kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone

Blame SOURCES/handle-hotplug-better.patch

7cc7ff
From d442ef48412e3dc1b24a9f97b02ee3383404d501 Mon Sep 17 00:00:00 2001
7cc7ff
From: Emil Velikov <emil.velikov@collabora.com>
7cc7ff
Date: Wed, 12 Jun 2019 16:58:54 +0000
7cc7ff
Subject: [PATCH 1/8] renderer/native: add missing eglTerminate in EGLDevice
7cc7ff
 error path
7cc7ff
MIME-Version: 1.0
7cc7ff
Content-Type: text/plain; charset=UTF-8
7cc7ff
Content-Transfer-Encoding: 8bit
7cc7ff
7cc7ff
Currently the EGLDevice code gets the display and calls eglInitialize.
7cc7ff
As a follow-up it checks the required EGL extensions - technically it
7cc7ff
could check the EGL device extensions earlier.
7cc7ff
7cc7ff
In either case, eglTerminate is missing. Thus the connection to the
7cc7ff
display was still bound.
7cc7ff
7cc7ff
This was highlighted with Mesa commit d6edccee8da ("egl: add
7cc7ff
EGL_platform_device support") + amdgpu.
7cc7ff
7cc7ff
In that case, since the eglTerminate is missing, we end up reusing the
7cc7ff
underlying amdgpu_device due to some caching in libdrm_amdgpu. The
7cc7ff
latter in itself being a good solution since it allows buffer sharing
7cc7ff
across primary and render node of the same device.
7cc7ff
7cc7ff
Note: we should really get this in branches all the way back to 3.30.
7cc7ff
7cc7ff
https://gitlab.gnome.org/GNOME/mutter/merge_requests/619
7cc7ff
7cc7ff
Fixes: 934184e23 ("MetaRendererNative: Add EGLDevice based rendering support")
7cc7ff
Cc: Jonas Ã…dahl <jadahl@gmail.com>
7cc7ff
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7cc7ff
7cc7ff
7cc7ff
(cherry picked from commit 9213574870faee7fe40609791fc48f4b44f861c0)
7cc7ff
---
7cc7ff
 src/backends/native/meta-renderer-native.c | 1 +
7cc7ff
 1 file changed, 1 insertion(+)
7cc7ff
7cc7ff
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
7cc7ff
index dbfc97aae..207b654fa 100644
7cc7ff
--- a/src/backends/native/meta-renderer-native.c
7cc7ff
+++ b/src/backends/native/meta-renderer-native.c
7cc7ff
@@ -4038,6 +4038,7 @@ create_renderer_gpu_data_egl_device (MetaRendererNative  *renderer_native,
7cc7ff
                    G_IO_ERROR_FAILED,
7cc7ff
                    "Missing EGL extensions required for EGLDevice renderer: %s",
7cc7ff
                    missing_extensions_str);
7cc7ff
+      meta_egl_terminate (egl, egl_display, NULL);
7cc7ff
       g_free (missing_extensions_str);
7cc7ff
       g_free (missing_extensions);
7cc7ff
       return NULL;
7cc7ff
-- 
7cc7ff
2.24.1
7cc7ff
7cc7ff
7cc7ff
From e18dfc888343585d21b3f64568571009c4967a95 Mon Sep 17 00:00:00 2001
7cc7ff
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
7cc7ff
Date: Mon, 17 Jun 2019 18:18:12 +0200
7cc7ff
Subject: [PATCH 2/8] renderer/native: Use g_set_error() instead of
7cc7ff
 _cogl_set_error()
7cc7ff
7cc7ff
It's even a GError, so lets use the proper API.
7cc7ff
7cc7ff
https://gitlab.gnome.org/GNOME/mutter/merge_requests/622
7cc7ff
(cherry picked from commit 1efb32d3000ca06ee3cfcc146dc812866d243619)
7cc7ff
---
7cc7ff
 src/backends/native/meta-renderer-native.c | 2 +-
7cc7ff
 1 file changed, 1 insertion(+), 1 deletion(-)
7cc7ff
7cc7ff
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
7cc7ff
index 207b654fa..e7aa6f389 100644
7cc7ff
--- a/src/backends/native/meta-renderer-native.c
7cc7ff
+++ b/src/backends/native/meta-renderer-native.c
7cc7ff
@@ -1277,7 +1277,7 @@ meta_renderer_native_egl_context_created (CoglDisplay *cogl_display,
7cc7ff
                                       cogl_display_egl->dummy_surface,
7cc7ff
                                       cogl_display_egl->egl_context))
