size /= 4;
- BEGIN_RING(chan, RING_ANY(NVC0_GRAPH_MACRO_ID), 2);
+ BEGIN_RING(chan, RING_3D_(NVC0_GRAPH_MACRO_ID), 2);
OUT_RING (chan, (m - 0x3800) / 8);
OUT_RING (chan, pos);
- BEGIN_RING_1I(chan, RING_ANY(NVC0_GRAPH_MACRO_UPLOAD_POS), size + 1);
+ BEGIN_RING_1I(chan, RING_3D_(NVC0_GRAPH_MACRO_UPLOAD_POS), size + 1);
OUT_RING (chan, pos);
OUT_RINGp (chan, data, size);
if (ret)
FAIL_SCREEN_INIT("Error allocating PGRAPH context for M2MF: %d\n", ret);
- BEGIN_RING(chan, RING_MF_(0x0000), 1);
- OUT_RING (chan, screen->m2mf->grclass);
+ BIND_RING (chan, screen->m2mf, NVC0_SUBCH_MF);
BEGIN_RING(chan, RING_MF(NOTIFY_ADDRESS_HIGH), 3);
OUT_RELOCh(chan, screen->fence.bo, 16, NOUVEAU_BO_GART | NOUVEAU_BO_RDWR);
OUT_RELOCl(chan, screen->fence.bo, 16, NOUVEAU_BO_GART | NOUVEAU_BO_RDWR);
if (ret)
FAIL_SCREEN_INIT("Error allocating PGRAPH context for 2D: %d\n", ret);
- BEGIN_RING(chan, RING_2D_(0x0000), 1);
- OUT_RING (chan, screen->eng2d->grclass);
+ BIND_RING (chan, screen->eng2d, NVC0_SUBCH_2D);
BEGIN_RING(chan, RING_2D(OPERATION), 1);
OUT_RING (chan, NVC0_2D_OPERATION_SRCCOPY);
BEGIN_RING(chan, RING_2D(CLIP_ENABLE), 1);
if (ret)
FAIL_SCREEN_INIT("Error allocating PGRAPH context for 3D: %d\n", ret);
- BEGIN_RING(chan, RING_3D_(0x0000), 1);
- OUT_RING (chan, screen->fermi->grclass);
+ BIND_RING (chan, screen->fermi, NVC0_SUBCH_3D);
BEGIN_RING(chan, RING_3D(NOTIFY_ADDRESS_HIGH), 3);
OUT_RELOCh(chan, screen->fence.bo, 32, NOUVEAU_BO_GART | NOUVEAU_BO_RDWR);
OUT_RELOCl(chan, screen->fence.bo, 32, NOUVEAU_BO_GART | NOUVEAU_BO_RDWR);
#include "nouveau/nouveau_bo.h"
#include "nouveau/nouveau_channel.h"
+#include "nouveau/nouveau_grobj.h"
#include "nouveau/nouveau_device.h"
#include "nouveau/nouveau_resource.h"
#include "nouveau/nouveau_reloc.h"
#define NV04_PFIFO_MAX_PACKET_LEN 2047
#endif
-#define SLEEP(us) usleep(us)
-
-extern uint64_t nouveau_bo_gpu_address(struct nouveau_bo *);
-
#define NVC0_SUBCH_3D 1
#define NVC0_SUBCH_2D 2
#define NVC0_SUBCH_MF 3
#define RING_2D_(m) ((NVC0_SUBCH_2D << 13) | ((m) >> 2))
#define RING_MF_(m) ((NVC0_SUBCH_MF << 13) | ((m) >> 2))
-#define RING_ANY(m) ((NVC0_SUBCH_3D << 13) | ((m) >> 2))
+#define RING_GR(gr, m) (((gr)->subc << 13) | ((m) >> 2))
int nouveau_pushbuf_flush(struct nouveau_channel *, unsigned min);
nouveau_pushbuf_flush(chan, 0);
}
+static INLINE void
+BIND_RING(struct nouveau_channel *chan, struct nouveau_grobj *gr, unsigned s)
+{
+ struct nouveau_subchannel *subc = &gr->channel->subc[s];
+
+ assert(s < 8);
+ if (subc->gr) {
+ assert(subc->gr->bound != NOUVEAU_GROBJ_BOUND_EXPLICIT);
+ subc->gr->bound = NOUVEAU_GROBJ_UNBOUND;
+ }
+ subc->gr = gr;
+ subc->gr->subc = s;
+ subc->gr->bound = NOUVEAU_GROBJ_BOUND_EXPLICIT;
+
+ BEGIN_RING(chan, RING_GR(gr, 0x0000), 1);
+ OUT_RING (chan, gr->grclass);
+}
+
#endif