summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c')
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c136
1 files changed, 34 insertions, 102 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c
index 04ca7f8bf..f624d5af0 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c
@@ -7,7 +7,7 @@ char rcsId_vmware[] =
"Id: vmware.c,v 1.11 2001/02/23 02:10:39 yoel Exp $";
#endif
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c,v 1.4 2001/05/16 06:48:12 keithp Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -23,12 +23,7 @@ char rcsId_vmware[] =
#include "mibstore.h" /* backing store */
#include "micmap.h" /* mi color map */
#include "vgaHW.h" /* VGA hardware */
-#define PSZ 8 /* 8bpp */
-#include "cfb.h"
-#undef PSZ
-#include "cfb16.h" /* 16bpp */
-#include "cfb24.h" /* 24bpp */
-#include "cfb32.h" /* 32bpp */
+#include "fb.h"
#include "xf86cmap.h" /* xf86HandleColormaps */
@@ -113,14 +108,12 @@ typedef enum {
OPTION_NOACCEL
} VMWAREOpts;
-static OptionInfoRec VMWAREOptions[] = {
+static const OptionInfoRec VMWAREOptions[] = {
{ OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
-#define nVMWAREOptions (sizeof(VMWAREOptions) / sizeof(VMWAREOptions[0]))
-
static Bool
VMWAREGetRec(ScrnInfoPtr pScrn)
{
@@ -332,7 +325,7 @@ VMWAREIdentify(int flags)
xf86PrintChipsets(VMWARE_NAME, "driver for VMware SVGA", VMWAREChipsets);
}
-static OptionInfoPtr
+static const OptionInfoRec *
VMWAREAvailableOptions(int chipid, int busid)
{
return VMWAREOptions;
@@ -343,13 +336,16 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
{
MessageType from;
VMWAREPtr pVMWARE;
- OptionInfoRec options[nVMWAREOptions];
+ OptionInfoPtr options;
int bpp24flags;
uint32 id;
int i;
- const char* mod;
ClockRange* clockRanges;
+ if (flags & PROBE_DETECT) {
+ return FALSE;
+ }
+
if (pScrn->numEntities != 1) {
return FALSE;
}
@@ -531,6 +527,8 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
#endif
xf86CollectOptions(pScrn, NULL);
+ if (!(options = xalloc(sizeof(VMWAREOptions))))
+ return FALSE;
memcpy(options, VMWAREOptions, sizeof(VMWAREOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
@@ -567,6 +565,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
}
pScrn->videoRam = pVMWARE->videoRam / 1024;
pScrn->memPhysBase = pVMWARE->memPhysBase;
+ xfree(options);
{
Gamma zeros = { 0.0, 0.0, 0.0 };
@@ -614,17 +613,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->currentMode = pScrn->modes;
xf86PrintModes(pScrn);
xf86SetDpi(pScrn, 0, 0);
- switch (pScrn->bitsPerPixel) {
- case 8: mod = "cfb"; break;
- case 16:mod = "cfb16"; break;
- case 24:mod = "cfb24"; break;
- case 32:mod = "cfb32"; break;
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unexpected bpp (%d)\n", pScrn->bitsPerPixel);
- VMWAREFreeRec(pScrn);
- return FALSE;
- }
- if (mod && !xf86LoadSubModule(pScrn, mod)) {
+ if (!xf86LoadSubModule(pScrn, "fb")) {
VMWAREFreeRec(pScrn);
return FALSE;
}
@@ -883,68 +872,25 @@ VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
+ miSetPixmapDepths ();
+
/*
* Initialise the framebuffer.
*/
- switch (pScrn->bitsPerPixel) {
-#if 0
- case 1:
- ret = xf1bppScreenInit(pScreen, pVMWARE->FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
- case 4:
- ret = xf4bppScreenInit(pScreen, pVMWARE->FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
-#endif
- case 8:
- /*
- * In ScreenToPrivate, below, we register our own
- * CopyPlane proc (via mfbRegisterCopyPlaneProc).
- * But we can't handle all cases, so we have to stash
- * away a pointer to someone who can.
- */
- pVMWARE->pcfbCopyPlane = cfbCopyPlane;
- ret = cfbScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
- case 16:
- pVMWARE->pcfbCopyPlane = cfb16CopyPlane;
- ret = cfb16ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
- case 24:
- pVMWARE->pcfbCopyPlane = cfb24CopyPlane;
- ret = cfb24ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
- case 32:
- pVMWARE->pcfbCopyPlane = cfb32CopyPlane;
- ret = cfb32ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
- default:
- xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) in VMWAREScreenInit\n",
- pScrn->bitsPerPixel);
- ret = FALSE;
- break;
- }
+ ret = fbScreenInit (pScreen, pVMWARE->FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth,
+ pScrn->bitsPerPixel);
+
if (!ret)
return FALSE;
+#ifdef RENDER
+ fbPictureInit (pScreen, 0, 0);
+#endif
+
/* Override the default mask/offset settings */
if (pScrn->bitsPerPixel > 8) {
int i;
@@ -993,23 +939,8 @@ VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
}
- /* Initialise the default colourmap */
- switch (pScrn->depth) {
-#if 0
- case 1:
- if (!xf1bppCreateDefColormap(pScreen))
- return FALSE;
- break;
- case 4:
- if (!xf4bppCreateDefColormap(pScreen))
- return FALSE;
- break;
-#endif
- default:
- if (!cfbCreateDefColormap(pScreen))
- return FALSE;
- break;
- }
+ if (!fbCreateDefColormap(pScreen))
+ return FALSE;
if (!xf86HandleColormaps(pScreen, 256, 8,
VMWARELoadPalette, NULL,
@@ -1091,7 +1022,12 @@ VMWAREProbe(DriverPtr drv, int flags)
numUsed = xf86MatchPciInstances(VMWARE_NAME, PCI_VENDOR_VMWARE,
VMWAREChipsets, VMWAREPciChipsets, devSections,
numDevSections, drv, &usedChips);
- for (i = 0; i < numUsed; i++) {
+ xfree(devSections);
+ if (numUsed <= 0)
+ return FALSE;
+ if (flags & PROBE_DETECT)
+ foundScreen = TRUE;
+ else for (i = 0; i < numUsed; i++) {
ScrnInfoPtr pScrn = NULL;
VmwareLog(("Even some VMware SVGA PCI instances exists\n"));
@@ -1115,11 +1051,8 @@ VMWAREProbe(DriverPtr drv, int flags)
foundScreen = TRUE;
}
}
- if (numUsed > 0) {
- xfree(usedChips);
- }
+ xfree(usedChips);
}
- xfree(devSections);
return foundScreen;
}
@@ -1250,7 +1183,6 @@ ScreenToPrivate(ScreenPtr pScreen, ScrnInfoPtr pScrn)
#endif
- mfbRegisterCopyPlaneProc(pScreen, vmwareCopyPlane);
pScreen->PaintWindowBackground = vmwarePaintWindow;
pScreen->PaintWindowBorder = vmwarePaintWindow;
pScreen->CopyWindow = vmwareCopyWindow;