diff options
author | Timothy Arceri <tarceri@itsqueeze.com> | 2017-02-10 13:02:22 +1100 |
---|---|---|
committer | Timothy Arceri <tarceri@itsqueeze.com> | 2017-02-22 08:40:00 +1100 |
commit | 207e3a6e4b6d70a965f2852204c35ccf42fe3533 (patch) | |
tree | fc7a5a92f2844a355f1558f0a6afe0af9abaec28 /src/amd/vulkan/radv_device.c | |
parent | ed6b47f435d902a26a4c572d4aced7d4a720b6f3 (diff) |
util/radv: move *_get_function_timestamp() to utils
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/amd/vulkan/radv_device.c')
-rw-r--r-- | src/amd/vulkan/radv_device.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 783ab12760..7b8132989c 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -25,14 +25,13 @@ * IN THE SOFTWARE. */ -#include <dlfcn.h> #include <stdbool.h> #include <string.h> #include <unistd.h> #include <fcntl.h> -#include <sys/stat.h> #include "radv_private.h" #include "radv_cs.h" +#include "util/disk_cache.h" #include "util/strtod.h" #include <xf86drm.h> @@ -46,28 +45,13 @@ #include "util/debug.h" static int -radv_get_function_timestamp(void *ptr, uint32_t* timestamp) -{ - Dl_info info; - struct stat st; - if (!dladdr(ptr, &info) || !info.dli_fname) { - return -1; - } - if (stat(info.dli_fname, &st)) { - return -1; - } - *timestamp = st.st_mtim.tv_sec; - return 0; -} - -static int radv_device_get_cache_uuid(enum radeon_family family, void *uuid) { uint32_t mesa_timestamp, llvm_timestamp; uint16_t f = family; memset(uuid, 0, VK_UUID_SIZE); - if (radv_get_function_timestamp(radv_device_get_cache_uuid, &mesa_timestamp) || - radv_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, &llvm_timestamp)) + if (!disk_cache_get_function_timestamp(radv_device_get_cache_uuid, &mesa_timestamp) || + !disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, &llvm_timestamp)) return -1; memcpy(uuid, &mesa_timestamp, 4); |