#define STATUS__PCI_FIFO_FREESPACE(n) (((n) & 0x3f) << 0)
#define STATUS__VERTICAL_RETRACE (1 << 6)
#define STATUS__CHUCK_BUSY (1 << 7)
#define STATUS__BRUCE_BUSY (1 << 8)
#define STATUS__GRAPHICS_BUSY (1 << 9)
#define STATUS__DISPLAYED_BUFFER(n) (((n) & 0x3) << 10)
#define STATUS__MEMORY_FIFO_FREESPACE(n) (((n) & 0xffff) << 12)
#define STATUS__SWAP_BUFFERS_PENDING(n) (((n) & 0x7) << 28)

#define INTRCTRL__INTERRUPT_ENABLE__HORIZONTAL_SYNC_RISING_EDGE (1 << 0)
#define INTRCTRL__INTERRUPT_ENABLE__HORIZONTAL_SYNC_FALLING_EDGE (1 << 1)
#define INTRCTRL__INTERRUPT_ENABLE__VERTICAL_SYNC_RISING_EDGE (1 << 2)
#define INTRCTRL__INTERRUPT_ENABLE__VERTICAL_SYNC_FALLING_EDGE (1 << 3)
#define INTRCTRL__INTERRUPT_ENABLE__PCI_FIFO_FULL (1 << 4)
#define INTRCTRL__INTERRUPT_ENABLE__USER_INTERRUPT_COMMAND (1 << 5)
#define INTRCTRL__INTERRUPT_GENERATED__HORIZONTAL_SYNC_RISING_EDGE (1 << 6)
#define INTRCTRL__INTERRUPT_GENERATED__HORIZONTAL_SYNC_FALLING_EDGE (1 << 7)
#define INTRCTRL__INTERRUPT_GENERATED__VERTICAL_SYNC_RISING_EDGE (1 << 8)
#define INTRCTRL__INTERRUPT_GENERATED__VERTICAL_SYNC_FALLING_EDGE (1 << 9)
#define INTRCTRL__INTERRUPT_GENERATED__PCI_FIFO_FULL (1 << 10)
#define INTRCTRL__INTERRUPT_GENERATED__USER_INTERRUPT_COMMAND (1 << 11)
#define INTRCTRL__USER_INTERRUPT_COMMAND_TAG(n) (((n) & 0xff) << 12)
#define INTRCTRL__EXTERNAL_PIN_PCI_INTA (1 << 31)

#define FBZCOLORPATH__RGB_SELECT__ITERATED_RGB (0 << 0)
#define FBZCOLORPATH__RGB_SELECT__BRUCE_COLOR_OUTPUT (1 << 0)
#define FBZCOLORPATH__RGB_SELECT__COLOR1_RGB (2 << 0)
#define FBZCOLORPATH__ALPHA_SELECT__ITERATED_A (0 << 2)
#define FBZCOLORPATH__ALPHA_SELECT__BRUCE_ALPHA_OUTPUT (1 << 2)
#define FBZCOLORPATH__ALPHA_SELECT__COLOR1_ALPHA (2 << 2)
#define FBZCOLORPATH__CC_LOCALSELECT__ITERATED_RGB (0 << 4)
#define FBZCOLORPATH__CC_LOCALSELECT__COLOR0_RGB (1 << 4)
#define FBZCOLORPATH__CCA_LOCALSELECT__ITERATED_ALPHA (0 << 5)
#define FBZCOLORPATH__CCA_LOCALSELECT__COLOR0_ALPHA (1 << 5)
#define FBZCOLORPATH__CCA_LOCALSELECT__CLAMPED_ITERATED (2 << 5)
#define FBZCOLORPATH__CCA_LOCALSELECT__CLAMPED_ITERATED_W (3 << 5)
#define FBZCOLORPATH__CC_LOCALSELECT_OVERRIDE (1 << 7)
#define FBZCOLORPATH__CC_ZERO_OTHER (1 << 8)
#define FBZCOLORPATH__CC_SUB_CLOCAL (1 << 9)
#define FBZCOLORPATH__CC_MSELECT__ZERO (0 << 10)
#define FBZCOLORPATH__CC_MSELECT__C_LOCAL (1 << 10)
#define FBZCOLORPATH__CC_MSELECT__A_OTHER (2 << 10)
#define FBZCOLORPATH__CC_MSELECT__A_LOCAL (3 << 10)
#define FBZCOLORPATH__CC_MSELECT__TEXTURE_ALPHA (4 << 10)
#define FBZCOLORPATH__CC_MSELECT__TEXTURE_RGB (5 << 10)
#define FBZCOLORPATH__CC_REVERSE_BLEND (1 << 13)
#define FBZCOLORPATH__CC_ADD_CLOCAL (1 << 14)
#define FBZCOLORPATH__CC_ADD_ALOCAL (1 << 15)
#define FBZCOLORPATH__CC_INVERT_OUTPUT (1 << 16)
#define FBZCOLORPATH__CCA_ZERO_OTHER (1 << 17)
#define FBZCOLORPATH__CCA_SUB_CLOCAL (1 << 18)
#define FBZCOLORPATH__CCA_MSELECT__ZERO (0 << 19)
#define FBZCOLORPATH__CCA_MSELECT__A_LOCAL (1 << 19)
#define FBZCOLORPATH__CCA_MSELECT__A_OTHER (2 << 19)
#define FBZCOLORPATH__CCA_MSELECT__TEXTURE_ALPHA (4 << 19)
#define FBZCOLORPATH__CCA_REVERSE_BLEND (1 << 22)
#define FBZCOLORPATH__CCA_ADD_CLOCAL (1 << 23)
#define FBZCOLORPATH__CCA_ADD_ALOCAL (1 << 24)
#define FBZCOLORPATH__CCA_INVERT_OUTPUT (1 << 25)
#define FBZCOLORPATH__PARAMETER_ADJUST (1 << 26)
#define FBZCOLORPATH__ENABLE_TEXTURE_MAPPING (1 << 27)
#define FBZCOLORPATH__ENABLE_RGBA_Z_W_CLAMPING (1 << 28)
#define FBZCOLORPATH__ENABLE_ANTI_ALIASING (1 << 29)

