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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
This commit is contained in:
Jonas Ådahl 2023-11-28 22:16:09 +01:00 committed by Marge Bot
parent 48c7caadd2
commit 3b46b4a099
4 changed files with 12 additions and 26 deletions

View File

@ -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); MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
MetaKmsDevice *kms_device = meta_kms_crtc_get_device (kms_crtc); 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 void

View File

@ -200,8 +200,8 @@ meta_kms_device_get_planes (MetaKmsDevice *device)
return device->planes; return device->planes;
} }
static MetaKmsPlane * static gboolean
get_plane_with_type_for (MetaKmsDevice *device, has_plane_with_type_for (MetaKmsDevice *device,
MetaKmsCrtc *crtc, MetaKmsCrtc *crtc,
MetaKmsPlaneType type) MetaKmsPlaneType type)
{ {
@ -215,24 +215,17 @@ get_plane_with_type_for (MetaKmsDevice *device,
continue; continue;
if (meta_kms_plane_is_usable_with (plane, crtc)) if (meta_kms_plane_is_usable_with (plane, crtc))
return plane; return TRUE;
} }
return NULL; return FALSE;
} }
MetaKmsPlane * gboolean
meta_kms_device_get_primary_plane_for (MetaKmsDevice *device, meta_kms_device_has_cursor_plane_for (MetaKmsDevice*device,
MetaKmsCrtc *crtc) MetaKmsCrtc *crtc)
{ {
return get_plane_with_type_for (device, crtc, META_KMS_PLANE_TYPE_PRIMARY); return has_plane_with_type_for (device, crtc, META_KMS_PLANE_TYPE_CURSOR);
}
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);
} }
GList * GList *

View File

@ -60,13 +60,8 @@ GList * meta_kms_device_get_crtcs (MetaKmsDevice *device);
META_EXPORT_TEST META_EXPORT_TEST
GList * meta_kms_device_get_planes (MetaKmsDevice *device); GList * meta_kms_device_get_planes (MetaKmsDevice *device);
META_EXPORT_TEST gboolean meta_kms_device_has_cursor_plane_for (MetaKmsDevice*device,
MetaKmsPlane * meta_kms_device_get_primary_plane_for (MetaKmsDevice *device, MetaKmsCrtc *crtc);
MetaKmsCrtc *crtc);
META_EXPORT_TEST
MetaKmsPlane * meta_kms_device_get_cursor_plane_for (MetaKmsDevice *device,
MetaKmsCrtc *crtc);
GList * meta_kms_device_get_fallback_modes (MetaKmsDevice *device); GList * meta_kms_device_get_fallback_modes (MetaKmsDevice *device);

View File

@ -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) for (l = meta_kms_device_get_crtcs (device); l; l = l->next)
{ {
MetaKmsCrtc *crtc = l->data; MetaKmsCrtc *crtc = l->data;
MetaKmsPlane *plane;
plane = meta_kms_device_get_cursor_plane_for (device, crtc); if (meta_kms_device_has_cursor_plane_for (device, crtc))
if (plane)
continue; continue;
meta_topic (META_DEBUG_KMS, meta_topic (META_DEBUG_KMS,