From 3b3c81807383e6b7fa7dc4a4e44a06bd79e977f0 Mon Sep 17 00:00:00 2001 From: evb Date: Tue, 14 Dec 2010 03:27:51 +0000 Subject: [PATCH] - fix now palette.c for vga, by copy logPalVGA/VGALOGPALETTE from NT4 DDK VGA sample drv and turn off codes for allocate 256 color pallette, instead use fix 16 color logPalVGA - fix header of debug.c svn path=/trunk/; revision=50027 --- .../drivers/video/displays/vga_new/debug.c | 4 +- .../drivers/video/displays/vga_new/palette.c | 75 +++++++++++++------ 2 files changed, 56 insertions(+), 23 deletions(-) diff --git a/reactos/drivers/video/displays/vga_new/debug.c b/reactos/drivers/video/displays/vga_new/debug.c index ada125df7ec..f41697bd5e4 100755 --- a/reactos/drivers/video/displays/vga_new/debug.c +++ b/reactos/drivers/video/displays/vga_new/debug.c @@ -1,7 +1,7 @@ /* - * PROJECT: ReactOS Framebuffer Display Driver + * PROJECT: ReactOS VGA Display Driver * LICENSE: Microsoft NT4 DDK Sample Code License - * FILE: boot/drivers/video/displays/framebuf/debug.c + * FILE: boot/drivers/video/displays/vga/debug.c * PURPOSE: Debug Support * PROGRAMMERS: Copyright (c) 1992-1995 Microsoft Corporation */ diff --git a/reactos/drivers/video/displays/vga_new/palette.c b/reactos/drivers/video/displays/vga_new/palette.c index c8cff990e2b..95aa06d875c 100755 --- a/reactos/drivers/video/displays/vga_new/palette.c +++ b/reactos/drivers/video/displays/vga_new/palette.c @@ -1,18 +1,36 @@ /* * PROJECT: ReactOS Framebuffer Display Driver * LICENSE: Microsoft NT4 DDK Sample Code License - * FILE: boot/drivers/video/displays/framebuf/palette.c + * FILE: boot/drivers/video/displays/vga/palette.c * PURPOSE: Palette Support * PROGRAMMERS: Copyright (c) 1992-1995 Microsoft Corporation */ #include "driver.h" -// Global Table defining the 20 Window Default Colors. For 256 color -// palettes the first 10 must be put at the beginning of the palette -// and the last 10 at the end of the palette. +// eVb: 4.1 [VGARISC Change] - Add static 16-color VGA palette from VGA NT4 DDK Sample -const PALETTEENTRY BASEPALETTE[20] = +/******************************Public*Data*Struct*************************\ +* LOGPALETTE +* +* This is the palette for the VGA. +* +\**************************************************************************/ + +// Little bit of hacking to get this to compile happily. + +typedef struct _VGALOGPALETTE +{ + USHORT ident; + USHORT NumEntries; + PALETTEENTRY palPalEntry[16]; +} VGALOGPALETTE; + +const VGALOGPALETTE logPalVGA = +{ + +0x400, // driver version +16, // num entries { { 0, 0, 0, 0 }, // 0 { 0x80,0, 0, 0 }, // 1 @@ -21,20 +39,19 @@ const PALETTEENTRY BASEPALETTE[20] = { 0, 0, 0x80,0 }, // 4 { 0x80,0, 0x80,0 }, // 5 { 0, 0x80,0x80,0 }, // 6 - { 0xC0,0xC0,0xC0,0 }, // 7 - { 192, 220, 192, 0 }, // 8 - { 166, 202, 240, 0 }, // 9 - { 255, 251, 240, 0 }, // 10 - { 160, 160, 164, 0 }, // 11 - { 0x80,0x80,0x80,0 }, // 12 - { 0xFF,0, 0 ,0 }, // 13 - { 0, 0xFF,0 ,0 }, // 14 - { 0xFF,0xFF,0 ,0 }, // 15 - { 0 ,0, 0xFF,0 }, // 16 - { 0xFF,0, 0xFF,0 }, // 17 - { 0, 0xFF,0xFF,0 }, // 18 - { 0xFF,0xFF,0xFF,0 }, // 19 + { 0x80,0x80,0x80,0 }, // 7 + + { 0xC0,0xC0,0xC0,0 }, // 8 + { 0xFF,0, 0, 0 }, // 9 + { 0, 0xFF,0, 0 }, // 10 + { 0xFF,0xFF,0, 0 }, // 11 + { 0, 0, 0xFF,0 }, // 12 + { 0xFF,0, 0xFF,0 }, // 13 + { 0, 0xFF,0xFF,0 }, // 14 + { 0xFF,0xFF,0xFF,0 } // 15 +} }; +// eVb: 4.1 [END] BOOL bInitDefaultPalette(PPDEV ppdev, DEVINFO *pDevInfo); @@ -72,8 +89,12 @@ VOID vDisablePalette(PPDEV ppdev) ppdev->hpalDefault = (HPALETTE) 0; } +// eVb: 4.2 [VGARISC Change] - VGA Palette is static, no need to free +#if 0 if (ppdev->pPal != (PPALETTEENTRY)NULL) EngFreeMem((PVOID)ppdev->pPal); +#endif +// eVb: 4.2 [END] } /******************************Public*Routine******************************\ @@ -85,6 +106,8 @@ VOID vDisablePalette(PPDEV ppdev) BOOL bInitDefaultPalette(PPDEV ppdev, DEVINFO *pDevInfo) { +// eVb: 4.3 [VGARISC Change] - VGA Palette is static, no need to build +#if 0 if (ppdev->ulBitCount == 8) { ULONG ulLoop; @@ -141,20 +164,26 @@ BOOL bInitDefaultPalette(PPDEV ppdev, DEVINFO *pDevInfo) ppdev->pPal[246 + ulLoop] = BASEPALETTE[ulLoop+10]; } +#endif +// eVb: 4.3 [END] // // Create handle for palette. // ppdev->hpalDefault = pDevInfo->hpalDefault = EngCreatePalette(PAL_INDEXED, - 256, - (PULONG) ppdev->pPal, +// eVb: 4.4 [VGARISC Change] - VGA Palette is 16 colors, not 256, and static + 16, + (PULONG) &logPalVGA.palPalEntry, +// eVb: 4.4 [END] 0,0,0); if (ppdev->hpalDefault == (HPALETTE) 0) { RIP("DISP bInitDefaultPalette failed EngCreatePalette\n"); - EngFreeMem(ppdev->pPal); +// eVb: 4.5 [VGARISC Change] - VGA Palette is static, no need to free + //EngFreeMem(ppdev->pPal); +// eVb: 4.5 [END] return(FALSE); } @@ -164,6 +193,8 @@ BOOL bInitDefaultPalette(PPDEV ppdev, DEVINFO *pDevInfo) return(TRUE); +// eVb: 4.6 [VGARISC Change] - VGA Palette is static, no bitfield palette needed +#if 0 } else { ppdev->hpalDefault = @@ -181,6 +212,8 @@ BOOL bInitDefaultPalette(PPDEV ppdev, DEVINFO *pDevInfo) } return(TRUE); +#endif +// eVb: 4.6 [END] } /******************************Public*Routine******************************\