static MSMDRI2DrawablePtr MSMDRI2GetDrawable(DrawablePtr pDraw) { MSMDRI2DrawablePtr pPriv; if (pDraw->type == DRAWABLE_WINDOW) { pPriv = dixLookupPrivate(&((WindowPtr)pDraw)->devPrivates, MSMDRI2WindowPrivateKey); } else { pPriv = dixLookupPrivate(&((PixmapPtr)pDraw)->devPrivates, MSMDRI2PixmapPrivateKey); } if (!pPriv) { pPriv = calloc(1, sizeof(*pPriv)); pPriv->pDraw = pDraw; if (pDraw->type == DRAWABLE_WINDOW) { dixSetPrivate(&((WindowPtr)pDraw)->devPrivates, MSMDRI2WindowPrivateKey, pPriv); } else { dixSetPrivate(&((PixmapPtr)pDraw)->devPrivates, MSMDRI2PixmapPrivateKey, pPriv); } if (!AddResource(pDraw->id, MSMDRI2DrawableRes, pPriv)) { MSMDRI2DrawableGone(pPriv, pDraw->id); pPriv = NULL; } } return pPriv; }
Bool DRIScreenInit(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv; int i; if (!dixRegisterPrivateKey(&DRIScreenPrivKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!dixRegisterPrivateKey(&DRIWindowPrivKeyRec, PRIVATE_WINDOW, 0)) return FALSE; if (!dixRegisterPrivateKey(&DRIPixmapPrivKeyRec, PRIVATE_PIXMAP, 0)) return FALSE; if (!dixRegisterPrivateKey(&DRIPixmapBufferPrivKeyRec, PRIVATE_PIXMAP, 0)) return FALSE; pDRIPriv = (DRIScreenPrivPtr) calloc(1, sizeof(DRIScreenPrivRec)); if (!pDRIPriv) { dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); return FALSE; } dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv); pDRIPriv->directRenderingSupport = TRUE; pDRIPriv->nrWindows = 0; /* Initialize drawable tables */ for (i = 0; i < DRI_MAX_DRAWABLES; i++) { pDRIPriv->DRIDrawables[i] = NULL; } return TRUE; }
static Bool glamor_egl_close_screen(ScreenPtr screen) { ScrnInfoPtr scrn; struct glamor_egl_screen_private *glamor_egl; PixmapPtr screen_pixmap; EGLImageKHR back_image; scrn = xf86ScreenToScrn(screen); glamor_egl = glamor_egl_get_screen_private(scrn); screen_pixmap = screen->GetScreenPixmap(screen); eglDestroyImageKHR(glamor_egl->display,glamor_egl->front_image); dixSetPrivate(&screen_pixmap->devPrivates, glamor_egl_pixmap_private_key, NULL); glamor_egl->front_image = NULL; if (glamor_egl->back_pixmap && *glamor_egl->back_pixmap) { back_image = dixLookupPrivate(&(*glamor_egl->back_pixmap)->devPrivates, glamor_egl_pixmap_private_key); if (back_image != NULL && back_image != EGL_NO_IMAGE_KHR) { eglDestroyImageKHR(glamor_egl->display, back_image); dixSetPrivate(&(*glamor_egl->back_pixmap)->devPrivates, glamor_egl_pixmap_private_key, NULL); } } screen->CloseScreen = glamor_egl->saved_close_screen; return screen->CloseScreen(screen); }
/* * The assumption is that this is called when the refCount of a surface * drops to <= 0, or the window/pixmap is destroyed. */ Bool DRIDrawablePrivDelete(pointer pResource, XID id) { DrawablePtr pDrawable = (DrawablePtr)pResource; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen); DRIDrawablePrivPtr pDRIDrawablePriv = NULL; WindowPtr pWin = NULL; PixmapPtr pPix = NULL; if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr)pDrawable; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); } else if (pDrawable->type == DRAWABLE_PIXMAP) { pPix = (PixmapPtr)pDrawable; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix); } if (pDRIDrawablePriv == NULL) { /* * We reuse __func__ and the resource type for the GLXPixmap code. * Attempt to free a pixmap buffer associated with the resource * if possible. */ return DRIFreePixmapImp(pDrawable); } if (pDRIDrawablePriv->drawableIndex != -1) { /* release drawable table entry */ pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL; } if (pDRIDrawablePriv->sid != 0) { DRISurfaceNotify(pDRIDrawablePriv->sid, AppleDRISurfaceNotifyDestroyed); } if (pDRIDrawablePriv->notifiers != NULL) x_hook_free(pDRIDrawablePriv->notifiers); free(pDRIDrawablePriv); if (pDrawable->type == DRAWABLE_WINDOW) { dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL); } else if (pDrawable->type == DRAWABLE_PIXMAP) { dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL); } --pDRIPriv->nrWindows; return TRUE; }
Bool miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) { if (pCursor->bits->refcnt <= 1) dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), NULL); return TRUE; }
/* Set up sprite information for the device. This function will be called once for each device after it is initialized in the DIX. */ static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { miPointerPtr pPointer; SetupScreen (pScreen); pPointer = malloc(sizeof(miPointerRec)); if (!pPointer) return FALSE; pPointer->pScreen = NULL; pPointer->pSpriteScreen = NULL; pPointer->pCursor = NULL; pPointer->pSpriteCursor = NULL; pPointer->limits.x1 = 0; pPointer->limits.x2 = 32767; pPointer->limits.y1 = 0; pPointer->limits.y2 = 32767; pPointer->confined = FALSE; pPointer->x = 0; pPointer->y = 0; if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen))) { free(pPointer); return FALSE; } dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, pPointer); return TRUE; }
Bool glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo) { ScreenPtr screen = pixmap->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); struct glamor_egl_screen_private *glamor_egl; EGLImageKHR image; GLuint texture; Bool ret = FALSE; glamor_egl = glamor_egl_get_screen_private(scrn); glamor_get_context(glamor_priv); image = eglCreateImageKHR(glamor_egl->display, glamor_egl->context, EGL_NATIVE_PIXMAP_KHR, bo, NULL); if (image == EGL_NO_IMAGE_KHR) { glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY); goto done; } glamor_create_texture_from_image(glamor_egl, image, &texture); glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); glamor_set_pixmap_texture(pixmap, texture); dixSetPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key, image); ret = TRUE; done: glamor_put_context(glamor_priv); return ret; }
Bool VidModeExtensionInit(ScreenPtr pScreen) { #ifdef XF86VIDMODE VidModePtr pVidMode; if (!xf86GetVidModeEnabled()) { DebugF("!xf86GetVidModeEnabled()\n"); return FALSE; } VidModeKey = &VidModeKeyRec; if (!dixRegisterPrivateKey(&VidModeKeyRec, PRIVATE_SCREEN, 0)) return FALSE; pVidMode = calloc(sizeof(VidModeRec), 1); if (!pVidMode) return FALSE; dixSetPrivate(&pScreen->devPrivates, VidModeKey, pVidMode); pVidMode->Flags = 0; pVidMode->Next = NULL; pVidMode->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = VidModeClose; VidModeCount++; return TRUE; #else DebugF("no vidmode extension\n"); return FALSE; #endif }
static Bool DRIFreePixmapImp(DrawablePtr pDrawable) { DRIPixmapBufferPtr shared; PixmapPtr pPix; if (pDrawable->type != DRAWABLE_PIXMAP) return FALSE; pPix = (PixmapPtr)pDrawable; shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey); if (NULL == shared) return FALSE; close(shared->fd); munmap(shared->buffer, shared->length); shm_unlink(shared->shmPath); free(shared); dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (pointer)NULL); return TRUE; }
void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) { miDCBufferPtr pBuffer; int i; if (DevHasCursor(pDev)) { for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; pBuffer = miGetDCDevice(pDev, pScreen); if (pBuffer) { if (pBuffer->pSourceGC) FreeGC(pBuffer->pSourceGC, (GContext) 0); if (pBuffer->pMaskGC) FreeGC(pBuffer->pMaskGC, (GContext) 0); if (pBuffer->pSaveGC) FreeGC(pBuffer->pSaveGC, (GContext) 0); if (pBuffer->pRestoreGC) FreeGC(pBuffer->pRestoreGC, (GContext) 0); #ifdef ARGB_CURSOR /* If a pRootPicture was allocated for a root window, it * is freed when that root window is destroyed, so don't * free it again here. */ #endif if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave); free(pBuffer); dixSetPrivate(&pDev->devPrivates, miDCDeviceKey(pScreen), NULL); } } } }
static Bool compCloseScreen(ScreenPtr pScreen) { CompScreenPtr cs = GetCompScreen(pScreen); Bool ret; free(cs->alternateVisuals); pScreen->CloseScreen = cs->CloseScreen; pScreen->InstallColormap = cs->InstallColormap; pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes; pScreen->ReparentWindow = cs->ReparentWindow; pScreen->ConfigNotify = cs->ConfigNotify; pScreen->MoveWindow = cs->MoveWindow; pScreen->ResizeWindow = cs->ResizeWindow; pScreen->ChangeBorderWidth = cs->ChangeBorderWidth; pScreen->ClipNotify = cs->ClipNotify; pScreen->UnrealizeWindow = cs->UnrealizeWindow; pScreen->RealizeWindow = cs->RealizeWindow; pScreen->DestroyWindow = cs->DestroyWindow; pScreen->CreateWindow = cs->CreateWindow; pScreen->CopyWindow = cs->CopyWindow; pScreen->PositionWindow = cs->PositionWindow; pScreen->GetImage = cs->GetImage; pScreen->GetSpans = cs->GetSpans; pScreen->SourceValidate = cs->SourceValidate; free(cs); dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); ret = (*pScreen->CloseScreen) (pScreen); return ret; }
Bool xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp) { sbusCmapPtr cmap; struct fbcmap fbcmap; unsigned char data[2]; cmap = xnfcalloc(1, sizeof(sbusCmapRec)); dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap); cmap->psdp = psdp; fbcmap.index = 0; fbcmap.count = 16; fbcmap.red = cmap->origRed; fbcmap.green = cmap->origGreen; fbcmap.blue = cmap->origBlue; if (ioctl (psdp->fd, FBIOGETCMAP, &fbcmap) >= 0) cmap->origCmapValid = TRUE; fbcmap.index = 0; fbcmap.count = 2; fbcmap.red = data; fbcmap.green = data; fbcmap.blue = data; if (pScreen->whitePixel == 0) { data[0] = 255; data[1] = 0; } else { data[0] = 0; data[1] = 255; } ioctl (psdp->fd, FBIOPUTCMAP, &fbcmap); cmap->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = xf86SbusCmapCloseScreen; return xf86HandleColormaps(pScreen, 256, 8, xf86SbusCmapLoadPalette, NULL, 0); }
int XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt) { XvMCScreenPtr pScreenPriv; if (!dixRegisterPrivateKey(&XvMCScreenKeyRec, PRIVATE_SCREEN, 0)) return BadAlloc; if(!(pScreenPriv = malloc(sizeof(XvMCScreenRec)))) return BadAlloc; dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv); pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = XvMCCloseScreen; pScreenPriv->num_adaptors = num; pScreenPriv->adaptors = pAdapt; pScreenPriv->clientDriverName[0] = 0; pScreenPriv->busID[0] = 0; pScreenPriv->major = 0; pScreenPriv->minor = 0; pScreenPriv->patchLevel = 0; XvMCInUse = TRUE; return Success; }
/* Screen initialization/teardown */ void miInitializeCompositeWrapper(ScreenPtr pScreen) { cwScreenPtr pScreenPriv; #ifdef RENDER Bool has_render = GetPictureScreenIfSet(pScreen) != NULL; #endif if (!dixRequestPrivate(cwGCKey, sizeof(cwGCRec))) return; pScreenPriv = xalloc(sizeof(cwScreenRec)); if (!pScreenPriv) return; dixSetPrivate(&pScreen->devPrivates, cwScreenKey, pScreenPriv); SCREEN_EPILOGUE(pScreen, CloseScreen, cwCloseScreen); SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage); SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans); SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC); SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow); SCREEN_EPILOGUE(pScreen, SetWindowPixmap, cwSetWindowPixmap); SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap); #ifdef RENDER if (has_render) cwInitializeRender(pScreen); #endif }
/* Return NULL if an error occurs. */ static DRIDrawablePrivPtr CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr) { DRIDrawablePrivPtr pDRIDrawablePriv; xp_window_id wid = 0; *widPtr = 0; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); if (pDRIDrawablePriv == NULL) { xp_error err; xp_window_changes wc; /* allocate a DRI Window Private record */ if (!(pDRIDrawablePriv = xalloc(sizeof(*pDRIDrawablePriv)))) { return NULL; } pDRIDrawablePriv->pDraw = (DrawablePtr)pWin; pDRIDrawablePriv->pScreen = pScreen; pDRIDrawablePriv->refCount = 0; pDRIDrawablePriv->drawableIndex = -1; pDRIDrawablePriv->notifiers = NULL; /* find the physical window */ wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE)); if (wid == 0) { xfree(pDRIDrawablePriv); return NULL; } /* allocate the physical surface */ err = xp_create_surface(wid, &pDRIDrawablePriv->sid); if (err != Success) { xfree(pDRIDrawablePriv); return NULL; } /* Make it visible */ wc.stack_mode = XP_MAPPED_ABOVE; wc.sibling = 0; err = xp_configure_surface(pDRIDrawablePriv->sid, XP_STACKING, &wc); if (err != Success) { xp_destroy_surface(pDRIDrawablePriv->sid); xfree(pDRIDrawablePriv); return NULL; } /* save private off of preallocated index */ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, pDRIDrawablePriv); } *widPtr = wid; return pDRIDrawablePriv; }
static Bool compCloseScreen (int index, ScreenPtr pScreen) { CompScreenPtr cs = GetCompScreen (pScreen); Bool ret; xfree (cs->alternateVisuals); pScreen->CloseScreen = cs->CloseScreen; pScreen->BlockHandler = cs->BlockHandler; pScreen->InstallColormap = cs->InstallColormap; pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes; pScreen->ReparentWindow = cs->ReparentWindow; pScreen->MoveWindow = cs->MoveWindow; pScreen->ResizeWindow = cs->ResizeWindow; pScreen->ChangeBorderWidth = cs->ChangeBorderWidth; pScreen->ClipNotify = cs->ClipNotify; pScreen->UnrealizeWindow = cs->UnrealizeWindow; pScreen->RealizeWindow = cs->RealizeWindow; pScreen->DestroyWindow = cs->DestroyWindow; pScreen->CreateWindow = cs->CreateWindow; pScreen->CopyWindow = cs->CopyWindow; pScreen->PositionWindow = cs->PositionWindow; xfree (cs); dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); ret = (*pScreen->CloseScreen) (index, pScreen); return ret; }
static Bool xf86FBCloseScreen(ScreenPtr pScreen) { FBLinkPtr pLink, tmp; FBLinearLinkPtr pLinearLink, tmp2; FBManagerPtr offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey); pScreen->CloseScreen = offman->CloseScreen; pLink = offman->UsedAreas; while (pLink) { tmp = pLink; pLink = pLink->next; free(tmp); } pLinearLink = offman->LinearAreas; while (pLinearLink) { tmp2 = pLinearLink; pLinearLink = pLinearLink->next; free(tmp2); } RegionDestroy(offman->InitialBoxes); RegionDestroy(offman->FreeBoxes); free(offman->FreeBoxesUpdateCallback); free(offman->devPrivates); free(offman); dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL); return (*pScreen->CloseScreen) (pScreen); }
Bool miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) { miDCScreenPtr pScreenPriv; if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0) || !dixRegisterScreenPrivateKey(&miDCCursorBitsKeyRec, pScreen, PRIVATE_CURSOR_BITS, 0) || !dixRegisterScreenPrivateKey(&miDCDeviceKeyRec, pScreen, PRIVATE_DEVICE, 0)) return FALSE; pScreenPriv = malloc(sizeof (miDCScreenRec)); if (!pScreenPriv) return FALSE; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miDCCloseScreen; dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv); if (!miSpriteInitialize (pScreen, screenFuncs)) { free((pointer) pScreenPriv); return FALSE; } return TRUE; }
static Bool xf86CreateRootWindow(WindowPtr pWin) { int ret = TRUE; int err = Success; ScreenPtr pScreen = pWin->drawable.pScreen; RootWinPropPtr pProp; CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey); DebugF("xf86CreateRootWindow(%p)\n", pWin); if ( pScreen->CreateWindow != xf86CreateRootWindow ) { /* Can't find hook we are hung on */ xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */, "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n", (void *)xf86CreateRootWindow, (void *)pScreen->CreateWindow ); } /* Unhook this function ... */ pScreen->CreateWindow = CreateWindow; dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL); /* ... and call the previous CreateWindow fuction, if any */ if (NULL!=pScreen->CreateWindow) { ret = (*pScreen->CreateWindow)(pWin); } /* Now do our stuff */ if (xf86RegisteredPropertiesTable != NULL) { if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) { for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum]; pProp != NULL && err==Success; pProp = pProp->next ) { Atom prop; prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE); err = dixChangeWindowProperty(serverClient, pWin, prop, pProp->type, pProp->format, PropModeReplace, pProp->size, pProp->data, FALSE); } /* Look at err */ ret &= (err==Success); } else { xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with " "non-root window %p (parent %p)\n", (void *)pWin, (void *)pWin->parent); ret = FALSE; } } DebugF("xf86CreateRootWindow() returns %d\n", ret); return ret; }
static DRI2DrawablePtr DRI2AllocateDrawable(DrawablePtr pDraw) { DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); DRI2DrawablePtr pPriv; CARD64 ust; WindowPtr pWin; PixmapPtr pPixmap; pPriv = malloc(sizeof *pPriv); if (pPriv == NULL) return NULL; pPriv->dri2_screen = ds; pPriv->drawable = pDraw; pPriv->width = pDraw->width; pPriv->height = pDraw->height; pPriv->buffers = NULL; pPriv->bufferCount = 0; pPriv->swapsPending = 0; pPriv->blockedClient = NULL; pPriv->blockedOnMsc = FALSE; pPriv->swap_count = 0; pPriv->target_sbc = -1; pPriv->swap_interval = 1; /* Initialize last swap target from DDX if possible */ if (!ds->GetMSC || !(*ds->GetMSC) (pDraw, &ust, &pPriv->last_swap_target)) pPriv->last_swap_target = 0; pPriv->swap_limit = 1; /* default to double buffering */ pPriv->last_swap_msc = 0; pPriv->last_swap_ust = 0; xorg_list_init(&pPriv->reference_list); pPriv->serialNumber = DRI2DrawableSerial(pDraw); pPriv->needInvalidate = FALSE; if (pDraw->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDraw; dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv); } else { pPixmap = (PixmapPtr) pDraw; dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, pPriv); } return pPriv; }
/* * Free one of the per-client per-window resources, clearing * redirect and the per-window pointer as appropriate */ void compFreeClientWindow (WindowPtr pWin, XID id) { ScreenPtr pScreen = pWin->drawable.pScreen; CompWindowPtr cw = GetCompWindow (pWin); CompClientWindowPtr ccw, *prev; Bool anyMarked = FALSE; WindowPtr pLayerWin; PixmapPtr pPixmap = NULL; if (!cw) return; for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next) { if (ccw->id == id) { *prev = ccw->next; if (ccw->update == CompositeRedirectManual) cw->update = CompositeRedirectAutomatic; free(ccw); break; } } if (!cw->clients) { anyMarked = compMarkWindows (pWin, &pLayerWin); if (pWin->redirectDraw != RedirectDrawNone) { pPixmap = (*pScreen->GetWindowPixmap) (pWin); compSetParentPixmap (pWin); } if (cw->damage) DamageDestroy (cw->damage); RegionUninit(&cw->borderClip); dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL); free(cw); } else if (cw->update == CompositeRedirectAutomatic && !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone) { anyMarked = compMarkWindows (pWin, &pLayerWin); DamageRegister (&pWin->drawable, cw->damage); cw->damageRegistered = TRUE; pWin->redirectDraw = RedirectDrawAutomatic; DamageDamageRegion(&pWin->drawable, &pWin->borderSize); } if (anyMarked) compHandleMarkedWindows (pWin, pLayerWin); if (pPixmap) { compRestoreWindow (pWin, pPixmap); (*pScreen->DestroyPixmap) (pPixmap); } }
Bool DRIDrawablePrivDelete(pointer pResource, XID id) { DrawablePtr pDrawable = (DrawablePtr)pResource; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen); DRIDrawablePrivPtr pDRIDrawablePriv = NULL; WindowPtr pWin = NULL; PixmapPtr pPix = NULL; if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr)pDrawable; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); } else if (pDrawable->type == DRAWABLE_PIXMAP) { pPix = (PixmapPtr)pDrawable; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix); } if (pDRIDrawablePriv == NULL) { return DRIFreePixmapImp(pDrawable); } if (pDRIDrawablePriv->drawableIndex != -1) { /* release drawable table entry */ pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL; } if (pDRIDrawablePriv->sid != 0) { xp_destroy_surface(pDRIDrawablePriv->sid); x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(pDRIDrawablePriv->sid)); } if (pDRIDrawablePriv->notifiers != NULL) x_hook_free(pDRIDrawablePriv->notifiers); xfree(pDRIDrawablePriv); if (pDrawable->type == DRAWABLE_WINDOW) { dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL); } else if (pDrawable->type == DRAWABLE_PIXMAP) { dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL); } --pDRIPriv->nrWindows; return TRUE; }
/* * Free one of the per-client per-window resources, clearing * redirect and the per-window pointer as appropriate */ void compFreeClientWindow (WindowPtr pWin, XID id) { CompWindowPtr cw = GetCompWindow (pWin); CompClientWindowPtr ccw, *prev; Bool wasMapped = pWin->mapped; if (!cw) return; for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next) { if (ccw->id == id) { *prev = ccw->next; if (ccw->update == CompositeRedirectManual) cw->update = CompositeRedirectAutomatic; free(ccw); break; } } if (!cw->clients) { if (wasMapped) { DisableMapUnmapEvents (pWin); UnmapWindow (pWin, FALSE); EnableMapUnmapEvents (pWin); } if (pWin->redirectDraw != RedirectDrawNone) compFreePixmap (pWin); if (cw->damage) DamageDestroy (cw->damage); RegionUninit(&cw->borderClip); dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL); free(cw); } else if (cw->update == CompositeRedirectAutomatic && !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone) { DamageRegister (&pWin->drawable, cw->damage); cw->damageRegistered = TRUE; pWin->redirectDraw = RedirectDrawAutomatic; DamageRegionAppend(&pWin->drawable, &pWin->borderSize); } if (wasMapped && !pWin->mapped) { Bool overrideRedirect = pWin->overrideRedirect; pWin->overrideRedirect = TRUE; DisableMapUnmapEvents (pWin); MapWindow (pWin, clients[CLIENT_ID(id)]); EnableMapUnmapEvents (pWin); pWin->overrideRedirect = overrideRedirect; } }
void miSetZeroLineBias(ScreenPtr pScreen, unsigned int bias) { if (!dixRegisterPrivateKey(&miZeroLineScreenKeyRec, PRIVATE_SCREEN, 0)) return; dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey, (unsigned long *) (unsigned long) bias); }
static Bool ShmCloseScreen(int i, ScreenPtr pScreen) { ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen); pScreen->CloseScreen = screen_priv->CloseScreen; dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL); free(screen_priv); return (*pScreen->CloseScreen) (i, pScreen); }
Bool xf86RandR12Init (ScreenPtr pScreen) { rrScrPrivPtr rp; XF86RandRInfoPtr randrp; #ifdef PANORAMIX /* XXX disable RandR when using Xinerama */ if (!noPanoramiXExtension) return TRUE; #endif if (xf86RandR12Generation != serverGeneration) xf86RandR12Generation = serverGeneration; #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) xf86RandR12Key = &xf86RandR12KeyIndex; #else xf86RandR12Index = AllocateScreenPrivateIndex(); #endif randrp = xalloc (sizeof (XF86RandRInfoRec)); if (!randrp) return FALSE; if (!RRScreenInit(pScreen)) { xfree (randrp); return FALSE; } rp = rrGetScrPriv(pScreen); rp->rrGetInfo = xf86RandR12GetInfo; rp->rrSetConfig = xf86RandR12SetConfig; randrp->virtualX = -1; randrp->virtualY = -1; randrp->mmWidth = pScreen->mmWidth; randrp->mmHeight = pScreen->mmHeight; randrp->rotation = RR_Rotate_0; /* initial rotated mode */ randrp->supported_rotations = RR_Rotate_0; randrp->maxX = randrp->maxY = 0; #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp); #else pScreen->devPrivates[xf86RandR12Index].ptr = randrp; #endif #if RANDR_12_INTERFACE if (!xf86RandR12Init12 (pScreen)) return FALSE; #endif return TRUE; }
void DRICloseScreen(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (pDRIPriv && pDRIPriv->directRenderingSupport) { xfree(pDRIPriv); dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); } }
Bool fbCreateWindow(WindowPtr pWin) { dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), fbGetScreenPixmap(pWin->drawable.pScreen)); if (pWin->drawable.bitsPerPixel == 32) pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp; return TRUE; }
Bool fbCreateWindow(WindowPtr pWin) { dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), fbGetScreenPixmap(pWin->drawable.pScreen)); #ifdef FB_SCREEN_PRIVATE if (pWin->drawable.bitsPerPixel == 32) pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp; #endif return TRUE; }
static int MSMDRI2DrawableGone(pointer p, XID id) { MSMDRI2DrawablePtr pPriv = p; DrawablePtr pDraw = pPriv->pDraw; if (pPriv->pThirdBuffer) MSMDRI2DestroyBuffer(pDraw, pPriv->pThirdBuffer); if (pDraw->type == DRAWABLE_WINDOW) { dixSetPrivate(&((WindowPtr)pDraw)->devPrivates, MSMDRI2WindowPrivateKey, NULL); } else { dixSetPrivate(&((PixmapPtr)pDraw)->devPrivates, MSMDRI2PixmapPrivateKey, NULL); } free(pPriv); return Success; }