summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_context.c2
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_draw.c7
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_push.c8
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_resource.c4
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_vbo.c18
-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
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_context.c8
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_state.c6
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c16
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c14
13 files changed, 62 insertions, 60 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;
}
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);
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);
}