radv,aco: report ACO errors/warnings back via VK_EXT_debug_report
[mesa.git] / src / amd / vulkan / radv_pipeline_cache.c
index b08395f5cfb3b6bcb024e4558b80c906d3ac6470..8cbf312019ca183db5a2022b8b8dd448bb5a8988 100644 (file)
@@ -28,6 +28,7 @@
 #include "radv_debug.h"
 #include "radv_private.h"
 #include "radv_shader.h"
+#include "vulkan/util/vk_util.h"
 
 #include "ac_nir_to_llvm.h"
 
@@ -262,67 +263,6 @@ radv_is_cache_disabled(struct radv_device *device)
        return (device->instance->debug_flags & RADV_DEBUG_NO_CACHE);
 }
 
-/*
- * Secure compiles cannot open files so we get the parent process to load the
- * cache entry for us.
- */
-static struct cache_entry *
-radv_sc_read_from_disk_cache(struct radv_device *device, uint8_t *disk_sha1)
-{
-       struct cache_entry *entry;
-       unsigned process = device->sc_state->secure_compile_thread_counter;
-       enum radv_secure_compile_type sc_type = RADV_SC_TYPE_READ_DISK_CACHE;
-
-       write(device->sc_state->secure_compile_processes[process].fd_secure_output,
-             &sc_type, sizeof(enum radv_secure_compile_type));
-       write(device->sc_state->secure_compile_processes[process].fd_secure_output,
-             disk_sha1, sizeof(uint8_t) * 20);
-
-       uint8_t found_cache_entry;
-       if (!radv_sc_read(device->sc_state->secure_compile_processes[process].fd_secure_input,
-                         &found_cache_entry, sizeof(uint8_t), true))
-               return NULL;
-
-       if (found_cache_entry) {
-               size_t entry_size;
-               if (!radv_sc_read(device->sc_state->secure_compile_processes[process].fd_secure_input,
-                                 &entry_size, sizeof(size_t), true))
-                       return NULL;
-
-               entry = malloc(entry_size);
-               if (!radv_sc_read(device->sc_state->secure_compile_processes[process].fd_secure_input,
-                                 entry, entry_size, true))
-                       return NULL;
-
-               return entry;
-       }
-
-       return NULL;
-}
-
-/*
- * Secure compiles cannot open files so we get the parent process to write to
- * the disk cache for us.
- */
-static void
-radv_sc_write_to_disk_cache(struct radv_device *device, uint8_t *disk_sha1,
-                           struct cache_entry *entry)
-{
-       unsigned process = device->sc_state->secure_compile_thread_counter;
-       enum radv_secure_compile_type sc_type = RADV_SC_TYPE_WRITE_DISK_CACHE;
-
-       write(device->sc_state->secure_compile_processes[process].fd_secure_output,
-             &sc_type, sizeof(enum radv_secure_compile_type));
-       write(device->sc_state->secure_compile_processes[process].fd_secure_output,
-             disk_sha1, sizeof(uint8_t) * 20);
-
-       uint32_t size = entry_size(entry);
-       write(device->sc_state->secure_compile_processes[process].fd_secure_output,
-             &size, sizeof(uint32_t));
-       write(device->sc_state->secure_compile_processes[process].fd_secure_output,
-             entry, size);
-}
-
 bool
 radv_create_shader_variants_from_pipeline_cache(struct radv_device *device,
                                                struct radv_pipeline_cache *cache,
@@ -356,14 +296,9 @@ radv_create_shader_variants_from_pipeline_cache(struct radv_device *device,
                disk_cache_compute_key(device->physical_device->disk_cache,
                                       sha1, 20, disk_sha1);
 
-               if (radv_device_use_secure_compile(device->instance)) {
-                       entry = radv_sc_read_from_disk_cache(device, disk_sha1);
-               } else {
-                       entry = (struct cache_entry *)
-                               disk_cache_get(device->physical_device->disk_cache,
-                                              disk_sha1, NULL);
-               }
-
+               entry = (struct cache_entry *)
+                       disk_cache_get(device->physical_device->disk_cache,
+                                      disk_sha1, NULL);
                if (!entry) {
                        radv_pipeline_cache_unlock(cache);
                        return false;
@@ -489,16 +424,8 @@ radv_pipeline_cache_insert_shaders(struct radv_device *device,
                disk_cache_compute_key(device->physical_device->disk_cache, sha1, 20,
                               disk_sha1);
 
-               /* Write the cache item out to the parent of this forked
-                * process.
-                */
-               if (radv_device_use_secure_compile(device->instance)) {
-                       radv_sc_write_to_disk_cache(device, disk_sha1, entry);
-               } else {
-                       disk_cache_put(device->physical_device->disk_cache,
-                                      disk_sha1, entry, entry_size(entry),
-                                      NULL);
-               }
+               disk_cache_put(device->physical_device->disk_cache, disk_sha1,
+                              entry, entry_size(entry), NULL);
        }
 
        if (device->instance->debug_flags & RADV_DEBUG_NO_MEMORY_CACHE &&
@@ -526,20 +453,12 @@ radv_pipeline_cache_insert_shaders(struct radv_device *device,
        return;
 }
 
-struct cache_header {
-       uint32_t header_size;
-       uint32_t header_version;
-       uint32_t vendor_id;
-       uint32_t device_id;
-       uint8_t  uuid[VK_UUID_SIZE];
-};
-
 bool
 radv_pipeline_cache_load(struct radv_pipeline_cache *cache,
                         const void *data, size_t size)
 {
        struct radv_device *device = cache->device;
-       struct cache_header header;
+       struct vk_pipeline_cache_header header;
 
        if (size < sizeof(header))
                return false;
@@ -643,7 +562,7 @@ VkResult radv_GetPipelineCacheData(
 {
        RADV_FROM_HANDLE(radv_device, device, _device);
        RADV_FROM_HANDLE(radv_pipeline_cache, cache, _cache);
-       struct cache_header *header;
+       struct vk_pipeline_cache_header *header;
        VkResult result = VK_SUCCESS;
 
        radv_pipeline_cache_lock(cache);