7cc7ff
     {
7cc7ff
-      _cogl_set_error (error, COGL_WINSYS_ERROR,
7cc7ff
+      g_set_error (error, COGL_WINSYS_ERROR,
7cc7ff
                    COGL_WINSYS_ERROR_CREATE_CONTEXT,
7cc7ff
                    "Failed to make context current");
7cc7ff
       return FALSE;
7cc7ff
-- 
7cc7ff
2.24.1
7cc7ff
7cc7ff
7cc7ff
From 1947a81db93624d57471ce1edf5548c7774c3569 Mon Sep 17 00:00:00 2001
7cc7ff
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
7cc7ff
Date: Mon, 17 Jun 2019 18:18:42 +0200
7cc7ff
Subject: [PATCH 3/8] renderer/native: Make sure we're not destroying an active
7cc7ff
 EGLSurface
7cc7ff
7cc7ff
When making a new surface/context pair current, mesa may want to flush
7cc7ff
the old context. Make sure we don't try to flush any freed memory by
7cc7ff
unmaking a surface/context pair current before freeing it.
7cc7ff
7cc7ff
Not doing this results in the following valgrind warnings:
7cc7ff
7cc7ff
==15986== Invalid read of size 8
7cc7ff
==15986==    at 0x69A6D80: dri_flush_front_buffer (gbm_dri.c:92)
7cc7ff
==15986==    by 0x1750D458: intel_flush_front (brw_context.c:251)
7cc7ff
==15986==    by 0x1750D4BB: intel_glFlush (brw_context.c:296)
7cc7ff
==15986==    by 0x1739D8DD: dri2_make_current (egl_dri2.c:1461)
7cc7ff
==15986==    by 0x17393A3A: eglMakeCurrent (eglapi.c:869)
7cc7ff
==15986==    by 0x54381FB: InternalMakeCurrentVendor (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
7cc7ff
==15986==    by 0x5438515: eglMakeCurrent (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
7cc7ff
==15986==    by 0x522A782: _cogl_winsys_egl_make_current (cogl-winsys-egl.c:303)
7cc7ff
==15986==    by 0x49B64C8: meta_renderer_native_create_view (meta-renderer-native.c:3076)
7cc7ff
==15986==    by 0x48D26E7: meta_renderer_create_view (meta-renderer.c:78)
7cc7ff
==15986==    by 0x48D277A: meta_renderer_rebuild_views (meta-renderer.c:111)
7cc7ff
==15986==    by 0x49BF46E: meta_stage_native_rebuild_views (meta-stage-native.c:142)
7cc7ff
==15986==  Address 0x1b076600 is 0 bytes inside a block of size 48 free'd
7cc7ff
==15986==    at 0x4839A0C: free (vg_replace_malloc.c:540)
7cc7ff
==15986==    by 0x49B59F3: meta_renderer_native_release_onscreen (meta-renderer-native.c:2651)
7cc7ff
==15986==    by 0x5211441: _cogl_onscreen_free (cogl-onscreen.c:167)
7cc7ff
==15986==    by 0x5210D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51)
7cc7ff
==15986==    by 0x51D0066: _cogl_object_default_unref (cogl-object.c:103)
7cc7ff
==15986==    by 0x520F989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814)
7cc7ff
==15986==    by 0x51D00B1: cogl_object_unref (cogl-object.c:115)
7cc7ff
==15986==    by 0x536F3C7: clutter_stage_view_dispose (clutter-stage-view.c:304)
7cc7ff
==15986==    by 0x4B7DAF2: g_object_unref (gobject.c:3309)
7cc7ff
==15986==    by 0x4A9596C: g_list_foreach (glist.c:1013)
7cc7ff
==15986==    by 0x4A9599A: g_list_free_full (glist.c:223)
7cc7ff
==15986==    by 0x48D2737: meta_renderer_rebuild_views (meta-renderer.c:100)
7cc7ff
==15986==  Block was alloc'd at
7cc7ff
==15986==    at 0x483AB1A: calloc (vg_replace_malloc.c:762)
7cc7ff
==15986==    by 0x69A76B2: gbm_dri_surface_create (gbm_dri.c:1252)
7cc7ff
==15986==    by 0x69A6BFE: gbm_surface_create (gbm.c:600)
7cc7ff
==15986==    by 0x49B4E29: meta_renderer_native_create_surface_gbm (meta-renderer-native.c:2221)
7cc7ff
==15986==    by 0x49B57DB: meta_onscreen_native_allocate (meta-renderer-native.c:2569)
7cc7ff
==15986==    by 0x49B6423: meta_renderer_native_create_view (meta-renderer-native.c:3062)
7cc7ff
==15986==    by 0x48D26E7: meta_renderer_create_view (meta-renderer.c:78)
7cc7ff
==15986==    by 0x48D277A: meta_renderer_rebuild_views (meta-renderer.c:111)
7cc7ff
==15986==    by 0x49BF46E: meta_stage_native_rebuild_views (meta-stage-native.c:142)
7cc7ff
==15986==    by 0x49A75B5: meta_backend_native_update_screen_size (meta-backend-native.c:520)
7cc7ff
==15986==    by 0x48B01BB: meta_backend_sync_screen_size (meta-backend.c:224)
7cc7ff
==15986==    by 0x48B09B7: meta_backend_real_post_init (meta-backend.c:501)
7cc7ff
7cc7ff
https://gitlab.gnome.org/GNOME/mutter/merge_requests/622
7cc7ff
(cherry picked from commit 56ddaaa3809240a357b5e19b5789d1aa49aaecc3)
7cc7ff
---
7cc7ff
 src/backends/native/meta-renderer-native.c | 13 +++++++++++++
7cc7ff
 1 file changed, 13 insertions(+)
7cc7ff
7cc7ff
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
7cc7ff
index e7aa6f389..b7bc3121a 100644
7cc7ff
--- a/src/backends/native/meta-renderer-native.c
7cc7ff
+++ b/src/backends/native/meta-renderer-native.c
7cc7ff
@@ -3040,6 +3040,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
7cc7ff
 {
7cc7ff
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
7cc7ff
   CoglContext *cogl_context = framebuffer->context;
7cc7ff
+  CoglDisplay *cogl_display = cogl_context_get_display (cogl_context);
7cc7ff
+  CoglDisplayEGL *cogl_display_egl = cogl_display->winsys;
7cc7ff
   CoglRenderer *cogl_renderer = cogl_context->display->renderer;
7cc7ff
   CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
7cc7ff
   CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
7cc7ff
@@ -3052,6 +3054,17 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
7cc7ff
 
7cc7ff
   onscreen_native = onscreen_egl->platform;
7cc7ff
 
7cc7ff
+  if (onscreen_egl->egl_surface != EGL_NO_SURFACE &&
7cc7ff
+      (cogl_display_egl->current_draw_surface == onscreen_egl->egl_surface ||
7cc7ff
+       cogl_display_egl->current_read_surface == onscreen_egl->egl_surface))
7cc7ff
+    {
7cc7ff
+      if (!_cogl_winsys_egl_make_current (cogl_display,
7cc7ff
+                                          cogl_display_egl->dummy_surface,
7cc7ff
+                                          cogl_display_egl->dummy_surface,
7cc7ff
+                                          cogl_display_egl->egl_context))
7cc7ff
+        g_warning ("Failed to clear current context");
7cc7ff
+    }
7cc7ff
+
7cc7ff
   g_list_free_full (onscreen_native->pending_page_flip_retries,
7cc7ff
                     (GDestroyNotify) retry_page_flip_data_free);
7cc7ff
   if (onscreen_native->retry_page_flips_source)
7cc7ff
-- 
7cc7ff
2.24.1
7cc7ff
7cc7ff
7cc7ff
From 60551e5e6f984a7ed3ba3339f027ed7b37f802c4 Mon Sep 17 00:00:00 2001
7cc7ff
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
7cc7ff
Date: Mon, 17 Jun 2019 19:16:12 +0200
7cc7ff
Subject: [PATCH 4/8] renderer/native: Fix EGLSurface destruction order
7cc7ff
7cc7ff
Make sure to destroy the EGL surface after releasing held buffers,
7cc7ff
otherwise we'll get the following valgrind warnings:
7cc7ff
7cc7ff
==24016== Invalid read of size 8
7cc7ff
==24016==    at 0x1739943F: release_buffer (platform_drm.c:73)
7cc7ff
==24016==    by 0x49AC355: meta_drm_buffer_gbm_finalize (meta-drm-buffer-gbm.c:213)
7cc7ff
==24016==    by 0x4B75B61: g_object_unref (gobject.c:3346)
7cc7ff
==24016==    by 0x49B4B41: free_current_bo (meta-renderer-native.c:991)
7cc7ff
==24016==    by 0x49B816F: meta_renderer_native_release_onscreen (meta-renderer-native.c:2971)
7cc7ff
==24016==    by 0x5209441: _cogl_onscreen_free (cogl-onscreen.c:167)
7cc7ff
==24016==    by 0x5208D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51)
7cc7ff
==24016==    by 0x51C8066: _cogl_object_default_unref (cogl-object.c:103)
7cc7ff
==24016==    by 0x5207989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814)
7cc7ff
==24016==    by 0x51C80B1: cogl_object_unref (cogl-object.c:115)
7cc7ff
==24016==    by 0x53673C7: clutter_stage_view_dispose (clutter-stage-view.c:304)
7cc7ff
==24016==    by 0x4B75AF2: g_object_unref (gobject.c:3309)
7cc7ff
==24016==  Address 0x18e742a8 is 536 bytes inside a block of size 784 free'd
7cc7ff
==24016==    at 0x4839A0C: free (vg_replace_malloc.c:540)
7cc7ff
==24016==    by 0x17399764: dri2_drm_destroy_surface (platform_drm.c:231)
7cc7ff
==24016==    by 0x1738550A: eglDestroySurface (eglapi.c:1145)
7cc7ff
==24016==    by 0x5440286: eglDestroySurface (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
7cc7ff
==24016==    by 0x49613A5: meta_egl_destroy_surface (meta-egl.c:432)
7cc7ff
==24016==    by 0x49B80F9: meta_renderer_native_release_onscreen (meta-renderer-native.c:2954)
7cc7ff
==24016==    by 0x5209441: _cogl_onscreen_free (cogl-onscreen.c:167)
7cc7ff
==24016==    by 0x5208D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51)
7cc7ff
==24016==    by 0x51C8066: _cogl_object_default_unref (cogl-object.c:103)
7cc7ff
==24016==    by 0x5207989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814)
7cc7ff
==24016==    by 0x51C80B1: cogl_object_unref (cogl-object.c:115)
7cc7ff
==24016==    by 0x53673C7: clutter_stage_view_dispose (clutter-stage-view.c:304)
7cc7ff
==24016==  Block was alloc'd at
7cc7ff
==24016==    at 0x483AB1A: calloc (vg_replace_malloc.c:762)
7cc7ff
==24016==    by 0x173997AE: dri2_drm_create_window_surface (platform_drm.c:145)
7cc7ff
==24016==    by 0x17388906: _eglCreateWindowSurfaceCommon (eglapi.c:929)
7cc7ff
==24016==    by 0x5440197: eglCreateWindowSurface (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
7cc7ff
==24016==    by 0x49612FF: meta_egl_create_window_surface (meta-egl.c:396)
7cc7ff
==24016==    by 0x49B752E: meta_renderer_native_create_surface_gbm (meta-renderer-native.c:2538)
7cc7ff
==24016==    by 0x49B7E6C: meta_onscreen_native_allocate (meta-renderer-native.c:2870)
7cc7ff
==24016==    by 0x49B8BCF: meta_renderer_native_create_view (meta-renderer-native.c:3387)
7cc7ff
==24016==    by 0x48D274B: meta_renderer_create_view (meta-renderer.c:78)
7cc7ff
==24016==    by 0x48D27DE: meta_renderer_rebuild_views (meta-renderer.c:111)
7cc7ff
==24016==    by 0x49BB4FB: meta_stage_native_rebuild_views (meta-stage-native.c:142)
7cc7ff
==24016==    by 0x49A733C: meta_backend_native_update_screen_size (meta-backend-native.c:517)
7cc7ff
7cc7ff
https://gitlab.gnome.org/GNOME/mutter/merge_requests/622
7cc7ff
(cherry picked from commit d9fb11b04319c00fd89715dd9207fe54e1d18c2d)
7cc7ff
---
7cc7ff
 src/backends/native/meta-renderer-native.c | 38 +++++++++++++++-------
7cc7ff
 1 file changed, 27 insertions(+), 11 deletions(-)
7cc7ff
7cc7ff
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
7cc7ff
index b7bc3121a..62c27c191 100644
7cc7ff
--- a/src/backends/native/meta-renderer-native.c
7cc7ff
+++ b/src/backends/native/meta-renderer-native.c
7cc7ff
@@ -3035,6 +3035,28 @@ meta_onscreen_native_allocate (CoglOnscreen *onscreen,
7cc7ff
   return TRUE;
7cc7ff
 }
7cc7ff
 
7cc7ff
+static void
7cc7ff
+destroy_egl_surface (CoglOnscreen *onscreen)
7cc7ff
+{
7cc7ff
+  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
7cc7ff
+
7cc7ff
+  if (onscreen_egl->egl_surface != EGL_NO_SURFACE)
7cc7ff
+    {
7cc7ff
+      MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
7cc7ff
+      MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
7cc7ff
+      CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
7cc7ff
+      CoglContext *cogl_context = framebuffer->context;
7cc7ff
+      CoglRenderer *cogl_renderer = cogl_context->display->renderer;
7cc7ff
+      CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
7cc7ff
+
7cc7ff
+      meta_egl_destroy_surface (egl,
7cc7ff
+                                cogl_renderer_egl->edpy,
7cc7ff
+                                onscreen_egl->egl_surface,
7cc7ff
+                                NULL);
7cc7ff
+      onscreen_egl->egl_surface = EGL_NO_SURFACE;
7cc7ff
+    }
7cc7ff
+}
7cc7ff
+
7cc7ff
 static void
7cc7ff
 meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
7cc7ff
 {
7cc7ff
@@ -3077,17 +3099,6 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
7cc7ff
                        g_source_destroy);
7cc7ff
     }
7cc7ff
 
7cc7ff
-  if (onscreen_egl->egl_surface != EGL_NO_SURFACE)
7cc7ff
-    {
7cc7ff
-      MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
7cc7ff
-
7cc7ff
-      meta_egl_destroy_surface (egl,
7cc7ff
-                                cogl_renderer_egl->edpy,
7cc7ff
-                                onscreen_egl->egl_surface,
7cc7ff
-                                NULL);
7cc7ff
-      onscreen_egl->egl_surface = EGL_NO_SURFACE;
7cc7ff
-    }
7cc7ff
-
7cc7ff
   renderer_gpu_data =
7cc7ff
     meta_renderer_native_get_gpu_data (onscreen_native->renderer_native,
7cc7ff
                                        onscreen_native->render_gpu);
7cc7ff
@@ -3100,6 +3111,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
7cc7ff
 
7cc7ff
       free_current_bo (onscreen);
7cc7ff
 
7cc7ff
+      destroy_egl_surface (onscreen);
7cc7ff
+
7cc7ff
       if (onscreen_native->gbm.surface)
7cc7ff
         {
7cc7ff
           gbm_surface_destroy (onscreen_native->gbm.surface);
7cc7ff
@@ -3110,6 +3123,9 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
7cc7ff
     case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
7cc7ff
       release_dumb_fb (&onscreen_native->egl.dumb_fb,
7cc7ff
                        onscreen_native->render_gpu);
7cc7ff
+
7cc7ff
+      destroy_egl_surface (onscreen);
7cc7ff
+
7cc7ff
       if (onscreen_native->egl.stream != EGL_NO_STREAM_KHR)
7cc7ff
         {
7cc7ff
           MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
7cc7ff
-- 
7cc7ff
2.24.1
7cc7ff
7cc7ff
7cc7ff
From c447010a23edc03c7a1103b477972ad666c2600f Mon Sep 17 00:00:00 2001
7cc7ff
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
7cc7ff
Date: Wed, 19 Jun 2019 20:55:48 +0200
7cc7ff
Subject: [PATCH 5/8] renderer/native: Remove left-over function declarations
7cc7ff
7cc7ff
There are no callers and no definitions of these.
7cc7ff
7cc7ff
https://gitlab.gnome.org/GNOME/mutter/merge_requests/655
7cc7ff
---
7cc7ff
 src/backends/native/meta-renderer-native.h | 12 ------------
7cc7ff
 1 file changed, 12 deletions(-)
7cc7ff
7cc7ff
diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h
7cc7ff
index a006dcbe7..8468208e1 100644
7cc7ff
--- a/src/backends/native/meta-renderer-native.h
7cc7ff
+++ b/src/backends/native/meta-renderer-native.h
7cc7ff
@@ -55,18 +55,6 @@ gboolean meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_n
7cc7ff
 
7cc7ff
 void meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native);
7cc7ff
 
7cc7ff
-gboolean meta_renderer_native_set_legacy_view_size (MetaRendererNative *renderer_native,
7cc7ff
-                                                    MetaRendererView   *view,
7cc7ff
-                                                    int                 width,
7cc7ff
-                                                    int                 height,
7cc7ff
-                                                    GError            **error);
7cc7ff
-
7cc7ff
-void meta_renderer_native_set_ignore_crtc (MetaRendererNative *renderer_native,
7cc7ff
-                                           uint32_t            id,
7cc7ff
-                                           gboolean            ignore);
7cc7ff
-
7cc7ff
-MetaRendererView * meta_renderer_native_create_legacy_view (MetaRendererNative *renderer_native);
7cc7ff
-
7cc7ff
 void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native);
7cc7ff
 
7cc7ff
 int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native);
7cc7ff
-- 
7cc7ff
2.24.1
7cc7ff
7cc7ff
7cc7ff
From 7f97403d12df19cf936a341cc218743ec339aa0a Mon Sep 17 00:00:00 2001
7cc7ff
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
7cc7ff
Date: Wed, 19 Jun 2019 20:57:14 +0200
7cc7ff
Subject: [PATCH 6/8] renderer/native: Queue mode reset from new rebuild_views
7cc7ff
 vfunc
7cc7ff
7cc7ff
Simplify the call site a bit and make the native renderer know it should
7cc7ff
queue mode reset itself when views have been rebuilt. This is done
7cc7ff
partly due to more things needing to be dealt with after views have been
7cc7ff
rebuilt.
7cc7ff
7cc7ff
https://gitlab.gnome.org/GNOME/mutter/merge_requests/655
7cc7ff
---
7cc7ff
 src/backends/meta-renderer.c               |  8 ++++++++
7cc7ff
 src/backends/meta-renderer.h               |  1 +
7cc7ff
 src/backends/native/meta-renderer-native.c | 17 ++++++++++++++++-
7cc7ff
 src/backends/native/meta-renderer-native.h |  2 --
7cc7ff
 src/backends/native/meta-stage-native.c    |  1 -
