mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-07 08:18:24 +02:00
Inline SHA1_DIGEST_STRING_LENGTH
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40383>
This commit is contained in:
parent
110632f702
commit
0da88d237a
44 changed files with 78 additions and 80 deletions
|
|
@ -571,7 +571,7 @@ radv_dump_shader(struct radv_device *device, struct radv_pipeline *pipeline, str
|
|||
|
||||
if (shader->spirv) {
|
||||
unsigned char sha1[BLAKE3_KEY_LEN + 1];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
|
||||
_mesa_sha1_compute(shader->spirv, shader->spirv_size, sha1);
|
||||
_mesa_sha1_format(sha1buf, sha1);
|
||||
|
|
|
|||
|
|
@ -1131,7 +1131,7 @@ hk_physical_device_init_pipeline_cache(struct hk_physical_device *pdev)
|
|||
|
||||
assert(len == sizeof(renderer) - 2);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, instance->driver_build_sha);
|
||||
|
||||
const uint64_t driver_flags = hk_physical_device_compiler_flags(pdev);
|
||||
|
|
|
|||
|
|
@ -854,7 +854,7 @@ static void
|
|||
v3dv_physical_device_init_disk_cache(struct v3dv_physical_device *device)
|
||||
{
|
||||
#ifdef ENABLE_SHADER_CACHE
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, device->driver_build_sha1);
|
||||
|
||||
assert(device->name);
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ shader_module_compile_to_nir(struct v3dv_device *device,
|
|||
assert(nir->info.stage == gl_stage);
|
||||
|
||||
if (V3D_DBG(SHADERDB) && (!stage->module || stage->module->nir == NULL)) {
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1buf, stage->pipeline->sha1);
|
||||
nir->info.name = ralloc_strdup(nir, sha1buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ v3dv_pipeline_cache_upload_nir(struct v3dv_pipeline *pipeline,
|
|||
|
||||
cache->nir_stats.count++;
|
||||
if (debug_cache) {
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1buf, snir->sha1_key);
|
||||
mesa_logi("pipeline cache %p, new nir entry %s\n", cache, sha1buf);
|
||||
if (dump_stats)
|
||||
|
|
@ -151,7 +151,7 @@ v3dv_pipeline_cache_search_for_nir(struct v3dv_pipeline *pipeline,
|
|||
return NULL;
|
||||
|
||||
if (debug_cache) {
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1buf, sha1_key);
|
||||
|
||||
mesa_logi("pipeline cache %p, search for nir %s\n", cache, sha1buf);
|
||||
|
|
@ -256,7 +256,7 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
|
|||
return NULL;
|
||||
|
||||
if (debug_cache) {
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1buf, sha1_key);
|
||||
|
||||
mesa_logi("pipeline cache %p, search pipeline with key %s\n", cache, sha1buf);
|
||||
|
|
@ -312,7 +312,7 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
|
|||
size_t buffer_size;
|
||||
uint8_t *buffer = disk_cache_get(disk_cache, cache_key, &buffer_size);
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1buf, cache_key);
|
||||
mesa_logi("[v3dv on-disk cache] %s %s\n",
|
||||
buffer ? "hit" : "miss", sha1buf);
|
||||
|
|
@ -452,7 +452,7 @@ pipeline_cache_upload_shared_data(struct v3dv_pipeline_cache *cache,
|
|||
_mesa_hash_table_insert(cache->cache, shared_data->sha1_key, shared_data);
|
||||
cache->stats.count++;
|
||||
if (debug_cache) {
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1buf, shared_data->sha1_key);
|
||||
|
||||
mesa_logi("pipeline cache %p, new cache entry with sha1 key %s:%p\n\n",
|
||||
|
|
@ -480,7 +480,7 @@ pipeline_cache_upload_shared_data(struct v3dv_pipeline_cache *cache,
|
|||
disk_cache_compute_key(disk_cache, shared_data->sha1_key, 20, cache_key);
|
||||
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1buf, shared_data->sha1_key);
|
||||
mesa_logi("[v3dv on-disk cache] storing %s\n", sha1buf);
|
||||
}
|
||||
|
|
@ -818,7 +818,7 @@ v3dv_MergePipelineCaches(VkDevice device,
|
|||
_mesa_hash_table_insert(dst->nir_cache, snir_dst->sha1_key, snir_dst);
|
||||
dst->nir_stats.count++;
|
||||
if (debug_cache) {
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1buf, snir_dst->sha1_key);
|
||||
|
||||
mesa_logi("pipeline cache %p, added nir entry %s "
|
||||
|
|
@ -841,7 +841,7 @@ v3dv_MergePipelineCaches(VkDevice device,
|
|||
|
||||
dst->stats.count++;
|
||||
if (debug_cache) {
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1buf, cache_entry->sha1_key);
|
||||
|
||||
mesa_logi("pipeline cache %p, added entry %s "
|
||||
|
|
|
|||
|
|
@ -2332,7 +2332,7 @@ can_skip_compile(struct gl_context *ctx, struct gl_shader *shader,
|
|||
{
|
||||
if (!force_recompile) {
|
||||
if (ctx->Cache) {
|
||||
char buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char buf[BLAKE3_HEX_LEN];
|
||||
disk_cache_compute_key(ctx->Cache, source, strlen(source),
|
||||
shader->disk_cache_sha1);
|
||||
if (disk_cache_has_key(ctx->Cache, shader->disk_cache_sha1)) {
|
||||
|
|
@ -2544,7 +2544,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
|
|||
ralloc_free(state);
|
||||
|
||||
if (ctx->Cache && shader->CompileStatus == COMPILE_SUCCESS) {
|
||||
char sha1_buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1_buf[BLAKE3_HEX_LEN];
|
||||
disk_cache_put_key(ctx->Cache, shader->disk_cache_sha1);
|
||||
if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
|
||||
_mesa_sha1_format(sha1_buf, shader->disk_cache_sha1);
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ shader_cache_write_program_metadata(struct gl_context *ctx,
|
|||
disk_cache_put(cache, prog->data->sha1, metadata.data, metadata.size,
|
||||
&cache_item_metadata);
|
||||
|
||||
char sha1_buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1_buf[BLAKE3_HEX_LEN];
|
||||
if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
|
||||
_mesa_sha1_format(sha1_buf, prog->data->sha1);
|
||||
fprintf(stderr, "putting program metadata in cache: %s\n", sha1_buf);
|
||||
|
|
@ -195,7 +195,7 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
|
|||
/* DRI config options may also change the output from the compiler so
|
||||
* include them as an input to sha1 creation.
|
||||
*/
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1buf, ctx->Const.dri_config_options_sha1);
|
||||
ralloc_strcat(&buf, sha1buf);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ ir3_disk_cache_init(struct ir3_compiler *compiler)
|
|||
sizeof(compiler->options.uche_trap_base));
|
||||
_mesa_sha1_final(&ctx, sha1);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, sha1);
|
||||
|
||||
uint64_t driver_flags = ir3_shader_debug_hash_key();
|
||||
|
|
@ -225,7 +225,7 @@ ir3_disk_cache_retrieve(struct ir3_shader *shader,
|
|||
compute_variant_key(shader, v, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving variant %s: ", sha1);
|
||||
}
|
||||
|
|
@ -264,7 +264,7 @@ ir3_disk_cache_store(struct ir3_shader *shader,
|
|||
compute_variant_key(shader, v, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing variant %s\n", sha1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -704,7 +704,7 @@ struct ir3_shader_variant {
|
|||
|
||||
struct ir3_info info;
|
||||
|
||||
char sha1_str[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1_str[BLAKE3_HEX_LEN];
|
||||
|
||||
struct ir3_shader_options shader_options;
|
||||
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ enum tu_suspend_resume_state
|
|||
SR_IN_CHAIN_AFTER_PRE_CHAIN,
|
||||
};
|
||||
|
||||
typedef char tu_sha1_str[SHA1_DIGEST_STRING_LENGTH];
|
||||
typedef char tu_sha1_str[BLAKE3_HEX_LEN];
|
||||
|
||||
struct tu_cmd_state
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ struct tu_program_state
|
|||
|
||||
struct tu_program_descriptor_linkage link[MESA_SHADER_STAGES];
|
||||
|
||||
char stage_sha1[MESA_SHADER_STAGES][SHA1_DIGEST_STRING_LENGTH];
|
||||
char stage_sha1[MESA_SHADER_STAGES][BLAKE3_HEX_LEN];
|
||||
|
||||
unsigned dynamic_descriptor_offsets[MAX_SETS];
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ ForwardDecl('struct tu_cmd_buffer')
|
|||
ForwardDecl('struct tu_device')
|
||||
ForwardDecl('struct tu_framebuffer')
|
||||
ForwardDecl('struct tu_tiling_config')
|
||||
ForwardDecl('typedef char tu_sha1_str[SHA1_DIGEST_STRING_LENGTH]')
|
||||
ForwardDecl('typedef char tu_sha1_str[BLAKE3_HEX_LEN]')
|
||||
|
||||
# List of the default tracepoints enabled. By default tracepoints are enabled,
|
||||
# set tp_default_enabled=False to disable them by default.
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ agx_disk_cache_init(struct agx_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
uint64_t driver_flags = screen->dev.debug;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ crocus_disk_cache_store(struct disk_cache *cache,
|
|||
crocus_disk_cache_compute_key(cache, ish, prog_key, prog_key_size, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ crocus_disk_cache_retrieve(struct crocus_context *ice,
|
|||
crocus_disk_cache_compute_key(cache, ish, prog_key, key_size, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving %s: ", sha1);
|
||||
}
|
||||
|
|
@ -250,7 +250,7 @@ crocus_disk_cache_init(struct crocus_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
const uint64_t driver_flags =
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ etna_disk_cache_init(struct etna_compiler *compiler, const char *renderer)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
compiler->disk_cache = disk_cache_create(renderer, timestamp, etna_mesa_debug);
|
||||
|
|
@ -131,7 +131,7 @@ etna_disk_cache_retrieve(struct etna_compiler *compiler, struct etna_shader_vari
|
|||
compute_variant_key(compiler, v, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving variant %s: ", sha1);
|
||||
|
|
@ -167,7 +167,7 @@ etna_disk_cache_store(struct etna_compiler *compiler, struct etna_shader_variant
|
|||
compute_variant_key(compiler, v, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing variant %s\n", sha1);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ iris_disk_cache_store(struct disk_cache *cache,
|
|||
iris_disk_cache_compute_key(cache, ish, prog_key, prog_key_size, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
@ -182,7 +182,7 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
|
|||
iris_disk_cache_compute_key(cache, ish, prog_key, key_size, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving %s: ", sha1);
|
||||
}
|
||||
|
|
@ -335,7 +335,7 @@ iris_disk_cache_init(struct iris_screen *screen)
|
|||
char renderer[5 + 40 + 1] = {0};
|
||||
|
||||
if (screen->brw) {
|
||||
char device_info_sha[SHA1_DIGEST_STRING_LENGTH];
|
||||
char device_info_sha[BLAKE3_HEX_LEN];
|
||||
brw_device_sha1(device_info_sha, screen->devinfo);
|
||||
memcpy(renderer, "iris_", 5);
|
||||
memcpy(renderer + 5, device_info_sha, 40);
|
||||
|
|
@ -353,7 +353,7 @@ iris_disk_cache_init(struct iris_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
const uint64_t driver_flags =
|
||||
|
|
|
|||
|
|
@ -1815,7 +1815,7 @@ iris_debug_archiver_open(void *tmp_ctx, struct iris_screen *screen,
|
|||
if (!INTEL_DEBUG(DEBUG_MDA) || !screen->brw)
|
||||
return NULL;
|
||||
|
||||
char name[SHA1_DIGEST_STRING_LENGTH + 5] = {};
|
||||
char name[BLAKE3_HEX_LEN + 5] = {};
|
||||
{
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char hash[BLAKE3_KEY_LEN];
|
||||
|
|
@ -1827,7 +1827,7 @@ iris_debug_archiver_open(void *tmp_ctx, struct iris_screen *screen,
|
|||
|
||||
_mesa_sha1_format(name, hash);
|
||||
}
|
||||
memcpy(&name[SHA1_DIGEST_STRING_LENGTH - 1], ".iris", 5);
|
||||
memcpy(&name[BLAKE3_HEX_LEN - 1], ".iris", 5);
|
||||
|
||||
debug_archiver *debug_archiver =
|
||||
debug_archiver_open(tmp_ctx, name, PACKAGE_VERSION MESA_GIT_SHA1);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ lima_vs_disk_cache_store(struct disk_cache *cache,
|
|||
disk_cache_compute_key(cache, key, sizeof(*key), cache_key);
|
||||
|
||||
if (lima_debug & LIMA_DEBUG_DISK_CACHE) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ lima_fs_disk_cache_store(struct disk_cache *cache,
|
|||
disk_cache_compute_key(cache, key, sizeof(*key), cache_key);
|
||||
|
||||
if (lima_debug & LIMA_DEBUG_DISK_CACHE) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ lima_vs_disk_cache_retrieve(struct disk_cache *cache,
|
|||
disk_cache_compute_key(cache, key, sizeof(*key), cache_key);
|
||||
|
||||
if (lima_debug & LIMA_DEBUG_DISK_CACHE) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving %s: ", sha1);
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ lima_fs_disk_cache_retrieve(struct disk_cache *cache,
|
|||
disk_cache_compute_key(cache, key, sizeof(*key), cache_key);
|
||||
|
||||
if (lima_debug & LIMA_DEBUG_DISK_CACHE) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving %s: ", sha1);
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ lima_disk_cache_init(struct lima_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
screen->disk_cache = disk_cache_create(screen->base.get_name(&screen->base), timestamp, 0);
|
||||
|
|
|
|||
|
|
@ -888,7 +888,7 @@ lp_disk_cache_create(struct llvmpipe_screen *screen)
|
|||
struct mesa_sha1 ctx;
|
||||
unsigned gallivm_perf = gallivm_get_perf_flags();
|
||||
unsigned char sha1[BLAKE3_KEY_LEN];
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
char cache_id[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_init(&ctx);
|
||||
|
||||
if (!disk_cache_get_function_identifier(lp_disk_cache_create, &ctx) ||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ nouveau_disk_cache_create(struct nouveau_screen *screen)
|
|||
{
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[BLAKE3_KEY_LEN];
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
char cache_id[BLAKE3_HEX_LEN];
|
||||
uint64_t driver_flags = 0;
|
||||
|
||||
_mesa_sha1_init(&ctx);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ panfrost_disk_cache_store(struct disk_cache *cache,
|
|||
panfrost_disk_cache_compute_key(cache, uncompiled, key, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ panfrost_disk_cache_retrieve(struct disk_cache *cache,
|
|||
panfrost_disk_cache_compute_key(cache, uncompiled, key, cache_key);
|
||||
|
||||
if (debug) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[mesa disk cache] retrieving %s: ", sha1);
|
||||
}
|
||||
|
|
@ -158,7 +158,7 @@ panfrost_disk_cache_init(struct panfrost_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
/* Consider any flags affecting the compile when caching */
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ static void r300_disk_cache_create(struct r300_screen* r300screen)
|
|||
{
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[BLAKE3_KEY_LEN];
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
char cache_id[BLAKE3_HEX_LEN];
|
||||
|
||||
_mesa_sha1_init(&ctx);
|
||||
if (!disk_cache_get_function_identifier(r300_disk_cache_create,
|
||||
|
|
|
|||
|
|
@ -755,7 +755,7 @@ static void r600_disk_cache_create(struct r600_common_screen *rscreen)
|
|||
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[BLAKE3_KEY_LEN];
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
char cache_id[BLAKE3_HEX_LEN];
|
||||
|
||||
_mesa_sha1_init(&ctx);
|
||||
if (!disk_cache_get_function_identifier(r600_disk_cache_create,
|
||||
|
|
|
|||
|
|
@ -1183,7 +1183,7 @@ static void si_disk_cache_create(struct si_screen *sscreen)
|
|||
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char sha1[BLAKE3_KEY_LEN];
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
char cache_id[BLAKE3_HEX_LEN];
|
||||
|
||||
_mesa_sha1_init(&ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void v3d_disk_cache_init(struct v3d_screen *screen)
|
|||
const uint8_t *id_sha1 = build_id_data(note);
|
||||
assert(id_sha1);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
screen->disk_cache =
|
||||
|
|
@ -114,7 +114,7 @@ v3d_disk_cache_retrieve(struct v3d_context *v3d,
|
|||
void *buffer = disk_cache_get(cache, cache_key, &buffer_size);
|
||||
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[v3d on-disk cache] %s %s\n",
|
||||
buffer ? "hit" : "miss",
|
||||
|
|
@ -197,7 +197,7 @@ v3d_disk_cache_store(struct v3d_context *v3d,
|
|||
v3d_disk_cache_compute_key(cache, key, cache_key, uncompiled);
|
||||
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[v3d on-disk cache] storing %s\n", sha1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -924,7 +924,7 @@ static void virgl_disk_cache_create(struct virgl_screen *screen)
|
|||
|
||||
uint8_t sha1[BLAKE3_KEY_LEN];
|
||||
_mesa_sha1_final(&sha1_ctx, sha1);
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, sha1);
|
||||
|
||||
screen->disk_cache = disk_cache_create("virgl", timestamp, 0);
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ disk_cache_init(struct zink_screen *screen)
|
|||
blake3_hash blake3;
|
||||
_mesa_blake3_final(&ctx, blake3);
|
||||
|
||||
char cache_id[SHA1_DIGEST_STRING_LENGTH];
|
||||
char cache_id[BLAKE3_HEX_LEN];
|
||||
mesa_bytes_to_hex(cache_id, blake3, BLAKE3_KEY_LEN);
|
||||
|
||||
screen->disk_cache = disk_cache_create("zink", cache_id, 0);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ impl DiskCache {
|
|||
pub fn new(name: &CStr, func_ptrs: &[*mut c_void], flags: u64) -> Option<Self> {
|
||||
let mut sha_ctx = SHA1_CTX::default();
|
||||
let mut sha = [0; BLAKE3_KEY_LEN as usize];
|
||||
let mut cache_id = [0; SHA1_DIGEST_STRING_LENGTH as usize];
|
||||
let mut cache_id = [0; BLAKE3_HEX_LEN as usize];
|
||||
|
||||
let cache = unsafe {
|
||||
SHA1Init(&mut sha_ctx);
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ blorp_debug_archiver_open(void *mem_ctx,
|
|||
|
||||
uint8_t sha1[BLAKE3_KEY_LEN];
|
||||
_mesa_sha1_compute(key, key_size, sha1);
|
||||
char name[SHA1_DIGEST_STRING_LENGTH + 6] = {};
|
||||
char name[BLAKE3_HEX_LEN + 6] = {};
|
||||
_mesa_sha1_format(name, sha1);
|
||||
memcpy(&name[SHA1_DIGEST_STRING_LENGTH - 1], ".blorp", 6);
|
||||
memcpy(&name[BLAKE3_HEX_LEN - 1], ".blorp", 6);
|
||||
|
||||
debug_archiver *archiver = debug_archiver_open(mem_ctx, name, "blorp");
|
||||
debug_archiver_set_prefix(
|
||||
|
|
|
|||
|
|
@ -1345,7 +1345,7 @@ brw_generator::generate_code(const brw_shader &s,
|
|||
|
||||
bool dump_shader_bin = brw_should_dump_shader_bin();
|
||||
unsigned char sha1[BLAKE3_KEY_LEN + 1];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
|
||||
auto override_path = debug_get_option_shader_bin_override_path();
|
||||
if (unlikely(debug_flag || dump_shader_bin || override_path != NULL ||
|
||||
|
|
|
|||
|
|
@ -2189,7 +2189,7 @@ elk_fs_generator::generate_code(const elk_cfg_t *cfg, int dispatch_width,
|
|||
|
||||
bool dump_shader_bin = elk_should_dump_shader_bin();
|
||||
unsigned char sha1[BLAKE3_KEY_LEN + 1];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
|
||||
if (unlikely(debug_flag || dump_shader_bin)) {
|
||||
_mesa_sha1_compute(p->store + start_offset / sizeof(elk_inst),
|
||||
|
|
|
|||
|
|
@ -2222,7 +2222,7 @@ generate_code(struct elk_codegen *p,
|
|||
|
||||
bool dump_shader_bin = elk_should_dump_shader_bin();
|
||||
unsigned char sha1[BLAKE3_KEY_LEN + 1];
|
||||
char sha1buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1buf[BLAKE3_HEX_LEN];
|
||||
|
||||
if (unlikely(debug_enabled || dump_shader_bin)) {
|
||||
_mesa_sha1_compute(p->store, p->next_insn_offset, sha1);
|
||||
|
|
|
|||
|
|
@ -819,7 +819,7 @@ intel_perf_store_configuration(struct intel_perf_config *perf_cfg, int fd,
|
|||
uint8_t hash[BLAKE3_KEY_LEN];
|
||||
_mesa_sha1_final(&sha1_ctx, hash);
|
||||
|
||||
char formatted_hash[SHA1_DIGEST_STRING_LENGTH];
|
||||
char formatted_hash[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(formatted_hash, hash);
|
||||
|
||||
char generated_guid[37];
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ main(int argc, char *argv[])
|
|||
*/
|
||||
if (devinfo.ver >= 9) {
|
||||
JSON_Object *obj = json_object(json);
|
||||
char device_info_sha[SHA1_DIGEST_STRING_LENGTH];
|
||||
char device_info_sha[BLAKE3_HEX_LEN];
|
||||
brw_device_sha1(device_info_sha, &devinfo);
|
||||
json_object_set_string(obj, "shader_cache_sha1", device_info_sha);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2405,7 +2405,7 @@ anv_physical_device_init_disk_cache(struct anv_physical_device *device)
|
|||
device->info.pci_device_id);
|
||||
assert(len == sizeof(renderer) - 2);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, device->driver_build_sha1);
|
||||
|
||||
const uint64_t driver_flags =
|
||||
|
|
|
|||
|
|
@ -1834,7 +1834,7 @@ anv_debug_archiver_init(void *mem_ctx, struct anv_shader_data *shaders_data,
|
|||
struct anv_shader_data *shader_data = &shaders_data[s];
|
||||
struct vk_shader_compile_info *info = shader_data->info;
|
||||
|
||||
char name[SHA1_DIGEST_STRING_LENGTH + 4] = {};
|
||||
char name[BLAKE3_HEX_LEN + 4] = {};
|
||||
{
|
||||
struct mesa_sha1 ctx;
|
||||
unsigned char hash[BLAKE3_KEY_LEN];
|
||||
|
|
@ -1847,7 +1847,7 @@ anv_debug_archiver_init(void *mem_ctx, struct anv_shader_data *shaders_data,
|
|||
|
||||
_mesa_sha1_format(name, hash);
|
||||
}
|
||||
memcpy(&name[SHA1_DIGEST_STRING_LENGTH - 1], ".anv", 4);
|
||||
memcpy(&name[BLAKE3_HEX_LEN - 1], ".anv", 4);
|
||||
|
||||
shader_data->archiver =
|
||||
debug_archiver_open(mem_ctx, name, PACKAGE_VERSION MESA_GIT_SHA1);
|
||||
|
|
|
|||
|
|
@ -1458,7 +1458,7 @@ anv_physical_device_init_disk_cache(struct anv_physical_device *device)
|
|||
device->info.pci_device_id);
|
||||
assert(len == sizeof(renderer) - 2);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, device->driver_build_sha1);
|
||||
|
||||
const uint64_t driver_flags =
|
||||
|
|
|
|||
|
|
@ -1348,7 +1348,7 @@ nvk_physical_device_init_pipeline_cache(struct nvk_physical_device *pdev)
|
|||
pdev->info.chipset);
|
||||
assert(len == sizeof(renderer) - 2);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, instance->driver_build_sha);
|
||||
|
||||
const uint64_t driver_flags = nvk_physical_device_compiler_flags(pdev);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ init_shader_caches(struct panvk_physical_device *device,
|
|||
device->kmod.dev->props.gpu_id);
|
||||
assert(len == sizeof(renderer) - 1);
|
||||
|
||||
char timestamp[SHA1_DIGEST_STRING_LENGTH];
|
||||
char timestamp[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(timestamp, instance->driver_build_sha);
|
||||
|
||||
const uint64_t driver_flags = 0;
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ static void
|
|||
make_cache_file_directory(struct disk_cache *cache, const cache_key key)
|
||||
{
|
||||
char *dir;
|
||||
char buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char buf[BLAKE3_HEX_LEN];
|
||||
|
||||
_mesa_sha1_format(buf, key);
|
||||
if (asprintf(&dir, "%s/%c%c", cache->path, buf[0], buf[1]) == -1)
|
||||
|
|
@ -678,7 +678,7 @@ disk_cache_load_item(struct disk_cache *cache, char *filename, size_t *size)
|
|||
char *
|
||||
disk_cache_get_cache_filename(struct disk_cache *cache, const cache_key key)
|
||||
{
|
||||
char buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char buf[BLAKE3_HEX_LEN];
|
||||
char *filename;
|
||||
|
||||
if (cache->path_init_failed)
|
||||
|
|
|
|||
|
|
@ -153,12 +153,12 @@ update_foz_index(struct foz_db *foz_db, FILE *db_idx, unsigned file_idx)
|
|||
header->payload_size != sizeof(uint64_t))
|
||||
break;
|
||||
|
||||
static_assert(FOSSILIZE_BLOB_HASH_LENGTH <= SHA1_DIGEST_STRING_LENGTH, "");
|
||||
char hash_str[SHA1_DIGEST_STRING_LENGTH] = {0};
|
||||
static_assert(FOSSILIZE_BLOB_HASH_LENGTH <= BLAKE3_HEX_LEN, "");
|
||||
char hash_str[BLAKE3_HEX_LEN] = {0};
|
||||
memcpy(hash_str, bytes_to_read, FOSSILIZE_BLOB_HASH_LENGTH);
|
||||
/* Fill the rest of the key string with zeros. */
|
||||
memset(hash_str + FOSSILIZE_BLOB_HASH_LENGTH, '0',
|
||||
SHA1_DIGEST_STRING_LENGTH - 1 - FOSSILIZE_BLOB_HASH_LENGTH);
|
||||
BLAKE3_HEX_LEN - 1 - FOSSILIZE_BLOB_HASH_LENGTH);
|
||||
|
||||
/* read cache item offset from index file */
|
||||
uint64_t cache_offset;
|
||||
|
|
@ -697,7 +697,7 @@ foz_write_entry(struct foz_db *foz_db, const uint8_t *cache_key_160bit,
|
|||
fseek(foz_db->file[0], 0, SEEK_END);
|
||||
|
||||
/* Write hash header to db */
|
||||
char hash_str[SHA1_DIGEST_STRING_LENGTH];
|
||||
char hash_str[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(hash_str, cache_key_160bit);
|
||||
if (fwrite(hash_str, 1, FOSSILIZE_BLOB_HASH_LENGTH, foz_db->file[0]) !=
|
||||
FOSSILIZE_BLOB_HASH_LENGTH)
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
#include "util/mesa-blake3.h"
|
||||
|
||||
#define SHA1_DIGEST_STRING_LENGTH BLAKE3_HEX_LEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ TEST_P(MesaSHA1TestFixture, Match)
|
|||
unsigned char sha1[BLAKE3_KEY_LEN];
|
||||
_mesa_sha1_compute(p.string, strlen(p.string), sha1);
|
||||
|
||||
char buf[SHA1_DIGEST_STRING_LENGTH];
|
||||
char buf[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_format(buf, sha1);
|
||||
|
||||
ASSERT_TRUE(memcmp(buf, p.expected_sha1, SHA1_LENGTH) == 0)
|
||||
|
|
|
|||
|
|
@ -771,8 +771,8 @@ parseAppAttr(struct OptConfData *data, const char **attr)
|
|||
} else
|
||||
XML_WARNING("Invalid executable_regexp=\"%s\".", exec_regexp);
|
||||
} else if (sha1) {
|
||||
/* SHA1_DIGEST_STRING_LENGTH includes terminating null byte */
|
||||
if (strlen(sha1) != (SHA1_DIGEST_STRING_LENGTH - 1)) {
|
||||
/* BLAKE3_HEX_LEN includes terminating null byte */
|
||||
if (strlen(sha1) != (BLAKE3_HEX_LEN - 1)) {
|
||||
XML_WARNING("Incorrect sha1 application attribute");
|
||||
data->ignoringApp = data->inApp;
|
||||
} else {
|
||||
|
|
@ -782,7 +782,7 @@ parseAppAttr(struct OptConfData *data, const char **attr)
|
|||
if (util_get_process_exec_path(path, ARRAY_SIZE(path)) > 0 &&
|
||||
(content = os_read_file(path, &len))) {
|
||||
uint8_t sha1x[BLAKE3_KEY_LEN];
|
||||
char sha1s[SHA1_DIGEST_STRING_LENGTH];
|
||||
char sha1s[BLAKE3_HEX_LEN];
|
||||
_mesa_sha1_compute(content, len, sha1x);
|
||||
_mesa_sha1_format((char*) sha1s, sha1x);
|
||||
free(content);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue