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);
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

View File

@ -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 *

View File

@ -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);

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)
{
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,