OSDN Git Service

freedreno: add flags param for rb creation
authorRob Clark <robclark@freedesktop.org>
Wed, 10 Oct 2018 12:37:23 +0000 (08:37 -0400)
committerRob Clark <robclark@freedesktop.org>
Sat, 13 Oct 2018 21:20:43 +0000 (17:20 -0400)
For now, we want a way for gallium to be able to provide hints for the
upcoming rb suballocation.  But could be useful for other things down
the road.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
freedreno/freedreno-symbol-check
freedreno/freedreno_priv.h
freedreno/freedreno_ringbuffer.c
freedreno/freedreno_ringbuffer.h

index 002a398..3216d48 100755 (executable)
@@ -48,6 +48,7 @@ fd_ringbuffer_emit_reloc_ring_full
 fd_ringbuffer_flush
 fd_ringbuffer_grow
 fd_ringbuffer_new
+fd_ringbuffer_new_flags
 fd_ringbuffer_new_object
 fd_ringbuffer_ref
 fd_ringbuffer_reloc
index 84dbc5c..e997ef0 100644 (file)
@@ -115,10 +115,6 @@ drm_private int fd_bo_cache_free(struct fd_bo_cache *cache, struct fd_bo *bo);
 /* for where @table_lock is already held: */
 drm_private void fd_device_del_locked(struct fd_device *dev);
 
-enum fd_ringbuffer_flags {
-       FD_RINGBUFFER_OBJECT = 0x1,
-};
-
 struct fd_pipe_funcs {
        struct fd_ringbuffer * (*ringbuffer_new)(struct fd_pipe *pipe, uint32_t size,
                        enum fd_ringbuffer_flags flags);
index 80af736..28fcc93 100644 (file)
 #include "freedreno_priv.h"
 #include "freedreno_ringbuffer.h"
 
-static struct fd_ringbuffer *
-ringbuffer_new(struct fd_pipe *pipe, uint32_t size,
+drm_public struct fd_ringbuffer *
+fd_ringbuffer_new_flags(struct fd_pipe *pipe, uint32_t size,
                enum fd_ringbuffer_flags flags)
 {
        struct fd_ringbuffer *ring;
 
+       /* we can't really support "growable" rb's in general for
+        * stateobj's since we need a single gpu addr (ie. can't
+        * do the trick of a chain of IB packets):
+        */
+       if (flags & FD_RINGBUFFER_OBJECT)
+               assert(size);
+
        ring = pipe->funcs->ringbuffer_new(pipe, size, flags);
        if (!ring)
                return NULL;
@@ -55,18 +62,13 @@ ringbuffer_new(struct fd_pipe *pipe, uint32_t size,
 drm_public struct fd_ringbuffer *
 fd_ringbuffer_new(struct fd_pipe *pipe, uint32_t size)
 {
-       return ringbuffer_new(pipe, size, 0);
+       return fd_ringbuffer_new_flags(pipe, size, 0);
 }
 
 drm_public struct fd_ringbuffer *
 fd_ringbuffer_new_object(struct fd_pipe *pipe, uint32_t size)
 {
-       /* we can't really support "growable" rb's in general for
-        * stateobj's since we need a single gpu addr (ie. can't
-        * do the trick of a chain of IB packets):
-        */
-       assert(size);
-       return ringbuffer_new(pipe, size, FD_RINGBUFFER_OBJECT);
+       return fd_ringbuffer_new_flags(pipe, size, FD_RINGBUFFER_OBJECT);
 }
 
 drm_public void fd_ringbuffer_del(struct fd_ringbuffer *ring)
index b2e8024..c5aebaf 100644 (file)
 struct fd_ringbuffer_funcs;
 struct fd_ringmarker;
 
+enum fd_ringbuffer_flags {
+
+       /* Ringbuffer is a "state object", which is potentially reused
+        * many times, rather than being used in one-shot mode linked
+        * to a parent ringbuffer.
+        */
+       FD_RINGBUFFER_OBJECT = 0x1,
+};
+
 struct fd_ringbuffer {
        int size;
        uint32_t *cur, *end, *start, *last_start;
@@ -52,7 +61,7 @@ struct fd_ringbuffer {
         */
        void *user;
 
-       uint32_t flags;
+       enum fd_ringbuffer_flags flags;
 
        /* This is a bit gross, but we can't use atomic_t in exported
         * headers.  OTOH, we don't need the refcnt to be publicly
@@ -70,8 +79,11 @@ struct fd_ringbuffer {
 
 struct fd_ringbuffer * fd_ringbuffer_new(struct fd_pipe *pipe,
                uint32_t size);
+will_be_deprecated
 struct fd_ringbuffer * fd_ringbuffer_new_object(struct fd_pipe *pipe,
                uint32_t size);
+struct fd_ringbuffer * fd_ringbuffer_new_flags(struct fd_pipe *pipe,
+               uint32_t size, enum fd_ringbuffer_flags flags);
 
 struct fd_ringbuffer *fd_ringbuffer_ref(struct fd_ringbuffer *ring);
 void fd_ringbuffer_del(struct fd_ringbuffer *ring);