panfrost: Use polygon list header size computation
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 13 Jun 2019 22:15:53 +0000 (15:15 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 17 Jun 2019 14:59:14 +0000 (07:59 -0700)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_context.c

index 009ff6859e50ae50049df013da17090e9ca642c7..f66ee434c04cff31fd22c288b23c5a2b3adb12d8 100644 (file)
@@ -46,6 +46,7 @@
 #include "pan_blending.h"
 #include "pan_blend_shaders.h"
 #include "pan_util.h"
+#include "pan_tiler.h"
 
 static int performance_counter_number = 0;
 extern const char *pan_counters_base;
@@ -134,6 +135,9 @@ panfrost_emit_sfbd(struct panfrost_context *ctx)
 struct bifrost_framebuffer
 panfrost_emit_mfbd(struct panfrost_context *ctx)
 {
+        unsigned width = ctx->pipe_framebuffer.width;
+        unsigned height = ctx->pipe_framebuffer.height;
+
         struct bifrost_framebuffer framebuffer = {
                 /* The lower 0x1ff controls the hierarchy mask. Set more bits
                  * on for more tile granularity (which can be a performance win
@@ -149,13 +153,12 @@ panfrost_emit_mfbd(struct panfrost_context *ctx)
 
                 /* See pan_tiler.c */
                 .tiler_polygon_list  = ctx->misc_0.gpu,
-                .tiler_polygon_list_body = ctx->misc_0.gpu + 0xf0000,
                 .tiler_polygon_list_size = 0x0,
 
-                .width1 = MALI_POSITIVE(ctx->pipe_framebuffer.width),
-                .height1 = MALI_POSITIVE(ctx->pipe_framebuffer.height),
-                .width2 = MALI_POSITIVE(ctx->pipe_framebuffer.width),
-                .height2 = MALI_POSITIVE(ctx->pipe_framebuffer.height),
+                .width1 = MALI_POSITIVE(width),
+                .height1 = MALI_POSITIVE(height),
+                .width2 = MALI_POSITIVE(width),
+                .height2 = MALI_POSITIVE(height),
 
                 .unk1 = 0x1080,
 
@@ -168,6 +171,14 @@ panfrost_emit_mfbd(struct panfrost_context *ctx)
                 .scratchpad = ctx->scratchpad.gpu,
         };
 
+        /* Compute the polygon header size and use that to offset the body */
+
+        unsigned header_size = panfrost_tiler_header_size(
+                        width, height, framebuffer.tiler_hierarchy_mask);
+
+        framebuffer.tiler_polygon_list_body =
+                framebuffer.tiler_polygon_list + header_size;
+
         return framebuffer;
 }