[PATCH i-g-t] tests/intel/xe_pxp: Require output for display tests

Jonathan Cavitt <[email protected]>
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
The subtests display-pxp-fb and display-black-pxp-fb both call the
function igt_create_color_fb with a width and height value generated by
getting outputs from for_each_connected_output and selecting the maximum
width and height among all available connected outputs.  If there are no
such outputs, then the resulting values will be zero, which is an invalid
input for the DRM_XE_CREATE_DUMB ioctl.

Skip these tests if there are no connected outputs.

Signed-off-by: Jonathan Cavitt <[email protected]>
Cc: Daniele Ceraolo Spurio <[email protected]>
Cc: Ville Syrjälä <[email protected]>
---
 tests/intel/xe_pxp.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/intel/xe_pxp.c b/tests/intel/xe_pxp.c
index 9320078733..080dc9519e 100644
--- a/tests/intel/xe_pxp.c
+++ b/tests/intel/xe_pxp.c
@@ -868,6 +868,18 @@ static void compare_crcs(int fd, igt_display_t *display, igt_fb_t *ref_fb, igt_f
 	}
 }
 
+static void require_connected_output(igt_display_t *display)
+{
+	igt_output_t *output;
+	bool connected_output = false;
+
+	for_each_connected_output(display, output) {
+		connected_output = true;
+		break;
+	}
+	igt_require_f(connected_output, "Display has no connected outputs\n");
+}
+
 /**
  * SUBTEST: display-pxp-fb
  * Description: Test that an encrypted fb is displayed correctly by comparing
@@ -1165,12 +1177,14 @@ int igt_main()
 		igt_subtest("display-pxp-fb") {
 			require_display(xe_fd, &display);
 			require_pxp_render(xe_fd, pxp_supported);
+			require_connected_output(&display);
 			test_display_pxp_fb(xe_fd, &display);
 		}
 
 		igt_subtest("display-black-pxp-fb") {
 			require_display(xe_fd, &display);
 			require_pxp_render(xe_fd, pxp_supported);
+			require_connected_output(&display);
 			test_display_black_pxp_fb(xe_fd, &display);
 		}
 	}
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.