diff mbox

[i-g-t,1/2] tests/testdisplay: Use cairo helpers to draw to plane

Message ID 1462541783-9761-1-git-send-email-tomeu.vizoso@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomeu Vizoso May 6, 2016, 1:36 p.m. UTC
Paint the color key with cairo, so the test doesn't have to map the BO
by itself, which depends on the driver being tested.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>

---

Don't know what's the purpose of drawing this rect, so it would be
better to remove it if it isn't needed.
---
 tests/testdisplay.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 00b47bd06280..f821bcc64779 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -226,21 +226,15 @@  static void connector_find_preferred_mode(uint32_t connector_id,
 static void
 paint_color_key(struct igt_fb *fb_info)
 {
-	int i, j;
-	uint32_t *fb_ptr;
-
-	fb_ptr = gem_mmap__gtt(drm_fd, fb_info->gem_handle, fb_info->size,
-			       PROT_READ | PROT_WRITE);
+	cairo_t *cr = igt_get_cairo_ctx(drm_fd, fb_info);
 
-	for (i = crtc_y; i < crtc_y + crtc_h; i++)
-		for (j = crtc_x; j < crtc_x + crtc_w; j++) {
-			uint32_t offset;
+	cairo_rectangle(cr, crtc_x, crtc_y, crtc_w, crtc_h);
+	cairo_set_source_rgb(cr, .8, .8, .8);
+	cairo_fill(cr);
 
-			offset = (i * fb_info->stride / 4) + j;
-			fb_ptr[offset] = SPRITE_COLOR_KEY;
-		}
+	igt_assert(!cairo_status(cr));
 
-	munmap(fb_ptr, fb_info->size);
+	cairo_destroy(cr);
 }
 
 static void paint_image(cairo_t *cr, const char *file)