struct pipe_surface *frontbuffer;
/* Hardware context */
- uint32_t *pushbuf;
struct nouveau_channel *channel;
struct nouveau_notifier *sync_notifier;
struct nouveau_grobj *NvNull;
#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 { \
} 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 { \
} 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)
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,
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;
#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;
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 **);
int chipset;
struct nouveau_grobj *curie;
struct nouveau_notifier *sync;
- uint32_t *pushbuf;
/* query objects */
struct nouveau_notifier *query;
#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 { \
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)
int chipset;
struct nouveau_grobj *tesla;
struct nouveau_notifier *sync;
- uint32_t *pushbuf;
};
#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 { \
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)