From 04cef8a03799aa88ebfa1c391e29f8d2ea020d95 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Jun 2009 15:26:07 +1000 Subject: nouveau: call nouveau_pushbuf directly rather than going through nvws --- src/gallium/drivers/nouveau/nouveau_push.h | 30 ++++++++++++++++++-------- src/gallium/drivers/nouveau/nouveau_stateobj.h | 26 ++++++++++++---------- src/gallium/drivers/nouveau/nouveau_winsys.h | 6 ------ 3 files changed, 36 insertions(+), 26 deletions(-) (limited to 'src/gallium/drivers/nouveau') diff --git a/src/gallium/drivers/nouveau/nouveau_push.h b/src/gallium/drivers/nouveau/nouveau_push.h index 54ef1c1291..afe4668fcd 100644 --- a/src/gallium/drivers/nouveau/nouveau_push.h +++ b/src/gallium/drivers/nouveau/nouveau_push.h @@ -26,25 +26,36 @@ #define BEGIN_RING(obj,mthd,size) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - if (pc->nvws->channel->pushbuf->remaining < ((size) + 1)) \ - pc->nvws->push_flush(pc->nvws, ((size) + 1), NULL); \ + struct nouveau_channel *chan = pc->nvws->channel; \ + if (chan->pushbuf->remaining < ((size) + 1)) \ + nouveau_pushbuf_flush(chan, ((size) + 1)); \ OUT_RING((pc->obj->subc << 13) | ((size) << 18) | (mthd)); \ - pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \ + chan->pushbuf->remaining -= ((size) + 1); \ } while(0) #define BEGIN_RING_NI(obj,mthd,size) do { \ BEGIN_RING(obj, (mthd) | 0x40000000, (size)); \ } while(0) +static inline void +DO_FIRE_RING(struct nouveau_channel *chan, struct pipe_fence_handle **fence) +{ + nouveau_pushbuf_flush(chan, 0); + if (fence) + *fence = NULL; +} + #define FIRE_RING(fence) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - pc->nvws->push_flush(pc->nvws, 0, fence); \ + DO_FIRE_RING(pc->nvws->channel, fence); \ } while(0) #define OUT_RELOC(bo,data,flags,vor,tor) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - pc->nvws->push_reloc(pc->nvws, pc->nvws->channel->pushbuf->cur++, \ - (bo), (data), (flags), (vor), (tor)); \ + struct nouveau_channel *chan = pc->nvws->channel; \ + nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, \ + pc->nvws->get_bo(bo), \ + (data), (flags), (vor), (tor)); \ } while(0) /* Raw data + flags depending on FB/TT buffer */ @@ -72,11 +83,12 @@ /* A reloc which'll recombine into a NV_DMA_METHOD packet header */ #define OUT_RELOCm(bo, flags, obj, mthd, size) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - if (pc->nvws->channel->pushbuf->remaining < ((size) + 1)) \ - pc->nvws->push_flush(pc->nvws->channel, ((size) + 1), NULL); \ + struct nouveau_channel *chan = pc->nvws->channel; \ + if (chan->pushbuf->remaining < ((size) + 1)) \ + nouveau_pushbuf_flush(chan, ((size) + 1)); \ OUT_RELOCd((bo), (pc->obj->subc << 13) | ((size) << 18) | (mthd), \ (flags), 0, 0); \ - pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \ + chan->pushbuf->remaining -= ((size) + 1); \ } while(0) #endif diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h index a54820e851..fbb05db7df 100644 --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h @@ -114,15 +114,16 @@ so_emit(struct nouveau_winsys *nvws, struct nouveau_stateobj *so) nr = so->cur - so->push; if (pb->remaining < nr) - nvws->push_flush(nvws, nr, NULL); + nouveau_pushbuf_flush(nvws->channel, nr); pb->remaining -= nr; memcpy(pb->cur, so->push, nr * 4); for (i = 0; i < so->cur_reloc; i++) { struct nouveau_stateobj_reloc *r = &so->reloc[i]; - nvws->push_reloc(nvws, pb->cur + r->offset, r->bo, - r->data, r->flags, r->vor, r->tor); + nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur + r->offset, + nvws->get_bo(r->bo), r->data, + r->flags, r->vor, r->tor); } pb->cur += nr; } @@ -138,19 +139,22 @@ so_emit_reloc_markers(struct nouveau_winsys *nvws, struct nouveau_stateobj *so) i = so->cur_reloc << 1; if (nvws->channel->pushbuf->remaining < i) - nvws->push_flush(nvws, i, NULL); + nouveau_pushbuf_flush(nvws->channel, i); nvws->channel->pushbuf->remaining -= i; for (i = 0; i < so->cur_reloc; i++) { struct nouveau_stateobj_reloc *r = &so->reloc[i]; - nvws->push_reloc(nvws, pb->cur++, r->bo, r->packet, - (r->flags & (NOUVEAU_BO_VRAM | - NOUVEAU_BO_GART | - NOUVEAU_BO_RDWR)) | - NOUVEAU_BO_DUMMY, 0, 0); - nvws->push_reloc(nvws, pb->cur++, r->bo, r->data, - r->flags | NOUVEAU_BO_DUMMY, r->vor, r->tor); + nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur++, + nvws->get_bo(r->bo), r->packet, + (r->flags & (NOUVEAU_BO_VRAM | + NOUVEAU_BO_GART | + NOUVEAU_BO_RDWR)) | + NOUVEAU_BO_DUMMY, 0, 0); + nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur++, + nvws->get_bo(r->bo), r->data, + r->flags | NOUVEAU_BO_DUMMY, + r->vor, r->tor); } } diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h index ff7dd1c51c..762c3a2a21 100644 --- a/src/gallium/drivers/nouveau/nouveau_winsys.h +++ b/src/gallium/drivers/nouveau/nouveau_winsys.h @@ -34,12 +34,6 @@ struct nouveau_winsys { struct nouveau_resource **); void (*res_free)(struct nouveau_resource **); - int (*push_reloc)(struct nouveau_winsys *, void *ptr, - struct pipe_buffer *, uint32_t data, - uint32_t flags, uint32_t vor, uint32_t tor); - int (*push_flush)(struct nouveau_winsys *, unsigned size, - struct pipe_fence_handle **fence); - int (*grobj_alloc)(struct nouveau_winsys *, int grclass, struct nouveau_grobj **); void (*grobj_free)(struct nouveau_grobj **); -- cgit v1.2.3