kms/device: Add getter for finding cursor planes

Works the same as the getter for the primary planes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/930
This commit is contained in:
Jonas Ådahl 2019-11-08 11:31:29 +01:00
parent 6c1e9b51f9
commit 3a8c545b32
2 changed files with 22 additions and 4 deletions

View File

@ -89,9 +89,10 @@ meta_kms_device_get_planes (MetaKmsDevice *device)
return device->planes;
}
MetaKmsPlane *
meta_kms_device_get_primary_plane_for (MetaKmsDevice *device,
MetaKmsCrtc *crtc)
static MetaKmsPlane *
get_plane_with_type_for (MetaKmsDevice *device,
MetaKmsCrtc *crtc,
MetaKmsPlaneType type)
{
GList *l;
@ -99,7 +100,7 @@ meta_kms_device_get_primary_plane_for (MetaKmsDevice *device,
{
MetaKmsPlane *plane = l->data;
if (meta_kms_plane_get_plane_type (plane) != META_KMS_PLANE_TYPE_PRIMARY)
if (meta_kms_plane_get_plane_type (plane) != type)
continue;
if (meta_kms_plane_is_usable_with (plane, crtc))
@ -109,6 +110,20 @@ meta_kms_device_get_primary_plane_for (MetaKmsDevice *device,
return NULL;
}
MetaKmsPlane *
meta_kms_device_get_primary_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);
}
void
meta_kms_device_update_states_in_impl (MetaKmsDevice *device)
{

View File

@ -42,6 +42,9 @@ GList * meta_kms_device_get_crtcs (MetaKmsDevice *device);
MetaKmsPlane * meta_kms_device_get_primary_plane_for (MetaKmsDevice *device,
MetaKmsCrtc *crtc);
MetaKmsPlane * meta_kms_device_get_cursor_plane_for (MetaKmsDevice *device,
MetaKmsCrtc *crtc);
int meta_kms_device_dispatch_sync (MetaKmsDevice *device,
GError **error);