summaryrefslogtreecommitdiff
path: root/lib/igt_fb.c
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@bootlin.com>2019-02-08 14:18:53 +0100
committerPaul Kocialkowski <paul.kocialkowski@bootlin.com>2019-02-11 10:53:07 +0100
commit77c6f0abef7136b45b32db4064531cd098de9f22 (patch)
treed56b4d6a1d9c06ce67e37d028f1cc8061670af9f /lib/igt_fb.c
parentad6e1dbe7cd38539df2ed73f02292fcfa8bc157b (diff)
igt: fb: Add size checks and recalculation before dumb allocation
Since we want to use the dumb buffers to store frames in formats with multiple planes, we need to add checks for unsupported corner cases, and we need to calculate the offsets and sizes of each planes. Let's use calc_fb_size for that. Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Reviewed-by: Lyude Paul <lyude@redhat.com>
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r--lib/igt_fb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index c61e6805..ca486551 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -561,6 +561,16 @@ static int create_bo_for_fb(struct igt_fb *fb)
}
}
+ /*
+ * The current dumb buffer allocation API doesn't really allow to
+ * specify a custom size or stride. Yet the caller is free to specify
+ * them, so we need to make sure to error out in this case.
+ */
+ igt_assert(fb->size == 0);
+ igt_assert(fb->strides[0] == 0);
+
+ fb->size = calc_fb_size(fb);
+
fb->is_dumb = true;
fb->gem_handle = kmstest_dumb_create(fd, fb->width, fb->height,
fb->plane_bpp[0],