summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-09-05 19:55:43 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-09-07 18:27:13 +0300
commit3bd68529c46401630467b85e5a8f1a3902280834 (patch)
treea2ff6fa0969b3ffca7fec1835c28372619908cf1 /lib
parent7d89cc39dde3b4881d85ace45d504cc098fa3684 (diff)
lib/igt_fb: Add missing set_domain calls
We're missing some set_domain calls around the ggtt mmap paths. This means we never tell the kernel that we've dirtied the object. And then at some point down the line the kernel throws the pages into /dev/null instead of hanging on to them/swapping them out because they were never marked as dirty. Throw in the missing set_domains(GTT,GTT) calls and rip out the old bogus set_domain(CPU,CPU). Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_fb.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ae71d967..1085d25d 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -404,6 +404,9 @@ static int create_bo_for_fb(int fd, int width, int height,
bo = gem_create(fd, size);
gem_set_tiling(fd, bo, igt_fb_mod_to_tiling(tiling), stride);
+ gem_set_domain(fd, bo,
+ I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
+
/* Ensure the framebuffer is preallocated */
ptr = gem_mmap__gtt(fd, bo, size, PROT_READ | PROT_WRITE);
igt_assert(*(uint32_t *)ptr == 0);
@@ -1342,6 +1345,9 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
{
void *ptr;
+ gem_set_domain(fd, fb->gem_handle,
+ I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
+
if (fb->is_dumb)
ptr = kmstest_dumb_map_buffer(fd, fb->gem_handle, fb->size,
PROT_READ | PROT_WRITE);
@@ -1790,6 +1796,8 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
setup_linear_mapping(fd, fb, &blit->linear);
} else {
blit->linear.handle = 0;
+ gem_set_domain(fd, fb->gem_handle,
+ I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
blit->linear.map = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
PROT_READ | PROT_WRITE);
igt_assert(blit->linear.map);
@@ -1848,10 +1856,6 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
create_cairo_surface__gtt(fd, fb);
}
- if (!fb->is_dumb)
- gem_set_domain(fd, fb->gem_handle, I915_GEM_DOMAIN_CPU,
- I915_GEM_DOMAIN_CPU);
-
igt_assert(cairo_surface_status(fb->cairo_surface) == CAIRO_STATUS_SUCCESS);
return fb->cairo_surface;
}