From 9eb9832b021e17e8599b168c3abf5ba2e49b1095 Mon Sep 17 00:00:00 2001 From: David Welch Date: Tue, 16 Mar 2004 21:11:44 +0000 Subject: [PATCH] - Use the miniport services to map the frame buffer. svn path=/trunk/; revision=8767 --- .../drivers/video/displays/vga/main/enable.c | 8 ++--- .../video/displays/vga/objects/screen.c | 34 +++++++++++++++---- reactos/drivers/video/displays/vga/vgaddi.h | 1 + 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/reactos/drivers/video/displays/vga/main/enable.c b/reactos/drivers/video/displays/vga/main/enable.c index b871fdc65a9..72574f4ab56 100644 --- a/reactos/drivers/video/displays/vga/main/enable.c +++ b/reactos/drivers/video/displays/vga/main/enable.c @@ -1,9 +1,9 @@ /* * entry.c * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * $Author: dwelch $ - * $Date: 2004/03/04 23:11:43 $ + * $Date: 2004/03/16 21:11:44 $ * */ @@ -189,9 +189,6 @@ DrvEnableDriver(IN ULONG EngineVersion, vgaPreCalc(); - // FIXME: Use Vidport to map the memory properly - vidmem = (char *)(0xd0000000 + 0xa0000); - VGADDI_InitializeOffScreenMem((640 * 480) >> 3, 65536 - ((640 * 480) >> 3)); DriveEnableData->pdrvfn = FuncList; @@ -367,6 +364,7 @@ DrvDisableSurface(IN DHPDEV PDev) PDEVSURF pdsurf = ppdev->AssociatedSurf; CHECKPOINT; DPRINT( "KMDriver: %x\n", ppdev->KMDriver ); + DeinitVGA(ppdev); // EngFreeMem(pdsurf->BankSelectInfo); CHECKPOINT; if (pdsurf->BankInfo != NULL) { diff --git a/reactos/drivers/video/displays/vga/objects/screen.c b/reactos/drivers/video/displays/vga/objects/screen.c index 7008ee162c0..d15da46bc8c 100644 --- a/reactos/drivers/video/displays/vga/objects/screen.c +++ b/reactos/drivers/video/displays/vga/objects/screen.c @@ -1,4 +1,5 @@ #include "../vgaddi.h" +#include "../vgavideo/vgavideo.h" static WORD PaletteBuffer[] = { 16, 0, // 16 entries, start with 0 @@ -101,9 +102,33 @@ DWORD getAvailableModes(HANDLE Driver, return modes.NumModes; } +BOOL DeinitVGA(PPDEV ppdev) +{ + VIDEO_MEMORY VideoMemory; + ULONG ReturnedDataLength; + + VideoMemory.RequestedVirtualAddress = (PVOID)ppdev->fbScreen; + + if (EngDeviceIoControl(ppdev->KMDriver, + IOCTL_VIDEO_UNMAP_VIDEO_MEMORY, + (PVOID)&VideoMemory, + sizeof(VIDEO_MEMORY), + NULL, + 0, + &ReturnedDataLength)) + { + DbgPrint("Failed to unmap video memory.\n"); + DbgBreakPoint(); + return(FALSE); + } + return(TRUE); +} + BOOL InitVGA(PPDEV ppdev, BOOL bFirst) { ULONG ReturnedDataLength; + VIDEO_MEMORY VideoMemory; + VIDEO_MEMORY_INFORMATION VideoMemoryInfo; ppdev->sizeSurf.cx = 640; ppdev->sizeSurf.cy = 480; @@ -142,11 +167,7 @@ BOOL InitVGA(PPDEV ppdev, BOOL bFirst) return(FALSE); } -/* - -gotta fix this up.. it prevents drawing to vidmem right now - - if (bFirst) { + if (bFirst) { // map video memory into virtual memory VideoMemory.RequestedVirtualAddress = NULL; @@ -162,7 +183,8 @@ gotta fix this up.. it prevents drawing to vidmem right now } ppdev->fbScreen = VideoMemoryInfo.FrameBufferBase; + vidmem = (PUCHAR)ppdev->fbScreen; } -*/ + return TRUE; } diff --git a/reactos/drivers/video/displays/vga/vgaddi.h b/reactos/drivers/video/displays/vga/vgaddi.h index 1a00de0b7a1..47ae7ab4c55 100644 --- a/reactos/drivers/video/displays/vga/vgaddi.h +++ b/reactos/drivers/video/displays/vga/vgaddi.h @@ -201,6 +201,7 @@ typedef VOID (*PFN_ScreenToScreenBlt)(PDEVSURF, PRECTL, PPOINTL, INT); #define DEVSURF_IDENT ('V' + ('S' << 8) + ('R' << 16) + ('F' << 24)) BOOL InitVGA(PPDEV ppdev, BOOL bFirst); // screen.c: initialize VGA mode +BOOL DeinitVGA(PPDEV ppdev); // screen.c: Free resources allocated in InitVGA #define DRIVER_EXTRA_SIZE 0 #define ALLOC_TAG TAG('D', 'v', 'g', 'a') // Dvga tag