diff options
author | Nanley Chery <nanley.g.chery@intel.com> | 2018-10-24 14:50:32 -0700 |
---|---|---|
committer | Nanley Chery <nanley.g.chery@intel.com> | 2018-11-28 15:33:47 -0800 |
commit | d24083a733b3b03a91610dd2d0f380e376f27367 (patch) | |
tree | fed3780ed24305b47f6259a2b17f61454f324e04 | |
parent | 8eb8be3f54c9d1d02d51a5b508d04777b5ff3f13 (diff) |
anv/cmd_buffer: Prepare init_fast_clear_color for ICL
Remove an optimization that no longer holds true for post-SKL HW.
Pull in the number of dwords to initialize from ISL.
-rw-r--r-- | src/intel/vulkan/genX_cmd_buffer.c | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index c7e5ef9596e..b1bd87fda3b 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -813,6 +813,9 @@ genX(cmd_buffer_mark_image_written)(struct anv_cmd_buffer *cmd_buffer, level, base_layer, layer_count, true); } +/* Ensure that the restrictions of the fields accessed by the HW for the + * fast-clear values are satisfied. + */ static void init_fast_clear_color(struct anv_cmd_buffer *cmd_buffer, const struct anv_image *image, @@ -823,48 +826,30 @@ init_fast_clear_color(struct anv_cmd_buffer *cmd_buffer, set_image_fast_clear_state(cmd_buffer, image, aspect, ANV_FAST_CLEAR_NONE); - - /* The fast clear value dword(s) will be copied into a surface state object. - * Ensure that the restrictions of the fields in the dword(s) are followed. - * - * CCS buffers on SKL+ can have any value set for the clear colors. - */ - if (image->samples == 1 && GEN_GEN >= 9) - return; - - /* Other combinations of auxiliary buffers and platforms require specific - * values in the clear value dword(s). - */ struct anv_address addr = anv_image_get_clear_color_addr(cmd_buffer->device, image, aspect); + const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev; + const unsigned num_dwords = isl_dev->ss.clear_value_size / 4; - if (GEN_GEN >= 9) { - for (unsigned i = 0; i < 4; i++) { - anv_batch_emit(&cmd_buffer->batch, GENX(MI_STORE_DATA_IMM), sdi) { - sdi.Address = addr; - sdi.Address.offset += i * 4; - /* MCS buffers on SKL+ can only have 1/0 clear colors. */ - assert(image->samples > 1); - sdi.ImmediateData = 0; - } - } - } else { + for (unsigned i = 0; i < num_dwords; i++) { anv_batch_emit(&cmd_buffer->batch, GENX(MI_STORE_DATA_IMM), sdi) { sdi.Address = addr; - if (GEN_GEN >= 8 || GEN_IS_HASWELL) { - /* Pre-SKL, the dword containing the clear values also contains - * other fields, so we need to initialize those fields to match the - * values that would be in a color attachment. + sdi.Address.offset += i * 4; + if (GEN_GEN >= 9 || GEN_VERSIONx10 == 70) { + /* On SKL, MCS buffers can only have 1/0 clear colors. + * + * On IVB, the dword containing the clear values also contains + * MBZ fields and Resource Min LOD. + */ + sdi.ImmediateData = 0; + } else { + /* On BDW and HSW, the dword containing the clear values also + * contains channel select fields. */ sdi.ImmediateData = ISL_CHANNEL_SELECT_RED << 25 | ISL_CHANNEL_SELECT_GREEN << 22 | ISL_CHANNEL_SELECT_BLUE << 19 | ISL_CHANNEL_SELECT_ALPHA << 16; - } else if (GEN_GEN == 7) { - /* On IVB, the dword containing the clear values also contains - * other fields that must be zero or can be zero. - */ - sdi.ImmediateData = 0; } } } |