summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:49:00 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:49:00 +0000
commit37d456e499fd76f2b4f2b261183abf6f926bd96c (patch)
tree47cf9a165d23673837b13c0e14870c771a762f21 /src
parent3f6319e455fb4792ecb1ed4853030062315ddb07 (diff)
merge latest (4.3.99.16) from XFree86 (vendor) branchXORG-RELEASE-1-BASEXEVIE-MERGEXEVIE-BASE
Diffstat (limited to 'src')
-rw-r--r--src/vmware.c16
-rw-r--r--src/vmware.h29
-rw-r--r--src/vmwarexaa.c66
3 files changed, 61 insertions, 50 deletions
diff --git a/src/vmware.c b/src/vmware.c
index d21ebb7..b5cbaf9 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -6,7 +6,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.17 2003/02/18 19:10:36 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c,v 1.19 2003/10/30 17:37:16 tsi Exp $ */
/*
* TODO: support the vmware linux kernel fb driver (Option "UseFBDev").
@@ -432,7 +432,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
pVMWARE->PciInfo->ioBase[0] + SVGA_VALUE_PORT;
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VMware SVGA regs at (0x%04x, 0x%04x)\n",
+ "VMware SVGA regs at (0x%04lx, 0x%04lx)\n",
pVMWARE->indexReg, pVMWARE->valueReg);
id = VMXGetVMwareSvgaId(pVMWARE);
@@ -494,7 +494,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "bpp: %d\n", pVMWARE->bitsPerPixel);
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "vram: %d\n", pVMWARE->videoRam);
- xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "pbase: %p\n", pVMWARE->memPhysBase);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "pbase: 0x%08lx\n", pVMWARE->memPhysBase);
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mwidt: %d\n", pVMWARE->maxWidth);
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mheig: %d\n", pVMWARE->maxHeight);
@@ -578,11 +578,11 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED,
2, "bpp: %d\n", pVMWARE->bitsPerPixel);
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED,
- 2, "w.red: %d\n", pVMWARE->weight.red);
+ 2, "w.red: %d\n", (int)pVMWARE->weight.red);
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED,
- 2, "w.grn: %d\n", pVMWARE->weight.green);
+ 2, "w.grn: %d\n", (int)pVMWARE->weight.green);
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED,
- 2, "w.blu: %d\n", pVMWARE->weight.blue);
+ 2, "w.blu: %d\n", (int)pVMWARE->weight.blue);
xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED,
2, "vis: %d\n", pVMWARE->defaultVisual);
@@ -646,7 +646,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->chipset = (char*)xf86TokenToString(VMWAREChipsets, pVMWARE->PciInfo->chipType);
if (!pScrn->chipset) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04 is not recognised\n", pVMWARE->PciInfo->chipType);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04x is not recognised\n", pVMWARE->PciInfo->chipType);
return FALSE;
}
@@ -1303,7 +1303,7 @@ VMWAREFreeScreen(int scrnIndex, int flags)
VMWAREFreeRec(xf86Screens[scrnIndex]);
}
-static Bool
+static ModeStatus
VMWAREValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
{
return MODE_OK;
diff --git a/src/vmware.h b/src/vmware.h
index 4059275..82fec25 100644
--- a/src/vmware.h
+++ b/src/vmware.h
@@ -3,7 +3,7 @@
* All Rights Reserved
* Id: vmware.h,v 1.6 2001/01/30 18:13:47 bennett Exp $
* **********************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h,v 1.10 2003/02/04 01:39:53 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h,v 1.12 2003/11/17 22:20:38 dawes Exp $ */
#ifndef VMWARE_H
#define VMWARE_H
@@ -87,6 +87,7 @@ typedef struct {
#ifdef RENDER
CompositeProcPtr Composite;
+ void (*EnableDisableFBAccess)(int, Bool);
#endif /* RENDER */
unsigned long mmioPhysBase;
@@ -179,87 +180,61 @@ extern const char *vmwareXaaSymbols[];
#define ACCELERATE_OPS
void vmwareWriteReg(
-#if NeedFunctionPrototypes
VMWAREPtr pVMWARE, int index, CARD32 value
-#endif
);
CARD32 vmwareReadReg(
-#if NeedFunctionPrototypes
VMWAREPtr pVMWARE, int index
-#endif
);
void vmwareWriteWordToFIFO(
-#if NeedFunctionPrototypes
VMWAREPtr pVMWARE, CARD32 value
-#endif
);
void vmwareWaitForFB(
-#ifdef NeedFunctionPrototypes
VMWAREPtr pVMWARE
-#endif
);
void vmwareSendSVGACmdUpdate(
-#if NeedFunctionPrototypes
VMWAREPtr pVMWARE, BoxPtr pBB
-#endif
);
/* vmwarecurs.c */
Bool vmwareCursorInit(
-#if NeedFunctionPrototypes
ScreenPtr pScr
-#endif
);
void vmwareCursorModeInit(
-#if NeedFunctionPrototypes
ScrnInfoPtr pScrn,
DisplayModePtr mode
-#endif
);
void vmwareCursorCloseScreen(
-#if NeedFunctionPrototypes
ScreenPtr pScr
-#endif
);
void vmwareWriteCursorRegs(
-#if NeedFunctionPrototypes
VMWAREPtr pVMWARE,
Bool visible,
Bool force
-#endif
);
void vmwareCursorHookWrappers(
-#if NeedFunctionPrototypes
ScreenPtr pScreen
-#endif
);
/* vmwarexaa.c */
Bool vmwareXAAScreenInit(
-#if NeedFunctionPrototypes
ScreenPtr pScreen
-#endif
);
Bool vmwareXAAModeInit(
-#if NeedFunctionPrototypes
ScrnInfoPtr pScrn, DisplayModePtr mode
-#endif
);
void vmwareXAACloseScreen(
-#if NeedFunctionPrototypes
ScreenPtr pScreen
-#endif
);
#endif
diff --git a/src/vmwarexaa.c b/src/vmwarexaa.c
index b8e67cf..e39d14c 100644
--- a/src/vmwarexaa.c
+++ b/src/vmwarexaa.c
@@ -6,7 +6,7 @@
char rcsId_vmwarexaa[] =
"Id: $";
#endif
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarexaa.c,v 1.5 2003/02/04 01:39:53 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarexaa.c,v 1.6 2003/04/13 18:09:27 dawes Exp $ */
#include "vmware.h"
@@ -67,11 +67,34 @@ static void vmwareSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
int srcx, int srcy,
int width, int height);
+static void vmwareXAAEnableDisableFBAccess(int index, Bool enable);
+
CARD32 vmwareAlphaTextureFormats[2] = {PICT_a8, 0};
CARD32 vmwareTextureFormats[2] = {PICT_a8r8g8b8, 0};
#endif
+#define SCRATCH_SIZE_BYTES(pvmware) \
+ (((OFFSCREEN_SCRATCH_SIZE + (pvmware)->fbPitch - 1) / \
+ (pvmware)->fbPitch) * (pvmware)->fbPitch)
+
+static void vmwareXAACreateHeap(ScreenPtr pScreen, ScrnInfoPtr pScrn,
+ VMWAREPtr pVMWARE) {
+ int scratchSizeBytes = SCRATCH_SIZE_BYTES(pVMWARE);
+ CARD8* osPtr = pVMWARE->FbBase + pVMWARE->videoRam - scratchSizeBytes;
+
+ pVMWARE->heap = vmwareHeap_Create(osPtr,
+ scratchSizeBytes,
+ OFFSCREEN_SCRATCH_MAX_SLOTS,
+ pVMWARE->videoRam - scratchSizeBytes,
+ pScrn->virtualX,
+ pScrn->virtualY,
+ pVMWARE->bitsPerPixel,
+ pVMWARE->fbPitch,
+ pVMWARE->fbOffset);
+ pVMWARE->frontBuffer = vmwareHeap_GetFrontBuffer(pVMWARE->heap);
+}
+
#define DESTROY_XAA_INFO(pVMWARE) \
if (pVMWARE->xaaInfo) { XAADestroyInfoRec(pVMWARE->xaaInfo); \
pVMWARE->xaaInfo = NULL; }
@@ -129,8 +152,7 @@ vmwareXAAScreenInit(ScreenPtr pScreen)
}
if (pVMWARE->vmwareCapability & SVGA_CAP_OFFSCREEN_1) {
- int scratchSizeBytes = ((OFFSCREEN_SCRATCH_SIZE + pVMWARE->fbPitch - 1) /
- pVMWARE->fbPitch) * pVMWARE->fbPitch;
+ int scratchSizeBytes = SCRATCH_SIZE_BYTES(pVMWARE);
BoxRec box;
RegionRec region;
@@ -143,24 +165,13 @@ vmwareXAAScreenInit(ScreenPtr pScreen)
if (pVMWARE->vmwareCapability & SVGA_CAP_ALPHA_BLEND &&
pScrn->bitsPerPixel > 8) {
if (box.y2 - (scratchSizeBytes / pVMWARE->fbPitch) > box.y1 + 4) {
- CARD8* osPtr = pVMWARE->FbBase + pVMWARE->videoRam -
- scratchSizeBytes;
box.y2 -= scratchSizeBytes / pVMWARE->fbPitch;
VmwareLog(("Allocated %d bytes at offset %d for alpha scratch\n",
scratchSizeBytes,
pVMWARE->videoRam - scratchSizeBytes));
- pVMWARE->heap = vmwareHeap_Create(osPtr,
- scratchSizeBytes,
- OFFSCREEN_SCRATCH_MAX_SLOTS,
- pVMWARE->videoRam - scratchSizeBytes,
- pScrn->virtualX,
- pScrn->virtualY,
- pVMWARE->bitsPerPixel,
- pVMWARE->fbPitch,
- pVMWARE->fbOffset);
- pVMWARE->frontBuffer = vmwareHeap_GetFrontBuffer(pVMWARE->heap);
+ vmwareXAACreateHeap(pScreen, pScrn, pVMWARE);
xaaInfo->SetupForCPUToScreenAlphaTexture =
vmwareSetupForCPUToScreenAlphaTexture;
@@ -207,6 +218,13 @@ vmwareXAAScreenInit(ScreenPtr pScreen)
return FALSE;
}
+#ifdef RENDER
+ if (pVMWARE->heap) {
+ pVMWARE->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
+ pScrn->EnableDisableFBAccess = vmwareXAAEnableDisableFBAccess;
+ }
+#endif
+
return TRUE;
}
@@ -250,6 +268,8 @@ vmwareXAACloseScreen(ScreenPtr pScreen)
#ifdef RENDER
if (pVMWARE->heap) {
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ pScrn->EnableDisableFBAccess = pVMWARE->EnableDisableFBAccess;
vmwareHeap_Destroy(pVMWARE->heap);
pVMWARE->heap = NULL;
}
@@ -546,4 +566,20 @@ vmwareSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
vmwareWriteWordToFIFO(pVMWARE, 0); /* param1 */
vmwareWriteWordToFIFO(pVMWARE, 0); /* param2 */
}
+
+void
+vmwareXAAEnableDisableFBAccess(int index, Bool enable)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ScreenPtr pScreen = pScrn->pScreen;
+ VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+
+ if (enable && pVMWARE->heap) {
+ vmwareHeap_Destroy(pVMWARE->heap);
+ vmwareXAACreateHeap(pScreen, pScrn, pVMWARE);
+ }
+
+ (*pVMWARE->EnableDisableFBAccess)(index, enable);
+}
+
#endif