[igt-dev] [PATCH i-g-t 1/3] tests/kms_color: Fill entire frame when painting rectangles

sunpeng.li at amd.com sunpeng.li at amd.com
Thu Apr 12 21:37:24 UTC 2018


From: "Leo (Sunpeng) Li" <sunpeng.li at amd.com>

Fill entire frame to avoid garbage data from being included in CRC
calculations.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com>
---
 tests/kms_color.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index dc4fcce..c312697 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -71,6 +71,7 @@ static void paint_gradient_rectangles(data_t *data,
 {
 	cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, fb);
 	int i, l = mode->hdisplay / 3;
+	int rows_remaining = mode->hdisplay % 3;
 
 	/* Paint 3 gradient rectangles with red/green/blue between 1.0 and
 	 * 0.5. We want to avoid 0 so each max LUTs only affect their own
@@ -86,6 +87,16 @@ static void paint_gradient_rectangles(data_t *data,
 					       colors[i].b);
 	}
 
+	if (rows_remaining > 0)
+		igt_paint_color_gradient_range(cr, i * l, 0, rows_remaining,
+					       mode->vdisplay,
+					       colors[i-1].r != 0 ? 0.2 : 0,
+					       colors[i-1].g != 0 ? 0.2 : 0,
+					       colors[i-1].b != 0 ? 0.2 : 0,
+					       colors[i-1].r,
+					       colors[i-1].g,
+					       colors[i-1].b);
+
 	igt_put_cairo_ctx(data->drm_fd, fb, cr);
 }
 
@@ -96,6 +107,7 @@ static void paint_rectangles(data_t *data,
 {
 	cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, fb);
 	int i, l = mode->hdisplay / 3;
+	int rows_remaining = mode->hdisplay % 3;
 
 	/* Paint 3 solid rectangles. */
 	for (i = 0 ; i < 3; i++) {
@@ -103,6 +115,10 @@ static void paint_rectangles(data_t *data,
 				colors[i].r, colors[i].g, colors[i].b);
 	}
 
+	if (rows_remaining > 0)
+		igt_paint_color(cr, i * l, 0, rows_remaining, mode->vdisplay,
+				colors[i-1].r, colors[i-1].g, colors[i-1].b);
+
 	igt_put_cairo_ctx(data->drm_fd, fb, cr);
 }
 
-- 
2.7.4



More information about the igt-dev mailing list