diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-05-19 14:50:12 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-05-24 09:36:23 +0100 |
commit | f64ab9e0d97dd9c654b4ae1924e62ef6813d9bb0 (patch) | |
tree | 4a02e0b82b5a26a4d1a5649119c1632cbfe64a89 /src/i830_batchbuffer.c | |
parent | 2b050f330f78d02e7f476e55be29d760271ac61c (diff) |
i915: Move vertices into a vertex buffer object.
In theory this should allow us to pack far more operations into a single
batch buffer, and reduce our overheads.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/i830_batchbuffer.c')
-rw-r--r-- | src/i830_batchbuffer.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c index 80539b33..69961c6b 100644 --- a/src/i830_batchbuffer.c +++ b/src/i830_batchbuffer.c @@ -39,6 +39,26 @@ #define DUMP_BATCHBUFFERS NULL /* "/tmp/i915-batchbuffers.dump" */ +static void intel_end_vertex(intel_screen_private *intel) +{ + if (intel->vertex_bo) { + if (intel->vertex_used) + dri_bo_subdata(intel->vertex_bo, 0, intel->vertex_used*4, intel->vertex_ptr); + + dri_bo_unreference(intel->vertex_bo); + intel->vertex_bo = NULL; + } +} + +void intel_next_vertex(intel_screen_private *intel) +{ + intel_end_vertex(intel); + + intel->vertex_bo = + dri_bo_alloc(intel->bufmgr, "vertex", sizeof (intel->vertex_ptr), 4096); + intel->vertex_used = 0; +} + static void intel_next_batch(ScrnInfoPtr scrn) { intel_screen_private *intel = intel_get_screen_private(scrn); @@ -158,6 +178,7 @@ void intel_batch_submit(ScrnInfoPtr scrn) if (intel->vertex_flush) intel->vertex_flush(intel); + intel_end_vertex(intel); /* Mark the end of the batchbuffer. */ OUT_BATCH(MI_BATCH_BUFFER_END); |