diff --git a/driver/xf86-video-vmware/aclocal.m4 b/driver/xf86-video-vmware/aclocal.m4 index 3ec9c2c92..f5c20ec3e 100644 --- a/driver/xf86-video-vmware/aclocal.m4 +++ b/driver/xf86-video-vmware/aclocal.m4 @@ -7631,7 +7631,7 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -dnl xorg-macros.m4. Generated from xorg-macros.m4.in:xorgversion.m4 by configure. +dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl dnl Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved. dnl @@ -7668,27 +7668,24 @@ dnl of the copyright holder. # your configure.ac with the minimum required version, such as: # XORG_MACROS_VERSION(1.1) # -# To force at least a version with this macro defined, also add: -# m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])]) +# To ensure that this macro is defined, also add: +# m4_ifndef([XORG_MACROS_VERSION], +# [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])]) # # # See the "minimum version" comment for each macro you use to see what # version you require. -AC_DEFUN([XORG_MACROS_VERSION],[ - [XORG_MACROS_needed_version=$1 - XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'` - XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`] - AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}]) - [XORG_MACROS_version=1.2.1 - XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'` - XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`] - if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then - AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x]) - fi - if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then - AC_MSG_ERROR([configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer]) - fi - AC_MSG_RESULT([yes, $XORG_MACROS_version]) +m4_defun([XORG_MACROS_VERSION],[ +m4_define([vers_have], [1.3.0]) +m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) +m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) +m4_if(m4_cmp(maj_have, maj_needed), 0,, + [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])]) +m4_if(m4_version_compare(vers_have, [$1]), -1, + [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])]) +m4_undefine([vers_have]) +m4_undefine([maj_have]) +m4_undefine([maj_needed]) ]) # XORG_MACROS_VERSION # XORG_PROG_RAWCPP() @@ -7955,7 +7952,7 @@ AC_SUBST(MAKE_HTML) # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[ AC_ARG_ENABLE(malloc0returnsnull, - AC_HELP_STRING([--enable-malloc0returnsnull], + AS_HELP_STRING([--enable-malloc0returnsnull], [malloc(0) returns NULL (default: auto)]), [MALLOC_ZERO_RETURNS_NULL=$enableval], [MALLOC_ZERO_RETURNS_NULL=auto]) @@ -8007,7 +8004,7 @@ AC_SUBST([XTMALLOC_ZERO_CFLAGS]) AC_DEFUN([XORG_WITH_LINT],[ # Allow checking code with lint, sparse, etc. -AC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint], +AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint], [Use a lint-style source code checker (default: disabled)])], [use_lint=$withval], [use_lint=no]) if test "x$use_lint" = "xyes" ; then @@ -8048,7 +8045,7 @@ AM_CONDITIONAL(LINT, [test x$LINT != xno]) AC_DEFUN([XORG_LINT_LIBRARY],[ AC_REQUIRE([XORG_WITH_LINT]) # Build lint "library" for more indepth checks of programs calling this library -AC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library], +AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library], [Create lint library (default: disabled)])], [make_lint_lib=$enableval], [make_lint_lib=no]) if test "x$make_lint_lib" != "xno" ; then @@ -8078,9 +8075,9 @@ if test "x$GCC" = xyes ; then CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs -fno-strict-aliasing \ -Wbad-function-cast" - case `gcc -dumpversion` in + case `$CC -dumpversion` in 3.4.* | 4.*) - CWARNFLAGS+=" -Wold-style-definition -Wdeclaration-after-statement" + CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement" ;; esac else @@ -8090,7 +8087,51 @@ else fi fi AC_SUBST(CWARNFLAGS) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) ]) # XORG_CWARNFLAGS + +# XORG_STRICT_OPTION +# ----------------------- +# Minimum version: 1.3.0 +# +# Add configure option to enable strict compilation +AC_DEFUN([XORG_STRICT_OPTION], [ +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_CC_C99]) +AC_REQUIRE([XORG_CWARNFLAGS]) + +AC_ARG_ENABLE(strict-compilation, + AS_HELP_STRING([--enable-strict-compilation], + [Enable all warnings from compiler and make them errors (default: disabled)]), + [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) +if test "x$STRICT_COMPILE" = "xyes"; then + AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) + AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) + if test "x$GCC" = xyes ; then + STRICT_CFLAGS="-pedantic -Werror" + elif test "x$SUNCC" = "xyes"; then + STRICT_CFLAGS="-errwarn" + elif test "x$INTELCC" = "xyes"; then + STRICT_CFLAGS="-Werror" + fi +fi +CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" +AC_SUBST([CWARNFLAGS]) +]) # XORG_STRICT_OPTION + +# XORG_DEFAULT_OPTIONS +# -------------------- +# Minimum version: 1.3.0 +# +# Defines default options for X.Org modules. +# +AC_DEFUN([XORG_DEFAULT_OPTIONS], [ +XORG_CWARNFLAGS +XORG_STRICT_OPTION +XORG_RELEASE_VERSION +XORG_CHANGELOG +XORG_MANPAGE_SECTIONS +]) # XORG_DEFAULT_OPTIONS dnl Copyright 2005 Red Hat, Inc dnl dnl Permission to use, copy, modify, distribute, and sell this software and its @@ -8125,7 +8166,7 @@ dnl AC_DEFUN([XORG_RELEASE_VERSION],[ AC_ARG_WITH(release-version, - AC_HELP_STRING([--with-release-version=STRING], + AS_HELP_STRING([--with-release-version=STRING], [Use release version string in package name]), [RELEASE_VERSION="$withval"], [RELEASE_VERSION=""]) diff --git a/driver/xf86-video-vmware/configure b/driver/xf86-video-vmware/configure index 8045d455e..f6ae356a8 100644 --- a/driver/xf86-video-vmware/configure +++ b/driver/xf86-video-vmware/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for xf86-video-vmware 10.16.6. +# Generated by GNU Autoconf 2.62 for xf86-video-vmware 10.16.8. # # Report bugs to . # @@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='xf86-video-vmware' PACKAGE_TARNAME='xf86-video-vmware' -PACKAGE_VERSION='10.16.6' -PACKAGE_STRING='xf86-video-vmware 10.16.6' +PACKAGE_VERSION='10.16.8' +PACKAGE_STRING='xf86-video-vmware 10.16.8' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' ac_unique_file="Makefile.am" @@ -1507,7 +1507,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xf86-video-vmware 10.16.6 to adapt to many kinds of systems. +\`configure' configures xf86-video-vmware 10.16.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1578,7 +1578,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xf86-video-vmware 10.16.6:";; + short | recursive ) echo "Configuration of xf86-video-vmware 10.16.8:";; esac cat <<\_ACEOF @@ -1697,7 +1697,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xf86-video-vmware configure 10.16.6 +xf86-video-vmware configure 10.16.8 generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1711,7 +1711,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xf86-video-vmware $as_me 10.16.6, which was +It was created by xf86-video-vmware $as_me 10.16.8, which was generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -2365,7 +2365,7 @@ fi # Define the identity of the package. PACKAGE='xf86-video-vmware' - VERSION='10.16.6' + VERSION='10.16.8' cat >>confdefs.h <<_ACEOF @@ -22252,7 +22252,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xf86-video-vmware $as_me 10.16.6, which was +This file was extended by xf86-video-vmware $as_me 10.16.8, which was generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22305,7 +22305,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -xf86-video-vmware config.status 10.16.6 +xf86-video-vmware config.status 10.16.8 configured by $0, generated by GNU Autoconf 2.62, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/driver/xf86-video-vmware/configure.ac b/driver/xf86-video-vmware/configure.ac index 6afb1fb05..b4e6a1798 100644 --- a/driver/xf86-video-vmware/configure.ac +++ b/driver/xf86-video-vmware/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-video-vmware], - 10.16.6, + 10.16.8, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-video-vmware) diff --git a/driver/xf86-video-vmware/src/vmware.c b/driver/xf86-video-vmware/src/vmware.c index 80224384a..0b1050425 100644 --- a/driver/xf86-video-vmware/src/vmware.c +++ b/driver/xf86-video-vmware/src/vmware.c @@ -18,7 +18,9 @@ char rcsId_vmware[] = #include "xf86.h" #include "xf86_OSproc.h" +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 #include "xf86Resources.h" +#endif #include "compiler.h" /* inb/outb */ @@ -83,7 +85,7 @@ char rcsId_vmware[] = #define VMWARE_DRIVER_NAME "vmware" #define VMWARE_MAJOR_VERSION 10 #define VMWARE_MINOR_VERSION 16 -#define VMWARE_PATCHLEVEL 6 +#define VMWARE_PATCHLEVEL 8 #define VMWARE_DRIVER_VERSION \ (VMWARE_MAJOR_VERSION * 65536 + VMWARE_MINOR_VERSION * 256 + VMWARE_PATCHLEVEL) #define VMWARE_DRIVER_VERSION_STRING \ @@ -109,11 +111,15 @@ static SymTabRec VMWAREChipsets[] = { { -1, NULL } }; +#ifndef XSERVER_LIBPCIACCESS static resRange vmwareLegacyRes[] = { { ResExcIoBlock, SVGA_LEGACY_BASE_PORT, SVGA_LEGACY_BASE_PORT + SVGA_NUM_PORTS*sizeof(uint32)}, _VGA_EXCLUSIVE, _END }; +#else +#define vmwareLegacyRes NULL +#endif #if XSERVER_LIBPCIACCESS @@ -306,7 +312,7 @@ vmwareSendSVGACmdUpdate(VMWAREPtr pVMWARE, BoxPtr pBB) vmwareWriteWordToFIFO(pVMWARE, pBB->y2 - pBB->y1); } -static void +void vmwareSendSVGACmdUpdateFullScreen(VMWAREPtr pVMWARE) { BoxRec BB; @@ -652,6 +658,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags) "No supported VMware SVGA found (read ID 0x%08x).\n", id); return FALSE; } + pVMWARE->suspensionSavedRegId = id; #if !XSERVER_LIBPCIACCESS pVMWARE->PciTag = pciTag(pVMWARE->PciInfo->bus, pVMWARE->PciInfo->device, @@ -1162,8 +1169,40 @@ VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool rebuildPixmap) vgaHWProtect(pScrn, FALSE); /* - * XXX -- If we want to check that we got the mode we asked for, this - * would be a good place. + * Push the new Xinerama state to X clients and the hardware, + * synchronously with the mode change. Note that this must happen + * AFTER we write the new width and height to the hardware + * registers, since updating the WIDTH and HEIGHT registers will + * reset the device's multimon topology. + */ + vmwareNextXineramaState(pVMWARE); + + return TRUE; +} + +void +vmwareNextXineramaState(VMWAREPtr pVMWARE) +{ + VMWARERegPtr vmwareReg = &pVMWARE->ModeReg; + + /* + * Switch to the next Xinerama state (from pVMWARE->xineramaNextState). + * + * This new state will be available to X clients via the Xinerama + * extension, and we push the new state to the virtual hardware, + * in order to configure a number of virtual monitors within the + * device's framebuffer. + * + * This function can be called at any time, but it should usually be + * called just after a mode switch. This is for two reasons: + * + * 1) We don't want X clients to see a Xinerama topology and a video + * mode that are inconsistent with each other, so we'd like to switch + * both at the same time. + * + * 2) We must set the host's display topology registers after setting + * the new video mode, since writes to WIDTH/HEIGHT will reset the + * hardware display topology. */ /* @@ -1177,7 +1216,14 @@ VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool rebuildPixmap) pVMWARE->xineramaNextState = NULL; pVMWARE->xineramaNextNumOutputs = 0; + } else { + /* + * There is no next state pending. Switch back to + * single-monitor mode. This is necessary for resetting the + * Xinerama state if we get a mode change which doesn't + * follow a VMwareCtrlDoSetTopology call. + */ VMWAREXineramaPtr basicState = (VMWAREXineramaPtr)xcalloc(1, sizeof (VMWAREXineramaRec)); if (basicState) { @@ -1194,7 +1240,8 @@ VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool rebuildPixmap) } /* - * Update host's view of guest topology. + * Update host's view of guest topology. This tells the device + * how we're carving up its framebuffer into virtual screens. */ if (pVMWARE->vmwareCapability & SVGA_CAP_DISPLAY_TOPOLOGY) { if (pVMWARE->xinerama) { @@ -1222,14 +1269,13 @@ VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool rebuildPixmap) vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_IS_PRIMARY, TRUE); vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_POSITION_X, 0); vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_POSITION_Y, 0); - vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_WIDTH, mode->HDisplay); - vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_HEIGHT, mode->VDisplay); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_WIDTH, vmwareReg->svga_reg_width); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_HEIGHT, vmwareReg->svga_reg_height); } + /* Done. */ vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_ID, SVGA_INVALID_DISPLAY_ID); } - - return TRUE; } static void @@ -1435,6 +1481,7 @@ VMWAREAddDisplayMode(ScrnInfoPtr pScrn, DisplayModeRec *mode; mode = xalloc(sizeof(DisplayModeRec)); + memset(mode, 0, sizeof *mode); mode->name = xalloc(strlen(name) + 1); strcpy(mode->name, name); @@ -1820,7 +1867,13 @@ VMWAREEnterVT(int scrnIndex, int flags) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - if (!pVMWARE->SavedReg.svga_fifo_enabled) { + /* + * After system resumes from hiberation, EnterVT will be called and this + * is a good place to restore the SVGA ID register. + */ + vmwareWriteReg(pVMWARE, SVGA_REG_ID, pVMWARE->suspensionSavedRegId); + + if (!pVMWARE->SavedReg.svga_fifo_enabled) { VMWAREInitFIFO(pScrn); } @@ -1831,6 +1884,14 @@ static void VMWARELeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + /* + * Before shutting down system for hibneration, LeaveVT will be called, + * we save the ID register value here and later restore it in EnterVT. + */ + pVMWARE->suspensionSavedRegId = vmwareReadReg(pVMWARE, SVGA_REG_ID); + VMWARERestore(pScrn); } diff --git a/driver/xf86-video-vmware/src/vmware.h b/driver/xf86-video-vmware/src/vmware.h index 57872b271..31560b54d 100644 --- a/driver/xf86-video-vmware/src/vmware.h +++ b/driver/xf86-video-vmware/src/vmware.h @@ -19,12 +19,14 @@ #include "xf86.h" #include "xf86_OSproc.h" -#include "xf86Resources.h" + #include #ifdef XSERVER_LIBPCIACCESS #include +#else +#include "xf86Resources.h" #endif #include "compiler.h" /* inb/outb */ @@ -102,6 +104,7 @@ typedef struct { VMWARERegRec SavedReg; VMWARERegRec ModeReg; + CARD32 suspensionSavedRegId; DisplayModePtr dynModes[NUM_DYN_MODES]; @@ -244,6 +247,10 @@ void vmwareSendSVGACmdUpdate( VMWAREPtr pVMWARE, BoxPtr pBB ); +void vmwareSendSVGACmdUpdateFullScreen( + VMWAREPtr pVMWARE + ); + DisplayModeRec *VMWAREAddDisplayMode( ScrnInfoPtr pScrn, const char *name, @@ -256,6 +263,10 @@ Bool vmwareIsRegionEqual( const RegionPtr reg2 ); +void vmwareNextXineramaState( + VMWAREPtr pVMWARE + ); + /* vmwarecurs.c */ Bool vmwareCursorInit( ScreenPtr pScr diff --git a/driver/xf86-video-vmware/src/vmwarectrl.c b/driver/xf86-video-vmware/src/vmwarectrl.c index 634b9ca8c..d9ceaa48c 100644 --- a/driver/xf86-video-vmware/src/vmwarectrl.c +++ b/driver/xf86-video-vmware/src/vmwarectrl.c @@ -282,11 +282,59 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn, if (xineramaState) { memcpy(xineramaState, extents, number * sizeof (VMWAREXineramaRec)); + /* + * Make this the new pending Xinerama state. Normally we'll + * wait until the next mode switch in order to synchronously + * push this state out to X clients and the virtual hardware. + * + * However, if we're already in the right video mode, there + * will be no mode change. In this case, push it out + * immediately. + */ xfree(pVMWARE->xineramaNextState); pVMWARE->xineramaNextState = xineramaState; pVMWARE->xineramaNextNumOutputs = number; - return VMwareCtrlDoSetRes(pScrn, maxX, maxY, FALSE); + if (maxX == pVMWARE->ModeReg.svga_reg_width && + maxY == pVMWARE->ModeReg.svga_reg_height) { + + /* + * XXX: + * + * There are problems with trying to set a Xinerama state + * without a mode switch. The biggest one is that + * applications typically won't notice a topology change + * that occurs without a mode switch. If you run "xdpyinfo + * -ext XINERAMA" after one such topology change, it will + * report the new data, but apps (like the GNOME Panel) + * will not notice until the next mode change. + * + * I don't think there's any good solution to this... as + * far as I know, even on a non-virtualized machine + * there's no way for an app to find out if the Xinerama + * opology changes without a resolution change also + * occurring. There might be some cheats we can take, like + * swithcing to a new mode with the same resolution and a + * different (fake) refresh rate, or temporarily switching + * to an intermediate mode. Ick. + * + * The other annoyance here is that when we reprogram the + * SVGA device's monitor topology registers, it may + * rearrange those monitors on the host's screen, but they + * will still have the old contents. This might be + * correct, but it isn't guaranteed to match what's on X's + * framebuffer at the moment. So we'll send a + * full-framebuffer update rect afterwards. + */ + + vmwareNextXineramaState(pVMWARE); + vmwareSendSVGACmdUpdateFullScreen(pVMWARE); + + return TRUE; + } else { + return VMwareCtrlDoSetRes(pScrn, maxX, maxY, FALSE); + } + } else { return FALSE; }