[PATCH] Fix texture video adapter for R300.

Peter Zubaj pzubaj at marticonet.sk
Tue Feb 26 04:36:37 PST 2008


---
 src/radeon_commonfuncs.c         |   22 ++++++++++++++++------
 src/radeon_reg.h                 |    2 +-
 src/radeon_textured_videofuncs.c |   17 +++++++++--------
 3 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/radeon_commonfuncs.c b/src/radeon_commonfuncs.c
index a829f4a..e4d9011 100644
--- a/src/radeon_commonfuncs.c
+++ b/src/radeon_commonfuncs.c
@@ -53,6 +53,7 @@
 static void FUNC_NAME(RADEONInit3DEngine)(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
+    unsigned int pipe_count;
     ACCEL_PREAMBLE();
 
     info->texW[0] = info->texH[0] = info->texW[1] = info->texH[1] = 1;
@@ -63,9 +64,16 @@ static void FUNC_NAME(RADEONInit3DEngine)(ScrnInfoPtr pScrn)
 	OUT_ACCEL_REG(R300_RB3D_ZCACHE_CTLSTAT, R300_ZC_FLUSH | R300_ZC_FREE);
 	OUT_ACCEL_REG(R300_WAIT_UNTIL, R300_WAIT_2D_IDLECLEAN | R300_WAIT_3D_IDLECLEAN);
 	FINISH_ACCEL();
-
-	BEGIN_ACCEL(3);
+	
+	pipe_count = 0;
+	
+	/* needs to be done for other cards too */
+	if (info->ChipFamily == CHIP_FAMILY_R300)
+	    pipe_count = 3;
+
+	BEGIN_ACCEL(3);					    
 	OUT_ACCEL_REG(R300_GB_TILE_CONFIG, (R300_ENABLE_TILING |
+					    (pipe_count << 1) |
 					    R300_TILE_SIZE_16 |
 					    R300_SUBPIXEL_1_16));
 	OUT_ACCEL_REG(R300_GB_SELECT, 0);
@@ -180,10 +188,12 @@ static void FUNC_NAME(RADEONInit3DEngine)(ScrnInfoPtr pScrn)
 					 (8191 << R300_SCISSOR_Y_SHIFT)));
 
 	if (IS_R300_VARIANT || (info->ChipFamily == CHIP_FAMILY_RS690)) {
-	    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, ((4080 << R300_CLIP_X_SHIFT) |
-					     (2040 << R300_CLIP_Y_SHIFT)));
+	    /* clip has offset 1440
+	       maximum is set to 2048 x 1536 */
+ 	    OUT_ACCEL_REG(R300_SC_CLIP_0_A, ((1080 << R300_CLIP_X_SHIFT) |
+					     (1080 << R300_CLIP_Y_SHIFT)));
+	    OUT_ACCEL_REG(R300_SC_CLIP_0_B, (((1080 + 2048) << R300_CLIP_X_SHIFT) |
+					     ((1080 + 1536) << R300_CLIP_Y_SHIFT)));
 	} else {
 	    OUT_ACCEL_REG(R300_SC_CLIP_0_A, ((0 << R300_CLIP_X_SHIFT) |
 					     (0 << R300_CLIP_Y_SHIFT)));
diff --git a/src/radeon_reg.h b/src/radeon_reg.h
index 5594841..c77a19e 100644
--- a/src/radeon_reg.h
+++ b/src/radeon_reg.h
@@ -3819,7 +3819,7 @@
 #define R600_BIOS_7_SCRATCH               0x1740
 
 #define R300_GB_TILE_CONFIG				0x4018
-#       define R300_ENABLE_TILING                       (1 << 1)
+#       define R300_ENABLE_TILING                       (1 << 0)
 #       define R300_TILE_SIZE_8                         (0 << 4)
 #       define R300_TILE_SIZE_16                        (1 << 4)
 #       define R300_TILE_SIZE_32                        (2 << 4)
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index 36951d5..9f065b1 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -156,18 +156,19 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
 
 	txformat1 |= R300_TX_FORMAT_YUV_TO_RGB_CLAMP;
 
-	txformat0 = (((RADEONPow2(pPriv->src_w) - 1) << R300_TXWIDTH_SHIFT) |
-		     ((RADEONPow2(pPriv->src_h) - 1) << R300_TXHEIGHT_SHIFT));
+	txformat0 = (((pPriv->src_w - 1) << R300_TXWIDTH_SHIFT) |
+		     ((pPriv->src_h - 1) << R300_TXHEIGHT_SHIFT));
 
 	txformat0 |= R300_TXPITCH_EN;
+		
+	info->texW[0] = pPriv->src_w;
+	info->texH[0] = pPriv->src_h;
 
-	info->texW[0] = RADEONPow2(pPriv->src_w);
-	info->texH[0] = RADEONPow2(pPriv->src_h);
+	/* set border to clamp mode */
+	txfilter = (2 << 0) | (2 << 3) | (R300_TX_MAG_FILTER_LINEAR | R300_TX_MIN_FILTER_LINEAR);
 
-	txfilter = (R300_TX_MAG_FILTER_LINEAR | R300_TX_MIN_FILTER_LINEAR);
-
-	txpitch = pPriv->src_w * 4;
-	txpitch >>= pixel_shift;
+	/* pitch is in pixels */
+	txpitch = pPriv->src_pitch / 2;
 	txpitch -= 1;
 
 	txoffset = pPriv->src_offset;
-- 
1.5.4.1


--=-s4VZrV0Xj4KVEK0lf2Aq--



More information about the xorg-driver-ati mailing list