summaryrefslogtreecommitdiff
path: root/lib/igt_fb.c
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@bootlin.com>2019-02-08 14:18:55 +0100
committerPaul Kocialkowski <paul.kocialkowski@bootlin.com>2019-02-11 10:53:07 +0100
commit91c9515d683a05df86bca78b086e2e68f504e10f (patch)
tree97e648e4fc1e113723882ae9f8fc86c16bdb35f8 /lib/igt_fb.c
parentd6e7907dcb71f97691f8bceb9b4206c077ff9802 (diff)
igt: fb: Don't pass the stride when allocating a dumb, multi-planar buffer
The dumb buffer allocation API only considers a single plane, and even though allocating multi-planar buffers through it is allowed, the stride it gives back is the the width times the bpp passed as an argument. That doesn't work in our case, since the bpp is going to be the one we give as an argument, but split over three planes so the stride doesn't match anymore. A proper fix for this would be to have a better dumb buffer allocation API, but for the time being, let's do it that way. Reviewed-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r--lib/igt_fb.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ca19c034..dea390b0 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -531,6 +531,7 @@ static int create_bo_for_fb(struct igt_fb *fb)
const struct format_desc_struct *fmt = lookup_drm_format(fb->drm_format);
unsigned int bpp = 0;
unsigned int plane;
+ unsigned *strides = &fb->strides[0];
int fd = fb->fd;
if (fb->tiling || fb->size || fb->strides[0] || igt_format_is_yuv(fb->drm_format)) {
@@ -578,8 +579,22 @@ static int create_bo_for_fb(struct igt_fb *fb)
plane ? fmt->hsub * fmt->vsub : 1);
fb->is_dumb = true;
+
+ /*
+ * We can't really pass the stride array here since the dumb
+ * buffer allocation is assuming that it operates on one
+ * plane, and therefore will calculate the stride as if each
+ * pixel was stored on a single plane.
+ *
+ * This might cause issues at some point on drivers that would
+ * change the stride of YUV buffers, but we haven't
+ * encountered any yet.
+ */
+ if (fb->num_planes > 1)
+ strides = NULL;
+
fb->gem_handle = kmstest_dumb_create(fd, fb->width, fb->height,
- bpp, &fb->strides[0], &fb->size);
+ bpp, strides, &fb->size);
return fb->gem_handle;
}