++vl->used;
if (ht)
- util_hash_table_set(ht, buf, (void *) (unsigned long) vl->used);
+ _mesa_hash_table_insert(ht, buf, (void *) (unsigned long) vl->used);
return PIPE_OK;
}
debug_flush_buf_reference(&item->fbuf, fbuf);
item->bt_depth = fctx->bt_depth;
item->ref_frame = debug_flush_capture_frame(2, item->bt_depth);
- if (util_hash_table_set(fctx->ref_hash, fbuf, item) != PIPE_OK) {
- debug_flush_item_destroy(item);
- goto out_no_item;
- }
+ _mesa_hash_table_insert(fctx->ref_hash, fbuf, item);
return;
}
goto out_no_item;
util_hash_table_foreach(fctx->ref_hash,
debug_flush_flush_cb,
NULL);
- util_hash_table_clear(fctx->ref_hash);
+ _mesa_hash_table_clear(fctx->ref_hash, NULL);
}
void
util_hash_table_foreach(fctx->ref_hash,
debug_flush_flush_cb,
NULL);
- util_hash_table_clear(fctx->ref_hash);
- util_hash_table_destroy(fctx->ref_hash);
+ _mesa_hash_table_clear(fctx->ref_hash, NULL);
+ _mesa_hash_table_destroy(fctx->ref_hash, NULL);
FREE(fctx);
}
#endif
os_abort();
}
- util_hash_table_set(serials_hash, p, (void *) (uintptr_t) serial);
+ _mesa_hash_table_insert(serials_hash, p, (void *) (uintptr_t) serial);
found = FALSE;
}
mtx_unlock(&serials_mutex);
debug_serial_delete(void *p)
{
mtx_lock(&serials_mutex);
- util_hash_table_remove(serials_hash, p);
+ _mesa_hash_table_remove_key(serials_hash, p);
mtx_unlock(&serials_mutex);
}
if (asprintf(&name, "%s%s", procname, ret == -UNW_ENOMEM ? "..." : "") == -1)
name = "??";
- util_hash_table_set(symbols_hash, addr, (void*)name);
+ _mesa_hash_table_insert(symbols_hash, addr, (void*)name);
}
mtx_unlock(&symbols_mutex);
debug_symbol_name(addr, buf, sizeof(buf));
name = strdup(buf);
- util_hash_table_set(symbols_hash, (void*)addr, (void*)name);
+ _mesa_hash_table_insert(symbols_hash, (void*)addr, (void*)name);
}
mtx_unlock(&symbols_mutex);
return name;
**************************************************************************/
-#include "pipe/p_compiler.h"
-#include "util/u_debug.h"
-
-#include "util/u_memory.h"
+#include "util/u_pointer.h"
#include "util/u_hash_table.h"
-#include "util/hash_table.h"
#if DETECT_OS_UNIX
#include <sys/stat.h>
#endif
-struct hash_table *
-util_hash_table_create(uint32_t (*hash)(const void *key),
- bool (*equal)(const void *key1, const void *key2))
-{
- return _mesa_hash_table_create(NULL, hash, equal);
-}
-
-
static uint32_t
pointer_hash(const void *key)
{
}
-enum pipe_error
-util_hash_table_set(struct hash_table *ht,
- void *key,
- void *value)
-{
- _mesa_hash_table_insert(ht, key, value);
- return PIPE_OK;
-}
-
-
void *
util_hash_table_get(struct hash_table *ht,
void *key)
}
-void
-util_hash_table_remove(struct hash_table *ht,
- void *key)
-{
- _mesa_hash_table_remove_key(ht, key);
-}
-
-
-void
-util_hash_table_clear(struct hash_table *ht)
-{
- _mesa_hash_table_clear(ht, NULL);
-}
-
-
enum pipe_error
util_hash_table_foreach(struct hash_table *ht,
enum pipe_error (*callback)
}
return PIPE_OK;
}
-
-
-size_t
-util_hash_table_count(struct hash_table *ht)
-{
- return _mesa_hash_table_num_entries(ht);
-}
-
-
-void
-util_hash_table_destroy(struct hash_table *ht)
-{
- _mesa_hash_table_destroy(ht, NULL);
-}
#include "pipe/p_defines.h"
+#include "util/hash_table.h"
#ifdef __cplusplus
extern "C" {
#endif
-struct hash_table;
-
-
-/**
- * Create an hash table.
- *
- * @param hash hash function
- * @param equal should return true for two equal keys.
- */
-struct hash_table *
-util_hash_table_create(uint32_t (*hash)(const void *key),
- bool (*equal)(const void *key1, const void *key2));
-
/**
* Create a hash table where the keys are generic pointers.
*/
util_hash_table_create_fd_keys(void);
-enum pipe_error
-util_hash_table_set(struct hash_table *ht,
- void *key,
- void *value);
-
void *
util_hash_table_get(struct hash_table *ht,
void *key);
-void
-util_hash_table_remove(struct hash_table *ht,
- void *key);
-
-
-void
-util_hash_table_clear(struct hash_table *ht);
-
-
enum pipe_error
util_hash_table_foreach(struct hash_table *ht,
enum pipe_error (*callback)
(void *key, void *value, void *data),
void *data);
-
-size_t
-util_hash_table_count(struct hash_table *ht);
-
-
-void
-util_hash_table_destroy(struct hash_table *ht);
-
-
#ifdef __cplusplus
}
#endif
return true;
err_out0:
- util_hash_table_destroy(screen->bo_handles);
+ _mesa_hash_table_destroy(screen->bo_handles, NULL);
return false;
}
void lima_bo_table_fini(struct lima_screen *screen)
{
mtx_destroy(&screen->bo_table_lock);
- util_hash_table_destroy(screen->bo_handles);
- util_hash_table_destroy(screen->bo_flink_names);
+ _mesa_hash_table_destroy(screen->bo_handles, NULL);
+ _mesa_hash_table_destroy(screen->bo_flink_names, NULL);
}
static void
bo, bo->size);
mtx_lock(&screen->bo_table_lock);
- util_hash_table_remove(screen->bo_handles,
+ _mesa_hash_table_remove_key(screen->bo_handles,
(void *)(uintptr_t)bo->handle);
if (bo->flink_name)
- util_hash_table_remove(screen->bo_flink_names,
+ _mesa_hash_table_remove_key(screen->bo_flink_names,
(void *)(uintptr_t)bo->flink_name);
mtx_unlock(&screen->bo_table_lock);
bo->flink_name = flink.name;
mtx_lock(&screen->bo_table_lock);
- util_hash_table_set(screen->bo_flink_names,
+ _mesa_hash_table_insert(screen->bo_flink_names,
(void *)(uintptr_t)bo->flink_name, bo);
mtx_unlock(&screen->bo_table_lock);
}
case WINSYS_HANDLE_TYPE_KMS:
mtx_lock(&screen->bo_table_lock);
- util_hash_table_set(screen->bo_handles,
+ _mesa_hash_table_insert(screen->bo_handles,
(void *)(uintptr_t)bo->handle, bo);
mtx_unlock(&screen->bo_table_lock);
return false;
mtx_lock(&screen->bo_table_lock);
- util_hash_table_set(screen->bo_handles,
+ _mesa_hash_table_insert(screen->bo_handles,
(void *)(uintptr_t)bo->handle, bo);
mtx_unlock(&screen->bo_table_lock);
return true;
if (lima_bo_get_info(bo)) {
if (handle->type == WINSYS_HANDLE_TYPE_SHARED)
- util_hash_table_set(screen->bo_flink_names,
+ _mesa_hash_table_insert(screen->bo_flink_names,
(void *)(uintptr_t)bo->flink_name, bo);
- util_hash_table_set(screen->bo_handles,
+ _mesa_hash_table_insert(screen->bo_handles,
(void*)(uintptr_t)bo->handle, bo);
}
else {
bo->offset = get.offset;
assert(bo->offset != 0);
- util_hash_table_set(screen->bo_handles, (void *)(uintptr_t)handle, bo);
+ _mesa_hash_table_insert(screen->bo_handles, (void *)(uintptr_t)handle, bo);
screen->bo_count++;
screen->bo_size += bo->size;
mtx_lock(&bo->screen->bo_handles_mutex);
bo->private = false;
- util_hash_table_set(bo->screen->bo_handles, (void *)(uintptr_t)bo->handle, bo);
+ _mesa_hash_table_insert(bo->screen->bo_handles, (void *)(uintptr_t)bo->handle, bo);
mtx_unlock(&bo->screen->bo_handles_mutex);
return fd;
mtx_lock(&screen->bo_handles_mutex);
if (pipe_reference(&(*bo)->reference, NULL)) {
- util_hash_table_remove(screen->bo_handles,
+ _mesa_hash_table_remove_key(screen->bo_handles,
(void *)(uintptr_t)(*bo)->handle);
v3d_bo_last_unreference(*bo);
}
{
struct v3d_screen *screen = v3d_screen(pscreen);
- util_hash_table_destroy(screen->bo_handles);
+ _mesa_hash_table_destroy(screen->bo_handles, NULL);
v3d_bufmgr_destroy(pscreen);
slab_destroy_parent(&screen->transfer_pool);
free(screen->ro);
bo->map = malloc(bo->size);
#endif
- util_hash_table_set(screen->bo_handles, (void *)(uintptr_t)handle, bo);
+ _mesa_hash_table_insert(screen->bo_handles, (void *)(uintptr_t)handle, bo);
done:
mtx_unlock(&screen->bo_handles_mutex);
mtx_lock(&bo->screen->bo_handles_mutex);
bo->private = false;
- util_hash_table_set(bo->screen->bo_handles, (void *)(uintptr_t)bo->handle, bo);
+ _mesa_hash_table_insert(bo->screen->bo_handles, (void *)(uintptr_t)bo->handle, bo);
mtx_unlock(&bo->screen->bo_handles_mutex);
return fd;
if (pipe_reference_described(&(*bo)->reference, NULL,
(debug_reference_descriptor)
vc4_bo_debug_describe)) {
- util_hash_table_remove(screen->bo_handles,
+ _mesa_hash_table_remove_key(screen->bo_handles,
(void *)(uintptr_t)(*bo)->handle);
vc4_bo_last_unreference(*bo);
}
{
struct vc4_screen *screen = vc4_screen(pscreen);
- util_hash_table_destroy(screen->bo_handles);
+ _mesa_hash_table_destroy(screen->bo_handles, NULL);
vc4_bufmgr_destroy(pscreen);
slab_destroy_parent(&screen->transfer_pool);
free(screen->ro);
if (FAILED(hr))
return hr;
vdecl->fvf = FVF;
- util_hash_table_set(This->ff.ht_fvf, &vdecl->fvf, vdecl);
+ _mesa_hash_table_insert(This->ff.ht_fvf, &vdecl->fvf, vdecl);
NineUnknown_ConvertRefToBind(NineUnknown(vdecl));
}
}
if (FAILED(hr))
return hr;
vdecl->fvf = FVF;
- util_hash_table_set(This->ff.ht_fvf, &vdecl->fvf, vdecl);
+ _mesa_hash_table_insert(This->ff.ht_fvf, &vdecl->fvf, vdecl);
NineUnknown_ConvertRefToBind(NineUnknown(vdecl));
}
return NineDevice9_SetVertexDeclaration(
This->guids = pParams->guids;
This->dtor = pParams->dtor;
- This->pdata = util_hash_table_create(ht_guid_hash, ht_guid_compare);
+ This->pdata = _mesa_hash_table_create(NULL, ht_guid_hash, ht_guid_compare);
if (!This->pdata)
return E_OUTOFMEMORY;
if (This->pdata) {
util_hash_table_foreach(This->pdata, ht_guid_delete, NULL);
- util_hash_table_destroy(This->pdata);
+ _mesa_hash_table_destroy(This->pdata, NULL);
}
FREE(This);
memcpy(header_data, user_data, header->size);
memcpy(&header->guid, refguid, sizeof(header->guid));
- err = util_hash_table_set(This->pdata, &header->guid, header);
- if (err == PIPE_OK) {
- if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header_data); }
- return D3D_OK;
- }
-
- FREE(header);
- if (err == PIPE_ERROR_OUT_OF_MEMORY) { return E_OUTOFMEMORY; }
-
- return D3DERR_DRIVERINTERNALERROR;
+ _mesa_hash_table_insert(This->pdata, &header->guid, header);
+ if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header_data); }
+ return D3D_OK;
}
HRESULT NINE_WINAPI
return D3DERR_NOTFOUND;
ht_guid_delete(NULL, header, NULL);
- util_hash_table_remove(This->pdata, refguid);
+ _mesa_hash_table_remove_key(This->pdata, refguid);
return D3D_OK;
}
{
const struct nine_context *context = &device->context;
struct NineVertexShader9 *vs;
- enum pipe_error err;
struct vs_build_ctx bld;
struct nine_ff_vs_key key;
unsigned s, i;
memcpy(&vs->ff_key, &key, sizeof(vs->ff_key));
- err = util_hash_table_set(device->ff.ht_vs, &vs->ff_key, vs);
- (void)err;
- assert(err == PIPE_OK);
+ _mesa_hash_table_insert(device->ff.ht_vs, &vs->ff_key, vs);
device->ff.num_vs++;
vs->num_inputs = bld.num_inputs;
struct nine_context *context = &device->context;
D3DMATRIX *projection_matrix = GET_D3DTS(PROJECTION);
struct NinePixelShader9 *ps;
- enum pipe_error err;
struct nine_ff_ps_key key;
unsigned s;
uint8_t sampler_mask = 0;
if (ps) {
memcpy(&ps->ff_key, &key, sizeof(ps->ff_key));
- err = util_hash_table_set(device->ff.ht_ps, &ps->ff_key, ps);
- (void)err;
- assert(err == PIPE_OK);
+ _mesa_hash_table_insert(device->ff.ht_ps, &ps->ff_key, ps);
device->ff.num_ps++;
ps->rt_mask = 0x1;
boolean
nine_ff_init(struct NineDevice9 *device)
{
- device->ff.ht_vs = util_hash_table_create(nine_ff_vs_key_hash,
- nine_ff_vs_key_comp);
- device->ff.ht_ps = util_hash_table_create(nine_ff_ps_key_hash,
- nine_ff_ps_key_comp);
+ device->ff.ht_vs = _mesa_hash_table_create(NULL, nine_ff_vs_key_hash,
+ nine_ff_vs_key_comp);
+ device->ff.ht_ps = _mesa_hash_table_create(NULL, nine_ff_ps_key_hash,
+ nine_ff_ps_key_comp);
- device->ff.ht_fvf = util_hash_table_create(nine_ff_fvf_key_hash,
- nine_ff_fvf_key_comp);
+ device->ff.ht_fvf = _mesa_hash_table_create(NULL, nine_ff_fvf_key_hash,
+ nine_ff_fvf_key_comp);
device->ff.vs_const = CALLOC(NINE_FF_NUM_VS_CONST, 4 * sizeof(float));
device->ff.ps_const = CALLOC(NINE_FF_NUM_PS_CONST, 4 * sizeof(float));
{
if (device->ff.ht_vs) {
util_hash_table_foreach(device->ff.ht_vs, nine_ff_ht_delete_cb, NULL);
- util_hash_table_destroy(device->ff.ht_vs);
+ _mesa_hash_table_destroy(device->ff.ht_vs, NULL);
}
if (device->ff.ht_ps) {
util_hash_table_foreach(device->ff.ht_ps, nine_ff_ht_delete_cb, NULL);
- util_hash_table_destroy(device->ff.ht_ps);
+ _mesa_hash_table_destroy(device->ff.ht_ps, NULL);
}
if (device->ff.ht_fvf) {
util_hash_table_foreach(device->ff.ht_fvf, nine_ff_ht_delete_cb, NULL);
- util_hash_table_destroy(device->ff.ht_fvf);
+ _mesa_hash_table_destroy(device->ff.ht_fvf, NULL);
}
device->ff.vs = NULL; /* destroyed by unbinding from hash table */
device->ff.ps = NULL;
/* could destroy the bound one here, so unbind */
context->pipe->bind_vs_state(context->pipe, NULL);
util_hash_table_foreach(device->ff.ht_vs, nine_ff_ht_delete_cb, NULL);
- util_hash_table_clear(device->ff.ht_vs);
+ _mesa_hash_table_clear(device->ff.ht_vs, NULL);
device->ff.num_vs = 0;
context->changed.group |= NINE_STATE_VS;
}
/* could destroy the bound one here, so unbind */
context->pipe->bind_fs_state(context->pipe, NULL);
util_hash_table_foreach(device->ff.ht_ps, nine_ff_ht_delete_cb, NULL);
- util_hash_table_clear(device->ff.ht_ps);
+ _mesa_hash_table_clear(device->ff.ht_ps, NULL);
device->ff.num_ps = 0;
context->changed.group |= NINE_STATE_PS;
}
assert(video_buffer);
assert(video_buffer->buffer_format == p_res->format);
- util_hash_table_set(priv->video_buffer_map, priv->p_outhdr_, video_buffer);
+ _mesa_hash_table_insert(priv->video_buffer_map, priv->p_outhdr_, video_buffer);
}
} else {
(void) tiz_krn_release_buffer(tiz_get_krn (handleOf (priv)),
util_hash_table_foreach(priv->video_buffer_map,
&hash_table_clear_item_callback,
NULL);
- util_hash_table_destroy(priv->video_buffer_map);
+ _mesa_hash_table_destroy(priv->video_buffer_map, NULL);
if (priv->pipe) {
vl_compositor_cleanup_state(&priv->cstate);
if (u_reduce_video_profile(context->decoder->profile) ==
PIPE_VIDEO_FORMAT_MPEG4_AVC) {
if (context->desc.h264enc.frame_idx)
- util_hash_table_destroy (context->desc.h264enc.frame_idx);
+ _mesa_hash_table_destroy(context->desc.h264enc.frame_idx, NULL);
}
if (u_reduce_video_profile(context->decoder->profile) ==
PIPE_VIDEO_FORMAT_HEVC) {
if (context->desc.h265enc.frame_idx)
- util_hash_table_destroy (context->desc.h265enc.frame_idx);
+ _mesa_hash_table_destroy(context->desc.h265enc.frame_idx, NULL);
}
} else {
if (u_reduce_video_profile(context->decoder->profile) ==
PIPE_USAGE_STREAM, coded_buf->size);
context->coded_buf = coded_buf;
- util_hash_table_set(context->desc.h264enc.frame_idx,
+ _mesa_hash_table_insert(context->desc.h264enc.frame_idx,
UINT_TO_PTR(h264->CurrPic.picture_id),
UINT_TO_PTR(h264->frame_num));
context->desc.h265enc.pic.constrained_intra_pred_flag = h265->pic_fields.bits.constrained_intra_pred_flag;
- util_hash_table_set(context->desc.h265enc.frame_idx,
+ _mesa_hash_table_insert(context->desc.h265enc.frame_idx,
UINT_TO_PTR(h265->decoded_curr_pic.picture_id),
UINT_TO_PTR(context->desc.h265enc.frame_num));
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) {
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;
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;
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);
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;
}
}
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);
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);
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
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);
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
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) {
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
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;
}
* 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;
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);
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);
}
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;
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);
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);
}
(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);
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);
}
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;
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);
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;
}
}
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
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;
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;
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;
}
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
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;
}
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:
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);
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)
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);
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);
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;
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);
}
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);
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