summaryrefslogtreecommitdiff
path: root/freedreno
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2018-10-10 08:37:23 -0400
committerRob Clark <robclark@freedesktop.org>2018-10-13 17:20:43 -0400
commitbf001648a92c8f5e10d95322f486a346febd2c09 (patch)
tree437406c55cf4cc13ba57b942e5f8936322ff0dd9 /freedreno
parenta8a006192634d1390acf3a09d4edec27084c8507 (diff)
freedreno: add flags param for rb creation
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>
Diffstat (limited to 'freedreno')
-rwxr-xr-xfreedreno/freedreno-symbol-check1
-rw-r--r--freedreno/freedreno_priv.h4
-rw-r--r--freedreno/freedreno_ringbuffer.c20
-rw-r--r--freedreno/freedreno_ringbuffer.h14
4 files changed, 25 insertions, 14 deletions
diff --git a/freedreno/freedreno-symbol-check b/freedreno/freedreno-symbol-check
index 002a3989..3216d487 100755
--- a/freedreno/freedreno-symbol-check
+++ b/freedreno/freedreno-symbol-check
@@ -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
diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h
index 84dbc5c6..e997ef07 100644
--- a/freedreno/freedreno_priv.h
+++ b/freedreno/freedreno_priv.h
@@ -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);
diff --git a/freedreno/freedreno_ringbuffer.c b/freedreno/freedreno_ringbuffer.c
index 80af736f..28fcc937 100644
--- a/freedreno/freedreno_ringbuffer.c
+++ b/freedreno/freedreno_ringbuffer.c
@@ -32,12 +32,19 @@
#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)
diff --git a/freedreno/freedreno_ringbuffer.h b/freedreno/freedreno_ringbuffer.h
index b2e8024d..c5aebaf2 100644
--- a/freedreno/freedreno_ringbuffer.h
+++ b/freedreno/freedreno_ringbuffer.h
@@ -39,6 +39,15 @@
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);