summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2009-06-04 15:26:07 +1000
committerBen Skeggs <[email protected]>2009-06-05 14:37:00 +1000
commit04cef8a03799aa88ebfa1c391e29f8d2ea020d95 (patch)
tree11d91b5787563aa5cf87706924329dd0a0c85fa0 /src
parent4795dd5950d4dcd7c8d421c8fb4851c193297ba1 (diff)
nouveau: call nouveau_pushbuf directly rather than going through nvws
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_push.h30
-rw-r--r--src/gallium/drivers/nouveau/nouveau_stateobj.h26
-rw-r--r--src/gallium/drivers/nouveau/nouveau_winsys.h6
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c2
-rw-r--r--src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c24
7 files changed, 39 insertions, 53 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_push.h b/src/gallium/drivers/nouveau/nouveau_push.h
index 54ef1c1291e..afe4668fcdf 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 a54820e8512..fbb05db7dfc 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 ff7dd1c51c8..762c3a2a218 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 **);
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index d395c5e1b7f..772eb78566a 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -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;
diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c
index 0d4baefaea3..5030c3ecbc8 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -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;
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index a7981a36157..425ac92d9fd 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -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;
}
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c
index e3175fd7753..2e0148543d0 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c
+++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c
@@ -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;