From 37ee68a95ca8c86ebe9abafaaf55b060dd2a2f73 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Apr 2007 10:50:02 -0700 Subject: [PATCH] Bug #10438: Fix 965 XV when sourcing from less than the full image. Bob deinterlacing in MythTV, and the zoom options in totem would result in attempting to source from outside the video instead of scaling appropriately. --- src/i965_video.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/i965_video.c b/src/i965_video.c index 9e96527d..17d20061 100644 --- a/src/i965_video.c +++ b/src/i965_video.c @@ -172,6 +172,7 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, struct brw_instruction *ps_kernel; struct brw_instruction *sip_kernel; float *vb; + float src_scale_x, src_scale_y; CARD32 *binding_table; Bool first_output = TRUE; int dest_surf_offset, src_surf_offset, src_sampler_offset, vs_offset; @@ -672,6 +673,10 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, dxo = dstRegion->extents.x1; dyo = dstRegion->extents.y1; + /* Use normalized texture coordinates */ + src_scale_x = ((float)src_w / width) / (float)drw_w; + src_scale_y = ((float)src_h / height) / (float)drw_h; + pbox = REGION_RECTS(dstRegion); nbox = REGION_NUM_RECTS(dstRegion); while (nbox--) { @@ -680,7 +685,6 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, int box_x2 = pbox->x2; int box_y2 = pbox->y2; int i; - float src_scale_x, src_scale_y; if (!first_output) { /* Since we use the same little vertex buffer over and over, sync @@ -691,10 +695,6 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, pbox++; - /* Use normalized texture coordinates */ - src_scale_x = (float)1.0 / (float)drw_w; - src_scale_y = (float)1.0 / (float)drw_h; - i = 0; vb[i++] = (box_x2 - dxo) * src_scale_x; vb[i++] = (box_y2 - dyo) * src_scale_y;