#define FOGMODE__ENABLE_FOG (1 << 0)
#define FOGMODE__FOGADD (1 << 1)
#define FOGMODE__FOGMULT (1 << 2)
#define FOGMODE__FOGALPHA (1 << 3)
#define FOGMODE__FOGZ (1 << 4)
#define FOGMODE__FOGCONSTANT (1 << 5)
#define FOGMODE__FOGDITHER (1 << 6)
#define FOGMODE__FOGZONES (1 << 7)

#define ALPHAMODE__ENABLE_ALPHA_FUNCTION (1 << 0)
#define ALPHAMODE__ALPHA_FUNCTION__NEVER (0 << 1)
#define ALPHAMODE__ALPHA_FUNCTION__LESS_THAN (1 << 1)
#define ALPHAMODE__ALPHA_FUNCTION__EQUAL (2 << 1)
#define ALPHAMODE__ALPHA_FUNCTION__LESS_THAN_OR_EQUAL (3 << 1)
#define ALPHAMODE__ALPHA_FUNCTION__GREATER_THAN (4 << 1)
#define ALPHAMODE__ALPHA_FUNCTION__NOT_EQUAL (5 << 1)
#define ALPHAMODE__ALPHA_FUNCTION__GREATER_THAN_OR_EQUAL (6 << 1)
#define ALPHAMODE__ALPHA_FUNCTION__ALWAYS (7 << 1)
#define ALPHAMODE__ENABLE_ALPHA_BLENDING (1 << 4)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_RGB__AZERO (0 << 8)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_RGB__ASRC_ALPHA (1 << 8)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_RGB__A_COLOR (2 << 8)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_RGB__ADST_ALPHA (3 << 8)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_RGB__AONE (4 << 8)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_RGB__AOMSRC_ALPHA (5 << 8)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_RGB__AOM_COLOR (6 << 8)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_RGB__AOMDST_ALPHA (7 << 8)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_RGB__ASATURATE (15 << 8)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_RGB__AZERO (0 << 12)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_RGB__ASRC_ALPHA (1 << 12)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_RGB__A_COLOR (2 << 12)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_RGB__ADST_ALPHA (3 << 12)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_RGB__AONE (4 << 12)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_RGB__AOMSRC_ALPHA (5 << 12)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_RGB__AOM_COLOR (6 << 12)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_RGB__AOMDST_ALPHA (7 << 12)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_RGB__ACOLORBEFOREFOG (15 << 12)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_ALPHA__AZERO (0 << 16)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__SOURCE_ALPHA__AONE (4 << 16)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_ALPHA__AZERO (0 << 20)
#define ALPHAMODE__ALPHA_BLENDING_FACTOR__DESTINATION_ALPHA__AONE (4 << 20)
#define ALPHAMODE__ALPHA_REFERENCE_VALUE(n) (((n) & 0xff) << 24)

#define FBZMODE__ENABLE_CLIPPING_RECTANGLE (1 << 0)
#define FBZMODE__ENABLE_CHROMA_KEYING (1 << 1)
#define FBZMODE__ENABLE_STIPPLE_REGISTER_MASKING (1 << 2)
#define FBZMODE__FLOATING_POINT_DEPTH_BUFFER (1 << 3)
#define FBZMODE__ENABLE_DEPTH_BUFFERING (1 << 4)
#define FBZMODE__DEPTH_BUFFER_FUNCTION__NEVER (0 << 5)
#define FBZMODE__DEPTH_BUFFER_FUNCTION__LESS_THAN (1 << 5)
#define FBZMODE__DEPTH_BUFFER_FUNCTION__EQUAL (2 << 5)
#define FBZMODE__DEPTH_BUFFER_FUNCTION__LESS_THAN_OR_EQUAL (3 << 5)
#define FBZMODE__DEPTH_BUFFER_FUNCTION__GREATER_THAN (4 << 5)
#define FBZMODE__DEPTH_BUFFER_FUNCTION__NOT_EQUAL (5 << 5)
#define FBZMODE__DEPTH_BUFFER_FUNCTION__GREATER_THAN_OR_EQUAL (6 << 5)
#define FBZMODE__DEPTH_BUFFER_FUNCTION__ALWAYS (7 << 5)
#define FBZMODE__ENABLE_DITHERING (1 << 8)
#define FBZMODE__RGB_BUFFER_WRITE_MASK (1 << 9)
#define FBZMODE__DEPTH_ALPHA_BUFFER_WRITE_MASK (1 << 10)
#define FBZMODE__DITHER_ALGORITHM (1 << 11)
#define FBZMODE__ENABLE_STIPPLE_PATTERN_MASKING (1 << 12)
#define FBZMODE__ENABLE_ALPHA_CHANNEL_MASK (1 << 13)
#define FBZMODE__DRAW_BUFFER__FRONT_BUFFER (0 << 14)
#define FBZMODE__DRAW_BUFFER__BACK_BUFFER (1 << 14)
#define FBZMODE__ENABLE_DEPTH_BIASING (1 << 16)
#define FBZMODE__RENDERING_COMMANDS_Y_ORIGIN (1 << 17)
#define FBZMODE__ENABLE_ALPHA_PLANES (1 << 18)
#define FBZMODE__ENABLE_ALPHA_BLENDING_DITHER_SUBTRACTION (1 << 19)
#define FBZMODE__DEPTH_BUFFER_SOURCE_COMPARE_SELECT (1 << 20)
#define FBZMODE__DEPTH_FLOAT_SELECT (1 << 21)

