diff options
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_screen.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nouveau_screen.c | 29 |
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 |