summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Andersson <g02maran@gmail.com>2013-03-01 22:34:28 +0100
committerAndreas Boll <andreas.boll.dev@gmail.com>2013-04-17 12:45:54 +0200
commit0a4ba02c3d711f0160769d6b8f8cd056a3919ad9 (patch)
treed3a0748cc683c71f13b20c11beb14e3e72213ebc
parentc2e264fd9656e4a62e374b9e73207e2307b40d8e (diff)
winsys/radeon: Only add bo to hash table when creating flink
The problem is that we mix bo handles and flinked names in the hash table. Because kms type handles are not flinked they should not be added to the hash table. If we do that we will sooner or later get a situation where we will overwrite a correct entry because the bo handle was the same as a flinked name. Note: this is a candidate for the stable branches. Reviewed-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit d96d8ed910dcecf4511fbc8c24de292cf04ee1d4)
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 090a6faf50..c9552108e6 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -958,6 +958,10 @@ static boolean radeon_winsys_bo_get_handle(struct pb_buffer *buffer,
bo->flinked = TRUE;
bo->flink = flink.name;
+
+ pipe_mutex_lock(bo->mgr->bo_handles_mutex);
+ util_hash_table_set(bo->mgr->bo_handles, (void*)(uintptr_t)bo->flink, bo);
+ pipe_mutex_unlock(bo->mgr->bo_handles_mutex);
}
whandle->handle = bo->flink;
} else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {