From c496d442844183968f7c4903c8ed549aa990d15f Mon Sep 17 00:00:00 2001 From: Fritz Koenig Date: Wed, 4 Dec 2019 16:16:43 -0800 Subject: [PATCH] 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 --- 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 98287b95145..db639c72c12 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 b478be3aa66..12dcb8a6e80 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 d5caf9513ca..6e046cfa8c6 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); } -- 2.30.2