static LayerListPtr NewLayerList (ScreenPtr pScreen, LayerPtr pLayer) { LayerListPtr pLayList; pLayList = (LayerListPtr) xalloc (sizeof (LayerListRec)); if (!pLayList) return 0; pLayList->pNext = 0; pLayList->pLayer = pLayer; pLayList->inheritClip = TRUE; REGION_NULL (pScreen, &pLayList->clipList); REGION_NULL (pScreen, &pLayList->borderClip); return pLayList; }
void fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { RegionRec rgnDst; int dx, dy; WindowPtr pwinRoot; pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); REGION_NULL (pWin->drawable.pScreen, &rgnDst); REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); fbValidateDrawable (&pWin->drawable); }
void fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { RegionRec rgnDst; int dx, dy; PixmapPtr pPixmap = fbGetWindowPixmap (pWin); DrawablePtr pDrawable = &pPixmap->drawable; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); REGION_NULL (pWin->drawable.pScreen, &rgnDst); REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); #ifdef COMPOSITE if (pPixmap->screen_x || pPixmap->screen_y) REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst, -pPixmap->screen_x, -pPixmap->screen_y); #endif fbCopyRegion (pDrawable, pDrawable, 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); fbValidateDrawable (&pWin->drawable); }
XF86VideoAdaptorPtr glamor_xv_init(ScreenPtr screen, int num_texture_ports) { glamor_port_private *port_priv; XF86VideoAdaptorPtr adapt; int i; glamor_xv_core_init(screen); adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports * (sizeof(glamor_port_private) + sizeof(DevUnion))); if (adapt == NULL) return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = 0; adapt->name = "GLAMOR Textured Video"; adapt->nEncodings = 1; adapt->pEncodings = DummyEncodingGLAMOR; adapt->nFormats = NUM_FORMATS; adapt->pFormats = Formats; adapt->nPorts = num_texture_ports; adapt->pPortPrivates = (DevUnion *) (&adapt[1]); adapt->pAttributes = glamor_xv_attributes; adapt->nAttributes = glamor_xv_num_attributes; port_priv = (glamor_port_private *) (&adapt->pPortPrivates[num_texture_ports]); adapt->pImages = glamor_xv_images; adapt->nImages = glamor_xv_num_images; adapt->PutVideo = NULL; adapt->PutStill = NULL; adapt->GetVideo = NULL; adapt->GetStill = NULL; adapt->StopVideo = glamor_xf86_xv_stop_video; adapt->SetPortAttribute = glamor_xf86_xv_set_port_attribute; adapt->GetPortAttribute = glamor_xf86_xv_get_port_attribute; adapt->QueryBestSize = glamor_xf86_xv_query_best_size; adapt->PutImage = glamor_xf86_xv_put_image; adapt->ReputImage = NULL; adapt->QueryImageAttributes = glamor_xf86_xv_query_image_attributes; for (i = 0; i < num_texture_ports; i++) { glamor_port_private *pPriv = &port_priv[i]; pPriv->brightness = 0; pPriv->contrast = 0; pPriv->saturation = 0; pPriv->hue = 0; pPriv->gamma = 1000; pPriv->transform_index = 0; REGION_NULL(pScreen, &pPriv->clip); adapt->pPortPrivates[i].ptr = (void *) (pPriv); } return adapt; }
/** * exaCreatePixmap() creates a new pixmap. * * If width and height are 0, this won't be a full-fledged pixmap and it will * get ModifyPixmapHeader() called on it later. So, we mark it as pinned, because * ModifyPixmapHeader() would break migration. These types of pixmaps are used * for scratch pixmaps, or to represent the visible screen. */ static PixmapPtr exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth) { PixmapPtr pPixmap; ExaPixmapPrivPtr pExaPixmap; int bpp; ExaScreenPriv(pScreen); if (w > 32767 || h > 32767) return NullPixmap; pPixmap = fbCreatePixmap (pScreen, w, h, depth); if (!pPixmap) return NULL; pExaPixmap = ExaGetPixmapPriv(pPixmap); bpp = pPixmap->drawable.bitsPerPixel; /* Glyphs have w/h equal to zero, and may not be migrated. See exaGlyphs. */ if (!w || !h) pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED; else pExaPixmap->score = EXA_PIXMAP_SCORE_INIT; pExaPixmap->area = NULL; pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr; pExaPixmap->sys_pitch = pPixmap->devKind; pExaPixmap->fb_ptr = NULL; if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1) pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8; else pExaPixmap->fb_pitch = w * bpp / 8; pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch, pExaScr->info->pixmapPitchAlign); pExaPixmap->fb_size = pExaPixmap->fb_pitch * h; if (pExaPixmap->fb_pitch > 131071) { fbDestroyPixmap(pPixmap); return NULL; } /* Set up damage tracking */ pExaPixmap->pDamage = DamageCreate (NULL, NULL, DamageReportNone, TRUE, pScreen, pPixmap); if (pExaPixmap->pDamage == NULL) { fbDestroyPixmap (pPixmap); return NULL; } DamageRegister (&pPixmap->drawable, pExaPixmap->pDamage); DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE); /* None of the pixmap bits are valid initially */ REGION_NULL(pScreen, &pExaPixmap->validReg); return pPixmap; }
static XF86VideoAdaptorPtr CHIPSSetupImageVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); CHIPSPtr cPtr = CHIPSPTR(pScrn); XF86VideoAdaptorPtr adapt; CHIPSPortPrivPtr pPriv; if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + sizeof(CHIPSPortPrivRec) + sizeof(DevUnion)))) return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; adapt->name = "Chips and Technologies Backend Scaler"; adapt->nEncodings = 1; adapt->pEncodings = DummyEncoding; adapt->nFormats = NUM_FORMATS; adapt->pFormats = Formats; adapt->nPorts = 1; adapt->pPortPrivates = (DevUnion*)(&adapt[1]); pPriv = (CHIPSPortPrivPtr)(&adapt->pPortPrivates[1]); adapt->pPortPrivates[0].ptr = (pointer)(pPriv); adapt->pAttributes = Attributes; adapt->nImages = NUM_IMAGES; adapt->nAttributes = NUM_ATTRIBUTES; adapt->pImages = Images; adapt->PutVideo = NULL; adapt->PutStill = NULL; adapt->GetVideo = NULL; adapt->GetStill = NULL; adapt->StopVideo = CHIPSStopVideo; adapt->SetPortAttribute = CHIPSSetPortAttribute; adapt->GetPortAttribute = CHIPSGetPortAttribute; adapt->QueryBestSize = CHIPSQueryBestSize; adapt->PutImage = CHIPSPutImage; adapt->QueryImageAttributes = CHIPSQueryImageAttributes; pPriv->colorKey = cPtr->videoKey; pPriv->videoStatus = 0; pPriv->manualDoubleBuffer = FALSE; pPriv->currentBuffer = 0; /* gotta uninit this someplace */ REGION_NULL(pScreen, &pPriv->clip); cPtr->adaptor = adapt; xvColorKey = MAKE_ATOM("XV_COLORKEY"); CHIPSResetVideo(pScrn); return adapt; }
/* * At any point after LayerStartInit, a new layer can be created. */ LayerPtr LayerCreate (ScreenPtr pScreen, int kind, int depth, PixmapPtr pPixmap, ShadowUpdateProc update, ShadowWindowProc window, int randr, void *closure) { layerScrPriv(pScreen); LayerPtr pLay, *pPrev; LayerKindPtr pLayKind; if (kind < 0 || pLayScr->nkinds <= kind) return 0; pLayKind = &pLayScr->kinds[kind]; pLay = (LayerPtr) xalloc (sizeof (LayerRec)); if (!pLay) return 0; /* * Initialize the layer */ pLay->pNext = 0; pLay->pKind = pLayKind; pLay->refcnt = 1; pLay->windows = 0; pLay->depth = depth; pLay->pPixmap = pPixmap; pLay->update = update; pLay->window = window; pLay->randr = randr; pLay->closure = closure; if (pPixmap == LAYER_SCREEN_PIXMAP) pLay->freePixmap = FALSE; else { pLay->freePixmap = TRUE; if (pPixmap) pPixmap->refcnt++; } REGION_NULL(pScreen, &pLay->region); /* * Hook the layer at the end of the list */ for (pPrev = &pLayScr->pLayers; *pPrev; pPrev = &(*pPrev)->pNext) ; *pPrev = pLay; return pLay; }
Bool shadowSetup(ScreenPtr pScreen) { shadowBufPtr pBuf; if (!DamageSetup(pScreen)) return FALSE; if (shadowGeneration != serverGeneration) { shadowScrPrivateIndex = AllocateScreenPrivateIndex(); if (shadowScrPrivateIndex == -1) return FALSE; shadowGeneration = serverGeneration; } pBuf = (shadowBufPtr) xalloc(sizeof(shadowBufRec)); if (!pBuf) return FALSE; #ifdef BACKWARDS_COMPATIBILITY pBuf->pDamage = DamageCreate((DamageReportFunc)shadowReportFunc, (DamageDestroyFunc)NULL, DamageReportRawRegion, TRUE, pScreen, pScreen); #else pBuf->pDamage = DamageCreate((DamageReportFunc)NULL, (DamageDestroyFunc)NULL, DamageReportNone, TRUE, pScreen, pScreen); #endif if (!pBuf->pDamage) { xfree(pBuf); return FALSE; } wrap(pBuf, pScreen, CloseScreen); wrap(pBuf, pScreen, GetImage); pBuf->update = NULL; pBuf->window = NULL; pBuf->pPixmap = 0; pBuf->closure = 0; pBuf->randr = 0; pBuf->ready_to_update = NULL; #ifdef BACKWARDS_COMPATIBILITY REGION_NULL(pScreen, &pBuf->damage); /* bc */ #endif pScreen->devPrivates[shadowScrPrivateIndex].ptr = (pointer) pBuf; return TRUE; }
void cfbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { DDXPointPtr pptSrc; DDXPointPtr ppt; RegionRec rgnDst; BoxPtr pbox; int dx, dy; int i, nbox; WindowPtr pwinRoot; pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; REGION_NULL(pWin->drawable.pScreen, &rgnDst); dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); pbox = REGION_RECTS(&rgnDst); nbox = REGION_NUM_RECTS(&rgnDst); if(!nbox || !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) { REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); return; } ppt = pptSrc; for (i = nbox; --i >= 0; ppt++, pbox++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } cfbDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, GXcopy, &rgnDst, pptSrc, ~0L); DEALLOCATE_LOCAL(pptSrc); REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); }
static void ShadowCopyWindow( WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgn ){ ScreenPtr pScreen = pWin->drawable.pScreen; ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen); int num = 0; RegionRec rgnDst; if (pPriv->vtSema) { REGION_NULL(pWin->drawable.pScreen, &rgnDst); REGION_COPY(pWin->drawable.pScreen, &rgnDst, prgn); REGION_TRANSLATE(pWin->drawable.pScreen, &rgnDst, pWin->drawable.x - ptOldOrg.x, pWin->drawable.y - ptOldOrg.y); REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, &rgnDst); if ((num = REGION_NUM_RECTS(&rgnDst))) { if(pPriv->preRefresh) (*pPriv->preRefresh)(pPriv->pScrn, num, REGION_RECTS(&rgnDst)); } else { REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); } } pScreen->CopyWindow = pPriv->CopyWindow; (*pScreen->CopyWindow) (pWin, ptOldOrg, prgn); pScreen->CopyWindow = ShadowCopyWindow; if (num) { if (pPriv->postRefresh) (*pPriv->postRefresh)(pPriv->pScrn, num, REGION_RECTS(&rgnDst)); REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); } }
static void XAACopyWindow8_32( WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc ){ DDXPointPtr pptSrc, ppt; RegionRec rgnDst; BoxPtr pbox; int dx, dy, nbox; WindowPtr pwinRoot; ScreenPtr pScreen = pWin->drawable.pScreen; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable)); Bool doUnderlay = miOverlayCopyUnderlay(pScreen); RegionPtr borderClip = &pWin->borderClip; Bool freeReg = FALSE; if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt || (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK)) { XAA_SCREEN_PROLOGUE (pScreen, CopyWindow); if(infoRec->pScrn->vtSema && infoRec->NeedToSync) { (*infoRec->Sync)(infoRec->pScrn); infoRec->NeedToSync = FALSE; } (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow8_32); return; } pwinRoot = WindowTable[pScreen->myNum]; if(doUnderlay) freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip); REGION_NULL(pScreen, &rgnDst); dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy); REGION_INTERSECT(pScreen, &rgnDst, borderClip, prgnSrc); pbox = REGION_RECTS(&rgnDst); nbox = REGION_NUM_RECTS(&rgnDst); if(!nbox || !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) { REGION_UNINIT(pScreen, &rgnDst); return; } ppt = pptSrc; while(nbox--) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; ppt++; pbox++; } infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000; infoRec->ScratchGC.alu = GXcopy; XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, &(infoRec->ScratchGC), &rgnDst, pptSrc); DEALLOCATE_LOCAL(pptSrc); REGION_UNINIT(pScreen, &rgnDst); if(freeReg) REGION_DESTROY(pScreen, borderClip); }
void winReshapeMultiWindow (WindowPtr pWin) { int nRects; RegionRec rrNewShape; BoxPtr pShape, pRects, pEnd; HRGN hRgn, hRgnRect; winWindowPriv(pWin); #if CYGDEBUG winDebug ("winReshape ()\n"); #endif /* Bail if the window is the root window */ if (pWin->parent == NULL) return; /* Bail if the window is not top level */ if (pWin->parent->parent != NULL) return; /* Bail if Windows window handle is invalid */ if (pWinPriv->hWnd == NULL) return; /* Free any existing window region stored in the window privates */ if (pWinPriv->hRgn != NULL) { DeleteObject (pWinPriv->hRgn); pWinPriv->hRgn = NULL; } /* Bail if the window has no bounding region defined */ if (!wBoundingShape (pWin)) return; REGION_NULL(pWin->drawable.pScreen, &rrNewShape); REGION_COPY(pWin->drawable.pScreen, &rrNewShape, wBoundingShape(pWin)); REGION_TRANSLATE(pWin->drawable.pScreen, &rrNewShape, pWin->borderWidth, pWin->borderWidth); nRects = REGION_NUM_RECTS(&rrNewShape); pShape = REGION_RECTS(&rrNewShape); /* Don't do anything if there are no rectangles in the region */ if (nRects > 0) { RECT rcClient; RECT rcWindow; int iOffsetX, iOffsetY; /* Get client rectangle */ if (!GetClientRect (pWinPriv->hWnd, &rcClient)) { ErrorF ("winReshape - GetClientRect failed, bailing: %d\n", (int) GetLastError ()); return; } /* Translate client rectangle coords to screen coords */ /* NOTE: Only transforms top and left members */ ClientToScreen (pWinPriv->hWnd, (LPPOINT) &rcClient); /* Get window rectangle */ if (!GetWindowRect (pWinPriv->hWnd, &rcWindow)) { ErrorF ("winReshape - GetWindowRect failed, bailing: %d\n", (int) GetLastError ()); return; } /* Calculate offset from window upper-left to client upper-left */ iOffsetX = rcClient.left - rcWindow.left; iOffsetY = rcClient.top - rcWindow.top; /* Create initial Windows region for title bar */ /* FIXME: Mean, nasty, ugly hack!!! */ hRgn = CreateRectRgn (0, 0, rcWindow.right, iOffsetY); if (hRgn == NULL) { ErrorF ("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) " "failed: %d\n", 0, 0, (int) rcWindow.right, iOffsetY, (int) GetLastError ()); } /* Loop through all rectangles in the X region */ for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++) { /* Create a Windows region for the X rectangle */ hRgnRect = CreateRectRgn (pRects->x1 + iOffsetX, pRects->y1 + iOffsetY, pRects->x2 + iOffsetX, pRects->y2 + iOffsetY); if (hRgnRect == NULL) { ErrorF ("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) " "failed: %d\n" "\tx1: %d x2: %d xOff: %d y1: %d y2: %d yOff: %d\n", pRects->x1 + iOffsetX, pRects->y1 + iOffsetY, pRects->x2 + iOffsetX, pRects->y2 + iOffsetY, (int) GetLastError (), pRects->x1, pRects->x2, iOffsetX, pRects->y1, pRects->y2, iOffsetY); } /* Merge the Windows region with the accumulated region */ if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) { ErrorF ("winReshape - CombineRgn () failed: %d\n", (int) GetLastError ()); } /* Delete the temporary Windows region */ DeleteObject (hRgnRect); } /* Save a handle to the composite region in the window privates */ pWinPriv->hRgn = hRgn; } REGION_UNINIT(pWin->drawable.pScreen, &rrNewShape); return; }
/* XaceCensorImage * * Called after pScreen->GetImage to prevent pieces or trusted windows from * being returned in image data from an untrusted window. * * Arguments: * client is the client doing the GetImage. * pVisibleRegion is the visible region of the window. * widthBytesLine is the width in bytes of one horizontal line in pBuf. * pDraw is the source window. * x, y, w, h is the rectangle of image data from pDraw in pBuf. * format is the format of the image data in pBuf: ZPixmap or XYPixmap. * pBuf is the image data. * * Returns: nothing. * * Side Effects: * Any part of the rectangle (x, y, w, h) that is outside the visible * region of the window will be destroyed (overwritten) in pBuf. */ void XaceCensorImage( ClientPtr client, RegionPtr pVisibleRegion, long widthBytesLine, DrawablePtr pDraw, int x, int y, int w, int h, unsigned int format, char *pBuf) { ScreenPtr pScreen; RegionRec imageRegion; /* region representing x,y,w,h */ RegionRec censorRegion; /* region to obliterate */ BoxRec imageBox; int nRects; pScreen = pDraw->pScreen; imageBox.x1 = x; imageBox.y1 = y; imageBox.x2 = x + w; imageBox.y2 = y + h; REGION_INIT(pScreen, &imageRegion, &imageBox, 1); REGION_NULL(pScreen, &censorRegion); /* censorRegion = imageRegion - visibleRegion */ REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion); nRects = REGION_NUM_RECTS(&censorRegion); if (nRects > 0) { /* we have something to censor */ GCPtr pScratchGC = NULL; PixmapPtr pPix = NULL; xRectangle *pRects = NULL; Bool failed = FALSE; int depth = 1; int bitsPerPixel = 1; int i; BoxPtr pBox; /* convert region to list-of-rectangles for PolyFillRect */ pRects = xalloc(nRects * sizeof(xRectangle)); if (!pRects) { failed = TRUE; goto failSafe; } for (pBox = REGION_RECTS(&censorRegion), i = 0; i < nRects; i++, pBox++) { pRects[i].x = pBox->x1; pRects[i].y = pBox->y1 - imageBox.y1; pRects[i].width = pBox->x2 - pBox->x1; pRects[i].height = pBox->y2 - pBox->y1; } /* use pBuf as a fake pixmap */ if (format == ZPixmap) { depth = pDraw->depth; bitsPerPixel = pDraw->bitsPerPixel; } pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h, depth, bitsPerPixel, widthBytesLine, (pointer)pBuf); if (!pPix) { failed = TRUE; goto failSafe; } pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen); if (!pScratchGC) { failed = TRUE; goto failSafe; } ValidateGC(&pPix->drawable, pScratchGC); (* pScratchGC->ops->PolyFillRect)(&pPix->drawable, pScratchGC, nRects, pRects); failSafe: if (failed) { /* Censoring was not completed above. To be safe, wipe out * all the image data so that nothing trusted gets out. */ bzero(pBuf, (int)(widthBytesLine * h)); } if (pRects) xfree(pRects); if (pScratchGC) FreeScratchGC(pScratchGC); if (pPix) FreeScratchPixmapHeader(pPix); } REGION_UNINIT(pScreen, &imageRegion); REGION_UNINIT(pScreen, &censorRegion); } /* XaceCensorImage */
static XF86VideoAdaptorPtr winSetupImageVideo (ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; #if 0 I810Ptr pI810 = I810PTR(pScrn); #endif XF86VideoAdaptorPtr adapt; if (!(adapt = xcalloc (1, sizeof(XF86VideoAdaptorRec)))) return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; adapt->name = PROJECT_NAME " Video Overlay"; adapt->nEncodings = 1; adapt->pEncodings = DummyEncoding; adapt->nFormats = NUM_FORMATS; adapt->pFormats = Formats; adapt->nPorts = 1; adapt->pPortPrivates = NULL; adapt->pPortPrivates[0].ptr = NULL; adapt->pAttributes = Attributes; adapt->nImages = NUM_IMAGES; adapt->nAttributes = NUM_ATTRIBUTES; adapt->pImages = Images; adapt->PutVideo = NULL; adapt->PutStill = NULL; adapt->GetVideo = NULL; adapt->GetStill = NULL; #if 0 adapt->StopVideo = I810StopVideo; adapt->SetPortAttribute = I810SetPortAttribute; adapt->GetPortAttribute = I810GetPortAttribute; adapt->QueryBestSize = I810QueryBestSize; adapt->PutImage = I810PutImage; adapt->QueryImageAttributes = I810QueryImageAttributes; #endif #if 0 pPriv->colorKey = pI810->colorKey & ((1 << pScrn->depth) - 1); #endif pPriv->videoStatus = 0; pPriv->brightness = 0; pPriv->contrast = 64; pPriv->linear = NULL; pPriv->currentBuf = 0; #if 0 /* gotta uninit this someplace */ REGION_NULL(pScreen, &pPriv->clip); #endif #if 0 pI810->adaptor = adapt; pI810->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = I810BlockHandler; #endif #if 0 xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); xvContrast = MAKE_ATOM("XV_CONTRAST"); xvColorKey = MAKE_ATOM("XV_COLORKEY"); #endif #if 0 I810ResetVideo(pScrn); #endif return adapt; }
static Bool ExaPrepareCompositeReg(ScreenPtr pScreen, CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { RegionRec region; RegionPtr dstReg = NULL; RegionPtr srcReg = NULL; RegionPtr maskReg = NULL; PixmapPtr pSrcPix = NULL; PixmapPtr pMaskPix = NULL; PixmapPtr pDstPix; ExaScreenPriv(pScreen); Bool ret; REGION_NULL(pScreen, ®ion); if (pSrc->pDrawable) { pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable); REGION_NULL(pScreen, &pExaScr->srcReg); srcReg = &pExaScr->srcReg; pExaScr->srcPix = pSrcPix; if (pSrc != pDst) REGION_TRANSLATE(pScreen, pSrc->pCompositeClip, -pSrc->pDrawable->x, -pSrc->pDrawable->y); } if (pMask && pMask->pDrawable) { pMaskPix = exaGetDrawablePixmap(pMask->pDrawable); REGION_NULL(pScreen, &pExaScr->maskReg); maskReg = &pExaScr->maskReg; if (pMask != pDst && pMask != pSrc) REGION_TRANSLATE(pScreen, pMask->pCompositeClip, -pMask->pDrawable->x, -pMask->pDrawable->y); } REGION_TRANSLATE(pScreen, pDst->pCompositeClip, -pDst->pDrawable->x, -pDst->pDrawable->y); pExaScr->SavedSourceValidate = ExaSrcValidate; swap(pExaScr, pScreen, SourceValidate); ret = miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); swap(pExaScr, pScreen, SourceValidate); REGION_TRANSLATE(pScreen, pDst->pCompositeClip, pDst->pDrawable->x, pDst->pDrawable->y); if (pSrc->pDrawable && pSrc != pDst) REGION_TRANSLATE(pScreen, pSrc->pCompositeClip, pSrc->pDrawable->x, pSrc->pDrawable->y); if (pMask && pMask->pDrawable && pMask != pDst && pMask != pSrc) REGION_TRANSLATE(pScreen, pMask->pCompositeClip, pMask->pDrawable->x, pMask->pDrawable->y); if (!ret) { if (srcReg) REGION_UNINIT(pScreen, srcReg); if (maskReg) REGION_UNINIT(pScreen, maskReg); return FALSE; } /** * Don't limit alphamaps readbacks for now until we've figured out how that * should be done. */ if (pSrc->alphaMap && pSrc->alphaMap->pDrawable) pExaScr->prepare_access_reg(exaGetDrawablePixmap(pSrc->alphaMap->pDrawable), EXA_PREPARE_AUX_SRC, NULL); if (pMask && pMask->alphaMap && pMask->alphaMap->pDrawable) pExaScr->prepare_access_reg(exaGetDrawablePixmap(pMask->alphaMap->pDrawable), EXA_PREPARE_AUX_MASK, NULL); if (pSrcPix) pExaScr->prepare_access_reg(pSrcPix, EXA_PREPARE_SRC, srcReg); if (pMaskPix) pExaScr->prepare_access_reg(pMaskPix, EXA_PREPARE_MASK, maskReg); if (srcReg) REGION_UNINIT(pScreen, srcReg); if (maskReg) REGION_UNINIT(pScreen, maskReg); pDstPix = exaGetDrawablePixmap(pDst->pDrawable); if (!exaOpReadsDestination(op)) { int xoff; int yoff; exaGetDrawableDeltas (pDst->pDrawable, pDstPix, &xoff, &yoff); REGION_TRANSLATE(pScreen, ®ion, pDst->pDrawable->x + xoff, pDst->pDrawable->y + yoff); dstReg = ®ion; } if (pDst->alphaMap && pDst->alphaMap->pDrawable) pExaScr->prepare_access_reg(exaGetDrawablePixmap(pDst->alphaMap->pDrawable), EXA_PREPARE_AUX_DEST, dstReg); pExaScr->prepare_access_reg(pDstPix, EXA_PREPARE_DEST, dstReg); REGION_UNINIT(pScreen, ®ion); return TRUE; }
Bool saa_hw_copy_nton(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown) { ScreenPtr pScreen = pDstDrawable->pScreen; struct saa_screen_priv *sscreen = saa_screen(pDstDrawable->pScreen); struct saa_driver *driver = sscreen->driver; PixmapPtr pSrcPixmap, pDstPixmap; struct saa_pixmap *src_spix, *dst_spix; int src_off_x, src_off_y; int dst_off_x, dst_off_y; RegionRec dst_reg, *src_reg; int ordering; Bool ret = TRUE; (void)pScreen; /* avoid doing copy operations if no boxes */ if (nbox == 0) return TRUE; pSrcPixmap = saa_get_pixmap(pSrcDrawable, &src_off_x, &src_off_y); pDstPixmap = saa_get_pixmap(pDstDrawable, &dst_off_x, &dst_off_y); src_spix = saa_pixmap(pSrcPixmap); dst_spix = saa_pixmap(pDstPixmap); if (src_spix->auth_loc != saa_loc_driver || dst_spix->auth_loc != saa_loc_driver) return FALSE; ordering = (nbox == 1 || (dx > 0 && dy > 0) || (pDstDrawable != pSrcDrawable && (pDstDrawable->type != DRAWABLE_WINDOW || pSrcDrawable->type != DRAWABLE_WINDOW))) ? CT_YXBANDED : CT_UNSORTED; src_reg = saa_boxes_to_region(pScreen, nbox, pbox, ordering); if (!src_reg) return FALSE; REGION_NULL(pScreen, &dst_reg); REGION_COPY(pScreen, &dst_reg, src_reg); REGION_TRANSLATE(pScreen, src_reg, dx + src_off_x, dy + src_off_y); REGION_TRANSLATE(pScreen, &dst_reg, dst_off_x, dst_off_y); if (!(driver->copy_prepare) (driver, pSrcPixmap, pDstPixmap, reverse ? -1 : 1, upsidedown ? -1 : 1, pGC ? pGC->alu : GXcopy, src_reg, pGC ? pGC->planemask : FB_ALLONES)) { goto fallback; } while (nbox--) { (driver->copy) (driver, pbox->x1 + dx + src_off_x, pbox->y1 + dy + src_off_y, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); pbox++; } (driver->copy_done) (driver); saa_pixmap_dirty(pDstPixmap, TRUE, &dst_reg); goto out; fallback: ret = FALSE; out: REGION_UNINIT(pScreen, &dst_reg); REGION_DESTROY(pScreen, src_reg); return ret; }
static void winReshapePRootless (WindowPtr pWin) { int nRects; ScreenPtr pScreen = pWin->drawable.pScreen; RegionRec rrNewShape; BoxPtr pShape, pRects, pEnd; HRGN hRgn, hRgnRect; winWindowPriv(pWin); #if CYGDEBUG ErrorF ("winReshapePRootless ()\n"); #endif /* Bail if the window is the root window */ if (pWin->parent == NULL) return; /* Bail if the window is not top level */ if (pWin->parent->parent != NULL) return; /* Free any existing window region stored in the window privates */ if (pWinPriv->hRgn != NULL) { DeleteObject (pWinPriv->hRgn); pWinPriv->hRgn = NULL; } /* Bail if the window has no bounding region defined */ if (!wBoundingShape (pWin)) return; REGION_NULL(pScreen, &rrNewShape); REGION_COPY(pScreen, &rrNewShape, wBoundingShape(pWin)); REGION_TRANSLATE(pScreen, &rrNewShape, pWin->borderWidth, pWin->borderWidth); nRects = REGION_NUM_RECTS(&rrNewShape); pShape = REGION_RECTS(&rrNewShape); if (nRects > 0) { /* Create initial empty Windows region */ hRgn = CreateRectRgn (0, 0, 0, 0); /* Loop through all rectangles in the X region */ for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++) { /* Create a Windows region for the X rectangle */ hRgnRect = CreateRectRgn (pRects->x1, pRects->y1, pRects->x2, pRects->y2); if (hRgnRect == NULL) { ErrorF("winReshapePRootless - CreateRectRgn() failed\n"); } /* Merge the Windows region with the accumulated region */ if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR) { ErrorF("winReshapePRootless - CombineRgn() failed\n"); } /* Delete the temporary Windows region */ DeleteObject (hRgnRect); } /* Save a handle to the composite region in the window privates */ pWinPriv->hRgn = hRgn; } REGION_UNINIT(pScreen, &rrNewShape); return; }
RegionPtr XAABitBlt( DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, void (*doBitBlt)(DrawablePtr, DrawablePtr, GCPtr, RegionPtr, DDXPointPtr), unsigned long bitPlane ) { RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ RegionPtr prgnExposed; Bool freeSrcClip = FALSE; RegionRec rgnDst; DDXPointPtr pptSrc, ppt; DDXPointRec origDest; BoxPtr pbox; BoxRec fastBox; int i, dx, dy, numRects; xRectangle origSource; int fastClip = 0; /* for fast clipping with pixmap source */ int fastExpose = 0; /* for fast exposures with pixmap source */ origSource.x = srcx; origSource.y = srcy; origSource.width = width; origSource.height = height; origDest.x = dstx; origDest.y = dsty; if((pSrcDrawable != pDstDrawable) && pSrcDrawable->pScreen->SourceValidate) { (*pSrcDrawable->pScreen->SourceValidate) ( pSrcDrawable, srcx, srcy, width, height); } srcx += pSrcDrawable->x; srcy += pSrcDrawable->y; /* clip the source */ if (pSrcDrawable->type == DRAWABLE_PIXMAP) { if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE)) prgnSrcClip = pGC->pCompositeClip; else fastClip = 1; } else { /* Window */ if (pGC->subWindowMode == IncludeInferiors) { if (!((WindowPtr) pSrcDrawable)->parent) { /* * special case bitblt from root window in * IncludeInferiors mode; just like from a pixmap */ fastClip = 1; } else if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE)) { prgnSrcClip = pGC->pCompositeClip; } else { prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable); freeSrcClip = TRUE; } } else { prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList; } } fastBox.x1 = srcx; fastBox.y1 = srcy; fastBox.x2 = srcx + width; fastBox.y2 = srcy + height; /* Don't create a source region if we are doing a fast clip */ if (fastClip) { fastExpose = 1; /* * clip the source; if regions extend beyond the source size, * make sure exposure events get sent */ if (fastBox.x1 < pSrcDrawable->x) { fastBox.x1 = pSrcDrawable->x; fastExpose = 0; } if (fastBox.y1 < pSrcDrawable->y) { fastBox.y1 = pSrcDrawable->y; fastExpose = 0; } if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) { fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; fastExpose = 0; } if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) { fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; fastExpose = 0; } } else { REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip); } dstx += pDstDrawable->x; dsty += pDstDrawable->y; if (pDstDrawable->type == DRAWABLE_WINDOW) { if (!((WindowPtr)pDstDrawable)->realized) { if (!fastClip) REGION_UNINIT(pGC->pScreen, &rgnDst); if (freeSrcClip) REGION_DESTROY(pGC->pScreen, prgnSrcClip); return NULL; } } dx = srcx - dstx; dy = srcy - dsty; /* Translate and clip the dst to the destination composite clip */ if (fastClip) { RegionPtr cclip; /* Translate the region directly */ fastBox.x1 -= dx; fastBox.x2 -= dx; fastBox.y1 -= dy; fastBox.y2 -= dy; /* If the destination composite clip is one rectangle we can do the clip directly. Otherwise we have to create a full blown region and call intersect */ cclip = pGC->pCompositeClip; if (REGION_NUM_RECTS(cclip) == 1) { BoxPtr pBox = REGION_RECTS(cclip); if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1; if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2; if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1; if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2; /* Check to see if the region is empty */ if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) { REGION_NULL(pGC->pScreen, &rgnDst); } else { REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); } } else { /* We must turn off fastClip now, since we must create a full blown region. It is intersected with the composite clip below. */ fastClip = 0; REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1); } } else { REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy); } if (!fastClip) { REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip); } /* Do bit blitting */ numRects = REGION_NUM_RECTS(&rgnDst); if (numRects && width && height) { if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec)))) { REGION_UNINIT(pGC->pScreen, &rgnDst); if (freeSrcClip) REGION_DESTROY(pGC->pScreen, prgnSrcClip); return NULL; } pbox = REGION_RECTS(&rgnDst); ppt = pptSrc; for (i = numRects; --i >= 0; pbox++, ppt++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc); DEALLOCATE_LOCAL(pptSrc); } prgnExposed = NULL; if (pGC->fExpose) { /* Pixmap sources generate a NoExposed (we return NULL to do this) */ if (!fastExpose) prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, origSource.x, origSource.y, (int)origSource.width, (int)origSource.height, origDest.x, origDest.y, bitPlane); } REGION_UNINIT(pGC->pScreen, &rgnDst); if (freeSrcClip) REGION_DESTROY(pGC->pScreen, prgnSrcClip); return prgnExposed; }
/* *----------------------------------------------------------------------- * RootlessComputeClips -- * Recompute the clipList, borderClip, exposed and borderExposed * regions for pParent and its children. Only viewable windows are * taken into account. * * Results: * None. * * Side Effects: * clipList, borderClip, exposed and borderExposed are altered. * A VisibilityNotify event may be generated on the parent window. * *----------------------------------------------------------------------- */ static void RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen, RegionPtr universe, VTKind kind, RegionPtr exposed) { int dx, dy; RegionRec childUniverse; register WindowPtr pChild; int oldVis, newVis; BoxRec borderSize; RegionRec childUnion; Bool overlap; RegionPtr borderVisible; Bool resized; /* * Figure out the new visibility of this window. * The extent of the universe should be the same as the extent of * the borderSize region. If the window is unobscured, this rectangle * will be completely inside the universe (the universe will cover it * completely). If the window is completely obscured, none of the * universe will cover the rectangle. */ borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent); borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent); dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent); if (dx > 32767) dx = 32767; borderSize.x2 = dx; dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent); if (dy > 32767) dy = 32767; borderSize.y2 = dy; oldVis = pParent->visibility; switch (RECT_IN_REGION( pScreen, universe, &borderSize)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnPART: newVis = VisibilityPartiallyObscured; { RegionPtr pBounding; if ((pBounding = wBoundingShape (pParent))) { switch (RootlessShapedWindowIn (pScreen, universe, pBounding, &borderSize, pParent->drawable.x, pParent->drawable.y)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnOUT: newVis = VisibilityFullyObscured; break; } } } break; default: newVis = VisibilityFullyObscured; break; } pParent->visibility = newVis; if (oldVis != newVis && ((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask)) SendVisibilityNotify(pParent); dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x; dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y; /* * avoid computations when dealing with simple operations */ switch (kind) { case VTMap: case VTStack: case VTUnmap: break; case VTMove: if ((oldVis == newVis) && ((oldVis == VisibilityFullyObscured) || (oldVis == VisibilityUnobscured))) { pChild = pParent; while (1) { if (pChild->viewable) { if (pChild->visibility != VisibilityFullyObscured) { REGION_TRANSLATE( pScreen, &pChild->borderClip, dx, dy); REGION_TRANSLATE( pScreen, &pChild->clipList, dx, dy); pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pChild, dx, dy); } if (pChild->valdata) { REGION_NULL(pScreen, &pChild->valdata->after.borderExposed); if (HasParentRelativeBorder(pChild)) { REGION_SUBTRACT(pScreen, &pChild->valdata->after.borderExposed, &pChild->borderClip, &pChild->winSize); } REGION_NULL(pScreen, &pChild->valdata->after.exposed); } if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pParent)) pChild = pChild->parent; if (pChild == pParent) break; pChild = pChild->nextSib; } return; } /* fall through */ default: /* * To calculate exposures correctly, we have to translate the old * borderClip and clipList regions to the window's new location so there * is a correspondence between pieces of the new and old clipping regions. */ if (dx || dy) { /* * We translate the old clipList because that will be exposed or copied * if gravity is right. */ REGION_TRANSLATE( pScreen, &pParent->borderClip, dx, dy); REGION_TRANSLATE( pScreen, &pParent->clipList, dx, dy); } break; case VTBroken: REGION_EMPTY (pScreen, &pParent->borderClip); REGION_EMPTY (pScreen, &pParent->clipList); break; } borderVisible = pParent->valdata->before.borderVisible; resized = pParent->valdata->before.resized; REGION_NULL(pScreen, &pParent->valdata->after.borderExposed); REGION_NULL(pScreen, &pParent->valdata->after.exposed); /* * Since the borderClip must not be clipped by the children, we do * the border exposure first... * * 'universe' is the window's borderClip. To figure the exposures, remove * the area that used to be exposed from the new. * This leaves a region of pieces that weren't exposed before. */ if (HasBorder (pParent)) { if (borderVisible) { /* * when the border changes shape, the old visible portions * of the border will be saved by DIX in borderVisible -- * use that region and destroy it */ REGION_SUBTRACT( pScreen, exposed, universe, borderVisible); REGION_DESTROY( pScreen, borderVisible); } else { REGION_SUBTRACT( pScreen, exposed, universe, &pParent->borderClip); } if (HasParentRelativeBorder(pParent) && (dx || dy)) { REGION_SUBTRACT( pScreen, &pParent->valdata->after.borderExposed, universe, &pParent->winSize); } else { REGION_SUBTRACT( pScreen, &pParent->valdata->after.borderExposed, exposed, &pParent->winSize); } REGION_COPY( pScreen, &pParent->borderClip, universe); /* * To get the right clipList for the parent, and to make doubly sure * that no child overlaps the parent's border, we remove the parent's * border from the universe before proceeding. */ REGION_INTERSECT( pScreen, universe, universe, &pParent->winSize); } else REGION_COPY( pScreen, &pParent->borderClip, universe); if ((pChild = pParent->firstChild) && pParent->mapped) { REGION_NULL(pScreen, &childUniverse); REGION_NULL(pScreen, &childUnion); if ((pChild->drawable.y < pParent->lastChild->drawable.y) || ((pChild->drawable.y == pParent->lastChild->drawable.y) && (pChild->drawable.x < pParent->lastChild->drawable.x))) { for (; pChild; pChild = pChild->nextSib) { if (pChild->viewable) REGION_APPEND( pScreen, &childUnion, &pChild->borderSize); } } else { for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) { if (pChild->viewable) REGION_APPEND( pScreen, &childUnion, &pChild->borderSize); } } REGION_VALIDATE( pScreen, &childUnion, &overlap); for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->viewable) { /* * If the child is viewable, we want to remove its extents * from the current universe, but we only re-clip it if * it's been marked. */ if (pChild->valdata) { /* * Figure out the new universe from the child's * perspective and recurse. */ REGION_INTERSECT( pScreen, &childUniverse, universe, &pChild->borderSize); RootlessComputeClips (pChild, pScreen, &childUniverse, kind, exposed); } /* * Once the child has been processed, we remove its extents * from the current universe, thus denying its space to any * other sibling. */ if (overlap) REGION_SUBTRACT( pScreen, universe, universe, &pChild->borderSize); } } if (!overlap) REGION_SUBTRACT( pScreen, universe, universe, &childUnion); REGION_UNINIT( pScreen, &childUnion); REGION_UNINIT( pScreen, &childUniverse); } /* if any children */ /* * 'universe' now contains the new clipList for the parent window. * * To figure the exposure of the window we subtract the old clip from the * new, just as for the border. */ if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) { REGION_COPY( pScreen, &pParent->valdata->after.exposed, universe); } else if (newVis != VisibilityFullyObscured && newVis != VisibilityNotViewable) { REGION_SUBTRACT( pScreen, &pParent->valdata->after.exposed, universe, &pParent->clipList); } /* * One last thing: backing storage. We have to try to save what parts of * the window are about to be obscured. We can just subtract the universe * from the old clipList and get the areas that were in the old but aren't * in the new and, hence, are about to be obscured. */ if (pParent->backStorage && !resized) { REGION_SUBTRACT( pScreen, exposed, &pParent->clipList, universe); (* pScreen->SaveDoomedAreas)(pParent, exposed, dx, dy); } /* HACK ALERT - copying contents of regions, instead of regions */ { RegionRec tmp; tmp = pParent->clipList; pParent->clipList = *universe; *universe = tmp; } #ifdef NOTDEF REGION_COPY( pScreen, &pParent->clipList, universe); #endif pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pParent, dx, dy); }
/* Entry point for hook functions. Called by Xserver. */ int XaceHook(int hook, ...) { pointer calldata; /* data passed to callback */ int *prv = NULL; /* points to return value from callback */ va_list ap; /* argument list */ va_start(ap, hook); /* Marshal arguments for passing to callback. * Each callback has its own case, which sets up a structure to hold * the arguments and integer return parameter, or in some cases just * sets calldata directly to a single argument (with no return result) */ switch (hook) { case XACE_RESOURCE_ACCESS: { XaceResourceAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, XID), va_arg(ap, RESTYPE), va_arg(ap, pointer), va_arg(ap, RESTYPE), va_arg(ap, pointer), va_arg(ap, Mask), Success /* default allow */ }; calldata = &rec; prv = &rec.status; break; } case XACE_DEVICE_ACCESS: { XaceDeviceAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, DeviceIntPtr), va_arg(ap, Mask), Success /* default allow */ }; calldata = &rec; prv = &rec.status; break; } case XACE_SEND_ACCESS: { XaceSendAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, DeviceIntPtr), va_arg(ap, WindowPtr), va_arg(ap, xEventPtr), va_arg(ap, int), Success /* default allow */ }; calldata = &rec; prv = &rec.status; break; } case XACE_RECEIVE_ACCESS: { XaceReceiveAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, WindowPtr), va_arg(ap, xEventPtr), va_arg(ap, int), Success /* default allow */ }; calldata = &rec; prv = &rec.status; break; } case XACE_CLIENT_ACCESS: { XaceClientAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, ClientPtr), va_arg(ap, Mask), Success /* default allow */ }; calldata = &rec; prv = &rec.status; break; } case XACE_EXT_ACCESS: { XaceExtAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, ExtensionEntry*), DixGetAttrAccess, Success /* default allow */ }; calldata = &rec; prv = &rec.status; break; } case XACE_SERVER_ACCESS: { XaceServerAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, Mask), Success /* default allow */ }; calldata = &rec; prv = &rec.status; break; } case XACE_SCREEN_ACCESS: case XACE_SCREENSAVER_ACCESS: { XaceScreenAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, ScreenPtr), va_arg(ap, Mask), Success /* default allow */ }; calldata = &rec; prv = &rec.status; break; } case XACE_AUTH_AVAIL: { XaceAuthAvailRec rec = { va_arg(ap, ClientPtr), va_arg(ap, XID) }; calldata = &rec; break; } case XACE_KEY_AVAIL: { XaceKeyAvailRec rec = { va_arg(ap, xEventPtr), va_arg(ap, DeviceIntPtr), va_arg(ap, int) }; calldata = &rec; break; } default: { va_end(ap); return 0; /* unimplemented hook number */ } } va_end(ap); /* call callbacks and return result, if any. */ CallCallbacks(&XaceHooks[hook], calldata); return prv ? *prv : Success; } /* XaceCensorImage * * Called after pScreen->GetImage to prevent pieces or trusted windows from * being returned in image data from an untrusted window. * * Arguments: * client is the client doing the GetImage. * pVisibleRegion is the visible region of the window. * widthBytesLine is the width in bytes of one horizontal line in pBuf. * pDraw is the source window. * x, y, w, h is the rectangle of image data from pDraw in pBuf. * format is the format of the image data in pBuf: ZPixmap or XYPixmap. * pBuf is the image data. * * Returns: nothing. * * Side Effects: * Any part of the rectangle (x, y, w, h) that is outside the visible * region of the window will be destroyed (overwritten) in pBuf. */ void XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h, format, pBuf) ClientPtr client; RegionPtr pVisibleRegion; long widthBytesLine; DrawablePtr pDraw; int x, y, w, h; unsigned int format; char * pBuf; { ScreenPtr pScreen; RegionRec imageRegion; /* region representing x,y,w,h */ RegionRec censorRegion; /* region to obliterate */ BoxRec imageBox; int nRects; pScreen = pDraw->pScreen; imageBox.x1 = x; imageBox.y1 = y; imageBox.x2 = x + w; imageBox.y2 = y + h; REGION_INIT(pScreen, &imageRegion, &imageBox, 1); REGION_NULL(pScreen, &censorRegion); /* censorRegion = imageRegion - visibleRegion */ REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion); nRects = REGION_NUM_RECTS(&censorRegion); if (nRects > 0) { /* we have something to censor */ GCPtr pScratchGC = NULL; PixmapPtr pPix = NULL; xRectangle *pRects = NULL; Bool failed = FALSE; int depth = 1; int bitsPerPixel = 1; int i; BoxPtr pBox; /* convert region to list-of-rectangles for PolyFillRect */ pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle)); if (!pRects) { failed = TRUE; goto failSafe; } for (pBox = REGION_RECTS(&censorRegion), i = 0; i < nRects; i++, pBox++) { pRects[i].x = pBox->x1; pRects[i].y = pBox->y1 - imageBox.y1; pRects[i].width = pBox->x2 - pBox->x1; pRects[i].height = pBox->y2 - pBox->y1; } /* use pBuf as a fake pixmap */ if (format == ZPixmap) { depth = pDraw->depth; bitsPerPixel = pDraw->bitsPerPixel; } pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h, depth, bitsPerPixel, widthBytesLine, (pointer)pBuf); if (!pPix) { failed = TRUE; goto failSafe; } pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen); if (!pScratchGC) { failed = TRUE; goto failSafe; } ValidateGC(&pPix->drawable, pScratchGC); (* pScratchGC->ops->PolyFillRect)(&pPix->drawable, pScratchGC, nRects, pRects); failSafe: if (failed) { /* Censoring was not completed above. To be safe, wipe out * all the image data so that nothing trusted gets out. */ bzero(pBuf, (int)(widthBytesLine * h)); } if (pRects) xfree(pRects); if (pScratchGC) FreeScratchGC(pScratchGC); if (pPix) FreeScratchPixmapHeader(pPix); } REGION_UNINIT(pScreen, &imageRegion); REGION_UNINIT(pScreen, &censorRegion); } /* XaceCensorImage */
// fixme this is ugly // Xprint/ValTree.c doesn't work, but maybe that method can? int RootlessMiValidateTree (WindowPtr pRoot, /* Parent to validate */ WindowPtr pChild, /* First child of pRoot that was * affected */ VTKind kind /* What kind of configuration caused call */) { RegionRec childClip; /* The new borderClip for the current * child */ RegionRec exposed; /* For intermediate calculations */ register ScreenPtr pScreen; register WindowPtr pWin; pScreen = pRoot->drawable.pScreen; if (pChild == NullWindow) pChild = pRoot->firstChild; REGION_NULL(pScreen, &childClip); REGION_NULL(pScreen, &exposed); if (REGION_BROKEN (pScreen, &pRoot->clipList) && !REGION_BROKEN (pScreen, &pRoot->borderClip)) { // fixme this might not work, but hopefully doesn't happen anyway. kind = VTBroken; REGION_EMPTY (pScreen, &pRoot->clipList); ErrorF("ValidateTree: BUSTED!\n"); } /* * Recursively compute the clips for all children of the root. * They don't clip against each other or the root itself, so * childClip is always reset to that child's size. */ for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) { if (pWin->viewable) { if (pWin->valdata) { REGION_COPY( pScreen, &childClip, &pWin->borderSize); RootlessComputeClips (pWin, pScreen, &childClip, kind, &exposed); } else if (pWin->visibility == VisibilityNotViewable) { RootlessTreeObscured(pWin); } } else { if (pWin->valdata) { REGION_EMPTY( pScreen, &pWin->clipList); if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pWin, 0, 0); REGION_EMPTY( pScreen, &pWin->borderClip); pWin->valdata = (ValidatePtr)NULL; } } } REGION_UNINIT(pScreen, &childClip); /* The root is never clipped by its children, so nothing on the root is ever exposed by moving or mapping its children. */ REGION_NULL(pScreen, &pRoot->valdata->after.exposed); REGION_NULL(pScreen, &pRoot->valdata->after.borderExposed); return 1; }
void XAAOverCopyWindow( WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc ){ ScreenPtr pScreen = pWin->drawable.pScreen; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen); ScrnInfoPtr pScrn = infoRec->pScrn; DDXPointPtr ppt, pptSrc; RegionRec rgnDst; BoxPtr pbox; int i, nbox, dx, dy; WindowPtr pRoot = WindowTable[pScreen->myNum]; if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) { XAA_SCREEN_PROLOGUE (pScreen, CopyWindow); if(pScrn->vtSema && infoRec->NeedToSync) { (*infoRec->Sync)(pScrn); infoRec->NeedToSync = FALSE; } (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAAOverCopyWindow); return; } infoRec->ScratchGC.alu = GXcopy; infoRec->ScratchGC.planemask = ~0; REGION_NULL(pScreen, &rgnDst); dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy); REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc); nbox = REGION_NUM_RECTS(&rgnDst); if(nbox && (pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) { pbox = REGION_RECTS(&rgnDst); for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } SWITCH_DEPTH(8); XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot, &(infoRec->ScratchGC), &rgnDst, pptSrc); if(pWin->drawable.bitsPerPixel != 8) { SWITCH_DEPTH(pScrn->depth); XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot, &(infoRec->ScratchGC), &rgnDst, pptSrc); } DEALLOCATE_LOCAL(pptSrc); } REGION_UNINIT(pScreen, &rgnDst); if(pWin->drawable.depth == 8) { REGION_NULL(pScreen, &rgnDst); miSegregateChildren(pWin, &rgnDst, pScrn->depth); if(REGION_NOTEMPTY(pScreen, &rgnDst)) { REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc); nbox = REGION_NUM_RECTS(&rgnDst); if(nbox && (pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))){ pbox = REGION_RECTS(&rgnDst); for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } SWITCH_DEPTH(pScrn->depth); XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot, &(infoRec->ScratchGC), &rgnDst, pptSrc); DEALLOCATE_LOCAL(pptSrc); } } REGION_UNINIT(pScreen, &rgnDst); } }
void cfb8_32WidCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; cfb8_32WidScreenPtr pScreenPriv = CFB8_32WID_GET_SCREEN_PRIVATE(pScreen); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; PixmapPtr pPixChildren; DDXPointPtr ppt, pptSrc; RegionRec rgnDst, rgnOther, rgnPixmap; BoxPtr pbox; int i, nbox, dx, dy, other_bpp; REGION_NULL(pScreen, &rgnDst); dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy); REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc); if ((nbox = REGION_NUM_RECTS(&rgnDst)) == 0) { /* Nothing to render. */ REGION_UNINIT(pScreen, &rgnDst); return; } /* First, copy the WID plane for the whole area. */ pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)); if(pptSrc) { pbox = REGION_RECTS(&rgnDst); for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } pScreenPriv->WIDOps->WidCopyArea((DrawablePtr)pScreenPriv->pixWid, &rgnDst, pptSrc); DEALLOCATE_LOCAL(pptSrc); } /* Next, we copy children which have a different * bpp than pWin into a temporary pixmap. We will * toss this pixmap back onto the framebuffer before * we return. */ if (pWin->drawable.bitsPerPixel == 8) other_bpp = pScrn->bitsPerPixel; else other_bpp = 8; REGION_NULL(pScreen, &rgnOther); SegregateChildrenBpp(pWin, &rgnOther, 0, other_bpp, pWin->drawable.bitsPerPixel); pPixChildren = NULL; if (REGION_NOTEMPTY(pScreen, &rgnOther)) { REGION_INTERSECT(pScreen, &rgnOther, &rgnOther, prgnSrc); nbox = REGION_NUM_RECTS(&rgnOther); if (nbox) { int width = rgnOther.extents.x2 - rgnOther.extents.x1; int height = rgnOther.extents.y2 - rgnOther.extents.y1; int depth = (other_bpp == 8) ? 8 : pScrn->depth; if (other_bpp == 8) pPixChildren = cfbCreatePixmap(pScreen, width, height, depth); else pPixChildren = cfb32CreatePixmap(pScreen, width, height, depth); } if (nbox && pPixChildren && (pptSrc = (DDXPointPtr) ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) { pbox = REGION_RECTS(&rgnOther); for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } REGION_NULL(pScreen, &rgnPixmap); REGION_COPY(pScreen, &rgnPixmap, &rgnOther); REGION_TRANSLATE(pScreen, &rgnPixmap, -(rgnOther.extents.x1), -(rgnOther.extents.y1)); if (other_bpp == 8) cfbDoBitbltCopy((DrawablePtr)pScreenPriv->pix8, (DrawablePtr)pPixChildren, GXcopy, &rgnPixmap, pptSrc, ~0L); else cfb32DoBitbltCopy((DrawablePtr)pScreenPriv->pix32, (DrawablePtr)pPixChildren, GXcopy, &rgnPixmap, pptSrc, ~0L); REGION_UNINIT(pScreen, &rgnPixmap); DEALLOCATE_LOCAL(pptSrc); } REGION_SUBTRACT(pScreen, &rgnDst, &rgnDst, &rgnOther); } /* Now copy the parent along with all child windows using the same depth. */ nbox = REGION_NUM_RECTS(&rgnDst); if(nbox && (pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) { pbox = REGION_RECTS(&rgnDst); for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } if (pWin->drawable.bitsPerPixel == 8) cfbDoBitbltCopy((DrawablePtr)pScreenPriv->pix8, (DrawablePtr)pScreenPriv->pix8, GXcopy, &rgnDst, pptSrc, ~0L); else cfb32DoBitbltCopy((DrawablePtr)pScreenPriv->pix32, (DrawablePtr)pScreenPriv->pix32, GXcopy, &rgnDst, pptSrc, ~0L); DEALLOCATE_LOCAL(pptSrc); } REGION_UNINIT(pScreen, &rgnDst); if (pPixChildren) { nbox = REGION_NUM_RECTS(&rgnOther); pptSrc = (DDXPointPtr) ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)); if (pptSrc) { pbox = REGION_RECTS(&rgnOther); for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) { ppt->x = pbox->x1 - rgnOther.extents.x1; ppt->y = pbox->y1 - rgnOther.extents.y1; } if (other_bpp == 8) cfbDoBitbltCopy((DrawablePtr)pPixChildren, (DrawablePtr)pScreenPriv->pix8, GXcopy, &rgnOther, pptSrc, ~0L); else cfb32DoBitbltCopy((DrawablePtr)pPixChildren, (DrawablePtr)pScreenPriv->pix32, GXcopy, &rgnOther, pptSrc, ~0L); DEALLOCATE_LOCAL(pptSrc); } if (other_bpp == 8) cfbDestroyPixmap(pPixChildren); else cfb32DestroyPixmap(pPixChildren); } REGION_UNINIT(pScreen, &rgnOther); }
/* * Redirect one window for one client */ int compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update) { CompWindowPtr cw = GetCompWindow (pWin); CompClientWindowPtr ccw; Bool wasMapped = pWin->mapped; CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen); if (pWin == cs->pOverlayWin) { return Success; } if (!pWin->parent) return BadMatch; /* * Only one Manual update is allowed */ if (cw && update == CompositeRedirectManual) for (ccw = cw->clients; ccw; ccw = ccw->next) if (ccw->update == CompositeRedirectManual) return BadAccess; /* * Allocate per-client per-window structure * The client *could* allocate multiple, but while supported, * it is not expected to be common */ ccw = xalloc (sizeof (CompClientWindowRec)); if (!ccw) return BadAlloc; ccw->id = FakeClientID (pClient->index); ccw->update = update; /* * Now make sure there's a per-window structure to hang this from */ if (!cw) { cw = xalloc (sizeof (CompWindowRec)); if (!cw) { xfree (ccw); return BadAlloc; } cw->damage = DamageCreate (compReportDamage, compDestroyDamage, DamageReportNonEmpty, FALSE, pWin->drawable.pScreen, pWin); if (!cw->damage) { xfree (ccw); xfree (cw); return BadAlloc; } if (wasMapped) { DisableMapUnmapEvents (pWin); UnmapWindow (pWin, FALSE); EnableMapUnmapEvents (pWin); } REGION_NULL (pScreen, &cw->borderClip); cw->borderClipX = 0; cw->borderClipY = 0; cw->update = CompositeRedirectAutomatic; cw->clients = 0; cw->oldx = COMP_ORIGIN_INVALID; cw->oldy = COMP_ORIGIN_INVALID; cw->damageRegistered = FALSE; cw->damaged = FALSE; dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw); } ccw->next = cw->clients; cw->clients = ccw; if (!AddResource (ccw->id, CompositeClientWindowType, pWin)) return BadAlloc; if (ccw->update == CompositeRedirectManual) { /* If the window was CompositeRedirectAutomatic, then * unmap the window so that the parent clip list will * be correctly recomputed. */ if (pWin->mapped) { DisableMapUnmapEvents (pWin); UnmapWindow (pWin, FALSE); EnableMapUnmapEvents (pWin); } if (cw->damageRegistered) { DamageUnregister (&pWin->drawable, cw->damage); cw->damageRegistered = FALSE; } cw->update = CompositeRedirectManual; } if (!compCheckRedirect (pWin)) { FreeResource (ccw->id, RT_NONE); return BadAlloc; } if (wasMapped && !pWin->mapped) { Bool overrideRedirect = pWin->overrideRedirect; pWin->overrideRedirect = TRUE; DisableMapUnmapEvents (pWin); MapWindow (pWin, pClient); EnableMapUnmapEvents (pWin); pWin->overrideRedirect = overrideRedirect; } return Success; }
static XF86VideoAdaptorPtr SIS6326SetupImageVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); XF86VideoAdaptorPtr adapt; SISPortPrivPtr pPriv; #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0) XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr; if(!pXAA || !pXAA->FillSolidRects) return NULL; #endif if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + sizeof(SISPortPrivRec) + sizeof(DevUnion)))) return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; adapt->name = "SIS 5597/5598/6326/530/620 Video Overlay"; adapt->nEncodings = 1; if(pSiS->oldChipset < OC_SIS6326) { adapt->pEncodings = &DummyEncoding5597; } else { adapt->pEncodings = &DummyEncoding; } adapt->nFormats = NUM_FORMATS; adapt->pFormats = SIS6326Formats; adapt->nPorts = 1; adapt->pPortPrivates = (DevUnion*)(&adapt[1]); pPriv = (SISPortPrivPtr)(&adapt->pPortPrivates[1]); adapt->pPortPrivates[0].ptr = (pointer)(pPriv); adapt->pAttributes = SIS6326Attributes; adapt->nAttributes = NUM_ATTRIBUTES; if(pSiS->NoYV12 == 1) { adapt->nImages = NUM_IMAGES_NOYV12; adapt->pImages = SIS6326ImagesNoYV12; } else { adapt->nImages = NUM_IMAGES; adapt->pImages = SIS6326Images; } adapt->PutVideo = NULL; adapt->PutStill = NULL; adapt->GetVideo = NULL; adapt->GetStill = NULL; adapt->StopVideo = SIS6326StopVideo; adapt->SetPortAttribute = SIS6326SetPortAttribute; adapt->GetPortAttribute = SIS6326GetPortAttribute; adapt->QueryBestSize = SIS6326QueryBestSize; adapt->PutImage = SIS6326PutImage; adapt->QueryImageAttributes = SIS6326QueryImageAttributes; pPriv->videoStatus = 0; pPriv->currentBuf = 0; pPriv->handle = NULL; pPriv->grabbedByV4L= FALSE; SIS6326SetPortDefaults(pScrn, pPriv); /* gotta uninit this someplace */ #if defined(REGION_NULL) REGION_NULL(pScreen, &pPriv->clip); #else REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); #endif pSiS->adaptor = adapt; xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); xvContrast = MAKE_ATOM("XV_CONTRAST"); xvColorKey = MAKE_ATOM("XV_COLORKEY"); xvAutopaintColorKey = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); xvSetDefaults = MAKE_ATOM("XV_SET_DEFAULTS"); xvDisableGfx = MAKE_ATOM("XV_DISABLE_GRAPHICS"); SIS6326ResetVideo(pScrn); pSiS->ResetXv = SIS6326ResetVideo; return adapt; }