diff options
author | marha <marha@users.sourceforge.net> | 2010-01-05 08:57:42 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-01-05 08:57:42 +0000 |
commit | 4b1326f06330c00501dd84100ed3a1987e2fa631 (patch) | |
tree | 6675ebcf771a6fdfeb9a2164f08811407731482e /xorg-server/hw/kdrive/src/kxv.c | |
parent | 7397e255c2e82618ab55ef2c81636c8e688b1225 (diff) | |
parent | 163827567b71b0763a4c1a7104159cd08b5c2d95 (diff) | |
download | vcxsrv-4b1326f06330c00501dd84100ed3a1987e2fa631.tar.gz vcxsrv-4b1326f06330c00501dd84100ed3a1987e2fa631.tar.bz2 vcxsrv-4b1326f06330c00501dd84100ed3a1987e2fa631.zip |
svn merge ^/branches/released
Diffstat (limited to 'xorg-server/hw/kdrive/src/kxv.c')
-rw-r--r-- | xorg-server/hw/kdrive/src/kxv.c | 303 |
1 files changed, 148 insertions, 155 deletions
diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c index 9a74654af..27ecc5d6c 100644 --- a/xorg-server/hw/kdrive/src/kxv.c +++ b/xorg-server/hw/kdrive/src/kxv.c @@ -1,6 +1,6 @@ -/* +/* - XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) + XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com> Copyright (C) 2000, 2001 - Nokia Home Communications @@ -67,29 +67,29 @@ static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *); static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*); static int KdXVFreePort(XvPortPtr); static int KdXVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr); static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32); static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *); static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8, - CARD16, CARD16,CARD16, CARD16, + CARD16, CARD16,CARD16, CARD16, unsigned int*, unsigned int*); static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16, XvImagePtr, unsigned char*, Bool, CARD16, CARD16); -static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, +static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, CARD16*, CARD16*, int*, int*); @@ -134,12 +134,12 @@ KdXVRegisterGenericAdaptorDriver( /* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */ - newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) * + newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) * (1 + NumGenDrivers)); if (!newdrivers) return 0; GenDrivers = newdrivers; - + GenDrivers[NumGenDrivers++] = InitFunc; return 1; @@ -184,7 +184,7 @@ KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr) Bool KdXVScreenInit( - ScreenPtr pScreen, + ScreenPtr pScreen, KdVideoAdaptorPtr *adaptors, int num ){ @@ -197,7 +197,7 @@ KdXVScreenInit( KdXVGeneration = serverGeneration; if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc) - return FALSE; + return FALSE; if(Success != (*XvScreenInitProc)(pScreen)) return FALSE; @@ -247,20 +247,18 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) { int i; - if(pAdaptor->name) - xfree(pAdaptor->name); + xfree(pAdaptor->name); if(pAdaptor->pEncodings) { XvEncodingPtr pEncode = pAdaptor->pEncodings; for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) { - if(pEncode->name) xfree(pEncode->name); + xfree(pEncode->name); } xfree(pAdaptor->pEncodings); } - if(pAdaptor->pFormats) - xfree(pAdaptor->pFormats); + xfree(pAdaptor->pFormats); if(pAdaptor->pPorts) { XvPortPtr pPort = pAdaptor->pPorts; @@ -269,9 +267,9 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) for(i = 0; i < pAdaptor->nPorts; i++, pPort++) { pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; if(pPriv) { - if(pPriv->clientClip) + if(pPriv->clientClip) REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip); - if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) + if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip); xfree(pPriv); } @@ -283,22 +281,20 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) XvAttributePtr pAttribute = pAdaptor->pAttributes; for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) { - if(pAttribute->name) xfree(pAttribute->name); + xfree(pAttribute->name); } xfree(pAdaptor->pAttributes); } - if(pAdaptor->nImages) - xfree(pAdaptor->pImages); - - if(pAdaptor->devPriv.ptr) - xfree(pAdaptor->devPriv.ptr); + xfree(pAdaptor->pImages); + + xfree(pAdaptor->devPriv.ptr); } static Bool KdXVInitAdaptors( - ScreenPtr pScreen, + ScreenPtr pScreen, KdVideoAdaptorPtr *infoPtr, int number ) { @@ -329,7 +325,7 @@ KdXVInitAdaptors( pxvs->nAdaptors = 0; pxvs->pAdaptors = NULL; - if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) + if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) return FALSE; for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) { @@ -343,7 +339,7 @@ KdXVInitAdaptors( if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings) continue; - pa->type = adaptorPtr->type; + pa->type = adaptorPtr->type; if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo) pa->type &= ~XvVideoMask; @@ -354,19 +350,19 @@ KdXVInitAdaptors( if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes) pa->type &= ~XvImageMask; - if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && + if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && !adaptorPtr->PutStill) pa->type &= ~XvInputMask; if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill) pa->type &= ~XvOutputMask; - - if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) + + if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) continue; - if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) + if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) continue; - pa->pScreen = pScreen; + pa->pScreen = pScreen; pa->ddAllocatePort = KdXVAllocatePort; pa->ddFreePort = KdXVFreePort; pa->ddPutVideo = KdXVPutVideo; @@ -385,8 +381,8 @@ KdXVInitAdaptors( if(adaptorPtr->nEncodings && (pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) { - for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; - i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) + for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; + i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) { pe->id = encodingPtr->id; pe->pScreen = pScreen; @@ -398,14 +394,14 @@ KdXVInitAdaptors( pe->rate.denominator = encodingPtr->rate.denominator; } pa->nEncodings = adaptorPtr->nEncodings; - pa->pEncodings = pEncode; - } + pa->pEncodings = pEncode; + } if(adaptorPtr->nImages && (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) { for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages; - i < adaptorPtr->nImages; i++, pi++, imagePtr++) + i < adaptorPtr->nImages; i++, pi++, imagePtr++) { pi->id = imagePtr->id; pi->type = imagePtr->type; @@ -437,8 +433,8 @@ KdXVInitAdaptors( if(adaptorPtr->nAttributes && (pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) { - for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; - i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) + for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; + i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) { pat->flags = attributePtr->flags; pat->min_value = attributePtr->min_value; @@ -447,8 +443,8 @@ KdXVInitAdaptors( strcpy(pat->name, attributePtr->name); } pa->nAttributes = adaptorPtr->nAttributes; - pa->pAttributes = pAttribute; - } + pa->pAttributes = pAttribute; + } totFormat = adaptorPtr->nFormats; @@ -457,8 +453,8 @@ KdXVInitAdaptors( KdXVFreeAdaptor(pa); continue; } - for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; - i < adaptorPtr->nFormats; i++, formatPtr++) + for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; + i < adaptorPtr->nFormats; i++, formatPtr++) { numVisuals = pScreen->numVisuals; pVisual = pScreen->visuals; @@ -468,26 +464,26 @@ KdXVInitAdaptors( (pVisual->nplanes == formatPtr->depth)) { if(numFormat >= totFormat) { - void *moreSpace; + void *moreSpace; totFormat *= 2; - moreSpace = xrealloc(pFormat, + moreSpace = xrealloc(pFormat, totFormat * sizeof(XvFormatRec)); if(!moreSpace) break; pFormat = moreSpace; pf = pFormat + numFormat; } - pf->visual = pVisual->vid; + pf->visual = pVisual->vid; pf->depth = formatPtr->depth; pf++; numFormat++; } pVisual++; - } + } } pa->nFormats = numFormat; - pa->pFormats = pFormat; + pa->pFormats = pFormat; if(!numFormat) { KdXVFreeAdaptor(pa); continue; @@ -517,15 +513,15 @@ KdXVInitAdaptors( KdXVFreeAdaptor(pa); continue; } - for(pp = pPort, i = 0, numPort = 0; + for(pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) { - if(!(pp->id = FakeClientID(0))) + if(!(pp->id = FakeClientID(0))) continue; - if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) + if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) continue; - + if(!AddResource(pp->id, PortResource, pp)) { xfree(portPriv); continue; @@ -542,7 +538,7 @@ KdXVInitAdaptors( portPriv->screen = screen; portPriv->AdaptorRec = adaptorPriv; portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr; - + pp++; numPort++; } @@ -554,7 +550,7 @@ KdXVInitAdaptors( } pa->base_id = pPort->id; - + pa++; numAdaptor++; } @@ -580,13 +576,13 @@ KdXVInitAdaptors( the GC and used it's clip list when they needed to reclip the window, even if the client clip was different from the one the video was initialized with. If the original GC was destroyed, they had to stop - the video. I like the new method better (MArk). + the video. I like the new method better (MArk). This function only works for windows. Will need to rewrite when (if) we support pixmap rendering. */ -static void +static void KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) { RegionPtr pregWin, pCompositeClip; @@ -623,7 +619,7 @@ KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) if(freeCompClip) { REGION_DESTROY(pWin->pScreen, pregWin); - } + } } /* Save the current clientClip and update the CompositeClip whenever @@ -631,7 +627,7 @@ KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) static void KdXVCopyClip( - XvPortRecPrivatePtr portPriv, + XvPortRecPrivatePtr portPriv, GCPtr pGC ){ /* copy the new clip if it exists */ @@ -672,12 +668,12 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(portPriv->pDraw->pScreen, &WinRegion, &WinBox, 1); REGION_INIT(portPriv->pDraw->pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); - + REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(portPriv->pDraw->pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -689,10 +685,10 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv) } ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen, portPriv->pDraw, - portPriv->vid_x, portPriv->vid_y, - WinBox.x1, WinBox.y1, - portPriv->vid_w, portPriv->vid_h, - portPriv->drw_w, portPriv->drw_h, + portPriv->vid_x, portPriv->vid_y, + WinBox.x1, WinBox.y1, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr); if(ret == Success) @@ -736,11 +732,11 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); /* clip and translate to the viewport */ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { @@ -753,10 +749,10 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) VPBox.y2 = screen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } - + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -767,8 +763,8 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; @@ -780,10 +776,10 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) } ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->screen, portPriv->pDraw, - portPriv->vid_x, portPriv->vid_y, + portPriv->vid_x, portPriv->vid_y, WinBox.x1, WinBox.y1, - portPriv->vid_w, portPriv->vid_h, - portPriv->drw_w, portPriv->drw_h, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr); if(ret == Success) portPriv->isOn = XV_ON; @@ -825,11 +821,11 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); /* clip and translate to the viewport */ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { @@ -842,10 +838,10 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) VPBox.y2 = screen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } - + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -856,8 +852,8 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; @@ -897,10 +893,10 @@ static int KdXVReputAllVideo(WindowPtr pWin, pointer data) { KdXVWindowPtr WinPriv; - + if (pWin->drawable.type != DRAWABLE_WINDOW) return WT_DONTWALKCHILDREN; - + WinPriv = GET_KDXV_WINDOW(pWin); while(WinPriv) { @@ -917,7 +913,7 @@ KdXVReputAllVideo(WindowPtr pWin, pointer data) static int KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) { - KdXVWindowPtr winPriv, PrivRoot; + KdXVWindowPtr winPriv, PrivRoot; winPriv = PrivRoot = GET_KDXV_WINDOW(pWin); @@ -934,7 +930,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) winPriv->PortRec = portPriv; winPriv->next = PrivRoot; dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv); - } + } return Success; } @@ -948,14 +944,14 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) while(winPriv) { if(winPriv->PortRec == portPriv) { - if(prevPriv) + if(prevPriv) prevPriv->next = winPriv->next; - else + else dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next); xfree(winPriv); break; } - prevPriv = winPriv; + prevPriv = winPriv; winPriv = winPriv->next; } portPriv->pDraw = NULL; @@ -1033,7 +1029,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) /* filter out XClearWindow/Area */ if (!pWin->valdata) return; - + pPrev = NULL; while(WinPriv) { @@ -1044,10 +1040,10 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) switch(pPriv->type) { case XvInputMask: KdXVReputVideo(pPriv); - break; + break; case XvOutputMask: - KdXVRegetVideo(pPriv); - break; + KdXVRegetVideo(pPriv); + break; default: /* overlaid still/image*/ if (pPriv->AdaptorRec->ReputImage) KdXVReputImage(pPriv); @@ -1061,7 +1057,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) } pPriv->pDraw = NULL; - if(!pPrev) + if(!pPrev) dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next); else pPrev->next = WinPriv->next; @@ -1078,7 +1074,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) } -static void +static void KdXVClipNotify(WindowPtr pWin, int dx, int dy) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -1097,7 +1093,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy) pPriv->pCompositeClip = NULL; - /* Stop everything except images, but stop them too if the + /* Stop everything except images, but stop them too if the window isn't visible. But we only remove the images. */ if(pPriv->type || !visible) { @@ -1110,7 +1106,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy) if(!pPriv->type) { /* overlaid still/image */ pPriv->pDraw = NULL; - if(!pPrev) + if(!pPrev) dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next); else pPrev->next = WinPriv->next; @@ -1153,16 +1149,13 @@ KdXVCloseScreen(int i, ScreenPtr pScreen) /* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */ - for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { + for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { KdXVFreeAdaptor(pa); } - if(pxvs->pAdaptors) - xfree(pxvs->pAdaptors); - + xfree(pxvs->pAdaptors); xfree(ScreenPriv); - return TRUE; } @@ -1193,9 +1186,9 @@ KdXVEnable(ScreenPtr pScreen) { if (!KdXVRunning (pScreen)) return TRUE; - - WalkTree(pScreen, KdXVReputAllVideo, 0); - + + WalkTree(pScreen, KdXVReputAllVideo, 0); + return TRUE; } @@ -1214,7 +1207,7 @@ KdXVDisable(ScreenPtr pScreen) pxvs = GET_XV_SCREEN(pScreen); ScreenPriv = GET_KDXV_SCREEN(pScreen); - + for(i = 0; i < pxvs->nAdaptors; i++) { pAdaptor = &pxvs->pAdaptors[i]; for(j = 0; j < pAdaptor->nPorts; j++) { @@ -1263,8 +1256,8 @@ KdXVPutVideo( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1277,7 +1270,7 @@ KdXVPutVideo( pPort->pDraw = (DrawablePtr)NULL; return BadAlloc; } - + /* If we are changing windows, unregister our port in the old window */ if(portPriv->pDraw && (portPriv->pDraw != pDraw)) KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1302,7 +1295,7 @@ KdXVPutVideo( pPort->pDraw = pDraw; if (!pScreenPriv->enabled) return Success; - + return(KdXVReputVideo(portPriv)); } @@ -1312,13 +1305,13 @@ KdXVPutStill( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - ScreenPtr pScreen = pDraw->pScreen; + ScreenPtr pScreen = pDraw->pScreen; KdScreenPriv(pScreen); KdScreenInfo *screen=pScreenPriv->screen; RegionRec WinRegion; @@ -1336,10 +1329,10 @@ KdXVPutStill( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; @@ -1351,7 +1344,7 @@ KdXVPutStill( VPBox.y2 = screen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } @@ -1367,7 +1360,7 @@ KdXVPutStill( if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; @@ -1417,8 +1410,8 @@ KdXVGetVideo( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1431,7 +1424,7 @@ KdXVGetVideo( pPort->pDraw = (DrawablePtr)NULL; return BadAlloc; } - + /* If we are changing windows, unregister our port in the old window */ if(portPriv->pDraw && (portPriv->pDraw != pDraw)) KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1454,7 +1447,7 @@ KdXVGetVideo( /* To indicate to the DI layer that we were successful */ pPort->pDraw = pDraw; - + if(!pScreenPriv->enabled) return Success; return(KdXVRegetVideo(portPriv)); @@ -1466,8 +1459,8 @@ KdXVGetStill( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1489,10 +1482,10 @@ KdXVGetStill( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->pDraw) { KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1526,7 +1519,7 @@ GET_STILL_BAILOUT: return ret; } - + static int KdXVStopVideo( @@ -1539,7 +1532,7 @@ KdXVStopVideo( if(pDraw->type != DRAWABLE_WINDOW) return BadAlloc; - + KdXVRemovePortFromWindow((WindowPtr)pDraw, portPriv); if(!pScreenPriv->enabled) return Success; @@ -1563,8 +1556,8 @@ KdXVSetPortAttribute( INT32 value ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen, + + return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen, attribute, value, portPriv->DevPriv.ptr)); } @@ -1577,8 +1570,8 @@ KdXVGetPortAttribute( INT32 *p_value ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen, + + return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen, attribute, (int *) p_value, portPriv->DevPriv.ptr)); } @@ -1594,8 +1587,8 @@ KdXVQueryBestSize( unsigned int *p_w, unsigned int *p_h ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen, + + (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen, (Bool)motion, vid_w, vid_h, drw_w, drw_h, p_w, p_h, portPriv->DevPriv.ptr); @@ -1603,14 +1596,14 @@ KdXVQueryBestSize( } -static int +static int KdXVPutImage( - ClientPtr client, - DrawablePtr pDraw, - XvPortPtr pPort, + ClientPtr client, + DrawablePtr pDraw, + XvPortPtr pPort, GCPtr pGC, - INT16 src_x, INT16 src_y, - CARD16 src_w, CARD16 src_h, + INT16 src_x, INT16 src_y, + CARD16 src_w, CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr format, @@ -1636,10 +1629,10 @@ KdXVPutImage( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; @@ -1651,7 +1644,7 @@ KdXVPutImage( VPBox.y2 = pScreen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } @@ -1667,7 +1660,7 @@ KdXVPutImage( if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; @@ -1712,19 +1705,19 @@ PUT_IMAGE_BAILOUT: } -static int +static int KdXVQueryImageAttributes( - ClientPtr client, + ClientPtr client, XvPortPtr pPort, - XvImagePtr format, - CARD16 *width, - CARD16 *height, + XvImagePtr format, + CARD16 *width, + CARD16 *height, int *pitches, int *offsets ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen, + return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen, format->id, width, height, pitches, offsets); } @@ -1878,7 +1871,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg) xRectangle *rects, *r; BoxPtr pBox = REGION_RECTS (pRgn); int nBox = REGION_NUM_RECTS (pRgn); - + rects = xalloc (nBox * sizeof (xRectangle)); if (!rects) goto bail0; @@ -1892,18 +1885,18 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg) r++; pBox++; } - + pGC = GetScratchGC (pDraw->depth, pDraw->pScreen); if (!pGC) goto bail1; - + val[0] = fg; val[1] = IncludeInferiors; ChangeGC (pGC, GCForeground|GCSubwindowMode, val); - + ValidateGC (pDraw, pGC); - - (*pGC->ops->PolyFillRect) (pDraw, pGC, + + (*pGC->ops->PolyFillRect) (pDraw, pGC, REGION_NUM_RECTS (pRgn), rects); FreeScratchGC (pGC); |