summaryrefslogtreecommitdiff
path: root/linux-core
AgeCommit message (Expand)Author
2006-10-20Bug #8707, 2.6.19-rc compatibility for memory manager code.Thomas Hellstrom
2006-10-19Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drmThomas Hellstrom
2006-10-19Importing fixes from drm-ttm-0-2-branchThomas Hellstrom
2006-10-19Make sure delayed delete list is empty on lastclose.Thomas Hellstrom
2006-10-18Merging drm-ttm-0-2-branchThomas Hellstrom
2006-10-18Remove stray softlink.Thomas Hellstrom
2006-10-18Avoid driver-specific AGP user-populated types, since we don't know what AGPThomas Hellstrom
2006-10-17Remove max number of locked pages check and call, sinceThomas Hellstrom
2006-10-17Lindent.Thomas Hellstrom
2006-10-17Add vma list memory usage to memory accounting.Thomas Hellstrom
2006-10-17Add memory usage accounting to avoid DOS problems.Thomas Hellstrom
2006-10-17Implement mm_lock and mm_unlock functions.Thomas Hellstrom
2006-10-17Remove the memory manager parameter from the put_block function, as thisThomas Hellstrom
2006-10-17Extend generality for more memory types.Thomas Hellstrom
2006-10-16Change Intel AGP memory type numbers.Thomas Hellstrom
2006-10-15Merge branch 'master' of git://anongit.freedesktop.org/git/mesa/drm into nouv...Stephane Marchesin
2006-10-14remove config.h from build no longer exists kbuild does itDave Airlie
2006-10-12Bugfixes.Thomas Hellstrom
2006-10-12Simplify the AGP backend interface somewhat.Thomas Hellstrom
2006-10-11Compatibility code for 2.6.15-2.6.18. It is ugly but a little comfort is thatThomas Hellstrom
2006-10-11Big update:Thomas Hellstrom
2006-10-10Use a nopage-based approach to fault in pfns.Thomas Hellstrom
2006-10-03Get rid of all ugly PTE hacks.Thomas Hellstrom
2006-10-02Bug 6242: [mach64] Use private DMA buffers, part #3.George Sapountzis
2006-10-02Fix type of second argument to spin_lock_irqsave().Michel Dänzer
2006-10-02Fix type of second argument to spin_lock_irqsave().Michel Dänzer
2006-10-02Make the user_token 44-bit for TTMs, and have them occupy a unique file spaceThomas Hellstrom
2006-10-02Add a buffer object manager for TTM maps.Thomas Hellstrom
2006-10-02Allow for 44 bit user-tokens (or drm_file offsets)Thomas Hellstrom
2006-10-02Add a comment to previos commit.Thomas Hellstrom
2006-10-02Trap and be verbose about a deadlock that occurs with AIGLX and drivers thatThomas Hellstrom
2006-10-02Make locked tasklet handling more robust.Michel Dänzer
2006-09-29Core vsync: Don't clobber target sequence number when scheduling signal.Michel Dänzer
2006-09-29Core vsync: Add flag DRM_VBLANK_NEXTONMISS.Michel Dänzer
2006-09-29Change first valid DRM drawable ID to be 1 instead of 0.Michel Dänzer
2006-09-29Drop tasklet locked driver callback when uninstalling IRQ.Michel Dänzer
2006-09-29Hook up DRM_IOCTL_UPDATE_DRAW ioctl.Michel Dänzer
2006-09-29Add support for tracking drawable information to coreMichel Dänzer
2006-09-29Add support for interrupt triggered driver callback with lock held to DRM core.Michel Dänzer
2006-09-29Add support for secondary vertical blank interrupt to i915 driver.Michel Dänzer
2006-09-29Add support for secondary vertical blank interrupt to DRM core.Michel Dänzer
2006-09-29Fix buffer manager takedown error.Thomas Hellstrom
2006-09-28Core vsync: Don't clobber target sequence number when scheduling signal.Michel Dänzer
2006-09-28Core vsync: Add flag DRM_VBLANK_NEXTONMISS.Michel Dänzer
2006-09-28Change first valid DRM drawable ID to be 1 instead of 0.Michel Dänzer
2006-09-28Drop tasklet locked driver callback when uninstalling IRQ.Michel Dänzer
2006-09-28Hook up DRM_IOCTL_UPDATE_DRAW ioctl.Michel Dänzer
2006-09-28Add support for tracking drawable information to coreMichel Dänzer
2006-09-28Add support for interrupt triggered driver callback with lock held to DRM core.Michel Dänzer
2006-09-28Add support for secondary vertical blank interrupt to i915 driver.Michel Dänzer
#n418'>418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939
#include "drmP.h"
#include "drm.h"
#include "nouveau_drv.h"
#include "nouveau_drm.h"

