freedreno: also set DUMP flag on shaders
authorRob Clark <robdclark@gmail.com>
Tue, 4 Dec 2018 13:07:50 +0000 (08:07 -0500)
committerRob Clark <robdclark@gmail.com>
Thu, 13 Dec 2018 20:51:01 +0000 (15:51 -0500)
If we emit shader as a pointer to a GEM object, also set the RELOC_DUMP
flag as a hint to kernel that this is a useful buffer to snapshot for
debug dumps.

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/a3xx/fd3_program.c
src/gallium/drivers/freedreno/a4xx/fd4_program.c
src/gallium/drivers/freedreno/a5xx/fd5_program.c
src/gallium/drivers/freedreno/a6xx/fd6_program.c
src/gallium/drivers/freedreno/freedreno_util.h

index 9582584785716558553d2d1f3341a1ca0d1c0d06..29371049ba0f84dd70ac2eb3ba0857cf76576b8d 100644 (file)
@@ -122,7 +122,7 @@ emit_shader(struct fd_ringbuffer *ring, const struct ir3_shader_variant *so)
                OUT_RING(ring, CP_LOAD_STATE_1_EXT_SRC_ADDR(0) |
                                CP_LOAD_STATE_1_STATE_TYPE(ST_SHADER));
        } else {
-               OUT_RELOC(ring, so->bo, 0,
+               OUT_RELOCD(ring, so->bo, 0,
                                CP_LOAD_STATE_1_STATE_TYPE(ST_SHADER), 0);
        }
        for (i = 0; i < sz; i++) {
index 07e715e4f0ae6561a1af381e45b9d828899860d8..952b56cefcba8467d60244225aed00bdff3b16d9 100644 (file)
@@ -101,7 +101,7 @@ emit_shader(struct fd_ringbuffer *ring, const struct ir3_shader_variant *so)
                OUT_RING(ring, CP_LOAD_STATE4_1_EXT_SRC_ADDR(0) |
                                CP_LOAD_STATE4_1_STATE_TYPE(ST4_SHADER));
        } else {
-               OUT_RELOC(ring, so->bo, 0,
+               OUT_RELOCD(ring, so->bo, 0,
                                CP_LOAD_STATE4_1_STATE_TYPE(ST4_SHADER), 0);
        }
 
index 9c54244457ff8c60805275d6e9ad532b8a57b5d4..650db0df463445351595ff0472d04ac06ac4c84b 100644 (file)
@@ -105,7 +105,7 @@ fd5_emit_shader(struct fd_ringbuffer *ring, const struct ir3_shader_variant *so)
                                CP_LOAD_STATE4_1_STATE_TYPE(ST4_SHADER));
                OUT_RING(ring, CP_LOAD_STATE4_2_EXT_SRC_ADDR_HI(0));
        } else {
-               OUT_RELOC(ring, so->bo, 0,
+               OUT_RELOCD(ring, so->bo, 0,
                                CP_LOAD_STATE4_1_STATE_TYPE(ST4_SHADER), 0);
        }
 
index add2d28b8662329f840da69afd51f9b9ac5f3d14..53d4a1d3e5b0a153109531a87e0a3fe1231858da 100644 (file)
@@ -121,7 +121,7 @@ fd6_emit_shader(struct fd_ringbuffer *ring, const struct ir3_shader_variant *so)
                OUT_RING(ring, CP_LOAD_STATE6_1_EXT_SRC_ADDR(0));
                OUT_RING(ring, CP_LOAD_STATE6_2_EXT_SRC_ADDR_HI(0));
        } else {
-               OUT_RELOC(ring, so->bo, 0, 0, 0);
+               OUT_RELOCD(ring, so->bo, 0, 0, 0);
        }
 
        /* for how clever coverity is, it is sometimes rather dull, and
index 479f255f6fc7e72c1859bb812ffdb69afb4b21fe..17e64b03f3813aed1dc1ee79b20eef9a5cf73ddb 100644 (file)
@@ -244,8 +244,8 @@ OUT_RINGP(struct fd_ringbuffer *ring, uint32_t data,
  */
 
 static inline void
-OUT_RELOC(struct fd_ringbuffer *ring, struct fd_bo *bo,
-               uint32_t offset, uint64_t or, int32_t shift)
+__out_reloc(struct fd_ringbuffer *ring, struct fd_bo *bo,
+               uint32_t offset, uint64_t or, int32_t shift, uint32_t flags)
 {
        if (LOG_DWORDS) {
                DBG("ring[%p]: OUT_RELOC   %04x:  %p+%u << %d", ring,
@@ -254,7 +254,7 @@ OUT_RELOC(struct fd_ringbuffer *ring, struct fd_bo *bo,
        debug_assert(offset < fd_bo_size(bo));
        fd_ringbuffer_reloc(ring, &(struct fd_reloc){
                .bo = bo,
-               .flags = FD_RELOC_READ,
+               .flags = flags,
                .offset = offset,
                .or = or,
                .shift = shift,
@@ -262,23 +262,25 @@ OUT_RELOC(struct fd_ringbuffer *ring, struct fd_bo *bo,
        });
 }
 
+static inline void
+OUT_RELOC(struct fd_ringbuffer *ring, struct fd_bo *bo,
+               uint32_t offset, uint64_t or, int32_t shift)
+{
+       __out_reloc(ring, bo, offset, or, shift, FD_RELOC_READ);
+}
+
 static inline void
 OUT_RELOCW(struct fd_ringbuffer *ring, struct fd_bo *bo,
                uint32_t offset, uint64_t or, int32_t shift)
 {
-       if (LOG_DWORDS) {
-               DBG("ring[%p]: OUT_RELOCW  %04x:  %p+%u << %d", ring,
-                               (uint32_t)(ring->cur - ring->start), bo, offset, shift);
-       }
-       debug_assert(offset < fd_bo_size(bo));
-       fd_ringbuffer_reloc(ring, &(struct fd_reloc){
-               .bo = bo,
-               .flags = FD_RELOC_READ | FD_RELOC_WRITE,
-               .offset = offset,
-               .or = or,
-               .shift = shift,
-               .orhi = or >> 32,
-       });
+       __out_reloc(ring, bo, offset, or, shift, FD_RELOC_READ | FD_RELOC_WRITE);
+}
+
+static inline void
+OUT_RELOCD(struct fd_ringbuffer *ring, struct fd_bo *bo,
+               uint32_t offset, uint64_t or, int32_t shift)
+{
+       __out_reloc(ring, bo, offset, or, shift, FD_RELOC_READ | FD_RELOC_DUMP);
 }
 
 static inline void