From 3b46b4a099acb4f1dd698b981f3106c551fe4cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 28 Nov 2023 22:16:09 +0100 Subject: [PATCH] kms/device: Replace get_plane*() with has_plane*() There might not be a single plane that is "for" a CRTC, so remove the API that made it appear as if it did. The existing users only cared if there was some plane for said CRTC, so replace the getters with API that just checks the existance at all. Part-of: --- src/backends/native/meta-crtc-kms.c | 2 +- src/backends/native/meta-kms-device.c | 23 +++++++------------ src/backends/native/meta-kms-device.h | 9 ++------ .../native/meta-kms-impl-device-simple.c | 4 +--- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c index 81ebce901..336060d9b 100644 --- a/src/backends/native/meta-crtc-kms.c +++ b/src/backends/native/meta-crtc-kms.c @@ -353,7 +353,7 @@ meta_crtc_kms_is_hw_cursor_supported (MetaCrtcNative *crtc_native) MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms); MetaKmsDevice *kms_device = meta_kms_crtc_get_device (kms_crtc); - return !!meta_kms_device_get_cursor_plane_for (kms_device, kms_crtc); + return meta_kms_device_has_cursor_plane_for (kms_device, kms_crtc); } void diff --git a/src/backends/native/meta-kms-device.c b/src/backends/native/meta-kms-device.c index 71b778014..83d9f8b6d 100644 --- a/src/backends/native/meta-kms-device.c +++ b/src/backends/native/meta-kms-device.c @@ -200,8 +200,8 @@ meta_kms_device_get_planes (MetaKmsDevice *device) return device->planes; } -static MetaKmsPlane * -get_plane_with_type_for (MetaKmsDevice *device, +static gboolean +has_plane_with_type_for (MetaKmsDevice *device, MetaKmsCrtc *crtc, MetaKmsPlaneType type) { @@ -215,24 +215,17 @@ get_plane_with_type_for (MetaKmsDevice *device, continue; if (meta_kms_plane_is_usable_with (plane, crtc)) - return plane; + return TRUE; } - return NULL; + return FALSE; } -MetaKmsPlane * -meta_kms_device_get_primary_plane_for (MetaKmsDevice *device, - MetaKmsCrtc *crtc) +gboolean +meta_kms_device_has_cursor_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); + return has_plane_with_type_for (device, crtc, META_KMS_PLANE_TYPE_CURSOR); } GList * diff --git a/src/backends/native/meta-kms-device.h b/src/backends/native/meta-kms-device.h index 32ec9f6a3..00dafb16c 100644 --- a/src/backends/native/meta-kms-device.h +++ b/src/backends/native/meta-kms-device.h @@ -60,13 +60,8 @@ GList * meta_kms_device_get_crtcs (MetaKmsDevice *device); META_EXPORT_TEST GList * meta_kms_device_get_planes (MetaKmsDevice *device); -META_EXPORT_TEST -MetaKmsPlane * meta_kms_device_get_primary_plane_for (MetaKmsDevice *device, - MetaKmsCrtc *crtc); - -META_EXPORT_TEST -MetaKmsPlane * meta_kms_device_get_cursor_plane_for (MetaKmsDevice *device, - MetaKmsCrtc *crtc); +gboolean meta_kms_device_has_cursor_plane_for (MetaKmsDevice*device, + MetaKmsCrtc *crtc); GList * meta_kms_device_get_fallback_modes (MetaKmsDevice *device); diff --git a/src/backends/native/meta-kms-impl-device-simple.c b/src/backends/native/meta-kms-impl-device-simple.c index ff452f847..a00ae37e0 100644 --- a/src/backends/native/meta-kms-impl-device-simple.c +++ b/src/backends/native/meta-kms-impl-device-simple.c @@ -1772,10 +1772,8 @@ meta_kms_impl_device_simple_initable_init (GInitable *initable, for (l = meta_kms_device_get_crtcs (device); l; l = l->next) { MetaKmsCrtc *crtc = l->data; - MetaKmsPlane *plane; - plane = meta_kms_device_get_cursor_plane_for (device, crtc); - if (plane) + if (meta_kms_device_has_cursor_plane_for (device, crtc)) continue; meta_topic (META_DEBUG_KMS,