[Mesa-dev] [PATCH] virgl: add exported dmabuf to BO hash table

Rob Herring robh at kernel.org
Fri Jun 17 22:25:35 UTC 2016


Exported dmabufs can get imported by the same process, but the handle was
not getting added to the hash table on export. Add the handle to the hash
table on export.

Cc: Dave Airlie <airlied at redhat.com>
Signed-off-by: Rob Herring <robh at kernel.org>
---
 src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
index cbd416c..8336a33 100644
--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
+++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
@@ -486,6 +486,9 @@ static boolean virgl_drm_winsys_resource_get_handle(struct virgl_winsys *qws,
    } else if (whandle->type == DRM_API_HANDLE_TYPE_FD) {
       if (drmPrimeHandleToFD(qdws->fd, res->bo_handle, DRM_CLOEXEC, (int*)&whandle->handle))
             return FALSE;
+      pipe_mutex_lock(qdws->bo_handles_mutex);
+      util_hash_table_set(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle, res);
+      pipe_mutex_unlock(qdws->bo_handles_mutex);
    }
    whandle->stride = stride;
    return TRUE;
-- 
2.7.4



More information about the mesa-dev mailing list