diff options
author | Jason Ekstrand <[email protected]> | 2017-11-21 08:46:25 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-02-08 16:35:31 -0800 |
commit | de3be6180169f95b781308398b31fbdd3db319e1 (patch) | |
tree | b34004cd9af2ae8aad718644f71e1c0148b66094 /src/intel/vulkan/anv_private.h | |
parent | 2cbfcb205ef777cb6e17ebca3ff658f9f2cb915f (diff) |
anv/cmd_buffer: Rework aux tracking
This commit completely reworks aux tracking. This includes a number of
somewhat distinct changes:
1) Since we are no longer fast-clearing multiple slices, we only need
to track one fast clear color and one fast clear type.
2) We store two bits for fast clear instead of one to let us
distinguish between zero and non-zero fast clear colors. This is
needed so that we can do full resolves when transitioning to
PRESENT_SRC_KHR with gen9 CCS images where we allow zero clear
values in all sorts of places we wouldn't normally.
3) We now track compression state as a boolean separate from fast clear
type and this is tracked on a per-slice granularity.
The previous scheme had some issues when it came to individual slices of
a multi-LOD images. In particular, we only tracked "needs resolve"
per-LOD but you could do a vkCmdPipelineBarrier that would only resolve
a portion of the image and would set "needs resolve" to false anyway.
Also, any transition from an undefined layout would reset the clear
color for the entire LOD regardless of whether or not there was some
clear color on some other slice.
As far as full/partial resolves go, he assumptions of the previous
scheme held because the one case where we do need a full resolve when
CCS_E is enabled is for window-system images. Since we only ever
allowed X-tiled window-system images, CCS was entirely disabled on gen9+
and we never got CCS_E. With the advent of Y-tiled window-system
buffers, we now need to properly support doing a full resolve of images
marked CCS_E.
v2 (Jason Ekstrand):
- Fix an bug in the compressed flag offset calculation
- Treat 3D images as multi-slice for the purposes of resolve tracking
v3 (Jason Ekstrand):
- Set the compressed flag whenever we fast-clear
- Simplify the resolve predicate computation logic
Reviewed-by: Topi Pohjolainen <[email protected]>
Reviewed-by: Nanley Chery <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_private.h')
-rw-r--r-- | src/intel/vulkan/anv_private.h | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 5f827029139..d38dd9e4220 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -2533,50 +2533,58 @@ anv_image_aux_layers(const struct anv_image * const image, } } -static inline unsigned -anv_fast_clear_state_entry_size(const struct anv_device *device) -{ - assert(device); - /* Entry contents: - * +--------------------------------------------+ - * | clear value dword(s) | needs resolve dword | - * +--------------------------------------------+ - */ - - /* Ensure that the needs resolve dword is in fact dword-aligned to enable - * GPU memcpy operations. - */ - assert(device->isl_dev.ss.clear_value_size % 4 == 0); - return device->isl_dev.ss.clear_value_size + 4; -} - static inline struct anv_address anv_image_get_clear_color_addr(const struct anv_device *device, const struct anv_image *image, - VkImageAspectFlagBits aspect, - unsigned level) + VkImageAspectFlagBits aspect) { + assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV); + uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect); return (struct anv_address) { .bo = image->planes[plane].bo, .offset = image->planes[plane].bo_offset + - image->planes[plane].fast_clear_state_offset + - anv_fast_clear_state_entry_size(device) * level, + image->planes[plane].fast_clear_state_offset, }; } static inline struct anv_address -anv_image_get_needs_resolve_addr(const struct anv_device *device, - const struct anv_image *image, - VkImageAspectFlagBits aspect, - unsigned level) +anv_image_get_fast_clear_type_addr(const struct anv_device *device, + const struct anv_image *image, + VkImageAspectFlagBits aspect) { struct anv_address addr = - anv_image_get_clear_color_addr(device, image, aspect, level); + anv_image_get_clear_color_addr(device, image, aspect); addr.offset += device->isl_dev.ss.clear_value_size; return addr; } +static inline struct anv_address +anv_image_get_compression_state_addr(const struct anv_device *device, + const struct anv_image *image, + VkImageAspectFlagBits aspect, + uint32_t level, uint32_t array_layer) +{ + assert(level < anv_image_aux_levels(image, aspect)); + assert(array_layer < anv_image_aux_layers(image, aspect, level)); + UNUSED uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect); + assert(image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_E); + + struct anv_address addr = + anv_image_get_fast_clear_type_addr(device, image, aspect); + addr.offset += 4; /* Go past the fast clear type */ + + if (image->type == VK_IMAGE_TYPE_3D) { + for (uint32_t l = 0; l < level; l++) + addr.offset += anv_minify(image->extent.depth, l) * 4; + } else { + addr.offset += level * image->array_size * 4; + } + addr.offset += array_layer * 4; + + return addr; +} + /* Returns true if a HiZ-enabled depth buffer can be sampled from. */ static inline bool anv_can_sample_with_hiz(const struct gen_device_info * const devinfo, |