panfrost: Populate bifrost-specific structs within mali_shader_meta
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 6 Apr 2020 21:50:38 +0000 (17:50 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Fri, 10 Apr 2020 14:52:54 +0000 (16:52 +0200)
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

index b84b4e2a5a37335efc82e31e5304a010ac6c2931..ac7ebf8c26c7bd404f4f8df637c69c87a0b2a808 100644 (file)
@@ -284,20 +284,31 @@ panfrost_shader_meta_init(struct panfrost_context *ctx,
                           enum pipe_shader_type st,
                           struct mali_shader_meta *meta)
 {
+        const struct panfrost_device *dev = pan_device(ctx->base.screen);
         struct panfrost_shader_state *ss = panfrost_get_shader_state(ctx, st);
 
         memset(meta, 0, sizeof(*meta));
         meta->shader = (ss->bo ? ss->bo->gpu : 0) | ss->first_tag;
-        meta->midgard1.uniform_count = MIN2(ss->uniform_count,
-                                            ss->uniform_cutoff);
-        meta->midgard1.work_count = ss->work_reg_count;
         meta->attribute_count = ss->attribute_count;
         meta->varying_count = ss->varying_count;
-        meta->midgard1.flags_hi = 0x8; /* XXX */
-        meta->midgard1.flags_lo = 0x220;
         meta->texture_count = ctx->sampler_view_count[st];
         meta->sampler_count = ctx->sampler_count[st];
-        meta->midgard1.uniform_buffer_count = panfrost_ubo_count(ctx, st);
+
+        if (dev->quirks & IS_BIFROST) {
+                meta->bifrost1.unk1 = 0x800200;
+                meta->bifrost1.uniform_buffer_count = panfrost_ubo_count(ctx, st);
+                meta->bifrost2.preload_regs = 0xC0;
+                meta->bifrost2.uniform_count = MIN2(ss->uniform_count,
+                                                    ss->uniform_cutoff);
+        } else {
+                meta->midgard1.uniform_count = MIN2(ss->uniform_count,
+                                                    ss->uniform_cutoff);
+                meta->midgard1.work_count = ss->work_reg_count;
+                meta->midgard1.flags_hi = 0x8; /* XXX */
+                meta->midgard1.flags_lo = 0x220;
+                meta->midgard1.uniform_buffer_count = panfrost_ubo_count(ctx, st);
+        }
+
 }
 
 static unsigned