summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-04-21 04:47:43 -0400
committerAlex Deucher <alexdeucher@gmail.com>2009-04-21 04:47:43 -0400
commit0e5164d968316bbb59b4484a7df087854738068f (patch)
tree90fbd6aab4f8bb7aa20dbe07ee7708bc2bb6696e /src
parent06a1b4169b506f69dd807380d9ce7210b3a3bc23 (diff)
Tex vid: rework part 2
- use pPriv->w/h directly for tex coords - take src x/y offset into account when calculating tex coords - when copying data, only optimize for y clipping. In order to deal with the x clipping optimization, the copy routines or tex coords would need to be fixed. This should fix clipping problems with the current code.
Diffstat (limited to 'src')
-rw-r--r--src/r600_textured_videofuncs.c14
-rw-r--r--src/radeon_textured_video.c61
-rw-r--r--src/radeon_textured_videofuncs.c179
-rw-r--r--src/radeon_video.h1
4 files changed, 126 insertions, 129 deletions
diff --git a/src/r600_textured_videofuncs.c b/src/r600_textured_videofuncs.c
index 27bdf4d5..23e7f405 100644
--- a/src/r600_textured_videofuncs.c
+++ b/src/r600_textured_videofuncs.c
@@ -349,7 +349,7 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
tex_res.format = FMT_8;
tex_res.w = pPriv->w >> 1;
tex_res.h = pPriv->h >> 1;
- tex_res.pitch = accel_state->src_pitch[0] >> 1;
+ tex_res.pitch = ((accel_state->src_pitch[0] >> 1) + 255) & ~255;
tex_res.dst_sel_x = SQ_SEL_X; /* V or U */
tex_res.dst_sel_y = SQ_SEL_1;
tex_res.dst_sel_z = SQ_SEL_1;
@@ -373,7 +373,7 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
tex_res.format = FMT_8;
tex_res.w = pPriv->w >> 1;
tex_res.h = pPriv->h >> 1;
- tex_res.pitch = accel_state->src_pitch[0] >> 1;
+ tex_res.pitch = ((accel_state->src_pitch[0] >> 1) + 255) & ~255;
tex_res.dst_sel_x = SQ_SEL_X; /* V or U */
tex_res.dst_sel_y = SQ_SEL_1;
tex_res.dst_sel_z = SQ_SEL_1;
@@ -559,10 +559,12 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
dstw = pBox->x2 - pBox->x1;
dsth = pBox->y2 - pBox->y1;
- srcX = ((pBox->x1 - pPriv->drw_x) *
- pPriv->src_w) / pPriv->dst_w;
- srcY = ((pBox->y1 - pPriv->drw_y) *
- pPriv->src_h) / pPriv->dst_h;
+ srcX = pPriv->src_x;
+ srcX += ((pBox->x1 - pPriv->drw_x) *
+ pPriv->src_w) / pPriv->dst_w;
+ srcY = pPriv->src_y;
+ 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;
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index 3b7bd714..b6cedb24 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -237,7 +237,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
int srcPitch, srcPitch2, dstPitch, dstPitch2 = 0;
int s2offset, s3offset, tmp;
int d2line, d3line;
- int top, left, npixels, nlines, size;
+ int top, nlines, size;
BoxRec dstBox;
int dst_width = width, dst_height = height;
int hw_align;
@@ -359,13 +359,10 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
/* copy data */
top = (y1 >> 16) & ~1;
- left = (x1 >> 16) & ~1;
- npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
pPriv->src_offset = pPriv->video_offset + info->fbLocation + pScrn->fbOffset;
pPriv->src_addr = (uint8_t *)(info->FB + pPriv->video_offset + (top * dstPitch));
- pPriv->src_addr += left << 1;
pPriv->src_pitch = dstPitch;
pPriv->planeu_offset = dstPitch * dst_height;
@@ -379,46 +376,40 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
switch(id) {
case FOURCC_YV12:
case FOURCC_I420:
- s2offset = srcPitch * ((height + 1) & ~1);
- s3offset = s2offset + (srcPitch2 * ((height + 1) >> 1));
- tmp = ((top >> 1) * srcPitch2) + (left >> 1);
- s2offset += tmp;
- s3offset += tmp;
+ s2offset = (srcPitch * ((height + 1) & ~1)) + ((top >> 1) * srcPitch2);
+ s3offset = (s2offset + (srcPitch2 * ((height + 1) >> 1))) + ((top >> 1) * srcPitch2);
if (pPriv->bicubic_state != BICUBIC_OFF) {
if (id == FOURCC_I420) {
tmp = s2offset;
s2offset = s3offset;
s3offset = tmp;
}
- RADEONCopyMungedData(pScrn, buf + (top * srcPitch) + left,
- buf + s2offset, buf + s3offset, pPriv->src_addr,
- srcPitch, srcPitch2, dstPitch, nlines, npixels);
+ RADEONCopyMungedData(pScrn, buf + (top * srcPitch),
+ buf + s2offset, buf + s3offset, pPriv->src_addr + (top * dstPitch),
+ srcPitch, srcPitch2, dstPitch, nlines, width);
} else {
if (id == FOURCC_YV12) {
tmp = s2offset;
s2offset = s3offset;
s3offset = tmp;
}
- d2line = pPriv->planeu_offset;
- d3line = pPriv->planev_offset;
- tmp = ((top >> 1) * dstPitch2) - (top * dstPitch);
- d2line += tmp;
- d3line += tmp;
+ d2line = pPriv->planeu_offset + ((top >> 1) * dstPitch2);
+ d3line = pPriv->planev_offset + ((top >> 1) * dstPitch2);
if (info->ChipFamily >= CHIP_FAMILY_R600) {
- R600CopyData(pScrn, buf + (top * srcPitch) + left, pPriv->src_addr + left,
- srcPitch, dstPitch, nlines, npixels, 1);
- R600CopyData(pScrn, buf + s2offset, pPriv->src_addr + d2line + (left >> 1),
- srcPitch2, dstPitch >> 1, (nlines + 1) >> 1, npixels >> 1, 1);
- R600CopyData(pScrn, buf + s3offset, pPriv->src_addr + d3line + (left >> 1),
- srcPitch2, dstPitch >> 1, (nlines + 1) >> 1, npixels >> 1, 1);
+ R600CopyData(pScrn, buf + (top * srcPitch), pPriv->src_addr + (top * dstPitch),
+ srcPitch, dstPitch, nlines, width, 1);
+ R600CopyData(pScrn, buf + s2offset, pPriv->src_addr + d2line,
+ srcPitch2, dstPitch2, (nlines + 1) >> 1, width >> 1, 1);
+ R600CopyData(pScrn, buf + s3offset, pPriv->src_addr + d3line,
+ srcPitch2, dstPitch2, (nlines + 1) >> 1, width >> 1, 1);
} else {
- RADEONCopyData(pScrn, buf + (top * srcPitch) + left, pPriv->src_addr + left,
- srcPitch, dstPitch, nlines, npixels, 1);
- RADEONCopyData(pScrn, buf + s2offset, pPriv->src_addr + d2line + (left >> 1),
- srcPitch2, dstPitch2, (nlines + 1) >> 1, npixels >> 1, 1);
- RADEONCopyData(pScrn, buf + s3offset, pPriv->src_addr + d3line + (left >> 1),
- srcPitch2, dstPitch2, (nlines + 1) >> 1, npixels >> 1, 1);
+ RADEONCopyData(pScrn, buf + (top * srcPitch), pPriv->src_addr + (top * dstPitch),
+ srcPitch, dstPitch, nlines, width, 1);
+ RADEONCopyData(pScrn, buf + s2offset, pPriv->src_addr + d2line,
+ srcPitch2, dstPitch2, (nlines + 1) >> 1, width >> 1, 1);
+ RADEONCopyData(pScrn, buf + s3offset, pPriv->src_addr + d3line,
+ srcPitch2, dstPitch2, (nlines + 1) >> 1, width >> 1, 1);
}
}
break;
@@ -426,11 +417,13 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
case FOURCC_YUY2:
default:
if (info->ChipFamily >= CHIP_FAMILY_R600)
- R600CopyData(pScrn, buf + (top * srcPitch) + (left << 1),
- pPriv->src_addr, srcPitch, dstPitch, nlines, npixels, 2);
+ R600CopyData(pScrn, buf + (top * srcPitch),
+ pPriv->src_addr + (top * dstPitch),
+ srcPitch, dstPitch, nlines, width, 2);
else
- RADEONCopyData(pScrn, buf + (top * srcPitch) + (left << 1),
- pPriv->src_addr, srcPitch, dstPitch, nlines, npixels, 2);
+ RADEONCopyData(pScrn, buf + (top * srcPitch),
+ pPriv->src_addr + (top * dstPitch),
+ srcPitch, dstPitch, nlines, width, 2);
break;
}
@@ -449,6 +442,8 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
pPriv->id = id;
pPriv->src_w = src_w;
pPriv->src_h = src_h;
+ pPriv->src_x = src_x;
+ pPriv->src_y = src_y;
pPriv->drw_x = drw_x;
pPriv->drw_y = drw_y;
pPriv->dst_w = drw_w;
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index caf8dce0..dd6f862c 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -388,10 +388,12 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
dstw = pBox->x2 - pBox->x1;
dsth = pBox->y2 - pBox->y1;
- srcX = ((pBox->x1 - pPriv->drw_x) *
- pPriv->src_w) / pPriv->dst_w;
- srcY = ((pBox->y1 - pPriv->drw_y) *
- pPriv->src_h) / pPriv->dst_h;
+ srcX = pPriv->src_x;
+ srcX += ((pBox->x1 - pPriv->drw_x) *
+ pPriv->src_w) / pPriv->dst_w;
+ srcY = pPriv->src_y;
+ 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;
@@ -546,9 +548,6 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
FINISH_ACCEL();
- info->accel_state->texW[0] = pPriv->w;
- info->accel_state->texH[0] = pPriv->h;
-
txfilter = R200_MAG_FILTER_LINEAR |
R200_MIN_FILTER_LINEAR |
R200_CLAMP_S_CLAMP_LAST |
@@ -915,10 +914,12 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
dstw = pBox->x2 - pBox->x1;
dsth = pBox->y2 - pBox->y1;
- srcX = ((pBox->x1 - pPriv->drw_x) *
- pPriv->src_w) / pPriv->dst_w;
- srcY = ((pBox->y1 - pPriv->drw_y) *
- pPriv->src_h) / pPriv->dst_h;
+ srcX = pPriv->src_x;
+ srcX += ((pBox->x1 - pPriv->drw_x) *
+ pPriv->src_w) / pPriv->dst_w;
+ srcY = pPriv->src_y;
+ 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;
@@ -927,25 +928,25 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
/*
* Just render a rect (using three coords).
*/
- VTX_OUT_6((float)dstX, (float)(dstY + dsth),
- (float)srcX / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0],
- (float)srcX / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0]);
- VTX_OUT_6((float)(dstX + dstw), (float)(dstY + dsth),
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0],
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0]);
- VTX_OUT_6((float)(dstX + dstw), (float)dstY,
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0],
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
+ VTX_OUT_6((float)dstX, (float)(dstY + dsth),
+ (float)srcX / pPriv->w, (float)(srcY + srch) / pPriv->h,
+ (float)srcX / pPriv->w, (float)(srcY + srch) / pPriv->h);
+ VTX_OUT_6((float)(dstX + dstw), (float)(dstY + dsth),
+ (float)(srcX + srcw) / pPriv->w, (float)(srcY + srch) / pPriv->h,
+ (float)(srcX + srcw) / pPriv->w, (float)(srcY + srch) / pPriv->h);
+ VTX_OUT_6((float)(dstX + dstw), (float)dstY,
+ (float)(srcX + srcw) / pPriv->w, (float)srcY / pPriv->h,
+ (float)(srcX + srcw) / pPriv->w, (float)srcY / pPriv->h);
} else {
/*
* Just render a rect (using three coords).
*/
- VTX_OUT_4((float)dstX, (float)(dstY + dsth),
- (float)srcX / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0]);
- VTX_OUT_4((float)(dstX + dstw), (float)(dstY + dsth),
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0]);
- VTX_OUT_4((float)(dstX + dstw), (float)dstY,
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
+ VTX_OUT_4((float)dstX, (float)(dstY + dsth),
+ (float)srcX / pPriv->w, (float)(srcY + srch) / pPriv->h);
+ VTX_OUT_4((float)(dstX + dstw), (float)(dstY + dsth),
+ (float)(srcX + srcw) / pPriv->w, (float)(srcY + srch) / pPriv->h);
+ VTX_OUT_4((float)(dstX + dstw), (float)dstY,
+ (float)(srcX + srcw) / pPriv->w, (float)srcY / pPriv->h);
}
pBox++;
@@ -1076,9 +1077,6 @@ FUNC_NAME(R300DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
(((pPriv->h - 1) & 0x7ff) << R300_TXHEIGHT_SHIFT) |
R300_TXPITCH_EN);
- info->accel_state->texW[0] = pPriv->w;
- info->accel_state->texH[0] = pPriv->h;
-
txfilter = (R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) |
R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST) |
R300_TX_MAG_FILTER_LINEAR |
@@ -2252,10 +2250,12 @@ FUNC_NAME(R300DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
dstw = pBox->x2 - pBox->x1;
dsth = pBox->y2 - pBox->y1;
- srcX = ((pBox->x1 - pPriv->drw_x) *
- pPriv->src_w) / pPriv->dst_w;
- srcY = ((pBox->y1 - pPriv->drw_y) *
- pPriv->src_h) / pPriv->dst_h;
+ srcX = pPriv->src_x;
+ srcX += ((pBox->x1 - pPriv->drw_x) *
+ pPriv->src_w) / pPriv->dst_w;
+ srcY = pPriv->src_y;
+ 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;
@@ -2315,57 +2315,57 @@ FUNC_NAME(R300DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
* have to deal with the legacy handling.
*/
if (use_quad) {
- VTX_OUT_6((float)dstX, (float)dstY,
- (float)srcX / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0],
- (float)srcX + 0.5, (float)srcY + 0.5);
- VTX_OUT_6((float)dstX, (float)(dstY + dsth),
- (float)srcX / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0],
- (float)srcX + 0.5, (float)(srcY + srch) + 0.5);
- VTX_OUT_6((float)(dstX + dstw), (float)(dstY + dsth),
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0],
- (float)(srcX + srcw) + 0.5, (float)(srcY + srch) + 0.5);
- VTX_OUT_6((float)(dstX + dstw), (float)dstY,
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0],
- (float)(srcX + srcw) + 0.5, (float)srcY + 0.5);
+ VTX_OUT_6((float)dstX, (float)dstY,
+ (float)srcX / pPriv->w, (float)srcY / pPriv->h,
+ (float)srcX + 0.5, (float)srcY + 0.5);
+ VTX_OUT_6((float)dstX, (float)(dstY + dsth),
+ (float)srcX / pPriv->w, (float)(srcY + srch) / pPriv->h,
+ (float)srcX + 0.5, (float)(srcY + srch) + 0.5);
+ VTX_OUT_6((float)(dstX + dstw), (float)(dstY + dsth),
+ (float)(srcX + srcw) / pPriv->w, (float)(srcY + srch) / pPriv->h,
+ (float)(srcX + srcw) + 0.5, (float)(srcY + srch) + 0.5);
+ VTX_OUT_6((float)(dstX + dstw), (float)dstY,
+ (float)(srcX + srcw) / pPriv->w, (float)srcY / pPriv->h,
+ (float)(srcX + srcw) + 0.5, (float)srcY + 0.5);
} else {
- VTX_OUT_6((float)dstX, (float)dstY,
- (float)srcX / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0],
- (float)srcX + 0.5, (float)srcY + 0.5);
- VTX_OUT_6((float)dstX, (float)(dstY + dstw + dsth),
- (float)srcX / info->accel_state->texW[0],
- ((float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0)) / info->accel_state->texH[0],
+ VTX_OUT_6((float)dstX, (float)dstY,
+ (float)srcX / pPriv->w, (float)srcY / pPriv->h,
+ (float)srcX + 0.5, (float)srcY + 0.5);
+ VTX_OUT_6((float)dstX, (float)(dstY + dstw + dsth),
+ (float)srcX / pPriv->w,
+ ((float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0)) / pPriv->h,
(float)srcX + 0.5,
(float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0) + 0.5);
- VTX_OUT_6((float)(dstX + dstw + dsth), (float)dstY,
- ((float)srcX + (float)srcw * (((float)dsth / (float)dstw) + 1.0)) / info->accel_state->texW[0],
- (float)srcY / info->accel_state->texH[0],
+ VTX_OUT_6((float)(dstX + dstw + dsth), (float)dstY,
+ ((float)srcX + (float)srcw * (((float)dsth / (float)dstw) + 1.0)) / pPriv->w,
+ (float)srcY / pPriv->h,
(float)srcX + (float)srcw * (((float)dsth / (float)dstw) + 1.0) + 0.5,
(float)srcY + 0.5);
}
} else {
if (use_quad) {
- VTX_OUT_4((float)dstX, (float)dstY,
- (float)srcX / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
- VTX_OUT_4((float)dstX, (float)(dstY + dsth),
- (float)srcX / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0]);
- VTX_OUT_4((float)(dstX + dstw), (float)(dstY + dsth),
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0]);
- VTX_OUT_4((float)(dstX + dstw), (float)dstY,
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
+ VTX_OUT_4((float)dstX, (float)dstY,
+ (float)srcX / pPriv->w, (float)srcY / pPriv->h);
+ VTX_OUT_4((float)dstX, (float)(dstY + dsth),
+ (float)srcX / pPriv->w, (float)(srcY + srch) / pPriv->h);
+ VTX_OUT_4((float)(dstX + dstw), (float)(dstY + dsth),
+ (float)(srcX + srcw) / pPriv->w, (float)(srcY + srch) / pPriv->h);
+ VTX_OUT_4((float)(dstX + dstw), (float)dstY,
+ (float)(srcX + srcw) / pPriv->w, (float)srcY / pPriv->h);
} else {
/*
* Render a big, scissored triangle. This means
* increasing the triangle size and adjusting
* texture coordinates.
*/
- VTX_OUT_4((float)dstX, (float)dstY,
- (float)srcX / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
- VTX_OUT_4((float)dstX, (float)(dstY + dsth + dstw),
- (float)srcX / info->accel_state->texW[0],
- ((float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0)) / info->accel_state->texH[0]);
- VTX_OUT_4((float)(dstX + dstw + dsth), (float)dstY,
- ((float)srcX + (float)srcw * (((float)dsth / (float)dstw) + 1.0)) / info->accel_state->texW[0],
- (float)srcY / info->accel_state->texH[0]);
+ VTX_OUT_4((float)dstX, (float)dstY,
+ (float)srcX / pPriv->w, (float)srcY / pPriv->h);
+ VTX_OUT_4((float)dstX, (float)(dstY + dsth + dstw),
+ (float)srcX / pPriv->w,
+ ((float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0)) / pPriv->h);
+ VTX_OUT_4((float)(dstX + dstw + dsth), (float)dstY,
+ ((float)srcX + (float)srcw * (((float)dsth / (float)dstw) + 1.0)) / pPriv->w,
+ (float)srcY / pPriv->h);
}
}
@@ -2503,9 +2503,6 @@ FUNC_NAME(R500DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
(((pPriv->h - 1) & 0x7ff) << R300_TXHEIGHT_SHIFT) |
R300_TXPITCH_EN);
- info->accel_state->texW[0] = pPriv->w;
- info->accel_state->texH[0] = pPriv->h;
-
txfilter = (R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) |
R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST) |
R300_TX_MAG_FILTER_LINEAR |
@@ -3805,10 +3802,12 @@ FUNC_NAME(R500DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
dstw = pBox->x2 - pBox->x1;
dsth = pBox->y2 - pBox->y1;
- srcX = ((pBox->x1 - pPriv->drw_x) *
- pPriv->src_w) / pPriv->dst_w;
- srcY = ((pBox->y1 - pPriv->drw_y) *
- pPriv->src_h) / pPriv->dst_h;
+ srcX = pPriv->src_x;
+ srcX += ((pBox->x1 - pPriv->drw_x) *
+ pPriv->src_w) / pPriv->dst_w;
+ srcY = pPriv->src_y;
+ 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;
@@ -3834,15 +3833,15 @@ FUNC_NAME(R500DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
(3 << RADEON_VF_NUM_VERTICES_SHIFT)));
#endif
if (pPriv->bicubic_enabled) {
- VTX_OUT_6((float)dstX, (float)dstY,
- (float)srcX / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0],
- (float)srcX + 0.5, (float)srcY + 0.5);
- VTX_OUT_6((float)dstX, (float)(dstY + dstw + dsth),
- (float)srcX / info->accel_state->texW[0], ((float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0)) / info->accel_state->texH[0],
- (float)srcX + 0.5, (float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0) + 0.5);
+ VTX_OUT_6((float)dstX, (float)dstY,
+ (float)srcX / pPriv->w, (float)srcY / pPriv->h,
+ (float)srcX + 0.5, (float)srcY + 0.5);
+ VTX_OUT_6((float)dstX, (float)(dstY + dstw + dsth),
+ (float)srcX / pPriv->w, ((float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0)) / pPriv->h,
+ (float)srcX + 0.5, (float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0) + 0.5);
VTX_OUT_6((float)(dstX + dstw + dsth), (float)dstY,
- ((float)srcX + (float)srcw * (((float)dsth / (float)dstw) + 1.0)) / info->accel_state->texW[0],
- (float)srcY / info->accel_state->texH[0],
+ ((float)srcX + (float)srcw * (((float)dsth / (float)dstw) + 1.0)) / pPriv->w,
+ (float)srcY / pPriv->h,
(float)srcX + (float)srcw * (((float)dsth / (float)dstw) + 1.0) + 0.5,
(float)srcY + 0.5);
} else {
@@ -3851,13 +3850,13 @@ FUNC_NAME(R500DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
* increasing the triangle size and adjusting
* texture coordinates.
*/
- VTX_OUT_4((float)dstX, (float)dstY,
- (float)srcX / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
+ VTX_OUT_4((float)dstX, (float)dstY,
+ (float)srcX / pPriv->w, (float)srcY / pPriv->h);
VTX_OUT_4((float)dstX, (float)(dstY + dsth + dstw),
- (float)srcX / info->accel_state->texW[0], ((float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0)) / info->accel_state->texH[0]);
+ (float)srcX / pPriv->w, ((float)srcY + (float)srch * (((float)dstw / (float)dsth) + 1.0)) / pPriv->h);
VTX_OUT_4((float)(dstX + dstw + dsth), (float)dstY,
- ((float)srcX + (float)srcw * (((float)dsth / (float)dstw) + 1.0)) / info->accel_state->texW[0],
- (float)srcY / info->accel_state->texH[0]);
+ ((float)srcX + (float)srcw * (((float)dsth / (float)dstw) + 1.0)) / pPriv->w,
+ (float)srcY / pPriv->h);
}
/* flushing is pipelined, free/finish is not */
diff --git a/src/radeon_video.h b/src/radeon_video.h
index 3f8f5e0e..0cf8168b 100644
--- a/src/radeon_video.h
+++ b/src/radeon_video.h
@@ -118,6 +118,7 @@ typedef struct {
int src_w, src_h, dst_w, dst_h;
int w, h;
int drw_x, drw_y;
+ int src_x, src_y;
int vsync;
} RADEONPortPrivRec, *RADEONPortPrivPtr;