radv/gfx10: add a separate flag for creating a GDS OA buffer
[mesa.git] / src / amd / vulkan / radv_device.c
index c3ff31668aa7716caa5eaa0162d516f2b526b3d9..ef0e866ef52b12c8555e1b0bfcd2e9b6a8776103 100644 (file)
@@ -398,10 +398,6 @@ radv_physical_device_init(struct radv_physical_device *device,
        radv_handle_env_var_force_family(device);
 
        device->use_aco = instance->perftest_flags & RADV_PERFTEST_ACO;
-       if (device->rad_info.chip_class < GFX7 && device->use_aco) {
-               fprintf(stderr, "WARNING: disabling ACO on unsupported GPUs.\n");
-               device->use_aco = false;
-       }
 
        snprintf(device->name, sizeof(device->name),
                 "AMD RADV%s %s (LLVM " MESA_LLVM_VERSION_STRING ")", device->use_aco ? "/ACO" : "",
@@ -426,8 +422,7 @@ radv_physical_device_init(struct radv_physical_device *device,
        disk_cache_format_hex_id(buf, device->cache_uuid, VK_UUID_SIZE * 2);
        device->disk_cache = disk_cache_create(device->name, buf, shader_env_flags);
 
-       if (device->rad_info.chip_class < GFX8 ||
-           device->rad_info.chip_class > GFX9)
+       if (device->rad_info.chip_class < GFX8)
                fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
 
        radv_get_driver_uuid(&device->driver_uuid);
@@ -1639,8 +1634,8 @@ void radv_GetPhysicalDeviceProperties2(
 
                        driver_props->conformanceVersion = (VkConformanceVersion) {
                                .major = 1,
-                               .minor = 1,
-                               .subminor = 2,
+                               .minor = 2,
+                               .subminor = 0,
                                .patch = 0,
                        };
                        break;
@@ -3640,6 +3635,7 @@ radv_get_preamble_cs(struct radv_queue *queue,
                     uint32_t gsvs_ring_size,
                     bool needs_tess_rings,
                     bool needs_gds,
+                    bool needs_gds_oa,
                     bool needs_sample_positions,
                     struct radeon_cmdbuf **initial_full_flush_preamble_cs,
                      struct radeon_cmdbuf **initial_preamble_cs,
@@ -3654,7 +3650,7 @@ radv_get_preamble_cs(struct radv_queue *queue,
        struct radeon_winsys_bo *gds_bo = NULL;
        struct radeon_winsys_bo *gds_oa_bo = NULL;
        struct radeon_cmdbuf *dest_cs[3] = {0};
-       bool add_tess_rings = false, add_gds = false, add_sample_positions = false;
+       bool add_tess_rings = false, add_gds = false, add_gds_oa = false, add_sample_positions = false;
        unsigned tess_factor_ring_size = 0, tess_offchip_ring_size = 0;
        unsigned max_offchip_buffers;
        unsigned hs_offchip_param = 0;
@@ -3668,6 +3664,10 @@ radv_get_preamble_cs(struct radv_queue *queue,
                if (needs_gds)
                        add_gds = true;
        }
+       if (!queue->has_gds_oa) {
+               if (needs_gds_oa)
+                       add_gds_oa = true;
+       }
        if (!queue->has_sample_positions) {
                if (needs_sample_positions)
                        add_sample_positions = true;
@@ -3697,14 +3697,14 @@ radv_get_preamble_cs(struct radv_queue *queue,
            compute_scratch_waves <= queue->compute_scratch_waves &&
            esgs_ring_size <= queue->esgs_ring_size &&
            gsvs_ring_size <= queue->gsvs_ring_size &&
-           !add_tess_rings && !add_gds && !add_sample_positions &&
+           !add_tess_rings && !add_gds && !add_gds_oa && !add_sample_positions &&
            queue->initial_preamble_cs) {
                *initial_full_flush_preamble_cs = queue->initial_full_flush_preamble_cs;
                *initial_preamble_cs = queue->initial_preamble_cs;
                *continue_preamble_cs = queue->continue_preamble_cs;
                if (!scratch_size_per_wave && !compute_scratch_size_per_wave &&
                    !esgs_ring_size && !gsvs_ring_size && !needs_tess_rings &&
-                   !needs_gds && !needs_sample_positions)
+                   !needs_gds && !needs_gds_oa && !needs_sample_positions)
                        *continue_preamble_cs = NULL;
                return VK_SUCCESS;
        }
@@ -3792,6 +3792,12 @@ radv_get_preamble_cs(struct radv_queue *queue,
                                                          RADV_BO_PRIORITY_SCRATCH);
                if (!gds_bo)
                        goto fail;
+       } else {
+               gds_bo = queue->gds_bo;
+       }
+
+       if (add_gds_oa) {
+               assert(queue->device->physical_device->rad_info.chip_class >= GFX10);
 
                gds_oa_bo = queue->device->ws->buffer_create(queue->device->ws,
                                                             4, 1,
@@ -3801,7 +3807,6 @@ radv_get_preamble_cs(struct radv_queue *queue,
                if (!gds_oa_bo)
                        goto fail;
        } else {
-               gds_bo = queue->gds_bo;
                gds_oa_bo = queue->gds_oa_bo;
        }
 
@@ -3985,8 +3990,10 @@ radv_get_preamble_cs(struct radv_queue *queue,
                queue->has_gds = true;
        }
 
-       if (gds_oa_bo != queue->gds_oa_bo)
+       if (gds_oa_bo != queue->gds_oa_bo) {
                queue->gds_oa_bo = gds_oa_bo;
+               queue->has_gds_oa = true;
+       }
 
        if (descriptor_bo != queue->descriptor_bo) {
                if (queue->descriptor_bo)
@@ -4257,6 +4264,7 @@ radv_get_preambles(struct radv_queue *queue,
        uint32_t esgs_ring_size = 0, gsvs_ring_size = 0;
        bool tess_rings_needed = false;
        bool gds_needed = false;
+       bool gds_oa_needed = false;
        bool sample_positions_needed = false;
 
        for (uint32_t j = 0; j < cmd_buffer_count; j++) {
@@ -4273,13 +4281,14 @@ radv_get_preambles(struct radv_queue *queue,
                gsvs_ring_size = MAX2(gsvs_ring_size, cmd_buffer->gsvs_ring_size_needed);
                tess_rings_needed |= cmd_buffer->tess_rings_needed;
                gds_needed |= cmd_buffer->gds_needed;
+               gds_oa_needed |= cmd_buffer->gds_oa_needed;
                sample_positions_needed |= cmd_buffer->sample_positions_needed;
        }
 
        return radv_get_preamble_cs(queue, scratch_size_per_wave, waves_wanted,
                                    compute_scratch_size_per_wave, compute_waves_wanted,
                                    esgs_ring_size, gsvs_ring_size, tess_rings_needed,
-                                   gds_needed, sample_positions_needed,
+                                   gds_needed, gds_oa_needed, sample_positions_needed,
                                    initial_full_flush_preamble_cs,
                                    initial_preamble_cs, continue_preamble_cs);
 }
@@ -5063,7 +5072,6 @@ static VkResult radv_alloc_memory(struct radv_device *device,
 
 fail:
        radv_free_memory(device, pAllocator,mem);
-       vk_free2(&device->alloc, pAllocator, mem);
 
        return result;
 }