anv: Respect the always_flush_cache driconf option
authorJason Ekstrand <jason@jlekstrand.net>
Mon, 11 Nov 2019 18:46:33 +0000 (12:46 -0600)
committerJason Ekstrand <jason@jlekstrand.net>
Tue, 3 Dec 2019 23:10:51 +0000 (17:10 -0600)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/genX_cmd_buffer.c

index 250f75e99367eb48cc77c60b99efb9734fef756a..0993a50507502ad62faf88e3f9852aeb998def68 100644 (file)
@@ -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.
     */
index 8fa0d74f5aa9b67394bbdb51e2d414b4f46a527d..d42a3ccfdbff9e2b176387eb42f1292f3f12a27b 100644 (file)
@@ -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;
 
index 42d5b4526990ab4a1108b524b09cde702a1c14e8..67500f91cdf97eb9d62b99c8c2f94e731837cf11 100644 (file)
@@ -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.