xorg-x11-drv-vmware/0001-Add-support-for-XSERVER_PLATFORM_BUS.patch
2014-05-13 09:10:26 +02:00

138 lines
3.6 KiB
Diff

From 957a38a715e3013d9ba7a41f1fb1255c4cbff5f9 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 6 May 2014 16:00:50 +0200
Subject: [PATCH xf86-video-vmware 1/2] 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>
---
src/vmware.c | 3 ---
src/vmware_bootstrap.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++---
vmwgfx/vmwgfx_driver.c | 4 ++--
3 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/src/vmware.c b/src/vmware.c
index 6b74e14..17434ab 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -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;
diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c
index ed6c740..b30cf2b 100644
--- a/src/vmware_bootstrap.c
+++ b/src/vmware_bootstrap.c
@@ -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
};
diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
index 2d38d2a..7e5dc4e 100644
--- a/vmwgfx/vmwgfx_driver.c
+++ b/vmwgfx/vmwgfx_driver.c
@@ -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();
--
1.9.0