#define LFBMODE__LINEAR_FRAME_BUFFER__WRITE_FORMAT__RGB565 (0 << 0)
#define LFBMODE__LINEAR_FRAME_BUFFER__WRITE_FORMAT__XRGB1555 (1 << 0)
#define LFBMODE__LINEAR_FRAME_BUFFER__WRITE_FORMAT__ARGB1555 (2 << 0)
#define LFBMODE__LINEAR_FRAME_BUFFER__WRITE_FORMAT__RGB888 (4 << 0)
#define LFBMODE__LINEAR_FRAME_BUFFER__WRITE_FORMAT__ARGB8888 (5 << 0)
#define LFBMODE__LINEAR_FRAME_BUFFER__WRITE_BUFFER_SELECT__FRONT_BUFFER (0 << 4)
#define LFBMODE__LINEAR_FRAME_BUFFER__WRITE_BUFFER_SELECT__BACK_BUFFER (1 << 4)
#define LFBMODE__LINEAR_FRAME_BUFFER__READ_BUFFER_SELECT__FRONT_BUFFER (0 << 6)
#define LFBMODE__LINEAR_FRAME_BUFFER__READ_BUFFER_SELECT__BACK_BUFFER (1 << 6)
#define LFBMODE__LINEAR_FRAME_BUFFER__ENABLE_PIXEL_PIPELINE_WRITES (1 << 8)
#define LFBMODE__LINEAR_FRAME_BUFFER__RGBA_LANES__ARGB (0 << 9)
#define LFBMODE__LINEAR_FRAME_BUFFER__RGBA_LANES__ABGR (1 << 9)
#define LFBMODE__LINEAR_FRAME_BUFFER__RGBA_LANES__RGBA (2 << 9)
#define LFBMODE__LINEAR_FRAME_BUFFER__RGBA_LANES__BGRA (3 << 9)
#define LFBMODE__LINEAR_FRAME_BUFFER__WORD_SWAP_WRITES (1 << 11)
#define LFBMODE__LINEAR_FRAME_BUFFER__BYTE_SWIZZLE_WRITES (1 << 12)
#define LFBMODE__LINEAR_FRAME_BUFFER__Y_ORIGIN (1 << 13)
#define LFBMODE__LINEAR_FRAME_BUFFER__WRITE_ACCESS_W_SELECT (1 << 14)
#define LFBMODE__LINEAR_FRAME_BUFFER__WORD_SWAP_READS (1 << 15)
#define LFBMODE__LINEAR_FRAME_BUFFER__BYTE_SWIZZLE_READS (1 << 16)

#define CLIPLEFTRIGHT__RIGHT(n) (((n) & 0xfff) << 0)
#define CLIPLEFTRIGHT__LEFT(n) (((n) & 0xfff) << 16)

#define CLIPLOWYHIGHY__HIGH_Y(n) (((n) & 0xfff) << 0)
#define CLIPLOWYHIGHY__LOW_Y(n) (((n) & 0xfff) << 16)

#define NOPCMD__CLEAR_REGISTERS (1 << 0)
#define NOPCMD__CLEAR_FBI_TRIANGLES_OUT (1 << 1)

#define SWAPBUFFERCMD__SYNCHRONIZE_FRAME_BUFFER_SWAPPING_TO_VERTICAL_RETRACE (1 << 0)
#define SWAPBUFFERCMD__SWAP_BUFFER_INTERVAL(n) (((n) & 0xff) << 1)
#define SWAPBUFFERCMD__DISABLE_BUFFER_SWAPPING (1 << 9)

#define FOGCOLOR__BLUE(n) (((n) & 0xff) << 0)
#define FOGCOLOR__GREEN(n) (((n) & 0xff) << 8)
#define FOGCOLOR__RED(n) (((n) & 0xff) << 16)

#define ZACOLOR__DEPTH(n) (((n) & 0xffff) << 0)
#define ZACOLOR__ALPHA(n) (((n) & 0xff) << 24)

#define CHROMAKEY__BLUE(n) (((n) & 0xff) << 0)
#define CHROMAKEY__GREEN(n) (((n) & 0xff) << 8)
#define CHROMAKEY__RED(n) (((n) & 0xff) << 16)

#define CHROMARANGE__BLUE(n) (((n) & 0xff) << 0)
#define CHROMARANGE__GREEN(n) (((n) & 0xff) << 8)
#define CHROMARANGE__RED(n) (((n) & 0xff) << 16)
#define CHROMARANGE__BLUE_MODE__INCLUSIVE (0 << 24)
#define CHROMARANGE__BLUE_MODE__EXCLUSIVE (1 << 24)
#define CHROMARANGE__GREEN_MODE__INCLUSIVE (0 << 25)
#define CHROMARANGE__GREEN_MODE__EXCLUSIVE (1 << 25)
#define CHROMARANGE__RED_MODE__INCLUSIVE (0 << 26)
#define CHROMARANGE__RED_MODE__EXCLUSIVE (1 << 26)
#define CHROMARANGE__BLOCK_MODE__INTERSECTION (0 << 27)
#define CHROMARANGE__BLOCK_MODE__UNION (1 << 27)
#define CHROMARANGE__ENABLE (1 << 28)

#define USERINTRCMD__GENERATE_USER_INTERRUPT (1 << 0)
#define USERINTRCMD__WAIT_FOR_INTERRUPT_GENERATED_BY_USER_INTERRUPT (1 << 1)
#define USERINTRCMD__USER_INTERRUPT_TAG(n) (((n) & 0xff) << 2)

#define COLOR0__BLUE(n) (((n) & 0xff) << 0)
#define COLOR0__GREEN(n) (((n) & 0xff) << 8)
#define COLOR0__RED(n) (((n) & 0xff) << 16)
#define COLOR0__ALPHA(n) (((n) & 0xff) << 24)

#define COLOR1__BLUE(n) (((n) & 0xff) << 0)
#define COLOR1__GREEN(n) (((n) & 0xff) << 8)
#define COLOR1__RED(n) (((n) & 0xff) << 16)
#define COLOR1__ALPHA(n) (((n) & 0xff) << 24)

#define FBISWAPHISTORY__NUMBER_OF_VERTICAL_SYNCS(n) (((n) & 0xf) << 0)
#define FBISWAPHISTORY__FRAME_N_1(n) (((n) & 0xf) << 4)
#define FBISWAPHISTORY__FRAME_N_2(n) (((n) & 0xf) << 8)
#define FBISWAPHISTORY__FRAME_N_3(n) (((n) & 0xf) << 12)
#define FBISWAPHISTORY__FRAME_N_4(n) (((n) & 0xf) << 16)
#define FBISWAPHISTORY__FRAME_N_5(n) (((n) & 0xf) << 20)
#define FBISWAPHISTORY__FRAME_N_6(n) (((n) & 0xf) << 24)
#define FBISWAPHISTORY__FRAME_N_7(n) (((n) & 0xf) << 28)

#define FOGTABLE__DELTA_FOG_BLENDING_FACTOR_2N(n) (((n) & 0xff) << 0)
#define FOGTABLE__FOG_BLENDING_FACTOR_2N(n) (((n) & 0xff) << 8)
#define FOGTABLE__DELTA_FOG_BLENDING_FACTOR_2N1(n) (((n) & 0xff) << 16)
#define FOGTABLE__FOG_BLENDING_FACTOR_2N1(n) (((n) & 0xff) << 24)

#define VRETRACE__V_SYNC_OFF_COUNTER(n) (((n) & 0x1fff) << 0)

#define HVRETRACE__V_SYNC_OFF_COUNTER(n) (((n) & 0x1fff) << 0)
#define HVRETRACE__H_RETRACE_COUNTER(n) (((n) & 0x7ff) << 16)

#define HSYNC__H_SYNC_ON(n) (((n) & 0x1ff) << 0)
#define HSYNC__H_SYNC_OFF(n) (((n) & 0x7ff) << 16)

#define VSYNC__V_SYNC_ON(n) (((n) & 0x1fff) << 0)
#define VSYNC__V_SYNC_OFF(n) (((n) & 0x1fff) << 16)

#define VIDEODIMENSIONS__X_WIDTH(n) (((n) & 0x7ff) << 0)
#define VIDEODIMENSIONS__Y_HEIGHT(n) (((n) & 0x7ff) << 16)

#define MAXRGBDELTA__BLUE(n) (((n) & 0xff) << 0)
#define MAXRGBDELTA__GREEN(n) (((n) & 0xff) << 8)
#define MAXRGBDELTA__RED(n) (((n) & 0xff) << 16)

#define HBORDER__H_BACK_COLOR(n) (((n) & 0x1ff) << 0)
#define HBORDER__H_FRONT_COLOR(n) (((n) & 0x1ff) << 16)

#define VBORDER__V_BACK_COLOR(n) (((n) & 0x1ff) << 0)
#define VBORDER__V_FRONT_COLOR(n) (((n) & 0x1ff) << 16)

#define BORDERCOLOR__BLUE(n) (((n) & 0xff) << 0)
#define BORDERCOLOR__GREEN(n) (((n) & 0xff) << 8)
#define BORDERCOLOR__RED(n) (((n) & 0xff) << 16)

#define FBIINIT0__VGA_PASSTHROUGH (1 << 0)
#define FBIINIT0__CHUCK_GRAPHICS_RESET (1 << 1)
#define FBIINIT0__CHUCK_FIFO_RESET (1 << 2)
#define FBIINIT0__BYTE_SWIZZLE_INCOMING_REGISTER_WRITES (1 << 3)
#define FBIINIT0__STALL_PCI_ENABLE_FOR_HIGH_WATER_MARK (1 << 4)
#define FBIINIT0__PCI_FIFO_EMPTY_ENTRIES_LOW_WATER_MARK(n) (((n) & 0x1f) << 6)
#define FBIINIT0__LINEAR_FRAME_BUFFER_ACCESSES_STORED_IN_MEMORY_FIFO (1 << 11)
#define FBIINIT0__TEXTURE_MEMORY_ACCESSES_STORED_IN_MEMORY_FIFO (1 << 12)
#define FBIINIT0__MEMORY_FIFO_ENABLE (1 << 13)
#define FBIINIT0__MEMORY_FIFO_HIGH_WATER_MARK(n) (((n) & 0x7ff) << 14)
#define FBIINIT0__MEMORY_FIFO_WRITE_BURST_HIGH_WATER_MARK(n) (((n) & 0x3f) << 25)

#define FBIINIT1__PCI_DEVICE_FUNCTION_NUMBER (1 << 0)
#define FBIINIT1__WAIT_STATE_CYCLES_FOR_PCI_WRITE_ACCESSES (1 << 1)
#define FBIINIT1__ENABLE_LINEAR_FRAME_BUFFER_READS (1 << 3)
#define FBIINIT1__NUMBER_OF_32X32_VIDEO_TILES_IN_HORIZONTAL_DIMENSION(n) (((n) & 0xf) << 4)
#define FBIINIT1__VIDEO_TIMING_RESET (1 << 8)
#define FBIINIT1__SOFTWARE_OVERRIDE_OF_HSYNC_VSYNC (1 << 9)
#define FBIINIT1__SOFTWARE_OVERRIDE_HSYNC_VALUE (1 << 10)
#define FBIINIT1__SOFTWARE_OVERRIDE_VSYNC_VALUE (1 << 11)
#define FBIINIT1__SOFTWARE_BLANKING_ENABLE (1 << 12)
#define FBIINIT1__DRIVE_VIDEO_TIMING_DATA_OUTPUTS (1 << 13)
#define FBIINIT1__DRIVE_VIDEO_TIMING_BLANK_OUTPUTS (1 << 14)
#define FBIINIT1__DRIVE_VIDEO_TIMING_HSYNC_VSYNC_OUTPUTS (1 << 15)
#define FBIINIT1__DRIVE_VIDEO_TIMING_DCLK_OUTPUT (1 << 16)
#define FBIINIT1__VIDEO_TIMING_VCLK_INPUT_SELECT (1 << 17)
#define FBIINIT1__VID_CLK_2X_DELAY_SELECT__NO_DELAY (0 << 18)
#define FBIINIT1__VID_CLK_2X_DELAY_SELECT__4NS (1 << 18)
#define FBIINIT1__VID_CLK_2X_DELAY_SELECT__6NS (2 << 18)
#define FBIINIT1__VID_CLK_2X_DELAY_SELECT__8NS (3 << 18)
#define FBIINIT1__VIDEO_TIMING_VCLK_SOURCE_SELECT__VID_CLK_SLAVE (0 << 20)
#define FBIINIT1__VIDEO_TIMING_VCLK_SOURCE_SELECT__VID_CLK_2X (1 << 20)
#define FBIINIT1__VIDEO_TIMING_VCLK_SOURCE_SELECT__VID_CLK_2X_SEL (2 << 20)
#define FBIINIT1__ENABLE_24_BITS_PER_PIXEL_VIDEO_OUTPUT (1 << 22)
#define FBIINIT1__ENABLE_SCAN_LINE_INTERLEAVING (1 << 23)
#define FBIINIT1__NUMBER_OF_32X32_VIDEO_TILES_IN_HORIZONTAL_DIMENSION_5 (1 << 24)
#define FBIINIT1__ENABLE_VIDEO_EDGE_DETECTION_FILTERING (1 << 25)
#define FBIINIT1__INVERT_VID_CLK_2X (1 << 26)
#define FBIINIT1__VID_CLK_2X_SEL_DELAY_SELECT__NO_DELAY (0 << 27)
#define FBIINIT1__VID_CLK_2X_SEL_DELAY_SELECT__4NS (1 << 27)
#define FBIINIT1__VID_CLK_2X_SEL_DELAY_SELECT__6NS (2 << 27)
#define FBIINIT1__VID_CLK_2X_SEL_DELAY_SELECT__8NS (3 << 27)
#define FBIINIT1__VID_CLK_DELAY_SELECT__NO_DELAY (0 << 29)
#define FBIINIT1__VID_CLK_DELAY_SELECT__4NS (1 << 29)
#define FBIINIT1__VID_CLK_DELAY_SELECT__6NS (2 << 29)
#define FBIINIT1__VID_CLK_DELAY_SELECT__8NS (3 << 29)
#define FBIINIT1__DISABLE_FAST_READ_AHEAD_WRITE_TO_READ_AHEAD_READ_TURNAROUND (1 << 31)

