aboutsummaryrefslogtreecommitdiff
path: root/render
AgeCommit message (Collapse)Author
2021-02-02render/dmabuf: cleanup on wlr_dmabuf_attributes_copy errorSimon Ser
2021-02-01render/wlr_texture: clamp texture coordinates to edge by defaultQuantum
Clamping texture coordinates prevents OpenGL from blending the left and right edge (or top and bottom edge) when scaling textures with GL_LINEAR filtering. This prevents visual artifacts like swaywm/sway#5809. Per discussion on IRC, this behaviour is made default. Compositors that want the wrapping behaviour (e.g. for tiled patterns) can override this by doing: struct wlr_gles2_texture_attribs attribs; wlr_gles2_texture_get_attribs(texture, &attribs); glBindTexture(attribs.target, attribs.tex); glTexParameteri(attribs.target, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(attribs.target, GL_TEXTURE_WRAP_T, GL_REPEAT); glBindTexture(attribs.target, 0);
2021-02-01render/egl: log whether DMA-BUF modifiers are supportedSimon Ser
2021-02-01render/egl: add check for EGL_KHR_surfaceless_contextBrandon Dowdy
As surfaces are no longer going to be used for wlr_egl, I may as well just go and add this check as it is needed for safety whenever surface-less rendering is being used.
2021-01-29render/egl: remove *config_attribs and wlr_egl->configBrandon Dowdy
Breaking changes: Both "EGLint *config_attribs" and "wlr_egl->config" no longer exist.
2021-01-29render/egl: remove wlr_egl_{create,destroy}_surfaceBrandon Dowdy
Breaking changes: wlr_egl_create_surface and wlr_egl_destroy_surface have been removed and no longer exist.
2021-01-27render/egl: fix NULL dereference when using llvmpipeSimon Ser
Fixes: 6becc69ec90c ("render/egl: fail to create wlr_egl on software renderer")
2021-01-27render/egl: fail to create wlr_egl on software rendererSimon Zeni
The creation of `wlr_egl` will fail is the device extension EGL_MESA_device_software is defined. The creation process is allowed to continue only if the environment variable `WLR_RENDERER_ALLOW_SOFTWARE` is defined to the value 1.
2021-01-23render/gbm_allocator: avoid drmPrimeHandleToFDSimon Ser
Some drivers (e.g. nouveau) need to do some book-keeping when exporting a BO handle to a DMA-BUF [1]. Using drmPrimeHandleToFD directly hides the export from the user-space drivers and causes some ref'counting issues. So we can't properly handle BOs with a different handle for each plane until [2] lands. [1]: https://gitlab.freedesktop.org/drm/nouveau/-/issues/43#note_772661 [2]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5442 Suggested-by: Ilia Mirkin <imirkin@alum.mit.edu>
2021-01-20Revert "render: add wlr_egl_create_from_drm_fd function"Simon Ser
This reverts commit ee31be167b4e2c4682f3da6f22bddc23796f213d.
2021-01-20Revert "render/egl: remove unused gbm_device member"Simon Ser
This reverts commit 306cf11d8702c82be61e027a9bb76e27e89b34d3.
2021-01-20render/egl: remove unused gbm_device memberSimon Zeni
2021-01-20render: add wlr_egl_create_from_drm_fd functionSimon Zeni
2021-01-17render/gbm_allocator: set modifier to INVALID if implicitSimon Ser
When gbm_bo_create is used and the GBM implementation does support modifiers, gbm_bo_get_modifier may return something other than DRM_FORMAT_MOD_INVALID. This can cause issues with the rest of the stack (e.g. EGL or KMS) in case these don't support modifiers. Instead, force the modifier to INVALID, to make sure no one uses modifiers.
2021-01-17render/gbm_allocator: export to DMA-BUF on initSimon Ser
Instead of lazily exporting BOs to DMA-BUFs, do it on init. This is the only way to use the buffer, so there's no point in deferring that work. This is preparatory work for the next commit.
2021-01-16render: introduce private wlr_renderer_autocreate_with_drm_fdSimon Ser
2021-01-16render/egl: fix gbm_device use-after-freeSimon Ser
The GBM device needs to be destroyed after the EGL display. ==50931==ERROR: AddressSanitizer: SEGV on unknown address 0x7fe40a000049 (pc 0x7fe446121d30 bp 0x60400001bbd0 sp 0x7ffc99c774d0 T0) ==50931==The signal is caused by a READ memory access. #0 0x7fe446121d30 (/usr/lib/dri/radeonsi_dri.so+0x5f0d30) #1 0x7fe4474717bd (/usr/lib/../lib/libEGL_mesa.so.0+0x177bd) #2 0x7fe4474677d9 (/usr/lib/../lib/libEGL_mesa.so.0+0xd7d9) #3 0x7fe44cca7b6f in wlr_egl_destroy ../subprojects/wlroots/render/egl.c:379 #4 0x7fe44ccc2626 in gles2_destroy ../subprojects/wlroots/render/gles2/renderer.c:705 #5 0x7fe44ccb5041 in wlr_renderer_destroy ../subprojects/wlroots/render/wlr_renderer.c:37 #6 0x7fe44cd17850 in backend_destroy ../subprojects/wlroots/backend/wayland/backend.c:296 #7 0x7fe44ccca4de in wlr_backend_destroy ../subprojects/wlroots/backend/backend.c:48 #8 0x7fe44cd11b21 in multi_backend_destroy ../subprojects/wlroots/backend/multi/backend.c:58 #9 0x7fe44cd125b0 in handle_display_destroy ../subprojects/wlroots/backend/multi/backend.c:125 #10 0x7fe44c315e0e (/usr/lib/libwayland-server.so.0+0x8e0e) #11 0x7fe44c3165a6 in wl_display_destroy (/usr/lib/libwayland-server.so.0+0x95a6) #12 0x55a2c8870683 in server_fini ../sway/server.c:203 #13 0x55a2c886cbf2 in main ../sway/main.c:436 #14 0x7fe44b77c151 in __libc_start_main (/usr/lib/libc.so.6+0x28151) #15 0x55a2c883172d in _start (/home/simon/src/sway/build/sway/sway+0x33472d)
2021-01-16render/gles2: make EGL context current in bind_bufferSimon Ser
Instead of requiring callers to manually make the EGL context current before binding a buffer and unsetting it after unbinding a buffer, do it inside wlr_renderer_bind_buffer. This hides renderer-specific implementation details inside the wlr_renderer interface. Non-GLES2 renderers may not use EGL. This removes all EGL dependencies from the backends. References: https://github.com/swaywm/wlroots/issues/2618 References: https://github.com/swaywm/wlroots/pull/2615#issuecomment-756687006
2021-01-16render: drop egl parameters from wlr_renderer_autocreateSimon Zeni
2021-01-15render: extract gles2 build files to subdirSimon Ser
This will make it easier to toggle when we make our GLES2 renderer optional.
2021-01-15render/gbm_allocator: fix gbm_device use-after-freeSimon Ser
We need to destroy any gbm_bo we've created before gbm_device_destroy. Closes: https://github.com/swaywm/wlroots/issues/2601
2021-01-15render/gbm_allocator: log GBM backend nameSimon Ser
2021-01-15render/gles2: restore EGL context after texture operationsSimon Ser
It can be surprising and unexpected that texture operations (such as texture upload and import) change the current EGL context, especially when it's done under-the-hood by wlroots in response to wl_surface requests. To prevent surprises, save and restore the previous EGL context.
2021-01-14render/gles2: save/restore EGL context in destroy_bufferSimon Ser
It can be surprising that destroying a buffer changes the EGL context, especially since this can be triggered from anywhere wlr_buffer_unlock is called. Prevent this from happening by saving and restoring the EGL context.
2021-01-12render/egl: remove surface and buffer age args from make_currentSimon Ser
These aren't used anymore.
2021-01-12render/egl: replace init/finish with create/destroySimon Ser
This ensures wlr_gles2_renderer can properly take ownership of the wlr_egl. Closes: https://github.com/swaywm/wlroots/issues/2612
2021-01-12render/egl: remove wlr_egl_swap_buffersSimon Ser
2021-01-12render/egl: remove support for EGL_NATIVE_VISUAL_IDSimon Ser
Nobody uses it anymore.
2021-01-12render/gles2: fix EGL use-after-freeSimon Ser
The wlr_egl was cleaned up too early. While at it, also fix a memory leak. Fixes: b899a412e3eb ("backend: remove wlr_egl from all backends")
2021-01-07backend: remove wlr_egl from all backendsSimon Zeni
2021-01-06render: remove EGL config and visual from wlr_renderer_autocreateSimon Ser
This isn't used anymore by any backend. Some examples still provide an EGL config to wlr_egl_init, so we can't drop it yet there.
2020-12-30render/drm_format_set: add special case for LINEAR-only formatsSimon Ser
Our wlr_format_set structs don't hold GBM usage flags. Instead, users who want to get a LINEAR buffer can use the DRM_FORMAT_MOD_LINEAR modifier even if the kernel driver doesn't support modifiers. Add a special case to wlr_drm_format_intersect to properly handle this situation.
2020-12-25Stop using wlr_texture_get_sizeSimon Ser
Just use wlr_texture.{width,height} directly.
2020-12-18render/drm_format_set: add wlr_drm_format_{create,add}Simon Ser
2020-12-17render/allocator: ignore NULL in wlr_allocator_destroySimon Ser
2020-12-15render/gles2: require GL_EXT_unpack_subimageSimon Ser
We implicitly depended on this extension.
2020-12-10egl: fix memory leakIlia Bozhinov
I have noticed this with LeakSanitizer, I hope these are all occurrences.
2020-12-09render/gles2: query alpha size from render bufferSimon Ser
If we're using a render buffer, query the alpha size from it. Closes: https://github.com/swaywm/wlroots/issues/2527
2020-12-09render/gles2: don't eglGetConfigAttrib on EGL_NO_CONFIG_KHRSimon Ser
If we don't have an EGL config, don't try to query anything from it.
2020-12-08render/drm_format_set: assert len <= cap when duplicatingSimon Ser
2020-12-08render/drm_format_set: allocate using cap when duplicatingSimon Ser
In wlr_drm_format_dup, allocate the new wlr_drm_format using cap instead of len. This makes it so the cap field is up-to-date and the chunk of memory isn't too small if we append new modifiers (we don't allow this yet but might in the future).
2020-12-07render/egl: support config-less wlr_eglSimon Ser
When using wlr_swapchain, there's no need to select an EGLConfig. Add support for creating config-less EGL contexts.
2020-12-03render/drm_format_set: introduce wlr_drm_format_intersectSimon Ser
Intersects modifiers from two wlr_drm_format structs. If either format doesn't support modifiers, the resulting format won't support modifiers.
2020-11-30render/egl: remove wlr_egl.external_only_dmabuf_formatsSimon Ser
Replace it with wlr_egl.dmabuf_render_formats.
2020-11-30render: assert {X,A}RGB8888 are supportedSimon Ser
The Wayland protocol requires those to be supported.
2020-11-30render: rename wlr_renderer_get_formatsSimon Ser
Rename wlr_renderer_get_formats to wlr_renderer_get_shm_texture_formats. This makes it clear those formats are only suitable for shm import.
2020-11-30render: rename wlr_renderer_get_dmabuf_formatsSimon Ser
Rename wlr_renderer_get_dmabuf_formats to wlr_renderer_get_dmabuf_texture_formats. This makes it clear the formats are only suitable for creating wlr_textures.
2020-11-30render: introduce wlr_renderer_get_dmabuf_render_formatsSimon Ser
It describes which DMA-BUF formats can be used to render.
2020-11-30render: remove wlr_renderer_format_supportedSimon Ser
Instead, callers can just use wlr_renderer_get_formats and iterate over the list. This function was unused in wlroots.
2020-11-28render/egl: don't rely on being able to open primary nodeSimon Ser
On some setups (e.g. remote access via SSH) the current user won't have the permission to open the primary node at all. It's still possible to use drmGetDevices to match the primary node name returned by EGL. Closes: https://github.com/swaywm/wlroots/issues/2488