[igt-dev] [PATCH i-g-t] tests/kms_psr: Check for available modesetting support

Chris Wilson chris at chris-wilson.co.uk
Mon Nov 9 11:54:10 UTC 2020


Check that there is a valid output/mode combo before trying to
dereference them.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2212
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/kms_psr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/kms_psr.c b/tests/kms_psr.c
index af81a259b..4b7513d7e 100644
--- a/tests/kms_psr.c
+++ b/tests/kms_psr.c
@@ -411,8 +411,14 @@ static void setup_test_plane(data_t *data, int test_plane)
 
 static void test_setup(data_t *data)
 {
+	igt_require_f(data->output,
+		      "No available output found\n");
+	igt_require_f(data->mode,
+		      "No available mode found on %s\n",
+		      data->output->name);
 	if (data->op_psr_mode == PSR_MODE_2)
 		igt_require(data->supports_psr2);
+
 	psr_enable_if_enabled(data);
 	setup_test_plane(data, data->test_plane_id);
 	igt_assert(psr_wait_entry_if_enabled(data));
-- 
2.29.2



More information about the igt-dev mailing list