Module Name: xsrc
Committed By: mrg
Date: Sat Nov 20 21:59:13 UTC 2010
Modified Files:
xsrc/external/mit/xf86-video-vmware/dist/src: vmwaremodule.c
Log Message:
merge xf86-video-vmware 11.0.3
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xf86-video-vmware/dist/src/vmwaremodule.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/xf86-video-vmware/dist/src/vmwaremodule.c
diff -u xsrc/external/mit/xf86-video-vmware/dist/src/vmwaremodule.c:1.4 xsrc/external/mit/xf86-video-vmware/dist/src/vmwaremodule.c:1.5
--- xsrc/external/mit/xf86-video-vmware/dist/src/vmwaremodule.c:1.4 Sat Aug 14 08:44:02 2010
+++ xsrc/external/mit/xf86-video-vmware/dist/src/vmwaremodule.c Sat Nov 20 21:59:13 2010
@@ -25,13 +25,21 @@
#include <xorg-server.h>
#include <xf86.h>
-#include <xf86drm.h>
#undef PACKAGE /* XXX MRG */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#ifdef HAVE_LIBDRM
+#include <xf86drm.h>
+#endif
+
+#ifndef HAVE_XORG_SERVER_1_5_0
+#include <xf86_ansic.h>
+#include <xf86_libc.h>
+#endif
+
/*
* Defines and exported module info.
*/
@@ -55,12 +63,19 @@
/*
* 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.
+ * As the driver's version is only {major, minor, patchlevel},
+ * the fourth digit may describe the commit number relative to the
+ * last version tag as output from `git describe`
*/
+
#ifdef __GNUC__
+#ifdef VMW_SUBPATCH
const char vmware_drv_modinfo[] __attribute__((section(".modinfo"),unused)) =
- "version=" VMWARE_DRIVER_VERSION_STRING ".0";
+ "version=" VMWARE_DRIVER_VERSION_STRING "." VMW_STRING(VMW_SUBPATCH);
+#else
+const char vmware_drv_modinfo[] __attribute__((section(".modinfo"),unused)) =
+ "version=" VMWARE_DRIVER_VERSION_STRING ".0";
+#endif /*VMW_SUBPATCH*/
#endif
static XF86ModuleVersionInfo vmware_version;
@@ -81,6 +96,7 @@
static Bool
vmware_check_kernel_module()
{
+#ifdef HAVE_LIBDRM
/* Super simple way of knowing if the kernel driver is loaded */
int ret = drmOpen(VMWGFX_MODULE_NAME, NULL);
if (ret < 0) {
@@ -97,11 +113,15 @@
drmClose(ret);
return TRUE;
+#else
+ return FALSE;
+#endif /* HAVE_LIBDRM */
}
static Bool
vmware_check_vmwgfx_driver(int matched, pointer opts)
{
+#ifdef HAVE_LIBDRM
int major; int minor;
pointer module;
CARD32 version;
@@ -141,10 +161,11 @@
err:
/* XXX We should drop the reference on the module here */
+#endif /* HAVE_LIBDRM */
return FALSE;
}
-static void
+static Bool
vmware_chain_module(pointer opts)
{
int vmwlegacy_devices;
@@ -155,6 +176,7 @@
GDevPtr *gdevs = NULL;
GDevPtr gdev;
int i;
+ pointer ret;
vmware_devices = xf86MatchDevice(VMWARE_DRIVER_NAME, &gdevs);
vmwgfx_devices = xf86MatchDevice(VMWGFX_DRIVER_NAME, NULL);
@@ -179,10 +201,18 @@
gdev->driver = driver_name;
}
- xfree(gdevs);
+ free(gdevs);
- if (!matched)
- xf86LoadOneModule(driver_name, opts);
+ if (!matched) {
+ if (xf86LoadOneModule(driver_name, opts) == NULL) {
+ xf86DrvMsg(-1, X_ERROR, "%s: Unexpected failure while "
+ "loading the \"%s\" driver. Giving up.\n",
+ VMWARE_DRIVER_NAME, driver_name);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
}
@@ -213,9 +243,13 @@
setupDone = 1;
/* Chain load the real driver */
- vmware_chain_module(opts);
-
- return (pointer) 1;
+ if (vmware_chain_module(opts))
+ return (pointer) 1;
+ else {
+ if (errmaj)
+ *errmaj = LDR_NOSUBENT;
+ return NULL;
+ }
} else {
if (errmaj)
*errmaj = LDR_ONCEONLY;