aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv50
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-04-02 14:30:16 +0200
committerMarek Olšák <[email protected]>2017-05-10 19:00:16 +0200
commitc24c3b94ed29ecd99b1101c74c6c4606f9b5580e (patch)
tree81f6966bc59a68d9867693c65d35fae9bb1d9819 /src/gallium/drivers/nouveau/nv50
parentfe437882ea2d60e91c244cc95beb4b79c615af49 (diff)
gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes
Diffstat (limited to 'src/gallium/drivers/nouveau/nv50')
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_context.c8
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_push.c6
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_state.c6
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_vbo.c19
4 files changed, 20 insertions, 19 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c
index bf768bc6db5..d0729276e1d 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_context.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c
@@ -62,9 +62,9 @@ nv50_memory_barrier(struct pipe_context *pipe, unsigned flags)
if (flags & PIPE_BARRIER_MAPPED_BUFFER) {
for (i = 0; i < nv50->num_vtxbufs; ++i) {
- if (!nv50->vtxbuf[i].buffer)
+ if (!nv50->vtxbuf[i].buffer.resource && !nv50->vtxbuf[i].is_user_buffer)
continue;
- if (nv50->vtxbuf[i].buffer->flags & PIPE_RESOURCE_FLAG_MAP_PERSISTENT)
+ if (nv50->vtxbuf[i].buffer.resource->flags & PIPE_RESOURCE_FLAG_MAP_PERSISTENT)
nv50->base.vbo_dirty = true;
}
@@ -144,7 +144,7 @@ nv50_context_unreference_resources(struct nv50_context *nv50)
assert(nv50->num_vtxbufs <= PIPE_MAX_ATTRIBS);
for (i = 0; i < nv50->num_vtxbufs; ++i)
- pipe_resource_reference(&nv50->vtxbuf[i].buffer, NULL);
+ pipe_resource_reference(&nv50->vtxbuf[i].buffer.resource, NULL);
pipe_resource_reference(&nv50->idxbuf.buffer, NULL);
@@ -230,7 +230,7 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
assert(nv50->num_vtxbufs <= PIPE_MAX_ATTRIBS);
for (i = 0; i < nv50->num_vtxbufs; ++i) {
- if (nv50->vtxbuf[i].buffer == res) {
+ if (nv50->vtxbuf[i].buffer.resource == res) {
nv50->dirty_3d |= NV50_NEW_3D_ARRAYS;
nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_3D_VERTEX);
if (!--ref)
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_push.c b/src/gallium/drivers/nouveau/nv50/nv50_push.c
index 6a53ad09768..d3419012e98 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_push.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_push.c
@@ -264,11 +264,11 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info)
const struct pipe_vertex_buffer *vb = &nv50->vtxbuf[i];
const uint8_t *data;
- if (unlikely(vb->buffer))
+ if (unlikely(!vb->is_user_buffer))
data = nouveau_resource_map_offset(&nv50->base,
- nv04_resource(vb->buffer), vb->buffer_offset, NOUVEAU_BO_RD);
+ nv04_resource(vb->buffer.resource), vb->buffer_offset, NOUVEAU_BO_RD);
else
- data = vb->user_buffer;
+ data = vb->buffer.user;
if (apply_bias && likely(!(nv50->vertex->instance_bufs & (1 << i))))
data += (ptrdiff_t)info->index_bias * vb->stride;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c
index 6fa3d2cdc3c..d5af6c9d1ff 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c
@@ -1060,7 +1060,7 @@ nv50_set_vertex_buffers(struct pipe_context *pipe,
for (i = 0; i < count; ++i) {
unsigned dst_index = start_slot + i;
- if (!vb[i].buffer && vb[i].user_buffer) {
+ if (vb[i].is_user_buffer) {
nv50->vbo_user |= 1 << dst_index;
if (!vb[i].stride)
nv50->vbo_constant |= 1 << dst_index;
@@ -1071,8 +1071,8 @@ nv50_set_vertex_buffers(struct pipe_context *pipe,
nv50->vbo_user &= ~(1 << dst_index);
nv50->vbo_constant &= ~(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)
nv50->vtxbufs_coherent |= (1 << dst_index);
else
nv50->vtxbufs_coherent &= ~(1 << dst_index);
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
index 227038e95a5..60970d7603e 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
@@ -141,13 +141,13 @@ nv50_emit_vtxattr(struct nv50_context *nv50, struct pipe_vertex_buffer *vb,
struct pipe_vertex_element *ve, unsigned attr)
{
struct nouveau_pushbuf *push = nv50->base.pushbuf;
- const void *data = (const uint8_t *)vb->user_buffer + ve->src_offset;
+ const void *data = (const uint8_t *)vb->buffer.user + ve->src_offset;
float v[4];
const unsigned nc = util_format_get_nr_components(ve->src_format);
const struct util_format_description *desc =
util_format_description(ve->src_format);
- assert(vb->user_buffer);
+ assert(vb->is_user_buffer);
if (desc->channel[0].pure_integer) {
if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
@@ -200,7 +200,7 @@ nv50_user_vbuf_range(struct nv50_context *nv50, unsigned vbi,
if (unlikely(nv50->vertex->instance_bufs & (1 << vbi))) {
/* TODO: use min and max instance divisor to get a proper range */
*base = 0;
- *size = nv50->vtxbuf[vbi].buffer->width0;
+ *size = nv50->vtxbuf[vbi].buffer.resource->width0;
} else {
/* NOTE: if there are user buffers, we *must* have index bounds */
assert(nv50->vb_elt_limit != ~0);
@@ -227,7 +227,7 @@ nv50_upload_user_buffers(struct nv50_context *nv50,
nv50_user_vbuf_range(nv50, b, &base, &size);
limits[b] = base + size - 1;
- addrs[b] = nouveau_scratch_data(&nv50->base, vb->user_buffer, base, size,
+ addrs[b] = nouveau_scratch_data(&nv50->base, vb->buffer.user, base, size,
&bo);
if (addrs[b])
BCTX_REFN_bo(nv50->bufctx_3d, 3D_VERTEX_TMP, NOUVEAU_BO_GART |
@@ -266,7 +266,7 @@ nv50_update_user_vbufs(struct nv50_context *nv50)
struct nouveau_bo *bo;
const uint32_t bo_flags = NOUVEAU_BO_GART | NOUVEAU_BO_RD;
written |= 1 << b;
- address[b] = nouveau_scratch_data(&nv50->base, vb->user_buffer,
+ address[b] = nouveau_scratch_data(&nv50->base, vb->buffer.user,
base, size, &bo);
if (address[b])
BCTX_REFN_bo(nv50->bufctx_3d, 3D_VERTEX_TMP, bo_flags, bo);
@@ -317,8 +317,9 @@ nv50_vertex_arrays_validate(struct nv50_context *nv50)
/* if vertex buffer was written by GPU - flush VBO cache */
assert(nv50->num_vtxbufs <= PIPE_MAX_ATTRIBS);
for (i = 0; i < nv50->num_vtxbufs; ++i) {
- struct nv04_resource *buf = nv04_resource(nv50->vtxbuf[i].buffer);
- if (buf && buf->status & NOUVEAU_BUFFER_STATUS_GPU_WRITING) {
+ struct nv04_resource *buf = nv04_resource(nv50->vtxbuf[i].buffer.resource);
+ if (!nv50->vtxbuf[i].is_user_buffer &&
+ buf && buf->status & NOUVEAU_BUFFER_STATUS_GPU_WRITING) {
buf->status &= ~NOUVEAU_BUFFER_STATUS_GPU_WRITING;
nv50->base.vbo_dirty = true;
}
@@ -386,12 +387,12 @@ nv50_vertex_arrays_validate(struct nv50_context *nv50)
address = addrs[b] + ve->pipe.src_offset;
limit = addrs[b] + limits[b];
} else
- if (!vb->buffer) {
+ if (!vb->buffer.resource) {
BEGIN_NV04(push, NV50_3D(VERTEX_ARRAY_FETCH(i)), 1);
PUSH_DATA (push, 0);
continue;
} else {
- struct nv04_resource *buf = nv04_resource(vb->buffer);
+ struct nv04_resource *buf = nv04_resource(vb->buffer.resource);
if (!(refd & (1 << b))) {
refd |= 1 << b;
BCTX_REFN(nv50->bufctx_3d, 3D_VERTEX, buf, RD);