Blame SOURCES/0002-onscreen-native-Pass-damage-rectangles-when-page-fli.patch

5c9faf
From b328c8cc8b0b31a4afe2bfc857c6ea5a2b837ef2 Mon Sep 17 00:00:00 2001
5c9faf
From: Piotr Lopatka <piotr.lopatka@gmail.com>
5c9faf
Date: Fri, 3 Sep 2021 20:01:59 +0100
5c9faf
Subject: [PATCH 2/2] onscreen/native: Pass damage rectangles when page
5c9faf
 flipping
5c9faf
5c9faf
This commit passes damage rectangles metadata to the (KMS) primary
5c9faf
plane.
5c9faf
5c9faf
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1879>
5c9faf
---
5c9faf
 src/backends/native/meta-crtc-kms.c        |  4 +++-
5c9faf
 src/backends/native/meta-crtc-kms.h        |  6 +++---
5c9faf
 src/backends/native/meta-onscreen-native.c | 22 ++++++++++++++++++----
5c9faf
 3 files changed, 24 insertions(+), 8 deletions(-)
5c9faf
5c9faf
diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c
5c9faf
index f1bc79146af..fde64817532 100644
5c9faf
--- a/src/backends/native/meta-crtc-kms.c
5c9faf
+++ b/src/backends/native/meta-crtc-kms.c
5c9faf
@@ -115,7 +115,7 @@ meta_crtc_kms_apply_transform (MetaCrtcKms            *crtc_kms,
5c9faf
                                       hw_transform);
5c9faf
 }
5c9faf
 
5c9faf
-void
5c9faf
+MetaKmsPlaneAssignment *
5c9faf
 meta_crtc_kms_assign_primary_plane (MetaCrtcKms   *crtc_kms,
5c9faf
                                     MetaDrmBuffer *buffer,
5c9faf
                                     MetaKmsUpdate *kms_update)
5c9faf
@@ -161,6 +161,8 @@ meta_crtc_kms_assign_primary_plane (MetaCrtcKms   *crtc_kms,
5c9faf
                                                    dst_rect,
5c9faf
                                                    flags);
5c9faf
   meta_crtc_kms_apply_transform (crtc_kms, plane_assignment);
5c9faf
+
5c9faf
+  return plane_assignment;
5c9faf
 }
5c9faf
 
5c9faf
 static GList *
