Example #1
0
void
XFixesExtensionInit(void)
{
    ExtensionEntry *extEntry;

    if (!dixRequestPrivate(XFixesClientPrivateKey, sizeof (XFixesClientRec)))
	return;
    if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0))
	return;

    if (XFixesSelectionInit() && XFixesCursorInit () && XFixesRegionInit () &&
	(extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents, 
				 XFixesNumberErrors,
				 ProcXFixesDispatch, SProcXFixesDispatch,
				 XFixesResetProc, StandardMinorOpcode)) != 0)
    {
	XFixesReqCode = (unsigned char)extEntry->base;
	XFixesEventBase = extEntry->eventBase;
	XFixesErrorBase = extEntry->errorBase;
	EventSwapVector[XFixesEventBase + XFixesSelectionNotify] =
	    (EventSwapPtr) SXFixesSelectionNotifyEvent;
	EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
	    (EventSwapPtr) SXFixesCursorNotifyEvent;
    }
}
Example #2
0
File: randr.c Project: hush-z/VMGL
void
RRExtensionInit (void)
{
    ExtensionEntry *extEntry;

    if (RRNScreens == 0) return;

    if (!dixRequestPrivate(RRClientPrivateKey,
                           sizeof (RRClientRec) +
                           screenInfo.numScreens * sizeof (RRTimesRec)))
        return;
    if (!AddCallback (&ClientStateCallback, RRClientCallback, 0))
        return;

    RRClientType = CreateNewResourceType(RRFreeClient);
    if (!RRClientType)
        return;
    RREventType = CreateNewResourceType(RRFreeEvents);
    if (!RREventType)
        return;
    extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors,
                             ProcRRDispatch, SProcRRDispatch,
                             NULL, StandardMinorOpcode);
    if (!extEntry)
        return;
    RRErrorBase = extEntry->errorBase;
    RREventBase = extEntry->eventBase;
    EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr)
            SRRScreenChangeNotifyEvent;
    EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
            SRRNotifyEvent;
#ifdef PANORAMIX
    RRXineramaExtensionInit();
#endif
}
Example #3
0
File: cw.c Project: L3oV1nc3/VMGL
/* 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
}
Example #4
0
Bool gma_uxa_init(gma500Ptr gma, ScreenPtr screen)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn (screen);
	gma->uxa = uxa_driver_alloc();
	if (gma->uxa == NULL)
		return FALSE;

#if HAS_DIXREGISTERPRIVATEKEY
	if (!dixRegisterPrivateKey (&uxa_pixmap_index, PRIVATE_PIXMAP, 0))
		return FALSE;
#else
	if (!dixRequestPrivate (&uxa_pixmap_index, 0))
		return FALSE;
#endif

	gma->uxa->uxa_major = 1;
	gma->uxa->uxa_minor = 0;

	/* Access */
	gma->uxa->prepare_access = gma_uxa_prepare_access;
	gma->uxa->finish_access = gma_uxa_finish_access;
	gma->uxa->pixmap_is_offscreen = gma_uxa_pixmap_is_offscreen;

	/* Migration */
	gma->uxa->put_image = gma_uxa_put_image;

	/* Solid */
	gma->uxa->check_solid = gma_uxa_check_solid;
	gma->uxa->prepare_solid = gma_uxa_prepare_solid;
	gma->uxa->solid = gma_uxa_solid;
	gma->uxa->done_solid = gma_uxa_done_solid;

	/* Copy */
	gma->uxa->check_copy = gma_uxa_check_copy;
	gma->uxa->prepare_copy = gma_uxa_prepare_copy;
	gma->uxa->copy = gma_uxa_copy;
	gma->uxa->done_copy = gma_uxa_done_copy;

	/* Composite */
	gma->uxa->check_composite = gma_uxa_check_composite;

	screen->SetScreenPixmap = gma_uxa_set_screen_pixmap;
	screen->CreatePixmap = gma_uxa_create_pixmap;
	screen->DestroyPixmap = gma_uxa_destroy_pixmap;

	gma->cs_bo = gma_bo_create(gma->fd, 4096, GMA_BO_BLIT, 0);
	gma_bo_mmap(gma->fd, gma->cs_bo);

	if (!uxa_driver_init(screen, gma->uxa)) {
		xf86DrvMsg (scrn->scrnIndex, X_ERROR,
			    "UXA initialization failed\n");
		return FALSE;
	}

	return TRUE;
}
Example #5
0
void
SecurityExtensionInit(INITARGS)
{
    ExtensionEntry	*extEntry;
    int ret = TRUE;

    SecurityAuthorizationResType =
	CreateNewResourceType(SecurityDeleteAuthorization);

    RTEventClient = CreateNewResourceType(
				SecurityDeleteAuthorizationEventClient);

    if (!SecurityAuthorizationResType || !RTEventClient)
	return;

    RTEventClient |= RC_NEVERRETAIN;
    RegisterResourceName(SecurityAuthorizationResType, "SecurityAuthorization");
    RegisterResourceName(RTEventClient, "SecurityEventClient");

    /* Allocate the private storage */
    if (!dixRequestPrivate(stateKey, sizeof(SecurityStateRec)))
	FatalError("SecurityExtensionSetup: Can't allocate client private.\n");

    /* Register callbacks */
    ret &= AddCallback(&ClientStateCallback, SecurityClientState, NULL);

    ret &= XaceRegisterCallback(XACE_EXT_DISPATCH, SecurityExtension, NULL);
    ret &= XaceRegisterCallback(XACE_RESOURCE_ACCESS, SecurityResource, NULL);
    ret &= XaceRegisterCallback(XACE_DEVICE_ACCESS, SecurityDevice, NULL);
    ret &= XaceRegisterCallback(XACE_PROPERTY_ACCESS, SecurityProperty, NULL);
    ret &= XaceRegisterCallback(XACE_SEND_ACCESS, SecuritySend, NULL);
    ret &= XaceRegisterCallback(XACE_RECEIVE_ACCESS, SecurityReceive, NULL);
    ret &= XaceRegisterCallback(XACE_CLIENT_ACCESS, SecurityClient, NULL);
    ret &= XaceRegisterCallback(XACE_EXT_ACCESS, SecurityExtension, NULL);
    ret &= XaceRegisterCallback(XACE_SERVER_ACCESS, SecurityServer, NULL);

    if (!ret)
	FatalError("SecurityExtensionSetup: Failed to register callbacks\n");

    /* Add extension to server */
    extEntry = AddExtension(SECURITY_EXTENSION_NAME,
			    XSecurityNumberEvents, XSecurityNumberErrors,
			    ProcSecurityDispatch, SProcSecurityDispatch,
                            SecurityResetProc, StandardMinorOpcode);

    SecurityErrorBase = extEntry->errorBase;
    SecurityEventBase = extEntry->eventBase;

    EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
	(EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;

    /* Label objects that were created before we could register ourself */
    SecurityLabelInitial();
}
_X_EXPORT int
dixRegisterPrivateDeleteFunc(const DevPrivateKey key,
			     CallbackProcPtr callback, pointer data)
{
    PrivateDescRec *item = findItem(key);
    if (!item) {
	if (!dixRequestPrivate(key, 0))
	    return FALSE;
	item = findItem(key);
    }
    return AddCallback(&item->deletefuncs, callback, data);
}
Example #7
0
Bool
ShadowFBInit2 (
    ScreenPtr		pScreen,
    RefreshAreaFuncPtr  preRefreshArea,
    RefreshAreaFuncPtr  postRefreshArea
){
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    ShadowScreenPtr pPriv;
#ifdef RENDER
    PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif /* RENDER */

    if(!preRefreshArea && !postRefreshArea) return FALSE;
    
    if(!dixRequestPrivate(ShadowGCKey, sizeof(ShadowGCRec)))
	return FALSE;

    if(!(pPriv = (ShadowScreenPtr)xalloc(sizeof(ShadowScreenRec))))
	return FALSE;

    dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv);

    pPriv->pScrn = pScrn;
    pPriv->preRefresh = preRefreshArea;
    pPriv->postRefresh = postRefreshArea;
    pPriv->vtSema = TRUE;

    pPriv->CloseScreen = pScreen->CloseScreen;
    pPriv->CopyWindow = pScreen->CopyWindow;
    pPriv->CreateGC = pScreen->CreateGC;
    pPriv->ModifyPixmapHeader = pScreen->ModifyPixmapHeader;

    pPriv->EnterVT = pScrn->EnterVT;
    pPriv->LeaveVT = pScrn->LeaveVT;

    pScreen->CloseScreen = ShadowCloseScreen;
    pScreen->CopyWindow = ShadowCopyWindow;
    pScreen->CreateGC = ShadowCreateGC;
    pScreen->ModifyPixmapHeader = ShadowModifyPixmapHeader;

    pScrn->EnterVT = ShadowEnterVT;
    pScrn->LeaveVT = ShadowLeaveVT;

#ifdef RENDER
    if(ps) {
      pPriv->Composite = ps->Composite;
      ps->Composite = ShadowComposite;
    }
#endif /* RENDER */

    return TRUE;
}
Bool
mfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
{
    if (mfbGeneration != serverGeneration)
    {
	visual.vid = FakeClientID(0);
	VID = visual.vid;
	mfbGeneration = serverGeneration;
    }
    if (pGCKey)
	*pGCKey = mfbGCPrivateKey;
    pScreen->GetWindowPixmap = mfbGetWindowPixmap;
    pScreen->SetWindowPixmap = mfbSetWindowPixmap;
    return dixRequestPrivate(mfbGCPrivateKey, sizeof(mfbPrivGC));
}
Example #9
0
rdpDevPrivateKey
rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes)
{
    rdpDevPrivateKey rv;

#if XRDP_PRI == 1
    rv = INT2PTR(AllocatePixmapPrivateIndex());
    AllocatePixmapPrivate(pScreen, PTR2INT(rv), bytes);
#elif XRDP_PRI == 2
    dixRequestPrivate(&g_privateKeyRecPixmap, bytes);
    rv = &g_privateKeyRecPixmap;
#else
    dixRegisterPrivateKey(&g_privateKeyRecPixmap, PRIVATE_PIXMAP, bytes);
    rv = &g_privateKeyRecPixmap;
#endif
    return rv;
}
Example #10
0
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;
}
Example #11
0
Bool uxa_glyphs_init(ScreenPtr pScreen)
{

#if HAS_DIXREGISTERPRIVATEKEY
	if (!dixRegisterPrivateKey(&uxa_glyph_key, PRIVATE_GLYPH, 0))
		return FALSE;
#else
	if (!dixRequestPrivate(&uxa_glyph_key, 0))
		return FALSE;
#endif

	/* Skip pixmap creation if we don't intend to use it. */
	if (uxa_get_screen(pScreen)->force_fallback)
		return TRUE;

	return uxa_realize_glyph_caches(pScreen);
}
Bool
fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
{
    if (pGCKey)
	*pGCKey = fbGCPrivateKey;
    
    if (!dixRequestPrivate(fbGCPrivateKey, sizeof(FbGCPrivRec)))
	return FALSE;
#ifdef FB_SCREEN_PRIVATE
    {
	FbScreenPrivPtr	pScreenPriv;

	pScreenPriv = (FbScreenPrivPtr) xalloc (sizeof (FbScreenPrivRec));
	if (!pScreenPriv)
	    return FALSE;
	dixSetPrivate(&pScreen->devPrivates, fbScreenPrivateKey, pScreenPriv);
    }
#endif
    return TRUE;
}
Example #13
0
Bool
radeon_glamor_init(ScreenPtr screen)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);

	if (!glamor_init(screen, GLAMOR_INVERTED_Y_AXIS | GLAMOR_USE_EGL_SCREEN |
#ifdef GLAMOR_NO_DRI3
			 GLAMOR_NO_DRI3 |
#endif
			 GLAMOR_USE_SCREEN | GLAMOR_USE_PICTURE_SCREEN)) {
		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
			   "Failed to initialize glamor.\n");
		return FALSE;
	}

	if (!glamor_egl_init_textured_pixmap(screen)) {
		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
			   "Failed to initialize textured pixmap of screen for glamor.\n");
		return FALSE;
	}

#if HAS_DIXREGISTERPRIVATEKEY
	if (!dixRegisterPrivateKey(&glamor_pixmap_index, PRIVATE_PIXMAP, 0))
#else
	if (!dixRequestPrivate(&glamor_pixmap_index, 0))
#endif
		return FALSE;

	screen->CreatePixmap = radeon_glamor_create_pixmap;
	screen->DestroyPixmap = radeon_glamor_destroy_pixmap;
#ifdef RADEON_PIXMAP_SHARING
	screen->SharePixmapBacking = radeon_glamor_share_pixmap_backing;
	screen->SetSharedPixmapBacking = radeon_glamor_set_shared_pixmap_backing;
#endif

	xf86DrvMsg(scrn->scrnIndex, X_INFO,
		   "Use GLAMOR acceleration.\n");
	return TRUE;
}
/** Initialize the RENDER extension, allocate the picture privates and
 *  wrap mi function hooks.  If the shadow frame buffer is used, then
 *  call the appropriate fb initialization function. */
Bool dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{
    DMXScreenInfo    *dmxScreen = &dmxScreens[pScreen->myNum];
    PictureScreenPtr  ps;

    /* The shadow framebuffer only relies on FB to be initialized */
    if (dmxShadowFB) return fbPictureInit(pScreen, formats, nformats);

    if (!miPictureInit(pScreen, formats, nformats))
        return FALSE;

    if (!dixRequestPrivate(dmxPictPrivateKey, sizeof(dmxPictPrivRec)))
        return FALSE;

    ps = GetPictureScreen(pScreen);

    DMX_WRAP(CreatePicture,      dmxCreatePicture,      dmxScreen, ps);
    DMX_WRAP(DestroyPicture,     dmxDestroyPicture,     dmxScreen, ps);

    DMX_WRAP(ChangePictureClip,  dmxChangePictureClip,  dmxScreen, ps);
    DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);

    DMX_WRAP(ChangePicture,      dmxChangePicture,      dmxScreen, ps);
    DMX_WRAP(ValidatePicture,    dmxValidatePicture,    dmxScreen, ps);

    DMX_WRAP(Composite,          dmxComposite,          dmxScreen, ps);
    DMX_WRAP(Glyphs,             dmxGlyphs,             dmxScreen, ps);
    DMX_WRAP(CompositeRects,     dmxCompositeRects,     dmxScreen, ps);

    DMX_WRAP(Trapezoids,         dmxTrapezoids,         dmxScreen, ps);
    DMX_WRAP(Triangles,          dmxTriangles,          dmxScreen, ps);
    DMX_WRAP(TriStrip,           dmxTriStrip,           dmxScreen, ps);
    DMX_WRAP(TriFan,             dmxTriFan,             dmxScreen, ps);

    return TRUE;
}
/**
 * @param pScreen screen being initialized
 * @param pScreenInfo SAA driver record
 *
 * saa_driver_init sets up SAA given a driver record filled in by the driver.
 * pScreenInfo should have been allocated by saa_driver_alloc().  See the
 * comments in _SaaDriver for what must be filled in and what is optional.
 *
 * @return TRUE if SAA was successfully initialized.
 */
Bool
saa_driver_init(ScreenPtr screen, struct saa_driver * saa_driver)
{
    struct saa_screen_priv *sscreen;

    if (!saa_driver)
	return FALSE;

    if (saa_driver->saa_major != SAA_VERSION_MAJOR ||
	saa_driver->saa_minor > SAA_VERSION_MINOR) {
	LogMessage(X_ERROR,
		   "SAA(%d): driver's SAA version requirements "
		   "(%d.%d) are incompatible with SAA version (%d.%d)\n",
		   screen->myNum, saa_driver->saa_major,
		   saa_driver->saa_minor, SAA_VERSION_MAJOR, SAA_VERSION_MINOR);
	return FALSE;
    }
#if 0
    if (!saa_driver->prepare_solid) {
	LogMessage(X_ERROR,
		   "SAA(%d): saa_driver_t::prepare_solid must be "
		   "non-NULL\n", screen->myNum);
	return FALSE;
    }

    if (!saa_driver->prepare_copy) {
	LogMessage(X_ERROR,
		   "SAA(%d): saa_driver_t::prepare_copy must be "
		   "non-NULL\n", screen->myNum);
	return FALSE;
    }
#endif
#ifdef SAA_DEVPRIVATEKEYREC
    if (!dixRegisterPrivateKey(&saa_screen_index, PRIVATE_SCREEN, 0)) {
	LogMessage(X_ERROR, "Failed to register SAA screen private.\n");
	return FALSE;
    }
    if (!dixRegisterPrivateKey(&saa_pixmap_index, PRIVATE_PIXMAP,
			       saa_driver->pixmap_size)) {
	LogMessage(X_ERROR, "Failed to register SAA pixmap private.\n");
	return FALSE;
    }
    if (!dixRegisterPrivateKey(&saa_gc_index, PRIVATE_GC,
			       sizeof(struct saa_gc_priv))) {
	LogMessage(X_ERROR, "Failed to register SAA gc private.\n");
	return FALSE;
    }
#else
    if (!dixRequestPrivate(&saa_screen_index, 0)) {
	LogMessage(X_ERROR, "Failed to register SAA screen private.\n");
	return FALSE;
    }
    if (!dixRequestPrivate(&saa_pixmap_index, saa_driver->pixmap_size)) {
	LogMessage(X_ERROR, "Failed to register SAA pixmap private.\n");
	return FALSE;
    }
    if (!dixRequestPrivate(&saa_gc_index, sizeof(struct saa_gc_priv))) {
	LogMessage(X_ERROR, "Failed to register SAA gc private.\n");
	return FALSE;
    }
#endif

    sscreen = calloc(1, sizeof(*sscreen));

    if (!sscreen) {
	LogMessage(X_WARNING,
		   "SAA(%d): Failed to allocate screen private\n",
		   screen->myNum);
	return FALSE;
    }

    sscreen->driver = saa_driver;
    dixSetPrivate(&screen->devPrivates, &saa_screen_index, sscreen);

    /*
     * Replace various fb screen functions
     */

    saa_wrap(sscreen, screen, CloseScreen, saa_close_screen);
    saa_wrap(sscreen, screen, CreateGC, saa_create_gc);
    saa_wrap(sscreen, screen, ChangeWindowAttributes,
	     saa_change_window_attributes);
    saa_wrap(sscreen, screen, CreatePixmap, saa_create_pixmap);
    saa_wrap(sscreen, screen, DestroyPixmap, saa_destroy_pixmap);
    saa_wrap(sscreen, screen, ModifyPixmapHeader, saa_modify_pixmap_header);

    saa_wrap(sscreen, screen, BitmapToRegion, saa_bitmap_to_region);
    saa_unaccel_setup(screen);
#ifdef RENDER
    saa_render_setup(screen);
#endif

    return TRUE;
}
Bool
radeon_glamor_init(ScreenPtr screen)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
	RADEONInfoPtr info = RADEONPTR(scrn);
