[gnome-remote-desktop] egl: Use Wayland platform instead of surfaceless



commit 6eb4ae4d683d0f3a70fa27de89c9170296d94839
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Apr 22 11:05:21 2022 +0200

    egl: Use Wayland platform instead of surfaceless
    
    When using EGL for downloading DMA buffers, and if we're on a system
    with both an Intel GPU and an NVIDIA GPU using the proprietary driver,
    using the surfaceless EGL platform will not work, as it may end up a
    different GPU than what was used by the display server. This would
    normally not be a problem, since the free drivers know how to handle
    this, but with the proprietary NVIDIA driver, importing the DMA buffers
    will fail, resulting in black screens.
    
    Work around this issue by creating a EGL display using the Wayland EGL
    platform. While we're not going to use anything directly Wayland
    related, what it means is we piggy back on the GPU selection mechanism
    used to end up with the likely correct GPU used for the EGL context,
    meaning DMA buffer imports starts to work and we get the correct content
    again.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/89

 src/grd-egl-thread.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/src/grd-egl-thread.c b/src/grd-egl-thread.c
index e4fdcf93..444b1eec 100644
--- a/src/grd-egl-thread.c
+++ b/src/grd-egl-thread.c
@@ -278,16 +278,8 @@ initialize_egl_context (GrdEglThread  *egl_thread,
       return FALSE;
     }
 
-  if (egl_platform == EGL_PLATFORM_SURFACELESS_MESA)
+  if (egl_platform == EGL_PLATFORM_WAYLAND_EXT)
     {
-      if (!epoxy_has_egl_extension (egl_display, "EGL_MESA_platform_surfaceless"))
-        {
-          eglTerminate (egl_display);
-          g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-                       "Missing extension 'EGL_MESA_platform_surfaceless'");
-          return FALSE;
-        }
-
       if (!epoxy_has_egl_extension (egl_display, "EGL_MESA_configless_context"))
         {
           eglTerminate (egl_display);
@@ -372,12 +364,12 @@ grd_egl_init_in_impl (GrdEglThread  *egl_thread,
     }
 
   initialized = initialize_egl_context (egl_thread,
-                                        EGL_PLATFORM_SURFACELESS_MESA,
+                                        EGL_PLATFORM_WAYLAND_EXT,
                                         error);
   if (initialized)
     {
       g_debug ("EGL context initialized with platform "
-               "EGL_PLATFORM_SURFACELESS_MESA");
+               "EGL_PLATFORM_WAYLAND_EXT");
     }
   else
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]