/* The sizes are taken from the difference between the start of two
 * grctx addresses while running the nvidia driver.  Probably slightly
 * larger than they actually are, because of other objects being created
 * between the contexts
 */
#define NV40_GRCTX_SIZE (175*1024)
#define NV43_GRCTX_SIZE (70*1024)
#define NV4A_GRCTX_SIZE (64*1024)
#define NV4C_GRCTX_SIZE (25*1024)
#define NV4E_GRCTX_SIZE (25*1024)

/*TODO: deciper what each offset in the context represents. The below
 *      contexts are taken from dumps just after the 3D object is
 *      created.
 */
static void nv40_graph_context_init(drm_device_t *dev, struct mem_block *ctx)
{
	drm_nouveau_private_t *dev_priv = dev->dev_private;
	int i;

	/* Always has the "instance address" of itself at offset 0 */
	INSTANCE_WR(ctx, 0x00000/4, nouveau_chip_instance_get(dev, ctx));
	/* unknown */
	INSTANCE_WR(ctx, 0x00024/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x00028/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x00030/4, 0x00000001);
	INSTANCE_WR(ctx, 0x0011c/4, 0x20010001);
	INSTANCE_WR(ctx, 0x00120/4, 0x0f73ef00);
	INSTANCE_WR(ctx, 0x00128/4, 0x02008821);
	INSTANCE_WR(ctx, 0x0016c/4, 0x00000040);
	INSTANCE_WR(ctx, 0x00170/4, 0x00000040);
	INSTANCE_WR(ctx, 0x00174/4, 0x00000040);
	INSTANCE_WR(ctx, 0x0017c/4, 0x80000000);
	INSTANCE_WR(ctx, 0x00180/4, 0x80000000);
	INSTANCE_WR(ctx, 0x00184/4, 0x80000000);
	INSTANCE_WR(ctx, 0x00188/4, 0x80000000);
	INSTANCE_WR(ctx, 0x0018c/4, 0x80000000);
	INSTANCE_WR(ctx, 0x0019c/4, 0x00000040);
	INSTANCE_WR(ctx, 0x001a0/4, 0x80000000);
	INSTANCE_WR(ctx, 0x001b0/4, 0x80000000);
	INSTANCE_WR(ctx, 0x001c0/4, 0x80000000);
	INSTANCE_WR(ctx, 0x001d0/4, 0x0b0b0b0c);
	INSTANCE_WR(ctx, 0x00340/4, 0x00040000);
	INSTANCE_WR(ctx, 0x00350/4, 0x55555555);
	INSTANCE_WR(ctx, 0x00354/4, 0x55555555);
	INSTANCE_WR(ctx, 0x00358/4, 0x55555555);
	INSTANCE_WR(ctx, 0x0035c/4, 0x55555555);
	INSTANCE_WR(ctx, 0x00388/4, 0x00000008);
	INSTANCE_WR(ctx, 0x0039c/4, 0x00000010);
	INSTANCE_WR(ctx, 0x00480/4, 0x00000100);
	INSTANCE_WR(ctx, 0x00494/4, 0x00000111);
	INSTANCE_WR(ctx, 0x00498/4, 0x00080060);
	INSTANCE_WR(ctx, 0x004b4/4, 0x00000080);
	INSTANCE_WR(ctx, 0x004b8/4, 0xffff0000);
	INSTANCE_WR(ctx, 0x004bc/4, 0x00000001);
	INSTANCE_WR(ctx, 0x004d0/4, 0x46400000);
	INSTANCE_WR(ctx, 0x004ec/4, 0xffff0000);
	INSTANCE_WR(ctx, 0x004f8/4, 0x0fff0000);
	INSTANCE_WR(ctx, 0x004fc/4, 0x0fff0000);
	INSTANCE_WR(ctx, 0x00504/4, 0x00011100);
	for (i=0x00520; i<=0x0055c; i+=4)
		INSTANCE_WR(ctx, i/4, 0x07ff0000);
	INSTANCE_WR(ctx, 0x00568/4, 0x4b7fffff);
	INSTANCE_WR(ctx, 0x00594/4, 0x30201000);
	INSTANCE_WR(ctx, 0x00598/4, 0x70605040);
	INSTANCE_WR(ctx, 0x0059c/4, 0xb8a89888);
	INSTANCE_WR(ctx, 0x005a0/4, 0xf8e8d8c8);
	INSTANCE_WR(ctx, 0x005b4/4, 0x40100000);
	INSTANCE_WR(ctx, 0x005cc/4, 0x00000004);
	INSTANCE_WR(ctx, 0x005d8/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x0060c/4, 0x435185d6);
	INSTANCE_WR(ctx, 0x00610/4, 0x2155b699);
	INSTANCE_WR(ctx, 0x00614/4, 0xfedcba98);
	INSTANCE_WR(ctx, 0x00618/4, 0x00000098);
	INSTANCE_WR(ctx, 0x00628/4, 0xffffffff);
	INSTANCE_WR(ctx, 0x0062c/4, 0x00ff7000);
	INSTANCE_WR(ctx, 0x00630/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x00640/4, 0x00ff0000);
	INSTANCE_WR(ctx, 0x0067c/4, 0x00ffff00);
	/* 0x680-0x6BC - NV30_TCL_PRIMITIVE_3D_TX_ADDRESS_UNIT(0-15) */
	/* 0x6C0-0x6FC - NV30_TCL_PRIMITIVE_3D_TX_FORMAT_UNIT(0-15) */
	for (i=0x006C0; i<=0x006fc; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00018488);
	/* 0x700-0x73C - NV30_TCL_PRIMITIVE_3D_TX_WRAP_UNIT(0-15) */
	for (i=0x00700; i<=0x0073c; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00028202);
	/* 0x740-0x77C - NV30_TCL_PRIMITIVE_3D_TX_ENABLE_UNIT(0-15) */
	/* 0x780-0x7BC - NV30_TCL_PRIMITIVE_3D_TX_SWIZZLE_UNIT(0-15) */
	for (i=0x00780; i<=0x007bc; i+=4)
		INSTANCE_WR(ctx, i/4, 0x0000aae4);
	/* 0x7C0-0x7FC - NV30_TCL_PRIMITIVE_3D_TX_FILTER_UNIT(0-15) */
	for (i=0x007c0; i<=0x007fc; i+=4)
		INSTANCE_WR(ctx, i/4, 0x01012000);
	/* 0x800-0x83C - NV30_TCL_PRIMITIVE_3D_TX_XY_DIM_UNIT(0-15) */
	for (i=0x00800; i<=0x0083c; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00080008);
	/* 0x840-0x87C - NV30_TCL_PRIMITIVE_3D_TX_UNK07_UNIT(0-15) */
	/* 0x880-0x8BC - NV30_TCL_PRIMITIVE_3D_TX_DEPTH_UNIT(0-15) */
	for (i=0x00880; i<=0x008bc; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00100008);
	/* unknown */
	for (i=0x00910; i<=0x0091c; i+=4)
		INSTANCE_WR(ctx, i/4, 0x0001bc80);
	for (i=0x00920; i<=0x0092c; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00000202);
	for (i=0x00940; i<=0x0094c; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00000008);
	for (i=0x00960; i<=0x0096c; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00080008);
	INSTANCE_WR(ctx, 0x00980/4, 0x00000002);
	INSTANCE_WR(ctx, 0x009b4/4, 0x00000001);
	INSTANCE_WR(ctx, 0x009c0/4, 0x3e020200);
	INSTANCE_WR(ctx, 0x009c4/4, 0x00ffffff);
	INSTANCE_WR(ctx, 0x009c8/4, 0x60103f00);
	INSTANCE_WR(ctx, 0x009d4/4, 0x00020000);
	INSTANCE_WR(ctx, 0x00a08/4, 0x00008100);
	INSTANCE_WR(ctx, 0x00aac/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00af0/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00af8/4, 0x80800001);
	INSTANCE_WR(ctx, 0x00bcc/4, 0x00000005);
	INSTANCE_WR(ctx, 0x00bf8/4, 0x00005555);
	INSTANCE_WR(ctx, 0x00bfc/4, 0x00005555);
	INSTANCE_WR(ctx, 0x00c00/4, 0x00005555);
	INSTANCE_WR(ctx, 0x00c04/4, 0x00005555);
	INSTANCE_WR(ctx, 0x00c08/4, 0x00005555);
	INSTANCE_WR(ctx, 0x00c0c/4, 0x00005555);
	INSTANCE_WR(ctx, 0x00c44/4, 0x00000001);
	for (i=0x03008; i<=0x03080; i+=8)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
	for (i=0x05288; i<=0x08570; i+=24)
		INSTANCE_WR(ctx, i/4, 0x00000001);
	for (i=0x08628; i<=0x08e18; i+=16)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
	for (i=0x0bd28; i<=0x0f010; i+=24)
		INSTANCE_WR(ctx, i/4, 0x00000001);
	for (i=0x0f0c8; i<=0x0f8b8; i+=16)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
	for (i=0x127c8; i<=0x15ab0; i+=24)
		INSTANCE_WR(ctx, i/4, 0x00000001);
	for (i=0x15b68; i<=0x16358; i+=16)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
	for (i=0x19268; i<=0x1c550; i+=24)
		INSTANCE_WR(ctx, i/4, 0x00000001);
	for (i=0x1c608; i<=0x1cdf8; i+=16)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
	for (i=0x1fd08; i<=0x22ff0; i+=24)
		INSTANCE_WR(ctx, i/4, 0x00000001);
	for (i=0x230a8; i<=0x23898; i+=16)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
	for (i=0x267a8; i<=0x29a90; i+=24)
		INSTANCE_WR(ctx, i/4, 0x00000001);
	for (i=0x29b48; i<=0x2a338; i+=16)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
}

