aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv40_graph.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv40_graph.c')
-rw-r--r--drivers/gpu/drm/nouveau/nv40_graph.c63
1 files changed, 41 insertions, 22 deletions
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c
index 70d957895cea..b9361e28687c 100644
--- a/drivers/gpu/drm/nouveau/nv40_graph.c
+++ b/drivers/gpu/drm/nouveau/nv40_graph.c
@@ -29,6 +29,8 @@
29#include "nouveau_drv.h" 29#include "nouveau_drv.h"
30#include "nouveau_grctx.h" 30#include "nouveau_grctx.h"
31 31
32static int nv40_graph_register(struct drm_device *);
33
32struct nouveau_channel * 34struct nouveau_channel *
33nv40_graph_channel(struct drm_device *dev) 35nv40_graph_channel(struct drm_device *dev)
34{ 36{
@@ -248,7 +250,7 @@ nv40_graph_init(struct drm_device *dev)
248 struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; 250 struct nouveau_fb_engine *pfb = &dev_priv->engine.fb;
249 struct nouveau_grctx ctx = {}; 251 struct nouveau_grctx ctx = {};
250 uint32_t vramsz, *cp; 252 uint32_t vramsz, *cp;
251 int i, j; 253 int ret, i, j;
252 254
253 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & 255 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) &
254 ~NV_PMC_ENABLE_PGRAPH); 256 ~NV_PMC_ENABLE_PGRAPH);
@@ -272,6 +274,10 @@ nv40_graph_init(struct drm_device *dev)
272 274
273 kfree(cp); 275 kfree(cp);
274 276
277 ret = nv40_graph_register(dev);
278 if (ret)
279 return ret;
280
275 /* No context present currently */ 281 /* No context present currently */
276 nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0x00000000); 282 nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0x00000000);
277 283
@@ -408,25 +414,38 @@ void nv40_graph_takedown(struct drm_device *dev)
408{ 414{
409} 415}
410 416
411struct nouveau_pgraph_object_class nv40_graph_grclass[] = { 417static int
412 { 0x506e, NVOBJ_ENGINE_SW, NULL }, /* nvsw */ 418nv40_graph_register(struct drm_device *dev)
413 { 0x0030, NVOBJ_ENGINE_GR, NULL }, /* null */ 419{
414 { 0x0039, NVOBJ_ENGINE_GR, NULL }, /* m2mf */ 420 struct drm_nouveau_private *dev_priv = dev->dev_private;
415 { 0x004a, NVOBJ_ENGINE_GR, NULL }, /* gdirect */ 421
416 { 0x009f, NVOBJ_ENGINE_GR, NULL }, /* imageblit (nv12) */ 422 if (dev_priv->engine.graph.registered)
417 { 0x008a, NVOBJ_ENGINE_GR, NULL }, /* ifc */ 423 return 0;
418 { 0x0089, NVOBJ_ENGINE_GR, NULL }, /* sifm */
419 { 0x3089, NVOBJ_ENGINE_GR, NULL }, /* sifm (nv40) */
420 { 0x0062, NVOBJ_ENGINE_GR, NULL }, /* surf2d */
421 { 0x3062, NVOBJ_ENGINE_GR, NULL }, /* surf2d (nv40) */
422 { 0x0043, NVOBJ_ENGINE_GR, NULL }, /* rop */
423 { 0x0012, NVOBJ_ENGINE_GR, NULL }, /* beta1 */
424 { 0x0072, NVOBJ_ENGINE_GR, NULL }, /* beta4 */
425 { 0x0019, NVOBJ_ENGINE_GR, NULL }, /* cliprect */
426 { 0x0044, NVOBJ_ENGINE_GR, NULL }, /* pattern */
427 { 0x309e, NVOBJ_ENGINE_GR, NULL }, /* swzsurf */
428 { 0x4097, NVOBJ_ENGINE_GR, NULL }, /* curie (nv40) */
429 { 0x4497, NVOBJ_ENGINE_GR, NULL }, /* curie (nv44) */
430 {}
431};
432 424
425 NVOBJ_CLASS(dev, 0x506e, SW); /* nvsw */
426 NVOBJ_CLASS(dev, 0x0030, GR); /* null */
427 NVOBJ_CLASS(dev, 0x0039, GR); /* m2mf */
428 NVOBJ_CLASS(dev, 0x004a, GR); /* gdirect */
429 NVOBJ_CLASS(dev, 0x009f, GR); /* imageblit (nv12) */
430 NVOBJ_CLASS(dev, 0x008a, GR); /* ifc */
431 NVOBJ_CLASS(dev, 0x0089, GR); /* sifm */
432 NVOBJ_CLASS(dev, 0x3089, GR); /* sifm (nv40) */
433 NVOBJ_CLASS(dev, 0x0062, GR); /* surf2d */
434 NVOBJ_CLASS(dev, 0x3062, GR); /* surf2d (nv40) */
435 NVOBJ_CLASS(dev, 0x0043, GR); /* rop */
436 NVOBJ_CLASS(dev, 0x0012, GR); /* beta1 */
437 NVOBJ_CLASS(dev, 0x0072, GR); /* beta4 */
438 NVOBJ_CLASS(dev, 0x0019, GR); /* cliprect */
439 NVOBJ_CLASS(dev, 0x0044, GR); /* pattern */
440 NVOBJ_CLASS(dev, 0x309e, GR); /* swzsurf */
441
442 /* curie */
443 if (dev_priv->chipset >= 0x60 ||
444 0x00005450 & (1 << (dev_priv->chipset & 0x0f)))
445 NVOBJ_CLASS(dev, 0x4497, GR);
446 else
447 NVOBJ_CLASS(dev, 0x4097, GR);
448
449 dev_priv->engine.graph.registered = true;
450 return 0;
451}