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

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



 configure.ac       |    4 
 man/Makefile.am    |   41 ++++-----
 src/Makefile.am    |   55 +++++++------
 src/vmware.c       |   36 ++++----
 src/vmware.h       |    3 
 src/vmwarecurs.c   |   17 ++++
 src/vmwaremodule.c |  223 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 312 insertions(+), 67 deletions(-)

New commits:
commit cc77a36048863640fb1fa9f82b5b0dbf41326872
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Thu Mar 18 15:30:36 2010 +0100

    Bump for 11.0.1 release.

diff --git a/configure.ac b/configure.ac
index ab54623..5b696b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-vmware],
-        11.0.0,
+        11.0.1,
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         xf86-video-vmware)
 

commit a5fb3698a033bfe7789641fd6719d8d4fb054201
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Tue Mar 9 08:37:11 2010 +0000

    Rework chainloader code to check for vmwgfx userspace driver as well

diff --git a/src/vmwaremodule.c b/src/vmwaremodule.c
index 5b7d289..d6fcddb 100644
--- a/src/vmwaremodule.c
+++ b/src/vmwaremodule.c
@@ -38,6 +38,9 @@
 #define VMWARE_DRIVER_NAME    "vmware"
 #define VMWGFX_DRIVER_NAME    "vmwgfx"
 #define VMWGFX_MODULE_NAME    "vmwgfx"
+#define VMWGFX_COMPAT_MAJOR   11
+#define VMWGFX_REQUIRED_MAJOR 11
+#define VMWGFX_REQUIRED_MINOR 0
 #define VMWLEGACY_DRIVER_NAME "vmwlegacy"
 
 #define VMW_STRING_INNER(s) #s
@@ -68,6 +71,7 @@ _X_EXPORT XF86ModuleData vmwareModuleData = {
     NULL
 };
 
+extern XF86ModuleData *VMWGFX_MODULE_DATA;
 
 /*
  * Chain loading functions
@@ -79,9 +83,13 @@ vmware_check_kernel_module()
     /* Super simple way of knowing if the kernel driver is loaded */
     int ret = drmOpen(VMWGFX_MODULE_NAME, NULL);
     if (ret < 0) {
-	fprintf(stderr,
-		"%s: Please ignore above \"FATAL: Module %s not found.\"\n",
-		VMWARE_DRIVER_NAME, VMWGFX_MODULE_NAME);
+	/* This shouldn't go in the log as the original message does not */
+	fprintf(stderr, "%s: Please ignore above \"FATAL: Module %s not found."
+		"\"\n", VMWARE_DRIVER_NAME, VMWGFX_MODULE_NAME);
+	/* This is what goes into the log on the other hand */
+	xf86DrvMsg(-1, X_PROBED, "%s: Please ignore above \"[drm] failed to "
+		   "load kernel  module \"%s\"\"\n", VMWARE_DRIVER_NAME,
+		   VMWGFX_MODULE_NAME);
 	return FALSE;
     }
 
@@ -91,6 +99,51 @@ vmware_check_kernel_module()
 }
 
 static Bool
+vmware_check_vmwgfx_driver(int matched, pointer opts)
+{
+    int major; int minor;
+    pointer module;
+    CARD32 version;
+
+    if (matched) {
+	xf86DrvMsg(-1, X_PROBED, "%s: X configured to use %s X driver assume "
+		   "who ever did that knows what they are doing\n",
+		   VMWARE_DRIVER_NAME, VMWGFX_DRIVER_NAME);
+	/* Also how did they end up here, if the configured X to use vmwgfx and
+	 * X should load that driver for that hardware. And since there is only
+	 * one SVGA device this driver shouldn't be loaded. Weird...
+	 */
+	return TRUE;
+    }
+
+    module = xf86LoadOneModule(VMWGFX_DRIVER_NAME, opts);
+    if (!module) {
+	xf86DrvMsg(-1, X_ERROR, "%s: Please ignore the above warnings about "
+		   "not being able to to load module/driver %s\n",
+		   VMWARE_DRIVER_NAME, VMWGFX_DRIVER_NAME);
+	return FALSE;
+    }
+
+    version = xf86GetModuleVersion(module);
+    major = GET_MODULE_MAJOR_VERSION(version);
+    minor = GET_MODULE_MINOR_VERSION(version);
+
+    if (major > VMWGFX_COMPAT_MAJOR ||
+	major < VMWGFX_REQUIRED_MAJOR ||
+	(major == VMWGFX_REQUIRED_MAJOR && minor < VMWGFX_REQUIRED_MINOR)) {
+	xf86DrvMsg(-1, X_PROBED, "%s: The %s X driver failed version "
+		   "checking.\n", VMWARE_DRIVER_NAME, VMWGFX_DRIVER_NAME);
+	goto err;
+    }
+
+    return TRUE;
+
+err:
+    /* XXX We should drop the reference on the module here */
+    return FALSE;
+}
+
+static Bool
 vmware_chain_module(pointer opts)
 {
     int vmwlegacy_devices;
@@ -106,10 +159,15 @@ vmware_chain_module(pointer opts)
     vmwgfx_devices = xf86MatchDevice(VMWGFX_DRIVER_NAME, NULL);
     vmwlegacy_devices = xf86MatchDevice(VMWLEGACY_DRIVER_NAME, NULL);
 
-    if (vmware_check_kernel_module()) {
+    if (vmware_check_vmwgfx_driver(vmwgfx_devices, opts) &&
+	vmware_check_kernel_module()) {
+	xf86DrvMsg(-1, X_INFO, "%s: Using %s X driver.\n",
+		   VMWARE_DRIVER_NAME, VMWGFX_DRIVER_NAME);
 	driver_name = VMWGFX_DRIVER_NAME;
-	matched = vmwgfx_devices;
+	matched = 1;
     } else {
+	xf86DrvMsg(-1, X_INFO, "%s: Using %s driver everything is fine.\n",
+		   VMWARE_DRIVER_NAME, VMWLEGACY_DRIVER_NAME);
 	driver_name = VMWLEGACY_DRIVER_NAME;
 	matched = vmwlegacy_devices;
     }

commit bf18be6f458a4612b2ebdd8d2b5894f8884891e4
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Tue Mar 9 16:10:25 2010 +0100

    fix a cursor refcounting bug, leading to segfaults
    
    this is similar to what xf86_use_hw_cursor() does, which is replaced by
    vmwareUseHWCursor (otherwise, the refcount could reach zero and hence the
    cursor deallocated while xf86CursorEnableDisableFBAccess() could still bring
    it back to life from the saved cursor).
    It is probably insane to do refcounting here, but this needs a xserver fix,
    and even if that's fixed this fix here shouldn't hurt (though would be
    unnecessary).

diff --git a/src/vmware.h b/src/vmware.h
index afefd7f..a3920ab 100644
--- a/src/vmware.h
+++ b/src/vmware.h
@@ -132,6 +132,7 @@ typedef struct {
     CARD32* vmwareFIFO;
 
     xf86CursorInfoPtr CursorInfoRec;
+    CursorPtr oldCurs;
     struct {
         int bg, fg, x, y;
         int hotX, hotY;
diff --git a/src/vmwarecurs.c b/src/vmwarecurs.c
index 017af28..38c5988 100644
--- a/src/vmwarecurs.c
+++ b/src/vmwarecurs.c
@@ -113,6 +113,12 @@ vmwareUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
 {
     ScrnInfoPtr pScrn = infoFromScreen(pScreen);
     VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+    VmwareLog(("UseHWCursor new cursor %p refcnt %i old cursor %p refcnt %i\n",
+              pCurs, pCurs->refcnt, pVMWARE->oldCurs, pVMWARE->oldCurs ? pVMWARE->oldCurs->refcnt : 0));
+    pCurs->refcnt++;
+    if (pVMWARE->oldCurs)
+       FreeCursor(pVMWARE->oldCurs, None);
+    pVMWARE->oldCurs = pCurs;
 
     pVMWARE->hwcur.hotX = pCurs->bits->xhot;
     pVMWARE->hwcur.hotY = pCurs->bits->yhot;
@@ -141,6 +147,13 @@ static Bool
 vmwareUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
 {
     ScrnInfoPtr pScrn = infoFromScreen(pScreen);
+    VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+    VmwareLog(("UseHWCursorARGB new cursor %p refcnt %i old cursor %p refcnt %i\n",
+              pCurs, pCurs->refcnt, pVMWARE->oldCurs, pVMWARE->oldCurs ? pVMWARE->oldCurs->refcnt : 0));
+    pCurs->refcnt++;
+    if (pVMWARE->oldCurs)
+       FreeCursor(pVMWARE->oldCurs, None);
+    pVMWARE->oldCurs = pCurs;
 
     return pCurs->bits->height <= MAX_CURS &&
            pCurs->bits->width <= MAX_CURS &&
@@ -286,6 +299,7 @@ vmwareCursorInit(ScreenPtr pScreen)
         return FALSE;
 
     pVMWARE->CursorInfoRec = infoPtr;
+    pVMWARE->oldCurs = NULL;
 
     infoPtr->MaxWidth = MAX_CURS;
     infoPtr->MaxHeight = MAX_CURS;
@@ -332,6 +346,9 @@ vmwareCursorCloseScreen(ScreenPtr pScreen)
 #endif /* RENDER */
 
     vmwareHideCursor(pScrn);
+    if (pVMWARE->oldCurs)
+       FreeCursor(pVMWARE->oldCurs, None);
+    pVMWARE->oldCurs = NULL;
     xf86DestroyCursorInfoRec(pVMWARE->CursorInfoRec);
 }
 

commit 257614ae9bea54d6a46e4477496500a84853ee37
Author: Roland Scheidegger <sroland@vmware.com>
Date:   Tue Mar 9 16:03:59 2010 +0100

    make DEBUG_LOGGING compile

diff --git a/src/vmware.h b/src/vmware.h
index 31560b5..afefd7f 100644
--- a/src/vmware.h
+++ b/src/vmware.h
@@ -204,7 +204,7 @@ static __inline ScrnInfoPtr infoFromScreen(ScreenPtr s) {
 /*#define DEBUG_LOGGING*/
 #ifdef DEBUG_LOGGING
 # define VmwareLog(args) ErrorF args
-# define TRACEPOINT VmwareLog((__FUNCTION__ ":" __FILE__ "\n"));
+# define TRACEPOINT VmwareLog(("%s : %s\n", __FUNCTION__, __FILE__));
 #else
 # define VmwareLog(args)
 # define TRACEPOINT

commit 29f6a2dca3e680908e938767256c9b995653ca7f
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Sun Mar 7 15:02:39 2010 +0000

    Print text about none fatal error message with Fatal in it

diff --git a/src/vmwaremodule.c b/src/vmwaremodule.c
index c512559..5b7d289 100644
--- a/src/vmwaremodule.c
+++ b/src/vmwaremodule.c
@@ -37,6 +37,7 @@
 
 #define VMWARE_DRIVER_NAME    "vmware"
 #define VMWGFX_DRIVER_NAME    "vmwgfx"
+#define VMWGFX_MODULE_NAME    "vmwgfx"
 #define VMWLEGACY_DRIVER_NAME "vmwlegacy"
 
 #define VMW_STRING_INNER(s) #s
@@ -76,9 +77,13 @@ static Bool
 vmware_check_kernel_module()
 {
     /* Super simple way of knowing if the kernel driver is loaded */
-    int ret = drmOpen("vmwgfx", NULL);
-    if (ret < 0)
+    int ret = drmOpen(VMWGFX_MODULE_NAME, NULL);
+    if (ret < 0) {
+	fprintf(stderr,
+		"%s: Please ignore above \"FATAL: Module %s not found.\"\n",
+		VMWARE_DRIVER_NAME, VMWGFX_MODULE_NAME);
 	return FALSE;
+    }
 
     drmClose(ret);
 

commit 204504861a2847734a04bd976accb0c730733523
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Fri Feb 26 16:27:17 2010 +0100

    Don't hardcode the module version in the source
    
    As pointed out by Julien Cristau XORG_RELEASE_VERSION
    gives us that info from configure.ac.
    
    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/src/vmware.c b/src/vmware.c
index 426cb64..5e683da 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -83,14 +83,11 @@ char rcsId_vmware[] =
 
 #define VMWARE_NAME "vmwlegacy"
 #define VMWARE_DRIVER_NAME "vmwlegacy"
-#define VMWARE_MAJOR_VERSION	11
-#define VMWARE_MINOR_VERSION	0
-#define VMWARE_PATCHLEVEL	0
 #define VMWARE_DRIVER_VERSION \
-   (VMWARE_MAJOR_VERSION * 65536 + VMWARE_MINOR_VERSION * 256 + VMWARE_PATCHLEVEL)
+   (PACKAGE_VERSION_MAJOR * 65536 + PACKAGE_VERSION_MINOR * 256 + PACKAGE_VERSION_PATCHLEVEL)
 #define VMWARE_DRIVER_VERSION_STRING \
-    VMW_STRING(VMWARE_MAJOR_VERSION) "." VMW_STRING(VMWARE_MINOR_VERSION) \
-    "." VMW_STRING(VMWARE_PATCHLEVEL)
+    VMW_STRING(PACKAGE_VERSION_MAJOR) "." VMW_STRING(PACKAGE_VERSION_MINOR) \
+    "." VMW_STRING(PACKAGE_VERSION_PATCHLEVEL)
 
 static const char VMWAREBuildStr[] = "VMware Guest X Server "
     VMWARE_DRIVER_VERSION_STRING " - build=$Name$\n";
@@ -194,7 +191,7 @@ static XF86ModuleVersionInfo vmwlegacyVersRec = {
     MODINFOSTRING1,
     MODINFOSTRING2,
     XORG_VERSION_CURRENT,
-    VMWARE_MAJOR_VERSION, VMWARE_MINOR_VERSION, VMWARE_PATCHLEVEL,
+    PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL,
     ABI_CLASS_VIDEODRV,
     ABI_VIDEODRV_VERSION,
     MOD_CLASS_VIDEODRV,
diff --git a/src/vmwaremodule.c b/src/vmwaremodule.c
index d46d26d..c512559 100644
--- a/src/vmwaremodule.c
+++ b/src/vmwaremodule.c
@@ -27,6 +27,9 @@
 #include <xf86.h>
 #include <xf86drm.h>
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 /*
  * Defines and exported module info.
@@ -39,18 +42,11 @@
 #define VMW_STRING_INNER(s) #s
 #define VMW_STRING(str) VMW_STRING_INNER(str)
 
-#define VMWARE_VERSION_MAJOR 11
-#define VMWARE_VERSION_MINOR 0
-#define VMWARE_VERSION_PATCH 0
-#define VMWARE_VERSION_STRING_MAJOR VMW_STRING(VMWARE_VERSION_MAJOR)
-#define VMWARE_VERSION_STRING_MINOR VMW_STRING(VMWARE_VERSION_MINOR)
-#define VMWARE_VERSION_STRING_PATCH VMW_STRING(VMWARE_VERSION_PATCH)
-
 #define VMWARE_DRIVER_VERSION \
-   (VMWARE_VERSION_MAJOR * 65536 + VMWARE_VERSION_MINOR * 256 + VMWARE_VERSION_PATCH)
+   (PACKAGE_VERSION_MAJOR * 65536 + PACKAGE_VERSION_MINOR * 256 + PACKAGE_VERSION_PATCHLEVEL)
 #define VMWARE_DRIVER_VERSION_STRING \
-    VMWARE_VERSION_STRING_MAJOR "." VMWARE_VERSION_STRING_MINOR \
-    "." VMWARE_VERSION_STRING_PATCH
+    VMW_STRING(PACKAGE_VERSION_MAJOR) "." VMW_STRING(PACKAGE_VERSION_MINOR) \
+    "." VMW_STRING(PACKAGE_VERSION_PATCHLEVEL)
 
 /*
  * Standard four digit version string expected by VMware Tools installer.
@@ -135,7 +131,7 @@ static XF86ModuleVersionInfo vmware_version = {
     MODINFOSTRING1,
     MODINFOSTRING2,
     XORG_VERSION_CURRENT,
-    VMWARE_VERSION_MAJOR, VMWARE_VERSION_MINOR, VMWARE_VERSION_PATCH,
+    PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL,
     ABI_CLASS_VIDEODRV,
     ABI_VIDEODRV_VERSION,
     MOD_CLASS_VIDEODRV,

commit 667263d9410bd0d5832cf08a2a28841fe6326b84
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Thu Feb 18 14:11:32 2010 +0100

    Bump major for new chainloading driver

diff --git a/configure.ac b/configure.ac
index 9099398..ab54623 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-vmware],
-        10.16.9,
+        11.0.0,
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         xf86-video-vmware)
 
diff --git a/src/vmware.c b/src/vmware.c
index 87a4c2b..426cb64 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -83,9 +83,9 @@ char rcsId_vmware[] =
 
 #define VMWARE_NAME "vmwlegacy"
 #define VMWARE_DRIVER_NAME "vmwlegacy"
-#define VMWARE_MAJOR_VERSION	10
-#define VMWARE_MINOR_VERSION	16
-#define VMWARE_PATCHLEVEL	9
+#define VMWARE_MAJOR_VERSION	11
+#define VMWARE_MINOR_VERSION	0
+#define VMWARE_PATCHLEVEL	0
 #define VMWARE_DRIVER_VERSION \
    (VMWARE_MAJOR_VERSION * 65536 + VMWARE_MINOR_VERSION * 256 + VMWARE_PATCHLEVEL)
 #define VMWARE_DRIVER_VERSION_STRING \
diff --git a/src/vmwaremodule.c b/src/vmwaremodule.c
index 81081fa..d46d26d 100644
--- a/src/vmwaremodule.c
+++ b/src/vmwaremodule.c
@@ -39,9 +39,9 @@
 #define VMW_STRING_INNER(s) #s
 #define VMW_STRING(str) VMW_STRING_INNER(str)
 
-#define VMWARE_VERSION_MAJOR 10
-#define VMWARE_VERSION_MINOR 16
-#define VMWARE_VERSION_PATCH 9
+#define VMWARE_VERSION_MAJOR 11
+#define VMWARE_VERSION_MINOR 0
+#define VMWARE_VERSION_PATCH 0
 #define VMWARE_VERSION_STRING_MAJOR VMW_STRING(VMWARE_VERSION_MAJOR)
 #define VMWARE_VERSION_STRING_MINOR VMW_STRING(VMWARE_VERSION_MINOR)
 #define VMWARE_VERSION_STRING_PATCH VMW_STRING(VMWARE_VERSION_PATCH)

commit 048fe839f0d761aeba95c324f14bdc5488e9e634
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Mon Feb 22 13:20:06 2010 +0100

    Link to drm but on for the vmware chainloader driver

diff --git a/src/Makefile.am b/src/Makefile.am
index 17677f7..0b74eca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,10 +23,10 @@
 # -avoid-version prevents gratuitous .0.0.0 version numbers on the end
 # _ladir passes a dummy rpath to libtool so the thing will actually link
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
-AM_CFLAGS = @XORG_CFLAGS@ @DRM_CFLAGS@
 
 vmwlegacy_drv_la_LTLIBRARIES = vmwlegacy_drv.la
 vmwlegacy_drv_la_LDFLAGS = -module -avoid-version
+vmwlegacy_drv_la_CFLAGS = @XORG_CFLAGS@
 vmwlegacy_drv_ladir = @moduledir@/drivers
 
 vmwlegacy_drv_la_SOURCES = \
@@ -54,6 +54,8 @@ vmwlegacy_drv_la_SOURCES = \
 
 vmware_drv_la_LTLIBRARIES = vmware_drv.la
 vmware_drv_la_LDFLAGS = -module -avoid-version
+vmware_drv_la_CFLAGS = @XORG_CFLAGS@ @DRM_CFLAGS@
+vmware_drv_la_LIBADD = @DRM_LIBS@
 vmware_drv_ladir = @moduledir@/drivers
 
 vmware_drv_la_SOURCES = \

commit 30964ffa31f4fdbffe563b7d7d20bfbf1ed22969
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Thu Feb 18 15:20:31 2010 +0100

    Make sure that modinfo strings are unique

diff --git a/src/vmware.c b/src/vmware.c
index 0785456..87a4c2b 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -101,7 +101,7 @@ static const char VMWAREBuildStr[] = "VMware Guest X Server "
  * extra zero for the fourth digit.
  */
 #ifdef __GNUC__
-const char vm_svga_version[] __attribute__((section(".modinfo"),unused)) =
+const char vmwlegacy_drv_modinfo[] __attribute__((section(".modinfo"),unused)) =
     "version=" VMWARE_DRIVER_VERSION_STRING ".0";
 #endif
 
diff --git a/src/vmwaremodule.c b/src/vmwaremodule.c
index a311c53..81081fa 100644
--- a/src/vmwaremodule.c
+++ b/src/vmwaremodule.c
@@ -58,7 +58,7 @@
  * extra zero for the fourth digit.
  */
 #ifdef __GNUC__
-const char vmware_modinfo[] __attribute__((section(".modinfo"),unused)) =
+const char vmware_drv_modinfo[] __attribute__((section(".modinfo"),unused)) =
     "version=" VMWARE_DRIVER_VERSION_STRING ".0";
 #endif
 

commit 0f2b02d72e36dc6390c09d6adba13e4101bf3df8
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Thu Feb 11 23:18:37 2010 +0100

    Add modinfo for vmware_drv.so

diff --git a/src/vmwaremodule.c b/src/vmwaremodule.c
index 826310b..a311c53 100644
--- a/src/vmwaremodule.c
+++ b/src/vmwaremodule.c
@@ -36,9 +36,31 @@
 #define VMWGFX_DRIVER_NAME    "vmwgfx"
 #define VMWLEGACY_DRIVER_NAME "vmwlegacy"
 
+#define VMW_STRING_INNER(s) #s
+#define VMW_STRING(str) VMW_STRING_INNER(str)
+
 #define VMWARE_VERSION_MAJOR 10
 #define VMWARE_VERSION_MINOR 16
 #define VMWARE_VERSION_PATCH 9
+#define VMWARE_VERSION_STRING_MAJOR VMW_STRING(VMWARE_VERSION_MAJOR)
+#define VMWARE_VERSION_STRING_MINOR VMW_STRING(VMWARE_VERSION_MINOR)
+#define VMWARE_VERSION_STRING_PATCH VMW_STRING(VMWARE_VERSION_PATCH)
+
+#define VMWARE_DRIVER_VERSION \
+   (VMWARE_VERSION_MAJOR * 65536 + VMWARE_VERSION_MINOR * 256 + VMWARE_VERSION_PATCH)
+#define VMWARE_DRIVER_VERSION_STRING \
+    VMWARE_VERSION_STRING_MAJOR "." VMWARE_VERSION_STRING_MINOR \
+    "." VMWARE_VERSION_STRING_PATCH
+
+/*
+ * Standard four digit version string expected by VMware Tools installer.
+ * As the driver's version is only  {major, minor, patchlevel}, simply append an
+ * extra zero for the fourth digit.
+ */
+#ifdef __GNUC__
+const char vmware_modinfo[] __attribute__((section(".modinfo"),unused)) =
+    "version=" VMWARE_DRIVER_VERSION_STRING ".0";
+#endif
 
 static XF86ModuleVersionInfo vmware_version;
 static MODULESETUPPROTO(vmware_setup);

commit c4f5bf8ea45b80c2ac4a5eec65ff58f148fb2807
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Thu Feb 11 22:04:53 2010 +0100

    Add a chain loading module to load new vmwgfx driver if kernel module is loaded

diff --git a/configure.ac b/configure.ac
index 0f13a9e..9099398 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto)
 
 # Checks for pkg-config packages
 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1 xproto fontsproto $REQUIRED_MODULES])
+PKG_CHECK_MODULES(DRM, [libdrm])
 
 PKG_CHECK_EXISTS([xorg-server >= 1.1.0],
                  [AC_DEFINE([HAVE_XORG_SERVER_1_1_0], 1,
diff --git a/src/Makefile.am b/src/Makefile.am
index 48ec1b0..17677f7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,31 +23,38 @@
 # -avoid-version prevents gratuitous .0.0.0 version numbers on the end
 # _ladir passes a dummy rpath to libtool so the thing will actually link
 # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
-AM_CFLAGS = @XORG_CFLAGS@
+AM_CFLAGS = @XORG_CFLAGS@ @DRM_CFLAGS@
+
+vmwlegacy_drv_la_LTLIBRARIES = vmwlegacy_drv.la
+vmwlegacy_drv_la_LDFLAGS = -module -avoid-version
+vmwlegacy_drv_ladir = @moduledir@/drivers
+
+vmwlegacy_drv_la_SOURCES = \
+	bits2pixels.c \
+	bits2pixels.h \
+	guest_os.h \
+	includeCheck.h \
+	svga_escape.h \
+	svga_limits.h \
+	svga_modes.h \
+	svga_overlay.h \
+	svga_reg.h \
+	svga_struct.h \
+	vm_basic_types.h \
+	vm_device_version.h \
+	vmware.c \
+	vmwarecurs.c \
+	vmware.h \
+	vmwarectrl.c \
+	vmwarectrl.h \
+	vmwarectrlproto.h \
+	vmwarexinerama.c \
+	vmwarevideo.c \
+	vmwaremodes.c
+
 vmware_drv_la_LTLIBRARIES = vmware_drv.la
 vmware_drv_la_LDFLAGS = -module -avoid-version
 vmware_drv_ladir = @moduledir@/drivers
 
 vmware_drv_la_SOURCES = \
-         bits2pixels.c \
-         bits2pixels.h \
-         guest_os.h \
-         includeCheck.h \
-	 svga_escape.h \
-         svga_limits.h \
-         svga_modes.h \
-	 svga_overlay.h \
-         svga_reg.h \
-         svga_struct.h \
-         vm_basic_types.h \
-         vm_device_version.h \
-         vmware.c \
-         vmwarecurs.c \
-         vmware.h \
-         vmwarectrl.c \
-         vmwarectrl.h \
-         vmwarectrlproto.h \
-         vmwarexinerama.c \
-         vmwarevideo.c \
-         vmwaremodes.c
-
+	vmwaremodule.c
diff --git a/src/vmware.c b/src/vmware.c
index bae2d56..0785456 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -81,8 +81,8 @@ char rcsId_vmware[] =
 #define VMW_INNERSTRINGIFY(s) #s
 #define VMW_STRING(str) VMW_INNERSTRINGIFY(str)
 
-#define VMWARE_NAME "VMWARE"
-#define VMWARE_DRIVER_NAME "vmware"
+#define VMWARE_NAME "vmwlegacy"
+#define VMWARE_DRIVER_NAME "vmwlegacy"
 #define VMWARE_MAJOR_VERSION	10
 #define VMWARE_MINOR_VERSION	16
 #define VMWARE_PATCHLEVEL	9
@@ -188,8 +188,8 @@ static const char *shadowfbSymbols[] = {
 #endif /* HAVE_XORG_SERVER_1_7_0 */
 
 #ifdef XFree86LOADER
-static XF86ModuleVersionInfo vmwareVersRec = {
-    "vmware",
+static XF86ModuleVersionInfo vmwlegacyVersRec = {
+    VMWARE_DRIVER_NAME,
     MODULEVENDORSTRING,
     MODINFOSTRING1,
     MODINFOSTRING2,
@@ -2021,7 +2021,7 @@ VMWAREProbe(DriverPtr drv, int flags)
 #endif
 
 
-_X_EXPORT DriverRec VMWARE = {
+_X_EXPORT DriverRec vmwlegacy = {
     VMWARE_DRIVER_VERSION,
     VMWARE_DRIVER_NAME,
     VMWAREIdentify,
@@ -2043,22 +2043,23 @@ _X_EXPORT DriverRec VMWARE = {
 };
 
 #ifdef XFree86LOADER
-static MODULESETUPPROTO(vmwareSetup);
+static MODULESETUPPROTO(vmwlegacySetup);
 
-_X_EXPORT XF86ModuleData vmwareModuleData = {
-    &vmwareVersRec,
-    vmwareSetup,
+_X_EXPORT XF86ModuleData vmwlegacyModuleData = {
+    &vmwlegacyVersRec,
+    vmwlegacySetup,
     NULL
 };
 
 static pointer
-vmwareSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+vmwlegacySetup(pointer module, pointer opts, int *errmaj, int *errmin)
 {
     static Bool setupDone = FALSE;
 
     if (!setupDone) {
         setupDone = TRUE;
-        xf86AddDriver(&VMWARE, module, VMWARE_DRIVER_FUNC);
+
+        xf86AddDriver(&vmwlegacy, module, VMWARE_DRIVER_FUNC);
 
         LoaderRefSymLists(vgahwSymbols, fbSymbols, ramdacSymbols,
                           shadowfbSymbols, NULL);
diff --git a/src/vmwaremodule.c b/src/vmwaremodule.c
new file mode 100644
index 0000000..826310b
--- /dev/null
+++ b/src/vmwaremodule.c
@@ -0,0 +1,142 @@
+/**********************************************************
+ * Copyright 2010 VMware, Inc.  All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+#include <xorg-server.h>
+#include <xf86.h>
+#include <xf86drm.h>
+
+
+/*
+ * Defines and exported module info.
+ */
+
+#define VMWARE_DRIVER_NAME    "vmware"
+#define VMWGFX_DRIVER_NAME    "vmwgfx"
+#define VMWLEGACY_DRIVER_NAME "vmwlegacy"
+
+#define VMWARE_VERSION_MAJOR 10
+#define VMWARE_VERSION_MINOR 16
+#define VMWARE_VERSION_PATCH 9
+
+static XF86ModuleVersionInfo vmware_version;
+static MODULESETUPPROTO(vmware_setup);
+
+_X_EXPORT XF86ModuleData vmwareModuleData = {
+    &vmware_version,
+    vmware_setup,
+    NULL
+};
+
+
+/*
+ * Chain loading functions
+ */
+
+static Bool
+vmware_check_kernel_module()
+{
+    /* Super simple way of knowing if the kernel driver is loaded */
+    int ret = drmOpen("vmwgfx", NULL);
+    if (ret < 0)
+	return FALSE;
+
+    drmClose(ret);
+
+    return TRUE;
+}
+
+static Bool
+vmware_chain_module(pointer opts)
+{
+    int vmwlegacy_devices;
+    int vmwgfx_devices;
+    int vmware_devices;
+    int matched;
+    char *driver_name;
+    GDevPtr *gdevs;
+    GDevPtr gdev;
+    int i;
+
+    vmware_devices = xf86MatchDevice(VMWARE_DRIVER_NAME, &gdevs);
+    vmwgfx_devices = xf86MatchDevice(VMWGFX_DRIVER_NAME, NULL);
+    vmwlegacy_devices = xf86MatchDevice(VMWLEGACY_DRIVER_NAME, NULL);
+
+    if (vmware_check_kernel_module()) {
+	driver_name = VMWGFX_DRIVER_NAME;
+	matched = vmwgfx_devices;
+    } else {
+	driver_name = VMWLEGACY_DRIVER_NAME;
+	matched = vmwlegacy_devices;
+    }
+
+    for (i = 0; i < vmware_devices; i++) {
+	gdev = gdevs[i];
+	gdev->driver = driver_name;
+    }
+
+    xfree(gdevs);
+
+    if (!matched)
+	xf86LoadOneModule(driver_name, opts);
+}
+
+
+/*
+ * Module info
+ */
+
+static XF86ModuleVersionInfo vmware_version = {
+    VMWARE_DRIVER_NAME,
+    MODULEVENDORSTRING,
+    MODINFOSTRING1,
+    MODINFOSTRING2,
+    XORG_VERSION_CURRENT,
+    VMWARE_VERSION_MAJOR, VMWARE_VERSION_MINOR, VMWARE_VERSION_PATCH,
+    ABI_CLASS_VIDEODRV,
+    ABI_VIDEODRV_VERSION,
+    MOD_CLASS_VIDEODRV,
+    {0, 0, 0, 0}
+};
+
+static pointer
+vmware_setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+    static Bool setupDone = 0;
+    int ret;
+
+    /* This module should be loaded only once, but check to be sure. */
+    if (!setupDone) {
+	setupDone = 1;
+
+	/* Chain load the real driver */
+	vmware_chain_module(opts);
+
+	return (pointer) 1;
+    } else {
+	if (errmaj)
+	    *errmaj = LDR_ONCEONLY;
+	return NULL;
+    }
+}

commit 0d9d1724dbe113dcc02736a8ca80ab540057cb5e
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Fri Jan 15 14:13:42 2010 -0800

    Update Sun license notices to current X.Org standard form
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>

diff --git a/man/Makefile.am b/man/Makefile.am
index f0eb29b..8f2454b 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,27 +1,24 @@
 #
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-# 
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation.
-# 
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-# 
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-# 
-# Except as contained in this notice, the name of the copyright holders shall
-# not be used in advertising or otherwise to promote the sale, use or
-# other dealings in this Software without prior written authorization
-# from the copyright holders.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
 # 
 
 drivermandir = $(DRIVER_MAN_DIR)

commit e0d370ae5f307d96e9dd9384cc0ea66a0f6c06c1
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Tue Dec 15 22:01:02 2009 -0500

    configure.ac: remove unused sdkdir=$(pkg-config...) statement
    
    The sdkdir variable isn't use, so remove the statement.
    
    Acked-by: Dan Nicholson <dbn.lists@gmail.com>
    
    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>

diff --git a/configure.ac b/configure.ac
index 4940e17..0f13a9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,7 +62,6 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto)
 
 # Checks for pkg-config packages
 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1 xproto fontsproto $REQUIRED_MODULES])
-sdkdir=$(pkg-config --variable=sdkdir xorg-server)
 
 PKG_CHECK_EXISTS([xorg-server >= 1.1.0],
                  [AC_DEFINE([HAVE_XORG_SERVER_1_1_0], 1,


Reply to: