diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_screen.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_winsys.h | 25 |
2 files changed, 25 insertions, 13 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index f0d06be9ce..24937217c0 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -223,10 +223,10 @@ nvc0_graph_set_macro(struct nvc0_screen *screen, uint32_t m, unsigned pos, 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); @@ -398,8 +398,7 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) 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); @@ -409,8 +408,7 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) 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); @@ -426,8 +424,7 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) 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); diff --git a/src/gallium/drivers/nvc0/nvc0_winsys.h b/src/gallium/drivers/nvc0/nvc0_winsys.h index 4da30ecb86..34bc536765 100644 --- a/src/gallium/drivers/nvc0/nvc0_winsys.h +++ b/src/gallium/drivers/nvc0/nvc0_winsys.h @@ -8,6 +8,7 @@ #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" @@ -18,10 +19,6 @@ #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 @@ -36,7 +33,7 @@ extern uint64_t nouveau_bo_gpu_address(struct nouveau_bo *); #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); @@ -171,4 +168,22 @@ FIRE_RING(struct nouveau_channel *chan) 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 |