[gtk/matthiasc/color-profiles: 3/4] wayland: Allow changing egl surfaces




commit ce549bde78849daefa54b9eb25fce412d23b345f
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Oct 1 16:46:45 2021 -0400

    wayland: Allow changing egl surfaces
    
    When the rendering setting changes, reset our
    egl surface. This causes us to create a new one
    with the proper EGLConfig the next time we need it.

 gdk/wayland/gdksurface-wayland.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 3febc604f5..14e6da0e97 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -5197,9 +5197,24 @@ gdk_wayland_surface_set_rendering (GdkSurface   *surface,
                                    GdkRendering  rendering)
 {
   GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
+  GdkWaylandDisplay *display_wayland =
+    GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
 
   g_return_if_fail (GDK_IS_WAYLAND_SURFACE (surface));
-  g_return_if_fail (impl->egl_surface == 0);
+
+  if (rendering == GDK_RENDERING_NONE ||
+      impl->rendering == rendering)
+    return;
 
   impl->rendering = rendering;
+
+  if (impl->egl_surface)
+    {
+      GDK_DISPLAY_NOTE (GDK_DISPLAY (display_wayland), OPENGL,
+                        g_message ("Rendering changed to %s, resetting egl surface",
+                        rendering == GDK_RENDERING_HDR ? "HDR" : "SDR"));
+
+      eglDestroySurface (display_wayland->egl_display, impl->egl_surface);
+      impl->egl_surface = NULL;
+    }
 }


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