[Mesa-dev] [PATCH 12/12] panfrost: Make hacks a little more obvious

Alyssa Rosenzweig alyssa at rosenzweig.io
Sun Mar 10 06:50:26 UTC 2019


To be clear, the layout switching voodoo is still a hack that needs to
be cleaned up. But that's a job as big as this patch series always-is,
so at least explain _why_ we're working counterintuitively.

Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
---
 src/gallium/drivers/panfrost/pan_resource.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 0f11b8e5e38..bf2e40e3086 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -212,12 +212,18 @@ panfrost_best_layout(const struct pipe_resource *rsrc)
                 PIPE_BIND_BLENDABLE;
 
         if (rsrc->bind & renderable_bind) {
-                /* TODO: AFBC */
-                return PAN_LINEAR;
-        } else if (rsrc->bind & PIPE_BIND_SAMPLER_VIEW) {
-                return PAN_TILED;
+                /* TODO: AFBC. Currently, on render we switch to AFBC. This is
+                 * a hack, but the correct solution (deferring layout selection
+                 * explicitly, switching upon any constrained use, shadowing if
+                 * necessary) is a lot more complex than needed right now. So
+                 * for now, pretend we're always regular textures;
+                 * set_framebuffer_state has a hack to flip on AFBC later if
+                 * strictly necessary */
         }
 
+        if (rsrc->bind & PIPE_BIND_SAMPLER_VIEW)
+                return PAN_TILED;
+
         /* If all else fails, we default to linear */
 
         return PAN_LINEAR;
@@ -253,7 +259,7 @@ panfrost_create_bo(struct panfrost_screen *screen, const struct pipe_resource *t
 
                 struct panfrost_memory mem;
 
-                unsigned pages = ((sz + 4095) / 4096) * 2;
+                unsigned pages = ((sz + 4095) / 4096);
                 screen->driver->allocate_slab(screen, &mem, pages, true, 0, 0, 0);
 
                 bo->cpu[0] = mem.cpu;
-- 
2.20.1



More information about the mesa-dev mailing list