[Mesa-dev] [PATCH] radv: do not advertise D16_UNORM on VI for Talos/Serious Sam Fusion 2017

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Fri Nov 3 19:00:47 UTC 2017


On Fri, Nov 3, 2017 at 11:39 AM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> VK_FORMAT_D16_UNORM is mandatory for 2D images, but Talos and
> Serious Sam Fusion 2017 can use VK_FORMAT_D32_SFLOAT instead.
>
> This implements some sort of drirc for radv (just based on
> the application names).
>
> This improves performance with Talos (73->76FPS) and Serious
> Sam 2017 (119->134FPS) because they no longer use any 16bpp
> depth surfaces and thus no HTILE decompressions are needed.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/vulkan/radv_device.c  | 17 +++++++++++++++++
>  src/amd/vulkan/radv_formats.c | 10 ++++++++++
>  src/amd/vulkan/radv_private.h |  2 ++
>  3 files changed, 29 insertions(+)
>
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index e34b19c648..391ae722bb 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -400,6 +400,23 @@ VkResult radv_CreateInstance(
>         instance->perftest_flags = parse_debug_string(getenv("RADV_PERFTEST"),
>                                                    radv_perftest_options);
>
> +       if (pCreateInfo->pApplicationInfo &&
> +           pCreateInfo->pApplicationInfo->pApplicationName) {
> +               const char *name =
> +                       pCreateInfo->pApplicationInfo->pApplicationName;
> +
> +               if (!strcmp(name, "Talos - Linux - 64bit") ||
> +                   !strcmp(name, "Serious Sam Fusion 2017 - Linux - 64bit")) {

I think at leat Talos also allows you to start a 32bit version? MAybe
figure out what they use and add it?

Also I'd appreciate if we can isolate the per app setup to a separate
function (& the flags to a separate struct, even though it has one
member now).

Do we want to check versions, in case a future update breaks this hack?

> +                       /* Although, VK_FORMAT_D16_UNORM is mandatory for
> +                        * VK_IMAGE_TYPE_2D, Talos and Serious Sam Fusion 2017
> +                        * can use VK_FORMAT_D32_SFLOAT when D16_UNORM is not
> +                        * supported. This improves performance on VI because
> +                        * TC compatible HTILE only supports D32_SFLOAT.
> +                        */
> +                       instance->disable_d16_unorm_format = true;
> +               }
> +       }
> +
>         *pInstance = radv_instance_to_handle(instance);
>
>         return VK_SUCCESS;
> diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c
> index 5c79ea7406..2adb20254a 100644
> --- a/src/amd/vulkan/radv_formats.c
> +++ b/src/amd/vulkan/radv_formats.c
> @@ -1122,6 +1122,16 @@ static VkResult radv_get_image_format_properties(struct radv_physical_device *ph
>                 }
>         }
>
> +       if (info->format == VK_FORMAT_D16_UNORM &&
> +           physical_device->instance->disable_d16_unorm_format &&
> +           physical_device->rad_info.chip_class == VI) {
> +               /* Do not advertise D16_UNORM on VI because TC compatible HTILE
> +                * only supports D32_SFLOAT (GFX9 supports both), and HTILE
> +                * decompressions are costly.
> +                */
> +               goto unsupported;
> +       }
> +
>         *pImageFormatProperties = (VkImageFormatProperties) {
>                 .maxExtent = maxExtent,
>                 .maxMipLevels = maxMipLevels,
> diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
> index 83965b41b2..2835bc03ea 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -298,6 +298,8 @@ struct radv_instance {
>
>         uint64_t debug_flags;
>         uint64_t perftest_flags;
> +
> +       bool disable_d16_unorm_format;
>  };
>
>  VkResult radv_init_wsi(struct radv_physical_device *physical_device);
> --
> 2.15.0
>
> _______________________________________________
> 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