From 554b959df0d5b1117fb42d3d7d1e715ea318f079 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 8 May 2020 11:24:12 -0700 Subject: [PATCH] freedreno: Replace OUT_RELOCD with permanently flagging shader BOs for it. Part-of: --- src/freedreno/computerator/a6xx.c | 2 +- src/freedreno/drm/freedreno_bo.c | 6 ++++++ src/freedreno/drm/freedreno_drmif.h | 1 + src/freedreno/drm/freedreno_ringbuffer.h | 7 ------- src/freedreno/ir3/ir3_shader.c | 2 ++ src/gallium/drivers/freedreno/a3xx/fd3_program.c | 2 +- src/gallium/drivers/freedreno/a4xx/fd4_program.c | 2 +- src/gallium/drivers/freedreno/a5xx/fd5_program.c | 2 +- src/gallium/drivers/freedreno/a6xx/fd6_program.c | 2 +- 9 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/freedreno/computerator/a6xx.c b/src/freedreno/computerator/a6xx.c index b02718bc849..953191ab377 100644 --- a/src/freedreno/computerator/a6xx.c +++ b/src/freedreno/computerator/a6xx.c @@ -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 diff --git a/src/freedreno/drm/freedreno_bo.c b/src/freedreno/drm/freedreno_bo.c index de8e128ec3f..794f0bc3b60 100644 --- a/src/freedreno/drm/freedreno_bo.c +++ b/src/freedreno/drm/freedreno_bo.c @@ -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; diff --git a/src/freedreno/drm/freedreno_drmif.h b/src/freedreno/drm/freedreno_drmif.h index ad8ef9ae316..a14ab60cf7c 100644 --- a/src/freedreno/drm/freedreno_drmif.h +++ b/src/freedreno/drm/freedreno_drmif.h @@ -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); diff --git a/src/freedreno/drm/freedreno_ringbuffer.h b/src/freedreno/drm/freedreno_ringbuffer.h index 14b2425abbd..6cfbf1a69ef 100644 --- a/src/freedreno/drm/freedreno_ringbuffer.h +++ b/src/freedreno/drm/freedreno_ringbuffer.h @@ -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) { diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index e8e95fce3ae..18d9659eafe 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -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); diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.c b/src/gallium/drivers/freedreno/a3xx/fd3_program.c index 9ecffcc0634..93773358d1a 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_program.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.c @@ -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++) { diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_program.c b/src/gallium/drivers/freedreno/a4xx/fd4_program.c index 4c48c617386..c4c5b03e7a0 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_program.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_program.c @@ -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); } diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_program.c b/src/gallium/drivers/freedreno/a5xx/fd5_program.c index 21d94dc72e2..dba953d590f 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_program.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_program.c @@ -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); } diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c index 651d9da781d..135adfa59c8 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c @@ -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 -- 2.30.2