[Mesa-dev] [PATCH 17/18] anv: Enable "permanent" compression for immutable format images

Pohjolainen, Topi topi.pohjolainen at gmail.com
Fri Nov 4 10:12:53 UTC 2016


On Fri, Oct 28, 2016 at 02:17:13AM -0700, Jason Ekstrand wrote:
> This commit extends our support of color compression to surfaces without
> the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT set.  These images will never have
> an image view created with a different format then the one set at image
> creation time so it's safe to always use compression.  We still bail if the
> image is used as a storage image because that sometimes ends up using a
> different format.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

> 
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> ---
>  src/intel/vulkan/anv_blorp.c |  3 +++
>  src/intel/vulkan/anv_image.c | 24 +++++++++++++++++++++++-
>  2 files changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
> index 4cc82ac..c9c9639 100644
> --- a/src/intel/vulkan/anv_blorp.c
> +++ b/src/intel/vulkan/anv_blorp.c
> @@ -1238,6 +1238,9 @@ ccs_resolve_attachment(struct anv_cmd_buffer *cmd_buffer,
>     const struct anv_image *image = iview->image;
>     assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);
>  
> +   if (image->aux_usage == ISL_AUX_USAGE_CCS_E)
> +      return;
> +
>     struct blorp_surf surf;
>     get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_COLOR_BIT,
>                                  att_state->aux_usage, &surf);
> diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
> index ba7c54f..06d791a 100644
> --- a/src/intel/vulkan/anv_image.c
> +++ b/src/intel/vulkan/anv_image.c
> @@ -199,8 +199,30 @@ make_surface(const struct anv_device *dev,
>           assert(image->aux_surface.isl.size == 0);
>           ok = isl_surf_get_ccs_surf(&dev->isl_dev, &anv_surf->isl,
>                                      &image->aux_surface.isl);
> -         if (ok)
> +         if (ok) {
>              add_surface(image, &image->aux_surface);
> +
> +            /* For images created without MUTABLE_FORMAT_BIT set, we know that
> +             * they will always be used with the original format.  In
> +             * particular, they will always be used with a format that
> +             * supports color compression.  This means that it's safe to just
> +             * leave compression on at all times for these formats.
> +             */
> +            if (!(vk_info->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) &&
> +                isl_format_supports_lossless_compression(&dev->info, format)) {
> +               if (vk_info->usage & VK_IMAGE_USAGE_STORAGE_BIT) {
> +                  /*
> +                   * For now, we leave compression off for anything that may
> +                   * be used as a storage image.  This is because accessing
> +                   * storage images may involve ccs-incompatible views or even
> +                   * untyped messages which don't support compression at all.
> +                   */
> +                  anv_finishme("Enable CCS for storage images");
> +               } else {
> +                  image->aux_usage = ISL_AUX_USAGE_CCS_E;
> +               }
> +            }
> +         }
>        }
>     }
>  
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list