enum mali_job_type {
JOB_NOT_STARTED = 0,
JOB_TYPE_NULL = 1,
- JOB_TYPE_SET_VALUE = 2,
+ JOB_TYPE_WRITE_VALUE = 2,
JOB_TYPE_CACHE_FLUSH = 3,
JOB_TYPE_COMPUTE = 4,
JOB_TYPE_VERTEX = 5,
MALI_FUNC_ALWAYS = 7
};
-/* Same OpenGL, but mixed up. Why? Because forget me, that's why! */
-
-enum mali_alt_func {
- MALI_ALT_FUNC_NEVER = 0,
- MALI_ALT_FUNC_GREATER = 1,
- MALI_ALT_FUNC_EQUAL = 2,
- MALI_ALT_FUNC_GEQUAL = 3,
- MALI_ALT_FUNC_LESS = 4,
- MALI_ALT_FUNC_NOTEQUAL = 5,
- MALI_ALT_FUNC_LEQUAL = 6,
- MALI_ALT_FUNC_ALWAYS = 7
-};
-
/* Flags apply to unknown2_3? */
#define MALI_HAS_MSAA (1 << 0)
struct midgard_blend_rt {
/* Flags base value of 0x200 to enable the render target.
* OR with 0x1 for blending (anything other than REPLACE).
- * OR with 0x2 for programmable blending with 0-2 registers
- * OR with 0x3 for programmable blending with 2+ registers
+ * OR with 0x2 for programmable blending
* OR with MALI_BLEND_SRGB for implicit sRGB
*/
MALI_EXCEPTION_ACCESS_WRITE = 3
};
-struct mali_payload_set_value {
- u64 out;
- u64 unknown;
-} __attribute__((packed));
+/* Details about write_value from panfrost igt tests which use it as a generic
+ * dword write primitive */
-/* Special attributes have a fixed index */
-#define MALI_SPECIAL_ATTRIBUTE_BASE 16
-#define MALI_VERTEX_ID (MALI_SPECIAL_ATTRIBUTE_BASE + 0)
-#define MALI_INSTANCE_ID (MALI_SPECIAL_ATTRIBUTE_BASE + 1)
+#define MALI_WRITE_VALUE_ZERO 3
+
+struct mali_payload_write_value {
+ u64 address;
+ u32 value_descriptor;
+ u32 reserved;
+ u64 immediate;
+} __attribute__((packed));
/*
* Mali Attributes
* let shift=extra_flags=0. Stride is set to the image format's bytes-per-pixel
* (*NOT the row stride*). Size is set to the size of the image itself.
*
- * Special internal varyings (including gl_FrontFacing) could be seen as
- * IMAGE/INTERNAL as well as LINEAR, setting all fields set to zero and using a
- * special elements pseudo-pointer.
+ * Special internal attribtues and varyings (gl_VertexID, gl_FrontFacing, etc)
+ * use particular fixed addresses with modified structures.
*/
enum mali_attr_mode {
MALI_ATTR_MODULO = 3,
MALI_ATTR_NPOT_DIVIDE = 4,
MALI_ATTR_IMAGE = 5,
- MALI_ATTR_INTERNAL = 6
};
-/* Pseudo-address for gl_FrontFacing, used with INTERNAL. Same addres is used
- * for gl_FragCoord with IMAGE, needing a coordinate flip. Who knows. */
+/* Pseudo-address for gl_VertexID, gl_FragCoord, gl_FrontFacing */
+#define MALI_ATTR_VERTEXID (0x22)
+#define MALI_ATTR_INSTANCEID (0x24)
#define MALI_VARYING_FRAG_COORD (0x25)
#define MALI_VARYING_FRONT_FACING (0x26)
/* Used for comparison to check if an address is special. Mostly a guess, but
* it doesn't really matter. */
-#define MALI_VARYING_SPECIAL (0x100)
+#define MALI_RECORD_SPECIAL (0x100)
union mali_attr {
/* This is used for actual attributes. */
int32_t src_offset;
} __attribute__((packed));
-enum mali_fbd_type {
- MALI_SFBD = 0,
- MALI_MFBD = 1,
-};
-
-#define FBD_TYPE (1)
#define FBD_MASK (~0x3f)
+/* MFBD, rather than SFBD */
+#define MALI_MFBD (0x1)
+
/* ORed into an MFBD address to specify the fbx section is included */
#define MALI_MFBD_TAG_EXTRA (0x2)
*/
u32 invocation_count;
- u32 size_y_shift : 5;
- u32 size_z_shift : 5;
- u32 workgroups_x_shift : 6;
- u32 workgroups_y_shift : 6;
- u32 workgroups_z_shift : 6;
- /* This is max(workgroups_x_shift, 2) in all the cases I've seen. */
- u32 workgroups_x_shift_2 : 4;
+ /* Bitfield for shifts:
+ *
+ * size_y_shift : 5
+ * size_z_shift : 5
+ * workgroups_x_shift : 6
+ * workgroups_y_shift : 6
+ * workgroups_z_shift : 6
+ * workgroups_x_shift_2 : 4
+ */
+ u32 invocation_shifts;
u32 draw_mode : 4;
u32 unknown_draw : 22;
#define MALI_POSITIVE(dim) (dim - 1)
-/* Opposite of MALI_POSITIVE, found in the depth_units field */
-
-#define MALI_NEGATIVE(dim) (dim + 1)
-
-/* Used with wrapping. Incomplete (this is a 4-bit field...) */
+/* Used with wrapping. Unclear what top bit conveys */
enum mali_wrap_mode {
- MALI_WRAP_REPEAT = 0x8,
- MALI_WRAP_CLAMP_TO_EDGE = 0x9,
- MALI_WRAP_CLAMP_TO_BORDER = 0xB,
- MALI_WRAP_MIRRORED_REPEAT = 0xC
+ MALI_WRAP_REPEAT = 0x8 | 0x0,
+ MALI_WRAP_CLAMP_TO_EDGE = 0x8 | 0x1,
+ MALI_WRAP_CLAMP = 0x8 | 0x2,
+ MALI_WRAP_CLAMP_TO_BORDER = 0x8 | 0x3,
+ MALI_WRAP_MIRRORED_REPEAT = 0x8 | 0x4 | 0x0,
+ MALI_WRAP_MIRRORED_CLAMP_TO_EDGE = 0x8 | 0x4 | 0x1,
+ MALI_WRAP_MIRRORED_CLAMP = 0x8 | 0x4 | 0x2,
+ MALI_WRAP_MIRRORED_CLAMP_TO_BORDER = 0x8 | 0x4 | 0x3,
};
/* Shared across both command stream and Midgard, and even with Bifrost */
uint16_t min_lod;
uint16_t max_lod;
- /* All one word in reality, but packed a bit */
+ /* All one word in reality, but packed a bit. Comparisons are flipped
+ * from OpenGL. */
enum mali_wrap_mode wrap_s : 4;
enum mali_wrap_mode wrap_t : 4;
enum mali_wrap_mode wrap_r : 4;
- enum mali_alt_func compare_func : 3;
+ enum mali_func compare_func : 3;
/* No effect on 2D textures. For cubemaps, set for ES3 and clear for
* ES2, controlling seamless cubemapping */
struct mali_single_framebuffer {
u32 unknown1;
u32 unknown2;
- u64 unknown_address_0;
+ mali_ptr scratchpad;
+
u64 zero1;
u64 zero0;
#define MALI_MFBD_EXTRA (1 << 13)
struct bifrost_framebuffer {
- u32 unk0; // = 0x10
+ u32 stack_shift : 4;
+ u32 unk0 : 28;
u32 unknown2; // = 0x1f, same as SFBD
mali_ptr scratchpad;