From 22d1e495daa83aee0792cc56151e4b5a960fa04c Mon Sep 17 00:00:00 2001 From: Fritz Koenig Date: Wed, 4 Dec 2019 16:16:43 -0800 Subject: freedreno: reorder format check With the addition of the planar formats helper, the planar formats no longer have a valid block.bits field. Calling util_format_get_blocksize therefore asserts. Reorder the check to see if the format is supported before doing the query to get the blocksize. Fixes: 20f132e5eff2d ("gallium/util: add planar format layouts and helpers") Signed-off-by: Fritz Koenig Reviewed-by: Rob Clark (cherry picked from commit c496d442844183968f7c4903c8ed549aa990d15f) --- src/gallium/drivers/freedreno/a4xx/fd4_screen.c | 4 ++-- src/gallium/drivers/freedreno/a5xx/fd5_screen.c | 4 ++-- src/gallium/drivers/freedreno/a6xx/fd6_screen.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c index c775ebfd1fc..22b142c9ad1 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c @@ -60,9 +60,9 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen, } if ((usage & PIPE_BIND_SAMPLER_VIEW) && + (fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0) && (target == PIPE_BUFFER || - util_format_get_blocksize(format) != 12) && - (fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0)) { + util_format_get_blocksize(format) != 12)) { retval |= PIPE_BIND_SAMPLER_VIEW; } diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c index 14f8ab77221..c26e0c86e13 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c @@ -76,9 +76,9 @@ fd5_screen_is_format_supported(struct pipe_screen *pscreen, } if ((usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE)) && + (fd5_pipe2tex(format) != (enum a5xx_tex_fmt)~0) && (target == PIPE_BUFFER || - util_format_get_blocksize(format) != 12) && - (fd5_pipe2tex(format) != (enum a5xx_tex_fmt)~0)) { + util_format_get_blocksize(format) != 12)) { retval |= usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE); } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_screen.c b/src/gallium/drivers/freedreno/a6xx/fd6_screen.c index dddda98f121..02be60ce3bf 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_screen.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_screen.c @@ -82,9 +82,9 @@ fd6_screen_is_format_supported(struct pipe_screen *pscreen, } if ((usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE)) && + (fd6_pipe2tex(format) != (enum a6xx_tex_fmt)~0) && (target == PIPE_BUFFER || - util_format_get_blocksize(format) != 12) && - (fd6_pipe2tex(format) != (enum a6xx_tex_fmt)~0)) { + util_format_get_blocksize(format) != 12)) { retval |= usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE); } -- cgit v1.2.1