diff options
author | Eric Anholt <[email protected]> | 2020-05-08 11:20:07 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-12 16:30:57 +0000 |
commit | 9d8d936dfcdab52361b9824cdd1f3ddb41486145 (patch) | |
tree | b8d1655f73e5817d5344713208deb9a643eeb70d /src/freedreno/drm | |
parent | 4235624b6a1f1858a8f200c03b6492ed1b9f21ec (diff) |
freedreno: Start moving relocs flags into the BOs.
It's silly to have all the reloc emitters passing around FD_RELOC_READ
when you have to have it set on all relocs (that don't include WRITE,
which implies read) for the kernel to actually track the fences on the BO.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4967>
Diffstat (limited to 'src/freedreno/drm')
-rw-r--r-- | src/freedreno/drm/freedreno_bo.c | 1 | ||||
-rw-r--r-- | src/freedreno/drm/freedreno_bo_cache.c | 1 | ||||
-rw-r--r-- | src/freedreno/drm/freedreno_priv.h | 1 | ||||
-rw-r--r-- | src/freedreno/drm/freedreno_ringbuffer.h | 8 | ||||
-rw-r--r-- | src/freedreno/drm/msm_ringbuffer.c | 12 | ||||
-rw-r--r-- | src/freedreno/drm/msm_ringbuffer_sp.c | 6 |
6 files changed, 15 insertions, 14 deletions
diff --git a/src/freedreno/drm/freedreno_bo.c b/src/freedreno/drm/freedreno_bo.c index 04f9c1d16b4..de8e128ec3f 100644 --- a/src/freedreno/drm/freedreno_bo.c +++ b/src/freedreno/drm/freedreno_bo.c @@ -73,6 +73,7 @@ static struct fd_bo * bo_from_handle(struct fd_device *dev, bo->size = size; bo->handle = handle; bo->iova = bo->funcs->iova(bo); + bo->flags = FD_RELOC_FLAGS_INIT; p_atomic_set(&bo->refcnt, 1); list_inithead(&bo->list); diff --git a/src/freedreno/drm/freedreno_bo_cache.c b/src/freedreno/drm/freedreno_bo_cache.c index b51e8db35ab..ccb98c1c3cf 100644 --- a/src/freedreno/drm/freedreno_bo_cache.c +++ b/src/freedreno/drm/freedreno_bo_cache.c @@ -181,6 +181,7 @@ retry: } p_atomic_set(&bo->refcnt, 1); fd_device_ref(bo->dev); + bo->flags = FD_RELOC_FLAGS_INIT; return bo; } } diff --git a/src/freedreno/drm/freedreno_priv.h b/src/freedreno/drm/freedreno_priv.h index 58d7551f4eb..32ab54fd50c 100644 --- a/src/freedreno/drm/freedreno_priv.h +++ b/src/freedreno/drm/freedreno_priv.h @@ -154,6 +154,7 @@ struct fd_bo { uint32_t handle; uint32_t name; int32_t refcnt; + uint32_t flags; /* flags like FD_RELOC_DUMP to use for relocs to this BO */ uint64_t iova; void *map; const struct fd_bo_funcs *funcs; diff --git a/src/freedreno/drm/freedreno_ringbuffer.h b/src/freedreno/drm/freedreno_ringbuffer.h index b484817e6f7..14b2425abbd 100644 --- a/src/freedreno/drm/freedreno_ringbuffer.h +++ b/src/freedreno/drm/freedreno_ringbuffer.h @@ -172,6 +172,8 @@ struct fd_reloc { uint32_t orhi; /* used for a5xx+ */ }; +#define FD_RELOC_FLAGS_INIT FD_RELOC_READ + /* NOTE: relocs are 2 dwords on a5xx+ */ static inline void @@ -252,21 +254,21 @@ 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); + __out_reloc(ring, bo, offset, or, shift, 0); } static inline void OUT_RELOCW(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_WRITE); + __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_READ | FD_RELOC_DUMP); + __out_reloc(ring, bo, offset, or, shift, FD_RELOC_DUMP); } static inline void diff --git a/src/freedreno/drm/msm_ringbuffer.c b/src/freedreno/drm/msm_ringbuffer.c index 5e033b3d6ac..8a15c559bb6 100644 --- a/src/freedreno/drm/msm_ringbuffer.c +++ b/src/freedreno/drm/msm_ringbuffer.c @@ -162,7 +162,7 @@ append_bo(struct msm_submit *submit, struct fd_bo *bo, uint32_t flags) idx = APPEND(submit, submit_bos); idx = APPEND(submit, bos); - submit->submit_bos[idx].flags = 0; + submit->submit_bos[idx].flags = bo->flags; submit->submit_bos[idx].handle = bo->handle; submit->submit_bos[idx].presumed = 0; @@ -174,8 +174,6 @@ append_bo(struct msm_submit *submit, struct fd_bo *bo, uint32_t flags) msm_bo->idx = idx; } - if (flags & FD_RELOC_READ) - submit->submit_bos[idx].flags |= MSM_SUBMIT_BO_READ; if (flags & FD_RELOC_WRITE) submit->submit_bos[idx].flags |= MSM_SUBMIT_BO_WRITE; @@ -283,8 +281,6 @@ handle_stateobj_relocs(struct msm_submit *submit, struct msm_ringbuffer *ring) struct fd_bo *bo = ring->u.reloc_bos[idx].bo; unsigned flags = 0; - if (ring->u.reloc_bos[idx].flags & MSM_SUBMIT_BO_READ) - flags |= FD_RELOC_READ; if (ring->u.reloc_bos[idx].flags & MSM_SUBMIT_BO_WRITE) flags |= FD_RELOC_WRITE; @@ -347,7 +343,7 @@ msm_submit_flush(struct fd_submit *submit, int in_fence_fd, cmds[i].type = MSM_SUBMIT_CMD_IB_TARGET_BUF; cmds[i].submit_idx = - append_bo(msm_submit, msm_ring->ring_bo, FD_RELOC_READ); + append_bo(msm_submit, msm_ring->ring_bo, 0); cmds[i].submit_offset = msm_ring->offset; cmds[i].size = offset_bytes(ring->cur, ring->start); cmds[i].pad = 0; @@ -363,7 +359,7 @@ msm_submit_flush(struct fd_submit *submit, int in_fence_fd, cmds[i].type = MSM_SUBMIT_CMD_IB_TARGET_BUF; } cmds[i].submit_idx = append_bo(msm_submit, - msm_ring->u.cmds[j]->ring_bo, FD_RELOC_READ); + msm_ring->u.cmds[j]->ring_bo, 0); cmds[i].submit_offset = msm_ring->offset; cmds[i].size = msm_ring->u.cmds[j]->size; cmds[i].pad = 0; @@ -607,7 +603,7 @@ msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, msm_ringbuffer_emit_reloc(ring, &(struct fd_reloc){ .bo = bo, - .flags = FD_RELOC_READ, + .flags = 0, .offset = msm_target->offset, }); diff --git a/src/freedreno/drm/msm_ringbuffer_sp.c b/src/freedreno/drm/msm_ringbuffer_sp.c index 5d8e34cc9c1..ef16ccd18e2 100644 --- a/src/freedreno/drm/msm_ringbuffer_sp.c +++ b/src/freedreno/drm/msm_ringbuffer_sp.c @@ -140,7 +140,7 @@ msm_submit_append_bo(struct msm_submit_sp *submit, struct fd_bo *bo, uint32_t fl idx = APPEND(submit, submit_bos); idx = APPEND(submit, bos); - submit->submit_bos[idx].flags = 0; + submit->submit_bos[idx].flags = bo->flags; submit->submit_bos[idx].handle = bo->handle; submit->submit_bos[idx].presumed = 0; @@ -259,7 +259,7 @@ msm_submit_sp_flush(struct fd_submit *submit, int in_fence_fd, for (unsigned i = 0; i < primary->u.nr_cmds; i++) { cmds[i].type = MSM_SUBMIT_CMD_BUF; cmds[i].submit_idx = msm_submit_append_bo(msm_submit, - primary->u.cmds[i].ring_bo, FD_RELOC_READ | FD_RELOC_DUMP); + primary->u.cmds[i].ring_bo, FD_RELOC_DUMP); cmds[i].submit_offset = primary->offset; cmds[i].size = primary->u.cmds[i].size; cmds[i].pad = 0; @@ -453,7 +453,7 @@ msm_ringbuffer_sp_emit_reloc_ring(struct fd_ringbuffer *ring, msm_ringbuffer_sp_emit_reloc(ring, &(struct fd_reloc){ .bo = bo, - .flags = FD_RELOC_READ | FD_RELOC_DUMP, + .flags = FD_RELOC_DUMP, .offset = msm_target->offset, }); |