summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i915
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2009-10-07 03:28:04 +0100
committerJakob Bornecrantz <[email protected]>2009-10-07 14:04:48 +0100
commit0f0127f6f9ee6c976c707cd406bf392aea978976 (patch)
tree18b6f95c4252551f60bb8682035d9ab909fd449e /src/gallium/drivers/i915
parentf8ba93aefdf23b88a945d6037cd2e672c99b314c (diff)
i915g: Use buffer write instead of map for lit vertices
Diffstat (limited to 'src/gallium/drivers/i915')
-rw-r--r--src/gallium/drivers/i915/i915_prim_vbuf.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c
index cf065fd51ba..07546c03b2b 100644
--- a/src/gallium/drivers/i915/i915_prim_vbuf.c
+++ b/src/gallium/drivers/i915/i915_prim_vbuf.c
@@ -53,6 +53,7 @@
#undef VBUF_USE_FIFO
+#undef VBUF_MAP_BUFFER
/**
* Primitive renderer for i915.
@@ -82,6 +83,12 @@ struct i915_vbuf_render {
void *vbo_ptr;
size_t vbo_max_used;
+#ifndef VBUF_MAP_BUFFER
+ size_t map_used_start;
+ size_t map_used_end;
+ size_t map_size;
+#endif
+
#ifdef VBUF_USE_FIFO
/* Stuff for the pool */
struct util_fifo *pool_fifo;
@@ -153,6 +160,14 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size)
i915_render->vbo_size = MAX2(size, i915_render->vbo_alloc_size);
i915_render->vbo_offset = 0;
+#ifndef VBUF_MAP_BUFFER
+ if (i915_render->vbo_size > i915_render->map_size) {
+ i915_render->map_size = i915_render->vbo_size;
+ FREE(i915_render->vbo_ptr);
+ i915_render->vbo_ptr = MALLOC(i915_render->map_size);
+ }
+#endif
+
#ifdef VBUF_USE_FIFO
if (i915_render->vbo_size != i915_render->pool_buffer_size) {
i915_render->pool_not_used = TRUE;
@@ -215,9 +230,13 @@ i915_vbuf_render_map_vertices(struct vbuf_render *render)
if (i915->vbo_flushed)
debug_printf("%s bad vbo flush occured stalling on hw\n", __FUNCTION__);
+#ifdef VBUF_MAP_BUFFER
i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE);
-
- return (unsigned char *)i915_render->vbo_ptr + i915->vbo_offset;
+ return (unsigned char *)i915_render->vbo_ptr + i915_render->vbo_offset;
+#else
+ (void)iws;
+ return (unsigned char *)i915_render->vbo_ptr;
+#endif
}
static void
@@ -230,7 +249,17 @@ i915_vbuf_render_unmap_vertices(struct vbuf_render *render,
struct intel_winsys *iws = i915->iws;
i915_render->vbo_max_used = MAX2(i915_render->vbo_max_used, i915_render->vertex_size * (max_index + 1));
+#ifdef VBUF_MAP_BUFFER
iws->buffer_unmap(iws, i915_render->vbo);
+#else
+ i915_render->map_used_start = i915_render->vertex_size * min_index;
+ i915_render->map_used_end = i915_render->vertex_size * (max_index + 1);
+ iws->buffer_write(iws, i915_render->vbo,
+ i915_render->map_used_start + i915_render->vbo_offset,
+ i915_render->map_used_end - i915_render->map_used_start,
+ i915_render->vbo_ptr + i915_render->map_used_start);
+
+#endif
}
static boolean
@@ -614,8 +643,14 @@ i915_vbuf_render_create(struct i915_context *i915)
i915_render->base.release_vertices = i915_vbuf_render_release_vertices;
i915_render->base.destroy = i915_vbuf_render_destroy;
+#ifndef VBUF_MAP_BUFFER
+ i915_render->map_size = 0;
+ i915_render->map_used_start = 0;
+ i915_render->map_used_end = 0;
+#endif
i915_render->vbo = NULL;
+ i915_render->vbo_ptr = NULL;
i915_render->vbo_size = 0;
i915_render->vbo_offset = 0;
i915_render->vbo_alloc_size = i915_render->base.max_vertex_buffer_bytes * 4;