#ifdef RENDER
#ifdef HAVE_FBGLYPHS
	UnrealizeGlyphProcPtr SavedUnrealizeGlyph = NULL;
#endif
	PictureScreenPtr ps = NULL;

	if (info->shadow_primary) {
		ps = GetPictureScreenIfSet(screen);

		if (ps) {
#ifdef HAVE_FBGLYPHS
			SavedUnrealizeGlyph = ps->UnrealizeGlyph;
#endif
			info->glamor.SavedGlyphs = ps->Glyphs;
			info->glamor.SavedTriangles = ps->Triangles;
			info->glamor.SavedTrapezoids = ps->Trapezoids;
		}
	}
#endif /* RENDER */

	if (!glamor_init(screen, GLAMOR_USE_EGL_SCREEN | GLAMOR_USE_SCREEN |
			 GLAMOR_USE_PICTURE_SCREEN | GLAMOR_INVERTED_Y_AXIS |
			 GLAMOR_NO_DRI3)) {
		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
			   "Failed to initialize glamor.\n");
		return FALSE;
	}

	if (!glamor_egl_init_textured_pixmap(screen)) {
		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
			   "Failed to initialize textured pixmap of screen for glamor.\n");
		return FALSE;
	}

#if HAS_DIXREGISTERPRIVATEKEY
	if (!dixRegisterPrivateKey(&glamor_pixmap_index, PRIVATE_PIXMAP, 0))
#else
	if (!dixRequestPrivate(&glamor_pixmap_index, 0))
#endif
		return FALSE;

	if (info->shadow_primary)
		radeon_glamor_screen_init(screen);

#if defined(RENDER) && defined(HAVE_FBGLYPHS)
	/* For ShadowPrimary, we need fbUnrealizeGlyph instead of
	 * glamor_unrealize_glyph
	 */
	if (ps)
		ps->UnrealizeGlyph = SavedUnrealizeGlyph;