static void
nv43_graph_context_init(drm_device_t *dev, struct mem_block *ctx)
{
	drm_nouveau_private_t *dev_priv = dev->dev_private;
	int i;
	
	INSTANCE_WR(ctx, 0x00000/4, nouveau_chip_instance_get(dev, ctx));
	INSTANCE_WR(ctx, 0x00024/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x00028/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x00030/4, 0x00000001);
	INSTANCE_WR(ctx, 0x0011c/4, 0x20010001);
	INSTANCE_WR(ctx, 0x00120/4, 0x0f73ef00);
	INSTANCE_WR(ctx, 0x00128/4, 0x02008821);
	INSTANCE_WR(ctx, 0x00178/4, 0x00000040);
	INSTANCE_WR(ctx, 0x0017c/4, 0x00000040);
	INSTANCE_WR(ctx, 0x00180/4, 0x00000040);
	INSTANCE_WR(ctx, 0x00188/4, 0x00000040);
	INSTANCE_WR(ctx, 0x00194/4, 0x80000000);
	INSTANCE_WR(ctx, 0x00198/4, 0x80000000);
	INSTANCE_WR(ctx, 0x0019c/4, 0x80000000);
	INSTANCE_WR(ctx, 0x001a0/4, 0x80000000);
	INSTANCE_WR(ctx, 0x001a4/4, 0x80000000);
	INSTANCE_WR(ctx, 0x001a8/4, 0x80000000);
	INSTANCE_WR(ctx, 0x001ac/4, 0x80000000);
	INSTANCE_WR(ctx, 0x001b0/4, 0x80000000);
	INSTANCE_WR(ctx, 0x001d0/4, 0x0b0b0b0c);
	INSTANCE_WR(ctx, 0x00340/4, 0x00040000);
	INSTANCE_WR(ctx, 0x00350/4, 0x55555555);
	INSTANCE_WR(ctx, 0x00354/4, 0x55555555);
	INSTANCE_WR(ctx, 0x00358/4, 0x55555555);
	INSTANCE_WR(ctx, 0x0035c/4, 0x55555555);
	INSTANCE_WR(ctx, 0x00388/4, 0x00000008);
	INSTANCE_WR(ctx, 0x0039c/4, 0x00001010);
	INSTANCE_WR(ctx, 0x003cc/4, 0x00000111);
	INSTANCE_WR(ctx, 0x003d0/4, 0x00080060);
	INSTANCE_WR(ctx, 0x003ec/4, 0x00000080);
	INSTANCE_WR(ctx, 0x003f0/4, 0xffff0000);
	INSTANCE_WR(ctx, 0x003f4/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00408/4, 0x46400000);
	INSTANCE_WR(ctx, 0x00418/4, 0xffff0000);
	INSTANCE_WR(ctx, 0x00424/4, 0x0fff0000);
	INSTANCE_WR(ctx, 0x00428/4, 0x0fff0000);
	INSTANCE_WR(ctx, 0x00430/4, 0x00011100);
	for (i=0x0044c; i<=0x00488; i+=4)
		INSTANCE_WR(ctx, i/4, 0x07ff0000);
	INSTANCE_WR(ctx, 0x00494/4, 0x4b7fffff);
	INSTANCE_WR(ctx, 0x004bc/4, 0x30201000);
	INSTANCE_WR(ctx, 0x004c0/4, 0x70605040);
	INSTANCE_WR(ctx, 0x004c4/4, 0xb8a89888);
	INSTANCE_WR(ctx, 0x004c8/4, 0xf8e8d8c8);
	INSTANCE_WR(ctx, 0x004dc/4, 0x40100000);
	INSTANCE_WR(ctx, 0x004f8/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x0052c/4, 0x435185d6);
	INSTANCE_WR(ctx, 0x00530/4, 0x2155b699);
	INSTANCE_WR(ctx, 0x00534/4, 0xfedcba98);
	INSTANCE_WR(ctx, 0x00538/4, 0x00000098);
	INSTANCE_WR(ctx, 0x00548/4, 0xffffffff);
	INSTANCE_WR(ctx, 0x0054c/4, 0x00ff7000);
	INSTANCE_WR(ctx, 0x00550/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x00560/4, 0x00ff0000);
	INSTANCE_WR(ctx, 0x00598/4, 0x00ffff00);
	for (i=0x005dc; i<=0x00618; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00018488);
	for (i=0x0061c; i<=0x00658; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00028202);
	for (i=0x0069c; i<=0x006d8; i+=4)
		INSTANCE_WR(ctx, i/4, 0x0000aae4);
	for (i=0x006dc; i<=0x00718; i+=4)
		INSTANCE_WR(ctx, i/4, 0x01012000);
	for (i=0x0071c; i<=0x00758; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00080008);
	for (i=0x0079c; i<=0x007d8; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00100008);
	for (i=0x0082c; i<=0x00838; i+=4)
		INSTANCE_WR(ctx, i/4, 0x0001bc80);
	for (i=0x0083c; i<=0x00848; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00000202);
	for (i=0x0085c; i<=0x00868; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00000008);
	for (i=0x0087c; i<=0x00888; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00080008);
	INSTANCE_WR(ctx, 0x0089c/4, 0x00000002);
	INSTANCE_WR(ctx, 0x008d0/4, 0x00000021);
	INSTANCE_WR(ctx, 0x008d4/4, 0x030c30c3);
	INSTANCE_WR(ctx, 0x008e0/4, 0x3e020200);
	INSTANCE_WR(ctx, 0x008e4/4, 0x00ffffff);
	INSTANCE_WR(ctx, 0x008e8/4, 0x0c103f00);
	INSTANCE_WR(ctx, 0x008f4/4, 0x00020000);
	INSTANCE_WR(ctx, 0x0092c/4, 0x00008100);
	INSTANCE_WR(ctx, 0x009b8/4, 0x00000001);
	INSTANCE_WR(ctx, 0x009fc/4, 0x00001001);
	INSTANCE_WR(ctx, 0x00a04/4, 0x00000003);
	INSTANCE_WR(ctx, 0x00a08/4, 0x00888001);
	INSTANCE_WR(ctx, 0x00a8c/4, 0x00000005);
	INSTANCE_WR(ctx, 0x00a98/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x00ab4/4, 0x00005555);
	INSTANCE_WR(ctx, 0x00ab8/4, 0x00005555);
	INSTANCE_WR(ctx, 0x00abc/4, 0x00005555);
	INSTANCE_WR(ctx, 0x00ac0/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00af8/4, 0x00000001);
	for (i=0x02ec0; i<=0x02f38; i+=8)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
	for (i=0x04c80; i<=0x06e70; i+=24)
		INSTANCE_WR(ctx, i/4, 0x00000001);
	for (i=0x06e80; i<=0x07270; i+=16)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
	for (i=0x096c0; i<=0x0b8b0; i+=24)
		INSTANCE_WR(ctx, i/4, 0x00000001);
	for (i=0x0b8c0; i<=0x0bcb0; i+=16)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
	for (i=0x0e100; i<=0x102f0; i+=24)
		INSTANCE_WR(ctx, i/4, 0x00000001);
	for (i=0x10300; i<=0x106f0; i+=16)
		INSTANCE_WR(ctx, i/4, 0x3f800000);
};

