summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/genX_cmd_buffer.c
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2017-07-11 10:46:58 -0700
committerJason Ekstrand <[email protected]>2017-07-22 20:12:09 -0700
commitb178e239dd7205a93ae3cf6c0a24c2c555bf333f (patch)
treeda4b1d783726da4539019c14b13fea390e5481d6 /src/intel/vulkan/genX_cmd_buffer.c
parentf793c57cc583371a4f9e0d04220eb60e91c0319a (diff)
anv: Transition MCS buffers from the undefined layout
v2: Define MCS buffers with any sample count (Jason) Cc: <[email protected]> Suggested-by: Jason Ekstrand <[email protected]> Signed-off-by: Nanley Chery <[email protected]>
Diffstat (limited to 'src/intel/vulkan/genX_cmd_buffer.c')
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 9b3bb101645..963634f55e3 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -392,7 +392,9 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
VkImageLayout initial_layout,
VkImageLayout final_layout)
{
- if (image->aux_usage != ISL_AUX_USAGE_CCS_E)
+ assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);
+
+ if (image->aux_usage == ISL_AUX_USAGE_NONE)
return;
if (initial_layout != VK_IMAGE_LAYOUT_UNDEFINED &&
@@ -405,15 +407,30 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
layer_count = anv_minify(image->extent.depth, base_level);
}
-#if GEN_GEN >= 9
- /* We're transitioning from an undefined layout so it doesn't really matter
- * what data ends up in the color buffer. We do, however, need to ensure
- * that the CCS has valid data in it. One easy way to do that is to
- * fast-clear the specified range.
- */
- anv_image_ccs_clear(cmd_buffer, image, base_level, level_count,
- base_layer, layer_count);
-#endif
+ if (image->aux_usage == ISL_AUX_USAGE_CCS_E ||
+ image->aux_usage == ISL_AUX_USAGE_MCS) {
+ /* We're transitioning from an undefined layout so it doesn't really
+ * matter what data ends up in the color buffer. We do, however, need to
+ * ensure that the auxiliary surface is not in an undefined state. This
+ * state is possible for CCS buffers SKL+ and MCS buffers with certain
+ * sample counts that require certain bits to be reserved (2x and 8x).
+ * One easy way to get to a valid state is to fast-clear the specified
+ * range.
+ *
+ * Even for MCS buffers that have sample counts that don't require
+ * certain bits to be reserved (4x and 8x), we're unsure if the hardware
+ * will be okay with the sample mappings given by the undefined buffer.
+ * We don't have any data to show that this is a problem, but we want to
+ * avoid causing difficult-to-debug problems.
+ */
+ if (image->samples == 4 || image->samples == 16) {
+ anv_perf_warn("Doing a potentially unnecessary fast-clear to define "
+ "an MCS buffer.");
+ }
+
+ anv_image_fast_clear(cmd_buffer, image, base_level, level_count,
+ base_layer, layer_count);
+ }
}
/**