summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i965/brw_batchbuffer.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-11-05 21:09:51 +0000
committerKeith Whitwell <keithw@vmware.com>2009-11-05 21:09:51 +0000
commit3763457892c2d0c654c0eca7585e4d3a863f7714 (patch)
tree0dff2177ce2d0ad0420c46b2dfe9f89cb3a4e546 /src/gallium/drivers/i965/brw_batchbuffer.c
parent963728665aa0d48d4fdbba4276084528f221ee39 (diff)
i965g: propogate map-buffer-range semantics down to winsys
Diffstat (limited to 'src/gallium/drivers/i965/brw_batchbuffer.c')
-rw-r--r--src/gallium/drivers/i965/brw_batchbuffer.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/gallium/drivers/i965/brw_batchbuffer.c b/src/gallium/drivers/i965/brw_batchbuffer.c
index a55be6faab..d725e8b27e 100644
--- a/src/gallium/drivers/i965/brw_batchbuffer.c
+++ b/src/gallium/drivers/i965/brw_batchbuffer.c
@@ -35,7 +35,6 @@
#include "brw_structs.h"
#include "intel_decode.h"
-#define USE_MALLOC_BUFFER 1
#define ALWAYS_EMIT_MI_FLUSH 1
enum pipe_error
@@ -50,14 +49,18 @@ brw_batchbuffer_reset(struct brw_batchbuffer *batch)
if (ret)
return ret;
- if (batch->malloc_buffer)
- batch->map = batch->malloc_buffer;
- else
- batch->map = batch->sws->bo_map(batch->buf,
- BRW_DATA_BATCH_BUFFER,
- GL_TRUE);
-
batch->size = BRW_BATCH_SIZE;
+
+ /* With map_range semantics, the winsys can decide whether to
+ * inject a malloc'ed bounce buffer instead of mapping directly.
+ */
+ batch->map = batch->sws->bo_map(batch->buf,
+ BRW_DATA_BATCH_BUFFER,
+ 0, batch->size,
+ GL_TRUE,
+ GL_TRUE,
+ GL_TRUE);
+
batch->ptr = batch->map;
return PIPE_OK;
}
@@ -68,11 +71,6 @@ brw_batchbuffer_alloc(struct brw_winsys_screen *sws,
{
struct brw_batchbuffer *batch = CALLOC_STRUCT(brw_batchbuffer);
- batch->use_malloc_buffer = USE_MALLOC_BUFFER;
- if (batch->use_malloc_buffer) {
- batch->malloc_buffer = MALLOC(BRW_BATCH_SIZE);
- }
-
batch->sws = sws;
batch->chipset = chipset;
brw_batchbuffer_reset(batch);
@@ -83,11 +81,7 @@ brw_batchbuffer_alloc(struct brw_winsys_screen *sws,
void
brw_batchbuffer_free(struct brw_batchbuffer *batch)
{
- if (batch->malloc_buffer) {
- FREE(batch->malloc_buffer);
- batch->map = NULL;
- }
- else if (batch->map) {
+ if (batch->map) {
batch->sws->bo_unmap(batch->buf);
batch->map = NULL;
}
@@ -134,18 +128,9 @@ _brw_batchbuffer_flush(struct brw_batchbuffer *batch,
batch->ptr += 4;
used = batch->ptr - batch->map;
- if (batch->use_malloc_buffer) {
- batch->sws->bo_subdata(batch->buf,
- BRW_DATA_BATCH_BUFFER,
- 0, used,
- batch->map );
- batch->map = NULL;
- }
- else {
- batch->sws->bo_unmap(batch->buf);
- batch->map = NULL;
- }
-
+ batch->sws->bo_flush_range(batch->buf, 0, used);
+ batch->sws->bo_unmap(batch->buf);
+ batch->map = NULL;
batch->ptr = NULL;
batch->sws->bo_exec(batch->buf, used );