Metalkit test 2dmark can trigger VMX host panic when it detects SVGA

FIFO is re-initialized while vmx is processing it.  To fix this issue,
I suggest metalkit SVGA_SetMode should handle mode transitions and
new function SVGA_Enable should initialize the FIFO.
This commit is contained in:
Kurt Daverman 2010-10-12 19:35:42 +00:00
parent 4a5a01ab57
commit 2a7c8577f5
2 changed files with 44 additions and 18 deletions

View file

@ -116,6 +116,7 @@ SVGA_Init(void)
* does not support the FIFO buffer at all. * does not support the FIFO buffer at all.
*/ */
gSVGA.vramSize = SVGA_ReadReg(SVGA_REG_VRAM_SIZE);
gSVGA.fbSize = SVGA_ReadReg(SVGA_REG_FB_SIZE); gSVGA.fbSize = SVGA_ReadReg(SVGA_REG_FB_SIZE);
gSVGA.fifoSize = SVGA_ReadReg(SVGA_REG_MEM_SIZE); gSVGA.fifoSize = SVGA_ReadReg(SVGA_REG_MEM_SIZE);
@ -163,41 +164,30 @@ SVGA_Init(void)
Intr_SetHandler(IRQ_VECTOR(irq), SVGAInterruptHandler); Intr_SetHandler(IRQ_VECTOR(irq), SVGAInterruptHandler);
Intr_SetMask(irq, TRUE); Intr_SetMask(irq, TRUE);
} }
SVGA_Enable();
} }
/* /*
*----------------------------------------------------------------------------- *-----------------------------------------------------------------------------
* *
* SVGA_SetMode -- * SVGA_Enable --
* *
* This switches to SVGA video mode, and enables the command FIFO. * Enable the SVGA device along with the SVGA FIFO.
* *
* Results: * Results:
* void. * void.
* *
* Side effects: * Side effects:
* Switches modes. Disables legacy video modes (VGA, VBE). * Initializes the command FIFO.
* Clears the command FIFO, and asks the host to start processing it.
* *
*----------------------------------------------------------------------------- *-----------------------------------------------------------------------------
*/ */
void void
SVGA_SetMode(uint32 width, // IN SVGA_Enable(void)
uint32 height, // IN
uint32 bpp) // IN
{ {
gSVGA.width = width;
gSVGA.height = height;
gSVGA.bpp = bpp;
SVGA_WriteReg(SVGA_REG_WIDTH, width);
SVGA_WriteReg(SVGA_REG_HEIGHT, height);
SVGA_WriteReg(SVGA_REG_BITS_PER_PIXEL, bpp);
SVGA_WriteReg(SVGA_REG_ENABLE, TRUE);
gSVGA.pitch = SVGA_ReadReg(SVGA_REG_BYTES_PER_LINE);
/* /*
* Initialize the command FIFO. The beginning of FIFO memory is * Initialize the command FIFO. The beginning of FIFO memory is
* used for an additional set of registers, the "FIFO registers". * used for an additional set of registers, the "FIFO registers".
@ -226,9 +216,10 @@ SVGA_SetMode(uint32 width, // IN
} }
/* /*
* Enable the FIFO. * Enable the SVGA device and FIFO.
*/ */
SVGA_WriteReg(SVGA_REG_ENABLE, TRUE);
SVGA_WriteReg(SVGA_REG_CONFIG_DONE, TRUE); SVGA_WriteReg(SVGA_REG_CONFIG_DONE, TRUE);
/* /*
@ -288,6 +279,39 @@ SVGA_Disable(void)
} }
/*
*-----------------------------------------------------------------------------
*
* SVGA_SetMode --
*
* This switches the SVGA video mode and enables SVGA device.
*
* Results:
* void.
*
* Side effects:
* Transitions to SVGA mode if SVGA device currently disabled.
*
*-----------------------------------------------------------------------------
*/
void
SVGA_SetMode(uint32 width, // IN
uint32 height, // IN
uint32 bpp) // IN
{
gSVGA.width = width;
gSVGA.height = height;
gSVGA.bpp = bpp;
SVGA_WriteReg(SVGA_REG_WIDTH, width);
SVGA_WriteReg(SVGA_REG_HEIGHT, height);
SVGA_WriteReg(SVGA_REG_BITS_PER_PIXEL, bpp);
SVGA_WriteReg(SVGA_REG_ENABLE, TRUE);
gSVGA.pitch = SVGA_ReadReg(SVGA_REG_BYTES_PER_LINE);
}
/* /*
*----------------------------------------------------------------------------- *-----------------------------------------------------------------------------
* *

View file

@ -53,6 +53,7 @@ typedef struct SVGADevice {
uint8 *fbMem; uint8 *fbMem;
uint32 fifoSize; uint32 fifoSize;
uint32 fbSize; uint32 fbSize;
uint32 vramSize;
uint32 deviceVersionId; uint32 deviceVersionId;
uint32 capabilities; uint32 capabilities;
@ -82,6 +83,7 @@ typedef struct SVGADevice {
extern SVGADevice gSVGA; extern SVGADevice gSVGA;
void SVGA_Init(void); void SVGA_Init(void);
void SVGA_Enable(void);
void SVGA_SetMode(uint32 width, uint32 height, uint32 bpp); void SVGA_SetMode(uint32 width, uint32 height, uint32 bpp);
void SVGA_Disable(void); void SVGA_Disable(void);
void SVGA_Panic(const char *err); void SVGA_Panic(const char *err);