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 <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26844>
This commit is contained in:
Mark Janes 2022-09-21 22:39:53 -07:00
parent c4ce1ca847
commit 48bf7ad3b8

View file

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