diff options
author | Christoph Bumiller <[email protected]> | 2011-10-20 22:42:59 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2011-10-21 23:00:40 +0200 |
commit | d988361ead27ce61615669bd428b04d2aac7af4f (patch) | |
tree | cf038c67142bf4352489fd0a80bb89df76c58c97 /src/gallium/drivers/nv50 | |
parent | 28271fd00dc5dd83f95b5cb890e0ab2c0ff6159d (diff) |
nouveau,nvc0: fix/improve handling of multiple constant buffers
Diffstat (limited to 'src/gallium/drivers/nv50')
-rw-r--r-- | src/gallium/drivers/nv50/nv50_context.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_transfer.c | 33 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index edd79159e72..2bf634a8237 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -53,6 +53,7 @@ #define NV50_BUFCTX_TEXTURES 3 #define NV50_BUFCTX_COUNT 4 +#define NV50_CB_TMP 123 /* fixed constant buffer binding points - low indices for user's constbufs */ #define NV50_CB_PVP 124 #define NV50_CB_PGP 126 @@ -206,6 +207,11 @@ nv50_m2mf_copy_linear(struct nouveau_context *pipe, struct nouveau_bo *dst, unsigned dstoff, unsigned dstdom, struct nouveau_bo *src, unsigned srcoff, unsigned srcdom, unsigned size); +void +nv50_cb_push(struct nouveau_context *nv, + struct nouveau_bo *bo, unsigned domain, + unsigned base, unsigned size, + unsigned offset, unsigned words, const uint32_t *data); /* nv50_vbo.c */ void nv50_draw_vbo(struct pipe_context *, const struct pipe_draw_info *); diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index c86c417c071..6f860e73348 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -364,3 +364,36 @@ nv50_miptree_transfer_unmap(struct pipe_context *pctx, nouveau_bo_unmap(tx->rect[1].bo); } +void +nv50_cb_push(struct nouveau_context *nv, + struct nouveau_bo *bo, unsigned domain, + unsigned base, unsigned size, + unsigned offset, unsigned words, const uint32_t *data) +{ + struct nouveau_channel *chan = nv->screen->channel; + + assert(!(offset & 3)); + size = align(size, 0x100); + + while (words) { + unsigned nr; + + MARK_RING(chan, 24, 2); + nr = AVAIL_RING(chan); + nr = MIN2(nr - 7, words); + nr = MIN2(nr, NV04_PFIFO_MAX_PACKET_LEN - 1); + + BEGIN_RING(chan, RING_3D(CB_DEF_ADDRESS_HIGH), 3); + OUT_RELOCh(chan, bo, base, domain | NOUVEAU_BO_WR); + OUT_RELOCl(chan, bo, base, domain | NOUVEAU_BO_WR); + OUT_RING (chan, (NV50_CB_TMP << 16) | (size & 0xffff)); + BEGIN_RING(chan, RING_3D(CB_ADDR), 1); + OUT_RING (chan, (offset << 6) | NV50_CB_TMP); + BEGIN_RING_NI(chan, RING_3D(CB_DATA(0)), nr); + OUT_RINGp (chan, data, nr); + + words -= nr; + data += nr; + offset += nr * 4; + } +} |