40 nv04_graph_ctx_regs[] = {
119 NV04_PGRAPH_PATT_COLORRAM+0x04,
120 NV04_PGRAPH_PATT_COLORRAM+0x08,
121 NV04_PGRAPH_PATT_COLORRAM+0x0c,
122 NV04_PGRAPH_PATT_COLORRAM+0x10,
123 NV04_PGRAPH_PATT_COLORRAM+0x14,
124 NV04_PGRAPH_PATT_COLORRAM+0x18,
125 NV04_PGRAPH_PATT_COLORRAM+0x1c,
126 NV04_PGRAPH_PATT_COLORRAM+0x20,
127 NV04_PGRAPH_PATT_COLORRAM+0x24,
128 NV04_PGRAPH_PATT_COLORRAM+0x28,
129 NV04_PGRAPH_PATT_COLORRAM+0x2c,
130 NV04_PGRAPH_PATT_COLORRAM+0x30,
131 NV04_PGRAPH_PATT_COLORRAM+0x34,
132 NV04_PGRAPH_PATT_COLORRAM+0x38,
133 NV04_PGRAPH_PATT_COLORRAM+0x3c,
134 NV04_PGRAPH_PATT_COLORRAM+0x40,
135 NV04_PGRAPH_PATT_COLORRAM+0x44,
136 NV04_PGRAPH_PATT_COLORRAM+0x48,
137 NV04_PGRAPH_PATT_COLORRAM+0x4c,
138 NV04_PGRAPH_PATT_COLORRAM+0x50,
139 NV04_PGRAPH_PATT_COLORRAM+0x54,
140 NV04_PGRAPH_PATT_COLORRAM+0x58,
141 NV04_PGRAPH_PATT_COLORRAM+0x5c,
142 NV04_PGRAPH_PATT_COLORRAM+0x60,
143 NV04_PGRAPH_PATT_COLORRAM+0x64,
144 NV04_PGRAPH_PATT_COLORRAM+0x68,
145 NV04_PGRAPH_PATT_COLORRAM+0x6c,
146 NV04_PGRAPH_PATT_COLORRAM+0x70,
147 NV04_PGRAPH_PATT_COLORRAM+0x74,
148 NV04_PGRAPH_PATT_COLORRAM+0x78,
149 NV04_PGRAPH_PATT_COLORRAM+0x7c,
150 NV04_PGRAPH_PATT_COLORRAM+0x80,
151 NV04_PGRAPH_PATT_COLORRAM+0x84,
152 NV04_PGRAPH_PATT_COLORRAM+0x88,
153 NV04_PGRAPH_PATT_COLORRAM+0x8c,
154 NV04_PGRAPH_PATT_COLORRAM+0x90,
155 NV04_PGRAPH_PATT_COLORRAM+0x94,
156 NV04_PGRAPH_PATT_COLORRAM+0x98,
157 NV04_PGRAPH_PATT_COLORRAM+0x9c,
158 NV04_PGRAPH_PATT_COLORRAM+0xa0,
159 NV04_PGRAPH_PATT_COLORRAM+0xa4,
160 NV04_PGRAPH_PATT_COLORRAM+0xa8,
161 NV04_PGRAPH_PATT_COLORRAM+0xac,
162 NV04_PGRAPH_PATT_COLORRAM+0xb0,
163 NV04_PGRAPH_PATT_COLORRAM+0xb4,
164 NV04_PGRAPH_PATT_COLORRAM+0xb8,
165 NV04_PGRAPH_PATT_COLORRAM+0xbc,
166 NV04_PGRAPH_PATT_COLORRAM+0xc0,
167 NV04_PGRAPH_PATT_COLORRAM+0xc4,
168 NV04_PGRAPH_PATT_COLORRAM+0xc8,
169 NV04_PGRAPH_PATT_COLORRAM+0xcc,
170 NV04_PGRAPH_PATT_COLORRAM+0xd0,
171 NV04_PGRAPH_PATT_COLORRAM+0xd4,
172 NV04_PGRAPH_PATT_COLORRAM+0xd8,
173 NV04_PGRAPH_PATT_COLORRAM+0xdc,
174 NV04_PGRAPH_PATT_COLORRAM+0xe0,
175 NV04_PGRAPH_PATT_COLORRAM+0xe4,
176 NV04_PGRAPH_PATT_COLORRAM+0xe8,
177 NV04_PGRAPH_PATT_COLORRAM+0xec,
178 NV04_PGRAPH_PATT_COLORRAM+0xf0,
179 NV04_PGRAPH_PATT_COLORRAM+0xf4,
180 NV04_PGRAPH_PATT_COLORRAM+0xf8,
181 NV04_PGRAPH_PATT_COLORRAM+0xfc,
370 return (
void *)nv_object(chan)->engine;
458 tmp = nv_ro32(
object, 0x00);
461 nv_wo32(
object, 0x00, tmp);
473 ctx1 = nv_ro32(
object, 0x00);
475 op = (ctx1 >> 15) & 7;
477 tmp = nv_ro32(
object, 0x0c);
480 nv_wo32(
object, 0x0c, tmp);
483 if (!(tmp & 0x02000000))
486 if ((
class == 0x1f ||
class == 0x48) && !(tmp & 0x04000000))
496 if (!(tmp & 0x18000000))
501 if (!(tmp & 0x20000000))
507 if (!(tmp & 0x40000000))
512 nv04_graph_set_ctx1(
object, 0x01000000, valid << 24);
519 u32 class = nv_ro32(object, 0) & 0xff;
524 if (data > 2 &&
class < 0x40)
526 nv04_graph_set_ctx1(
object, 0x00038000, data << 15);
528 nv04_graph_set_ctx_val(
object, 0, 0);
534 void *args,
u32 size)
548 nv_wr32(priv, 0x40053c, min);
549 nv_wr32(priv, 0x400544, max);
555 void *args,
u32 size)
559 u32 min = data & 0xffff,
max;
569 nv_wr32(priv, 0x400540, min);
570 nv_wr32(priv, 0x400548, max);
578 u32 inst = *(
u32 *)args << 4;
579 return nv_ro32(imem, inst);
584 void *args,
u32 size)
586 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
588 nv04_graph_set_ctx1(
object, 0x00004000, 0);
589 nv04_graph_set_ctx_val(
object, 0x02000000, 0);
592 nv04_graph_set_ctx1(
object, 0x00004000, 0);
593 nv04_graph_set_ctx_val(
object, 0x02000000, 0x02000000);
601 void *args,
u32 size)
603 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
605 nv04_graph_set_ctx1(
object, 0x00004000, 0);
606 nv04_graph_set_ctx_val(
object, 0x02000000, 0);
609 nv04_graph_set_ctx1(
object, 0x00004000, 0);
610 nv04_graph_set_ctx_val(
object, 0x02000000, 0x02000000);
613 nv04_graph_set_ctx1(
object, 0x00004000, 0x00004000);
614 nv04_graph_set_ctx_val(
object, 0x02000000, 0x02000000);
622 void *args,
u32 size)
624 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
626 nv04_graph_set_ctx_val(
object, 0x08000000, 0);
629 nv04_graph_set_ctx_val(
object, 0x08000000, 0x08000000);
637 void *args,
u32 size)
639 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
641 nv04_graph_set_ctx_val(
object, 0x08000000, 0);
644 nv04_graph_set_ctx_val(
object, 0x08000000, 0x08000000);
652 void *args,
u32 size)
654 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
656 nv04_graph_set_ctx_val(
object, 0x10000000, 0);
659 nv04_graph_set_ctx_val(
object, 0x10000000, 0x10000000);
667 void *args,
u32 size)
669 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
671 nv04_graph_set_ctx_val(
object, 0x20000000, 0);
674 nv04_graph_set_ctx_val(
object, 0x20000000, 0x20000000);
682 void *args,
u32 size)
684 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
686 nv04_graph_set_ctx_val(
object, 0x40000000, 0);
689 nv04_graph_set_ctx_val(
object, 0x40000000, 0x40000000);
697 void *args,
u32 size)
699 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
701 nv04_graph_set_ctx_val(
object, 0x02000000, 0);
704 nv04_graph_set_ctx_val(
object, 0x02000000, 0x02000000);
712 void *args,
u32 size)
714 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
716 nv04_graph_set_ctx_val(
object, 0x04000000, 0);
719 nv04_graph_set_ctx_val(
object, 0x04000000, 0x04000000);
727 void *args,
u32 size)
729 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
731 nv04_graph_set_ctx_val(
object, 0x02000000, 0);
734 nv04_graph_set_ctx_val(
object, 0x02000000, 0x02000000);
742 void *args,
u32 size)
744 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
746 nv04_graph_set_ctx_val(
object, 0x04000000, 0);
749 nv04_graph_set_ctx_val(
object, 0x04000000, 0x04000000);
757 void *args,
u32 size)
759 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
761 nv04_graph_set_ctx1(
object, 0x2000, 0);
764 nv04_graph_set_ctx1(
object, 0x2000, 0x2000);
772 void *args,
u32 size)
774 switch (nv04_graph_mthd_bind_class(
object, args, size)) {
776 nv04_graph_set_ctx1(
object, 0x1000, 0);
782 nv04_graph_set_ctx1(
object, 0x1000, 0x1000);
789 nv03_graph_gdi_omthds[] = {
790 { 0x0184, nv01_graph_mthd_bind_patt },
791 { 0x0188, nv04_graph_mthd_bind_rop },
792 { 0x018c, nv04_graph_mthd_bind_beta1 },
793 { 0x0190, nv04_graph_mthd_bind_surf_dst },
794 { 0x02fc, nv04_graph_mthd_set_operation },
799 nv04_graph_gdi_omthds[] = {
800 { 0x0188, nv04_graph_mthd_bind_patt },
801 { 0x018c, nv04_graph_mthd_bind_rop },
802 { 0x0190, nv04_graph_mthd_bind_beta1 },
803 { 0x0194, nv04_graph_mthd_bind_beta4 },
804 { 0x0198, nv04_graph_mthd_bind_surf2d },
805 { 0x02fc, nv04_graph_mthd_set_operation },
810 nv01_graph_blit_omthds[] = {
811 { 0x0184, nv01_graph_mthd_bind_chroma },
812 { 0x0188, nv01_graph_mthd_bind_clip },
813 { 0x018c, nv01_graph_mthd_bind_patt },
814 { 0x0190, nv04_graph_mthd_bind_rop },
815 { 0x0194, nv04_graph_mthd_bind_beta1 },
816 { 0x0198, nv04_graph_mthd_bind_surf_dst },
817 { 0x019c, nv04_graph_mthd_bind_surf_src },
818 { 0x02fc, nv04_graph_mthd_set_operation },
823 nv04_graph_blit_omthds[] = {
824 { 0x0184, nv01_graph_mthd_bind_chroma },
825 { 0x0188, nv01_graph_mthd_bind_clip },
826 { 0x018c, nv04_graph_mthd_bind_patt },
827 { 0x0190, nv04_graph_mthd_bind_rop },
828 { 0x0194, nv04_graph_mthd_bind_beta1 },
829 { 0x0198, nv04_graph_mthd_bind_beta4 },
830 { 0x019c, nv04_graph_mthd_bind_surf2d },
831 { 0x02fc, nv04_graph_mthd_set_operation },
836 nv04_graph_iifc_omthds[] = {
837 { 0x0188, nv01_graph_mthd_bind_chroma },
838 { 0x018c, nv01_graph_mthd_bind_clip },
839 { 0x0190, nv04_graph_mthd_bind_patt },
840 { 0x0194, nv04_graph_mthd_bind_rop },
841 { 0x0198, nv04_graph_mthd_bind_beta1 },
842 { 0x019c, nv04_graph_mthd_bind_beta4 },
843 { 0x01a0, nv04_graph_mthd_bind_surf2d_swzsurf },
844 { 0x03e4, nv04_graph_mthd_set_operation },
849 nv01_graph_ifc_omthds[] = {
850 { 0x0184, nv01_graph_mthd_bind_chroma },
851 { 0x0188, nv01_graph_mthd_bind_clip },
852 { 0x018c, nv01_graph_mthd_bind_patt },
853 { 0x0190, nv04_graph_mthd_bind_rop },
854 { 0x0194, nv04_graph_mthd_bind_beta1 },
855 { 0x0198, nv04_graph_mthd_bind_surf_dst },
856 { 0x02fc, nv04_graph_mthd_set_operation },
861 nv04_graph_ifc_omthds[] = {
862 { 0x0184, nv01_graph_mthd_bind_chroma },
863 { 0x0188, nv01_graph_mthd_bind_clip },
864 { 0x018c, nv04_graph_mthd_bind_patt },
865 { 0x0190, nv04_graph_mthd_bind_rop },
866 { 0x0194, nv04_graph_mthd_bind_beta1 },
867 { 0x0198, nv04_graph_mthd_bind_beta4 },
868 { 0x019c, nv04_graph_mthd_bind_surf2d },
869 { 0x02fc, nv04_graph_mthd_set_operation },
874 nv03_graph_sifc_omthds[] = {
875 { 0x0184, nv01_graph_mthd_bind_chroma },
876 { 0x0188, nv01_graph_mthd_bind_patt },
877 { 0x018c, nv04_graph_mthd_bind_rop },
878 { 0x0190, nv04_graph_mthd_bind_beta1 },
879 { 0x0194, nv04_graph_mthd_bind_surf_dst },
880 { 0x02fc, nv04_graph_mthd_set_operation },
885 nv04_graph_sifc_omthds[] = {
886 { 0x0184, nv01_graph_mthd_bind_chroma },
887 { 0x0188, nv04_graph_mthd_bind_patt },
888 { 0x018c, nv04_graph_mthd_bind_rop },
889 { 0x0190, nv04_graph_mthd_bind_beta1 },
890 { 0x0194, nv04_graph_mthd_bind_beta4 },
891 { 0x0198, nv04_graph_mthd_bind_surf2d },
892 { 0x02fc, nv04_graph_mthd_set_operation },
897 nv03_graph_sifm_omthds[] = {
898 { 0x0188, nv01_graph_mthd_bind_patt },
899 { 0x018c, nv04_graph_mthd_bind_rop },
900 { 0x0190, nv04_graph_mthd_bind_beta1 },
901 { 0x0194, nv04_graph_mthd_bind_surf_dst },
902 { 0x0304, nv04_graph_mthd_set_operation },
907 nv04_graph_sifm_omthds[] = {
908 { 0x0188, nv04_graph_mthd_bind_patt },
909 { 0x018c, nv04_graph_mthd_bind_rop },
910 { 0x0190, nv04_graph_mthd_bind_beta1 },
911 { 0x0194, nv04_graph_mthd_bind_beta4 },
912 { 0x0198, nv04_graph_mthd_bind_surf2d },
913 { 0x0304, nv04_graph_mthd_set_operation },
918 nv04_graph_surf3d_omthds[] = {
919 { 0x02f8, nv04_graph_mthd_surf3d_clip_h },
920 { 0x02fc, nv04_graph_mthd_surf3d_clip_v },
925 nv03_graph_ttri_omthds[] = {
926 { 0x0188, nv01_graph_mthd_bind_clip },
927 { 0x018c, nv04_graph_mthd_bind_surf_color },
928 { 0x0190, nv04_graph_mthd_bind_surf_zeta },
933 nv01_graph_prim_omthds[] = {
934 { 0x0184, nv01_graph_mthd_bind_clip },
935 { 0x0188, nv01_graph_mthd_bind_patt },
936 { 0x018c, nv04_graph_mthd_bind_rop },
937 { 0x0190, nv04_graph_mthd_bind_beta1 },
938 { 0x0194, nv04_graph_mthd_bind_surf_dst },
939 { 0x02fc, nv04_graph_mthd_set_operation },
944 nv04_graph_prim_omthds[] = {
945 { 0x0184, nv01_graph_mthd_bind_clip },
946 { 0x0188, nv04_graph_mthd_bind_patt },
947 { 0x018c, nv04_graph_mthd_bind_rop },
948 { 0x0190, nv04_graph_mthd_bind_beta1 },
949 { 0x0194, nv04_graph_mthd_bind_beta4 },
950 { 0x0198, nv04_graph_mthd_bind_surf2d },
951 { 0x02fc, nv04_graph_mthd_set_operation },
966 *pobject = nv_object(obj);
972 nv_mo32(obj, 0x00, 0x00080000, 0x00080000);
974 nv_wo32(obj, 0x04, 0x00000000);
975 nv_wo32(obj, 0x08, 0x00000000);
976 nv_wo32(obj, 0x0c, 0x00000000);
982 .ctor = nv04_graph_object_ctor,
991 nv04_graph_sclass[] = {
992 { 0x0012, &nv04_graph_ofuncs },
993 { 0x0017, &nv04_graph_ofuncs },
994 { 0x0018, &nv04_graph_ofuncs },
995 { 0x0019, &nv04_graph_ofuncs },
1001 { 0x0030, &nv04_graph_ofuncs },
1004 { 0x0038, &nv04_graph_ofuncs },
1005 { 0x0039, &nv04_graph_ofuncs },
1006 { 0x0042, &nv04_graph_ofuncs },
1007 { 0x0043, &nv04_graph_ofuncs },
1008 { 0x0044, &nv04_graph_ofuncs },
1012 { 0x0052, &nv04_graph_ofuncs },
1014 { 0x0054, &nv04_graph_ofuncs },
1015 { 0x0055, &nv04_graph_ofuncs },
1016 { 0x0057, &nv04_graph_ofuncs },
1017 { 0x0058, &nv04_graph_ofuncs },
1018 { 0x0059, &nv04_graph_ofuncs },
1019 { 0x005a, &nv04_graph_ofuncs },
1020 { 0x005b, &nv04_graph_ofuncs },
1027 { 0x0064, &nv04_graph_ofuncs },
1028 { 0x0065, &nv04_graph_ofuncs },
1029 { 0x0066, &nv04_graph_ofuncs },
1030 { 0x0072, &nv04_graph_ofuncs },
1058 for (i = 0; i <
ARRAY_SIZE(nv04_graph_ctx_regs); i++)
1059 nv_wr32(priv, nv04_graph_ctx_regs[i], chan->
nv04[i]);
1073 for (i = 0; i <
ARRAY_SIZE(nv04_graph_ctx_regs); i++)
1074 chan->
nv04[i] = nv_rd32(priv, nv04_graph_ctx_regs[i]);
1086 unsigned long flags;
1093 prev = nv04_graph_channel(priv);
1095 nv04_graph_unload_context(prev);
1101 nv04_graph_load_context(next, chid);
1103 spin_unlock_irqrestore(&priv->
lock, flags);
1110 for (i = 0; i <
ARRAY_SIZE(nv04_graph_ctx_regs); i++) {
1111 if (nv04_graph_ctx_regs[i] == reg)
1112 return &chan->
nv04[
i];
1127 unsigned long flags;
1131 *pobject = nv_object(chan);
1137 *pobject = nv_object(priv->
chan[fifo->
chid]);
1139 spin_unlock_irqrestore(&priv->
lock, flags);
1148 spin_unlock_irqrestore(&priv->
lock, flags);
1157 unsigned long flags;
1161 spin_unlock_irqrestore(&priv->
lock, flags);
1171 unsigned long flags;
1175 if (nv04_graph_channel(priv) == chan)
1176 nv04_graph_unload_context(chan);
1178 spin_unlock_irqrestore(&priv->
lock, flags);
1184 nv04_graph_cclass = {
1187 .ctor = nv04_graph_context_ctor,
1188 .dtor = nv04_graph_context_dtor,
1190 .fini = nv04_graph_context_fini,
1202 u32 mask = 0xffffffff;
1208 nv_error(graph,
"idle timed out with status 0x%08x\n",
1217 nv04_graph_intr_name[] = {
1223 nv04_graph_nstatus[] = {
1266 u32 chid = (addr & 0x0f000000) >> 24;
1267 u32 subc = (addr & 0x0000e000) >> 13;
1268 u32 mthd = (addr & 0x00001ffc);
1270 u32 class = nv_rd32(priv, 0x400180 + subc * 4) & 0xff;
1271 u32 inst = (nv_rd32(priv, 0x40016c) & 0xffff) << 4;
1273 unsigned long flags;
1276 chan = priv->
chan[chid];
1279 spin_unlock_irqrestore(&priv->
lock, flags);
1284 if (handle && !nv_call(handle->
object, mthd, data))
1285 show &= ~NV_PGRAPH_INTR_NOTIFY;
1291 stat &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH;
1292 show &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH;
1293 nv04_graph_context_switch(priv);
1307 nv_error(priv,
"ch %d/%d class 0x%04x "
1308 "mthd 0x%04x data 0x%08x\n",
1309 chid, subc,
class, mthd, data);
1324 *pobject = nv_object(priv);
1328 nv_subdev(priv)->unit = 0x00001000;
1329 nv_subdev(priv)->intr = nv04_graph_intr;
1330 nv_engine(priv)->cclass = &nv04_graph_cclass;
1331 nv_engine(priv)->sclass = nv04_graph_sclass;
1382 .ctor = nv04_graph_ctor,
1384 .init = nv04_graph_init,