public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/kms_plane_scaling: Use IGT helpers for selecting planes to scale
@ 2019-03-13 17:24 Nicholas Kazlauskas
  2019-03-13 18:15 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nicholas Kazlauskas @ 2019-03-13 17:24 UTC (permalink / raw)
  To: igt-dev

These tests intend to test scaling on hardware with overlay planes.

They will incorrectly try to scale the cursor plane or occasionally
crash by trying to access planes that don't exist for hardware that
doesn't expose any overlay planes.

Make plane selection explicit by requesting the plane by type and index
using the igt helper igt_pipe_get_plane_type_index.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
---
 tests/kms_plane_scaling.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index d408a203..6fdb50c5 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -269,6 +269,7 @@ static void
 test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
 {
 	igt_display_t *display = &d->display;
+	igt_pipe_t *pipe_obj = &display->pipes[pipe];
 	drmModeModeInfo *mode;
 	int primary_plane_scaling = 0; /* For now */
 	uint64_t tiling = is_i915_device(display->drm_fd) ?
@@ -280,7 +281,7 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
 	mode = igt_output_get_mode(output);
 
 	/* Set up display with plane 1 */
-	d->plane1 = &display->pipes[pipe].planes[0];
+	d->plane1 = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_PRIMARY);
 	prepare_crtc(d, output, pipe, d->plane1, mode);
 
 	igt_create_color_pattern_fb(display->drm_fd, 600, 600,
@@ -311,7 +312,14 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
 	}
 
 	/* Set up fb[1]->plane2 mapping. */
-	d->plane2 = igt_output_get_plane(output, 1);
+	d->plane2 = igt_pipe_get_plane_type_index(pipe_obj,
+						  DRM_PLANE_TYPE_OVERLAY, 0);
+
+	if (!d->plane2) {
+		igt_debug("Plane-2 doesnt exist on pipe %s\n", kmstest_pipe_name(pipe));
+		return;
+	}
+
 	igt_plane_set_fb(d->plane2, &d->fb[1]);
 
 	/* 2nd plane windowed */
@@ -349,14 +357,15 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
 	}
 
 	/* Set up fb[2]->plane3 mapping. */
-	d->plane3 = igt_output_get_plane(output, 2);
-	igt_plane_set_fb(d->plane3, &d->fb[2]);
-
-	if(d->plane3->type == DRM_PLANE_TYPE_CURSOR) {
+	d->plane3 = igt_pipe_get_plane_type_index(pipe_obj,
+						  DRM_PLANE_TYPE_OVERLAY, 1);
+	if(!d->plane3) {
 		igt_debug("Plane-3 doesnt exist on pipe %s\n", kmstest_pipe_name(pipe));
 		return;
 	}
 
+	igt_plane_set_fb(d->plane3, &d->fb[2]);
+
 	/* 3rd plane windowed - no scaling */
 	igt_fb_set_position(&d->fb[2], d->plane3, 100, 100);
 	igt_fb_set_size(&d->fb[2], d->plane3, d->fb[2].width-300, d->fb[2].height-300);
@@ -435,13 +444,14 @@ __test_scaler_with_clipping_clamping_scenario(data_t *d, drmModeModeInfo *mode,
 static void
 test_scaler_with_clipping_clamping_scenario(data_t *d, enum pipe pipe, igt_output_t *output)
 {
+	igt_pipe_t *pipe_obj = &d->display.pipes[pipe];
 	drmModeModeInfo *mode;
 
 	igt_require(get_num_scalers(d, pipe) >= 2);
 
 	mode = igt_output_get_mode(output);
-	d->plane1 = &d->display.pipes[pipe].planes[0];
-	d->plane2 = &d->display.pipes[pipe].planes[1];
+	d->plane1 = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_PRIMARY);
+	d->plane2 = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_OVERLAY);
 	prepare_crtc(d, output, pipe, d->plane1, mode);
 
 	for (int i = 0; i < d->plane1->drm_plane->count_formats; i++) {
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-27 20:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-13 17:24 [igt-dev] [PATCH i-g-t] tests/kms_plane_scaling: Use IGT helpers for selecting planes to scale Nicholas Kazlauskas
2019-03-13 18:15 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-03-14  1:13 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-03-27 20:12 ` [igt-dev] [PATCH i-g-t] " Li, Sun peng (Leo)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox