diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2011-11-22 19:56:20 +0100 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2011-11-25 16:56:11 +0100 |
commit | 1c77e3d7434f04c59233ce7e497a949e386e1630 (patch) | |
tree | 09dc18a038b7b4c6cd2395cf10f6f3a117942cd6 | |
parent | 2aa256c96496ed6dd9dbd5880c278f4422500b0f (diff) |
vmware: Hook up vmwgfx to be tried before falling back to legacy
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 18 | ||||
-rw-r--r-- | src/Makefile.am | 21 | ||||
-rw-r--r-- | src/vmware_bootstrap.c | 65 | ||||
-rw-r--r-- | src/vmware_bootstrap.h | 10 | ||||
-rw-r--r-- | src/vmwaremodule.c | 256 | ||||
-rw-r--r-- | vmwgfx/Makefile.am | 11 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_bootstrap.c | 199 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_dri2.c | 2 | ||||
-rw-r--r-- | vmwgfx/vmwgfx_driver.c | 50 |
10 files changed, 93 insertions, 541 deletions
diff --git a/Makefile.am b/Makefile.am index 3208a23..1203715 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,7 +18,7 @@ # 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. -SUBDIRS = src man vmwarectrl @VMWGFX_DIRS@ +SUBDIRS = @VMWGFX_DIRS@ src man vmwarectrl MAINTAINERCLEANFILES = ChangeLog INSTALL .PHONY: ChangeLog INSTALL diff --git a/configure.ac b/configure.ac index 2c4f959..9af67a4 100644 --- a/configure.ac +++ b/configure.ac @@ -72,11 +72,6 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto) # Obtain compiler/linker options for the driver dependencies PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1 xproto fontsproto $REQUIRED_MODULES]) -PKG_CHECK_MODULES(LIBDRM, - [libdrm], - [AC_DEFINE([HAVE_LIBDRM], 1, [Has libdrm])], - [echo "Will not try support for 3D or kernel modesetting."]) - 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])]) @@ -115,27 +110,34 @@ AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes) AC_SUBST([moduledir]) if test x$BUILD_VMWGFX = xyes; then + PKG_CHECK_MODULES([LIBDRM], [libdrm],[],[BUILD_VMWGFX=no]) +fi +if test x$BUILD_VMWGFX = xyes; then PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0],[],[BUILD_VMWGFX=no]) fi DRIVER_NAME=vmware AC_SUBST([DRIVER_NAME]) - +AC_MSG_CHECKING([whether to build Kernel Mode Setting and 3D]) VMWGFX_DIRS= if test x$BUILD_VMWGFX = xyes; then + AC_MSG_RESULT([yes]) AC_SYS_LARGEFILE VMWGFX_DIRS="saa vmwgfx" + VMWGFX_LIBADD='$(top_srcdir)/vmwgfx/libvmwgfx.la' AC_CONFIG_FILES([ saa/Makefile vmwgfx/Makefile ]) - echo "Will build the vmwgfx driver." + AC_DEFINE([BUILD_VMWGFX], 1, + [Building the vmwgfx driver path]) else - echo "Will not build the vmwgfx driver." + AC_MSG_RESULT([no]) fi AC_SUBST([VMWGFX_DIRS]) +AC_SUBST([VMWGFX_LIBADD]) AC_CONFIG_FILES([ Makefile src/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index c035757..60bc15a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,12 +24,13 @@ # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. -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 +vmware_drv_la_LTLIBRARIES = vmware_drv.la +vmware_drv_la_LDFLAGS = -module -avoid-version +vmware_drv_la_CFLAGS = @XORG_CFLAGS@ +vmware_drv_ladir = @moduledir@/drivers +vmware_drv_la_LIBADD = @VMWGFX_LIBADD@ -vmwlegacy_drv_la_SOURCES = \ +vmware_drv_la_SOURCES = \ bits2pixels.c \ bits2pixels.h \ guest_os.h \ @@ -51,13 +52,5 @@ vmwlegacy_drv_la_SOURCES = \ vmwarexinerama.c \ vmwarevideo.c \ vmwaremodes.c \ + vmware_bootstrap.h \ vmware_bootstrap.c - -vmware_drv_la_LTLIBRARIES = vmware_drv.la -vmware_drv_la_LDFLAGS = -module -avoid-version -vmware_drv_la_CFLAGS = @XORG_CFLAGS@ @LIBDRM_CFLAGS@ -vmware_drv_la_LIBADD = @LIBDRM_LIBS@ -vmware_drv_ladir = @moduledir@/drivers - -vmware_drv_la_SOURCES = \ - vmwaremodule.c diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c index 45f8cc2..92eb3c5 100644 --- a/src/vmware_bootstrap.c +++ b/src/vmware_bootstrap.c @@ -81,8 +81,8 @@ #define VMW_INNERSTRINGIFY(s) #s #define VMW_STRING(str) VMW_INNERSTRINGIFY(str) -#define VMWARE_NAME "vmwlegacy" -#define VMWARE_DRIVER_NAME "vmwlegacy" +#define VMWARE_NAME "vmware" +#define VMWARE_DRIVER_NAME "vmware" #define VMWARE_DRIVER_VERSION \ (PACKAGE_VERSION_MAJOR * 65536 + PACKAGE_VERSION_MINOR * 256 + PACKAGE_VERSION_PATCHLEVEL) #define VMWARE_DRIVER_VERSION_STRING \ @@ -101,11 +101,11 @@ static const char VMWAREBuildStr[] = "VMware Guest X Server " #ifdef __GNUC__ #ifdef VMW_SUBPATCH -const char vmwlegacy_drv_modinfo[] +const char vmware_drv_modinfo[] __attribute__((section(".modinfo"),unused)) = "version=" VMWARE_DRIVER_VERSION_STRING "." VMW_STRING(VMW_SUBPATCH); #else -const char vmwlegacy_drv_modinfo[] +const char vmware_drv_modinfo[] __attribute__((section(".modinfo"),unused)) = "version=" VMWARE_DRIVER_VERSION_STRING ".0"; #endif /*VMW_SUBPATCH*/ @@ -167,7 +167,7 @@ static SymTabRec VMWAREChipsets[] = { }; #ifdef XFree86LOADER -static XF86ModuleVersionInfo vmwlegacyVersRec = { +static XF86ModuleVersionInfo vmwareVersRec = { VMWARE_DRIVER_NAME, MODULEVENDORSTRING, MODINFOSTRING1, @@ -185,7 +185,12 @@ static const OptionInfoRec VMWAREOptions[] = { { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_XINERAMA, "Xinerama", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_STATIC_XINERAMA, "StaticXinerama", OPTV_STRING, {0}, FALSE }, + { OPTION_GUI_LAYOUT, "GuiLayout", OPTV_STRING, {0}, FALSE }, { OPTION_DEFAULT_MODE, "AddDefaultMode", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_RENDER_ACCEL, "RenderAccel", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_DIRECT_PRESENTS, "DirectPresents", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_HW_PRESENTS, "HWPresents", OPTV_BOOLEAN, {0}, FALSE}, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -210,8 +215,30 @@ VMwarePreinitStub(ScrnInfoPtr pScrn, int flags) EntityInfoPtr pEnt; pScrn->PreInit = pScrn->driverPrivate; + +#ifdef BUILD_VMWGFX pScrn->driverPrivate = NULL; + /* + * Try vmwgfx path. + */ + if ((*pScrn->PreInit)(pScrn, flags)) + return TRUE; + +#else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Driver was compiled without KMS- and 3D support.\n"); +#endif /* defined(BUILD_VMWGFX) */ + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling 3D support.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling Render Acceleration.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling RandR12+ support.\n"); + + pScrn->driverPrivate = NULL; + vmwlegacy_hookup(pScrn); + pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (pEnt->location.type != BUS_PCI) return FALSE; @@ -223,8 +250,6 @@ VMwarePreinitStub(ScrnInfoPtr pScrn, int flags) pScrn->chipset = (char*)xf86TokenToString(VMWAREChipsets, DEVICE_ID(pciInfo)); - ErrorF("Stub bitsperpixel is %d\n", pScrn->bitsPerPixel); - return (*pScrn->PreInit)(pScrn, flags); }; @@ -252,7 +277,13 @@ VMwarePciProbe (DriverPtr drv, case PCI_CHIP_VMWARE0405: case PCI_CHIP_VMWARE0710: xf86MsgVerb(X_INFO, 4, "VMwarePciProbe: Valid device\n"); + +#ifdef BUILD_VMWGFX + vmwgfx_hookup(scrn); +#else vmwlegacy_hookup(scrn); +#endif /* defined(BUILD_VMWGFX) */ + scrn->driverPrivate = scrn->PreInit; scrn->PreInit = VMwarePreinitStub; break; @@ -308,7 +339,13 @@ VMWAREProbe(DriverPtr drv, int flags) pScrn->name = VMWARE_NAME; pScrn->Probe = VMWAREProbe; pScrn->PreInit = VMWAREPreInit; + +#ifdef BUILD_VMWGFX + vmwgfx_hookup(scrn); +#else vmwlegacy_hookup(scrn); +#endif /* defined(BUILD_VMWGFX) */ + scrn->driverPrivate = scrn->PreInit; scrn->PreInit = VMwarePreinitStub; foundScreen = TRUE; @@ -372,7 +409,7 @@ VMWareDriverFunc(ScrnInfoPtr pScrn, #endif -_X_EXPORT DriverRec vmwlegacy = { +_X_EXPORT DriverRec vmware = { VMWARE_DRIVER_VERSION, VMWARE_DRIVER_NAME, VMWAREIdentify, @@ -434,23 +471,23 @@ static const char *shadowfbSymbols[] = { #endif #ifdef XFree86LOADER -static MODULESETUPPROTO(vmwlegacySetup); +static MODULESETUPPROTO(vmwareSetup); -_X_EXPORT XF86ModuleData vmwlegacyModuleData = { - &vmwlegacyVersRec, - vmwlegacySetup, +_X_EXPORT XF86ModuleData vmwareModuleData = { + &vmwareVersRec, + vmwareSetup, NULL }; static pointer -vmwlegacySetup(pointer module, pointer opts, int *errmaj, int *errmin) +vmwareSetup(pointer module, pointer opts, int *errmaj, int *errmin) { static Bool setupDone = FALSE; if (!setupDone) { setupDone = TRUE; - xf86AddDriver(&vmwlegacy, module, VMWARE_DRIVER_FUNC); + xf86AddDriver(&vmware, module, VMWARE_DRIVER_FUNC); LoaderRefSymLists(vgahwSymbols, fbSymbols, ramdacSymbols, shadowfbSymbols, NULL); diff --git a/src/vmware_bootstrap.h b/src/vmware_bootstrap.h index 611fd8e..1a1ee9e 100644 --- a/src/vmware_bootstrap.h +++ b/src/vmware_bootstrap.h @@ -35,7 +35,12 @@ typedef enum { OPTION_HW_CURSOR, OPTION_XINERAMA, OPTION_STATIC_XINERAMA, + OPTION_GUI_LAYOUT, OPTION_DEFAULT_MODE, + OPTION_RENDER_ACCEL, + OPTION_DRI, + OPTION_DIRECT_PRESENTS, + OPTION_HW_PRESENTS } VMWAREOpts; OptionInfoPtr VMWARECopyOptions(void); @@ -44,5 +49,10 @@ const char **vgahwSymbols; void vmwlegacy_hookup(ScrnInfoPtr pScrn); +#ifdef BUILD_VMWGFX +void +vmwgfx_hookup(ScrnInfoPtr pScrn); +#endif /* defined(BUILD_VMWGFX) */ + #endif diff --git a/src/vmwaremodule.c b/src/vmwaremodule.c deleted file mode 100644 index 0da2440..0000000 --- a/src/vmwaremodule.c +++ /dev/null @@ -1,256 +0,0 @@ -/********************************************************** - * 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. - * - **********************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef HAVE_LIBDRM -#include <xf86drm.h> -#endif - -#include <xorg-server.h> -#include <xf86.h> - -#ifndef HAVE_XORG_SERVER_1_5_0 -#include <xf86_ansic.h> -#include <xf86_libc.h> -#endif - -/* - * Defines and exported module info. - */ - -#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 -#define VMW_STRING(str) VMW_STRING_INNER(str) - -#define VMWARE_DRIVER_VERSION \ - (PACKAGE_VERSION_MAJOR * 65536 + PACKAGE_VERSION_MINOR * 256 + PACKAGE_VERSION_PATCHLEVEL) -#define VMWARE_DRIVER_VERSION_STRING \ - 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. - * 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 "." 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; -static MODULESETUPPROTO(vmware_setup); - -_X_EXPORT XF86ModuleData vmwareModuleData = { - &vmware_version, - vmware_setup, - NULL -}; - -extern XF86ModuleData *VMWGFX_MODULE_DATA; - -/* - * Chain loading functions - */ - -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) { - /* 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; - } - - 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; - - 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 */ -#endif /* HAVE_LIBDRM */ - return FALSE; -} - -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_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 = 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; - } - - /* Xorg -configure returns 1 from xf86MatchDevice with NULL gdevs */ - for (i = 0; gdevs && i < vmware_devices; i++) { - gdev = gdevs[i]; - gdev->driver = driver_name; - } - - free(gdevs); - - 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; -} - - -/* - * Module info - */ - -static XF86ModuleVersionInfo vmware_version = { - VMWARE_DRIVER_NAME, - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL, - 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; - - /* This module should be loaded only once, but check to be sure. */ - if (!setupDone) { - setupDone = 1; - - /* Chain load the real driver */ - if (vmware_chain_module(opts)) - return (pointer) 1; - else { - if (errmaj) - *errmaj = LDR_NOSUBENT; - return NULL; - } - } else { - if (errmaj) - *errmaj = LDR_ONCEONLY; - return NULL; - } -} diff --git a/vmwgfx/Makefile.am b/vmwgfx/Makefile.am index e956b64..8fe3e71 100644 --- a/vmwgfx/Makefile.am +++ b/vmwgfx/Makefile.am @@ -1,11 +1,9 @@ -vmwgfx_drv_la_LTLIBRARIES = vmwgfx_drv.la -vmwgfx_drv_la_LDFLAGS = -module -avoid-version -vmwgfx_drv_la_CFLAGS = $(CWARNFLAGS) $(XORG_CFLAGS) @LIBDRM_CFLAGS@ @XATRACKER_CFLAGS@ -I$(top_srcdir)/src -I$(top_srcdir)/saa -vmwgfx_drv_la_LIBADD = @LIBDRM_LIBS@ $(top_srcdir)/saa/libsaa.la\ +noinst_LTLIBRARIES = libvmwgfx.la +libvmwgfx_la_CFLAGS = $(CWARNFLAGS) $(XORG_CFLAGS) @LIBDRM_CFLAGS@ @XATRACKER_CFLAGS@ -I$(top_srcdir)/src -I$(top_srcdir)/saa +libvmwgfx_la_LIBADD = @LIBDRM_LIBS@ $(top_srcdir)/saa/libsaa.la\ @XATRACKER_LIBS@ -vmwgfx_drv_ladir = @moduledir@/drivers -vmwgfx_drv_la_SOURCES = \ +libvmwgfx_la_SOURCES = \ vmwgfx_driver.c \ vmwgfx_driver.h \ vmwgfx_crtc.c \ @@ -16,7 +14,6 @@ vmwgfx_drv_la_SOURCES = \ vmwgfx_saa.h \ vmwgfx_drmi.c \ vmwgfx_drmi.h \ - vmwgfx_bootstrap.c \ vmwgfx_overlay.c \ vmwgfx_ctrl.c \ vmwgfx_ctrl.h \ diff --git a/vmwgfx/vmwgfx_bootstrap.c b/vmwgfx/vmwgfx_bootstrap.c deleted file mode 100644 index 5e8e9e1..0000000 --- a/vmwgfx/vmwgfx_bootstrap.c +++ /dev/null @@ -1,199 +0,0 @@ -/********************************************************** - * Copyright 2008-2011 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. - * - **********************************************************/ - -/** - * @file - * Bootstrap file for the vmwgfx xorg driver. - * - * @author Alan Hourihane <alanh@tungstengraphics.com> - * @author Jakob Bornecrantz <wallbraker@gmail.com> - * @author Thomas Hellstrom <thellstrom@vmware.com> - */ - -#include "xorg-server.h" -#include "xf86.h" -#include "pciaccess.h" - -#ifndef XSERVER_LIBPCIACCESS -#error "libpciaccess needed" -#endif - -void xorg_tracker_set_functions(ScrnInfoPtr scrn); -const OptionInfoRec * xorg_tracker_available_options(int chipid, int busid); - - -/* - * Defines and modinfo - */ - -#define VMWGFX_DRIVER_NAME "vmwgfx" - -#define VMW_STRING_INNER(s) #s -#define VMW_STRING(str) VMW_STRING_INNER(str) - -#define VMWGFX_VERSION_MAJOR 11 -#define VMWGFX_VERSION_MINOR 0 -#define VMWGFX_VERSION_PATCH 0 -#define VMWGFX_VERSION_STRING_MAJOR VMW_STRING(VMWGFX_VERSION_MAJOR) -#define VMWGFX_VERSION_STRING_MINOR VMW_STRING(VMWGFX_VERSION_MINOR) -#define VMWGFX_VERSION_STRING_PATCH VMW_STRING(VMWGFX_VERSION_PATCH) - -#define VMWGFX_DRIVER_VERSION \ - (VMWGFX_VERSION_MAJOR * 65536 + VMWGFX_VERSION_MINOR * 256 + VMWGFX_VERSION_PATCH) -#define VMWGFX_DRIVER_VERSION_STRING \ - VMWGFX_VERSION_STRING_MAJOR "." VMWGFX_VERSION_STRING_MINOR \ - "." VMWGFX_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__ -_X_EXPORT const char vmwgfx_drv_modinfo[] __attribute__((section(".modinfo"),unused)) = - "version=" VMWGFX_DRIVER_VERSION_STRING ".0"; -#endif - -static void vmw_xorg_identify(int flags); -_X_EXPORT Bool vmw_xorg_pci_probe(DriverPtr driver, - int entity_num, - struct pci_device *device, - intptr_t match_data); - - -/* - * Tables - */ - -static const struct pci_id_match vmw_xorg_device_match[] = { - {0x15ad, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0}, -}; - -static SymTabRec vmw_xorg_chipsets[] = { - {PCI_MATCH_ANY, "VMware SVGA Device"}, - {-1, NULL} -}; - -static PciChipsets vmw_xorg_pci_devices[] = { - {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL}, - {-1, -1, NULL} -}; - -static XF86ModuleVersionInfo vmw_xorg_version = { - VMWGFX_DRIVER_NAME, - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - VMWGFX_VERSION_MAJOR, VMWGFX_VERSION_MINOR, VMWGFX_VERSION_PATCH, - ABI_CLASS_VIDEODRV, - ABI_VIDEODRV_VERSION, - MOD_CLASS_VIDEODRV, - {0, 0, 0, 0} -}; - -/* - * Xorg driver exported structures - */ - -_X_EXPORT DriverRec vmwgfx = { - 1, - VMWGFX_DRIVER_NAME, - vmw_xorg_identify, - NULL, - xorg_tracker_available_options, - NULL, - 0, - NULL, - vmw_xorg_device_match, - vmw_xorg_pci_probe -}; - -static MODULESETUPPROTO(vmw_xorg_setup); - -_X_EXPORT XF86ModuleData vmwgfxModuleData = { - &vmw_xorg_version, - vmw_xorg_setup, - NULL -}; - - -/* - * Xorg driver functions - */ - -static pointer -vmw_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = 0; - - /* This module should be loaded only once, but check to be sure. - */ - if (!setupDone) { - setupDone = 1; - xf86AddDriver(&vmwgfx, module, HaveDriverFuncs); - - /* - * The return value must be non-NULL on success even though there - * is no TearDownProc. - */ - return (pointer) 1; - } else { - if (errmaj) - *errmaj = LDR_ONCEONLY; - return NULL; - } -} - -static void -vmw_xorg_identify(int flags) -{ - xf86PrintChipsets("vmwgfx", "Driver for VMware SVGA device", - vmw_xorg_chipsets); -} - -_X_EXPORT Bool -vmw_xorg_pci_probe(DriverPtr driver, - int entity_num, struct pci_device *device, intptr_t match_data) -{ - ScrnInfoPtr scrn = NULL; - EntityInfoPtr entity; - - scrn = xf86ConfigPciEntity(scrn, 0, entity_num, vmw_xorg_pci_devices, - NULL, NULL, NULL, NULL, NULL); - if (scrn != NULL) { - scrn->driverVersion = 1; - scrn->driverName = "vmwgfx"; - scrn->name = "vmwgfx"; - scrn->Probe = NULL; - - entity = xf86GetEntityInfo(entity_num); - - /* Use all the functions from the xorg tracker */ - xorg_tracker_set_functions(scrn); - } - return scrn != NULL; -} diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c index b3fb1e8..ddeaf1d 100644 --- a/vmwgfx/vmwgfx_dri2.c +++ b/vmwgfx/vmwgfx_dri2.c @@ -376,7 +376,7 @@ xorg_dri2_init(ScreenPtr pScreen) dri2info.version = min(DRI2INFOREC_VERSION, 3); dri2info.fd = ms->fd; - dri2info.driverName = pScrn->driverName; + dri2info.driverName = "vmwgfx"; dri2info.deviceName = "/dev/dri/card0"; /* FIXME */ dri2info.CreateBuffer = dri2_create_buffer; diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c index a3d7860..69fef8c 100644 --- a/vmwgfx/vmwgfx_driver.c +++ b/vmwgfx/vmwgfx_driver.c @@ -58,6 +58,7 @@ #include <saa.h> #include "vmwgfx_saa.h" +#include "../src/vmware_bootstrap.h" #define XA_VERSION_MINOR_REQUIRED 0 #define DRM_VERSION_MAJOR_REQUIRED 2 @@ -97,47 +98,15 @@ static ModeStatus drv_valid_mode(int scrnIndex, DisplayModePtr mode, Bool verbos int flags); extern void xorg_tracker_set_functions(ScrnInfoPtr scrn); -extern const OptionInfoRec * xorg_tracker_available_options(int chipid, - int busid); - - -typedef enum -{ - OPTION_SW_CURSOR, - OPTION_RENDER_ACCEL, - OPTION_DRI, - OPTION_DIRECT_PRESENTS, - OPTION_HW_PRESENTS -} drv_option_enums; - -static const OptionInfoRec drv_options[] = { - {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_RENDER_ACCEL, "RenderAccel", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_DIRECT_PRESENTS, "DirectPresents", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_HW_PRESENTS, "HWPresents", OPTV_BOOLEAN, {0}, FALSE}, - {-1, NULL, OPTV_NONE, {0}, FALSE} -}; - - -/* - * Exported Xorg driver functions to winsys - */ - -const OptionInfoRec * -xorg_tracker_available_options(int chipid, int busid) -{ - return drv_options; -} void -xorg_tracker_set_functions(ScrnInfoPtr scrn) +vmwgfx_hookup(ScrnInfoPtr pScrn) { - scrn->PreInit = drv_pre_init; - scrn->ScreenInit = drv_screen_init; - scrn->SwitchMode = drv_switch_mode; - scrn->FreeScreen = drv_free_screen; - scrn->ValidMode = drv_valid_mode; + pScrn->PreInit = drv_pre_init; + pScrn->ScreenInit = drv_screen_init; + pScrn->SwitchMode = drv_switch_mode; + pScrn->FreeScreen = drv_free_screen; + pScrn->ValidMode = drv_valid_mode; } /* @@ -399,9 +368,8 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) /* Process the options */ xf86CollectOptions(pScrn, NULL); - if (!(ms->Options = malloc(sizeof(drv_options)))) + if (!(ms->Options = VMWARECopyOptions())) return FALSE; - memcpy(ms->Options, drv_options, sizeof(drv_options)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options); ms->accelerate_render = TRUE; @@ -461,7 +429,7 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) } - if (xf86ReturnOptValBool(ms->Options, OPTION_SW_CURSOR, FALSE)) { + if (!xf86ReturnOptValBool(ms->Options, OPTION_HW_CURSOR, TRUE)) { ms->SWCursor = TRUE; } |