mirror of
https://github.com/X11Libre/xf86-video-vmware.git
synced 2026-03-24 01:24:37 +00:00
drop hacks for ancient pre-libpciaccess Xservers
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
16
configure.ac
16
configure.ac
@@ -96,21 +96,7 @@ PKG_CHECK_EXISTS([xorg-server >= 1.12.0],
|
||||
|
||||
# Obtain compiler/linker options for the vmwarectrl client tool
|
||||
PKG_CHECK_MODULES(X11, x11 xext)
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$XORG_CFLAGS"
|
||||
AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
|
||||
[XSERVER_LIBPCIACCESS=yes], [XSERVER_LIBPCIACCESS=no],
|
||||
[#include "xorg-server.h"])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
if test x$XSERVER_LIBPCIACCESS = xyes; then
|
||||
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes)
|
||||
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
|
||||
|
||||
AC_SUBST([moduledir])
|
||||
|
||||
|
||||
32
src/vmware.c
32
src/vmware.c
@@ -296,11 +296,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
SVGA_LEGACY_BASE_PORT + SVGA_VALUE_PORT*sizeof(uint32);
|
||||
} else {
|
||||
/* Note: This setting of valueReg causes unaligned I/O */
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pVMWARE->portIOBase = pVMWARE->PciInfo->regions[0].base_addr;
|
||||
#else
|
||||
pVMWARE->portIOBase = pVMWARE->PciInfo->ioBase[0];
|
||||
#endif
|
||||
pVMWARE->indexReg = domainIOBase +
|
||||
pVMWARE->portIOBase + SVGA_INDEX_PORT;
|
||||
pVMWARE->valueReg = domainIOBase +
|
||||
@@ -338,10 +334,6 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
|
||||
}
|
||||
pVMWARE->suspensionSavedRegId = id;
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
pVMWARE->PciTag = pciTag(pVMWARE->PciInfo->bus, pVMWARE->PciInfo->device,
|
||||
pVMWARE->PciInfo->func);
|
||||
#endif
|
||||
pVMWARE->Primary = xf86IsPrimaryPci(pVMWARE->PciInfo);
|
||||
|
||||
pScrn->monitor = pScrn->confScreen->monitor;
|
||||
@@ -682,7 +674,6 @@ static Bool
|
||||
VMWAREMapMem(ScrnInfoPtr pScrn)
|
||||
{
|
||||
VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
int err;
|
||||
struct pci_device *const device = pVMWARE->PciInfo;
|
||||
void *fbBase;
|
||||
@@ -699,12 +690,6 @@ VMWAREMapMem(ScrnInfoPtr pScrn)
|
||||
return FALSE;
|
||||
}
|
||||
pVMWARE->FbBase = fbBase;
|
||||
#else
|
||||
pVMWARE->FbBase = xf86MapPciMem(pScrn->scrnIndex, 0,
|
||||
pVMWARE->PciTag,
|
||||
pVMWARE->memPhysBase,
|
||||
pVMWARE->videoRam);
|
||||
#endif
|
||||
if (!pVMWARE->FbBase)
|
||||
return FALSE;
|
||||
|
||||
@@ -723,11 +708,7 @@ VMWAREUnmapMem(ScrnInfoPtr pScrn)
|
||||
|
||||
VmwareLog(("Unmapped: %p/%u\n", pVMWARE->FbBase, pVMWARE->videoRam));
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_unmap_range(pVMWARE->PciInfo, pVMWARE->FbBase, pVMWARE->videoRam);
|
||||
#else
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->FbBase, pVMWARE->videoRam);
|
||||
#endif
|
||||
pVMWARE->FbBase = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -998,11 +979,9 @@ static void
|
||||
VMWAREInitFIFO(ScrnInfoPtr pScrn)
|
||||
{
|
||||
VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
struct pci_device *const device = pVMWARE->PciInfo;
|
||||
int err;
|
||||
void *mmioVirtBase;
|
||||
#endif
|
||||
volatile CARD32* vmwareFIFO;
|
||||
Bool extendedFifo;
|
||||
int min;
|
||||
@@ -1011,7 +990,6 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn)
|
||||
|
||||
pVMWARE->mmioPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_MEM_START);
|
||||
pVMWARE->mmioSize = vmwareReadReg(pVMWARE, SVGA_REG_MEM_SIZE) & ~3;
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
err = pci_device_map_range(device, pVMWARE->mmioPhysBase,
|
||||
pVMWARE->mmioSize,
|
||||
PCI_DEV_MAP_FLAG_WRITABLE,
|
||||
@@ -1023,12 +1001,6 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn)
|
||||
return;
|
||||
}
|
||||
pVMWARE->mmioVirtBase = mmioVirtBase;
|
||||
#else
|
||||
pVMWARE->mmioVirtBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
|
||||
pVMWARE->PciTag,
|
||||
pVMWARE->mmioPhysBase,
|
||||
pVMWARE->mmioSize);
|
||||
#endif
|
||||
vmwareFIFO = pVMWARE->vmwareFIFO = (CARD32*)pVMWARE->mmioVirtBase;
|
||||
|
||||
extendedFifo = pVMWARE->vmwareCapability & SVGA_CAP_EXTENDED_FIFO;
|
||||
@@ -1052,11 +1024,7 @@ VMWAREStopFIFO(ScrnInfoPtr pScrn)
|
||||
TRACEPOINT
|
||||
|
||||
vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 0);
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
pci_device_unmap_range(pVMWARE->PciInfo, pVMWARE->mmioVirtBase, pVMWARE->mmioSize);
|
||||
#else
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->mmioVirtBase, pVMWARE->mmioSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
static Bool
|
||||
|
||||
17
src/vmware.h
17
src/vmware.h
@@ -17,11 +17,7 @@
|
||||
|
||||
#include <X11/extensions/panoramiXproto.h>
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#include <pciaccess.h>
|
||||
#else
|
||||
#include "xf86Resources.h"
|
||||
#endif
|
||||
|
||||
#include "compiler.h" /* inb/outb */
|
||||
|
||||
@@ -72,12 +68,7 @@ typedef xXineramaScreenInfo VMWAREXineramaRec, *VMWAREXineramaPtr;
|
||||
|
||||
typedef struct {
|
||||
EntityInfoPtr pEnt;
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
struct pci_device *PciInfo;
|
||||
#else
|
||||
pciVideoPtr PciInfo;
|
||||
PCITAG PciTag;
|
||||
#endif
|
||||
Bool Primary;
|
||||
int depth;
|
||||
int bitsPerPixel;
|
||||
@@ -196,19 +187,11 @@ typedef struct {
|
||||
/* Undefine this to kill all acceleration */
|
||||
#define ACCELERATE_OPS
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#define VENDOR_ID(p) (p)->vendor_id
|
||||
#define DEVICE_ID(p) (p)->device_id
|
||||
#define SUBVENDOR_ID(p) (p)->subvendor_id
|
||||
#define SUBSYS_ID(p) (p)->subdevice_id
|
||||
#define CHIP_REVISION(p) (p)->revision
|
||||
#else
|
||||
#define VENDOR_ID(p) (p)->vendor
|
||||
#define DEVICE_ID(p) (p)->chipType
|
||||
#define SUBVENDOR_ID(p) (p)->subsysVendor
|
||||
#define SUBSYS_ID(p) (p)->subsysCard
|
||||
#define CHIP_REVISION(p) (p)->chipRev
|
||||
#endif
|
||||
|
||||
void vmwareWriteReg(
|
||||
VMWAREPtr pVMWARE, int index, CARD32 value
|
||||
|
||||
@@ -34,11 +34,6 @@
|
||||
#include "vmware_bootstrap.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
#include "vm_basic_types.h"
|
||||
#include "svga_reg.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_XORG_SERVER_1_5_0
|
||||
#include <xf86_ansic.h>
|
||||
#include <xf86_libc.h>
|
||||
@@ -72,12 +67,7 @@ static char vmware_driver_name[] = VMWARE_DRIVER_NAME;
|
||||
VMW_STRING(PACKAGE_VERSION_MAJOR) "." VMW_STRING(PACKAGE_VERSION_MINOR) \
|
||||
"." VMW_STRING(PACKAGE_VERSION_PATCHLEVEL)
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
static const char VMWAREBuildStr[] = "VMware Guest X Server "
|
||||
VMWARE_DRIVER_VERSION_STRING " - build=$Name$\n";
|
||||
#else
|
||||
static char vmware_name[] = VMWARE_NAME;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Standard four digit version string expected by VMware Tools installer.
|
||||
@@ -98,31 +88,13 @@ __attribute__((section(".modinfo"),unused)) =
|
||||
#endif /*VMW_SUBPATCH*/
|
||||
#endif
|
||||
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
static resRange vmwareLegacyRes[] = {
|
||||
{ ResExcIoBlock, SVGA_LEGACY_BASE_PORT,
|
||||
SVGA_LEGACY_BASE_PORT + SVGA_NUM_PORTS*sizeof(uint32)},
|
||||
_VGA_EXCLUSIVE, _END
|
||||
};
|
||||
#else
|
||||
#define vmwareLegacyRes NULL
|
||||
#endif
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#define VENDOR_ID(p) (p)->vendor_id
|
||||
#define DEVICE_ID(p) (p)->device_id
|
||||
#define SUBVENDOR_ID(p) (p)->subvendor_id
|
||||
#define SUBSYS_ID(p) (p)->subdevice_id
|
||||
#define CHIP_REVISION(p) (p)->revision
|
||||
#else
|
||||
#define VENDOR_ID(p) (p)->vendor
|
||||
#define DEVICE_ID(p) (p)->chipType
|
||||
#define SUBVENDOR_ID(p) (p)->subsysVendor
|
||||
#define SUBSYS_ID(p) (p)->subsysCard
|
||||
#define CHIP_REVISION(p) (p)->chipRev
|
||||
#endif
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
|
||||
#define VMWARE_DEVICE_MATCH(d, i) \
|
||||
{PCI_VENDOR_ID_VMWARE, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) }
|
||||
@@ -132,7 +104,6 @@ static const struct pci_id_match VMwareDeviceMatch[] = {
|
||||
VMWARE_DEVICE_MATCH (PCI_DEVICE_ID_VMWARE_SVGA, 0 ),
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Currently, even the PCI obedient 0405 chip still only obeys IOSE and
|
||||
@@ -199,11 +170,7 @@ vmwgfx_hosted_detect(void);
|
||||
static Bool
|
||||
VMwarePreinitStub(ScrnInfoPtr pScrn, int flags)
|
||||
{
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
struct pci_device *pciInfo;
|
||||
#else
|
||||
pciVideoPtr pciInfo;
|
||||
#endif /* XSERVER_LIBPCIACCESS */
|
||||
EntityInfoPtr pEnt;
|
||||
|
||||
pScrn->PreInit = pScrn->driverPrivate;
|
||||
@@ -250,7 +217,6 @@ VMwarePreinitStub(ScrnInfoPtr pScrn, int flags)
|
||||
return (*pScrn->PreInit)(pScrn, flags);
|
||||
};
|
||||
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
static Bool
|
||||
VMwarePciProbe (DriverPtr drv,
|
||||
int entity_num,
|
||||
@@ -287,115 +253,6 @@ VMwarePciProbe (DriverPtr drv,
|
||||
}
|
||||
return scrn != NULL;
|
||||
}
|
||||
#else
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* RewriteTagString --
|
||||
*
|
||||
* Rewrites the given string, removing the $Name$, and
|
||||
* replacing it with the contents. The output string must
|
||||
* have enough room, or else.
|
||||
*
|
||||
* Results:
|
||||
*
|
||||
* Output string updated.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void
|
||||
RewriteTagString(const char *istr, char *ostr, int osize)
|
||||
{
|
||||
int chr;
|
||||
Bool inTag = FALSE;
|
||||
char *op = ostr;
|
||||
|
||||
do {
|
||||
chr = *istr++;
|
||||
if (chr == '$') {
|
||||
if (inTag) {
|
||||
inTag = FALSE;
|
||||
for (; op > ostr && op[-1] == ' '; op--) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strncmp(istr, "Name:", 5) == 0) {
|
||||
istr += 5;
|
||||
istr += strspn(istr, " ");
|
||||
inTag = TRUE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
*op++ = chr;
|
||||
} while (chr);
|
||||
}
|
||||
|
||||
static Bool
|
||||
VMWAREProbe(DriverPtr drv, int flags)
|
||||
{
|
||||
int numDevSections, numUsed;
|
||||
GDevPtr *devSections;
|
||||
int *usedChips;
|
||||
int i;
|
||||
Bool foundScreen = FALSE;
|
||||
char buildString[sizeof(VMWAREBuildStr)];
|
||||
|
||||
RewriteTagString(VMWAREBuildStr, buildString, sizeof(VMWAREBuildStr));
|
||||
xf86MsgVerb(X_PROBED, 4, "%s", buildString);
|
||||
|
||||
numDevSections = xf86MatchDevice(VMWARE_DRIVER_NAME, &devSections);
|
||||
if (numDevSections <= 0) {
|
||||
#ifdef DEBUG
|
||||
xf86MsgVerb(X_ERROR, 0, "No vmware driver section\n");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
if (xf86GetPciVideoInfo()) {
|
||||
VmwareLog(("Some PCI Video Info Exists\n"));
|
||||
numUsed = xf86MatchPciInstances(VMWARE_NAME, PCI_VENDOR_ID_VMWARE,
|
||||
VMWAREChipsets, VMWAREPciChipsets, devSections,
|
||||
numDevSections, drv, &usedChips);
|
||||
free(devSections);
|
||||
if (numUsed <= 0)
|
||||
return FALSE;
|
||||
if (flags & PROBE_DETECT)
|
||||
foundScreen = TRUE;
|
||||
else
|
||||
for (i = 0; i < numUsed; i++) {
|
||||
ScrnInfoPtr pScrn = NULL;
|
||||
|
||||
VmwareLog(("Even some VMware SVGA PCI instances exists\n"));
|
||||
pScrn = xf86ConfigPciEntity(pScrn, flags, usedChips[i],
|
||||
VMWAREPciChipsets, NULL, NULL, NULL,
|
||||
NULL, NULL);
|
||||
if (pScrn) {
|
||||
VmwareLog(("And even configuration succeeded\n"));
|
||||
pScrn->driverVersion = VMWARE_DRIVER_VERSION;
|
||||
pScrn->driverName = VMWARE_DRIVER_NAME;
|
||||
pScrn->name = VMWARE_NAME;
|
||||
pScrn->Probe = VMWAREProbe;
|
||||
|
||||
#ifdef BUILD_VMWGFX
|
||||
vmwgfx_hookup(pScrn);
|
||||
#else
|
||||
vmwlegacy_hookup(pScrn);
|
||||
#endif /* defined(BUILD_VMWGFX) */
|
||||
|
||||
pScrn->driverPrivate = pScrn->PreInit;
|
||||
pScrn->PreInit = VMwarePreinitStub;
|
||||
foundScreen = TRUE;
|
||||
}
|
||||
}
|
||||
free(usedChips);
|
||||
}
|
||||
return foundScreen;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XSERVER_PLATFORM_BUS
|
||||
static Bool
|
||||
@@ -498,24 +355,15 @@ _X_EXPORT DriverRec vmware = {
|
||||
VMWARE_DRIVER_VERSION,
|
||||
vmware_driver_name,
|
||||
VMWAREIdentify,
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
NULL,
|
||||
#else
|
||||
VMWAREProbe,
|
||||
#endif
|
||||
VMWAREAvailableOptions,
|
||||
NULL,
|
||||
0,
|
||||
#if VMWARE_DRIVER_FUNC
|
||||
VMWareDriverFunc,
|
||||
#endif
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
VMwareDeviceMatch,
|
||||
VMwarePciProbe,
|
||||
#else
|
||||
NULL,
|
||||
NULL,
|
||||
#endif
|
||||
#ifdef XSERVER_PLATFORM_BUS
|
||||
VMwarePlatformProbe,
|
||||
#else
|
||||
|
||||
@@ -49,9 +49,6 @@
|
||||
#include "xf86cmap.h"
|
||||
#include "xf86xv.h"
|
||||
#include "xorgVersion.h"
|
||||
#ifndef XSERVER_LIBPCIACCESS
|
||||
#error "libpciaccess needed"
|
||||
#endif
|
||||
|
||||
#include <pciaccess.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user