summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zubaj <pzubaj at marticonet.sk>2008-02-26 14:26:14 -0500
committerAlex Deucher <alex@samba.(none)>2008-02-26 14:26:14 -0500
commit00ec17ad53d7ad43f19c9b723794ac1b8ef86826 (patch)
treef37273fe3d7eee225057cfc9013daffa13859e5c
parent4207793f9b6c891cb17ba715223d2002668885e3 (diff)
R300: Fix clamping and pitch for textured video
-rw-r--r--src/radeon_reg.h11
-rw-r--r--src/radeon_textured_videofuncs.c16
2 files changed, 20 insertions, 7 deletions
diff --git a/src/radeon_reg.h b/src/radeon_reg.h
index 78b6eede..046c52bd 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 1c9b7e80..6e8661e9 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;