anv: Replace aux_surface.isl.size_B checks with aux_usage checks

Now that aux_usage has a unified meaning, aux_usage == NONE if and only
if aux_surface.isl.size_B > 0.  In most of these cases, the question
we're asking is "does have compression?" and not "have we allocated an
aux surface for compression?".

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3556>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3556>
This commit is contained in:
Jason Ekstrand 2020-01-21 17:21:47 -06:00 committed by Marge Bot
parent e693a57232
commit 41bffe0913
3 changed files with 11 additions and 13 deletions

View file

@ -251,7 +251,7 @@ add_aux_state_tracking_buffer(struct anv_image *image,
const struct anv_device *device) const struct anv_device *device)
{ {
assert(image && device); assert(image && device);
assert(image->planes[plane].aux_surface.isl.size_B > 0 && assert(image->planes[plane].aux_usage != ISL_AUX_USAGE_NONE &&
image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV); image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
/* Compressed images must be tiled and therefore everything should be 4K /* Compressed images must be tiled and therefore everything should be 4K
@ -532,7 +532,7 @@ make_surface(struct anv_device *dev,
image->planes[plane].surface.isl.size_B)) <= image->planes[plane].surface.isl.size_B)) <=
(image->planes[plane].offset + image->planes[plane].size)); (image->planes[plane].offset + image->planes[plane].size));
if (image->planes[plane].aux_surface.isl.size_B) { if (image->planes[plane].aux_usage != ISL_AUX_USAGE_NONE) {
/* assert(image->planes[plane].fast_clear_state_offset == */ /* assert(image->planes[plane].fast_clear_state_offset == */
/* (image->planes[plane].aux_surface.offset + image->planes[plane].aux_surface.isl.size_B)); */ /* (image->planes[plane].aux_surface.offset + image->planes[plane].aux_surface.isl.size_B)); */
assert(image->planes[plane].fast_clear_state_offset < assert(image->planes[plane].fast_clear_state_offset <
@ -1121,7 +1121,7 @@ anv_layout_to_aux_state(const struct gen_device_info * const devinfo,
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect); uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
/* If we don't have an aux buffer then aux state makes no sense */ /* If we don't have an aux buffer then aux state makes no sense */
assert(image->planes[plane].aux_surface.isl.size_B > 0); assert(image->planes[plane].aux_usage != ISL_AUX_USAGE_NONE);
/* All images that use an auxiliary surface are required to be tiled. */ /* All images that use an auxiliary surface are required to be tiled. */
assert(image->planes[plane].surface.isl.tiling != ISL_TILING_LINEAR); assert(image->planes[plane].surface.isl.tiling != ISL_TILING_LINEAR);
@ -1309,7 +1309,7 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,
/* If there is no auxiliary surface allocated, we must use the one and only /* If there is no auxiliary surface allocated, we must use the one and only
* main buffer. * main buffer.
*/ */
if (image->planes[plane].aux_surface.isl.size_B == 0) if (image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE)
return ISL_AUX_USAGE_NONE; return ISL_AUX_USAGE_NONE;
enum isl_aux_state aux_state = enum isl_aux_state aux_state =
@ -1381,7 +1381,7 @@ anv_layout_to_fast_clear_type(const struct gen_device_info * const devinfo,
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect); uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
/* If there is no auxiliary surface allocated, there are no fast-clears */ /* If there is no auxiliary surface allocated, there are no fast-clears */
if (image->planes[plane].aux_surface.isl.size_B == 0) if (image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE)
return ANV_FAST_CLEAR_NONE; return ANV_FAST_CLEAR_NONE;
/* We don't support MSAA fast-clears on Ivybridge or Bay Trail because they /* We don't support MSAA fast-clears on Ivybridge or Bay Trail because they

View file

@ -3487,15 +3487,13 @@ anv_image_aux_levels(const struct anv_image * const image,
VkImageAspectFlagBits aspect) VkImageAspectFlagBits aspect)
{ {
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect); uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
if (image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE)
return 0;
/* The Gen12 CCS aux surface is represented with only one level. */ /* The Gen12 CCS aux surface is represented with only one level. */
const uint8_t aux_logical_levels = return image->planes[plane].aux_surface.isl.tiling == ISL_TILING_GEN12_CCS ?
image->planes[plane].aux_surface.isl.tiling == ISL_TILING_GEN12_CCS ?
image->planes[plane].surface.isl.levels : image->planes[plane].surface.isl.levels :
image->planes[plane].aux_surface.isl.levels; image->planes[plane].aux_surface.isl.levels;
return image->planes[plane].aux_surface.isl.size_B > 0 ?
aux_logical_levels : 0;
} }
/* Returns the number of auxiliary buffer layers attached to an image. */ /* Returns the number of auxiliary buffer layers attached to an image. */

View file

@ -4827,7 +4827,7 @@ cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
if (GEN_GEN < 10 && if (GEN_GEN < 10 &&
(att_state->pending_load_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) && (att_state->pending_load_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) &&
image->planes[0].aux_surface.isl.size_B > 0 && image->planes[0].aux_usage != ISL_AUX_USAGE_NONE &&
iview->planes[0].isl.base_level == 0 && iview->planes[0].isl.base_level == 0 &&
iview->planes[0].isl.base_array_layer == 0) { iview->planes[0].isl.base_array_layer == 0) {
if (att_state->aux_usage != ISL_AUX_USAGE_NONE) { if (att_state->aux_usage != ISL_AUX_USAGE_NONE) {