diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index 53fb6cf3c86..5ee9a0da1cc 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -32,6 +32,7 @@ #endif #include "util/disk_cache.h" +#include "util/hex.h" #include "util/u_debug.h" #include "radv_debug.h" #include "radv_private.h" @@ -2272,7 +2273,7 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm * when creating the cache. */ char buf[VK_UUID_SIZE * 2 + 1]; - disk_cache_format_hex_id(buf, device->cache_uuid, VK_UUID_SIZE * 2); + mesa_bytes_to_hex(buf, device->cache_uuid, VK_UUID_SIZE); device->vk.disk_cache = disk_cache_create(device->name, buf, 0); #endif diff --git a/src/freedreno/vulkan/tu_device.cc b/src/freedreno/vulkan/tu_device.cc index 7497a182bf0..ce1400b4572 100644 --- a/src/freedreno/vulkan/tu_device.cc +++ b/src/freedreno/vulkan/tu_device.cc @@ -16,6 +16,7 @@ #include "git_sha1.h" #include "util/u_debug.h" #include "util/disk_cache.h" +#include "util/hex.h" #include "util/driconf.h" #include "util/os_misc.h" #include "vk_shader_module.h" @@ -388,7 +389,7 @@ tu_physical_device_init(struct tu_physical_device *device, * when creating the cache. */ char buf[VK_UUID_SIZE * 2 + 1]; - disk_cache_format_hex_id(buf, device->cache_uuid, VK_UUID_SIZE * 2); + mesa_bytes_to_hex(buf, device->cache_uuid, VK_UUID_SIZE); device->vk.disk_cache = disk_cache_create(device->name, buf, 0); device->vk.pipeline_cache_import_ops = cache_import_ops; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 41bf0641adf..2ffc941e09a 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -39,6 +39,7 @@ #include "gallivm/lp_bld_type.h" #include "gallivm/lp_bld_nir.h" #include "util/disk_cache.h" +#include "util/hex.h" #include "util/os_misc.h" #include "util/os_time.h" #include "util/u_helpers.h" @@ -950,7 +951,7 @@ lp_disk_cache_create(struct llvmpipe_screen *screen) _mesa_sha1_update(&ctx, &gallivm_perf, sizeof(gallivm_perf)); update_cache_sha1_cpu(&ctx); _mesa_sha1_final(&ctx, sha1); - disk_cache_format_hex_id(cache_id, sha1, 20 * 2); + mesa_bytes_to_hex(cache_id, sha1, 20); screen->disk_shader_cache = disk_cache_create("llvmpipe", cache_id, 0); } diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 23faf23dca7..1cfa3742d0c 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -7,6 +7,7 @@ #include "util/format/u_format.h" #include "util/format/u_format_s3tc.h" #include "util/u_string.h" +#include "util/hex.h" #include "util/os_mman.h" #include "util/os_time.h" @@ -167,7 +168,7 @@ nouveau_disk_cache_create(struct nouveau_screen *screen) return; _mesa_sha1_final(&ctx, sha1); - disk_cache_format_hex_id(cache_id, sha1, 20 * 2); + mesa_bytes_to_hex(cache_id, sha1, 20); if (screen->prefer_nir) driver_flags |= NOUVEAU_SHADER_CACHE_FLAGS_IR_NIR; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index a4ce4d877a8..c86ba4e8e9d 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -26,6 +26,7 @@ #include "util/format/u_format_s3tc.h" #include "util/u_screen.h" #include "util/u_memory.h" +#include "util/hex.h" #include "util/os_time.h" #include "vl/vl_decoder.h" #include "vl/vl_video_buffer.h" @@ -105,7 +106,7 @@ static void r300_disk_cache_create(struct r300_screen* r300screen) return; _mesa_sha1_final(&ctx, sha1); - disk_cache_format_hex_id(cache_id, sha1, 20 * 2); + mesa_bytes_to_hex(cache_id, sha1, 20); r300screen->disk_shader_cache = disk_cache_create(r300_get_family_name(r300screen), diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c index e5762c714bd..6d57f355db5 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.c +++ b/src/gallium/drivers/r600/r600_pipe_common.c @@ -34,6 +34,7 @@ #include "util/format/u_format_s3tc.h" #include "util/u_upload_mgr.h" #include "util/os_time.h" +#include "util/hex.h" #include "vl/vl_decoder.h" #include "vl/vl_video_buffer.h" #include "radeon_video.h" @@ -772,7 +773,7 @@ static void r600_disk_cache_create(struct r600_common_screen *rscreen) return; _mesa_sha1_final(&ctx, sha1); - disk_cache_format_hex_id(cache_id, sha1, 20 * 2); + mesa_bytes_to_hex(cache_id, sha1, 20); /* These flags affect shader compilation. */ uint64_t shader_debug_flags = diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index b876d7a593e..08fe4583c8e 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -34,6 +34,7 @@ #include "ac_shadowed_regs.h" #include "compiler/nir/nir.h" #include "util/disk_cache.h" +#include "util/hex.h" #include "util/u_cpu_detect.h" #include "util/u_log.h" #include "util/u_memory.h" @@ -1093,7 +1094,7 @@ static void si_disk_cache_create(struct si_screen *sscreen) return; _mesa_sha1_final(&ctx, sha1); - disk_cache_format_hex_id(cache_id, sha1, 20 * 2); + mesa_bytes_to_hex(cache_id, sha1, 20); sscreen->disk_shader_cache = disk_cache_create(sscreen->info.name, cache_id, sscreen->info.address32_hi); diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 3650e397f9c..4df6fc8aa6c 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -46,6 +46,7 @@ #include "util/u_string.h" #include "util/perf/u_trace.h" #include "util/u_transfer_helper.h" +#include "util/hex.h" #include "util/xmlconfig.h" #include "util/u_cpu_detect.h" @@ -284,7 +285,7 @@ disk_cache_init(struct zink_screen *screen) _mesa_sha1_final(&ctx, sha1); char cache_id[20 * 2 + 1]; - disk_cache_format_hex_id(cache_id, sha1, 20 * 2); + mesa_bytes_to_hex(cache_id, sha1, 20); screen->disk_cache = disk_cache_create("zink", cache_id, 0); diff --git a/src/gallium/frontends/clover/nir/invocation.cpp b/src/gallium/frontends/clover/nir/invocation.cpp index d898d26c0e7..b0df3a81bb3 100644 --- a/src/gallium/frontends/clover/nir/invocation.cpp +++ b/src/gallium/frontends/clover/nir/invocation.cpp @@ -36,6 +36,7 @@ #include #include #include +#include using namespace clover; @@ -239,7 +240,7 @@ struct disk_cache *clover::nir::create_clc_disk_cache(void) _mesa_sha1_final(&ctx, sha1); - disk_cache_format_hex_id(cache_id, sha1, 20 * 2); + mesa_bytes_to_hex(cache_id, sha1, 20); return disk_cache_create("clover-clc", cache_id, 0); } diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h index 32f638010b5..511450fee8c 100644 --- a/src/util/disk_cache.h +++ b/src/util/disk_cache.h @@ -33,7 +33,6 @@ #include #include #include -#include "util/hex.h" #include "util/mesa-sha1.h" #include "util/detect_os.h" @@ -80,12 +79,6 @@ struct cache_item_metadata { struct disk_cache; -static inline char * -disk_cache_format_hex_id(char *buf, const uint8_t *hex_id, unsigned size) -{ - return mesa_bytes_to_hex(buf, hex_id, size / 2); -} - #ifdef HAVE_DLADDR static inline bool disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)