7cc7ff
 5 files changed, 25 insertions(+), 4 deletions(-)
7cc7ff
7cc7ff
diff --git a/src/backends/meta-renderer.c b/src/backends/meta-renderer.c
7cc7ff
index 28637437b..87ba9f9f0 100644
7cc7ff
--- a/src/backends/meta-renderer.c
7cc7ff
+++ b/src/backends/meta-renderer.c
7cc7ff
@@ -90,6 +90,12 @@ meta_renderer_create_view (MetaRenderer       *renderer,
7cc7ff
  */
7cc7ff
 void
7cc7ff
 meta_renderer_rebuild_views (MetaRenderer *renderer)
7cc7ff
+{
7cc7ff
+  return META_RENDERER_GET_CLASS (renderer)->rebuild_views (renderer);
7cc7ff
+}
7cc7ff
+
7cc7ff
+static void
7cc7ff
+meta_renderer_real_rebuild_views (MetaRenderer *renderer)
7cc7ff
 {
7cc7ff
   MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer);
7cc7ff
   MetaBackend *backend = meta_get_backend ();
7cc7ff
@@ -181,4 +187,6 @@ meta_renderer_class_init (MetaRendererClass *klass)
7cc7ff
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
7cc7ff
 
7cc7ff
   object_class->finalize = meta_renderer_finalize;
7cc7ff
+
7cc7ff
+  klass->rebuild_views = meta_renderer_real_rebuild_views;
7cc7ff
 }
