public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/igt_fb: Add missing set_domain calls
@ 2018-09-06 12:27 Ville Syrjala
  2018-09-06 12:34 ` Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ville Syrjala @ 2018-09-06 12:27 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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>
---
 lib/igt_fb.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ae71d9673228..1085d25d33ce 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;
 }
-- 
2.16.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-06 17:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-06 12:27 [igt-dev] [PATCH i-g-t] lib/igt_fb: Add missing set_domain calls Ville Syrjala
2018-09-06 12:34 ` Chris Wilson
2018-09-06 14:58 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-09-06 17:09 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox