Esempio n. 1
0
/*
 * Function to enable/disable access to the frame buffer
 *
 * This is used when VT switching and when entering/leaving DGA direct mode.
 *
 * This has been rewritten again to eliminate the saved pixmap.  The
 * devPrivate field in the screen pixmap is set to NULL to catch code
 * accidentally referencing the frame buffer while the X server is not
 * supposed to touch it.
 *
 * Here, we exchange the pixmap private data, rather than the pixmaps
 * themselves to avoid having to find and change any references to the screen
 * pixmap such as GC's, window privates etc.  This also means that this code
 * does not need to know exactly how the pixmap pixels are accessed.  Further,
 * this exchange is >not< done through the screen's ModifyPixmapHeader()
 * vector.  This means the called frame buffer code layers can determine
 * whether they are switched in or out by keeping track of the root pixmap's
 * private data, and therefore don't need to access pScrnInfo->vtSema.
 */
void
xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
{
    ScrnInfoPtr pScrnInfo = xf86Screens[scrnIndex];
    ScreenPtr pScreen = pScrnInfo->pScreen;
    PixmapPtr pspix;

    pspix = (*pScreen->GetScreenPixmap) (pScreen);
    if (enable)
    {
	/*
	 * Restore all of the clip lists on the screen
	 */
	if (!xf86Resetting)
	    SetRootClip (pScreen, TRUE);

    }
    else
    {
	/*
	 * Empty all of the clip lists on the screen
	 */
	SetRootClip (pScreen, FALSE);
    }
}
Esempio n. 2
0
static Bool
xwl_glamor_create_screen_resources(ScreenPtr screen)
{
    struct xwl_screen *xwl_screen = xwl_screen_get(screen);
    int ret;

    screen->CreateScreenResources = xwl_screen->CreateScreenResources;
    ret = (*screen->CreateScreenResources) (screen);
    xwl_screen->CreateScreenResources = screen->CreateScreenResources;
    screen->CreateScreenResources = xwl_glamor_create_screen_resources;

    if (!ret)
        return ret;

    if (xwl_screen->rootless) {
        screen->devPrivate =
            fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0);
        SetRootClip(screen, FALSE);
    }
    else {
        screen->devPrivate =
            xwl_glamor_create_pixmap(screen, screen->width, screen->height,
                                     screen->rootDepth,
                                     CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
        if (screen->devPrivate)
            glamor_set_screen_pixmap(screen->devPrivate, NULL);
    }

    return screen->devPrivate != NULL;
}
Esempio n. 3
0
void
winDoRandRScreenSetSize (ScreenPtr  pScreen,
                         CARD16	    width,
                         CARD16	    height,
                         CARD32	    mmWidth,
                         CARD32	    mmHeight)
{
  winScreenPriv(pScreen);
  winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
  WindowPtr pRoot = pScreen->root;

  // Prevent screen updates while we change things around
  SetRootClip(pScreen, FALSE);

  /* Update the screen size as requested */
  pScreenInfo->dwWidth = width;
  pScreenInfo->dwHeight = height;

  /* Reallocate the framebuffer used by the drawing engine */
  (*pScreenPriv->pwinFreeFB)(pScreen);
  if (!(*pScreenPriv->pwinAllocateFB)(pScreen))
    {
      ErrorF ("winDoRandRScreenSetSize - Could not reallocate framebuffer\n");
    }

  pScreen->width = width;
  pScreen->height = height;
  pScreen->mmWidth = mmWidth;
  pScreen->mmHeight = mmHeight;

  /* Update the screen pixmap to point to the new framebuffer */
  winUpdateFBPointer(pScreen, pScreenInfo->pfb);

  // pScreen->devPrivate == pScreen->GetScreenPixmap(screen) ?
  // resize the root window
  //pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL);
  // does this emit a ConfigureNotify??

  // Restore the ability to update screen, now with new dimensions
  SetRootClip(pScreen, TRUE);

  // and arrange for it to be repainted
  miPaintWindow(pRoot, &pRoot->borderClip,  PW_BACKGROUND);

  /* Indicate that a screen size change took place */
  RRScreenSizeNotify(pScreen);
}
Esempio n. 4
0
void
KdDisableScreen (ScreenPtr pScreen)
{
    KdScreenPriv(pScreen);

    if (!pScreenPriv->enabled)
	return;
    if (!pScreenPriv->closed)
	SetRootClip (pScreen, FALSE);
    KdDisableColormap (pScreen);
    if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel)
	(*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
    if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->disableCursor)
	(*pScreenPriv->card->cfuncs->disableCursor) (pScreen);
    if (pScreenPriv->card->cfuncs->dpms)
	(*pScreenPriv->card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
    pScreenPriv->enabled = FALSE;
    if(pScreenPriv->card->cfuncs->disable)
        (*pScreenPriv->card->cfuncs->disable) (pScreen);
}
Esempio n. 5
0
Bool
KdEnableScreen (ScreenPtr pScreen)
{
    KdScreenPriv (pScreen);

    if (pScreenPriv->enabled)
	return TRUE;
    if(pScreenPriv->card->cfuncs->enable)
	if (!(*pScreenPriv->card->cfuncs->enable) (pScreen))
	    return FALSE;
    pScreenPriv->enabled = TRUE;
    pScreenPriv->dpmsState = KD_DPMS_NORMAL;
    pScreenPriv->card->selected = pScreenPriv->screen->mynum;
    if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->enableCursor)
	(*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
    if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel)
	(*pScreenPriv->card->cfuncs->enableAccel) (pScreen);
    KdEnableColormap (pScreen);
    SetRootClip (pScreen, TRUE);
    if (pScreenPriv->card->cfuncs->dpms)
	(*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
    return TRUE;
}