#include "i915_state.h"
+#undef VBUF_USE_FIFO
+
/**
* Primitive renderer for i915.
*/
/* 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
};
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,
}
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
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);
}
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;