panfrost; Disable AFBC for depth buffers
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Wed, 13 Mar 2019 01:31:30 +0000 (01:31 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 14 Mar 2019 22:47:12 +0000 (22:47 +0000)
For inexplicable reasons, the depth buffer is faster if kept as linear,
whereas the colour buffers are faster if AFBC. Given both code paths are
available, we'll choose the faster one of each (which also helps with
testing coverage).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_resource.c

index a038ea122f7176a7945d6bf485d9196487a91dc8..f607a9a8169bc8b7c63cbc1cf0285c67f03d59a8 100644 (file)
@@ -2058,10 +2058,7 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx,
                                 panfrost_attach_vt_framebuffer(ctx);
                                 panfrost_set_scissor(ctx);
 
-                                struct panfrost_resource *tex = ((struct panfrost_resource *) ctx->pipe_framebuffer.zsbuf->texture);
-
-                                if (tex->bo->layout != PAN_AFBC && !panfrost_is_scanout(ctx))
-                                        panfrost_enable_afbc(ctx, tex, true);
+                                /* Keep the depth FBO linear */
                         }
                 }
         }
index 89be07871a515ee394f30ea2c3cde93cd1f66a9e..ffb65fc52a94d088e9f60fa468b0087d31475739 100644 (file)
@@ -220,6 +220,12 @@ panfrost_create_bo(struct panfrost_screen *screen, const struct pipe_resource *t
         /* Tiling textures is almost always faster, unless we only use it once */
         bool should_tile = (template->usage != PIPE_USAGE_STREAM) && (template->bind & PIPE_BIND_SAMPLER_VIEW);
 
+        /* For unclear reasons, depth/stencil is faster linear than AFBC, so
+         * make sure it's linear */
+
+        if (template->bind & PIPE_BIND_DEPTH_STENCIL)
+                should_tile = false;
+
         /* Set the layout appropriately */
         bo->layout = should_tile ? PAN_TILED : PAN_LINEAR;