summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2005-04-20 12:25:23 +0000
committerDaniel Stone <daniel@fooishbar.org>2005-04-20 12:25:23 +0000
commitb9c4a3ddd1fe26da0e7b4c0e87f603d6c645b17d (patch)
treea5ad0cb769d560f9e9b0cd771a38e73d852e1269
parent447cb9ac1433d9dee68e8f1fc9171a0ef3cc0512 (diff)
change "foo.h" to <X11/foo.h> for core headers, e.g. X.h, Xpoll.h; change "foo.h", "extensions/foo.h" and "X11/foo.h" to <X11/extensions/foo.h> for extension headers, e.g. Xv.h; change "foo.[ch]" to <X11/Xtrans/foo.[ch]> for Xtrans files.
-rw-r--r--src/ct_video.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/src/ct_video.c b/src/ct_video.c
index 4c560fa..471f370 100644
--- a/src/ct_video.c
+++ b/src/ct_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.15 2003/07/17 08:19:35 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.16tsi Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -11,7 +11,7 @@
#include "regionstr.h"
#include "ct_driver.h"
-#include "Xv.h"
+#include <X11/extensions/Xv.h>
#include "xaa.h"
#include "xaalocal.h"
#include "dixstruct.h"
@@ -267,12 +267,11 @@ CHIPSSetupImageVideo(ScreenPtr pScreen)
pPriv->colorKey = cPtr->videoKey;
pPriv->videoStatus = 0;
- pPriv->doubleBuffer = TRUE;
pPriv->manualDoubleBuffer = FALSE;
pPriv->currentBuffer = 0;
/* gotta uninit this someplace */
- REGION_INIT(pScreen, &pPriv->clip, NullBox, 0);
+ REGION_NULL(pScreen, &pPriv->clip);
cPtr->adaptor = adapt;
@@ -533,7 +532,9 @@ CHIPSDisplayVideo(
DisplayModePtr mode = pScrn->currentMode;
unsigned char tmp, m1f, m1e;
int buffer = pPriv->currentBuffer;
-
+ Bool dblscan = (pScrn->currentMode->Flags & V_DBLSCAN) == V_DBLSCAN;
+ int val;
+
if (cPtr->Flags & ChipsAccelSupport)
CHIPSHiQVSync(pScrn);
@@ -571,6 +572,7 @@ CHIPSDisplayVideo(
cPtr->writeMR(cPtr, 0x23, ((offset >> 8) & 0xFF));
cPtr->writeMR(cPtr, 0x24, ((offset >> 16) & 0xFF));
}
+
/* Setup Pointer 2 */
if ((buffer && !pPriv->manualDoubleBuffer) || !pPriv->doubleBuffer) {
cPtr->writeMR(cPtr, 0x25, (offset & 0xF8));
@@ -578,7 +580,6 @@ CHIPSDisplayVideo(
cPtr->writeMR(cPtr, 0x27, ((offset >> 16) & 0xFF));
}
-
tmp = cPtr->readMR(cPtr, 0x04);
if (pPriv->doubleBuffer && !pPriv->manualDoubleBuffer && triggerBufSwitch)
tmp |= 0x18;
@@ -586,6 +587,7 @@ CHIPSDisplayVideo(
tmp = cPtr->readMR(cPtr, 0x20);
tmp &= 0xC3;
+
if (pPriv->doubleBuffer && !pPriv->manualDoubleBuffer && triggerBufSwitch)
tmp |= ((1 << 2 | 1 << 5) | ((buffer) ? (1 << 4) : 0));
cPtr->writeMR(cPtr, 0x20, tmp);
@@ -605,14 +607,16 @@ CHIPSDisplayVideo(
tmp = (tmp & 0xF8) + (((cPtr->OverlaySkewX + dstBox->x2 - 1) >> 8) & 0x07);
cPtr->writeMR(cPtr, 0x2D, tmp);
/* Top Edge of Overlay */
- cPtr->writeMR(cPtr, 0x2E, ((cPtr->OverlaySkewY + dstBox->y1) & 0xFF));
+ val = cPtr->OverlaySkewY + (dstBox->y1 << (dblscan ? 1 : 0));
+ cPtr->writeMR(cPtr, 0x2E, ((val) & 0xFF));
tmp = cPtr->readMR(cPtr, 0x2F);
- tmp = (tmp & 0xF8) + (((cPtr->OverlaySkewY + dstBox->y1) >> 8) & 0x07);
+ tmp = (tmp & 0xF8) + (((val) >> 8) & 0x07);
cPtr->writeMR(cPtr, 0x2F, tmp);
/* Bottom Edge of Overlay*/
- cPtr->writeMR(cPtr, 0x30, ((cPtr->OverlaySkewY + dstBox->y2 - 1) & 0xFF));
+ val = cPtr->OverlaySkewY + (dstBox->y2 << (dblscan ? 1 : 0));
+ cPtr->writeMR(cPtr, 0x30, ((val - 1) & 0xFF));
tmp = cPtr->readMR(cPtr, 0x31);
- tmp = (tmp & 0xF8) + (((cPtr->OverlaySkewY + dstBox->y2 - 1) >> 8) & 0x07);
+ tmp = (tmp & 0xF8) + (((val - 1) >> 8) & 0x07);
cPtr->writeMR(cPtr, 0x31, tmp);
/* Horizontal Zoom */
@@ -624,10 +628,13 @@ CHIPSDisplayVideo(
}
/* Vertical Zoom */
- if (drw_h > src_h) {
+ if (drw_h > src_h || dblscan) {
m1f = m1f | 0x80; /* set V-interpolation */
- m1e = m1e | 0x08;
- tmp = cPtr->VideoZoomMax * src_h / drw_h ;
+ m1e = m1e | 0x08;
+ if (dblscan)
+ tmp = cPtr->VideoZoomMax >> 1;
+ if (drw_h > src_h)
+ tmp = tmp * src_h / drw_h;
cPtr->writeMR(cPtr, 0x33, tmp);
}
cPtr->writeMR(cPtr, 0x1F, m1f);
@@ -655,7 +662,7 @@ CHIPSPutImage(
CHIPSPtr cPtr = CHIPSPTR(pScrn);
INT32 x1, x2, y1, y2;
unsigned char *dst_start;
- int pitch, new_size, offset, offset2 = 0, offset3 = 0;
+ int new_size, offset, offset2 = 0, offset3 = 0;
int srcPitch, srcPitch2 = 0, dstPitch;
int top, left, npixels, nlines, bpp;
BoxRec dstBox;
@@ -673,7 +680,7 @@ CHIPSPutImage(
dstBox.x2 = drw_x + drw_w;
dstBox.y1 = drw_y;
dstBox.y2 = drw_y + drw_h;
-
+
if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2,
clipBoxes, width, height))
return Success;
@@ -684,12 +691,14 @@ CHIPSPutImage(
dstBox.y2 -= pScrn->frameY0;
bpp = pScrn->bitsPerPixel >> 3;
- pitch = bpp * pScrn->displayWidth;
dstPitch = ((width << 1) + 15) & ~15;
new_size = ((dstPitch * height) + bpp - 1) / bpp;
- if (pPriv->doubleBuffer)
- new_size <<= 1;
+
+ pPriv->doubleBuffer = (pScrn->currentMode->Flags & V_DBLSCAN) != V_DBLSCAN;
+
+ if (pPriv->doubleBuffer)
+ new_size <<= 1;
switch(id) {
case FOURCC_YV12: /* YV12 */
@@ -704,12 +713,12 @@ CHIPSPutImage(
}
if(!(pPriv->linear = CHIPSAllocateMemory(pScrn, pPriv->linear, new_size))) {
- if (pPriv->doubleBuffer &&
- (pPriv->linear = CHIPSAllocateMemory(pScrn, pPriv->linear,
+ if (pPriv->doubleBuffer
+ && (pPriv->linear = CHIPSAllocateMemory(pScrn, pPriv->linear,
new_size >> 1))) {
new_size >>= 1;
pPriv->doubleBuffer = FALSE;
- } else
+ } else
return BadAlloc;
}
@@ -851,7 +860,7 @@ CHIPSAllocateSurface(
XF86SurfacePtr surface
){
FBLinearPtr linear;
- int pitch, fbpitch, size, bpp;
+ int pitch, size, bpp;
OffscreenPrivPtr pPriv;
if((w > 1024) || (h > 1024))
@@ -860,7 +869,6 @@ CHIPSAllocateSurface(
w = (w + 1) & ~1;
pitch = ((w << 1) + 15) & ~15;
bpp = pScrn->bitsPerPixel >> 3;
- fbpitch = bpp * pScrn->displayWidth;
size = ((pitch * h) + bpp - 1) / bpp;
if(!(linear = CHIPSAllocateMemory(pScrn, NULL, size)))