freedreno/drm: Use same-sized "chunks" for growable rings
authorRob Clark <robdclark@chromium.org>
Wed, 9 Nov 2022 23:47:25 +0000 (15:47 -0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 11 Nov 2022 01:27:03 +0000 (01:27 +0000)
Using the same size that we suballoc from for suballoc'd streaming and
long-lived stateobjs should help improve bo cache usage, by making more
of the backing BOs the same size and interchangable.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19656>

src/freedreno/drm/freedreno_priv.h
src/freedreno/drm/freedreno_ringbuffer.h
src/freedreno/drm/freedreno_ringbuffer_sp.c

index ae137fc..a5184dc 100644 (file)
@@ -53,6 +53,8 @@
 
 extern simple_mtx_t table_lock;
 
+#define SUBALLOC_SIZE (32 * 1024)
+
 /*
  * Stupid/simple growable array implementation:
  */
index 0576834..5b45234 100644 (file)
@@ -183,9 +183,6 @@ fd_ringbuffer_grow(struct fd_ringbuffer *ring, uint32_t ndwords)
 {
    assert(ring->funcs->grow); /* unsupported on kgsl */
 
-   /* there is an upper bound on IB size, which appears to be 0x0fffff */
-   ring->size = MIN2(ring->size << 1, 0x0fffff);
-
    ring->funcs->grow(ring, ring->size);
 }
 
index 7df4b39..35fb699 100644 (file)
  * (but still builds a bos table)
  */
 
-#define INIT_SIZE 0x1000
-
-#define SUBALLOC_SIZE (32 * 1024)
-
 /* In the pipe->flush() path, we don't have a util_queue_fence we can wait on,
  * instead use a condition-variable.  Note that pipe->flush() is not expected
  * to be a common/hot path.
@@ -147,7 +143,7 @@ fd_submit_sp_new_ringbuffer(struct fd_submit *submit, uint32_t size,
       fd_submit_suballoc_ring_bo(submit, fd_ring, size);
    } else {
       if (flags & FD_RINGBUFFER_GROWABLE)
-         size = INIT_SIZE;
+         size = SUBALLOC_SIZE;
 
       fd_ring->offset = 0;
       fd_ring->ring_bo = fd_bo_new_ring(submit->pipe->dev, size);