Module: Mesa
Branch: master
Commit: f475b7998030529c8151343fca1a7a05c178e386
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f475b7998030529c8151343fca1a7a05c178e386

Author: Alyssa Rosenzweig <[email protected]>
Date:   Thu Jul 18 11:09:19 2019 -0700

panfrost/mfbd: Unify depth-only with masked FBO path

Signed-off-by: Alyssa Rosenzweig <[email protected]>

---

 src/gallium/drivers/panfrost/pan_mfbd.c | 46 +++++++++++++++++----------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c 
b/src/gallium/drivers/panfrost/pan_mfbd.c
index c9f3dc315a0..bbaa9f29414 100644
--- a/src/gallium/drivers/panfrost/pan_mfbd.c
+++ b/src/gallium/drivers/panfrost/pan_mfbd.c
@@ -401,39 +401,41 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx, bool 
has_draws)
         /* TODO: MRT clear */
         panfrost_mfbd_clear(job, &fb, &fbx, rts, fb.rt_count_2);
 
-        for (int cb = 0; cb < ctx->pipe_framebuffer.nr_cbufs; ++cb) {
+        /* We always upload at least one dummy GL_NONE render target */
+
+        unsigned rt_descriptors =
+                MAX2(ctx->pipe_framebuffer.nr_cbufs, 1);
+
+        /* Upload either the render target or a dummy GL_NONE target */
+
+        for (int cb = 0; cb < rt_descriptors; ++cb) {
                 struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[cb];
 
-                if (!surf)
-                        continue;
+                if (surf) {
+                        panfrost_mfbd_set_cbuf(&rts[cb], surf);
 
-                unsigned bpp = util_format_get_blocksize(surf->format);
+                        /* What is this? Looks like some extension of the bpp
+                         * field. Maybe it establishes how much internal
+                         * tilebuffer space is reserved? */
 
-                panfrost_mfbd_set_cbuf(&rts[cb], surf);
+                        unsigned bpp = util_format_get_blocksize(surf->format);
+                        fb.rt_count_2 = MAX2(fb.rt_count_2, ALIGN_POT(bpp, 4) 
/ 4);
+                } else {
+                        struct mali_rt_format null_rt = {
+                                .unk1 = 0x4000000,
+                                .unk4 = 0x8
+                        };
 
-                /* What is this? Looks like some extension of the bpp field.
-                 * Maybe it establishes how much internal tilebuffer space is
-                 * reserved? */
-                fb.rt_count_2 = MAX2(fb.rt_count_2, ALIGN_POT(bpp, 4) / 4);
+                        rts[cb].format = null_rt;
+                        rts[cb].framebuffer = 0;
+                        rts[cb].framebuffer_stride = 0;
+                }
         }
 
         if (ctx->pipe_framebuffer.zsbuf) {
                 panfrost_mfbd_set_zsbuf(&fb, &fbx, 
ctx->pipe_framebuffer.zsbuf);
         }
 
-        /* For the special case of a depth-only FBO, we need to attach a dummy 
render target */
-
-        if (ctx->pipe_framebuffer.nr_cbufs == 0) {
-                struct mali_rt_format null_rt = {
-                        .unk1 = 0x4000000,
-                        .unk4 = 0x8
-                };
-
-                rts[0].format = null_rt;
-                rts[0].framebuffer = 0;
-                rts[0].framebuffer_stride = 0;
-        }
-
         /* When scanning out, the depth buffer is immediately invalidated, so
          * we don't need to waste bandwidth writing it out. This can improve
          * performance substantially (Z32_UNORM 1080p @ 60fps is 475 MB/s of

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to