util: Call mesa_bytes_to_hex directly instead of disk_cache_format_hex_id.

The formatting is nothing specific about the disk cache.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22527>
This commit is contained in:
Tatsuyuki Ishi 2023-04-17 22:12:25 +09:00 committed by Marge Bot
parent 681d8cd9ea
commit 3678c28d3d
10 changed files with 18 additions and 16 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);
}

View file

@ -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;

View file

@ -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),

View file

@ -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 =

View file

@ -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);

View file

@ -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);

View file

@ -36,6 +36,7 @@
#include <compiler/nir/nir_serialize.h>
#include <compiler/spirv/nir_spirv.h>
#include <util/u_math.h>
#include <util/hex.h>
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);
}

View file

@ -33,7 +33,6 @@
#include <stdint.h>
#include <stdbool.h>
#include <sys/stat.h>
#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)