freedreno: Replace OUT_RELOCD with permanently flagging shader BOs for it.
authorEric Anholt <eric@anholt.net>
Fri, 8 May 2020 18:24:12 +0000 (11:24 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 12 May 2020 16:30:57 +0000 (16:30 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4967>

src/freedreno/computerator/a6xx.c
src/freedreno/drm/freedreno_bo.c
src/freedreno/drm/freedreno_drmif.h
src/freedreno/drm/freedreno_ringbuffer.h
src/freedreno/ir3/ir3_shader.c
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

index b02718bc8494957579af6f1cfc82ea387bed988c..953191ab3778792d62268a923cecd65026330643 100644 (file)
@@ -168,7 +168,7 @@ cs_program_emit(struct fd_ringbuffer *ring, struct kernel *kernel)
                CP_LOAD_STATE6_0_STATE_SRC(SS6_INDIRECT) |
                CP_LOAD_STATE6_0_STATE_BLOCK(SB6_CS_SHADER) |
                CP_LOAD_STATE6_0_NUM_UNIT(v->instrlen));
-       OUT_RELOCD(ring, v->bo, 0, 0, 0);
+       OUT_RELOC(ring, v->bo, 0, 0, 0);
 }
 
 static void
index de8e128ec3f35be5685b82c6e5348603d1b3b1b6..794f0bc3b605b86e9ff9b325bf7ad22aec728d66 100644 (file)
@@ -226,6 +226,12 @@ out_unlock:
        return bo;
 }
 
+void
+fd_bo_mark_for_dump(struct fd_bo *bo)
+{
+       bo->flags |= FD_RELOC_DUMP;
+}
+
 uint64_t fd_bo_get_iova(struct fd_bo *bo)
 {
        return bo->iova;
index ad8ef9ae316bb2ea219cba5fef1e6f4f558fcba8..a14ab60cf7cc2e5a3268246863a49cce63afd295 100644 (file)
@@ -157,6 +157,7 @@ struct fd_bo *fd_bo_from_handle(struct fd_device *dev,
                uint32_t handle, uint32_t size);
 struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name);
 struct fd_bo * fd_bo_from_dmabuf(struct fd_device *dev, int fd);
+void fd_bo_mark_for_dump(struct fd_bo *bo);
 uint64_t fd_bo_get_iova(struct fd_bo *bo);
 struct fd_bo * fd_bo_ref(struct fd_bo *bo);
 void fd_bo_del(struct fd_bo *bo);
index 14b2425abbdd93791bf26f391e1b2a9d3fa58c39..6cfbf1a69ef53a2b5a2d03cd9a6497f44516c8c7 100644 (file)
@@ -264,13 +264,6 @@ OUT_RELOCW(struct fd_ringbuffer *ring, struct fd_bo *bo,
        __out_reloc(ring, bo, offset, or, shift, 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_DUMP);
-}
-
 static inline void
 OUT_RB(struct fd_ringbuffer *ring, struct fd_ringbuffer *target)
 {
index e8e95fce3ae1c02d99626770bac676f40b9c39ee..18d9659eafe023e8e8f11d6db75230c9fc94e4d9 100644 (file)
@@ -171,6 +171,8 @@ assemble_variant(struct ir3_shader_variant *v)
                        DRM_FREEDRENO_GEM_CACHE_WCOMBINE |
                        DRM_FREEDRENO_GEM_TYPE_KMEM,
                        "%s:%s", ir3_shader_stage(v), info->name);
+       /* Always include shaders in kernel crash dumps. */
+       fd_bo_mark_for_dump(v->bo);
 
        memcpy(fd_bo_map(v->bo), bin, sz);
 
index 9ecffcc0634899a1552f6a069f81a72de31ad228..93773358d1a184d81698462c59b9452592e76209 100644 (file)
@@ -85,7 +85,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_RELOCD(ring, so->bo, 0,
+               OUT_RELOC(ring, so->bo, 0,
                                CP_LOAD_STATE_1_STATE_TYPE(ST_SHADER), 0);
        }
        for (i = 0; i < sz; i++) {
index 4c48c617386472400d1201c0ee1f79343d58e44f..c4c5b03e7a0db0d22fa67f597f03597423f61da2 100644 (file)
@@ -64,7 +64,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_RELOCD(ring, so->bo, 0,
+               OUT_RELOC(ring, so->bo, 0,
                                CP_LOAD_STATE4_1_STATE_TYPE(ST4_SHADER), 0);
        }
 
index 21d94dc72e27470c2247b29d4414075f7a3e8feb..dba953d590ff786ea36e794191dc678cf9f50713 100644 (file)
@@ -68,7 +68,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_RELOCD(ring, so->bo, 0,
+               OUT_RELOC(ring, so->bo, 0,
                                CP_LOAD_STATE4_1_STATE_TYPE(ST4_SHADER), 0);
        }
 
index 651d9da781d747c6e19bcc2086143f6831ded945..135adfa59c8ad20b9bc1915164984d9d67d5f43a 100644 (file)
@@ -90,7 +90,7 @@ fd6_emit_shader(struct fd_ringbuffer *ring, const struct ir3_shader_variant *so)
                        CP_LOAD_STATE6_0_STATE_SRC(SS6_INDIRECT) |
                        CP_LOAD_STATE6_0_STATE_BLOCK(sb) |
                        CP_LOAD_STATE6_0_NUM_UNIT(so->instrlen));
-       OUT_RELOCD(ring, so->bo, 0, 0, 0);
+       OUT_RELOC(ring, so->bo, 0, 0, 0);
 }
 
 /* Add any missing varyings needed for stream-out.  Otherwise varyings not