forked from KolibriOS/kolibrios
setup 3D engine
git-svn-id: svn://kolibrios.org@811 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
9040dc17ec
commit
ad395f70dd
@ -62,20 +62,23 @@ int Blit(blit_t *blit);
|
||||
|
||||
# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
|
||||
# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1)
|
||||
# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4)
|
||||
# define RADEON_GMC_BRUSH_NONE (15 << 4)
|
||||
# define RADEON_GMC_DST_16BPP (4 << 8)
|
||||
# define RADEON_GMC_DST_24BPP (5 << 8)
|
||||
# define RADEON_GMC_DST_32BPP (6 << 8)
|
||||
# define RADEON_GMC_DST_DATATYPE_SHIFT 8
|
||||
# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12)
|
||||
# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24)
|
||||
# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24)
|
||||
# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28)
|
||||
# define RADEON_GMC_WR_MSK_DIS (1 << 30)
|
||||
# define RADEON_ROP3_S 0x00cc0000
|
||||
# define RADEON_ROP3_P 0x00f00000
|
||||
# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4)
|
||||
# define RADEON_GMC_BRUSH_NONE (15 << 4)
|
||||
# define RADEON_GMC_DST_16BPP (4 << 8)
|
||||
# define RADEON_GMC_DST_24BPP (5 << 8)
|
||||
# define RADEON_GMC_DST_32BPP (6 << 8)
|
||||
# define RADEON_GMC_DST_DATATYPE_SHIFT 8
|
||||
# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12)
|
||||
# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24)
|
||||
# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24)
|
||||
# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28)
|
||||
# define RADEON_GMC_WR_MSK_DIS (1 << 30)
|
||||
# define RADEON_ROP3_S 0x00cc0000
|
||||
# define RADEON_ROP3_P 0x00f00000
|
||||
|
||||
#define RADEON_CP_PACKET0 0x00000000
|
||||
#define RADEON_CP_PACKET1 0x40000000
|
||||
#define RADEON_CP_PACKET2 0x80000000
|
||||
#define RADEON_CP_PACKET3 0xC0000000
|
||||
|
||||
# define RADEON_CNTL_PAINT 0x00009100
|
||||
@ -84,6 +87,15 @@ int Blit(blit_t *blit);
|
||||
# define RADEON_CNTL_PAINT_POLYLINE 0x00009500
|
||||
# define RADEON_CNTL_PAINT_MULTI 0x00009A00
|
||||
|
||||
#define CP_PACKET0(reg, n) \
|
||||
(RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
|
||||
|
||||
#define CP_PACKET1(reg0, reg1) \
|
||||
(RADEON_CP_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2))
|
||||
|
||||
#define CP_PACKET2() \
|
||||
(RADEON_CP_PACKET2)
|
||||
|
||||
#define CP_PACKET3( pkt, n ) \
|
||||
(RADEON_CP_PACKET3 | (pkt) | ((n) << 16))
|
||||
|
||||
@ -92,10 +104,18 @@ int Blit(blit_t *blit);
|
||||
write = rhd.ring_wp; \
|
||||
} while (0)
|
||||
|
||||
#define ADVANCE_RING()
|
||||
|
||||
#define OUT_RING( x ) do { \
|
||||
ring[write++] = (x); \
|
||||
} while (0)
|
||||
|
||||
#define OUT_RING_REG(reg, val) \
|
||||
do { \
|
||||
OUT_RING(CP_PACKET0(reg, 0)); \
|
||||
OUT_RING(val); \
|
||||
} while (0)
|
||||
|
||||
#define DRM_MEMORYBARRIER() __asm volatile("lock; addl $0,0(%%esp)" : : : "memory");
|
||||
|
||||
#define COMMIT_RING() do { \
|
||||
|
671
programs/system/drivers/ati2d/accel_3d.inc
Normal file
671
programs/system/drivers/ati2d/accel_3d.inc
Normal file
@ -0,0 +1,671 @@
|
||||
|
||||
#include "radeon_reg.h"
|
||||
|
||||
#define BEGIN_ACCEL(n) BEGIN_RING(2*(n))
|
||||
//#define FINISH_ACCEL() ADVANCE_RING()
|
||||
#define FINISH_ACCEL() COMMIT_RING()
|
||||
|
||||
#define OUT_ACCEL_REG(reg, val) OUT_RING_REG(reg, val)
|
||||
|
||||
#define IS_R300_3D 0
|
||||
#define IS_R500_3D 1
|
||||
|
||||
typedef enum {
|
||||
CHIP_FAMILY_UNKNOW,
|
||||
CHIP_FAMILY_LEGACY,
|
||||
CHIP_FAMILY_RADEON,
|
||||
CHIP_FAMILY_RV100,
|
||||
CHIP_FAMILY_RS100, /* U1 (IGP320M) or A3 (IGP320)*/
|
||||
CHIP_FAMILY_RV200,
|
||||
CHIP_FAMILY_RS200, /* U2 (IGP330M/340M/350M) or A4 (IGP330/340/345/350), RS250 (IGP 7000) */
|
||||
CHIP_FAMILY_R200,
|
||||
CHIP_FAMILY_RV250,
|
||||
CHIP_FAMILY_RS300, /* RS300/RS350 */
|
||||
CHIP_FAMILY_RV280,
|
||||
CHIP_FAMILY_R300,
|
||||
CHIP_FAMILY_R350,
|
||||
CHIP_FAMILY_RV350,
|
||||
CHIP_FAMILY_RV380, /* RV370/RV380/M22/M24 */
|
||||
CHIP_FAMILY_R420, /* R420/R423/M18 */
|
||||
CHIP_FAMILY_RV410, /* RV410, M26 */
|
||||
CHIP_FAMILY_RS400, /* xpress 200, 200m (RS400) Intel */
|
||||
CHIP_FAMILY_RS480, /* xpress 200, 200m (RS410/480/482/485) AMD */
|
||||
CHIP_FAMILY_RV515, /* rv515 */
|
||||
CHIP_FAMILY_R520, /* r520 */
|
||||
CHIP_FAMILY_RV530, /* rv530 */
|
||||
CHIP_FAMILY_R580, /* r580 */
|
||||
CHIP_FAMILY_RV560, /* rv560 */
|
||||
CHIP_FAMILY_RV570, /* rv570 */
|
||||
CHIP_FAMILY_RS600,
|
||||
CHIP_FAMILY_RS690,
|
||||
CHIP_FAMILY_RS740,
|
||||
CHIP_FAMILY_R600, /* r600 */
|
||||
CHIP_FAMILY_R630,
|
||||
CHIP_FAMILY_RV610,
|
||||
CHIP_FAMILY_RV630,
|
||||
CHIP_FAMILY_RV670,
|
||||
CHIP_FAMILY_RV620,
|
||||
CHIP_FAMILY_RV635,
|
||||
CHIP_FAMILY_RS780,
|
||||
CHIP_FAMILY_LAST
|
||||
} RADEONChipFamily;
|
||||
|
||||
static void Init3DEngine(RHDPtr rhdPtr)
|
||||
{
|
||||
// RADEONInfoPtr info = RADEONPTR(pScrn);
|
||||
u32_t gb_tile_config, su_reg_dest, vap_cntl;
|
||||
// ACCEL_PREAMBLE();
|
||||
|
||||
u32 *ring, write;
|
||||
|
||||
// info->texW[0] = info->texH[0] = info->texW[1] = info->texH[1] = 1;
|
||||
|
||||
if (IS_R300_3D || IS_R500_3D) {
|
||||
|
||||
BEGIN_ACCEL(3);
|
||||
OUT_ACCEL_REG(R300_RB3D_DSTCACHE_CTLSTAT, R300_DC_FLUSH_3D | R300_DC_FREE_3D);
|
||||
OUT_ACCEL_REG(R300_RB3D_ZCACHE_CTLSTAT, R300_ZC_FLUSH | R300_ZC_FREE);
|
||||
OUT_ACCEL_REG(RADEON_WAIT_UNTIL, RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_3D_IDLECLEAN);
|
||||
FINISH_ACCEL();
|
||||
|
||||
gb_tile_config = (R300_ENABLE_TILING | R300_TILE_SIZE_16 | R300_SUBPIXEL_1_16);
|
||||
|
||||
switch(rhdPtr->num_gb_pipes) {
|
||||
case 2: gb_tile_config |= R300_PIPE_COUNT_R300; break;
|
||||
case 3: gb_tile_config |= R300_PIPE_COUNT_R420_3P; break;
|
||||
case 4: gb_tile_config |= R300_PIPE_COUNT_R420; break;
|
||||
default:
|
||||
case 1: gb_tile_config |= R300_PIPE_COUNT_RV350; break;
|
||||
}
|
||||
|
||||
BEGIN_ACCEL(5);
|
||||
OUT_ACCEL_REG(R300_GB_TILE_CONFIG, gb_tile_config);
|
||||
OUT_ACCEL_REG(RADEON_WAIT_UNTIL, RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_3D_IDLECLEAN);
|
||||
OUT_ACCEL_REG(R300_DST_PIPE_CONFIG, R300_PIPE_AUTO_CONFIG);
|
||||
OUT_ACCEL_REG(R300_GB_SELECT, 0);
|
||||
OUT_ACCEL_REG(R300_GB_ENABLE, 0);
|
||||
FINISH_ACCEL();
|
||||
|
||||
if (IS_R500_3D) {
|
||||
su_reg_dest = ((1 << rhdPtr->num_gb_pipes) - 1);
|
||||
BEGIN_ACCEL(2);
|
||||
OUT_ACCEL_REG(R500_SU_REG_DEST, su_reg_dest);
|
||||
OUT_ACCEL_REG(R500_VAP_INDEX_OFFSET, 0);
|
||||
FINISH_ACCEL();
|
||||
}
|
||||
|
||||
BEGIN_ACCEL(3);
|
||||
OUT_ACCEL_REG(R300_RB3D_DSTCACHE_CTLSTAT, R300_DC_FLUSH_3D | R300_DC_FREE_3D);
|
||||
OUT_ACCEL_REG(R300_RB3D_ZCACHE_CTLSTAT, R300_ZC_FLUSH | R300_ZC_FREE);
|
||||
OUT_ACCEL_REG(RADEON_WAIT_UNTIL, RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_3D_IDLECLEAN);
|
||||
FINISH_ACCEL();
|
||||
|
||||
BEGIN_ACCEL(5);
|
||||
OUT_ACCEL_REG(R300_GB_AA_CONFIG, 0);
|
||||
OUT_ACCEL_REG(R300_RB3D_DSTCACHE_CTLSTAT, R300_DC_FLUSH_3D | R300_DC_FREE_3D);
|
||||
OUT_ACCEL_REG(R300_RB3D_ZCACHE_CTLSTAT, R300_ZC_FLUSH | R300_ZC_FREE);
|
||||
OUT_ACCEL_REG(R300_GB_MSPOS0, ((8 << R300_MS_X0_SHIFT) |
|
||||
(8 << R300_MS_Y0_SHIFT) |
|
||||
(8 << R300_MS_X1_SHIFT) |
|
||||
(8 << R300_MS_Y1_SHIFT) |
|
||||
(8 << R300_MS_X2_SHIFT) |
|
||||
(8 << R300_MS_Y2_SHIFT) |
|
||||
(8 << R300_MSBD0_Y_SHIFT) |
|
||||
(7 << R300_MSBD0_X_SHIFT)));
|
||||
OUT_ACCEL_REG(R300_GB_MSPOS1, ((8 << R300_MS_X3_SHIFT) |
|
||||
(8 << R300_MS_Y3_SHIFT) |
|
||||
(8 << R300_MS_X4_SHIFT) |
|
||||
(8 << R300_MS_Y4_SHIFT) |
|
||||
(8 << R300_MS_X5_SHIFT) |
|
||||
(8 << R300_MS_Y5_SHIFT) |
|
||||
(8 << R300_MSBD1_SHIFT)));
|
||||
FINISH_ACCEL();
|
||||
|
||||
BEGIN_ACCEL(5);
|
||||
OUT_ACCEL_REG(R300_GA_ENHANCE, R300_GA_DEADLOCK_CNTL | R300_GA_FASTSYNC_CNTL);
|
||||
OUT_ACCEL_REG(R300_GA_POLY_MODE, R300_FRONT_PTYPE_TRIANGE | R300_BACK_PTYPE_TRIANGE);
|
||||
OUT_ACCEL_REG(R300_GA_ROUND_MODE, (R300_GEOMETRY_ROUND_NEAREST |
|
||||
R300_COLOR_ROUND_NEAREST));
|
||||
OUT_ACCEL_REG(R300_GA_COLOR_CONTROL, (R300_RGB0_SHADING_GOURAUD |
|
||||
R300_ALPHA0_SHADING_GOURAUD |
|
||||
R300_RGB1_SHADING_GOURAUD |
|
||||
R300_ALPHA1_SHADING_GOURAUD |
|
||||
R300_RGB2_SHADING_GOURAUD |
|
||||
R300_ALPHA2_SHADING_GOURAUD |
|
||||
R300_RGB3_SHADING_GOURAUD |
|
||||
R300_ALPHA3_SHADING_GOURAUD));
|
||||
OUT_ACCEL_REG(R300_GA_OFFSET, 0);
|
||||
FINISH_ACCEL();
|
||||
|
||||
BEGIN_ACCEL(5);
|
||||
OUT_ACCEL_REG(R300_SU_TEX_WRAP, 0);
|
||||
OUT_ACCEL_REG(R300_SU_POLY_OFFSET_ENABLE, 0);
|
||||
OUT_ACCEL_REG(R300_SU_CULL_MODE, R300_FACE_NEG);
|
||||
OUT_ACCEL_REG(R300_SU_DEPTH_SCALE, 0x4b7fffff);
|
||||
OUT_ACCEL_REG(R300_SU_DEPTH_OFFSET, 0);
|
||||
FINISH_ACCEL();
|
||||
|
||||
/* setup the VAP */
|
||||
if (rhdPtr->has_tcl)
|
||||
vap_cntl = ((5 << R300_PVS_NUM_SLOTS_SHIFT) |
|
||||
(5 << R300_PVS_NUM_CNTLRS_SHIFT) |
|
||||
(9 << R300_VF_MAX_VTX_NUM_SHIFT));
|
||||
else
|
||||
vap_cntl = ((10 << R300_PVS_NUM_SLOTS_SHIFT) |
|
||||
(5 << R300_PVS_NUM_CNTLRS_SHIFT) |
|
||||
(5 << R300_VF_MAX_VTX_NUM_SHIFT));
|
||||
|
||||
if (rhdPtr->ChipSet == CHIP_FAMILY_RV515)
|
||||
vap_cntl |= (2 << R300_PVS_NUM_FPUS_SHIFT);
|
||||
else if ((rhdPtr->ChipSet == CHIP_FAMILY_RV530) ||
|
||||
(rhdPtr->ChipSet == CHIP_FAMILY_RV560))
|
||||
vap_cntl |= (5 << R300_PVS_NUM_FPUS_SHIFT);
|
||||
else if (rhdPtr->ChipSet == CHIP_FAMILY_R420)
|
||||
vap_cntl |= (6 << R300_PVS_NUM_FPUS_SHIFT);
|
||||
else if ((rhdPtr->ChipSet == CHIP_FAMILY_R520) ||
|
||||
(rhdPtr->ChipSet == CHIP_FAMILY_R580) ||
|
||||
(rhdPtr->ChipSet == CHIP_FAMILY_RV570))
|
||||
vap_cntl |= (8 << R300_PVS_NUM_FPUS_SHIFT);
|
||||
else
|
||||
vap_cntl |= (4 << R300_PVS_NUM_FPUS_SHIFT);
|
||||
|
||||
if (rhdPtr->has_tcl)
|
||||
BEGIN_ACCEL(15);
|
||||
else
|
||||
BEGIN_ACCEL(9);
|
||||
OUT_ACCEL_REG(R300_VAP_VTX_STATE_CNTL, 0);
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0);
|
||||
|
||||
if (rhdPtr->has_tcl)
|
||||
OUT_ACCEL_REG(R300_VAP_CNTL_STATUS, 0);
|
||||
else
|
||||
OUT_ACCEL_REG(R300_VAP_CNTL_STATUS, R300_PVS_BYPASS);
|
||||
OUT_ACCEL_REG(R300_VAP_CNTL, vap_cntl);
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0);
|
||||
OUT_ACCEL_REG(R300_VAP_VTE_CNTL, R300_VTX_XY_FMT | R300_VTX_Z_FMT);
|
||||
OUT_ACCEL_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0);
|
||||
|
||||
OUT_ACCEL_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0,
|
||||
((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_0_SHIFT) |
|
||||
(R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_0_SHIFT) |
|
||||
(R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_0_SHIFT) |
|
||||
(R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_0_SHIFT) |
|
||||
((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W)
|
||||
<< R300_WRITE_ENA_0_SHIFT) |
|
||||
(R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_1_SHIFT) |
|
||||
(R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_1_SHIFT) |
|
||||
(R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_1_SHIFT) |
|
||||
(R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_1_SHIFT) |
|
||||
((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W)
|
||||
<< R300_WRITE_ENA_1_SHIFT)));
|
||||
OUT_ACCEL_REG(R300_VAP_PROG_STREAM_CNTL_EXT_1,
|
||||
((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_2_SHIFT) |
|
||||
(R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_2_SHIFT) |
|
||||
(R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_2_SHIFT) |
|
||||
(R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_2_SHIFT) |
|
||||
((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W)
|
||||
<< R300_WRITE_ENA_2_SHIFT)));
|
||||
|
||||
if (rhdPtr->has_tcl) {
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_FLOW_CNTL_OPC, 0);
|
||||
OUT_ACCEL_REG(R300_VAP_GB_VERT_CLIP_ADJ, 0x3f800000);
|
||||
OUT_ACCEL_REG(R300_VAP_GB_VERT_DISC_ADJ, 0x3f800000);
|
||||
OUT_ACCEL_REG(R300_VAP_GB_HORZ_CLIP_ADJ, 0x3f800000);
|
||||
OUT_ACCEL_REG(R300_VAP_GB_HORZ_DISC_ADJ, 0x3f800000);
|
||||
OUT_ACCEL_REG(R300_VAP_CLIP_CNTL, R300_CLIP_DISABLE);
|
||||
}
|
||||
FINISH_ACCEL();
|
||||
|
||||
/* pre-load the vertex shaders */
|
||||
if (rhdPtr->has_tcl) {
|
||||
/* exa mask shader program */
|
||||
BEGIN_ACCEL(13);
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0);
|
||||
/* PVS inst 0 */
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_DST_OPCODE(R300_VE_ADD) |
|
||||
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
|
||||
R300_PVS_DST_OFFSET(0) |
|
||||
R300_PVS_DST_WE_X | R300_PVS_DST_WE_Y |
|
||||
R300_PVS_DST_WE_Z | R300_PVS_DST_WE_W));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(0) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_X) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_Y) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_Z) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_W)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(0) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(0) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
|
||||
/* PVS inst 1 */
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_DST_OPCODE(R300_VE_ADD) |
|
||||
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
|
||||
R300_PVS_DST_OFFSET(1) |
|
||||
R300_PVS_DST_WE_X | R300_PVS_DST_WE_Y |
|
||||
R300_PVS_DST_WE_Z | R300_PVS_DST_WE_W));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(6) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_X) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_Y) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_Z) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_W)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(6) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(6) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
|
||||
/* PVS inst 2 */
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_DST_OPCODE(R300_VE_ADD) |
|
||||
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
|
||||
R300_PVS_DST_OFFSET(2) |
|
||||
R300_PVS_DST_WE_X | R300_PVS_DST_WE_Y |
|
||||
R300_PVS_DST_WE_Z | R300_PVS_DST_WE_W));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(7) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_X) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_Y) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_Z) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_W)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(7) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(7) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
FINISH_ACCEL();
|
||||
|
||||
BEGIN_ACCEL(9);
|
||||
/* exa no mask instruction */
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_INDX_REG, 3);
|
||||
/* PVS inst 0 */
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_DST_OPCODE(R300_VE_ADD) |
|
||||
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
|
||||
R300_PVS_DST_OFFSET(0) |
|
||||
R300_PVS_DST_WE_X | R300_PVS_DST_WE_Y |
|
||||
R300_PVS_DST_WE_Z | R300_PVS_DST_WE_W));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(0) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_X) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_Y) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_Z) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_W)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(0) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(0) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
|
||||
/* PVS inst 1 */
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_DST_OPCODE(R300_VE_ADD) |
|
||||
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
|
||||
R300_PVS_DST_OFFSET(1) |
|
||||
R300_PVS_DST_WE_X | R300_PVS_DST_WE_Y |
|
||||
R300_PVS_DST_WE_Z | R300_PVS_DST_WE_W));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(6) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_X) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_Y) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_Z) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_W)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(6) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(6) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
FINISH_ACCEL();
|
||||
|
||||
/* Xv shader program */
|
||||
BEGIN_ACCEL(9);
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_INDX_REG, 5);
|
||||
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_DST_OPCODE(R300_VE_ADD) |
|
||||
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
|
||||
R300_PVS_DST_OFFSET(0) |
|
||||
R300_PVS_DST_WE_X | R300_PVS_DST_WE_Y |
|
||||
R300_PVS_DST_WE_Z | R300_PVS_DST_WE_W));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(0) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_X) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_Y) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_Z) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_W)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(0) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(0) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_DST_OPCODE(R300_VE_ADD) |
|
||||
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
|
||||
R300_PVS_DST_OFFSET(1) |
|
||||
R300_PVS_DST_WE_X | R300_PVS_DST_WE_Y |
|
||||
R300_PVS_DST_WE_Z | R300_PVS_DST_WE_W));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(6) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_X) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_Y) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_Z) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_W)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(6) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
OUT_ACCEL_REG(R300_VAP_PVS_VECTOR_DATA_REG,
|
||||
(R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(6) |
|
||||
R300_PVS_SRC_SWIZZLE_X(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Y(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_Z(R300_PVS_SRC_SELECT_FORCE_0) |
|
||||
R300_PVS_SRC_SWIZZLE_W(R300_PVS_SRC_SELECT_FORCE_0)));
|
||||
FINISH_ACCEL();
|
||||
}
|
||||
|
||||
/* pre-load the RS instructions */
|
||||
BEGIN_ACCEL(4);
|
||||
if (IS_R300_3D) {
|
||||
/* rasterizer source table
|
||||
* R300_RS_TEX_PTR is the offset into the input RS stream
|
||||
* 0,1 are tex0
|
||||
* 2,3 are tex1
|
||||
*/
|
||||
OUT_ACCEL_REG(R300_RS_IP_0,
|
||||
(R300_RS_TEX_PTR(0) |
|
||||
R300_RS_SEL_S(R300_RS_SEL_C0) |
|
||||
R300_RS_SEL_T(R300_RS_SEL_C1) |
|
||||
R300_RS_SEL_R(R300_RS_SEL_K0) |
|
||||
R300_RS_SEL_Q(R300_RS_SEL_K1)));
|
||||
OUT_ACCEL_REG(R300_RS_IP_1,
|
||||
(R300_RS_TEX_PTR(2) |
|
||||
R300_RS_SEL_S(R300_RS_SEL_C0) |
|
||||
R300_RS_SEL_T(R300_RS_SEL_C1) |
|
||||
R300_RS_SEL_R(R300_RS_SEL_K0) |
|
||||
R300_RS_SEL_Q(R300_RS_SEL_K1)));
|
||||
/* src tex */
|
||||
/* R300_INST_TEX_ID - select the RS source table entry
|
||||
* R300_INST_TEX_ADDR - the FS temp register for the texture data
|
||||
*/
|
||||
OUT_ACCEL_REG(R300_RS_INST_0, (R300_INST_TEX_ID(0) |
|
||||
R300_RS_INST_TEX_CN_WRITE |
|
||||
R300_INST_TEX_ADDR(0)));
|
||||
/* mask tex */
|
||||
OUT_ACCEL_REG(R300_RS_INST_1, (R300_INST_TEX_ID(1) |
|
||||
R300_RS_INST_TEX_CN_WRITE |
|
||||
R300_INST_TEX_ADDR(1)));
|
||||
|
||||
} else {
|
||||
/* rasterizer source table
|
||||
* R300_RS_TEX_PTR is the offset into the input RS stream
|
||||
* 0,1 are tex0
|
||||
* 2,3 are tex1
|
||||
*/
|
||||
OUT_ACCEL_REG(R500_RS_IP_0, ((0 << R500_RS_IP_TEX_PTR_S_SHIFT) |
|
||||
(1 << R500_RS_IP_TEX_PTR_T_SHIFT) |
|
||||
(R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) |
|
||||
(R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT)));
|
||||
|
||||
OUT_ACCEL_REG(R500_RS_IP_1, ((2 << R500_RS_IP_TEX_PTR_S_SHIFT) |
|
||||
(3 << R500_RS_IP_TEX_PTR_T_SHIFT) |
|
||||
(R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) |
|
||||
(R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT)));
|
||||
/* src tex */
|
||||
/* R500_RS_INST_TEX_ID_SHIFT - select the RS source table entry
|
||||
* R500_RS_INST_TEX_ADDR_SHIFT - the FS temp register for the texture data
|
||||
*/
|
||||
OUT_ACCEL_REG(R500_RS_INST_0, ((0 << R500_RS_INST_TEX_ID_SHIFT) |
|
||||
R500_RS_INST_TEX_CN_WRITE |
|
||||
(0 << R500_RS_INST_TEX_ADDR_SHIFT)));
|
||||
/* mask tex */
|
||||
OUT_ACCEL_REG(R500_RS_INST_1, ((1 << R500_RS_INST_TEX_ID_SHIFT) |
|
||||
R500_RS_INST_TEX_CN_WRITE |
|
||||
(1 << R500_RS_INST_TEX_ADDR_SHIFT)));
|
||||
}
|
||||
FINISH_ACCEL();
|
||||
|
||||
/* pre-load FS tex instructions */
|
||||
if (IS_R300_3D) {
|
||||
BEGIN_ACCEL(2);
|
||||
/* tex inst for src texture */
|
||||
OUT_ACCEL_REG(R300_US_TEX_INST_0,
|
||||
(R300_TEX_SRC_ADDR(0) |
|
||||
R300_TEX_DST_ADDR(0) |
|
||||
R300_TEX_ID(0) |
|
||||
R300_TEX_INST(R300_TEX_INST_LD)));
|
||||
|
||||
/* tex inst for mask texture */
|
||||
OUT_ACCEL_REG(R300_US_TEX_INST_1,
|
||||
(R300_TEX_SRC_ADDR(1) |
|
||||
R300_TEX_DST_ADDR(1) |
|
||||
R300_TEX_ID(1) |
|
||||
R300_TEX_INST(R300_TEX_INST_LD)));
|
||||
FINISH_ACCEL();
|
||||
}
|
||||
|
||||
if (IS_R300_3D) {
|
||||
BEGIN_ACCEL(9);
|
||||
OUT_ACCEL_REG(R300_US_CONFIG, (0 << R300_NLEVEL_SHIFT) | R300_FIRST_TEX);
|
||||
OUT_ACCEL_REG(R300_US_PIXSIZE, 1); /* highest temp used */
|
||||
OUT_ACCEL_REG(R300_US_CODE_ADDR_0,
|
||||
(R300_ALU_START(0) |
|
||||
R300_ALU_SIZE(0) |
|
||||
R300_TEX_START(0) |
|
||||
R300_TEX_SIZE(0)));
|
||||
OUT_ACCEL_REG(R300_US_CODE_ADDR_1,
|
||||
(R300_ALU_START(0) |
|
||||
R300_ALU_SIZE(0) |
|
||||
R300_TEX_START(0) |
|
||||
R300_TEX_SIZE(0)));
|
||||
OUT_ACCEL_REG(R300_US_CODE_ADDR_2,
|
||||
(R300_ALU_START(0) |
|
||||
R300_ALU_SIZE(0) |
|
||||
R300_TEX_START(0) |
|
||||
R300_TEX_SIZE(0)));
|
||||
} else {
|
||||
BEGIN_ACCEL(7);
|
||||
OUT_ACCEL_REG(R300_US_CONFIG, R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO);
|
||||
OUT_ACCEL_REG(R300_US_PIXSIZE, 1); /* highest temp used */
|
||||
OUT_ACCEL_REG(R500_US_FC_CTRL, 0);
|
||||
}
|
||||
OUT_ACCEL_REG(R300_US_W_FMT, 0);
|
||||
OUT_ACCEL_REG(R300_US_OUT_FMT_1, (R300_OUT_FMT_UNUSED |
|
||||
R300_OUT_FMT_C0_SEL_BLUE |
|
||||
R300_OUT_FMT_C1_SEL_GREEN |
|
||||
R300_OUT_FMT_C2_SEL_RED |
|
||||
R300_OUT_FMT_C3_SEL_ALPHA));
|
||||
OUT_ACCEL_REG(R300_US_OUT_FMT_2, (R300_OUT_FMT_UNUSED |
|
||||
R300_OUT_FMT_C0_SEL_BLUE |
|
||||
R300_OUT_FMT_C1_SEL_GREEN |
|
||||
R300_OUT_FMT_C2_SEL_RED |
|
||||
R300_OUT_FMT_C3_SEL_ALPHA));
|
||||
OUT_ACCEL_REG(R300_US_OUT_FMT_3, (R300_OUT_FMT_UNUSED |
|
||||
R300_OUT_FMT_C0_SEL_BLUE |
|
||||
R300_OUT_FMT_C1_SEL_GREEN |
|
||||
R300_OUT_FMT_C2_SEL_RED |
|
||||
R300_OUT_FMT_C3_SEL_ALPHA));
|
||||
FINISH_ACCEL();
|
||||
|
||||
|
||||
BEGIN_ACCEL(3);
|
||||
OUT_ACCEL_REG(R300_FG_DEPTH_SRC, 0);
|
||||
OUT_ACCEL_REG(R300_FG_FOG_BLEND, 0);
|
||||
OUT_ACCEL_REG(R300_FG_ALPHA_FUNC, 0);
|
||||
FINISH_ACCEL();
|
||||
|
||||
BEGIN_ACCEL(13);
|
||||
OUT_ACCEL_REG(R300_RB3D_ABLENDCNTL, 0);
|
||||
OUT_ACCEL_REG(R300_RB3D_ZSTENCILCNTL, 0);
|
||||
OUT_ACCEL_REG(R300_RB3D_ZCACHE_CTLSTAT, R300_ZC_FLUSH | R300_ZC_FREE);
|
||||
OUT_ACCEL_REG(R300_RB3D_BW_CNTL, 0);
|
||||
OUT_ACCEL_REG(R300_RB3D_ZCNTL, 0);
|
||||
OUT_ACCEL_REG(R300_RB3D_ZTOP, 0);
|
||||
OUT_ACCEL_REG(R300_RB3D_ROPCNTL, 0);
|
||||
|
||||
OUT_ACCEL_REG(R300_RB3D_AARESOLVE_CTL, 0);
|
||||
OUT_ACCEL_REG(R300_RB3D_COLOR_CHANNEL_MASK, (R300_BLUE_MASK_EN |
|
||||
R300_GREEN_MASK_EN |
|
||||
R300_RED_MASK_EN |
|
||||
R300_ALPHA_MASK_EN));
|
||||
OUT_ACCEL_REG(R300_RB3D_DSTCACHE_CTLSTAT, R300_DC_FLUSH_3D | R300_DC_FREE_3D);
|
||||
OUT_ACCEL_REG(R300_RB3D_CCTL, 0);
|
||||
OUT_ACCEL_REG(R300_RB3D_DITHER_CTL, 0);
|
||||
OUT_ACCEL_REG(R300_RB3D_DSTCACHE_CTLSTAT, R300_DC_FLUSH_3D | R300_DC_FREE_3D);
|
||||
FINISH_ACCEL();
|
||||
|
||||
BEGIN_ACCEL(7);
|
||||
OUT_ACCEL_REG(R300_SC_EDGERULE, 0xA5294A5);
|
||||
OUT_ACCEL_REG(R300_SC_SCISSOR0, ((0 << R300_SCISSOR_X_SHIFT) |
|
||||
(0 << R300_SCISSOR_Y_SHIFT)));
|
||||
OUT_ACCEL_REG(R300_SC_SCISSOR1, ((8191 << R300_SCISSOR_X_SHIFT) |
|
||||
(8191 << R300_SCISSOR_Y_SHIFT)));
|
||||
|
||||
if (IS_R300_3D) {
|
||||
/* clip has offset 1440 */
|
||||
OUT_ACCEL_REG(R300_SC_CLIP_0_A, ((1088 << R300_CLIP_X_SHIFT) |
|
||||
(1088 << R300_CLIP_Y_SHIFT)));
|
||||
OUT_ACCEL_REG(R300_SC_CLIP_0_B, (((1080 + 2920) << R300_CLIP_X_SHIFT) |
|
||||
((1080 + 2920) << R300_CLIP_Y_SHIFT)));
|
||||
} else {
|
||||
OUT_ACCEL_REG(R300_SC_CLIP_0_A, ((0 << R300_CLIP_X_SHIFT) |
|
||||
(0 << R300_CLIP_Y_SHIFT)));
|
||||
OUT_ACCEL_REG(R300_SC_CLIP_0_B, ((4080 << R300_CLIP_X_SHIFT) |
|
||||
(4080 << R300_CLIP_Y_SHIFT)));
|
||||
}
|
||||
OUT_ACCEL_REG(R300_SC_CLIP_RULE, 0xAAAA);
|
||||
OUT_ACCEL_REG(R300_SC_SCREENDOOR, 0xffffff);
|
||||
FINISH_ACCEL();
|
||||
} else if ((rhdPtr->ChipSet == CHIP_FAMILY_RV250) ||
|
||||
(rhdPtr->ChipSet == CHIP_FAMILY_RV280) ||
|
||||
(rhdPtr->ChipSet == CHIP_FAMILY_RS300) ||
|
||||
(rhdPtr->ChipSet == CHIP_FAMILY_R200)) {
|
||||
|
||||
BEGIN_ACCEL(7);
|
||||
if (rhdPtr->ChipSet == CHIP_FAMILY_RS300) {
|
||||
OUT_ACCEL_REG(R200_SE_VAP_CNTL_STATUS, RADEON_TCL_BYPASS);
|
||||
} else {
|
||||
OUT_ACCEL_REG(R200_SE_VAP_CNTL_STATUS, 0);
|
||||
}
|
||||
OUT_ACCEL_REG(R200_PP_CNTL_X, 0);
|
||||
OUT_ACCEL_REG(R200_PP_TXMULTI_CTL_0, 0);
|
||||
OUT_ACCEL_REG(R200_SE_VTX_STATE_CNTL, 0);
|
||||
OUT_ACCEL_REG(R200_RE_CNTL, 0x0);
|
||||
OUT_ACCEL_REG(R200_SE_VTE_CNTL, 0);
|
||||
OUT_ACCEL_REG(R200_SE_VAP_CNTL, R200_VAP_FORCE_W_TO_ONE |
|
||||
R200_VAP_VF_MAX_VTX_NUM);
|
||||
FINISH_ACCEL();
|
||||
|
||||
BEGIN_ACCEL(5);
|
||||
OUT_ACCEL_REG(RADEON_RE_TOP_LEFT, 0);
|
||||
OUT_ACCEL_REG(RADEON_RE_WIDTH_HEIGHT, 0x07ff07ff);
|
||||
OUT_ACCEL_REG(RADEON_AUX_SC_CNTL, 0);
|
||||
OUT_ACCEL_REG(RADEON_RB3D_PLANEMASK, 0xffffffff);
|
||||
OUT_ACCEL_REG(RADEON_SE_CNTL, (RADEON_DIFFUSE_SHADE_GOURAUD |
|
||||
RADEON_BFACE_SOLID |
|
||||
RADEON_FFACE_SOLID |
|
||||
RADEON_VTX_PIX_CENTER_OGL |
|
||||
RADEON_ROUND_MODE_ROUND |
|
||||
RADEON_ROUND_PREC_4TH_PIX));
|
||||
FINISH_ACCEL();
|
||||
} else {
|
||||
BEGIN_ACCEL(2);
|
||||
if ((rhdPtr->ChipSet == CHIP_FAMILY_RADEON) ||
|
||||
(rhdPtr->ChipSet == CHIP_FAMILY_RV200))
|
||||
OUT_ACCEL_REG(RADEON_SE_CNTL_STATUS, 0);
|
||||
else
|
||||
OUT_ACCEL_REG(RADEON_SE_CNTL_STATUS, RADEON_TCL_BYPASS);
|
||||
OUT_ACCEL_REG(RADEON_SE_COORD_FMT,
|
||||
RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
|
||||
RADEON_VTX_ST0_NONPARAMETRIC |
|
||||
RADEON_VTX_ST1_NONPARAMETRIC |
|
||||
RADEON_TEX1_W_ROUTING_USE_W0);
|
||||
FINISH_ACCEL();
|
||||
|
||||
BEGIN_ACCEL(5);
|
||||
OUT_ACCEL_REG(RADEON_RE_TOP_LEFT, 0);
|
||||
OUT_ACCEL_REG(RADEON_RE_WIDTH_HEIGHT, 0x07ff07ff);
|
||||
OUT_ACCEL_REG(RADEON_AUX_SC_CNTL, 0);
|
||||
OUT_ACCEL_REG(RADEON_RB3D_PLANEMASK, 0xffffffff);
|
||||
OUT_ACCEL_REG(RADEON_SE_CNTL, (RADEON_DIFFUSE_SHADE_GOURAUD |
|
||||
RADEON_BFACE_SOLID |
|
||||
RADEON_FFACE_SOLID |
|
||||
RADEON_VTX_PIX_CENTER_OGL |
|
||||
RADEON_ROUND_MODE_ROUND |
|
||||
RADEON_ROUND_PREC_4TH_PIX));
|
||||
FINISH_ACCEL();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,7 @@ void (__stdcall *old_restore)(int x, int y);
|
||||
cursor_t* (*old_create)(void);
|
||||
cursor_t* __create_cursor(void);
|
||||
|
||||
static void Init3DEngine(RHDPtr rhdPtr);
|
||||
|
||||
u32 __stdcall drvEntry(int action)
|
||||
{
|
||||
@ -64,6 +65,7 @@ u32 __stdcall drvEntry(int action)
|
||||
// old_create = HwCursorCreate;
|
||||
|
||||
R5xx2DInit();
|
||||
// Init3DEngine(&rhd);
|
||||
|
||||
//init_r500();
|
||||
|
||||
@ -167,6 +169,7 @@ int _stdcall srv_2d(ioctl_t *io)
|
||||
|
||||
#include "r500.inc"
|
||||
#include "accel_2d.inc"
|
||||
#include "accel_3d.inc"
|
||||
|
||||
#define CLIP_TOP 1
|
||||
#define CLIP_BOTTOM 2
|
||||
|
@ -125,6 +125,8 @@ typedef struct RHDRec
|
||||
u32 ring_rp;
|
||||
u32 ring_wp;
|
||||
|
||||
int num_gb_pipes;
|
||||
Bool has_tcl;
|
||||
}RHD_t, *RHDPtr;
|
||||
|
||||
extern RHD_t rhd;
|
||||
|
5273
programs/system/drivers/ati2d/radeon_reg.h
Normal file
5273
programs/system/drivers/ati2d/radeon_reg.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user