vmware: Make sure the driver builds on old servers

Move things around a bit so the driver compiles with
servers back to Xserver 1.0.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
This commit is contained in:
Thomas Hellstrom
2012-01-12 10:00:41 +01:00
parent 194ff6f151
commit 8ddbb3216d
5 changed files with 120 additions and 107 deletions

View File

@@ -75,6 +75,7 @@
/* Base and Offset gets us headed the right way for PCI Base Addr Registers */
#define SVGA_LEGACY_BASE_PORT 0x4560
#define SVGA_NUM_PORTS 0x3
#define SVGA_MAGIC 0x900000UL
#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))

View File

@@ -17,9 +17,6 @@ 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 */
@@ -48,7 +45,43 @@ char rcsId_vmware[] =
#endif
#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5)
#define xf86LoaderReqSymLists(...) do {} while (0)
#define LoaderRefSymLists(...) do {} while (0)
#else
const char *vgahwSymbols[] = {
"vgaHWGetHWRec",
"vgaHWGetIOBase",
"vgaHWGetIndex",
"vgaHWInit",
"vgaHWProtect",
"vgaHWRestore",
"vgaHWSave",
"vgaHWSaveScreen",
"vgaHWUnlock",
NULL
};
static const char *fbSymbols[] = {
"fbCreateDefColormap",
"fbPictureInit",
"fbScreenInit",
NULL
};
static const char *ramdacSymbols[] = {
"xf86CreateCursorInfoRec",
"xf86DestroyCursorInfoRec",
"xf86InitCursor",
NULL
};
static const char *shadowfbSymbols[] = {
"ShadowFBInit2",
NULL
};
#endif
/* Table of default modes to always add to the mode list. */
@@ -240,54 +273,6 @@ VMXGetVMwareSvgaId(VMWAREPtr pVMWARE)
return SVGA_ID_INVALID;
}
#ifndef XSERVER_LIBPCIACCESS
/*
*----------------------------------------------------------------------
*
* RewriteTagString --
*
* Rewrites the given string, removing the $Name$, and
* replacing it with the contents. The output string must
* have enough room, or else.
*
* Results:
*
* Output string updated.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static void
RewriteTagString(const char *istr, char *ostr, int osize)
{
int chr;
Bool inTag = FALSE;
char *op = ostr;
do {
chr = *istr++;
if (chr == '$') {
if (inTag) {
inTag = FALSE;
for (; op > ostr && op[-1] == ' '; op--) {
}
continue;
}
if (strncmp(istr, "Name:", 5) == 0) {
istr += 5;
istr += strspn(istr, " ");
inTag = TRUE;
continue;
}
}
*op++ = chr;
} while (chr);
}
#endif
static Bool
VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
{
@@ -1653,3 +1638,12 @@ vmwlegacy_hookup(ScrnInfoPtr pScrn)
pScrn->FreeScreen = VMWAREFreeScreen;
pScrn->ValidMode = VMWAREValidMode;
}
#ifdef XFree86LOADER
void
VMWARERefSymLists(void)
{
LoaderRefSymLists(vgahwSymbols, fbSymbols, ramdacSymbols,
shadowfbSymbols, NULL);
}
#endif /* XFree86LOADER */

View File

