v3d: Fold comparisons for IF conditions into the flags for the IF.
[mesa.git] / src / broadcom / compiler / v3d_compiler.h
index a02b5a6404a74bc6486ecf3dfce83bfb4bde3525..717d85890b0ebb4d8f64872bf2f265581de805ee 100644 (file)
@@ -223,7 +223,7 @@ enum quniform_contents {
          */
         QUNIFORM_TEXTURE_CONFIG_P1,
 
-        /* A V3D 4.x texture config parameter.  The high 8 bits will be
+        /* A V3D 4.x texture config parameter.  The high 8 bits will be
          * which texture or sampler is being sampled, and the driver must
          * replace the address field with the appropriate address.
          */
@@ -243,10 +243,7 @@ enum quniform_contents {
         QUNIFORM_TEXRECT_SCALE_X,
         QUNIFORM_TEXRECT_SCALE_Y,
 
-        QUNIFORM_TEXTURE_BORDER_COLOR,
-
         QUNIFORM_ALPHA_REF,
-        QUNIFORM_SAMPLE_MASK,
 
         /**
          * Returns the the offset of the scratch buffer for register spilling.
@@ -255,6 +252,21 @@ enum quniform_contents {
         QUNIFORM_SPILL_SIZE_PER_THREAD,
 };
 
+static inline uint32_t v3d_tmu_config_data_create(uint32_t unit, uint32_t value)
+{
+        return unit << 24 | value;
+}
+
+static inline uint32_t v3d_tmu_config_data_get_unit(uint32_t data)
+{
+        return data >> 24;
+}
+
+static inline uint32_t v3d_tmu_config_data_get_value(uint32_t data)
+{
+        return data & 0xffffff;
+}
+
 struct v3d_varying_slot {
         uint8_t slot_and_component;
 };
@@ -301,8 +313,6 @@ struct v3d_key {
                 uint8_t swizzle[4];
                 uint8_t return_size;
                 uint8_t return_channels;
-                unsigned compare_mode:1;
-                unsigned compare_func:3;
                 bool clamp_s:1;
                 bool clamp_t:1;
                 bool clamp_r:1;
@@ -447,6 +457,10 @@ struct v3d_compile {
         struct exec_list *cf_node_list;
         const struct v3d_compiler *compiler;
 
+        void (*debug_output)(const char *msg,
+                             void *debug_output_data);
+        void *debug_output_data;
+
         /**
          * Mapping from nir_register * or nir_ssa_def * to array of struct
          * qreg for the values.
@@ -519,8 +533,8 @@ struct v3d_compile {
          * space needs to be available in the spill BO per thread per QPU.
          */
         uint32_t spill_size;
-        /* Shader-db stats for register spilling. */
-        uint32_t spills, fills;
+        /* Shader-db stats */
+        uint32_t spills, fills, loops;
         /**
          * Register spilling's per-thread base address, shared between each
          * spill/fill's addressing calculations.
@@ -648,6 +662,14 @@ struct v3d_vs_prog_data {
 
         /* Total number of components written, for the shader state record. */
         uint32_t vpm_output_size;
+
+        /* Set if there should be separate VPM segments for input and output.
+         * If unset, vpm_input_size will be 0.
+         */
+        bool separate_segments;
+
+        /* Value to be programmed in VCM_CACHE_SIZE. */
+        uint8_t vcm_cache_size;
 };
 
 struct v3d_fs_prog_data {
@@ -688,6 +710,9 @@ uint64_t *v3d_compile_vs(const struct v3d_compiler *compiler,
                          struct v3d_vs_key *key,
                          struct v3d_vs_prog_data *prog_data,
                          nir_shader *s,
+                         void (*debug_output)(const char *msg,
+                                              void *debug_output_data),
+                         void *debug_output_data,
                          int program_id, int variant_id,
                          uint32_t *final_assembly_size);
 
@@ -695,6 +720,9 @@ uint64_t *v3d_compile_fs(const struct v3d_compiler *compiler,
                          struct v3d_fs_key *key,
                          struct v3d_fs_prog_data *prog_data,
                          nir_shader *s,
+                         void (*debug_output)(const char *msg,
+                                              void *debug_output_data),
+                         void *debug_output_data,
                          int program_id, int variant_id,
                          uint32_t *final_assembly_size);
 
@@ -723,6 +751,7 @@ struct qreg vir_emit_def(struct v3d_compile *c, struct qinst *inst);
 struct qinst *vir_emit_nondef(struct v3d_compile *c, struct qinst *inst);
 void vir_set_cond(struct qinst *inst, enum v3d_qpu_cond cond);
 void vir_set_pf(struct qinst *inst, enum v3d_qpu_pf pf);
+void vir_set_uf(struct qinst *inst, enum v3d_qpu_uf uf);
 void vir_set_unpack(struct qinst *inst, int src,
                     enum v3d_qpu_input_unpack unpack);
 
@@ -741,7 +770,6 @@ bool vir_is_tex(struct qinst *inst);
 bool vir_is_add(struct qinst *inst);
 bool vir_is_mul(struct qinst *inst);
 bool vir_is_float_input(struct qinst *inst);
-bool vir_depends_on_flags(struct qinst *inst);
 bool vir_writes_r3(const struct v3d_device_info *devinfo, struct qinst *inst);
 bool vir_writes_r4(const struct v3d_device_info *devinfo, struct qinst *inst);
 struct qreg vir_follow_movs(struct v3d_compile *c, struct qreg reg);
@@ -753,6 +781,7 @@ void vir_emit_thrsw(struct v3d_compile *c);
 
 void vir_dump(struct v3d_compile *c);
 void vir_dump_inst(struct v3d_compile *c, struct qinst *inst);
+void vir_dump_uniform(enum quniform_contents contents, uint32_t data);
 
 void vir_validate(struct v3d_compile *c);
 
@@ -928,7 +957,7 @@ VIR_A_ALU2(OR)
 VIR_A_ALU2(XOR)
 VIR_A_ALU2(VADD)
 VIR_A_ALU2(VSUB)
-VIR_A_ALU2(STVPMV)
+VIR_A_NODST_2(STVPMV)
 VIR_A_ALU1(NOT)
 VIR_A_ALU1(NEG)
 VIR_A_ALU1(FLAPUSH)
@@ -940,6 +969,7 @@ VIR_A_ALU0(TIDX)
 VIR_A_ALU0(EIDX)
 VIR_A_ALU1(LDVPMV_IN)
 VIR_A_ALU1(LDVPMV_OUT)
+VIR_A_ALU0(TMUWT)
 
 VIR_A_ALU0(FXCD)
 VIR_A_ALU0(XCD)
@@ -1056,7 +1086,7 @@ vir_LOAD_IMM_I2(struct v3d_compile *c, uint32_t val)
 */
 
 static inline struct qinst *
-vir_BRANCH(struct v3d_compile *c, enum v3d_qpu_cond cond)
+vir_BRANCH(struct v3d_compile *c, enum v3d_qpu_branch_cond cond)
 {
         /* The actual uniform_data value will be set at scheduling time */
         return vir_emit_nondef(c, vir_branch_inst(cond, vir_uniform_ui(c, 0)));