summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alex@samba.(none)>2008-02-26 14:33:24 -0500
committerAlex Deucher <alex@samba.(none)>2008-02-26 14:33:24 -0500
commit44e527a117ab0a363135ff066c7f7e0c12e3dc89 (patch)
tree47f1d45f7ae8cf7a2c1ca3762683dc8d7f0f0e31
parent00ec17ad53d7ad43f19c9b723794ac1b8ef86826 (diff)
R300: fix cordinate clamping in render code
Based on Peter's fix for textured video
-rw-r--r--src/radeon_exa.c15
-rw-r--r--src/radeon_exa_render.c15
-rw-r--r--src/radeon_textured_video.c15
3 files changed, 9 insertions, 36 deletions
diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 4ea451d7..4da4841a 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 30e3329e..9bbccb5c 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 8a14024d..b3d689d0 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 {