aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau
diff options
context:
space:
mode:
authorDavid McFarland <[email protected]>2018-10-23 21:51:09 -0300
committerTimothy Arceri <[email protected]>2018-10-26 14:49:22 +1100
commit07a00a8729d709a4c43c828c64242c226607f09a (patch)
treeec5fd349e3367c66aa3c5550eccffda1b853df0d /src/gallium/drivers/nouveau
parent3d198926a487cefc0316c2c4d1ebb20ff8ebf535 (diff)
util: Change remaining uint32 cache ids to sha1
After discussion with Timothy Arceri. disk_cache_get_function_identifier was using only the first byte of the sha1 build-id. Replace disk_cache_get_function_identifier with implementation from radv_get_build_id. Instead of writing a uint32_t it now writes to a mesa_sha1. All drivers using disk_cache_get_function_identifier are updated accordingly. Reviewed-by: Timothy Arceri <[email protected]> Fixes: 83ea8dd99bb1 ("util: add disk_cache_get_function_identifier()")
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index a6c1a2ee47f..e9fe04bddf7 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -148,20 +148,21 @@ nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
static void
nouveau_disk_cache_create(struct nouveau_screen *screen)
{
- uint32_t mesa_id;
- char *mesa_id_str;
- int res;
-
- if (disk_cache_get_function_identifier(nouveau_disk_cache_create,
- &mesa_id)) {
- res = asprintf(&mesa_id_str, "%u", mesa_id);
- if (res != -1) {
- screen->disk_shader_cache =
- disk_cache_create(nouveau_screen_get_name(&screen->base),
- mesa_id_str, 0);
- free(mesa_id_str);
- }
- }
+ struct mesa_sha1 ctx;
+ unsigned char sha1[20];
+ char cache_id[20 * 2 + 1];
+
+ _mesa_sha1_init(&ctx);
+ if (!disk_cache_get_function_identifier(nouveau_disk_cache_create,
+ &ctx))
+ return;
+
+ _mesa_sha1_final(&ctx, sha1);
+ disk_cache_format_hex_id(cache_id, sha1, 20 * 2);
+
+ screen->disk_shader_cache =
+ disk_cache_create(nouveau_screen_get_name(&screen->base),
+ cache_id, 0);
}
int