aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/panfrost/pan_cmdstream.c19
-rw-r--r--src/gallium/drivers/panfrost/pan_cmdstream.h5
-rw-r--r--src/gallium/drivers/panfrost/pan_compute.c2
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c32
4 files changed, 29 insertions, 29 deletions
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 02d3cfde068..0070c18faba 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -101,6 +101,25 @@ panfrost_vt_update_occlusion_query(struct panfrost_context *ctx,
tp->postfix.occlusion_counter = 0;
}
+void
+panfrost_vt_init(struct panfrost_context *ctx,
+ enum pipe_shader_type stage,
+ struct midgard_payload_vertex_tiler *vtp)
+{
+ if (!ctx->shader[stage])
+ return;
+
+ memset(vtp, 0, sizeof(*vtp));
+ vtp->gl_enables = 0x6;
+ panfrost_vt_attach_framebuffer(ctx, vtp);
+
+ if (stage == PIPE_SHADER_FRAGMENT) {
+ panfrost_vt_update_occlusion_query(ctx, vtp);
+ panfrost_vt_update_rasterizer(ctx, vtp);
+ }
+}
+
+
static unsigned
panfrost_translate_index_size(unsigned size)
{
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h
index 655110243cd..9ace7802ba2 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.h
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.h
@@ -36,6 +36,11 @@ void panfrost_sampler_desc_init(const struct pipe_sampler_state *cso,
struct mali_sampler_descriptor *hw);
void
+panfrost_vt_init(struct panfrost_context *ctx,
+ enum pipe_shader_type stage,
+ struct midgard_payload_vertex_tiler *vtp);
+
+void
panfrost_vt_attach_framebuffer(struct panfrost_context *ctx,
struct midgard_payload_vertex_tiler *vt);
diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c
index d67e87f590b..09ab09fb63e 100644
--- a/src/gallium/drivers/panfrost/pan_compute.c
+++ b/src/gallium/drivers/panfrost/pan_compute.c
@@ -117,6 +117,8 @@ panfrost_launch_grid(struct pipe_context *pipe,
if (info->input)
pipe->set_constant_buffer(pipe, PIPE_SHADER_COMPUTE, 0, &ubuf);
+ panfrost_vt_init(ctx, PIPE_SHADER_COMPUTE, payload);
+
panfrost_emit_shader_meta(batch, PIPE_SHADER_COMPUTE, payload);
panfrost_emit_const_buf(batch, PIPE_SHADER_COMPUTE, payload);
panfrost_emit_shared_memory(batch, info, payload);
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index db9f96a0185..999823263f9 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -148,32 +148,10 @@ panfrost_clear(
void
panfrost_invalidate_frame(struct panfrost_context *ctx)
{
- for (unsigned i = 0; i < PIPE_SHADER_TYPES; ++i)
- ctx->payloads[i].postfix.shared_memory = 0;
-
/* TODO: When does this need to be handled? */
ctx->active_queries = true;
}
-/* In practice, every field of these payloads should be configurable
- * arbitrarily, which means these functions are basically catch-all's for
- * as-of-yet unwavering unknowns */
-
-static void
-panfrost_emit_vertex_payload(struct panfrost_context *ctx)
-{
- /* 0x2 bit clear on 32-bit T6XX */
-
- struct midgard_payload_vertex_tiler payload = {
- .gl_enables = 0x4 | 0x2,
- };
-
- /* Vertex and compute are closely coupled, so share a payload */
-
- memcpy(&ctx->payloads[PIPE_SHADER_VERTEX], &payload, sizeof(payload));
- memcpy(&ctx->payloads[PIPE_SHADER_COMPUTE], &payload, sizeof(payload));
-}
-
bool
panfrost_writes_point_size(struct panfrost_context *ctx)
{
@@ -422,17 +400,14 @@ panfrost_draw_vbo(
unsigned vertex_count;
+ for (int i = 0; i <= PIPE_SHADER_FRAGMENT; ++i)
+ panfrost_vt_init(ctx, i, &ctx->payloads[i]);
+
panfrost_vt_set_draw_info(ctx, info, g2m_draw_mode(mode),
&ctx->payloads[PIPE_SHADER_VERTEX],
&ctx->payloads[PIPE_SHADER_FRAGMENT],
&vertex_count, &ctx->padded_count);
- for (int i = 0; i <= PIPE_SHADER_FRAGMENT; ++i)
- panfrost_vt_attach_framebuffer(ctx, &ctx->payloads[i]);
-
- panfrost_vt_update_rasterizer(ctx, &ctx->payloads[PIPE_SHADER_FRAGMENT]);
- panfrost_vt_update_occlusion_query(ctx, &ctx->payloads[PIPE_SHADER_FRAGMENT]);
-
panfrost_statistics_record(ctx, info);
/* Dispatch "compute jobs" for the vertex/tiler pair as (1,
@@ -1455,7 +1430,6 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
/* Prepare for render! */
panfrost_batch_init(ctx);
- panfrost_emit_vertex_payload(ctx);
panfrost_invalidate_frame(ctx);
return gallium;