#endif

	screen->CreatePixmap = radeon_glamor_create_pixmap;
	screen->DestroyPixmap = radeon_glamor_destroy_pixmap;
#ifdef RADEON_PIXMAP_SHARING
	screen->SharePixmapBacking = radeon_glamor_share_pixmap_backing;
	screen->SetSharedPixmapBacking = radeon_glamor_set_shared_pixmap_backing;
#endif

	xf86DrvMsg(scrn->scrnIndex, X_INFO,
		   "Use GLAMOR acceleration.\n");
	return TRUE;
}
Example #17
0
Bool
xf86VGAarbiterWrapFunctions(void)
{
    ScrnInfoPtr pScrn;
    VGAarbiterScreenPtr pScreenPriv;
    miPointerScreenPtr PointPriv;
#ifdef RENDER
    PictureScreenPtr    ps;
#endif
    ScreenPtr pScreen;
    int vga_count, i;

    if (vga_no_arb)
        return FALSE;

    /*
     * we need to wrap the arbiter if we have more than
     * one VGA card - hotplug cries.
     */
    pci_device_vgaarb_get_info(NULL, &vga_count, NULL);
    if (vga_count < 2 || !xf86Screens)
        return FALSE;

    xf86Msg(X_INFO,"Found %d VGA devices: arbiter wrapping enabled\n",
            vga_count);

    for (i = 0; i < xf86NumScreens; i++) {
        pScreen = xf86Screens[i]->pScreen;
#ifdef RENDER
        ps = GetPictureScreenIfSet(pScreen);
#endif
        pScrn = xf86Screens[pScreen->myNum];
        PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);

        if (!dixRequestPrivate(VGAarbiterGCKey, sizeof(VGAarbiterGCRec)))
            return FALSE;

        if (!(pScreenPriv = xalloc(sizeof(VGAarbiterScreenRec))))
            return FALSE;

        dixSetPrivate(&pScreen->devPrivates, VGAarbiterScreenKey, pScreenPriv);

        WRAP_SCREEN(CloseScreen, VGAarbiterCloseScreen);
        WRAP_SCREEN(SaveScreen, VGAarbiterSaveScreen);
        WRAP_SCREEN(WakeupHandler, VGAarbiterWakeupHandler);
        WRAP_SCREEN(BlockHandler, VGAarbiterBlockHandler);
        WRAP_SCREEN(CreateGC, VGAarbiterCreateGC);
        WRAP_SCREEN(GetImage, VGAarbiterGetImage);
        WRAP_SCREEN(GetSpans, VGAarbiterGetSpans);
        WRAP_SCREEN(SourceValidate, VGAarbiterSourceValidate);
        WRAP_SCREEN(CopyWindow, VGAarbiterCopyWindow);
        WRAP_SCREEN(ClearToBackground, VGAarbiterClearToBackground);
        WRAP_SCREEN(CreatePixmap, VGAarbiterCreatePixmap);
        WRAP_SCREEN(StoreColors, VGAarbiterStoreColors);
        WRAP_SCREEN(DisplayCursor, VGAarbiterDisplayCursor);
        WRAP_SCREEN(RealizeCursor, VGAarbiterRealizeCursor);
        WRAP_SCREEN(UnrealizeCursor, VGAarbiterUnrealizeCursor);
        WRAP_SCREEN(RecolorCursor, VGAarbiterRecolorCursor);
        WRAP_SCREEN(SetCursorPosition, VGAarbiterSetCursorPosition);
#ifdef RENDER
        WRAP_PICT(Composite,VGAarbiterComposite);
        WRAP_PICT(Glyphs,VGAarbiterGlyphs);
        WRAP_PICT(CompositeRects,VGAarbiterCompositeRects);
#endif
        WRAP_SCREEN_INFO(AdjustFrame, VGAarbiterAdjustFrame);
        WRAP_SCREEN_INFO(SwitchMode, VGAarbiterSwitchMode);
        WRAP_SCREEN_INFO(EnterVT, VGAarbiterEnterVT);
        WRAP_SCREEN_INFO(LeaveVT, VGAarbiterLeaveVT);
        WRAP_SCREEN_INFO(FreeScreen, VGAarbiterFreeScreen);
        WRAP_SPRITE;
    }

    return TRUE;
}