freedreno/drm: Move ring_pool slab parent to base
authorRob Clark <robdclark@chromium.org>
Mon, 14 Mar 2022 23:56:55 +0000 (16:56 -0700)
committerMarge Bot <emma+marge@anholt.net>
Fri, 25 Mar 2022 02:03:30 +0000 (02:03 +0000)
Prep to move most of sp submit/ringbuffer to something that can be
re-used by virtio backend.

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

src/freedreno/drm/freedreno_priv.h
src/freedreno/drm/msm/msm_pipe.c
src/freedreno/drm/msm/msm_priv.h
src/freedreno/drm/msm/msm_ringbuffer_sp.c

index 155535d..0d8efa6 100644 (file)
@@ -42,6 +42,7 @@
 #include "util/list.h"
 #include "util/log.h"
 #include "util/simple_mtx.h"
+#include "util/slab.h"
 #include "util/u_atomic.h"
 #include "util/u_debug.h"
 #include "util/u_math.h"
@@ -250,6 +251,8 @@ struct fd_pipe {
    struct fd_bo *control_mem;
    volatile struct fd_pipe_control *control;
 
+   struct slab_parent_pool ring_pool;
+
    const struct fd_pipe_funcs *funcs;
 };
 
index 49587fc..babb89b 100644 (file)
@@ -199,7 +199,7 @@ 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);
+   msm_pipe_sp_ringpool_fini(pipe);
    free(msm_pipe);
 }
 
@@ -281,7 +281,7 @@ msm_pipe_new(struct fd_device *dev, enum fd_pipe_id id, uint32_t prio)
    if (open_submitqueue(pipe, prio))
       goto fail;
 
-   msm_pipe_sp_ringpool_init(msm_pipe);
+   msm_pipe_sp_ringpool_init(pipe);
 
    return pipe;
 fail:
index 828ee03..ca2bca8 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "freedreno_priv.h"
 
-#include "util/slab.h"
 #include "util/timespec.h"
 
 #include "pipe/p_defines.h"
@@ -55,7 +54,6 @@ struct msm_pipe {
    uint64_t gmem_base;
    uint32_t gmem;
    uint32_t queue_id;
-   struct slab_parent_pool ring_pool;
 
    /**
     * If we *ever* see an in-fence-fd, assume that userspace is
@@ -77,8 +75,8 @@ 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_flush(struct fd_pipe *pipe, uint32_t fence);
 
-void msm_pipe_sp_ringpool_init(struct msm_pipe *msm_pipe);
-void msm_pipe_sp_ringpool_fini(struct msm_pipe *msm_pipe);
+void msm_pipe_sp_ringpool_init(struct fd_pipe *pipe);
+void msm_pipe_sp_ringpool_fini(struct fd_pipe *pipe);
 
 struct msm_bo {
    struct fd_bo base;
index c87399c..a607f0e 100644 (file)
@@ -617,7 +617,7 @@ msm_submit_sp_new(struct fd_pipe *pipe)
    msm_submit->bo_table = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
                                                   _mesa_key_pointer_equal);
 
-   slab_create_child(&msm_submit->ring_pool, &to_msm_pipe(pipe)->ring_pool);
+   slab_create_child(&msm_submit->ring_pool, &pipe->ring_pool);
 
    submit = &msm_submit->base;
    submit->funcs = &submit_funcs;
@@ -626,18 +626,17 @@ msm_submit_sp_new(struct fd_pipe *pipe)
 }
 
 void
-msm_pipe_sp_ringpool_init(struct msm_pipe *msm_pipe)
+msm_pipe_sp_ringpool_init(struct fd_pipe *pipe)
 {
    // TODO tune size:
-   slab_create_parent(&msm_pipe->ring_pool, sizeof(struct msm_ringbuffer_sp),
-                      16);
+   slab_create_parent(&pipe->ring_pool, sizeof(struct msm_ringbuffer_sp), 16);
 }
 
 void
-msm_pipe_sp_ringpool_fini(struct msm_pipe *msm_pipe)
+msm_pipe_sp_ringpool_fini(struct fd_pipe *pipe)
 {
-   if (msm_pipe->ring_pool.num_elements)
-      slab_destroy_parent(&msm_pipe->ring_pool);
+   if (pipe->ring_pool.num_elements)
+      slab_destroy_parent(&pipe->ring_pool);
 }
 
 static void