aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-02-10 08:47:09 -0500
committerAlyssa Rosenzweig <[email protected]>2020-02-16 09:16:46 -0500
commit6dc105555b43695e1de49baf946c6179987f2f4a (patch)
tree0da37f93032eb10a88a7e65d243e15a8301f4efd
parent254f40fd535ef57dee2bcc4afd97840749ce5918 (diff)
panfrost: Unify bifrost_scratchpad with mali_shared_memory
It looks like these are the same structure, so this allows us to reuse mali_shared_memory across architectures, and dispels with the Bifrost-specific mystery of the scratchpads... nothing so mysterious after all, just stack. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3835>
-rw-r--r--src/gallium/drivers/panfrost/pan_compute.c2
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c7
-rw-r--r--src/panfrost/include/panfrost-job.h20
-rw-r--r--src/panfrost/pandecode/decode.c41
4 files changed, 18 insertions, 52 deletions
diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c
index 33618cb6997..f4c28c36429 100644
--- a/src/gallium/drivers/panfrost/pan_compute.c
+++ b/src/gallium/drivers/panfrost/pan_compute.c
@@ -131,7 +131,7 @@ panfrost_launch_grid(struct pipe_context *pipe,
.shared_workgroup_count = ~0
};
- payload->postfix.framebuffer =
+ payload->postfix.shared_memory =
panfrost_upload_transient(batch, &shared, sizeof(shared));
/* Invoke according to the grid info */
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 417c900c961..f6f9858e074 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -141,6 +141,9 @@ 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)
{
@@ -162,7 +165,7 @@ panfrost_attach_vt_framebuffer(struct panfrost_context *ctx)
}
for (unsigned i = 0; i < PIPE_SHADER_TYPES; ++i)
- ctx->payloads[i].postfix.framebuffer = batch->framebuffer.gpu;
+ ctx->payloads[i].postfix.shared_memory = batch->framebuffer.gpu;
}
/* Reset per-frame context, called on context initialisation as well as after
@@ -172,7 +175,7 @@ void
panfrost_invalidate_frame(struct panfrost_context *ctx)
{
for (unsigned i = 0; i < PIPE_SHADER_TYPES; ++i)
- ctx->payloads[i].postfix.framebuffer = 0;
+ ctx->payloads[i].postfix.shared_memory = 0;
if (ctx->rasterizer)
ctx->dirty |= PAN_DIRTY_RASTERIZER;
diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h
index 8027abebf34..d0d56810ecc 100644
--- a/src/panfrost/include/panfrost-job.h
+++ b/src/panfrost/include/panfrost-job.h
@@ -1056,17 +1056,6 @@ struct bifrost_tiler_only {
u64 zero8;
} __attribute__((packed));
-struct bifrost_scratchpad {
- u32 zero;
- u32 flags; // = 0x1f
- /* This is a pointer to a CPU-inaccessible buffer, 16 pages, allocated
- * during startup. It seems to serve the same purpose as the
- * gpu_scratchpad in the SFBD for Midgard, although it's slightly
- * larger.
- */
- mali_ptr gpu_scratchpad;
-} __attribute__((packed));
-
struct mali_vertex_tiler_postfix {
/* Zero for vertex jobs. Pointer to the position (gl_Position) varying
* output from the vertex shader for tiler jobs.
@@ -1100,11 +1089,10 @@ struct mali_vertex_tiler_postfix {
u64 viewport;
u64 occlusion_counter; /* A single bit as far as I can tell */
- /* Note: on Bifrost, this isn't actually the FBD. It points to
- * bifrost_scratchpad instead. However, it does point to the same thing
- * in vertex and tiler jobs.
- */
- mali_ptr framebuffer;
+ /* On Bifrost, this points directly to a mali_shared_memory structure.
+ * On Midgard, this points to a framebuffer (either SFBD or MFBD as
+ * tagged), which embeds a mali_shared_memory structure */
+ mali_ptr shared_memory;
} __attribute__((packed));
struct midgard_payload_vertex_tiler {
diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c
index 41b843f7a3b..ef115dfaa0a 100644
--- a/src/panfrost/pandecode/decode.c
+++ b/src/panfrost/pandecode/decode.c
@@ -1809,29 +1809,6 @@ pandecode_uniforms(mali_ptr uniforms, unsigned uniform_count)
free(ptr);
}
-static void
-pandecode_scratchpad(uintptr_t pscratchpad, int job_no, char *suffix)
-{
-
- struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(pscratchpad);
-
- struct bifrost_scratchpad *PANDECODE_PTR_VAR(scratchpad, mem, pscratchpad);
-
- if (scratchpad->zero) {
- pandecode_msg("XXX: scratchpad zero tripped");
- pandecode_prop("zero = 0x%x\n", scratchpad->zero);
- }
-
- pandecode_log("struct bifrost_scratchpad scratchpad_%"PRIx64"_%d%s = {\n", pscratchpad, job_no, suffix);
- pandecode_indent++;
-
- pandecode_prop("flags = 0x%x", scratchpad->flags);
- MEMORY_PROP(scratchpad, gpu_scratchpad);
-
- pandecode_indent--;
- pandecode_log("};\n");
-}
-
static const char *
shader_type_for_job(unsigned type)
{
@@ -2137,14 +2114,15 @@ pandecode_vertex_tiler_postfix_pre(
.rt_count = 1
};
- if (is_bifrost)
- pandecode_scratchpad(p->framebuffer & ~1, job_no, suffix);
- else if (p->framebuffer & MALI_MFBD)
- fbd_info = pandecode_mfbd_bfr((u64) ((uintptr_t) p->framebuffer) & FBD_MASK, job_no, false, job_type == JOB_TYPE_COMPUTE);
+ if (is_bifrost) {
+ pandecode_log_cont("\t/* %X %/\n", p->shared_memory & 1);
+ pandecode_compute_fbd(p->shared_memory & ~1, job_no);
+ } else if (p->shared_memory & MALI_MFBD)
+ fbd_info = pandecode_mfbd_bfr((u64) ((uintptr_t) p->shared_memory) & FBD_MASK, job_no, false, job_type == JOB_TYPE_COMPUTE);
else if (job_type == JOB_TYPE_COMPUTE)
- pandecode_compute_fbd((u64) (uintptr_t) p->framebuffer, job_no);
+ pandecode_compute_fbd((u64) (uintptr_t) p->shared_memory, job_no);
else
- fbd_info = pandecode_sfbd((u64) (uintptr_t) p->framebuffer, job_no, false, gpu_id);
+ fbd_info = pandecode_sfbd((u64) (uintptr_t) p->shared_memory, job_no, false, gpu_id);
int varying_count = 0, attribute_count = 0, uniform_count = 0, uniform_buffer_count = 0;
int texture_count = 0, sampler_count = 0;
@@ -2309,7 +2287,7 @@ pandecode_vertex_tiler_postfix_pre(
/* MRT blend fields are used whenever MFBD is used, with
* per-RT descriptors */
- if (job_type == JOB_TYPE_TILER && p->framebuffer & MALI_MFBD) {
+ if (job_type == JOB_TYPE_TILER && p->shared_memory & MALI_MFBD) {
void* blend_base = (void *) (s + 1);
for (unsigned i = 0; i < fbd_info.rt_count; i++) {
@@ -2759,9 +2737,6 @@ pandecode_fragment_job(const struct pandecode_mapped_memory *mem,
bool is_mfbd = s->framebuffer & MALI_MFBD;
- /* Bifrost theoretically may retain support for SFBD on compute jobs,
- * but for graphics workloads with a FRAGMENT payload, use MFBD */
-
if (!is_mfbd && is_bifrost)
pandecode_msg("XXX: Bifrost fragment must use MFBD\n");