diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv04_graph.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_graph.c | 645 |
1 files changed, 418 insertions, 227 deletions
diff --git a/drivers/gpu/drm/nouveau/nv04_graph.c b/drivers/gpu/drm/nouveau/nv04_graph.c index c8973421b635..af75015068d6 100644 --- a/drivers/gpu/drm/nouveau/nv04_graph.c +++ b/drivers/gpu/drm/nouveau/nv04_graph.c | |||
@@ -26,6 +26,11 @@ | |||
26 | #include "drm.h" | 26 | #include "drm.h" |
27 | #include "nouveau_drm.h" | 27 | #include "nouveau_drm.h" |
28 | #include "nouveau_drv.h" | 28 | #include "nouveau_drv.h" |
29 | #include "nouveau_hw.h" | ||
30 | #include "nouveau_util.h" | ||
31 | |||
32 | static int nv04_graph_register(struct drm_device *dev); | ||
33 | static void nv04_graph_isr(struct drm_device *dev); | ||
29 | 34 | ||
30 | static uint32_t nv04_graph_ctx_regs[] = { | 35 | static uint32_t nv04_graph_ctx_regs[] = { |
31 | 0x0040053c, | 36 | 0x0040053c, |
@@ -357,10 +362,10 @@ nv04_graph_channel(struct drm_device *dev) | |||
357 | if (chid >= dev_priv->engine.fifo.channels) | 362 | if (chid >= dev_priv->engine.fifo.channels) |
358 | return NULL; | 363 | return NULL; |
359 | 364 | ||
360 | return dev_priv->fifos[chid]; | 365 | return dev_priv->channels.ptr[chid]; |
361 | } | 366 | } |
362 | 367 | ||
363 | void | 368 | static void |
364 | nv04_graph_context_switch(struct drm_device *dev) | 369 | nv04_graph_context_switch(struct drm_device *dev) |
365 | { | 370 | { |
366 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 371 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
@@ -368,7 +373,6 @@ nv04_graph_context_switch(struct drm_device *dev) | |||
368 | struct nouveau_channel *chan = NULL; | 373 | struct nouveau_channel *chan = NULL; |
369 | int chid; | 374 | int chid; |
370 | 375 | ||
371 | pgraph->fifo_access(dev, false); | ||
372 | nouveau_wait_for_idle(dev); | 376 | nouveau_wait_for_idle(dev); |
373 | 377 | ||
374 | /* If previous context is valid, we need to save it */ | 378 | /* If previous context is valid, we need to save it */ |
@@ -376,11 +380,9 @@ nv04_graph_context_switch(struct drm_device *dev) | |||
376 | 380 | ||
377 | /* Load context for next channel */ | 381 | /* Load context for next channel */ |
378 | chid = dev_priv->engine.fifo.channel_id(dev); | 382 | chid = dev_priv->engine.fifo.channel_id(dev); |
379 | chan = dev_priv->fifos[chid]; | 383 | chan = dev_priv->channels.ptr[chid]; |
380 | if (chan) | 384 | if (chan) |
381 | nv04_graph_load_context(chan); | 385 | nv04_graph_load_context(chan); |
382 | |||
383 | pgraph->fifo_access(dev, true); | ||
384 | } | 386 | } |
385 | 387 | ||
386 | static uint32_t *ctx_reg(struct graph_state *ctx, uint32_t reg) | 388 | static uint32_t *ctx_reg(struct graph_state *ctx, uint32_t reg) |
@@ -412,10 +414,25 @@ int nv04_graph_create_context(struct nouveau_channel *chan) | |||
412 | 414 | ||
413 | void nv04_graph_destroy_context(struct nouveau_channel *chan) | 415 | void nv04_graph_destroy_context(struct nouveau_channel *chan) |
414 | { | 416 | { |
417 | struct drm_device *dev = chan->dev; | ||
418 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
419 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
415 | struct graph_state *pgraph_ctx = chan->pgraph_ctx; | 420 | struct graph_state *pgraph_ctx = chan->pgraph_ctx; |
421 | unsigned long flags; | ||
422 | |||
423 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | ||
424 | pgraph->fifo_access(dev, false); | ||
425 | |||
426 | /* Unload the context if it's the currently active one */ | ||
427 | if (pgraph->channel(dev) == chan) | ||
428 | pgraph->unload_context(dev); | ||
416 | 429 | ||
430 | /* Free the context resources */ | ||
417 | kfree(pgraph_ctx); | 431 | kfree(pgraph_ctx); |
418 | chan->pgraph_ctx = NULL; | 432 | chan->pgraph_ctx = NULL; |
433 | |||
434 | pgraph->fifo_access(dev, true); | ||
435 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | ||
419 | } | 436 | } |
420 | 437 | ||
421 | int nv04_graph_load_context(struct nouveau_channel *chan) | 438 | int nv04_graph_load_context(struct nouveau_channel *chan) |
@@ -468,13 +485,19 @@ int nv04_graph_init(struct drm_device *dev) | |||
468 | { | 485 | { |
469 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 486 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
470 | uint32_t tmp; | 487 | uint32_t tmp; |
488 | int ret; | ||
471 | 489 | ||
472 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & | 490 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & |
473 | ~NV_PMC_ENABLE_PGRAPH); | 491 | ~NV_PMC_ENABLE_PGRAPH); |
474 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) | | 492 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) | |
475 | NV_PMC_ENABLE_PGRAPH); | 493 | NV_PMC_ENABLE_PGRAPH); |
476 | 494 | ||
495 | ret = nv04_graph_register(dev); | ||
496 | if (ret) | ||
497 | return ret; | ||
498 | |||
477 | /* Enable PGRAPH interrupts */ | 499 | /* Enable PGRAPH interrupts */ |
500 | nouveau_irq_register(dev, 12, nv04_graph_isr); | ||
478 | nv_wr32(dev, NV03_PGRAPH_INTR, 0xFFFFFFFF); | 501 | nv_wr32(dev, NV03_PGRAPH_INTR, 0xFFFFFFFF); |
479 | nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0xFFFFFFFF); | 502 | nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0xFFFFFFFF); |
480 | 503 | ||
@@ -510,6 +533,8 @@ int nv04_graph_init(struct drm_device *dev) | |||
510 | 533 | ||
511 | void nv04_graph_takedown(struct drm_device *dev) | 534 | void nv04_graph_takedown(struct drm_device *dev) |
512 | { | 535 | { |
536 | nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000); | ||
537 | nouveau_irq_unregister(dev, 12); | ||
513 | } | 538 | } |
514 | 539 | ||
515 | void | 540 | void |
@@ -524,13 +549,27 @@ nv04_graph_fifo_access(struct drm_device *dev, bool enabled) | |||
524 | } | 549 | } |
525 | 550 | ||
526 | static int | 551 | static int |
527 | nv04_graph_mthd_set_ref(struct nouveau_channel *chan, int grclass, | 552 | nv04_graph_mthd_set_ref(struct nouveau_channel *chan, |
528 | int mthd, uint32_t data) | 553 | u32 class, u32 mthd, u32 data) |
529 | { | 554 | { |
530 | atomic_set(&chan->fence.last_sequence_irq, data); | 555 | atomic_set(&chan->fence.last_sequence_irq, data); |
531 | return 0; | 556 | return 0; |
532 | } | 557 | } |
533 | 558 | ||
559 | int | ||
560 | nv04_graph_mthd_page_flip(struct nouveau_channel *chan, | ||
561 | u32 class, u32 mthd, u32 data) | ||
562 | { | ||
563 | struct drm_device *dev = chan->dev; | ||
564 | struct nouveau_page_flip_state s; | ||
565 | |||
566 | if (!nouveau_finish_page_flip(chan, &s)) | ||
567 | nv_set_crtc_base(dev, s.crtc, | ||
568 | s.offset + s.y * s.pitch + s.x * s.bpp / 8); | ||
569 | |||
570 | return 0; | ||
571 | } | ||
572 | |||
534 | /* | 573 | /* |
535 | * Software methods, why they are needed, and how they all work: | 574 | * Software methods, why they are needed, and how they all work: |
536 | * | 575 | * |
@@ -606,12 +645,12 @@ nv04_graph_mthd_set_ref(struct nouveau_channel *chan, int grclass, | |||
606 | */ | 645 | */ |
607 | 646 | ||
608 | static void | 647 | static void |
609 | nv04_graph_set_ctx1(struct nouveau_channel *chan, uint32_t mask, uint32_t value) | 648 | nv04_graph_set_ctx1(struct nouveau_channel *chan, u32 mask, u32 value) |
610 | { | 649 | { |
611 | struct drm_device *dev = chan->dev; | 650 | struct drm_device *dev = chan->dev; |
612 | uint32_t instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4; | 651 | u32 instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4; |
613 | int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7; | 652 | int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7; |
614 | uint32_t tmp; | 653 | u32 tmp; |
615 | 654 | ||
616 | tmp = nv_ri32(dev, instance); | 655 | tmp = nv_ri32(dev, instance); |
617 | tmp &= ~mask; | 656 | tmp &= ~mask; |
@@ -623,11 +662,11 @@ nv04_graph_set_ctx1(struct nouveau_channel *chan, uint32_t mask, uint32_t value) | |||
623 | } | 662 | } |
624 | 663 | ||
625 | static void | 664 | static void |
626 | nv04_graph_set_ctx_val(struct nouveau_channel *chan, uint32_t mask, uint32_t value) | 665 | nv04_graph_set_ctx_val(struct nouveau_channel *chan, u32 mask, u32 value) |
627 | { | 666 | { |
628 | struct drm_device *dev = chan->dev; | 667 | struct drm_device *dev = chan->dev; |
629 | uint32_t instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4; | 668 | u32 instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4; |
630 | uint32_t tmp, ctx1; | 669 | u32 tmp, ctx1; |
631 | int class, op, valid = 1; | 670 | int class, op, valid = 1; |
632 | 671 | ||
633 | ctx1 = nv_ri32(dev, instance); | 672 | ctx1 = nv_ri32(dev, instance); |
@@ -672,13 +711,13 @@ nv04_graph_set_ctx_val(struct nouveau_channel *chan, uint32_t mask, uint32_t val | |||
672 | } | 711 | } |
673 | 712 | ||
674 | static int | 713 | static int |
675 | nv04_graph_mthd_set_operation(struct nouveau_channel *chan, int grclass, | 714 | nv04_graph_mthd_set_operation(struct nouveau_channel *chan, |
676 | int mthd, uint32_t data) | 715 | u32 class, u32 mthd, u32 data) |
677 | { | 716 | { |
678 | if (data > 5) | 717 | if (data > 5) |
679 | return 1; | 718 | return 1; |
680 | /* Old versions of the objects only accept first three operations. */ | 719 | /* Old versions of the objects only accept first three operations. */ |
681 | if (data > 2 && grclass < 0x40) | 720 | if (data > 2 && class < 0x40) |
682 | return 1; | 721 | return 1; |
683 | nv04_graph_set_ctx1(chan, 0x00038000, data << 15); | 722 | nv04_graph_set_ctx1(chan, 0x00038000, data << 15); |
684 | /* changing operation changes set of objects needed for validation */ | 723 | /* changing operation changes set of objects needed for validation */ |
@@ -687,8 +726,8 @@ nv04_graph_mthd_set_operation(struct nouveau_channel *chan, int grclass, | |||
687 | } | 726 | } |
688 | 727 | ||
689 | static int | 728 | static int |
690 | nv04_graph_mthd_surf3d_clip_h(struct nouveau_channel *chan, int grclass, | 729 | nv04_graph_mthd_surf3d_clip_h(struct nouveau_channel *chan, |
691 | int mthd, uint32_t data) | 730 | u32 class, u32 mthd, u32 data) |
692 | { | 731 | { |
693 | uint32_t min = data & 0xffff, max; | 732 | uint32_t min = data & 0xffff, max; |
694 | uint32_t w = data >> 16; | 733 | uint32_t w = data >> 16; |
@@ -706,8 +745,8 @@ nv04_graph_mthd_surf3d_clip_h(struct nouveau_channel *chan, int grclass, | |||
706 | } | 745 | } |
707 | 746 | ||
708 | static int | 747 | static int |
709 | nv04_graph_mthd_surf3d_clip_v(struct nouveau_channel *chan, int grclass, | 748 | nv04_graph_mthd_surf3d_clip_v(struct nouveau_channel *chan, |
710 | int mthd, uint32_t data) | 749 | u32 class, u32 mthd, u32 data) |
711 | { | 750 | { |
712 | uint32_t min = data & 0xffff, max; | 751 | uint32_t min = data & 0xffff, max; |
713 | uint32_t w = data >> 16; | 752 | uint32_t w = data >> 16; |
@@ -725,8 +764,8 @@ nv04_graph_mthd_surf3d_clip_v(struct nouveau_channel *chan, int grclass, | |||
725 | } | 764 | } |
726 | 765 | ||
727 | static int | 766 | static int |
728 | nv04_graph_mthd_bind_surf2d(struct nouveau_channel *chan, int grclass, | 767 | nv04_graph_mthd_bind_surf2d(struct nouveau_channel *chan, |
729 | int mthd, uint32_t data) | 768 | u32 class, u32 mthd, u32 data) |
730 | { | 769 | { |
731 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 770 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
732 | case 0x30: | 771 | case 0x30: |
@@ -742,8 +781,8 @@ nv04_graph_mthd_bind_surf2d(struct nouveau_channel *chan, int grclass, | |||
742 | } | 781 | } |
743 | 782 | ||
744 | static int | 783 | static int |
745 | nv04_graph_mthd_bind_surf2d_swzsurf(struct nouveau_channel *chan, int grclass, | 784 | nv04_graph_mthd_bind_surf2d_swzsurf(struct nouveau_channel *chan, |
746 | int mthd, uint32_t data) | 785 | u32 class, u32 mthd, u32 data) |
747 | { | 786 | { |
748 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 787 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
749 | case 0x30: | 788 | case 0x30: |
@@ -763,8 +802,8 @@ nv04_graph_mthd_bind_surf2d_swzsurf(struct nouveau_channel *chan, int grclass, | |||
763 | } | 802 | } |
764 | 803 | ||
765 | static int | 804 | static int |
766 | nv04_graph_mthd_bind_nv01_patt(struct nouveau_channel *chan, int grclass, | 805 | nv04_graph_mthd_bind_nv01_patt(struct nouveau_channel *chan, |
767 | int mthd, uint32_t data) | 806 | u32 class, u32 mthd, u32 data) |
768 | { | 807 | { |
769 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 808 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
770 | case 0x30: | 809 | case 0x30: |
@@ -778,8 +817,8 @@ nv04_graph_mthd_bind_nv01_patt(struct nouveau_channel *chan, int grclass, | |||
778 | } | 817 | } |
779 | 818 | ||
780 | static int | 819 | static int |
781 | nv04_graph_mthd_bind_nv04_patt(struct nouveau_channel *chan, int grclass, | 820 | nv04_graph_mthd_bind_nv04_patt(struct nouveau_channel *chan, |
782 | int mthd, uint32_t data) | 821 | u32 class, u32 mthd, u32 data) |
783 | { | 822 | { |
784 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 823 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
785 | case 0x30: | 824 | case 0x30: |
@@ -793,8 +832,8 @@ nv04_graph_mthd_bind_nv04_patt(struct nouveau_channel *chan, int grclass, | |||
793 | } | 832 | } |
794 | 833 | ||
795 | static int | 834 | static int |
796 | nv04_graph_mthd_bind_rop(struct nouveau_channel *chan, int grclass, | 835 | nv04_graph_mthd_bind_rop(struct nouveau_channel *chan, |
797 | int mthd, uint32_t data) | 836 | u32 class, u32 mthd, u32 data) |
798 | { | 837 | { |
799 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 838 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
800 | case 0x30: | 839 | case 0x30: |
@@ -808,8 +847,8 @@ nv04_graph_mthd_bind_rop(struct nouveau_channel *chan, int grclass, | |||
808 | } | 847 | } |
809 | 848 | ||
810 | static int | 849 | static int |
811 | nv04_graph_mthd_bind_beta1(struct nouveau_channel *chan, int grclass, | 850 | nv04_graph_mthd_bind_beta1(struct nouveau_channel *chan, |
812 | int mthd, uint32_t data) | 851 | u32 class, u32 mthd, u32 data) |
813 | { | 852 | { |
814 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 853 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
815 | case 0x30: | 854 | case 0x30: |
@@ -823,8 +862,8 @@ nv04_graph_mthd_bind_beta1(struct nouveau_channel *chan, int grclass, | |||
823 | } | 862 | } |
824 | 863 | ||
825 | static int | 864 | static int |
826 | nv04_graph_mthd_bind_beta4(struct nouveau_channel *chan, int grclass, | 865 | nv04_graph_mthd_bind_beta4(struct nouveau_channel *chan, |
827 | int mthd, uint32_t data) | 866 | u32 class, u32 mthd, u32 data) |
828 | { | 867 | { |
829 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 868 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
830 | case 0x30: | 869 | case 0x30: |
@@ -838,8 +877,8 @@ nv04_graph_mthd_bind_beta4(struct nouveau_channel *chan, int grclass, | |||
838 | } | 877 | } |
839 | 878 | ||
840 | static int | 879 | static int |
841 | nv04_graph_mthd_bind_surf_dst(struct nouveau_channel *chan, int grclass, | 880 | nv04_graph_mthd_bind_surf_dst(struct nouveau_channel *chan, |
842 | int mthd, uint32_t data) | 881 | u32 class, u32 mthd, u32 data) |
843 | { | 882 | { |
844 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 883 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
845 | case 0x30: | 884 | case 0x30: |
@@ -853,8 +892,8 @@ nv04_graph_mthd_bind_surf_dst(struct nouveau_channel *chan, int grclass, | |||
853 | } | 892 | } |
854 | 893 | ||
855 | static int | 894 | static int |
856 | nv04_graph_mthd_bind_surf_src(struct nouveau_channel *chan, int grclass, | 895 | nv04_graph_mthd_bind_surf_src(struct nouveau_channel *chan, |
857 | int mthd, uint32_t data) | 896 | u32 class, u32 mthd, u32 data) |
858 | { | 897 | { |
859 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 898 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
860 | case 0x30: | 899 | case 0x30: |
@@ -868,8 +907,8 @@ nv04_graph_mthd_bind_surf_src(struct nouveau_channel *chan, int grclass, | |||
868 | } | 907 | } |
869 | 908 | ||
870 | static int | 909 | static int |
871 | nv04_graph_mthd_bind_surf_color(struct nouveau_channel *chan, int grclass, | 910 | nv04_graph_mthd_bind_surf_color(struct nouveau_channel *chan, |
872 | int mthd, uint32_t data) | 911 | u32 class, u32 mthd, u32 data) |
873 | { | 912 | { |
874 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 913 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
875 | case 0x30: | 914 | case 0x30: |
@@ -883,8 +922,8 @@ nv04_graph_mthd_bind_surf_color(struct nouveau_channel *chan, int grclass, | |||
883 | } | 922 | } |
884 | 923 | ||
885 | static int | 924 | static int |
886 | nv04_graph_mthd_bind_surf_zeta(struct nouveau_channel *chan, int grclass, | 925 | nv04_graph_mthd_bind_surf_zeta(struct nouveau_channel *chan, |
887 | int mthd, uint32_t data) | 926 | u32 class, u32 mthd, u32 data) |
888 | { | 927 | { |
889 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 928 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
890 | case 0x30: | 929 | case 0x30: |
@@ -898,8 +937,8 @@ nv04_graph_mthd_bind_surf_zeta(struct nouveau_channel *chan, int grclass, | |||
898 | } | 937 | } |
899 | 938 | ||
900 | static int | 939 | static int |
901 | nv04_graph_mthd_bind_clip(struct nouveau_channel *chan, int grclass, | 940 | nv04_graph_mthd_bind_clip(struct nouveau_channel *chan, |
902 | int mthd, uint32_t data) | 941 | u32 class, u32 mthd, u32 data) |
903 | { | 942 | { |
904 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 943 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
905 | case 0x30: | 944 | case 0x30: |
@@ -913,8 +952,8 @@ nv04_graph_mthd_bind_clip(struct nouveau_channel *chan, int grclass, | |||
913 | } | 952 | } |
914 | 953 | ||
915 | static int | 954 | static int |
916 | nv04_graph_mthd_bind_chroma(struct nouveau_channel *chan, int grclass, | 955 | nv04_graph_mthd_bind_chroma(struct nouveau_channel *chan, |
917 | int mthd, uint32_t data) | 956 | u32 class, u32 mthd, u32 data) |
918 | { | 957 | { |
919 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { | 958 | switch (nv_ri32(chan->dev, data << 4) & 0xff) { |
920 | case 0x30: | 959 | case 0x30: |
@@ -930,194 +969,346 @@ nv04_graph_mthd_bind_chroma(struct nouveau_channel *chan, int grclass, | |||
930 | return 1; | 969 | return 1; |
931 | } | 970 | } |
932 | 971 | ||
933 | static struct nouveau_pgraph_object_method nv04_graph_mthds_sw[] = { | 972 | static int |
934 | { 0x0150, nv04_graph_mthd_set_ref }, | 973 | nv04_graph_register(struct drm_device *dev) |
935 | {} | 974 | { |
936 | }; | 975 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
937 | |||
938 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_gdirect[] = { | ||
939 | { 0x0184, nv04_graph_mthd_bind_nv01_patt }, | ||
940 | { 0x0188, nv04_graph_mthd_bind_rop }, | ||
941 | { 0x018c, nv04_graph_mthd_bind_beta1 }, | ||
942 | { 0x0190, nv04_graph_mthd_bind_surf_dst }, | ||
943 | { 0x02fc, nv04_graph_mthd_set_operation }, | ||
944 | {}, | ||
945 | }; | ||
946 | |||
947 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_gdirect[] = { | ||
948 | { 0x0188, nv04_graph_mthd_bind_nv04_patt }, | ||
949 | { 0x018c, nv04_graph_mthd_bind_rop }, | ||
950 | { 0x0190, nv04_graph_mthd_bind_beta1 }, | ||
951 | { 0x0194, nv04_graph_mthd_bind_beta4 }, | ||
952 | { 0x0198, nv04_graph_mthd_bind_surf2d }, | ||
953 | { 0x02fc, nv04_graph_mthd_set_operation }, | ||
954 | {}, | ||
955 | }; | ||
956 | |||
957 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv01_imageblit[] = { | ||
958 | { 0x0184, nv04_graph_mthd_bind_chroma }, | ||
959 | { 0x0188, nv04_graph_mthd_bind_clip }, | ||
960 | { 0x018c, nv04_graph_mthd_bind_nv01_patt }, | ||
961 | { 0x0190, nv04_graph_mthd_bind_rop }, | ||
962 | { 0x0194, nv04_graph_mthd_bind_beta1 }, | ||
963 | { 0x0198, nv04_graph_mthd_bind_surf_dst }, | ||
964 | { 0x019c, nv04_graph_mthd_bind_surf_src }, | ||
965 | { 0x02fc, nv04_graph_mthd_set_operation }, | ||
966 | {}, | ||
967 | }; | ||
968 | |||
969 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_imageblit_ifc[] = { | ||
970 | { 0x0184, nv04_graph_mthd_bind_chroma }, | ||
971 | { 0x0188, nv04_graph_mthd_bind_clip }, | ||
972 | { 0x018c, nv04_graph_mthd_bind_nv04_patt }, | ||
973 | { 0x0190, nv04_graph_mthd_bind_rop }, | ||
974 | { 0x0194, nv04_graph_mthd_bind_beta1 }, | ||
975 | { 0x0198, nv04_graph_mthd_bind_beta4 }, | ||
976 | { 0x019c, nv04_graph_mthd_bind_surf2d }, | ||
977 | { 0x02fc, nv04_graph_mthd_set_operation }, | ||
978 | {}, | ||
979 | }; | ||
980 | |||
981 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_iifc[] = { | ||
982 | { 0x0188, nv04_graph_mthd_bind_chroma }, | ||
983 | { 0x018c, nv04_graph_mthd_bind_clip }, | ||
984 | { 0x0190, nv04_graph_mthd_bind_nv04_patt }, | ||
985 | { 0x0194, nv04_graph_mthd_bind_rop }, | ||
986 | { 0x0198, nv04_graph_mthd_bind_beta1 }, | ||
987 | { 0x019c, nv04_graph_mthd_bind_beta4 }, | ||
988 | { 0x01a0, nv04_graph_mthd_bind_surf2d_swzsurf }, | ||
989 | { 0x03e4, nv04_graph_mthd_set_operation }, | ||
990 | {}, | ||
991 | }; | ||
992 | |||
993 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv01_ifc[] = { | ||
994 | { 0x0184, nv04_graph_mthd_bind_chroma }, | ||
995 | { 0x0188, nv04_graph_mthd_bind_clip }, | ||
996 | { 0x018c, nv04_graph_mthd_bind_nv01_patt }, | ||
997 | { 0x0190, nv04_graph_mthd_bind_rop }, | ||
998 | { 0x0194, nv04_graph_mthd_bind_beta1 }, | ||
999 | { 0x0198, nv04_graph_mthd_bind_surf_dst }, | ||
1000 | { 0x02fc, nv04_graph_mthd_set_operation }, | ||
1001 | {}, | ||
1002 | }; | ||
1003 | |||
1004 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_sifc[] = { | ||
1005 | { 0x0184, nv04_graph_mthd_bind_chroma }, | ||
1006 | { 0x0188, nv04_graph_mthd_bind_nv01_patt }, | ||
1007 | { 0x018c, nv04_graph_mthd_bind_rop }, | ||
1008 | { 0x0190, nv04_graph_mthd_bind_beta1 }, | ||
1009 | { 0x0194, nv04_graph_mthd_bind_surf_dst }, | ||
1010 | { 0x02fc, nv04_graph_mthd_set_operation }, | ||
1011 | {}, | ||
1012 | }; | ||
1013 | |||
1014 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_sifc[] = { | ||
1015 | { 0x0184, nv04_graph_mthd_bind_chroma }, | ||
1016 | { 0x0188, nv04_graph_mthd_bind_nv04_patt }, | ||
1017 | { 0x018c, nv04_graph_mthd_bind_rop }, | ||
1018 | { 0x0190, nv04_graph_mthd_bind_beta1 }, | ||
1019 | { 0x0194, nv04_graph_mthd_bind_beta4 }, | ||
1020 | { 0x0198, nv04_graph_mthd_bind_surf2d }, | ||
1021 | { 0x02fc, nv04_graph_mthd_set_operation }, | ||
1022 | {}, | ||
1023 | }; | ||
1024 | |||
1025 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_sifm[] = { | ||
1026 | { 0x0188, nv04_graph_mthd_bind_nv01_patt }, | ||
1027 | { 0x018c, nv04_graph_mthd_bind_rop }, | ||
1028 | { 0x0190, nv04_graph_mthd_bind_beta1 }, | ||
1029 | { 0x0194, nv04_graph_mthd_bind_surf_dst }, | ||
1030 | { 0x0304, nv04_graph_mthd_set_operation }, | ||
1031 | {}, | ||
1032 | }; | ||
1033 | |||
1034 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_sifm[] = { | ||
1035 | { 0x0188, nv04_graph_mthd_bind_nv04_patt }, | ||
1036 | { 0x018c, nv04_graph_mthd_bind_rop }, | ||
1037 | { 0x0190, nv04_graph_mthd_bind_beta1 }, | ||
1038 | { 0x0194, nv04_graph_mthd_bind_beta4 }, | ||
1039 | { 0x0198, nv04_graph_mthd_bind_surf2d_swzsurf }, | ||
1040 | { 0x0304, nv04_graph_mthd_set_operation }, | ||
1041 | {}, | ||
1042 | }; | ||
1043 | 976 | ||
1044 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv01_shape[] = { | 977 | if (dev_priv->engine.graph.registered) |
1045 | { 0x0184, nv04_graph_mthd_bind_clip }, | 978 | return 0; |
1046 | { 0x0188, nv04_graph_mthd_bind_nv01_patt }, | ||
1047 | { 0x018c, nv04_graph_mthd_bind_rop }, | ||
1048 | { 0x0190, nv04_graph_mthd_bind_beta1 }, | ||
1049 | { 0x0194, nv04_graph_mthd_bind_surf_dst }, | ||
1050 | { 0x02fc, nv04_graph_mthd_set_operation }, | ||
1051 | {}, | ||
1052 | }; | ||
1053 | 979 | ||
1054 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv04_shape[] = { | 980 | /* dvd subpicture */ |
1055 | { 0x0184, nv04_graph_mthd_bind_clip }, | 981 | NVOBJ_CLASS(dev, 0x0038, GR); |
1056 | { 0x0188, nv04_graph_mthd_bind_nv04_patt }, | 982 | |
1057 | { 0x018c, nv04_graph_mthd_bind_rop }, | 983 | /* m2mf */ |
1058 | { 0x0190, nv04_graph_mthd_bind_beta1 }, | 984 | NVOBJ_CLASS(dev, 0x0039, GR); |
1059 | { 0x0194, nv04_graph_mthd_bind_beta4 }, | 985 | |
1060 | { 0x0198, nv04_graph_mthd_bind_surf2d }, | 986 | /* nv03 gdirect */ |
1061 | { 0x02fc, nv04_graph_mthd_set_operation }, | 987 | NVOBJ_CLASS(dev, 0x004b, GR); |
1062 | {}, | 988 | NVOBJ_MTHD (dev, 0x004b, 0x0184, nv04_graph_mthd_bind_nv01_patt); |
989 | NVOBJ_MTHD (dev, 0x004b, 0x0188, nv04_graph_mthd_bind_rop); | ||
990 | NVOBJ_MTHD (dev, 0x004b, 0x018c, nv04_graph_mthd_bind_beta1); | ||
991 | NVOBJ_MTHD (dev, 0x004b, 0x0190, nv04_graph_mthd_bind_surf_dst); | ||
992 | NVOBJ_MTHD (dev, 0x004b, 0x02fc, nv04_graph_mthd_set_operation); | ||
993 | |||
994 | /* nv04 gdirect */ | ||
995 | NVOBJ_CLASS(dev, 0x004a, GR); | ||
996 | NVOBJ_MTHD (dev, 0x004a, 0x0188, nv04_graph_mthd_bind_nv04_patt); | ||
997 | NVOBJ_MTHD (dev, 0x004a, 0x018c, nv04_graph_mthd_bind_rop); | ||
998 | NVOBJ_MTHD (dev, 0x004a, 0x0190, nv04_graph_mthd_bind_beta1); | ||
999 | NVOBJ_MTHD (dev, 0x004a, 0x0194, nv04_graph_mthd_bind_beta4); | ||
1000 | NVOBJ_MTHD (dev, 0x004a, 0x0198, nv04_graph_mthd_bind_surf2d); | ||
1001 | NVOBJ_MTHD (dev, 0x004a, 0x02fc, nv04_graph_mthd_set_operation); | ||
1002 | |||
1003 | /* nv01 imageblit */ | ||
1004 | NVOBJ_CLASS(dev, 0x001f, GR); | ||
1005 | NVOBJ_MTHD (dev, 0x001f, 0x0184, nv04_graph_mthd_bind_chroma); | ||
1006 | NVOBJ_MTHD (dev, 0x001f, 0x0188, nv04_graph_mthd_bind_clip); | ||
1007 | NVOBJ_MTHD (dev, 0x001f, 0x018c, nv04_graph_mthd_bind_nv01_patt); | ||
1008 | NVOBJ_MTHD (dev, 0x001f, 0x0190, nv04_graph_mthd_bind_rop); | ||
1009 | NVOBJ_MTHD (dev, 0x001f, 0x0194, nv04_graph_mthd_bind_beta1); | ||
1010 | NVOBJ_MTHD (dev, 0x001f, 0x0198, nv04_graph_mthd_bind_surf_dst); | ||
1011 | NVOBJ_MTHD (dev, 0x001f, 0x019c, nv04_graph_mthd_bind_surf_src); | ||
1012 | NVOBJ_MTHD (dev, 0x001f, 0x02fc, nv04_graph_mthd_set_operation); | ||
1013 | |||
1014 | /* nv04 imageblit */ | ||
1015 | NVOBJ_CLASS(dev, 0x005f, GR); | ||
1016 | NVOBJ_MTHD (dev, 0x005f, 0x0184, nv04_graph_mthd_bind_chroma); | ||
1017 | NVOBJ_MTHD (dev, 0x005f, 0x0188, nv04_graph_mthd_bind_clip); | ||
1018 | NVOBJ_MTHD (dev, 0x005f, 0x018c, nv04_graph_mthd_bind_nv04_patt); | ||
1019 | NVOBJ_MTHD (dev, 0x005f, 0x0190, nv04_graph_mthd_bind_rop); | ||
1020 | NVOBJ_MTHD (dev, 0x005f, 0x0194, nv04_graph_mthd_bind_beta1); | ||
1021 | NVOBJ_MTHD (dev, 0x005f, 0x0198, nv04_graph_mthd_bind_beta4); | ||
1022 | NVOBJ_MTHD (dev, 0x005f, 0x019c, nv04_graph_mthd_bind_surf2d); | ||
1023 | NVOBJ_MTHD (dev, 0x005f, 0x02fc, nv04_graph_mthd_set_operation); | ||
1024 | |||
1025 | /* nv04 iifc */ | ||
1026 | NVOBJ_CLASS(dev, 0x0060, GR); | ||
1027 | NVOBJ_MTHD (dev, 0x0060, 0x0188, nv04_graph_mthd_bind_chroma); | ||
1028 | NVOBJ_MTHD (dev, 0x0060, 0x018c, nv04_graph_mthd_bind_clip); | ||
1029 | NVOBJ_MTHD (dev, 0x0060, 0x0190, nv04_graph_mthd_bind_nv04_patt); | ||
1030 | NVOBJ_MTHD (dev, 0x0060, 0x0194, nv04_graph_mthd_bind_rop); | ||
1031 | NVOBJ_MTHD (dev, 0x0060, 0x0198, nv04_graph_mthd_bind_beta1); | ||
1032 | NVOBJ_MTHD (dev, 0x0060, 0x019c, nv04_graph_mthd_bind_beta4); | ||
1033 | NVOBJ_MTHD (dev, 0x0060, 0x01a0, nv04_graph_mthd_bind_surf2d_swzsurf); | ||
1034 | NVOBJ_MTHD (dev, 0x0060, 0x03e4, nv04_graph_mthd_set_operation); | ||
1035 | |||
1036 | /* nv05 iifc */ | ||
1037 | NVOBJ_CLASS(dev, 0x0064, GR); | ||
1038 | |||
1039 | /* nv01 ifc */ | ||
1040 | NVOBJ_CLASS(dev, 0x0021, GR); | ||
1041 | NVOBJ_MTHD (dev, 0x0021, 0x0184, nv04_graph_mthd_bind_chroma); | ||
1042 | NVOBJ_MTHD (dev, 0x0021, 0x0188, nv04_graph_mthd_bind_clip); | ||
1043 | NVOBJ_MTHD (dev, 0x0021, 0x018c, nv04_graph_mthd_bind_nv01_patt); | ||
1044 | NVOBJ_MTHD (dev, 0x0021, 0x0190, nv04_graph_mthd_bind_rop); | ||
1045 | NVOBJ_MTHD (dev, 0x0021, 0x0194, nv04_graph_mthd_bind_beta1); | ||
1046 | NVOBJ_MTHD (dev, 0x0021, 0x0198, nv04_graph_mthd_bind_surf_dst); | ||
1047 | NVOBJ_MTHD (dev, 0x0021, 0x02fc, nv04_graph_mthd_set_operation); | ||
1048 | |||
1049 | /* nv04 ifc */ | ||
1050 | NVOBJ_CLASS(dev, 0x0061, GR); | ||
1051 | NVOBJ_MTHD (dev, 0x0061, 0x0184, nv04_graph_mthd_bind_chroma); | ||
1052 | NVOBJ_MTHD (dev, 0x0061, 0x0188, nv04_graph_mthd_bind_clip); | ||
1053 | NVOBJ_MTHD (dev, 0x0061, 0x018c, nv04_graph_mthd_bind_nv04_patt); | ||
1054 | NVOBJ_MTHD (dev, 0x0061, 0x0190, nv04_graph_mthd_bind_rop); | ||
1055 | NVOBJ_MTHD (dev, 0x0061, 0x0194, nv04_graph_mthd_bind_beta1); | ||
1056 | NVOBJ_MTHD (dev, 0x0061, 0x0198, nv04_graph_mthd_bind_beta4); | ||
1057 | NVOBJ_MTHD (dev, 0x0061, 0x019c, nv04_graph_mthd_bind_surf2d); | ||
1058 | NVOBJ_MTHD (dev, 0x0061, 0x02fc, nv04_graph_mthd_set_operation); | ||
1059 | |||
1060 | /* nv05 ifc */ | ||
1061 | NVOBJ_CLASS(dev, 0x0065, GR); | ||
1062 | |||
1063 | /* nv03 sifc */ | ||
1064 | NVOBJ_CLASS(dev, 0x0036, GR); | ||
1065 | NVOBJ_MTHD (dev, 0x0036, 0x0184, nv04_graph_mthd_bind_chroma); | ||
1066 | NVOBJ_MTHD (dev, 0x0036, 0x0188, nv04_graph_mthd_bind_nv01_patt); | ||
1067 | NVOBJ_MTHD (dev, 0x0036, 0x018c, nv04_graph_mthd_bind_rop); | ||
1068 | NVOBJ_MTHD (dev, 0x0036, 0x0190, nv04_graph_mthd_bind_beta1); | ||
1069 | NVOBJ_MTHD (dev, 0x0036, 0x0194, nv04_graph_mthd_bind_surf_dst); | ||
1070 | NVOBJ_MTHD (dev, 0x0036, 0x02fc, nv04_graph_mthd_set_operation); | ||
1071 | |||
1072 | /* nv04 sifc */ | ||
1073 | NVOBJ_CLASS(dev, 0x0076, GR); | ||
1074 | NVOBJ_MTHD (dev, 0x0076, 0x0184, nv04_graph_mthd_bind_chroma); | ||
1075 | NVOBJ_MTHD (dev, 0x0076, 0x0188, nv04_graph_mthd_bind_nv04_patt); | ||
1076 | NVOBJ_MTHD (dev, 0x0076, 0x018c, nv04_graph_mthd_bind_rop); | ||
1077 | NVOBJ_MTHD (dev, 0x0076, 0x0190, nv04_graph_mthd_bind_beta1); | ||
1078 | NVOBJ_MTHD (dev, 0x0076, 0x0194, nv04_graph_mthd_bind_beta4); | ||
1079 | NVOBJ_MTHD (dev, 0x0076, 0x0198, nv04_graph_mthd_bind_surf2d); | ||
1080 | NVOBJ_MTHD (dev, 0x0076, 0x02fc, nv04_graph_mthd_set_operation); | ||
1081 | |||
1082 | /* nv05 sifc */ | ||
1083 | NVOBJ_CLASS(dev, 0x0066, GR); | ||
1084 | |||
1085 | /* nv03 sifm */ | ||
1086 | NVOBJ_CLASS(dev, 0x0037, GR); | ||
1087 | NVOBJ_MTHD (dev, 0x0037, 0x0188, nv04_graph_mthd_bind_nv01_patt); | ||
1088 | NVOBJ_MTHD (dev, 0x0037, 0x018c, nv04_graph_mthd_bind_rop); | ||
1089 | NVOBJ_MTHD (dev, 0x0037, 0x0190, nv04_graph_mthd_bind_beta1); | ||
1090 | NVOBJ_MTHD (dev, 0x0037, 0x0194, nv04_graph_mthd_bind_surf_dst); | ||
1091 | NVOBJ_MTHD (dev, 0x0037, 0x0304, nv04_graph_mthd_set_operation); | ||
1092 | |||
1093 | /* nv04 sifm */ | ||
1094 | NVOBJ_CLASS(dev, 0x0077, GR); | ||
1095 | NVOBJ_MTHD (dev, 0x0077, 0x0188, nv04_graph_mthd_bind_nv04_patt); | ||
1096 | NVOBJ_MTHD (dev, 0x0077, 0x018c, nv04_graph_mthd_bind_rop); | ||
1097 | NVOBJ_MTHD (dev, 0x0077, 0x0190, nv04_graph_mthd_bind_beta1); | ||
1098 | NVOBJ_MTHD (dev, 0x0077, 0x0194, nv04_graph_mthd_bind_beta4); | ||
1099 | NVOBJ_MTHD (dev, 0x0077, 0x0198, nv04_graph_mthd_bind_surf2d_swzsurf); | ||
1100 | NVOBJ_MTHD (dev, 0x0077, 0x0304, nv04_graph_mthd_set_operation); | ||
1101 | |||
1102 | /* null */ | ||
1103 | NVOBJ_CLASS(dev, 0x0030, GR); | ||
1104 | |||
1105 | /* surf2d */ | ||
1106 | NVOBJ_CLASS(dev, 0x0042, GR); | ||
1107 | |||
1108 | /* rop */ | ||
1109 | NVOBJ_CLASS(dev, 0x0043, GR); | ||
1110 | |||
1111 | /* beta1 */ | ||
1112 | NVOBJ_CLASS(dev, 0x0012, GR); | ||
1113 | |||
1114 | /* beta4 */ | ||
1115 | NVOBJ_CLASS(dev, 0x0072, GR); | ||
1116 | |||
1117 | /* cliprect */ | ||
1118 | NVOBJ_CLASS(dev, 0x0019, GR); | ||
1119 | |||
1120 | /* nv01 pattern */ | ||
1121 | NVOBJ_CLASS(dev, 0x0018, GR); | ||
1122 | |||
1123 | /* nv04 pattern */ | ||
1124 | NVOBJ_CLASS(dev, 0x0044, GR); | ||
1125 | |||
1126 | /* swzsurf */ | ||
1127 | NVOBJ_CLASS(dev, 0x0052, GR); | ||
1128 | |||
1129 | /* surf3d */ | ||
1130 | NVOBJ_CLASS(dev, 0x0053, GR); | ||
1131 | NVOBJ_MTHD (dev, 0x0053, 0x02f8, nv04_graph_mthd_surf3d_clip_h); | ||
1132 | NVOBJ_MTHD (dev, 0x0053, 0x02fc, nv04_graph_mthd_surf3d_clip_v); | ||
1133 | |||
1134 | /* nv03 tex_tri */ | ||
1135 | NVOBJ_CLASS(dev, 0x0048, GR); | ||
1136 | NVOBJ_MTHD (dev, 0x0048, 0x0188, nv04_graph_mthd_bind_clip); | ||
1137 | NVOBJ_MTHD (dev, 0x0048, 0x018c, nv04_graph_mthd_bind_surf_color); | ||
1138 | NVOBJ_MTHD (dev, 0x0048, 0x0190, nv04_graph_mthd_bind_surf_zeta); | ||
1139 | |||
1140 | /* tex_tri */ | ||
1141 | NVOBJ_CLASS(dev, 0x0054, GR); | ||
1142 | |||
1143 | /* multitex_tri */ | ||
1144 | NVOBJ_CLASS(dev, 0x0055, GR); | ||
1145 | |||
1146 | /* nv01 chroma */ | ||
1147 | NVOBJ_CLASS(dev, 0x0017, GR); | ||
1148 | |||
1149 | /* nv04 chroma */ | ||
1150 | NVOBJ_CLASS(dev, 0x0057, GR); | ||
1151 | |||
1152 | /* surf_dst */ | ||
1153 | NVOBJ_CLASS(dev, 0x0058, GR); | ||
1154 | |||
1155 | /* surf_src */ | ||
1156 | NVOBJ_CLASS(dev, 0x0059, GR); | ||
1157 | |||
1158 | /* surf_color */ | ||
1159 | NVOBJ_CLASS(dev, 0x005a, GR); | ||
1160 | |||
1161 | /* surf_zeta */ | ||
1162 | NVOBJ_CLASS(dev, 0x005b, GR); | ||
1163 | |||
1164 | /* nv01 line */ | ||
1165 | NVOBJ_CLASS(dev, 0x001c, GR); | ||
1166 | NVOBJ_MTHD (dev, 0x001c, 0x0184, nv04_graph_mthd_bind_clip); | ||
1167 | NVOBJ_MTHD (dev, 0x001c, 0x0188, nv04_graph_mthd_bind_nv01_patt); | ||
1168 | NVOBJ_MTHD (dev, 0x001c, 0x018c, nv04_graph_mthd_bind_rop); | ||
1169 | NVOBJ_MTHD (dev, 0x001c, 0x0190, nv04_graph_mthd_bind_beta1); | ||
1170 | NVOBJ_MTHD (dev, 0x001c, 0x0194, nv04_graph_mthd_bind_surf_dst); | ||
1171 | NVOBJ_MTHD (dev, 0x001c, 0x02fc, nv04_graph_mthd_set_operation); | ||
1172 | |||
1173 | /* nv04 line */ | ||
1174 | NVOBJ_CLASS(dev, 0x005c, GR); | ||
1175 | NVOBJ_MTHD (dev, 0x005c, 0x0184, nv04_graph_mthd_bind_clip); | ||
1176 | NVOBJ_MTHD (dev, 0x005c, 0x0188, nv04_graph_mthd_bind_nv04_patt); | ||
1177 | NVOBJ_MTHD (dev, 0x005c, 0x018c, nv04_graph_mthd_bind_rop); | ||
1178 | NVOBJ_MTHD (dev, 0x005c, 0x0190, nv04_graph_mthd_bind_beta1); | ||
1179 | NVOBJ_MTHD (dev, 0x005c, 0x0194, nv04_graph_mthd_bind_beta4); | ||
1180 | NVOBJ_MTHD (dev, 0x005c, 0x0198, nv04_graph_mthd_bind_surf2d); | ||
1181 | NVOBJ_MTHD (dev, 0x005c, 0x02fc, nv04_graph_mthd_set_operation); | ||
1182 | |||
1183 | /* nv01 tri */ | ||
1184 | NVOBJ_CLASS(dev, 0x001d, GR); | ||
1185 | NVOBJ_MTHD (dev, 0x001d, 0x0184, nv04_graph_mthd_bind_clip); | ||
1186 | NVOBJ_MTHD (dev, 0x001d, 0x0188, nv04_graph_mthd_bind_nv01_patt); | ||
1187 | NVOBJ_MTHD (dev, 0x001d, 0x018c, nv04_graph_mthd_bind_rop); | ||
1188 | NVOBJ_MTHD (dev, 0x001d, 0x0190, nv04_graph_mthd_bind_beta1); | ||
1189 | NVOBJ_MTHD (dev, 0x001d, 0x0194, nv04_graph_mthd_bind_surf_dst); | ||
1190 | NVOBJ_MTHD (dev, 0x001d, 0x02fc, nv04_graph_mthd_set_operation); | ||
1191 | |||
1192 | /* nv04 tri */ | ||
1193 | NVOBJ_CLASS(dev, 0x005d, GR); | ||
1194 | NVOBJ_MTHD (dev, 0x005d, 0x0184, nv04_graph_mthd_bind_clip); | ||
1195 | NVOBJ_MTHD (dev, 0x005d, 0x0188, nv04_graph_mthd_bind_nv04_patt); | ||
1196 | NVOBJ_MTHD (dev, 0x005d, 0x018c, nv04_graph_mthd_bind_rop); | ||
1197 | NVOBJ_MTHD (dev, 0x005d, 0x0190, nv04_graph_mthd_bind_beta1); | ||
1198 | NVOBJ_MTHD (dev, 0x005d, 0x0194, nv04_graph_mthd_bind_beta4); | ||
1199 | NVOBJ_MTHD (dev, 0x005d, 0x0198, nv04_graph_mthd_bind_surf2d); | ||
1200 | NVOBJ_MTHD (dev, 0x005d, 0x02fc, nv04_graph_mthd_set_operation); | ||
1201 | |||
1202 | /* nv01 rect */ | ||
1203 | NVOBJ_CLASS(dev, 0x001e, GR); | ||
1204 | NVOBJ_MTHD (dev, 0x001e, 0x0184, nv04_graph_mthd_bind_clip); | ||
1205 | NVOBJ_MTHD (dev, 0x001e, 0x0188, nv04_graph_mthd_bind_nv01_patt); | ||
1206 | NVOBJ_MTHD (dev, 0x001e, 0x018c, nv04_graph_mthd_bind_rop); | ||
1207 | NVOBJ_MTHD (dev, 0x001e, 0x0190, nv04_graph_mthd_bind_beta1); | ||
1208 | NVOBJ_MTHD (dev, 0x001e, 0x0194, nv04_graph_mthd_bind_surf_dst); | ||
1209 | NVOBJ_MTHD (dev, 0x001e, 0x02fc, nv04_graph_mthd_set_operation); | ||
1210 | |||
1211 | /* nv04 rect */ | ||
1212 | NVOBJ_CLASS(dev, 0x005e, GR); | ||
1213 | NVOBJ_MTHD (dev, 0x005e, 0x0184, nv04_graph_mthd_bind_clip); | ||
1214 | NVOBJ_MTHD (dev, 0x005e, 0x0188, nv04_graph_mthd_bind_nv04_patt); | ||
1215 | NVOBJ_MTHD (dev, 0x005e, 0x018c, nv04_graph_mthd_bind_rop); | ||
1216 | NVOBJ_MTHD (dev, 0x005e, 0x0190, nv04_graph_mthd_bind_beta1); | ||
1217 | NVOBJ_MTHD (dev, 0x005e, 0x0194, nv04_graph_mthd_bind_beta4); | ||
1218 | NVOBJ_MTHD (dev, 0x005e, 0x0198, nv04_graph_mthd_bind_surf2d); | ||
1219 | NVOBJ_MTHD (dev, 0x005e, 0x02fc, nv04_graph_mthd_set_operation); | ||
1220 | |||
1221 | /* nvsw */ | ||
1222 | NVOBJ_CLASS(dev, 0x506e, SW); | ||
1223 | NVOBJ_MTHD (dev, 0x506e, 0x0150, nv04_graph_mthd_set_ref); | ||
1224 | NVOBJ_MTHD (dev, 0x506e, 0x0500, nv04_graph_mthd_page_flip); | ||
1225 | |||
1226 | dev_priv->engine.graph.registered = true; | ||
1227 | return 0; | ||
1063 | }; | 1228 | }; |
1064 | 1229 | ||
1065 | static struct nouveau_pgraph_object_method nv04_graph_mthds_nv03_tex_tri[] = { | 1230 | static struct nouveau_bitfield nv04_graph_intr[] = { |
1066 | { 0x0188, nv04_graph_mthd_bind_clip }, | 1231 | { NV_PGRAPH_INTR_NOTIFY, "NOTIFY" }, |
1067 | { 0x018c, nv04_graph_mthd_bind_surf_color }, | 1232 | {} |
1068 | { 0x0190, nv04_graph_mthd_bind_surf_zeta }, | ||
1069 | {}, | ||
1070 | }; | 1233 | }; |
1071 | 1234 | ||
1072 | static struct nouveau_pgraph_object_method nv04_graph_mthds_surf3d[] = { | 1235 | static struct nouveau_bitfield nv04_graph_nstatus[] = |
1073 | { 0x02f8, nv04_graph_mthd_surf3d_clip_h }, | 1236 | { |
1074 | { 0x02fc, nv04_graph_mthd_surf3d_clip_v }, | 1237 | { NV04_PGRAPH_NSTATUS_STATE_IN_USE, "STATE_IN_USE" }, |
1075 | {}, | 1238 | { NV04_PGRAPH_NSTATUS_INVALID_STATE, "INVALID_STATE" }, |
1239 | { NV04_PGRAPH_NSTATUS_BAD_ARGUMENT, "BAD_ARGUMENT" }, | ||
1240 | { NV04_PGRAPH_NSTATUS_PROTECTION_FAULT, "PROTECTION_FAULT" }, | ||
1241 | {} | ||
1076 | }; | 1242 | }; |
1077 | 1243 | ||
1078 | struct nouveau_pgraph_object_class nv04_graph_grclass[] = { | 1244 | struct nouveau_bitfield nv04_graph_nsource[] = |
1079 | { 0x0038, false, NULL }, /* dvd subpicture */ | 1245 | { |
1080 | { 0x0039, false, NULL }, /* m2mf */ | 1246 | { NV03_PGRAPH_NSOURCE_NOTIFICATION, "NOTIFICATION" }, |
1081 | { 0x004b, false, nv04_graph_mthds_nv03_gdirect }, /* nv03 gdirect */ | 1247 | { NV03_PGRAPH_NSOURCE_DATA_ERROR, "DATA_ERROR" }, |
1082 | { 0x004a, false, nv04_graph_mthds_nv04_gdirect }, /* nv04 gdirect */ | 1248 | { NV03_PGRAPH_NSOURCE_PROTECTION_ERROR, "PROTECTION_ERROR" }, |
1083 | { 0x001f, false, nv04_graph_mthds_nv01_imageblit }, /* nv01 imageblit */ | 1249 | { NV03_PGRAPH_NSOURCE_RANGE_EXCEPTION, "RANGE_EXCEPTION" }, |
1084 | { 0x005f, false, nv04_graph_mthds_nv04_imageblit_ifc }, /* nv04 imageblit */ | 1250 | { NV03_PGRAPH_NSOURCE_LIMIT_COLOR, "LIMIT_COLOR" }, |
1085 | { 0x0060, false, nv04_graph_mthds_nv04_iifc }, /* nv04 iifc */ | 1251 | { NV03_PGRAPH_NSOURCE_LIMIT_ZETA, "LIMIT_ZETA" }, |
1086 | { 0x0064, false, NULL }, /* nv05 iifc */ | 1252 | { NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD, "ILLEGAL_MTHD" }, |
1087 | { 0x0021, false, nv04_graph_mthds_nv01_ifc }, /* nv01 ifc */ | 1253 | { NV03_PGRAPH_NSOURCE_DMA_R_PROTECTION, "DMA_R_PROTECTION" }, |
1088 | { 0x0061, false, nv04_graph_mthds_nv04_imageblit_ifc }, /* nv04 ifc */ | 1254 | { NV03_PGRAPH_NSOURCE_DMA_W_PROTECTION, "DMA_W_PROTECTION" }, |
1089 | { 0x0065, false, NULL }, /* nv05 ifc */ | 1255 | { NV03_PGRAPH_NSOURCE_FORMAT_EXCEPTION, "FORMAT_EXCEPTION" }, |
1090 | { 0x0036, false, nv04_graph_mthds_nv03_sifc }, /* nv03 sifc */ | 1256 | { NV03_PGRAPH_NSOURCE_PATCH_EXCEPTION, "PATCH_EXCEPTION" }, |
1091 | { 0x0076, false, nv04_graph_mthds_nv04_sifc }, /* nv04 sifc */ | 1257 | { NV03_PGRAPH_NSOURCE_STATE_INVALID, "STATE_INVALID" }, |
1092 | { 0x0066, false, NULL }, /* nv05 sifc */ | 1258 | { NV03_PGRAPH_NSOURCE_DOUBLE_NOTIFY, "DOUBLE_NOTIFY" }, |
1093 | { 0x0037, false, nv04_graph_mthds_nv03_sifm }, /* nv03 sifm */ | 1259 | { NV03_PGRAPH_NSOURCE_NOTIFY_IN_USE, "NOTIFY_IN_USE" }, |
1094 | { 0x0077, false, nv04_graph_mthds_nv04_sifm }, /* nv04 sifm */ | 1260 | { NV03_PGRAPH_NSOURCE_METHOD_CNT, "METHOD_CNT" }, |
1095 | { 0x0030, false, NULL }, /* null */ | 1261 | { NV03_PGRAPH_NSOURCE_BFR_NOTIFICATION, "BFR_NOTIFICATION" }, |
1096 | { 0x0042, false, NULL }, /* surf2d */ | 1262 | { NV03_PGRAPH_NSOURCE_DMA_VTX_PROTECTION, "DMA_VTX_PROTECTION" }, |
1097 | { 0x0043, false, NULL }, /* rop */ | 1263 | { NV03_PGRAPH_NSOURCE_DMA_WIDTH_A, "DMA_WIDTH_A" }, |
1098 | { 0x0012, false, NULL }, /* beta1 */ | 1264 | { NV03_PGRAPH_NSOURCE_DMA_WIDTH_B, "DMA_WIDTH_B" }, |
1099 | { 0x0072, false, NULL }, /* beta4 */ | ||
1100 | { 0x0019, false, NULL }, /* cliprect */ | ||
1101 | { 0x0018, false, NULL }, /* nv01 pattern */ | ||
1102 | { 0x0044, false, NULL }, /* nv04 pattern */ | ||
1103 | { 0x0052, false, NULL }, /* swzsurf */ | ||
1104 | { 0x0053, false, nv04_graph_mthds_surf3d }, /* surf3d */ | ||
1105 | { 0x0048, false, nv04_graph_mthds_nv03_tex_tri }, /* nv03 tex_tri */ | ||
1106 | { 0x0054, false, NULL }, /* tex_tri */ | ||
1107 | { 0x0055, false, NULL }, /* multitex_tri */ | ||
1108 | { 0x0017, false, NULL }, /* nv01 chroma */ | ||
1109 | { 0x0057, false, NULL }, /* nv04 chroma */ | ||
1110 | { 0x0058, false, NULL }, /* surf_dst */ | ||
1111 | { 0x0059, false, NULL }, /* surf_src */ | ||
1112 | { 0x005a, false, NULL }, /* surf_color */ | ||
1113 | { 0x005b, false, NULL }, /* surf_zeta */ | ||
1114 | { 0x001c, false, nv04_graph_mthds_nv01_shape }, /* nv01 line */ | ||
1115 | { 0x005c, false, nv04_graph_mthds_nv04_shape }, /* nv04 line */ | ||
1116 | { 0x001d, false, nv04_graph_mthds_nv01_shape }, /* nv01 tri */ | ||
1117 | { 0x005d, false, nv04_graph_mthds_nv04_shape }, /* nv04 tri */ | ||
1118 | { 0x001e, false, nv04_graph_mthds_nv01_shape }, /* nv01 rect */ | ||
1119 | { 0x005e, false, nv04_graph_mthds_nv04_shape }, /* nv04 rect */ | ||
1120 | { 0x506e, true, nv04_graph_mthds_sw }, | ||
1121 | {} | 1265 | {} |
1122 | }; | 1266 | }; |
1123 | 1267 | ||
1268 | static void | ||
1269 | nv04_graph_isr(struct drm_device *dev) | ||
1270 | { | ||
1271 | u32 stat; | ||
1272 | |||
1273 | while ((stat = nv_rd32(dev, NV03_PGRAPH_INTR))) { | ||
1274 | u32 nsource = nv_rd32(dev, NV03_PGRAPH_NSOURCE); | ||
1275 | u32 nstatus = nv_rd32(dev, NV03_PGRAPH_NSTATUS); | ||
1276 | u32 addr = nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR); | ||
1277 | u32 chid = (addr & 0x0f000000) >> 24; | ||
1278 | u32 subc = (addr & 0x0000e000) >> 13; | ||
1279 | u32 mthd = (addr & 0x00001ffc); | ||
1280 | u32 data = nv_rd32(dev, NV04_PGRAPH_TRAPPED_DATA); | ||
1281 | u32 class = nv_rd32(dev, 0x400180 + subc * 4) & 0xff; | ||
1282 | u32 show = stat; | ||
1283 | |||
1284 | if (stat & NV_PGRAPH_INTR_NOTIFY) { | ||
1285 | if (nsource & NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD) { | ||
1286 | if (!nouveau_gpuobj_mthd_call2(dev, chid, class, mthd, data)) | ||
1287 | show &= ~NV_PGRAPH_INTR_NOTIFY; | ||
1288 | } | ||
1289 | } | ||
1290 | |||
1291 | if (stat & NV_PGRAPH_INTR_CONTEXT_SWITCH) { | ||
1292 | nv_wr32(dev, NV03_PGRAPH_INTR, NV_PGRAPH_INTR_CONTEXT_SWITCH); | ||
1293 | stat &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH; | ||
1294 | show &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH; | ||
1295 | nv04_graph_context_switch(dev); | ||
1296 | } | ||
1297 | |||
1298 | nv_wr32(dev, NV03_PGRAPH_INTR, stat); | ||
1299 | nv_wr32(dev, NV04_PGRAPH_FIFO, 0x00000001); | ||
1300 | |||
1301 | if (show && nouveau_ratelimit()) { | ||
1302 | NV_INFO(dev, "PGRAPH -"); | ||
1303 | nouveau_bitfield_print(nv04_graph_intr, show); | ||
1304 | printk(" nsource:"); | ||
1305 | nouveau_bitfield_print(nv04_graph_nsource, nsource); | ||
1306 | printk(" nstatus:"); | ||
1307 | nouveau_bitfield_print(nv04_graph_nstatus, nstatus); | ||
1308 | printk("\n"); | ||
1309 | NV_INFO(dev, "PGRAPH - ch %d/%d class 0x%04x " | ||
1310 | "mthd 0x%04x data 0x%08x\n", | ||
1311 | chid, subc, class, mthd, data); | ||
1312 | } | ||
1313 | } | ||
1314 | } | ||