[PATCH 4/4] etnaviv: add support for snorm textures
Lucas Stach
l.stach at pengutronix.de
Thu Jul 13 08:07:21 UTC 2017
Am Mittwoch, den 21.06.2017, 22:36 +0200 schrieb Christian Gmeiner:
> Based on a patch from Wladimir J. van der Laan and untested due
> to lack of hardware. Binary blob emits those formats if GPU supports
> HALTI1 (faked with ibvivhook).
This patch causes piglit regressions on i.MX6QP. For example the
fbo-blend-color test is going from some broken subtests to a complete
failure. I'm not sure if it's a failure on the on the test or Mesa side,
the etnaviv pipe driver seems to handle things correctly.
Given how close we are to the 17.2 branchpoint we need either a
volunteer to look into this (I don't have the time currently) or we
should revert this patch and try again after 17.2.
Regards,
Lucas
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> ---
> src/gallium/drivers/etnaviv/etnaviv_format.c | 7 ++++---
> src/gallium/drivers/etnaviv/etnaviv_screen.c | 8 ++++++--
> 2 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c b/src/gallium/drivers/etnaviv/etnaviv_format.c
> index c9a8ce2..47f80ac 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_format.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
> @@ -91,7 +91,7 @@ struct etna_format {
> static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> /* 8-bit */
> V_(R8_UNORM, UNSIGNED_BYTE, NONE),
> - V_(R8_SNORM, BYTE, NONE),
> + VT(R8_SNORM, BYTE, EXT_R8_SNORM | EXT_FORMAT, SWIZ(X, 0, 0, 1), NONE),
> V_(R8_UINT, UNSIGNED_BYTE, NONE),
> V_(R8_SINT, BYTE, NONE),
> V_(R8_USCALED, UNSIGNED_BYTE, NONE),
> @@ -121,7 +121,7 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> _T(B5G5R5X1_UNORM, X1R5G5B5, SWIZ(X, Y, Z, W), X1R5G5B5),
>
> VT(R8G8_UNORM, UNSIGNED_BYTE, EXT_G8R8 | EXT_FORMAT, SWIZ(X, Y, 0, 1), NONE),
> - V_(R8G8_SNORM, BYTE, NONE),
> + VT(R8G8_SNORM, BYTE, EXT_G8R8_SNORM | EXT_FORMAT, SWIZ(X, Y, 0, 1), NONE),
> V_(R8G8_UINT, UNSIGNED_BYTE, NONE),
> V_(R8G8_SINT, BYTE, NONE),
> V_(R8G8_USCALED, UNSIGNED_BYTE, NONE),
> @@ -156,8 +156,9 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
> V_(A8B8G8R8_UNORM, UNSIGNED_BYTE, NONE),
>
> V_(R8G8B8A8_UNORM, UNSIGNED_BYTE, A8B8G8R8),
> - V_(R8G8B8A8_SNORM, BYTE, A8B8G8R8),
> + VT(R8G8B8A8_SNORM, BYTE, EXT_A8B8G8R8_SNORM | EXT_FORMAT, SWIZ(X, Y, Z, 1), NONE),
> _T(R8G8B8X8_UNORM, X8B8G8R8, SWIZ(X, Y, Z, W), X8B8G8R8),
> + _T(R8G8B8X8_SNORM, EXT_X8B8G8R8_SNORM | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE),
> V_(R8G8B8A8_UINT, UNSIGNED_BYTE, A8B8G8R8),
> V_(R8G8B8A8_SINT, BYTE, A8B8G8R8),
> V_(R8G8B8A8_USCALED, UNSIGNED_BYTE, A8B8G8R8),
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index e310c16..c7c4c95 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -459,7 +459,8 @@ etna_screen_get_timestamp(struct pipe_screen *pscreen)
> }
>
> static bool
> -gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt)
> +gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt,
> + enum pipe_format format)
> {
> if (fmt == TEXTURE_FORMAT_ETC1)
> return VIV_FEATURE(screen, chipFeatures, ETC1_TEXTURE_COMPRESSION);
> @@ -470,6 +471,9 @@ gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt)
> if (fmt & EXT_FORMAT)
> return VIV_FEATURE(screen, chipMinorFeatures1, HALTI0);
>
> + if (util_format_is_snorm(format))
> + return VIV_FEATURE(screen, chipMinorFeatures2, HALTI1);
> +
> return true;
> }
>
> @@ -514,7 +518,7 @@ etna_screen_is_format_supported(struct pipe_screen *pscreen,
> if (usage & PIPE_BIND_SAMPLER_VIEW) {
> uint32_t fmt = translate_texture_format(format);
>
> - if (!gpu_supports_texure_format(screen, fmt))
> + if (!gpu_supports_texure_format(screen, fmt, format))
> fmt = ETNA_NO_MATCH;
>
> if (sample_count < 2 && fmt != ETNA_NO_MATCH)
More information about the etnaviv
mailing list