summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Deucher <alex@samba.(none)>2008-02-27 02:13:10 -0500
committerAlex Deucher <alex@samba.(none)>2008-02-27 02:13:10 -0500
commit7cfad216a3f1486be194c972b9b6bcf070358586 (patch)
treef69814c2dadac514b7947107cd5da0bcce0c7a5c /src
parenta2dca1d68d751def34ef3c6f836574173737bf76 (diff)
RADEON: fix clipping for textured video
Diffstat (limited to 'src')
-rw-r--r--src/radeon_textured_video.c14
-rw-r--r--src/radeon_textured_videofuncs.c30
-rw-r--r--src/radeon_video.h4
3 files changed, 23 insertions, 25 deletions
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index ff2e5d6..df62082 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -240,7 +240,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
tmp = ((top >> 1) * srcPitch2) + (left >> 1);
s2offset += tmp;
s3offset += tmp;
- if(id == FOURCC_I420) {
+ if (id == FOURCC_I420) {
tmp = s2offset;
s2offset = s3offset;
s3offset = tmp;
@@ -263,18 +263,14 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
}
pPriv->id = id;
- pPriv->src_x1 = x1;
- pPriv->src_y1 = y1;
- pPriv->src_x2 = x2;
- pPriv->src_y2 = y2;
pPriv->src_w = src_w;
pPriv->src_h = src_h;
- pPriv->dst_x1 = dstBox.x1;
- pPriv->dst_y1 = dstBox.y1;
- pPriv->dst_x2 = dstBox.x2;
- pPriv->dst_y2 = dstBox.y1;
+ pPriv->drw_x = drw_x;
+ pPriv->drw_y = drw_y;
pPriv->dst_w = drw_w;
pPriv->dst_h = drw_h;
+ pPriv->w = width;
+ pPriv->h = height;
#ifdef XF86DRI
if (info->directRenderingEnabled)
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index 6e8661e..e0f3bba 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -157,13 +157,13 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
txformat1 |= R300_TX_FORMAT_YUV_TO_RGB_CLAMP;
- txformat0 = (((pPriv->src_w - 1) << R300_TXWIDTH_SHIFT) |
- ((pPriv->src_h - 1) << R300_TXHEIGHT_SHIFT));
+ txformat0 = (((pPriv->w - 1) << R300_TXWIDTH_SHIFT) |
+ ((pPriv->h - 1) << R300_TXHEIGHT_SHIFT));
txformat0 |= R300_TXPITCH_EN;
- info->texW[0] = pPriv->src_w;
- info->texH[0] = pPriv->src_h;
+ info->texW[0] = pPriv->w;
+ info->texH[0] = pPriv->h;
txfilter = (R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) |
R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST) |
@@ -419,8 +419,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
(info->ChipFamily == CHIP_FAMILY_RS300) ||
(info->ChipFamily == CHIP_FAMILY_R200)) {
- info->texW[0] = pPriv->src_w;
- info->texH[0] = pPriv->src_h;
+ info->texW[0] = pPriv->w;
+ info->texH[0] = pPriv->h;
BEGIN_VIDEO(12);
@@ -435,8 +435,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
OUT_VIDEO_REG(R200_PP_TXFORMAT_0, txformat);
OUT_VIDEO_REG(R200_PP_TXFORMAT_X_0, 0);
OUT_VIDEO_REG(R200_PP_TXSIZE_0,
- (pPriv->src_w - 1) |
- ((pPriv->src_h - 1) << RADEON_TEX_VSIZE_SHIFT));
+ (pPriv->w - 1) |
+ ((pPriv->h - 1) << RADEON_TEX_VSIZE_SHIFT));
OUT_VIDEO_REG(R200_PP_TXPITCH_0, pPriv->src_pitch - 32);
OUT_VIDEO_REG(R200_PP_TXOFFSET_0, pPriv->src_offset);
@@ -485,8 +485,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
RADEON_CLAMP_TX);
OUT_VIDEO_REG(RADEON_PP_TEX_SIZE_0,
- (pPriv->src_w - 1) |
- ((pPriv->src_h - 1) << RADEON_TEX_VSIZE_SHIFT));
+ (pPriv->w - 1) |
+ ((pPriv->h - 1) << RADEON_TEX_VSIZE_SHIFT));
OUT_VIDEO_REG(RADEON_PP_TEX_PITCH_0,
pPriv->src_pitch - 32);
FINISH_VIDEO();
@@ -501,10 +501,11 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
dstY = pBox->y1 + dstyoff;
dstw = pBox->x2 - pBox->x1;
dsth = pBox->y2 - pBox->y1;
- srcX = (pBox->x1 - pPriv->dst_x1) *
- pPriv->src_w / pPriv->dst_w;
- srcY = (pBox->y1 - pPriv->dst_y1) *
- pPriv->src_h / pPriv->dst_h;
+
+ srcX = ((pBox->x1 - pPriv->drw_x) *
+ pPriv->src_w) / pPriv->dst_w;
+ srcY = ((pBox->y1 - pPriv->drw_y) *
+ pPriv->src_h) / pPriv->dst_h;
srcw = (pPriv->src_w * dstw) / pPriv->dst_w;
srch = (pPriv->src_h * dsth) / pPriv->dst_h;
@@ -518,6 +519,7 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
srcBottomRight.x = IntToxFixed(srcX + srcw);
srcBottomRight.y = IntToxFixed(srcY + srch);
+
#if 0
ErrorF("dst: %d, %d, %d, %d\n", dstX, dstY, dstw, dsth);
ErrorF("src: %d, %d, %d, %d\n", srcX, srcY, srcw, srch);
diff --git a/src/radeon_video.h b/src/radeon_video.h
index 9051faa..f897e07 100644
--- a/src/radeon_video.h
+++ b/src/radeon_video.h
@@ -101,9 +101,9 @@ typedef struct {
CARD8 *src_addr;
int id;
- int src_x1, src_y1, src_x2, src_y2;
- int dst_x1, dst_y1, dst_x2, dst_y2;
int src_w, src_h, dst_w, dst_h;
+ int w, h;
+ int drw_x, drw_y;
} RADEONPortPrivRec, *RADEONPortPrivPtr;