From 00ec17ad53d7ad43f19c9b723794ac1b8ef86826 Mon Sep 17 00:00:00 2001 From: Peter Zubaj Date: Tue, 26 Feb 2008 14:26:14 -0500 Subject: R300: Fix clamping and pitch for textured video --- src/radeon_reg.h | 11 +++++++++++ src/radeon_textured_videofuncs.c | 16 +++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) (limited to 'src') 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; -- cgit v1.2.3