anv: Rework the meaning of anv_image::planes[]::aux_usage

Previously, we set aux_usage=ISL_AUX_USAGE_NONE when we really meant
CCS_D.  This sort-of made sense before we had anv_layout_to_aux_usage
but now that we have that helper.  However, in our more modern aux
tracking model, all aux usage goes through anv_layout_to_* and we're
better off making the meaning of anv_image::planes[]::aux_usage be
AUX_USAGE_NONE if and only if there is no compression.

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

View File

@ -1441,17 +1441,6 @@ void anv_CmdResolveImage(
}
}
static enum isl_aux_usage
fast_clear_aux_usage(const struct anv_image *image,
VkImageAspectFlagBits aspect)
{
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
if (image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE)
return ISL_AUX_USAGE_CCS_D;
else
return image->planes[plane].aux_usage;
}
void
anv_image_copy_to_shadow(struct anv_cmd_buffer *cmd_buffer,
const struct anv_image *image,
@ -1836,7 +1825,7 @@ anv_image_ccs_op(struct anv_cmd_buffer *cmd_buffer,
struct blorp_surf surf;
get_blorp_surf_for_anv_image(cmd_buffer->device, image, aspect,
0, ANV_IMAGE_LAYOUT_EXPLICIT_AUX,
fast_clear_aux_usage(image, aspect),
image->planes[plane].aux_usage,
&surf);
/* Blorp will store the clear color for us if we provide the clear color

View File

@ -438,8 +438,8 @@ make_surface(struct anv_device *dev,
&image->planes[plane].surface.isl,
&image->planes[plane].aux_surface.isl);
assert(ok);
add_surface(image, &image->planes[plane].aux_surface, plane);
image->planes[plane].aux_usage = ISL_AUX_USAGE_HIZ;
add_surface(image, &image->planes[plane].aux_surface, plane);
}
} else if ((aspect & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) && image->samples == 1) {
/* TODO: Disallow compression with :
@ -499,6 +499,8 @@ make_surface(struct anv_device *dev,
"Gen12+. Not allocating a CCS buffer.");
image->planes[plane].aux_surface.isl.size_B = 0;
return VK_SUCCESS;
} else {
image->planes[plane].aux_usage = ISL_AUX_USAGE_CCS_D;
}
add_surface(image, &image->planes[plane].aux_surface, plane);
@ -512,9 +514,9 @@ make_surface(struct anv_device *dev,
&image->planes[plane].surface.isl,
&image->planes[plane].aux_surface.isl);
if (ok) {
image->planes[plane].aux_usage = ISL_AUX_USAGE_MCS;
add_surface(image, &image->planes[plane].aux_surface, plane);
add_aux_state_tracking_buffer(image, plane, dev);
image->planes[plane].aux_usage = ISL_AUX_USAGE_MCS;
}
}
@ -1153,10 +1155,9 @@ anv_layout_to_aux_state(const struct gen_device_info * const devinfo,
*/
assert(image->planes[plane].aux_usage == ISL_AUX_USAGE_HIZ);
return ISL_AUX_STATE_AUX_INVALID;
} else if (image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE) {
} else if (image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_D) {
return ISL_AUX_STATE_PASS_THROUGH;
} else {
assert(image->planes[plane].aux_usage != ISL_AUX_USAGE_CCS_D);
return ISL_AUX_STATE_COMPRESSED_CLEAR;
}
@ -1173,7 +1174,7 @@ anv_layout_to_aux_state(const struct gen_device_info * const devinfo,
return ISL_AUX_STATE_COMPRESSED_CLEAR;
else
return ISL_AUX_STATE_RESOLVED;
} else if (image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE) {
} else if (image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_D) {
return ISL_AUX_STATE_PASS_THROUGH;
} else {
return ISL_AUX_STATE_COMPRESSED_CLEAR;
@ -1213,11 +1214,9 @@ anv_layout_to_aux_state(const struct gen_device_info * const devinfo,
assert(aspect & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
/* fall-through */
case VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR:
if (image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE) {
assert(image->samples == 1);
if (image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_D) {
return ISL_AUX_STATE_PARTIAL_CLEAR;
} else {
assert(image->planes[plane].aux_usage != ISL_AUX_USAGE_CCS_D);
return ISL_AUX_STATE_COMPRESSED_CLEAR;
}
@ -1322,7 +1321,7 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,
case ISL_AUX_STATE_PARTIAL_CLEAR:
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
assert(image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE);
assert(image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_D);
assert(image->samples == 1);
return ISL_AUX_USAGE_CCS_D;

View File

@ -3438,11 +3438,9 @@ struct anv_image {
struct anv_surface shadow_surface;
/**
* For color images, this is the aux usage for this image when not used
* as a color attachment.
*
* For depth/stencil images, this is set to ISL_AUX_USAGE_HIZ if the
* image has a HiZ buffer.
* The base aux usage for this image. For color images, this can be
* either CCS_E or CCS_D depending on whether or not we can reliably
* leave CCS on all the time.
*/
enum isl_aux_usage aux_usage;

View File

@ -815,7 +815,7 @@ anv_cmd_predicated_ccs_resolve(struct anv_cmd_buffer *cmd_buffer,
* to do a partial resolve on a CCS_D surface.
*/
if (resolve_op == ISL_AUX_OP_PARTIAL_RESOLVE &&
image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE)
image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_D)
resolve_op = ISL_AUX_OP_FULL_RESOLVE;
anv_image_ccs_op(cmd_buffer, image, format, aspect, level,