From db1d35c53d08fc311ed54ba45d28e31f7b343b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 10 Apr 2021 21:20:41 +0200 Subject: [PATCH] kms/mode: Recreate blob id each mode set This simplifies the blob management and isn't that less efficient that it matters. Part-of: --- .../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 4fdf60f28..cda913355 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 7917cfe7c..ded03c52e 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 cc726cff2..7094cd0da 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); }