コード例 #1
0
ファイル: rootlessScreen.c プロジェクト: dikerex/theqvd
static Bool
RootlessAllocatePrivates(ScreenPtr pScreen)
{
    RootlessScreenRec *s;
    static unsigned long rootlessGeneration = 0;

    if (rootlessGeneration != serverGeneration) {
        rootlessScreenPrivateIndex = AllocateScreenPrivateIndex();
        if (rootlessScreenPrivateIndex == -1) return FALSE;
        rootlessGCPrivateIndex = AllocateGCPrivateIndex();
        if (rootlessGCPrivateIndex == -1) return FALSE;
        rootlessWindowPrivateIndex = AllocateWindowPrivateIndex();
        if (rootlessWindowPrivateIndex == -1) return FALSE;
        rootlessGeneration = serverGeneration;
    }

    // no allocation needed for screen privates
    if (!AllocateGCPrivate(pScreen, rootlessGCPrivateIndex,
                           sizeof(RootlessGCRec)))
        return FALSE;
    if (!AllocateWindowPrivate(pScreen, rootlessWindowPrivateIndex, 0))
        return FALSE;

    s = xalloc(sizeof(RootlessScreenRec));
    if (! s) return FALSE;
    SCREENREC(pScreen) = s;

    return TRUE;
}
コード例 #2
0
ファイル: dri.c プロジェクト: BackupTheBerlios/dri-ex-svn
Bool
DRIExtensionInit(void)
{
    static unsigned long DRIGeneration = 0;

    if (DRIGeneration != serverGeneration) {
        if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
            return FALSE;
        DRIGeneration = serverGeneration;
    }

    /*
     * Allocate a window private index with a zero sized private area for
     * each window, then should a window become a DRI window, we'll hang
     * a DRIWindowPrivateRec off of this private index. Do same for pixmaps.
     */
    if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0)
        return FALSE;
    if ((DRIPixmapPrivIndex = AllocatePixmapPrivateIndex()) < 0)
        return FALSE;

    DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);

    return TRUE;
}
コード例 #3
0
Bool LeoAccelInit (ScreenPtr pScreen, LeoPtr pLeo)
{
	LeoCommand0 *lc0;
	LeoDraw *ld0;

	if (serverGeneration != LeoGeneration) {
		LeoScreenPrivateIndex = AllocateScreenPrivateIndex ();
		if (LeoScreenPrivateIndex == -1) return FALSE;
		LeoGCPrivateIndex = AllocateGCPrivateIndex ();
		LeoWindowPrivateIndex = AllocateWindowPrivateIndex ();
		LeoGeneration = serverGeneration;
	}
	
	/* Allocate private structures holding pointer to both videoRAM and control registers.
	   We do not have to map these by ourselves, because the XServer did it for us; we
	   only copy the pointers to out structures. */
	if (!AllocateGCPrivate(pScreen, LeoGCPrivateIndex, sizeof(LeoPrivGCRec))) return FALSE;
	if (!AllocateWindowPrivate(pScreen, LeoWindowPrivateIndex, 0)) return FALSE;
	pScreen->devPrivates[LeoScreenPrivateIndex].ptr = pLeo;
	pLeo->lc0 = lc0 = (LeoCommand0 *) ((char *)pLeo->fb + LEO_LC0_VOFF);
	pLeo->ld0 = ld0 = (LeoDraw *) ((char *)pLeo->fb + LEO_LD0_VOFF);

	if (!pLeo->NoAccel) {
		/* Replace various screen functions. */
		pScreen->CreateGC = LeoCreateGC;
		pScreen->CopyWindow = LeoCopyWindow;
	}

	/* We will now clear the screen: we'll draw a rectangle covering all the
	 * viewscreen, using a 'blackness' ROP.
	 */
	ld0->wid = 1;
	ld0->widclip = 0;
	ld0->wmask = 0xffff;
	ld0->planemask = 0xffffff;
	ld0->rop = LEO_ATTR_WE_ENABLE|LEO_ATTR_RGBE_ENABLE|LEO_ATTR_FORCE_WID;
	ld0->fg = 0;
	ld0->vclipmin = 0;
	ld0->vclipmax = (pLeo->psdp->width - 1) | ((pLeo->psdp->height - 1) << 16);
	pLeo->vclipmax = (pLeo->psdp->width - 1) | ((pLeo->psdp->height - 1) << 16);
	pLeo->width = pLeo->psdp->width;
	pLeo->height = pLeo->psdp->height;
	
	while (lc0->csr & LEO_CSR_BLT_BUSY);
	
	lc0->extent = (pLeo->psdp->width - 1) | ((pLeo->psdp->height - 1) << 11);
	lc0->fill = 0;
	
	while (lc0->csr & LEO_CSR_BLT_BUSY);
	
	lc0->addrspace = LEO_ADDRSPC_OBGR;
	ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW;

	/* Success */
	return TRUE;
}
コード例 #4
0
ファイル: layerinit.c プロジェクト: aosm/X11
Bool
LayerStartInit (ScreenPtr pScreen)
{
    LayerScreenPtr  pScrPriv;
    
    if (layerGeneration != serverGeneration)
    {
	layerScrPrivateIndex = AllocateScreenPrivateIndex ();
	if (layerScrPrivateIndex == -1)
	    return FALSE;
	layerGCPrivateIndex = AllocateGCPrivateIndex ();
	if (layerGCPrivateIndex == -1)
	    return FALSE;
	layerWinPrivateIndex = AllocateWindowPrivateIndex ();
	if (layerWinPrivateIndex == -1)
	    return FALSE;
	layerGeneration = serverGeneration;
    }
    if (!AllocateGCPrivate (pScreen, layerGCPrivateIndex, sizeof (LayerGCRec)))
	return FALSE;
    if (!AllocateWindowPrivate (pScreen, layerWinPrivateIndex, sizeof (LayerWinRec)))
	return FALSE;
    pScrPriv = (LayerScreenPtr) xalloc (sizeof (LayerScreenRec));
    if (!pScrPriv)
	return FALSE;
    pScrPriv->nkinds = 0;
    pScrPriv->kinds = 0;
    pScrPriv->pLayers = 0;
    pScreen->devPrivates[layerScrPrivateIndex].ptr = (pointer) pScrPriv;
    /*
     * Add fb kind -- always 0
     */
    if (LayerNewKind (pScreen) < 0)
    {
	pScreen->devPrivates[layerScrPrivateIndex].ptr = 0;
	xfree (pScrPriv);
	return FALSE;
    }
    /*
     * Add shadow kind -- always 1
     */
    if (!shadowSetup (pScreen))
	return FALSE;
    if (LayerNewKind (pScreen) < 0)
    {
	pScreen->devPrivates[layerScrPrivateIndex].ptr = 0;
	xfree (pScrPriv->kinds);
	xfree (pScrPriv);
	return FALSE;
    }
    return TRUE;
}
コード例 #5
0
ファイル: afbscrinit.c プロジェクト: Magister/x11rdp_xorg71
Bool
afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex)
{
	if (afbGeneration != serverGeneration) {
#ifdef PIXMAP_PER_WINDOW
		frameWindowPrivateIndex = AllocateWindowPrivateIndex();
#endif
		afbWindowPrivateIndex = AllocateWindowPrivateIndex();
		afbGCPrivateIndex = AllocateGCPrivateIndex();
		afbGeneration = serverGeneration;
	}
	if (pWinIndex)
		*pWinIndex = afbWindowPrivateIndex;
	if (pGCIndex)
		*pGCIndex = afbGCPrivateIndex;

	afbScreenPrivateIndex = AllocateScreenPrivateIndex();
	pScreen->GetWindowPixmap = afbGetWindowPixmap;
	pScreen->SetWindowPixmap = afbSetWindowPixmap;
	return(AllocateWindowPrivate(pScreen, afbWindowPrivateIndex, sizeof(afbPrivWin)) &&
	       AllocateGCPrivate(pScreen, afbGCPrivateIndex, sizeof(afbPrivGC)));
}
コード例 #6
0
ファイル: cw.c プロジェクト: GrahamCobb/maemo-xsisusb
/* Screen initialization/teardown */
void
miInitializeCompositeWrapper(ScreenPtr pScreen)
{
    cwScreenPtr pScreenPriv;

    if (cwDisabled[pScreen->myNum])
	return;

    if (cwGeneration != serverGeneration)
    {
	cwScreenIndex = AllocateScreenPrivateIndex();
	if (cwScreenIndex < 0)
	    return;
	cwGCIndex = AllocateGCPrivateIndex();
	cwWindowIndex = AllocateWindowPrivateIndex();
#ifdef RENDER
	cwPictureIndex = AllocatePicturePrivateIndex();
#endif
	cwGeneration = serverGeneration;
    }
    if (!AllocateGCPrivate(pScreen, cwGCIndex, sizeof(cwGCRec)))
	return;
    if (!AllocateWindowPrivate(pScreen, cwWindowIndex, 0))
	return;
#ifdef RENDER
    if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0))
	return;
