summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-03-19 00:06:15 +1100
committerBen Skeggs <skeggsb@gmail.com>2008-03-19 22:50:42 +1100
commit9575e35807c89c0b8a745671bc2dcd54d96379ff (patch)
treed05c56b1807634eb81d8d5f1c5ed4f0c41b8d492 /src
parent75e714d476eb573a6e06585341ce693434eb237e (diff)
nouveau: pass nvws to nvws->push_* functions, rather than nouveau_channel*
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_push.h7
-rw-r--r--src/gallium/drivers/nouveau/nouveau_stateobj.h10
-rw-r--r--src/gallium/drivers/nouveau/nouveau_winsys.h4
-rw-r--r--src/gallium/drivers/nv40/nv40_dma.h66
-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/dri/nouveau/nouveau_winsys.c15
7 files changed, 23 insertions, 83 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_push.h b/src/gallium/drivers/nouveau/nouveau_push.h
index c5c5d988d5..225c17744a 100644
--- a/src/gallium/drivers/nouveau/nouveau_push.h
+++ b/src/gallium/drivers/nouveau/nouveau_push.h
@@ -27,7 +27,7 @@
#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->channel, ((size) + 1)); \
+ pc->nvws->push_flush(pc->nvws, ((size) + 1)); \
OUT_RING((pc->obj->subc << 13) | ((size) << 18) | (mthd)); \
pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \
} while(0)
@@ -38,13 +38,12 @@
#define FIRE_RING() do { \
NOUVEAU_PUSH_CONTEXT(pc); \
- pc->nvws->push_flush(pc->nvws->channel, 0); \
+ pc->nvws->push_flush(pc->nvws, 0); \
} while(0)
#define OUT_RELOC(bo,data,flags,vor,tor) do { \
NOUVEAU_PUSH_CONTEXT(pc); \
- pc->nvws->push_reloc(pc->nvws->channel, \
- pc->nvws->channel->pushbuf->cur++, \
+ pc->nvws->push_reloc(pc->nvws, pc->nvws->channel->pushbuf->cur++, \
(bo), (data), (flags), (vor), (tor)); \
} while(0)
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index 439c7e4734..d465223748 100644
--- a/src/gallium/drivers/nouveau/nouveau_stateobj.h
+++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h
@@ -99,14 +99,14 @@ so_emit(struct nouveau_winsys *nvws, struct nouveau_stateobj *so)
nr = so->cur - so->push;
if (pb->remaining < nr)
- nvws->push_flush(nvws->channel, nr);
+ nvws->push_flush(nvws, 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->channel, pb->cur + r->offset, r->bo,
+ nvws->push_reloc(nvws, pb->cur + r->offset, r->bo,
r->data, r->flags, r->vor, r->tor);
}
pb->cur += nr;
@@ -120,17 +120,17 @@ 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->channel, i);
+ nvws->push_flush(nvws, 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->channel, pb->cur++, r->bo, r->packet,
+ nvws->push_reloc(nvws, pb->cur++, r->bo, r->packet,
(r->flags &
(NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)) |
NOUVEAU_BO_DUMMY, 0, 0);
- nvws->push_reloc(nvws->channel, pb->cur++, r->bo, r->data,
+ nvws->push_reloc(nvws, pb->cur++, 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 e4b20478a0..7fa7cc0910 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -24,10 +24,10 @@ struct nouveau_winsys {
struct nouveau_resource **);
void (*res_free)(struct nouveau_resource **);
- int (*push_reloc)(struct nouveau_channel *, void *ptr,
+ 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_channel *, unsigned size);
+ int (*push_flush)(struct nouveau_winsys *, unsigned size);
int (*grobj_alloc)(struct nouveau_winsys *, int grclass,
struct nouveau_grobj **);
diff --git a/src/gallium/drivers/nv40/nv40_dma.h b/src/gallium/drivers/nv40/nv40_dma.h
deleted file mode 100644
index 1fb8267768..0000000000
--- a/src/gallium/drivers/nv40/nv40_dma.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef __NV40_DMA_H__
-#define __NV40_DMA_H__
-
-#include "pipe/nouveau/nouveau_winsys.h"
-
-#define OUT_RING(data) do { \
- (*nv40->nvws->channel->pushbuf->cur++) = (data); \
-} while(0)
-
-#define OUT_RINGp(src,size) do { \
- memcpy(nv40->nvws->channel->pushbuf->cur, (src), (size) * 4); \
- nv40->nvws->channel->pushbuf->cur += (size); \
-} while(0)
-
-#define OUT_RINGf(data) do { \
- union { float v; uint32_t u; } c; \
- c.v = (data); \
- OUT_RING(c.u); \
-} while(0)
-
-#define BEGIN_RING(obj,mthd,size) do { \
- if (nv40->nvws->channel->pushbuf->remaining < ((size) + 1)) \
- nv40->nvws->push_flush(nv40->nvws->channel, ((size) + 1)); \
- OUT_RING((nv40->obj->subc << 13) | ((size) << 18) | (mthd)); \
- nv40->nvws->channel->pushbuf->remaining -= ((size) + 1); \
-} while(0)
-
-#define BEGIN_RING_NI(obj,mthd,size) do { \
- BEGIN_RING(obj, (mthd) | 0x40000000, (size)); \
-} while(0)
-
-#define FIRE_RING() do { \
- nv40->nvws->push_flush(nv40->nvws->channel, 0); \
-} while(0)
-
-#define OUT_RELOC(bo,data,flags,vor,tor) do { \
- nv40->nvws->push_reloc(nv40->nvws->channel, \
- nv40->nvws->channel->pushbuf->cur, \
- (struct nouveau_bo *)(bo), \
- (data), (flags), (vor), (tor)); \
- OUT_RING(0); \
-} while(0)
-
-/* Raw data + flags depending on FB/TT buffer */
-#define OUT_RELOCd(bo,data,flags,vor,tor) do { \
- OUT_RELOC((bo), (data), (flags) | NOUVEAU_BO_OR, (vor), (tor)); \
-} while(0)
-
-/* FB/TT object handle */
-#define OUT_RELOCo(bo,flags) do { \
- OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR, \
- nv40->nvws->channel->vram->handle, \
- nv40->nvws->channel->gart->handle); \
-} while(0)
-
-/* Low 32-bits of offset */
-#define OUT_RELOCl(bo,delta,flags) do { \
- OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_LOW, 0, 0); \
-} while(0)
-
-/* High 32-bits of offset */
-#define OUT_RELOCh(bo,delta,flags) do { \
- OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_HIGH, 0, 0); \
-} while(0)
-
-#endif
diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c
index 268ca83ce0..bf30fbeca1 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -260,7 +260,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws,
so_emit(nvws, so);
so_ref(NULL, &so);
- nvws->push_flush(nvws->channel, 0);
+ nvws->push_flush(nvws, 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 721c6421d1..ff4aca81a5 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -171,7 +171,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws,
so_emit(nvws, so);
so_ref(NULL, &so);
- nvws->push_flush(nvws->channel, 0);
+ nvws->push_flush(nvws, 0);
screen->pipe.winsys = ws;
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_winsys.c b/src/gallium/winsys/dri/nouveau/nouveau_winsys.c
index 6c85aab9f5..bf1afce5d9 100644
--- a/src/gallium/winsys/dri/nouveau/nouveau_winsys.c
+++ b/src/gallium/winsys/dri/nouveau/nouveau_winsys.c
@@ -59,14 +59,21 @@ nouveau_pipe_surface_fill(struct nouveau_winsys *nvws, struct pipe_surface *dst,
}
static int
-nouveau_pipe_emit_reloc(struct nouveau_channel *chan, void *ptr,
+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)
{
- return nouveau_pushbuf_emit_reloc(chan, ptr, nouveau_buffer(buf)->bo,
+ return nouveau_pushbuf_emit_reloc(nvws->channel, ptr,
+ nouveau_buffer(buf)->bo,
data, flags, vor, tor);
}
+static int
+nouveau_pipe_push_flush(struct nouveau_winsys *nvws, unsigned size)
+{
+ return nouveau_pushbuf_flush(nvws->channel, size);
+}
+
struct pipe_context *
nouveau_pipe_create(struct nouveau_context *nv)
{
@@ -114,8 +121,8 @@ nouveau_pipe_create(struct nouveau_context *nv)
nvws->res_alloc = nouveau_resource_alloc;
nvws->res_free = nouveau_resource_free;
- nvws->push_reloc = nouveau_pipe_emit_reloc;
- nvws->push_flush = nouveau_pushbuf_flush;
+ 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;