From 48bf7ad3b8910f458f717b86fa5abb457bf4e7b6 Mon Sep 17 00:00:00 2001 From: Mark Janes Date: Wed, 21 Sep 2022 22:39:53 -0700 Subject: [PATCH] iris: use device info sha in device renderer string For iris, use the intel device info hash function instead of PCI ID in the renderer name. The renderer is incorporated into the gallium disk cache for programs, as part of the key for looking up cache entries. PCI ID can vary between on devices which are comparable from the perspective of the shader compiler. A more precise key eliminates redundant entries in a multiplatform shader cache. Reviewed-by: Lionel Landwerlin Part-of: --- src/gallium/drivers/iris/iris_disk_cache.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/iris/iris_disk_cache.c b/src/gallium/drivers/iris/iris_disk_cache.c index 2e7e300c8f0..47eeabb7ccd 100644 --- a/src/gallium/drivers/iris/iris_disk_cache.c +++ b/src/gallium/drivers/iris/iris_disk_cache.c @@ -274,11 +274,12 @@ iris_disk_cache_init(struct iris_screen *screen) if (INTEL_DEBUG(DEBUG_DISK_CACHE_DISABLE_MASK)) return; - /* array length = print length + nul char + 1 extra to verify it's unused */ - char renderer[11]; - UNUSED int len = - snprintf(renderer, sizeof(renderer), "iris_%04x", screen->devinfo->pci_device_id); - assert(len == sizeof(renderer) - 2); + /* array length = strlen("iris_") + sha + nul char */ + char renderer[5 + 40 + 1] = {0}; + char device_info_sha[41]; + brw_device_sha1(device_info_sha, screen->compiler->devinfo); + memcpy(renderer, "iris_", 5); + memcpy(renderer + 5, device_info_sha, 40); const struct build_id_note *note = build_id_find_nhdr_for_addr(iris_disk_cache_init);