virgl: add exported dmabuf to BO hash table
authorRob Herring <robh@kernel.org>
Fri, 17 Jun 2016 22:25:35 +0000 (17:25 -0500)
committerDave Airlie <airlied@redhat.com>
Thu, 28 Jul 2016 23:09:56 +0000 (09:09 +1000)
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.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/winsys/virgl/drm/virgl_drm_winsys.c

index 81afa8487323a7fe81066819a11ac75395f5251a..11385b2faae42d2516fee549ee091c69ce1c9bd2 100644 (file)
@@ -489,6 +489,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;