ULONG DrvGetModes( HANDLE hDriver, ULONG cjSize, DEVMODEW *pdm) { DWORD cModes; DWORD cbOutputSize; PVIDEO_MODE_INFORMATION pVideoModeInformation, pVideoTemp; DWORD cOutputModes = cjSize / (sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE); DWORD cbModeSize; DISPDBG((3, "DrvGetModes\n")); cModes = getAvailableModes(hDriver, (PVIDEO_MODE_INFORMATION *) &pVideoModeInformation, &cbModeSize); if (cModes == 0) { DISPDBG((0, "DrvGetModes failed to get mode information")); return 0; } if (pdm == NULL) { cbOutputSize = cModes * (sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE); } else { // // Now copy the information for the supported modes back into the output // buffer // cbOutputSize = 0; pVideoTemp = pVideoModeInformation; do { if (pVideoTemp->Length != 0) { if (cOutputModes == 0) { break; } // // Zero the entire structure to start off with. // memset(pdm, 0, sizeof(DEVMODEW)); // // Set the name of the device to the name of the DLL. // memcpy(pdm->dmDeviceName, DLL_NAME, sizeof(DLL_NAME)); pdm->dmSpecVersion = DM_SPECVERSION; pdm->dmDriverVersion = DM_SPECVERSION; pdm->dmSize = sizeof(DEVMODEW); pdm->dmDriverExtra = DRIVER_EXTRA_SIZE; pdm->dmBitsPerPel = pVideoTemp->NumberOfPlanes * pVideoTemp->BitsPerPlane; pdm->dmPelsWidth = pVideoTemp->VisScreenWidth; pdm->dmPelsHeight = pVideoTemp->VisScreenHeight; pdm->dmDisplayFrequency = pVideoTemp->Frequency; pdm->dmDisplayFlags = 0; pdm->dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY | DM_DISPLAYFLAGS ; // // Go to the next DEVMODE entry in the buffer. // cOutputModes--; pdm = (LPDEVMODEW) ( ((ULONG)pdm) + sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE); cbOutputSize += (sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE); } pVideoTemp = (PVIDEO_MODE_INFORMATION) (((PUCHAR)pVideoTemp) + cbModeSize); } while (--cModes); } EngFreeMem(pVideoModeInformation); return cbOutputSize; }
BOOL bInitializeModeFields( PDEV* ppdev, GDIINFO* pgdi, DEVINFO* pdi, DEVMODEW* pdm) { ULONG cModes; PVIDEO_MODE_INFORMATION pVideoBuffer; PVIDEO_MODE_INFORMATION pVideoModeSelected; PVIDEO_MODE_INFORMATION pVideoTemp; BOOL bSelectDefault; VIDEO_MODE_INFORMATION VideoModeInformation; ULONG cbModeSize; // Call the miniport to get mode information cModes = getAvailableModes(ppdev->hDriver, &pVideoBuffer, &cbModeSize); if (cModes == 0) goto ReturnFalse; // Now see if the requested mode has a match in that table. pVideoModeSelected = NULL; pVideoTemp = pVideoBuffer; if ((pdm->dmPelsWidth == 0) && (pdm->dmPelsHeight == 0) && (pdm->dmBitsPerPel == 0) && (pdm->dmDisplayFrequency == 0)) { DISPDBG((1, "Default mode requested")); bSelectDefault = TRUE; } else { DISPDBG((1, "Requested mode...")); DISPDBG((1, " Screen width -- %li", pdm->dmPelsWidth)); DISPDBG((1, " Screen height -- %li", pdm->dmPelsHeight)); DISPDBG((1, " Bits per pel -- %li", pdm->dmBitsPerPel)); DISPDBG((1, " Frequency -- %li", pdm->dmDisplayFrequency)); bSelectDefault = FALSE; } while (cModes--) { if (pVideoTemp->Length != 0) { DISPDBG((2, " Checking against miniport mode:")); DISPDBG((2, " Screen width -- %li", pVideoTemp->VisScreenWidth)); DISPDBG((2, " Screen height -- %li", pVideoTemp->VisScreenHeight)); DISPDBG((2, " Bits per pel -- %li", pVideoTemp->BitsPerPlane * pVideoTemp->NumberOfPlanes)); DISPDBG((2, " Frequency -- %li", pVideoTemp->Frequency)); if (bSelectDefault || ((pVideoTemp->VisScreenWidth == pdm->dmPelsWidth) && (pVideoTemp->VisScreenHeight == pdm->dmPelsHeight) && (pVideoTemp->BitsPerPlane * pVideoTemp->NumberOfPlanes == pdm->dmBitsPerPel) && (pVideoTemp->Frequency == pdm->dmDisplayFrequency))) { pVideoModeSelected = pVideoTemp; DISPDBG((1, "...Found a mode match!")); break; } } pVideoTemp = (PVIDEO_MODE_INFORMATION) (((PUCHAR)pVideoTemp) + cbModeSize); } // If no mode has been found, return an error if (pVideoModeSelected == NULL) { DISPDBG((1, "...Couldn't find a mode match!")); EngFreeMem(pVideoBuffer); goto ReturnFalse; } // We have chosen the one we want. Save it in a stack buffer and // get rid of allocated memory before we forget to free it. VideoModeInformation = *pVideoModeSelected; EngFreeMem(pVideoBuffer); // Set up screen information from the mini-port: ppdev->ulMode = VideoModeInformation.ModeIndex; ppdev->cxScreen = VideoModeInformation.VisScreenWidth; ppdev->cyScreen = VideoModeInformation.VisScreenHeight; ppdev->iBitmapFormat = BMF_4BPP; DISPDBG((1, "ScreenStride: %lx", VideoModeInformation.ScreenStride)); ppdev->flHooks = (HOOK_BITBLT | HOOK_TEXTOUT | HOOK_COPYBITS | HOOK_STROKEPATH | HOOK_PAINT); // Fill in the GDIINFO data structure with the default 4bpp values: *pgdi = ggdiDefault; // Now overwrite the defaults with the relevant information returned // from the kernel driver: pgdi->ulHorzSize = VideoModeInformation.XMillimeter; pgdi->ulVertSize = VideoModeInformation.YMillimeter; pgdi->ulHorzRes = VideoModeInformation.VisScreenWidth; pgdi->ulVertRes = VideoModeInformation.VisScreenHeight; pgdi->ulPanningHorzRes = VideoModeInformation.VisScreenWidth; pgdi->ulPanningVertRes = VideoModeInformation.VisScreenHeight; pgdi->cBitsPixel = VideoModeInformation.BitsPerPlane; pgdi->cPlanes = VideoModeInformation.NumberOfPlanes; pgdi->ulVRefresh = VideoModeInformation.Frequency; pgdi->ulDACRed = VideoModeInformation.NumberRedBits; pgdi->ulDACGreen = VideoModeInformation.NumberGreenBits; pgdi->ulDACBlue = VideoModeInformation.NumberBlueBits; pgdi->ulLogPixelsX = pdm->dmLogPixels; pgdi->ulLogPixelsY = pdm->dmLogPixels; // Fill in the devinfo structure with the default 4bpp values: *pdi = gdevinfoDefault; return(TRUE); ReturnFalse: DISPDBG((0, "Failed bInitializeModeFields")); return(FALSE); }
BOOL bInitPDEV( PPDEV ppdev, DEVMODEW *pDevMode, GDIINFO *pGdiInfo, DEVINFO *pDevInfo) { ULONG cModes; PVIDEO_MODE_INFORMATION pVideoBuffer, pVideoModeSelected, pVideoTemp; BOOL bSelectDefault; ULONG cbModeSize; // // calls the miniport to get mode information. // cModes = getAvailableModes(ppdev->hDriver, &pVideoBuffer, &cbModeSize); if (cModes == 0) { DISPDBG((0, "no available modes\n")); return(FALSE); } // // Determine if we are looking for a default mode. // if ( ((pDevMode->dmPelsWidth) || (pDevMode->dmPelsHeight) || (pDevMode->dmBitsPerPel) || (pDevMode->dmDisplayFlags) || (pDevMode->dmDisplayFrequency)) == 0) { bSelectDefault = TRUE; } else { bSelectDefault = FALSE; } // // Now see if the requested mode has a match in that table. // pVideoModeSelected = NULL; pVideoTemp = pVideoBuffer; // // Note: Not all vga minports support the frequency field. Those // that do not support fill it in with zero. Also, if the registry // entry is set to 0, we will ignore the freq. // while (cModes--) { if (pVideoTemp->Length != 0) { if (bSelectDefault || ((pVideoTemp->VisScreenWidth == pDevMode->dmPelsWidth) && (pVideoTemp->VisScreenHeight == pDevMode->dmPelsHeight) && (pVideoTemp->BitsPerPlane * pVideoTemp->NumberOfPlanes == pDevMode->dmBitsPerPel) && (pVideoTemp->Frequency == pDevMode->dmDisplayFrequency))) { pVideoModeSelected = pVideoTemp; DISPDBG((1, "Found a match\n")) ; break; } } pVideoTemp = (PVIDEO_MODE_INFORMATION) (((PUCHAR)pVideoTemp) + cbModeSize); } // // If no mode has been found, return an error // if (pVideoModeSelected == NULL) { DISPDBG((0, "no valid modes\n")); EngFreeMem(pVideoBuffer); return(FALSE); } // // Save the mode number we selected // ppdev->ulModeNum = pVideoModeSelected->ModeIndex; // // Set the displayed surface dimensions from the DEVMODE // ppdev->sizlSurf.cx = pVideoModeSelected->VisScreenWidth; ppdev->sizlSurf.cy = pVideoModeSelected->VisScreenHeight; // // Set the GDI info that varies with resolution // pGdiInfo->ulHorzRes = pVideoModeSelected->VisScreenWidth; pGdiInfo->ulVertRes = pVideoModeSelected->VisScreenHeight; pGdiInfo->ulPanningHorzRes = pVideoModeSelected->VisScreenWidth; pGdiInfo->ulPanningVertRes = pVideoModeSelected->VisScreenHeight; pGdiInfo->ulHorzSize = pVideoModeSelected->XMillimeter; pGdiInfo->ulVertSize = pVideoModeSelected->YMillimeter; pGdiInfo->ulDevicePelsDPI = (pVideoModeSelected->VisScreenWidth * 254)/2400; pGdiInfo->ulVRefresh = pVideoModeSelected->Frequency; pGdiInfo->ulLogPixelsX = pDevMode->dmLogPixels; pGdiInfo->ulLogPixelsY = pDevMode->dmLogPixels; if (!(pVideoModeSelected->AttributeFlags & VIDEO_MODE_NO_OFF_SCREEN)) { ppdev->fl |= DRIVER_OFFSCREEN_REFRESHED; } EngFreeMem(pVideoBuffer); return TRUE; }
BOOL NTAPI bInitPDEV( PPDEV ppdev, DEVMODEW *pDevMode, GDIINFO *pGdiInfo, DEVINFO *pDevInfo) { ULONG cModes; PVIDEO_MODE_INFORMATION pVideoBuffer, pVideoModeSelected, pVideoTemp; VIDEO_COLOR_CAPABILITIES colorCapabilities; ULONG ulTemp; BOOL bSelectDefault; ULONG cbModeSize; // // calls the miniport to get mode information. // cModes = getAvailableModes(ppdev->hDriver, &pVideoBuffer, &cbModeSize); if (cModes == 0) { return(FALSE); } // // Now see if the requested mode has a match in that table. // pVideoModeSelected = NULL; pVideoTemp = pVideoBuffer; if ((pDevMode->dmPelsWidth == 0) && (pDevMode->dmPelsHeight == 0) && (pDevMode->dmBitsPerPel == 0) && (pDevMode->dmDisplayFrequency == 0)) { DISPDBG((2, "Default mode requested")); bSelectDefault = TRUE; } else { // eVb: 2.5 [DDK Change] - Add missing newlines to debug output DISPDBG((2, "Requested mode...\n")); DISPDBG((2, " Screen width -- %li\n", pDevMode->dmPelsWidth)); DISPDBG((2, " Screen height -- %li\n", pDevMode->dmPelsHeight)); DISPDBG((2, " Bits per pel -- %li\n", pDevMode->dmBitsPerPel)); DISPDBG((2, " Frequency -- %li\n", pDevMode->dmDisplayFrequency)); // eVb: 2.5 [END] bSelectDefault = FALSE; } while (cModes--) { if (pVideoTemp->Length != 0) { if (bSelectDefault || ((pVideoTemp->VisScreenWidth == pDevMode->dmPelsWidth) && (pVideoTemp->VisScreenHeight == pDevMode->dmPelsHeight) && (pVideoTemp->BitsPerPlane * pVideoTemp->NumberOfPlanes == pDevMode->dmBitsPerPel) && (pVideoTemp->Frequency == pDevMode->dmDisplayFrequency))) { pVideoModeSelected = pVideoTemp; DISPDBG((3, "Found a match\n")) ; break; } } pVideoTemp = (PVIDEO_MODE_INFORMATION) (((PUCHAR)pVideoTemp) + cbModeSize); } // // If no mode has been found, return an error // if (pVideoModeSelected == NULL) { EngFreeMem(pVideoBuffer); 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. // ppdev->ulMode = pVideoModeSelected->ModeIndex; ppdev->cxScreen = pVideoModeSelected->VisScreenWidth; ppdev->cyScreen = pVideoModeSelected->VisScreenHeight; ppdev->ulBitCount = pVideoModeSelected->BitsPerPlane * pVideoModeSelected->NumberOfPlanes; ppdev->lDeltaScreen = pVideoModeSelected->ScreenStride; ppdev->flRed = pVideoModeSelected->RedMask; ppdev->flGreen = pVideoModeSelected->GreenMask; ppdev->flBlue = pVideoModeSelected->BlueMask; pGdiInfo->ulVersion = GDI_DRIVER_VERSION; pGdiInfo->ulTechnology = DT_RASDISPLAY; pGdiInfo->ulHorzSize = pVideoModeSelected->XMillimeter; pGdiInfo->ulVertSize = pVideoModeSelected->YMillimeter; pGdiInfo->ulHorzRes = ppdev->cxScreen; pGdiInfo->ulVertRes = ppdev->cyScreen; pGdiInfo->ulPanningHorzRes = ppdev->cxScreen; pGdiInfo->ulPanningVertRes = ppdev->cyScreen; pGdiInfo->cBitsPixel = pVideoModeSelected->BitsPerPlane; pGdiInfo->cPlanes = pVideoModeSelected->NumberOfPlanes; pGdiInfo->ulVRefresh = pVideoModeSelected->Frequency; pGdiInfo->ulBltAlignment = 1; // We don't have accelerated screen- // to-screen blts, and any // window alignment is okay pGdiInfo->ulLogPixelsX = pDevMode->dmLogPixels; pGdiInfo->ulLogPixelsY = pDevMode->dmLogPixels; #ifdef MIPS if (ppdev->ulBitCount == 8) pGdiInfo->flTextCaps = (TC_RA_ABLE | TC_SCROLLBLT); else #endif pGdiInfo->flTextCaps = TC_RA_ABLE; pGdiInfo->flRaster = 0; // flRaster is reserved by DDI pGdiInfo->ulDACRed = pVideoModeSelected->NumberRedBits; pGdiInfo->ulDACGreen = pVideoModeSelected->NumberGreenBits; pGdiInfo->ulDACBlue = pVideoModeSelected->NumberBlueBits; pGdiInfo->ulAspectX = 0x24; // One-to-one aspect ratio pGdiInfo->ulAspectY = 0x24; pGdiInfo->ulAspectXY = 0x33; pGdiInfo->xStyleStep = 1; // A style unit is 3 pels pGdiInfo->yStyleStep = 1; pGdiInfo->denStyleStep = 3; pGdiInfo->ptlPhysOffset.x = 0; pGdiInfo->ptlPhysOffset.y = 0; pGdiInfo->szlPhysSize.cx = 0; pGdiInfo->szlPhysSize.cy = 0; // RGB and CMY color info. // // try to get it from the miniport. // if the miniport doesn ot support this feature, use defaults. // if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES, NULL, 0, &colorCapabilities, sizeof(VIDEO_COLOR_CAPABILITIES), &ulTemp)) { DISPDBG((2, "getcolorCapabilities failed \n")); pGdiInfo->ciDevice.Red.x = 6700; pGdiInfo->ciDevice.Red.y = 3300; pGdiInfo->ciDevice.Red.Y = 0; pGdiInfo->ciDevice.Green.x = 2100; pGdiInfo->ciDevice.Green.y = 7100; pGdiInfo->ciDevice.Green.Y = 0; pGdiInfo->ciDevice.Blue.x = 1400; pGdiInfo->ciDevice.Blue.y = 800; pGdiInfo->ciDevice.Blue.Y = 0; pGdiInfo->ciDevice.AlignmentWhite.x = 3127; pGdiInfo->ciDevice.AlignmentWhite.y = 3290; pGdiInfo->ciDevice.AlignmentWhite.Y = 0; pGdiInfo->ciDevice.RedGamma = 20000; pGdiInfo->ciDevice.GreenGamma = 20000; pGdiInfo->ciDevice.BlueGamma = 20000; } else { pGdiInfo->ciDevice.Red.x = colorCapabilities.RedChromaticity_x; pGdiInfo->ciDevice.Red.y = colorCapabilities.RedChromaticity_y; pGdiInfo->ciDevice.Red.Y = 0; pGdiInfo->ciDevice.Green.x = colorCapabilities.GreenChromaticity_x; pGdiInfo->ciDevice.Green.y = colorCapabilities.GreenChromaticity_y; pGdiInfo->ciDevice.Green.Y = 0; pGdiInfo->ciDevice.Blue.x = colorCapabilities.BlueChromaticity_x; pGdiInfo->ciDevice.Blue.y = colorCapabilities.BlueChromaticity_y; pGdiInfo->ciDevice.Blue.Y = 0; pGdiInfo->ciDevice.AlignmentWhite.x = colorCapabilities.WhiteChromaticity_x; pGdiInfo->ciDevice.AlignmentWhite.y = colorCapabilities.WhiteChromaticity_y; pGdiInfo->ciDevice.AlignmentWhite.Y = colorCapabilities.WhiteChromaticity_Y; // if we have a color device store the three color gamma values, // otherwise store the unique gamma value in all three. if (colorCapabilities.AttributeFlags & VIDEO_DEVICE_COLOR) { pGdiInfo->ciDevice.RedGamma = colorCapabilities.RedGamma; pGdiInfo->ciDevice.GreenGamma = colorCapabilities.GreenGamma; pGdiInfo->ciDevice.BlueGamma = colorCapabilities.BlueGamma; } else { pGdiInfo->ciDevice.RedGamma = colorCapabilities.WhiteGamma; pGdiInfo->ciDevice.GreenGamma = colorCapabilities.WhiteGamma; pGdiInfo->ciDevice.BlueGamma = colorCapabilities.WhiteGamma; } }; pGdiInfo->ciDevice.Cyan.x = 0; pGdiInfo->ciDevice.Cyan.y = 0; pGdiInfo->ciDevice.Cyan.Y = 0; pGdiInfo->ciDevice.Magenta.x = 0; pGdiInfo->ciDevice.Magenta.y = 0; pGdiInfo->ciDevice.Magenta.Y = 0; pGdiInfo->ciDevice.Yellow.x = 0; pGdiInfo->ciDevice.Yellow.y = 0; pGdiInfo->ciDevice.Yellow.Y = 0; // No dye correction for raster displays. pGdiInfo->ciDevice.MagentaInCyanDye = 0; pGdiInfo->ciDevice.YellowInCyanDye = 0; pGdiInfo->ciDevice.CyanInMagentaDye = 0; pGdiInfo->ciDevice.YellowInMagentaDye = 0; pGdiInfo->ciDevice.CyanInYellowDye = 0; pGdiInfo->ciDevice.MagentaInYellowDye = 0; pGdiInfo->ulDevicePelsDPI = 0; // For printers only pGdiInfo->ulPrimaryOrder = PRIMARY_ORDER_CBA; // BUGBUG this should be modified to take into account the size // of the display and the resolution. pGdiInfo->ulHTPatternSize = HT_PATSIZE_4x4_M; pGdiInfo->flHTFlags = HT_FLAG_ADDITIVE_PRIMS; // Fill in the basic devinfo structure *pDevInfo = gDevInfoFrameBuffer; // Fill in the rest of the devinfo and GdiInfo structures. if (ppdev->ulBitCount == 8) { // It is Palette Managed. pGdiInfo->ulNumColors = 20; pGdiInfo->ulNumPalReg = 1 << ppdev->ulBitCount; // eVb: 2.7 [DDK CHANGE] - No dithering support pDevInfo->flGraphicsCaps |= GCAPS_PALMANAGED; // eVb: 2.7 [END] pGdiInfo->ulHTOutputFormat = HT_FORMAT_8BPP; pDevInfo->iDitherFormat = BMF_8BPP; // Assuming palette is orthogonal - all colors are same size. ppdev->cPaletteShift = 8 - pGdiInfo->ulDACRed; } else { pGdiInfo->ulNumColors = (ULONG) (-1); pGdiInfo->ulNumPalReg = 0; if (ppdev->ulBitCount == 16) { pGdiInfo->ulHTOutputFormat = HT_FORMAT_16BPP; pDevInfo->iDitherFormat = BMF_16BPP; } else if (ppdev->ulBitCount == 24) { pGdiInfo->ulHTOutputFormat = HT_FORMAT_24BPP; pDevInfo->iDitherFormat = BMF_24BPP; } else { pGdiInfo->ulHTOutputFormat = HT_FORMAT_32BPP; pDevInfo->iDitherFormat = BMF_32BPP; } } EngFreeMem(pVideoBuffer); return(TRUE); }
BOOL bInitPDEV( PPDEV ppdev, DEVMODEW *pDevMode) { GDIINFO *pGdiInfo; ULONG cModes; PVIDEO_MODE_INFORMATION pVideoBuffer, pVideoModeSelected, pVideoTemp; VIDEO_COLOR_CAPABILITIES colorCapabilities; ULONG ulTemp; BOOL bSelectDefault; ULONG cbModeSize; pGdiInfo = ppdev->pGdiInfo; // // calls the miniport to get mode information. // cModes = getAvailableModes(ppdev->hDriver, &pVideoBuffer, &cbModeSize); if (cModes == 0) { DISPDBG((0, "vga64k.dll: no available modes\n")); return(FALSE); } // // Determine if we are looking for a default mode. // if ( ((pDevMode->dmPelsWidth) || (pDevMode->dmPelsHeight) || (pDevMode->dmBitsPerPel) || (pDevMode->dmDisplayFlags) || (pDevMode->dmDisplayFrequency)) == 0) { bSelectDefault = TRUE; } else { bSelectDefault = FALSE; } // // Now see if the requested mode has a match in that table. // pVideoModeSelected = NULL; pVideoTemp = pVideoBuffer; while (cModes--) { if (pVideoTemp->Length != 0) { if (bSelectDefault || ((pVideoTemp->VisScreenWidth == pDevMode->dmPelsWidth) && (pVideoTemp->VisScreenHeight == pDevMode->dmPelsHeight) && (pVideoTemp->BitsPerPlane * pVideoTemp->NumberOfPlanes == pDevMode->dmBitsPerPel) && (pVideoTemp->Frequency == pDevMode->dmDisplayFrequency))) { pVideoModeSelected = pVideoTemp; DISPDBG((2, "vga64k: Found a match\n")) ; break; } } pVideoTemp = (PVIDEO_MODE_INFORMATION) (((PUCHAR)pVideoTemp) + cbModeSize); } // // If no mode has been found, return an error // if (pVideoModeSelected == NULL) { DISPDBG((0, "vga64k.dll: no valid modes\n")); EngFreeMem(pVideoBuffer); return(FALSE); } // // Fill in the GDIINFO data structure with the information returned from // the kernel driver. // ppdev->ulMode = pVideoModeSelected->ModeIndex; ppdev->cxScreen = pVideoModeSelected->VisScreenWidth; ppdev->cyScreen = pVideoModeSelected->VisScreenHeight; ppdev->ulBitCount = pVideoModeSelected->BitsPerPlane * pVideoModeSelected->NumberOfPlanes; ppdev->lDeltaScreen = pVideoModeSelected->ScreenStride; ppdev->flRed = pVideoModeSelected->RedMask; ppdev->flGreen = pVideoModeSelected->GreenMask; ppdev->flBlue = pVideoModeSelected->BlueMask; if (!(pVideoModeSelected->AttributeFlags & VIDEO_MODE_NO_OFF_SCREEN)) { ppdev->fl |= DRIVER_USE_OFFSCREEN; } pGdiInfo->ulVersion = GDI_DRIVER_VERSION; pGdiInfo->ulTechnology = DT_RASDISPLAY; pGdiInfo->ulHorzSize = pVideoModeSelected->XMillimeter; pGdiInfo->ulVertSize = pVideoModeSelected->YMillimeter; pGdiInfo->ulHorzRes = ppdev->cxScreen; pGdiInfo->ulVertRes = ppdev->cyScreen; pGdiInfo->ulPanningHorzRes = ppdev->cxScreen; pGdiInfo->ulPanningVertRes = ppdev->cyScreen; pGdiInfo->cBitsPixel = pVideoModeSelected->BitsPerPlane; pGdiInfo->cPlanes = pVideoModeSelected->NumberOfPlanes; pGdiInfo->ulVRefresh = pVideoModeSelected->Frequency; pGdiInfo->ulBltAlignment = 1; // We're not accelerated, and we don't // care about window alignment pGdiInfo->ulLogPixelsX = pDevMode->dmLogPixels; pGdiInfo->ulLogPixelsY = pDevMode->dmLogPixels; pGdiInfo->flTextCaps = TC_RA_ABLE | TC_SCROLLBLT; pGdiInfo->flRaster = 0; // DDI reservers flRaster pGdiInfo->ulDACRed = pVideoModeSelected->NumberRedBits; pGdiInfo->ulDACGreen = pVideoModeSelected->NumberGreenBits; pGdiInfo->ulDACBlue = pVideoModeSelected->NumberBlueBits; pGdiInfo->ulAspectX = 0x24; // One-to-one aspect ratio pGdiInfo->ulAspectY = 0x24; pGdiInfo->ulAspectXY = 0x33; pGdiInfo->xStyleStep = 1; // A style unit is 3 pels pGdiInfo->yStyleStep = 1; pGdiInfo->denStyleStep = 3; pGdiInfo->ptlPhysOffset.x = 0; pGdiInfo->ptlPhysOffset.y = 0; pGdiInfo->szlPhysSize.cx = 0; pGdiInfo->szlPhysSize.cy = 0; // RGB and CMY color info. // try to get it from the miniport. // if the miniport doesn ot support this feature, use defaults. if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES, NULL, 0, &colorCapabilities, sizeof(VIDEO_COLOR_CAPABILITIES), &ulTemp)) { DISPDBG((1, "vga64k DISP getcolorCapabilities failed \n")); pGdiInfo->ciDevice.Red.x = 6700; pGdiInfo->ciDevice.Red.y = 3300; pGdiInfo->ciDevice.Red.Y = 0; pGdiInfo->ciDevice.Green.x = 2100; pGdiInfo->ciDevice.Green.y = 7100; pGdiInfo->ciDevice.Green.Y = 0; pGdiInfo->ciDevice.Blue.x = 1400; pGdiInfo->ciDevice.Blue.y = 800; pGdiInfo->ciDevice.Blue.Y = 0; pGdiInfo->ciDevice.AlignmentWhite.x = 3127; pGdiInfo->ciDevice.AlignmentWhite.y = 3290; pGdiInfo->ciDevice.AlignmentWhite.Y = 0; pGdiInfo->ciDevice.RedGamma = 20000; pGdiInfo->ciDevice.GreenGamma = 20000; pGdiInfo->ciDevice.BlueGamma = 20000; } else { pGdiInfo->ciDevice.Red.x = colorCapabilities.RedChromaticity_x; pGdiInfo->ciDevice.Red.y = colorCapabilities.RedChromaticity_y; pGdiInfo->ciDevice.Red.Y = 0; pGdiInfo->ciDevice.Green.x = colorCapabilities.GreenChromaticity_x; pGdiInfo->ciDevice.Green.y = colorCapabilities.GreenChromaticity_y; pGdiInfo->ciDevice.Green.Y = 0; pGdiInfo->ciDevice.Blue.x = colorCapabilities.BlueChromaticity_x; pGdiInfo->ciDevice.Blue.y = colorCapabilities.BlueChromaticity_y; pGdiInfo->ciDevice.Blue.Y = 0; pGdiInfo->ciDevice.AlignmentWhite.x = colorCapabilities.WhiteChromaticity_x; pGdiInfo->ciDevice.AlignmentWhite.y = colorCapabilities.WhiteChromaticity_y; pGdiInfo->ciDevice.AlignmentWhite.Y = colorCapabilities.WhiteChromaticity_Y; // if we have a color device store the three color gamma values, // otherwise store the unique gamma value in all three. if (colorCapabilities.AttributeFlags & VIDEO_DEVICE_COLOR) { pGdiInfo->ciDevice.RedGamma = colorCapabilities.RedGamma; pGdiInfo->ciDevice.GreenGamma = colorCapabilities.GreenGamma; pGdiInfo->ciDevice.BlueGamma = colorCapabilities.BlueGamma; } else { pGdiInfo->ciDevice.RedGamma = colorCapabilities.WhiteGamma; pGdiInfo->ciDevice.GreenGamma = colorCapabilities.WhiteGamma; pGdiInfo->ciDevice.BlueGamma = colorCapabilities.WhiteGamma; } }; pGdiInfo->ciDevice.Cyan.x = 0; pGdiInfo->ciDevice.Cyan.y = 0; pGdiInfo->ciDevice.Cyan.Y = 0; pGdiInfo->ciDevice.Magenta.x = 0; pGdiInfo->ciDevice.Magenta.y = 0; pGdiInfo->ciDevice.Magenta.Y = 0; pGdiInfo->ciDevice.Yellow.x = 0; pGdiInfo->ciDevice.Yellow.y = 0; pGdiInfo->ciDevice.Yellow.Y = 0; // No dye correction for raster displays. pGdiInfo->ciDevice.MagentaInCyanDye = 0; pGdiInfo->ciDevice.YellowInCyanDye = 0; pGdiInfo->ciDevice.CyanInMagentaDye = 0; pGdiInfo->ciDevice.YellowInMagentaDye = 0; pGdiInfo->ciDevice.CyanInYellowDye = 0; pGdiInfo->ciDevice.MagentaInYellowDye = 0; // Fill in the rest of the devinfo and GdiInfo structures. pGdiInfo->ulNumColors = (ULONG)-1; pGdiInfo->ulNumPalReg = 0; pGdiInfo->ulDevicePelsDPI = 0; // For printers only pGdiInfo->ulPrimaryOrder = PRIMARY_ORDER_CBA; pGdiInfo->ulHTPatternSize = HT_PATSIZE_4x4_M; pGdiInfo->ulHTOutputFormat = HT_FORMAT_16BPP; pGdiInfo->flHTFlags = HT_FLAG_ADDITIVE_PRIMS; // Fill in the basic devinfo structure *(ppdev->pDevInfo) = gDevInfoFrameBuffer; EngFreeMem(pVideoBuffer); return(TRUE); }