summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/winsys/virgl/drm/virgl_drm_winsys.c28
-rw-r--r--src/gallium/winsys/virgl/drm/virgl_drm_winsys.h3
2 files changed, 11 insertions, 20 deletions
diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
index 08509224b4f..4c8947bf679 100644
--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
+++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
@@ -60,20 +60,13 @@ static void virgl_hw_res_destroy(struct virgl_drm_winsys *qdws,
{
struct drm_gem_close args;
- if (res->flinked) {
- mtx_lock(&qdws->bo_handles_mutex);
+ mtx_lock(&qdws->bo_handles_mutex);
+ util_hash_table_remove(qdws->bo_handles,
+ (void *)(uintptr_t)res->bo_handle);
+ if (res->flink_name)
util_hash_table_remove(qdws->bo_names,
- (void *)(uintptr_t)res->flink);
- mtx_unlock(&qdws->bo_handles_mutex);
- }
-
- if (res->bo_handle) {
- mtx_lock(&qdws->bo_handles_mutex);
- util_hash_table_remove(qdws->bo_handles,
- (void *)(uintptr_t)res->bo_handle);
- mtx_unlock(&qdws->bo_handles_mutex);
- }
-
+ (void *)(uintptr_t)res->flink_name);
+ mtx_unlock(&qdws->bo_handles_mutex);
if (res->ptr)
os_munmap(res->ptr, res->size);
@@ -483,21 +476,20 @@ static boolean virgl_drm_winsys_resource_get_handle(struct virgl_winsys *qws,
return FALSE;
if (whandle->type == WINSYS_HANDLE_TYPE_SHARED) {
- if (!res->flinked) {
+ if (!res->flink_name) {
memset(&flink, 0, sizeof(flink));
flink.handle = res->bo_handle;
if (drmIoctl(qdws->fd, DRM_IOCTL_GEM_FLINK, &flink)) {
return FALSE;
}
- res->flinked = TRUE;
- res->flink = flink.name;
+ res->flink_name = flink.name;
mtx_lock(&qdws->bo_handles_mutex);
- util_hash_table_set(qdws->bo_names, (void *)(uintptr_t)res->flink, res);
+ util_hash_table_set(qdws->bo_names, (void *)(uintptr_t)res->flink_name, res);
mtx_unlock(&qdws->bo_handles_mutex);
}
- whandle->handle = res->flink;
+ whandle->handle = res->flink_name;
} else if (whandle->type == WINSYS_HANDLE_TYPE_KMS) {
whandle->handle = res->bo_handle;
} else if (whandle->type == WINSYS_HANDLE_TYPE_FD) {
diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h
index d30fe2a0dcc..c0d1ae568a7 100644
--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h
+++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h
@@ -47,8 +47,7 @@ struct virgl_hw_res {
uint32_t bind;
boolean cacheable;
int64_t start, end;
- boolean flinked;
- uint32_t flink;
+ uint32_t flink_name;
};
struct virgl_drm_winsys