#define FBIINIT2__DISABLE_VIDEO_DITHER_SUBTRACTION (1 << 0)
#define FBIINIT2__DRAM_BANKING_CONFIGURATION (1 << 1)
#define FBIINIT2__TRIPLE_BUFFERING_ENABLE (1 << 4)
#define FBIINIT2__ENABLE_FAST_RAS_READ_CYCLES (1 << 5)
#define FBIINIT2__ENABLE_GENERATED_DRAM_OE_SIGNAL (1 << 6)
#define FBIINIT2__ENABLE_FAST_READ_AHEAD_WRITE_TURNAROUND (1 << 7)
#define FBIINIT2__ENABLE_PASS_THROUGH_DITHER_MODE (1 << 8)
#define FBIINIT2__SWAP_BUFFER_ALGORITHM__DAC_VSYNC (0 << 9)
#define FBIINIT2__SWAP_BUFFER_ALGORITHM__DAC_DATA (1 << 9)
#define FBIINIT2__SWAP_BUFFER_ALGORITHM__PCI_FIFO_STALL (2 << 9)
#define FBIINIT2__SWAP_BUFFER_ALGORITHM__SLI_SYNCIN_SYNCOUT (3 << 9)
#define FBIINIT2__VIDEO_BUFFER_OFFSET(n) (((n) & 0x1ff) << 11)
#define FBIINIT2__ENABLE_DRAM_BANKING (1 << 20)
#define FBIINIT2__ENABLE_DRAM_READ_AHEAD_FIFO (1 << 21)
#define FBIINIT2__REFRESH_ENABLE (1 << 22)
#define FBIINIT2__REFRESH_LOAD_VALUE(n) (((n) & 0x1ff) << 23)

#define FBIINIT3__TRIANGLE_REGISTER_ADDRESS_REMAPPING (1 << 0)
#define FBIINIT3__VIDEO_FIFO_THRESHOLD(n) (((n) & 0x1f) << 1)
#define FBIINIT3__DISABLE_TEXTURE_MAPPING (1 << 6)
#define FBIINIT3__GENERIC_POWER_ON_STRAPPING_PINS(n) (((n) & 0x7) << 8)
#define FBIINIT3__VGA_PASS_RESET_VALUE (1 << 11)
#define FBIINIT3__HARDCODE_PCI_BASE_ADDRESS (1 << 12)
#define FBIINIT3__FBI_TO_TREX_BUS_CLOCK_DELAY_SELECTIONS(n) (((n) & 0xf) << 13)
#define FBIINIT3__TREX_TO_FBI_BUS_FIFO_THRESHOLD(n) (((n) & 0x1f) << 17)
#define FBIINIT3__Y_ORIGIN_SWAP_SUBTRACTION_VALUE(n) (((n) & 0x3ff) << 22)

#define FBIINIT4__WAIT_STATE_CYCLES_FOR_PCI_READ_ACCESSES (1 << 0)
#define FBIINIT4__ENABLE_READ_AHEAD_LOGIC_FOR_LINEAR_FRAME_BUFFER_READS (1 << 1)
#define FBIINIT4__MEMORY_FIFO_LOW_WATER_MARK_FOR_PCI_FIFO(n) (((n) & 0x3f) << 2)
#define FBIINIT4__MEMORY_FIFO_ROW_START(n) (((n) & 0x3ff) << 8)
#define FBIINIT4__MEMORY_FIFO_ROW_ROLLOVER(n) (((n) & 0x3ff) << 18)
#define FBIINIT4__VIDEO_CLOCKING_DELAY_CONTROL(n) (((n) & 0x7) << 29)

#define FBIINIT5__DISABLE_PCI_STOP_FUNCTIONALITY (1 << 0)
#define FBIINIT5__PCI_SLAVE_DEVICE_IS_66MHZ_CAPABLE (1 << 1)
#define FBIINIT5__DAC_DATA_OUTPUT_WIDTH (1 << 2)
#define FBIINIT5__DAC_DATA_OUTPUT_VALUE_GPIO_0 (1 << 3)
#define FBIINIT5__DAC_DATA_CONTROL_4 (1 << 4)
#define FBIINIT5__GENERIC_POWER_ON_STRAPPING_PINS(n) (((n) & 0xf) << 5)
#define FBIINIT5__COLOR_AUX_BUFFER_MEMORY_ALLOCATION__2_COLOR_BUFFERS_1_AUX_BUFFER (0 << 9)
#define FBIINIT5__COLOR_AUX_BUFFER_MEMORY_ALLOCATION__3_COLOR_BUFFERS_0_AUX_BUFFERS (1 << 9)
#define FBIINIT5__COLOR_AUX_BUFFER_MEMORY_ALLOCATION__3_COLOR_BUFFERS_1_AUX_BUFFER (2 << 9)
#define FBIINIT5__DRIVE_VID_CLK_SLAVE_OUTPUT (1 << 11)
#define FBIINIT5__DRIVE_DAC_DATA_OUTPUT (1 << 12)
#define FBIINIT5__VIDEO_TIMING_VCLK_INPUT_SELECT (1 << 13)
#define FBIINIT5__MULTI_CVG_CONFIGURATION_DETECT (1 << 14)
#define FBIINIT5__SYNCHRONIZE_READS_FROM_HRETRACE_AND_VRETRACE (1 << 15)
#define FBIINIT5__HORIZONTAL_BORDER_COLOR_ENABLE_RIGHT_EDGE (1 << 16)
#define FBIINIT5__HORIZONTAL_BORDER_COLOR_ENABLE_LEFT_EDGE (1 << 17)
#define FBIINIT5__VERTICAL_BORDER_COLOR_ENABLE_BOTTOM_EDGE (1 << 18)
#define FBIINIT5__VERTICAL_BORDER_COLOR_ENABLE_TOP_EDGE (1 << 19)
#define FBIINIT5__SCAN_DOUBLE_VIDEO_OUT_IN_HORIZONTAL_DIMENSION (1 << 20)
#define FBIINIT5__SCAN_DOUBLE_VIDEO_OUT_IN_VERTICAL_DIMENSION (1 << 21)
#define FBIINIT5__ENABLE_GAMMA_CORRECTION_FOR_16_BIT_VIDEO_OUTPUT (1 << 22)
#define FBIINIT5__INVERT_DAC_HSYNC_OUTPUT_TO_DAC (1 << 23)
#define FBIINIT5__INVERT_DAC_VSYNC_OUTPUT_TO_DAC (1 << 24)
#define FBIINIT5__ENABLE_FULL_24_BIT_DAC_DATA_OUTPUT (1 << 25)
#define FBIINIT5__INTERLACED_VIDEO_OUTPUT (1 << 26)
#define FBIINIT5__DAC_DATA_CONTROL_27 (1 << 27)
#define FBIINIT5__TRIANGLE_RASTERIZATION_UNIT_MODE(n) (((n) & 0x3) << 30)

