summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/i915/i915_prim_vbuf.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c
index a7e1d4b45e7..cf065fd51ba 100644
--- a/src/gallium/drivers/i915/i915_prim_vbuf.c
+++ b/src/gallium/drivers/i915/i915_prim_vbuf.c
@@ -52,6 +52,8 @@
#include "i915_state.h"
+#undef VBUF_USE_FIFO
+
/**
* Primitive renderer for i915.
*/
@@ -74,16 +76,19 @@ struct i915_vbuf_render {
/* Stuff for the vbo */
struct intel_buffer *vbo;
- size_t vbo_size;
+ size_t vbo_size; /**< current size of allocated buffer */
+ size_t vbo_alloc_size; /**< minimum buffer size to allocate */
size_t vbo_offset;
void *vbo_ptr;
size_t vbo_max_used;
- /* stuff for the pool */
+#ifdef VBUF_USE_FIFO
+ /* Stuff for the pool */
struct util_fifo *pool_fifo;
unsigned pool_used;
unsigned pool_buffer_size;
boolean pool_not_used;
+#endif
};
@@ -132,18 +137,23 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size)
struct intel_winsys *iws = i915->iws;
if (i915_render->vbo) {
+#ifdef VBUF_USE_FIFO
if (i915_render->pool_not_used)
iws->buffer_destroy(iws, i915_render->vbo);
else
u_fifo_add(i915_render->pool_fifo, i915_render->vbo);
i915_render->vbo = NULL;
+#else
+ iws->buffer_destroy(iws, i915_render->vbo);
+#endif
}
i915->vbo_flushed = 0;
- i915_render->vbo_size = MAX2(size, i915_render->pool_buffer_size);
+ i915_render->vbo_size = MAX2(size, i915_render->vbo_alloc_size);
i915_render->vbo_offset = 0;
+#ifdef VBUF_USE_FIFO
if (i915_render->vbo_size != i915_render->pool_buffer_size) {
i915_render->pool_not_used = TRUE;
i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size, 64,
@@ -158,6 +168,10 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size)
}
u_fifo_pop(i915_render->pool_fifo, (void**)&i915_render->vbo);
}
+#else
+ i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size,
+ 64, INTEL_NEW_VERTEX);
+#endif
}
static boolean
@@ -173,10 +187,11 @@ i915_vbuf_render_allocate_vertices(struct vbuf_render *render,
assert(!i915->vbo);
if (!i915_vbuf_render_reserve(i915_render, size)) {
-
+#ifdef VBUF_USE_FIFO
+ /* incase we flushed reset the number of pool buffers used */
if (i915->vbo_flushed)
i915_render->pool_used = 0;
-
+#endif
i915_vbuf_render_new_buf(i915_render, size);
}
@@ -603,19 +618,19 @@ i915_vbuf_render_create(struct i915_context *i915)
i915_render->vbo = NULL;
i915_render->vbo_size = 0;
i915_render->vbo_offset = 0;
+ i915_render->vbo_alloc_size = i915_render->base.max_vertex_buffer_bytes * 4;
+#ifdef VBUF_USE_POOL
i915_render->pool_used = FALSE;
- i915_render->pool_buffer_size = i915_render->base.max_vertex_buffer_bytes * 4;
+ i915_render->pool_buffer_size = i915_render->vbo_alloc_size;
i915_render->pool_fifo = u_fifo_create(6);
for (i = 0; i < 6; i++)
u_fifo_add(i915_render->pool_fifo,
iws->buffer_create(iws, i915_render->pool_buffer_size, 64,
INTEL_NEW_VERTEX));
-
-#if 0
- /* TODO JB: is this realy needed? */
- i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE);
- iws->buffer_unmap(iws, i915_render->vbo);
+#else
+ (void)i;
+ (void)iws;
#endif
return &i915_render->base;