pan/decode: Restore bifrost sample_locations

Code by Connor Abbott, reverting a part of
254f40fd53 where it was removed during a
Midgard refactor.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4025>
This commit is contained in:
Alyssa Rosenzweig 2020-02-28 07:17:53 -05:00 committed by Marge Bot
parent 5815f33c6b
commit 3f5cd446b2
2 changed files with 66 additions and 9 deletions

View file

@ -1491,7 +1491,14 @@ struct mali_shared_memory {
mali_ptr unknown1;
} __attribute__((packed));
/* Configures multisampling on Bifrost fragment jobs */
struct bifrost_multisampling {
u64 zero1;
u64 zero2;
mali_ptr sample_locations;
u64 zero4;
} __attribute__((packed));
struct mali_single_framebuffer {
struct mali_shared_memory shared_memory;
@ -1685,7 +1692,10 @@ struct mali_framebuffer_extra {
#define MALI_MFBD_EXTRA (1 << 13)
struct mali_framebuffer {
struct mali_shared_memory shared_memory;
union {
struct mali_shared_memory shared_memory;
struct bifrost_multisampling msaa;
};
/* 0x20 */
u16 width1, height1;

View file

@ -1063,21 +1063,68 @@ pandecode_render_target(uint64_t gpu_va, unsigned job_no, const struct mali_fram
}
static struct pandecode_fbd
pandecode_mfbd_bfr(uint64_t gpu_va, int job_no, bool is_fragment, bool is_compute)
pandecode_mfbd_bfr(uint64_t gpu_va, int job_no, bool is_fragment, bool is_compute, bool is_bifrost)
{
struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(gpu_va);
const struct mali_framebuffer *PANDECODE_PTR_VAR(fb, mem, (mali_ptr) gpu_va);
struct pandecode_fbd info;
if (is_bifrost && fb->msaa.sample_locations) {
/* The blob stores all possible sample locations in a single buffer
* allocated on startup, and just switches the pointer when switching
* MSAA state. For now, we just put the data into the cmdstream, but we
* should do something like what the blob does with a real driver.
*
* There seem to be 32 slots for sample locations, followed by another
* 16. The second 16 is just the center location followed by 15 zeros
* in all the cases I've identified (maybe shader vs. depth/color
* samples?).
*/
struct pandecode_mapped_memory *smem = pandecode_find_mapped_gpu_mem_containing(fb->msaa.sample_locations);
const u16 *PANDECODE_PTR_VAR(samples, smem, fb->msaa.sample_locations);
pandecode_log("uint16_t sample_locations_%d[] = {\n", job_no);
pandecode_indent++;
for (int i = 0; i < 32 + 16; i++) {
pandecode_log("%d, %d,\n", samples[2 * i], samples[2 * i + 1]);
}
pandecode_indent--;
pandecode_log("};\n");
}
pandecode_log("struct mali_framebuffer framebuffer_%"PRIx64"_%d = {\n", gpu_va, job_no);
pandecode_indent++;
pandecode_log(".shared_memory = {\n");
pandecode_indent++;
pandecode_shared_memory(&fb->shared_memory, is_compute);
pandecode_indent--;
pandecode_log("},\n");
if (is_bifrost) {
pandecode_log(".msaa = {\n");
pandecode_indent++;
if (fb->msaa.sample_locations)
pandecode_prop("sample_locations = sample_locations_%d", job_no);
else
pandecode_msg("XXX: sample_locations missing\n");
if (fb->msaa.zero1 || fb->msaa.zero2 || fb->msaa.zero4) {
pandecode_msg("XXX: multisampling zero tripped\n");
pandecode_prop("zero1 = %" PRIx64, fb->msaa.zero1);
pandecode_prop("zero2 = %" PRIx64, fb->msaa.zero2);
pandecode_prop("zero4 = %" PRIx64, fb->msaa.zero4);
}
pandecode_indent--;
pandecode_log("},\n");
} else {
pandecode_log(".shared_memory = {\n");
pandecode_indent++;
pandecode_shared_memory(&fb->shared_memory, is_compute);
pandecode_indent--;
pandecode_log("},\n");
}
info.width = fb->width1 + 1;
info.height = fb->height1 + 1;
@ -2126,7 +2173,7 @@ pandecode_vertex_tiler_postfix_pre(
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);
fbd_info = pandecode_mfbd_bfr((u64) ((uintptr_t) p->shared_memory) & FBD_MASK, job_no, false, job_type == JOB_TYPE_COMPUTE, false);
else if (job_type == JOB_TYPE_COMPUTE)
pandecode_compute_fbd((u64) (uintptr_t) p->shared_memory, job_no);
else
@ -2753,7 +2800,7 @@ pandecode_fragment_job(const struct pandecode_mapped_memory *mem,
struct pandecode_fbd info;
if (is_mfbd)
info = pandecode_mfbd_bfr(s->framebuffer & FBD_MASK, job_no, true, false);
info = pandecode_mfbd_bfr(s->framebuffer & FBD_MASK, job_no, true, false, is_bifrost);
else
info = pandecode_sfbd(s->framebuffer & FBD_MASK, job_no, true, gpu_id);