[igt-dev] [PATCH i-g-t 3/4] tests/kms_plane: fix rounding error

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Tue Jun 15 16:00:21 UTC 2021


On some screen sizes with legacy hw there was possible to get
rounding error on source clamping test which would incorrectly
fail clamping tests.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 tests/kms_plane.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index ba419bbde..f22c045d8 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -473,12 +473,19 @@ static void draw_entire_color_array(data_t *data, cairo_t *cr, uint32_t format,
 	const int color_amount = ARRAY_SIZE(colors_extended);
 	const int x = format == DRM_FORMAT_XRGB8888 ? 0 : data->crop;
 
+	if (format != DRM_FORMAT_XRGB8888) {
+		cairo_rectangle(cr, data->crop, data->crop,
+				fb->width - data->crop * 2,
+				fb->height - data->crop * 2);
+	}
+
+
 	for (int n = 0; n < color_amount; n++) {
 		int y = (fb->height - x * 2) * n / color_amount + x;
 
 		igt_paint_color(cr, x, y,
 				fb->width - x * 2,
-				(fb->height - x * 2) / color_amount,
+				(fb->height - x * 2) / color_amount + 1,
 				colors_extended[n].red,
 				colors_extended[n].green,
 				colors_extended[n].blue);
-- 
2.28.0



More information about the igt-dev mailing list