diff options
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 6 | ||||
-rw-r--r-- | src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 10 | ||||
-rw-r--r-- | src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c | 4 | ||||
-rw-r--r-- | src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c | 4 | ||||
-rw-r--r-- | src/gallium/winsys/lima/drm/lima_drm_winsys.c | 4 | ||||
-rw-r--r-- | src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 4 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 20 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 14 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_context.c | 20 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_screen.c | 8 | ||||
-rw-r--r-- | src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 20 |
11 files changed, 52 insertions, 62 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index 18ed3aaa596..8a821c8fd4f 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -198,7 +198,7 @@ void amdgpu_bo_destroy(struct pb_buffer *_buf) simple_mtx_unlock(&ws->sws_list_lock); simple_mtx_lock(&ws->bo_export_table_lock); - util_hash_table_remove(ws->bo_export_table, bo->bo); + _mesa_hash_table_remove_key(ws->bo_export_table, bo->bo); simple_mtx_unlock(&ws->bo_export_table_lock); if (bo->initial_domain & RADEON_DOMAIN_VRAM_GTT) { @@ -1519,7 +1519,7 @@ static struct pb_buffer *amdgpu_bo_from_handle(struct radeon_winsys *rws, amdgpu_add_buffer_to_global_list(bo); - util_hash_table_set(ws->bo_export_table, bo->bo, bo); + _mesa_hash_table_insert(ws->bo_export_table, bo->bo, bo); simple_mtx_unlock(&ws->bo_export_table_lock); return &bo->base; @@ -1602,7 +1602,7 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws, hash_table_set: simple_mtx_lock(&ws->bo_export_table_lock); - util_hash_table_set(ws->bo_export_table, bo->bo, bo); + _mesa_hash_table_insert(ws->bo_export_table, bo->bo, bo); simple_mtx_unlock(&ws->bo_export_table_lock); bo->is_shared = true; diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index f770daafa16..3dff8e46ada 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -139,7 +139,7 @@ static void do_winsys_deinit(struct amdgpu_winsys *ws) pb_slabs_deinit(&ws->bo_slabs[i]); } pb_cache_deinit(&ws->bo_cache); - util_hash_table_destroy(ws->bo_export_table); + _mesa_hash_table_destroy(ws->bo_export_table, NULL); simple_mtx_destroy(&ws->sws_list_lock); simple_mtx_destroy(&ws->global_bo_list_lock); simple_mtx_destroy(&ws->bo_export_table_lock); @@ -165,9 +165,9 @@ static void amdgpu_winsys_destroy(struct radeon_winsys *rws) destroy = pipe_reference(&ws->reference, NULL); if (destroy && dev_tab) { - util_hash_table_remove(dev_tab, ws->dev); - if (util_hash_table_count(dev_tab) == 0) { - util_hash_table_destroy(dev_tab); + _mesa_hash_table_remove_key(dev_tab, ws->dev); + if (_mesa_hash_table_num_entries(dev_tab) == 0) { + _mesa_hash_table_destroy(dev_tab, NULL); dev_tab = NULL; } } @@ -467,7 +467,7 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config, return NULL; } - util_hash_table_set(dev_tab, dev, aws); + _mesa_hash_table_insert(dev_tab, dev, aws); if (aws->reserve_vmid) { r = amdgpu_vm_reserve_vmid(dev, 0); diff --git a/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c b/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c index 1d3f6dc817b..e5e00dd3d64 100644 --- a/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c +++ b/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c @@ -81,7 +81,7 @@ etna_drm_screen_destroy(struct pipe_screen *pscreen) destroy = --screen->refcnt == 0; if (destroy) { int fd = etna_device_fd(screen->dev); - util_hash_table_remove(etna_tab, intptr_to_pointer(fd)); + _mesa_hash_table_remove_key(etna_tab, intptr_to_pointer(fd)); } mtx_unlock(&etna_screen_mutex); @@ -110,7 +110,7 @@ etna_drm_screen_create_renderonly(struct renderonly *ro) pscreen = screen_create(ro); if (pscreen) { int fd = etna_device_fd(etna_screen(pscreen)->dev); - util_hash_table_set(etna_tab, intptr_to_pointer(fd), pscreen); + _mesa_hash_table_insert(etna_tab, intptr_to_pointer(fd), pscreen); /* Bit of a hack, to avoid circular linkage dependency, * ie. pipe driver having to call in to winsys, we diff --git a/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c b/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c index c0da444785f..6bc4853f08a 100644 --- a/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c +++ b/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c @@ -52,7 +52,7 @@ fd_drm_screen_destroy(struct pipe_screen *pscreen) destroy = --screen->refcnt == 0; if (destroy) { int fd = fd_device_fd(screen->dev); - util_hash_table_remove(fd_tab, intptr_to_pointer(fd)); + _mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(fd)); } mtx_unlock(&fd_screen_mutex); @@ -86,7 +86,7 @@ fd_drm_screen_create(int fd, struct renderonly *ro) if (pscreen) { int fd = fd_device_fd(dev); - util_hash_table_set(fd_tab, intptr_to_pointer(fd), pscreen); + _mesa_hash_table_insert(fd_tab, intptr_to_pointer(fd), pscreen); /* Bit of a hack, to avoid circular linkage dependency, * ie. pipe driver having to call in to winsys, we diff --git a/src/gallium/winsys/lima/drm/lima_drm_winsys.c b/src/gallium/winsys/lima/drm/lima_drm_winsys.c index 6dcd21c2e60..046b47b65e7 100644 --- a/src/gallium/winsys/lima/drm/lima_drm_winsys.c +++ b/src/gallium/winsys/lima/drm/lima_drm_winsys.c @@ -47,7 +47,7 @@ lima_drm_screen_destroy(struct pipe_screen *pscreen) mtx_lock(&lima_screen_mutex); destroy = --screen->refcnt == 0; if (destroy) - util_hash_table_remove(fd_tab, intptr_to_pointer(fd)); + _mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(fd)); mtx_unlock(&lima_screen_mutex); if (destroy) { @@ -77,7 +77,7 @@ lima_drm_screen_create(int fd) pscreen = lima_screen_create(dup_fd, NULL); if (pscreen) { - util_hash_table_set(fd_tab, intptr_to_pointer(dup_fd), pscreen); + _mesa_hash_table_insert(fd_tab, intptr_to_pointer(dup_fd), pscreen); /* Bit of a hack, to avoid circular linkage dependency, * ie. pipe driver having to call in to winsys, we diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c index 8547219b689..313126060ba 100644 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c @@ -31,7 +31,7 @@ bool nouveau_drm_screen_unref(struct nouveau_screen *screen) ret = --screen->refcount; assert(ret >= 0); if (ret == 0) - util_hash_table_remove(fd_tab, intptr_to_pointer(screen->drm->fd)); + _mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(screen->drm->fd)); mtx_unlock(&nouveau_screen_mutex); return ret == 0; } @@ -119,7 +119,7 @@ nouveau_drm_screen_create(int fd) * closed by its owner. The hash key needs to live at least as long as * the screen. */ - util_hash_table_set(fd_tab, intptr_to_pointer(dupfd), screen); + _mesa_hash_table_insert(fd_tab, intptr_to_pointer(dupfd), screen); screen->refcount = 1; mtx_unlock(&nouveau_screen_mutex); return &screen->base; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index 6d3e9c9f752..0f3a8aa67cd 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -361,9 +361,9 @@ void radeon_bo_destroy(struct pb_buffer *_buf) memset(&args, 0, sizeof(args)); mtx_lock(&rws->bo_handles_mutex); - util_hash_table_remove(rws->bo_handles, (void*)(uintptr_t)bo->handle); + _mesa_hash_table_remove_key(rws->bo_handles, (void*)(uintptr_t)bo->handle); if (bo->flink_name) { - util_hash_table_remove(rws->bo_names, + _mesa_hash_table_remove_key(rws->bo_names, (void*)(uintptr_t)bo->flink_name); } mtx_unlock(&rws->bo_handles_mutex); @@ -725,7 +725,7 @@ static struct radeon_bo *radeon_create_bo(struct radeon_drm_winsys *rws, return radeon_bo(b); } - util_hash_table_set(rws->bo_vas, (void*)(uintptr_t)bo->va, bo); + _mesa_hash_table_insert(rws->bo_vas, (void*)(uintptr_t)bo->va, bo); mtx_unlock(&rws->bo_handles_mutex); } @@ -1042,7 +1042,7 @@ no_slab: bo->u.real.use_reusable_pool = use_reusable_pool; mtx_lock(&ws->bo_handles_mutex); - util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo); + _mesa_hash_table_insert(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo); mtx_unlock(&ws->bo_handles_mutex); return &bo->base; @@ -1089,7 +1089,7 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws, bo->hash = __sync_fetch_and_add(&ws->next_bo_hash, 1); (void) mtx_init(&bo->u.real.map_mutex, mtx_plain); - util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo); + _mesa_hash_table_insert(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo); mtx_unlock(&ws->bo_handles_mutex); @@ -1123,7 +1123,7 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws, return b; } - util_hash_table_set(ws->bo_vas, (void*)(uintptr_t)bo->va, bo); + _mesa_hash_table_insert(ws->bo_vas, (void*)(uintptr_t)bo->va, bo); mtx_unlock(&ws->bo_handles_mutex); } @@ -1217,9 +1217,9 @@ static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws, (void) mtx_init(&bo->u.real.map_mutex, mtx_plain); if (bo->flink_name) - util_hash_table_set(ws->bo_names, (void*)(uintptr_t)bo->flink_name, bo); + _mesa_hash_table_insert(ws->bo_names, (void*)(uintptr_t)bo->flink_name, bo); - util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo); + _mesa_hash_table_insert(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo); done: mtx_unlock(&ws->bo_handles_mutex); @@ -1254,7 +1254,7 @@ done: return b; } - util_hash_table_set(ws->bo_vas, (void*)(uintptr_t)bo->va, bo); + _mesa_hash_table_insert(ws->bo_vas, (void*)(uintptr_t)bo->va, bo); mtx_unlock(&ws->bo_handles_mutex); } @@ -1299,7 +1299,7 @@ static bool radeon_winsys_bo_get_handle(struct radeon_winsys *rws, bo->flink_name = flink.name; mtx_lock(&ws->bo_handles_mutex); - util_hash_table_set(ws->bo_names, (void*)(uintptr_t)bo->flink_name, bo); + _mesa_hash_table_insert(ws->bo_names, (void*)(uintptr_t)bo->flink_name, bo); mtx_unlock(&ws->bo_handles_mutex); } whandle->handle = bo->flink_name; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index 394ba1f9831..fca5be58751 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -622,9 +622,9 @@ static void radeon_winsys_destroy(struct radeon_winsys *rws) radeon_surface_manager_free(ws->surf_man); } - util_hash_table_destroy(ws->bo_names); - util_hash_table_destroy(ws->bo_handles); - util_hash_table_destroy(ws->bo_vas); + _mesa_hash_table_destroy(ws->bo_names, NULL); + _mesa_hash_table_destroy(ws->bo_handles, NULL); + _mesa_hash_table_destroy(ws->bo_vas, NULL); mtx_destroy(&ws->bo_handles_mutex); mtx_destroy(&ws->vm32.mutex); mtx_destroy(&ws->vm64.mutex); @@ -776,9 +776,9 @@ static bool radeon_winsys_unref(struct radeon_winsys *ws) destroy = pipe_reference(&rws->reference, NULL); if (destroy && fd_tab) { - util_hash_table_remove(fd_tab, intptr_to_pointer(rws->fd)); - if (util_hash_table_count(fd_tab) == 0) { - util_hash_table_destroy(fd_tab); + _mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(rws->fd)); + if (_mesa_hash_table_num_entries(fd_tab) == 0) { + _mesa_hash_table_destroy(fd_tab, NULL); fd_tab = NULL; } } @@ -929,7 +929,7 @@ radeon_drm_winsys_create(int fd, const struct pipe_screen_config *config, return NULL; } - util_hash_table_set(fd_tab, intptr_to_pointer(ws->fd), ws); + _mesa_hash_table_insert(fd_tab, intptr_to_pointer(ws->fd), ws); /* We must unlock the mutex once the winsys is fully initialized, so that * other threads attempting to create the winsys from the same fd will diff --git a/src/gallium/winsys/svga/drm/vmw_context.c b/src/gallium/winsys/svga/drm/vmw_context.c index bc6883ee08c..432f9afcd1f 100644 --- a/src/gallium/winsys/svga/drm/vmw_context.c +++ b/src/gallium/winsys/svga/drm/vmw_context.c @@ -260,7 +260,7 @@ vmw_swc_flush(struct svga_winsys_context *swc, vmw_svga_winsys_surface_reference(&isurf->vsurf, NULL); } - util_hash_table_clear(vswc->hash); + _mesa_hash_table_clear(vswc->hash, NULL); vswc->surface.used = 0; vswc->surface.reserved = 0; @@ -504,12 +504,8 @@ vmw_swc_surface_only_relocation(struct svga_winsys_context *swc, isrf = &vswc->surface.items[vswc->surface.used + vswc->surface.staged]; vmw_svga_winsys_surface_reference(&isrf->vsurf, vsurf); isrf->referenced = FALSE; - /* - * Note that a failure here may just fall back to unhashed behavior - * and potentially cause unnecessary flushing, so ignore the - * return code. - */ - (void) util_hash_table_set(vswc->hash, vsurf, isrf); + + _mesa_hash_table_insert(vswc->hash, vsurf, isrf); ++vswc->surface.staged; vswc->seen_surfaces += vsurf->size; @@ -600,12 +596,8 @@ vmw_swc_shader_relocation(struct svga_winsys_context *swc, ishader = &vswc->shader.items[vswc->shader.used + vswc->shader.staged]; vmw_svga_winsys_shader_reference(&ishader->vshader, vshader); ishader->referenced = FALSE; - /* - * Note that a failure here may just fall back to unhashed behavior - * and potentially cause unnecessary flushing, so ignore the - * return code. - */ - (void) util_hash_table_set(vswc->hash, vshader, ishader); + + _mesa_hash_table_insert(vswc->hash, vshader, ishader); ++vswc->shader.staged; } @@ -682,7 +674,7 @@ vmw_swc_destroy(struct svga_winsys_context *swc) vmw_svga_winsys_shader_reference(&ishader->vshader, NULL); } - util_hash_table_destroy(vswc->hash); + _mesa_hash_table_destroy(vswc->hash, NULL); pb_validate_destroy(vswc->validate); vmw_ioctl_context_destroy(vswc->vws, swc->cid); #ifdef DEBUG diff --git a/src/gallium/winsys/svga/drm/vmw_screen.c b/src/gallium/winsys/svga/drm/vmw_screen.c index cecb932c4c7..8b4b89981b2 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen.c +++ b/src/gallium/winsys/svga/drm/vmw_screen.c @@ -69,7 +69,7 @@ vmw_winsys_create( int fd ) struct stat stat_buf; if (dev_hash == NULL) { - dev_hash = util_hash_table_create(vmw_dev_hash, vmw_dev_compare); + dev_hash = _mesa_hash_table_create(NULL, vmw_dev_hash, vmw_dev_compare); if (dev_hash == NULL) return NULL; } @@ -107,14 +107,12 @@ vmw_winsys_create( int fd ) if (!vmw_winsys_screen_init_svga(vws)) goto out_no_svga; - if (util_hash_table_set(dev_hash, &vws->device, vws) != PIPE_OK) - goto out_no_hash_insert; + _mesa_hash_table_insert(dev_hash, &vws->device, vws); cnd_init(&vws->cs_cond); mtx_init(&vws->cs_mutex, mtx_plain); return vws; -out_no_hash_insert: out_no_svga: vmw_pools_cleanup(vws); out_no_pools: @@ -132,7 +130,7 @@ void vmw_winsys_destroy(struct vmw_winsys_screen *vws) { if (--vws->open_count == 0) { - util_hash_table_remove(dev_hash, &vws->device); + _mesa_hash_table_remove_key(dev_hash, &vws->device); vmw_pools_cleanup(vws); vws->fence_ops->destroy(vws->fence_ops); vmw_ioctl_cleanup(vws); diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c index 4d9aa0332f8..9d8b2f75891 100644 --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c @@ -68,10 +68,10 @@ static void virgl_hw_res_destroy(struct virgl_drm_winsys *qdws, struct drm_gem_close args; mtx_lock(&qdws->bo_handles_mutex); - util_hash_table_remove(qdws->bo_handles, + _mesa_hash_table_remove_key(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle); if (res->flink_name) - util_hash_table_remove(qdws->bo_names, + _mesa_hash_table_remove_key(qdws->bo_names, (void *)(uintptr_t)res->flink_name); mtx_unlock(&qdws->bo_handles_mutex); if (res->ptr) @@ -113,8 +113,8 @@ virgl_drm_winsys_destroy(struct virgl_winsys *qws) virgl_resource_cache_flush(&qdws->cache); - util_hash_table_destroy(qdws->bo_handles); - util_hash_table_destroy(qdws->bo_names); + _mesa_hash_table_destroy(qdws->bo_handles, NULL); + _mesa_hash_table_destroy(qdws->bo_names, NULL); mtx_destroy(&qdws->bo_handles_mutex); mtx_destroy(&qdws->mutex); @@ -387,8 +387,8 @@ virgl_drm_winsys_resource_create_handle(struct virgl_winsys *qws, res->num_cs_references = 0; if (res->flink_name) - util_hash_table_set(qdws->bo_names, (void *)(uintptr_t)res->flink_name, res); - util_hash_table_set(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle, res); + _mesa_hash_table_insert(qdws->bo_names, (void *)(uintptr_t)res->flink_name, res); + _mesa_hash_table_insert(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle, res); done: mtx_unlock(&qdws->bo_handles_mutex); @@ -417,7 +417,7 @@ static boolean virgl_drm_winsys_resource_get_handle(struct virgl_winsys *qws, res->flink_name = flink.name; mtx_lock(&qdws->bo_handles_mutex); - util_hash_table_set(qdws->bo_names, (void *)(uintptr_t)res->flink_name, res); + _mesa_hash_table_insert(qdws->bo_names, (void *)(uintptr_t)res->flink_name, res); mtx_unlock(&qdws->bo_handles_mutex); } whandle->handle = res->flink_name; @@ -427,7 +427,7 @@ static boolean virgl_drm_winsys_resource_get_handle(struct virgl_winsys *qws, if (drmPrimeHandleToFD(qdws->fd, res->bo_handle, DRM_CLOEXEC, (int*)&whandle->handle)) return FALSE; mtx_lock(&qdws->bo_handles_mutex); - util_hash_table_set(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle, res); + _mesa_hash_table_insert(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle, res); mtx_unlock(&qdws->bo_handles_mutex); } @@ -1017,7 +1017,7 @@ virgl_drm_screen_destroy(struct pipe_screen *pscreen) destroy = --screen->refcnt == 0; if (destroy) { int fd = virgl_drm_winsys(screen->vws)->fd; - util_hash_table_remove(fd_tab, intptr_to_pointer(fd)); + _mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(fd)); close(fd); } mtx_unlock(&virgl_screen_mutex); @@ -1055,7 +1055,7 @@ virgl_drm_screen_create(int fd, const struct pipe_screen_config *config) pscreen = virgl_create_screen(vws, config); if (pscreen) { - util_hash_table_set(fd_tab, intptr_to_pointer(dup_fd), pscreen); + _mesa_hash_table_insert(fd_tab, intptr_to_pointer(dup_fd), pscreen); /* Bit of a hack, to avoid circular linkage dependency, * ie. pipe driver having to call in to winsys, we |