[PATCH i-g-t 1/3] tests/kms_color_helper: Add a helper to get high resolution mode

Bhanuprakash Modem bhanuprakash.modem at intel.com
Fri May 24 10:12:00 UTC 2024


Add a helper to get the mode with highest possible resolution.

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_color_helper.c | 14 ++++++++++++++
 tests/kms_color_helper.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index 143dff43e..f7d5a0931 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -24,11 +24,25 @@
 
 #include "kms_color_helper.h"
 
+drmModeModeInfo *output_mode_with_max_resolution(igt_output_t *output)
+{
+	igt_info("Default mode: ");
+	kmstest_dump_mode(igt_output_get_mode(output));
+
+	igt_sort_connector_modes(output->config.connector, sort_drm_modes_by_res_dsc);
+
+	igt_info("High resolution mode: ");
+	kmstest_dump_mode(&output->config.connector->modes[0]);
+
+	return &output->config.connector->modes[0];
+}
+
 bool pipe_output_combo_valid(data_t *data, enum pipe pipe)
 {
 	bool ret = true;
 
 	igt_output_set_pipe(data->output, pipe);
+	igt_output_override_mode(data->output, data->mode);
 	if (!intel_pipe_output_combo_valid(&data->display))
 		ret = false;
 	igt_output_set_pipe(data->output, PIPE_NONE);
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index 23463b944..8162c440d 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -69,6 +69,7 @@ typedef struct {
 	color_t coeffs[];
 } gamma_lut_t;
 
+drmModeModeInfo *output_mode_with_max_resolution(igt_output_t *output);
 bool pipe_output_combo_valid(data_t *data, enum pipe pipe);
 bool panel_supports_deep_color(int fd, char *output_name);
 uint64_t get_max_bpc(igt_output_t *output);
-- 
2.43.2



More information about the igt-dev mailing list