screen.c revision bd9987a5cea6755c011b29a419474e093a75d97c
/******************************Module*Header*******************************\
*
* *******************
* * GDI SAMPLE CODE *
* *******************
*
* Module Name: screen.c
*
* Initializes the GDIINFO and DEVINFO structures for DrvEnablePDEV.
*
* Copyright (c) 1992-1998 Microsoft Corporation
\**************************************************************************/
#include "driver.h"
#define SYSTM_LOGFONT {16,7,0,0,700,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,VARIABLE_PITCH | FF_DONTCARE,L"System"}
#define HELVE_LOGFONT {12,9,0,0,400,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_STROKE_PRECIS,PROOF_QUALITY,VARIABLE_PITCH | FF_DONTCARE,L"MS Sans Serif"}
#define COURI_LOGFONT {12,9,0,0,400,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_STROKE_PRECIS,PROOF_QUALITY,FIXED_PITCH | FF_DONTCARE, L"Courier"}
// This is the basic devinfo for a default driver. This is used as a base and customized based
// on information passed back from the miniport driver.
const DEVINFO gDevInfoFrameBuffer = {
#ifdef VBOX_WITH_DDRAW
#endif
), /* Graphics capabilities */
SYSTM_LOGFONT, /* Default font description */
HELVE_LOGFONT, /* ANSI variable font description */
COURI_LOGFONT, /* ANSI fixed font description */
0, /* Count of device fonts */
0, /* Preferred DIB format */
8, /* Width of color dither */
8, /* Height of color dither */
0 /* Default palette to use for this device */
};
/* Setup display information after remapping. */
{
NULL,
0,
&DispInfo,
sizeof(DispInfo),
{
return;
}
if (returnedDataLength != sizeof (QUERYDISPLAYINFORESULT)
{
DISPDBG((1, "DISP bInitSURF failed DispInfo.u32DisplayInfoSize 0x%x >= pMemoryInformation->VideoRamLength 0x%x\n",
ppdev->cbDisplayInformation = 0;
return;
}
pu8 += sizeof (VBOXDISPLAYINFO);
}
{
{
}
}
/******************************Public*Routine******************************\
* bInitSURF
*
* Enables the surface. Maps the frame buffer into memory.
*
\**************************************************************************/
{
ULONG RemappingNeeded = 0;
//
// Set the current mode into the hardware.
//
sizeof(ULONG),
sizeof(ULONG),
{
return(FALSE);
}
//
// If this is the first time we enable the surface we need to map in the
// memory also.
//
if (bFirst || RemappingNeeded)
{
sizeof(VIDEO_MEMORY),
sizeof(VIDEO_MEMORY_INFORMATION),
{
return(FALSE);
}
{
DISPDBG((0, "VideoRamBase does not correspond to FrameBufferBase\n"));
}
//
// Make sure we can access this video memory
//
return(FALSE);
}
//
// Initialize the head of the offscreen list to NULL.
//
// It's a hardware pointer; set up pointer attributes.
// device supports a color Pointer, we will allocate a larger bitmap.
// If this is a color bitmap we allocate for the largest possible
// bitmap because we have no idea of what the pixel depth might be.
// Width rounded up to nearest byte multiple
{
}
else
{
}
sizeof(VIDEO_POINTER_ATTRIBUTES) +
DISPDBG((0, "bInitPointer EngAllocMem failed\n"));
return(FALSE);
}
/* Setup the display information. */
}
{
{
/* Enable VBVA for this video mode. */
}
}
/* Update the display information. */
return(TRUE);
}
/******************************Public*Routine******************************\
* vDisableSURF
*
* Disable the surface. Un-Maps the frame in memory.
*
\**************************************************************************/
{
sizeof(VIDEO_MEMORY),
NULL,
0,
{
DISPDBG((0, "DISP vDisableSURF failed IOCTL_VIDEO_UNMAP\n"));
}
}
/******************************Public*Routine******************************\
* bInitPDEV
*
* Determine the mode we should be in based on the DEVMODE passed in.
* Query mini-port to get information needed to fill in the DevInfo and the
* GdiInfo .
*
\**************************************************************************/
{
//
// calls the miniport to get mode information.
//
if (cModes == 0)
{
return(FALSE);
}
//
// Now see if the requested mode has a match in that table.
//
if ((pDevMode->dmPelsWidth == 0) &&
(pDevMode->dmPelsHeight == 0) &&
(pDevMode->dmBitsPerPel == 0) &&
(pDevMode->dmDisplayFrequency == 0))
{
}
else
{
}
while (cModes--)
{
if (pVideoTemp->Length != 0)
{
if (bSelectDefault ||
{
break;
}
}
}
//
// If no mode has been found, return an error
//
if (pVideoModeSelected == NULL)
{
DISPDBG((0,"DISP bInitPDEV failed - no valid modes\n"));
return(FALSE);
}
//
// Fill in the GDIINFO data structure with the information returned from
// the kernel driver.
//
/* bit block transfers are accelerated */
pGdiInfo->ulBltAlignment = 0;
#ifdef MIPS
else
#endif
pGdiInfo->ptlPhysOffset.x = 0;
pGdiInfo->ptlPhysOffset.y = 0;
// RGB and CMY color info.
//
// try to get it from the miniport.
// if the miniport doesn ot support this feature, use defaults.
//
NULL,
0,
sizeof(VIDEO_COLOR_CAPABILITIES),
&ulTemp))
{
}
else
{
// if we have a color device store the three color gamma values,
// otherwise store the unique gamma value in all three.
{
}
else
{
}
};
// No dye correction for raster displays.
// Note: this should be modified later to take into account the size
// of the display and the resolution.
// Fill in the basic devinfo structure
// Fill in the rest of the devinfo and GdiInfo structures.
{
// It is Palette Managed.
// Assuming palette is orthogonal - all colors are same size.
}
else
{
pGdiInfo->ulNumPalReg = 0;
{
}
{
}
else
{
}
}
return(TRUE);
}
/******************************Public*Routine******************************\
* getAvailableModes
*
* Calls the miniport to get the list of modes supported by the kernel driver,
* and returns the list of modes supported by the diplay driver among those
*
* returns the number of entries in the videomode buffer.
* 0 means no modes are supported by the miniport or that an error occured.
*
* NOTE: the buffer must be freed up by the caller.
*
\**************************************************************************/
{
//
// Get the number of modes supported by the mini-port
//
NULL,
0,
&modes,
sizeof(VIDEO_NUM_MODES),
&ulTemp))
{
DISPDBG((0, "getAvailableModes failed VIDEO_QUERY_NUM_AVAIL_MODES\n"));
return(0);
}
//
// Allocate the buffer for the mini-port to write the modes in.
//
{
DISPDBG((0, "getAvailableModes failed EngAllocMem\n"));
return 0;
}
//
// Ask the mini-port to fill in the available modes.
//
NULL,
0,
&ulTemp))
{
DISPDBG((0, "getAvailableModes failed VIDEO_QUERY_AVAIL_MODES\n"));
return(0);
}
//
// Now see which of these modes are supported by the display driver.
// As an internal mechanism, set the length to 0 for the modes we
// DO NOT support.
//
//
// Mode is rejected if it is not one plane, or not graphics, or is not
// one of 8, 16 or 32 bits per pel.
//
while (ulTemp--)
{
{
pVideoTemp->Length = 0;
}
}
}