Commit 5eb15670 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Decode color mask

parent 2df10139
......@@ -116,6 +116,26 @@ struct mali_stencil_test {
unsigned zero : 4;
} __attribute__((packed));
/* Blending is a mess, since anything fancy triggers a blend shader, and
* -those- are not understood whatsover yet */
#define MALI_MASK_R (1 << 0)
#define MALI_MASK_G (1 << 1)
#define MALI_MASK_B (1 << 2)
#define MALI_MASK_A (1 << 3)
struct mali_blend_equation {
unsigned unknown : 28;
/* Corresponds to MALI_MASK_* above and glColorMask arguments */
unsigned color_mask : 4;
/* Probably doesn't actually exist, but keeps the union with mali_ptr
* from spilling and masking zero trips and other ugliness */
unsigned zero : 32;
};
struct mali_shader_meta {
mali_ptr shader;
u32 zero1;
......@@ -158,7 +178,7 @@ struct mali_shader_meta {
mali_ptr blend_shader;
/* Exact format of this is not known yet */
u64 blend_equation;
struct mali_blend_equation blend_equation;
};
} __attribute__((packed));
......
......@@ -48,6 +48,16 @@ static const struct panwrap_flag_info clear_flag_info[] = {
};
#undef FLAG_INFO
#define FLAG_INFO(flag) { MALI_MASK_##flag, "MALI_MASK_" #flag }
static const struct panwrap_flag_info mask_flag_info[] = {
FLAG_INFO(R),
FLAG_INFO(G),
FLAG_INFO(B),
FLAG_INFO(A),
{}
};
#undef FLAG_INFO
#define FLAG_INFO(flag) { MALI_##flag, "MALI_" #flag }
static const struct panwrap_flag_info u3_flag_info[] = {
FLAG_INFO(HAS_MSAA),
......@@ -377,6 +387,27 @@ panwrap_replay_stencil(const char *name, const u32 *raw)
panwrap_log("},\n");
}
static void
panwrap_replay_blend_equation(const u32 *raw)
{
const struct mali_blend_equation *blend = (struct mali_blend_equation *) raw;
if (blend->zero)
panwrap_msg("Blend zero tripped: %X\n", blend->zero);
panwrap_log(".blend_equation = {\n");
panwrap_indent++;
panwrap_prop("unknown = 0x%X", blend->unknown);
panwrap_log(".color_mask = ");
panwrap_log_decoded_flags(mask_flag_info, blend->color_mask);
panwrap_log_cont(",\n");
panwrap_indent--;
panwrap_log("},\n");
}
static int
panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
const struct panwrap_mapped_memory *mem,
......@@ -455,7 +486,7 @@ panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
if (s->unknown2_3 & MALI_HAS_BLEND_SHADER) {
panwrap_replay_shader_address("blend_shader", s->blend_shader);
} else {
panwrap_prop("blend_equation = 0x%" PRIx64, s->blend_equation);
panwrap_replay_blend_equation(&s->blend_equation);
}
panwrap_indent--;
......
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