summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2008-05-27 00:19:41 +0900
committerJosé Fonseca <[email protected]>2008-05-27 00:19:41 +0900
commit35cfd0a4900750f67cba4f64929ff3347f0bd46f (patch)
tree23ff08745c1376d56c623a35440e386a0a5e78e0
parenta0e2955a16a8a04afe7f84b1c8551211542a6fbd (diff)
pipebuffer: Malloc buffer provider.
Simple wrapper around pb_malloc_buffer_create for convenience.
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c33
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr.h9
2 files changed, 41 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
index 9e8244f909b..6c3502eea7f 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
@@ -30,13 +30,14 @@
* Implementation of malloc-based buffers to store data that can't be processed
* by the hardware.
*
- * \author Jos� Fonseca <[email protected]>
+ * \author Jose Fonseca <[email protected]>
*/
#include "pipe/p_debug.h"
#include "pipe/p_util.h"
#include "pb_buffer.h"
+#include "pb_bufmgr.h"
struct malloc_buffer
@@ -125,3 +126,33 @@ pb_malloc_buffer_create(size_t size,
return &buf->base;
}
+
+
+static struct pb_buffer *
+pb_malloc_buffer_create_buffer(struct pb_manager *mgr,
+ size_t size,
+ const struct pb_desc *desc)
+{
+ return pb_malloc_buffer_create(size, desc);
+}
+
+
+static void
+pb_malloc_bufmgr_destroy(struct pb_manager *mgr)
+{
+ /* No-op */
+}
+
+
+static struct pb_manager
+pb_malloc_bufmgr = {
+ pb_malloc_buffer_create_buffer,
+ pb_malloc_bufmgr_destroy
+};
+
+
+struct pb_manager *
+pb_malloc_bufmgr_create(void)
+{
+ return &pb_malloc_bufmgr;
+}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
index f6cc7a525b7..4a922d16c18 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
@@ -79,6 +79,15 @@ struct pb_manager
};
+/**
+ * Malloc buffer provider.
+ *
+ * Simple wrapper around pb_malloc_buffer_create for convenience.
+ */
+struct pb_manager *
+pb_malloc_bufmgr_create(void);
+
+
/**
* Static buffer pool sub-allocator.
*