#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 */
/* 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
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;
}
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);
}
}
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 **);
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;
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;
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;
}
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)
{
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;