panfrost: implement clear_render_target
authorDavid Heidelberg <david.heidelberg@collabora.com>
Fri, 9 Dec 2022 11:06:52 +0000 (12:06 +0100)
committerMarge Bot <emma+marge@anholt.net>
Sat, 10 Dec 2022 10:56:09 +0000 (10:56 +0000)
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Co-authored-by: Aleksey Komarov <q4arus@ya.ru>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Aleksey Komarov <q4arus@ya.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20238>

src/gallium/drivers/panfrost/pan_resource.c

index 9e95b79..d268b83 100644 (file)
 #include "pan_tiling.h"
 #include "decode.h"
 
+static void
+panfrost_clear_render_target(struct pipe_context *pipe,
+                             struct pipe_surface *dst,
+                             const union pipe_color_union *color,
+                             unsigned dstx, unsigned dsty,
+                             unsigned width, unsigned height,
+                             bool render_condition_enabled)
+{
+        struct panfrost_context *ctx = pan_context(pipe);
+
+        if (render_condition_enabled &&
+            !panfrost_render_condition_check(ctx))
+                return;
+
+        panfrost_blitter_save(ctx, render_condition_enabled);
+        util_blitter_clear_render_target(ctx->blitter, dst, color,
+                                         dstx, dsty, width, height);
+}
+
 static struct pipe_resource *
 panfrost_resource_from_handle(struct pipe_screen *pscreen,
                               const struct pipe_resource *templat,
@@ -1495,4 +1514,5 @@ panfrost_resource_context_init(struct pipe_context *pctx)
         pctx->buffer_subdata = u_default_buffer_subdata;
         pctx->texture_subdata = u_default_texture_subdata;
         pctx->clear_buffer = u_default_clear_buffer;
+        pctx->clear_render_target = panfrost_clear_render_target;
 }