From b91740df0e739e0f0ec730201ac4e7571eba8454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 26 Jan 2021 16:13:18 +0100 Subject: [PATCH] crtc/kms: Make the 'transform-handled' API pass through MetaCrtcNative In preparation for creating another non-KMS backend virtual CRTC. Part-of: --- src/backends/native/meta-crtc-kms.c | 22 ++++++++++++++----- src/backends/native/meta-crtc-kms.h | 3 --- src/backends/native/meta-crtc-native.c | 9 ++++++++ src/backends/native/meta-crtc-native.h | 6 +++++ .../native/meta-monitor-manager-native.c | 3 ++- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/backends/native/meta-crtc-kms.c b/src/backends/native/meta-crtc-kms.c index fb38e4d67..f1bc79146 100644 --- a/src/backends/native/meta-crtc-kms.c +++ b/src/backends/native/meta-crtc-kms.c @@ -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; } diff --git a/src/backends/native/meta-crtc-kms.h b/src/backends/native/meta-crtc-kms.h index df957be15..f8d241bbb 100644 --- a/src/backends/native/meta-crtc-kms.h +++ b/src/backends/native/meta-crtc-kms.h @@ -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); diff --git a/src/backends/native/meta-crtc-native.c b/src/backends/native/meta-crtc-native.c index 3a0e7a952..5e5751780 100644 --- a/src/backends/native/meta-crtc-native.c +++ b/src/backends/native/meta-crtc-native.c @@ -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) { diff --git a/src/backends/native/meta-crtc-native.h b/src/backends/native/meta-crtc-native.h index 61ea15be3..0c16e5895 100644 --- a/src/backends/native/meta-crtc-native.h +++ b/src/backends/native/meta-crtc-native.h @@ -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 */ diff --git a/src/backends/native/meta-monitor-manager-native.c b/src/backends/native/meta-monitor-manager-native.c index 30a153506..0b9471c25 100644 --- a/src/backends/native/meta-monitor-manager-native.c +++ b/src/backends/native/meta-monitor-manager-native.c @@ -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