#include <stdint.h>
#include <stdbool.h>
-#include "panfrost-job.h"
#define MIDGARD_DBG_MSGS 0x0001
#define MIDGARD_DBG_SHADERS 0x0002
typedef enum {
midgard_outmod_none = 0,
- midgard_outmod_pos = 1,
- /* 0x2 unknown */
- midgard_outmod_sat = 3
+ midgard_outmod_pos = 1, /* max(x, 0.0) */
+ midgard_outmod_sat_signed = 2, /* clamp(x, -1.0, 1.0) */
+ midgard_outmod_sat = 3 /* clamp(x, 0.0, 1.0) */
} midgard_outmod_float;
typedef enum {
typedef struct
__attribute__((__packed__))
{
- bool abs : 1;
- bool negate : 1;
+ unsigned mod : 2;
bool full : 1; /* 0 = half, 1 = full */
unsigned component : 3;
}
/* Packs a colour from fp16 to a native format */
midgard_op_pack_colour = 0x09,
+ /* Likewise packs from fp32 */
+ midgard_op_pack_colour_32 = 0x0A,
+
/* Unclear why this is on the L/S unit, but moves fp32 cube map
* coordinates in r27 to its cube map texture coordinate destination
* (e.g r29). */
/* Used for compute shader's __global arguments, __local variables (or
* for register spilling) */
- midgard_op_ld_char = 0x81,
- midgard_op_ld_char2 = 0x84,
- midgard_op_ld_short = 0x85,
+ midgard_op_ld_uchar = 0x80, /* zero extends */
+ midgard_op_ld_char = 0x81, /* sign extends */
+ midgard_op_ld_ushort = 0x84, /* zero extends */
+ midgard_op_ld_short = 0x85, /* sign extends */
midgard_op_ld_char4 = 0x88, /* short2, int, float */
midgard_op_ld_short4 = 0x8C, /* int2, float2, long */
midgard_op_ld_int4 = 0x90, /* float4, long2 */
midgard_op_ld_vary_32u = 0x9A,
midgard_op_ld_vary_32i = 0x9B,
- /* Old version of midgard_op_ld_color_buffer_u8_as_fp16, for T720 */
- midgard_op_ld_color_buffer_u8_as_fp16_old = 0x9D,
+ /* Old version of midgard_op_ld_color_buffer_as_fp16, for T720 */
+ midgard_op_ld_color_buffer_as_fp32_old = 0x9C,
+ midgard_op_ld_color_buffer_as_fp16_old = 0x9D,
+ midgard_op_ld_color_buffer_32u_old = 0x9E,
/* The distinction between these ops is the alignment requirement /
* accompanying shift. Thus, the offset to ld_ubo_int4 is in 16-byte
midgard_op_ld_ubo_int4 = 0xB0,
/* New-style blending ops. Works on T760/T860 */
- midgard_op_ld_color_buffer_u8_as_fp16 = 0xB9,
+ midgard_op_ld_color_buffer_as_fp32 = 0xB8,
+ midgard_op_ld_color_buffer_as_fp16 = 0xB9,
midgard_op_ld_color_buffer_32u = 0xBA,
midgard_op_st_char = 0xC0,
} midgard_load_store_op;
typedef enum {
+ midgard_interp_sample = 0,
midgard_interp_centroid = 1,
midgard_interp_default = 2
} midgard_interpolation;
unsigned cont : 1;
unsigned last : 1;
- enum mali_texture_type format : 2;
+ unsigned format : 2;
/* Are sampler_handle/texture_handler respectively set by registers? If
* true, the lower 8-bits of the respective field is a register word.
unsigned mask : 4;
- /* Intriguingly, textures can take an outmod just like textures. Int
+ /* Intriguingly, textures can take an outmod just like alu ops. Int
* outmods are not supported as far as I can tell, so this is only
* meaningful for float samplers */
midgard_outmod_float outmod : 2;
unsigned swizzle : 8;
- /* For barriers, control barriers are implied regardless, but these
- * bits also enable memory barriers of various types. For regular
- * textures, these bits are not yet understood. */
- unsigned barrier_buffer : 1;
- unsigned barrier_shared : 1;
- unsigned barrier_stack : 1;
+ /* These indicate how many bundles after this texture op may be
+ * executed in parallel with this op. We may execute only ALU and
+ * ld/st in parallel (not other textures), and obviously there cannot
+ * be any dependency (the blob appears to forbid even accessing other
+ * channels of a given texture register). */
- unsigned unknown4 : 9;
+ unsigned out_of_order : 2;
+ unsigned unknown4 : 10;
/* In immediate mode, each offset field is an immediate range [0, 7].
*
- * In register mode, offset_x becomes a register full / select / upper
+ * In register mode, offset_x becomes a register (full, select, upper)
* triplet followed by a vec3 swizzle is splattered across
* offset_y/offset_z in a genuinely bizarre way.
*
unsigned zero2 : 14;
unsigned zero3 : 24;
- unsigned buffer : 1;
- unsigned shared : 1;
- unsigned stack : 1;
- unsigned zero4 : 5;
+ unsigned out_of_order : 4;
+ unsigned zero4 : 4;
uint64_t zero5;
} midgard_texture_barrier_word;
}
midgard_constants;
+enum midgard_roundmode {
+ MIDGARD_RTE = 0x0, /* round to even */
+ MIDGARD_RTZ = 0x1, /* round to zero */
+ MIDGARD_RTN = 0x2, /* round to negative */
+ MIDGARD_RTP = 0x3, /* round to positive */
+};
+
#endif