diff options
author | Keith Packard <keithp@keithp.com> | 2001-06-19 09:31:47 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2001-06-19 09:31:47 +0000 |
commit | 918ff10f2697ee8c17013bd31596072a38c5ac9b (patch) | |
tree | 492b2f647335ff82456a0ae0bf51a4b9270592ed | |
parent | 6d86517b0ed0db51f3eaf19c186db52feb1e47e0 (diff) |
Finish Xv support for kdrive/mach64
-rw-r--r-- | hw/kdrive/mach64/mach64.c | 22 | ||||
-rw-r--r-- | hw/kdrive/mach64/mach64.h | 31 | ||||
-rw-r--r-- | hw/kdrive/mach64/mach64draw.c | 22 | ||||
-rw-r--r-- | hw/kdrive/mach64/mach64video.c | 315 |
4 files changed, 222 insertions, 168 deletions
diff --git a/hw/kdrive/mach64/mach64.c b/hw/kdrive/mach64/mach64.c index ec49aafaa..3f1c90928 100644 --- a/hw/kdrive/mach64/mach64.c +++ b/hw/kdrive/mach64/mach64.c @@ -19,7 +19,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.c,v 1.2 2001/06/04 09:45:41 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.c,v 1.3 2001/06/16 05:48:48 keithp Exp $ */ #include "mach64.h" #include <sys/io.h> @@ -78,6 +78,21 @@ mach64ScreenInit (KdScreenInfo *screen) if (mach64s->vesa.mapping != VESA_LINEAR) screen->dumb = TRUE; mach64s->screen = mach64s->vesa.fb; + switch (screen->fb[0].depth) { + case 8: + mach64s->colorKey = 0xff; + break; + case 15: + case 16: + mach64s->colorKey = 0x001e; + break; + case 24: + mach64s->colorKey = 0x0000fe; + break; + default: + mach64s->colorKey = 1; + break; + } mach64s->colorKey = 1; memory = mach64s->vesa.fb_size; screen_size = screen->fb[0].byteStride * screen->height; @@ -108,7 +123,10 @@ Bool mach64InitScreen (ScreenPtr pScreen) { #ifdef XV - mach64InitVideo(pScreen); + KdScreenPriv(pScreen); + Mach64CardInfo *mach64c = pScreenPriv->screen->card->driver; + if (mach64c->media_reg && mach64c->reg) + mach64InitVideo(pScreen); #endif return vesaInitScreen (pScreen); } diff --git a/hw/kdrive/mach64/mach64.h b/hw/kdrive/mach64/mach64.h index dd242680b..ae79e4e82 100644 --- a/hw/kdrive/mach64/mach64.h +++ b/hw/kdrive/mach64/mach64.h @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.h,v 1.2 2001/06/04 09:45:42 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64.h,v 1.3 2001/06/16 05:48:48 keithp Exp $ */ #ifndef _MACH64_H_ #define _MACH64_H_ @@ -349,6 +349,8 @@ typedef struct _Reg { #define SCALE_OVERLAY_EN (1 << 30) #define SCALE_EN (1 << 31) +#define VIDEO_IN_VYUY422 (0xb) +#define VIDEO_IN_YVYU422 (0xc) #define SCALER_IN_15bpp (0x3 << 16) #define SCALER_IN_16bpp (0x4 << 16) #define SCALER_IN_32bpp (0x6 << 16) @@ -428,14 +430,15 @@ typedef struct _MediaReg { VOL32 TVO_CNTL; /* 0x140 */ VOL32 unused_141[15]; VOL32 unused_150; /* 0x150 */ - VOL32 CRT_HORZ_VERT_LOAD; - VOL32 AGP_BASE_AGP_CNTL; - VOL32 SCALER_COLOUR_CNTL; - VOL32 SCALER_H_COEFF0; - VOL32 SCALER_H_COEFF1; - VOL32 SCALER_H_COEFF2; - VOL32 SCALER_H_COEFF3; - VOL32 SCALER_H_COEFF4; + VOL32 CRT_HORZ_VERT_LOAD; /* 0x151 */ + VOL32 AGP_BASE; /* 0x152 */ + VOL32 AGP_CNTL; /* 0x153 */ + VOL32 SCALER_COLOUR_CNTL; /* 0x154 */ + VOL32 SCALER_H_COEFF0; /* 0x155 */ + VOL32 SCALER_H_COEFF1; /* 0x156 */ + VOL32 SCALER_H_COEFF2; /* 0x157 */ + VOL32 SCALER_H_COEFF3; /* 0x158 */ + VOL32 SCALER_H_COEFF4; /* 0x159 */ VOL32 unused_15a; VOL32 unused_15b; VOL32 GUI_CMDFIFO_DEBUG; @@ -504,8 +507,8 @@ typedef struct _mach64PortPriv { CARD8 currentBuf; - CARD8 brightness; - CARD8 contrast; + int brightness; + int saturation; RegionRec clip; CARD32 colorKey; @@ -543,6 +546,12 @@ mach64ReadLCD (Reg *reg, int id); void mach64WriteLCD (Reg *reg, int id, CARD32 data); +void +mach64WaitAvail(Reg *reg, int n); + +void +mach64WaitIdle (Reg *reg); + Bool mach64DrawSetup (ScreenPtr pScreen); diff --git a/hw/kdrive/mach64/mach64draw.c b/hw/kdrive/mach64/mach64draw.c index cdb308d22..9632eb523 100644 --- a/hw/kdrive/mach64/mach64draw.c +++ b/hw/kdrive/mach64/mach64draw.c @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64draw.c,v 1.2 2001/06/04 09:45:42 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/mach64/mach64draw.c,v 1.3 2001/06/16 05:48:49 keithp Exp $ */ #include "mach64.h" #include "mach64draw.h" @@ -69,8 +69,8 @@ static CARD32 combo; #define IDX(reg,n) (&(reg)->n - &(reg)->CRTC_H_TOTAL_DISP) -static void -WAIT_AVAIL(Reg *reg, int n) +void +mach64WaitAvail(Reg *reg, int n) { if (avail < n) { @@ -80,8 +80,8 @@ WAIT_AVAIL(Reg *reg, int n) avail -= n; } -static void -WAIT_IDLE (Reg *reg) +void +mach64WaitIdle (Reg *reg) { while (reg->GUI_STAT & 1) ; @@ -98,7 +98,7 @@ mach64Setup (ScreenPtr pScreen, CARD32 combo, int wait) triple = mach64s->bpp24; avail = 0; - WAIT_AVAIL(reg, wait + 3); + mach64WaitAvail(reg, wait + 3); reg->DP_PIX_WIDTH = mach64s->DP_PIX_WIDTH; reg->USR1_DST_OFF_PITCH = mach64s->USR1_DST_OFF_PITCH; reg->DP_SET_GUI_ENGINE = mach64s->DP_SET_GUI_ENGINE | (combo << 20); @@ -133,10 +133,10 @@ mach64Solid (int x1, int y1, int x2, int y2) DST_Y_DIR | DST_24_ROT_EN | DST_24_ROT((x1 / 4) % 6)); - WAIT_AVAIL (reg, 1); + mach64WaitAvail (reg, 1); reg->GUI_TRAJ_CNTL = traj; } - WAIT_AVAIL(reg,2); + mach64WaitAvail(reg,2); reg->DST_X_Y = MACH64_XY(x1,y1); reg->DST_WIDTH_HEIGHT = MACH64_XY(x2-x1,y2-y1); } @@ -194,7 +194,7 @@ mach64Copy (int srcX, if (copyDy > 0) traj |= 2; - WAIT_AVAIL (reg, 1); + mach64WaitAvail (reg, 1); reg->GUI_TRAJ_CNTL = traj; } if (copyDx <= 0) @@ -207,7 +207,7 @@ mach64Copy (int srcX, srcY += h - 1; dstY += h - 1; } - WAIT_AVAIL (reg, 4); + mach64WaitAvail (reg, 4); reg->SRC_Y_X = MACH64_YX(srcX, srcY); reg->SRC_WIDTH1 = w; reg->DST_Y_X = MACH64_YX(dstX, dstY); @@ -414,5 +414,5 @@ mach64DrawSync (ScreenPtr pScreen) mach64CardInfo(pScreenPriv); reg = mach64c->reg; - WAIT_IDLE (reg); + mach64WaitIdle (reg); } diff --git a/hw/kdrive/mach64/mach64video.c b/hw/kdrive/mach64/mach64video.c index 2566f3a5a..345ca3bbd 100644 --- a/hw/kdrive/mach64/mach64video.c +++ b/hw/kdrive/mach64/mach64video.c @@ -26,7 +26,7 @@ #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -static Atom xvBrightness, xvContrast, xvColorKey; +static Atom xvBrightness, xvSaturation, xvColorKey; #define IMAGE_MAX_WIDTH 720 #define IMAGE_MAX_HEIGHT 576 @@ -41,12 +41,19 @@ mach64StopVideo(KdScreenInfo *screen, pointer data, Bool exit) Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + Reg *reg = mach64c->reg; MediaReg *media = mach64c->media_reg; REGION_EMPTY(screen->pScreen, &pPortPriv->clip); if(pPortPriv->videoOn) { + mach64WaitIdle (reg); + + media->OVERLAY_Y_X_START = 0x80000000; + media->OVERLAY_Y_X_END = 0; + media->OVERLAY_SCALE_CNTL = 0; + media->OVERLAY_Y_X_START = 0; pPortPriv->videoOn = FALSE; } } @@ -67,15 +74,19 @@ mach64SetPortAttribute(KdScreenInfo *screen, if(attribute == xvBrightness) { - if((value < -128) || (value > 127)) - return BadValue; + if(value < -1000) + value = -1000; + if (value > 1000) + value = 1000; pPortPriv->brightness = value; } - else if(attribute == xvContrast) + else if(attribute == xvSaturation) { - if((value < 0) || (value > 255)) - return BadValue; - pPortPriv->contrast = value; + if (value < -1000) + value = -1000; + if (value > 1000) + value = 1000; + pPortPriv->saturation = value; } else if(attribute == xvColorKey) { @@ -98,8 +109,8 @@ mach64GetPortAttribute(KdScreenInfo *screen, if(attribute == xvBrightness) *value = pPortPriv->brightness; - else if(attribute == xvContrast) - *value = pPortPriv->contrast; + else if(attribute == xvSaturation) + *value = pPortPriv->saturation; else if(attribute == xvColorKey) *value = pPortPriv->colorKey; else @@ -162,6 +173,7 @@ static void mach64CopyPlanarData(KdScreenInfo *screen, unsigned char *buf, int srcPitch, + int srcPitch2, int dstPitch, /* of chroma */ int srcH, int top, @@ -176,68 +188,101 @@ mach64CopyPlanarData(KdScreenInfo *screen, Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - int i; - CARD8 *src1, *src2, *src3, *dst1, *dst2, *dst3; + int i, j; + CARD8 *src1, *src2, *src3, *dst1; - /* Copy Y data */ - src1 = buf + (top*srcPitch) + left; + /* compute source data pointers */ + src1 = buf; + src2 = src1 + srcH * srcPitch; + src3 = src2 + (srcH >> 1) * srcPitch2; + + /* adjust for origin */ + src1 += top * srcPitch + left; + src2 += (top >> 1) * srcPitch2 + (left >> 1); + src3 += (top >> 1) * srcPitch2 + (left >> 1); + + if (id == FOURCC_I420) + { + CARD8 *srct = src2; + src2 = src3; + src3 = srct; + } + if (pPortPriv->currentBuf == 0) dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset; else dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset; - for (i = 0; i < h; i++) + w >>= 1; + for (j = 0; j < h; j++) { - memcpy(dst1, src1, w); + CARD32 *dst = (CARD32 *) dst1; + CARD8 *s1 = src1; + CARD8 *s2 = src2; + CARD8 *s3 = src3; + + for (i = 0; i < w; i++) + { + *dst++ = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); + s1 += 2; + s2++; + s3++; + } src1 += srcPitch; - dst1 += dstPitch << 1; + dst1 += dstPitch; + if (j & 1) + { + src2 += srcPitch2; + src3 += srcPitch2; + } } +} - /* Copy V data for YV12, or U data for I420 */ - src2 = buf + (srcH*srcPitch) + ((top*srcPitch)>>2) + (left>>1); - if (pPortPriv->currentBuf == 0) - { - if (id == FOURCC_I420) - dst2 = (CARD8 *) mach64s->vesa.fb + pPortPriv->UBuf0Offset; - else - dst2 = (CARD8 *) mach64s->vesa.fb + pPortPriv->VBuf0Offset; - } else { - if (id == FOURCC_I420) - dst2 = (CARD8 *) mach64s->vesa.fb + pPortPriv->UBuf1Offset; - else - dst2 = (CARD8 *) mach64s->vesa.fb + pPortPriv->VBuf1Offset; +/* I really should stick this in miregion */ +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; + + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); + + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; } - for (i = 0; i < h/2; i++) - { - memcpy(dst2, src2, w/2); - src2 += srcPitch>>1; - dst2 += dstPitch; - } + return TRUE; +} - /* Copy U data for YV12, or V data for I420 */ - src3 = buf + (srcH*srcPitch) + ((srcH*srcPitch)>>2) + ((top*srcPitch)>>2) + (left>>1); - if (pPortPriv->currentBuf == 0) - { - if (id == FOURCC_I420) - dst3 = (CARD8 *) mach64s->vesa.fb + pPortPriv->VBuf0Offset; - else - dst3 = (CARD8 *) mach64s->vesa.fb + pPortPriv->UBuf0Offset; - } - else - { - if (id == FOURCC_I420) - dst3 = (CARD8 *) mach64s->vesa.fb + pPortPriv->VBuf1Offset; - else - dst3 = (CARD8 *) mach64s->vesa.fb + pPortPriv->UBuf1Offset; - } - - for (i = 0; i < h/2; i++) - { - memcpy(dst3, src3, w/2); - src3 += srcPitch>>1; - dst3 += dstPitch; - } +static void +mach64PaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg) +{ + WindowPtr pRoot = WindowTable[pScreen->myNum]; + unsigned backgroundState; + PixUnion background; + + /* XXX use window background painting routine XXX */ + backgroundState = pRoot->backgroundState; + background = pRoot->background; + pRoot->backgroundState = BackgroundPixel; + pRoot->background.pixel = fg; + (*pScreen->PaintWindowBackground) (pRoot, pRgn, PW_BACKGROUND); + pRoot->backgroundState = backgroundState; + pRoot->background = background; } /* Mach64ClipVideo - @@ -335,102 +380,90 @@ mach64DisplayVideo(KdScreenInfo *screen, Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + Reg *reg = mach64c->reg; MediaReg *media = mach64c->media_reg; int xscaleInt, xscaleFract, yscaleInt, yscaleFract; int xscaleIntUV = 0, xscaleFractUV = 0; int yscaleIntUV = 0, yscaleFractUV = 0; int HORZ_INC, VERT_INC; - unsigned int swidth; CARD32 SCALER_IN; + int tmp; + int left; + int bright; + int sat; + mach64WaitIdle (reg); + /* lock registers to prevent non-atomic update */ media->OVERLAY_Y_X_START = 0x80000000; /* ending screen coordinate */ - media->OVERLAY_Y_X_END = MACH64_YX (x2, y2); + media->OVERLAY_Y_X_END = MACH64_YX (dstBox->x2, dstBox->y2); /* color key */ media->OVERLAY_GRAPHICS_KEY_CLR = mach64s->colorKey; media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1; - /* XXX always display video for now */ - media->OVERLAY_KEY_CNTL = 1; + /* set key control to obey only graphics color key */ + media->OVERLAY_KEY_CNTL = 0x50; /* no exclusive video region */ media->OVERLAY_EXCLUSIVE_HORZ = 0; - + media->OVERLAY_EXCLUSIVE_VERT = 0; + /* scaling coefficients */ + media->SCALER_H_COEFF0 = 0x00002000; + media->SCALER_H_COEFF1 = 0x0D06200D; + media->SCALER_H_COEFF2 = 0x0D0A1C0D; + media->SCALER_H_COEFF3 = 0x0C0E1A0C; + media->SCALER_H_COEFF4 = 0x0C14140C; + VERT_INC = (src_h << 12) / drw_h; HORZ_INC = (src_w << 12) / drw_w; media->OVERLAY_SCALE_INC = MACH64_YX(HORZ_INC, VERT_INC); media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND | - SCALE_GAMMA_22 | + SCALE_GAMMA_BRIGHT | + SCALE_BANDWIDTH | + SCALE_OVERLAY_EN | SCALE_EN); media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset; media->SCALER_BUF1_OFFSET = pPortPriv->YBuf0Offset; - media->SCALER_BUF0_OFFSET_U = pPortPriv->UBuf0Offset; - media->SCALER_BUF1_OFFSET_U = pPortPriv->UBuf1Offset; - media->SCALER_BUF0_OFFSET_V = pPortPriv->VBuf0Offset; - media->SCALER_BUF1_OFFSET_V = pPortPriv->VBuf1Offset; - media->SCALER_BUF_PITCH = src_w; - media->SCALER_HEIGHT_WIDTH = MACH64_YX(src_w, src_h); - media->SCALER_TEST + 0; - - media->SCALER_COLOUR_CNTL = ((0 << 0) | /* BRIGHTNESS */ - (0x10 << 8) | /* SATURATION_U */ - (0x10 << 16) | /* SATURATION_V */ + media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset; + media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset; + media->SCALER_BUF_PITCH = dstPitch >> 1; + media->SCALER_HEIGHT_WIDTH = MACH64_YX(src_w - (x1 >> 16), src_h - (y1 >> 16)); + media->SCALER_TEST = 0; + + bright = (pPortPriv->brightness * 64 / 1000); + if (bright < -0x40) + bright = -0x40; + if (bright > 0x3f) + bright = 0x3f; + bright = bright & 0x7f; + sat = ((pPortPriv->saturation * 31 + 31000) / 2000); + if (sat > 0x1f) + sat = 0x1f; + if (sat < 0) + sat = 0; + media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */ + (sat << 8) | /* SATURATION_U */ + (sat << 16) | /* SATURATION_V */ (0 << 21) | /* SCALER_VERT_ADJ_UV */ (0 << 28)); /* SCALER_HORZ_ADJ_UV */ - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - SCALER_IN = SCALER_IN_YUV_12; - swidth = (width + 7) & ~7; - break; - break; - case FOURCC_UYVY: - SCALER_IN = SCALER_IN_VYUY422; - break; - case FOURCC_YUY2: + if (id == FOURCC_UYVY) SCALER_IN = SCALER_IN_YVYU422; - break; - } + else + SCALER_IN = SCALER_IN_VYUY422; + + media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422; - media->VIDEO_FORMAT = SCALER_IN; media->CAPTURE_CONFIG = (OVL_BUF_MODE | (pPortPriv->currentBuf == 0 ? 0 : OVL_BUF_NEXT)); -#if 0 - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - overlay->OV0STRIDE = (dstPitch << 1) | (dstPitch << 16); - overlay->OV0CMD &= ~SOURCE_FORMAT; - overlay->OV0CMD |= YUV_420; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - overlay->OV0STRIDE = dstPitch; - overlay->OV0CMD &= ~SOURCE_FORMAT; - overlay->OV0CMD |= YUV_422; - overlay->OV0CMD &= ~OV_BYTE_ORDER; - if (id == FOURCC_UYVY) - overlay->OV0CMD |= Y_SWAP; - break; - } - - overlay->OV0CMD &= ~BUFFER_AND_FIELD; - if (pPriv->currentBuf == 0) - overlay->OV0CMD |= BUFFER0_FIELD0; - else - overlay->OV0CMD |= BUFFER1_FIELD0; - - OVERLAY_UPDATE(i810c->OverlayPhysical); -#endif - /* set XY location and unlock */ - media->OVERLAY_Y_X_START = MACH64_YX (x1, y1); + media->OVERLAY_Y_X_START = MACH64_YX (dstBox->x1, dstBox->y1); } static int @@ -455,7 +488,7 @@ mach64PutImage(KdScreenInfo *screen, Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; INT32 x1, x2, y1, y2; - int srcPitch, dstPitch; + int srcPitch, srcPitch2, dstPitch; int top, left, npixels, nlines, size; BoxRec dstBox; @@ -479,16 +512,17 @@ mach64PutImage(KdScreenInfo *screen, switch(id) { case FOURCC_YV12: case FOURCC_I420: + dstPitch = ((width << 1) + 15) & ~15; srcPitch = (width + 3) & ~3; - dstPitch = ((width >> 1) + 7) & ~7; /* of chroma */ - size = dstPitch * height * 3; + srcPitch2 = ((width >> 1) + 3) & ~3; + size = dstPitch * height; break; case FOURCC_UYVY: case FOURCC_YUY2: default: - srcPitch = (width << 1); - dstPitch = (srcPitch + 7) & ~7; + dstPitch = ((width << 1) + 15) & ~15; size = dstPitch * height; + srcPitch = (width << 1); break; } @@ -508,9 +542,11 @@ mach64PutImage(KdScreenInfo *screen, #endif /* buffer swap */ +#if 0 if (pPortPriv->currentBuf == 0) pPortPriv->currentBuf = 1; else +#endif pPortPriv->currentBuf = 0; /* copy data */ @@ -523,7 +559,7 @@ mach64PutImage(KdScreenInfo *screen, case FOURCC_I420: top &= ~1; nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; - mach64CopyPlanarData(screen, buf, srcPitch, dstPitch, height, top, left, + mach64CopyPlanarData(screen, buf, srcPitch, srcPitch2, dstPitch, height, top, left, nlines, npixels, id); break; case FOURCC_UYVY: @@ -535,23 +571,14 @@ mach64PutImage(KdScreenInfo *screen, break; } -#if 0 /* update cliplist */ - if(!RegionsEqual(&pPortPriv->clip, clipBoxes)) { - REGION_COPY(pScreen, &pPortPriv->clip, clipBoxes); - mach64FillBoxSolid(screen, REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes), - pPortPriv->colorKey, GXcopy, ~0); - /* - XAAFillSolidRects(screen, pPortPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - */ + if (!RegionsEqual (&pPortPriv->clip, clipBoxes)) + { + REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); + mach64PaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey); } -#endif - mach64DisplayVideo(screen, id, width, height, dstPitch, - x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); pPortPriv->videoOn = TRUE; @@ -631,9 +658,9 @@ static KdVideoFormatRec Formats[NUM_FORMATS] = static KdAttributeRec Attributes[NUM_ATTRIBUTES] = { - {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, - {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, - {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"} + {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"}, + {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"} }; #define NUM_IMAGES 4 @@ -718,7 +745,7 @@ mach64SetupImageVideo(ScreenPtr pScreen) pPortPriv->colorKey = mach64s->colorKey & ((1 << screen->fb[0].depth) - 1); pPortPriv->videoOn = FALSE; pPortPriv->brightness = 0; - pPortPriv->contrast = 128; + pPortPriv->saturation = 0; pPortPriv->currentBuf = 0; /* gotta uninit this someplace */ @@ -727,7 +754,7 @@ mach64SetupImageVideo(ScreenPtr pScreen) mach64s->pAdaptor = adapt; xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); - xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); xvColorKey = MAKE_ATOM("XV_COLORKEY"); mach64ResetVideo(screen); |