From: Jason Ekstrand Date: Tue, 21 Jan 2020 23:13:30 +0000 (-0600) Subject: anv: Rework the meaning of anv_image::planes[]::aux_usage X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e693a57232a45df6093e583ec5a105d04d2f4c13;p=mesa.git 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 Part-of: --- diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index f2554e04df9..232d02fdddc 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -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 diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 7c7b385df28..e11d1659328 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -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; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 55b06ef6db9..3c79a5d43e5 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -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; diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 6fabe9134a3..7d02961a141 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -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,