panfrost: Allocate blit_blend with ralloc()
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 8 Oct 2020 08:49:12 +0000 (10:49 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 9 Oct 2020 14:16:41 +0000 (14:16 +0000)
This way we can use blend states as memory context which will help
simplify the blend shader creation/destruction logic.

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/7066>

src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h
src/gallium/drivers/panfrost/pan_job.c

index 8185640..06afce0 100644 (file)
@@ -1608,8 +1608,9 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
         panfrost_batch_init(ctx);
 
         if (!(dev->quirks & IS_BIFROST)) {
+                ctx->blit_blend = rzalloc(ctx, struct panfrost_blend_state);
                 for (unsigned c = 0; c < PIPE_MAX_COLOR_BUFS; ++c)
-                        ctx->blit_blend.rt[c].shaders = _mesa_hash_table_u64_create(ctx);
+                        ctx->blit_blend->rt[c].shaders = _mesa_hash_table_u64_create(ctx);
         }
 
         /* By default mask everything on */
index 50fddff..130989f 100644 (file)
@@ -178,7 +178,7 @@ struct panfrost_context {
         unsigned sample_mask;
         unsigned min_samples;
 
-        struct panfrost_blend_state blit_blend;
+        struct panfrost_blend_state *blit_blend;
 };
 
 /* Corresponds to the CSO */
index 57abaa2..d07b358 100644 (file)
@@ -854,7 +854,8 @@ panfrost_load_surface(struct panfrost_batch *batch, struct pipe_surface *surf, u
 
         if (loc >= FRAG_RESULT_DATA0 && !panfrost_can_fixed_blend(rsrc->base.format)) {
                 struct panfrost_blend_shader *b =
-                        panfrost_get_blend_shader(batch->ctx, &batch->ctx->blit_blend, rsrc->base.format, loc - FRAG_RESULT_DATA0);
+                        panfrost_get_blend_shader(batch->ctx, batch->ctx->blit_blend,
+                                                  rsrc->base.format, loc - FRAG_RESULT_DATA0);
 
                 struct panfrost_bo *bo = panfrost_batch_create_bo(batch, b->size,
                    PAN_BO_EXECUTE,