[igt-dev] [PATCH i-g-t v2 05/13] igt: fb: Move size computation to the common path

Maxime Ripard maxime.ripard at bootlin.com
Tue Jan 8 15:19:51 UTC 2019


In order to properly support the YUV buffer on non-i915 platforms, we need
to run calc_fb_size for the dumb buffers allocation path too. Move it out
of the special case and in the common code path.

Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
---
 lib/igt_fb.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index d69c3fb2d38d..31e44d6188d9 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -528,16 +528,14 @@ static void clear_yuv_buffer(struct igt_fb *fb)
 /* helpers to create nice-looking framebuffers */
 static int create_bo_for_fb(struct igt_fb *fb)
 {
+	uint64_t size = calc_fb_size(fb);
 	int fd = fb->fd;
 
+	/* respect the size requested by the caller */
+	if (fb->size == 0)
+		fb->size = size;
+
 	if (fb->tiling || fb->size || fb->strides[0] || igt_format_is_yuv(fb->drm_format)) {
-		uint64_t size;
-
-		size = calc_fb_size(fb);
-
-		/* respect the size requested by the caller */
-		if (fb->size == 0)
-			fb->size = size;
 
 		fb->is_dumb = false;
 
-- 
2.20.1



More information about the igt-dev mailing list