[PATCH xf86-video-vmware] Fix build issues if using xserver built with meson

2019-01-16 Thread Tuomo Rinne
Meson defines variables as:
define XSERVER_LIBPCIACCESS
whereas autotools defines:
define XSERVER_LIBPCIACCESS 1

This fix caters for both forms.

Signed-off-by: Tuomo Rinne 
---
 src/vmware.c   | 16 
 src/vmware.h   |  4 ++--
 src/vmware_bootstrap.c | 14 +++---
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/vmware.c b/src/vmware.c
index bd8ec37..4f731e4 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -341,7 +341,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 */
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 pVMWARE->portIOBase = pVMWARE->PciInfo->regions[0].base_addr;
 #else
 pVMWARE->portIOBase = pVMWARE->PciInfo->ioBase[0];
@@ -383,7 +383,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
 }
 pVMWARE->suspensionSavedRegId = id;
 
-#if !XSERVER_LIBPCIACCESS
+#ifndef XSERVER_LIBPCIACCESS
 pVMWARE->PciTag = pciTag(pVMWARE->PciInfo->bus, pVMWARE->PciInfo->device,
  pVMWARE->PciInfo->func);
 #endif
@@ -727,13 +727,13 @@ static Bool
 VMWAREMapMem(ScrnInfoPtr pScrn)
 {
 VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 int err;
 struct pci_device *const device = pVMWARE->PciInfo;
 void *fbBase;
 #endif
 
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
err = pci_device_map_range(device,
   pVMWARE->memPhysBase,
   pVMWARE->videoRam,
@@ -770,7 +770,7 @@ VMWAREUnmapMem(ScrnInfoPtr pScrn)
 
 VmwareLog(("Unmapped: %p/%u\n", pVMWARE->FbBase, pVMWARE->videoRam));
 
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 pci_device_unmap_range(pVMWARE->PciInfo, pVMWARE->FbBase, 
pVMWARE->videoRam);
 #else
 xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->FbBase, pVMWARE->videoRam);
@@ -1045,7 +1045,7 @@ static void
 VMWAREInitFIFO(ScrnInfoPtr pScrn)
 {
 VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 struct pci_device *const device = pVMWARE->PciInfo;
 int err;
 void *mmioVirtBase;
@@ -1058,7 +1058,7 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn)
 
 pVMWARE->mmioPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_MEM_START);
 pVMWARE->mmioSize = vmwareReadReg(pVMWARE, SVGA_REG_MEM_SIZE) & ~3;
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 err = pci_device_map_range(device, pVMWARE->mmioPhysBase,
pVMWARE->mmioSize,
PCI_DEV_MAP_FLAG_WRITABLE,
@@ -1099,7 +1099,7 @@ VMWAREStopFIFO(ScrnInfoPtr pScrn)
 TRACEPOINT
 
 vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 0);
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 pci_device_unmap_range(pVMWARE->PciInfo, pVMWARE->mmioVirtBase, 
pVMWARE->mmioSize);
 #else
 xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->mmioVirtBase, 
pVMWARE->mmioSize);
diff --git a/src/vmware.h b/src/vmware.h
index 028dff3..f08a283 100644
--- a/src/vmware.h
+++ b/src/vmware.h
@@ -83,7 +83,7 @@ typedef xXineramaScreenInfo VMWAREXineramaRec, 
*VMWAREXineramaPtr;
 
 typedef struct {
 EntityInfoPtr pEnt;
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 struct pci_device *PciInfo;
 #else
 pciVideoPtr PciInfo;
@@ -207,7 +207,7 @@ typedef struct {
 /* Undefine this to kill all acceleration */
 #define ACCELERATE_OPS
 
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 #define VENDOR_ID(p)  (p)->vendor_id
 #define DEVICE_ID(p)  (p)->device_id
 #define SUBVENDOR_ID(p)   (p)->subvendor_id
diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c
index 0cfac57..ac7c7f6 100644
--- a/src/vmware_bootstrap.c
+++ b/src/vmware_bootstrap.c
@@ -91,7 +91,7 @@ static char vmware_driver_name[] = VMWARE_DRIVER_NAME;
 VMW_STRING(PACKAGE_VERSION_MAJOR) "." VMW_STRING(PACKAGE_VERSION_MINOR) \
 "." VMW_STRING(PACKAGE_VERSION_PATCHLEVEL)
 
-#if !XSERVER_LIBPCIACCESS
+#ifndef XSERVER_LIBPCIACCESS
 static const char VMWAREBuildStr[] = "VMware Guest X Server "
 VMWARE_DRIVER_VERSION_STRING " - build=$Name$\n";
 #else
@@ -127,7 +127,7 @@ static resRange vmwareLegacyRes[] = {
 #define vmwareLegacyRes NULL
 #endif
 
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 #define VENDOR_ID(p)  (p)->vendor_id
 #define DEVICE_ID(p)  (p)->device_id
 #define SUBVENDOR_ID(p)   (p)->subvendor_id
@@ -141,7 +141,7 @@ static resRange vmwareLegacyRes[] = {
 #define CHIP_REVISION(p)  (p)->chipRev
 #endif
 
-#if XSERVER_LIBPCIACCESS
+#ifdef XSERVER_LIBPCIACCESS
 
 #define VMWARE_DEVICE_MATCH(d, i) \
 {PCI_VENDOR_ID_VMWARE, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i

xf86-video-vmware compilation issue with xserver built with meson

2019-01-12 Thread Tuomo Rinne
Hi,

There's a different behaviour between the build systems in how they define the
variables in xorg-server.h. I've in particular run into problem with variable 
XSERVER_LIBPCIACCESS. 

The autotools build system defines this as: 
#define XSERVER_LIBPCIACCESS 1 

whereas meson build system defines this as:
#define XSERVER_LIBPCIACCESS 

The xf86-video-vmware driver has statements such as
#if XSERVER_LIBPCIACCESS which causes compilation errors when compiled 
in conjunction with the meson build of xserver.

The correct fix would be to use #ifdef statements in the xf86-video-vmware 
driver correct? I'm happy to send a patch if this is the case. 

Thanks, Tuomo

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel