panfrost: Decode render target swizzle/channels
[mesa.git] / src / gallium / drivers / panfrost / include / panfrost-job.h
index dbb5486bfa4ba94596c30947edced77f85a0ff13..7a2735ad363ff99eb2d18488d10e082d55bc3a09 100644 (file)
@@ -30,8 +30,6 @@
 #include <stdint.h>
 #include <panfrost-misc.h>
 
-#define T8XX
-
 #define MALI_SHORT_PTR_BITS (sizeof(uintptr_t)*8)
 
 #define MALI_FBD_HIERARCHY_WEIGHTS 8
@@ -71,14 +69,16 @@ enum mali_draw_mode {
 
 /* Applies to tiler_gl_enables */
 
-#define MALI_CULL_FACE_BACK  0x80
-#define MALI_CULL_FACE_FRONT 0x40
 
-#define MALI_FRONT_FACE(v) (v << 5)
+#define MALI_OCCLUSION_QUERY    (1 << 3)
+#define MALI_OCCLUSION_PRECISE  (1 << 4)
+
+#define MALI_FRONT_FACE(v)      (v << 5)
 #define MALI_CCW (0)
 #define MALI_CW  (1)
 
-#define MALI_OCCLUSION_BOOLEAN 0x8
+#define MALI_CULL_FACE_FRONT    (1 << 6)
+#define MALI_CULL_FACE_BACK     (1 << 7)
 
 /* TODO: Might this actually be a finer bitfield? */
 #define MALI_DEPTH_STENCIL_ENABLE 0x6400
@@ -120,7 +120,7 @@ enum mali_alt_func {
 #define MALI_HAS_MSAA          (1 << 0)
 #define MALI_CAN_DISCARD       (1 << 5)
 
-/* Applies on T6XX, specifying that programmable blending is in use */
+/* Applies on SFBD systems, specifying that programmable blending is in use */
 #define MALI_HAS_BLEND_SHADER  (1 << 6)
 
 /* func is mali_func */
@@ -404,7 +404,7 @@ enum mali_format {
 #define MALI_NO_ALPHA_TO_COVERAGE (1 << 10)
 
 struct mali_blend_meta {
-#ifdef T8XX
+#ifndef BIFROST
         /* Base value of 0x200.
          * OR with 0x1 for blending (anything other than REPLACE).
          * OR with 0x2 for programmable blending
@@ -995,7 +995,7 @@ struct mali_vertex_tiler_postfix {
         mali_ptr framebuffer;
 
 #ifdef __LP64__
-#ifndef T8XX
+#ifdef BIFROST
         /* most likely padding to make this a multiple of 64 bytes */
         u64 zero7;
 #endif
@@ -1003,29 +1003,26 @@ struct mali_vertex_tiler_postfix {
 } __attribute__((packed));
 
 struct midgard_payload_vertex_tiler {
-#ifdef T6XX
+#ifndef __LP64__
         union midgard_primitive_size primitive_size;
 #endif
 
         struct mali_vertex_tiler_prefix prefix;
 
-#ifdef T6XX
+#ifndef __LP64__
         u32 zero3;
 #endif
+
         u32 gl_enables; // 0x5
 
         /* Offset for first vertex in buffer */
         u32 draw_start;
 
-#ifdef T6XX
-        u32 zero5;
-#else
-        u64 zero5;
-#endif
+       uintptr_t zero5;
 
         struct mali_vertex_tiler_postfix postfix;
 
-#ifdef T8XX
+#ifdef __LP64__
         union midgard_primitive_size primitive_size;
 #endif
 } __attribute__((packed));
@@ -1189,10 +1186,15 @@ struct mali_sampler_descriptor {
  */
 
 struct mali_viewport {
-        float floats[4];
+        /* XY clipping planes */
+        float clip_minx;
+        float clip_miny;
+        float clip_maxx;
+        float clip_maxy;
 
-        float depth_range_n;
-        float depth_range_f;
+        /* Depth clipping planes */
+        float clip_minz;
+        float clip_maxz;
 
         u16 viewport0[2];
         u16 viewport1[2];
@@ -1344,15 +1346,26 @@ struct mali_single_framebuffer {
         /* More below this, maybe */
 } __attribute__((packed));
 
-/* Format bits for the render target */
+/* Format bits for the render target flags */
+
+#define MALI_MFBD_FORMAT_AFBC    (1 << 5)
+#define MALI_MFBD_FORMAT_MSAA    (1 << 7)
 
-#define MALI_MFBD_FORMAT_AFBC    (1 << 10)
-#define MALI_MFBD_FORMAT_MSAA    (1 << 12)
-#define MALI_MFBD_FORMAT_NO_ALPHA (1 << 25)
+struct mali_rt_format {
+        unsigned unk1 : 32;
+        unsigned unk2 : 3;
+
+        unsigned nr_channels : 2; /* MALI_POSITIVE */
+
+        unsigned flags : 11;
+
+        unsigned swizzle : 12;
+
+        unsigned unk4 : 4;
+} __attribute__((packed));
 
 struct bifrost_render_target {
-        u32 unk1; // = 0x4000000
-        u32 format;
+        struct mali_rt_format format;
 
         u64 zero1;