From: Marek Olšák <marek.ol...@amd.com> --- src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 13 +++++-------- 1 file 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 @@ -24,20 +24,21 @@ * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. */ #include "amdgpu_cs.h" #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> #include <sys/stat.h> #include "amd/common/sid.h" #include "amd/common/gfx9d.h" #ifndef AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E #endif @@ -180,30 +181,26 @@ static uint64_t amdgpu_query_value(struct radeon_winsys *rws, static bool amdgpu_read_registers(struct radeon_winsys *rws, unsigned reg_offset, unsigned num_registers, uint32_t *out) { struct amdgpu_winsys *ws = (struct amdgpu_winsys*)rws; return amdgpu_read_mm_registers(ws->dev, reg_offset / 4, num_registers, 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; } static bool amdgpu_winsys_unref(struct radeon_winsys *rws) { struct amdgpu_winsys *ws = (struct amdgpu_winsys*)rws; bool destroy; /* When the reference counter drops to zero, remove the device pointer @@ -245,21 +242,21 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config, /* The DRM driver version of amdgpu is 3.x.x. */ if (version->version_major != 3) { drmFreeVersion(version); return NULL; } drmFreeVersion(version); /* 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. */ r = amdgpu_device_initialize(fd, &drm_major, &drm_minor, &dev); if (r) { simple_mtx_unlock(&dev_tab_mutex); fprintf(stderr, "amdgpu: amdgpu_device_initialize failed.\n"); return NULL; } -- 2.17.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev