[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-vmware: Changes to 'upstream-experimental'



 configure.ac         |    6 --
 src/vmware.c         |   80 +++++++++++++++++++-------
 src/vmware.h         |   14 ++++
 src/vmwarectrl.c     |   81 +++++++++++----------------
 src/vmwaremodes.c    |  152 ++++++++++++++++++++++++++++++++-------------------
 src/vmwaremodule.c   |    7 +-
 src/vmwarevideo.c    |   50 ++++++++++++----
 src/vmwarexinerama.c |  106 +++++++++++++++++++++++------------
 8 files changed, 310 insertions(+), 186 deletions(-)

New commits:
commit 5d7242154c392b2df57476c01f5f0a7a9bce3d8b
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Jan 11 13:15:59 2012 +0100

    Bump package version to 11.1.0 for release
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>

diff --git a/configure.ac b/configure.ac
index 74fd1b9..f90e8b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-vmware],
-        [11.0.99.901],
+        [11.1.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-vmware])
 AC_CONFIG_SRCDIR([Makefile.am])

commit abf9cb75630cb27bb4741d194cb23014fe3d09b1
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Thu Nov 17 16:38:22 2011 +0100

    vmwlegacy: Fix up Xinerama / panoramiX replies.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/src/vmwarexinerama.c b/src/vmwarexinerama.c
index 49df3f2..954abdc 100644
--- a/src/vmwarexinerama.c
+++ b/src/vmwarexinerama.c
@@ -153,9 +153,11 @@ VMwareXineramaGetState(ClientPtr client)
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
     rep.state = pVMWARE->xinerama;
+    rep.window = stuff->window;
     if(client->swapped) {
        _swaps (&rep.sequenceNumber, n);
        _swapl (&rep.length, n);
+       _swapl (&rep.window, n);
     }
     WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep);
     return client->noClientException;
@@ -206,9 +208,12 @@ VMwareXineramaGetScreenCount(ClientPtr client)
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
     rep.ScreenCount = pVMWARE->xineramaNumOutputs;
+    rep.window = stuff->window;
+    
     if(client->swapped) {
        _swaps(&rep.sequenceNumber, n);
        _swapl(&rep.length, n);
+       _swapl(&rep.window, n);
     }
     WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
     return client->noClientException;
@@ -244,6 +249,7 @@ VMwareXineramaGetScreenSize(ClientPtr client)
     VMWAREPtr pVMWARE;
     int rc;
 
+
     REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
@@ -260,11 +266,15 @@ VMwareXineramaGetScreenSize(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.width  = pVMWARE->xineramaState[stuff->screen].width;
     rep.height  = pVMWARE->xineramaState[stuff->screen].height;
+    rep.window = stuff->window;
+    rep.screen = stuff->screen;
     if(client->swapped) {
        _swaps(&rep.sequenceNumber, n);
        _swapl(&rep.length, n);
        _swapl(&rep.width, n);
        _swapl(&rep.height, n);
+       _swapl(&rep.window, n);
+       _swapl(&rep.screen, n);
     }
     WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
     return client->noClientException;

commit be23efbc91f47a6a34fbe24f167ee29fdf58f541
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Nov 16 10:23:10 2011 +0100

    vmwlegacy: Fix device fifo communication
    
    This fixes two issues with the device fifo communication:
    1) Idle the fifo before initializing it. If the fifo is already up and
    processing data due to an uncleanly shut down server, and init could
    otherwise confuse the device.
    
    2) Mark fifo memory volatile when writing to it and make sure commands
    are written before telling the device they are available.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/src/vmware.c b/src/vmware.c
index 55bde22..fa01dca 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -299,7 +299,7 @@ vmwareWriteReg(VMWAREPtr pVMWARE, int index, CARD32 value)
 void
 vmwareWriteWordToFIFO(VMWAREPtr pVMWARE, CARD32 value)
 {
-    CARD32* vmwareFIFO = pVMWARE->vmwareFIFO;
+    volatile CARD32* vmwareFIFO = pVMWARE->vmwareFIFO;
 
     /* Need to sync? */
     if ((vmwareFIFO[SVGA_FIFO_NEXT_CMD] + sizeof(CARD32) == vmwareFIFO[SVGA_FIFO_STOP])
@@ -310,6 +310,9 @@ vmwareWriteWordToFIFO(VMWAREPtr pVMWARE, CARD32 value)
     }
 
     vmwareFIFO[vmwareFIFO[SVGA_FIFO_NEXT_CMD] / sizeof(CARD32)] = value;
+
+    write_mem_barrier();
+
     if(vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX] -
        sizeof(CARD32)) {
         vmwareFIFO[SVGA_FIFO_NEXT_CMD] = vmwareFIFO[SVGA_FIFO_MIN];
@@ -1342,7 +1345,7 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn)
     int err;
     void *mmioVirtBase;
 #endif
-    CARD32* vmwareFIFO;
+    volatile CARD32* vmwareFIFO;
     Bool extendedFifo;
     int min;
 
@@ -1373,6 +1376,9 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn)
     extendedFifo = pVMWARE->vmwareCapability & SVGA_CAP_EXTENDED_FIFO;
     min = extendedFifo ? vmwareReadReg(pVMWARE, SVGA_REG_MEM_REGS) : 4;
 
+    vmwareWaitForFB(pVMWARE);
+    vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 0);
+
     vmwareFIFO[SVGA_FIFO_MIN] = min * sizeof(CARD32);
     vmwareFIFO[SVGA_FIFO_MAX] = pVMWARE->mmioSize;
     vmwareFIFO[SVGA_FIFO_NEXT_CMD] = min * sizeof(CARD32);

commit 4c08c2600936efeedb1a33436876ba82a11218e7
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Fri Oct 7 13:15:11 2011 -0700

    Build fix for ABI version 12
    
    This results in the vmware driver assuming there is only one PCI domain,
    which I think is true for everywhere this is expected to run anyway.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/src/vmware.c b/src/vmware.c
index 1be0990..55bde22 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -612,9 +612,11 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
     uint32 width = 0, height = 0;
     Bool defaultMode;
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
 #ifndef BUILD_FOR_420
     domainIOBase = pScrn->domainIOBase;
 #endif
+#endif
 
     if (flags & PROBE_DETECT) {
         return FALSE;

commit 208ccbc7179b40a570a5943e325dd22740a67577
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Fri Oct 7 13:10:59 2011 -0700

    Fix build failures resulting from changes to the swaps and swapl macros in recent xorg-server
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/src/vmware.h b/src/vmware.h
index cf32462..0385292 100644
--- a/src/vmware.h
+++ b/src/vmware.h
@@ -43,6 +43,14 @@
 #include "svga_reg.h"
 #include "svga_struct.h"
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
+#define _swapl(x, n) swapl(x,n)
+#define _swaps(x, n) swaps(x,n)
+#else
+#define _swapl(x, n) swapl(x)
+#define _swaps(x, n) swaps(x)
+#endif
+
 /*
  * The virtual hardware's cursor limits are pretty big. Some VMware
  * product versions limit to 1024x1024 pixels, others limit to 128
diff --git a/src/vmwarectrl.c b/src/vmwarectrl.c
index d021eb7..d31bef6 100644
--- a/src/vmwarectrl.c
+++ b/src/vmwarectrl.c
@@ -82,10 +82,10 @@ VMwareCtrlQueryVersion(ClientPtr client)
    rep.majorVersion = VMWARE_CTRL_MAJOR_VERSION;
    rep.minorVersion = VMWARE_CTRL_MINOR_VERSION;
    if (client->swapped) {
-      swaps(&rep.sequenceNumber, n);
-      swapl(&rep.length, n);
-      swapl(&rep.majorVersion, n);
-      swapl(&rep.minorVersion, n);
+      _swaps(&rep.sequenceNumber, n);
+      _swapl(&rep.length, n);
+      _swapl(&rep.majorVersion, n);
+      _swapl(&rep.minorVersion, n);
    }
    WriteToClient(client, sizeof(xVMwareCtrlQueryVersionReply), (char *)&rep);
 
@@ -225,11 +225,11 @@ VMwareCtrlSetRes(ClientPtr client)
    rep.x = stuff->x;
    rep.y = stuff->y;
    if (client->swapped) {
-      swaps(&rep.sequenceNumber, n);
-      swapl(&rep.length, n);
-      swapl(&rep.screen, n);
-      swapl(&rep.x, n);
-      swapl(&rep.y, n);
+      _swaps(&rep.sequenceNumber, n);
+      _swapl(&rep.length, n);
+      _swapl(&rep.screen, n);
+      _swapl(&rep.x, n);
+      _swapl(&rep.y, n);
    }
    WriteToClient(client, sizeof(xVMwareCtrlSetResReply), (char *)&rep);
 
@@ -379,9 +379,9 @@ VMwareCtrlSetTopology(ClientPtr client)
    rep.sequenceNumber = client->sequence;
    rep.screen = stuff->screen;
    if (client->swapped) {
-      swaps(&rep.sequenceNumber, n);
-      swapl(&rep.length, n);
-      swapl(&rep.screen, n);
+      _swaps(&rep.sequenceNumber, n);
+      _swapl(&rep.length, n);
+      _swapl(&rep.screen, n);
    }
    WriteToClient(client, sizeof(xVMwareCtrlSetTopologyReply), (char *)&rep);
 
@@ -448,7 +448,7 @@ SVMwareCtrlQueryVersion(ClientPtr client)
    REQUEST(xVMwareCtrlQueryVersionReq);
    REQUEST_SIZE_MATCH(xVMwareCtrlQueryVersionReq);
 
-   swaps(&stuff->length, n);
+   _swaps(&stuff->length, n);
 
    return VMwareCtrlQueryVersion(client);
 }
@@ -479,10 +479,10 @@ SVMwareCtrlSetRes(ClientPtr client)
    REQUEST(xVMwareCtrlSetResReq);
    REQUEST_SIZE_MATCH(xVMwareCtrlSetResReq);
 
-   swaps(&stuff->length, n);
-   swapl(&stuff->screen, n);
-   swapl(&stuff->x, n);
-   swapl(&stuff->y, n);
+   _swaps(&stuff->length, n);
+   _swapl(&stuff->screen, n);
+   _swapl(&stuff->x, n);
+   _swapl(&stuff->y, n);
 
    return VMwareCtrlSetRes(client);
 }
@@ -513,9 +513,9 @@ SVMwareCtrlSetTopology(ClientPtr client)
    REQUEST(xVMwareCtrlSetTopologyReq);
    REQUEST_SIZE_MATCH(xVMwareCtrlSetTopologyReq);
 
-   swaps(&stuff->length, n);
-   swapl(&stuff->screen, n);
-   swapl(&stuff->number, n);
+   _swaps(&stuff->length, n);
+   _swapl(&stuff->screen, n);
+   _swapl(&stuff->number, n);
    /* Each extent is a struct of shorts. */
    SwapRestS(stuff);
 
diff --git a/src/vmwarexinerama.c b/src/vmwarexinerama.c
index 2407c27..49df3f2 100644
--- a/src/vmwarexinerama.c
+++ b/src/vmwarexinerama.c
@@ -99,10 +99,10 @@ VMwareXineramaQueryVersion(ClientPtr client)
     rep.majorVersion = 1;
     rep.minorVersion = 0;
     if(client->swapped) {
-        swaps(&rep.sequenceNumber, n);
-        swapl(&rep.length, n);
-        swaps(&rep.majorVersion, n);
-        swaps(&rep.minorVersion, n);
+        _swaps(&rep.sequenceNumber, n);
+        _swapl(&rep.length, n);
+        _swaps(&rep.majorVersion, n);
+        _swaps(&rep.minorVersion, n);
     }
     WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *)&rep);
     return (client->noClientException);
@@ -154,8 +154,8 @@ VMwareXineramaGetState(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.state = pVMWARE->xinerama;
     if(client->swapped) {
-       swaps (&rep.sequenceNumber, n);
-       swapl (&rep.length, n);
+       _swaps (&rep.sequenceNumber, n);
+       _swapl (&rep.length, n);
     }
     WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep);
     return client->noClientException;
@@ -207,8 +207,8 @@ VMwareXineramaGetScreenCount(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.ScreenCount = pVMWARE->xineramaNumOutputs;
     if(client->swapped) {
-       swaps(&rep.sequenceNumber, n);
-       swapl(&rep.length, n);
+       _swaps(&rep.sequenceNumber, n);
+       _swapl(&rep.length, n);
     }
     WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
     return client->noClientException;
@@ -261,10 +261,10 @@ VMwareXineramaGetScreenSize(ClientPtr client)
     rep.width  = pVMWARE->xineramaState[stuff->screen].width;
     rep.height  = pVMWARE->xineramaState[stuff->screen].height;
     if(client->swapped) {
-       swaps(&rep.sequenceNumber, n);
-       swapl(&rep.length, n);
-       swapl(&rep.width, n);
-       swapl(&rep.height, n);
+       _swaps(&rep.sequenceNumber, n);
+       _swapl(&rep.length, n);
+       _swapl(&rep.width, n);
+       _swapl(&rep.height, n);
     }
     WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
     return client->noClientException;
@@ -310,9 +310,9 @@ VMwareXineramaIsActive(ClientPtr client)
     rep.state = pVMWARE->xinerama;
     if(client->swapped) {
 	register int n;
-	swaps(&rep.sequenceNumber, n);
-	swapl(&rep.length, n);
-	swapl(&rep.state, n);
+	_swaps(&rep.sequenceNumber, n);
+	_swapl(&rep.length, n);
+	_swapl(&rep.state, n);
     }
     WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
     return client->noClientException;
@@ -358,9 +358,9 @@ VMwareXineramaQueryScreens(ClientPtr client)
     rep.length = rep.number * sz_XineramaScreenInfo >> 2;
     if(client->swapped) {
        register int n;
-       swaps(&rep.sequenceNumber, n);
-       swapl(&rep.length, n);
-       swapl(&rep.number, n);
+       _swaps(&rep.sequenceNumber, n);
+       _swapl(&rep.length, n);
+       _swapl(&rep.number, n);
     }
     WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *)&rep);
 
@@ -375,10 +375,10 @@ VMwareXineramaQueryScreens(ClientPtr client)
 	  scratch.height = pVMWARE->xineramaState[i].height;
 	  if(client->swapped) {
 	     register int n;
-	     swaps(&scratch.x_org, n);
-	     swaps(&scratch.y_org, n);
-	     swaps(&scratch.width, n);
-	     swaps(&scratch.height, n);
+	     _swaps(&scratch.x_org, n);
+	     _swaps(&scratch.y_org, n);
+	     _swaps(&scratch.width, n);
+	     _swaps(&scratch.height, n);
 	  }
 	  WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch);
        }
@@ -449,7 +449,7 @@ SVMwareXineramaQueryVersion (ClientPtr client)
 {
     REQUEST(xPanoramiXQueryVersionReq);
     register int n;
-    swaps(&stuff->length,n);
+    _swaps(&stuff->length,n);
     REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
     return VMwareXineramaQueryVersion(client);
 }
@@ -477,7 +477,7 @@ SVMwareXineramaGetState(ClientPtr client)
 {
     REQUEST(xPanoramiXGetStateReq);
     register int n;
-    swaps (&stuff->length, n);
+    _swaps (&stuff->length, n);
     REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
     return VMwareXineramaGetState(client);
 }
@@ -505,7 +505,7 @@ SVMwareXineramaGetScreenCount(ClientPtr client)
 {
     REQUEST(xPanoramiXGetScreenCountReq);
     register int n;
-    swaps (&stuff->length, n);
+    _swaps (&stuff->length, n);
     REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
     return VMwareXineramaGetScreenCount(client);
 }
@@ -533,7 +533,7 @@ SVMwareXineramaGetScreenSize(ClientPtr client)
 {
     REQUEST(xPanoramiXGetScreenSizeReq);
     register int n;
-    swaps (&stuff->length, n);
+    _swaps (&stuff->length, n);
     REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
     return VMwareXineramaGetScreenSize(client);
 }
@@ -561,7 +561,7 @@ SVMwareXineramaIsActive(ClientPtr client)
 {
     REQUEST(xXineramaIsActiveReq);
     register int n;
-    swaps (&stuff->length, n);
+    _swaps (&stuff->length, n);
     REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
     return VMwareXineramaIsActive(client);
 }
@@ -589,7 +589,7 @@ SVMwareXineramaQueryScreens(ClientPtr client)
 {
     REQUEST(xXineramaQueryScreensReq);
     register int n;
-    swaps (&stuff->length, n);
+    _swaps (&stuff->length, n);
     REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
     return VMwareXineramaQueryScreens(client);
 }

commit de70a1d0cb79dad9e52baa43306264db80a163da
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Oct 5 13:33:17 2011 +0200

    xf86-video-vmware 11.0.99.901
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>

diff --git a/configure.ac b/configure.ac
index cd2854e..74fd1b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-vmware],
-        [11.0.3],
+        [11.0.99.901],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-vmware])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 26845eb54a15d43f09288a87c5f74beac8fb6ec7
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date:   Tue Sep 27 19:31:22 2011 -0700

    Use dixLookupWindow instead of LookupWindow on Xorg 1.5 & later
    
    The LookupWindow function was deprecated in xserver commit ed75b056511ccb4
    and removed during the Xorg 1.11 merge window by commit 82a8677d9175732.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>

diff --git a/src/vmwarexinerama.c b/src/vmwarexinerama.c
index 371c7b1..2407c27 100644
--- a/src/vmwarexinerama.c
+++ b/src/vmwarexinerama.c
@@ -48,6 +48,26 @@
 #include <xf86_libc.h>
 #endif
 
+/* 
+ * LookupWindow was removed with video abi 11.
+ */
+#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 4)
+#ifndef DixGetAttrAccess
+#define DixGetAttrAccess   (1<<4)
+#endif
+#endif
+
+#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 2)
+static inline int
+dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
+{
+    *pWin = LookupWindow(id, client);
+    if (!*pWin)
+	return BadWindow;
+    return Success;
+}
+#endif
+
 
 /*
  *----------------------------------------------------------------------------
@@ -116,10 +136,12 @@ VMwareXineramaGetState(ClientPtr client)
     ExtensionEntry *ext;
     ScrnInfoPtr pScrn;
     VMWAREPtr pVMWARE;
+    int rc;
 
     REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
-    pWin = LookupWindow(stuff->window, client);
-    if(!pWin) return BadWindow;
+    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+    if (rc != Success)
+	return rc;
 
     if (!(ext = CheckExtension(PANORAMIX_PROTOCOL_NAME))) {
        return BadMatch;
@@ -167,10 +189,12 @@ VMwareXineramaGetScreenCount(ClientPtr client)
     ExtensionEntry *ext;
     ScrnInfoPtr pScrn;
     VMWAREPtr pVMWARE;
+    int rc;
 
     REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
-    pWin = LookupWindow(stuff->window, client);
-    if(!pWin) return BadWindow;
+    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+    if (rc != Success)
+	return rc;
 
     if (!(ext = CheckExtension(PANORAMIX_PROTOCOL_NAME))) {
        return BadMatch;
@@ -218,10 +242,12 @@ VMwareXineramaGetScreenSize(ClientPtr client)
     ExtensionEntry *ext;
     ScrnInfoPtr pScrn;
     VMWAREPtr pVMWARE;
+    int rc;
 
     REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
-    pWin = LookupWindow (stuff->window, client);
-    if(!pWin)  return BadWindow;
+    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+    if (rc != Success)
+	return rc;
 
     if (!(ext = CheckExtension(PANORAMIX_PROTOCOL_NAME))) {
        return BadMatch;

commit b5438423ad29338429321cd29118a66b715cdcac
Author: Matt Turner <mattst88@gmail.com>
Date:   Sun Sep 25 14:06:47 2011 -0400

    Fix wrong-sized swaps
    
    Signed-off-by: Matt Turner <mattst88@gmail.com>

diff --git a/src/vmwarexinerama.c b/src/vmwarexinerama.c
index 3476f43..371c7b1 100644
--- a/src/vmwarexinerama.c
+++ b/src/vmwarexinerama.c
@@ -134,7 +134,6 @@ VMwareXineramaGetState(ClientPtr client)
     if(client->swapped) {
        swaps (&rep.sequenceNumber, n);
        swapl (&rep.length, n);
-       swaps (&rep.state, n);
     }
     WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep);
     return client->noClientException;
@@ -186,7 +185,6 @@ VMwareXineramaGetScreenCount(ClientPtr client)
     if(client->swapped) {
        swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
-       swaps(&rep.ScreenCount, n);
     }
     WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
     return client->noClientException;
@@ -239,8 +237,8 @@ VMwareXineramaGetScreenSize(ClientPtr client)
     if(client->swapped) {
        swaps(&rep.sequenceNumber, n);
        swapl(&rep.length, n);
-       swaps(&rep.width, n);
-       swaps(&rep.height, n);
+       swapl(&rep.width, n);
+       swapl(&rep.height, n);
     }
     WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
     return client->noClientException;

commit 4ae8aac35b7209576eaeb64347470d3145b27832
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Mon Jul 4 15:39:02 2011 +0200

    vmwlegacy: Fix server termination due to pitch inconsistency.
    
    Don't require a 32*32 bit pitch alignment when validating modes, since the
    requested virtual pitch (pVMWARE->maxWidth*bpp) must be a multiple of that
    alignment. If not, the server will terminate with a cryptic error message.
    
    This is only for validating modes. The driver will adjust the pitch to the
    host requirement when a mode is set anyway, and hopefully the host won't
    require a pitch it doesn't support.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>

diff --git a/src/vmware.c b/src/vmware.c
index 4158732..1be0990 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -970,7 +970,8 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
     }
 
     i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes,
-                          clockRanges, NULL, 256, pVMWARE->maxWidth, 32 * 32,
+                          clockRanges, NULL, 256, pVMWARE->maxWidth,
+                          pVMWARE->bitsPerPixel * 1,
                           128, pVMWARE->maxHeight,
                           pScrn->display->virtualX, pScrn->display->virtualY,
                           pVMWARE->videoRam,
diff --git a/src/vmwaremodes.c b/src/vmwaremodes.c
index 9a7b757..2965dca 100644
--- a/src/vmwaremodes.c
+++ b/src/vmwaremodes.c
@@ -138,6 +138,9 @@ vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight)
 	if (dispModeCount == 0) {
 
 	    /*
+	     * Set up a large virtual size, so that we allow also
+	     * setting modes larger than the initial mode.
+	     *
 	     * We might also want to consider the case where
 	     * dispModeCount != 0, but the requested display modes
 	     * are not available. This is sufficient for now.

commit 0142bb8d10edb153c9ce79a2ea3ff92a7fb15ac5
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Mar 30 12:37:24 2011 +0200

    vmwlegacy: Don't prune modes based on the virtual size of the default mode
    
    We might be pruning modes based on the virtual size of the default mode in
    some situations. Avoid this by allowing a virtual size equal to the device
    max size, unless the user has requested something else.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Alan Hourihane <alanh@vmware.com>

diff --git a/src/vmwaremodes.c b/src/vmwaremodes.c
index 6df977d..9a7b757 100644
--- a/src/vmwaremodes.c
+++ b/src/vmwaremodes.c
@@ -39,6 +39,7 @@
 #include <xf86Modes.h>
 #endif
 #include "vm_basic_types.h"
+#include "vmware.h"
 
 #ifndef M_T_DRIVER
 # define M_T_DRIVER  0x40	/* Supplied by the driver (EDID, etc) */
@@ -85,6 +86,7 @@ vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight)
 	char **dispModeList;
 	char *dynModeName;
 	char name[80];
+	VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
 
 	/* First, add the default mode name to the display mode
 	 * requests.
@@ -132,6 +134,20 @@ vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight)
 	    dynamic.HTotal / 1000;
 	mode = xf86DuplicateMode(&dynamic);
 	modes = xf86ModesAdd(modes, mode);
+
+	if (dispModeCount == 0) {
+
+	    /*
+	     * We might also want to consider the case where
+	     * dispModeCount != 0, but the requested display modes
+	     * are not available. This is sufficient for now.
+	     */
+
+	    if (pScrn->display->virtualX == 0)
+		pScrn->display->virtualX = pVMWARE->maxWidth;
+	    if (pScrn->display->virtualY == 0)
+		pScrn->display->virtualY = pVMWARE->maxHeight;
+	}
     }
 
     *monitorModes = xf86ModesAdd(*monitorModes, modes);

commit 04297d435b87e3d04a427ac8ef33d314727220e6
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Mar 30 12:22:43 2011 +0200

    vmwlegacy: Fix up default mode VRefresh anc Clock calculation
    
    The VRefresh value was a factor 1000 too high.
    Calculate clock based on vrefresh and resolution.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Alan Hourihane <alanh@vmware.com>

diff --git a/src/vmwaremodes.c b/src/vmwaremodes.c
index 5386b17..6df977d 100644
--- a/src/vmwaremodes.c
+++ b/src/vmwaremodes.c
@@ -120,10 +120,6 @@ vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight)
 	dynamic.HSyncStart = dynamic.HDisplay + 1;
 	dynamic.HSyncEnd = dynamic.HSyncStart + 1;
 	dynamic.HTotal = dynamic.HSyncEnd * 5 / 4;
-	if (monitor->nHsync > 0)
-	    dynamic.Clock = dynamic.HTotal * monitor->hsync[0].lo;
-	else
-	    dynamic.Clock = 75000;
 	dynamic.VDisplay = dheight;
 	dynamic.VSyncStart = dynamic.VDisplay + 1;
 	dynamic.VSyncEnd = dynamic.VSyncStart + 1;
@@ -131,8 +127,9 @@ vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight)
 	if (monitor->nVrefresh > 0)
 	    dynamic.VRefresh = monitor->vrefresh[0].lo;
 	else
-	    dynamic.VRefresh = 60000;
-
+	    dynamic.VRefresh = 60;
+	dynamic.Clock = dynamic.VRefresh * dynamic.VTotal *
+	    dynamic.HTotal / 1000;
 	mode = xf86DuplicateMode(&dynamic);
 	modes = xf86ModesAdd(modes, mode);
     }

commit c5ca599361c87ec816db92d4f9841143f8601934
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Mar 30 11:01:06 2011 +0200

    vmwlegacy: Fix a bug in screen dimension calculation
    
    This bug resulted in incorrect screen dimensions and DPI being calculated
    in some circumstances, leading to among other things bad aspect ratios in xine.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>

diff --git a/src/vmware.c b/src/vmware.c
index 1f262e3..4158732 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -1626,10 +1626,10 @@ VMWareDriverFunc(ScrnInfoPtr pScrn,
        * keep the DPI constant.
        */
       if (modemm && modemm->mode) {
-	  modemm->mmWidth *= (modemm->mode->HDisplay * VMWARE_INCHTOMM +
-			      pScrn->xDpi / 2)  / pScrn->xDpi;
-	  modemm->mmHeight *= (modemm->mode->VDisplay * VMWARE_INCHTOMM +
-			       pScrn->yDpi / 2) / pScrn->yDpi;
+	  modemm->mmWidth = (modemm->mode->HDisplay * VMWARE_INCHTOMM +
+			     pScrn->xDpi / 2)  / pScrn->xDpi;
+	  modemm->mmHeight = (modemm->mode->VDisplay * VMWARE_INCHTOMM +
+			      pScrn->yDpi / 2) / pScrn->yDpi;
       }
       return TRUE;
    default:

commit c02d5977015983473a9bbae97ec65ce70a5faa3b
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Tue Mar 29 13:03:39 2011 +0200

    vmwlegacy: Make sure we draw the colorkey to the right drawable
    
    Don't draw the colorkey to the screen drawable, but to the video drawable
    when possible.
    
    Also change the Xv API/ABI test to use the builtin ABI version
    functions.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Michel D�er <daenzer@vmware.com>

diff --git a/configure.ac b/configure.ac
index e3dcf30..cd2854e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,10 +81,6 @@ PKG_CHECK_EXISTS([xorg-server >= 1.1.0],
                  [AC_DEFINE([HAVE_XORG_SERVER_1_1_0], 1,
                  [Has version 1.1.0 or greater of the Xserver])])
 
-PKG_CHECK_EXISTS([xorg-server >= 1.0.99.901],
-                 [AC_DEFINE([HAVE_XORG_SERVER_1_0_99_901], 1,
-                 [Has version 1.0.99.901 or greater of the Xserver])])
-
 PKG_CHECK_EXISTS([xorg-server >= 1.2.0],
                  [AC_DEFINE([HAVE_XORG_SERVER_1_2_0], 1,
                  [Has version 1.2.0 or greater of the Xserver])])
diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c
index 4ce0d5d..71f21fe 100644
--- a/src/vmwarevideo.c
+++ b/src/vmwarevideo.c
@@ -51,6 +51,12 @@
 #include <xf86_libc.h>
 #endif
 
+
+#define HAVE_FILLKEYHELPERDRAWABLE \
+    ((GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 2) ||  \
+     ((GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) == 1) && \
+      (GET_ABI_MINOR(ABI_VIDEODRV_VERSION) >= 2)))
+
 #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
 
 /*
@@ -159,7 +165,7 @@ struct VMWAREVideoRec {
    int                (*play)(ScrnInfoPtr, struct VMWAREVideoRec *,
                               short, short, short, short, short,
                               short, short, short, int, unsigned char*,
-                              short, short, RegionPtr);
+                              short, short, RegionPtr, DrawablePtr);
    /*
     * Offscreen memory region used to pass video data to the host.
     */
@@ -180,7 +186,7 @@ typedef VMWAREVideoRec *VMWAREVideoPtr;
 /*
  * Callback functions
  */
-#ifdef HAVE_XORG_SERVER_1_0_99_901
+#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 1)
 static int vmwareXvPutImage(ScrnInfoPtr pScrn, short src_x, short src_y,
                             short drw_x, short drw_y, short src_w, short src_h,
                             short drw_w, short drw_h, int image,
@@ -217,7 +223,8 @@ static int vmwareVideoInitStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
                                  short drw_y, short src_w, short src_h,
                                  short drw_w, short drw_h, int format,
                                  unsigned char *buf, short width,
-                                 short height, RegionPtr clipBoxes);
+                                 short height, RegionPtr clipBoxes,
+				 DrawablePtr draw);
 static int vmwareVideoInitAttributes(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
                                      int format, unsigned short width,
                                      unsigned short height);
@@ -226,7 +233,8 @@ static int vmwareVideoPlay(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
                            short drw_y, short src_w, short src_h,
                            short drw_w, short drw_h, int format,
                            unsigned char *buf, short width,
-                           short height, RegionPtr clipBoxes);
+                           short height, RegionPtr clipBoxes,
+			   DrawablePtr draw);
 static void vmwareVideoFlush(VMWAREPtr pVMWARE, uint32 streamId);
 static void vmwareVideoSetOneReg(VMWAREPtr pVMWARE, uint32 streamId,
                                  uint32 regId, uint32 value);
@@ -631,7 +639,8 @@ vmwareVideoInitStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
                       short drw_y, short src_w, short src_h,
                       short drw_w, short drw_h, int format,
                       unsigned char *buf, short width,
-                      short height, RegionPtr clipBoxes)
+                      short height, RegionPtr clipBoxes,
+		      DrawablePtr draw)
 {
     VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
     int i;
@@ -676,8 +685,11 @@ vmwareVideoInitStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
 	BoxPtr boxes = REGION_RECTS(&pVid->clipBoxes);
 	int nBoxes = REGION_NUM_RECTS(&pVid->clipBoxes);
 
+#if HAVE_FILLKEYHELPERDRAWABLE
+	xf86XVFillKeyHelperDrawable(draw, pVid->colorKey, clipBoxes);
+#else
         xf86XVFillKeyHelper(pScrn->pScreen, pVid->colorKey, clipBoxes);
-
+#endif
 	/**
 	 * Force update to paint the colorkey before the overlay flush.
 	 */
@@ -691,7 +703,8 @@ vmwareVideoInitStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
                pVid->fbarea->offset, pVid->fbarea->size, pVid->size));
 
     return pVid->play(pScrn, pVid, src_x, src_y, drw_x, drw_y, src_w, src_h,
-                      drw_w, drw_h, format, buf, width, height, clipBoxes);
+                      drw_w, drw_h, format, buf, width, height, clipBoxes,
+		      draw);
 }
 
 
@@ -761,7 +774,8 @@ vmwareVideoPlay(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
                 short drw_y, short src_w, short src_h,
                 short drw_w, short drw_h, int format,
                 unsigned char *buf, short width,
-                short height, RegionPtr clipBoxes)
+                short height, RegionPtr clipBoxes,
+		DrawablePtr draw)
 {
     VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
     uint32 *fifoItem;
@@ -803,7 +817,7 @@ vmwareVideoPlay(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
         vmwareStopVideo(pScrn, pVid, TRUE);
         return pVid->play(pScrn, pVid, src_x, src_y, drw_x, drw_y, src_w,
                           src_h, drw_w, drw_h, format, buf, width, height,
-                          clipBoxes);
+                          clipBoxes, draw);
     }
 
     pVid->size = size;
@@ -856,8 +870,11 @@ vmwareVideoPlay(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
 	    BoxPtr boxes = REGION_RECTS(&pVid->clipBoxes);
 	    int nBoxes = REGION_NUM_RECTS(&pVid->clipBoxes);
 
-            xf86XVFillKeyHelper(pScrn->pScreen, pVid->colorKey, clipBoxes);
-
+#if HAVE_FILLKEYHELPERDRAWABLE
+	    xf86XVFillKeyHelperDrawable(draw, pVid->colorKey, clipBoxes);
+#else
+	    xf86XVFillKeyHelper(pScrn->pScreen, pVid->colorKey, clipBoxes);
+#endif
 	    /**
 	     * Force update to paint the colorkey before the overlay flush.
 	     */
@@ -1056,7 +1073,7 @@ vmwareVideoEndStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid)
  *-----------------------------------------------------------------------------
  */
 
-#ifdef HAVE_XORG_SERVER_1_0_99_901
+#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 1)
 static int
 vmwareXvPutImage(ScrnInfoPtr pScrn, short src_x, short src_y,
                  short drw_x, short drw_y, short src_w, short src_h,
@@ -1082,8 +1099,15 @@ vmwareXvPutImage(ScrnInfoPtr pScrn, short src_x, short src_y,
         return XvBadAlloc;
     }
 
+#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 1)
     return pVid->play(pScrn, pVid, src_x, src_y, drw_x, drw_y, src_w, src_h,
-                      drw_w, drw_h, format, buf, width, height, clipBoxes);
+                      drw_w, drw_h, format, buf, width, height, clipBoxes,
+		      dst);
+#else
+    return pVid->play(pScrn, pVid, src_x, src_y, drw_x, drw_y, src_w, src_h,
+                      drw_w, drw_h, format, buf, width, height, clipBoxes,
+		      NULL);
+#endif
 }
 
 

commit b234d7d6925b480a9c4fe23e5100e6fe7e5c0eac
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Tue Mar 29 11:18:24 2011 +0200

    vmwlegacy: Silence a number of warnings
    
    This potentially also fixes a use of an uninitialized pointer value, which
    may cause OOM or segfaults.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Michel D�er <daenzer@vmware.com>

diff --git a/src/vmware.c b/src/vmware.c
index e04835f..1f262e3 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -1021,6 +1021,7 @@ VMWAREMapMem(ScrnInfoPtr pScrn)
 #if XSERVER_LIBPCIACCESS
     int err;
     struct pci_device *const device = pVMWARE->PciInfo;
+    void *fbBase;
 #endif
 
 #if XSERVER_LIBPCIACCESS
@@ -1028,14 +1029,14 @@ VMWAREMapMem(ScrnInfoPtr pScrn)
                               pVMWARE->memPhysBase,
                               pVMWARE->videoRam,
                               PCI_DEV_MAP_FLAG_WRITABLE,
-                              (void **) &pVMWARE->FbBase);
+			      &fbBase);
    if (err) {
        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                   "Unable to map frame buffer BAR. %s (%d)\n",
                   strerror (err), err);
        return FALSE;
    }
-
+   pVMWARE->FbBase = fbBase;
 #else
     pVMWARE->FbBase = xf86MapPciMem(pScrn->scrnIndex, 0,
                                     pVMWARE->PciTag,
@@ -1336,6 +1337,7 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn)
 #if XSERVER_LIBPCIACCESS
     struct pci_device *const device = pVMWARE->PciInfo;
     int err;
+    void *mmioVirtBase;
 #endif
     CARD32* vmwareFIFO;
     Bool extendedFifo;
@@ -1349,13 +1351,14 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn)
     err = pci_device_map_range(device, pVMWARE->mmioPhysBase,


Reply to: