[mutter] kms/device: Add getter for finding cursor planes



commit 3a8c545b32eb09247d86ef19d83029b94f040734
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Nov 8 11:31:29 2019 +0100

    kms/device: Add getter for finding cursor planes
    
    Works the same as the getter for the primary planes.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/930

 src/backends/native/meta-kms-device.c | 23 +++++++++++++++++++----
 src/backends/native/meta-kms-device.h |  3 +++
 2 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/native/meta-kms-device.c b/src/backends/native/meta-kms-device.c
index c6a05e83c..376ac5a91 100644
--- a/src/backends/native/meta-kms-device.c
+++ b/src/backends/native/meta-kms-device.c
@@ -89,9 +89,10 @@ meta_kms_device_get_planes (MetaKmsDevice *device)
   return device->planes;
 }
 
-MetaKmsPlane *
-meta_kms_device_get_primary_plane_for (MetaKmsDevice *device,
-                                       MetaKmsCrtc   *crtc)
+static MetaKmsPlane *
+get_plane_with_type_for (MetaKmsDevice    *device,
+                         MetaKmsCrtc      *crtc,
+                         MetaKmsPlaneType  type)
 {
   GList *l;
 
@@ -99,7 +100,7 @@ meta_kms_device_get_primary_plane_for (MetaKmsDevice *device,
     {
       MetaKmsPlane *plane = l->data;
 
-      if (meta_kms_plane_get_plane_type (plane) != META_KMS_PLANE_TYPE_PRIMARY)
+      if (meta_kms_plane_get_plane_type (plane) != type)
         continue;
 
       if (meta_kms_plane_is_usable_with (plane, crtc))
@@ -109,6 +110,20 @@ meta_kms_device_get_primary_plane_for (MetaKmsDevice *device,
   return NULL;
 }
 
+MetaKmsPlane *
+meta_kms_device_get_primary_plane_for (MetaKmsDevice *device,
+                                       MetaKmsCrtc   *crtc)
+{
+  return get_plane_with_type_for (device, crtc, META_KMS_PLANE_TYPE_PRIMARY);
+}
+
+MetaKmsPlane *
+meta_kms_device_get_cursor_plane_for (MetaKmsDevice *device,
+                                      MetaKmsCrtc   *crtc)
+{
+  return get_plane_with_type_for (device, crtc, META_KMS_PLANE_TYPE_CURSOR);
+}
+
 void
 meta_kms_device_update_states_in_impl (MetaKmsDevice *device)
 {
diff --git a/src/backends/native/meta-kms-device.h b/src/backends/native/meta-kms-device.h
index ea0f9aab5..d3d655fec 100644
--- a/src/backends/native/meta-kms-device.h
+++ b/src/backends/native/meta-kms-device.h
@@ -42,6 +42,9 @@ GList * meta_kms_device_get_crtcs (MetaKmsDevice *device);
 MetaKmsPlane * meta_kms_device_get_primary_plane_for (MetaKmsDevice *device,
                                                       MetaKmsCrtc   *crtc);
 
+MetaKmsPlane * meta_kms_device_get_cursor_plane_for (MetaKmsDevice *device,
+                                                     MetaKmsCrtc   *crtc);
+
 int meta_kms_device_dispatch_sync (MetaKmsDevice  *device,
                                    GError        **error);
 


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