v3d: Add VIR dumping of TMU config p0/p1.
authorEric Anholt <eric@anholt.net>
Tue, 4 Dec 2018 23:03:15 +0000 (15:03 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 8 Dec 2018 00:48:23 +0000 (16:48 -0800)
I had a bit of it for V3D 3.x, but didn't update it for 4.x.

src/broadcom/compiler/v3d_compiler.h
src/broadcom/compiler/vir_dump.c
src/gallium/drivers/v3d/v3d_uniforms.c

index bed5b588e0d5a533d013cca41b3334d4f3362d1e..6ab1176068d151e3ce893c73d20e8bb1ad948eec 100644 (file)
@@ -252,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;
 };
index f02413c6877a1e2c64417f07099be1a844ed57bc..d1c343f773e5f3321e71314eba054928408d52c5 100644 (file)
@@ -103,6 +103,18 @@ vir_print_reg(struct v3d_compile *c, const struct qinst *inst,
                         fprintf(stderr, " (tex[%d].p1)", data);
                         break;
 
+                case QUNIFORM_TMU_CONFIG_P0:
+                        fprintf(stderr, " (tex[%d].p0 | 0x%x)",
+                                v3d_tmu_config_data_get_unit(data),
+                                v3d_tmu_config_data_get_value(data));
+                        break;
+
+                case QUNIFORM_TMU_CONFIG_P1:
+                        fprintf(stderr, " (tex[%d].p1 | 0x%x)",
+                                v3d_tmu_config_data_get_unit(data),
+                                v3d_tmu_config_data_get_value(data));
+                        break;
+
                 case QUNIFORM_TEXTURE_WIDTH:
                         fprintf(stderr, " (tex[%d].width)", data);
                         break;
index 6d927deeec5014b926c7963d2e7716e4b5d2b731..49e83ccdb1d5fdd509c4aba8cb7cbd6c05be7dc8 100644 (file)
@@ -148,17 +148,13 @@ write_tmu_p0(struct v3d_job *job,
              struct v3d_texture_stateobj *texstate,
              uint32_t data)
 {
-        /* Extract the texture unit from the top bits, and the compiler's
-         * packed p0 from the bottom.
-         */
-        uint32_t unit = data >> 24;
-        uint32_t p0 = data & 0x00ffffff;
-
+        int unit  = v3d_tmu_config_data_get_unit(data);
         struct pipe_sampler_view *psview = texstate->textures[unit];
         struct v3d_sampler_view *sview = v3d_sampler_view(psview);
         struct v3d_resource *rsc = v3d_resource(psview->texture);
 
-        cl_aligned_reloc(&job->indirect, uniforms, sview->bo, p0);
+        cl_aligned_reloc(&job->indirect, uniforms, sview->bo,
+                         v3d_tmu_config_data_get_value(data));
         v3d_job_add_bo(job, rsc->bo);
 }
 
@@ -169,16 +165,12 @@ write_tmu_p1(struct v3d_job *job,
              struct v3d_texture_stateobj *texstate,
              uint32_t data)
 {
-        /* Extract the texture unit from the top bits, and the compiler's
-         * packed p1 from the bottom.
-         */
-        uint32_t unit = data >> 24;
-        uint32_t p0 = data & 0x00ffffff;
-
+        uint32_t unit = v3d_tmu_config_data_get_unit(data);
         struct pipe_sampler_state *psampler = texstate->samplers[unit];
         struct v3d_sampler_state *sampler = v3d_sampler_state(psampler);
 
-        cl_aligned_reloc(&job->indirect, uniforms, sampler->bo, p0);
+        cl_aligned_reloc(&job->indirect, uniforms, sampler->bo,
+                         v3d_tmu_config_data_get_value(data));
 }
 
 struct v3d_cl_reloc