winsys/radeon: fix bo with virtual address referencing mismatch
authorMartin Andersson <g02maran@gmail.com>
Sat, 2 Feb 2013 16:55:07 +0000 (17:55 +0100)
committerJerome Glisse <jglisse@redhat.com>
Mon, 11 Feb 2013 23:38:00 +0000 (18:38 -0500)
If the same context try to flink and open the object, use the
same bo struct instead of opening a new gem handle for the object.
This way we avoid avoid having 2 different handle pointing to the
same kernel object which can latter lead to trouble with virtual
address.

Fix:
https://bugs.freedesktop.org/show_bug.cgi?id=60200

Signed-off-by: Martin Andersson <g02maran@gmail.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
src/gallium/winsys/radeon/drm/radeon_drm_bo.c

index bb6e954..2d41c26 100644 (file)
@@ -963,6 +963,10 @@ static boolean radeon_winsys_bo_get_handle(struct pb_buffer *buffer,
         whandle->handle = bo->handle;
     }
 
+    pipe_mutex_lock(bo->mgr->bo_handles_mutex);
+    util_hash_table_set(bo->mgr->bo_handles, (void*)(uintptr_t)whandle->handle, bo);
+    pipe_mutex_unlock(bo->mgr->bo_handles_mutex);
+
     whandle->stride = stride;
     return TRUE;
 }