crtc/native: Add API to check whether the CRTC supports hardware cursors

On a KMS backed CRTC, hardware cursor are supported when there are
cursor planes to assign them to. Note that when using legacy mode
setting, fake cursor planes are added when adequate.

On virtual CRTCs, used with virtual monitors, the equivalent of hardware
cursor are always supported, as they are sent using embedded PipeWire
stream metadata.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1991>
This commit is contained in:
Jonas Ådahl 2021-09-06 10:40:17 +02:00 committed by Marge Bot
parent 2c70120555
commit e82685d049
4 changed files with 30 additions and 0 deletions

View File

@ -94,6 +94,16 @@ meta_crtc_kms_is_transform_handled (MetaCrtcNative *crtc_native,
return is_transform_handled (crtc_kms, transform);
}
static gboolean
meta_crtc_kms_is_hw_cursor_supported (MetaCrtcNative *crtc_native)
{
MetaCrtcKms *crtc_kms = META_CRTC_KMS (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);
}
void
meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms,
MetaKmsPlaneAssignment *kms_plane_assignment)
@ -385,4 +395,5 @@ meta_crtc_kms_class_init (MetaCrtcKmsClass *klass)
object_class->dispose = meta_crtc_kms_dispose;
crtc_native_class->is_transform_handled = meta_crtc_kms_is_transform_handled;
crtc_native_class->is_hw_cursor_supported = meta_crtc_kms_is_hw_cursor_supported;
}

View File

@ -33,6 +33,14 @@ meta_crtc_native_is_transform_handled (MetaCrtcNative *crtc_native,
return klass->is_transform_handled (crtc_native, transform);
}
gboolean
meta_crtc_native_is_hw_cursor_supported (MetaCrtcNative *crtc_native)
{
MetaCrtcNativeClass *klass = META_CRTC_NATIVE_GET_CLASS (crtc_native);
return klass->is_hw_cursor_supported (crtc_native);
}
static void
meta_crtc_native_init (MetaCrtcNative *crtc_native)
{

View File

@ -33,9 +33,12 @@ struct _MetaCrtcNativeClass
gboolean (* is_transform_handled) (MetaCrtcNative *crtc_native,
MetaMonitorTransform monitor_transform);
gboolean (* is_hw_cursor_supported) (MetaCrtcNative *crtc_native);
};
gboolean meta_crtc_native_is_transform_handled (MetaCrtcNative *crtc_native,
MetaMonitorTransform transform);
gboolean meta_crtc_native_is_hw_cursor_supported (MetaCrtcNative *crtc_native);
#endif /* META_CRTC_NATIVE_H */

View File

@ -45,6 +45,12 @@ meta_crtc_virtual_is_transform_handled (MetaCrtcNative *crtc_native,
return transform == META_MONITOR_TRANSFORM_NORMAL;
}
static gboolean
meta_crtc_virtual_is_hw_cursor_supported (MetaCrtcNative *crtc_native)
{
return TRUE;
}
static void
meta_crtc_virtual_init (MetaCrtcVirtual *crtc_virtual)
{
@ -57,4 +63,6 @@ meta_crtc_virtual_class_init (MetaCrtcVirtualClass *klass)
crtc_native_class->is_transform_handled =
meta_crtc_virtual_is_transform_handled;
crtc_native_class->is_hw_cursor_supported =
meta_crtc_virtual_is_hw_cursor_supported;
}