[igt-dev] [i-g-t V6 06/10] tests/kms_vrr: Add a helper to get the low refresh mode
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Thu Dec 7 06:48:56 UTC 2023
To switch the refresh rate seamlessly, add a new helper to
identify the mode with the same resolution but low vrefresh
and clock.
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
tests/kms_vrr.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c
index db82cd008..f3cd18dcd 100644
--- a/tests/kms_vrr.c
+++ b/tests/kms_vrr.c
@@ -166,6 +166,24 @@ output_mode_with_maxrate(igt_output_t *output, unsigned int vrr_max)
return mode;
}
+static drmModeModeInfo
+low_rr_mode_with_same_res(igt_output_t *output, unsigned int vrr_min)
+{
+ int i;
+ drmModeConnectorPtr connector = output->config.connector;
+ drmModeModeInfo mode = *igt_output_get_mode(output);
+
+ for (i = 0; i < connector->count_modes; i++)
+ if (connector->modes[i].hdisplay == mode.hdisplay &&
+ connector->modes[i].vdisplay == mode.vdisplay &&
+ connector->modes[i].clock < mode.clock &&
+ connector->modes[i].vrefresh < mode.vrefresh &&
+ connector->modes[i].vrefresh >= vrr_min)
+ mode = connector->modes[i];
+
+ return mode;
+}
+
/* Read min and max vrr range from the connector debugfs. */
static range_t
get_vrr_range(data_t *data, igt_output_t *output)
--
2.40.0
More information about the igt-dev
mailing list