summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nouveau/nouveau_buffer.c
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2012-05-16 21:08:37 +0200
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2012-05-17 15:24:58 +0200
commite6caafd9d7fbfcb5906d22be9d6a3c1714e078ac (patch)
tree3e933ed79288c21fa45d3ce697ea5ca8196ee9f5 /src/gallium/drivers/nouveau/nouveau_buffer.c
parentef7bb281292c17b762b57779306e874704c87328 (diff)
nv50,nvc0: handle user vertex buffers
And restructure VBO validation a little in the process.
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_buffer.c')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_buffer.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 936e2bf246a..c396e3c3986 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -604,30 +604,28 @@ nouveau_scratch_more(struct nouveau_context *nv, unsigned min_size)
return ret;
}
-/* Upload data to scratch memory and update buffer address.
- * Returns the bo the data resides in, if successful.
- */
-struct nouveau_bo *
+
+/* Copy data to a scratch buffer and return address & bo the data resides in. */
+uint64_t
nouveau_scratch_data(struct nouveau_context *nv,
- struct nv04_resource *buf, unsigned base, unsigned size)
+ const void *data, unsigned base, unsigned size,
+ struct nouveau_bo **bo)
{
- struct nouveau_bo *bo;
unsigned bgn = MAX2(base, nv->scratch.offset);
unsigned end = bgn + size;
if (end >= nv->scratch.end) {
end = base + size;
if (!nouveau_scratch_more(nv, end))
- return NULL;
+ return 0;
bgn = base;
}
nv->scratch.offset = align(end, 4);
- memcpy(nv->scratch.map + bgn, buf->data + base, size);
+ memcpy(nv->scratch.map + bgn, (const uint8_t *)data + base, size);
- bo = nv->scratch.current;
- buf->address = bo->offset + (bgn - base);
- return bo;
+ *bo = nv->scratch.current;
+ return (*bo)->offset + (bgn - base);
}
void *