diff options
author | Ilia Mirkin <[email protected]> | 2015-05-25 21:14:13 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2015-05-25 21:45:22 -0400 |
commit | c3d36a2e1a87a4aded662db7a5d320ee7ac3a8b5 (patch) | |
tree | 78db1bfc94d58e2c087c7358b4f312249eb676c4 | |
parent | fdad7dfbdae07b9273fc8f57e63258dbe542c9b5 (diff) |
nv30/draw: allocate vertex buffers in gart
These are only used once per draw, so it makes sense to keep them in
GART. Also take this opportunity to modernize the buffer mapping API
usage.
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Ben Skeggs <[email protected]>
Cc: "10.5 10.6" <[email protected]>
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_draw.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c b/src/gallium/drivers/nouveau/nv30/nv30_draw.c index b0557b0d082..7ae1a1bd1d4 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c @@ -71,12 +71,12 @@ nv30_render_allocate_vertices(struct vbuf_render *render, struct nv30_render *r = nv30_render(render); struct nv30_context *nv30 = r->nv30; - r->length = vertex_size * nr_vertices; + r->length = (uint32_t)vertex_size * (uint32_t)nr_vertices; if (r->offset + r->length >= render->max_vertex_buffer_bytes) { pipe_resource_reference(&r->buffer, NULL); r->buffer = pipe_buffer_create(&nv30->screen->base.base, - PIPE_BIND_VERTEX_BUFFER, 0, + PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STREAM, render->max_vertex_buffer_bytes); if (!r->buffer) return FALSE; @@ -91,10 +91,14 @@ static void * nv30_render_map_vertices(struct vbuf_render *render) { struct nv30_render *r = nv30_render(render); - char *map = pipe_buffer_map(&r->nv30->base.pipe, r->buffer, - PIPE_TRANSFER_WRITE | - PIPE_TRANSFER_UNSYNCHRONIZED, &r->transfer); - return map + r->offset; + char *map = pipe_buffer_map_range( + &r->nv30->base.pipe, r->buffer, + r->offset, r->length, + PIPE_TRANSFER_WRITE | + PIPE_TRANSFER_DISCARD_RANGE, + &r->transfer); + assert(map); + return map; } static void |