Add support for XSERVER_PLATFORM_BUS

This is a preparation patch for adding support for server managed fds.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
This commit is contained in:
Hans de Goede
2014-05-06 16:00:50 +02:00
parent 88c487cb19
commit 675fe58eee
3 changed files with 53 additions and 8 deletions

View File

@@ -310,9 +310,6 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
pVMWARE->pvtSema = &pScrn->vtSema;
pVMWARE->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
if (pVMWARE->pEnt->location.type != BUS_PCI) {
return FALSE;
}
pVMWARE->PciInfo = xf86GetPciInfoForEntity(pVMWARE->pEnt->index);
if (pVMWARE->PciInfo == NULL) {
return FALSE;

View File

@@ -50,6 +50,10 @@
#include <xf86_libc.h>
#endif
#ifdef XSERVER_PLATFORM_BUS
#include "xf86platformBus.h"
#endif
#ifdef HaveDriverFuncs
#define VMWARE_DRIVER_FUNC HaveDriverFuncs
#else
@@ -247,9 +251,6 @@ VMwarePreinitStub(ScrnInfoPtr pScrn, int flags)
vmwlegacy_hookup(pScrn);
pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
if (pEnt->location.type != BUS_PCI)
return FALSE;
pciInfo = xf86GetPciInfoForEntity(pEnt->index);
if (pciInfo == NULL)
return FALSE;
@@ -407,6 +408,45 @@ VMWAREProbe(DriverPtr drv, int flags)
}
#endif
#ifdef XSERVER_PLATFORM_BUS
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;
}
#endif
static void
VMWAREIdentify(int flags)
{
@@ -481,6 +521,14 @@ _X_EXPORT DriverRec vmware = {
#if XSERVER_LIBPCIACCESS
VMwareDeviceMatch,
VMwarePciProbe,
#else
NULL,
NULL,
#endif
#ifdef XSERVER_PLATFORM_BUS
VMwarePlatformProbe,
#else
NULL,
#endif
};

View File

@@ -465,13 +465,13 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
pScrn->displayWidth = 640; /* default it */
if (ms->pEnt->location.type != BUS_PCI) {
ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
if (!ms->PciInfo) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Incorrect bus for device.\n");
goto out_err_bus;
}
ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
xf86SetPrimInitDone(pScrn->entityList[0]);
ms->hdriver = vmwgfx_hosted_detect();