From 29550bc50aef656afb99da7c45611767af0c3a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Thu, 6 Oct 2022 10:33:24 -0700 Subject: [PATCH] intel: Add has_context_isolation to intel_device_info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Iris, hasvk and anv were fetching the same information, better do it on one place. Reviewed-by: Tapani Pälli Signed-off-by: José Roberto de Souza Part-of: --- src/gallium/drivers/iris/iris_screen.c | 3 +-- src/intel/dev/intel_device_info.c | 2 ++ src/intel/dev/intel_device_info.h | 1 + src/intel/vulkan/anv_device.c | 5 +---- src/intel/vulkan/anv_private.h | 1 - src/intel/vulkan/genX_state.c | 2 +- src/intel/vulkan_hasvk/anv_device.c | 5 +---- src/intel/vulkan_hasvk/anv_private.h | 1 - src/intel/vulkan_hasvk/genX_state.c | 2 +- 9 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index fa2bd2dedfe..010d5671a5b 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -784,8 +784,7 @@ iris_screen_create(int fd, const struct pipe_screen_config *config) * * Checking the last feature availability will include all previous ones. */ - int v; - if (!intel_gem_get_param(fd, I915_PARAM_HAS_CONTEXT_ISOLATION, &v) || !v) { + if (!screen->devinfo.has_context_isolation) { debug_error("Kernel is too old (4.16+ required) or unusable for Iris.\n" "Check your dmesg logs for loading failures.\n"); return NULL; diff --git a/src/intel/dev/intel_device_info.c b/src/intel/dev/intel_device_info.c index d21de297108..22b6f64f9fe 100644 --- a/src/intel/dev/intel_device_info.c +++ b/src/intel/dev/intel_device_info.c @@ -2008,6 +2008,8 @@ intel_i915_get_device_info_from_fd(int fd, struct intel_device_info *devinfo) devinfo->has_mmap_offset = val >= 4; if (getparam(fd, I915_PARAM_HAS_USERPTR_PROBE, &val)) devinfo->has_userptr_probe = val; + if (getparam(fd, I915_PARAM_HAS_CONTEXT_ISOLATION, &val)) + devinfo->has_context_isolation = val; return true; } diff --git a/src/intel/dev/intel_device_info.h b/src/intel/dev/intel_device_info.h index 73e827f2fd5..78ffc23bbb2 100644 --- a/src/intel/dev/intel_device_info.h +++ b/src/intel/dev/intel_device_info.h @@ -148,6 +148,7 @@ struct intel_device_info bool has_mesh_shading; bool has_mmap_offset; bool has_userptr_probe; + bool has_context_isolation; /** * \name Intel hardware quirks diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 04de126dcc0..48e445d2ea1 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -793,9 +793,6 @@ anv_i915_physical_device_get_parameters(struct anv_physical_device *device) device->max_context_priority = priorities[i]; } - if (intel_gem_get_param(fd, I915_PARAM_HAS_CONTEXT_ISOLATION, &val)) - device->has_context_isolation = val; - if (intel_gem_get_param(fd, I915_PARAM_HAS_EXEC_TIMELINE_FENCES, &val)) device->has_exec_timeline = val; @@ -956,7 +953,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->has_context_isolation; + !device->info.has_context_isolation; device->compiler->supports_shader_constants = true; device->compiler->indirect_ubos_use_sampler = device->info.ver < 12; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index e0777bf68c0..aefbd639982 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -963,7 +963,6 @@ struct anv_physical_device { bool has_exec_async; bool has_exec_capture; VkQueueGlobalPriorityKHR max_context_priority; - bool has_context_isolation; uint64_t gtt_size; bool always_use_bindless; diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c index 5a15a7a513b..cfb3bc89d1a 100644 --- a/src/intel/vulkan/genX_state.c +++ b/src/intel/vulkan/genX_state.c @@ -424,7 +424,7 @@ init_render_queue_state(struct anv_queue *queue) * * This is only safe on kernels with context isolation support. */ - if (device->physical->has_context_isolation) { + 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; diff --git a/src/intel/vulkan_hasvk/anv_device.c b/src/intel/vulkan_hasvk/anv_device.c index 768e57d27d6..85ee7fb5a04 100644 --- a/src/intel/vulkan_hasvk/anv_device.c +++ b/src/intel/vulkan_hasvk/anv_device.c @@ -819,9 +819,6 @@ anv_physical_device_try_create(struct vk_instance *vk_instance, assert(device->supports_48bit_addresses == !device->use_relocations); device->use_softpin = !device->use_relocations; - if (intel_gem_get_param(fd, I915_PARAM_HAS_CONTEXT_ISOLATION, &val)) - device->has_context_isolation = val; - if (intel_gem_get_param(fd, I915_PARAM_HAS_EXEC_TIMELINE_FENCES, &val)) device->has_exec_timeline = val; if (debug_get_bool_option("ANV_QUEUE_THREAD_DISABLE", false)) @@ -890,7 +887,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.ver < 8 || !device->has_context_isolation; + device->info.ver < 8 || !device->info.has_context_isolation; device->compiler->supports_shader_constants = true; device->compiler->indirect_ubos_use_sampler = device->info.ver < 12; diff --git a/src/intel/vulkan_hasvk/anv_private.h b/src/intel/vulkan_hasvk/anv_private.h index 951fd7cba58..799bd4adce3 100644 --- a/src/intel/vulkan_hasvk/anv_private.h +++ b/src/intel/vulkan_hasvk/anv_private.h @@ -962,7 +962,6 @@ struct anv_physical_device { bool has_exec_async; bool has_exec_capture; int max_context_priority; - bool has_context_isolation; uint64_t gtt_size; bool use_relocations; diff --git a/src/intel/vulkan_hasvk/genX_state.c b/src/intel/vulkan_hasvk/genX_state.c index 52aff461d0b..8792108f8d3 100644 --- a/src/intel/vulkan_hasvk/genX_state.c +++ b/src/intel/vulkan_hasvk/genX_state.c @@ -387,7 +387,7 @@ init_render_queue_state(struct anv_queue *queue) * * This is only safe on kernels with context isolation support. */ - if (GFX_VER >= 8 && device->physical->has_context_isolation) { + if (GFX_VER >= 8 && device->physical->info.has_context_isolation) { #if GFX_VER >= 9 anv_batch_write_reg(&batch, GENX(CS_DEBUG_MODE2), csdm2) { csdm2.CONSTANT_BUFFERAddressOffsetDisable = true;