[igt-dev] [PATCH i-g-t 3/4] lib/igt_fb: Use linear.fb in the converter

Ville Syrjala ville.syrjala at linux.intel.com
Fri Nov 2 19:06:50 UTC 2018


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

The converter operates between the linear and shadow fbs. When using
the blitter path there is no particular reason to assume that the
linear fb and actual fb have the same strides for instance. Thus
consulting the actual fb for metadata is not really correct.

We can also simplify the mmap() path by copying all the original
fb metadata into linear.fb as there we map the original fb directly.
We just have to keep clearing linear.fb.gem_handle so that the
dtor knows which kind of beast it's got.

Cc: Maxime Ripard <maxime.ripard at bootlin.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_fb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index a59b5a884d46..97310f70b635 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1946,7 +1946,7 @@ static void destroy_cairo_surface__convert(void *arg)
 	struct fb_convert cvt = {
 		.dst	= {
 			.ptr	= blit->base.linear.map,
-			.fb	= blit->base.fb,
+			.fb	= &blit->base.linear.fb,
 		},
 
 		.src	= {
@@ -1987,18 +1987,16 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	    fb->tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED) {
 		setup_linear_mapping(fd, fb, &blit->base.linear);
 	} else {
+		blit->base.linear.fb = *fb;
 		blit->base.linear.fb.gem_handle = 0;
 		blit->base.linear.map = map_bo(fd, fb);
 		igt_assert(blit->base.linear.map);
-		blit->base.linear.fb.size = fb->size;
-		memcpy(blit->base.linear.fb.strides, fb->strides, sizeof(fb->strides));
-		memcpy(blit->base.linear.fb.offsets, fb->offsets, sizeof(fb->offsets));
 	}
 
 	cvt.dst.ptr = blit->shadow_ptr;
 	cvt.dst.fb = &blit->shadow_fb;
 	cvt.src.ptr = blit->base.linear.map;
-	cvt.src.fb = blit->base.fb;
+	cvt.src.fb = &blit->base.linear.fb;
 	fb_convert(&cvt);
 
 	fb->cairo_surface =
-- 
2.18.1



More information about the igt-dev mailing list