static Bool
TegraCloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    TegraPtr tegra = TegraPTR(pScrn);

    if (tegra->damage) {
        DamageUnregister(&pScreen->GetScreenPixmap(pScreen)->drawable,
                         tegra->damage);
        DamageDestroy(tegra->damage);
        tegra->damage = NULL;
    }

    if (tegra->drmmode.shadow_enable) {
        shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
        free(tegra->drmmode.shadow_fb);
        tegra->drmmode.shadow_fb = NULL;
    }

    drmmode_uevent_fini(pScrn, &tegra->drmmode);
    drmmode_free_bos(pScrn, &tegra->drmmode);

    if (pScrn->vtSema)
        TegraLeaveVT(VT_FUNC_ARGS);

    pScreen->CreateScreenResources = tegra->createScreenResources;
    pScreen->BlockHandler = tegra->BlockHandler;

    pScrn->vtSema = FALSE;
    pScreen->CloseScreen = tegra->CloseScreen;
    return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
}
示例#2
0
static Bool
NestedCloseScreen(int scrnIndex, ScreenPtr pScreen) {
    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];

    xf86DrvMsg(scrnIndex, X_INFO, "NestedCloseScreen\n");

    shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));

    TimerFree(PNESTED(pScrn)->timer);
    NestedClientCloseScreen(PCLIENTDATA(pScrn));

    pScreen->CloseScreen = PNESTED(pScrn)->CloseScreen;
    return (*pScreen->CloseScreen)(scrnIndex, pScreen);
}
示例#3
0
static Bool
shadowCloseScreen(int i, ScreenPtr pScreen)
{
    shadowBuf(pScreen);

    unwrap(pBuf, pScreen, GetImage);
    unwrap(pBuf, pScreen, CloseScreen);
    shadowRemove(pScreen, pBuf->pPixmap);
    DamageDestroy(pBuf->pDamage);
#ifdef BACKWARDS_COMPATIBILITY
    REGION_UNINIT(pScreen, &pBuf->damage); /* bc */
#endif
    if (pBuf->pPixmap)
	pScreen->DestroyPixmap(pBuf->pPixmap);
    xfree(pBuf);
    return pScreen->CloseScreen(i, pScreen);
}
示例#4
0
文件: shadow.c 项目: MrKepzie/xserver
static Bool
shadowCloseScreen(ScreenPtr pScreen)
{
    shadowBuf(pScreen);

    unwrap(pBuf, pScreen, GetImage);
    unwrap(pBuf, pScreen, CloseScreen);
    shadowRemove(pScreen, pBuf->pPixmap);
    DamageDestroy(pBuf->pDamage);
#ifdef BACKWARDS_COMPATIBILITY
    RegionUninit(&pBuf->damage);        /* bc */
#endif
    if (pBuf->pPixmap)
        pScreen->DestroyPixmap(pBuf->pPixmap);
    free(pBuf);
    return pScreen->CloseScreen(pScreen);
}
示例#5
0
文件: layerwin.c 项目: aosm/X11
void
LayerDestroyPixmap (ScreenPtr pScreen, LayerPtr pLayer)
{
    if (pLayer->pPixmap)
    {
	if (pLayer->pKind->kind == LAYER_SHADOW)
	    shadowRemove (pScreen, pLayer->pPixmap);
	if (pLayer->freePixmap)
	{
	    LayerKindPtr    pKind = pLayer->pKind;

	    LayerUnwrap (pScreen, pKind, DestroyPixmap);
	    (*pScreen->DestroyPixmap) (pLayer->pPixmap);
	    LayerWrap (pScreen, pKind, DestroyPixmap, layerDestroyPixmap);
	}
	pLayer->pPixmap = 0;
    }
}
Bool
GXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode)
{
    GeodeRec *pGeode = GEODEPTR(pScrni);
    Rotation curr = pGeode->rotation;
    unsigned int curdw = pScrni->displayWidth;
    PixmapPtr pPixmap;
    BOOL ret;

    pPixmap = pScrni->pScreen->GetScreenPixmap(pScrni->pScreen);
    pGeode->rotation = GXGetRotation(pScrni->pScreen);

    /* Leave if we have nothing to do */

    if (pGeode->rotation == curr && pGeode->curMode == mode) {
        return TRUE;
    }

    shadowRemove(pScrni->pScreen, NULL);

    switch (pGeode->rotation) {
    case RR_Rotate_0:
        ErrorF("Rotate to 0 degrees\n");
        pScrni->displayWidth = pGeode->displayWidth;
        pGeode->Pitch = pGeode->displayPitch;
        break;

    case RR_Rotate_90:
        ErrorF("Rotate to 90 degrees\n");
        pScrni->displayWidth = pScrni->pScreen->width;
        break;

    case RR_Rotate_180:
        ErrorF("Rotate to 180 degrees\n");
        pScrni->displayWidth = pGeode->displayWidth;
        break;

    case RR_Rotate_270:
        ErrorF("Rotate to 270 degrees\n");
        pScrni->displayWidth = pScrni->pScreen->width;
        break;
    }

    if (pGeode->rotation != RR_Rotate_0) {

        ret =
            shadowAdd(pScrni->pScreen, pPixmap, GXUpdate, GXWindowLinear,
                      pGeode->rotation, NULL);

        if (!ret) {
            ErrorF("shadowAdd failed\n");
            goto error;
        }
    }

    if (pGeode->rotation == RR_Rotate_0)
        pScrni->fbOffset = pGeode->displayOffset;
    else
        pScrni->fbOffset = pGeode->shadowOffset;

    pScrni->pScreen->ModifyPixmapHeader(pPixmap,
                                        pScrni->pScreen->width,
                                        pScrni->pScreen->height,
                                        pScrni->pScreen->rootDepth,
                                        pScrni->bitsPerPixel,
                                        PixmapBytePad(pScrni->displayWidth,
                                                      pScrni->
                                                      pScreen->rootDepth),
                                        (pointer) (pGeode->FBBase +
                                                   pScrni->fbOffset));

    /* Don't use XAA pixmap cache or offscreen pixmaps when rotated */
#if XF86XAA
    if (pGeode->AccelInfoRec) {
        if (pGeode->rotation == RR_Rotate_0) {
            pGeode->AccelInfoRec->Flags =
                LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE;
            pGeode->AccelInfoRec->UsingPixmapCache = TRUE;
            pGeode->AccelInfoRec->maxOffPixWidth = 0;
            pGeode->AccelInfoRec->maxOffPixHeight = 0;
        }
        else {
            pGeode->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER;
            pGeode->AccelInfoRec->UsingPixmapCache = FALSE;
            pGeode->AccelInfoRec->maxOffPixWidth = 1;
            pGeode->AccelInfoRec->maxOffPixHeight = 1;
        }
    }
#endif

    return TRUE;

 error:
    /* Restore the old rotation */
    pScrni->displayWidth = curdw;

    if (curr & (RR_Rotate_0 | RR_Rotate_180)) {
        pScrni->pScreen->width = pScrni->virtualX;
        pScrni->pScreen->height = pScrni->virtualY;
    }
    else {
        pScrni->pScreen->width = pScrni->virtualY;
        pScrni->pScreen->height = pScrni->virtualX;
    }

    pGeode->rotation = curr;
    return FALSE;
}