[igt-dev] [PATCH i-g-t v2 07/13] igt: fb: Account for all planes bpp
Maxime Ripard
maxime.ripard at bootlin.com
Tue Jan 8 15:19:53 UTC 2019
When allocating a dumb buffer for a format with multiple plane, we need to
account for all plane's bpp in order to allocate the proper size.
Let's add all the planes bpp and use the result to allocate our buffer.
Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
---
lib/igt_fb.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 2c33a899bc04..96d56d0e63be 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -529,6 +529,7 @@ static void clear_yuv_buffer(struct igt_fb *fb)
static int create_bo_for_fb(struct igt_fb *fb)
{
uint64_t size = calc_fb_size(fb);
+ unsigned int plane, bpp;
int fd = fb->fd;
/* respect the size requested by the caller */
@@ -557,10 +558,12 @@ static int create_bo_for_fb(struct igt_fb *fb)
}
}
+ for (plane = 0; plane < fb->num_planes; plane++)
+ bpp += fb->plane_bpp[plane];
+
fb->is_dumb = true;
fb->gem_handle = kmstest_dumb_create(fd, fb->width, fb->height,
- fb->plane_bpp[0],
- &fb->strides[0], &fb->size);
+ bpp, &fb->strides[0], &fb->size);
return fb->gem_handle;
}
--
2.20.1
More information about the igt-dev
mailing list