7cc7ff
diff --git a/src/backends/meta-renderer.h b/src/backends/meta-renderer.h
7cc7ff
index dae52cb9a..478baee91 100644
7cc7ff
--- a/src/backends/meta-renderer.h
7cc7ff
+++ b/src/backends/meta-renderer.h
7cc7ff
@@ -43,6 +43,7 @@ struct _MetaRendererClass
7cc7ff
   CoglRenderer * (* create_cogl_renderer) (MetaRenderer *renderer);
7cc7ff
   MetaRendererView * (* create_view) (MetaRenderer       *renderer,
7cc7ff
                                       MetaLogicalMonitor *logical_monitor);
7cc7ff
+  void (* rebuild_views) (MetaRenderer *renderer);
7cc7ff
 };
7cc7ff
 
7cc7ff
 CoglRenderer * meta_renderer_create_cogl_renderer (MetaRenderer *renderer);
7cc7ff
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
7cc7ff
index 62c27c191..70e1c4f9d 100644
7cc7ff
--- a/src/backends/native/meta-renderer-native.c
7cc7ff
+++ b/src/backends/native/meta-renderer-native.c
7cc7ff
@@ -258,6 +258,9 @@ cogl_pixel_format_from_drm_format (uint32_t               drm_format,
7cc7ff
                                    CoglPixelFormat       *out_format,
7cc7ff
                                    CoglTextureComponents *out_components);
7cc7ff
 
7cc7ff
+static void
7cc7ff
+meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native);
7cc7ff
+
7cc7ff
 static MetaBackend *
7cc7ff
 backend_from_renderer_native (MetaRendererNative *renderer_native)
7cc7ff
 {
7cc7ff
@@ -3186,7 +3189,7 @@ meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native)
7cc7ff
   return TRUE;
7cc7ff
 }
7cc7ff
 
7cc7ff
-void
7cc7ff
+static void
7cc7ff
 meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native)
7cc7ff
 {
7cc7ff
   MetaRenderer *renderer = META_RENDERER (renderer_native);
7cc7ff
@@ -3552,6 +3555,17 @@ meta_renderer_native_create_view (MetaRenderer       *renderer,
7cc7ff
   return view;
7cc7ff
 }
7cc7ff
 
7cc7ff
+static void
7cc7ff
+meta_renderer_native_rebuild_views (MetaRenderer *renderer)
7cc7ff
+{
7cc7ff
+  MetaRendererClass *parent_renderer_class =
7cc7ff
+    META_RENDERER_CLASS (meta_renderer_native_parent_class);
7cc7ff
+
7cc7ff
+  parent_renderer_class->rebuild_views (renderer);
7cc7ff
+
7cc7ff
+  meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer));
7cc7ff
+}
7cc7ff
+
7cc7ff
 void
7cc7ff
 meta_renderer_native_finish_frame (MetaRendererNative *renderer_native)
