diff options
author | Rafael Antognolli <[email protected]> | 2018-03-27 15:51:21 -0700 |
---|---|---|
committer | Rafael Antognolli <[email protected]> | 2018-04-05 07:42:45 -0700 |
commit | 94675edcfda93dab29f2ed8a1f218d6491dbb085 (patch) | |
tree | 6854439bd5a396bcfe34c06b29dad79ca9366601 /src/intel/vulkan | |
parent | f77789a3f0bfd094f8d36dd50f65b5f948745eb1 (diff) |
intel: Use Clear Color struct size.
The size of the clear color struct (expected by the hardware) is 8
dwords (isl_dev.ss.clear_value_state_size here). But we still need to
track the size of the clear color, used when memcopying it to/from the
state buffer. For that we keep isl_dev.ss.clear_value_size.
v4:
- Add struct to gen11 too (Jason, Jordan)
- Add field for Converted Clear Color to gen11 (Jason)
- Add clear_color_state_offset to differentiate from
clear_value_offset.
- Fix all the places where clear_value_size was used.
v5 (Jason):
- Split genxml changes to another commit.
- Remove unnecessary gen checks.
- Bring back missing offset increment to init_fast_clear_color().
v6 (Jason):
- On init_fast_clear_color, change:
addr.offset += 4 => sdi.Address.offset += i * 4
- Use GEN_GEN instead of GEN_VERSIONx10.
[[email protected]: isl_device_init changes]
Signed-off-by: Rafael Antognolli <[email protected]>
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 6 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 6 | ||||
-rw-r--r-- | src/intel/vulkan/genX_cmd_buffer.c | 23 |
3 files changed, 22 insertions, 13 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index b20d791751d..d9b5d266020 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -267,8 +267,12 @@ add_aux_state_tracking_buffer(struct anv_image *image, (image->planes[plane].offset + image->planes[plane].size)); } + const unsigned clear_color_state_size = device->info.gen >= 10 ? + device->isl_dev.ss.clear_color_state_size : + device->isl_dev.ss.clear_value_size; + /* Clear color and fast clear type */ - unsigned state_size = device->isl_dev.ss.clear_value_size + 4; + unsigned state_size = clear_color_state_size + 4; /* We only need to track compression on CCS_E surfaces. */ if (image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_E) { diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 3b08939f6cc..d7a04438165 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -2614,7 +2614,11 @@ anv_image_get_fast_clear_type_addr(const struct anv_device *device, { struct anv_address addr = anv_image_get_clear_color_addr(device, image, aspect); - addr.offset += device->isl_dev.ss.clear_value_size; + + const unsigned clear_color_state_size = device->info.gen >= 10 ? + device->isl_dev.ss.clear_color_state_size : + device->isl_dev.ss.clear_value_size; + addr.offset += clear_color_state_size; return addr; } diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 3da6dffa1a9..8287d67a53d 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -826,35 +826,36 @@ init_fast_clear_color(struct anv_cmd_buffer *cmd_buffer, */ struct anv_address addr = anv_image_get_clear_color_addr(cmd_buffer->device, image, aspect); - unsigned i = 0; - for (; i < cmd_buffer->device->isl_dev.ss.clear_value_size; i += 4) { - anv_batch_emit(&cmd_buffer->batch, GENX(MI_STORE_DATA_IMM), sdi) { - sdi.Address = addr; - if (GEN_GEN >= 9) { + 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 if (GEN_VERSIONx10 >= 75) { + } + } + } else { + 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. */ - assert(i == 0); 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_VERSIONx10 == 70) { + } 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. */ - assert(i == 0); sdi.ImmediateData = 0; } } - - addr.offset += 4; } } |