5c9faf
diff --git a/src/backends/native/meta-crtc-kms.h b/src/backends/native/meta-crtc-kms.h
5c9faf
index f8d241bbb51..bd80835f986 100644
5c9faf
--- a/src/backends/native/meta-crtc-kms.h
5c9faf
+++ b/src/backends/native/meta-crtc-kms.h
5c9faf
@@ -48,9 +48,9 @@ void meta_crtc_kms_set_cursor_renderer_private (MetaCrtcKms    *crtc_kms,
5c9faf
 void meta_crtc_kms_apply_transform (MetaCrtcKms            *crtc_kms,
5c9faf
                                     MetaKmsPlaneAssignment *kms_plane_assignment);
5c9faf
 
5c9faf
-void meta_crtc_kms_assign_primary_plane (MetaCrtcKms   *crtc_kms,
5c9faf
-                                         MetaDrmBuffer *buffer,
5c9faf
-                                         MetaKmsUpdate *kms_update);
5c9faf
+MetaKmsPlaneAssignment * meta_crtc_kms_assign_primary_plane (MetaCrtcKms   *crtc_kms,
5c9faf
+                                                             MetaDrmBuffer *buffer,
5c9faf
+                                                             MetaKmsUpdate *kms_update);
5c9faf
 
5c9faf
 void meta_crtc_kms_set_mode (MetaCrtcKms   *crtc_kms,
5c9faf
                              MetaKmsUpdate *kms_update);
5c9faf
diff --git a/src/backends/native/meta-onscreen-native.c b/src/backends/native/meta-onscreen-native.c
5c9faf
index 112bd0d438b..00b2d9f89cc 100644
5c9faf
--- a/src/backends/native/meta-onscreen-native.c
5c9faf
+++ b/src/backends/native/meta-onscreen-native.c
5c9faf
@@ -416,7 +416,9 @@ static void
5c9faf
 meta_onscreen_native_flip_crtc (CoglOnscreen                *onscreen,
5c9faf
                                 MetaRendererView            *view,
5c9faf
                                 MetaCrtc                    *crtc,
5c9faf
-                                MetaKmsPageFlipListenerFlag  flags)
5c9faf
+                                MetaKmsPageFlipListenerFlag  flags,
5c9faf
+                                const int                   *rectangles,
5c9faf
+                                int                          n_rectangles)
5c9faf
 {
5c9faf
   MetaOnscreenNative *onscreen_native = META_ONSCREEN_NATIVE (onscreen);
5c9faf
   MetaRendererNative *renderer_native = onscreen_native->renderer_native;
5c9faf
@@ -430,6 +432,7 @@ meta_onscreen_native_flip_crtc (CoglOnscreen                *onscreen,
5c9faf
   MetaKmsUpdate *kms_update;
5c9faf
   MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state = NULL;
5c9faf
   MetaDrmBuffer *buffer;
5c9faf
+  MetaKmsPlaneAssignment *plane_assignment;
5c9faf
 
5c9faf
   COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeFlipCrtcs,
5c9faf
                            "Onscreen (flip CRTCs)");
5c9faf
@@ -456,8 +459,15 @@ meta_onscreen_native_flip_crtc (CoglOnscreen                *onscreen,
5c9faf
           buffer = secondary_gpu_state->gbm.next_fb;
5c9faf
         }
5c9faf
 
5c9faf
-      meta_crtc_kms_assign_primary_plane (crtc_kms, buffer, kms_update);
5c9faf
+      plane_assignment = meta_crtc_kms_assign_primary_plane (crtc_kms,
5c9faf
+                                                             buffer,
5c9faf
+                                                             kms_update);
5c9faf
 
5c9faf
+      if (rectangles != NULL && n_rectangles != 0)
5c9faf
+        {
5c9faf
+          meta_kms_plane_assignment_set_fb_damage (plane_assignment,
5c9faf
+                                                   rectangles, n_rectangles);
5c9faf
+        }
5c9faf
       break;
5c9faf
     case META_RENDERER_NATIVE_MODE_SURFACELESS:
5c9faf
       g_assert_not_reached ();
5c9faf
@@ -1081,7 +1091,9 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen  *onscreen,
5c9faf
       meta_onscreen_native_flip_crtc (onscreen,
5c9faf
                                       onscreen_native->view,
5c9faf
                                       onscreen_native->crtc,
5c9faf
-                                      META_KMS_PAGE_FLIP_LISTENER_FLAG_NONE);
5c9faf
+                                      META_KMS_PAGE_FLIP_LISTENER_FLAG_NONE,
5c9faf
+                                      rectangles,
5c9faf
+                                      n_rectangles);
5c9faf
     }
5c9faf
   else
5c9faf
     {
5c9faf
@@ -1299,7 +1311,9 @@ meta_onscreen_native_direct_scanout (CoglOnscreen   *onscreen,
5c9faf
   meta_onscreen_native_flip_crtc (onscreen,
5c9faf
                                   onscreen_native->view,
5c9faf
                                   onscreen_native->crtc,
5c9faf
-                                  META_KMS_PAGE_FLIP_LISTENER_FLAG_DROP_ON_ERROR);
5c9faf
+                                  META_KMS_PAGE_FLIP_LISTENER_FLAG_DROP_ON_ERROR,
5c9faf
+                                  NULL,
5c9faf
+                                  0);
5c9faf
 
5c9faf
   kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (onscreen_native->crtc));
5c9faf
   kms_device = meta_kms_crtc_get_device (kms_crtc);
5c9faf
-- 
5c9faf
2.36.1
5c9faf