Summary: | eglGetDisplay() is broken for Wayland | ||
---|---|---|---|
Product: | Mesa | Reporter: | Michael Olbrich <m.olbrich> |
Component: | EGL/Wayland | Assignee: | Wayland bug list <wayland-bugs> |
Status: | RESOLVED MOVED | QA Contact: | mesa-dev |
Severity: | normal | ||
Priority: | medium | ||
Version: | git | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | egldisplay-try-interface-name-for-wl-display.patch |
Description
Michael Olbrich
2017-11-15 12:03:13 UTC
eglGetDisplay() is by definition broken on multi-platform implementations, yes. Any reason you cannot use EGL_KHR_platform_wayland? (In reply to Pekka Paalanen from comment #1) > eglGetDisplay() is by definition broken on multi-platform implementations, > yes. Ugh. It is broken by definition, but Mesa does go to great lengths to try to make it work by auto-detecting: see _eglNativePlatformDetectNativeDisplay() inside src/egl/main/egldisplay.c. Michael, I'll attach a compiled but untested patch; can you please let me know if it helps? Created attachment 135490 [details] [review] egldisplay-try-interface-name-for-wl-display.patch <cheeky> I do recall mentioning that exposing the same symbol(s) will lead to bad experiences. Followed by some ideas... </cheeky> WRT eglGetDisplay - I'd recommend moving towards the EGL_*_platform_* extensions ASAP - EGL_EXT_platform_wayland or EGL_KHR_platform_wayland in this case. A better heuristic would be to use dladdr() for eglGetDisplay. See the analogous GBM patch [1]. https://patchwork.freedesktop.org/patch/187918/ (In reply to Emil Velikov from comment #4) > <cheeky> > I do recall mentioning that exposing the same symbol(s) will lead to bad > experiences. Followed by some ideas... > </cheeky> Yep, as per the discussion on inlining wayland_drm_buffer_get. :) It certainly hurts, but then again breaking ABI and forcing every single Wayland user to rebuild - probably having to change every symbol name in the API to make sure there was no clash between the two when loaded - would be uncharted depths of pain. On the other hand, the solution is the same: look at the interface name, rather than ever compare pointers equally. Unfortunately, we can't use the same solution since the wayland-drm one only works for wl_resource in libwayland-server rather than a plain wl_interface or a wl_proxy ... oh well. > A better heuristic would be to use dladdr() for eglGetDisplay. See the > analogous GBM patch [1]. I don't think that would necessarily fix it, particularly if the wayland-client.so.1 being loaded differed, e.g. due to people linking their own copies? (In reply to Daniel Stone from comment #2) > Michael, I'll attach a compiled but untested patch; can you please let me > know if it helps? Looks good. It does the right thing for wayland and drm at least. is _eglPointerIsDereferencable() sufficient to ensure that the whole string is accessible? (In reply to Michael Olbrich from comment #6) > (In reply to Daniel Stone from comment #2) > > > Michael, I'll attach a compiled but untested patch; can you please let me > > know if it helps? > > Looks good. It does the right thing for wayland and drm at least. > is _eglPointerIsDereferencable() sufficient to ensure that the whole string > is accessible? Good point - I guess it'd have to be if (_eglPointerIsDereferencable(child_pointer) && _eglPointerIsDereferencable(((char *) child_pointer) + strlen("wl_display") + 1) && strcmp(interface->name, "wl_display") == 0) ... ugh. Does that work for you? (In reply to Daniel Stone from comment #7) > Good point - I guess it'd have to be if > (_eglPointerIsDereferencable(child_pointer) && > _eglPointerIsDereferencable(((char *) child_pointer) + strlen("wl_display") > + 1) && strcmp(interface->name, "wl_display") == 0) ... ugh. Does that work > for you? Yes that works. (In reply to Pekka Paalanen from comment #1) > Any reason you cannot use EGL_KHR_platform_wayland? It's not my code. It's somewhere in gstreamer-vaapi. I was just debugging why my application was crashing. (In reply to Michael Olbrich from comment #9) > (In reply to Pekka Paalanen from comment #1) > > Any reason you cannot use EGL_KHR_platform_wayland? > > It's not my code. It's somewhere in gstreamer-vaapi. I was just debugging > why my application was crashing. Ok, while this issue is being worked on in Mesa, I would very much recommend filing a bug against gstreamer-vaapi to start using the EGL platform extensions whenever available. It's the only reliable way forward. -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/171. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.