diff options
author | Jakob Bornecrantz <[email protected]> | 2010-12-01 05:49:42 +0100 |
---|---|---|
committer | Jakob Bornecrantz <[email protected]> | 2011-01-21 20:53:29 +0100 |
commit | 8af583f6e844ef2d173eb3c5c2e378cd1da018a8 (patch) | |
tree | fb68c0cfffa5d398ac21d89dd5544223f536137d /src/gallium | |
parent | 0c3352b6df7972fd530a901396b392d0293d27ae (diff) |
i915g: Don't (un)map vbuf on each (un)map call
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/i915/i915_prim_vbuf.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c index baebbc7bae3..3473c863970 100644 --- a/src/gallium/drivers/i915/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -181,6 +181,7 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size) struct i915_winsys *iws = i915->iws; if (i915_render->vbo) { + iws->buffer_unmap(iws, i915_render->vbo); iws->buffer_destroy(iws, i915_render->vbo); /* * XXX If buffers where referenced then this should be done in @@ -208,6 +209,7 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size) i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size, I915_NEW_VERTEX); + i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE); } /** @@ -262,16 +264,13 @@ i915_vbuf_render_map_vertices(struct vbuf_render *render) { struct i915_vbuf_render *i915_render = i915_vbuf_render(render); struct i915_context *i915 = i915_render->i915; - struct i915_winsys *iws = i915->iws; 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_render->vbo_sw_offset; #else - (void)iws; return (unsigned char *)i915_render->vbo_ptr; #endif } @@ -288,7 +287,7 @@ i915_vbuf_render_unmap_vertices(struct vbuf_render *render, i915_render->vbo_max_index = max_index; 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); + (void)iws; #else i915_render->map_used_start = i915_render->vertex_size * min_index; i915_render->map_used_end = i915_render->vertex_size * (max_index + 1); @@ -684,6 +683,15 @@ static void i915_vbuf_render_destroy(struct vbuf_render *render) { struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + struct i915_winsys *iws = i915->iws; + + if (i915_render->vbo) { + i915->vbo = NULL; + iws->buffer_unmap(iws, i915_render->vbo); + iws->buffer_destroy(iws, i915_render->vbo); + } + FREE(i915_render); } |