summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Cellier <rixed@happyleptic.org>2010-02-08 11:44:28 +0100
committerFrancisco Jerez <currojerez@riseup.net>2010-02-08 17:18:18 +0100
commit3f2aaabcdfe339908338dff42aabc1fef47e8694 (patch)
tree11ecea854c69b68b94422f71426fe488a342cb7b
parent6bf8f8d7e13ccbb773765c4fcdcaf6d1d2993122 (diff)
Fix lack of precision in video resizing. #26443
On some videos the last displayed line was wrong. This can be fixed using LynxEM+ VPR68. Code borrowed from siliconmotion's in-house driver. Also fix a typo. Signed-off-by: Cedric Cellier <rixed@happyleptic.org> Signed-off-by: Francisco Jerez <currojerez@riseup.net>
-rw-r--r--src/smi_video.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/smi_video.c b/src/smi_video.c
index 9bf0e1b..c2e8868 100644
--- a/src/smi_video.c
+++ b/src/smi_video.c
@@ -1103,7 +1103,7 @@ SMI_PutVideo(
vpr00 |= 0x0010000E;
} else {
/*
- Bit 21 = 10: Vertical Interpolation = enabled
+ Bit 21 = 1: Vertical Interpolation = enabled
Bit 24 = 1: Select Video Window I Source Addr = 1
1= Video window I source addr = capture port buffer ?
*/
@@ -1747,7 +1747,7 @@ SMI_DisplayVideo(
{
SMIPtr pSmi = SMIPTR(pScrn);
CARD32 vpr00;
- int hstretch, vstretch;
+ uint32_t hstretch, vstretch;
ENTER();
@@ -1774,13 +1774,13 @@ SMI_DisplayVideo(
}
if (drw_w > vid_w) {
- hstretch = (2560 * vid_w / drw_w + 5) / 10;
+ hstretch = ((uint32_t)(vid_w - 1) << 16) / (drw_w - 1);
} else {
hstretch = 0;
}
if (drw_h > vid_h) {
- vstretch = (2560 * vid_h / drw_h + 5) / 10;
+ vstretch = ((uint32_t)(vid_h - 1) << 16) / (drw_h - 1);
vpr00 |= 1 << 21;
} else {
vstretch = 0;
@@ -1791,7 +1791,10 @@ SMI_DisplayVideo(
WRITE_VPR(pSmi, 0x18, (dstBox->x2) | (dstBox->y2 << 16));
WRITE_VPR(pSmi, 0x1C, offset >> 3);
WRITE_VPR(pSmi, 0x20, (pitch >> 3) | ((pitch >> 3) << 16));
- WRITE_VPR(pSmi, 0x24, (hstretch << 8) | vstretch);
+ WRITE_VPR(pSmi, 0x24, (hstretch & 0xff00) | ((vstretch & 0xff00) >> 8));
+ if (pSmi->Chipset == SMI_LYNXEMplus) { /* This one can store additional precision */
+ WRITE_VPR(pSmi, 0x68, ((hstretch & 0xff) << 8) | (vstretch & 0xff));
+ }
LEAVE();
}