radv: move the disk cache to the vk_physical_device struct

To be able to use it from the common pipeline cache implementation.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19047>
This commit is contained in:
Samuel Pitoiset 2022-10-11 12:27:20 +02:00
parent 3e22f957d5
commit db62b13ddd
3 changed files with 9 additions and 14 deletions

View file

@ -837,7 +837,7 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
*/
char buf[VK_UUID_SIZE * 2 + 1];
disk_cache_format_hex_id(buf, device->cache_uuid, VK_UUID_SIZE * 2);
device->disk_cache = disk_cache_create(device->name, buf, 0);
device->vk.disk_cache = disk_cache_create(device->name, buf, 0);
#endif
if (!radv_is_conformant(device))
@ -949,7 +949,7 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
fail_perfcounters:
ac_destroy_perfcounters(&device->ac_perfcounters);
disk_cache_destroy(device->disk_cache);
disk_cache_destroy(device->vk.disk_cache);
#ifdef ENABLE_SHADER_CACHE
fail_wsi:
#endif
@ -974,7 +974,7 @@ radv_physical_device_destroy(struct vk_physical_device *vk_device)
radv_finish_wsi(device);
ac_destroy_perfcounters(&device->ac_perfcounters);
device->ws->destroy(device->ws);
disk_cache_destroy(device->disk_cache);
disk_cache_destroy(device->vk.disk_cache);
if (device->local_fd != -1)
close(device->local_fd);
if (device->master_fd != -1)

View file

@ -340,16 +340,16 @@ radv_create_shaders_from_pipeline_cache(
/* Don't cache when we want debug info, since this isn't
* present in the cache.
*/
if (radv_is_cache_disabled(device) || !device->physical_device->disk_cache) {
if (radv_is_cache_disabled(device) || !device->physical_device->vk.disk_cache) {
radv_pipeline_cache_unlock(cache);
return false;
}
uint8_t disk_sha1[20];
disk_cache_compute_key(device->physical_device->disk_cache, sha1, 20, disk_sha1);
disk_cache_compute_key(device->physical_device->vk.disk_cache, sha1, 20, disk_sha1);
entry =
(struct cache_entry *)disk_cache_get(device->physical_device->disk_cache, disk_sha1, NULL);
(struct cache_entry *)disk_cache_get(device->physical_device->vk.disk_cache, disk_sha1, NULL);
if (!entry) {
radv_pipeline_cache_unlock(cache);
return false;
@ -541,11 +541,11 @@ radv_pipeline_cache_insert_shaders(struct radv_device *device, struct radv_pipel
*
* Make sure to exclude meta shaders because they are stored in a different cache file.
*/
if (device->physical_device->disk_cache && cache != &device->meta_state.cache) {
if (device->physical_device->vk.disk_cache && cache != &device->meta_state.cache) {
uint8_t disk_sha1[20];
disk_cache_compute_key(device->physical_device->disk_cache, sha1, 20, disk_sha1);
disk_cache_compute_key(device->physical_device->vk.disk_cache, sha1, 20, disk_sha1);
disk_cache_put(device->physical_device->disk_cache, disk_sha1, entry, entry_size(entry),
disk_cache_put(device->physical_device->vk.disk_cache, disk_sha1, entry, entry_size(entry),
NULL);
}

View file

@ -302,11 +302,6 @@ struct radv_physical_device {
/* Whether to emulate ETC2 image support on HW without support. */
bool emulate_etc2;
/* This is the drivers on-disk cache used as a fallback as opposed to
* the pipeline cache defined by apps.
*/
struct disk_cache *disk_cache;
VkPhysicalDeviceMemoryProperties memory_properties;
enum radeon_bo_domain memory_domains[VK_MAX_MEMORY_TYPES];
enum radeon_bo_flag memory_flags[VK_MAX_MEMORY_TYPES];