aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost
diff options
context:
space:
mode:
authorBoris Brezillon <[email protected]>2020-03-06 09:59:56 +0100
committerBoris Brezillon <[email protected]>2020-03-10 12:47:34 +0100
commit0d75eb002e1e3444052eb93046368dddea9b576c (patch)
treee35211c30ffc56418f5cddabfdc037c5f2575335 /src/gallium/drivers/panfrost
parent5d33d42b4d42abc9fb8b212222ca5f6d17d94e7d (diff)
panfrost: Move panfrost_attach_vt_framebuffer() to pan_cmdstream.c
Move panfrost_attach_vt_framebuffer() to pan_cmdstream.c and change its name to panfrost_vt_attach_framebuffer() so we can use a consistent prefix (panfrost_vt_) for all helpers initializing/updating midgard_payload_vertex_tiler fields. Note that the function only initializes one VT object now. Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r--src/gallium/drivers/panfrost/pan_cmdstream.c31
-rw-r--r--src/gallium/drivers/panfrost/pan_cmdstream.h4
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c31
3 files changed, 38 insertions, 28 deletions
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 18a47b0854e..83f80d24dfb 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -22,12 +22,43 @@
* SOFTWARE.
*/
+#include "util/macros.h"
+
+#include "panfrost-quirks.h"
+
#include "pan_allocate.h"
#include "pan_bo.h"
#include "pan_cmdstream.h"
#include "pan_context.h"
#include "pan_job.h"
+/* TODO: Bifrost requires just a mali_shared_memory, without the rest of the
+ * framebuffer */
+
+void
+panfrost_vt_attach_framebuffer(struct panfrost_context *ctx,
+ struct midgard_payload_vertex_tiler *vt)
+{
+ struct panfrost_screen *screen = pan_screen(ctx->base.screen);
+ struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
+
+ /* If we haven't, reserve space for the framebuffer */
+
+ if (!batch->framebuffer.gpu) {
+ unsigned size = (screen->quirks & MIDGARD_SFBD) ?
+ sizeof(struct mali_single_framebuffer) :
+ sizeof(struct mali_framebuffer);
+
+ batch->framebuffer = panfrost_allocate_transient(batch, size);
+
+ /* Tag the pointer */
+ if (!(screen->quirks & MIDGARD_SFBD))
+ batch->framebuffer.gpu |= MALI_MFBD;
+ }
+
+ vt->postfix.shared_memory = batch->framebuffer.gpu;
+}
+
void
panfrost_emit_shader_meta(struct panfrost_batch *batch,
enum pipe_shader_type st,
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h
index 326e4b2efe5..86380cd5d8a 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.h
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.h
@@ -33,6 +33,10 @@
#include "pan_job.h"
void
+panfrost_vt_attach_framebuffer(struct panfrost_context *ctx,
+ struct midgard_payload_vertex_tiler *vt);
+
+void
panfrost_emit_shader_meta(struct panfrost_batch *batch,
enum pipe_shader_type st,
struct midgard_payload_vertex_tiler *vtp);
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 1f595919faa..41eda89d8fb 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -142,33 +142,6 @@ panfrost_clear(
panfrost_batch_clear(batch, buffers, color, depth, stencil);
}
-/* TODO: Bifrost requires just a mali_shared_memory, without the rest of the
- * framebuffer */
-
-static void
-panfrost_attach_vt_framebuffer(struct panfrost_context *ctx)
-{
- struct panfrost_screen *screen = pan_screen(ctx->base.screen);
- struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
-
- /* If we haven't, reserve space for the framebuffer */
-
- if (!batch->framebuffer.gpu) {
- unsigned size = (screen->quirks & MIDGARD_SFBD) ?
- sizeof(struct mali_single_framebuffer) :
- sizeof(struct mali_framebuffer);
-
- batch->framebuffer = panfrost_allocate_transient(batch, size);
-
- /* Tag the pointer */
- if (!(screen->quirks & MIDGARD_SFBD))
- batch->framebuffer.gpu |= MALI_MFBD;
- }
-
- for (unsigned i = 0; i < PIPE_SHADER_TYPES; ++i)
- ctx->payloads[i].postfix.shared_memory = batch->framebuffer.gpu;
-}
-
/* Reset per-frame context, called on context initialisation as well as after
* flushing a frame */
@@ -559,7 +532,9 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
struct panfrost_screen *screen = pan_screen(ctx->base.screen);
panfrost_batch_add_fbo_bos(batch);
- panfrost_attach_vt_framebuffer(ctx);
+
+ for (int i = 0; i < PIPE_SHADER_TYPES; ++i)
+ panfrost_vt_attach_framebuffer(ctx, &ctx->payloads[i]);
if (with_vertex_data) {
panfrost_emit_vertex_data(batch);