crtc/kms: Make the 'transform-handled' API pass through MetaCrtcNative

In preparation for creating another non-KMS backend virtual CRTC.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
Jonas Ådahl 2021-01-26 16:13:18 +01:00 committed by Marge Bot
parent 6aef4b3970
commit b91740df0e
5 changed files with 34 additions and 9 deletions

View File

@ -74,9 +74,9 @@ meta_crtc_kms_set_cursor_renderer_private (MetaCrtcKms *crtc_kms,
crtc_kms->cursor_renderer_private_destroy_notify = destroy_notify;
}
gboolean
meta_crtc_kms_is_transform_handled (MetaCrtcKms *crtc_kms,
MetaMonitorTransform transform)
static gboolean
is_transform_handled (MetaCrtcKms *crtc_kms,
MetaMonitorTransform transform)
{
if (!crtc_kms->primary_plane)
return FALSE;
@ -85,6 +85,15 @@ meta_crtc_kms_is_transform_handled (MetaCrtcKms *crtc_kms,
transform);
}
static gboolean
meta_crtc_kms_is_transform_handled (MetaCrtcNative *crtc_native,
MetaMonitorTransform transform)
{
MetaCrtcKms *crtc_kms = META_CRTC_KMS (crtc_native);
return is_transform_handled (crtc_kms, transform);
}
void
meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms,
MetaKmsPlaneAssignment *kms_plane_assignment)
@ -96,9 +105,9 @@ meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms,
crtc_config = meta_crtc_get_config (crtc);
hw_transform = crtc_config->transform;
if (!meta_crtc_kms_is_transform_handled (crtc_kms, hw_transform))
if (!is_transform_handled (crtc_kms, hw_transform))
hw_transform = META_MONITOR_TRANSFORM_NORMAL;
if (!meta_crtc_kms_is_transform_handled (crtc_kms, hw_transform))
if (!is_transform_handled (crtc_kms, hw_transform))
return;
meta_kms_plane_update_set_rotation (crtc_kms->primary_plane,
@ -369,6 +378,9 @@ static void
meta_crtc_kms_class_init (MetaCrtcKmsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MetaCrtcNativeClass *crtc_native_class = META_CRTC_NATIVE_CLASS (klass);
object_class->dispose = meta_crtc_kms_dispose;
crtc_native_class->is_transform_handled = meta_crtc_kms_is_transform_handled;
}

View File

@ -45,9 +45,6 @@ void meta_crtc_kms_set_cursor_renderer_private (MetaCrtcKms *crtc_kms,
gpointer cursor_renderer_private,
GDestroyNotify destroy_notify);
gboolean meta_crtc_kms_is_transform_handled (MetaCrtcKms *crtc_kms,
MetaMonitorTransform transform);
void meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms,
MetaKmsPlaneAssignment *kms_plane_assignment);

View File

@ -24,6 +24,15 @@
G_DEFINE_ABSTRACT_TYPE (MetaCrtcNative, meta_crtc_native,
META_TYPE_CRTC)
gboolean
meta_crtc_native_is_transform_handled (MetaCrtcNative *crtc_native,
MetaMonitorTransform transform)
{
MetaCrtcNativeClass *klass = META_CRTC_NATIVE_GET_CLASS (crtc_native);
return klass->is_transform_handled (crtc_native, transform);
}
static void
meta_crtc_native_init (MetaCrtcNative *crtc_native)
{

View File

@ -30,6 +30,12 @@ G_DECLARE_DERIVABLE_TYPE (MetaCrtcNative, meta_crtc_native,
struct _MetaCrtcNativeClass
{
MetaCrtcClass parent_class;
gboolean (* is_transform_handled) (MetaCrtcNative *crtc_native,
MetaMonitorTransform monitor_transform);
};
gboolean meta_crtc_native_is_transform_handled (MetaCrtcNative *crtc_native,
MetaMonitorTransform transform);
#endif /* META_CRTC_NATIVE_H */

View File

@ -528,7 +528,8 @@ meta_monitor_manager_native_is_transform_handled (MetaMonitorManager *manager,
MetaCrtc *crtc,
MetaMonitorTransform transform)
{
return meta_crtc_kms_is_transform_handled (META_CRTC_KMS (crtc), transform);
return meta_crtc_native_is_transform_handled (META_CRTC_NATIVE (crtc),
transform);
}
static float