[igt-dev] [PATCH i-g-t v1] tests/kms_rotation_crc: do atomic commit if there are multiple primary planes

Jessica Zhang quic_jesszhan at quicinc.com
Mon May 2 23:49:19 UTC 2022


Currently, IGT uses possible_crtcs to initiate the pipe->planes array and
assumes that the first primary plane it encounters is the primary plane
being assigned to the current pipe within the driver [1]. However, this
is not always the case when there are multiple possible primary planes.

Because of this, it's possible for IGT to assigned an fb to an unused
primary plane, causing the page flip ioctl to throw an error. To avoid
this, let's have IGT do an atomic commit instead of a page flip when
testing on drivers where there are multiple possible primary planes.

[1]
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/lib/igt_kms.c#L2305

Signed-off-by: Jessica Zhang <quic_jesszhan at quicinc.com>
---
 tests/kms_rotation_crc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 50869a08a275..aab75c5ccd80 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -362,8 +362,14 @@ static void test_single_case(data_t *data, enum pipe pipe,
 			     uint32_t format, bool test_bad_format)
 {
 	igt_display_t *display = &data->display;
+	igt_plane_t *current_plane;
 	igt_crc_t crc_output;
 	int ret;
+	int num_primary_planes = 0;
+
+	for_each_plane_on_pipe(&data->display, pipe, current_plane)
+		if (current_plane->type == DRM_PLANE_TYPE_PRIMARY)
+			num_primary_planes++;
 
 	igt_debug("Testing case %i on pipe %s, format %s\n", rect, kmstest_pipe_name(pipe), igt_format_str(format));
 	prepare_fbs(data, output, plane, rect, format);
@@ -409,7 +415,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 		if (igt_rotation_90_or_270(data->rotation))
 			igt_plane_set_size(plane, data->fb.height, data->fb.width);
 
-		if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
+		if (num_primary_planes > 1 || plane->type != DRM_PLANE_TYPE_PRIMARY) {
 			igt_display_commit_atomic(display, DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, NULL);
 		} else {
 			ret = drmModePageFlip(data->gfx_fd,
-- 
2.31.0



More information about the igt-dev mailing list