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/nouveau_buffer.c20
-rw-r--r--src/gallium/drivers/nouveau/nouveau_buffer.h9
2 files changed, 14 insertions, 15 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 *
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.h b/src/gallium/drivers/nouveau/nouveau_buffer.h
index 19255a3c0fd..3b8ee72e72a 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.h
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.h
@@ -89,11 +89,12 @@ boolean
nouveau_user_buffer_upload(struct nouveau_context *, struct nv04_resource *,
unsigned base, unsigned size);
-/* Copy data to a scratch buffer, update buffer address.
- * Returns the bo the data resides in, or NULL on failure.
+/* Copy data to a scratch buffer and return address & bo the data resides in.
+ * Returns 0 on failure.
*/
-struct nouveau_bo *
+uint64_t
nouveau_scratch_data(struct nouveau_context *,
- struct nv04_resource *, unsigned base, unsigned size);
+ const void *data, unsigned base, unsigned size,
+ struct nouveau_bo **);
#endif