Commit 0dddbcdf authored by Connor Abbott's avatar Connor Abbott

panwrap: Rewrite panwrap decoding and add Bifrost support

In order to properly support 64-bit jobs as well as Bifrost, a number of
structures need to be moved around, split, etc. which requires a lot of
shuffling things around. I think this would probably be hard to untangle
from the actual new Bifrost bits, so I've left everything together in
one commit. The list of things changed includes:

- To save some space due to the larger pointers, vertex and tiler jobs
  no longer have the same layout (i.e. common fields like shader_meta,
  etc. no longer have the same offset). A few of the tiler-only fields
  and vertex-only fields now overlap. The tiler job structure is much
  larger than the vertex job structure, although most of the new fields
  are zero for the things I've tried so far. It's not clear whether this
  also also happens on Midgard 64-bit jobs. In addition, there is a new
  Bifrost-only fused job type, where the common fields in the beginning
  are shared. The end result is that there is now a common prefix,
  followed by tiler-only or vertex-only fields (or both, for Midgard),
  and then a common postfix.
- For Bifrost, we no longer have to make a special incomplete FBD just
  for vertex and tiler jobs. Instead, the relevant fields (tiler_meta
  and the scratchpad) have been moved out into separate structures, and
  removed from the FBD when not needed for fragment jobs.
- There is no Bifrost driver that uses the SFBD, so we need to decode
  the MFBD now.
parent a9ca7ce2
This diff is collapsed.
This diff is collapsed.
......@@ -136,7 +136,7 @@ void replay_memory_specific(struct panwrap_mapped_memory *pos, int offset, int l
for (uint32_t i = offset / sizeof(uint32_t); i < (offset + len) / sizeof(uint32_t); ++i) {
if (array[i])
panwrap_log("%s%s[%d] = %s;\n", pos->touched[i] ? "// " : "", pos->name, i, pointer_as_memory_reference(array[i]));
panwrap_log("%s%s[%d] = 0x%x;\n", pos->touched[i] ? "// " : "", pos->name, i, array[i]);
}
/* Touch what we have written */
......@@ -228,6 +228,9 @@ void panwrap_track_mmap(mali_ptr gpu_va, void *addr, size_t length,
list_del(&mem->node);
free(mem);
panwrap_msg("va %d mapped to %" PRIx64 "\n", mapped_mem->allocation_number,
mapped_mem->gpu_va);
/* Generate somewhat semantic name for the region */
snprintf(mapped_mem->name, sizeof(mapped_mem->name),
"%s_%d",
......
......@@ -25,17 +25,11 @@
* be integrated here as well in the near future, once an assembler is written
* for that platform. */
/* TODO: expose in meson so Lyude doesn't get annoyed at me for breaking
* Bifrost */
#define SHADER_MIDGARD
#ifdef SHADER_MIDGARD
/* Disassemble the shader itself. */
void
panwrap_shader_disassemble(mali_ptr shader_ptr, int shader_no, int type)
panwrap_shader_disassemble(mali_ptr shader_ptr, int shader_no, int type,
bool is_bifrost)
{
struct panwrap_mapped_memory *shaders = panwrap_find_mapped_gpu_mem_containing(shader_ptr);
ptrdiff_t offset = shader_ptr - shaders->gpu_va;
......@@ -43,7 +37,10 @@ panwrap_shader_disassemble(mali_ptr shader_ptr, int shader_no, int type)
/* Disassemble it at trace time... */
panwrap_log("const char shader_src_%d[] = R\"(\n", shader_no);
DisassembleMidgard(shaders->addr + offset, shaders->length - offset);
if (is_bifrost)
DisassembleBifrost(shaders->addr + offset, shaders->length - offset);
else
DisassembleMidgard(shaders->addr + offset, shaders->length - offset);
panwrap_log(")\";\n\n");
/* ...but reassemble at runtime! */
......@@ -56,13 +53,3 @@ panwrap_shader_disassemble(mali_ptr shader_ptr, int shader_no, int type)
type);
}
#else
void
panwrap_shader_disassemble(mali_ptr shader_ptr, int shader_no, int type)
{
panwrap_msg("Shader decoding is not yet supported on non-Midgard platforms\n");
panwrap_msg("No disassembly performed for shader at " MALI_PTR_FMT, shader_ptr);
}
#endif
......@@ -22,6 +22,7 @@
#define SHADER_VERTEX JOB_TYPE_VERTEX
#define SHADER_FRAGMENT JOB_TYPE_TILER
void panwrap_shader_disassemble(mali_ptr shader_ptr, int shader_no, int type);
void panwrap_shader_disassemble(mali_ptr shader_ptr, int shader_no, int type,
bool is_bifrost);
#endif /* !PANWRAP_SHADER_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment