summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2019-02-15 14:52:00 +0100
committerPhilipp Zabel <philipp.zabel@gmail.com>2019-02-25 17:19:54 +0100
commit1c49b5445ebeb84f1767811b6400a0fe87897acf (patch)
tree19d3f52449365d0593e721b6d8f718d1c5d451c6
parent2914a6da8b73e4e49d781b8db60f9179fa08fe45 (diff)
downloadweston-1c49b5445ebeb84f1767811b6400a0fe87897acf.tar.gz
compositor-drm: fix gbm_bo_get_handle_for_plane error handling
gbm_bo_get_handle_for_plane returns -1 on error, not 0. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r--libweston/compositor-drm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 39397630..905a0869 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -1246,9 +1246,12 @@ drm_fb_get_from_dmabuf(struct linux_dmabuf_buffer *dmabuf,
fb->num_planes = dmabuf->attributes.n_planes;
for (i = 0; i < dmabuf->attributes.n_planes; i++) {
- fb->handles[i] = gbm_bo_get_handle_for_plane(fb->bo, i).u32;
- if (!fb->handles[i])
+ union gbm_bo_handle handle;
+
+ handle = gbm_bo_get_handle_for_plane(fb->bo, i);
+ if (handle.s32 == -1)
goto err_free;
+ fb->handles[i] = handle.u32;
}
if (drm_fb_addfb(backend, fb) != 0)