[Mesa-dev] [PATCH] panfrost: Place the height value in the height field

Tomeu Vizoso tomeu.vizoso at collabora.com
Thu Jul 11 10:11:13 UTC 2019


In the mali_single_framebuffer descriptor.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
---
 src/gallium/drivers/panfrost/pan_context.c | 12 ++++++++----
 src/gallium/drivers/panfrost/pan_tiler.c   | 12 ++++++++----
 src/gallium/drivers/panfrost/pan_tiler.h   |  6 ++++--
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index cb55dc66e799..9a378ccbfc03 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -102,7 +102,7 @@ panfrost_emit_midg_tiler(
 
         unsigned total_size = header_size + body_size;
 
-        if (t.hierarchy_mask) {
+        if (t.hierarchy_mask != PAN_TILER_HIERARCHY_MASK_DISABLED) {
                 assert(ctx->tiler_polygon_list.bo->size >= total_size);
 
                 /* Specify allocated tiler structures */
@@ -113,6 +113,8 @@ panfrost_emit_midg_tiler(
                 t.heap_end =
                         ctx->tiler_heap.bo->gpu + ctx->tiler_heap.bo->size;
         } else {
+                assert(ctx->tiler_dummy.bo->size >= total_size);
+
                 /* The tiler is disabled, so don't allow the tiler heap */
                 t.heap_start = ctx->tiler_heap.bo->gpu;
                 t.heap_end = t.heap_start;
@@ -120,8 +122,10 @@ panfrost_emit_midg_tiler(
                 /* Use a dummy polygon list */
                 t.polygon_list = ctx->tiler_dummy.bo->gpu;
 
-                /* Also, set a "tiler disabled?" flag? */
-                t.hierarchy_mask |= 0x1000;
+                /* We don't have a SET_VALUE job, so write the polygon list manually */
+                uint32_t *polygon_list_body = (uint32_t *)
+                        (ctx->tiler_dummy.bo->cpu + header_size);
+                polygon_list_body[0] = 0xa0000000; /* TODO: Just that? */
         }
 
         t.polygon_list_body =
@@ -141,7 +145,7 @@ panfrost_emit_sfbd(struct panfrost_context *ctx, unsigned vertex_count)
 
         struct mali_single_framebuffer framebuffer = {
                 .width = MALI_POSITIVE(width),
-                .height = MALI_POSITIVE(width),
+                .height = MALI_POSITIVE(height),
                 .unknown2 = 0x1f,
                 .format = 0x30000000,
                 .clear_flags = 0x1000,
diff --git a/src/gallium/drivers/panfrost/pan_tiler.c b/src/gallium/drivers/panfrost/pan_tiler.c
index fc0de7d8842d..a1a1f8475ad7 100644
--- a/src/gallium/drivers/panfrost/pan_tiler.c
+++ b/src/gallium/drivers/panfrost/pan_tiler.c
@@ -229,12 +229,12 @@ panfrost_raw_header_size(unsigned width, unsigned height, unsigned masked_count)
 /* Given a hierarchy mask and a framebuffer size, compute the header size */
 
 unsigned
-panfrost_tiler_header_size(unsigned width, unsigned height, uint8_t mask)
+panfrost_tiler_header_size(unsigned width, unsigned height, unsigned mask)
 {
         /* If no hierarchy levels are enabled, that means there is no geometry
          * for the tiler to process, so use a minimum size. Used for clears */
 
-        if (mask == 0x00)
+        if (mask == PAN_TILER_HIERARCHY_MASK_DISABLED)
                 return MINIMUM_HEADER_SIZE;
 
         /* Some levels are enabled. Ensure that only smaller levels are
@@ -262,9 +262,13 @@ panfrost_tiler_header_size(unsigned width, unsigned height, uint8_t mask)
  * out how to actually implement this. */
 
 unsigned
-panfrost_tiler_body_size(unsigned width, unsigned height, uint8_t mask)
+panfrost_tiler_body_size(unsigned width, unsigned height, unsigned mask)
 {
         unsigned header_size = panfrost_tiler_header_size(width, height, mask);
+
+        if (mask == PAN_TILER_HIERARCHY_MASK_DISABLED)
+                return 0;
+
         return ALIGN_POT(header_size * 512 / 8, 512);
 }
 
@@ -283,7 +287,7 @@ panfrost_choose_hierarchy_mask(
         /* If there is no geometry, we don't bother enabling anything */
 
         if (!vertex_count)
-                return 0x00;
+                return PAN_TILER_HIERARCHY_MASK_DISABLED;
 
         /* Otherwise, default everything on. TODO: Proper tests */
 
diff --git a/src/gallium/drivers/panfrost/pan_tiler.h b/src/gallium/drivers/panfrost/pan_tiler.h
index 8d7f6f29de0b..153829dd299a 100644
--- a/src/gallium/drivers/panfrost/pan_tiler.h
+++ b/src/gallium/drivers/panfrost/pan_tiler.h
@@ -28,11 +28,13 @@
 #ifndef __PAN_TILER_H__
 #define __PAN_TILER_H__
 
+#define PAN_TILER_HIERARCHY_MASK_DISABLED 0xFFF
+
 unsigned
-panfrost_tiler_header_size(unsigned width, unsigned height, uint8_t mask);
+panfrost_tiler_header_size(unsigned width, unsigned height, unsigned mask);
 
 unsigned
-panfrost_tiler_body_size(unsigned width, unsigned height, uint8_t mask);
+panfrost_tiler_body_size(unsigned width, unsigned height, unsigned mask);
 
 unsigned
 panfrost_choose_hierarchy_mask(
-- 
2.20.1



More information about the mesa-dev mailing list