From 178a2946c0b998c1f1c8a70b135b3b1507b4b11a Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 11 Nov 2019 12:46:33 -0600 Subject: [PATCH] anv: Respect the always_flush_cache driconf option Reviewed-by: Lionel Landwerlin --- src/intel/vulkan/anv_device.c | 7 +++++++ src/intel/vulkan/anv_private.h | 2 ++ src/intel/vulkan/genX_cmd_buffer.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 250f75e9936..0993a505075 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -54,6 +54,10 @@ DRI_CONF_BEGIN DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(0) DRI_CONF_VK_X11_STRICT_IMAGE_COUNT("false") DRI_CONF_SECTION_END + + DRI_CONF_SECTION_DEBUG + DRI_CONF_ALWAYS_FLUSH_CACHE("false") + DRI_CONF_SECTION_END DRI_CONF_END; /* This is probably far to big but it reflects the max size used for messages @@ -509,6 +513,9 @@ anv_physical_device_init(struct anv_physical_device *device, device->has_mem_available = get_available_system_memory() != 0; + device->always_flush_cache = + driQueryOptionb(&instance->dri_options, "always_flush_cache"); + /* Starting with Gen10, the timestamp frequency of the command streamer may * vary from one part to another. We can query the value from the kernel. */ diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 8fa0d74f5aa..d42a3ccfdbf 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1002,6 +1002,8 @@ struct anv_physical_device { /** True if we can use bindless access for samplers */ bool has_bindless_samplers; + bool always_flush_cache; + struct anv_device_extension_table supported_extensions; struct anv_physical_device_dispatch_table dispatch; diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 42d5b452699..67500f91cdf 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1800,6 +1800,9 @@ genX(cmd_buffer_apply_pipe_flushes)(struct anv_cmd_buffer *cmd_buffer) { enum anv_pipe_bits bits = cmd_buffer->state.pending_pipe_bits; + if (cmd_buffer->device->instance->physicalDevice.always_flush_cache) + bits |= ANV_PIPE_FLUSH_BITS | ANV_PIPE_INVALIDATE_BITS; + /* Flushes are pipelined while invalidations are handled immediately. * Therefore, if we're flushing anything then we need to schedule a stall * before any invalidations can happen. -- 2.30.2