@@ -42,6 +42,7 @@
#include "vm_basic_types.h"
#include "svga_reg.h"
#include "svga_struct.h"
#include "vmware_bootstrap.h"
#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
#define _swapl(x, n) swapl(x,n)
@@ -208,15 +209,6 @@ static __inline ScrnInfoPtr infoFromScreen(ScreenPtr s) {
#define MOUSE_ID 1
/*#define DEBUG_LOGGING*/
#ifdef DEBUG_LOGGING
# define VmwareLog(args) ErrorF args
# define TRACEPOINT VmwareLog(("%s : %s\n", __FUNCTION__, __FILE__));
#else
# define VmwareLog(args)
# define TRACEPOINT
#endif
/* Undefine this to kill all acceleration */
#define ACCELERATE_OPS

View File

@@ -36,6 +36,15 @@
#include "vm_device_version.h"
#include "vmware_bootstrap.h"
#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
#include "xf86Resources.h"
#endif
#ifndef XSERVER_LIBPCIACCESS
#include "vm_basic_types.h"
#include "svga_reg.h"
#endif
#ifndef HAVE_XORG_SERVER_1_5_0
#include <xf86_ansic.h>
#include <xf86_libc.h>
@@ -295,6 +304,52 @@ VMwarePciProbe (DriverPtr drv,
}
#else
/*
*----------------------------------------------------------------------
*
* RewriteTagString --
*
* Rewrites the given string, removing the $Name$, and
* replacing it with the contents. The output string must
* have enough room, or else.
*
* Results:
*
* Output string updated.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static void
RewriteTagString(const char *istr, char *ostr, int osize)
{
int chr;
Bool inTag = FALSE;
char *op = ostr;
do {
chr = *istr++;
if (chr == '$') {
if (inTag) {
inTag = FALSE;
for (; op > ostr && op[-1] == ' '; op--) {
}
continue;
}
if (strncmp(istr, "Name:", 5) == 0) {
istr += 5;
istr += strspn(istr, " ");
inTag = TRUE;
continue;
}
}
*op++ = chr;
} while (chr);
}
static Bool
VMWAREProbe(DriverPtr drv, int flags)
{
@@ -339,16 +394,15 @@ VMWAREProbe(DriverPtr drv, int flags)
pScrn->driverName = VMWARE_DRIVER_NAME;
pScrn->name = VMWARE_NAME;
pScrn->Probe = VMWAREProbe;
pScrn->PreInit = VMWAREPreInit;
#ifdef BUILD_VMWGFX
vmwgfx_hookup(scrn);
vmwgfx_hookup(pScrn);
#else
vmwlegacy_hookup(scrn);
vmwlegacy_hookup(pScrn);
#endif /* defined(BUILD_VMWGFX) */
scrn->driverPrivate = scrn->PreInit;
scrn->PreInit = VMwarePreinitStub;
pScrn->driverPrivate = pScrn->PreInit;
pScrn->PreInit = VMwarePreinitStub;
foundScreen = TRUE;
}
}
@@ -431,45 +485,6 @@ _X_EXPORT DriverRec vmware = {
#endif
};
#if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5)
#define xf86LoaderReqSymLists(...) do {} while (0)
#define LoaderRefSymLists(...) do {} while (0)
#else
const char *vgahwSymbols[] = {
"vgaHWGetHWRec",
"vgaHWGetIOBase",
"vgaHWGetIndex",
"vgaHWInit",
"vgaHWProtect",
"vgaHWRestore",
"vgaHWSave",
"vgaHWSaveScreen",
"vgaHWUnlock",
NULL
};
static const char *fbSymbols[] = {
"fbCreateDefColormap",
"fbPictureInit",
"fbScreenInit",
NULL
};
static const char *ramdacSymbols[] = {
"xf86CreateCursorInfoRec",
"xf86DestroyCursorInfoRec",
"xf86InitCursor",
NULL
};
static const char *shadowfbSymbols[] = {
"ShadowFBInit2",
NULL
};
#endif
#ifdef XFree86LOADER
static MODULESETUPPROTO(vmwareSetup);
@@ -490,8 +505,7 @@ vmwareSetup(pointer module, pointer opts, int *errmaj, int *errmin)
xf86AddDriver(&vmware, module, VMWARE_DRIVER_FUNC);
LoaderRefSymLists(vgahwSymbols, fbSymbols, ramdacSymbols,
shadowfbSymbols, NULL);
VMWARERefSymLists();
return (pointer)1;
}

View File

@@ -45,7 +45,6 @@ typedef enum {
} VMWAREOpts;
OptionInfoPtr VMWARECopyOptions(void);
const char **vgahwSymbols;
void
vmwlegacy_hookup(ScrnInfoPtr pScrn);
@@ -55,5 +54,18 @@ void
vmwgfx_hookup(ScrnInfoPtr pScrn);
#endif /* defined(BUILD_VMWGFX) */
#ifdef XFree86LOADER
void
VMWARERefSymLists(void);
#endif /* XFree86LOADER */
/*#define DEBUG_LOGGING*/
#ifdef DEBUG_LOGGING
# define VmwareLog(args) ErrorF args
# define TRACEPOINT VmwareLog(("%s : %s\n", __FUNCTION__, __FILE__));
#else
# define VmwareLog(args)
# define TRACEPOINT
#endif
#endif