Commit 6acd393e authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Identify viewport abstraction

parent 5a5ee4e9
......@@ -197,7 +197,7 @@ struct mali_payload_vertex_tiler {
uintptr_t attribute_meta; /* attribute_meta[] */
uintptr_t varyings; /* struct attr */
uintptr_t unknown6; /* pointer */
uintptr_t nullForVertex;
uintptr_t viewport;
u32 zero6;
u64 fbd;
} __attribute__((packed));
......@@ -261,23 +261,19 @@ struct mali_sampler_descriptor {
uint32_t unknown2;
} __attribute__((packed));
/* TODO: What is this? In practice, it looks like { -inf, -inf, inf, inf, 0.0,
* 1.0, }, followed by a hex thingy, and then zeroes, which suggests some kind
* of bounds, perhaps mapping coordinate systems. But why only for tiler jobs?
/* TODO: What are the floats? Apparently always { -inf, -inf, inf, inf, 0.0,
* 1.0 }
*
* Might the two combine together into a single u64?
*
* width and height fields are equal to those in the associated framebuffer
* descriptor, for some reason.
* viewport0/viewport1 form the arguments to glViewport. viewport1 is modified
* by MALI_POSITIVE; viewport0 is as-is.
*/
struct nullForVertex {
struct mali_viewport {
float floats[6];
u32 zero0;
u16 width;
u16 height;
};
u16 viewport0[2];
u16 viewport1[2];
} __attribute__((packed));
/* TODO: I have no idea what this could possibly be, whatsoever. */
......
......@@ -346,14 +346,11 @@ panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
} else
panwrap_msg("<no shader>\n");
if (v->nullForVertex) {
struct panwrap_mapped_memory *fmem = panwrap_find_mapped_gpu_mem_containing(v->nullForVertex);
struct nullForVertex *PANWRAP_PTR_VAR(f, fmem, v->nullForVertex);
if (v->viewport) {
struct panwrap_mapped_memory *fmem = panwrap_find_mapped_gpu_mem_containing(v->viewport);
struct mali_viewport *PANWRAP_PTR_VAR(f, fmem, v->viewport);
if (f->zero0)
panwrap_msg("zero tripped (%X)\n", f->zero0);
panwrap_log("struct nullForVertex nullForVertex_%d = {\n", job_no);
panwrap_log("struct mali_viewport viewport_%d = {\n", job_no);
panwrap_indent++;
panwrap_log(".floats = {\n");
panwrap_indent++;
......@@ -363,12 +360,19 @@ panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
panwrap_indent--;
panwrap_log("},\n");
panwrap_prop("width = MALI_POSITIVE(%" PRId16 ")", f->width + 1);
panwrap_prop("height = MALI_POSITIVE(%" PRId16 ")", f->height + 1);
/* Only the higher coordinates are MALI_POSITIVE scaled */
panwrap_prop("viewport0 = { %d, %d }",
f->viewport0[0], f->viewport0[1]);
panwrap_prop("viewport1 = { MALI_POSITIVE(%d), MALI_POSITIVE(%d) }",
f->viewport1[0] + 1, f->viewport1[1] + 1);
panwrap_indent--;
panwrap_log("};\n");
TOUCH(fmem, v->nullForVertex, *f, "nullForVertex", job_no, true);
TOUCH(fmem, v->viewport, *f, "viewport", job_no, true);
}
if (v->attribute_meta) {
......@@ -640,7 +644,7 @@ panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
DYN_MEMORY_PROP(v, job_no, attribute_meta);
DYN_MEMORY_PROP(v, job_no, varyings);
//DYN_MEMORY_PROP(v, job_no, unknown6);
DYN_MEMORY_PROP(v, job_no, nullForVertex);
DYN_MEMORY_PROP(v, job_no, viewport);
DYN_MEMORY_PROP(v, job_no, fbd);
MEMORY_PROP(v, unknown0);
......
......@@ -93,16 +93,20 @@ trans_fbd_clear(
/* nullForVertex */
struct nullForVertex
trans_nfv_default(int width, int height) {
struct nullForVertex ret = {
struct mali_viewport
trans_viewport(int viewport_x0, int viewport_y0,
int viewport_x1, int viewport_y1)
{
/* Viewport encoding is asymmetric. Purpose of the floats is unknown? */
struct mali_viewport ret = {
.floats = {
-inff, -inff,
inff, inff,
0.000000f, 1.000000f,
},
.width = MALI_POSITIVE(width),
.height = MALI_POSITIVE(height)
.viewport0 = { viewport_x0, viewport_y0 },
.viewport1 = { MALI_POSITIVE(viewport_x1), MALI_POSITIVE(viewport_y1) },
};
return ret;
......
......@@ -25,7 +25,9 @@ void trans_fbd_clear(
bool clear_color, bool clear_depth, bool clear_stencil,
float r, float g, float b, float a, float depth, u32 stencil);
struct nullForVertex trans_nfv_default(int width, int height);
struct mali_viewport
trans_viewport(int viewport_x0, int viewport_y0,
int viewport_x1, int viewport_y1);
void
trans_rasterizer_state(struct mali_payload_vertex_tiler *vt,
......
......@@ -307,7 +307,7 @@ void main(void) {
.attribute_count = 0,
.varying_count = 1,
.uniform_count = 0,
.work_count = 2,
.work_count = 4,
.unknown1 = 0x600,
.unknown2 = 0x8,
.unknown2_0 = 0x0,
......@@ -327,8 +327,8 @@ void main(void) {
const char shader_src_2[] = "--snip--";
pandev_shader_compile(shader_12 + 320, shader_src_2, 7);
struct nullForVertex nullForVertex_2 = trans_nfv_default(400, 240);
mali_ptr nullForVertex_2_p = pandev_upload(-1, alloc_gpu_va_19, memory_19, &nullForVertex_2, sizeof(nullForVertex_2), false);
struct mali_viewport viewport_2 = trans_viewport(0, 0, 400, 240);
mali_ptr viewport_2_p = pandev_upload(-1, alloc_gpu_va_19, memory_19, &viewport_2, sizeof(viewport_2), false);
mali_ptr varyings_2_p = varyings_1_p;
struct mali_unknown6 unknown6_2 = {
......@@ -345,7 +345,7 @@ void main(void) {
.index_count = MALI_POSITIVE(3),
.gl_enables = 0x45,
.varyings = varyings_2_p,
.nullForVertex = nullForVertex_2_p,
.viewport = viewport_2_p,
.fbd = fbd_2_p,
.unknown0 = alloc_gpu_va_20 + 64,
._shader_upper = (shader_meta_2_p) >> 4,
......
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