7cc7ff
 {
7cc7ff
@@ -4350,6 +4364,7 @@ meta_renderer_native_class_init (MetaRendererNativeClass *klass)
7cc7ff
 
7cc7ff
   renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer;
7cc7ff
   renderer_class->create_view = meta_renderer_native_create_view;
7cc7ff
+  renderer_class->rebuild_views = meta_renderer_native_rebuild_views;
7cc7ff
 
7cc7ff
   obj_props[PROP_MONITOR_MANAGER] =
7cc7ff
     g_param_spec_object ("monitor-manager",
7cc7ff
diff --git a/src/backends/native/meta-renderer-native.h b/src/backends/native/meta-renderer-native.h
7cc7ff
index 8468208e1..9eecdead1 100644
7cc7ff
--- a/src/backends/native/meta-renderer-native.h
7cc7ff
+++ b/src/backends/native/meta-renderer-native.h
7cc7ff
@@ -53,8 +53,6 @@ struct gbm_device * meta_gbm_device_from_gpu (MetaGpuKms *gpu_kms);
7cc7ff
 
7cc7ff
 gboolean meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native);
7cc7ff
 
7cc7ff
-void meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native);
7cc7ff
-
7cc7ff
 void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native);
7cc7ff
 
7cc7ff
 int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native);
7cc7ff
diff --git a/src/backends/native/meta-stage-native.c b/src/backends/native/meta-stage-native.c
7cc7ff
index add3e81fd..9b9c45ef3 100644
7cc7ff
--- a/src/backends/native/meta-stage-native.c
7cc7ff
+++ b/src/backends/native/meta-stage-native.c
7cc7ff
@@ -140,7 +140,6 @@ meta_stage_native_rebuild_views (MetaStageNative *stage_native)
7cc7ff
   ClutterActor *stage = meta_backend_get_stage (backend);
7cc7ff
 
7cc7ff
   meta_renderer_rebuild_views (renderer);
7cc7ff
-  meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer));
7cc7ff
   clutter_stage_update_resource_scales (CLUTTER_STAGE (stage));
7cc7ff
   ensure_frame_callbacks (stage_native);
7cc7ff
 }
7cc7ff
-- 
7cc7ff
2.24.1
7cc7ff
7cc7ff
7cc7ff
From 025054c93e43e8359c9ecafb6edea1eb4b7ad681 Mon Sep 17 00:00:00 2001
7cc7ff
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
7cc7ff
Date: Wed, 19 Jun 2019 21:14:05 +0200
7cc7ff
Subject: [PATCH 7/8] renderer/native: Discard page flip retries when
7cc7ff
 rebuilding views
7cc7ff
7cc7ff
Rebuilding views means we don't care to retry page flip attempts for
7cc7ff
previous views, especially since connectors may have been disconnected,
7cc7ff
making a page flip retry hit an assert a flipped CRTC has connectors
7cc7ff
associated with it.
7cc7ff
7cc7ff
https://gitlab.gnome.org/GNOME/mutter/merge_requests/655
7cc7ff
---
7cc7ff
 src/backends/native/meta-renderer-native.c | 50 +++++++++++++++++-----
7cc7ff
 1 file changed, 39 insertions(+), 11 deletions(-)
7cc7ff
7cc7ff
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
7cc7ff
index 70e1c4f9d..3cd01bcb7 100644
7cc7ff
--- a/src/backends/native/meta-renderer-native.c
7cc7ff
+++ b/src/backends/native/meta-renderer-native.c
7cc7ff
@@ -3060,6 +3060,24 @@ destroy_egl_surface (CoglOnscreen *onscreen)
7cc7ff
     }
7cc7ff
 }
7cc7ff
 
7cc7ff
+static void
7cc7ff
+discard_onscreen_page_flip_retries (MetaOnscreenNative *onscreen_native)
7cc7ff
+{
7cc7ff
+  g_list_free_full (onscreen_native->pending_page_flip_retries,
7cc7ff
+                    (GDestroyNotify) retry_page_flip_data_free);
7cc7ff
+  onscreen_native->pending_page_flip_retries = NULL;
7cc7ff
+
7cc7ff
+  if (onscreen_native->retry_page_flips_source)
7cc7ff
+    {
7cc7ff
+      MetaBackend *backend =
7cc7ff
+        backend_from_renderer_native (onscreen_native->renderer_native);
7cc7ff
+
7cc7ff
+      meta_backend_thaw_updates (backend);
7cc7ff
+      g_clear_pointer (&onscreen_native->retry_page_flips_source,
7cc7ff
+                       g_source_destroy);
7cc7ff
+    }
7cc7ff
+}
7cc7ff
+
7cc7ff
 static void
7cc7ff
 meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
7cc7ff
 {
7cc7ff
@@ -3090,17 +3108,7 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
7cc7ff
         g_warning ("Failed to clear current context");
7cc7ff
     }
