[i-g-t 2/2] tests/kms_vrr: Fix hardcoded step size

Bhanuprakash Modem bhanuprakash.modem at intel.com
Thu Jun 20 08:28:34 UTC 2024


In seamless-virtual subtest we are trying different Vrefresh
values between Vmin & Vmax by incrementing the Vrefresh by
by 10 Hz (hardcoded).

With this approach:
- We'll achieve less no. of refresh rates if VRR range is low
    Ex: We can achieve only 1 step between 40 to 60 Hz.
- Execution time will increase in case of high VRR range.
    Ex: We need 30 steps to reach 60 Hz to 360 Hz.

Instead of hardcoding the step size (10 Hz), allow test to
execute fixed number of steps (say 5 steps to reach Vmin to
Vmax) will guarantee to test (5) different refresh rates
between Vmin & Vmax irrespective of the VRR range.

Cc: Manasi Navare <navaremanasi at chromium.org>
Cc: Mitul Golani <mitulkumar.ajitkumar.golani at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_vrr.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c
index 6fd04505e..2ea90cd8e 100644
--- a/tests/kms_vrr.c
+++ b/tests/kms_vrr.c
@@ -740,6 +740,7 @@ test_seamless_virtual_rr_basic(data_t *data, enum pipe pipe, igt_output_t *outpu
 	uint32_t result;
 	unsigned int vrefresh;
 	uint64_t rate[] = {0};
+	uint32_t step_size;
 
 	igt_info("Use HIGH_RR Mode as default\n");
 	kmstest_dump_mode(&data->switch_modes[HIGH_RR_MODE]);
@@ -759,8 +760,14 @@ test_seamless_virtual_rr_basic(data_t *data, enum pipe pipe, igt_output_t *outpu
 		     "Refresh rate (%u Hz) %"PRIu64"ns: Target threshold not reached, result was %u%%\n",
 		     data->switch_modes[HIGH_RR_MODE].vrefresh, rate[0], result);
 
+	/*
+	 * Calculate step size by considering the no. of steps required to
+	 * reach Vmin to Vmax as 5.
+	 */
+	step_size = (data->range.max - data->range.min) / 5;
+
 	/* Switch to Virtual RR */
-	for (vrefresh = data->range.min + 10; vrefresh < data->range.max; vrefresh += 10) {
+	for (vrefresh = data->range.min + step_size; vrefresh < data->range.max; vrefresh += step_size) {
 		drmModeModeInfo virtual_mode = virtual_rr_vrr_range_mode(output, vrefresh);
 
 		igt_info("Requesting Virtual Mode with Refresh Rate (%u Hz): \n", vrefresh);
-- 
2.43.2



More information about the igt-dev mailing list