From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5063910E3AD for ; Mon, 11 Dec 2023 11:48:20 +0000 (UTC) From: Bhanuprakash Modem To: igt-dev@lists.freedesktop.org, mitulkumar.ajitkumar.golani@intel.com Subject: [i-g-t V7 4/8] tests/kms_vrr: Fix pipe/output combo validity constraint Date: Mon, 11 Dec 2023 17:06:46 +0530 Message-Id: <20231211113650.3520399-5-bhanuprakash.modem@intel.com> In-Reply-To: <20231211113650.3520399-1-bhanuprakash.modem@intel.com> References: <20231211113650.3520399-1-bhanuprakash.modem@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: Before starting the subtest, we are checking the selected pipe/output combo validity with default mode, but inside the subtest we are using the mode with highest resolution. Few panels exposes 4K as a default mode even though it supports 8K, in this scenario test may misbehave. So, check the pipe/output combo validity with the mode that we are actually going to use in the subtest. V2: Reword the commit message Signed-off-by: Bhanuprakash Modem --- tests/kms_vrr.c | 62 +++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c index df241aa6c..4540d8b4b 100644 --- a/tests/kms_vrr.c +++ b/tests/kms_vrr.c @@ -163,9 +163,6 @@ output_mode_with_maxrate(igt_output_t *output, unsigned int vrr_max) connector->modes[i].vrefresh <= vrr_max) mode = connector->modes[i]; - igt_info("Override Mode: "); - kmstest_dump_mode(&mode); - return mode; } @@ -233,21 +230,7 @@ static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe) drmModeModeInfo mode; cairo_t *cr; - /* Reset output */ - igt_display_reset(&data->display); - igt_output_set_pipe(output, pipe); - - /* Capture VRR range */ - data->range = get_vrr_range(data, output); - - /* Override mode with max vrefresh. - * - vrr_min range should be less than the override mode vrefresh. - * - Limit the vrr_max range with the override mode vrefresh. - */ - mode = output_mode_with_maxrate(output, data->range.max); - igt_require(mode.vrefresh > data->range.min); - data->range.max = mode.vrefresh; - igt_output_override_mode(output, &mode); + mode = *igt_output_get_mode(output); /* Prepare resources */ igt_create_color_fb(data->drm_fd, mode.hdisplay, mode.vdisplay, @@ -483,7 +466,36 @@ static void test_cleanup(data_t *data, enum pipe pipe, igt_output_t *output) igt_remove_fb(data->drm_fd, &data->fb0); } -static bool config_constraint(igt_output_t *output, uint32_t flags) +static bool output_constraint(data_t *data, igt_output_t *output) +{ + drmModeModeInfo mode; + + /* Reset output */ + igt_display_reset(&data->display); + + /* Capture VRR range */ + data->range = get_vrr_range(data, output); + + /* + * Override mode with max vrefresh. + * - vrr_min range should be less than the override mode vrefresh. + * - Limit the vrr_max range with the override mode vrefresh. + */ + mode = output_mode_with_maxrate(output, data->range.max); + if (mode.vrefresh < data->range.min) + return false; + + data->range.max = mode.vrefresh; + + igt_info("Override Mode: "); + kmstest_dump_mode(&mode); + + igt_output_override_mode(output, &mode); + + return true; +} + +static bool config_constraint(data_t *data, igt_output_t *output, uint32_t flags) { if (!has_vrr(output)) return false; @@ -495,6 +507,9 @@ static bool config_constraint(igt_output_t *output, uint32_t flags) if ((flags & ~TEST_NEGATIVE) && !vrr_capable(output)) return false; + if (!output_constraint(data, output)) + return false; + return true; } @@ -507,16 +522,17 @@ run_vrr_test(data_t *data, test_t test, uint32_t flags) for_each_connected_output(&data->display, output) { enum pipe pipe; - if (!config_constraint(output, flags)) + if (!config_constraint(data, output, flags)) continue; for_each_pipe(&data->display, pipe) { if (igt_pipe_connector_valid(pipe, output)) { - igt_display_reset(&data->display); - igt_output_set_pipe(output, pipe); - if (!intel_pipe_output_combo_valid(&data->display)) + + if (!intel_pipe_output_combo_valid(&data->display)) { + igt_output_set_pipe(output, PIPE_NONE); continue; + } igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), output->name) -- 2.40.0