panfrost: Get rid of the non-native wallpering bits

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
diff --git a/src/gallium/drivers/panfrost/pan_blit.c b/src/gallium/drivers/panfrost/pan_blit.c
index c9fc8c8..59c505b 100644
--- a/src/gallium/drivers/panfrost/pan_blit.c
+++ b/src/gallium/drivers/panfrost/pan_blit.c
@@ -91,41 +91,3 @@
 
         return;
 }
-
-/* Blits a framebuffer to "itself". Mali is a tiler, so the
- * framebuffer is implicitly cleared every frame, so if there is
- * no actual glClear(), we have to blit it back ourselves.
- */
-
-void
-panfrost_blit_wallpaper(struct panfrost_context *ctx, struct pipe_box *box)
-{
-        struct panfrost_batch *batch = ctx->wallpaper_batch;
-        struct pipe_blit_info binfo = {0};
-
-        panfrost_blitter_save(ctx, ctx->blitter_wallpaper);
-
-        struct pipe_surface *surf = batch->key.cbufs[0];
-        unsigned level = surf->u.tex.level;
-        unsigned layer = surf->u.tex.first_layer;
-        assert(surf->u.tex.last_layer == layer);
-
-        binfo.src.resource = binfo.dst.resource = batch->key.cbufs[0]->texture;
-        binfo.src.level = binfo.dst.level = level;
-        binfo.src.box.x = binfo.dst.box.x = box->x;
-        binfo.src.box.y = binfo.dst.box.y = box->y;
-        binfo.src.box.z = binfo.dst.box.z = layer;
-        binfo.src.box.width = binfo.dst.box.width = box->width;
-        binfo.src.box.height = binfo.dst.box.height = box->height;
-        binfo.src.box.depth = binfo.dst.box.depth = 1;
-
-        binfo.src.format = binfo.dst.format = batch->key.cbufs[0]->format;
-
-        assert(batch->key.nr_cbufs == 1);
-        binfo.mask = PIPE_MASK_RGBA;
-        binfo.filter = PIPE_TEX_FILTER_LINEAR;
-        binfo.scissor_enable = FALSE;
-
-        util_blitter_blit(ctx->blitter_wallpaper, &binfo);
-}
-
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 05298f7..0f7987b 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1825,18 +1825,6 @@
                                 const struct panfrost_ptr *tiler_job)
 {
         struct panfrost_context *ctx = batch->ctx;
-        bool wallpapering = ctx->wallpaper_batch && batch->scoreboard.tiler_dep;
-
-        if (wallpapering) {
-                /* Inject in reverse order, with "predicted" job indices.
-                 * THIS IS A HACK XXX */
-
-                panfrost_add_job(&batch->pool, &batch->scoreboard, MALI_JOB_TYPE_TILER, false,
-                                 batch->scoreboard.job_index + 2, tiler_job, true);
-                panfrost_add_job(&batch->pool, &batch->scoreboard, MALI_JOB_TYPE_VERTEX, false, 0,
-                                 vertex_job, true);
-                return;
-        }
 
         /* If rasterizer discard is enable, only submit the vertex */
 
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index a09e4f8..588b5f6 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1309,9 +1309,6 @@
         if (panfrost->blitter)
                 util_blitter_destroy(panfrost->blitter);
 
-        if (panfrost->blitter_wallpaper)
-                util_blitter_destroy(panfrost->blitter_wallpaper);
-
         util_unreference_framebuffer_state(&panfrost->pipe_framebuffer);
         u_upload_destroy(pipe->stream_uploader);
         u_upload_destroy(panfrost->state_uploader);
@@ -1620,10 +1617,8 @@
         ctx->primconvert = util_primconvert_create(gallium, ctx->draw_modes);
 
         ctx->blitter = util_blitter_create(gallium);
-        ctx->blitter_wallpaper = util_blitter_create(gallium);
 
         assert(ctx->blitter);
-        assert(ctx->blitter_wallpaper);
 
         /* Prepare for render! */
 
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index a452c4c..e607b82 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -162,15 +162,6 @@
         struct primconvert_context *primconvert;
         struct blitter_context *blitter;
 
-        /* Blitting the wallpaper (the old contents of the framebuffer back to
-         * itself) uses a dedicated u_blitter instance versus general blit()
-         * callbacks from Gallium, as the blit() callback can trigger
-         * wallpapering without Gallium realising, which in turns u_blitter
-         * errors due to unsupported reucrsion */
-
-        struct blitter_context *blitter_wallpaper;
-        struct panfrost_batch *wallpaper_batch;
-
         struct panfrost_blend_state *blend;
 
         struct pipe_viewport_state pipe_viewport;
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 5b6fce5..8170ba1 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -276,12 +276,6 @@
 struct panfrost_batch *
 panfrost_get_batch_for_fbo(struct panfrost_context *ctx)
 {
-        /* If we're wallpapering, we special case to workaround
-         * u_blitter abuse */
-
-        if (ctx->wallpaper_batch)
-                return ctx->wallpaper_batch;
-
         /* If we already began rendering, use that */
 
         if (ctx->batch) {
@@ -548,13 +542,6 @@
         if (!(flags & PAN_BO_ACCESS_SHARED))
                 return;
 
-        /* All dependencies should have been flushed before we execute the
-         * wallpaper draw, so it should be harmless to skip the
-         * update_bo_access() call.
-         */
-        if (batch == batch->ctx->wallpaper_batch)
-                return;
-
         assert(flags & PAN_BO_ACCESS_RW);
         panfrost_batch_update_bo_access(batch, bo, flags & PAN_BO_ACCESS_WRITE,
                         old_flags != 0);
diff --git a/src/gallium/drivers/panfrost/pan_resource.h b/src/gallium/drivers/panfrost/pan_resource.h
index 121a7ab..1de0051 100644
--- a/src/gallium/drivers/panfrost/pan_resource.h
+++ b/src/gallium/drivers/panfrost/pan_resource.h
@@ -113,10 +113,6 @@
               const struct pipe_blit_info *info);
 
 void
-panfrost_blit_wallpaper(struct panfrost_context *ctx,
-                        struct pipe_box *box);
-
-void
 panfrost_resource_set_damage_region(struct pipe_screen *screen,
                                     struct pipe_resource *res,
                                     unsigned int nrects,