From b7128b1d1236ec8e9c7c3062dd1b84207d90f1c2 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Tue, 17 Mar 2020 21:42:37 +0200 Subject: [PATCH] connector/kms: Detect variable refresh rate capability The "vrr_capable" property indicates whether variable refresh rate is supported for a connector. Part-of: --- src/backends/native/meta-kms-connector-private.h | 1 + src/backends/native/meta-kms-connector.c | 13 +++++++++++++ src/backends/native/meta-kms-connector.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/backends/native/meta-kms-connector-private.h b/src/backends/native/meta-kms-connector-private.h index 8be080dfb..fcabc19cf 100644 --- a/src/backends/native/meta-kms-connector-private.h +++ b/src/backends/native/meta-kms-connector-private.h @@ -40,6 +40,7 @@ typedef enum _MetaKmsConnectorProp META_KMS_CONNECTOR_PROP_COLORSPACE, META_KMS_CONNECTOR_PROP_HDR_OUTPUT_METADATA, META_KMS_CONNECTOR_PROP_BROADCAST_RGB, + META_KMS_CONNECTOR_PROP_VRR_CAPABLE, META_KMS_CONNECTOR_N_PROPS } MetaKmsConnectorProp; diff --git a/src/backends/native/meta-kms-connector.c b/src/backends/native/meta-kms-connector.c index 93cbe7003..6a51fd46f 100644 --- a/src/backends/native/meta-kms-connector.c +++ b/src/backends/native/meta-kms-connector.c @@ -397,6 +397,10 @@ state_set_properties (MetaKmsConnectorState *state, prop = &props[META_KMS_CONNECTOR_PROP_UNDERSCAN]; if (prop->prop_id) state->underscan.supported = TRUE; + + prop = &props[META_KMS_CONNECTOR_PROP_VRR_CAPABLE]; + if (prop->prop_id) + state->vrr_capable = !!prop->value; } static CoglSubpixelOrder @@ -829,6 +833,7 @@ meta_kms_connector_state_new (void) state = g_new0 (MetaKmsConnectorState, 1); state->suggested_x = -1; state->suggested_y = -1; + state->vrr_capable = FALSE; return state; } @@ -1007,6 +1012,9 @@ meta_kms_connector_state_changes (MetaKmsConnectorState *state, state->broadcast_rgb.supported != new_state->broadcast_rgb.supported) return META_KMS_RESOURCE_CHANGE_FULL; + if (state->vrr_capable != new_state->vrr_capable) + return META_KMS_RESOURCE_CHANGE_FULL; + if (state->privacy_screen_state != new_state->privacy_screen_state) return META_KMS_RESOURCE_CHANGE_PRIVACY_SCREEN; @@ -1357,6 +1365,11 @@ init_properties (MetaKmsConnector *connector, .num_enum_values = META_KMS_CONNECTOR_BROADCAST_RGB_N_PROPS, .default_value = META_KMS_CONNECTOR_BROADCAST_RGB_UNKNOWN, }, + [META_KMS_CONNECTOR_PROP_VRR_CAPABLE] = + { + .name = "vrr_capable", + .type = DRM_MODE_PROP_RANGE, + }, }, .dpms_enum = { [META_KMS_CONNECTOR_DPMS_ON] = diff --git a/src/backends/native/meta-kms-connector.h b/src/backends/native/meta-kms-connector.h index 031e2166e..cb71b4987 100644 --- a/src/backends/native/meta-kms-connector.h +++ b/src/backends/native/meta-kms-connector.h @@ -83,6 +83,8 @@ typedef struct _MetaKmsConnectorState struct { gboolean supported; } underscan; + + gboolean vrr_capable; } MetaKmsConnectorState; META_EXPORT_TEST