summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2007-11-05 18:04:35 +0000
committerJosé Fonseca <[email protected]>2007-11-06 14:49:38 +0000
commitfa1a66d7fc4fd7854de7958a48e4992edd154489 (patch)
treece48a896ebbef8b09ee363774cdfdf86dfb52da6 /src/mesa/pipe
parent4f79dbd5aa6b8a955ac9dcc43cf0852acd89a320 (diff)
Supply buffer usage hints to winsys.
Winsys driver needs some hints in order to allocate the appropriate kind of memory for the buffer.
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/i915simple/i915_prim_vbuf.c4
-rw-r--r--src/mesa/pipe/p_defines.h14
-rw-r--r--src/mesa/pipe/p_winsys.h11
-rw-r--r--src/mesa/pipe/xlib/xm_winsys.c5
4 files changed, 24 insertions, 10 deletions
diff --git a/src/mesa/pipe/i915simple/i915_prim_vbuf.c b/src/mesa/pipe/i915simple/i915_prim_vbuf.c
index 3632adce790..75ca6d6e5ef 100644
--- a/src/mesa/pipe/i915simple/i915_prim_vbuf.c
+++ b/src/mesa/pipe/i915simple/i915_prim_vbuf.c
@@ -376,7 +376,9 @@ static void vbuf_flush_elements( struct draw_stage *stage )
/* FIXME: handle failure */
if(!vbuf->buf)
vbuf->buf = winsys->buffer_create(winsys, 64);
- winsys->buffer_data(winsys, vbuf->buf, VBUF_SIZE, NULL);
+ winsys->buffer_data( winsys, vbuf->buf,
+ VBUF_SIZE, NULL,
+ PIPE_BUFFER_USAGE_VERTEX );
vbuf->vertex_map = winsys->buffer_map(winsys,
vbuf->buf,
PIPE_BUFFER_FLAG_WRITE );
diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h
index ef79716ed91..119ea1bd775 100644
--- a/src/mesa/pipe/p_defines.h
+++ b/src/mesa/pipe/p_defines.h
@@ -168,15 +168,19 @@
/**
- * Buffer flags
+ * Buffer access flags
*/
#define PIPE_BUFFER_FLAG_READ 0x1
#define PIPE_BUFFER_FLAG_WRITE 0x2
-#define PIPE_BUFFER_USE_TEXTURE 0x1
-#define PIPE_BUFFER_USE_VERTEX_BUFFER 0x2
-#define PIPE_BUFFER_USE_INDEX_BUFFER 0x4
-#define PIPE_BUFFER_USE_RENDER_TARGET 0x8
+
+/**
+ * Buffer usage flags
+ */
+#define PIPE_BUFFER_USAGE_PIXEL 0x1
+#define PIPE_BUFFER_USAGE_VERTEX 0x2
+#define PIPE_BUFFER_USAGE_INDEX 0x4
+#define PIPE_BUFFER_USAGE_CONSTANT 0x8
/**
diff --git a/src/mesa/pipe/p_winsys.h b/src/mesa/pipe/p_winsys.h
index 2d4432dbca4..298b5556515 100644
--- a/src/mesa/pipe/p_winsys.h
+++ b/src/mesa/pipe/p_winsys.h
@@ -116,10 +116,17 @@ struct pipe_winsys
struct pipe_buffer_handle **ptr,
struct pipe_buffer_handle *buf );
- /** Create the data store of a buffer and optionally initialize it */
+ /**
+ * Create the data store of a buffer and optionally initialize it.
+ *
+ * usage is a bitmask of PIPE_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This
+ * usage argument is only an optimization hint, not a guarantee, therefore
+ * proper behavior must be observed in all circumstances.
+ */
void (*buffer_data)(struct pipe_winsys *sws,
struct pipe_buffer_handle *buf,
- unsigned size, const void *data );
+ unsigned size, const void *data,
+ unsigned usage);
/** Modify some or all of the data contained in a buffer's data store */
void (*buffer_subdata)(struct pipe_winsys *sws,
diff --git a/src/mesa/pipe/xlib/xm_winsys.c b/src/mesa/pipe/xlib/xm_winsys.c
index 5de811a66fa..45ece8ef554 100644
--- a/src/mesa/pipe/xlib/xm_winsys.c
+++ b/src/mesa/pipe/xlib/xm_winsys.c
@@ -120,7 +120,7 @@ xm_buffer_reference(struct pipe_winsys *pws,
static void
xm_buffer_data(struct pipe_winsys *pws, struct pipe_buffer_handle *buf,
- unsigned size, const void *data )
+ unsigned size, const void *data, unsigned usage )
{
struct xm_buffer *xm_buf = xm_bo(buf);
assert(!xm_buf->userBuffer);
@@ -245,7 +245,8 @@ xm_region_alloc(struct pipe_winsys *winsys,
winsys->buffer_data( winsys,
region->buffer,
region->pitch * cpp * height,
- NULL );
+ NULL,
+ PIPE_BUFFER_USAGE_PIXEL );
return region;
}