Пример #1
0
static Bool
intel_platform_probe(DriverPtr driver,
		     int entity_num, int flags,
		     struct xf86_platform_device *dev,
		     intptr_t match_data)
{
	ScrnInfoPtr scrn = NULL;
	char *path = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_PATH);
	unsigned scrn_flags = 0;

	if (!dev->pdev)
		return FALSE;

	if (!has_kernel_mode_setting(dev->pdev))
		return FALSE;

	/* Allow ourselves to act as a slaved output if not primary */
	if (flags & PLATFORM_PROBE_GPU_SCREEN) {
		flags &= ~PLATFORM_PROBE_GPU_SCREEN;
		scrn_flags |= XF86_ALLOCATE_GPU_SCREEN;
	}

	/* if we get any flags we don't understand fail to probe for now */
	if (flags)
		return FALSE;

	scrn = xf86AllocateScreen(driver, scrn_flags);
	if (scrn == NULL)
		return FALSE;

	scrn->driverVersion = INTEL_VERSION;
	scrn->driverName = INTEL_DRIVER_NAME;
	scrn->name = INTEL_NAME;
	scrn->driverPrivate = (void *)(match_data | 1);
	scrn->Probe = NULL;

	if (xf86IsEntitySharable(entity_num))
		xf86SetEntityShared(entity_num);
	xf86AddEntityToScreen(scrn, entity_num);

	xf86DrvMsg(scrn->scrnIndex, X_INFO,
		   "using device path '%s'\n", path ? path : "Default device");

#if !UMS_ONLY
	switch (get_accel_method()) {
#if USE_SNA
        case SNA: return sna_init_scrn(scrn, entity_num);
#endif
#if USE_UXA
        case UXA: return intel_init_scrn(scrn);
#endif

	default: break;
	}
#endif

	return FALSE;
}
static Bool
intel_scrn_create(DriverPtr		driver,
		  int			entity_num,
		  intptr_t		match_data,
		  unsigned		flags)
{
	ScrnInfoPtr scrn;

	scrn = xf86AllocateScreen(driver, flags);
	if (scrn == NULL)
		return FALSE;

	scrn->driverVersion = INTEL_VERSION;
	scrn->driverName = INTEL_DRIVER_NAME;
	scrn->name = INTEL_NAME;
	scrn->driverPrivate = (void *)(match_data | 1);
	scrn->Probe = NULL;

	if (xf86IsEntitySharable(entity_num))
		xf86SetEntityShared(entity_num);
	xf86AddEntityToScreen(scrn, entity_num);

#if !KMS_ONLY
	if ((unsigned)((struct intel_device_info *)match_data)->gen < 020)
		return lg_i810_init(scrn);
#endif

#if !UMS_ONLY
	switch (get_accel_method()) {
#if USE_SNA
	case SNA: return sna_init_scrn(scrn, entity_num);
#endif
#if USE_UXA
	case UXA: return intel_init_scrn(scrn);
#endif

	default: break;
	}
#endif

	return FALSE;
}
Пример #3
0
static Bool
VMwarePlatformProbe(DriverPtr drv, int entity, int flags,
                    struct xf86_platform_device *dev, intptr_t match_data)
{
    ScrnInfoPtr pScrn;
    int scrnFlag = 0;

    if (!dev->pdev)
        return FALSE;

    if (flags & PLATFORM_PROBE_GPU_SCREEN)
        scrnFlag = XF86_ALLOCATE_GPU_SCREEN;

    pScrn = xf86AllocateScreen(drv, scrnFlag);
    if (!pScrn)
        return FALSE;

    if (xf86IsEntitySharable(entity))
        xf86SetEntityShared(entity);

    xf86AddEntityToScreen(pScrn, entity);

    pScrn->driverVersion = VMWARE_DRIVER_VERSION;
    pScrn->driverName = VMWARE_DRIVER_NAME;
    pScrn->name = VMWARE_NAME;
    pScrn->Probe = NULL;
#ifdef BUILD_VMWGFX
    vmwgfx_hookup(pScrn);
#else
    vmwlegacy_hookup(pScrn);
#endif
    pScrn->driverPrivate = pScrn->PreInit;
    pScrn->PreInit = VMwarePreinitStub;

    return TRUE;
}
static Bool
radeon_platform_probe(DriverPtr pDriver,
		      int entity_num, int flags,
		      struct xf86_platform_device *dev,
		      intptr_t match_data)
{
    ScrnInfoPtr pScrn;
    int scr_flags = 0;
    EntityInfoPtr pEnt;

    if (!dev->pdev)
	return FALSE;

    if (flags & PLATFORM_PROBE_GPU_SCREEN)
	scr_flags = XF86_ALLOCATE_GPU_SCREEN;

    pScrn = xf86AllocateScreen(pDriver, scr_flags);
    if (xf86IsEntitySharable(entity_num))
	xf86SetEntityShared(entity_num);
    xf86AddEntityToScreen(pScrn, entity_num);

    if (!radeon_kernel_mode_enabled(pScrn, dev->pdev))
	return FALSE;

    pScrn->driverVersion = RADEON_VERSION_CURRENT;
    pScrn->driverName    = RADEON_DRIVER_NAME;
    pScrn->name          = RADEON_NAME;
    pScrn->Probe         = NULL;
    pScrn->PreInit       = RADEONPreInit_KMS;
    pScrn->ScreenInit    = RADEONScreenInit_KMS;
    pScrn->SwitchMode    = RADEONSwitchMode_KMS;
    pScrn->AdjustFrame   = RADEONAdjustFrame_KMS;
    pScrn->EnterVT       = RADEONEnterVT_KMS;
    pScrn->LeaveVT       = RADEONLeaveVT_KMS;
    pScrn->FreeScreen    = RADEONFreeScreen_KMS;
    pScrn->ValidMode     = RADEONValidMode;

    pEnt = xf86GetEntityInfo(entity_num);

    /* Create a RADEONEntity for all chips, even with old single head
     * Radeon, need to use pRADEONEnt for new monitor detection routines.
     */
    {
        DevUnion    *pPriv;
        RADEONEntPtr pRADEONEnt;

        xf86SetEntitySharable(entity_num);

        if (gRADEONEntityIndex == -1)
            gRADEONEntityIndex = xf86AllocateEntityPrivateIndex();

        pPriv = xf86GetEntityPrivate(pEnt->index,
                                     gRADEONEntityIndex);

	xf86SetEntityInstanceForScreen(pScrn, pEnt->index, xf86GetNumEntityInstances(pEnt->index) - 1);

        if (!pPriv->ptr) {
            pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1);
            pRADEONEnt = pPriv->ptr;
        } else {
            pRADEONEnt = pPriv->ptr;
        }
        pRADEONEnt->platform_dev = dev;
    }

    free(pEnt);

    return TRUE;
}