summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alex@botch2.com>2008-04-10 17:08:50 -0400
committerAlex Deucher <alex@botch2.com>2008-04-10 17:08:50 -0400
commit6f8f75bd19ef1919c0291141675be2d0e29b3251 (patch)
treebc3583b960347f37a6971c482a5d46f70262a242
parent4b9234e1c4f7c7f419cb4245d64f3f9756c98bb6 (diff)
R3xx+: consolidate some common 3D code
-rw-r--r--src/radeon_commonfuncs.c16
-rw-r--r--src/radeon_exa_render.c18
-rw-r--r--src/radeon_textured_videofuncs.c19
3 files changed, 21 insertions, 32 deletions
diff --git a/src/radeon_commonfuncs.c b/src/radeon_commonfuncs.c
index deb2c991..69b35361 100644
--- a/src/radeon_commonfuncs.c
+++ b/src/radeon_commonfuncs.c
@@ -144,6 +144,22 @@ static void FUNC_NAME(RADEONInit3DEngine)(ScrnInfoPtr pScrn)
OUT_ACCEL_REG(R300_SU_DEPTH_OFFSET, 0);
FINISH_ACCEL();
+ /* setup the VAP */
+ BEGIN_ACCEL(5);
+ if (info->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_PVS_STATE_FLUSH_REG, 0);
+ OUT_ACCEL_REG(R300_VAP_CNTL, ((6 << R300_PVS_NUM_SLOTS_SHIFT) |
+ (5 << R300_PVS_NUM_CNTLRS_SHIFT) |
+ (4 << R300_PVS_NUM_FPUS_SHIFT) |
+ (12 << R300_VF_MAX_VTX_NUM_SHIFT)));
+ 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);
+ FINISH_ACCEL();
+
BEGIN_ACCEL(4);
OUT_ACCEL_REG(R300_US_W_FMT, 0);
OUT_ACCEL_REG(R300_US_OUT_FMT_1, (R300_OUT_FMT_UNUSED |
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
index 1158f89d..fab8f97e 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -1096,23 +1096,7 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
RADEON_SWITCH_TO_3D();
/* setup the VAP */
- if (info->has_tcl) {
- BEGIN_ACCEL(9);
- OUT_ACCEL_REG(R300_VAP_CNTL_STATUS, 0);
-
- } else {
- BEGIN_ACCEL(9);
- OUT_ACCEL_REG(R300_VAP_CNTL_STATUS, R300_PVS_BYPASS);
- }
-
- OUT_ACCEL_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0);
- OUT_ACCEL_REG(R300_VAP_CNTL, ((6 << R300_PVS_NUM_SLOTS_SHIFT) |
- (5 << R300_PVS_NUM_CNTLRS_SHIFT) |
- (4 << R300_PVS_NUM_FPUS_SHIFT) |
- (12 << R300_VF_MAX_VTX_NUM_SHIFT)));
- 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);
-
+ BEGIN_ACCEL(4);
if (info->has_tcl) {
OUT_ACCEL_REG(R300_VAP_PROG_STREAM_CNTL_0,
((R300_DATA_TYPE_FLOAT_2 << R300_DATA_TYPE_0_SHIFT) |
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index dbf85622..90f01e81 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -196,21 +196,10 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
txenable = R300_TEX_0_ENABLE;
/* setup the VAP */
- if (info->has_tcl) {
- BEGIN_VIDEO(27);
- OUT_VIDEO_REG(R300_VAP_CNTL_STATUS, 0);
- } else {
- BEGIN_VIDEO(10);
- OUT_VIDEO_REG(R300_VAP_CNTL_STATUS, R300_PVS_BYPASS);
- }
-
- OUT_VIDEO_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0);
- OUT_VIDEO_REG(R300_VAP_CNTL, ((6 << R300_PVS_NUM_SLOTS_SHIFT) |
- (5 << R300_PVS_NUM_CNTLRS_SHIFT) |
- (4 << R300_PVS_NUM_FPUS_SHIFT) |
- (12 << R300_VF_MAX_VTX_NUM_SHIFT)));
- OUT_VIDEO_REG(R300_VAP_VTE_CNTL, R300_VTX_XY_FMT | R300_VTX_Z_FMT);
- OUT_VIDEO_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0);
+ if (info->has_tcl)
+ BEGIN_VIDEO(22);
+ else
+ BEGIN_VIDEO(5);
if (info->has_tcl) {
OUT_VIDEO_REG(R300_VAP_PROG_STREAM_CNTL_0,