panfrost: Take the number of samples into account in blend shaders
authorBoris Brezillon <boris.brezillon@collabora.com>
Tue, 8 Dec 2020 10:42:15 +0000 (11:42 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 9 Dec 2020 16:29:25 +0000 (16:29 +0000)
Midgard has to split the writeout instruction if the number of bits per
pixel exceeds 128. We thus need to take the number of samples into
account when creating blend shaders.

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

.gitlab-ci/deqp-panfrost-t860-fails.txt
src/gallium/drivers/panfrost/pan_blend.h
src/gallium/drivers/panfrost/pan_blend_cso.c
src/gallium/drivers/panfrost/pan_blend_shaders.c
src/gallium/drivers/panfrost/pan_job.c

index a0f551b..462f206 100644 (file)
@@ -29,9 +29,6 @@ dEQP-GLES3.functional.fbo.msaa.4_samples.depth32f_stencil8,Fail
 dEQP-GLES3.functional.fbo.msaa.4_samples.depth_component16,Fail
 dEQP-GLES3.functional.fbo.msaa.4_samples.depth_component24,Fail
 dEQP-GLES3.functional.fbo.msaa.4_samples.depth_component32f,Fail
-dEQP-GLES3.functional.fbo.msaa.4_samples.rg32f,Fail
-dEQP-GLES3.functional.fbo.msaa.4_samples.rgba16f,Fail
-dEQP-GLES3.functional.fbo.msaa.4_samples.rgba32f,Fail
 dEQP-GLES3.functional.fbo.msaa.4_samples.stencil_index8,Fail
 dEQP-GLES2.functional.shaders.indexing.tmp_array.float_const_write_dynamic_loop_read_fragment,Crash
 dEQP-GLES2.functional.shaders.indexing.tmp_array.float_const_write_dynamic_loop_read_vertex,Crash
index 901d54a..ba74edc 100644 (file)
@@ -47,6 +47,9 @@ struct panfrost_blend_shader_key {
         unsigned logicop_enable : 1;
         unsigned logicop_func:4;
 
+        /* Number of samples */
+        unsigned nr_samples : 5;
+
         struct pipe_rt_blend_state equation;
 };
 
@@ -143,7 +146,7 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rt, struct
 struct panfrost_blend_shader *
 panfrost_get_blend_shader(struct panfrost_context *ctx,
                           struct panfrost_blend_state *blend,
-                          enum pipe_format fmt,
+                          enum pipe_format fmt, unsigned nr_samples,
                           unsigned rt,
                           const float *constants);
 
index 370fe9f..dace098 100644 (file)
@@ -69,7 +69,7 @@
 struct panfrost_blend_shader *
 panfrost_get_blend_shader(struct panfrost_context *ctx,
                           struct panfrost_blend_state *blend,
-                          enum pipe_format fmt,
+                          enum pipe_format fmt, unsigned nr_samples,
                           unsigned rt,
                           const float *constants)
 {
@@ -81,6 +81,7 @@ panfrost_get_blend_shader(struct panfrost_context *ctx,
         struct panfrost_blend_shader_key key = {
                 .rt = rt,
                 .format = fmt,
+                .nr_samples = MAX2(nr_samples, 1),
                 .has_constants = constants != NULL,
                 .logicop_enable = blend->base.logicop_enable,
         };
@@ -254,9 +255,12 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti, struc
                 }
         }
 
+        unsigned nr_samples = fb->cbufs[rti]->nr_samples ? :
+                              fb->cbufs[rti]->texture->nr_samples;
+
         /* Otherwise, we need to grab a shader */
         struct panfrost_blend_shader *shader =
-                panfrost_get_blend_shader(ctx, blend, fmt, rti,
+                panfrost_get_blend_shader(ctx, blend, fmt, nr_samples, rti,
                                           rt->constant_mask ?
                                           ctx->blend_color.color : NULL);
 
index 4a5e97e..8ff0649 100644 (file)
@@ -287,6 +287,7 @@ panfrost_compile_blend_shader(struct panfrost_blend_shader *shader,
                 .gpu_id = dev->gpu_id,
                 .is_blend = true,
                 .blend.rt = shader->key.rt,
+                .blend.nr_samples = shader->key.nr_samples,
                 .rt_formats = {shader->key.format},
         };
 
index eec81a9..dedf66d 100644 (file)
@@ -825,7 +825,9 @@ 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,
+                                                  rsrc->base.format,
+                                                  rsrc->base.nr_samples,
+                                                  loc - FRAG_RESULT_DATA0,
                                                   NULL);
 
                 struct panfrost_bo *bo = panfrost_batch_create_bo(batch, b->size,