diff options
author | Alexandros Frantzis <alexandros.frantzis@collabora.com> | 2019-03-13 12:16:29 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-06-19 07:44:51 +0000 |
commit | 384210be5a17d63a3673ec8cc943465dacc42b36 (patch) | |
tree | 84d708819f7dd0970d549dd69673a7ae2cee5ef2 | |
parent | 91a6a37d459fc5c6c8cab00a7edc18c1dcb6c735 (diff) | |
download | weston-384210be5a17d63a3673ec8cc943465dacc42b36.tar.gz |
clients/simple-dmabuf-egl: Properly check for error in gbm_bo_get_handle_for_plane
gbm_bo_get_handle_for_plane returns handle.s32 == -1 on error, at least
for the Mesa dri implementation.
Reported-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
(cherry picked from commit ff98a9080fcc1e8689bb5996dd03fc4f1c313983)
-rw-r--r-- | clients/simple-dmabuf-egl.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clients/simple-dmabuf-egl.c b/clients/simple-dmabuf-egl.c index 142d73e7..75d880e0 100644 --- a/clients/simple-dmabuf-egl.c +++ b/clients/simple-dmabuf-egl.c @@ -369,9 +369,17 @@ create_dmabuf_buffer(struct display *display, struct buffer *buffer, #ifdef HAVE_GBM_MODIFIERS buffer->plane_count = gbm_bo_get_plane_count(buffer->bo); for (i = 0; i < buffer->plane_count; ++i) { - uint32_t handle = gbm_bo_get_handle_for_plane(buffer->bo, i).u32; - int ret = drmPrimeHandleToFD(display->gbm.drm_fd, handle, 0, - &buffer->dmabuf_fds[i]); + int ret; + union gbm_bo_handle handle; + + handle = gbm_bo_get_handle_for_plane(buffer->bo, i); + if (handle.s32 == -1) { + fprintf(stderr, "error: failed to get gbm_bo_handle\n"); + goto error; + } + + ret = drmPrimeHandleToFD(display->gbm.drm_fd, handle.u32, 0, + &buffer->dmabuf_fds[i]); if (ret < 0 || buffer->dmabuf_fds[i] < 0) { fprintf(stderr, "error: failed to get dmabuf_fd\n"); goto error; |