(In reply to grulja from comment #15) > (In reply to Martin Stránský [:stransky] (ni? me) from comment #11) > > Actually the egl_dmbauf code works as expected but it doesn't consider XWayland scenario here or multi GPU setup. > > Jan I expect you want to upstream that code, right? In such case we should use general gtk calls to check used display type. > > > > You should use something like GdkIsWaylandDisplay(): > > https://searchfox.org/mozilla-central/rev/00ea1649b59d5f427979e2d6ba42be96f62d6e82/widget/gtk/WidgetUtilsGtk.cpp#103 > > > > To check if Firefox is running on Wayland. Otherwise you should use X11/EGL. > > Also EGL_PLATFORM_WAYLAND_KHR/EGL_PLATFORM_GBM_KHR is not optimal solution here but I don't know what code Google uses for it. > > > > This code is used only on Wayland, there is check in WebRTC for that: > https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/modules/desktop_capture/desktop_capturer.cc;l=105 Well, with Chrome/Chromimum moving to Wayland it would be good to fix that in general way and not hack it for Firefox only. Chrome/Chromimum will hit the same issues sooner or later (at least EGL/X11 ones and Wayland/XWayland scenarios on Intel/NVIDIA laptops). > > EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,...) uses default Wayland display and may broke in multi-display scenario (when testing on nested compositor for instance). Does EGL_PLATFORM_WAYLAND_KHR use actual Wayland display? > > From the documentation: > To obtain an EGLDisplay backed by a Wayland display, call eglGetPlatformDisplay with <platform> set to EGL_PLATFORM_WAYLAND_KHR. Bug 1773377 for instance. If you want GL to use correct display/setup as Firefox itself you need to create it directly over something which you're already using (recent X11/Wayland display connection or so). Otherwise GL tends to pick whatever it dares so you may end up with using NVIDIA on Wayland while Firefox is running X11 on Intel as this bug says :)
Bug 1819035 Comment 18 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to grulja from comment #15) > (In reply to Martin Stránský [:stransky] (ni? me) from comment #11) > > Actually the egl_dmbauf code works as expected but it doesn't consider XWayland scenario here or multi GPU setup. > > Jan I expect you want to upstream that code, right? In such case we should use general gtk calls to check used display type. > > > > You should use something like GdkIsWaylandDisplay(): > > https://searchfox.org/mozilla-central/rev/00ea1649b59d5f427979e2d6ba42be96f62d6e82/widget/gtk/WidgetUtilsGtk.cpp#103 > > > > To check if Firefox is running on Wayland. Otherwise you should use X11/EGL. > > Also EGL_PLATFORM_WAYLAND_KHR/EGL_PLATFORM_GBM_KHR is not optimal solution here but I don't know what code Google uses for it. > > > > This code is used only on Wayland, there is check in WebRTC for that: > https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/modules/desktop_capture/desktop_capturer.cc;l=105 Well, with Chrome/Chromimum moving to Wayland it would be good to fix that in general way and not hack it for Firefox only. Chrome/Chromimum will hit the same issues sooner or later (at least EGL/X11 ones and Wayland/XWayland scenarios on Intel/NVIDIA laptops). > > EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,...) uses default Wayland display and may broke in multi-display scenario (when testing on nested compositor for instance). Does EGL_PLATFORM_WAYLAND_KHR use actual Wayland display? > > From the documentation: > To obtain an EGLDisplay backed by a Wayland display, call eglGetPlatformDisplay with <platform> set to EGL_PLATFORM_WAYLAND_KHR. See Bug 1773377 for instance. If you want GL to use correct display/setup as Firefox itself you need to create it directly over something which you're already using (recent X11/Wayland display connection or so). Otherwise GL tends to pick whatever it dares so you may end up with using NVIDIA on Wayland while Firefox is running X11 on Intel as this bug says :)