本文整理汇总了C++中dixSetPrivate函数的典型用法代码示例。如果您正苦于以下问题:C++ dixSetPrivate函数的具体用法?C++ dixSetPrivate怎么用?C++ dixSetPrivate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dixSetPrivate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MSMDRI2GetDrawable
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;
}
示例2: DRIScreenInit
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;
}
示例3: glamor_egl_close_screen
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);
}
示例4: DRIDrawablePrivDelete
/*
* 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;
}
示例5: glamor_egl_create_textured_pixmap_from_gbm_bo
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;
}
示例6: VidModeExtensionInit
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
}
示例7: DRIFreePixmapImp
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;
}
示例8: compCloseScreen
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;
}
示例9: xf86SbusHandleColormaps
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);
}
示例10: XvMCScreenInit
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;
}
示例11: miInitializeCompositeWrapper
/* 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
}
示例12: CreateSurfaceForWindow
/* 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;
}
示例13: compCloseScreen
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;
}
示例14: xf86FBCloseScreen
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);
}
示例15: miDCInitialize
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;
}