freedreno: Optimize duplicate obj-obj ring relocs.

No need to include the same BO multiple times in the long-lived ringbuffer
object's list of relocs to be added to the submit.

Improves non-TC drawoverhead -test 9 (8 tex updates) throughput by 1.4901%
+/- 0.8705% (n=20)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11697>
This commit is contained in:
Emma Anholt
2021-06-24 16:11:59 -07:00
committed by Marge Bot
parent 5c3ca9cb81
commit 10d8e123c5
2 changed files with 16 additions and 9 deletions
+12
View File
@@ -675,6 +675,18 @@ msm_ringbuffer_sp_grow(struct fd_ringbuffer *ring, uint32_t size)
ring->size = size;
}
static inline bool
msm_ringbuffer_references_bo(struct fd_ringbuffer *ring, struct fd_bo *bo)
{
struct msm_ringbuffer_sp *msm_ring = to_msm_ringbuffer_sp(ring);
for (int i = 0; i < msm_ring->u.nr_reloc_bos; i++) {
if (msm_ring->u.reloc_bos[i] == bo)
return true;
}
return false;
}
#define PTRSZ 64
#include "msm_ringbuffer_sp.h"
#undef PTRSZ
+4 -9
View File
@@ -69,14 +69,7 @@ static void X(msm_ringbuffer_sp_emit_reloc_obj)(struct fd_ringbuffer *ring,
* relocs per ringbuffer object is fairly small, so the O(n^2) doesn't
* hurt much.
*/
bool found = false;
for (int i = 0; i < msm_ring->u.nr_reloc_bos; i++) {
if (msm_ring->u.reloc_bos[i] == reloc->bo) {
found = true;
break;
}
}
if (!found) {
if (!msm_ringbuffer_references_bo(ring, reloc->bo)) {
APPEND(&msm_ring->u, reloc_bos, fd_bo_ref(reloc->bo));
}
}
@@ -118,7 +111,9 @@ static uint32_t X(msm_ringbuffer_sp_emit_reloc_ring)(
if (ring->flags & _FD_RINGBUFFER_OBJECT) {
for (unsigned i = 0; i < msm_target->u.nr_reloc_bos; i++) {
APPEND(&msm_ring->u, reloc_bos, fd_bo_ref(msm_target->u.reloc_bos[i]));
struct fd_bo *target_bo = msm_target->u.reloc_bos[i];
if (!msm_ringbuffer_references_bo(ring, target_bo))
APPEND(&msm_ring->u, reloc_bos, fd_bo_ref(target_bo));
}
} else {
// TODO it would be nice to know whether we have already