summaryrefslogtreecommitdiffstats
path: root/src/freedreno/drm
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2018-11-28 10:35:32 -0500
committerRob Clark <[email protected]>2018-12-07 13:49:21 -0500
commite779725f0b4bf50ab700cc000ed928b94d21c18f (patch)
treedad154b4674cd35e49dc8b94e94a477f4b101f38 /src/freedreno/drm
parent9f7c6c78bc9d419aebe0baf69e1ef7b9c4f66b80 (diff)
freedreno/drm: fix relocs in nested stateobjs
If we have an reloc from stateobjA to stateobjB, we would previously leave stateobjB's bos out of the submit's bos table. Handle this case by copying into stateobjA's reloc_bos table. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/freedreno/drm')
-rw-r--r--src/freedreno/drm/msm_ringbuffer_sp.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/freedreno/drm/msm_ringbuffer_sp.c b/src/freedreno/drm/msm_ringbuffer_sp.c
index 997ff147659..8e4e4a5a18c 100644
--- a/src/freedreno/drm/msm_ringbuffer_sp.c
+++ b/src/freedreno/drm/msm_ringbuffer_sp.c
@@ -451,12 +451,24 @@ msm_ringbuffer_sp_emit_reloc_ring(struct fd_ringbuffer *ring,
.offset = msm_target->offset,
});
- if ((target->flags & _FD_RINGBUFFER_OBJECT) &&
- !(ring->flags & _FD_RINGBUFFER_OBJECT)) {
+ if (!(target->flags & _FD_RINGBUFFER_OBJECT))
+ return size;
+
+ struct msm_ringbuffer_sp *msm_ring = to_msm_ringbuffer_sp(ring);
+
+ if (ring->flags & _FD_RINGBUFFER_OBJECT) {
+ for (unsigned i = 0; i < msm_target->u.nr_reloc_bos; i++) {
+ unsigned idx = APPEND(&msm_ring->u, reloc_bos);
+
+ msm_ring->u.reloc_bos[idx].bo =
+ fd_bo_ref(msm_target->u.reloc_bos[i].bo);
+ msm_ring->u.reloc_bos[idx].flags =
+ msm_target->u.reloc_bos[i].flags;
+ }
+ } else {
// TODO it would be nice to know whether we have already
// seen this target before. But hopefully we hit the
// append_bo() fast path enough for this to not matter:
- struct msm_ringbuffer_sp *msm_ring = to_msm_ringbuffer_sp(ring);
struct msm_submit_sp *msm_submit = to_msm_submit_sp(msm_ring->u.submit);
for (unsigned i = 0; i < msm_target->u.nr_reloc_bos; i++) {