OSDN Git Service

freedreno: get bo size for imported dma-buf
authorVarad Gautam <varadgautam@gmail.com>
Fri, 21 Aug 2015 16:44:35 +0000 (22:14 +0530)
committerRob Clark <robclark@freedesktop.org>
Sun, 23 Aug 2015 16:33:45 +0000 (12:33 -0400)
Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
freedreno/freedreno_bo.c

index eabffe9..596bfbc 100644 (file)
@@ -237,8 +237,9 @@ fd_bo_from_dmabuf(struct fd_device *dev, int fd)
                return NULL;
        }
 
-       /* hmm, would be nice if we had a way to figure out the size.. */
-       size = 0;
+       /* lseek() to get bo size */
+       size = lseek(fd, 0, SEEK_END);
+       lseek(fd, 0, SEEK_CUR);
 
        bo = fd_bo_from_handle(dev, req.handle, size);
        bo->fd = fd;