#define FBIINIT6__VIDEO_WINDOW_ACTIVE_COUNTER(n) (((n) & 0x7) << 0)
#define FBIINIT6__VIDEO_WINDOW_DRAG_COUNTER(n) (((n) & 0x1f) << 3)
#define FBIINIT6__SCANLINE_INTERLEAVE_SYNC_MASTER (1 << 8)
#define FBIINIT6__DAC_DATA_OUTPUT_VALUE_GPIO_2(n) (((n) & 0x3) << 9)
#define FBIINIT6__DAC_DATA_OUTPUT_VALUE_GPIO_3(n) (((n) & 0x3) << 11)
#define FBIINIT6__SLI_SYNCIN_OUTPUT_VALUE(n) (((n) & 0x3) << 13)
#define FBIINIT6__SLI_SYNCOUT_OUTPUT_VALUE(n) (((n) & 0x3) << 15)
#define FBIINIT6__DAC_RD_OUTPUT_VALUE(n) (((n) & 0x3) << 17)
#define FBIINIT6__DAC_WR_OUTPUT_VALUE(n) (((n) & 0x3) << 19)
#define FBIINIT6__PCI_FIFO_EMPTY_ENTRIES_LOW_WATER_MARK(n) (((n) & 0x7f) << 21)
#define FBIINIT6__VGA_PASS_N_OUTPUT_VALUE(n) (((n) & 0x3) << 28)
#define FBIINIT6__NUMBER_OF_32X32_VIDEO_TILES_IN_HORIZONTAL_DIMENSION (1 << 30)

#define FBIINIT7__CMDFIFO_ENABLE (1 << 8)
#define FBIINIT7__CMDFIFO_OFFSCREEN_MEMORY_STORE (1 << 9)
#define FBIINIT7__DISABLE_INTERNAL_CMDFIFO_HOLE_COUNTING_LOGIC (1 << 10)
#define FBIINIT7__CMDFIFO_READ_FETCH_THRESHOLD(n) (((n) & 0x1f) << 11)
#define FBIINIT7__SYNCHRONIZE_WRITES_TO_CMDFIFO_REGISTERS (1 << 16)
#define FBIINIT7__SYNCHRONIZE_READS_TO_CMDFIFO_REGISTERS (1 << 17)
#define FBIINIT7__RESET_PCI_PACKER (1 << 18)
#define FBIINIT7__ENABLE_CHROMAKEY_AND_CHROMARANGE_WRITES (1 << 19)
#define FBIINIT7__CMDFIFO_PCI_TIMEOUT_COUNTER_VALUE(n) (((n) & 0x7f) << 20)
#define FBIINIT7__ENABLE_BURSTING_OF_CONSECUTIVE_TEXTURE_MEMORY_WRITES (1 << 27)

#define CMDFIFOBASEADDR__CMDFIFO_BASE_ADDRESS(n) (((n) & 0x3ff) << 0)
#define CMDFIFOBASEADDR__CMDFIFO_END_ADDRESS(n) (((n) & 0x3ff) << 16)

#define CLUTDATA__BLUE(n) (((n) & 0xff) << 0)
#define CLUTDATA__GREEN(n) (((n) & 0xff) << 8)
#define CLUTDATA__RED(n) (((n) & 0xff) << 16)
#define CLUTDATA__INDEX(n) (((n) & 0x3f) << 24)

#define DACDATA__WRITE_DATA(n) (((n) & 0xff) << 0)
#define DACDATA__ADDRESS_2_0(n) (((n) & 0x7) << 8)
#define DACDATA__READ_COMMAND (1 << 11)
#define DACDATA__ADDRESS_4_3(n) (((n) & 0x3) << 12)

#define SSETUPMODE__SETUP_RED_GREEN_BLUE (1 << 0)
#define SSETUPMODE__SETUP_ALPHA (1 << 1)
#define SSETUPMODE__SETUP_Z (1 << 2)
#define SSETUPMODE__SETUP_WB (1 << 3)
#define SSETUPMODE__SETUP_W0 (1 << 4)
#define SSETUPMODE__SETUP_S0_AND_T0 (1 << 5)
#define SSETUPMODE__SETUP_W1 (1 << 6)
#define SSETUPMODE__SETUP_S1_AND_T1 (1 << 7)
#define SSETUPMODE__STRIP_MODE (1 << 16)
#define SSETUPMODE__ENABLE_CULLING (1 << 17)
#define SSETUPMODE__CULLING_SIGN (1 << 18)
#define SSETUPMODE__DISABLE_PING_PONG_SIGN_CORRECTION (1 << 19)

