Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

render/egl: initialize wlr_egl with EGL_PLATFORM_DEVICE_EXT #2671

Merged
merged 1 commit into from
Jul 27, 2021

Conversation

bl4ckb0ne
Copy link
Contributor

This function relies on the extension EGL_WL_bind_wayland_display being present. If not, the creation of wlr_egl will fallback on using GBM.

I see in the logs that the client extensions are being printed twice, would you prefer the fallback to be in wlr_egl_create_from_drm_fd rather than in wlr_renderer_autocreate_with_drm_fd?

I also I fixed an issue regarding eglMakeCurrent when processing the error, EGL_NO_DISPLAY is not a valid display handle and will cause an EGL_BAD_DISPLAY error.

As with other commands taking EGLDisplay parameters, if display is not a valid EGLDisplay handle, an EGL_BAD_DISPLAY error is generated. (Some implementations have chosen to allow EGL_NO_DISPLAY as a valid display parameter for eglMakeCurrent. This behavior is not portable to all EGL implementations, and should be considered as an undocumented vendor extension).

https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglMakeCurrent.xhtml

Fixes #2649

render/wlr_renderer.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
@emersion
Copy link
Member

Note, the Mesa MR that makes the device platform work is: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8638

render/egl.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
@emersion
Copy link
Member

Unfortunately this PR breaks split display/render devices. This happens because Mesa doesn't create an EGLDevice for the display-only device, even if kmsro would make it work. See https://gitlab.freedesktop.org/mesa/mesa/-/issues/4178.

@bl4ckb0ne
Copy link
Contributor Author

Want me to take a look at that issue?

@emersion
Copy link
Member

It's a tricky issue, I'm not sure what's the best way to fix it. I'd like to hear ideas from Mesa devs.

@bl4ckb0ne
Copy link
Contributor Author

I'll keep an eye on the issue then, let me know if I can do anything to help

render/egl.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
include/wlr/render/egl.h Outdated Show resolved Hide resolved
@emersion
Copy link
Member

emersion commented Apr 1, 2021

Unfortunately this PR breaks split display/render devices.

If we keep the GBM fallback, it should work fine. Unfortunately this means we can't get rid of GBM in the renderer yet.

@bl4ckb0ne bl4ckb0ne force-pushed the fallback_egl_drm_fd branch 2 times, most recently from 9423ed1 to d729cbc Compare April 6, 2021 20:50
@bl4ckb0ne
Copy link
Contributor Author

Alpine failure because of some python trouble

render/egl.c Show resolved Hide resolved
@bl4ckb0ne bl4ckb0ne force-pushed the fallback_egl_drm_fd branch 2 times, most recently from a5ac54c to 2f51cd9 Compare April 26, 2021 19:18
@bl4ckb0ne
Copy link
Contributor Author

The fix is finally in Mesa 21.1.0, I'll rebase the patch.

emersion added a commit to emersion/wlroots that referenced this pull request Jun 24, 2021
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]: swaywm#2671
render/egl.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
render/wlr_renderer.c Outdated Show resolved Hide resolved
@bl4ckb0ne bl4ckb0ne force-pushed the fallback_egl_drm_fd branch 2 times, most recently from 67c2699 to 8000140 Compare July 12, 2021 17:12
@emersion emersion changed the title render: add wlr_egl_create_from_drm_fd function render/egl: initialize wlr_egl with EGL_PLATFORM_DEVICE_EXT Jul 12, 2021
render/egl.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
render/egl.c Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
render/egl.c Show resolved Hide resolved
@bl4ckb0ne bl4ckb0ne force-pushed the fallback_egl_drm_fd branch 2 times, most recently from f2fb205 to bcdae12 Compare July 26, 2021 17:26
render/egl.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
render/egl.c Outdated Show resolved Hide resolved
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.
Copy link
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience. This version LGTM!

@emersion emersion merged commit 6f19295 into swaywm:master Jul 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

render/egl: use EGLDevice instead of the GBM platform
2 participants