#endif
    pScreenPriv = (cwScreenPtr)xalloc(sizeof(cwScreenRec));
    if (!pScreenPriv)
	return;

    pScreen->devPrivates[cwScreenIndex].ptr = (pointer)pScreenPriv;
    
    SCREEN_EPILOGUE(pScreen, CloseScreen, cwCloseScreen);
    SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage);
    SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans);
    SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC);
    SCREEN_EPILOGUE(pScreen, PaintWindowBackground, cwPaintWindowBackground);
    SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder);
    SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);

    SCREEN_EPILOGUE(pScreen, SetWindowPixmap, cwSetWindowPixmap);
    SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);

#ifdef RENDER
    if (GetPictureScreen (pScreen))
	cwInitializeRender(pScreen);
#endif
}
コード例 #7
0
ファイル: rdpPri.c プロジェクト: Hanchao-Wang/xrdp
rdpDevPrivateKey
rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes)
{
    rdpDevPrivateKey rv;

#if XRDP_PRI == 1
    rv = INT2PTR(AllocateWindowPrivateIndex());
    AllocateWindowPrivate(pScreen, PTR2INT(rv), bytes);
#elif XRDP_PRI == 2
    dixRequestPrivate(&g_privateKeyRecWindow, bytes);
    rv = &g_privateKeyRecWindow;
#else
    dixRegisterPrivateKey(&g_privateKeyRecWindow, PRIVATE_WINDOW, bytes);
    rv = &g_privateKeyRecWindow;
#endif
    return rv;
}
コード例 #8
0
ファイル: Init.c プロジェクト: GrahamCobb/maemo-xsisusb
void
InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
{
  int i, j;

  xnestOpenDisplay(argc, argv);
  
  screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
  screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
  screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay);
  screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
  
  screenInfo->numPixmapFormats = 0;
  for (i = 0; i < xnestNumPixmapFormats; i++) 
    for (j = 0; j < xnestNumDepths; j++)
      if ((xnestPixmapFormats[i].depth == 1) ||
          (xnestPixmapFormats[i].depth == xnestDepths[j])) {
	screenInfo->formats[screenInfo->numPixmapFormats].depth = 
	  xnestPixmapFormats[i].depth;
	screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel = 
	  xnestPixmapFormats[i].bits_per_pixel;
	screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad = 
	  xnestPixmapFormats[i].scanline_pad;
	screenInfo->numPixmapFormats++;
	break;
      }
  
  xnestWindowPrivateIndex = AllocateWindowPrivateIndex();
  xnestGCPrivateIndex = AllocateGCPrivateIndex();
  xnestFontPrivateIndex = AllocateFontPrivateIndex();
  
  if (!xnestNumScreens) xnestNumScreens = 1;

  for (i = 0; i < xnestNumScreens; i++)
    AddScreen(xnestOpenScreen, argc, argv);

  xnestNumScreens = screenInfo->numScreens;

  xnestDoFullGeneration = xnestFullGeneration;
}
コード例 #9
0
ファイル: mbuf.c プロジェクト: GrahamCobb/maemo-xsisusb
void
MultibufferExtensionInit()
{
    ExtensionEntry	    *extEntry;
    int			    i, j;
    ScreenPtr		    pScreen;
    MultibufferScreenPtr    pMultibufferScreen;

    /*
     * allocate private pointers in windows and screens.  Allocating
     * window privates may seem like an unnecessary expense, but every
     * PositionWindow call must check to see if the window is
     * multi-buffered; a resource lookup is too expensive.
     */
    MultibufferScreenIndex = AllocateScreenPrivateIndex ();
    if (MultibufferScreenIndex < 0)
	return;
    MultibufferWindowIndex = AllocateWindowPrivateIndex ();
    for (i = 0; i < screenInfo.numScreens; i++)
    {
	pScreen = screenInfo.screens[i];
	if (!AllocateWindowPrivate (pScreen, MultibufferWindowIndex, 0) ||
	    !(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec))))
	{
	    for (j = 0; j < i; j++)
		xfree (screenInfo.screens[j]->devPrivates[MultibufferScreenIndex].ptr);
	    return;
	}
	pScreen->devPrivates[MultibufferScreenIndex].ptr = (pointer) pMultibufferScreen;
	/*
 	 * wrap PositionWindow to resize the pixmap when the window
	 * changes size
 	 */
	pMultibufferScreen->PositionWindow = pScreen->PositionWindow;
	pScreen->PositionWindow = MultibufferPositionWindow;
    }
    /*
     * create the resource types
     */
    MultibufferDrawableResType =
	CreateNewResourceType(MultibufferDrawableDelete)|RC_CACHED|RC_DRAWABLE;
    MultibufferResType = CreateNewResourceType(MultibufferDelete);
    MultibuffersResType = CreateNewResourceType(MultibuffersDelete);
    OtherClientResType = CreateNewResourceType(OtherClientDelete);
    if (MultibufferDrawableResType && MultibufferResType &&
	MultibuffersResType && 	OtherClientResType &&
	(extEntry = AddExtension(MULTIBUFFER_PROTOCOL_NAME,
				 MultibufferNumberEvents, 
				 MultibufferNumberErrors,
				 ProcMultibufferDispatch, SProcMultibufferDispatch,
				 MultibufferResetProc, StandardMinorOpcode)))
    {
#if 0
	MultibufferReqCode = (unsigned char)extEntry->base;
#endif
	MultibufferEventBase = extEntry->eventBase;
	MultibufferErrorBase = extEntry->errorBase;
	EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
	EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent;
    }
}