OSDN Git Service

minigbm: Fill sizes[0] in gbm_bo_import
authorStéphane Marchesin <marcheu@chromium.org>
Sat, 12 Mar 2016 06:01:35 +0000 (22:01 -0800)
committerchrome-bot <chrome-bot@chromium.org>
Sat, 12 Mar 2016 11:41:45 +0000 (03:41 -0800)
We need to give useable sizes to imported buffers, not just the ones
we create.

BUG=chromium:592681
TEST=run the test on lumpy

Change-Id: Ife99988600607e2f4a56bbad37b48c21829701dd
Reviewed-on: https://chromium-review.googlesource.com/332448
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
gbm.c

diff --git a/gbm.c b/gbm.c
index b38ba9c..671fec0 100644 (file)
--- a/gbm.c
+++ b/gbm.c
@@ -269,11 +269,12 @@ gbm_bo_import(struct gbm_device *gbm, uint32_t type,
                return NULL;
 
        bo = gbm_bo_new(gbm, fd_data->width, fd_data->height, fd_data->format);
-       bo->strides[0] = fd_data->stride;
-
        if (!bo)
                return NULL;
 
+       bo->strides[0] = fd_data->stride;
+       bo->sizes[0] = fd_data->height * fd_data->stride;
+
        prime_handle.fd = fd_data->fd;
 
        ret = drmIoctl(bo->gbm->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &prime_handle);