[mutter/wip/rstrode/rhel-8.0.0: 24/30] crtc/kms: Use plane formats if no IN_FORMATS



commit b059c3b400cb3646940877a2ff9f06ff0f6c739f
Author: Pekka Paalanen <pekka paalanen collabora com>
Date:   Mon Nov 19 13:20:37 2018 +0200

    crtc/kms: Use plane formats if no IN_FORMATS
    
    If the IN_FORMATS property is not found, copy the formats from the DRM
    plane instead. This is the fallback for getting a list of formats the
    primary plane supports when DRM universal planes capability is enabled.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/341

 src/backends/native/meta-crtc-kms.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c
index 29ffc8c37..2cede326e 100644
--- a/src/backends/native/meta-crtc-kms.c
+++ b/src/backends/native/meta-crtc-kms.c
@@ -213,6 +213,21 @@ free_modifier_array (GArray *arr)
   g_array_free (arr, TRUE);
 }
 
+static void
+set_formats_from_array (MetaCrtc       *crtc,
+                        const uint32_t *formats,
+                        size_t          count_formats)
+{
+  MetaCrtcKms *crtc_kms = crtc->driver_private;
+  size_t i;
+
+  for (i = 0; i < count_formats; i++)
+    {
+      g_hash_table_insert (crtc_kms->formats_modifiers,
+                           GUINT_TO_POINTER (formats[i]), NULL);
+    }
+}
+
 static void
 parse_formats (MetaCrtc *crtc,
                int       kms_fd,
@@ -374,6 +389,14 @@ init_crtc_rotations (MetaCrtc *crtc,
                   parse_formats (crtc, kms_fd, props->prop_values[fmts_idx]);
                   drmModeFreeProperty (prop);
                 }
+
+              /* fall back to universal plane formats without modifiers */
+              if (g_hash_table_size (crtc_kms->formats_modifiers) == 0)
+                {
+                  set_formats_from_array (crtc,
+                                          drm_plane->formats,
+                                          drm_plane->count_formats);
+                }
             }
 
           if (props)


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