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/nvc0 | |
parent | fe437882ea2d60e91c244cc95beb4b79c615af49 (diff) |
gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0')
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_context.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c | 14 |
4 files changed, 22 insertions, 22 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c index d0f4da303bb..ef61256816a 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c @@ -62,9 +62,9 @@ nvc0_memory_barrier(struct pipe_context *pipe, unsigned flags) if (flags & PIPE_BARRIER_MAPPED_BUFFER) { for (i = 0; i < nvc0->num_vtxbufs; ++i) { - if (!nvc0->vtxbuf[i].buffer) + if (!nvc0->vtxbuf[i].buffer.resource && !nvc0->vtxbuf[i].is_user_buffer) continue; - if (nvc0->vtxbuf[i].buffer->flags & PIPE_RESOURCE_FLAG_MAP_PERSISTENT) + if (nvc0->vtxbuf[i].buffer.resource->flags & PIPE_RESOURCE_FLAG_MAP_PERSISTENT) nvc0->base.vbo_dirty = true; } @@ -147,7 +147,7 @@ nvc0_context_unreference_resources(struct nvc0_context *nvc0) util_unreference_framebuffer_state(&nvc0->framebuffer); for (i = 0; i < nvc0->num_vtxbufs; ++i) - pipe_resource_reference(&nvc0->vtxbuf[i].buffer, NULL); + pipe_vertex_buffer_unreference(&nvc0->vtxbuf[i]); pipe_resource_reference(&nvc0->idxbuf.buffer, NULL); @@ -260,7 +260,7 @@ nvc0_invalidate_resource_storage(struct nouveau_context *ctx, if (res->target == PIPE_BUFFER) { for (i = 0; i < nvc0->num_vtxbufs; ++i) { - if (nvc0->vtxbuf[i].buffer == res) { + if (nvc0->vtxbuf[i].buffer.resource == res) { nvc0->dirty_3d |= NVC0_NEW_3D_ARRAYS; nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_VTX); if (!--ref) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c index c51c9a7778f..bf33746802c 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c @@ -941,7 +941,7 @@ nvc0_set_vertex_buffers(struct pipe_context *pipe, for (i = 0; i < count; ++i) { unsigned dst_index = start_slot + i; - if (vb[i].user_buffer) { + if (vb[i].is_user_buffer) { nvc0->vbo_user |= 1 << dst_index; if (!vb[i].stride && nvc0->screen->eng3d->oclass < GM107_3D_CLASS) nvc0->constant_vbos |= 1 << dst_index; @@ -952,8 +952,8 @@ nvc0_set_vertex_buffers(struct pipe_context *pipe, nvc0->vbo_user &= ~(1 << dst_index); nvc0->constant_vbos &= ~(1 << dst_index); - if (vb[i].buffer && - vb[i].buffer->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT) + if (vb[i].buffer.resource && + vb[i].buffer.resource->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT) nvc0->vtxbufs_coherent |= (1 << dst_index); else nvc0->vtxbufs_coherent &= ~(1 << dst_index); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c index 9a3eb06bd4b..b42b4685607 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c @@ -176,8 +176,8 @@ nvc0_set_constant_vertex_attrib(struct nvc0_context *nvc0, const unsigned a) uint32_t mode; const struct util_format_description *desc; void *dst; - const void *src = (const uint8_t *)vb->user_buffer + ve->src_offset; - assert(!vb->buffer); + const void *src = (const uint8_t *)vb->buffer.user + ve->src_offset; + assert(vb->is_user_buffer); desc = util_format_description(ve->src_format); @@ -254,7 +254,7 @@ nvc0_update_user_vbufs(struct nvc0_context *nvc0) struct nouveau_bo *bo; const uint32_t bo_flags = NOUVEAU_BO_RD | NOUVEAU_BO_GART; written |= 1 << b; - address[b] = nouveau_scratch_data(&nvc0->base, vb->user_buffer, + address[b] = nouveau_scratch_data(&nvc0->base, vb->buffer.user, base, size, &bo); if (bo) BCTX_REFN_bo(nvc0->bufctx_3d, 3D_VTX_TMP, bo_flags, bo); @@ -289,7 +289,7 @@ nvc0_update_user_vbufs_shared(struct nvc0_context *nvc0) nvc0_user_vbuf_range(nvc0, b, &base, &size); - address = nouveau_scratch_data(&nvc0->base, nvc0->vtxbuf[b].user_buffer, + address = nouveau_scratch_data(&nvc0->base, nvc0->vtxbuf[b].buffer.user, base, size, &bo); if (bo) BCTX_REFN_bo(nvc0->bufctx_3d, 3D_VTX_TMP, bo_flags, bo); @@ -346,9 +346,9 @@ nvc0_validate_vertex_buffers(struct nvc0_context *nvc0) /* address/value set in nvc0_update_user_vbufs */ continue; } - res = nv04_resource(vb->buffer); + res = nv04_resource(vb->buffer.resource); offset = ve->pipe.src_offset + vb->buffer_offset; - limit = vb->buffer->width0 - 1; + limit = vb->buffer.resource->width0 - 1; if (unlikely(ve->pipe.instance_divisor)) { BEGIN_NVC0(push, NVC0_3D(VERTEX_ARRAY_FETCH(i)), 4); @@ -395,12 +395,12 @@ nvc0_validate_vertex_buffers_shared(struct nvc0_context *nvc0) } /* address/value set in nvc0_update_user_vbufs_shared */ continue; - } else if (!vb->buffer) { + } else if (!vb->buffer.resource) { /* there can be holes in the vertex buffer lists */ IMMED_NVC0(push, NVC0_3D(VERTEX_ARRAY_FETCH(b)), 0); continue; } - buf = nv04_resource(vb->buffer); + buf = nv04_resource(vb->buffer.resource); offset = vb->buffer_offset; limit = buf->base.width0 - 1; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c index fd2bcbb961c..e4ccac88c14 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c @@ -69,11 +69,11 @@ nvc0_vertex_configure_translate(struct nvc0_context *nvc0, int32_t index_bias) const uint8_t *map; const struct pipe_vertex_buffer *vb = &nvc0->vtxbuf[i]; - if (likely(!vb->buffer)) - map = (const uint8_t *)vb->user_buffer; + if (likely(vb->is_user_buffer)) + map = (const uint8_t *)vb->buffer.user; else map = nouveau_resource_map_offset(&nvc0->base, - nv04_resource(vb->buffer), vb->buffer_offset, NOUVEAU_BO_RD); + nv04_resource(vb->buffer.resource), vb->buffer_offset, NOUVEAU_BO_RD); if (index_bias && !unlikely(nvc0->vertex->instance_bufs & (1 << i))) map += (intptr_t)index_bias * vb->stride; @@ -101,16 +101,16 @@ nvc0_push_map_edgeflag(struct push_context *ctx, struct nvc0_context *nvc0, unsigned attr = nvc0->vertprog->vp.edgeflag; struct pipe_vertex_element *ve = &nvc0->vertex->element[attr].pipe; struct pipe_vertex_buffer *vb = &nvc0->vtxbuf[ve->vertex_buffer_index]; - struct nv04_resource *buf = nv04_resource(vb->buffer); + struct nv04_resource *buf = nv04_resource(vb->buffer.resource); ctx->edgeflag.stride = vb->stride; ctx->edgeflag.width = util_format_get_blocksize(ve->src_format); - if (buf) { + if (!vb->is_user_buffer) { unsigned offset = vb->buffer_offset + ve->src_offset; ctx->edgeflag.data = nouveau_resource_map_offset(&nvc0->base, buf, offset, NOUVEAU_BO_RD); } else { - ctx->edgeflag.data = (const uint8_t *)vb->user_buffer + ve->src_offset; + ctx->edgeflag.data = (const uint8_t *)vb->buffer.user + ve->src_offset; } if (index_bias) @@ -586,7 +586,7 @@ nvc0_push_vbo(struct nvc0_context *nvc0, const struct pipe_draw_info *info) if (info->indexed) nouveau_resource_unmap(nv04_resource(nvc0->idxbuf.buffer)); for (i = 0; i < nvc0->num_vtxbufs; ++i) - nouveau_resource_unmap(nv04_resource(nvc0->vtxbuf[i].buffer)); + nouveau_resource_unmap(nv04_resource(nvc0->vtxbuf[i].buffer.resource)); NOUVEAU_DRV_STAT(&nvc0->screen->base, draw_calls_fallback_count, 1); } |