[mutter] kms/mode: Recreate blob id each mode set



commit db1d35c53d08fc311ed54ba45d28e31f7b343b7b
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sat Apr 10 21:20:41 2021 +0200

    kms/mode: Recreate blob id each mode set
    
    This simplifies the blob management and isn't that less efficient that
    it matters.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>

 src/backends/native/meta-kms-impl-device-atomic.c |  4 +++-
 src/backends/native/meta-kms-mode-private.h       |  2 +-
 src/backends/native/meta-kms-mode.c               | 17 ++++-------------
 3 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/src/backends/native/meta-kms-impl-device-atomic.c 
b/src/backends/native/meta-kms-impl-device-atomic.c
index 4fdf60f280..cda9133559 100644
--- a/src/backends/native/meta-kms-impl-device-atomic.c
+++ b/src/backends/native/meta-kms-impl-device-atomic.c
@@ -264,10 +264,12 @@ process_mode_set (MetaKmsImplDevice  *impl_device,
       uint32_t mode_id;
       GList *l;
 
-      mode_id = meta_kms_mode_ensure_blob_id (mode, error);
+      mode_id = meta_kms_mode_create_blob_id (mode, error);
       if (mode_id == 0)
         return FALSE;
 
+      g_array_append_val (blob_ids, mode_id);
+
       meta_topic (META_DEBUG_KMS,
                   "[atomic] Setting mode of CRTC %u (%s) to %s",
                   meta_kms_crtc_get_id (crtc),
diff --git a/src/backends/native/meta-kms-mode-private.h b/src/backends/native/meta-kms-mode-private.h
index 7917cfe7c7..ded03c52ef 100644
--- a/src/backends/native/meta-kms-mode-private.h
+++ b/src/backends/native/meta-kms-mode-private.h
@@ -22,7 +22,7 @@
 
 #include "backends/native/meta-kms-mode.h"
 
-uint32_t meta_kms_mode_ensure_blob_id (MetaKmsMode  *mode,
+uint32_t meta_kms_mode_create_blob_id (MetaKmsMode  *mode,
                                        GError      **error);
 
 void meta_kms_mode_free (MetaKmsMode *mode);
diff --git a/src/backends/native/meta-kms-mode.c b/src/backends/native/meta-kms-mode.c
index cc726cff24..7094cd0dab 100644
--- a/src/backends/native/meta-kms-mode.c
+++ b/src/backends/native/meta-kms-mode.c
@@ -28,22 +28,22 @@ struct _MetaKmsMode
   MetaKmsImplDevice *impl_device;
   MetaKmsModeFlag flags;
   drmModeModeInfo drm_mode;
-  uint32_t blob_id;
 };
 
 uint32_t
-meta_kms_mode_ensure_blob_id (MetaKmsMode  *mode,
+meta_kms_mode_create_blob_id (MetaKmsMode  *mode,
                               GError      **error)
 {
   int fd;
   int ret;
+  uint32_t blob_id;
 
   fd = meta_kms_impl_device_get_fd (mode->impl_device);
 
   ret = drmModeCreatePropertyBlob (fd,
                                    &mode->drm_mode,
                                    sizeof (mode->drm_mode),
-                                   &mode->blob_id);
+                                   &blob_id);
   if (ret < 0)
     {
       g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
@@ -52,7 +52,7 @@ meta_kms_mode_ensure_blob_id (MetaKmsMode  *mode,
       return 0;
     }
 
-  return mode->blob_id;
+  return blob_id;
 }
 
 const char *
@@ -124,15 +124,6 @@ meta_kms_mode_hash (MetaKmsMode *mode)
 void
 meta_kms_mode_free (MetaKmsMode *mode)
 {
-  if (mode->blob_id)
-    {
-      int fd;
-
-      fd = meta_kms_impl_device_get_fd (mode->impl_device);
-
-      drmModeDestroyPropertyBlob (fd, mode->blob_id);
-    }
-
   g_free (mode);
 }
 


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