summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-01-16 23:14:31 (GMT)
committerBen Skeggs <bskeggs@redhat.com>2011-01-16 23:14:31 (GMT)
commit38e8809bb415bae5c182fc79c8fc62992c5e4ed0 (patch)
treeadaebd7f2468db182678aa50db4b2706c3c5ef50
parentb795ca6e97fae9735843748585401098dae1c3e1 (diff)
nvc0: merge initial acceleration support
Squashed commit of the following: commit e8ce1ef351ee51bec51211dca6fda88fdbfbefee Author: Ben Skeggs <bskeggs@redhat.com> Date: Mon Jan 17 08:55:04 2011 +1000 fix hardcoding of nvc0 wfb path commit b414b1f948da18d96309bad84c54948d877efaa6 Author: Ben Skeggs <bskeggs@redhat.com> Date: Mon Jan 17 08:52:53 2011 +1000 general tidy-ups in preparation for merge to master commit 73bf71d5de0cb990178a1d2a31e0ea1717c214a4 Merge: fb499a4 b795ca6 Author: Ben Skeggs <bskeggs@redhat.com> Date: Mon Jan 17 08:47:40 2011 +1000 Merge branch 'master' into nvc0 commit fb499a4e9d95650dc89f4c1820b94d01344733f6 Author: Ben Skeggs <bskeggs@redhat.com> Date: Mon Dec 20 12:54:43 2010 +1000 nvc0: switch to "standard" RING macros commit 64f0e1d0e9e29c5437ad4e52d01ccfb0b03a2ae9 Merge: eba7e17 c2092a4 Author: Ben Skeggs <bskeggs@redhat.com> Date: Mon Dec 20 11:58:42 2010 +1000 Merge branch 'master' into nvc0 Conflicts: src/nv_dma.c commit eba7e173a5006ff50b950d0e8b8154564471a9ce Author: Ben Skeggs <bskeggs@redhat.com> Date: Fri Dec 17 11:04:40 2010 +1000 nvc0/xv: use mad in nv12 shader, rather than mul+add Signed-off-by: Ben Skeggs <bskeggs@redhat.com> commit b025ceb40a5e94a3657f3c7f76044c49a1a05e8d Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Thu Dec 16 23:34:29 2010 +0100 nvc0: fix offset of 17bc buffer I had messed it up in 5e4da3451c3c0f645f98fea7fb0ce2629b1bfd2f. commit 6ff5a9a7f3411ef218f17fa481c583596ffde2cc Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Thu Dec 16 01:07:25 2010 +0100 nvc0/xv: bind textures for the FP, not the TEP commit 5e4da3451c3c0f645f98fea7fb0ce2629b1bfd2f Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Thu Dec 16 01:02:58 2010 +0100 nvc0: switch to rnn headers commit 0839041e79dbb0e629326d0f240220b33921db1a Author: Ben Skeggs <bskeggs@redhat.com> Date: Wed Dec 15 16:42:41 2010 +1000 nvc0/exa: fix m2mf dfs commit 88c1c43302331e1cb8b7035bfb4677a5e7da3090 Author: Ben Skeggs <bskeggs@redhat.com> Date: Mon Dec 13 12:00:23 2010 +1000 nvc0: add Xv implementation commit ad5b4cfe388a102a0c93f7281cb4bba532b1796b Merge: 1942a81 b6cb21b Author: Ben Skeggs <bskeggs@redhat.com> Date: Wed Dec 15 14:57:04 2010 +1000 Merge branch 'master' into nvc0 commit 1942a81c0eb592972d4a3e8c46b80192ae8d1a59 Author: Ben Skeggs <bskeggs@redhat.com> Date: Thu Dec 9 12:48:27 2010 +1000 nvc0: call grobj_alloc for all used object classes Though the hardware has no concept of object handles any more, the nouveau DRM still uses this call to know what engines are in use. commit 0c670a6d406fe0a57373fa9e03005be6f28ecc3e Author: Ben Skeggs <bskeggs@redhat.com> Date: Thu Dec 9 12:44:41 2010 +1000 nvc0: don't try and create DmaNotifier0 commit 5d3d20d908a50ad7742567d58969c7f12dd944f7 Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Thu Dec 9 01:36:32 2010 +0100 nvc0: change tile_mode to contain 0xZYX instead of 0xZY Warning: the kernel will not like that (EVO) commit dd7fd8263e0e9f92412fb20086e4c8acf8cab099 Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Thu Dec 9 00:29:58 2010 +0100 exa: don't fall back to nv04 m2mf if nvc0 m2mf fails commit b4cf5a8f2276392945c2530f0d6fe96b5ab4b5da Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Thu Dec 9 00:07:59 2010 +0100 nvc0/exa: remove noisy debug messages commit 5419ef6d2cfabb7329982cb8dbdb5bbc8e973fe3 Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Wed Dec 8 23:55:51 2010 +0100 nvc0/accel: remove unneeded scratch method 0x3420 init It was intended be read by a MACRO method to get the address for constants upload. commit 178356391ff6831599eba257a5912079894641a1 Merge: 8573280 8bb8231 Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Thu Dec 9 01:31:40 2010 +0100 Merge remote branch 'origin/master' into nvc0 Conflicts: src/drmmode_display.c src/nouveau_exa.c src/nv_driver.c src/nv_type.h commit 8573280871401e29f27fa24d0b7c6ac5e35b2cc1 Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Sat Jul 3 14:27:36 2010 +0200 nvc0: initial implementation EXA should work, Xv not yet done.
-rw-r--r--src/Makefile.am3
-rw-r--r--src/nouveau_class.h975
-rw-r--r--src/nouveau_exa.c49
-rw-r--r--src/nouveau_local.h3
-rw-r--r--src/nouveau_wfb.c5
-rw-r--r--src/nouveau_xv.c26
-rw-r--r--src/nv50_defs.xml.h144
-rw-r--r--src/nv50_xv.c5
-rw-r--r--src/nv_3ddefs.xml.h93
-rw-r--r--src/nv_accel_common.c63
-rw-r--r--src/nv_driver.c2
-rw-r--r--src/nv_object.xml.h246
-rw-r--r--src/nv_proto.h34
-rw-r--r--src/nvc0_3d.xml.h1093
-rw-r--r--src/nvc0_accel.c728
-rw-r--r--src/nvc0_accel.h83
-rw-r--r--src/nvc0_exa.c1200
-rw-r--r--src/nvc0_m2mf.xml.h138
-rw-r--r--src/nvc0_xv.c427
19 files changed, 4318 insertions, 999 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 9340c45..e9e84ae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -58,6 +58,9 @@ nouveau_drv_la_SOURCES = \
nv50_exa.c \
nv50_xv.c \
nv50_texture.h \
+ nvc0_accel.c nvc0_accel.h \
+ nvc0_exa.c \
+ nvc0_xv.c \
drmmode_display.c \
vl_hwmc.c \
vl_hwmc.h
diff --git a/src/nouveau_class.h b/src/nouveau_class.h
index 5ce978a..5f4a829 100644
--- a/src/nouveau_class.h
+++ b/src/nouveau_class.h
@@ -735,44 +735,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT_HIGH 0x0000023c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT 0x00009039
-
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_NOP 0x00000100
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_SERIALIZE 0x00000110
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_MODE_IN 0x00000204
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_PITCH_IN 0x00000208
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_HEIGHT_IN 0x0000020c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_DEPTH_IN 0x00000210
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Z 0x00000214
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_MODE_OUT 0x00000220
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_PITCH_OUT 0x00000224
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_HEIGHT_OUT 0x00000228
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_DEPTH_OUT 0x0000022c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Z 0x00000230
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT_HIGH 0x00000238
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT_LOW 0x0000023c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC 0x00000300
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_PUSH (1 << 0)
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_LINEAR_IN (1 << 4)
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_LINEAR_OUT (1 << 8)
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_NOTIFY (1 << 13)
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_INC_SHIFT 20
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_INC_MASK 0x00f00000
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_DATA 0x00000304
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN_HIGH 0x0000030c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN_LOW 0x00000310
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_PITCH_IN 0x00000314
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_PITCH_OUT 0x00000318
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_LINE_LENGTH_IN 0x0000031c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_LINE_COUNT 0x00000320
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_NOTIFY_ADDRESS_HIGH 0x0000032c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_NOTIFY_ADDRESS_LOW 0x00000330
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_NOTIFY 0x00000334
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_X 0x00000344
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Y 0x00000348
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_X 0x0000034c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Y 0x00000350
-
#define NV01_MEMORY_LOCAL_BANKED 0x0000003d
@@ -9112,938 +9074,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_COMPUTE_USER_PARAM__SIZE 0x00000040
-#define NVC0TCL 0x00009097
-
-#define NVC0TCL_SEMAPHORE_ADDRESS_HIGH 0x00000010
-#define NVC0TCL_SEMAPHORE_ADDRESS_LOW 0x00000014
-#define NVC0TCL_NOP 0x00000100
-#define NVC0TCL_NOTIFY_ADDRESS_HIGH 0x00000104
-#define NVC0TCL_NOTIFY_ADDRESS_LOW 0x00000108
-#define NVC0TCL_NOTIFY 0x0000010c
-#define NVC0TCL_SERIALIZE 0x00000110
-#define NVC0TCL_EARLY_FRAGMENT_TESTS 0x00000210
-#define NVC0TCL_TESS_MODE 0x00000320
-#define NVC0TCL_TESS_MODE_PRIM_SHIFT 0
-#define NVC0TCL_TESS_MODE_PRIM_MASK 0x0000000f
-#define NVC0TCL_TESS_MODE_PRIM_ISOLINES 0x00000000
-#define NVC0TCL_TESS_MODE_PRIM_TRIANGLES 0x00000001
-#define NVC0TCL_TESS_MODE_PRIM_QUADS 0x00000002
-#define NVC0TCL_TESS_MODE_SPACING_SHIFT 4
-#define NVC0TCL_TESS_MODE_SPACING_MASK 0x000000f0
-#define NVC0TCL_TESS_MODE_SPACING_EQUAL 0x00000000
-#define NVC0TCL_TESS_MODE_SPACING_FRACTIONAL_ODD 0x00000010
-#define NVC0TCL_TESS_MODE_SPACING_FRACTIONAL_EVEN 0x00000020
-#define NVC0TCL_TESS_MODE_CW (1 << 8)
-#define NVC0TCL_TESS_MODE_CONNECTED (1 << 9)
-#define NVC0TCL_TESS_LEVEL_OUTER(x) (0x00000324+((x)*4))
-#define NVC0TCL_TESS_LEVEL_OUTER__SIZE 0x00000004
-#define NVC0TCL_TESS_LEVEL_INNER(x) (0x00000334+((x)*4))
-#define NVC0TCL_TESS_LEVEL_INNER__SIZE 0x00000002
-#define NVC0TCL_RASTERIZE_ENABLE 0x0000037c
-#define NVC0TCL_TFB_BUFFER_ENABLE(x) (0x00000380+((x)*32))
-#define NVC0TCL_TFB_BUFFER_ENABLE__SIZE 0x00000004
-#define NVC0TCL_TFB_ADDRESS_HIGH(x) (0x00000384+((x)*32))
-#define NVC0TCL_TFB_ADDRESS_HIGH__SIZE 0x00000004
-#define NVC0TCL_TFB_ADDRESS_LOW(x) (0x00000388+((x)*32))
-#define NVC0TCL_TFB_ADDRESS_LOW__SIZE 0x00000004
-#define NVC0TCL_TFB_BUFFER_SIZE(x) (0x0000038c+((x)*32))
-#define NVC0TCL_TFB_BUFFER_SIZE__SIZE 0x00000004
-#define NVC0TCL_TFB_PRIMITIVE_ID(x) (0x00000390+((x)*32))
-#define NVC0TCL_TFB_PRIMITIVE_ID__SIZE 0x00000004
-#define NVC0TCL_TFB_UNK0700(x) (0x00000700+((x)*16))
-#define NVC0TCL_TFB_UNK0700__SIZE 0x00000004
-#define NVC0TCL_TFB_VARYING_COUNT(x) (0x00000704+((x)*16))
-#define NVC0TCL_TFB_VARYING_COUNT__SIZE 0x00000004
-#define NVC0TCL_TFB_BUFFER_STRIDE(x) (0x00000708+((x)*16))
-#define NVC0TCL_TFB_BUFFER_STRIDE__SIZE 0x00000004
-#define NVC0TCL_TFB_ENABLE 0x00000744
-#define NVC0TCL_LOCAL_BASE 0x0000077c
-#define NVC0TCL_UNK0790_ADDRESS_HIGH 0x00000790
-#define NVC0TCL_UNK0790_ADDRESS_LOW 0x00000794
-#define NVC0TCL_RT_ADDRESS_HIGH(x) (0x00000800+((x)*32))
-#define NVC0TCL_RT_ADDRESS_HIGH__SIZE 0x00000008
-#define NVC0TCL_RT_ADDRESS_LOW(x) (0x00000804+((x)*32))
-#define NVC0TCL_RT_ADDRESS_LOW__SIZE 0x00000008
-#define NVC0TCL_RT_HORIZ(x) (0x00000808+((x)*32))
-#define NVC0TCL_RT_HORIZ__SIZE 0x00000008
-#define NVC0TCL_RT_VERT(x) (0x0000080c+((x)*32))
-#define NVC0TCL_RT_VERT__SIZE 0x00000008
-#define NVC0TCL_RT_FORMAT(x) (0x00000810+((x)*32))
-#define NVC0TCL_RT_FORMAT__SIZE 0x00000008
-#define NVC0TCL_RT_FORMAT_R32G32B32A32_FLOAT 0x000000c0
-#define NVC0TCL_RT_FORMAT_R32G32B32A32_SINT 0x000000c1
-#define NVC0TCL_RT_FORMAT_R32G32B32A32_UINT 0x000000c2
-#define NVC0TCL_RT_FORMAT_R32G32B32X32_FLOAT 0x000000c3
-#define NVC0TCL_RT_FORMAT_R16G16B16A16_UNORM 0x000000c6
-#define NVC0TCL_RT_FORMAT_R16G16B16A16_SNORM 0x000000c7
-#define NVC0TCL_RT_FORMAT_R16G16B16A16_SINT 0x000000c8
-#define NVC0TCL_RT_FORMAT_R16G16B16A16_UINT 0x000000c9
-#define NVC0TCL_RT_FORMAT_R16G16B16A16_FLOAT 0x000000ca
-#define NVC0TCL_RT_FORMAT_R32G32_FLOAT 0x000000cb
-#define NVC0TCL_RT_FORMAT_R32G32_SINT 0x000000cc
-#define NVC0TCL_RT_FORMAT_R32G32_UINT 0x000000cd
-#define NVC0TCL_RT_FORMAT_R16G16B16X16_FLOAT 0x000000ce
-#define NVC0TCL_RT_FORMAT_A8R8G8B8_UNORM 0x000000cf
-#define NVC0TCL_RT_FORMAT_A8R8G8B8_SRGB 0x000000d0
-#define NVC0TCL_RT_FORMAT_A2B10G10R10_UNORM 0x000000d1
-#define NVC0TCL_RT_FORMAT_A2B10G10R10_UINT 0x000000d2
-#define NVC0TCL_RT_FORMAT_A8B8G8R8_UNORM 0x000000d5
-#define NVC0TCL_RT_FORMAT_A8B8G8R8_SRGB 0x000000d6
-#define NVC0TCL_RT_FORMAT_A8B8G8R8_SNORM 0x000000d7
-#define NVC0TCL_RT_FORMAT_A8B8G8R8_SINT 0x000000d8
-#define NVC0TCL_RT_FORMAT_A8B8G8R8_UINT 0x000000d9
-#define NVC0TCL_RT_FORMAT_R16G16_UNORM 0x000000da
-#define NVC0TCL_RT_FORMAT_R16G16_SNORM 0x000000db
-#define NVC0TCL_RT_FORMAT_R16G16_SINT 0x000000dc
-#define NVC0TCL_RT_FORMAT_R16G16_UINT 0x000000dd
-#define NVC0TCL_RT_FORMAT_R16G16_FLOAT 0x000000de
-#define NVC0TCL_RT_FORMAT_A2R10G10B10_UNORM 0x000000df
-#define NVC0TCL_RT_FORMAT_B10G11R11_FLOAT 0x000000e0
-#define NVC0TCL_RT_FORMAT_R32_FLOAT 0x000000e5
-#define NVC0TCL_RT_FORMAT_X8R8G8B8_UNORM 0x000000e6
-#define NVC0TCL_RT_FORMAT_X8R8G8B8_SRGB 0x000000e7
-#define NVC0TCL_RT_FORMAT_R5G6B5_UNORM 0x000000e8
-#define NVC0TCL_RT_FORMAT_A1R5G5B5_UNORM 0x000000e9
-#define NVC0TCL_RT_FORMAT_R8G8_UNORM 0x000000ea
-#define NVC0TCL_RT_FORMAT_R8G8_SNORM 0x000000eb
-#define NVC0TCL_RT_FORMAT_R8G8_SINT 0x000000ec
-#define NVC0TCL_RT_FORMAT_R8G8_UINT 0x000000ed
-#define NVC0TCL_RT_FORMAT_R16_UNORM 0x000000ee
-#define NVC0TCL_RT_FORMAT_R16_SNORM 0x000000ef
-#define NVC0TCL_RT_FORMAT_R16_SINT 0x000000f0
-#define NVC0TCL_RT_FORMAT_R16_UINT 0x000000f1
-#define NVC0TCL_RT_FORMAT_R16_FLOAT 0x000000f2
-#define NVC0TCL_RT_FORMAT_R8_UNORM 0x000000f3
-#define NVC0TCL_RT_FORMAT_R8_SNORM 0x000000f4
-#define NVC0TCL_RT_FORMAT_R8_SINT 0x000000f5
-#define NVC0TCL_RT_FORMAT_R8_UINT 0x000000f6
-#define NVC0TCL_RT_FORMAT_A8_UNORM 0x000000f7
-#define NVC0TCL_RT_FORMAT_X1R5G5B5_UNORM 0x000000f8
-#define NVC0TCL_RT_FORMAT_X8B8G8R8_UNORM 0x000000f9
-#define NVC0TCL_RT_FORMAT_X8B8G8R8_SRGB 0x000000fa
-#define NVC0TCL_RT_TILE_MODE(x) (0x00000814+((x)*32))
-#define NVC0TCL_RT_TILE_MODE__SIZE 0x00000008
-#define NVC0TCL_RT_ARRAY_MODE(x) (0x00000818+((x)*32))
-#define NVC0TCL_RT_ARRAY_MODE__SIZE 0x00000008
-#define NVC0TCL_RT_ARRAY_MODE_LAYERS_SHIFT 0
-#define NVC0TCL_RT_ARRAY_MODE_LAYERS_MASK 0x0000ffff
-#define NVC0TCL_RT_ARRAY_MODE_VOLUME (1 << 16)
-#define NVC0TCL_RT_LAYER_STRIDE(x) (0x0000081c+((x)*32))
-#define NVC0TCL_RT_LAYER_STRIDE__SIZE 0x00000008
-#define NVC0TCL_VIEWPORT_SCALE_X(x) (0x00000a00+((x)*32))
-#define NVC0TCL_VIEWPORT_SCALE_X__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_SCALE_Y(x) (0x00000a04+((x)*32))
-#define NVC0TCL_VIEWPORT_SCALE_Y__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_SCALE_Z(x) (0x00000a08+((x)*32))
-#define NVC0TCL_VIEWPORT_SCALE_Z__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_TRANSLATE_X(x) (0x00000a0c+((x)*32))
-#define NVC0TCL_VIEWPORT_TRANSLATE_X__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_TRANSLATE_Y(x) (0x00000a10+((x)*32))
-#define NVC0TCL_VIEWPORT_TRANSLATE_Y__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_TRANSLATE_Z(x) (0x00000a14+((x)*32))
-#define NVC0TCL_VIEWPORT_TRANSLATE_Z__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_HORIZ(x) (0x00000c00+((x)*16))
-#define NVC0TCL_VIEWPORT_HORIZ__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_HORIZ_X_SHIFT 0
-#define NVC0TCL_VIEWPORT_HORIZ_X_MASK 0x0000ffff
-#define NVC0TCL_VIEWPORT_HORIZ_W_SHIFT 16
-#define NVC0TCL_VIEWPORT_HORIZ_W_MASK 0xffff0000
-#define NVC0TCL_VIEWPORT_VERT(x) (0x00000c04+((x)*16))
-#define NVC0TCL_VIEWPORT_VERT__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_VERT_Y_SHIFT 0
-#define NVC0TCL_VIEWPORT_VERT_Y_MASK 0x0000ffff
-#define NVC0TCL_VIEWPORT_VERT_H_SHIFT 16
-#define NVC0TCL_VIEWPORT_VERT_H_MASK 0xffff0000
-#define NVC0TCL_DEPTH_RANGE_NEAR(x) (0x00000c08+((x)*16))
-#define NVC0TCL_DEPTH_RANGE_NEAR__SIZE 0x00000010
-#define NVC0TCL_DEPTH_RANGE_FAR(x) (0x00000c0c+((x)*16))
-#define NVC0TCL_DEPTH_RANGE_FAR__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ(x) (0x00000d00+((x)*8))
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ__SIZE 0x00000008
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ_MIN_SHIFT 0
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ_MIN_MASK 0x0000ffff
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ_MAX_SHIFT 16
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ_MAX_MASK 0xffff0000
-#define NVC0TCL_VIEWPORT_CLIP_VERT(x) (0x00000d04+((x)*8))
-#define NVC0TCL_VIEWPORT_CLIP_VERT__SIZE 0x00000008
-#define NVC0TCL_VIEWPORT_CLIP_VERT_MIN_SHIFT 0
-#define NVC0TCL_VIEWPORT_CLIP_VERT_MIN_MASK 0x0000ffff
-#define NVC0TCL_VIEWPORT_CLIP_VERT_MAX_SHIFT 16
-#define NVC0TCL_VIEWPORT_CLIP_VERT_MAX_MASK 0xffff0000
-#define NVC0TCL_CLIPID_REGION_HORIZ(x) (0x00000d40+((x)*8))
-#define NVC0TCL_CLIPID_REGION_HORIZ__SIZE 0x00000004
-#define NVC0TCL_CLIPID_REGION_VERT(x) (0x00000d44+((x)*8))
-#define NVC0TCL_CLIPID_REGION_VERT__SIZE 0x00000004
-#define NVC0TCL_VERTEX_BUFFER_FIRST 0x00000d74
-#define NVC0TCL_VERTEX_BUFFER_COUNT 0x00000d78
-#define NVC0TCL_CLEAR_COLOR(x) (0x00000d80+((x)*4))
-#define NVC0TCL_CLEAR_COLOR__SIZE 0x00000004
-#define NVC0TCL_CLEAR_DEPTH 0x00000d90
-#define NVC0TCL_STACK_ADDRESS_HIGH 0x00000d94
-#define NVC0TCL_STACK_ADDRESS_LOW 0x00000d98
-#define NVC0TCL_STACK_SIZE_LOG 0x00000d9c
-#define NVC0TCL_CLEAR_STENCIL 0x00000da0
-#define NVC0TCL_POLYGON_SMOOTH_ENABLE 0x00000db4
-#define NVC0TCL_POLYGON_OFFSET_POINT_ENABLE 0x00000dc0
-#define NVC0TCL_POLYGON_OFFSET_LINE_ENABLE 0x00000dc4
-#define NVC0TCL_POLYGON_OFFSET_FILL_ENABLE 0x00000dc8
-#define NVC0TCL_PATCH_VERTICES 0x00000dcc
-#define NVC0TCL_WATCHDOG_TIMER 0x00000de4
-#define NVC0TCL_WINDOW_OFFSET_X 0x00000df8
-#define NVC0TCL_WINDOW_OFFSET_Y 0x00000dfc
-#define NVC0TCL_SCISSOR_ENABLE(x) (0x00000e00+((x)*16))
-#define NVC0TCL_SCISSOR_ENABLE__SIZE 0x00000010
-#define NVC0TCL_SCISSOR_HORIZ(x) (0x00000e04+((x)*16))
-#define NVC0TCL_SCISSOR_HORIZ__SIZE 0x00000010
-#define NVC0TCL_SCISSOR_HORIZ_MIN_SHIFT 0
-#define NVC0TCL_SCISSOR_HORIZ_MIN_MASK 0x0000ffff
-#define NVC0TCL_SCISSOR_HORIZ_MAX_SHIFT 16
-#define NVC0TCL_SCISSOR_HORIZ_MAX_MASK 0xffff0000
-#define NVC0TCL_SCISSOR_VERT(x) (0x00000e08+((x)*16))
-#define NVC0TCL_SCISSOR_VERT__SIZE 0x00000010
-#define NVC0TCL_SCISSOR_VERT_MIN_SHIFT 0
-#define NVC0TCL_SCISSOR_VERT_MIN_MASK 0x0000ffff
-#define NVC0TCL_SCISSOR_VERT_MAX_SHIFT 16
-#define NVC0TCL_SCISSOR_VERT_MAX_MASK 0xffff0000
-#define NVC0TCL_LOCAL_WARPS_LOG_ALLOC 0x00000f44
-#define NVC0TCL_LOCAL_WARPS_NO_CLAMP 0x00000f48
-#define NVC0TCL_STACK_WARPS_LOG_ALLOC 0x00000f4c
-#define NVC0TCL_STACK_WARPS_NO_CLAMP 0x00000f50
-#define NVC0TCL_STENCIL_BACK_FUNC_REF 0x00000f54
-#define NVC0TCL_STENCIL_BACK_MASK 0x00000f58
-#define NVC0TCL_STENCIL_BACK_FUNC_MASK 0x00000f5c
-#define NVC0TCL_VERTEX_RUNOUT_HIGH 0x00000f84
-#define NVC0TCL_VERTEX_RUNOUT_LOW 0x00000f88
-#define NVC0TCL_DEPTH_BOUNDS(x) (0x00000f9c+((x)*4))
-#define NVC0TCL_DEPTH_BOUNDS__SIZE 0x00000002
-#define NVC0TCL_MSAA_MASK(x) (0x00000fbc+((x)*4))
-#define NVC0TCL_MSAA_MASK__SIZE 0x00000004
-#define NVC0TCL_CLIPID_ADDRESS_HIGH 0x00000fcc
-#define NVC0TCL_CLIPID_ADDRESS_LOW 0x00000fd0
-#define NVC0TCL_ZETA_ADDRESS_HIGH 0x00000fe0
-#define NVC0TCL_ZETA_ADDRESS_LOW 0x00000fe4
-#define NVC0TCL_ZETA_FORMAT 0x00000fe8
-#define NVC0TCL_ZETA_FORMAT_Z32_FLOAT 0x0000000a
-#define NVC0TCL_ZETA_FORMAT_Z16_UNORM 0x00000013
-#define NVC0TCL_ZETA_FORMAT_Z24S8_UNORM 0x00000014
-#define NVC0TCL_ZETA_FORMAT_X8Z24_UNORM 0x00000015
-#define NVC0TCL_ZETA_FORMAT_S8Z24_UNORM 0x00000016
-#define NVC0TCL_ZETA_FORMAT_Z32_FLOAT_X24S8_UNORM 0x00000019
-#define NVC0TCL_ZETA_TILE_MODE 0x00000fec
-#define NVC0TCL_ZETA_LAYER_STRIDE 0x00000ff0
-#define NVC0TCL_SCREEN_SCISSOR_HORIZ 0x00000ff4
-#define NVC0TCL_SCREEN_SCISSOR_HORIZ_W_SHIFT 16
-#define NVC0TCL_SCREEN_SCISSOR_HORIZ_W_MASK 0xffff0000
-#define NVC0TCL_SCREEN_SCISSOR_HORIZ_X_SHIFT 0
-#define NVC0TCL_SCREEN_SCISSOR_HORIZ_X_MASK 0x0000ffff
-#define NVC0TCL_SCREEN_SCISSOR_VERT 0x00000ff8
-#define NVC0TCL_SCREEN_SCISSOR_VERT_H_SHIFT 16
-#define NVC0TCL_SCREEN_SCISSOR_VERT_H_MASK 0xffff0000
-#define NVC0TCL_SCREEN_SCISSOR_VERT_Y_SHIFT 0
-#define NVC0TCL_SCREEN_SCISSOR_VERT_Y_MASK 0x0000ffff
-#define NVC0TCL_VTX_ATTR_DEFINE 0x0000114c
-#define NVC0TCL_VTX_ATTR_DEFINE_ATTR_SHIFT 0
-#define NVC0TCL_VTX_ATTR_DEFINE_ATTR_MASK 0x0000003f
-#define NVC0TCL_VTX_ATTR_DEFINE_COMP_SHIFT 8
-#define NVC0TCL_VTX_ATTR_DEFINE_COMP_MASK 0x00000f00
-#define NVC0TCL_VTX_ATTR_DEFINE_SIZE_SHIFT 12
-#define NVC0TCL_VTX_ATTR_DEFINE_SIZE_MASK 0x0000f000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_SHIFT 16
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_MASK 0x000f0000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_FLOAT 0x00070000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_UNORM 0x00010000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_SNORM 0x00020000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_USCALED 0x00050000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_SSCALED 0x00060000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_UINT 0x00040000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_SINT 0x00030000
-#define NVC0TCL_VTX_ATTR_DATA(x) (0x00001150+((x)*4))
-#define NVC0TCL_VTX_ATTR_DATA__SIZE 0x00000004
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT(x) (0x00001160+((x)*4))
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT__SIZE 0x00000020
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_BUFFER_SHIFT 0
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_BUFFER_MASK 0x0000003f
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_CONST (1 << 6)
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_OFFSET_SHIFT 7
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_OFFSET_MASK 0x001fff80
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_SHIFT 21
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_MASK 0x07e00000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_32_32_32_32 0x00200000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_32_32_32 0x00400000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_16_16_16_16 0x00600000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_32_32 0x00800000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_16_16_16 0x00a00000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_8_8_8_8 0x01400000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_16_16 0x01e00000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_32 0x02400000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_8_8_8 0x02600000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_8_8 0x03000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_16 0x03600000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_8 0x03a00000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_2_10_10_10 0x06000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_SHIFT 27
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_MASK 0x78000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_FLOAT 0x38000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_UNORM 0x08000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_SNORM 0x10000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_USCALED 0x28000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_SSCALED 0x30000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_UINT 0x20000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_SINT 0x18000000
-#define NVC0TCL_RT_CONTROL 0x0000121c
-#define NVC0TCL_RT_CONTROL_COUNT_SHIFT 0
-#define NVC0TCL_RT_CONTROL_COUNT_MASK 0x0000000f
-#define NVC0TCL_RT_CONTROL_MAP0_SHIFT 4
-#define NVC0TCL_RT_CONTROL_MAP0_MASK 0x00000070
-#define NVC0TCL_RT_CONTROL_MAP1_SHIFT 7
-#define NVC0TCL_RT_CONTROL_MAP1_MASK 0x00000380
-#define NVC0TCL_RT_CONTROL_MAP2_SHIFT 10
-#define NVC0TCL_RT_CONTROL_MAP2_MASK 0x00001c00
-#define NVC0TCL_RT_CONTROL_MAP3_SHIFT 13
-#define NVC0TCL_RT_CONTROL_MAP3_MASK 0x0000e000
-#define NVC0TCL_RT_CONTROL_MAP4_SHIFT 16
-#define NVC0TCL_RT_CONTROL_MAP4_MASK 0x00070000
-#define NVC0TCL_RT_CONTROL_MAP5_SHIFT 19
-#define NVC0TCL_RT_CONTROL_MAP5_MASK 0x00380000
-#define NVC0TCL_RT_CONTROL_MAP6_SHIFT 22
-#define NVC0TCL_RT_CONTROL_MAP6_MASK 0x01c00000
-#define NVC0TCL_RT_CONTROL_MAP7_SHIFT 25
-#define NVC0TCL_RT_CONTROL_MAP7_MASK 0x0e000000
-#define NVC0TCL_ZETA_HORIZ 0x00001228
-#define NVC0TCL_ZETA_VERT 0x0000122c
-#define NVC0TCL_ZETA_ARRAY_MODE 0x00001230
-#define NVC0TCL_ZETA_ARRAY_MODE_LAYERS_SHIFT 0
-#define NVC0TCL_ZETA_ARRAY_MODE_LAYERS_MASK 0x0000ffff
-#define NVC0TCL_ZETA_ARRAY_MODE_UNK (1 << 16)
-#define NVC0TCL_LINKED_TSC 0x00001234
-#define NVC0TCL_FP_RESULT_COUNT 0x00001298
-#define NVC0TCL_DEPTH_TEST_ENABLE 0x000012cc
-#define NVC0TCL_SHADE_MODEL 0x000012d4
-#define NVC0TCL_SHADE_MODEL_FLAT 0x00001d00
-#define NVC0TCL_SHADE_MODEL_SMOOTH 0x00001d01
-#define NVC0TCL_BLEND_INDEPENDENT 0x000012e4
-#define NVC0TCL_DEPTH_WRITE_ENABLE 0x000012e8
-#define NVC0TCL_ALPHA_TEST_ENABLE 0x000012ec
-#define NVC0TCL_PM_SET(x) (0x000012f0+((x)*4))
-#define NVC0TCL_PM_SET__SIZE 0x00000004
-#define NVC0TCL_VB_ELEMENT_U8_SETUP 0x00001300
-#define NVC0TCL_VB_ELEMENT_U8_SETUP_OFFSET_SHIFT 30
-#define NVC0TCL_VB_ELEMENT_U8_SETUP_OFFSET_MASK 0xc0000000
-#define NVC0TCL_VB_ELEMENT_U8_SETUP_COUNT_SHIFT 0
-#define NVC0TCL_VB_ELEMENT_U8_SETUP_COUNT_MASK 0x3fffffff
-#define NVC0TCL_VB_ELEMENT_U8 0x00001304
-#define NVC0TCL_VB_ELEMENT_U8_I0_SHIFT 0
-#define NVC0TCL_VB_ELEMENT_U8_I0_MASK 0x000000ff
-#define NVC0TCL_VB_ELEMENT_U8_I1_SHIFT 8
-#define NVC0TCL_VB_ELEMENT_U8_I1_MASK 0x0000ff00
-#define NVC0TCL_VB_ELEMENT_U8_I2_SHIFT 16
-#define NVC0TCL_VB_ELEMENT_U8_I2_MASK 0x00ff0000
-#define NVC0TCL_VB_ELEMENT_U8_I3_SHIFT 24
-#define NVC0TCL_VB_ELEMENT_U8_I3_MASK 0xff000000
-#define NVC0TCL_DEPTH_TEST_FUNC 0x0000130c
-#define NVC0TCL_DEPTH_TEST_FUNC_NEVER 0x00000200
-#define NVC0TCL_DEPTH_TEST_FUNC_LESS 0x00000201
-#define NVC0TCL_DEPTH_TEST_FUNC_EQUAL 0x00000202
-#define NVC0TCL_DEPTH_TEST_FUNC_LEQUAL 0x00000203
-#define NVC0TCL_DEPTH_TEST_FUNC_GREATER 0x00000204
-#define NVC0TCL_DEPTH_TEST_FUNC_NOTEQUAL 0x00000205
-#define NVC0TCL_DEPTH_TEST_FUNC_GEQUAL 0x00000206
-#define NVC0TCL_DEPTH_TEST_FUNC_ALWAYS 0x00000207
-#define NVC0TCL_ALPHA_TEST_REF 0x00001310
-#define NVC0TCL_ALPHA_TEST_FUNC 0x00001314
-#define NVC0TCL_ALPHA_TEST_FUNC_NEVER 0x00000200
-#define NVC0TCL_ALPHA_TEST_FUNC_LESS 0x00000201
-#define NVC0TCL_ALPHA_TEST_FUNC_EQUAL 0x00000202
-#define NVC0TCL_ALPHA_TEST_FUNC_LEQUAL 0x00000203
-#define NVC0TCL_ALPHA_TEST_FUNC_GREATER 0x00000204
-#define NVC0TCL_ALPHA_TEST_FUNC_NOTEQUAL 0x00000205
-#define NVC0TCL_ALPHA_TEST_FUNC_GEQUAL 0x00000206
-#define NVC0TCL_ALPHA_TEST_FUNC_ALWAYS 0x00000207
-#define NVC0TCL_BLEND_COLOR(x) (0x0000131c+((x)*4))
-#define NVC0TCL_BLEND_COLOR__SIZE 0x00000004
-#define NVC0TCL_TIC_FLUSH 0x00001330
-#define NVC0TCL_TSC_FLUSH 0x00001334
-#define NVC0TCL_TEX_CACHE_CTL 0x00001338
-#define NVC0TCL_BLEND_EQUATION_RGB 0x00001340
-#define NVC0TCL_BLEND_EQUATION_RGB_FUNC_ADD 0x00008006
-#define NVC0TCL_BLEND_EQUATION_RGB_MIN 0x00008007
-#define NVC0TCL_BLEND_EQUATION_RGB_MAX 0x00008008
-#define NVC0TCL_BLEND_EQUATION_RGB_FUNC_SUBTRACT 0x0000800a
-#define NVC0TCL_BLEND_EQUATION_RGB_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NVC0TCL_BLEND_FUNC_SRC_RGB 0x00001344
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_FUNC_DST_RGB 0x00001348
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNC_DST_RGB_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNC_DST_RGB_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNC_DST_RGB_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNC_DST_RGB_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNC_DST_RGB_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNC_DST_RGB_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNC_DST_RGB_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_EQUATION_ALPHA 0x0000134c
-#define NVC0TCL_BLEND_EQUATION_ALPHA_FUNC_ADD 0x00008006
-#define NVC0TCL_BLEND_EQUATION_ALPHA_MIN 0x00008007
-#define NVC0TCL_BLEND_EQUATION_ALPHA_MAX 0x00008008
-#define NVC0TCL_BLEND_EQUATION_ALPHA_FUNC_SUBTRACT 0x0000800a
-#define NVC0TCL_BLEND_EQUATION_ALPHA_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA 0x00001350
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA 0x00001358
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_STENCIL_ENABLE 0x00001380
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL 0x00001384
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_ZERO 0x00000000
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_INCR 0x00001e02
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_DECR 0x00001e03
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL 0x00001388
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_ZERO 0x00000000
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_INCR 0x00001e02
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_DECR 0x00001e03
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS 0x0000138c
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_ZERO 0x00000000
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_INCR 0x00001e02
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_DECR 0x00001e03
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC 0x00001390
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_NEVER 0x00000200
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_LESS 0x00000201
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_EQUAL 0x00000202
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_LEQUAL 0x00000203
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_GREATER 0x00000204
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_GEQUAL 0x00000206
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_ALWAYS 0x00000207
-#define NVC0TCL_STENCIL_FRONT_FUNC_REF 0x00001394
-#define NVC0TCL_STENCIL_FRONT_MASK 0x00001398
-#define NVC0TCL_STENCIL_FRONT_FUNC_MASK 0x0000139c
-#define NVC0TCL_FRAG_COLOR_CLAMP_EN 0x000013a8
-#define NVC0TCL_Y_ORIGIN_BOTTOM 0x000013ac
-#define NVC0TCL_LINE_WIDTH(x) (0x000013b0+((x)*4))
-#define NVC0TCL_LINE_WIDTH__SIZE 0x00000002
-#define NVC0TCL_POINT_COORD_REPLACE_MAP(x) (0x000013c0+((x)*4))
-#define NVC0TCL_POINT_COORD_REPLACE_MAP__SIZE 0x00000008
-#define NVC0TCL_GP_VERTEX_OUTPUT_COUNT 0x00001420
-#define NVC0TCL_FENCE 0x0000142c
-#define NVC0TCL_VB_ELEMENT_BASE 0x00001434
-#define NVC0TCL_INSTANCE_BASE 0x00001438
-#define NVC0TCL_CODE_CB_FLUSH 0x00001440
-#define NVC0TCL_CLIPID_HEIGHT 0x00001504
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE 0x00001510
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_0 (1 << 0)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_1 (1 << 1)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_2 (1 << 2)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_3 (1 << 3)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_4 (1 << 4)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_5 (1 << 5)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_6 (1 << 6)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_7 (1 << 7)
-#define NVC0TCL_SAMPLECNT_ENABLE 0x00001514
-#define NVC0TCL_POINT_SIZE 0x00001518
-#define NVC0TCL_POINT_SPRITE_ENABLE 0x00001520
-#define NVC0TCL_SAMPLECNT_RESET 0x00001530
-#define NVC0TCL_MULTISAMPLE_ZETA_ENABLE 0x00001534
-#define NVC0TCL_ZETA_ENABLE 0x00001538
-#define NVC0TCL_MULTISAMPLE_CTRL 0x0000153c
-#define NVC0TCL_MULTISAMPLE_CTRL_ALPHA_TO_COVERAGE (1 << 0)
-#define NVC0TCL_MULTISAMPLE_CTRL_ALPHA_TO_ONE (1 << 4)
-#define NVC0TCL_NOPERSPECTIVE_BITMAP(x) (0x00001540+((x)*4))
-#define NVC0TCL_NOPERSPECTIVE_BITMAP__SIZE 0x00000004
-#define NVC0TCL_COND_ADDRESS_HIGH 0x00001550
-#define NVC0TCL_COND_ADDRESS_LOW 0x00001554
-#define NVC0TCL_COND_MODE 0x00001558
-#define NVC0TCL_COND_MODE_NEVER 0x00000000
-#define NVC0TCL_COND_MODE_ALWAYS 0x00000001
-#define NVC0TCL_COND_MODE_RES 0x00000002
-#define NVC0TCL_COND_MODE_NOT_RES_AND_NOT_ID 0x00000003
-#define NVC0TCL_COND_MODE_RES_OR_ID 0x00000004
-#define NVC0TCL_TSC_ADDRESS_HIGH 0x0000155c
-#define NVC0TCL_TSC_ADDRESS_LOW 0x00001560
-#define NVC0TCL_TSC_LIMIT 0x00001564
-#define NVC0TCL_POLYGON_OFFSET_FACTOR 0x0000156c
-#define NVC0TCL_LINE_SMOOTH_ENABLE 0x00001570
-#define NVC0TCL_TIC_ADDRESS_HIGH 0x00001574
-#define NVC0TCL_TIC_ADDRESS_LOW 0x00001578
-#define NVC0TCL_TIC_LIMIT 0x0000157c
-#define NVC0TCL_PM_CONTROL(x) (0x00001580+((x)*4))
-#define NVC0TCL_PM_CONTROL__SIZE 0x00000004
-#define NVC0TCL_PM_CONTROL_UNK0 (1 << 0)
-#define NVC0TCL_PM_CONTROL_UNK1_SHIFT 4
-#define NVC0TCL_PM_CONTROL_UNK1_MASK 0x00000070
-#define NVC0TCL_PM_CONTROL_UNK2_SHIFT 8
-#define NVC0TCL_PM_CONTROL_UNK2_MASK 0xffffff00
-#define NVC0TCL_STENCIL_TWO_SIDE_ENABLE 0x00001594
-#define NVC0TCL_STENCIL_BACK_OP_FAIL 0x00001598
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_ZERO 0x00000000
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_INCR 0x00001e02
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_DECR 0x00001e03
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL 0x0000159c
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_ZERO 0x00000000
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_INCR 0x00001e02
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_DECR 0x00001e03
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS 0x000015a0
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_ZERO 0x00000000
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_INCR 0x00001e02
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_DECR 0x00001e03
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC 0x000015a4
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_NEVER 0x00000200
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_LESS 0x00000201
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_EQUAL 0x00000202
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_LEQUAL 0x00000203
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_GREATER 0x00000204
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_GEQUAL 0x00000206
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_ALWAYS 0x00000207
-#define NVC0TCL_MULTISAMPLE_COLOR_ENABLE 0x000015b4
-#define NVC0TCL_FRAMEBUFFER_SRGB 0x000015b8
-#define NVC0TCL_POLYGON_OFFSET_UNITS 0x000015bc
-#define NVC0TCL_GP_BUILTIN_RESULT_EN 0x000015cc
-#define NVC0TCL_GP_BUILTIN_RESULT_EN_VPORT (1 << 0)
-#define NVC0TCL_GP_BUILTIN_RESULT_EN_LAYER (1 << 16)
-#define NVC0TCL_MULTISAMPLE_MODE 0x000015d0
-#define NVC0TCL_MULTISAMPLE_MODE_1X 0x00000000
-#define NVC0TCL_MULTISAMPLE_MODE_2XMS 0x00000001
-#define NVC0TCL_MULTISAMPLE_MODE_4XMS 0x00000002
-#define NVC0TCL_MULTISAMPLE_MODE_8XMS 0x00000004
-#define NVC0TCL_MULTISAMPLE_MODE_4XMS_4XCS 0x00000008
-#define NVC0TCL_MULTISAMPLE_MODE_4XMS_12XCS 0x00000009
-#define NVC0TCL_MULTISAMPLE_MODE_8XMS_8XCS 0x0000000a
-#define NVC0TCL_EDGEFLAG_ENABLE 0x000015e4
-#define NVC0TCL_VB_ELEMENT_U32 0x000015e8
-#define NVC0TCL_VB_ELEMENT_U16_SETUP 0x000015ec
-#define NVC0TCL_VB_ELEMENT_U16_SETUP_OFFSET_SHIFT 30
-#define NVC0TCL_VB_ELEMENT_U16_SETUP_OFFSET_MASK 0xc0000000
-#define NVC0TCL_VB_ELEMENT_U16_SETUP_COUNT_SHIFT 0
-#define NVC0TCL_VB_ELEMENT_U16_SETUP_COUNT_MASK 0x3fffffff
-#define NVC0TCL_VB_ELEMENT_U16 0x000015f0
-#define NVC0TCL_VB_ELEMENT_U16_I0_SHIFT 0
-#define NVC0TCL_VB_ELEMENT_U16_I0_MASK 0x0000ffff
-#define NVC0TCL_VB_ELEMENT_U16_I1_SHIFT 16
-#define NVC0TCL_VB_ELEMENT_U16_I1_MASK 0xffff0000
-#define NVC0TCL_VERTEX_BASE_HIGH 0x000015f4
-#define NVC0TCL_VERTEX_BASE_LOW 0x000015f8
-#define NVC0TCL_CODE_ADDRESS_HIGH 0x00001608
-#define NVC0TCL_CODE_ADDRESS_LOW 0x0000160c
-#define NVC0TCL_VERTEX_BEGIN 0x00001618
-#define NVC0TCL_VERTEX_BEGIN_MODE_SHIFT 0
-#define NVC0TCL_VERTEX_BEGIN_MODE_MASK 0x0000000f
-#define NVC0TCL_VERTEX_BEGIN_MODE_POINTS 0x00000000
-#define NVC0TCL_VERTEX_BEGIN_MODE_LINES 0x00000001
-#define NVC0TCL_VERTEX_BEGIN_MODE_LINE_LOOP 0x00000002
-#define NVC0TCL_VERTEX_BEGIN_MODE_LINE_STRIP 0x00000003
-#define NVC0TCL_VERTEX_BEGIN_MODE_TRIANGLES 0x00000004
-#define NVC0TCL_VERTEX_BEGIN_MODE_TRIANGLE_STRIP 0x00000005
-#define NVC0TCL_VERTEX_BEGIN_MODE_TRIANGLE_FAN 0x00000006
-#define NVC0TCL_VERTEX_BEGIN_MODE_QUADS 0x00000007
-#define NVC0TCL_VERTEX_BEGIN_MODE_QUAD_STRIP 0x00000008
-#define NVC0TCL_VERTEX_BEGIN_MODE_POLYGON 0x00000009
-#define NVC0TCL_VERTEX_BEGIN_MODE_LINES_ADJACENCY 0x0000000a
-#define NVC0TCL_VERTEX_BEGIN_MODE_LINE_STRIP_ADJACENCY 0x0000000b
-#define NVC0TCL_VERTEX_BEGIN_MODE_TRIANGLES_ADJACENCY 0x0000000c
-#define NVC0TCL_VERTEX_BEGIN_MODE_TRIANGLE_STRIP_ADJACENCY 0x0000000d
-#define NVC0TCL_VERTEX_BEGIN_MODE_PATCHES 0x0000000e
-#define NVC0TCL_VERTEX_BEGIN_INSTANCE (1 << 26)
-#define NVC0TCL_VERTEX_END 0x00001614
-#define NVC0TCL_VERTEX_DATA 0x00001640
-#define NVC0TCL_PRIM_RESTART_ENABLE 0x00001644
-#define NVC0TCL_PRIM_RESTART_INDEX 0x00001648
-#define NVC0TCL_POINT_SMOOTH_ENABLE 0x00001658
-#define NVC0TCL_POINT_SPRITE_CTRL 0x00001660
-#define NVC0TCL_LINE_STIPPLE_ENABLE 0x0000166c
-#define NVC0TCL_LINE_STIPPLE_PATTERN 0x00001680
-#define NVC0TCL_PROVOKING_VERTEX_LAST 0x00001684
-#define NVC0TCL_VERTEX_TWO_SIDE_ENABLE 0x00001688
-#define NVC0TCL_POLYGON_STIPPLE_ENABLE 0x0000168c
-#define NVC0TCL_POLYGON_STIPPLE_PATTERN(x) (0x00001700+((x)*4))
-#define NVC0TCL_POLYGON_STIPPLE_PATTERN__SIZE 0x00000020
-#define NVC0TCL_UNK17BC_ADDRESS_HIGH 0x000017bc
-#define NVC0TCL_UNK17BC_ADDRESS_LOW 0x000017c0
-#define NVC0TCL_UNK17BC_LIMIT 0x000017c4
-#define NVC0TCL_VP_POINT_SIZE_EN 0x00001910
-#define NVC0TCL_CULL_FACE_ENABLE 0x00001918
-#define NVC0TCL_FRONT_FACE 0x0000191c
-#define NVC0TCL_FRONT_FACE_CW 0x00000900
-#define NVC0TCL_FRONT_FACE_CCW 0x00000901
-#define NVC0TCL_CULL_FACE 0x00001920
-#define NVC0TCL_CULL_FACE_FRONT 0x00000404
-#define NVC0TCL_CULL_FACE_BACK 0x00000405
-#define NVC0TCL_CULL_FACE_FRONT_AND_BACK 0x00000408
-#define NVC0TCL_VIEWPORT_TRANSFORM_EN 0x0000192c
-#define NVC0TCL_VIEW_VOLUME_CLIP_CTRL 0x0000193c
-#define NVC0TCL_VIEWPORT_CLIP_RECTS_EN 0x0000194c
-#define NVC0TCL_VIEWPORT_CLIP_MODE 0x00001950
-#define NVC0TCL_VIEWPORT_CLIP_MODE_INCLUDE 0x00000000
-#define NVC0TCL_VIEWPORT_CLIP_MODE_EXCLUDE 0x00000001
-#define NVC0TCL_VIEWPORT_CLIP_MODE_UNKNOWN 0x00000002
-#define NVC0TCL_FP_ZORDER_CTRL 0x0000196c
-#define NVC0TCL_CLIPID_ENABLE 0x0000197c
-#define NVC0TCL_CLIPID_WIDTH 0x00001980
-#define NVC0TCL_CLIPID_ID 0x00001984
-#define NVC0TCL_REG_MODE 0x000019a0
-#define NVC0TCL_REG_MODE_PACKED 0x00000001
-#define NVC0TCL_REG_MODE_STRIPED 0x00000002
-#define NVC0TCL_FP_CONTROL 0x000019a8
-#define NVC0TCL_FP_CONTROL_MULTIPLE_RESULTS (1 << 0)
-#define NVC0TCL_FP_CONTROL_EXPORTS_Z (1 << 8)
-#define NVC0TCL_FP_CONTROL_USES_KIL (1 << 20)
-#define NVC0TCL_DEPTH_BOUNDS_EN 0x000019bc
-#define NVC0TCL_LOGIC_OP_ENABLE 0x000019c4
-#define NVC0TCL_LOGIC_OP 0x000019c8
-#define NVC0TCL_LOGIC_OP_CLEAR 0x00001500
-#define NVC0TCL_LOGIC_OP_AND 0x00001501
-#define NVC0TCL_LOGIC_OP_AND_REVERSE 0x00001502
-#define NVC0TCL_LOGIC_OP_COPY 0x00001503
-#define NVC0TCL_LOGIC_OP_AND_INVERTED 0x00001504
-#define NVC0TCL_LOGIC_OP_NOOP 0x00001505
-#define NVC0TCL_LOGIC_OP_XOR 0x00001506
-#define NVC0TCL_LOGIC_OP_OR 0x00001507
-#define NVC0TCL_LOGIC_OP_NOR 0x00001508
-#define NVC0TCL_LOGIC_OP_EQUIV 0x00001509
-#define NVC0TCL_LOGIC_OP_INVERT 0x0000150a
-#define NVC0TCL_LOGIC_OP_OR_REVERSE 0x0000150b
-#define NVC0TCL_LOGIC_OP_COPY_INVERTED 0x0000150c
-#define NVC0TCL_LOGIC_OP_OR_INVERTED 0x0000150d
-#define NVC0TCL_LOGIC_OP_NAND 0x0000150e
-#define NVC0TCL_LOGIC_OP_SET 0x0000150f
-#define NVC0TCL_CLEAR_BUFFERS 0x000019d0
-#define NVC0TCL_CLEAR_BUFFERS_Z (1 << 0)
-#define NVC0TCL_CLEAR_BUFFERS_S (1 << 1)
-#define NVC0TCL_CLEAR_BUFFERS_R (1 << 2)
-#define NVC0TCL_CLEAR_BUFFERS_G (1 << 3)
-#define NVC0TCL_CLEAR_BUFFERS_B (1 << 4)
-#define NVC0TCL_CLEAR_BUFFERS_A (1 << 5)
-#define NVC0TCL_CLEAR_BUFFERS_RT_SHIFT 6
-#define NVC0TCL_CLEAR_BUFFERS_RT_MASK 0x000003c0
-#define NVC0TCL_CLEAR_BUFFERS_LAYER_SHIFT 10
-#define NVC0TCL_CLEAR_BUFFERS_LAYER_MASK 0x0007fc00
-#define NVC0TCL_COLOR_MASK(x) (0x00001a00+((x)*4))
-#define NVC0TCL_COLOR_MASK__SIZE 0x00000008
-#define NVC0TCL_COLOR_MASK_R_SHIFT 0
-#define NVC0TCL_COLOR_MASK_R_MASK 0x0000000f
-#define NVC0TCL_COLOR_MASK_G_SHIFT 4
-#define NVC0TCL_COLOR_MASK_G_MASK 0x000000f0
-#define NVC0TCL_COLOR_MASK_B_SHIFT 8
-#define NVC0TCL_COLOR_MASK_B_MASK 0x00000f00
-#define NVC0TCL_COLOR_MASK_A_SHIFT 12
-#define NVC0TCL_COLOR_MASK_A_MASK 0x0000f000
-#define NVC0TCL_QUERY_ADDRESS_HIGH 0x00001b00
-#define NVC0TCL_QUERY_ADDRESS_LOW 0x00001b04
-#define NVC0TCL_QUERY_SEQUENCE 0x00001b08
-#define NVC0TCL_QUERY_GET 0x00001b0c
-#define NVC0TCL_VERTEX_ARRAY_FETCH(x) (0x00001c00+((x)*16))
-#define NVC0TCL_VERTEX_ARRAY_FETCH__SIZE 0x00000020
-#define NVC0TCL_VERTEX_ARRAY_FETCH_STRIDE_SHIFT 0
-#define NVC0TCL_VERTEX_ARRAY_FETCH_STRIDE_MASK 0x00000fff
-#define NVC0TCL_VERTEX_ARRAY_FETCH_ENABLE (1 << 12)
-#define NVC0TCL_BLEND_EQUATIONI_RGB(x) (0x00001e04+((x)*32))
-#define NVC0TCL_BLEND_EQUATIONI_RGB__SIZE 0x00000008
-#define NVC0TCL_BLEND_EQUATIONI_RGB_FUNC_ADD 0x00008006
-#define NVC0TCL_BLEND_EQUATIONI_RGB_MIN 0x00008007
-#define NVC0TCL_BLEND_EQUATIONI_RGB_MAX 0x00008008
-#define NVC0TCL_BLEND_EQUATIONI_RGB_FUNC_SUBTRACT 0x0000800a
-#define NVC0TCL_BLEND_EQUATIONI_RGB_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB(x) (0x00001e08+((x)*32))
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB__SIZE 0x00000008
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_FUNCI_DST_RGB(x) (0x00001e0c+((x)*32))
-#define NVC0TCL_BLEND_FUNCI_DST_RGB__SIZE 0x00000008
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA(x) (0x00001e10+((x)*32))
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA__SIZE 0x00000008
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA_FUNC_ADD 0x00008006
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA_MIN 0x00008007
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA_MAX 0x00008008
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA_FUNC_SUBTRACT 0x0000800a
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA(x) (0x00001e14+((x)*32))
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA__SIZE 0x00000008
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA(x) (0x00001e18+((x)*32))
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA__SIZE 0x00000008
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_SP_SELECT(x) (0x00002000+((x)*64))
-#define NVC0TCL_SP_SELECT__SIZE 0x00000006
-#define NVC0TCL_SP_SELECT_ENABLE (1 << 0)
-#define NVC0TCL_SP_SELECT_PROGRAM_SHIFT 4
-#define NVC0TCL_SP_SELECT_PROGRAM_MASK 0x000000f0
-#define NVC0TCL_SP_START_ID(x) (0x00002004+((x)*64))
-#define NVC0TCL_SP_START_ID__SIZE 0x00000006
-#define NVC0TCL_SP_GPR_ALLOC(x) (0x0000200c+((x)*64))
-#define NVC0TCL_SP_GPR_ALLOC__SIZE 0x00000006
-#define NVC0TCL_CB_SIZE 0x00002380
-#define NVC0TCL_CB_BIND(x) (0x00002410+((x)*32))
-#define NVC0TCL_CB_BIND__SIZE 0x00000005
-#define NVC0TCL_CB_BIND_VALID (1 << 0)
-#define NVC0TCL_CB_BIND_INDEX_SHIFT 4
-#define NVC0TCL_CB_BIND_INDEX_MASK 0x000000f0
-#define NVC0TCL_BIND_TIC(x) (0x00002404+((x)*32))
-#define NVC0TCL_BIND_TIC__SIZE 0x00000005
-#define NVC0TCL_BIND_TIC_ACTIVE (1 << 0)
-#define NVC0TCL_BIND_TIC_TEXTURE_SHIFT 1
-#define NVC0TCL_BIND_TIC_TEXTURE_MASK 0x000001fe
-#define NVC0TCL_BIND_TIC_TIC_SHIFT 9
-#define NVC0TCL_BIND_TIC_TIC_MASK 0x7ffffe00
-#define NVC0TCL_TEX_LIMITS(x) (0x00002200+((x)*16))
-#define NVC0TCL_TEX_LIMITS__SIZE 0x00000005
-#define NVC0TCL_TEX_LIMITS_SAMPLERS_LOG2_SHIFT 0
-#define NVC0TCL_TEX_LIMITS_SAMPLERS_LOG2_MASK 0x0000000f
-#define NVC0TCL_TEX_LIMITS_TEXTURES_LOG2_SHIFT 4
-#define NVC0TCL_TEX_LIMITS_TEXTURES_LOG2_MASK 0x000000f0
-#define NVC0TCL_CB_ADDR_HIGH 0x00002384
-#define NVC0TCL_CB_ADDR_LOW 0x00002388
-#define NVC0TCL_CB_POS 0x0000238c
-#define NVC0TCL_CB_DATA(x) (0x00002390+((x)*4))
-#define NVC0TCL_CB_DATA__SIZE 0x00000010
-#define NVC0TCL_TFB_VARYING_LOCS(x) (0x00002800+((x)*4))
-#define NVC0TCL_TFB_VARYING_LOCS__SIZE 0x00000080
-#define NVC0TCL_UNK_UPLOAD_POS 0x00003800
-#define NVC0TCL_UNK_UPLOAD_DATA 0x00003804
-#define NVC0TCL_VERTEX_ARRAY_SELECT 0x00003820
-#define NVC0TCL_VERTEX_ARRAY_ADDRESS 0x00003824
-#define NVC0TCL_BLEND_ENABLEI 0x00003858
-#define NVC0TCL_POLYGON_MODE_FRONT 0x00003868
-#define NVC0TCL_POLYGON_MODE_FRONT_POINT 0x00001b00
-#define NVC0TCL_POLYGON_MODE_FRONT_LINE 0x00001b01
-#define NVC0TCL_POLYGON_MODE_FRONT_FILL 0x00001b02
-#define NVC0TCL_POLYGON_MODE_BACK 0x00003870
-#define NVC0TCL_POLYGON_MODE_BACK_POINT 0x00001b00
-#define NVC0TCL_POLYGON_MODE_BACK_LINE 0x00001b01
-#define NVC0TCL_POLYGON_MODE_BACK_FILL 0x00001b02
-#define NVC0TCL_GP_SELECT 0x00003878
-#define NVC0TCL_GP_SELECT_ENABLE (1 << 0)
-#define NVC0TCL_GP_SELECT_PROGRAM_SHIFT 4
-#define NVC0TCL_GP_SELECT_PROGRAM_MASK 0x000000f0
-#define NVC0TCL_TEP_SELECT 0x00003880
-#define NVC0TCL_TEP_SELECT_ENABLE (1 << 0)
-#define NVC0TCL_TEP_SELECT_PROGRAM_SHIFT 4
-#define NVC0TCL_TEP_SELECT_PROGRAM_MASK 0x000000f0
-
-
-#define NVC0_COMPUTE 0x000090c0
-
-#define NVC0_COMPUTE_NOP 0x00000100
-#define NVC0_COMPUTE_NOTIFY 0x00000104
-#define NVC0_COMPUTE_SERIALIZE 0x00000110
-#define NVC0_COMPUTE_LOCAL_SIZE 0x00000204
-#define NVC0_COMPUTE_SHARED_BASE 0x00000214
-#define NVC0_COMPUTE_GRIDDIM_YX 0x00000238
-#define NVC0_COMPUTE_GRIDDIM_YX_X_SHIFT 0
-#define NVC0_COMPUTE_GRIDDIM_YX_X_MASK 0x0000ffff
-#define NVC0_COMPUTE_GRIDDIM_YX_Y_SHIFT 16
-#define NVC0_COMPUTE_GRIDDIM_YX_Y_MASK 0xffff0000
-#define NVC0_COMPUTE_GRIDDIM_Z 0x0000023c
-#define NVC0_COMPUTE_SHARED_SIZE 0x0000024c
-#define NVC0_COMPUTE_BLOCK_ALLOC 0x00000250
-#define NVC0_COMPUTE_BLOCK_ALLOC_THREADS_SHIFT 0
-#define NVC0_COMPUTE_BLOCK_ALLOC_THREADS_MASK 0x0000ffff
-#define NVC0_COMPUTE_BLOCK_ALLOC_BARRIERS_SHIFT 16
-#define NVC0_COMPUTE_BLOCK_ALLOC_BARRIERS_MASK 0xffff0000
-#define NVC0_COMPUTE_CP_GPR_ALLOC 0x000002c0
-#define NVC0_COMPUTE_GLOBAL_BASE 0x000002c8
-#define NVC0_COMPUTE_GLOBAL_BASE_HIGH_SHIFT 0
-#define NVC0_COMPUTE_GLOBAL_BASE_HIGH_MASK 0x000000ff
-#define NVC0_COMPUTE_GLOBAL_BASE_INDEX_SHIFT 16
-#define NVC0_COMPUTE_GLOBAL_BASE_INDEX_MASK 0x00ff0000
-#define NVC0_COMPUTE_GLOBAL_BASE_FLAGS_SHIFT 28
-#define NVC0_COMPUTE_GLOBAL_BASE_FLAGS_MASK 0xf0000000
-#define NVC0_COMPUTE_LAUNCH 0x00000368
-#define NVC0_COMPUTE_BLOCKDIM_YX 0x000003ac
-#define NVC0_COMPUTE_BLOCKDIM_YX_X_SHIFT 0
-#define NVC0_COMPUTE_BLOCKDIM_YX_X_MASK 0x0000ffff
-#define NVC0_COMPUTE_BLOCKDIM_YX_Y_SHIFT 16
-#define NVC0_COMPUTE_BLOCKDIM_YX_Y_MASK 0xffff0000
-#define NVC0_COMPUTE_BLOCKDIM_Z 0x000003b0
-#define NVC0_COMPUTE_CP_START_ID 0x000003b4
-#define NVC0_COMPUTE_LOCAL_BASE 0x0000077c
-#define NVC0_COMPUTE_UNK0790_ADDRESS_HIGH 0x00000790
-#define NVC0_COMPUTE_UNK0790_ADDRESS_LOW 0x00000794
-#define NVC0_COMPUTE_LINKED_TSC 0x00001234
-#define NVC0_COMPUTE_TSC_ADDRESS_HIGH 0x0000155c
-#define NVC0_COMPUTE_TSC_ADDRESS_LOW 0x00001560
-#define NVC0_COMPUTE_TSC_LIMIT 0x00001564
-#define NVC0_COMPUTE_TIC_ADDRESS_HIGH 0x00001574
-#define NVC0_COMPUTE_TIC_ADDRESS_LOW 0x00001578
-#define NVC0_COMPUTE_TIC_LIMIT 0x0000157c
-#define NVC0_COMPUTE_CODE_ADDRESS_HIGH 0x00001608
-#define NVC0_COMPUTE_CODE_ADDRESS_LOW 0x0000160c
-#define NVC0_COMPUTE_CB_BIND 0x00001694
-#define NVC0_COMPUTE_CB_BIND_INDEX_SHIFT 1
-#define NVC0_COMPUTE_CB_BIND_INDEX_MASK 0xfffffffe
-#define NVC0_COMPUTE_CB_BIND_VALID (1 << 0)
-#define NVC0_COMPUTE_QUERY_ADDRESS_HIGH 0x00001b00
-#define NVC0_COMPUTE_QUERY_ADDRESS_LOW 0x00001b04
-#define NVC0_COMPUTE_QUERY_SEQUENCE 0x00001b08
-#define NVC0_COMPUTE_QUERY_GET 0x00001b0c
-#define NVC0_COMPUTE_CB_ADDRESS_HIGH 0x00002384
-#define NVC0_COMPUTE_CB_ADDRESS_LOW 0x00002388
-#define NVC0_COMPUTE_CB_POS 0x0000238c
-#define NVC0_COMPUTE_CB_DATA 0x00002390
+#include "nv_object.xml.h"
+#include "nv_3ddefs.xml.h"
+#include "nvc0_m2mf.xml.h"
+#include "nvc0_3d.xml.h"
+#include "nv50_defs.xml.h"
#endif /* NOUVEAU_REG_H */
diff --git a/src/nouveau_exa.c b/src/nouveau_exa.c
index 4e9f946..6ffee2a 100644
--- a/src/nouveau_exa.c
+++ b/src/nouveau_exa.c
@@ -357,7 +357,7 @@ nv50_style_tiled_pixmap(PixmapPtr ppix)
ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);
- return pNv->Architecture == NV_ARCH_50 &&
+ return pNv->Architecture >= NV_ARCH_50 &&
(nouveau_pixmap_bo(ppix)->tile_flags &
NOUVEAU_BO_TILE_LAYOUT_MASK);
}
@@ -378,8 +378,15 @@ nouveau_exa_download_from_screen(PixmapPtr pspix, int x, int y, int w, int h,
offset = (y * src_pitch) + (x * cpp);
if (pNv->GART) {
- if (NVAccelDownloadM2MF(pspix, x, y, w, h, dst, dst_pitch))
- return TRUE;
+ if (pNv->Architecture >= NV_ARCH_C0) {
+ if (NVC0AccelDownloadM2MF(pspix, x, y, w, h,
+ dst, dst_pitch))
+ return TRUE;
+ } else {
+ if (NVAccelDownloadM2MF(pspix, x, y, w, h,
+ dst, dst_pitch))
+ return TRUE;
+ }
}
bo = nouveau_pixmap_bo(pspix);
@@ -414,18 +421,33 @@ nouveau_exa_upload_to_screen(PixmapPtr pdpix, int x, int y, int w, int h,
exaMarkSync(pdpix->drawable.pScreen);
return TRUE;
}
- } else {
+ } else
+ if (pNv->Architecture < NV_ARCH_C0) {
if (NV50EXAUploadSIFC(src, src_pitch, pdpix,
x, y, w, h, cpp)) {
exaMarkSync(pdpix->drawable.pScreen);
return TRUE;
}
+ } else {
+ if (NVC0EXAUploadSIFC(src, src_pitch, pdpix,
+ x, y, w, h, cpp)) {
+ exaMarkSync(pdpix->drawable.pScreen);
+ return TRUE;
+ }
}
}
/* try gart-based transfer */
if (pNv->GART) {
- if (NVAccelUploadM2MF(pdpix, x, y, w, h, src, src_pitch)) {
+ if (pNv->Architecture < NV_ARCH_C0) {
+ ret = NVAccelUploadM2MF(pdpix, x, y, w, h,
+ src, src_pitch);
+ } else {
+ ret = NVC0AccelUploadM2MF(pdpix, x, y, w, h,
+ src, src_pitch);
+ }
+
+ if (ret) {
exaMarkSync(pdpix->drawable.pScreen);
return TRUE;
}
@@ -510,7 +532,8 @@ nouveau_exa_init(ScreenPtr pScreen)
exa->PrepareSolid = NV04EXAPrepareSolid;
exa->Solid = NV04EXASolid;
exa->DoneSolid = NV04EXADoneSolid;
- } else {
+ } else
+ if (pNv->Architecture < NV_ARCH_C0) {
exa->PrepareCopy = NV50EXAPrepareCopy;
exa->Copy = NV50EXACopy;
exa->DoneCopy = NV50EXADoneCopy;
@@ -518,6 +541,14 @@ nouveau_exa_init(ScreenPtr pScreen)
exa->PrepareSolid = NV50EXAPrepareSolid;
exa->Solid = NV50EXASolid;
exa->DoneSolid = NV50EXADoneSolid;
+ } else {
+ exa->PrepareCopy = NVC0EXAPrepareCopy;
+ exa->Copy = NVC0EXACopy;
+ exa->DoneCopy = NVC0EXADoneCopy;
+
+ exa->PrepareSolid = NVC0EXAPrepareSolid;
+ exa->Solid = NVC0EXASolid;
+ exa->DoneSolid = NVC0EXADoneSolid;
}
switch (pNv->Architecture) {
@@ -546,6 +577,12 @@ nouveau_exa_init(ScreenPtr pScreen)
exa->Composite = NV50EXAComposite;
exa->DoneComposite = NV50EXADoneComposite;
break;
+ case NV_ARCH_C0:
+ exa->CheckComposite = NVC0EXACheckComposite;
+ exa->PrepareComposite = NVC0EXAPrepareComposite;
+ exa->Composite = NVC0EXAComposite;
+ exa->DoneComposite = NVC0EXADoneComposite;
+ break;
default:
break;
}
diff --git a/src/nouveau_local.h b/src/nouveau_local.h
index 38b861f..98b33dc 100644
--- a/src/nouveau_local.h
+++ b/src/nouveau_local.h
@@ -43,6 +43,9 @@
#define NOUVEAU_ALIGN(x,bytes) (((x) + ((bytes) - 1)) & ~((bytes) - 1))
+#define NVC0_TILE_PITCH(m) (64 << ((m) & 0xf))
+#define NVC0_TILE_HEIGHT(m) (8 << ((m) >> 4))
+
static inline int log2i(int i)
{
int r = 0;
diff --git a/src/nouveau_wfb.c b/src/nouveau_wfb.c
index 2425e31..e02fd1c 100644
--- a/src/nouveau_wfb.c
+++ b/src/nouveau_wfb.c
@@ -177,7 +177,10 @@ nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite,
wfb->pitch = ppix->devKind;
/* 8192x8192x4 is 28 bits max, 64 - 28 == 36. */
wfb->multiply_factor = (((1ULL << 36) - 1) / wfb->pitch) + 1;
- wfb->tile_height = bo->tile_mode + 2;
+ if (bo->device->chipset < 0xc0)
+ wfb->tile_height = bo->tile_mode + 2;
+ else
+ wfb->tile_height = (bo->tile_mode >> 4) + 3;
wfb->horiz_tiles = wfb->pitch / 64;
have_tiled = 1;
}
diff --git a/src/nouveau_xv.c b/src/nouveau_xv.c
index c1d4ccb..30753fa 100644
--- a/src/nouveau_xv.c
+++ b/src/nouveau_xv.c
@@ -245,8 +245,13 @@ nouveau_xv_bo_realloc(ScrnInfoPtr pScrn, unsigned flags, unsigned size,
}
tile_flags = 0;
- if (pNv->Architecture >= NV_ARCH_50 && (flags & NOUVEAU_BO_VRAM))
- tile_flags = 0x7000;
+ if (flags & NOUVEAU_BO_VRAM) {
+ if (pNv->Architecture == NV_ARCH_50)
+ tile_flags = 0x7000;
+ else
+ if (pNv->Architecture == NV_ARCH_C0)
+ tile_flags = 0xfe00;
+ }
ret = nouveau_bo_new_tile(pNv->dev, flags | NOUVEAU_BO_MAP, 0,
size, 0, tile_flags, pbo);
@@ -1106,6 +1111,12 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x,
nouveau_bo_unmap(destination_buffer);
+ if (pNv->Architecture >= NV_ARCH_C0) {
+ nvc0_xv_m2mf(m2mf, pPriv->video_mem, uv_offset, dstPitch,
+ nlines, destination_buffer, line_len);
+ goto put_image;
+ }
+
if (MARK_RING(chan, 64, 4))
return FALSE;
@@ -1245,6 +1256,7 @@ CPU_copy:
if (pPriv->currentHostBuffer != NO_PRIV_HOST_BUFFER_AVAILABLE)
pPriv->currentHostBuffer ^= 1;
+put_image:
/* If we're not using the hw overlay, we're rendering into a pixmap
* and need to take a couple of additional steps...
*/
@@ -1315,6 +1327,13 @@ CPU_copy:
xb, yb, npixels, nlines,
src_w, src_h, drw_w, drw_h,
clipBoxes, ppix, pPriv);
+ } else {
+ ret = nvc0_xv_image_put(pScrn, pPriv->video_mem,
+ offset, uv_offset,
+ id, dstPitch, &dstBox, 0, 0,
+ xb, yb, npixels, nlines,
+ src_w, src_h, drw_w, drw_h,
+ clipBoxes, ppix, pPriv);
}
if (ret != Success)
@@ -2041,7 +2060,6 @@ NV50SetupTexturedVideo (ScreenPtr pScreen)
return adapt;
}
-
/**
* NVInitVideo
* tries to initialize the various supported adapters
@@ -2084,7 +2102,7 @@ NVInitVideo(ScreenPtr pScreen)
textureAdaptor[0] = NV40SetupTexturedVideo(pScreen, FALSE);
textureAdaptor[1] = NV40SetupTexturedVideo(pScreen, TRUE);
} else
- if (pNv->Architecture == NV_ARCH_50) {
+ if (pNv->Architecture >= NV_ARCH_50) {
textureAdaptor[0] = NV50SetupTexturedVideo(pScreen);
}
}
diff --git a/src/nv50_defs.xml.h b/src/nv50_defs.xml.h
new file mode 100644
index 0000000..88eca54
--- /dev/null
+++ b/src/nv50_defs.xml.h
@@ -0,0 +1,144 @@
+#ifndef NV50_DEFS_XML
+#define NV50_DEFS_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nv50_defs.xml ( 4487 bytes, from 2010-12-15 16:39:58)
+- copyright.xml ( 6452 bytes, from 2010-11-19 01:08:12)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin Kościelnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+#define NV50_SURFACE_FORMAT_R32G32B32A32_FLOAT 0x000000c0
+#define NV50_SURFACE_FORMAT_R32G32B32A32_SINT 0x000000c1
+#define NV50_SURFACE_FORMAT_R32G32B32A32_UINT 0x000000c2
+#define NV50_SURFACE_FORMAT_R32G32B32X32_FLOAT 0x000000c3
+#define NV50_SURFACE_FORMAT_R32G32B32X32_SINT 0x000000c4
+#define NV50_SURFACE_FORMAT_R32G32B32X32_UINT 0x000000c5
+#define NV50_SURFACE_FORMAT_R16G16B16A16_UNORM 0x000000c6
+#define NV50_SURFACE_FORMAT_R16G16B16A16_SNORM 0x000000c7
+#define NV50_SURFACE_FORMAT_R16G16B16A16_SINT 0x000000c8
+#define NV50_SURFACE_FORMAT_R16G16B16A16_UINT 0x000000c9
+#define NV50_SURFACE_FORMAT_R16G16B16A16_FLOAT 0x000000ca
+#define NV50_SURFACE_FORMAT_R32G32_FLOAT 0x000000cb
+#define NV50_SURFACE_FORMAT_R32G32_SINT 0x000000cc
+#define NV50_SURFACE_FORMAT_R32G32_UINT 0x000000cd
+#define NV50_SURFACE_FORMAT_R16G16B16X16_FLOAT 0x000000ce
+#define NV50_SURFACE_FORMAT_A8R8G8B8_UNORM 0x000000cf
+#define NV50_SURFACE_FORMAT_A8R8G8B8_SRGB 0x000000d0
+#define NV50_SURFACE_FORMAT_A2B10G10R10_UNORM 0x000000d1
+#define NV50_SURFACE_FORMAT_A2B10G10R10_UINT 0x000000d2
+#define NV50_SURFACE_FORMAT_A8B8G8R8_UNORM 0x000000d5
+#define NV50_SURFACE_FORMAT_A8B8G8R8_SRGB 0x000000d6
+#define NV50_SURFACE_FORMAT_A8B8G8R8_SNORM 0x000000d7
+#define NV50_SURFACE_FORMAT_A8B8G8R8_SINT 0x000000d8
+#define NV50_SURFACE_FORMAT_A8B8G8R8_UINT 0x000000d9
+#define NV50_SURFACE_FORMAT_R16G16_UNORM 0x000000da
+#define NV50_SURFACE_FORMAT_R16G16_SNORM 0x000000db
+#define NV50_SURFACE_FORMAT_R16G16_SINT 0x000000dc
+#define NV50_SURFACE_FORMAT_R16G16_UINT 0x000000dd
+#define NV50_SURFACE_FORMAT_R16G16_FLOAT 0x000000de
+#define NV50_SURFACE_FORMAT_A2R10G10B10_UNORM 0x000000df
+#define NV50_SURFACE_FORMAT_B10G11R11_FLOAT 0x000000e0
+#define NV50_SURFACE_FORMAT_R32_FLOAT 0x000000e5
+#define NV50_SURFACE_FORMAT_X8R8G8B8_UNORM 0x000000e6
+#define NV50_SURFACE_FORMAT_X8R8G8B8_SRGB 0x000000e7
+#define NV50_SURFACE_FORMAT_R5G6B5_UNORM 0x000000e8
+#define NV50_SURFACE_FORMAT_A1R5G5B5_UNORM 0x000000e9
+#define NV50_SURFACE_FORMAT_R8G8_UNORM 0x000000ea
+#define NV50_SURFACE_FORMAT_R8G8_SNORM 0x000000eb
+#define NV50_SURFACE_FORMAT_R8G8_SINT 0x000000ec
+#define NV50_SURFACE_FORMAT_R8G8_UINT 0x000000ed
+#define NV50_SURFACE_FORMAT_R16_UNORM 0x000000ee
+#define NV50_SURFACE_FORMAT_R16_SNORM 0x000000ef
+#define NV50_SURFACE_FORMAT_R16_SINT 0x000000f0
+#define NV50_SURFACE_FORMAT_R16_UINT 0x000000f1
+#define NV50_SURFACE_FORMAT_R16_FLOAT 0x000000f2
+#define NV50_SURFACE_FORMAT_R8_UNORM 0x000000f3
+#define NV50_SURFACE_FORMAT_R8_SNORM 0x000000f4
+#define NV50_SURFACE_FORMAT_R8_SINT 0x000000f5
+#define NV50_SURFACE_FORMAT_R8_UINT 0x000000f6
+#define NV50_SURFACE_FORMAT_A8_UNORM 0x000000f7
+#define NV50_SURFACE_FORMAT_X1R5G5B5_UNORM 0x000000f8
+#define NV50_SURFACE_FORMAT_X8B8G8R8_UNORM 0x000000f9
+#define NV50_SURFACE_FORMAT_X8B8G8R8_SRGB 0x000000fa
+#define NV50_ZETA_FORMAT_Z32_FLOAT 0x0000000a
+#define NV50_ZETA_FORMAT_Z16_UNORM 0x00000013
+#define NV50_ZETA_FORMAT_Z24S8_UNORM 0x00000014
+#define NV50_ZETA_FORMAT_X8Z24_UNORM 0x00000015
+#define NV50_ZETA_FORMAT_S8Z24_UNORM 0x00000016
+#define NV50_ZETA_FORMAT_C8Z24_UNORM 0x00000018
+#define NV50_ZETA_FORMAT_Z32_FLOAT_X24S8_UNORM 0x00000019
+#define NV50_ZETA_FORMAT_X16C8S8X8Z24_UNORM 0x0000001d
+#define NV50_ZETA_FORMAT_Z32_FLOAT_X16C8X8_UNORM 0x0000001e
+#define NV50_ZETA_FORMAT_Z32_FLOAT_X16C8S8_UNORM 0x0000001f
+#define NV50_QUERY__SIZE 0x00000010
+#define NV50_QUERY_COUNTER 0x00000000
+
+#define NV50_QUERY_RES 0x00000004
+
+#define NV50_QUERY_TIME 0x00000008
+
+
+#endif /* NV50_DEFS_XML */
diff --git a/src/nv50_xv.c b/src/nv50_xv.c
index 1538cdc..ddeb5bb 100644
--- a/src/nv50_xv.c
+++ b/src/nv50_xv.c
@@ -399,6 +399,11 @@ nv50_xv_csc_update(ScrnInfoPtr pScrn, NVPortPrivPtr pPriv)
off[1] = Loff * yco + Coff * (uco[1] + vco[1]) + bright;
off[2] = Loff * yco + Coff * (uco[2] + vco[2]) + bright;
+ if (pNv->Architecture >= NV_ARCH_C0) {
+ nvc0_xv_csc_update(pNv, yco, off, uco, vco);
+ return;
+ }
+
if (MARK_RING(chan, 64, 2))
return;
diff --git a/src/nv_3ddefs.xml.h b/src/nv_3ddefs.xml.h
new file mode 100644
index 0000000..04cd11e
--- /dev/null
+++ b/src/nv_3ddefs.xml.h
@@ -0,0 +1,93 @@
+#ifndef NV_3DDEFS_XML
+#define NV_3DDEFS_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nv_3ddefs.xml ( 16394 bytes, from 2010-12-15 23:45:18)
+- copyright.xml ( 6452 bytes, from 2010-12-15 23:45:18)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin Kościelnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+#define NV50_BLEND_FACTOR_ZERO 0x00004000
+#define NV50_BLEND_FACTOR_ONE 0x00004001
+#define NV50_BLEND_FACTOR_SRC_COLOR 0x00004300
+#define NV50_BLEND_FACTOR_ONE_MINUS_SRC_COLOR 0x00004301
+#define NV50_BLEND_FACTOR_SRC_ALPHA 0x00004302
+#define NV50_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA 0x00004303
+#define NV50_BLEND_FACTOR_DST_ALPHA 0x00004304
+#define NV50_BLEND_FACTOR_ONE_MINUS_DST_ALPHA 0x00004305
+#define NV50_BLEND_FACTOR_DST_COLOR 0x00004306
+#define NV50_BLEND_FACTOR_ONE_MINUS_DST_COLOR 0x00004307
+#define NV50_BLEND_FACTOR_SRC_ALPHA_SATURATE 0x00004308
+#define NV50_BLEND_FACTOR_CONSTANT_COLOR 0x0000c001
+#define NV50_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR 0x0000c002
+#define NV50_BLEND_FACTOR_CONSTANT_ALPHA 0x0000c003
+#define NV50_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
+#define NV50_BLEND_FACTOR_SRC1_COLOR 0x0000c900
+#define NV50_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR 0x0000c901
+#define NV50_BLEND_FACTOR_SRC1_ALPHA 0x0000c902
+#define NV50_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA 0x0000c903
+
+#endif /* NV_3DDEFS_XML */
diff --git a/src/nv_accel_common.c b/src/nv_accel_common.c
index dc7215e..ac4f628 100644
--- a/src/nv_accel_common.c
+++ b/src/nv_accel_common.c
@@ -54,7 +54,26 @@ nouveau_allocate_surface(ScrnInfoPtr scrn, int width, int height, int bpp,
}
if (tiled) {
- if (pNv->Architecture >= NV_ARCH_50) {
+ if (pNv->Architecture >= NV_ARCH_C0) {
+ if (height > 64)
+ tile_mode = 0x40;
+ else if (height > 32)
+ tile_mode = 0x30;
+ else if (height > 16)
+ tile_mode = 0x20;
+ else if (height > 8)
+ tile_mode = 0x10;
+ else
+ tile_mode = 0x00;
+
+ if (usage_hint & NOUVEAU_CREATE_PIXMAP_ZETA)
+ tile_flags = 0x1100; /* S8Z24 */
+ else
+ tile_flags = 0xfe00;
+
+ height = NOUVEAU_ALIGN(
+ height, NVC0_TILE_HEIGHT(tile_mode));
+ } else if (pNv->Architecture >= NV_ARCH_50) {
if (height > 32)
tile_mode = 4;
else if (height > 16)
@@ -607,7 +626,8 @@ NVAccelCommonInit(ScrnInfoPtr pScrn)
return TRUE;
/* General engine objects */
- INIT_CONTEXT_OBJECT(DmaNotifier0);
+ if (pNv->Architecture < NV_ARCH_C0)
+ INIT_CONTEXT_OBJECT(DmaNotifier0);
/* 2D engine */
if (pNv->Architecture < NV_ARCH_50) {
@@ -621,13 +641,23 @@ NVAccelCommonInit(ScrnInfoPtr pScrn)
INIT_CONTEXT_OBJECT(ScaledImage);
INIT_CONTEXT_OBJECT(ClipRectangle);
INIT_CONTEXT_OBJECT(ImageFromCpu);
- } else {
+ } else
+ if (pNv->Architecture < NV_ARCH_C0) {
INIT_CONTEXT_OBJECT(2D_NV50);
+ } else {
+ INIT_CONTEXT_OBJECT(2D_NVC0);
}
- INIT_CONTEXT_OBJECT(MemFormat);
+
+ if (pNv->Architecture < NV_ARCH_C0)
+ INIT_CONTEXT_OBJECT(MemFormat);
+ else
+ INIT_CONTEXT_OBJECT(M2MF_NVC0);
/* 3D init */
switch (pNv->Architecture) {
+ case NV_ARCH_C0:
+ INIT_CONTEXT_OBJECT(3D_NVC0);
+ break;
case NV_ARCH_50:
INIT_CONTEXT_OBJECT(NV50TCL);
break;
@@ -658,21 +688,18 @@ void NVAccelFree(ScrnInfoPtr pScrn)
nouveau_notifier_free(&pNv->notify0);
nouveau_notifier_free(&pNv->vblank_sem);
- if (pNv->Architecture < NV_ARCH_50) {
- nouveau_grobj_free(&pNv->NvContextSurfaces);
- nouveau_grobj_free(&pNv->NvContextBeta1);
- nouveau_grobj_free(&pNv->NvContextBeta4);
- nouveau_grobj_free(&pNv->NvImagePattern);
- nouveau_grobj_free(&pNv->NvRop);
- nouveau_grobj_free(&pNv->NvRectangle);
- nouveau_grobj_free(&pNv->NvImageBlit);
- nouveau_grobj_free(&pNv->NvScaledImage);
- nouveau_grobj_free(&pNv->NvClipRectangle);
- nouveau_grobj_free(&pNv->NvImageFromCpu);
- } else
- nouveau_grobj_free(&pNv->Nv2D);
+ nouveau_grobj_free(&pNv->NvContextSurfaces);
+ nouveau_grobj_free(&pNv->NvContextBeta1);
+ nouveau_grobj_free(&pNv->NvContextBeta4);
+ nouveau_grobj_free(&pNv->NvImagePattern);
+ nouveau_grobj_free(&pNv->NvRop);
+ nouveau_grobj_free(&pNv->NvRectangle);
+ nouveau_grobj_free(&pNv->NvImageBlit);
+ nouveau_grobj_free(&pNv->NvScaledImage);
+ nouveau_grobj_free(&pNv->NvClipRectangle);
+ nouveau_grobj_free(&pNv->NvImageFromCpu);
+ nouveau_grobj_free(&pNv->Nv2D);
nouveau_grobj_free(&pNv->NvMemFormat);
-
nouveau_grobj_free(&pNv->NvSW);
nouveau_grobj_free(&pNv->Nv3D);
diff --git a/src/nv_driver.c b/src/nv_driver.c
index f4aa2bc..5286ff4 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -112,6 +112,8 @@ static struct NvFamily NVKnownFamilies[] =
{ "GeForce 6", "NV4x" },
{ "GeForce 7", "G7x" },
{ "GeForce 8", "G8x" },
+ { "GeForce GTX 200", "NVA0" },
+ { "GeForce GTX 400", "NVC0" },
{ NULL, NULL}
};
diff --git a/src/nv_object.xml.h b/src/nv_object.xml.h
new file mode 100644
index 0000000..af1096b
--- /dev/null
+++ b/src/nv_object.xml.h
@@ -0,0 +1,246 @@
+#ifndef NV_OBJECT_XML
+#define NV_OBJECT_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nv_object.xml ( 11092 bytes, from 2010-12-15 23:45:18)
+- copyright.xml ( 6452 bytes, from 2010-12-15 23:45:18)
+- nvchipsets.xml ( 3074 bytes, from 2010-12-15 23:45:18)
+- nv_defs.xml ( 4437 bytes, from 2010-12-15 23:45:18)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin Kościelnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+#define NV01_ROOT 0x00000001
+#define NV01_CONTEXT_DMA 0x00000002
+#define NV01_DEVICE 0x00000003
+#define NV01_TIMER 0x00000004
+#define NV01_NULL 0x00000030
+#define NV01_MEMORY_LOCAL_BANKED 0x0000003d
+#define NV01_MAPPING_SYSTEM 0x0000003e
+#define NV03_MEMORY_LOCAL_CURSOR 0x0000003f
+#define NV01_MEMORY_LOCAL_LINEAR 0x00000040
+#define NV01_MAPPING_LOCAL 0x00000041
+#define NV03_VIDEO_LUT_CURSOR_DAC 0x00000046
+#define NV03_CHANNEL_PIO 0x0000006a
+#define NV03_CHANNEL_DMA 0x0000006b
+#define NV10_VIDEO_DISPLAY 0x0000007c
+#define NV01_CONTEXT_BETA1 0x00000012
+#define NV04_BETA_SOLID 0x00000072
+#define NV01_CONTEXT_COLOR_KEY 0x00000017
+#define NV04_CONTEXT_COLOR_KEY 0x00000057
+#define NV01_CONTEXT_PATTERN 0x00000018
+#define NV01_CONTEXT_CLIP_RECTANGLE 0x00000019
+#define NV03_CONTEXT_ROP 0x00000043
+#define NV04_IMAGE_PATTERN 0x00000044
+#define NV01_RENDER_SOLID_LINE 0x0000001c
+#define NV04_RENDER_SOLID_LINE 0x0000005c
+#define NV30_RENDER_SOLID_LINE 0x0000035c
+#define NV40_RENDER_SOLID_LINE 0x0000305c
+#define NV01_RENDER_SOLID_TRIANGLE 0x0000001d
+#define NV04_RENDER_SOLID_TRIANGLE 0x0000005d
+#define NV01_RENDER_SOLID_RECTANGLE 0x0000001e
+#define NV04_RENDER_SOLID_RECTANGLE 0x0000005e
+#define NV01_IMAGE_BLIT 0x0000001f
+#define NV04_IMAGE_BLIT 0x0000005f
+#define NV11_IMAGE_BLIT 0x0000009f
+#define NV01_IMAGE_FROM_CPU 0x00000021
+#define NV04_IMAGE_FROM_CPU 0x00000061
+#define NV05_IMAGE_FROM_CPU 0x00000065
+#define NV10_IMAGE_FROM_CPU 0x0000008a
+#define NV30_IMAGE_FROM_CPU 0x0000038a
+#define NV40_IMAGE_FROM_CPU 0x0000308a
+#define NV03_STRETCHED_IMAGE_FROM_CPU 0x00000036
+#define NV04_STRETCHED_IMAGE_FROM_CPU 0x00000076
+#define NV05_STRETCHED_IMAGE_FROM_CPU 0x00000066
+#define NV30_STRETCHED_IMAGE_FROM_CPU 0x00000366
+#define NV40_STRETCHED_IMAGE_FROM_CPU 0x00003066
+#define NV03_SCALED_IMAGE_FROM_MEMORY 0x00000037
+#define NV04_SCALED_IMAGE_FROM_MEMORY 0x00000077
+#define NV05_SCALED_IMAGE_FROM_MEMORY 0x00000063
+#define NV10_SCALED_IMAGE_FROM_MEMORY 0x00000089
+#define NV30_SCALED_IMAGE_FROM_MEMORY 0x00000389
+#define NV40_SCALED_IMAGE_FROM_MEMORY 0x00003089
+#define NV50_SCALED_IMAGE_FROM_MEMORY 0x00005089
+#define NV04_DVD_SUBPICTURE 0x00000038
+#define NV10_DVD_SUBPICTURE 0x00000088
+#define NV03_GDI_RECTANGLE_TEXT 0x0000004b
+#define NV04_GDI_RECTANGLE_TEXT 0x0000004a
+#define NV04_SWIZZLED_SURFACE 0x00000052
+#define NV20_SWIZZLED_SURFACE 0x0000009e
+#define NV30_SWIZZLED_SURFACE 0x0000039e
+#define NV40_SWIZZLED_SURFACE 0x0000309e
+#define NV03_CONTEXT_SURFACE_DST 0x00000058
+#define NV03_CONTEXT_SURFACE_SRC 0x00000059
+#define NV04_CONTEXT_SURFACES_2D 0x00000042
+#define NV10_CONTEXT_SURFACES_2D 0x00000062
+#define NV30_CONTEXT_SURFACES_2D 0x00000362
+#define NV40_CONTEXT_SURFACES_2D 0x00003062
+#define NV50_CONTEXT_SURFACES_2D 0x00005062
+#define NV04_INDEXED_IMAGE_FROM_CPU 0x00000060
+#define NV05_INDEXED_IMAGE_FROM_CPU 0x00000064
+#define NV30_INDEXED_IMAGE_FROM_CPU 0x00000364
+#define NV40_INDEXED_IMAGE_FROM_CPU 0x00003064
+#define NV10_TEXTURE_FROM_CPU 0x0000007b
+#define NV30_TEXTURE_FROM_CPU 0x0000037b
+#define NV40_TEXTURE_FROM_CPU 0x0000307b
+#define NV04_M2MF 0x00000039
+#define NV50_M2MF 0x00005039
+#define NVC0_M2MF 0x00009039
+#define NV03_TEXTURED_TRIANGLE 0x00000048
+#define NV04_TEXTURED_TRIANGLE 0x00000054
+#define NV10_TEXTURED_TRIANGLE 0x00000094
+#define NV04_MULTITEX_TRIANGLE 0x00000055
+#define NV10_MULTITEX_TRIANGLE 0x00000095
+#define NV03_CONTEXT_SURFACE_COLOR 0x0000005a
+#define NV03_CONTEXT_SURFACE_ZETA 0x0000005b
+#define NV04_CONTEXT_SURFACES_3D 0x00000053
+#define NV10_CONTEXT_SURFACES_3D 0x00000093
+#define NV10_3D 0x00000056
+#define NV11_3D 0x00000096
+#define NV17_3D 0x00000099
+#define NV20_3D 0x00000097
+#define NV25_3D 0x00000597
+#define NV30_3D 0x00000397
+#define NV35_3D 0x00000497
+#define NV34_3D 0x00000697
+#define NV40_3D 0x00004097
+#define NV44_3D 0x00004497
+#define NV50_3D 0x00005097
+#define NV84_3D 0x00008297
+#define NVA0_3D 0x00008397
+#define NVA3_3D 0x00008597
+#define NVAF_3D 0x00008697
+#define NVC0_3D 0x00009097
+#define NV50_2D 0x0000502d
+#define NVC0_2D 0x0000902d
+#define NV50_COMPUTE 0x000050c0
+#define NVA3_COMPUTE 0x000085c0
+#define NVC0_COMPUTE 0x000090c0
+#define NV84_CRYPT 0x000074c1
+#define NV01_SUBCHAN__SIZE 0x00008000
+#define NV01_SUBCHAN 0x00000000
+
+#define NV01_SUBCHAN_OBJECT 0x00000000
+
+
+#define NV84_SUBCHAN_QUERY_ADDRESS_HIGH 0x00000010
+
+#define NV84_SUBCHAN_QUERY_ADDRESS_LOW 0x00000014
+
+#define NV84_SUBCHAN_QUERY_SEQUENCE 0x00000018
+
+#define NV84_SUBCHAN_QUERY_GET 0x0000001c
+
+#define NV84_SUBCHAN_QUERY_INTR 0x00000020
+
+#define NV84_SUBCHAN_WRCACHE_FLUSH 0x00000024
+
+#define NV10_SUBCHAN_REF_CNT 0x00000050
+
+
+#define NV11_SUBCHAN_DMA_SEMAPHORE 0x00000060
+
+#define NV11_SUBCHAN_SEMAPHORE_OFFSET 0x00000064
+
+#define NV11_SUBCHAN_SEMAPHORE_ACQUIRE 0x00000068
+
+#define NV11_SUBCHAN_SEMAPHORE_RELEASE 0x0000006c
+
+#define NV40_SUBCHAN_YIELD 0x00000080
+
+#define NV01_GRAPH 0x00000000
+
+#define NV04_GRAPH_NOP 0x00000100
+
+#define NV04_GRAPH_NOTIFY 0x00000104
+#define NV04_GRAPH_NOTIFY_WRITE 0x00000000
+#define NV04_GRAPH_NOTIFY_WRITE_AND_AWAKEN 0x00000001
+
+#define NVC0_GRAPH_NOTIFY_ADDRESS_HIGH 0x00000104
+
+#define NVC0_GRAPH_NOTIFY_ADDRESS_LOW 0x00000108
+
+#define NVC0_GRAPH_NOTIFY 0x0000010c
+#define NVC0_GRAPH_NOTIFY_WRITE 0x00000000
+#define NVC0_GRAPH_NOTIFY_WRITE_AND_AWAKEN 0x00000001
+
+#define NV50_GRAPH_WAIT_FOR_IDLE 0x00000110
+
+#define NVC0_GRAPH_MACRO_UPLOAD_POS 0x00000114
+
+#define NVC0_GRAPH_MACRO_UPLOAD_DATA 0x00000118
+
+#define NVC0_GRAPH_MACRO_ID 0x0000011c
+
+#define NVC0_GRAPH_MACRO_POS 0x00000120
+
+#define NVA3_GRAPH_UNK0120 0x00000120
+
+#define NVA3_GRAPH_UNK0124 0x00000124
+
+#define NV40_GRAPH_PM_TRIGGER 0x00000140
+
+
+#endif /* NV_OBJECT_XML */
diff --git a/src/nv_proto.h b/src/nv_proto.h
index 775b094..2e4fce0 100644
--- a/src/nv_proto.h
+++ b/src/nv_proto.h
@@ -134,6 +134,11 @@ int NV40SetTexturePortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
void NV50SyncToVBlank(PixmapPtr ppix, BoxPtr box);
Bool NVAccelInitNV50TCL(ScrnInfoPtr pScrn);
+/* in nvc0_accel.c */
+Bool NVAccelInitM2MF_NVC0(ScrnInfoPtr pScrn);
+Bool NVAccelInit2D_NVC0(ScrnInfoPtr pScrn);
+Bool NVAccelInit3D_NVC0(ScrnInfoPtr pScrn);
+
/* in nv50_exa.c */
Bool NV50EXAPrepareSolid(PixmapPtr, int, Pixel, Pixel);
void NV50EXASolid(PixmapPtr, int, int, int, int);
@@ -149,6 +154,26 @@ void NV50EXADoneComposite(PixmapPtr);
Bool NV50EXAUploadSIFC(const char *src, int src_pitch,
PixmapPtr pdPix, int x, int y, int w, int h, int cpp);
+/* in nvc0_exa.c */
+Bool NVC0AccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h,
+ const char *src, int src_pitch);
+Bool NVC0AccelDownloadM2MF(PixmapPtr pspix, int x, int y, int w, int h,
+ char *dst, unsigned dst_pitch);
+
+Bool NVC0EXAPrepareSolid(PixmapPtr, int, Pixel, Pixel);
+void NVC0EXASolid(PixmapPtr, int, int, int, int);
+void NVC0EXADoneSolid(PixmapPtr);
+Bool NVC0EXAPrepareCopy(PixmapPtr, PixmapPtr, int, int, int, Pixel);
+void NVC0EXACopy(PixmapPtr, int, int, int, int, int, int);
+void NVC0EXADoneCopy(PixmapPtr);
+Bool NVC0EXACheckComposite(int, PicturePtr, PicturePtr, PicturePtr);
+Bool NVC0EXAPrepareComposite(int, PicturePtr, PicturePtr, PicturePtr,
+ PixmapPtr, PixmapPtr, PixmapPtr);
+void NVC0EXAComposite(PixmapPtr, int, int, int, int, int, int, int, int);
+void NVC0EXADoneComposite(PixmapPtr);
+Bool NVC0EXAUploadSIFC(const char *src, int src_pitch,
+ PixmapPtr pdPix, int x, int y, int w, int h, int cpp);
+
/* nv50_xv.c */
int nv50_xv_image_put(ScrnInfoPtr, struct nouveau_bo *, int, int, int, int,
BoxPtr, int, int, int, int, uint16_t, uint16_t,
@@ -160,6 +185,15 @@ int nv50_xv_port_attribute_get(ScrnInfoPtr, Atom, INT32 *, pointer);
void nv50_xv_set_port_defaults(ScrnInfoPtr, NVPortPrivPtr);
void nv50_xv_csc_update(ScrnInfoPtr, NVPortPrivPtr);
+/* nvc0_xv.c */
+int nvc0_xv_image_put(ScrnInfoPtr, struct nouveau_bo *, int, int, int, int,
+ BoxPtr, int, int, int, int, uint16_t, uint16_t,
+ uint16_t, uint16_t, uint16_t, uint16_t,
+ RegionPtr, PixmapPtr, NVPortPrivPtr);
+void nvc0_xv_m2mf(struct nouveau_grobj *, struct nouveau_bo *, int, int, int,
+ struct nouveau_bo *, int);
+void nvc0_xv_csc_update(NVPtr, float, float *, float *, float *);
+
/* To support EXA 2.0, 2.1 has this in the header */
#ifndef exaMoveInPixmap
extern void exaMoveInPixmap(PixmapPtr pPixmap);
diff --git a/src/nvc0_3d.xml.h b/src/nvc0_3d.xml.h
new file mode 100644
index 0000000..f170d71
--- /dev/null
+++ b/src/nvc0_3d.xml.h
@@ -0,0 +1,1093 @@
+#ifndef NVC0_3D_XML
+#define NVC0_3D_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nvc0_3d.xml ( 28127 bytes, from 2010-12-15 16:39:58)
+- copyright.xml ( 6452 bytes, from 2010-11-19 01:08:12)
+- nv_defs.xml ( 4437 bytes, from 2010-07-24 13:13:40)
+- nv_3ddefs.xml ( 16394 bytes, from 2010-10-11 14:37:46)
+- nv_object.xml ( 11547 bytes, from 2010-11-19 01:08:12)
+- nvchipsets.xml ( 3074 bytes, from 2010-11-19 01:08:12)
+- nv50_defs.xml ( 4487 bytes, from 2010-12-15 16:39:58)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin Kościelnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+
+#define NVC0_3D_EARLY_FRAGMENT_TESTS 0x00000210
+
+#define NVC0_3D_TESS_MODE 0x00000320
+#define NVC0_3D_TESS_MODE_PRIM__MASK 0x0000000f
+#define NVC0_3D_TESS_MODE_PRIM__SHIFT 0
+#define NVC0_3D_TESS_MODE_PRIM_ISOLINES 0x00000000
+#define NVC0_3D_TESS_MODE_PRIM_TRIANGLES 0x00000001
+#define NVC0_3D_TESS_MODE_PRIM_QUADS 0x00000002
+#define NVC0_3D_TESS_MODE_SPACING__MASK 0x000000f0
+#define NVC0_3D_TESS_MODE_SPACING__SHIFT 4
+#define NVC0_3D_TESS_MODE_SPACING_EQUAL 0x00000000
+#define NVC0_3D_TESS_MODE_SPACING_FRACTIONAL_ODD 0x00000010
+#define NVC0_3D_TESS_MODE_SPACING_FRACTIONAL_EVEN 0x00000020
+#define NVC0_3D_TESS_MODE_CW 0x00000100
+#define NVC0_3D_TESS_MODE_CONNECTED 0x00000200
+
+#define NVC0_3D_TESS_LEVEL_OUTER(i0) (0x00000324 + 0x4*(i0))
+#define NVC0_3D_TESS_LEVEL_OUTER__ESIZE 0x00000004
+#define NVC0_3D_TESS_LEVEL_OUTER__LEN 0x00000004
+
+#define NVC0_3D_TESS_LEVEL_INNER(i0) (0x00000334 + 0x4*(i0))
+#define NVC0_3D_TESS_LEVEL_INNER__ESIZE 0x00000004
+#define NVC0_3D_TESS_LEVEL_INNER__LEN 0x00000002
+
+#define NVC0_3D_RASTERIZE_ENABLE 0x0000037c
+
+#define NVC0_3D_TFB(i0) (0x00000380 + 0x20*(i0))
+#define NVC0_3D_TFB__ESIZE 0x00000020
+#define NVC0_3D_TFB__LEN 0x00000004
+
+#define NVC0_3D_TFB_BUFFER_ENABLE(i0) (0x00000380 + 0x20*(i0))
+
+#define NVC0_3D_TFB_ADDRESS_HIGH(i0) (0x00000384 + 0x20*(i0))
+
+#define NVC0_3D_TFB_ADDRESS_LOW(i0) (0x00000388 + 0x20*(i0))
+
+#define NVC0_3D_TFB_BUFFER_SIZE(i0) (0x0000038c + 0x20*(i0))
+
+#define NVC0_3D_TFB_PRIMITIVE_ID(i0) (0x00000390 + 0x20*(i0))
+
+#define NVC0_3D_TFB_UNK0700(i0) (0x00000700 + 0x10*(i0))
+
+#define NVC0_3D_TFB_VARYING_COUNT(i0) (0x00000704 + 0x10*(i0))
+
+#define NVC0_3D_TFB_BUFFER_STRIDE(i0) (0x00000708 + 0x10*(i0))
+
+#define NVC0_3D_TFB_ENABLE 0x00000744
+
+#define NVC0_3D_LOCAL_BASE 0x0000077c
+
+#define NVC0_3D_LOCAL_ADDRESS_HIGH 0x00000790
+
+#define NVC0_3D_LOCAL_ADDRESS_LOW 0x00000794
+
+#define NVC0_3D_LOCAL_SIZE_HIGH 0x00000798
+
+#define NVC0_3D_LOCAL_SIZE_LOW 0x0000079c
+
+#define NVC0_3D_RT(i0) (0x00000800 + 0x20*(i0))
+#define NVC0_3D_RT__ESIZE 0x00000020
+#define NVC0_3D_RT__LEN 0x00000008
+
+#define NVC0_3D_RT_ADDRESS_HIGH(i0) (0x00000800 + 0x20*(i0))
+
+#define NVC0_3D_RT_ADDRESS_LOW(i0) (0x00000804 + 0x20*(i0))
+
+#define NVC0_3D_RT_HORIZ(i0) (0x00000808 + 0x20*(i0))
+
+#define NVC0_3D_RT_VERT(i0) (0x0000080c + 0x20*(i0))
+
+#define NVC0_3D_RT_FORMAT(i0) (0x00000810 + 0x20*(i0))
+
+#define NVC0_3D_RT_TILE_MODE(i0) (0x00000814 + 0x20*(i0))
+#define NVC0_3D_RT_TILE_MODE_UNK0 0x00000001
+#define NVC0_3D_RT_TILE_MODE_Y__MASK 0x00000070
+#define NVC0_3D_RT_TILE_MODE_Y__SHIFT 4
+#define NVC0_3D_RT_TILE_MODE_Z__MASK 0x00000700
+#define NVC0_3D_RT_TILE_MODE_Z__SHIFT 8
+
+#define NVC0_3D_RT_ARRAY_MODE(i0) (0x00000818 + 0x20*(i0))
+#define NVC0_3D_RT_ARRAY_MODE_LAYERS__MASK 0x0000ffff
+#define NVC0_3D_RT_ARRAY_MODE_LAYERS__SHIFT 0
+#define NVC0_3D_RT_ARRAY_MODE_VOLUME 0x00010000
+
+#define NVC0_3D_RT_LAYER_STRIDE(i0) (0x0000081c + 0x20*(i0))
+
+#define NVC0_3D_VIEWPORT_SCALE_X(i0) (0x00000a00 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_SCALE_X__ESIZE 0x00000020
+#define NVC0_3D_VIEWPORT_SCALE_X__LEN 0x00000010
+
+#define NVC0_3D_VIEWPORT_SCALE_Y(i0) (0x00000a04 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_SCALE_Y__ESIZE 0x00000020
+#define NVC0_3D_VIEWPORT_SCALE_Y__LEN 0x00000010
+
+#define NVC0_3D_VIEWPORT_SCALE_Z(i0) (0x00000a08 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_SCALE_Z__ESIZE 0x00000020
+#define NVC0_3D_VIEWPORT_SCALE_Z__LEN 0x00000010
+
+#define NVC0_3D_VIEWPORT_TRANSLATE_X(i0) (0x00000a0c + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_TRANSLATE_X__ESIZE 0x00000020
+#define NVC0_3D_VIEWPORT_TRANSLATE_X__LEN 0x00000010
+
+#define NVC0_3D_VIEWPORT_TRANSLATE_Y(i0) (0x00000a10 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_TRANSLATE_Y__ESIZE 0x00000020
+#define NVC0_3D_VIEWPORT_TRANSLATE_Y__LEN 0x00000010
+
+#define NVC0_3D_VIEWPORT_TRANSLATE_Z(i0) (0x00000a14 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_TRANSLATE_Z__ESIZE 0x00000020
+#define NVC0_3D_VIEWPORT_TRANSLATE_Z__LEN 0x00000010
+
+#define NVC0_3D_VIEWPORT_HORIZ(i0) (0x00000c00 + 0x10*(i0))
+#define NVC0_3D_VIEWPORT_HORIZ__ESIZE 0x00000010
+#define NVC0_3D_VIEWPORT_HORIZ__LEN 0x00000010
+#define NVC0_3D_VIEWPORT_HORIZ_X__MASK 0x0000ffff
+#define NVC0_3D_VIEWPORT_HORIZ_X__SHIFT 0
+#define NVC0_3D_VIEWPORT_HORIZ_W__MASK 0xffff0000
+#define NVC0_3D_VIEWPORT_HORIZ_W__SHIFT 16
+
+#define NVC0_3D_VIEWPORT_VERT(i0) (0x00000c04 + 0x10*(i0))
+#define NVC0_3D_VIEWPORT_VERT__ESIZE 0x00000010
+#define NVC0_3D_VIEWPORT_VERT__LEN 0x00000010
+#define NVC0_3D_VIEWPORT_VERT_Y__MASK 0x0000ffff
+#define NVC0_3D_VIEWPORT_VERT_Y__SHIFT 0
+#define NVC0_3D_VIEWPORT_VERT_H__MASK 0xffff0000
+#define NVC0_3D_VIEWPORT_VERT_H__SHIFT 16
+
+#define NVC0_3D_DEPTH_RANGE_NEAR(i0) (0x00000c08 + 0x10*(i0))
+#define NVC0_3D_DEPTH_RANGE_NEAR__ESIZE 0x00000010
+#define NVC0_3D_DEPTH_RANGE_NEAR__LEN 0x00000010
+
+#define NVC0_3D_DEPTH_RANGE_FAR(i0) (0x00000c0c + 0x10*(i0))
+#define NVC0_3D_DEPTH_RANGE_FAR__ESIZE 0x00000010
+#define NVC0_3D_DEPTH_RANGE_FAR__LEN 0x00000010
+
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ(i0) (0x00000d00 + 0x8*(i0))
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ__ESIZE 0x00000008
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ__LEN 0x00000008
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ_MIN__MASK 0x0000ffff
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ_MIN__SHIFT 0
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ_MAX__MASK 0xffff0000
+#define NVC0_3D_VIEWPORT_CLIP_HORIZ_MAX__SHIFT 16
+
+#define NVC0_3D_VIEWPORT_CLIP_VERT(i0) (0x00000d04 + 0x8*(i0))
+#define NVC0_3D_VIEWPORT_CLIP_VERT__ESIZE 0x00000008
+#define NVC0_3D_VIEWPORT_CLIP_VERT__LEN 0x00000008
+#define NVC0_3D_VIEWPORT_CLIP_VERT_MIN__MASK 0x0000ffff
+#define NVC0_3D_VIEWPORT_CLIP_VERT_MIN__SHIFT 0
+#define NVC0_3D_VIEWPORT_CLIP_VERT_MAX__MASK 0xffff0000
+#define NVC0_3D_VIEWPORT_CLIP_VERT_MAX__SHIFT 16
+
+#define NVC0_3D_CLIPID_REGION_HORIZ(i0) (0x00000d40 + 0x8*(i0))
+#define NVC0_3D_CLIPID_REGION_HORIZ__ESIZE 0x00000008
+#define NVC0_3D_CLIPID_REGION_HORIZ__LEN 0x00000004
+#define NVC0_3D_CLIPID_REGION_HORIZ_X__MASK 0x0000ffff
+#define NVC0_3D_CLIPID_REGION_HORIZ_X__SHIFT 0
+#define NVC0_3D_CLIPID_REGION_HORIZ_W__MASK 0xffff0000
+#define NVC0_3D_CLIPID_REGION_HORIZ_W__SHIFT 16
+
+#define NVC0_3D_CLIPID_REGION_VERT(i0) (0x00000d44 + 0x8*(i0))
+#define NVC0_3D_CLIPID_REGION_VERT__ESIZE 0x00000008
+#define NVC0_3D_CLIPID_REGION_VERT__LEN 0x00000004
+#define NVC0_3D_CLIPID_REGION_VERT_Y__MASK 0x0000ffff
+#define NVC0_3D_CLIPID_REGION_VERT_Y__SHIFT 0
+#define NVC0_3D_CLIPID_REGION_VERT_H__MASK 0xffff0000
+#define NVC0_3D_CLIPID_REGION_VERT_H__SHIFT 16
+
+#define NVC0_3D_VERTEX_BUFFER_FIRST 0x00000d74
+
+#define NVC0_3D_VERTEX_BUFFER_COUNT 0x00000d78
+
+#define NVC0_3D_CLEAR_COLOR(i0) (0x00000d80 + 0x4*(i0))
+#define NVC0_3D_CLEAR_COLOR__ESIZE 0x00000004
+#define NVC0_3D_CLEAR_COLOR__LEN 0x00000004
+
+#define NVC0_3D_CLEAR_DEPTH 0x00000d90
+
+#define NVC0_3D_CLEAR_STENCIL 0x00000da0
+
+#define NVC0_3D_POLYGON_SMOOTH_ENABLE 0x00000db4
+
+#define NVC0_3D_POLYGON_OFFSET_POINT_ENABLE 0x00000dc0
+
+#define NVC0_3D_POLYGON_OFFSET_LINE_ENABLE 0x00000dc4
+
+#define NVC0_3D_POLYGON_OFFSET_FILL_ENABLE 0x00000dc8
+
+#define NVC0_3D_PATCH_VERTICES 0x00000dcc
+
+#define NVC0_3D_WINDOW_OFFSET_X 0x00000df8
+
+#define NVC0_3D_WINDOW_OFFSET_Y 0x00000dfc
+
+#define NVC0_3D_SCISSOR_ENABLE(i0) (0x00000e00 + 0x10*(i0))
+#define NVC0_3D_SCISSOR_ENABLE__ESIZE 0x00000010
+#define NVC0_3D_SCISSOR_ENABLE__LEN 0x00000010
+
+#define NVC0_3D_SCISSOR_HORIZ(i0) (0x00000e04 + 0x10*(i0))
+#define NVC0_3D_SCISSOR_HORIZ__ESIZE 0x00000010
+#define NVC0_3D_SCISSOR_HORIZ__LEN 0x00000010
+#define NVC0_3D_SCISSOR_HORIZ_MIN__MASK 0x0000ffff
+#define NVC0_3D_SCISSOR_HORIZ_MIN__SHIFT 0
+#define NVC0_3D_SCISSOR_HORIZ_MAX__MASK 0xffff0000
+#define NVC0_3D_SCISSOR_HORIZ_MAX__SHIFT 16
+
+#define NVC0_3D_SCISSOR_VERT(i0) (0x00000e08 + 0x10*(i0))
+#define NVC0_3D_SCISSOR_VERT__ESIZE 0x00000010
+#define NVC0_3D_SCISSOR_VERT__LEN 0x00000010
+#define NVC0_3D_SCISSOR_VERT_MIN__MASK 0x0000ffff
+#define NVC0_3D_SCISSOR_VERT_MIN__SHIFT 0
+#define NVC0_3D_SCISSOR_VERT_MAX__MASK 0xffff0000
+#define NVC0_3D_SCISSOR_VERT_MAX__SHIFT 16
+
+#define NVC0_3D_STENCIL_BACK_FUNC_REF 0x00000f54
+
+#define NVC0_3D_STENCIL_BACK_MASK 0x00000f58
+
+#define NVC0_3D_STENCIL_BACK_FUNC_MASK 0x00000f5c
+
+#define NVC0_3D_VERTEX_RUNOUT_ADDRESS_HIGH 0x00000f84
+
+#define NVC0_3D_VERTEX_RUNOUT_ADDRESS_LOW 0x00000f88
+
+#define NVC0_3D_DEPTH_BOUNDS(i0) (0x00000f9c + 0x4*(i0))
+#define NVC0_3D_DEPTH_BOUNDS__ESIZE 0x00000004
+#define NVC0_3D_DEPTH_BOUNDS__LEN 0x00000002
+
+#define NVC0_3D_MSAA_MASK(i0) (0x00000fbc + 0x4*(i0))
+#define NVC0_3D_MSAA_MASK__ESIZE 0x00000004
+#define NVC0_3D_MSAA_MASK__LEN 0x00000004
+
+#define NVC0_3D_CLIPID_ADDRESS_HIGH 0x00000fcc
+
+#define NVC0_3D_CLIPID_ADDRESS_LOW 0x00000fd0
+
+#define NVC0_3D_ZETA_ADDRESS_HIGH 0x00000fe0
+
+#define NVC0_3D_ZETA_ADDRESS_LOW 0x00000fe4
+
+#define NVC0_3D_ZETA_FORMAT 0x00000fe8
+
+#define NVC0_3D_ZETA_TILE_MODE 0x00000fec
+
+#define NVC0_3D_ZETA_LAYER_STRIDE 0x00000ff0
+
+#define NVC0_3D_SCREEN_SCISSOR_HORIZ 0x00000ff4
+#define NVC0_3D_SCREEN_SCISSOR_HORIZ_W__MASK 0xffff0000
+#define NVC0_3D_SCREEN_SCISSOR_HORIZ_W__SHIFT 16
+#define NVC0_3D_SCREEN_SCISSOR_HORIZ_X__MASK 0x0000ffff
+#define NVC0_3D_SCREEN_SCISSOR_HORIZ_X__SHIFT 0
+
+#define NVC0_3D_SCREEN_SCISSOR_VERT 0x00000ff8
+#define NVC0_3D_SCREEN_SCISSOR_VERT_H__MASK 0xffff0000
+#define NVC0_3D_SCREEN_SCISSOR_VERT_H__SHIFT 16
+#define NVC0_3D_SCREEN_SCISSOR_VERT_Y__MASK 0x0000ffff
+#define NVC0_3D_SCREEN_SCISSOR_VERT_Y__SHIFT 0
+
+#define NVC0_3D_VERTEX_ID 0x00001118
+
+#define NVC0_3D_VTX_ATTR_DEFINE 0x0000114c
+#define NVC0_3D_VTX_ATTR_DEFINE_ATTR__MASK 0x000000ff
+#define NVC0_3D_VTX_ATTR_DEFINE_ATTR__SHIFT 0
+#define NVC0_3D_VTX_ATTR_DEFINE_COMP__MASK 0x00000700
+#define NVC0_3D_VTX_ATTR_DEFINE_COMP__SHIFT 8
+#define NVC0_3D_VTX_ATTR_DEFINE_COMP__MIN 0x00000001
+#define NVC0_3D_VTX_ATTR_DEFINE_COMP__MAX 0x00000004
+#define NVC0_3D_VTX_ATTR_DEFINE_SIZE__MASK 0x00007000
+#define NVC0_3D_VTX_ATTR_DEFINE_SIZE__SHIFT 12
+#define NVC0_3D_VTX_ATTR_DEFINE_SIZE_8 0x00001000
+#define NVC0_3D_VTX_ATTR_DEFINE_SIZE_16 0x00002000
+#define NVC0_3D_VTX_ATTR_DEFINE_SIZE_32 0x00004000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE__MASK 0x00070000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE__SHIFT 16
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_SNORM 0x00010000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_UNORM 0x00020000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_SINT 0x00030000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_UINT 0x00040000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_USCALED 0x00050000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_SSCALED 0x00060000
+#define NVC0_3D_VTX_ATTR_DEFINE_TYPE_FLOAT 0x00070000
+
+#define NVC0_3D_VTX_ATTR_DATA(i0) (0x00001150 + 0x4*(i0))
+#define NVC0_3D_VTX_ATTR_DATA__ESIZE 0x00000004
+#define NVC0_3D_VTX_ATTR_DATA__LEN 0x00000004
+
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT(i0) (0x00001160 + 0x4*(i0))
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT__ESIZE 0x00000004
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT__LEN 0x00000020
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_BUFFER__MASK 0x0000003f
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_BUFFER__SHIFT 0
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_CONST 0x00000040
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_OFFSET__MASK 0x001fff80
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_OFFSET__SHIFT 7
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE__MASK 0x07e00000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE__SHIFT 21
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_32_32_32_32 0x00200000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_32_32_32 0x00400000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_16_16_16_16 0x00600000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_32_32 0x00800000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_16_16_16 0x00a00000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_8_8_8_8 0x01400000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_16_16 0x01e00000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_32 0x02400000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_8_8_8 0x02600000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_8_8 0x03000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_16 0x03600000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_8 0x03a00000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_2_10_10_10 0x06000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE__MASK 0x78000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE__SHIFT 27
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_SNORM 0x08000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_UNORM 0x10000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_SINT 0x18000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_UINT 0x20000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_USCALED 0x28000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_SSCALED 0x30000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_FLOAT 0x38000000
+#define NVC0_3D_VERTEX_ATTRIB_FORMAT_BGRA 0x80000000
+
+#define NVC0_3D_RT_CONTROL 0x0000121c
+#define NVC0_3D_RT_CONTROL_COUNT__MASK 0x0000000f
+#define NVC0_3D_RT_CONTROL_COUNT__SHIFT 0
+#define NVC0_3D_RT_CONTROL_MAP0__MASK 0x00000070
+#define NVC0_3D_RT_CONTROL_MAP0__SHIFT 4
+#define NVC0_3D_RT_CONTROL_MAP1__MASK 0x00000380
+#define NVC0_3D_RT_CONTROL_MAP1__SHIFT 7
+#define NVC0_3D_RT_CONTROL_MAP2__MASK 0x00001c00
+#define NVC0_3D_RT_CONTROL_MAP2__SHIFT 10
+#define NVC0_3D_RT_CONTROL_MAP3__MASK 0x0000e000
+#define NVC0_3D_RT_CONTROL_MAP3__SHIFT 13
+#define NVC0_3D_RT_CONTROL_MAP4__MASK 0x00070000
+#define NVC0_3D_RT_CONTROL_MAP4__SHIFT 16
+#define NVC0_3D_RT_CONTROL_MAP5__MASK 0x00380000
+#define NVC0_3D_RT_CONTROL_MAP5__SHIFT 19
+#define NVC0_3D_RT_CONTROL_MAP6__MASK 0x01c00000
+#define NVC0_3D_RT_CONTROL_MAP6__SHIFT 22
+#define NVC0_3D_RT_CONTROL_MAP7__MASK 0x0e000000
+#define NVC0_3D_RT_CONTROL_MAP7__SHIFT 25
+
+#define NVC0_3D_ZETA_HORIZ 0x00001228
+
+#define NVC0_3D_ZETA_VERT 0x0000122c
+
+#define NVC0_3D_ZETA_ARRAY_MODE 0x00001230
+#define NVC0_3D_ZETA_ARRAY_MODE_LAYERS__MASK 0x0000ffff
+#define NVC0_3D_ZETA_ARRAY_MODE_LAYERS__SHIFT 0
+#define NVC0_3D_ZETA_ARRAY_MODE_UNK 0x00010000
+
+#define NVC0_3D_LINKED_TSC 0x00001234
+
+#define NVC0_3D_FP_RESULT_COUNT 0x00001298
+
+#define NVC0_3D_DEPTH_TEST_ENABLE 0x000012cc
+
+#define NVC0_3D_D3D_FILL_MODE 0x000012d0
+#define NVC0_3D_D3D_FILL_MODE_POINT 0x00000001
+#define NVC0_3D_D3D_FILL_MODE_WIREFRAME 0x00000002
+#define NVC0_3D_D3D_FILL_MODE_SOLID 0x00000003
+
+#define NVC0_3D_SHADE_MODEL 0x000012d4
+#define NVC0_3D_SHADE_MODEL_FLAT 0x00001d00
+#define NVC0_3D_SHADE_MODEL_SMOOTH 0x00001d01
+
+#define NVC0_3D_BLEND_INDEPENDENT 0x000012e4
+
+#define NVC0_3D_DEPTH_WRITE_ENABLE 0x000012e8
+
+#define NVC0_3D_ALPHA_TEST_ENABLE 0x000012ec
+
+#define NVC0_3D_VB_ELEMENT_U8_SETUP 0x00001300
+#define NVC0_3D_VB_ELEMENT_U8_SETUP_OFFSET__MASK 0xc0000000
+#define NVC0_3D_VB_ELEMENT_U8_SETUP_OFFSET__SHIFT 30
+#define NVC0_3D_VB_ELEMENT_U8_SETUP_COUNT__MASK 0x3fffffff
+#define NVC0_3D_VB_ELEMENT_U8_SETUP_COUNT__SHIFT 0
+
+#define NVC0_3D_VB_ELEMENT_U8 0x00001304
+#define NVC0_3D_VB_ELEMENT_U8_I0__MASK 0x000000ff
+#define NVC0_3D_VB_ELEMENT_U8_I0__SHIFT 0
+#define NVC0_3D_VB_ELEMENT_U8_I1__MASK 0x0000ff00
+#define NVC0_3D_VB_ELEMENT_U8_I1__SHIFT 8
+#define NVC0_3D_VB_ELEMENT_U8_I2__MASK 0x00ff0000
+#define NVC0_3D_VB_ELEMENT_U8_I2__SHIFT 16
+#define NVC0_3D_VB_ELEMENT_U8_I3__MASK 0xff000000
+#define NVC0_3D_VB_ELEMENT_U8_I3__SHIFT 24
+
+#define NVC0_3D_D3D_CULL_MODE 0x00001308
+#define NVC0_3D_D3D_CULL_MODE_NONE 0x00000001
+#define NVC0_3D_D3D_CULL_MODE_FRONT 0x00000002
+#define NVC0_3D_D3D_CULL_MODE_BACK 0x00000003
+
+#define NVC0_3D_DEPTH_TEST_FUNC 0x0000130c
+#define NVC0_3D_DEPTH_TEST_FUNC_NEVER 0x00000200
+#define NVC0_3D_DEPTH_TEST_FUNC_LESS 0x00000201
+#define NVC0_3D_DEPTH_TEST_FUNC_EQUAL 0x00000202
+#define NVC0_3D_DEPTH_TEST_FUNC_LEQUAL 0x00000203
+#define NVC0_3D_DEPTH_TEST_FUNC_GREATER 0x00000204
+#define NVC0_3D_DEPTH_TEST_FUNC_NOTEQUAL 0x00000205
+#define NVC0_3D_DEPTH_TEST_FUNC_GEQUAL 0x00000206
+#define NVC0_3D_DEPTH_TEST_FUNC_ALWAYS 0x00000207
+
+#define NVC0_3D_ALPHA_TEST_REF 0x00001310
+
+#define NVC0_3D_ALPHA_TEST_FUNC 0x00001314
+#define NVC0_3D_ALPHA_TEST_FUNC_NEVER 0x00000200
+#define NVC0_3D_ALPHA_TEST_FUNC_LESS 0x00000201
+#define NVC0_3D_ALPHA_TEST_FUNC_EQUAL 0x00000202
+#define NVC0_3D_ALPHA_TEST_FUNC_LEQUAL 0x00000203
+#define NVC0_3D_ALPHA_TEST_FUNC_GREATER 0x00000204
+#define NVC0_3D_ALPHA_TEST_FUNC_NOTEQUAL 0x00000205
+#define NVC0_3D_ALPHA_TEST_FUNC_GEQUAL 0x00000206
+#define NVC0_3D_ALPHA_TEST_FUNC_ALWAYS 0x00000207
+
+#define NVC0_3D_BLEND_COLOR(i0) (0x0000131c + 0x4*(i0))
+#define NVC0_3D_BLEND_COLOR__ESIZE 0x00000004
+#define NVC0_3D_BLEND_COLOR__LEN 0x00000004
+
+#define NVC0_3D_TSC_FLUSH 0x00001330
+#define NVC0_3D_TSC_FLUSH_UNK0 0x00000001
+#define NVC0_3D_TSC_FLUSH_UNK1__MASK 0x03fffff0
+#define NVC0_3D_TSC_FLUSH_UNK1__SHIFT 4
+
+#define NVC0_3D_TIC_FLUSH 0x00001334
+#define NVC0_3D_TIC_FLUSH_UNK0 0x00000001
+#define NVC0_3D_TIC_FLUSH_UNK1__MASK 0x03fffff0
+#define NVC0_3D_TIC_FLUSH_UNK1__SHIFT 4
+
+#define NVC0_3D_TEX_CACHE_CTL 0x00001338
+#define NVC0_3D_TEX_CACHE_CTL_UNK1__MASK 0x00000030
+#define NVC0_3D_TEX_CACHE_CTL_UNK1__SHIFT 4
+
+#define NVC0_3D_BLEND_EQUATION_RGB 0x00001340
+#define NVC0_3D_BLEND_EQUATION_RGB_FUNC_ADD 0x00008006
+#define NVC0_3D_BLEND_EQUATION_RGB_MIN 0x00008007
+#define NVC0_3D_BLEND_EQUATION_RGB_MAX 0x00008008
+#define NVC0_3D_BLEND_EQUATION_RGB_FUNC_SUBTRACT 0x0000800a
+#define NVC0_3D_BLEND_EQUATION_RGB_FUNC_REVERSE_SUBTRACT 0x0000800b
+
+#define NVC0_3D_BLEND_FUNC_SRC_RGB 0x00001344
+
+#define NVC0_3D_BLEND_FUNC_DST_RGB 0x00001348
+
+#define NVC0_3D_BLEND_EQUATION_ALPHA 0x0000134c
+#define NVC0_3D_BLEND_EQUATION_ALPHA_FUNC_ADD 0x00008006
+#define NVC0_3D_BLEND_EQUATION_ALPHA_MIN 0x00008007
+#define NVC0_3D_BLEND_EQUATION_ALPHA_MAX 0x00008008
+#define NVC0_3D_BLEND_EQUATION_ALPHA_FUNC_SUBTRACT 0x0000800a
+#define NVC0_3D_BLEND_EQUATION_ALPHA_FUNC_REVERSE_SUBTRACT 0x0000800b
+
+#define NVC0_3D_BLEND_FUNC_SRC_ALPHA 0x00001350
+
+#define NVC0_3D_BLEND_FUNC_DST_ALPHA 0x00001358
+
+#define NVC0_3D_BLEND_ENABLE(i0) (0x00001360 + 0x4*(i0))
+#define NVC0_3D_BLEND_ENABLE__ESIZE 0x00000004
+#define NVC0_3D_BLEND_ENABLE__LEN 0x00000008
+
+#define NVC0_3D_STENCIL_FRONT_ENABLE 0x00001380
+
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL 0x00001384
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_ZERO 0x00000000
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_INVERT 0x0000150a
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_KEEP 0x00001e00
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_REPLACE 0x00001e01
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_INCR 0x00001e02
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_DECR 0x00001e03
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_INCR_WRAP 0x00008507
+#define NVC0_3D_STENCIL_FRONT_OP_FAIL_DECR_WRAP 0x00008508
+
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL 0x00001388
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_ZERO 0x00000000
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_INVERT 0x0000150a
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_KEEP 0x00001e00
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_REPLACE 0x00001e01
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_INCR 0x00001e02
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_DECR 0x00001e03
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_INCR_WRAP 0x00008507
+#define NVC0_3D_STENCIL_FRONT_OP_ZFAIL_DECR_WRAP 0x00008508
+
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS 0x0000138c
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_ZERO 0x00000000
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_INVERT 0x0000150a
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_KEEP 0x00001e00
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_REPLACE 0x00001e01
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_INCR 0x00001e02
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_DECR 0x00001e03
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_INCR_WRAP 0x00008507
+#define NVC0_3D_STENCIL_FRONT_OP_ZPASS_DECR_WRAP 0x00008508
+
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC 0x00001390
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_NEVER 0x00000200
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_LESS 0x00000201
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_EQUAL 0x00000202
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_LEQUAL 0x00000203
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_GREATER 0x00000204
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_NOTEQUAL 0x00000205
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_GEQUAL 0x00000206
+#define NVC0_3D_STENCIL_FRONT_FUNC_FUNC_ALWAYS 0x00000207
+
+#define NVC0_3D_STENCIL_FRONT_FUNC_REF 0x00001394
+
+#define NVC0_3D_STENCIL_FRONT_MASK 0x00001398
+
+#define NVC0_3D_STENCIL_FRONT_FUNC_MASK 0x0000139c
+
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN 0x000013a8
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_0 0x00000001
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_1 0x00000010
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_2 0x00000100
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_3 0x00001000
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_4 0x00010000
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_5 0x00100000
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_6 0x01000000
+#define NVC0_3D_FRAG_COLOR_CLAMP_EN_7 0x10000000
+
+#define NVC0_3D_Y_ORIGIN_BOTTOM 0x000013ac
+
+#define NVC0_3D_LINE_WIDTH 0x000013b0
+
+#define NVC0_3D_GP_VERTEX_OUTPUT_COUNT 0x00001420
+#define NVC0_3D_GP_VERTEX_OUTPUT_COUNT__MIN 0x00000001
+#define NVC0_3D_GP_VERTEX_OUTPUT_COUNT__MAX 0x00000400
+
+#define NVC0_3D_FENCE_UNK 0x0000142c
+
+#define NVC0_3D_VB_ELEMENT_BASE 0x00001434
+
+#define NVC0_3D_VB_INSTANCE_BASE 0x00001438
+
+#define NVC0_3D_CODE_CB_FLUSH 0x00001440
+
+#define NVC0_3D_CLIPID_HEIGHT 0x00001504
+#define NVC0_3D_CLIPID_HEIGHT__MAX 0x00002000
+
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE 0x00001510
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_0 0x00000001
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_1 0x00000002
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_2 0x00000004
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_3 0x00000008
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_4 0x00000010
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_5 0x00000020
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_6 0x00000040
+#define NVC0_3D_VP_CLIP_DISTANCE_ENABLE_7 0x00000080
+
+#define NVC0_3D_SAMPLECNT_ENABLE 0x00001514
+
+#define NVC0_3D_POINT_SIZE 0x00001518
+
+#define NVC0_3D_POINT_SPRITE_ENABLE 0x00001520
+
+#define NVC0_3D_SAMPLECNT_RESET 0x00001530
+
+#define NVC0_3D_MULTISAMPLE_ZETA_ENABLE 0x00001534
+
+#define NVC0_3D_ZETA_ENABLE 0x00001538
+
+#define NVC0_3D_MULTISAMPLE_CTRL 0x0000153c
+#define NVC0_3D_MULTISAMPLE_CTRL_ALPHA_TO_COVERAGE 0x00000001
+#define NVC0_3D_MULTISAMPLE_CTRL_ALPHA_TO_ONE 0x00000010
+
+#define NVC0_3D_COND_ADDRESS_HIGH 0x00001550
+
+#define NVC0_3D_COND_ADDRESS_LOW 0x00001554
+
+#define NVC0_3D_COND_MODE 0x00001558
+#define NVC0_3D_COND_MODE_NEVER 0x00000000
+#define NVC0_3D_COND_MODE_ALWAYS 0x00000001
+#define NVC0_3D_COND_MODE_RES_NON_ZERO 0x00000002
+#define NVC0_3D_COND_MODE_EQUAL 0x00000003
+#define NVC0_3D_COND_MODE_NOT_EQUAL 0x00000004
+
+#define NVC0_3D_TSC_ADDRESS_HIGH 0x0000155c
+
+#define NVC0_3D_TSC_ADDRESS_LOW 0x00001560
+#define NVC0_3D_TSC_ADDRESS_LOW__ALIGN 0x00000020
+
+#define NVC0_3D_TSC_LIMIT 0x00001564
+#define NVC0_3D_TSC_LIMIT__MAX 0x00001fff
+
+#define NVC0_3D_POLYGON_OFFSET_FACTOR 0x0000156c
+
+#define NVC0_3D_LINE_SMOOTH_ENABLE 0x00001570
+
+#define NVC0_3D_TIC_ADDRESS_HIGH 0x00001574
+
+#define NVC0_3D_TIC_ADDRESS_LOW 0x00001578
+
+#define NVC0_3D_TIC_LIMIT 0x0000157c
+
+#define NVC0_3D_STENCIL_TWO_SIDE_ENABLE 0x00001594
+
+#define NVC0_3D_STENCIL_BACK_OP_FAIL 0x00001598
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_ZERO 0x00000000
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_INVERT 0x0000150a
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_KEEP 0x00001e00
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_REPLACE 0x00001e01
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_INCR 0x00001e02
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_DECR 0x00001e03
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_INCR_WRAP 0x00008507
+#define NVC0_3D_STENCIL_BACK_OP_FAIL_DECR_WRAP 0x00008508
+
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL 0x0000159c
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_ZERO 0x00000000
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_INVERT 0x0000150a
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_KEEP 0x00001e00
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_REPLACE 0x00001e01
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_INCR 0x00001e02
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_DECR 0x00001e03
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_INCR_WRAP 0x00008507
+#define NVC0_3D_STENCIL_BACK_OP_ZFAIL_DECR_WRAP 0x00008508
+
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS 0x000015a0
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_ZERO 0x00000000
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_INVERT 0x0000150a
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_KEEP 0x00001e00
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_REPLACE 0x00001e01
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_INCR 0x00001e02
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_DECR 0x00001e03
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_INCR_WRAP 0x00008507
+#define NVC0_3D_STENCIL_BACK_OP_ZPASS_DECR_WRAP 0x00008508
+
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC 0x000015a4
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_NEVER 0x00000200
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_LESS 0x00000201
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_EQUAL 0x00000202
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_LEQUAL 0x00000203
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_GREATER 0x00000204
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_NOTEQUAL 0x00000205
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_GEQUAL 0x00000206
+#define NVC0_3D_STENCIL_BACK_FUNC_FUNC_ALWAYS 0x00000207
+
+#define NVC0_3D_MULTISAMPLE_COLOR_ENABLE 0x000015b4
+
+#define NVC0_3D_FRAMEBUFFER_SRGB 0x000015b8
+
+#define NVC0_3D_POLYGON_OFFSET_UNITS 0x000015bc
+
+#define NVC0_3D_GP_BUILTIN_RESULT_EN 0x000015cc
+#define NVC0_3D_GP_BUILTIN_RESULT_EN_LAYER 0x00010000
+
+#define NVC0_3D_MULTISAMPLE_MODE 0x000015d0
+#define NVC0_3D_MULTISAMPLE_MODE_1X 0x00000000
+#define NVC0_3D_MULTISAMPLE_MODE_2XMS 0x00000001
+#define NVC0_3D_MULTISAMPLE_MODE_4XMS 0x00000002
+#define NVC0_3D_MULTISAMPLE_MODE_8XMS 0x00000003
+#define NVC0_3D_MULTISAMPLE_MODE_4XMS_4XCS 0x00000008
+#define NVC0_3D_MULTISAMPLE_MODE_4XMS_12XCS 0x00000009
+#define NVC0_3D_MULTISAMPLE_MODE_8XMS_8XCS 0x0000000a
+
+#define NVC0_3D_VERTEX_BEGIN_D3D 0x000015d4
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE__MASK 0x0fffffff
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE__SHIFT 0
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_POINTS 0x00000001
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_LINES 0x00000002
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_LINE_STRIP 0x00000003
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_TRIANGLES 0x00000004
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_TRIANGLE_STRIP 0x00000005
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_LINES_ADJACENCY 0x0000000a
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_LINE_STRIP_ADJACENCY 0x0000000b
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_TRIANGLES_ADJACENCY 0x0000000c
+#define NVC0_3D_VERTEX_BEGIN_D3D_PRIMITIVE_TRIANGLE_STRIP_ADJACENCY 0x0000000d
+#define NVC0_3D_VERTEX_BEGIN_D3D_INSTANCE_NEXT 0x10000000
+
+#define NVC0_3D_VERTEX_END_D3D 0x000015d8
+#define NVC0_3D_VERTEX_END_D3D_UNK0 0x00000001
+#define NVC0_3D_VERTEX_END_D3D_UNK1 0x00000002
+
+#define NVC0_3D_EDGEFLAG_ENABLE 0x000015e4
+
+#define NVC0_3D_VB_ELEMENT_U32 0x000015e8
+
+#define NVC0_3D_VB_ELEMENT_U16_SETUP 0x000015ec
+#define NVC0_3D_VB_ELEMENT_U16_SETUP_OFFSET__MASK 0xc0000000
+#define NVC0_3D_VB_ELEMENT_U16_SETUP_OFFSET__SHIFT 30
+#define NVC0_3D_VB_ELEMENT_U16_SETUP_COUNT__MASK 0x3fffffff
+#define NVC0_3D_VB_ELEMENT_U16_SETUP_COUNT__SHIFT 0
+
+#define NVC0_3D_VB_ELEMENT_U16 0x000015f0
+#define NVC0_3D_VB_ELEMENT_U16_I0__MASK 0x0000ffff
+#define NVC0_3D_VB_ELEMENT_U16_I0__SHIFT 0
+#define NVC0_3D_VB_ELEMENT_U16_I1__MASK 0xffff0000
+#define NVC0_3D_VB_ELEMENT_U16_I1__SHIFT 16
+
+#define NVC0_3D_VERTEX_BASE_HIGH 0x000015f4
+
+#define NVC0_3D_VERTEX_BASE_LOW 0x000015f8
+
+#define NVC0_3D_POINT_COORD_REPLACE 0x00001604
+#define NVC0_3D_POINT_COORD_REPLACE_BITS__MASK 0x00001fff
+#define NVC0_3D_POINT_COORD_REPLACE_BITS__SHIFT 0
+
+#define NVC0_3D_CODE_ADDRESS_HIGH 0x00001608
+
+#define NVC0_3D_CODE_ADDRESS_LOW 0x0000160c
+
+#define NVC0_3D_VERTEX_END_GL 0x00001614
+#define NVC0_3D_VERTEX_END_GL_UNK0 0x00000001
+#define NVC0_3D_VERTEX_END_GL_UNK1 0x00000002
+
+#define NVC0_3D_VERTEX_BEGIN_GL 0x00001618
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE__MASK 0x0fffffff
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE__SHIFT 0
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_POINTS 0x00000000
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_LINES 0x00000001
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_LINE_LOOP 0x00000002
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_LINE_STRIP 0x00000003
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLES 0x00000004
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLE_STRIP 0x00000005
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLE_FAN 0x00000006
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_QUADS 0x00000007
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_QUAD_STRIP 0x00000008
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_POLYGON 0x00000009
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_LINES_ADJACENCY 0x0000000a
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_LINE_STRIP_ADJACENCY 0x0000000b
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLES_ADJACENCY 0x0000000c
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLE_STRIP_ADJACENCY 0x0000000d
+#define NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_PATCHES 0x0000000e
+#define NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT 0x10000000
+
+#define NVC0_3D_VERTEX_DATA 0x00001640
+
+#define NVC0_3D_PRIM_RESTART_ENABLE 0x00001644
+
+#define NVC0_3D_PRIM_RESTART_INDEX 0x00001648
+
+#define NVC0_3D_VP_GP_BUILTIN_ATTR_EN 0x0000164c
+#define NVC0_3D_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID 0x00000001
+#define NVC0_3D_VP_GP_BUILTIN_ATTR_EN_INSTANCE_ID 0x00000010
+#define NVC0_3D_VP_GP_BUILTIN_ATTR_EN_PRIMITIVE_ID 0x00000100
+#define NVC0_3D_VP_GP_BUILTIN_ATTR_EN_UNK12 0x00001000
+
+#define NVC0_3D_POINT_SMOOTH_ENABLE 0x00001658
+
+#define NVC0_3D_POINT_SPRITE_CTRL 0x00001660
+
+#define NVC0_3D_TEX_MISC 0x00001664
+#define NVC0_3D_TEX_MISC_SEAMLESS_CUBE_MAP 0x00000004
+
+#define NVC0_3D_LINE_STIPPLE_ENABLE 0x0000166c
+
+#define NVC0_3D_LINE_STIPPLE_PATTERN 0x00001680
+
+#define NVC0_3D_PROVOKING_VERTEX_LAST 0x00001684
+
+#define NVC0_3D_VERTEX_TWO_SIDE_ENABLE 0x00001688
+
+#define NVC0_3D_POLYGON_STIPPLE_ENABLE 0x0000168c
+
+#define NVC0_3D_POLYGON_STIPPLE_PATTERN(i0) (0x00001700 + 0x4*(i0))
+#define NVC0_3D_POLYGON_STIPPLE_PATTERN__ESIZE 0x00000004
+#define NVC0_3D_POLYGON_STIPPLE_PATTERN__LEN 0x00000020
+
+#define NVC0_3D_STRMOUT_UNK1780(i0) (0x00001780 + 0x4*(i0))
+#define NVC0_3D_STRMOUT_UNK1780__ESIZE 0x00000004
+#define NVC0_3D_STRMOUT_UNK1780__LEN 0x00000004
+
+#define NVC0_3D_UNK17BC_ADDRESS_HIGH 0x000017bc
+
+#define NVC0_3D_UNK17BC_ADDRESS_LOW 0x000017c0
+
+#define NVC0_3D_UNK17BC_LIMIT 0x000017c4
+
+#define NVC0_3D_INDEX_ARRAY_START_HIGH 0x000017c8
+
+#define NVC0_3D_INDEX_ARRAY_START_LOW 0x000017cc
+
+#define NVC0_3D_INDEX_ARRAY_LIMIT_HIGH 0x000017d0
+
+#define NVC0_3D_INDEX_ARRAY_LIMIT_LOW 0x000017d4
+
+#define NVC0_3D_INDEX_LOG2_SIZE 0x000017d8
+
+#define NVC0_3D_INDEX_BATCH_FIRST 0x000017dc
+
+#define NVC0_3D_INDEX_BATCH_COUNT 0x000017e0
+
+#define NVC0_3D_VERTEX_ARRAY_PER_INSTANCE(i0) (0x00001880 + 0x4*(i0))
+#define NVC0_3D_VERTEX_ARRAY_PER_INSTANCE__ESIZE 0x00000004
+#define NVC0_3D_VERTEX_ARRAY_PER_INSTANCE__LEN 0x00000020
+
+#define NVC0_3D_VP_POINT_SIZE_EN 0x00001910
+
+#define NVC0_3D_CULL_FACE_ENABLE 0x00001918
+
+#define NVC0_3D_FRONT_FACE 0x0000191c
+#define NVC0_3D_FRONT_FACE_CW 0x00000900
+#define NVC0_3D_FRONT_FACE_CCW 0x00000901
+
+#define NVC0_3D_CULL_FACE 0x00001920
+#define NVC0_3D_CULL_FACE_FRONT 0x00000404
+#define NVC0_3D_CULL_FACE_BACK 0x00000405
+#define NVC0_3D_CULL_FACE_FRONT_AND_BACK 0x00000408
+
+#define NVC0_3D_VIEWPORT_TRANSFORM_EN 0x0000192c
+
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL 0x0000193c
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK0 0x00000001
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK1 0x00000002
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK2 0x00000004
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK3 0x00000008
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK4 0x00000010
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK7 0x00000080
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK10 0x00000400
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK11 0x00000800
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK12 0x00001000
+#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK13 0x00002000
+
+#define NVC0_3D_VIEWPORT_CLIP_RECTS_EN 0x0000194c
+
+#define NVC0_3D_VIEWPORT_CLIP_MODE 0x00001950
+#define NVC0_3D_VIEWPORT_CLIP_MODE_INSIDE_ANY 0x00000000
+#define NVC0_3D_VIEWPORT_CLIP_MODE_OUTSIDE_ALL 0x00000001
+#define NVC0_3D_VIEWPORT_CLIP_MODE_NEVER 0x00000002
+
+#define NVC0_3D_FP_ZORDER_CTRL 0x0000196c
+#define NVC0_3D_FP_ZORDER_CTRL_0 0x00000001
+#define NVC0_3D_FP_ZORDER_CTRL_1 0x00000010
+
+#define NVC0_3D_CLIPID_ENABLE 0x0000197c
+
+#define NVC0_3D_CLIPID_WIDTH 0x00001980
+#define NVC0_3D_CLIPID_WIDTH__MAX 0x00002000
+#define NVC0_3D_CLIPID_WIDTH__ALIGN 0x00000040
+
+#define NVC0_3D_CLIPID_ID 0x00001984
+
+#define NVC0_3D_FP_CONTROL 0x000019a8
+#define NVC0_3D_FP_CONTROL_MULTIPLE_RESULTS 0x00000001
+#define NVC0_3D_FP_CONTROL_EXPORTS_Z 0x00000100
+#define NVC0_3D_FP_CONTROL_USES_KIL 0x00100000
+
+#define NVC0_3D_DEPTH_BOUNDS_EN 0x000019bc
+
+#define NVC0_3D_LOGIC_OP_ENABLE 0x000019c4
+
+#define NVC0_3D_LOGIC_OP 0x000019c8
+#define NVC0_3D_LOGIC_OP_CLEAR 0x00001500
+#define NVC0_3D_LOGIC_OP_AND 0x00001501
+#define NVC0_3D_LOGIC_OP_AND_REVERSE 0x00001502
+#define NVC0_3D_LOGIC_OP_COPY 0x00001503
+#define NVC0_3D_LOGIC_OP_AND_INVERTED 0x00001504
+#define NVC0_3D_LOGIC_OP_NOOP 0x00001505
+#define NVC0_3D_LOGIC_OP_XOR 0x00001506
+#define NVC0_3D_LOGIC_OP_OR 0x00001507
+#define NVC0_3D_LOGIC_OP_NOR 0x00001508
+#define NVC0_3D_LOGIC_OP_EQUIV 0x00001509
+#define NVC0_3D_LOGIC_OP_INVERT 0x0000150a
+#define NVC0_3D_LOGIC_OP_OR_REVERSE 0x0000150b
+#define NVC0_3D_LOGIC_OP_COPY_INVERTED 0x0000150c
+#define NVC0_3D_LOGIC_OP_OR_INVERTED 0x0000150d
+#define NVC0_3D_LOGIC_OP_NAND 0x0000150e
+#define NVC0_3D_LOGIC_OP_SET 0x0000150f
+
+#define NVC0_3D_CLEAR_BUFFERS 0x000019d0
+#define NVC0_3D_CLEAR_BUFFERS_Z 0x00000001
+#define NVC0_3D_CLEAR_BUFFERS_S 0x00000002
+#define NVC0_3D_CLEAR_BUFFERS_R 0x00000004
+#define NVC0_3D_CLEAR_BUFFERS_G 0x00000008
+#define NVC0_3D_CLEAR_BUFFERS_B 0x00000010
+#define NVC0_3D_CLEAR_BUFFERS_A 0x00000020
+#define NVC0_3D_CLEAR_BUFFERS_RT__MASK 0x000003c0
+#define NVC0_3D_CLEAR_BUFFERS_RT__SHIFT 6
+#define NVC0_3D_CLEAR_BUFFERS_LAYER__MASK 0x001ffc00
+#define NVC0_3D_CLEAR_BUFFERS_LAYER__SHIFT 10
+
+#define NVC0_3D_COLOR_MASK(i0) (0x00001a00 + 0x4*(i0))
+#define NVC0_3D_COLOR_MASK__ESIZE 0x00000004
+#define NVC0_3D_COLOR_MASK__LEN 0x00000008
+#define NVC0_3D_COLOR_MASK_R 0x0000000f
+#define NVC0_3D_COLOR_MASK_G 0x000000f0
+#define NVC0_3D_COLOR_MASK_B 0x00000f00
+#define NVC0_3D_COLOR_MASK_A 0x0000f000
+
+#define NVC0_3D_QUERY_ADDRESS_HIGH 0x00001b00
+
+#define NVC0_3D_QUERY_ADDRESS_LOW 0x00001b04
+
+#define NVC0_3D_QUERY_SEQUENCE 0x00001b08
+
+#define NVC0_3D_QUERY_GET 0x00001b0c
+#define NVC0_3D_QUERY_GET_FENCE 0x1000f010
+#define NVC0_3D_QUERY_GET_SAMPLE_COUNT 0x0100f002
+#define NVC0_3D_QUERY_GET_TFB 0x05805002
+#define NVC0_3D_QUERY_GET_GENERATED_PRIMS 0x06805002
+#define NVC0_3D_QUERY_GET_UNK00005002 0x00005002
+
+#define NVC0_3D_VERTEX_ARRAY_FETCH(i0) (0x00001c00 + 0x10*(i0))
+#define NVC0_3D_VERTEX_ARRAY_FETCH__ESIZE 0x00000010
+#define NVC0_3D_VERTEX_ARRAY_FETCH__LEN 0x00000020
+#define NVC0_3D_VERTEX_ARRAY_FETCH_STRIDE__MASK 0x00000fff
+#define NVC0_3D_VERTEX_ARRAY_FETCH_STRIDE__SHIFT 0
+#define NVC0_3D_VERTEX_ARRAY_FETCH_ENABLE 0x00001000
+
+#define NVC0_3D_VERTEX_ARRAY_DIVISOR(i0) (0x00001c0c + 0x10*(i0))
+#define NVC0_3D_VERTEX_ARRAY_DIVISOR__ESIZE 0x00000010
+#define NVC0_3D_VERTEX_ARRAY_DIVISOR__LEN 0x00000020
+
+#define NVC0_3D_IBLEND(i0) (0x00001e00 + 0x20*(i0))
+#define NVC0_3D_IBLEND__ESIZE 0x00000020
+#define NVC0_3D_IBLEND__LEN 0x00000008
+
+#define NVC0_3D_IBLEND_EQUATION_RGB(i0) (0x00001e04 + 0x20*(i0))
+#define NVC0_3D_IBLEND_EQUATION_RGB_FUNC_ADD 0x00008006
+#define NVC0_3D_IBLEND_EQUATION_RGB_MIN 0x00008007
+#define NVC0_3D_IBLEND_EQUATION_RGB_MAX 0x00008008
+#define NVC0_3D_IBLEND_EQUATION_RGB_FUNC_SUBTRACT 0x0000800a
+#define NVC0_3D_IBLEND_EQUATION_RGB_FUNC_REVERSE_SUBTRACT 0x0000800b
+
+#define NVC0_3D_IBLEND_FUNC_SRC_RGB(i0) (0x00001e08 + 0x20*(i0))
+
+#define NVC0_3D_IBLEND_FUNC_DST_RGB(i0) (0x00001e0c + 0x20*(i0))
+
+#define NVC0_3D_IBLEND_EQUATION_ALPHA(i0) (0x00001e10 + 0x20*(i0))
+#define NVC0_3D_IBLEND_EQUATION_ALPHA_FUNC_ADD 0x00008006
+#define NVC0_3D_IBLEND_EQUATION_ALPHA_MIN 0x00008007
+#define NVC0_3D_IBLEND_EQUATION_ALPHA_MAX 0x00008008
+#define NVC0_3D_IBLEND_EQUATION_ALPHA_FUNC_SUBTRACT 0x0000800a
+#define NVC0_3D_IBLEND_EQUATION_ALPHA_FUNC_REVERSE_SUBTRACT 0x0000800b
+
+#define NVC0_3D_IBLEND_FUNC_SRC_ALPHA(i0) (0x00001e14 + 0x20*(i0))
+
+#define NVC0_3D_IBLEND_FUNC_DST_ALPHA(i0) (0x00001e18 + 0x20*(i0))
+
+#define NVC0_3D_SP(i0) (0x00002000 + 0x40*(i0))
+#define NVC0_3D_SP__ESIZE 0x00000040
+#define NVC0_3D_SP__LEN 0x00000006
+
+#define NVC0_3D_SP_SELECT(i0) (0x00002000 + 0x40*(i0))
+#define NVC0_3D_SP_SELECT_ENABLE 0x00000001
+#define NVC0_3D_SP_SELECT_PROGRAM__MASK 0x00000070
+#define NVC0_3D_SP_SELECT_PROGRAM__SHIFT 4
+#define NVC0_3D_SP_SELECT_PROGRAM_VP_A 0x00000000
+#define NVC0_3D_SP_SELECT_PROGRAM_VP_B 0x00000010
+#define NVC0_3D_SP_SELECT_PROGRAM_TCP 0x00000020
+#define NVC0_3D_SP_SELECT_PROGRAM_TEP 0x00000030
+#define NVC0_3D_SP_SELECT_PROGRAM_GP 0x00000040
+#define NVC0_3D_SP_SELECT_PROGRAM_FP 0x00000050
+
+#define NVC0_3D_SP_START_ID(i0) (0x00002004 + 0x40*(i0))
+
+#define NVC0_3D_SP_GPR_ALLOC(i0) (0x0000200c + 0x40*(i0))
+
+#define NVC0_3D_TEX_LIMITS(i0) (0x00002200 + 0x10*(i0))
+#define NVC0_3D_TEX_LIMITS__ESIZE 0x00000010
+#define NVC0_3D_TEX_LIMITS__LEN 0x00000005
+
+#define NVC0_3D_CB_SIZE 0x00002380
+
+#define NVC0_3D_CB_ADDRESS_HIGH 0x00002384
+
+#define NVC0_3D_CB_ADDRESS_LOW 0x00002388
+
+#define NVC0_3D_CB_POS 0x0000238c
+
+#define NVC0_3D_CB_DATA(i0) (0x00002390 + 0x4*(i0))
+#define NVC0_3D_CB_DATA__ESIZE 0x00000004
+#define NVC0_3D_CB_DATA__LEN 0x00000010
+
+#define NVC0_3D_BIND_TSC(i0) (0x00002400 + 0x20*(i0))
+#define NVC0_3D_BIND_TSC__ESIZE 0x00000020
+#define NVC0_3D_BIND_TSC__LEN 0x00000005
+#define NVC0_3D_BIND_TSC_ACTIVE 0x00000001
+#define NVC0_3D_BIND_TSC_SAMPLER__MASK 0x00000ff0
+#define NVC0_3D_BIND_TSC_SAMPLER__SHIFT 4
+#define NVC0_3D_BIND_TSC_TSC__MASK 0x01fff000
+#define NVC0_3D_BIND_TSC_TSC__SHIFT 12
+
+#define NVC0_3D_BIND_TIC(i0) (0x00002404 + 0x20*(i0))
+#define NVC0_3D_BIND_TIC__ESIZE 0x00000020
+#define NVC0_3D_BIND_TIC__LEN 0x00000005
+#define NVC0_3D_BIND_TIC_ACTIVE 0x00000001
+#define NVC0_3D_BIND_TIC_TEXTURE__MASK 0x000001fe
+#define NVC0_3D_BIND_TIC_TEXTURE__SHIFT 1
+#define NVC0_3D_BIND_TIC_TIC__MASK 0x7ffffe00
+#define NVC0_3D_BIND_TIC_TIC__SHIFT 9
+
+#define NVC0_3D_CB_BIND(i0) (0x00002410 + 0x20*(i0))
+#define NVC0_3D_CB_BIND__ESIZE 0x00000020
+#define NVC0_3D_CB_BIND__LEN 0x00000005
+#define NVC0_3D_CB_BIND_VALID 0x00000001
+#define NVC0_3D_CB_BIND_INDEX__MASK 0x000000f0
+#define NVC0_3D_CB_BIND_INDEX__SHIFT 4
+
+#define NVC0_3D_VERT_COLOR_CLAMP_EN 0x00002600
+
+#define NVC0_3D_TFB_VARYING_LOCS(i0) (0x00002800 + 0x4*(i0))
+#define NVC0_3D_TFB_VARYING_LOCS__ESIZE 0x00000004
+#define NVC0_3D_TFB_VARYING_LOCS__LEN 0x00000080
+
+#define NVC0_3D_VERTEX_ARRAY_SELECT 0x00003820
+
+#define NVC0_3D_VERTEX_ARRAY_LIMIT_HIGH 0x00003824
+
+#define NVC0_3D_VERTEX_ARRAY_LIMIT_LOW 0x00003828
+
+#define NVC0_3D_VERTEX_ARRAY_START_HIGH 0x0000382c
+
+#define NVC0_3D_VERTEX_ARRAY_START_LOW 0x00003830
+
+#define NVC0_3D_BLEND_ENABLES 0x00003858
+
+#define NVC0_3D_POLYGON_MODE_FRONT 0x00003868
+#define NVC0_3D_POLYGON_MODE_FRONT_POINT 0x00001b00
+#define NVC0_3D_POLYGON_MODE_FRONT_LINE 0x00001b01
+#define NVC0_3D_POLYGON_MODE_FRONT_FILL 0x00001b02
+
+#define NVC0_3D_POLYGON_MODE_BACK 0x00003870
+#define NVC0_3D_POLYGON_MODE_BACK_POINT 0x00001b00
+#define NVC0_3D_POLYGON_MODE_BACK_LINE 0x00001b01
+#define NVC0_3D_POLYGON_MODE_BACK_FILL 0x00001b02
+
+#define NVC0_3D_GP_SELECT 0x00003878
+
+#define NVC0_3D_TEP_SELECT 0x00003880
+
+
+#endif /* NVC0_3D_XML */
diff --git a/src/nvc0_accel.c b/src/nvc0_accel.c
new file mode 100644
index 0000000..aef8305
--- /dev/null
+++ b/src/nvc0_accel.c
@@ -0,0 +1,728 @@
+/*
+ * Copyright 2008 Ben Skeggs
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nv_include.h"
+#include "nvc0_accel.h"
+
+#define NOUVEAU_BO(a, b, m) (NOUVEAU_BO_##a | NOUVEAU_BO_##b | NOUVEAU_BO_##m)
+
+Bool
+NVAccelInitM2MF_NVC0(ScrnInfoPtr pScrn)
+{
+ NVPtr pNv = NVPTR(pScrn);
+ struct nouveau_channel *chan = pNv->chan;
+ int ret;
+
+ ret = nouveau_grobj_alloc(chan, 0x9039, 0x9039, &pNv->NvMemFormat);
+ if (ret)
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+NVAccelInit2D_NVC0(ScrnInfoPtr pScrn)
+{
+ NVPtr pNv = NVPTR(pScrn);
+ struct nouveau_channel *chan = pNv->chan;
+ int ret;
+
+ ret = nouveau_grobj_alloc(chan, 0x902d, 0x902d, &pNv->Nv2D);
+ if (ret)
+ return FALSE;
+
+ BEGIN_RING(chan, pNv->Nv2D, NV50_2D_CLIP_ENABLE, 1);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, pNv->Nv2D, NV50_2D_COLOR_KEY_ENABLE, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, pNv->Nv2D, 0x0884, 1);
+ OUT_RING (chan, 0x3f);
+ BEGIN_RING(chan, pNv->Nv2D, 0x0888, 1);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, pNv->Nv2D, NV50_2D_ROP, 1);
+ OUT_RING (chan, 0x55);
+ BEGIN_RING(chan, pNv->Nv2D, NV50_2D_OPERATION, 1);
+ OUT_RING (chan, NV50_2D_OPERATION_SRCCOPY);
+
+ BEGIN_RING(chan, pNv->Nv2D, NV50_2D_BLIT_DU_DX_FRACT, 4);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, 1);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, pNv->Nv2D, NV50_2D_DRAW_SHAPE, 2);
+ OUT_RING (chan, 4);
+ OUT_RING (chan, NV50_SURFACE_FORMAT_R5G6B5_UNORM);
+ BEGIN_RING(chan, pNv->Nv2D, NV50_2D_PATTERN_FORMAT, 2);
+ OUT_RING (chan, 2);
+ OUT_RING (chan, 1);
+ FIRE_RING (chan);
+
+ pNv->currentRop = 0xfffffffa;
+ return TRUE;
+}
+
+Bool
+NVAccelInit3D_NVC0(ScrnInfoPtr pScrn)
+{
+ NVPtr pNv = NVPTR(pScrn);
+ struct nouveau_channel *chan = pNv->chan;
+ struct nouveau_grobj *fermi, *m2mf;
+ struct nouveau_bo *bo;
+ uint32_t tclClass;
+ int ret, i;
+
+ switch (pNv->dev->chipset) {
+ case 0xc0:
+ tclClass = 0x9097;
+ break;
+ default:
+ return FALSE;
+ }
+
+ if (!pNv->Nv3D) {
+ ret = nouveau_grobj_alloc(chan, tclClass, tclClass, &pNv->Nv3D);
+ if (ret)
+ return FALSE;
+
+ ret = nouveau_bo_new(pNv->dev, NOUVEAU_BO_VRAM,
+ (128 << 10), 0x20000,
+ &pNv->tesla_scratch);
+ if (ret) {
+ nouveau_grobj_free(&pNv->Nv3D);
+ return FALSE;
+ }
+ }
+ bo = pNv->tesla_scratch;
+ m2mf = pNv->NvMemFormat;
+ fermi = pNv->Nv3D;
+
+ if (MARK_RING(chan, 512, 32))
+ return FALSE;
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_NOTIFY_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, bo, NTFY_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+ OUT_RELOCl(chan, bo, NTFY_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+ OUT_RING (chan, 0);
+
+ BEGIN_RING(chan, fermi, NVC0_GRAPH_NOTIFY_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, bo, NTFY_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+ OUT_RELOCl(chan, bo, NTFY_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+ OUT_RING (chan, 0);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_MULTISAMPLE_COLOR_ENABLE, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_MULTISAMPLE_ZETA_ENABLE, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_MULTISAMPLE_MODE, 1);
+ OUT_RING (chan, NVC0_3D_MULTISAMPLE_MODE_1X);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_COND_MODE, 1);
+ OUT_RING (chan, NVC0_3D_COND_MODE_ALWAYS);
+ BEGIN_RING(chan, fermi, NVC0_3D_RT_CONTROL, 1);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, fermi, NVC0_3D_ZETA_ENABLE, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_VIEWPORT_CLIP_RECTS_EN, 2);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_CLIPID_ENABLE, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_VERTEX_TWO_SIDE_ENABLE, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, 0x0fac, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_COLOR_MASK(0), 8);
+ OUT_RING (chan, 0x1111);
+ for (i = 1; i < 8; ++i)
+ OUT_RING(chan, 0);
+ FIRE_RING (chan);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_SCREEN_SCISSOR_HORIZ, 2);
+ OUT_RING (chan, (8192 << 16) | 0);
+ OUT_RING (chan, (8192 << 16) | 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_Y_ORIGIN_BOTTOM, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_WINDOW_OFFSET_X, 2);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, 0x1590, 1);
+ OUT_RING (chan, 0);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_LINKED_TSC, 1);
+ OUT_RING (chan, 1);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_VIEWPORT_TRANSFORM_EN, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_VIEW_VOLUME_CLIP_CTRL, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_DEPTH_RANGE_NEAR(0), 2);
+ OUT_RINGf (chan, 0.0f);
+ OUT_RINGf (chan, 1.0f);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_TEX_LIMITS(4), 1);
+ OUT_RING (chan, 0x54);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_BLEND_ENABLE(0), 8);
+ OUT_RING (chan, 1);
+ for (i = 1; i < 8; ++i)
+ OUT_RING(chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_BLEND_INDEPENDENT, 1);
+ OUT_RING (chan, 0);
+
+ BEGIN_RING(chan, fermi, 0x17bc, 3);
+ OUT_RELOCh(chan, bo, MISC_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+ OUT_RELOCl(chan, bo, MISC_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+ OUT_RING (chan, 1);
+ FIRE_RING (chan);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_CODE_ADDRESS_HIGH, 2);
+ OUT_RELOCh(chan, bo, CODE_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+ OUT_RELOCl(chan, bo, CODE_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, bo, PVP_PASS, NOUVEAU_BO(VRAM, VRAM, WR)) ||
+ OUT_RELOCl(chan, bo, PVP_PASS, NOUVEAU_BO(VRAM, VRAM, WR))) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 7 * 8 + 20 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 7 * 2 + 20);
+ OUT_RING (chan, 0x00020461);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, 0xff000);
+ OUT_RING (chan, 0x00000000); /* VP_ATTR_EN[0x000] */
+ OUT_RING (chan, 0x0001033f); /* VP_ATTR_EN[0x080] */
+ OUT_RING (chan, 0x00000000); /* VP_ATTR_EN[0x100] */
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000); /* VP_ATTR_EN[0x200] */
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000); /* VP_ATTR_EN[0x300] */
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x0033f000); /* VP_EXPORT_EN[0x040] */
+ OUT_RING (chan, 0x00000000); /* VP_EXPORT_EN[0x0c0] */
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000); /* VP_EXPORT_EN[0x2c0] */
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0xfff01c66);
+ OUT_RING (chan, 0x06000080); /* vfetch { $r0,1,2,3 } b128 a[0x80] */
+ OUT_RING (chan, 0xfff11c26);
+ OUT_RING (chan, 0x06000090); /* vfetch { $r4,5 } b64 a[0x90] */
+ OUT_RING (chan, 0xfff19c26);
+ OUT_RING (chan, 0x060000a0); /* vfetch { $r6,7 } b64 a[0xa0] */
+ OUT_RING (chan, 0x03f01c66);
+ OUT_RING (chan, 0x0a7e0070); /* export v[0x70] { $r0 $r1 $r2 $r3 } */
+ OUT_RING (chan, 0x13f01c26);
+ OUT_RING (chan, 0x0a7e0080); /* export v[0x80] { $r4 $r5 } */
+ OUT_RING (chan, 0x1bf01c26);
+ OUT_RING (chan, 0x0a7e0090); /* export v[0x90] { $r6 $r7 } */
+ OUT_RING (chan, 0x00001de7);
+ OUT_RING (chan, 0x80000000); /* exit */
+
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_SELECT(1), 2);
+ OUT_RING (chan, 0x11);
+ OUT_RING (chan, PVP_PASS);
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_GPR_ALLOC(1), 1);
+ OUT_RING (chan, 8);
+ BEGIN_RING(chan, fermi, 0x163c, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, 0x2600, 1);
+ OUT_RING (chan, 1);
+ FIRE_RING (chan);
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, bo, PFP_S, NOUVEAU_BO(VRAM, VRAM, WR)) ||
+ OUT_RELOCl(chan, bo, PFP_S, NOUVEAU_BO(VRAM, VRAM, WR))) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 6 * 8 + 20 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 6 * 2 + 20);
+ OUT_RING (chan, 0x00021462);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x80000000);
+ OUT_RING (chan, 0x0000000a);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x0000000f);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0xfff01c00);
+ OUT_RING (chan, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
+ OUT_RING (chan, 0x10001c00);
+ OUT_RING (chan, 0xc8000000); /* rcp f32 $r0 $r0 */
+ OUT_RING (chan, 0x03f05c40);
+ OUT_RING (chan, 0xc07e0084); /* pinterp f32 $r1 $r0 v[$r63+0x84] */
+ OUT_RING (chan, 0x03f01c40);
+ OUT_RING (chan, 0xc07e0080); /* pinterp f32 $r0 $r0 v[$r63+0x80] */
+ OUT_RING (chan, 0xfc001e86);
+ OUT_RING (chan, 0x8013c000); /* tex { $r0,1,2,3 } $t0 { $r0,1 } */
+ OUT_RING (chan, 0x00001de7);
+ OUT_RING (chan, 0x80000000); /* exit */
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, bo, PFP_C, NOUVEAU_BO(VRAM, VRAM, WR)) ||
+ OUT_RELOCl(chan, bo, PFP_C, NOUVEAU_BO(VRAM, VRAM, WR))) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 13 * 8 + 20 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 13 * 2 + 20);
+ OUT_RING (chan, 0x00021462);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x80000000);
+ OUT_RING (chan, 0x00000a0a);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x0000000f);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0xfff01c00);
+ OUT_RING (chan, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
+ OUT_RING (chan, 0x10001c00);
+ OUT_RING (chan, 0xc8000000); /* rcp f32 $r0 $r0 */
+ OUT_RING (chan, 0x03f0dc40);
+ OUT_RING (chan, 0xc07e0094); /* pinterp f32 $r3 $r0 v[$r63+0x94] */
+ OUT_RING (chan, 0x03f09c40);
+ OUT_RING (chan, 0xc07e0090); /* pinterp f32 $r2 $r0 v[$r63+0x90] */
+ OUT_RING (chan, 0xfc211e86);
+ OUT_RING (chan, 0x80120001); /* tex { _,_,_,$r4 } $t1 { $r2,3 } */
+ OUT_RING (chan, 0x03f05c40);
+ OUT_RING (chan, 0xc07e0084); /* pinterp f32 $r1 $r0 v[$r63+0x84] */
+ OUT_RING (chan, 0x03f01c40);
+ OUT_RING (chan, 0xc07e0080); /* pinterp f32 $r0 $r0 v[$r63+0x80] */
+ OUT_RING (chan, 0xfc001e86);
+ OUT_RING (chan, 0x8013c000); /* tex { $r0,1,2,3 } $t0 { $r0,1 } */
+ OUT_RING (chan, 0x1030dc40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r3 $r3 $r4 */
+ OUT_RING (chan, 0x10209c40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r2 $r2 $r4 */
+ OUT_RING (chan, 0x10105c40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r1 $r1 $r4 */
+ OUT_RING (chan, 0x10001c40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r0 $r0 $r4 */
+ OUT_RING (chan, 0x00001de7);
+ OUT_RING (chan, 0x80000000); /* exit */
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, bo, PFP_CCA, NOUVEAU_BO(VRAM, VRAM, WR)) ||
+ OUT_RELOCl(chan, bo, PFP_CCA, NOUVEAU_BO(VRAM, VRAM, WR))) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 13 * 8 + 20 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 13 * 2 + 20);
+ OUT_RING (chan, 0x00021462); /* 0x0000c000 = USES_KIL, MULTI_COLORS */
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x80000000); /* FRAG_COORD_UMASK = 0x8 */
+ OUT_RING (chan, 0x00000a0a); /* FP_INTERP[0x080], 0022 0022 */
+ OUT_RING (chan, 0x00000000); /* FP_INTERP[0x0c0], 0 = OFF */
+ OUT_RING (chan, 0x00000000); /* FP_INTERP[0x100], 1 = FLAT */
+ OUT_RING (chan, 0x00000000); /* FP_INTERP[0x140], 2 = PERSPECTIVE */
+ OUT_RING (chan, 0x00000000); /* FP_INTERP[0x180], 3 = LINEAR */
+ OUT_RING (chan, 0x00000000); /* FP_INTERP[0x1c0] */
+ OUT_RING (chan, 0x00000000); /* FP_INTERP[0x200] */
+ OUT_RING (chan, 0x00000000); /* FP_INTERP[0x240] */
+ OUT_RING (chan, 0x00000000); /* FP_INTERP[0x280] */
+ OUT_RING (chan, 0x00000000); /* FP_INTERP[0x2c0] */
+ OUT_RING (chan, 0x00000000); /* FP_INTERP[0x300] */
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x0000000f); /* FP_RESULT_MASK (0x8000 Face ?) */
+ OUT_RING (chan, 0x00000000); /* 0x2 = FragDepth, 0x1 = SampleMask */
+ OUT_RING (chan, 0xfff01c00);
+ OUT_RING (chan, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
+ OUT_RING (chan, 0x10001c00);
+ OUT_RING (chan, 0xc8000000); /* rcp f32 $r0 $r0 */
+ OUT_RING (chan, 0x03f0dc40);
+ OUT_RING (chan, 0xc07e0094); /* pinterp f32 $r3 $r0 v[$r63+0x94] */
+ OUT_RING (chan, 0x03f09c40);
+ OUT_RING (chan, 0xc07e0090); /* pinterp f32 $r2 $r0 v[$r63+0x90] */
+ OUT_RING (chan, 0xfc211e86);
+ OUT_RING (chan, 0x8013c001); /* tex { $r4,5,6,7 } $t1 { $r2,3 } */
+ OUT_RING (chan, 0x03f05c40);
+ OUT_RING (chan, 0xc07e0084); /* pinterp f32 $r1 $r0 v[$r63+0x84] */
+ OUT_RING (chan, 0x03f01c40);
+ OUT_RING (chan, 0xc07e0080); /* pinterp f32 $r0 $r0 v[$r63+0x80] */
+ OUT_RING (chan, 0xfc001e86);
+ OUT_RING (chan, 0x8013c000); /* tex { $r0,1,2,3 } $t0 { $r0,1 } */
+ OUT_RING (chan, 0x1c30dc40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r3 $r3 $r7 */
+ OUT_RING (chan, 0x18209c40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r2 $r2 $r6 */
+ OUT_RING (chan, 0x14105c40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r1 $r1 $r5 */
+ OUT_RING (chan, 0x10001c40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r0 $r0 $r4 */
+ OUT_RING (chan, 0x00001de7);
+ OUT_RING (chan, 0x80000000); /* exit */
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, bo, PFP_CCASA, NOUVEAU_BO(VRAM, VRAM, WR)) ||
+ OUT_RELOCl(chan, bo, PFP_CCASA, NOUVEAU_BO(VRAM, VRAM, WR))) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 13 * 8 + 20 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 13 * 2 + 20);
+ OUT_RING (chan, 0x00021462);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x80000000);
+ OUT_RING (chan, 0x00000a0a);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x0000000f);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0xfff01c00);
+ OUT_RING (chan, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
+ OUT_RING (chan, 0x10001c00);
+ OUT_RING (chan, 0xc8000000); /* rcp f32 $r0 $r0 */
+ OUT_RING (chan, 0x03f0dc40);
+ OUT_RING (chan, 0xc07e0084); /* pinterp f32 $r3 $r0 v[$r63+0x84] */
+ OUT_RING (chan, 0x03f09c40);
+ OUT_RING (chan, 0xc07e0080); /* pinterp f32 $r2 $r0 v[$r63+0x80] */
+ OUT_RING (chan, 0xfc211e86);
+ OUT_RING (chan, 0x80120000); /* tex { _,_,_,$r4 } $t0 { $r2,3 } */
+ OUT_RING (chan, 0x03f05c40);
+ OUT_RING (chan, 0xc07e0094); /* pinterp f32 $r1 $r0 v[$r63+0x94] */
+ OUT_RING (chan, 0x03f01c40);
+ OUT_RING (chan, 0xc07e0090); /* pinterp f32 $r0 $r0 v[$r63+0x90] */
+ OUT_RING (chan, 0xfc001e86);
+ OUT_RING (chan, 0x8013c001); /* tex { $r0,1,2,3 } $t1 { $r0,1 } */
+ OUT_RING (chan, 0x1030dc40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r3 $r3 $r4 */
+ OUT_RING (chan, 0x10209c40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r2 $r2 $r4 */
+ OUT_RING (chan, 0x10105c40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r1 $r1 $r4 */
+ OUT_RING (chan, 0x10001c40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r0 $r0 $r4 */
+ OUT_RING (chan, 0x00001de7);
+ OUT_RING (chan, 0x80000000); /* exit */
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, bo, PFP_S_A8, NOUVEAU_BO(VRAM, VRAM, WR)) ||
+ OUT_RELOCl(chan, bo, PFP_S_A8, NOUVEAU_BO(VRAM, VRAM, WR))) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 9 * 8 + 20 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 9 * 2 + 20);
+ OUT_RING (chan, 0x00021462);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x80000000);
+ OUT_RING (chan, 0x0000000a);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x0000000f);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0xfff01c00);
+ OUT_RING (chan, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
+ OUT_RING (chan, 0x10001c00);
+ OUT_RING (chan, 0xc8000000); /* rcp f32 $r0 $r0 */
+ OUT_RING (chan, 0x03f05c40);
+ OUT_RING (chan, 0xc07e0084); /* pinterp f32 $r1 $r0 v[$r63+0x84] */
+ OUT_RING (chan, 0x03f01c40);
+ OUT_RING (chan, 0xc07e0080); /* pinterp f32 $r0 $r0 v[$r63+0x80] */
+ OUT_RING (chan, 0xfc001e86);
+ OUT_RING (chan, 0x80120000); /* tex { _ _ _ $r0 } $t0 { $r0 $r1 } */
+ OUT_RING (chan, 0x0000dde4);
+ OUT_RING (chan, 0x28000000); /* mov b32 $r3 $r0 */
+ OUT_RING (chan, 0x00009de4);
+ OUT_RING (chan, 0x28000000); /* mov b32 $r2 $r0 */
+ OUT_RING (chan, 0x00005de4);
+ OUT_RING (chan, 0x28000000); /* mov b32 $r1 $r0 */
+ OUT_RING (chan, 0x00001de7);
+ OUT_RING (chan, 0x80000000); /* exit */
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, bo, PFP_C_A8, NOUVEAU_BO(VRAM, VRAM, WR)) ||
+ OUT_RELOCl(chan, bo, PFP_C_A8, NOUVEAU_BO(VRAM, VRAM, WR))) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 13 * 8 + 20 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 13 * 2 + 20);
+ OUT_RING (chan, 0x00021462);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x80000000);
+ OUT_RING (chan, 0x00000a0a);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x0000000f);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0xfff01c00);
+ OUT_RING (chan, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
+ OUT_RING (chan, 0x10001c00);
+ OUT_RING (chan, 0xc8000000); /* rcp f32 $r0 $r0 */
+ OUT_RING (chan, 0x03f0dc40);
+ OUT_RING (chan, 0xc07e0094); /* pinterp f32 $r3 $r0 v[$r63+0x94] */
+ OUT_RING (chan, 0x03f09c40);
+ OUT_RING (chan, 0xc07e0090); /* pinterp f32 $r2 $r0 v[$r63+0x90] */
+ OUT_RING (chan, 0xfc205e86);
+ OUT_RING (chan, 0x80120001); /* tex { _ _ _ $r1 } $t1 { $r2 $r3 } */
+ OUT_RING (chan, 0x03f0dc40);
+ OUT_RING (chan, 0xc07e0084); /* pinterp f32 $r3 $r0 v[$r63+0x84] */
+ OUT_RING (chan, 0x03f09c40);
+ OUT_RING (chan, 0xc07e0080); /* pinterp f32 $r2 $r0 v[$r63+0x80] */
+ OUT_RING (chan, 0xfc201e86);
+ OUT_RING (chan, 0x80120000); /* tex { _ _ _ $r0 } $t0 { $r2 $r3 } */
+ OUT_RING (chan, 0x0400dc40);
+ OUT_RING (chan, 0x58000000); /* mul ftz rn f32 $r3 $r0 $r1 */
+ OUT_RING (chan, 0x0c009de4);
+ OUT_RING (chan, 0x28000000); /* mov b32 $r2 $r3 */
+ OUT_RING (chan, 0x0c005de4);
+ OUT_RING (chan, 0x28000000); /* mov b32 $r1 $r3 */
+ OUT_RING (chan, 0x0c001de4);
+ OUT_RING (chan, 0x28000000); /* mov b32 $r0 $r3 */
+ OUT_RING (chan, 0x00001de7);
+ OUT_RING (chan, 0x80000000); /* exit */
+ FIRE_RING (chan);
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, bo, PFP_NV12, NOUVEAU_BO(VRAM, VRAM, WR)) ||
+ OUT_RELOCl(chan, bo, PFP_NV12, NOUVEAU_BO(VRAM, VRAM, WR))) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 19 * 8 + 20 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 19 * 2 + 20);
+ OUT_RING (chan, 0x00021462);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x80000000);
+ OUT_RING (chan, 0x00000a0a);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x0000000f);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0xfff09c00);
+ OUT_RING (chan, 0xc07e007c);
+ OUT_RING (chan, 0x10209c00);
+ OUT_RING (chan, 0xc8000000);
+ OUT_RING (chan, 0x0bf01c40);
+ OUT_RING (chan, 0xc07e0080);
+ OUT_RING (chan, 0x0bf05c40);
+ OUT_RING (chan, 0xc07e0084);
+ OUT_RING (chan, 0xfc001e86);
+ OUT_RING (chan, 0x80120000);
+ OUT_RING (chan, 0x00015c40);
+ OUT_RING (chan, 0x58004000);
+ OUT_RING (chan, 0x1050dc20);
+ OUT_RING (chan, 0x50004000);
+ OUT_RING (chan, 0x20511c20);
+ OUT_RING (chan, 0x50004000);
+ OUT_RING (chan, 0x30515c20);
+ OUT_RING (chan, 0x50004000);
+ OUT_RING (chan, 0x0bf01c40);
+ OUT_RING (chan, 0xc07e0090);
+ OUT_RING (chan, 0x0bf05c40);
+ OUT_RING (chan, 0xc07e0094);
+ OUT_RING (chan, 0xfc001e86);
+ OUT_RING (chan, 0x80130001);
+ OUT_RING (chan, 0x4000dc40);
+ OUT_RING (chan, 0x30064000);
+ OUT_RING (chan, 0x50011c40);
+ OUT_RING (chan, 0x30084000);
+ OUT_RING (chan, 0x60015c40);
+ OUT_RING (chan, 0x300a4000);
+ OUT_RING (chan, 0x70101c40);
+ OUT_RING (chan, 0x30064000);
+ OUT_RING (chan, 0x90109c40);
+ OUT_RING (chan, 0x300a4000);
+ OUT_RING (chan, 0x80105c40);
+ OUT_RING (chan, 0x30084000);
+ OUT_RING (chan, 0x00001de7);
+ OUT_RING (chan, 0x80000000);
+
+ BEGIN_RING(chan, fermi, 0x021c, 1); /* CODE_FLUSH ? */
+ OUT_RING (chan, 0x1111);
+ FIRE_RING (chan);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_SELECT(5), 2);
+ OUT_RING (chan, 0x51);
+ OUT_RING (chan, PFP_S);
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_GPR_ALLOC(5), 1);
+ OUT_RING (chan, 8);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_CB_SIZE, 3);
+ OUT_RING (chan, 256);
+ if (OUT_RELOCh(chan, bo, CB_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR) ||
+ OUT_RELOCl(chan, bo, CB_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, fermi, NVC0_3D_CB_BIND(4), 1);
+ OUT_RING (chan, 0x01);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_EARLY_FRAGMENT_TESTS, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, 0x0360, 2);
+ OUT_RING (chan, 0x20164010);
+ OUT_RING (chan, 0x20);
+ BEGIN_RING(chan, fermi, 0x196c, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, 0x1664, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_FRAG_COLOR_CLAMP_EN, 1);
+ OUT_RING (chan, 0x11111111);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_DEPTH_TEST_ENABLE, 1);
+ OUT_RING (chan, 0);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_RASTERIZE_ENABLE, 1);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_SELECT(4), 1);
+ OUT_RING (chan, 0x40);
+ BEGIN_RING(chan, fermi, NVC0_3D_GP_BUILTIN_RESULT_EN, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_SELECT(3), 1);
+ OUT_RING (chan, 0x30);
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_SELECT(2), 1);
+ OUT_RING (chan, 0x20);
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_SELECT(0), 1);
+ OUT_RING (chan, 0x00);
+
+ BEGIN_RING(chan, fermi, 0x1604, 1);
+ OUT_RING (chan, 4);
+ BEGIN_RING(chan, fermi, NVC0_3D_POINT_SPRITE_ENABLE, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_SCISSOR_ENABLE(0), 1);
+ OUT_RING (chan, 1);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_VIEWPORT_HORIZ(0), 2);
+ OUT_RING (chan, (8192 << 16) | 0);
+ OUT_RING (chan, (8192 << 16) | 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_SCISSOR_HORIZ(0), 2);
+ OUT_RING (chan, (8192 << 16) | 0);
+ OUT_RING (chan, (8192 << 16) | 0);
+ FIRE_RING (chan);
+
+ return TRUE;
+}
+
diff --git a/src/nvc0_accel.h b/src/nvc0_accel.h
new file mode 100644
index 0000000..5cb3e87
--- /dev/null
+++ b/src/nvc0_accel.h
@@ -0,0 +1,83 @@
+#ifndef __NVC0_ACCEL_H__
+#define __NVC0_ACCEL_H__
+
+#include "nvc0_pushbuf.h"
+
+/* scratch buffer offsets */
+#define CODE_OFFSET 0x00000 /* Code */
+#define TIC_OFFSET 0x02000 /* Texture Image Control */
+#define TSC_OFFSET 0x03000 /* Texture Sampler Control */
+#define NTFY_OFFSET 0x08000
+#define MISC_OFFSET 0x10000
+
+/* fragment programs */
+#define PFP_S 0x0000 /* (src) */
+#define PFP_C 0x0100 /* (src IN mask) */
+#define PFP_CCA 0x0200 /* (src IN mask) component-alpha */
+#define PFP_CCASA 0x0300 /* (src IN mask) component-alpha src-alpha */
+#define PFP_S_A8 0x0400 /* (src) a8 rt */
+#define PFP_C_A8 0x0500 /* (src IN mask) a8 rt - same for CA and CA_SA */
+#define PFP_NV12 0x0600 /* NV12 YUV->RGB */
+
+/* vertex programs */
+#define PVP_PASS 0x0700 /* vertex pass-through shader */
+
+/* shader constants */
+#define CB_OFFSET 0x1000
+
+#define VTX_ATTR(a, c, t, s) \
+ ((NVC0_3D_VTX_ATTR_DEFINE_TYPE_##t) | \
+ ((a) << NVC0_3D_VTX_ATTR_DEFINE_ATTR__SHIFT) | \
+ ((c) << NVC0_3D_VTX_ATTR_DEFINE_COMP__SHIFT) | \
+ ((s) << NVC0_3D_VTX_ATTR_DEFINE_SIZE__SHIFT))
+
+static __inline__ void
+VTX1s(NVPtr pNv, float sx, float sy, unsigned dx, unsigned dy)
+{
+ struct nouveau_channel *chan = pNv->chan;
+ struct nouveau_grobj *fermi = pNv->Nv3D;
+
+ BEGIN_RING(chan, fermi, NVC0_3D_VTX_ATTR_DEFINE, 3);
+ OUT_RING (chan, VTX_ATTR(1, 2, FLOAT, 4));
+ OUT_RINGf (chan, sx);
+ OUT_RINGf (chan, sy);
+#if 1
+ BEGIN_RING(chan, fermi, NVC0_3D_VTX_ATTR_DEFINE, 2);
+ OUT_RING (chan, VTX_ATTR(0, 2, USCALED, 2));
+ OUT_RING (chan, (dy << 16) | dx);
+#else
+ BEGIN_RING(chan, fermi, NVC0_3D_VTX_ATTR_DEFINE, 3);
+ OUT_RING (chan, VTX_ATTR(0, 2, FLOAT, 4));
+ OUT_RINGf (chan, (float)dx);
+ OUT_RINGf (chan, (float)dy);
+#endif
+}
+
+static __inline__ void
+VTX2s(NVPtr pNv, float s1x, float s1y, float s2x, float s2y,
+ unsigned dx, unsigned dy)
+{
+ struct nouveau_channel *chan = pNv->chan;
+ struct nouveau_grobj *fermi = pNv->Nv3D;
+
+ BEGIN_RING(chan, fermi, NVC0_3D_VTX_ATTR_DEFINE, 3);
+ OUT_RING (chan, VTX_ATTR(1, 2, FLOAT, 4));
+ OUT_RINGf (chan, s1x);
+ OUT_RINGf (chan, s1y);
+ BEGIN_RING(chan, fermi, NVC0_3D_VTX_ATTR_DEFINE, 3);
+ OUT_RING (chan, VTX_ATTR(2, 2, FLOAT, 4));
+ OUT_RINGf (chan, s2x);
+ OUT_RINGf (chan, s2y);
+#if 1
+ BEGIN_RING(chan, fermi, NVC0_3D_VTX_ATTR_DEFINE, 2);
+ OUT_RING (chan, VTX_ATTR(0, 2, USCALED, 2));
+ OUT_RING (chan, (dy << 16) | dx);
+#else
+ BEGIN_RING(chan, fermi, NVC0_3D_VTX_ATTR_DEFINE, 3);
+ OUT_RING (chan, VTX_ATTR(0, 2, FLOAT, 4));
+ OUT_RINGf (chan, (float)dx);
+ OUT_RINGf (chan, (float)dy);
+#endif
+}
+
+#endif
diff --git a/src/nvc0_exa.c b/src/nvc0_exa.c
new file mode 100644
index 0000000..45647ce
--- /dev/null
+++ b/src/nvc0_exa.c
@@ -0,0 +1,1200 @@
+/*
+ * Copyright 2007 NVIDIA, Corporation
+ * Copyright 2008 Ben Skeggs
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nv_include.h"
+#include "nv_rop.h"
+#include "nvc0_accel.h"
+#include "nv50_texture.h"
+
+#define NOUVEAU_BO(a, b, c) (NOUVEAU_BO_##a | NOUVEAU_BO_##b | NOUVEAU_BO_##c)
+
+Bool
+NVC0AccelDownloadM2MF(PixmapPtr pspix, int x, int y, int w, int h,
+ char *dst, unsigned dst_pitch)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pspix->drawable.pScreen->myNum];
+ NVPtr pNv = NVPTR(pScrn);
+ struct nouveau_channel *chan = pNv->chan;
+ struct nouveau_bo *bo = nouveau_pixmap_bo(pspix);
+ struct nouveau_grobj *m2mf = pNv->NvMemFormat;
+ const int cpp = pspix->drawable.bitsPerPixel / 8;
+ const int line_len = w * cpp;
+ const int line_limit = (128 << 10) / line_len;
+ unsigned src_offset = 0, src_pitch = 0, tiled = 1;
+
+ if (!nv50_style_tiled_pixmap(pspix)) {
+ tiled = 0;
+ src_pitch = exaGetPixmapPitch(pspix);
+ src_offset = (y * src_pitch) + (x * cpp);
+ } else {
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_TILING_MODE_IN, 5);
+ OUT_RING (chan, bo->tile_mode);
+ OUT_RING (chan, pspix->drawable.width * cpp);
+ OUT_RING (chan, pspix->drawable.height);
+ OUT_RING (chan, 1);
+ OUT_RING (chan, 0);
+ }
+
+ while (h) {
+ const char *src;
+ int line_count, i;
+
+ /* GART size >= 128 KiB assumed */
+ line_count = h;
+ if (line_count > line_limit)
+ line_count = line_limit;
+
+ MARK_RING(chan, 16, 4);
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ OUT_RELOCh(chan, pNv->GART, 0, NOUVEAU_BO(GART, GART, WR));
+ OUT_RELOCl(chan, pNv->GART, 0, NOUVEAU_BO(GART, GART, WR));
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_IN_HIGH, 6);
+ OUT_RELOCh(chan, bo, src_offset, NOUVEAU_BO(VRAM, GART, RD));
+ OUT_RELOCl(chan, bo, src_offset, NOUVEAU_BO(VRAM, GART, RD));
+ OUT_RING (chan, src_pitch);
+ OUT_RING (chan, line_len);
+ OUT_RING (chan, line_len);
+ OUT_RING (chan, line_count);
+
+ if (tiled) {
+ BEGIN_RING(chan, m2mf,
+ NVC0_M2MF_TILING_POSITION_IN_X, 2);
+ OUT_RING (chan, x * cpp);
+ OUT_RING (chan, y);
+ }
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100000 | (tiled << 8));
+
+ if (nouveau_bo_map(pNv->GART, NOUVEAU_BO_RD)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ src = pNv->GART->map;
+
+ if (dst_pitch == line_len) {
+ memcpy(dst, src, dst_pitch * line_count);
+ dst += dst_pitch * line_count;
+ } else {
+ for (i = 0; i < line_count; ++i) {
+ memcpy(dst, src, line_len);
+ src += line_len;
+ dst += dst_pitch;
+ }
+ }
+ nouveau_bo_unmap(pNv->GART);
+
+ if (!tiled)
+ src_offset += line_count * src_pitch;
+ h -= line_count;
+ y += line_count;
+ }
+
+ return TRUE;
+}
+
+Bool
+NVC0AccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h,
+ const char *src, int src_pitch)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pdpix->drawable.pScreen->myNum];
+ NVPtr pNv = NVPTR(pScrn);
+ struct nouveau_channel *chan = pNv->chan;
+ struct nouveau_bo *bo = nouveau_pixmap_bo(pdpix);
+ struct nouveau_grobj *m2mf = pNv->NvMemFormat;
+ int cpp = pdpix->drawable.bitsPerPixel / 8;
+ int line_len = w * cpp;
+ int line_limit = (128 << 10) / line_len;
+ unsigned dst_offset = 0, dst_pitch = 0, tiled = 1;
+
+ if (!nv50_style_tiled_pixmap(pdpix)) {
+ tiled = 0;
+ dst_pitch = exaGetPixmapPitch(pdpix);
+ dst_offset = (y * dst_pitch) + (x * cpp);
+ } else {
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_TILING_MODE_OUT, 5);
+ OUT_RING (chan, bo->tile_mode);
+ OUT_RING (chan, pdpix->drawable.width * cpp);
+ OUT_RING (chan, pdpix->drawable.height);
+ OUT_RING (chan, 1);
+ OUT_RING (chan, 0);
+ }
+
+ while (h) {
+ char *dst;
+ int i, line_count;
+
+ line_count = h;
+ if (line_count > line_limit)
+ line_count = line_limit;
+
+ if (nouveau_bo_map(pNv->GART, NOUVEAU_BO_WR))
+ return FALSE;
+ dst = pNv->GART->map;
+
+ if (src_pitch == line_len) {
+ memcpy(dst, src, src_pitch * line_count);
+ src += src_pitch * line_count;
+ } else {
+ for (i = 0; i < line_count; i++) {
+ memcpy(dst, src, line_len);
+ src += src_pitch;
+ dst += line_len;
+ }
+ }
+ nouveau_bo_unmap(pNv->GART);
+
+ if (MARK_RING(chan, 16, 4))
+ return FALSE;
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_IN_HIGH, 2);
+ OUT_RELOCh(chan, pNv->GART, 0, NOUVEAU_BO(GART, GART, RD));
+ OUT_RELOCl(chan, pNv->GART, 0, NOUVEAU_BO(GART, GART, RD));
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ OUT_RELOCh(chan, bo, dst_offset, NOUVEAU_BO(VRAM, GART, WR));
+ OUT_RELOCl(chan, bo, dst_offset, NOUVEAU_BO(VRAM, GART, WR));
+
+ if (tiled) {
+ BEGIN_RING(chan, m2mf,
+ NVC0_M2MF_TILING_POSITION_OUT_X, 2);
+ OUT_RING (chan, x * cpp);
+ OUT_RING (chan, y);
+ }
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_PITCH_IN, 4);
+ OUT_RING (chan, line_len);
+ OUT_RING (chan, dst_pitch);
+ OUT_RING (chan, line_len);
+ OUT_RING (chan, line_count);
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100000 | (tiled << 4));
+ FIRE_RING (chan);
+
+ if (!tiled)
+ dst_offset += line_count * dst_pitch;
+ h -= line_count;
+ y += line_count;
+ }
+
+ return TRUE;
+}
+
+
+struct nvc0_exa_state {
+ struct {
+ PictTransformPtr transform;
+ float width;
+ float height;
+ } unit[2];
+
+ Bool have_mask;
+};
+
+static struct nvc0_exa_state exa_state;
+
+#define NVC0EXA_LOCALS(p) \
+ ScrnInfoPtr pScrn = xf86Screens[(p)->drawable.pScreen->myNum]; \
+ NVPtr pNv = NVPTR(pScrn); \
+ struct nouveau_channel *chan = pNv->chan; (void)chan; \
+ struct nouveau_grobj *m2mf = pNv->NvMemFormat; (void)m2mf; \
+ struct nouveau_grobj *eng2d = pNv->Nv2D; (void)eng2d; \
+ struct nouveau_grobj *fermi = pNv->Nv3D; (void)fermi; \
+ struct nvc0_exa_state *state = &exa_state; (void)state
+
+#define BF(f) NV50_BLEND_FACTOR_##f
+
+struct nvc0_blend_op {
+ unsigned src_alpha;
+ unsigned dst_alpha;
+ unsigned src_blend;
+ unsigned dst_blend;
+};
+
+static struct nvc0_blend_op
+NVC0EXABlendOp[] = {
+/* Clear */ { 0, 0, BF( ZERO), BF( ZERO) },
+/* Src */ { 0, 0, BF( ONE), BF( ZERO) },
+/* Dst */ { 0, 0, BF( ZERO), BF( ONE) },
+/* Over */ { 1, 0, BF( ONE), BF(ONE_MINUS_SRC_ALPHA) },
+/* OverReverse */ { 0, 1, BF(ONE_MINUS_DST_ALPHA), BF( ONE) },
+/* In */ { 0, 1, BF( DST_ALPHA), BF( ZERO) },
+/* InReverse */ { 1, 0, BF( ZERO), BF( SRC_ALPHA) },
+/* Out */ { 0, 1, BF(ONE_MINUS_DST_ALPHA), BF( ZERO) },
+/* OutReverse */ { 1, 0, BF( ZERO), BF(ONE_MINUS_SRC_ALPHA) },
+/* Atop */ { 1, 1, BF( DST_ALPHA), BF(ONE_MINUS_SRC_ALPHA) },
+/* AtopReverse */ { 1, 1, BF(ONE_MINUS_DST_ALPHA), BF( SRC_ALPHA) },
+/* Xor */ { 1, 1, BF(ONE_MINUS_DST_ALPHA), BF(ONE_MINUS_SRC_ALPHA) },
+/* Add */ { 0, 0, BF( ONE), BF( ONE) },
+};
+
+static Bool
+NVC0EXA2DSurfaceFormat(PixmapPtr ppix, uint32_t *fmt)
+{
+ NVC0EXA_LOCALS(ppix);
+
+ switch (ppix->drawable.bitsPerPixel) {
+ case 8 : *fmt = NV50_2D_SRC_FORMAT_R8_UNORM; break;
+ case 15: *fmt = NV50_2D_SRC_FORMAT_X1R5G5B5_UNORM; break;
+ case 16: *fmt = NV50_2D_SRC_FORMAT_R5G6B5_UNORM; break;
+ case 24: *fmt = NV50_2D_SRC_FORMAT_X8R8G8B8_UNORM; break;
+ case 30: *fmt = NV50_2D_SRC_FORMAT_A2B10G10R10_UNORM; break;
+ case 32: *fmt = NV50_2D_SRC_FORMAT_A8R8G8B8_UNORM; break;
+ default:
+ NOUVEAU_FALLBACK("Unknown surface format for bpp=%d\n",
+ ppix->drawable.bitsPerPixel);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void NVC0EXASetClip(PixmapPtr ppix, int x, int y, int w, int h)
+{
+ NVC0EXA_LOCALS(ppix);
+
+ BEGIN_RING(chan, eng2d, NV50_2D_CLIP_X, 4);
+ OUT_RING (chan, x);
+ OUT_RING (chan, y);
+ OUT_RING (chan, w);
+ OUT_RING (chan, h);
+}
+
+static Bool
+NVC0EXAAcquireSurface2D(PixmapPtr ppix, int is_src)
+{
+ NVC0EXA_LOCALS(ppix);
+ struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
+ int mthd = is_src ? NV50_2D_SRC_FORMAT : NV50_2D_DST_FORMAT;
+ uint32_t fmt, bo_flags;
+
+ if (!NVC0EXA2DSurfaceFormat(ppix, &fmt))
+ return FALSE;
+
+ bo_flags = NOUVEAU_BO_VRAM;
+ bo_flags |= is_src ? NOUVEAU_BO_RD : NOUVEAU_BO_WR;
+
+ if (!nv50_style_tiled_pixmap(ppix)) {
+ BEGIN_RING(chan, eng2d, mthd, 2);
+ OUT_RING (chan, fmt);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, eng2d, mthd + 0x14, 1);
+ OUT_RING (chan, (uint32_t)exaGetPixmapPitch(ppix));
+ } else {
+ BEGIN_RING(chan, eng2d, mthd, 5);
+ OUT_RING (chan, fmt);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, bo->tile_mode);
+ OUT_RING (chan, 1);
+ OUT_RING (chan, 0);
+ }
+
+ BEGIN_RING(chan, eng2d, mthd + 0x18, 4);
+ OUT_RING (chan, ppix->drawable.width);
+ OUT_RING (chan, ppix->drawable.height);
+ if (OUT_RELOCh(chan, bo, 0, bo_flags) ||
+ OUT_RELOCl(chan, bo, 0, bo_flags))
+ return FALSE;
+
+ if (is_src == 0)
+ NVC0EXASetClip(ppix, 0, 0, ppix->drawable.width, ppix->drawable.height);
+
+ return TRUE;
+}
+
+static void
+NVC0EXASetPattern(PixmapPtr pdpix, int col0, int col1, int pat0, int pat1)
+{
+ NVC0EXA_LOCALS(pdpix);
+
+ BEGIN_RING(chan, eng2d, NV50_2D_PATTERN_COLOR(0), 4);
+ OUT_RING (chan, col0);
+ OUT_RING (chan, col1);
+ OUT_RING (chan, pat0);
+ OUT_RING (chan, pat1);
+}
+
+static void
+NVC0EXASetROP(PixmapPtr pdpix, int alu, Pixel planemask)
+{
+ NVC0EXA_LOCALS(pdpix);
+ int rop;
+
+ if (planemask != ~0)
+ rop = NVROP[alu].copy_planemask;
+ else
+ rop = NVROP[alu].copy;
+
+ BEGIN_RING(chan, eng2d, NV50_2D_OPERATION, 1);
+ if (alu == GXcopy && EXA_PM_IS_SOLID(&pdpix->drawable, planemask)) {
+ OUT_RING (chan, NV50_2D_OPERATION_SRCCOPY);
+ return;
+ } else {
+ OUT_RING (chan, NV50_2D_OPERATION_SRCCOPY_PREMULT);
+ }
+
+ BEGIN_RING(chan, eng2d, NV50_2D_PATTERN_FORMAT, 2);
+ switch (pdpix->drawable.bitsPerPixel) {
+ case 8: OUT_RING (chan, 3); break;
+ case 15: OUT_RING (chan, 1); break;
+ case 16: OUT_RING (chan, 0); break;
+ case 24:
+ case 32:
+ default:
+ OUT_RING (chan, 2);
+ break;
+ }
+ OUT_RING (chan, 1);
+
+ /* There are 16 ALUs.
+ * 0-15: copy
+ * 16-31: copy_planemask
+ */
+
+ if (!EXA_PM_IS_SOLID(&pdpix->drawable, planemask)) {
+ alu += 16;
+ NVC0EXASetPattern(pdpix, 0, planemask, ~0, ~0);
+ } else {
+ if (pNv->currentRop > 15)
+ NVC0EXASetPattern(pdpix, ~0, ~0, ~0, ~0);
+ }
+
+ if (pNv->currentRop != alu) {
+ BEGIN_RING(chan, eng2d, NV50_2D_ROP, 1);
+ OUT_RING (chan, rop);
+ pNv->currentRop = alu;
+ }
+}
+
+static void
+NVC0EXAStateSolidResubmit(struct nouveau_channel *chan)
+{
+ ScrnInfoPtr pScrn = chan->user_private;
+ NVPtr pNv = NVPTR(pScrn);
+
+ NVC0EXAPrepareSolid(pNv->pdpix, pNv->alu, pNv->planemask,
+ pNv->fg_colour);
+}
+
+Bool
+NVC0EXAPrepareSolid(PixmapPtr pdpix, int alu, Pixel planemask, Pixel fg)
+{
+ NVC0EXA_LOCALS(pdpix);
+ uint32_t fmt;
+
+ if (!NVC0EXA2DSurfaceFormat(pdpix, &fmt))
+ NOUVEAU_FALLBACK("rect format\n");
+
+ if (MARK_RING(chan, 64, 4))
+ NOUVEAU_FALLBACK("ring space\n");
+
+ if (!NVC0EXAAcquireSurface2D(pdpix, 0)) {
+ MARK_UNDO(chan);
+ NOUVEAU_FALLBACK("dest pixmap\n");
+ }
+
+ NVC0EXASetROP(pdpix, alu, planemask);
+
+ BEGIN_RING(chan, eng2d, NV50_2D_DRAW_SHAPE, 3);
+ OUT_RING (chan, NV50_2D_DRAW_SHAPE_RECTANGLES);
+ OUT_RING (chan, fmt);
+ OUT_RING (chan, fg);
+
+ pNv->pdpix = pdpix;
+ pNv->alu = alu;
+ pNv->planemask = planemask;
+ pNv->fg_colour = fg;
+ chan->flush_notify = NVC0EXAStateSolidResubmit;
+ return TRUE;
+}
+
+void
+NVC0EXASolid(PixmapPtr pdpix, int x1, int y1, int x2, int y2)
+{
+ NVC0EXA_LOCALS(pdpix);
+
+ WAIT_RING (chan, 5);
+ BEGIN_RING(chan, eng2d, NV50_2D_DRAW_POINT32_X(0), 4);
+ OUT_RING (chan, x1);
+ OUT_RING (chan, y1);
+ OUT_RING (chan, x2);
+ OUT_RING (chan, y2);
+
+ if ((x2 - x1) * (y2 - y1) >= 512)
+ FIRE_RING (chan);
+}
+
+void
+NVC0EXADoneSolid(PixmapPtr pdpix)
+{
+ NVC0EXA_LOCALS(pdpix);
+
+ chan->flush_notify = NULL;
+}
+
+static void
+NVC0EXAStateCopyResubmit(struct nouveau_channel *chan)
+{
+ ScrnInfoPtr pScrn = chan->user_private;
+ NVPtr pNv = NVPTR(pScrn);
+
+ NVC0EXAPrepareCopy(pNv->pspix, pNv->pdpix, 0, 0, pNv->alu,
+ pNv->planemask);
+}
+
+Bool
+NVC0EXAPrepareCopy(PixmapPtr pspix, PixmapPtr pdpix, int dx, int dy,
+ int alu, Pixel planemask)
+{
+ NVC0EXA_LOCALS(pdpix);
+
+ if (MARK_RING(chan, 64, 4))
+ NOUVEAU_FALLBACK("ring space\n");
+
+ if (!NVC0EXAAcquireSurface2D(pspix, 1)) {
+ MARK_UNDO(chan);
+ NOUVEAU_FALLBACK("src pixmap\n");
+ }
+
+ if (!NVC0EXAAcquireSurface2D(pdpix, 0)) {
+ MARK_UNDO(chan);
+ NOUVEAU_FALLBACK("dest pixmap\n");
+ }
+
+ NVC0EXASetROP(pdpix, alu, planemask);
+
+ pNv->pspix = pspix;
+ pNv->pdpix = pdpix;
+ pNv->alu = alu;
+ pNv->planemask = planemask;
+ chan->flush_notify = NVC0EXAStateCopyResubmit;
+ return TRUE;
+}
+
+void
+NVC0EXACopy(PixmapPtr pdpix, int srcX , int srcY,
+ int dstX , int dstY,
+ int width, int height)
+{
+ NVC0EXA_LOCALS(pdpix);
+
+ WAIT_RING (chan, 17);
+ BEGIN_RING(chan, eng2d, NV50_2D_SERIALIZE, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, eng2d, 0x088c, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, eng2d, NV50_2D_BLIT_DST_X, 12);
+ OUT_RING (chan, dstX);
+ OUT_RING (chan, dstY);
+ OUT_RING (chan, width);
+ OUT_RING (chan, height);
+ OUT_RING (chan, 0); /* DU,V_DX,Y_FRACT,INT */
+ OUT_RING (chan, 1);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, 1);
+ OUT_RING (chan, 0); /* BLIT_SRC_X,Y_FRACT,INT */
+ OUT_RING (chan, srcX);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, srcY);
+
+ if (width * height >= 512)
+ FIRE_RING (chan);
+}
+
+void
+NVC0EXADoneCopy(PixmapPtr pdpix)
+{
+ NVC0EXA_LOCALS(pdpix);
+
+ chan->flush_notify = NULL;
+}
+
+static void
+NVC0EXAStateSIFCResubmit(struct nouveau_channel *chan)
+{
+ ScrnInfoPtr pScrn = chan->user_private;
+ NVPtr pNv = NVPTR(pScrn);
+
+ if (MARK_RING(pNv->chan, 32, 2))
+ return;
+
+ if (NVC0EXAAcquireSurface2D(pNv->pdpix, 0))
+ MARK_UNDO(pNv->chan);
+}
+
+Bool
+NVC0EXAUploadSIFC(const char *src, int src_pitch,
+ PixmapPtr pdpix, int x, int y, int w, int h, int cpp)
+{
+ NVC0EXA_LOCALS(pdpix);
+ int line_dwords = (w * cpp + 3) / 4;
+ uint32_t sifc_fmt;
+
+ if (!NVC0EXA2DSurfaceFormat(pdpix, &sifc_fmt))
+ NOUVEAU_FALLBACK("hostdata format\n");
+
+ if (MARK_RING(chan, 64, 2))
+ return FALSE;
+
+ if (!NVC0EXAAcquireSurface2D(pdpix, 0)) {
+ MARK_UNDO(chan);
+ NOUVEAU_FALLBACK("dest pixmap\n");
+ }
+
+ /* If the pitch isn't aligned to a dword you can
+ * get corruption at the end of a line.
+ */
+ NVC0EXASetClip(pdpix, x, y, w, h);
+
+ BEGIN_RING(chan, eng2d, NV50_2D_OPERATION, 1);
+ OUT_RING (chan, NV50_2D_OPERATION_SRCCOPY);
+ BEGIN_RING(chan, eng2d, NV50_2D_SIFC_BITMAP_ENABLE, 2);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, sifc_fmt);
+ BEGIN_RING(chan, eng2d, NV50_2D_SIFC_WIDTH, 10);
+ OUT_RING (chan, (line_dwords * 4) / cpp);
+ OUT_RING (chan, h);
+ OUT_RING (chan, 0); /* SIFC_DX,Y_DU,V_FRACT,INT */
+ OUT_RING (chan, 1);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, 1);
+ OUT_RING (chan, 0); /* SIFC_DST_X,Y_FRACT,INT */
+ OUT_RING (chan, x);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, y);
+
+ pNv->pdpix = pdpix;
+ chan->flush_notify = NVC0EXAStateSIFCResubmit;
+
+ while (h--) {
+ const char *ptr = src;
+ int count = line_dwords;
+
+ while (count) {
+ int size = count > 1792 ? 1792 : count;
+
+ WAIT_RING (chan, size + 1);
+ BEGIN_RING_NI(chan, eng2d, NV50_2D_SIFC_DATA, size);
+ OUT_RINGp (chan, ptr, size);
+
+ ptr += size * 4;
+ count -= size;
+ }
+
+ src += src_pitch;
+ }
+
+ chan->flush_notify = NULL;
+ return TRUE;
+}
+
+static Bool
+NVC0EXACheckRenderTarget(PicturePtr ppict)
+{
+ if (ppict->pDrawable->width > 8192 ||
+ ppict->pDrawable->height > 8192)
+ NOUVEAU_FALLBACK("render target dimensions exceeded %dx%d\n",
+ ppict->pDrawable->width,
+ ppict->pDrawable->height);
+
+ switch (ppict->format) {
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ case PICT_r5g6b5:
+ case PICT_a8:
+ case PICT_x1r5g5b5:
+ case PICT_a1r5g5b5:
+ case PICT_x8b8g8r8:
+ case PICT_a2b10g10r10:
+ case PICT_x2b10g10r10:
+ case PICT_a2r10g10b10:
+ case PICT_x2r10g10b10:
+ break;
+ default:
+ NOUVEAU_FALLBACK("picture format 0x%08x\n", ppict->format);
+ }
+
+ return TRUE;
+}
+
+static Bool
+NVC0EXARenderTarget(PixmapPtr ppix, PicturePtr ppict)
+{
+ NVC0EXA_LOCALS(ppix);
+ struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
+ unsigned format;
+
+ /*XXX: Scanout buffer not tiled, someone needs to figure it out */
+ if (!nv50_style_tiled_pixmap(ppix))
+ NOUVEAU_FALLBACK("pixmap is scanout buffer\n");
+
+ switch (ppict->format) {
+ case PICT_a8r8g8b8: format = NV50_SURFACE_FORMAT_A8R8G8B8_UNORM; break;
+ case PICT_x8r8g8b8: format = NV50_SURFACE_FORMAT_X8R8G8B8_UNORM; break;
+ case PICT_r5g6b5: format = NV50_SURFACE_FORMAT_R5G6B5_UNORM; break;
+ case PICT_a8: format = NV50_SURFACE_FORMAT_A8_UNORM; break;
+ case PICT_x1r5g5b5: format = NV50_SURFACE_FORMAT_X1R5G5B5_UNORM; break;
+ case PICT_a1r5g5b5: format = NV50_SURFACE_FORMAT_A1R5G5B5_UNORM; break;
+ case PICT_x8b8g8r8: format = NV50_SURFACE_FORMAT_X8B8G8R8_UNORM; break;
+ case PICT_a2b10g10r10:
+ case PICT_x2b10g10r10:
+ format = NV50_SURFACE_FORMAT_A2B10G10R10_UNORM;
+ break;
+ case PICT_a2r10g10b10:
+ case PICT_x2r10g10b10:
+ format = NV50_SURFACE_FORMAT_A2R10G10B10_UNORM;
+ break;
+ default:
+ NOUVEAU_FALLBACK("invalid picture format\n");
+ }
+
+ BEGIN_RING(chan, fermi, NVC0_3D_RT_ADDRESS_HIGH(0), 8);
+ if (OUT_RELOCh(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR) ||
+ OUT_RELOCl(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR))
+ return FALSE;
+ OUT_RING (chan, ppix->drawable.width);
+ OUT_RING (chan, ppix->drawable.height);
+ OUT_RING (chan, format);
+ OUT_RING (chan, bo->tile_mode);
+ OUT_RING (chan, 0x00000001);
+ OUT_RING (chan, 0x00000000);
+
+ return TRUE;
+}
+
+static Bool
+NVC0EXACheckTexture(PicturePtr ppict, PicturePtr pdpict, int op)
+{
+ if (!ppict->pDrawable)
+ NOUVEAU_FALLBACK("Solid and gradient pictures unsupported.\n");
+
+ if (ppict->pDrawable->width > 8192 ||
+ ppict->pDrawable->height > 8192)
+ NOUVEAU_FALLBACK("texture dimensions exceeded %dx%d\n",
+ ppict->pDrawable->width,
+ ppict->pDrawable->height);
+
+ switch (ppict->format) {
+ case PICT_a8r8g8b8:
+ case PICT_a8b8g8r8:
+ case PICT_x8r8g8b8:
+ case PICT_x8b8g8r8:
+ case PICT_r5g6b5:
+ case PICT_a8:
+ case PICT_x1r5g5b5:
+ case PICT_x1b5g5r5:
+ case PICT_a1r5g5b5:
+ case PICT_a1b5g5r5:
+ case PICT_b5g6r5:
+ case PICT_b8g8r8a8:
+ case PICT_b8g8r8x8:
+ case PICT_a2b10g10r10:
+ case PICT_x2b10g10r10:
+ case PICT_x2r10g10b10:
+ case PICT_a2r10g10b10:
+ case PICT_x4r4g4b4:
+ case PICT_x4b4g4r4:
+ case PICT_a4r4g4b4:
+ case PICT_a4b4g4r4:
+ break;
+ default:
+ NOUVEAU_FALLBACK("picture format 0x%08x\n", ppict->format);
+ }
+
+ switch (ppict->filter) {
+ case PictFilterNearest:
+ case PictFilterBilinear:
+ break;
+ default:
+ NOUVEAU_FALLBACK("picture filter %d\n", ppict->filter);
+ }
+
+ /* OpenGL and Render disagree on what should be sampled outside an XRGB
+ * texture (with no repeating). Opengl has a hardcoded alpha value of
+ * 1.0, while render expects 0.0. We assume that clipping is done for
+ * untranformed sources.
+ */
+ if (NVC0EXABlendOp[op].src_alpha && !ppict->repeat &&
+ ppict->transform && (PICT_FORMAT_A(ppict->format) == 0)
+ && (PICT_FORMAT_A(pdpict->format) != 0))
+ NOUVEAU_FALLBACK("REPEAT_NONE unsupported for XRGB source\n");
+
+ return TRUE;
+}
+
+#define _(X1, X2, X3, X4, FMT) \
+ (NV50TIC_0_0_TYPER_UNORM | NV50TIC_0_0_TYPEG_UNORM | \
+ NV50TIC_0_0_TYPEB_UNORM | NV50TIC_0_0_TYPEA_UNORM | \
+ NV50TIC_0_0_MAP##X1 | NV50TIC_0_0_MAP##X2 | \
+ NV50TIC_0_0_MAP##X3 | NV50TIC_0_0_MAP##X4 | \
+ NV50TIC_0_0_FMT_##FMT)
+
+static Bool
+NVC0EXATexture(PixmapPtr ppix, PicturePtr ppict, unsigned unit)
+{
+ NVC0EXA_LOCALS(ppix);
+ struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
+ const unsigned tcb_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
+ uint32_t mode;
+
+ /* XXX: maybe add support for linear textures at some point */
+ if (!nv50_style_tiled_pixmap(ppix))
+ NOUVEAU_FALLBACK("pixmap is scanout buffer\n");
+
+ BEGIN_RING(chan, fermi, NVC0_3D_TIC_ADDRESS_HIGH, 3);
+ if (OUT_RELOCh(chan, pNv->tesla_scratch, TIC_OFFSET, tcb_flags) ||
+ OUT_RELOCl(chan, pNv->tesla_scratch, TIC_OFFSET, tcb_flags))
+ return FALSE;
+ OUT_RING (chan, 15);
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, pNv->tesla_scratch,
+ TIC_OFFSET + unit * 32, tcb_flags) ||
+ OUT_RELOCl(chan, pNv->tesla_scratch,
+ TIC_OFFSET + unit * 32, tcb_flags))
+ return FALSE;
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 8 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 8);
+
+ switch (ppict->format) {
+ case PICT_a8r8g8b8:
+ OUT_RING(chan, _(B_C0, G_C1, R_C2, A_C3, 8_8_8_8));
+ break;
+ case PICT_a8b8g8r8:
+ OUT_RING(chan, _(R_C0, G_C1, B_C2, A_C3, 8_8_8_8));
+ break;
+ case PICT_x8r8g8b8:
+ OUT_RING(chan, _(B_C0, G_C1, R_C2, A_ONE, 8_8_8_8));
+ break;
+ case PICT_x8b8g8r8:
+ OUT_RING(chan, _(R_C0, G_C1, B_C2, A_ONE, 8_8_8_8));
+ break;
+ case PICT_r5g6b5:
+ OUT_RING(chan, _(B_C0, G_C1, R_C2, A_ONE, 5_6_5));
+ break;
+ case PICT_a8:
+ OUT_RING(chan, _(A_C0, B_ZERO, G_ZERO, R_ZERO, 8));
+ break;
+ case PICT_x1r5g5b5:
+ OUT_RING(chan, _(B_C0, G_C1, R_C2, A_ONE, 1_5_5_5));
+ break;
+ case PICT_x1b5g5r5:
+ OUT_RING(chan, _(R_C0, G_C1, B_C2, A_ONE, 1_5_5_5));
+ break;
+ case PICT_a1r5g5b5:
+ OUT_RING(chan, _(B_C0, G_C1, R_C2, A_C3, 1_5_5_5));
+ break;
+ case PICT_a1b5g5r5:
+ OUT_RING(chan, _(R_C0, G_C1, B_C2, A_C3, 1_5_5_5));
+ break;
+ case PICT_b5g6r5:
+ OUT_RING(chan, _(R_C0, G_C1, B_C2, A_ONE, 5_6_5));
+ break;
+ case PICT_b8g8r8x8:
+ OUT_RING(chan, _(A_ONE, R_C1, G_C2, B_C3, 8_8_8_8));
+ break;
+ case PICT_b8g8r8a8:
+ OUT_RING(chan, _(A_C0, R_C1, G_C2, B_C3, 8_8_8_8));
+ break;
+ case PICT_a2b10g10r10:
+ OUT_RING(chan, _(R_C0, G_C1, B_C2, A_C3, 2_10_10_10));
+ break;
+ case PICT_x2b10g10r10:
+ OUT_RING(chan, _(R_C0, G_C1, B_C2, A_ONE, 2_10_10_10));
+ break;
+ case PICT_x2r10g10b10:
+ OUT_RING(chan, _(B_C0, G_C1, R_C2, A_ONE, 2_10_10_10));
+ break;
+ case PICT_a2r10g10b10:
+ OUT_RING(chan, _(B_C0, G_C1, R_C2, A_C3, 2_10_10_10));
+ break;
+ case PICT_x4r4g4b4:
+ OUT_RING(chan, _(B_C0, G_C1, R_C2, A_ONE, 4_4_4_4));
+ break;
+ case PICT_x4b4g4r4:
+ OUT_RING(chan, _(R_C0, G_C1, B_C2, A_ONE, 4_4_4_4));
+ break;
+ case PICT_a4r4g4b4:
+ OUT_RING(chan, _(B_C0, G_C1, R_C2, A_C3, 4_4_4_4));
+ break;
+ case PICT_a4b4g4r4:
+ OUT_RING(chan, _(R_C0, G_C1, B_C2, A_C3, 4_4_4_4));
+ break;
+ default:
+ NOUVEAU_FALLBACK("invalid picture format, this SHOULD NOT HAPPEN. Expect trouble.\n");
+ }
+#undef _
+
+ mode = 0xd0005000 | (bo->tile_mode << (22 - 4));
+ if (OUT_RELOCl(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD) ||
+ OUT_RELOCd(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+ NOUVEAU_BO_HIGH | NOUVEAU_BO_OR, mode, mode))
+ return FALSE;
+ OUT_RING (chan, 0x00300000);
+ OUT_RING (chan, (1 << 31) | ppix->drawable.width);
+ OUT_RING (chan, (1 << 16) | ppix->drawable.height);
+ OUT_RING (chan, 0x03000000);
+ OUT_RING (chan, 0x00000000);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_TSC_ADDRESS_HIGH, 3);
+ if (OUT_RELOCh(chan, pNv->tesla_scratch, TSC_OFFSET, tcb_flags) ||
+ OUT_RELOCl(chan, pNv->tesla_scratch, TSC_OFFSET, tcb_flags))
+ return FALSE;
+ OUT_RING (chan, 0);
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, pNv->tesla_scratch,
+ TSC_OFFSET + unit * 32, tcb_flags) ||
+ OUT_RELOCl(chan, pNv->tesla_scratch,
+ TSC_OFFSET + unit * 32, tcb_flags))
+ return FALSE;
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 8 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 8);
+
+ if (ppict->repeat) {
+ switch (ppict->repeatType) {
+ case RepeatPad:
+ OUT_RING (chan, 0x00024000 |
+ NV50TSC_1_0_WRAPS_CLAMP |
+ NV50TSC_1_0_WRAPT_CLAMP |
+ NV50TSC_1_0_WRAPR_CLAMP);
+ break;
+ case RepeatReflect:
+ OUT_RING (chan, 0x00024000 |
+ NV50TSC_1_0_WRAPS_MIRROR_REPEAT |
+ NV50TSC_1_0_WRAPT_MIRROR_REPEAT |
+ NV50TSC_1_0_WRAPR_MIRROR_REPEAT);
+ break;
+ case RepeatNormal:
+ default:
+ OUT_RING (chan, 0x00024000 |
+ NV50TSC_1_0_WRAPS_REPEAT |
+ NV50TSC_1_0_WRAPT_REPEAT |
+ NV50TSC_1_0_WRAPR_REPEAT);
+ break;
+ }
+ } else {
+ OUT_RING (chan, 0x00024000 |
+ NV50TSC_1_0_WRAPS_CLAMP_TO_BORDER |
+ NV50TSC_1_0_WRAPT_CLAMP_TO_BORDER |
+ NV50TSC_1_0_WRAPR_CLAMP_TO_BORDER);
+ }
+ if (ppict->filter == PictFilterBilinear) {
+ OUT_RING (chan,
+ NV50TSC_1_1_MAGF_LINEAR |
+ NV50TSC_1_1_MINF_LINEAR | NV50TSC_1_1_MIPF_NONE);
+ } else {
+ OUT_RING (chan,
+ NV50TSC_1_1_MAGF_NEAREST |
+ NV50TSC_1_1_MINF_NEAREST | NV50TSC_1_1_MIPF_NONE);
+ }
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RINGf (chan, 0.0f);
+ OUT_RINGf (chan, 0.0f);
+ OUT_RINGf (chan, 0.0f);
+ OUT_RINGf (chan, 0.0f);
+
+ state->unit[unit].width = ppix->drawable.width;
+ state->unit[unit].height = ppix->drawable.height;
+ state->unit[unit].transform = ppict->transform;
+ return TRUE;
+}
+
+static Bool
+NVC0EXACheckBlend(int op)
+{
+ if (op > PictOpAdd)
+ NOUVEAU_FALLBACK("unsupported blend op %d\n", op);
+ return TRUE;
+}
+
+static void
+NVC0EXABlend(PixmapPtr ppix, PicturePtr ppict, int op, int component_alpha)
+{
+ NVC0EXA_LOCALS(ppix);
+ struct nvc0_blend_op *b = &NVC0EXABlendOp[op];
+ unsigned sblend = b->src_blend;
+ unsigned dblend = b->dst_blend;
+
+ if (b->dst_alpha) {
+ if (!PICT_FORMAT_A(ppict->format)) {
+ if (sblend == BF(DST_ALPHA))
+ sblend = BF(ONE);
+ else
+ if (sblend == BF(ONE_MINUS_DST_ALPHA))
+ sblend = BF(ZERO);
+ }
+ }
+
+ if (b->src_alpha && component_alpha) {
+ if (dblend == BF(SRC_ALPHA))
+ dblend = BF(SRC_COLOR);
+ else
+ if (dblend == BF(ONE_MINUS_SRC_ALPHA))
+ dblend = BF(ONE_MINUS_SRC_COLOR);
+ }
+
+ if (sblend == BF(ONE) && dblend == BF(ZERO)) {
+ BEGIN_RING(chan, fermi, NVC0_3D_BLEND_ENABLE(0), 1);
+ OUT_RING (chan, 0);
+ } else {
+ BEGIN_RING(chan, fermi, NVC0_3D_BLEND_ENABLE(0), 1);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, fermi, NVC0_3D_BLEND_EQUATION_RGB, 5);
+ OUT_RING (chan, NVC0_3D_BLEND_EQUATION_RGB_FUNC_ADD);
+ OUT_RING (chan, sblend);
+ OUT_RING (chan, dblend);
+ OUT_RING (chan, NVC0_3D_BLEND_EQUATION_ALPHA_FUNC_ADD);
+ OUT_RING (chan, sblend);
+ BEGIN_RING(chan, fermi, NVC0_3D_BLEND_FUNC_DST_ALPHA, 1);
+ OUT_RING (chan, dblend);
+ }
+}
+
+Bool
+NVC0EXACheckComposite(int op,
+ PicturePtr pspict, PicturePtr pmpict, PicturePtr pdpict)
+{
+ if (!NVC0EXACheckBlend(op))
+ NOUVEAU_FALLBACK("blend not supported\n");
+
+ if (!NVC0EXACheckRenderTarget(pdpict))
+ NOUVEAU_FALLBACK("render target invalid\n");
+
+ if (!NVC0EXACheckTexture(pspict, pdpict, op))
+ NOUVEAU_FALLBACK("src picture invalid\n");
+
+ if (pmpict) {
+ if (pmpict->componentAlpha &&
+ PICT_FORMAT_RGB(pmpict->format) &&
+ NVC0EXABlendOp[op].src_alpha &&
+ NVC0EXABlendOp[op].src_blend != BF(ZERO))
+ NOUVEAU_FALLBACK("component-alpha not supported\n");
+
+ if (!NVC0EXACheckTexture(pmpict, pdpict, op))
+ NOUVEAU_FALLBACK("mask picture invalid\n");
+ }
+
+ return TRUE;
+}
+
+static void
+NVC0EXAStateCompositeResubmit(struct nouveau_channel *chan)
+{
+ ScrnInfoPtr pScrn = chan->user_private;
+ NVPtr pNv = NVPTR(pScrn);
+
+ NVC0EXAPrepareComposite(pNv->alu, pNv->pspict, pNv->pmpict, pNv->pdpict,
+ pNv->pspix, pNv->pmpix, pNv->pdpix);
+}
+
+Bool
+NVC0EXAPrepareComposite(int op,
+ PicturePtr pspict, PicturePtr pmpict, PicturePtr pdpict,
+ PixmapPtr pspix, PixmapPtr pmpix, PixmapPtr pdpix)
+{
+ NVC0EXA_LOCALS(pspix);
+ const unsigned shd_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD;
+
+ if (MARK_RING (chan, 128, 4 + 2 + 2 * 10))
+ NOUVEAU_FALLBACK("ring space\n");
+
+ // fonts: !pmpict, op == 12 (Add, ONE/ONE)
+ /*
+ if (pmpict || op != 12)
+ NOUVEAU_FALLBACK("comp-alpha");
+ */
+
+ BEGIN_RING(chan, eng2d, NV50_2D_SERIALIZE, 1);
+ OUT_RING (chan, 0);
+
+ if (!NVC0EXARenderTarget(pdpix, pdpict)) {
+ MARK_UNDO(chan);
+ NOUVEAU_FALLBACK("render target invalid\n");
+ }
+
+ NVC0EXABlend(pdpix, pdpict, op, pmpict && pmpict->componentAlpha &&
+ PICT_FORMAT_RGB(pmpict->format));
+
+ BEGIN_RING(chan, fermi, NVC0_3D_CODE_ADDRESS_HIGH, 2);
+ if (OUT_RELOCh(chan, pNv->tesla_scratch, CODE_OFFSET, shd_flags) ||
+ OUT_RELOCl(chan, pNv->tesla_scratch, CODE_OFFSET, shd_flags)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+
+ if (!NVC0EXATexture(pspix, pspict, 0)) {
+ MARK_UNDO(chan);
+ NOUVEAU_FALLBACK("src picture invalid\n");
+ }
+ BEGIN_RING(chan, fermi, NVC0_3D_BIND_TIC(4), 1);
+ OUT_RING (chan, (0 << 9) | (0 << 1) | NVC0_3D_BIND_TIC_ACTIVE);
+
+ if (pmpict) {
+ if (!NVC0EXATexture(pmpix, pmpict, 1)) {
+ MARK_UNDO(chan);
+ NOUVEAU_FALLBACK("mask picture invalid\n");
+ }
+ state->have_mask = TRUE;
+
+ BEGIN_RING(chan, fermi, NVC0_3D_BIND_TIC(4), 1);
+ OUT_RING (chan, (1 << 9) | (1 << 1) | NVC0_3D_BIND_TIC_ACTIVE);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_START_ID(5), 1);
+ if (pdpict->format == PICT_a8) {
+ OUT_RING (chan, PFP_C_A8);
+ } else {
+ if (pmpict->componentAlpha &&
+ PICT_FORMAT_RGB(pmpict->format)) {
+ if (NVC0EXABlendOp[op].src_alpha)
+ OUT_RING (chan, PFP_CCASA);
+ else
+ OUT_RING (chan, PFP_CCA);
+ } else {
+ OUT_RING (chan, PFP_C);
+ }
+ }
+ } else {
+ state->have_mask = FALSE;
+
+ BEGIN_RING(chan, fermi, NVC0_3D_BIND_TIC(4), 1);
+ OUT_RING (chan, (1 << 1) | 0);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_START_ID(5), 1);
+ if (pdpict->format == PICT_a8)
+ OUT_RING (chan, PFP_S_A8);
+ else
+ OUT_RING (chan, PFP_S);
+ }
+
+ BEGIN_RING(chan, fermi, NVC0_3D_TSC_FLUSH, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_TIC_FLUSH, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_TEX_CACHE_CTL, 1);
+ OUT_RING (chan, 0);
+
+ pNv->alu = op;
+ pNv->pspict = pspict;
+ pNv->pmpict = pmpict;
+ pNv->pdpict = pdpict;
+ pNv->pspix = pspix;
+ pNv->pmpix = pmpix;
+ pNv->pdpix = pdpix;
+ chan->flush_notify = NVC0EXAStateCompositeResubmit;
+ return TRUE;
+}
+
+#define xFixedToFloat(v) \
+ ((float)xFixedToInt((v)) + ((float)xFixedFrac(v) / 65536.0))
+
+static inline void
+NVC0EXATransform(PictTransformPtr t, int x, int y, float sx, float sy,
+ float *x_ret, float *y_ret)
+{
+ if (t) {
+ PictVector v;
+
+ v.vector[0] = IntToxFixed(x);
+ v.vector[1] = IntToxFixed(y);
+ v.vector[2] = xFixed1;
+ PictureTransformPoint(t, &v);
+ *x_ret = xFixedToFloat(v.vector[0]) / sx;
+ *y_ret = xFixedToFloat(v.vector[1]) / sy;
+ } else {
+ *x_ret = (float)x / sx;
+ *y_ret = (float)y / sy;
+ }
+}
+
+void
+NVC0EXAComposite(PixmapPtr pdpix,
+ int sx, int sy, int mx, int my,
+ int dx, int dy, int w, int h)
+{
+ NVC0EXA_LOCALS(pdpix);
+ float sX0, sX1, sX2, sY0, sY1, sY2;
+
+ WAIT_RING (chan, 64);
+ BEGIN_RING(chan, fermi, NVC0_3D_SCISSOR_HORIZ(0), 2);
+ OUT_RING (chan, ((dx + w) << 16) | dx);
+ OUT_RING (chan, ((dy + h) << 16) | dy);
+ BEGIN_RING(chan, fermi, NVC0_3D_VERTEX_BEGIN_GL, 1);
+ OUT_RING (chan, NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLES);
+
+ NVC0EXATransform(state->unit[0].transform, sx, sy + (h * 2),
+ state->unit[0].width, state->unit[0].height,
+ &sX0, &sY0);
+ NVC0EXATransform(state->unit[0].transform, sx, sy,
+ state->unit[0].width, state->unit[0].height,
+ &sX1, &sY1);
+ NVC0EXATransform(state->unit[0].transform, sx + (w * 2), sy,
+ state->unit[0].width, state->unit[0].height,
+ &sX2, &sY2);
+
+ if (state->have_mask) {
+ float mX0, mX1, mX2, mY0, mY1, mY2;
+
+ NVC0EXATransform(state->unit[1].transform, mx, my + (h * 2),
+ state->unit[1].width, state->unit[1].height,
+ &mX0, &mY0);
+ NVC0EXATransform(state->unit[1].transform, mx, my,
+ state->unit[1].width, state->unit[1].height,
+ &mX1, &mY1);
+ NVC0EXATransform(state->unit[1].transform, mx + (w * 2), my,
+ state->unit[1].width, state->unit[1].height,
+ &mX2, &mY2);
+
+ VTX2s(pNv, sX0, sY0, mX0, mY0, dx, dy + (h * 2));
+ VTX2s(pNv, sX1, sY1, mX1, mY1, dx, dy);
+ VTX2s(pNv, sX2, sY2, mX2, mY2, dx + (w * 2), dy);
+ } else {
+ VTX1s(pNv, sX0, sY0, dx, dy + (h * 2));
+ VTX1s(pNv, sX1, sY1, dx, dy);
+ VTX1s(pNv, sX2, sY2, dx + (w * 2), dy);
+ }
+
+ BEGIN_RING(chan, fermi, NVC0_3D_VERTEX_END_GL, 1);
+ OUT_RING (chan, 0);
+}
+
+void
+NVC0EXADoneComposite(PixmapPtr pdpix)
+{
+ NVC0EXA_LOCALS(pdpix);
+
+ chan->flush_notify = NULL;
+}
+
diff --git a/src/nvc0_m2mf.xml.h b/src/nvc0_m2mf.xml.h
new file mode 100644
index 0000000..3bf628d
--- /dev/null
+++ b/src/nvc0_m2mf.xml.h
@@ -0,0 +1,138 @@
+#ifndef NVC0_M2MF_XML
+#define NVC0_M2MF_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nvc0_m2mf.xml ( 2227 bytes, from 2010-10-16 16:10:29)
+- copyright.xml ( 6498 bytes, from 2010-10-03 13:18:37)
+- nv_object.xml ( 11379 bytes, from 2010-10-16 11:43:24)
+- nvchipsets.xml ( 2907 bytes, from 2010-10-15 16:28:21)
+- nv_defs.xml ( 4437 bytes, from 2010-07-06 07:43:58)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro, curro_, currojerez)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin Kościelnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <patmandin@gmail.com> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+
+#define NVC0_M2MF_TILING_MODE_IN 0x00000204
+
+#define NVC0_M2MF_TILING_PITCH_IN 0x00000208
+
+#define NVC0_M2MF_TILING_HEIGHT_IN 0x0000020c
+
+#define NVC0_M2MF_TILING_DEPTH_IN 0x00000210
+
+#define NVC0_M2MF_TILING_POSITION_IN_Z 0x00000214
+
+#define NVC0_M2MF_TILING_MODE_OUT 0x00000220
+
+#define NVC0_M2MF_TILING_PITCH_OUT 0x00000224
+
+#define NVC0_M2MF_TILING_HEIGHT_OUT 0x00000228
+
+#define NVC0_M2MF_TILING_DEPTH_OUT 0x0000022c
+
+#define NVC0_M2MF_TILING_POSITION_OUT_Z 0x00000230
+
+#define NVC0_M2MF_OFFSET_OUT_HIGH 0x00000238
+
+#define NVC0_M2MF_OFFSET_OUT_LOW 0x0000023c
+
+#define NVC0_M2MF_EXEC 0x00000300
+#define NVC0_M2MF_EXEC_PUSH 0x00000001
+#define NVC0_M2MF_EXEC_LINEAR_IN 0x00000010
+#define NVC0_M2MF_EXEC_LINEAR_OUT 0x00000100
+#define NVC0_M2MF_EXEC_NOTIFY 0x00002000
+#define NVC0_M2MF_EXEC_INC__MASK 0x00f00000
+#define NVC0_M2MF_EXEC_INC__SHIFT 20
+
+#define NVC0_M2MF_DATA 0x00000304
+
+#define NVC0_M2MF_OFFSET_IN_HIGH 0x0000030c
+
+#define NVC0_M2MF_OFFSET_IN_LOW 0x00000310
+
+#define NVC0_M2MF_PITCH_IN 0x00000314
+
+#define NVC0_M2MF_PITCH_OUT 0x00000318
+
+#define NVC0_M2MF_LINE_LENGTH_IN 0x0000031c
+
+#define NVC0_M2MF_LINE_COUNT 0x00000320
+
+#define NVC0_M2MF_NOTIFY_ADDRESS_HIGH 0x0000032c
+
+#define NVC0_M2MF_NOTIFY_ADDRESS_LOW 0x00000330
+
+#define NVC0_M2MF_NOTIFY 0x00000334
+
+#define NVC0_M2MF_TILING_POSITION_IN_X 0x00000344
+
+#define NVC0_M2MF_TILING_POSITION_IN_Y 0x00000348
+
+#define NVC0_M2MF_TILING_POSITION_OUT_X 0x0000034c
+
+#define NVC0_M2MF_TILING_POSITION_OUT_Y 0x00000350
+
+
+#endif /* NVC0_M2MF_XML */
diff --git a/src/nvc0_xv.c b/src/nvc0_xv.c
new file mode 100644
index 0000000..41ec7a8
--- /dev/null
+++ b/src/nvc0_xv.c
@@ -0,0 +1,427 @@
+/*
+ * Copyright 2008 Ben Skeggs
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "xf86xv.h"
+#include <X11/extensions/Xv.h>
+#include "exa.h"
+#include "damage.h"
+#include "dixstruct.h"
+#include "fourcc.h"
+
+#include "nv_include.h"
+#include "nvc0_accel.h"
+#include "nv50_texture.h"
+
+extern Atom xvSyncToVBlank, xvSetDefaults;
+
+void
+nvc0_xv_m2mf(struct nouveau_grobj *m2mf,
+ struct nouveau_bo *dst, int uv_offset, int dst_pitch, int nlines,
+ struct nouveau_bo *src, int line_len)
+{
+ struct nouveau_channel *chan = m2mf->channel;
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_TILING_MODE_OUT, 5);
+ OUT_RING (chan, dst->tile_mode);
+ OUT_RING (chan, dst_pitch);
+ OUT_RING (chan, nlines);
+ OUT_RING (chan, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_TILING_POSITION_OUT_X, 2);
+ OUT_RING (chan, 0);
+ OUT_RING (chan, 0);
+
+ if (uv_offset) {
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_IN_HIGH, 2);
+ OUT_RELOCh(chan, src, line_len * nlines,
+ NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+ OUT_RELOCl(chan, src, line_len * nlines,
+ NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ OUT_RELOCh(chan, dst, uv_offset,
+ NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCl(chan, dst, uv_offset,
+ NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_PITCH_IN, 4);
+ OUT_RING (chan, line_len);
+ OUT_RING (chan, dst_pitch);
+ OUT_RING (chan, line_len);
+ OUT_RING (chan, nlines >> 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x00100010);
+ }
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_IN_HIGH, 2);
+ OUT_RELOCh(chan, src, 0, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+ OUT_RELOCl(chan, src, 0, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ OUT_RELOCh(chan, dst, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCl(chan, dst, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_PITCH_IN, 4);
+ OUT_RING (chan, line_len);
+ OUT_RING (chan, dst_pitch);
+ OUT_RING (chan, line_len);
+ OUT_RING (chan, nlines);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x00100010);
+}
+
+static Bool
+nvc0_xv_check_image_put(PixmapPtr ppix)
+{
+ switch (ppix->drawable.bitsPerPixel) {
+ case 32:
+ case 24:
+ case 16:
+ case 15:
+ break;
+ default:
+ return FALSE;
+ }
+
+ if (!nv50_style_tiled_pixmap(ppix))
+ return FALSE;
+
+ return TRUE;
+}
+
+static Bool
+nvc0_xv_state_emit(PixmapPtr ppix, int id, struct nouveau_bo *src,
+ int packed_y, int uv, int src_w, int src_h)
+{
+ ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];
+ NVPtr pNv = NVPTR(pScrn);
+ struct nouveau_channel *chan = pNv->chan;
+ struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
+ struct nouveau_grobj *m2mf = pNv->NvMemFormat;
+ struct nouveau_grobj *fermi = pNv->Nv3D;
+ const unsigned shd_flags = NOUVEAU_BO_RD | NOUVEAU_BO_VRAM;
+ const unsigned tcb_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
+ uint32_t mode = 0xd0005000 | (src->tile_mode << 18);
+
+ if (MARK_RING(chan, 256, 18))
+ return FALSE;
+
+ BEGIN_RING(chan, fermi, NVC0_3D_RT_ADDRESS_HIGH(0), 8);
+ if (OUT_RELOCh(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR) ||
+ OUT_RELOCl(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ OUT_RING (chan, ppix->drawable.width);
+ OUT_RING (chan, ppix->drawable.height);
+ switch (ppix->drawable.bitsPerPixel) {
+ case 32: OUT_RING (chan, NV50_SURFACE_FORMAT_A8R8G8B8_UNORM); break;
+ case 24: OUT_RING (chan, NV50_SURFACE_FORMAT_X8R8G8B8_UNORM); break;
+ case 16: OUT_RING (chan, NV50_SURFACE_FORMAT_R5G6B5_UNORM); break;
+ case 15: OUT_RING (chan, NV50_SURFACE_FORMAT_X1R5G5B5_UNORM); break;
+ }
+ OUT_RING (chan, bo->tile_mode);
+ OUT_RING (chan, 1);
+ OUT_RING (chan, 0);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_BLEND_ENABLE(0), 1);
+ OUT_RING (chan, 0);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_TIC_ADDRESS_HIGH, 3);
+ if (OUT_RELOCh(chan, pNv->tesla_scratch, TIC_OFFSET, tcb_flags) ||
+ OUT_RELOCl(chan, pNv->tesla_scratch, TIC_OFFSET, tcb_flags)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ OUT_RING (chan, 15);
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, pNv->tesla_scratch, TIC_OFFSET, tcb_flags) ||
+ OUT_RELOCl(chan, pNv->tesla_scratch, TIC_OFFSET, tcb_flags)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 16 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x00100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 16);
+ if (id == FOURCC_YV12 || id == FOURCC_I420) {
+ OUT_RING (chan, NV50TIC_0_0_MAPA_C0 | NV50TIC_0_0_TYPEA_UNORM |
+ NV50TIC_0_0_MAPB_ZERO | NV50TIC_0_0_TYPEB_UNORM |
+ NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
+ NV50TIC_0_0_MAPR_ZERO | NV50TIC_0_0_TYPER_UNORM |
+ NV50TIC_0_0_FMT_8);
+ if (OUT_RELOCl(chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD) ||
+ OUT_RELOC (chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+ NOUVEAU_BO_HIGH | NOUVEAU_BO_OR, mode, mode)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ OUT_RING (chan, 0x00300000);
+ OUT_RING (chan, src_w);
+ OUT_RING (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | src_h);
+ OUT_RING (chan, 0x03000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, NV50TIC_0_0_MAPA_C1 | NV50TIC_0_0_TYPEA_UNORM |
+ NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
+ NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
+ NV50TIC_0_0_MAPR_ZERO | NV50TIC_0_0_TYPER_UNORM |
+ NV50TIC_0_0_FMT_8_8);
+ if (OUT_RELOCl(chan, src, uv, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD) ||
+ OUT_RELOC (chan, src, uv, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+ NOUVEAU_BO_HIGH | NOUVEAU_BO_OR, mode, mode)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ OUT_RING (chan, 0x00300000);
+ OUT_RING (chan, src_w >> 1);
+ OUT_RING (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | (src_h >> 1));
+ OUT_RING (chan, 0x03000000);
+ OUT_RING (chan, 0x00000000);
+ } else {
+ if (id == FOURCC_UYVY) {
+ OUT_RING (chan, NV50TIC_0_0_MAPA_C1 | NV50TIC_0_0_TYPEA_UNORM |
+ NV50TIC_0_0_MAPB_ZERO | NV50TIC_0_0_TYPEB_UNORM |
+ NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
+ NV50TIC_0_0_MAPR_ZERO | NV50TIC_0_0_TYPER_UNORM |
+ NV50TIC_0_0_FMT_8_8);
+ } else {
+ OUT_RING (chan, NV50TIC_0_0_MAPA_C0 | NV50TIC_0_0_TYPEA_UNORM |
+ NV50TIC_0_0_MAPB_ZERO | NV50TIC_0_0_TYPEB_UNORM |
+ NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
+ NV50TIC_0_0_MAPR_ZERO | NV50TIC_0_0_TYPER_UNORM |
+ NV50TIC_0_0_FMT_8_8);
+ }
+ if (OUT_RELOCl(chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD) ||
+ OUT_RELOC (chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+ NOUVEAU_BO_HIGH | NOUVEAU_BO_OR, mode, mode)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ OUT_RING (chan, 0x00300000);
+ OUT_RING (chan, src_w);
+ OUT_RING (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | src_h);
+ OUT_RING (chan, 0x03000000);
+ OUT_RING (chan, 0x00000000);
+ if (id == FOURCC_UYVY) {
+ OUT_RING (chan, NV50TIC_0_0_MAPA_C2 | NV50TIC_0_0_TYPEA_UNORM |
+ NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM |
+ NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
+ NV50TIC_0_0_MAPR_ZERO | NV50TIC_0_0_TYPER_UNORM |
+ NV50TIC_0_0_FMT_8_8_8_8);
+ } else {
+ OUT_RING (chan, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
+ NV50TIC_0_0_MAPB_C1 | NV50TIC_0_0_TYPEB_UNORM |
+ NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
+ NV50TIC_0_0_MAPR_ZERO | NV50TIC_0_0_TYPER_UNORM |
+ NV50TIC_0_0_FMT_8_8_8_8);
+ }
+ if (OUT_RELOCl(chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD) ||
+ OUT_RELOC (chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+ NOUVEAU_BO_HIGH | NOUVEAU_BO_OR, mode, mode)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ OUT_RING (chan, 0x00300000);
+ OUT_RING (chan, (src_w >> 1));
+ OUT_RING (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | src_h);
+ OUT_RING (chan, 0x03000000);
+ OUT_RING (chan, 0x00000000);
+ }
+
+ BEGIN_RING(chan, fermi, NVC0_3D_TSC_ADDRESS_HIGH, 3);
+ if (OUT_RELOCh(chan, pNv->tesla_scratch, TSC_OFFSET, tcb_flags) ||
+ OUT_RELOCl(chan, pNv->tesla_scratch, TSC_OFFSET, tcb_flags)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ OUT_RING (chan, 0x00000000);
+
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_OFFSET_OUT_HIGH, 2);
+ if (OUT_RELOCh(chan, pNv->tesla_scratch, TSC_OFFSET, tcb_flags) ||
+ OUT_RELOCl(chan, pNv->tesla_scratch, TSC_OFFSET, tcb_flags)) {
+ MARK_UNDO(chan);
+ return FALSE;
+ }
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_LINE_LENGTH_IN, 2);
+ OUT_RING (chan, 16 * 4);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, m2mf, NVC0_M2MF_EXEC, 1);
+ OUT_RING (chan, 0x00100111);
+ BEGIN_RING_NI(chan, m2mf, NVC0_M2MF_DATA, 16);
+ OUT_RING (chan, NV50TSC_1_0_WRAPS_CLAMP_TO_EDGE |
+ NV50TSC_1_0_WRAPT_CLAMP_TO_EDGE |
+ NV50TSC_1_0_WRAPR_CLAMP_TO_EDGE);
+ OUT_RING (chan, NV50TSC_1_1_MAGF_LINEAR |
+ NV50TSC_1_1_MINF_LINEAR |
+ NV50TSC_1_1_MIPF_NONE);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, NV50TSC_1_0_WRAPS_CLAMP_TO_EDGE |
+ NV50TSC_1_0_WRAPT_CLAMP_TO_EDGE |
+ NV50TSC_1_0_WRAPR_CLAMP_TO_EDGE);
+ OUT_RING (chan, NV50TSC_1_1_MAGF_LINEAR |
+ NV50TSC_1_1_MINF_LINEAR |
+ NV50TSC_1_1_MIPF_NONE);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x00000000);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_CODE_ADDRESS_HIGH, 2);
+ if (OUT_RELOCh(chan, pNv->tesla_scratch, CODE_OFFSET, shd_flags) ||
+ OUT_RELOCl(chan, pNv->tesla_scratch, CODE_OFFSET, shd_flags)) {
+ MARK_UNDO(chan);
+ return FALSE;
+
+ }
+ BEGIN_RING(chan, fermi, NVC0_3D_SP_START_ID(5), 1);
+ OUT_RING (chan, PFP_NV12);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_TSC_FLUSH, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_TIC_FLUSH, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, fermi, NVC0_3D_TEX_CACHE_CTL, 1);
+ OUT_RING (chan, 0);
+
+ BEGIN_RING(chan, fermi, NVC0_3D_BIND_TIC(4), 1);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, fermi, NVC0_3D_BIND_TIC(4), 1);
+ OUT_RING (chan, 0x203);
+
+ return TRUE;
+}
+
+int
+nvc0_xv_image_put(ScrnInfoPtr pScrn,
+ struct nouveau_bo *src, int packed_y, int uv,
+ int id, int src_pitch, BoxPtr dstBox,
+ int x1, int y1, int x2, int y2,
+ uint16_t width, uint16_t height,
+ uint16_t src_w, uint16_t src_h,
+ uint16_t drw_w, uint16_t drw_h,
+ RegionPtr clipBoxes, PixmapPtr ppix,
+ NVPortPrivPtr pPriv)
+{
+ NVPtr pNv = NVPTR(pScrn);
+ struct nouveau_channel *chan = pNv->chan;
+ struct nouveau_grobj *fermi = pNv->Nv3D;
+ float X1, X2, Y1, Y2;
+ BoxPtr pbox;
+ int nbox;
+
+ if (!nvc0_xv_check_image_put(ppix))
+ return BadMatch;
+ if (!nvc0_xv_state_emit(ppix, id, src, packed_y, uv, width, height))
+ return BadAlloc;
+
+ if (0 && pPriv->SyncToVBlank) {
+ NV50SyncToVBlank(ppix, dstBox);
+ }
+
+ /* These are fixed point values in the 16.16 format. */
+ X1 = (float)(x1>>16)+(float)(x1&0xFFFF)/(float)0x10000;
+ Y1 = (float)(y1>>16)+(float)(y1&0xFFFF)/(float)0x10000;
+ X2 = (float)(x2>>16)+(float)(x2&0xFFFF)/(float)0x10000;
+ Y2 = (float)(y2>>16)+(float)(y2&0xFFFF)/(float)0x10000;
+
+ pbox = REGION_RECTS(clipBoxes);
+ nbox = REGION_NUM_RECTS(clipBoxes);
+ while(nbox--) {
+ float tx1=X1+(float)(pbox->x1 - dstBox->x1)*(X2-X1)/(float)(drw_w);
+ float tx2=X1+(float)(pbox->x2 - dstBox->x1)*(src_w)/(float)(drw_w);
+ float ty1=Y1+(float)(pbox->y1 - dstBox->y1)*(Y2-Y1)/(float)(drw_h);
+ float ty2=Y1+(float)(pbox->y2 - dstBox->y1)*(src_h)/(float)(drw_h);
+ int sx1=pbox->x1;
+ int sx2=pbox->x2;
+ int sy1=pbox->y1;
+ int sy2=pbox->y2;
+
+ tx1 = tx1 / width;
+ tx2 = tx2 / width;
+ ty1 = ty1 / height;
+ ty2 = ty2 / height;
+
+ if (AVAIL_RING(chan) < 64) {
+ if (!nvc0_xv_state_emit(ppix, id, src, packed_y, uv,
+ width, height))
+ return BadAlloc;
+ }
+
+ BEGIN_RING(chan, fermi, NVC0_3D_SCISSOR_HORIZ(0), 2);
+ OUT_RING (chan, sx2 << NVC0_3D_SCISSOR_HORIZ_MAX__SHIFT | sx1);
+ OUT_RING (chan, sy2 << NVC0_3D_SCISSOR_VERT_MAX__SHIFT | sy1 );
+
+ BEGIN_RING(chan, fermi, NVC0_3D_VERTEX_BEGIN_GL, 1);
+ OUT_RING (chan, NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLES);
+ VTX2s(pNv, tx1, ty1, tx1, ty1, sx1, sy1);
+ VTX2s(pNv, tx2+(tx2-tx1), ty1, tx2+(tx2-tx1), ty1, sx2+(sx2-sx1), sy1);
+ VTX2s(pNv, tx1, ty2+(ty2-ty1), tx1, ty2+(ty2-ty1), sx1, sy2+(sy2-sy1));
+ BEGIN_RING(chan, fermi, NVC0_3D_VERTEX_END_GL, 1);
+ OUT_RING (chan, 0);
+
+ pbox++;
+ }
+
+ FIRE_RING (chan);
+ return Success;
+}
+
+void
+nvc0_xv_csc_update(NVPtr pNv, float yco, float *off, float *uco, float *vco)
+{
+ struct nouveau_channel *chan = pNv->chan;
+ struct nouveau_bo *bo = pNv->tesla_scratch;
+ struct nouveau_grobj *fermi = pNv->Nv3D;
+
+ if (MARK_RING(chan, 64, 2))
+ return;
+
+ BEGIN_RING(chan, fermi, NVC0_3D_CB_SIZE, 3);
+ OUT_RING (chan, 256);
+ if (OUT_RELOCh(chan, bo, CB_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR) ||
+ OUT_RELOCl(chan, bo, CB_OFFSET, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR)) {
+ MARK_UNDO(chan);
+ return;
+ }
+ BEGIN_RING(chan, fermi, NVC0_3D_CB_POS, 11);
+ OUT_RING (chan, 0);
+ OUT_RINGf (chan, yco);
+ OUT_RINGf (chan, off[0]);
+ OUT_RINGf (chan, off[1]);
+ OUT_RINGf (chan, off[2]);
+ OUT_RINGf (chan, uco[0]);
+ OUT_RINGf (chan, uco[1]);
+ OUT_RINGf (chan, uco[2]);
+ OUT_RINGf (chan, vco[0]);
+ OUT_RINGf (chan, vco[1]);
+ OUT_RINGf (chan, vco[2]);
+}