[PATCH weston v3 2/3] simple-dmabuf-drm: use large enough buffer for freedreno

Guido Günther agx at sigxcpu.org
Mon Mar 19 12:38:12 UTC 2018


Use stride instead of width fur buffer calculation.

Signed-off-by: Guido Günther <agx at sigxcpu.org>
---
 clients/simple-dmabuf-drm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
index 174d0f85..08e794c8 100644
--- a/clients/simple-dmabuf-drm.c
+++ b/clients/simple-dmabuf-drm.c
@@ -229,13 +229,14 @@ 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);
 
+	buf->stride = ALIGN(buf->width, 32) * buf->bpp / 8;
+	size = buf->stride * buf->height * buf->bpp / 8;
+	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;
 }
 
-- 
2.16.1



More information about the wayland-devel mailing list