summaryrefslogtreecommitdiff
path: root/src/radeon_textured_videofuncs.c
diff options
context:
space:
mode:
authorChristiaan van Dijk <dvbmail@xs4all.nl>2009-01-12 11:54:15 -0500
committerAlex Deucher <alexdeucher@gmail.com>2009-01-12 11:54:15 -0500
commitb437da34cb4f7c637674fb432ad81b9bf32244a3 (patch)
tree9dc18caba6563798e27ee57e09839e2a39411735 /src/radeon_textured_videofuncs.c
parent3d106b990fa8daba96e590c57b164640a2faae7f (diff)
R3xx/R4xx: Maximize the use of clipped triangles for Xv rendering
While trying to get tear free video on my RS690 I found some problems in the code for rendering the video as a clipped triangle. The size limitations are quite strict and scaling the video output window creates all kinds of weird effects. This patch maximizes the use of this function and resolves the scaling issues. There could be a problem with zero target height/width, not sure if this is handled elsewhere.
Diffstat (limited to 'src/radeon_textured_videofuncs.c')
-rw-r--r--src/radeon_textured_videofuncs.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index 2fe852da..c6ed472f 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -1529,7 +1529,7 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
#endif
if (IS_R300_3D || IS_R500_3D) {
- if (IS_R300_3D && ((dstw > 1440) || (dsth > 1440)))
+ if (IS_R300_3D && ((dstw+dsth) > 2880))
use_quad = TRUE;
/*
* Set up the scissor area to that of the output size.
@@ -1634,39 +1634,43 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
(float)(srcX + srcw) / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0],
(float)(srcX + srcw) + 0.5, (float)srcY + 0.5);
} else {
- VTX_OUT_FILTER((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_FILTER((float)dstX, (float)(dstY + dsth * 2),
- (float)srcX / info->accel_state->texW[0], (float)(srcY + srch * 2) / info->accel_state->texH[0],
- (float)srcX + 0.5, (float)(srcY + srch * 2) + 0.5);
- VTX_OUT_FILTER((float)(dstX + dstw * 2), (float)dstY,
- (float)(srcX + srcw * 2) / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0],
- (float)(srcX + srcw * 2) + 0.5, (float)srcY + 0.5);
+ VTX_OUT_FILTER((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_FILTER((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_FILTER((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) + 0.5,
+ (float)srcY + 0.5);
}
} else {
if (IS_R300_3D || IS_R500_3D) {
if (use_quad) {
- VTX_OUT((float)dstX, (float)dstY,
- (float)srcX / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
- VTX_OUT((float)dstX, (float)(dstY + dsth),
- (float)srcX / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0]);
- VTX_OUT((float)(dstX + dstw), (float)(dstY + dsth),
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0]);
- VTX_OUT((float)(dstX + dstw), (float)dstY,
- (float)(srcX + srcw) / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
+ VTX_OUT((float)dstX, (float)dstY,
+ (float)srcX / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
+ VTX_OUT((float)dstX, (float)(dstY + dsth),
+ (float)srcX / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0]);
+ VTX_OUT((float)(dstX + dstw), (float)(dstY + dsth),
+ (float)(srcX + srcw) / info->accel_state->texW[0], (float)(srcY + srch) / info->accel_state->texH[0]);
+ VTX_OUT((float)(dstX + dstw), (float)dstY,
+ (float)(srcX + srcw) / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
} else {
/*
* Render a big, scissored triangle. This means
- * doubling the triangle size and adjusting
+ * increasing the triangle size and adjusting
* texture coordinates.
*/
- VTX_OUT((float)dstX, (float)dstY,
- (float)srcX / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
- VTX_OUT((float)dstX, (float)(dstY + dsth * 2),
- (float)srcX / info->accel_state->texW[0], (float)(srcY + srch * 2) / info->accel_state->texH[0]);
- VTX_OUT((float)(dstX + dstw * 2), (float)dstY,
- (float)(srcX + srcw * 2) / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
+ VTX_OUT((float)dstX, (float)dstY,
+ (float)srcX / info->accel_state->texW[0], (float)srcY / info->accel_state->texH[0]);
+ VTX_OUT((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((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]);
}
} else {
/*