Commit fd77d4f2 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Identify depth test function

parent 5d827583
......@@ -62,12 +62,33 @@ enum mali_gl_mode {
: (field == 0) ? "0" \
: "0 /* XXX: Unknown, check hexdump */"
/* Used in stencil and depth tests */
enum mali_func {
MALI_FUNC_NEVER = 0,
MALI_FUNC_LESS = 1,
MALI_FUNC_EQUAL = 2,
MALI_FUNC_LEQUAL = 3,
MALI_FUNC_GREATER = 4,
MALI_FUNC_NOTEQUAL = 5,
MALI_FUNC_GEQUAL = 6,
MALI_FUNC_ALWAYS = 7
};
/* Flags apply to unknown2_3? */
#define MALI_HAS_MSAA (1 << 16)
#define MALI_CAN_DISCARD (1 << 21)
#define MALI_HAS_BLEND_SHADER (1 << 22)
/* func is mali_func */
#define MALI_DEPTH_FUNC(func) (func << 24)
#define MALI_GET_DEPTH_FUNC(flags) ((flags >> 24) & 0x7)
#define MALI_DEPTH_FUNC_MASK MALI_DEPTH_FUNC(0x7)
#define MALI_NO_DEPTH_TEST_A (1 << 25)
#define MALI_NO_DEPTH_TEST_B (1 << 26)
#define MALI_DEPTH_TEST (1 << 27)
/* Next flags to unknown2_4 */
......@@ -77,17 +98,6 @@ enum mali_gl_mode {
/* Stencil test state is all encoded in a single u32, just with a lot of
* enums... */
enum mali_stencil_func {
MALI_STENCIL_NEVER = 0,
MALI_STENCIL_LESS = 1,
MALI_STENCIL_EQUAL = 2,
MALI_STENCIL_LEQUAL = 3,
MALI_STENCIL_GREATER = 4,
MALI_STENCIL_NOTEQUAL = 5,
MALI_STENCIL_GEQUAL = 6,
MALI_STENCIL_ALWAYS = 7
};
enum mali_stencil_op {
MALI_STENCIL_KEEP = 0,
MALI_STENCIL_REPLACE = 1,
......@@ -102,7 +112,7 @@ enum mali_stencil_op {
struct mali_stencil_test {
unsigned ref : 8;
unsigned mask : 8;
enum mali_stencil_func func : 3;
enum mali_func func : 3;
enum mali_stencil_op sfail : 3;
enum mali_stencil_op dpfail : 3;
enum mali_stencil_op dppass : 3;
......
......@@ -115,8 +115,8 @@ static char *panwrap_gl_mode_name(enum mali_gl_mode mode)
#undef DEFINE_CASE
}
#define DEFINE_CASE(name) case MALI_STENCIL_ ## name: return "MALI_STENCIL_" #name
static char *panwrap_stencil_func_name(enum mali_stencil_func mode)
#define DEFINE_CASE(name) case MALI_FUNC_ ## name: return "MALI_FUNC_" #name
static char *panwrap_func_name(enum mali_func mode)
{
switch(mode) {
DEFINE_CASE(NEVER);
......@@ -127,10 +127,12 @@ static char *panwrap_stencil_func_name(enum mali_stencil_func mode)
DEFINE_CASE(NOTEQUAL);
DEFINE_CASE(GEQUAL);
DEFINE_CASE(ALWAYS);
default: return "MALI_STENCIL_NEVER /* XXX: Unknown stencil function, check dump */";
default: return "MALI_FUNC_NEVER /* XXX: Unknown function, check dump */";
}
}
#undef DEFINE_CASE
#define DEFINE_CASE(name) case MALI_STENCIL_ ## name: return "MALI_STENCIL_" #name
static char *panwrap_stencil_op_name(enum mali_stencil_op op)
{
switch(op) {
......@@ -357,7 +359,7 @@ panwrap_replay_stencil(const char *name, const u32 *raw)
{
const struct mali_stencil_test *stencil = (struct mali_stencil_test *) raw;
const char *func = panwrap_stencil_func_name(stencil->func);
const char *func = panwrap_func_name(stencil->func);
const char *sfail = panwrap_stencil_op_name(stencil->sfail);
const char *dpfail = panwrap_stencil_op_name(stencil->dpfail);
const char *dppass = panwrap_stencil_op_name(stencil->dppass);
......@@ -426,7 +428,20 @@ panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
}
panwrap_log(".unknown2_3 = ");
panwrap_log_decoded_flags(u3_flag_info, s->unknown2_3);
int unknown2_3 = s->unknown2_3;
/* We're not quite sure what these flags mean without the depth test, if anything */
if (unknown2_3 & (MALI_DEPTH_TEST | MALI_DEPTH_FUNC_MASK)) {
const char *func = panwrap_func_name(MALI_GET_DEPTH_FUNC(unknown2_3));
unknown2_3 &= ~MALI_DEPTH_FUNC_MASK;
panwrap_log_cont("MALI_DEPTH_FUNC(%s) | ", func);
}
panwrap_log_decoded_flags(u3_flag_info, unknown2_3);
panwrap_log_cont(",\n");
panwrap_log(".unknown2_4 = ");
......
......@@ -306,7 +306,7 @@ void main(void) {
.stencil_front = {
.ref = 0,
.mask = 0xFF,
.func = MALI_STENCIL_ALWAYS,
.func = MALI_FUNC_ALWAYS,
.sfail = MALI_STENCIL_KEEP,
.dpfail = MALI_STENCIL_KEEP,
.dppass = MALI_STENCIL_KEEP,
......@@ -314,7 +314,7 @@ void main(void) {
.stencil_back = {
.ref = 0,
.mask = 0xFF,
.func = MALI_STENCIL_ALWAYS,
.func = MALI_FUNC_ALWAYS,
.sfail = MALI_STENCIL_KEEP,
.dpfail = MALI_STENCIL_KEEP,
.dppass = MALI_STENCIL_KEEP,
......
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