From 8a1a49aae40099be3f1d104cfb3de5762da58b7c Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Wed, 17 May 2023 17:04:19 +0300 Subject: [PATCH] anv: assume context isolation support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lionel Landwerlin Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7265 Reviewed-by: José Roberto de Souza Part-of: --- src/intel/vulkan/anv_device.c | 9 +++++++-- src/intel/vulkan/anv_nir_compute_push_layout.c | 2 +- src/intel/vulkan/genX_state.c | 9 ++++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index a7975809d46..c2e85cf9a39 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1218,6 +1218,12 @@ anv_physical_device_try_create(struct vk_instance *vk_instance, goto fail_fd; } + if (!devinfo.has_context_isolation) { + result = vk_errorf(instance, VK_ERROR_INCOMPATIBLE_DRIVER, + "Vulkan requires context isolation for %s", devinfo.name); + goto fail_fd; + } + struct anv_physical_device *device = vk_zalloc(&instance->vk.alloc, sizeof(*device), 8, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); @@ -1333,8 +1339,7 @@ anv_physical_device_try_create(struct vk_instance *vk_instance, } device->compiler->shader_debug_log = compiler_debug_log; device->compiler->shader_perf_log = compiler_perf_log; - device->compiler->constant_buffer_0_is_relative = - !device->info.has_context_isolation; + device->compiler->constant_buffer_0_is_relative = false; device->compiler->supports_shader_constants = true; device->compiler->indirect_ubos_use_sampler = device->info.ver < 12; diff --git a/src/intel/vulkan/anv_nir_compute_push_layout.c b/src/intel/vulkan/anv_nir_compute_push_layout.c index 7a5fefbeee8..06264be0af1 100644 --- a/src/intel/vulkan/anv_nir_compute_push_layout.c +++ b/src/intel/vulkan/anv_nir_compute_push_layout.c @@ -248,7 +248,7 @@ anv_nir_compute_push_layout(nir_shader *nir, if (ubo_range->length == 0) continue; - if (n >= 4 || (n == 3 && compiler->constant_buffer_0_is_relative)) { + if (n >= 4) { memset(ubo_range, 0, sizeof(*ubo_range)); continue; } diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c index ed37403169c..9d735e49d19 100644 --- a/src/intel/vulkan/genX_state.c +++ b/src/intel/vulkan/genX_state.c @@ -478,11 +478,10 @@ init_render_queue_state(struct anv_queue *queue) * * This is only safe on kernels with context isolation support. */ - if (device->physical->info.has_context_isolation) { - anv_batch_write_reg(&batch, GENX(CS_DEBUG_MODE2), csdm2) { - csdm2.CONSTANT_BUFFERAddressOffsetDisable = true; - csdm2.CONSTANT_BUFFERAddressOffsetDisableMask = true; - } + assert(device->physical->info.has_context_isolation); + anv_batch_write_reg(&batch, GENX(CS_DEBUG_MODE2), csdm2) { + csdm2.CONSTANT_BUFFERAddressOffsetDisable = true; + csdm2.CONSTANT_BUFFERAddressOffsetDisableMask = true; } init_common_queue_state(queue, &batch);