diff options
author | Marek Olšák <[email protected]> | 2018-07-16 13:10:57 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-07-18 11:56:28 -0400 |
commit | e06b8ec106e64880a56d1cb990836ec3ad6536e6 (patch) | |
tree | 8b113c431f33d74651ded17217640ee4d4fcf8cf /src | |
parent | 53684e91637e06e818866805e9d9881d3ca8beee (diff) |
winsys/amdgpu: use a better hash_pointer function
Tested-by: Leo Liu <[email protected]>
Acked-by: Leo Liu <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index cca6a3cc25b..db7a4d7033c 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -31,6 +31,7 @@ #include "amdgpu_public.h" #include "util/u_hash_table.h" +#include "util/hash_table.h" #include <amdgpu_drm.h> #include <xf86drm.h> #include <stdio.h> @@ -187,16 +188,12 @@ static bool amdgpu_read_registers(struct radeon_winsys *rws, 0xffffffff, 0, out) == 0; } -static unsigned hash_dev(void *key) +static unsigned hash_pointer(void *key) { -#if defined(PIPE_ARCH_X86_64) - return pointer_to_intptr(key) ^ (pointer_to_intptr(key) >> 32); -#else - return pointer_to_intptr(key); -#endif + return _mesa_hash_pointer(key); } -static int compare_dev(void *key1, void *key2) +static int compare_pointers(void *key1, void *key2) { return key1 != key2; } @@ -252,7 +249,7 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config, /* Look up the winsys from the dev table. */ simple_mtx_lock(&dev_tab_mutex); if (!dev_tab) - dev_tab = util_hash_table_create(hash_dev, compare_dev); + dev_tab = util_hash_table_create(hash_pointer, compare_pointers); /* Initialize the amdgpu device. This should always return the same pointer * for the same fd. */ |