diff options
author | Guido Günther <agx@sigxcpu.org> | 2018-03-19 17:45:19 +0100 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2018-03-19 14:26:52 -0500 |
commit | 3ed7a0000840253a233363e64308d93f49c48364 (patch) | |
tree | 4efcaab0da4718fc7d9341b36015067352693750 | |
parent | dc0e65413ef90a5d20a1fdfa3e1e454491c4900e (diff) | |
download | weston-3ed7a0000840253a233363e64308d93f49c48364.tar.gz |
simple-dmabuf-drm: use appropriately sized buffer (freedreno)
Use stride instead of width for buffer calculation.
[Derek Foreman edited the commit log and removed the leftover
initialization of 'size']
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
-rw-r--r-- | clients/simple-dmabuf-drm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index efe3b7f5..2975f3a5 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -221,14 +221,16 @@ static int fd_alloc_bo(struct buffer *buf) { int flags = DRM_FREEDRENO_GEM_CACHE_WCOMBINE; - int size = buf->width * buf->height * buf->bpp / 8; - buf->fd_dev = fd_device_new(buf->drm_fd); + int size; + buf->fd_dev = fd_device_new(buf->drm_fd); + buf->stride = ALIGN(buf->width, 32) * buf->bpp / 8; + size = buf->stride * buf->height; + buf->fd_dev = fd_device_new(buf->drm_fd); buf->fd_bo = fd_bo_new(buf->fd_dev, size, flags); if (!buf->fd_bo) return 0; - buf->stride = ALIGN(buf->width, 32) * buf->bpp / 8; return 1; } |