[PATCH i-g-t 3/5] tests/intel/xe_pxp: use igt_next_crtc()

Jani Nikula
2026-03-06T13:24:23Z

The test doesn't care about pipes, but rather just another CRTC, so
prefer igt_next_crtc() over looping pipes and igt_crtc_for_pipe.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
tests/intel/xe_pxp.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/tests/intel/xe_pxp.c b/tests/intel/xe_pxp.c
index d45bd8feab97..932007873394 100644
--- a/tests/intel/xe_pxp.c
+++ b/tests/intel/xe_pxp.c
@@ -881,8 +881,8 @@ static void test_display_pxp_fb(int fd, igt_display_t *display)
drmModeModeInfo *mode;
igt_fb_t ref_fb, pxp_fb;
igt_plane_t *plane;
- igt_crtc_t *crtc;
- int width = 0, height = 0, i = 0;
+ igt_crtc_t *crtc = NULL;
+ int width = 0, height = 0;
uint32_t q;
uint32_t vm;

@@ -902,15 +902,13 @@ static void test_display_pxp_fb(int fd, igt_display_t *display)
/* Do a modeset on all outputs */
for_each_connected_output(display, output) {
mode = igt_output_get_mode(output);
- crtc = igt_crtc_for_pipe(display, i);
+ crtc = igt_next_crtc(display, crtc);
plane = igt_crtc_get_plane_type(crtc, DRM_PLANE_TYPE_PRIMARY);
igt_require(igt_crtc_connector_valid(crtc, output));
igt_output_set_crtc(output,
crtc);

commit_fb(display, plane, &ref_fb, mode);
-
- i++;
}

/* Create an encrypted FB with the same contents as ref_fb */
@@ -938,8 +936,8 @@ static void test_display_black_pxp_fb(int fd, igt_display_t *display)
drmModeModeInfo *mode;
igt_fb_t ref_fb, pxp_fb;
igt_plane_t *plane;
- igt_crtc_t *crtc;
- int width = 0, height = 0, i = 0;
+ igt_crtc_t *crtc = NULL;
+ int width = 0, height = 0;
uint32_t q;
uint32_t vm;

@@ -960,7 +958,7 @@ static void test_display_black_pxp_fb(int fd, igt_display_t *display)
/* Do a modeset on all outputs */
for_each_connected_output(display, output) {
mode = igt_output_get_mode(output);
- crtc = igt_crtc_for_pipe(display, i);
+ crtc = igt_next_crtc(display, crtc);
plane = igt_crtc_get_plane_type(crtc, DRM_PLANE_TYPE_PRIMARY);
igt_require(igt_crtc_connector_valid(crtc, output));
igt_output_set_crtc(output,
@@ -971,7 +969,6 @@ static void test_display_black_pxp_fb(int fd, igt_display_t *display)
igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);

igt_display_commit2(display, COMMIT_ATOMIC);
- i++;
}

/* Create an fb filled with a non-black color */
--
2.47.3