static void nv4a_graph_context_init(drm_device_t *dev, struct mem_block *ctx)
{
	drm_nouveau_private_t *dev_priv = dev->dev_private;
	int i;

	INSTANCE_WR(ctx, 0x00000/4, nouveau_chip_instance_get(dev, ctx));
	INSTANCE_WR(ctx, 0x00024/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x00028/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x00030/4, 0x00000001);
	INSTANCE_WR(ctx, 0x0011c/4, 0x20010001);
	INSTANCE_WR(ctx, 0x00120/4, 0x0f73ef00);
	INSTANCE_WR(ctx, 0x00128/4, 0x02008821);
	INSTANCE_WR(ctx, 0x00158/4, 0x00000001);
	INSTANCE_WR(ctx, 0x0015c/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00160/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00164/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00168/4, 0x00000001);
	INSTANCE_WR(ctx, 0x0016c/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00170/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00174/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00178/4, 0x00000040);
	INSTANCE_WR(ctx, 0x0017c/4, 0x00000040);
	INSTANCE_WR(ctx, 0x00180/4, 0x00000040);
	INSTANCE_WR(ctx, 0x00188/4, 0x00000040);
	INSTANCE_WR(ctx, 0x001d0/4, 0x0b0b0b0c);
	INSTANCE_WR(ctx, 0x00340/4, 0x00040000);
	INSTANCE_WR(ctx, 0x00350/4, 0x55555555);
	INSTANCE_WR(ctx, 0x00354/4, 0x55555555);
	INSTANCE_WR(ctx, 0x00358/4, 0x55555555);
	INSTANCE_WR(ctx, 0x0035c/4, 0x55555555);
	INSTANCE_WR(ctx, 0x00388/4, 0x00000008);
	INSTANCE_WR(ctx, 0x0039c/4, 0x00003010);
	INSTANCE_WR(ctx, 0x003cc/4, 0x00000111);
	INSTANCE_WR(ctx, 0x003d0/4, 0x00080060);
	INSTANCE_WR(ctx, 0x003ec/4, 0x00000080);
	INSTANCE_WR(ctx, 0x003f0/4, 0xffff0000);
	INSTANCE_WR(ctx, 0x003f4/4, 0x00000001);
	INSTANCE_WR(ctx, 0x00408/4, 0x46400000);
	INSTANCE_WR(ctx, 0x00418/4, 0xffff0000);
	INSTANCE_WR(ctx, 0x00424/4, 0x0fff0000);
	INSTANCE_WR(ctx, 0x00428/4, 0x0fff0000);
	INSTANCE_WR(ctx, 0x00430/4, 0x00011100);
	for (i=0x0044c; i<=0x00488; i+=4)
		INSTANCE_WR(ctx, i/4, 0x07ff0000);
	INSTANCE_WR(ctx, 0x00494/4, 0x4b7fffff);
	INSTANCE_WR(ctx, 0x004bc/4, 0x30201000);
	INSTANCE_WR(ctx, 0x004c0/4, 0x70605040);
	INSTANCE_WR(ctx, 0x004c4/4, 0xb8a89888);
	INSTANCE_WR(ctx, 0x004c8/4, 0xf8e8d8c8);
	INSTANCE_WR(ctx, 0x004dc/4, 0x40100000);
	INSTANCE_WR(ctx, 0x004f8/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x0052c/4, 0x435185d6);
	INSTANCE_WR(ctx, 0x00530/4, 0x2155b699);
	INSTANCE_WR(ctx, 0x00534/4, 0xfedcba98);
	INSTANCE_WR(ctx, 0x00538/4, 0x00000098);
	INSTANCE_WR(ctx, 0x00548/4, 0xffffffff);
	INSTANCE_WR(ctx, 0x0054c/4, 0x00ff7000);
	INSTANCE_WR(ctx, 0x00550/4, 0x0000ffff);
	INSTANCE_WR(ctx, 0x0055c/4, 0x00ff0000);
	INSTANCE_WR(ctx, 0x00594/4, 0x00ffff00);
	for (i=0x005d8; i<=0x00614; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00018488);
	for (i=0x00618; i<=0x00654; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00028202);
	for (i=0x00698; i<=0x006d4; i+=4)
		INSTANCE_WR(ctx, i/4, 0x0000aae4);
	for (i=0x006d8; i<=0x00714; i+=4)
		INSTANCE_WR(ctx, i/4, 0x01012000);
	for (i=0x00718; i<=0x00754; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00080008);
	for (i=0x00798; i<=0x007d4; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00100008);
	for (i=0x00828; i<=0x00834; i+=4)
		INSTANCE_WR(ctx, i/4, 0x0001bc80);
	for (i=0x00838; i<=0x00844; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00000202);
	for (i=0x00858; i<=0x00864; i+=4)
		INSTANCE_WR(ctx, i/4, 0x00000008);
	for (i=0x00878; i<=0x00884; i+=4)