summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_ringbuffer.h
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2010-01-16 21:11:01 +0000
committerKeith Whitwell <[email protected]>2010-01-16 21:15:55 +0000
commit164fd16cfbc09970676c2e6866e062a5c9b410db (patch)
treebfcc222ce3fb66354cb2acada0b62a69f66a96af /src/gallium/auxiliary/util/u_ringbuffer.h
parentdee52d5bd31c7bd70883fd7fe496445bb49aad1f (diff)
util: add generic ringbuffer utitilty
Diffstat (limited to 'src/gallium/auxiliary/util/u_ringbuffer.h')
-rw-r--r--src/gallium/auxiliary/util/u_ringbuffer.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_ringbuffer.h b/src/gallium/auxiliary/util/u_ringbuffer.h
new file mode 100644
index 00000000000..85f0ad6c1f6
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_ringbuffer.h
@@ -0,0 +1,29 @@
+
+#ifndef UTIL_RINGBUFFER_H
+#define UTIL_RINGBUFFER_H
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_defines.h" /* only for pipe_error! */
+
+/* Generic header
+ */
+struct util_packet {
+ unsigned dwords:8;
+ unsigned data24:24;
+};
+
+struct util_ringbuffer;
+
+struct util_ringbuffer *util_ringbuffer_create( unsigned dwords );
+
+void util_ringbuffer_destroy( struct util_ringbuffer *ring );
+
+void util_ringbuffer_enqueue( struct util_ringbuffer *ring,
+ const struct util_packet *packet );
+
+enum pipe_error util_ringbuffer_dequeue( struct util_ringbuffer *ring,
+ struct util_packet *packet,
+ unsigned max_dwords,
+ boolean wait );
+
+#endif