aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv20_graph.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-10-19 20:39:35 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-12-03 00:06:56 -0500
commitb8c157d3a9a13871742c8a8d3d4598c3791ed5f5 (patch)
tree3ee372c2e8aa1100148f3d6e8232befdb386399a /drivers/gpu/drm/nouveau/nv20_graph.c
parenta6a1a38075661bec189f2bad7912f8861e6ce357 (diff)
drm/nouveau: only expose the object classes that are supported by the chipset
We previously added all the available classes for the entire generation, even though the objects wouldn't work on the hardware. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv20_graph.c')
-rw-r--r--drivers/gpu/drm/nouveau/nv20_graph.c131
1 files changed, 87 insertions, 44 deletions
diff --git a/drivers/gpu/drm/nouveau/nv20_graph.c b/drivers/gpu/drm/nouveau/nv20_graph.c
index 872f8d059694..7720bccb3c98 100644
--- a/drivers/gpu/drm/nouveau/nv20_graph.c
+++ b/drivers/gpu/drm/nouveau/nv20_graph.c
@@ -32,6 +32,9 @@
32#define NV34_GRCTX_SIZE (18140) 32#define NV34_GRCTX_SIZE (18140)
33#define NV35_36_GRCTX_SIZE (22396) 33#define NV35_36_GRCTX_SIZE (22396)
34 34
35static int nv20_graph_register(struct drm_device *);
36static int nv30_graph_register(struct drm_device *);
37
35static void 38static void
36nv20_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx) 39nv20_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
37{ 40{
@@ -572,6 +575,12 @@ nv20_graph_init(struct drm_device *dev)
572 575
573 nv20_graph_rdi(dev); 576 nv20_graph_rdi(dev);
574 577
578 ret = nv20_graph_register(dev);
579 if (ret) {
580 nouveau_gpuobj_ref(NULL, &pgraph->ctx_table);
581 return ret;
582 }
583
575 nv_wr32(dev, NV03_PGRAPH_INTR , 0xFFFFFFFF); 584 nv_wr32(dev, NV03_PGRAPH_INTR , 0xFFFFFFFF);
576 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0xFFFFFFFF); 585 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0xFFFFFFFF);
577 586
@@ -696,6 +705,12 @@ nv30_graph_init(struct drm_device *dev)
696 return ret; 705 return ret;
697 } 706 }
698 707
708 ret = nv30_graph_register(dev);
709 if (ret) {
710 nouveau_gpuobj_ref(NULL, &pgraph->ctx_table);
711 return ret;
712 }
713
699 nv_wr32(dev, NV20_PGRAPH_CHANNEL_CTX_TABLE, 714 nv_wr32(dev, NV20_PGRAPH_CHANNEL_CTX_TABLE,
700 pgraph->ctx_table->pinst >> 4); 715 pgraph->ctx_table->pinst >> 4);
701 716
@@ -756,48 +771,76 @@ nv30_graph_init(struct drm_device *dev)
756 return 0; 771 return 0;
757} 772}
758 773
759struct nouveau_pgraph_object_class nv20_graph_grclass[] = { 774static int
760 { 0x506e, NVOBJ_ENGINE_SW, NULL }, /* nvsw */ 775nv20_graph_register(struct drm_device *dev)
761 { 0x0030, NVOBJ_ENGINE_GR, NULL }, /* null */ 776{
762 { 0x0039, NVOBJ_ENGINE_GR, NULL }, /* m2mf */ 777 struct drm_nouveau_private *dev_priv = dev->dev_private;
763 { 0x004a, NVOBJ_ENGINE_GR, NULL }, /* gdirect */ 778
764 { 0x009f, NVOBJ_ENGINE_GR, NULL }, /* imageblit (nv12) */ 779 if (dev_priv->engine.graph.registered)
765 { 0x008a, NVOBJ_ENGINE_GR, NULL }, /* ifc */ 780 return 0;
766 { 0x0089, NVOBJ_ENGINE_GR, NULL }, /* sifm */
767 { 0x0062, NVOBJ_ENGINE_GR, NULL }, /* surf2d */
768 { 0x0043, NVOBJ_ENGINE_GR, NULL }, /* rop */
769 { 0x0012, NVOBJ_ENGINE_GR, NULL }, /* beta1 */
770 { 0x0072, NVOBJ_ENGINE_GR, NULL }, /* beta4 */
771 { 0x0019, NVOBJ_ENGINE_GR, NULL }, /* cliprect */
772 { 0x0044, NVOBJ_ENGINE_GR, NULL }, /* pattern */
773 { 0x009e, NVOBJ_ENGINE_GR, NULL }, /* swzsurf */
774 { 0x0096, NVOBJ_ENGINE_GR, NULL }, /* celcius */
775 { 0x0097, NVOBJ_ENGINE_GR, NULL }, /* kelvin (nv20) */
776 { 0x0597, NVOBJ_ENGINE_GR, NULL }, /* kelvin (nv25) */
777 {}
778};
779
780struct nouveau_pgraph_object_class nv30_graph_grclass[] = {
781 { 0x506e, NVOBJ_ENGINE_SW, NULL }, /* nvsw */
782 { 0x0030, NVOBJ_ENGINE_GR, NULL }, /* null */
783 { 0x0039, NVOBJ_ENGINE_GR, NULL }, /* m2mf */
784 { 0x004a, NVOBJ_ENGINE_GR, NULL }, /* gdirect */
785 { 0x009f, NVOBJ_ENGINE_GR, NULL }, /* imageblit (nv12) */
786 { 0x008a, NVOBJ_ENGINE_GR, NULL }, /* ifc */
787 { 0x038a, NVOBJ_ENGINE_GR, NULL }, /* ifc (nv30) */
788 { 0x0089, NVOBJ_ENGINE_GR, NULL }, /* sifm */
789 { 0x0389, NVOBJ_ENGINE_GR, NULL }, /* sifm (nv30) */
790 { 0x0062, NVOBJ_ENGINE_GR, NULL }, /* surf2d */
791 { 0x0362, NVOBJ_ENGINE_GR, NULL }, /* surf2d (nv30) */
792 { 0x0043, NVOBJ_ENGINE_GR, NULL }, /* rop */
793 { 0x0012, NVOBJ_ENGINE_GR, NULL }, /* beta1 */
794 { 0x0072, NVOBJ_ENGINE_GR, NULL }, /* beta4 */
795 { 0x0019, NVOBJ_ENGINE_GR, NULL }, /* cliprect */
796 { 0x0044, NVOBJ_ENGINE_GR, NULL }, /* pattern */
797 { 0x039e, NVOBJ_ENGINE_GR, NULL }, /* swzsurf */
798 { 0x0397, NVOBJ_ENGINE_GR, NULL }, /* rankine (nv30) */
799 { 0x0497, NVOBJ_ENGINE_GR, NULL }, /* rankine (nv35) */
800 { 0x0697, NVOBJ_ENGINE_GR, NULL }, /* rankine (nv34) */
801 {}
802};
803 781
782 NVOBJ_CLASS(dev, 0x506e, SW); /* nvsw */
783 NVOBJ_CLASS(dev, 0x0030, GR); /* null */
784 NVOBJ_CLASS(dev, 0x0039, GR); /* m2mf */
785 NVOBJ_CLASS(dev, 0x004a, GR); /* gdirect */
786 NVOBJ_CLASS(dev, 0x009f, GR); /* imageblit (nv12) */
787 NVOBJ_CLASS(dev, 0x008a, GR); /* ifc */
788 NVOBJ_CLASS(dev, 0x0089, GR); /* sifm */
789 NVOBJ_CLASS(dev, 0x0062, GR); /* surf2d */
790 NVOBJ_CLASS(dev, 0x0043, GR); /* rop */
791 NVOBJ_CLASS(dev, 0x0012, GR); /* beta1 */
792 NVOBJ_CLASS(dev, 0x0072, GR); /* beta4 */
793 NVOBJ_CLASS(dev, 0x0019, GR); /* cliprect */
794 NVOBJ_CLASS(dev, 0x0044, GR); /* pattern */
795 NVOBJ_CLASS(dev, 0x009e, GR); /* swzsurf */
796 NVOBJ_CLASS(dev, 0x0096, GR); /* celcius */
797
798 /* kelvin */
799 if (dev_priv->chipset < 0x25)
800 NVOBJ_CLASS(dev, 0x0097, GR);
801 else
802 NVOBJ_CLASS(dev, 0x0597, GR);
803
804 dev_priv->engine.graph.registered = true;
805 return 0;
806}
807
808static int
809nv30_graph_register(struct drm_device *dev)
810{
811 struct drm_nouveau_private *dev_priv = dev->dev_private;
812
813 if (dev_priv->engine.graph.registered)
814 return 0;
815
816 NVOBJ_CLASS(dev, 0x506e, SW); /* nvsw */
817 NVOBJ_CLASS(dev, 0x0030, GR); /* null */
818 NVOBJ_CLASS(dev, 0x0039, GR); /* m2mf */
819 NVOBJ_CLASS(dev, 0x004a, GR); /* gdirect */
820 NVOBJ_CLASS(dev, 0x009f, GR); /* imageblit (nv12) */
821 NVOBJ_CLASS(dev, 0x008a, GR); /* ifc */
822 NVOBJ_CLASS(dev, 0x038a, GR); /* ifc (nv30) */
823 NVOBJ_CLASS(dev, 0x0089, GR); /* sifm */
824 NVOBJ_CLASS(dev, 0x0389, GR); /* sifm (nv30) */
825 NVOBJ_CLASS(dev, 0x0062, GR); /* surf2d */
826 NVOBJ_CLASS(dev, 0x0362, GR); /* surf2d (nv30) */
827 NVOBJ_CLASS(dev, 0x0043, GR); /* rop */
828 NVOBJ_CLASS(dev, 0x0012, GR); /* beta1 */
829 NVOBJ_CLASS(dev, 0x0072, GR); /* beta4 */
830 NVOBJ_CLASS(dev, 0x0019, GR); /* cliprect */
831 NVOBJ_CLASS(dev, 0x0044, GR); /* pattern */
832 NVOBJ_CLASS(dev, 0x039e, GR); /* swzsurf */
833
834 /* rankine */
835 if (0x00000003 & (1 << (dev_priv->chipset & 0x0f)))
836 NVOBJ_CLASS(dev, 0x0397, GR);
837 else
838 if (0x00000010 & (1 << (dev_priv->chipset & 0x0f)))
839 NVOBJ_CLASS(dev, 0x0697, GR);
840 else
841 if (0x000001e0 & (1 << (dev_priv->chipset & 0x0f)))
842 NVOBJ_CLASS(dev, 0x0497, GR);
843
844 dev_priv->engine.graph.registered = true;
845 return 0;
846}