diff options
author | Marek Olšák <[email protected]> | 2017-04-02 14:30:16 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-05-10 19:00:16 +0200 |
commit | c24c3b94ed29ecd99b1101c74c6c4606f9b5580e (patch) | |
tree | 81f6966bc59a68d9867693c65d35fae9bb1d9819 /src/gallium/drivers/nouveau/nv30 | |
parent | fe437882ea2d60e91c244cc95beb4b79c615af49 (diff) |
gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes
Diffstat (limited to 'src/gallium/drivers/nouveau/nv30')
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_draw.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_push.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_resource.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_vbo.c | 18 |
5 files changed, 20 insertions, 19 deletions
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_context.c b/src/gallium/drivers/nouveau/nv30/nv30_context.c index 4c16e0c41df..cec3cd06b58 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_context.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_context.c @@ -115,7 +115,7 @@ nv30_invalidate_resource_storage(struct nouveau_context *nv, if (res->bind & PIPE_BIND_VERTEX_BUFFER) { for (i = 0; i < nv30->num_vtxbufs; ++i) { - if (nv30->vtxbuf[i].buffer == res) { + if (nv30->vtxbuf[i].buffer.resource == res) { nv30->dirty |= NV30_NEW_ARRAYS; nouveau_bufctx_reset(nv30->bufctx, BUFCTX_VTXBUF); if (!--ref) diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c b/src/gallium/drivers/nouveau/nv30/nv30_draw.c index 10c9f56fad5..28d3de932ff 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c @@ -419,10 +419,11 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) } for (i = 0; i < nv30->num_vtxbufs; i++) { - const void *map = nv30->vtxbuf[i].user_buffer; + const void *map = nv30->vtxbuf[i].is_user_buffer ? + nv30->vtxbuf[i].buffer.user : NULL; if (!map) { - if (nv30->vtxbuf[i].buffer) - map = pipe_buffer_map(pipe, nv30->vtxbuf[i].buffer, + if (nv30->vtxbuf[i].buffer.resource) + map = pipe_buffer_map(pipe, nv30->vtxbuf[i].buffer.resource, PIPE_TRANSFER_UNSYNCHRONIZED | PIPE_TRANSFER_READ, &transfer[i]); } diff --git a/src/gallium/drivers/nouveau/nv30/nv30_push.c b/src/gallium/drivers/nouveau/nv30/nv30_push.c index 67ab0508c17..90adfa06799 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_push.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_push.c @@ -209,9 +209,9 @@ nv30_push_vbo(struct nv30_context *nv30, const struct pipe_draw_info *info) for (i = 0; i < nv30->num_vtxbufs; ++i) { uint8_t *data; struct pipe_vertex_buffer *vb = &nv30->vtxbuf[i]; - struct nv04_resource *res = nv04_resource(vb->buffer); + struct nv04_resource *res = nv04_resource(vb->buffer.resource); - if (!vb->buffer && !vb->user_buffer) { + if (!vb->buffer.resource) { continue; } @@ -281,8 +281,8 @@ nv30_push_vbo(struct nv30_context *nv30, const struct pipe_draw_info *info) nouveau_resource_unmap(nv04_resource(nv30->idxbuf.buffer)); for (i = 0; i < nv30->num_vtxbufs; ++i) { - if (nv30->vtxbuf[i].buffer) { - nouveau_resource_unmap(nv04_resource(nv30->vtxbuf[i].buffer)); + if (nv30->vtxbuf[i].buffer.resource) { + nouveau_resource_unmap(nv04_resource(nv30->vtxbuf[i].buffer.resource)); } } diff --git a/src/gallium/drivers/nouveau/nv30/nv30_resource.c b/src/gallium/drivers/nouveau/nv30/nv30_resource.c index 6238a2384cb..d5842dd8a4e 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_resource.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_resource.c @@ -39,9 +39,9 @@ nv30_memory_barrier(struct pipe_context *pipe, unsigned flags) if (flags & PIPE_BARRIER_MAPPED_BUFFER) { for (i = 0; i < nv30->num_vtxbufs; ++i) { - if (!nv30->vtxbuf[i].buffer) + if (!nv30->vtxbuf[i].buffer.resource) continue; - if (nv30->vtxbuf[i].buffer->flags & PIPE_RESOURCE_FLAG_MAP_PERSISTENT) + if (nv30->vtxbuf[i].buffer.resource->flags & PIPE_RESOURCE_FLAG_MAP_PERSISTENT) nv30->base.vbo_dirty = true; } diff --git a/src/gallium/drivers/nouveau/nv30/nv30_vbo.c b/src/gallium/drivers/nouveau/nv30/nv30_vbo.c index 9338f2ed700..d049b55a90f 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_vbo.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_vbo.c @@ -40,7 +40,7 @@ nv30_emit_vtxattr(struct nv30_context *nv30, struct pipe_vertex_buffer *vb, { const unsigned nc = util_format_get_nr_components(ve->src_format); struct nouveau_pushbuf *push = nv30->base.pushbuf; - struct nv04_resource *res = nv04_resource(vb->buffer); + struct nv04_resource *res = nv04_resource(vb->buffer.resource); const struct util_format_description *desc = util_format_description(ve->src_format); const void *data; @@ -102,12 +102,12 @@ nv30_prevalidate_vbufs(struct nv30_context *nv30) for (i = 0; i < nv30->num_vtxbufs; i++) { vb = &nv30->vtxbuf[i]; - if (!vb->stride || !vb->buffer) /* NOTE: user_buffer not implemented */ + if (!vb->stride || !vb->buffer.resource) /* NOTE: user_buffer not implemented */ continue; - buf = nv04_resource(vb->buffer); + buf = nv04_resource(vb->buffer.resource); /* NOTE: user buffers with temporary storage count as mapped by GPU */ - if (!nouveau_resource_mapped_by_gpu(vb->buffer)) { + if (!nouveau_resource_mapped_by_gpu(vb->buffer.resource)) { if (nv30->vbo_push_hint) { nv30->vbo_fifo = ~0; continue; @@ -138,7 +138,7 @@ nv30_update_user_vbufs(struct nv30_context *nv30) struct pipe_vertex_element *ve = &nv30->vertex->pipe[i]; const int b = ve->vertex_buffer_index; struct pipe_vertex_buffer *vb = &nv30->vtxbuf[b]; - struct nv04_resource *buf = nv04_resource(vb->buffer); + struct nv04_resource *buf = nv04_resource(vb->buffer.resource); if (!(nv30->vbo_user & (1 << b))) continue; @@ -173,7 +173,7 @@ nv30_release_user_vbufs(struct nv30_context *nv30) int i = ffs(vbo_user) - 1; vbo_user &= ~(1 << i); - nouveau_buffer_release_gpu_storage(nv04_resource(nv30->vtxbuf[i].buffer)); + nouveau_buffer_release_gpu_storage(nv04_resource(nv30->vtxbuf[i].buffer.resource)); } nouveau_bufctx_reset(nv30->bufctx, BUFCTX_VTXTMP); @@ -235,7 +235,7 @@ nv30_vbo_validate(struct nv30_context *nv30) vb = &nv30->vtxbuf[ve->vertex_buffer_index]; user = (nv30->vbo_user & (1 << ve->vertex_buffer_index)); - res = nv04_resource(vb->buffer); + res = nv04_resource(vb->buffer.resource); if (nv30->vbo_fifo || unlikely(vb->stride == 0)) { if (!nv30->vbo_fifo) @@ -583,9 +583,9 @@ nv30_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) } for (i = 0; i < nv30->num_vtxbufs && !nv30->base.vbo_dirty; ++i) { - if (!nv30->vtxbuf[i].buffer) + if (!nv30->vtxbuf[i].buffer.resource) continue; - if (nv30->vtxbuf[i].buffer->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT) + if (nv30->vtxbuf[i].buffer.resource->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT) nv30->base.vbo_dirty = true; } |