[PATCH i-g-t v3 2/8] tests/kms_plane_scaling: Fix basic scaling test, v3.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mahesh Kumar <mahesh1.kumar@xxxxxxxxx>

PIPEC doesnt have 3rd plane in GEN9. So, we skip the
3rd plane related scaling test where 2nd OVERLAY
plane is not available.

Restricting downscaling to (9/10)x original size of the
image to avoid "Max pixel rate limitation" of the hardware.

When testing with a resolution of 1024x768, the test fails
in iterate_plane_scaling because height becomes out of bounds.

Lastly, instead of a fixed test image, generate a test pattern
at runtime to not run into bxt's hardware limits for scaling.

Later patches in this series will cover corner cases of
scaling.

Changes since v1:
- Move out the code reshuffle to a separate commit. (Maarten)
  This makes it more clear what's fixed.
Changes since v2:
- Fix iterate_plane_scaling on 1024x768. (Maarten)
- Instead of upscaling a test image, use the test pattern with a color. (Maarten)
  Using a 600x600 test pattern doesn't run into BXT's
  hardware limits for scaling.

Signed-off-by: Mahesh Kumar <mahesh1.kumar@xxxxxxxxx>
Signed-off-by: Jyoti Yadav <jyoti.r.yadav@xxxxxxxxx>
Signed-off-by: Vidya Srinivas <vidya.srinivas@xxxxxxxxx>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
Reviewed-by: Mika Kahola <mika.kahola@xxxxxxxxx> #v2
---
 tests/kms_plane_scaling.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 37e05158b968..cf4a8a116c8b 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -53,8 +53,6 @@ typedef struct {
 	igt_plane_t *plane4;
 } data_t;
 
-#define FILE_NAME   "1080p-left.png"
-
 static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 			igt_plane_t *plane, drmModeModeInfo *mode, enum igt_commit_style s)
 {
@@ -156,7 +154,9 @@ static void iterate_plane_scaling(data_t *d, drmModeModeInfo *mode)
 
 		/* adjust fb size */
 		for (w = mode->hdisplay; w <= d->fb2.width; w+=10) {
-			h = w * mode->hdisplay / mode->vdisplay;
+			/* Source coordinates must not be clipped. */
+			h = min(w * mode->hdisplay / mode->vdisplay, d->fb2.height);
+
 			igt_fb_set_size(&d->fb2, d->plane2, w, h);
 			igt_display_commit2(display, COMMIT_UNIVERSAL);
 		}
@@ -173,11 +173,10 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
 	igt_output_set_pipe(output, pipe);
 	mode = igt_output_get_mode(output);
 
-	/* allocate fb2 with image size */
-	d->fb_id2 = igt_create_image_fb(d->drm_fd, 0, 0,
-					DRM_FORMAT_XRGB8888,
-					LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */
-					FILE_NAME, &d->fb2);
+	d->fb_id2 = igt_create_color_pattern_fb(display->drm_fd, 600, 600,
+						DRM_FORMAT_XRGB8888,
+						LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */
+						.5, .5, .5, &d->fb2);
 	igt_assert(d->fb_id2);
 
 	d->fb_id3 = igt_create_pattern_fb(d->drm_fd,
@@ -231,7 +230,9 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
 	igt_fb_set_position(&d->fb2, d->plane2, 0, 0);
 	igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width, d->fb2.height);
 	igt_plane_set_position(d->plane2, 10, 10);
-	igt_plane_set_size(d->plane2, 500, 500 * d->fb2.height/d->fb2.width);
+
+	/* Downscale (10/9)x of original image */
+	igt_plane_set_size(d->plane2, (d->fb2.width * 10)/9, (d->fb2.height * 10)/9);
 	igt_display_commit2(display, COMMIT_UNIVERSAL);
 
 	if (primary_plane_scaling) {
@@ -247,6 +248,11 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
 	d->plane3 = igt_output_get_plane(output, 2);
 	igt_plane_set_fb(d->plane3, &d->fb3);
 
+	if(d->plane3->type == DRM_PLANE_TYPE_CURSOR) {
+		igt_debug("Plane-3 doesnt exist on pipe %s\n", kmstest_pipe_name(pipe));
+		goto cleanup;
+	}
+
 	/* 3rd plane windowed - no scaling */
 	igt_fb_set_position(&d->fb3, d->plane3, 100, 100);
 	igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-300, d->fb3.height-300);
@@ -280,6 +286,7 @@ test_plane_scaling_on_pipe(data_t *d, enum pipe pipe, igt_output_t *output)
 		igt_display_commit2(display, COMMIT_UNIVERSAL);
 	}
 
+cleanup:
 	/* back to single plane mode */
 	igt_plane_set_fb(d->plane2, NULL);
 	igt_plane_set_fb(d->plane3, NULL);
-- 
2.15.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux