lib/igt_fb: Fix domain tracking for GTT cairo surfaces

If we create a cairo surface using a GTT mmaping, then we need to use
the GTT access domain. cairo surfaces created with a blit temporary (for
unfenced surfaces) still use the CPU domain.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2016-03-02 14:12:12 +00:00
parent 5533f22c35
commit 18d0b1efb8
2 changed files with 4 additions and 2 deletions

View File

@ -967,6 +967,7 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
cairo_format,
fb->width, fb->height,
blit->linear.stride);
fb->domain = I915_GEM_DOMAIN_GTT;
cairo_surface_set_user_data(fb->cairo_surface,
(cairo_user_data_key_t *)create_cairo_surface__blit,
@ -989,6 +990,7 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
cairo_image_surface_create_for_data(ptr,
drm_format_to_cairo(fb->drm_format),
fb->width, fb->height, fb->stride);
fb->domain = I915_GEM_DOMAIN_GTT;
cairo_surface_set_user_data(fb->cairo_surface,
(cairo_user_data_key_t *)create_cairo_surface__gtt,
@ -1005,8 +1007,7 @@ static cairo_surface_t *get_cairo_surface(int fd, struct igt_fb *fb)
create_cairo_surface__gtt(fd, fb);
}
gem_set_domain(fd, fb->gem_handle,
I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
gem_set_domain(fd, fb->gem_handle, fb->domain, fb->domain);
igt_assert(cairo_surface_status(fb->cairo_surface) == CAIRO_STATUS_SUCCESS);
return fb->cairo_surface;

View File

@ -54,6 +54,7 @@ struct igt_fb {
uint64_t tiling;
unsigned size;
cairo_surface_t *cairo_surface;
unsigned domain;
uint32_t src_x;
uint32_t src_y;
uint32_t src_w;