nouveau: pass nvws to nvws->push_* functions, rather than nouveau_channel*
authorBen Skeggs <skeggsb@gmail.com>
Tue, 18 Mar 2008 13:06:15 +0000 (00:06 +1100)
committerBen Skeggs <skeggsb@gmail.com>
Wed, 19 Mar 2008 11:50:42 +0000 (22:50 +1100)
src/gallium/drivers/nouveau/nouveau_push.h
src/gallium/drivers/nouveau/nouveau_stateobj.h
src/gallium/drivers/nouveau/nouveau_winsys.h
src/gallium/drivers/nv40/nv40_dma.h [deleted file]
src/gallium/drivers/nv40/nv40_screen.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/winsys/dri/nouveau/nouveau_winsys.c

index c5c5d988d58cac05b08350ad493314c8d7bf8462..225c17744ad33089c53816dc15bce1d6d5c434f6 100644 (file)
@@ -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)
 
 #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)
 
index 439c7e4734ad3514bfa15576921a4548acc1c8a7..d465223748aaec62cfebca85e6c7f6f1f274794e 100644 (file)
@@ -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);
        }
 }
index e4b20478a0ce1355185bdaaf1ff8e8755b66ddea..7fa7cc0910c4f05ef0f8ee9feb8a0222f2fd0492 100644 (file)
@@ -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 (file)
index 1fb8267..0000000
+++ /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
index 268ca83ce0d7a386c06056346e1948d937590cc3..bf30fbeca19019124ea4843c98acc358c65748ba 100644 (file)
@@ -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;
index 721c6421d1f03b5906740106657fe4eb4ce79236..ff4aca81a5a5c93e18c2387055ae90d3516dfafc 100644 (file)
@@ -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;
 
index 6c85aab9f5f1371a92e5427029a58e46b8a808c0..bf1afce5d9daf6658cb054c8937b0b8d952867be 100644 (file)
@@ -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;