freedreno: Avoid staging blits with stencil on older gens
authorRob Clark <robdclark@chromium.org>
Fri, 23 Apr 2021 23:47:47 +0000 (16:47 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 28 Apr 2021 15:36:42 +0000 (15:36 +0000)
This avoids infinite recursion with fallback to
util_resource_copy_region()

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10444>

src/gallium/drivers/freedreno/freedreno_resource.c

index f175296..41523a8 100644 (file)
@@ -508,10 +508,18 @@ fd_resource_dump(struct fd_resource *rsc, const char *name)
 static struct fd_resource *
 fd_alloc_staging(struct fd_context *ctx, struct fd_resource *rsc,
                  unsigned level, const struct pipe_box *box)
+   assert_dt
 {
    struct pipe_context *pctx = &ctx->base;
    struct pipe_resource tmpl = rsc->b.b;
 
+   /* We cannot currently do stencil export on earlier gens, and
+    * u_blitter cannot do blits involving stencil otherwise:
+    */
+   if ((ctx->screen->gpu_id < 600) && !ctx->blit &&
+       (util_format_get_mask(tmpl.format) & PIPE_MASK_S))
+      return NULL;
+
    tmpl.width0 = box->width;
    tmpl.height0 = box->height;
    /* for array textures, box->depth is the array_size, otherwise