nouveau: call nouveau_pushbuf directly rather than going through nvws

This commit is contained in:
Ben Skeggs 2009-06-04 15:26:07 +10:00
parent 4795dd5950
commit 04cef8a037
7 changed files with 39 additions and 53 deletions

View file

@ -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

View file

@ -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);
}
}

View file

@ -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 **);

View file

@ -303,7 +303,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
so_emit(nvws, so);
so_ref(NULL, &so);
nvws->push_flush(nvws, 0, NULL);
nouveau_pushbuf_flush(nvws->channel, 0);
screen->pipe.winsys = ws;
screen->pipe.destroy = nv30_screen_destroy;

View file

@ -283,7 +283,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
so_emit(nvws, so);
so_ref(NULL, &so);
nvws->push_flush(nvws, 0, NULL);
nouveau_pushbuf_flush(nvws->channel, 0);
screen->pipe.winsys = ws;
screen->pipe.destroy = nv40_screen_destroy;

View file

@ -400,7 +400,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
so_emit(nvws, so);
so_ref (so, &screen->static_init);
so_ref (NULL, &so);
nvws->push_flush(nvws, 0, NULL);
nouveau_pushbuf_flush(nvws->channel, 0);
return &screen->pipe;
}

View file

@ -30,27 +30,6 @@ nouveau_pipe_grobj_alloc(struct nouveau_winsys *nvws, int grclass,
return 0;
}
static int
nouveau_pipe_push_reloc(struct nouveau_winsys *nvws, void *ptr,
struct pipe_buffer *buf, uint32_t data,
uint32_t flags, uint32_t vor, uint32_t tor)
{
struct nouveau_bo *bo = nouveau_pipe_buffer(buf)->bo;
return nouveau_pushbuf_emit_reloc(nvws->channel, ptr, bo,
data, flags, vor, tor);
}
static int
nouveau_pipe_push_flush(struct nouveau_winsys *nvws, unsigned size,
struct pipe_fence_handle **fence)
{
if (fence)
*fence = NULL;
return nouveau_pushbuf_flush(nvws->channel, size);
}
static struct nouveau_bo *
nouveau_pipe_get_bo(struct pipe_buffer *pb)
{
@ -74,9 +53,6 @@ nouveau_winsys_new(struct pipe_winsys *ws)
nvws->res_alloc = nouveau_resource_alloc;
nvws->res_free = nouveau_resource_free;
nvws->push_reloc = nouveau_pipe_push_reloc;
nvws->push_flush = nouveau_pipe_push_flush;
nvws->grobj_alloc = nouveau_pipe_grobj_alloc;
nvws->grobj_free = nouveau_grobj_free;