From 514a18fe0c6b8b0f4cfd055c62815d2217ac0b33 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Thu, 7 Mar 2024 17:44:39 +0100 Subject: [PATCH] kms/crtc: Track if the VRR_ENABLED property is supported Part-of: --- src/backends/native/meta-kms-crtc.c | 11 +++++++---- src/backends/native/meta-kms-crtc.h | 5 ++++- src/tests/native-kms-device.c | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c index 5b044402b..a0872089a 100644 --- a/src/backends/native/meta-kms-crtc.c +++ b/src/backends/native/meta-kms-crtc.c @@ -229,7 +229,7 @@ meta_kms_crtc_state_changes (MetaKmsCrtcState *state, if (!meta_drm_mode_equal (&state->drm_mode, &other_state->drm_mode)) return META_KMS_RESOURCE_CHANGE_FULL; - if (state->vrr_enabled != other_state->vrr_enabled) + if (state->vrr.enabled != other_state->vrr.enabled) return META_KMS_RESOURCE_CHANGE_FULL; if (!gamma_equal (state, other_state)) @@ -274,7 +274,10 @@ meta_kms_crtc_read_state (MetaKmsCrtc *crtc, prop = &crtc->prop_table.props[META_KMS_CRTC_PROP_VRR_ENABLED]; if (prop->prop_id) - crtc_state.vrr_enabled = !!prop->value; + { + crtc_state.vrr.supported = TRUE; + crtc_state.vrr.enabled = !!prop->value; + } read_gamma_state (crtc, &crtc_state, impl_device, drm_crtc); @@ -399,7 +402,7 @@ meta_kms_crtc_predict_state_in_impl (MetaKmsCrtc *crtc, continue; if (crtc_update->vrr.has_update) - crtc->current_state.vrr_enabled = !!crtc_update->vrr.is_enabled; + crtc->current_state.vrr.enabled = !!crtc_update->vrr.is_enabled; break; } @@ -577,7 +580,7 @@ meta_kms_crtc_determine_deadline (MetaKmsCrtc *crtc, return FALSE; } - if (crtc->current_state.vrr_enabled) + if (crtc->current_state.vrr.enabled) { next_presentation_us = 0; next_deadline_us = diff --git a/src/backends/native/meta-kms-crtc.h b/src/backends/native/meta-kms-crtc.h index cb59042af..580ee9a89 100644 --- a/src/backends/native/meta-kms-crtc.h +++ b/src/backends/native/meta-kms-crtc.h @@ -34,7 +34,10 @@ typedef struct _MetaKmsCrtcState gboolean is_drm_mode_valid; drmModeModeInfo drm_mode; - gboolean vrr_enabled; + struct { + gboolean enabled; + gboolean supported; + } vrr; struct { MetaGammaLut *value; diff --git a/src/tests/native-kms-device.c b/src/tests/native-kms-device.c index 7a65c4c8f..251233048 100644 --- a/src/tests/native-kms-device.c +++ b/src/tests/native-kms-device.c @@ -111,7 +111,7 @@ assert_crtc_state_equals (const MetaKmsCrtcState *crtc_state1, crtc_state2->drm_mode.name); } - g_assert_true (crtc_state1->vrr_enabled == crtc_state2->vrr_enabled); + g_assert_true (crtc_state1->vrr.enabled == crtc_state2->vrr.enabled); g_assert_true (meta_gamma_lut_equal (crtc_state1->gamma.value, crtc_state2->gamma.value)); @@ -211,7 +211,7 @@ copy_crtc_state (const MetaKmsCrtcState *crtc_state) new_state = *crtc_state; - new_state.vrr_enabled = crtc_state->vrr_enabled; + new_state.vrr.enabled = crtc_state->vrr.enabled; if (crtc_state->gamma.value) new_state.gamma.value = meta_gamma_lut_copy (crtc_state->gamma.value);