aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2019-07-29 11:48:06 -0700
committerRob Clark <[email protected]>2019-08-02 10:24:14 -0700
commite2bb3e84ab87bab1c1ce3c703bb69fccc82225c3 (patch)
tree351f69e33512c33638859a08b689f21f12e94753
parent9ac23794c9906366a8786f241ec63e1d4cf0cafd (diff)
freedreno/drm: convert ring_pool to child_pool
Worth another couple percent at driver2 Signed-off-by: Rob Clark <[email protected]>
-rw-r--r--src/freedreno/drm/msm_pipe.c3
-rw-r--r--src/freedreno/drm/msm_priv.h7
-rw-r--r--src/freedreno/drm/msm_ringbuffer_sp.c25
3 files changed, 29 insertions, 6 deletions
diff --git a/src/freedreno/drm/msm_pipe.c b/src/freedreno/drm/msm_pipe.c
index 718becbf782..2eef493b5d4 100644
--- a/src/freedreno/drm/msm_pipe.c
+++ b/src/freedreno/drm/msm_pipe.c
@@ -167,6 +167,7 @@ static void msm_pipe_destroy(struct fd_pipe *pipe)
{
struct msm_pipe *msm_pipe = to_msm_pipe(pipe);
close_submitqueue(pipe, msm_pipe->queue_id);
+ msm_pipe_sp_ringpool_init(msm_pipe);
free(msm_pipe);
}
@@ -244,6 +245,8 @@ struct fd_pipe * msm_pipe_new(struct fd_device *dev,
if (open_submitqueue(pipe, prio))
goto fail;
+ msm_pipe_sp_ringpool_init(msm_pipe);
+
return pipe;
fail:
if (pipe)
diff --git a/src/freedreno/drm/msm_priv.h b/src/freedreno/drm/msm_priv.h
index fd4267fa371..172e9870fe5 100644
--- a/src/freedreno/drm/msm_priv.h
+++ b/src/freedreno/drm/msm_priv.h
@@ -29,6 +29,8 @@
#include "freedreno_priv.h"
+#include "util/slab.h"
+
#ifndef __user
# define __user
#endif
@@ -51,6 +53,7 @@ struct msm_pipe {
uint32_t gmem;
uint32_t chip_id;
uint32_t queue_id;
+ struct slab_parent_pool ring_pool;
};
FD_DEFINE_CAST(fd_pipe, msm_pipe);
@@ -63,6 +66,10 @@ struct fd_ringbuffer * msm_ringbuffer_sp_new_object(struct fd_pipe *pipe, uint32
struct fd_submit * msm_submit_new(struct fd_pipe *pipe);
struct fd_submit * msm_submit_sp_new(struct fd_pipe *pipe);
+void msm_pipe_sp_ringpool_init(struct msm_pipe *msm_pipe);
+void msm_pipe_sp_ringpool_fini(struct msm_pipe *msm_pipe);
+
+
struct msm_bo {
struct fd_bo base;
uint64_t offset;
diff --git a/src/freedreno/drm/msm_ringbuffer_sp.c b/src/freedreno/drm/msm_ringbuffer_sp.c
index c87ad512810..af71277072c 100644
--- a/src/freedreno/drm/msm_ringbuffer_sp.c
+++ b/src/freedreno/drm/msm_ringbuffer_sp.c
@@ -51,7 +51,7 @@ struct msm_submit_sp {
/* maps fd_bo to idx in bos table: */
struct hash_table *bo_table;
- struct slab_mempool ring_pool;
+ struct slab_child_pool ring_pool;
struct fd_ringbuffer *primary;
@@ -210,7 +210,7 @@ msm_submit_sp_new_ringbuffer(struct fd_submit *submit, uint32_t size,
struct msm_submit_sp *msm_submit = to_msm_submit_sp(submit);
struct msm_ringbuffer_sp *msm_ring;
- msm_ring = slab_alloc_st(&msm_submit->ring_pool);
+ msm_ring = slab_alloc(&msm_submit->ring_pool);
msm_ring->u.submit = submit;
@@ -317,7 +317,7 @@ msm_submit_sp_destroy(struct fd_submit *submit)
// TODO it would be nice to have a way to debug_assert() if all
// rb's haven't been free'd back to the slab, because that is
// an indication that we are leaking bo's
- slab_destroy(&msm_submit->ring_pool);
+ slab_destroy_child(&msm_submit->ring_pool);
for (unsigned i = 0; i < msm_submit->nr_bos; i++)
fd_bo_del(msm_submit->bos[i]);
@@ -341,8 +341,8 @@ msm_submit_sp_new(struct fd_pipe *pipe)
msm_submit->bo_table = _mesa_hash_table_create(NULL,
_mesa_hash_pointer, _mesa_key_pointer_equal);
- // TODO tune size:
- slab_create(&msm_submit->ring_pool, sizeof(struct msm_ringbuffer_sp), 16);
+
+ slab_create_child(&msm_submit->ring_pool, &to_msm_pipe(pipe)->ring_pool);
submit = &msm_submit->base;
submit->pipe = pipe;
@@ -351,6 +351,19 @@ msm_submit_sp_new(struct fd_pipe *pipe)
return submit;
}
+void
+msm_pipe_sp_ringpool_init(struct msm_pipe *msm_pipe)
+{
+ // TODO tune size:
+ slab_create_parent(&msm_pipe->ring_pool, sizeof(struct msm_ringbuffer_sp), 16);
+}
+
+void
+msm_pipe_sp_ringpool_fini(struct msm_pipe *msm_pipe)
+{
+ if (msm_pipe->ring_pool.num_elements)
+ slab_destroy_parent(&msm_pipe->ring_pool);
+}
static void
finalize_current_cmd(struct fd_ringbuffer *ring)
@@ -511,7 +524,7 @@ msm_ringbuffer_sp_destroy(struct fd_ringbuffer *ring)
fd_bo_del(msm_ring->u.cmds[i].ring_bo);
}
- slab_free_st(&to_msm_submit_sp(submit)->ring_pool, msm_ring);
+ slab_free(&to_msm_submit_sp(submit)->ring_pool, msm_ring);
}
}