panfrost: Set mfbd.msaa.sample_locations on Bifrost
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 6 Apr 2020 23:44:58 +0000 (19:44 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Fri, 10 Apr 2020 14:53:44 +0000 (16:53 +0200)
And mfbd.shared_memory only on Midgard.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4505>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_cmdstream.h
src/gallium/drivers/panfrost/pan_mfbd.c

index 784f170a34cda84bae8bf02675b97c16c6eaa293..e207c6d96143f66decfd82041c224cffd509297e 100644 (file)
@@ -1859,3 +1859,61 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
         panfrost_new_job(batch, JOB_TYPE_TILER, false, vertex, tp, tp_size,
                          false);
 }
+
+/* TODO: stop hardcoding this */
+mali_ptr
+panfrost_emit_sample_locations(struct panfrost_batch *batch)
+{
+        uint16_t locations[] = {
+            128, 128,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            0, 256,
+            128, 128,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+            0, 0,
+        };
+
+        return panfrost_upload_transient(batch, locations, 96 * sizeof(uint16_t));
+}
index 11fe0a6481fd2e57916958380a7b1ef0ca2759b5..e56fb4a44c3159eada9e6dd0996cc5c467bda73f 100644 (file)
@@ -108,4 +108,7 @@ panfrost_vt_update_primitive_size(struct panfrost_context *ctx,
                                   struct mali_vertex_tiler_prefix *prefix,
                                   union midgard_primitive_size *primitive_size);
 
+mali_ptr
+panfrost_emit_sample_locations(struct panfrost_batch *batch);
+
 #endif /* __PAN_CMDSTREAM_H__ */
index b0e295ea51c5b53a3e7918982d88f988625e0eea..c4063c317eaeb32f130f72583089a46dce5a196d 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "pan_bo.h"
 #include "pan_context.h"
+#include "pan_cmdstream.h"
 #include "pan_util.h"
 #include "panfrost-quirks.h"
 
@@ -365,9 +366,7 @@ panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count)
         unsigned width = batch->key.width;
         unsigned height = batch->key.height;
 
-        unsigned shift = panfrost_get_stack_shift(batch->stack_size);
-
-        struct mali_framebuffer framebuffer = {
+        struct mali_framebuffer mfbd = {
                 .width1 = MALI_POSITIVE(width),
                 .height1 = MALI_POSITIVE(height),
                 .width2 = MALI_POSITIVE(width),
@@ -377,20 +376,25 @@ panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count)
 
                 .rt_count_1 = MALI_POSITIVE(batch->key.nr_cbufs),
                 .rt_count_2 = 4,
-
-                .shared_memory = {
-                        .stack_shift = shift,
-                        .scratchpad = panfrost_batch_get_scratchpad(batch, shift, dev->thread_tls_alloc, dev->core_count)->gpu,
-                        .shared_workgroup_count = ~0,
-                }
         };
 
-        if (dev->quirks & IS_BIFROST)
-                framebuffer.tiler_meta = panfrost_batch_get_tiler_meta(batch, vertex_count);
-        else
-                framebuffer.tiler = panfrost_emit_midg_tiler(batch, vertex_count);
+        if (dev->quirks & IS_BIFROST) {
+                mfbd.msaa.sample_locations = panfrost_emit_sample_locations(batch);
+                mfbd.tiler_meta = panfrost_batch_get_tiler_meta(batch, vertex_count);
+        } else {
+                unsigned shift = panfrost_get_stack_shift(batch->stack_size);
+                struct panfrost_bo *bo = panfrost_batch_get_scratchpad(batch,
+                                                                       shift,
+                                                                       dev->thread_tls_alloc,
+                                                                       dev->core_count);
+                mfbd.shared_memory.stack_shift = shift;
+                mfbd.shared_memory.scratchpad = bo->gpu;
+                mfbd.shared_memory.shared_workgroup_count = ~0;
+
+                mfbd.tiler = panfrost_emit_midg_tiler(batch, vertex_count);
+        }
 
-        return framebuffer;
+        return mfbd;
 }
 
 void