summaryrefslogtreecommitdiff
path: root/tests/testdisplay.c
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.com>2016-05-06 15:36:22 +0200
committerTomeu Vizoso <tomeu.vizoso@collabora.com>2016-05-19 14:42:39 +0200
commit99bdf4f0ff3e2000afb4bf71f4a73e4589946050 (patch)
treec9e7b73eae76564507c0c627fa5a542370b3e834 /tests/testdisplay.c
parenta1b0ed1dc48ea209b2a3a07a2d24245ad2cd1948 (diff)
tests/testdisplay: Use cairo helpers to draw to plane
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>
Diffstat (limited to 'tests/testdisplay.c')
-rw-r--r--tests/testdisplay.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 00b47bd0..f821bcc6 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)