summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/nouveau_winsys/nouveau_context.h1
-rw-r--r--src/mesa/drivers/dri/nouveau_winsys/nouveau_local.h31
-rw-r--r--src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys.c29
-rw-r--r--src/mesa/pipe/nouveau/nouveau_winsys.h12
-rw-r--r--src/mesa/pipe/nv40/nv40_context.h1
-rw-r--r--src/mesa/pipe/nv40/nv40_dma.h34
-rw-r--r--src/mesa/pipe/nv50/nv50_context.h1
-rw-r--r--src/mesa/pipe/nv50/nv50_dma.h34
8 files changed, 62 insertions, 81 deletions
diff --git a/src/mesa/drivers/dri/nouveau_winsys/nouveau_context.h b/src/mesa/drivers/dri/nouveau_winsys/nouveau_context.h
index f201001bd9..2fd3336065 100644
--- a/src/mesa/drivers/dri/nouveau_winsys/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau_winsys/nouveau_context.h
@@ -31,7 +31,6 @@ struct nouveau_context {
struct pipe_surface *frontbuffer;
/* Hardware context */
- uint32_t *pushbuf;
struct nouveau_channel *channel;
struct nouveau_notifier *sync_notifier;
struct nouveau_grobj *NvNull;
diff --git a/src/mesa/drivers/dri/nouveau_winsys/nouveau_local.h b/src/mesa/drivers/dri/nouveau_winsys/nouveau_local.h
index e7111de4dc..a53b699202 100644
--- a/src/mesa/drivers/dri/nouveau_winsys/nouveau_local.h
+++ b/src/mesa/drivers/dri/nouveau_winsys/nouveau_local.h
@@ -24,21 +24,13 @@
#define NOUVEAU_DMA_TIMEOUT 2000
/* Push buffer access macros */
-#define BEGIN_RING(obj,mthd,size) do { \
- nv->pushbuf = nouveau_pipe_dma_beginp(nv->obj, (mthd), (size)); \
-} while(0)
-
-#define BEGIN_RING_GR(obj,mthd,size) do { \
- nv->pushbuf = nouveau_pipe_dma_beginp(obj, (mthd), (size)); \
-} while(0)
-
#define OUT_RING(data) do { \
- (*nv->pushbuf++) = (data); \
+ (*nv->channel->pushbuf->cur++) = (data); \
} while(0)
#define OUT_RINGp(src,size) do { \
- memcpy(nv->pushbuf, (src), (size)<<2); \
- nv->pushbuf += (size); \
+ memcpy(nv->channel->pushbuf->cur, (src), (size)<<2); \
+ nv->channel->pushbuf->cur += (size); \
} while(0)
#define OUT_RINGf(data) do { \
@@ -48,7 +40,18 @@
} while(0)
#define FIRE_RING() do { \
- nouveau_pipe_dma_kickoff(nv->channel); \
+ nouveau_pushbuf_flush(nv->channel, 0); \
+} while(0)
+
+#define BEGIN_RING_GR(obj,mthd,size) do { \
+ if (nv->channel->pushbuf->remaining < ((size) + 1)) \
+ nouveau_pushbuf_flush(nv->channel, ((size) + 1)); \
+ OUT_RING(((obj)->subc << 13) | ((size) << 18) | (mthd)); \
+ nv->channel->pushbuf->remaining -= ((size) + 1); \
+} while(0)
+
+#define BEGIN_RING(obj,mthd,size) do { \
+ BEGIN_RING_GR(nv->obj, (mthd), (size)); \
} while(0)
#define BIND_RING(o,s) do { \
@@ -58,8 +61,8 @@
} while(0)
#define OUT_RELOC(bo,data,flags,vor,tor) do { \
- nouveau_pushbuf_emit_reloc(nv->channel, nv->pushbuf, (void*)(bo), \
- (data), (flags), (vor), (tor)); \
+ nouveau_pushbuf_emit_reloc(nv->channel, nv->channel->pushbuf->cur, \
+ (void*)(bo), (data), (flags), (vor), (tor));\
OUT_RING(0); \
} while(0)
diff --git a/src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys.c b/src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys.c
index 403647ab17..f5e4546100 100644
--- a/src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys.c
+++ b/src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys.c
@@ -34,30 +34,6 @@ nouveau_pipe_grobj_alloc(struct nouveau_winsys *nvws, int grclass,
return 0;
}
-uint32_t *
-nouveau_pipe_dma_beginp(struct nouveau_grobj *grobj, int mthd, int size)
-{
- struct nouveau_channel *chan = grobj->channel;
- uint32_t *pushbuf;
-
- if (chan->pushbuf->remaining < (size + 1)) {
- nouveau_pushbuf_flush(chan, size + 1);
- }
-
- pushbuf = chan->pushbuf->cur;
- chan->pushbuf->cur += (size + 1);
- chan->pushbuf->remaining -= (size + 1);
-
- (*pushbuf++) = ((grobj->subc << 13) | (size << 18) | mthd);
- return pushbuf;
-}
-
-void
-nouveau_pipe_dma_kickoff(struct nouveau_channel *chan)
-{
- nouveau_pushbuf_flush(chan, 0);
-}
-
static int
nouveau_pipe_surface_copy(struct nouveau_winsys *nvws, struct pipe_surface *dst,
unsigned dx, unsigned dy, struct pipe_surface *src,
@@ -126,9 +102,8 @@ nouveau_pipe_create(struct nouveau_context *nv)
nvws->res_alloc = nouveau_resource_alloc;
nvws->res_free = nouveau_resource_free;
- nvws->begin_ring = nouveau_pipe_dma_beginp;
- nvws->out_reloc = nouveau_pushbuf_emit_reloc;
- nvws->fire_ring = nouveau_pipe_dma_kickoff;
+ nvws->push_reloc = nouveau_pushbuf_emit_reloc;
+ nvws->push_flush = nouveau_pushbuf_flush;
nvws->grobj_alloc = nouveau_pipe_grobj_alloc;
nvws->grobj_free = nouveau_grobj_free;
diff --git a/src/mesa/pipe/nouveau/nouveau_winsys.h b/src/mesa/pipe/nouveau/nouveau_winsys.h
index 7b80027c3a..27c991077e 100644
--- a/src/mesa/pipe/nouveau/nouveau_winsys.h
+++ b/src/mesa/pipe/nouveau/nouveau_winsys.h
@@ -11,6 +11,7 @@
#include "pipe/nouveau/nouveau_grobj.h"
#include "pipe/nouveau/nouveau_notifier.h"
#include "pipe/nouveau/nouveau_resource.h"
+#include "pipe/nouveau/nouveau_pushbuf.h"
struct nouveau_winsys {
struct nouveau_context *nv;
@@ -23,13 +24,10 @@ struct nouveau_winsys {
struct nouveau_resource **);
void (*res_free)(struct nouveau_resource **);
- /*XXX: this is crappy, and bound to be slow.. however, it's nice and
- * simple, it'll do for the moment*/
- uint32_t *(*begin_ring)(struct nouveau_grobj *, int mthd, int size);
- int (*out_reloc)(struct nouveau_channel *, void *ptr,
- struct nouveau_bo *, uint32_t data,
- uint32_t flags, uint32_t vor, uint32_t tor);
- void (*fire_ring)(struct nouveau_channel *);
+ int (*push_reloc)(struct nouveau_channel *, void *ptr,
+ struct nouveau_bo *, uint32_t data,
+ uint32_t flags, uint32_t vor, uint32_t tor);
+ int (*push_flush)(struct nouveau_channel *, unsigned size);
int (*grobj_alloc)(struct nouveau_winsys *, int grclass,
struct nouveau_grobj **);
diff --git a/src/mesa/pipe/nv40/nv40_context.h b/src/mesa/pipe/nv40/nv40_context.h
index 5d0bf89680..934f68ef1a 100644
--- a/src/mesa/pipe/nv40/nv40_context.h
+++ b/src/mesa/pipe/nv40/nv40_context.h
@@ -31,7 +31,6 @@ struct nv40_context {
int chipset;
struct nouveau_grobj *curie;
struct nouveau_notifier *sync;
- uint32_t *pushbuf;
/* query objects */
struct nouveau_notifier *query;
diff --git a/src/mesa/pipe/nv40/nv40_dma.h b/src/mesa/pipe/nv40/nv40_dma.h
index 3775ce6e72..1fb8267768 100644
--- a/src/mesa/pipe/nv40/nv40_dma.h
+++ b/src/mesa/pipe/nv40/nv40_dma.h
@@ -3,21 +3,13 @@
#include "pipe/nouveau/nouveau_winsys.h"
-#define BEGIN_RING(obj,mthd,size) do { \
- nv40->pushbuf = nv40->nvws->begin_ring(nv40->obj, (mthd), (size)); \
-} while(0)
-
-#define BEGIN_RING_NI(obj,mthd,size) do { \
- BEGIN_RING(obj, (mthd) | 0x40000000, (size)); \
-} while(0)
-
#define OUT_RING(data) do { \
- (*nv40->pushbuf++) = (data); \
+ (*nv40->nvws->channel->pushbuf->cur++) = (data); \
} while(0)
#define OUT_RINGp(src,size) do { \
- memcpy(nv40->pushbuf, (src), (size) * 4); \
- nv40->pushbuf += (size); \
+ memcpy(nv40->nvws->channel->pushbuf->cur, (src), (size) * 4); \
+ nv40->nvws->channel->pushbuf->cur += (size); \
} while(0)
#define OUT_RINGf(data) do { \
@@ -26,14 +18,26 @@
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->fire_ring(nv40->nvws->channel); \
+ nv40->nvws->push_flush(nv40->nvws->channel, 0); \
} while(0)
#define OUT_RELOC(bo,data,flags,vor,tor) do { \
- nv40->nvws->out_reloc(nv40->nvws->channel, nv40->pushbuf, \
- (struct nouveau_bo *)(bo), \
- (data), (flags), (vor), (tor)); \
+ 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)
diff --git a/src/mesa/pipe/nv50/nv50_context.h b/src/mesa/pipe/nv50/nv50_context.h
index 5be4e5cb1b..b1c4d5b894 100644
--- a/src/mesa/pipe/nv50/nv50_context.h
+++ b/src/mesa/pipe/nv50/nv50_context.h
@@ -26,7 +26,6 @@ struct nv50_context {
int chipset;
struct nouveau_grobj *tesla;
struct nouveau_notifier *sync;
- uint32_t *pushbuf;
};
diff --git a/src/mesa/pipe/nv50/nv50_dma.h b/src/mesa/pipe/nv50/nv50_dma.h
index f8121b61cc..366316df75 100644
--- a/src/mesa/pipe/nv50/nv50_dma.h
+++ b/src/mesa/pipe/nv50/nv50_dma.h
@@ -3,21 +3,13 @@
#include "pipe/nouveau/nouveau_winsys.h"
-#define BEGIN_RING(obj,mthd,size) do { \
- nv50->pushbuf = nv50->nvws->begin_ring(nv50->obj, (mthd), (size)); \
-} while(0)
-
-#define BEGIN_RING_NI(obj,mthd,size) do { \
- BEGIN_RING(obj, (mthd) | 0x40000000, (size)); \
-} while(0)
-
#define OUT_RING(data) do { \
- (*nv50->pushbuf++) = (data); \
+ (*nv50->nvws->channel->pushbuf->cur++) = (data); \
} while(0)
#define OUT_RINGp(src,size) do { \
- memcpy(nv50->pushbuf, (src), (size) * 4); \
- nv50->pushbuf += (size); \
+ memcpy(nv50->nvws->channel->pushbuf->cur, (src), (size) * 4); \
+ nv50->nvws->channel->pushbuf->cur += (size); \
} while(0)
#define OUT_RINGf(data) do { \
@@ -26,14 +18,26 @@
OUT_RING(c.u); \
} while(0)
+#define BEGIN_RING(obj,mthd,size) do { \
+ if (nv50->nvws->channel->pushbuf->remaining < ((size) + 1)) \
+ nv50->nvws->push_flush(nv50->nvws->channel, ((size) + 1)); \
+ OUT_RING((nv50->obj->subc << 13) | ((size) << 18) | (mthd)); \
+ nv50->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 { \
- nv50->nvws->fire_ring(nv50->nvws->channel); \
+ nv50->nvws->push_flush(nv50->nvws->channel, 0); \
} while(0)
#define OUT_RELOC(bo,data,flags,vor,tor) do { \
- nv50->nvws->out_reloc(nv50->nvws->channel, nv50->pushbuf, \
- (struct nouveau_bo *)(bo), \
- (data), (flags), (vor), (tor)); \
+ nv50->nvws->push_reloc(nv50->nvws->channel, \
+ nv50->nvws->channel->pushbuf->cur, \
+ (struct nouveau_bo *)(bo), \
+ (data), (flags), (vor), (tor)); \
OUT_RING(0); \
} while(0)