@@ -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)
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(-)