summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2018-12-10 10:40:31 -0500
committerRob Clark <robdclark@gmail.com>2018-12-13 15:51:01 -0500
commit85cd4df47f952414e47fc61a08a03fdf285af766 (patch)
treee49ce4089a2357b3ede326e465bf0c8f57cd1639
parentcca1e9606c1fa05dafb994d2d1d92a9b2a35c5c2 (diff)
freedreno/a6xx: fix blitter crash
Fixes a crash with unsupported formats in dEQP-GLES3.functional.texture.format.sized.2d.rgb9_e5_pot Also fixes gpu hangs with some formats that are supported, but which we don't know what internal-format to use for the blitter, for ex dEQP-GLES3.functional.texture.format.sized.2d_array.rgb10_a2_pot Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_blitter.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
index 13a5e4afb4..456aedd29d 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
@@ -52,6 +52,19 @@ ok_dims(const struct pipe_resource *r, const struct pipe_box *b, int lvl)
(b->z >= 0) && (b->z + b->depth <= last_layer);
}
+static bool
+ok_format(enum pipe_format pfmt)
+{
+ enum a6xx_color_fmt fmt = fd6_pipe2color(pfmt);
+ if (fmt == ~0)
+ return false;
+
+ if (fd6_ifmt(fmt) == 0)
+ return false;
+
+ return true;
+}
+
#define DEBUG_BLIT_FALLBACK 0
#define fail_if(cond) \
do { \
@@ -81,6 +94,10 @@ can_do_blit(const struct pipe_blit_info *info)
fail_if(util_format_is_compressed(info->src.format) !=
util_format_is_compressed(info->src.format));
+ /* Fail if unsupported format: */
+ fail_if(!ok_format(info->src.format));
+ fail_if(!ok_format(info->dst.format));
+
/* ... but only if they're the same compression format. */
fail_if(util_format_is_compressed(info->src.format) &&
info->src.format != info->dst.format);