#define SARGB__ALPHA(n) (((n) & 0xff) << 24)
#define SARGB__RED(n) (((n) & 0xff) << 16)
#define SARGB__GREEN(n) (((n) & 0xff) << 8)
#define SARGB__BLUE(n) (((n) & 0xff) << 0)

#define TEXTUREMODE__ENABLE_PERSPECTIVE_CORRECTION_FOR_S_AND_T (1 << 0)
#define TEXTUREMODE__TEXTURE_MINIFICATION_FILTER (1 << 1)
#define TEXTUREMODE__TEXTURE_MAGNIFICATION_FILTER (1 << 2)
#define TEXTUREMODE__CLAMP_WHEN_W_IS_NEGATIVE (1 << 3)
#define TEXTUREMODE__ENABLE_LEVEL_OF_DETAIL_DITHERING (1 << 4)
#define TEXTUREMODE__NARROW_CHANNEL_COMPRESSED (1 << 5)
#define TEXTUREMODE__CLAMP_S_ITERATOR (1 << 6)
#define TEXTUREMODE__CLAMP_T_ITERATOR (1 << 7)
#define TEXTUREMODE__TEXTURE_FORMAT(n) (((n) & 0xf) << 8)
#define TEXTUREMODE__TEXTURE_COLOR__ZERO_OTHER (1 << 12)
#define TEXTUREMODE__TEXTURE_COLOR__SUBTRACT_COLOR_LOCAL (1 << 13)
#define TEXTUREMODE__TEXTURE_COLOR__MUX_SELECT(n) (((n) & 0x7) << 14)
#define TEXTUREMODE__TEXTURE_COLOR__REVERSE_BLEND (1 << 17)
#define TEXTUREMODE__TEXTURE_COLOR__ADD_COLOR_LOCAL (1 << 18)
#define TEXTUREMODE__TEXTURE_COLOR__ADD_ALPHA_LOCAL (1 << 19)
#define TEXTUREMODE__TEXTURE_COLOR__INVERT_OUTPUT (1 << 20)
#define TEXTUREMODE__TEXTURE_ALPHA__ZERO_OTHER (1 << 21)
#define TEXTUREMODE__TEXTURE_ALPHA__SUBTRACT_COLOR_LOCAL (1 << 22)
#define TEXTUREMODE__TEXTURE_ALPHA__MUX_SELECT(n) (((n) & 0x7) << 23)
#define TEXTUREMODE__TEXTURE_ALPHA__REVERSE_BLEND (1 << 26)
#define TEXTUREMODE__TEXTURE_ALPHA__ADD_COLOR_LOCAL (1 << 27)
#define TEXTUREMODE__TEXTURE_ALPHA__ADD_ALPHA_LOCAL (1 << 28)
#define TEXTUREMODE__TEXTURE_ALPHA__INVERT_OUTPUT (1 << 29)
#define TEXTUREMODE__ENABLE_TRILINEAR_TEXTURE_MAPPING (1 << 30)
#define TEXTUREMODE__SEQUENTIAL_8_BIT_DOWNLOAD (1 << 31)

#define TLOD__MINIMUM_LOD(n) (((n) & 0x3f) << 0)
#define TLOD__MAXIMUM_LOD(n) (((n) & 0x3f) << 6)
#define TLOD__LOD_BIAS(n) (((n) & 0x3f) << 12)
#define TLOD__LOD_ODD (1 << 18)
#define TLOD__TEXTURE_IS_SPLIT (1 << 19)
#define TLOD__S_DIMENSION_IS_WIDER (1 << 20)
#define TLOD__ASPECT_RATIO(n) (((n) & 0x3) << 21)
#define TLOD__LOD_ZERO_FRAC (1 << 23)
#define TLOD__USE_MULTIPLE_TEXBASEADDR_REGISTERS (1 << 24)
#define TLOD__BYTE_SWAP_INCOMING_TEXTURE_DATA (1 << 25)
#define TLOD__SHORT_SWAP_INCOMING_TEXTURE_DATA (1 << 26)
#define TLOD__ENABLE_RAW_DIRECT_TEXTURE_MEMORY_WRITES (1 << 27)

#define TDETAIL__DETAIL_TEXTURE_LOD_CLAMP(n) (((n) & 0xff) << 0)
#define TDETAIL__DETAIL_TEXTURE_BIAS(n) (((n) & 0x3f) << 8)
#define TDETAIL__DETAIL_TEXTURE_SCALE_SHIFT_LEFT(n) (((n) & 0x7) << 14)
#define TDETAIL__RGB_TEXTURE_MINIFICATION_FILTER (1 << 17)
#define TDETAIL__RGB_TEXTURE_MAGNIFICATION_FILTER (1 << 18)
#define TDETAIL__ALPHA_TEXTURE_MINIFICATION_FILTER (1 << 19)
#define TDETAIL__ALPHA_TEXTURE_MAGNIFICATION_FILTER (1 << 20)
#define TDETAIL__TMINFILTER_AND_TMAGFILTER (1 << 21)
