aboutsummaryrefslogtreecommitdiff
path: root/render/egl.c
AgeCommit message (Collapse)Author
2022-06-12render/egl: don't leak memory on error returnbi4k8
2022-05-25render/egl: add wlr_egl_get_{context,display}Simon Ser
This allows compositors to integrate with the wlroots GLES2 renderer, if they need to perform custom GL rendering.
2022-03-14Free drmDevice in get_egl_device_from_drm_fd()Dean
2021-12-02render/egl: improve modifier support detectionSimon Ser
Support for EXT_image_dma_buf_import_modifiers doesn't necessarily indicate support for modifiers. For instance, Mesa will advertise EXT_image_dma_buf_import_modifiers for all drivers. This is a trick to allow EGL clients to enumerate supported formats (something EXT_image_dma_buf_import is missing). For more information, see [1]. Add a new wlr_egl.has_modifiers flag which indicates whether modifiers are supported. It's set to true if any eglQueryDmaBufModifiersEXT query returned a non-empty list. Use that flag to figure out whether the buffer modifier should be passed to the EGL implementation on import. [1]: https://github.com/KhronosGroup/EGL-Registry/issues/142
2021-12-01render/egl: add wlr_egl_create_with_contextSimon Ser
This allows creating a wlr_egl from an already-existing EGL display and context. This is useful to allow compositors to choose the exact EGL initialization parameters.
2021-12-01render/egl: store IMG_context_priority in wlr_eglSimon Ser
The next commit will split extension lookup and context initialization.
2021-11-26render/egl: always add LINEAR to supported modifiersSimon Ser
2021-11-26Require INVALID for implicit format modifiersSimon Ser
See [1] for the motivation. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
2021-11-09egl: use alts for EGL_EXT_device_enum, if missingCole Mickens
2021-10-27render/egl.c: Fix memory leaks in egl_createHaelwenn (lanodan) Monnier
calloc is moved to right before egl is called to avoid requiring to free() unused memory. Found via scan-build
2021-10-01Revert "Require INVALID for implicit format modifiers"Simon Ser
This reverts commit ea7357b70366588069c83f158e6a4eb2d3a702b3.
2021-10-01Revert "render/egl: always add LINEAR to supported modifiers"Simon Ser
This reverts commit 780052d4da0c93f9210dd87d2100b116af7ff308.
2021-10-01render/egl: always add LINEAR to supported modifiersSimon Ser
2021-10-01Require INVALID for implicit format modifiersSimon Ser
See [1] for the motivation. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
2021-08-25render/egl: reopen DRM node for GBMSimon Ser
This will be necessary for the next patch, to avoid messing up BO handles shared between the GL implementation and the DRM backend.
2021-07-27render/egl: initialize wlr_egl with EGL_PLATFORM_DEVICE_EXTSimon Zeni
Uses the EXT_device_query extension to get the EGL device matching the requested DRM file descriptor. If the extension is not supported or no device is found, the EGL device will be retrieved using GBM. Depends on the EGL_EXT_device_enumeration to get the list of EGL devices.
2021-07-27render/egl: fix typoyuiiio
2021-07-26render/egl: add support for EGL_EXT_device_drm_render_nodeSimon Ser
This EGL extension has been added in [1]. The upsides are: - We directly get a render node, instead of having to convert the primary node name to a render node name. - If EGL_DRM_RENDER_NODE_FILE_EXT returns NULL, that means there is no render node being used by the driver. [1]: https://github.com/KhronosGroup/EGL-Registry/pull/127
2021-07-23render/egl: set EGL_IMAGE_PRESERVED_KHRSimon Ser
Without setting this the EGL implementation is allowed to perform destructive actions on the buffer when imported: its contents become undefined. This is mostly a pedantic change, because Mesa processes the attrib and does absolutely nothing with it.
2021-07-12render/egl: rename wlr_egl.exts to better match KhronosSimon Ser
Khronos refers to extensions with their namespace as a prefix in uppercase. Change our naming to align with Khronos conventions. This also makes grepping easier.
2021-07-05render/egl: remove EGL_WL_bind_wayland_display supportSimon Ser
Our GLES2 renderer doesn't use it anymore, so we can drop it.
2021-06-30render/egl: replace wlr_egl_create with wlr_egl_create_with_drm_fdSimon Ser
We never create an EGL context with the platform set to something other than EGL_PLATFORM_GBM_KHR. Let's simplify wlr_egl_create by taking a DRM FD instead of a (platform, remote_display) tuple. This hides the internal details of creating an EGL context for a specific device. This will allow us to transparently use the device platform [1] when the time comes. [1]: https://github.com/swaywm/wlroots/pull/2671
2021-06-24render/egl: make most functions privateSimon Ser
The wlr_egl functions are mostly used internally by the GLES2 renderer. Let's reduce our API surface a bit by hiding them. If there are good use-cases for one of these, we can always make them public again. The functions mutating the current EGL context are not made private because e.g. Wayfire uses them.
2021-05-11render/egl: query and display EGL driver nameSimon Ser
GL_RENDERER typically displays a human-readable string for the name of the GPU, and EGL_VENDOR typically displays a human-readable string for the GPU manufacturer. EGL_DRIVER_NAME_EXT should give the name of the driver in use. References: https://github.com/KhronosGroup/EGL-Registry/commit/e8baa0bf39120803505c6e360e1e33af0d9b9745
2021-04-26Log drmGetDevices2 error codeSimon Ser
2021-04-26render/egl: fail on EGL_MESA_device_softwareSimon Zeni
2021-04-08render: remove wlr_texture_to_dmabufSimon Ser
This is unused in wlroots, and the use-cases for compositors are pretty niche since they can access the original DMA-BUF via the wlr_buffer.
2021-04-07render/egl: check "EGL_KHR_platform_gbm" for EGL gbm platformzccrs
See the https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_platform_gbm.txt example code. On EGL_PLATFORM_GBM_KHR platform, we should be check the "EGL_KHR_platform_gbm" extension. Change-Id: Icf11c07c2949841a80b10527fb09987257fbd63b
2021-04-06render/egl: stop relying on platform for high prioritySimon Ser
All backends use the GBM platform. We can't use it to figure out whether the DRM backend is used anymore. Let's just try to always request a high-priority EGL context. Failing to do so is not fatal.
2021-03-27render/egl, backend/wayland: add workaround for split render/display setupsSimon Ser
Split render/display setups have two separate devices: one display-only with a primary node, and one render-only with a render node. However in these cases the EGL implementation and the Wayland compositor will advertise the display device instead of the render device [1]. The EGL implementation will magically open the render device when the display device is passed in. So just pass the display device as if it were a render device. Maybe in the future Mesa will advertise the render device instead and we'll be able to remove this workaround. [1]: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4178
2021-03-15render/egl: don't fail on EGL_MESA_device_softwareSimon Ser
Mesa may advertise EGL_MESA_device_software even when hardware drivers are in use [1]. Demote the error to a warning until the Mesa bug is fixed. [1]: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4178 References: https://github.com/swaywm/wlroots/pull/2689
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-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-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: drop egl parameters from wlr_renderer_autocreateSimon Zeni
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.
2020-12-10egl: fix memory leakIlia Bozhinov
I have noticed this with LeakSanitizer, I hope these are all occurrences.
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-11-30render/egl: remove wlr_egl.external_only_dmabuf_formatsSimon Ser
Replace it with wlr_egl.dmabuf_render_formats.