From e32ec112785d9ea111a9de0087f2f487cadc9051 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 9 Dec 2010 17:41:13 +0100 Subject: [PATCH] nvc0: call grobj_alloc for all used classes Only doing this to notify the DRM that we need a PGRAPH context, nvc0 hardware doesn't use actual grobjs anymore. --- src/gallium/drivers/nvc0/nvc0_screen.c | 29 +++++++++++++++++++++++--- src/gallium/drivers/nvc0/nvc0_screen.h | 4 ++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index 107d50d7f2b..fb100e5233a 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -206,6 +206,10 @@ nvc0_screen_destroy(struct pipe_screen *pscreen) if (screen->tic.entries) FREE(screen->tic.entries); + nouveau_grobj_free(&screen->fermi); + nouveau_grobj_free(&screen->eng2d); + nouveau_grobj_free(&screen->m2mf); + nouveau_screen_fini(&screen->base); FREE(screen); @@ -327,6 +331,13 @@ nvc0_magic_3d_init(struct nouveau_channel *chan) OUT_RING (chan, 0); } +#define FAIL_SCREEN_INIT(str, err) \ + do { \ + NOUVEAU_ERR(str, err); \ + nvc0_screen_destroy(pscreen); \ + return NULL; \ + } while(0) + struct pipe_screen * nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { @@ -383,15 +394,23 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) OUT_RING (chan, 0x0000); } + ret = nouveau_grobj_alloc(chan, 0xbeef9039, NVC0_M2MF, &screen->m2mf); + if (ret) + FAIL_SCREEN_INIT("Error allocating PGRAPH context for M2MF: %d\n", ret); + BEGIN_RING(chan, RING_MF_(0x0000), 1); - OUT_RING (chan, 0x9039); + OUT_RING (chan, screen->m2mf->grclass); 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); OUT_RING (chan, 0); + ret = nouveau_grobj_alloc(chan, 0xbeef902d, NVC0_2D, &screen->eng2d); + if (ret) + FAIL_SCREEN_INIT("Error allocating PGRAPH context for 2D: %d\n", ret); + BEGIN_RING(chan, RING_2D_(0x0000), 1); - OUT_RING (chan, 0x902d); + OUT_RING (chan, screen->eng2d->grclass); BEGIN_RING(chan, RING_2D(OPERATION), 1); OUT_RING (chan, NVC0_2D_OPERATION_SRCCOPY); BEGIN_RING(chan, RING_2D(CLIP_ENABLE), 1); @@ -403,8 +422,12 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) BEGIN_RING(chan, RING_2D_(0x0888), 1); OUT_RING (chan, 1); + ret = nouveau_grobj_alloc(chan, 0xbeef9097, NVC0_3D, &screen->fermi); + if (ret) + FAIL_SCREEN_INIT("Error allocating PGRAPH context for 3D: %d\n", ret); + BEGIN_RING(chan, RING_3D_(0x0000), 1); - OUT_RING (chan, 0x9097); + OUT_RING (chan, screen->fermi->grclass); 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_screen.h b/src/gallium/drivers/nvc0/nvc0_screen.h index 12cea658a5a..8aa77da2bf1 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.h +++ b/src/gallium/drivers/nvc0/nvc0_screen.h @@ -65,6 +65,10 @@ struct nvc0_screen { struct nvc0_mman *mm_GART; struct nvc0_mman *mm_VRAM; struct nvc0_mman *mm_VRAM_fe0; + + struct nouveau_grobj *fermi; + struct nouveau_grobj *eng2d; + struct nouveau_grobj *m2mf; }; static INLINE struct nvc0_screen * -- 2.30.2