7cc7ff
 
7cc7ff
-  g_list_free_full (onscreen_native->pending_page_flip_retries,
7cc7ff
-                    (GDestroyNotify) retry_page_flip_data_free);
7cc7ff
-  if (onscreen_native->retry_page_flips_source)
7cc7ff
-    {
7cc7ff
-      MetaBackend *backend =
7cc7ff
-        backend_from_renderer_native (onscreen_native->renderer_native);
7cc7ff
-
7cc7ff
-      meta_backend_thaw_updates (backend);
7cc7ff
-      g_clear_pointer (&onscreen_native->retry_page_flips_source,
7cc7ff
-                       g_source_destroy);
7cc7ff
-    }
7cc7ff
+  discard_onscreen_page_flip_retries (onscreen_native);
7cc7ff
 
7cc7ff
   renderer_gpu_data =
7cc7ff
     meta_renderer_native_get_gpu_data (onscreen_native->renderer_native,
7cc7ff
@@ -3555,12 +3563,32 @@ meta_renderer_native_create_view (MetaRenderer       *renderer,
7cc7ff
   return view;
7cc7ff
 }
7cc7ff
 
7cc7ff
+static void
7cc7ff
+discard_page_flip_retries (MetaRenderer *renderer)
7cc7ff
+{
7cc7ff
+  GList *l;
7cc7ff
+
7cc7ff
+  for (l = meta_renderer_get_views (renderer); l; l = l->next)
7cc7ff
+    {
7cc7ff
+      ClutterStageView *stage_view = l->data;
7cc7ff
+      CoglFramebuffer *framebuffer =
7cc7ff
+        clutter_stage_view_get_onscreen (stage_view);
7cc7ff
+      CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
7cc7ff
+      CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
7cc7ff
+      MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
7cc7ff
+
7cc7ff
+      discard_onscreen_page_flip_retries (onscreen_native);
7cc7ff
+    }
7cc7ff
+}
7cc7ff
+
7cc7ff
 static void
7cc7ff
 meta_renderer_native_rebuild_views (MetaRenderer *renderer)
7cc7ff
 {
7cc7ff
   MetaRendererClass *parent_renderer_class =
7cc7ff
     META_RENDERER_CLASS (meta_renderer_native_parent_class);
7cc7ff
 
7cc7ff
+  discard_page_flip_retries (renderer);
7cc7ff
+
7cc7ff
   parent_renderer_class->rebuild_views (renderer);
7cc7ff
 
7cc7ff
   meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer));
7cc7ff
-- 
7cc7ff
2.24.1
7cc7ff
7cc7ff
7cc7ff
From f4fdec6003e2cf9fa4b1882e92faf1da64e6052e Mon Sep 17 00:00:00 2001
7cc7ff
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
7cc7ff
Date: Wed, 27 Nov 2019 17:34:35 +0100
7cc7ff
Subject: [PATCH 8/8] =?UTF-8?q?crtc-kms:=20Ignore=2090=C2=B0=20rotations?=
7cc7ff
MIME-Version: 1.0
7cc7ff
Content-Type: text/plain; charset=UTF-8
7cc7ff
Content-Transfer-Encoding: 8bit
7cc7ff
7cc7ff
They tend to require special modifiers or won't work at all; ignore
7cc7ff
them.
7cc7ff
---
7cc7ff
 src/backends/native/meta-crtc-kms.c | 4 ----
7cc7ff
 1 file changed, 4 deletions(-)
7cc7ff
7cc7ff
diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c
7cc7ff
index 8c2fbfe3c..8374376d5 100644
7cc7ff
--- a/src/backends/native/meta-crtc-kms.c
7cc7ff
+++ b/src/backends/native/meta-crtc-kms.c
7cc7ff
@@ -368,12 +368,8 @@ parse_transforms (MetaCrtc          *crtc,
7cc7ff
 
7cc7ff
       if (strcmp (prop->enums[i].name, "rotate-0") == 0)
7cc7ff
         transform = META_MONITOR_TRANSFORM_NORMAL;
7cc7ff
-      else if (strcmp (prop->enums[i].name, "rotate-90") == 0)
7cc7ff
-        transform = META_MONITOR_TRANSFORM_90;
7cc7ff
       else if (strcmp (prop->enums[i].name, "rotate-180") == 0)
7cc7ff
         transform = META_MONITOR_TRANSFORM_180;
7cc7ff
-      else if (strcmp (prop->enums[i].name, "rotate-270") == 0)
7cc7ff
-        transform = META_MONITOR_TRANSFORM_270;
7cc7ff
 
7cc7ff
       if (transform != -1)
7cc7ff
         {
7cc7ff
-- 
7cc7ff
2.24.1
7cc7ff