xf86-video-ati: Branch 'master' - 3 commits

Alex Deucher agd5f at kemper.freedesktop.org
Tue Feb 26 11:46:09 PST 2008


 src/radeon_commonfuncs.c         |    7 ++++---
 src/radeon_exa.c                 |   15 ---------------
 src/radeon_exa_render.c          |   15 +++++++++------
 src/radeon_reg.h                 |   11 +++++++++++
 src/radeon_textured_video.c      |   15 ---------------
 src/radeon_textured_videofuncs.c |   16 +++++++++-------
 6 files changed, 33 insertions(+), 46 deletions(-)

New commits:
commit b4fa1ce9d2da04d94521a82d3c2e95f0fe985ccc
Author: Alex Deucher <alex at samba.(none)>
Date:   Tue Feb 26 14:45:25 2008 -0500

    R300/R500: fix up clipping
    
    Based on patch from Peter Zubaj.

diff --git a/src/radeon_commonfuncs.c b/src/radeon_commonfuncs.c
index f6f6b06..0250aef 100644
--- a/src/radeon_commonfuncs.c
+++ b/src/radeon_commonfuncs.c
@@ -206,15 +206,16 @@ static void FUNC_NAME(RADEONInit3DEngine)(ScrnInfoPtr pScrn)
 					 (8191 << R300_SCISSOR_Y_SHIFT)));
 
 	if (IS_R300_VARIANT || (info->ChipFamily == CHIP_FAMILY_RS690)) {
+	    /* 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, ((4080 << R300_CLIP_X_SHIFT) |
-					     (2040 << R300_CLIP_Y_SHIFT)));
+	    OUT_ACCEL_REG(R300_SC_CLIP_0_B, (((1080 + 2048) << R300_CLIP_X_SHIFT) |
+					     ((1080 + 2048) << 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) |
-					     (2040 << R300_CLIP_Y_SHIFT)));
+					     (4080 << R300_CLIP_Y_SHIFT)));
 	}
 	OUT_ACCEL_REG(R300_SC_CLIP_RULE, 0xAAAA);
 	OUT_ACCEL_REG(R300_SC_SCREENDOOR, 0xffffff);
commit 44e527a117ab0a363135ff066c7f7e0c12e3dc89
Author: Alex Deucher <alex at samba.(none)>
Date:   Tue Feb 26 14:33:24 2008 -0500

    R300: fix cordinate clamping in render code
    
    Based on Peter's fix for textured video

diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 4ea451d..4da4841 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -105,21 +105,6 @@ RADEONLog2(int val)
 	return bits - 1;
 }
 
-static __inline__ int
-RADEONPow2(int num)
-{
-    int pot = 2;
-
-    if (num <= 2)
-	return num;
-
-    while (pot < num) {
-	pot *= 2;
-    }
-
-    return pot;
-}
-
 static __inline__ CARD32 F_TO_DW(float val)
 {
     union {
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
index 30e3329..9bbccb5 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -809,8 +809,8 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
 
     txformat1 = R300TexFormats[i].card_fmt;
 
-    txformat0 = (((RADEONPow2(w) - 1) << R300_TXWIDTH_SHIFT) |
-		 ((RADEONPow2(h) - 1) << R300_TXHEIGHT_SHIFT));
+    txformat0 = (((w - 1) << R300_TXWIDTH_SHIFT) |
+		 ((h - 1) << R300_TXHEIGHT_SHIFT));
 
     if (pPict->repeat) {
 	ErrorF("repeat\n");
@@ -822,15 +822,18 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
 	txformat0 |= R300_TXPITCH_EN;
 
 
-    info->texW[unit] = RADEONPow2(w);
-    info->texH[unit] = RADEONPow2(h);
+    info->texW[unit] = w;
+    info->texH[unit] = h;
+
+    txfilter = (R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) |
+		R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST));
 
     switch (pPict->filter) {
     case PictFilterNearest:
-	txfilter = (R300_TX_MAG_FILTER_NEAREST | R300_TX_MIN_FILTER_NEAREST);
+	txfilter |= (R300_TX_MAG_FILTER_NEAREST | R300_TX_MIN_FILTER_NEAREST);
 	break;
     case PictFilterBilinear:
-	txfilter = (R300_TX_MAG_FILTER_LINEAR | R300_TX_MIN_FILTER_LINEAR);
+	txfilter |= (R300_TX_MAG_FILTER_LINEAR | R300_TX_MIN_FILTER_LINEAR);
 	break;
     default:
 	RADEON_FALLBACK(("Bad filter 0x%x\n", pPict->filter));
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index 8a14024..b3d689d 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -67,21 +67,6 @@ RADEONTilingEnabled(ScrnInfoPtr pScrn, PixmapPtr pPix)
 	}
 }
 
-static __inline__ int
-RADEONPow2(int num)
-{
-    int pot = 2;
-
-    if (num <= 2)
-	return num;
-
-    while (pot < num) {
-	pot *= 2;
-    }
-
-    return pot;
-}
-
 static __inline__ CARD32 F_TO_DW(float val)
 {
     union {
commit 00ec17ad53d7ad43f19c9b723794ac1b8ef86826
Author: Peter Zubaj <pzubaj at marticonet.sk>
Date:   Tue Feb 26 14:26:14 2008 -0500

    R300: Fix clamping and pitch for textured video

diff --git a/src/radeon_reg.h b/src/radeon_reg.h
index 78b6eed..046c52b 100644
--- a/src/radeon_reg.h
+++ b/src/radeon_reg.h
@@ -4067,6 +4067,17 @@
 
 #define R300_TX_INVALTAGS				0x4100
 #define R300_TX_FILTER0_0				0x4400
+#       define R300_TX_CLAMP_S(x)                       (x << 0)
+#       define R300_TX_CLAMP_T(x)                       (x << 3)
+#       define R300_TX_CLAMP_R(x)                       (x << 6)
+#       define R300_TX_CLAMP_WRAP                       0
+#       define R300_TX_CLAMP_MIRROR                     1
+#       define R300_TX_CLAMP_CLAMP_LAST                 2
+#       define R300_TX_CLAMP_MIRROR_CLAMP_LAST          3
+#       define R300_TX_CLAMP_CLAMP_BORDER               4
+#       define R300_TX_CLAMP_MIRROR_CLAMP_BORDER        5
+#       define R300_TX_CLAMP_CLAMP_GL                   6
+#       define R300_TX_CLAMP_MIRROR_CLAMP_GL            7
 #       define R300_TX_MAG_FILTER_NEAREST               (1 << 9)
 #       define R300_TX_MIN_FILTER_NEAREST               (1 << 11)
 #       define R300_TX_MAG_FILTER_LINEAR                (2 << 9)
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index 1c9b7e8..6e8661e 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -157,18 +157,20 @@ 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] = RADEONPow2(pPriv->src_w);
-	info->texH[0] = RADEONPow2(pPriv->src_h);
+	info->texW[0] = pPriv->src_w;
+	info->texH[0] = pPriv->src_h;
 
-	txfilter = (R300_TX_MAG_FILTER_LINEAR | R300_TX_MIN_FILTER_LINEAR);
+	txfilter = (R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) |
+		    R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST) |
+		    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;


More information about the xorg-commit mailing list