Moved display driver and got win32k loading it's entry point.

svn path=/trunk/; revision=1036
This commit is contained in:
Jason Filby 2000-03-08 21:23:14 +00:00
parent e2eb8c1697
commit 3da0b018e5
11 changed files with 39 additions and 324 deletions

View file

@ -1,12 +1,11 @@
# $Id: makefile,v 1.5 1999/12/18 10:17:42 ea Exp $
# $Id: makefile,v 1.6 2000/03/08 21:23:13 jfilby Exp $
#
#
BASE_CFLAGS = -I../../../include
MP_OBJECTS = vgamp.o vgamp.coff ../../../ntoskrnl/ntoskrnl.a ../vidport/vidport.a
DDI_OBJECTS = vgaddi.o vgaddi.coff ../../../subsys/win32k/win32k.a
all: vgamp.sys vgaddi.sys
all: vgamp.sys
.phony: all
@ -48,35 +47,7 @@ vgamp.sys: $(MP_OBJECTS)
$(MP_OBJECTS)
- $(RM) temp.exp
vgaddi.sys: $(DDI_OBJECTS)
$(CC) \
-specs=../../svc_specs \
-mdll \
-o junk.tmp \
-Wl,--defsym,_end=end \
-Wl,--defsym,_edata=__data_end__ \
-Wl,--defsym,_etext=etext \
-Wl,--base-file,base.tmp \
$(DDI_OBJECTS)
- $(RM) junk.tmp
$(DLLTOOL) \
--dllname vgaddi.sys \
--base-file base.tmp \
--output-exp temp.exp \
--kill-at
- $(RM) base.tmp
$(CC) \
--verbose \
-Wl,--image-base,0x10000 \
-Wl,-e,_DriverEntry@8 \
-Wl,temp.exp \
-specs=../../svc_specs \
-mdll \
-o vgaddi.sys \
$(DDI_OBJECTS)
- $(RM) temp.exp
floppy: $(FLOPPY_DIR)/drivers/vgamp.sys $(FLOPPY_DIR)/drivers/vgaddi.sys
floppy: $(FLOPPY_DIR)/drivers/vgamp.sys
$(FLOPPY_DIR)/drivers/vgamp.sys: vgamp.sys
ifeq ($(DOSCLI),yes)
@ -85,14 +56,7 @@ else
$(CP) vgamp.sys $(FLOPPY_DIR)/drivers/vgamp.sys
endif
$(FLOPPY_DIR)/drivers/vgaddi.sys: vgaddi.sys
ifeq ($(DOSCLI),yes)
$(CP) vgaddi.sys $(FLOPPY_DIR)\drivers\vgaddi.sys
else
$(CP) vgaddi.sys $(FLOPPY_DIR)/drivers/vgaddi.sys
endif
dist: ../../../$(DIST_DIR)/drivers/vgamp.sys ../../../$(DIST_DIR)/drivers/vgaddi.sys
dist: ../../../$(DIST_DIR)/drivers/vgamp.sys
../../../$(DIST_DIR)/drivers/vgamp.sys: vgamp.sys
ifeq ($(DOSCLI),yes)
@ -101,12 +65,5 @@ else
$(CP) vgamp.sys ../../../$(DIST_DIR)/drivers/vgamp.sys
endif
../../../$(DIST_DIR)/drivers/vgaddi.sys: vgaddi.sys
ifeq ($(DOSCLI),yes)
$(CP) vgaddi.sys ..\..\..\$(DIST_DIR)\drivers\vgaddi.sys
else
$(CP) vgaddi.sys ../../../$(DIST_DIR)/drivers/vgaddi.sys
endif
include ../../../rules.mak

View file

@ -1,210 +0,0 @@
/*
* VGADDI.C - Generic VGA DDI graphics driver
*
*/
#include <ddk/ntddk.h>
#include <ddk/winddi.h>
#include "vgaddi.h"
#define DBG_PREFIX "VGADDI: "
VOID VGADDIAssertMode(IN DHPDEV DPev,
IN BOOL Enable);
VOID VGADDICompletePDEV(IN DHPDEV PDev,
IN HDEV Dev);
VOID VGADDIDisablePDEV(IN DHPDEV PDev);
VOID VGADDIDisableSurface(IN DHPDEV PDev);
DHPDEV VGADDIEnablePDEV(IN DEVMODEW *DM,
IN LPWSTR LogAddress,
IN ULONG PatternCount,
OUT HSURF *SurfPatterns,
IN ULONG CapsSize,
OUT ULONG *DevCaps,
IN ULONG DevInfoSize,
OUT DEVINFO *DI,
IN LPWSTR DevDataFile,
IN LPWSTR DeviceName,
IN HANDLE Driver);
HSURF VGADDIEnableSurface(IN DHPDEV PDev);
ULONG VGADDIGetModes(IN HANDLE Driver,
IN ULONG DataSize,
OUT PDEVMODEW DM);
DRVFN FuncList[] =
{
/* Required Display driver fuctions */
{INDEX_DrvAssertMode, (PFN) VGADDIAssertMode},
{INDEX_DrvCompletePDEV, (PFN) VGADDICompletePDEV},
{INDEX_DrvDisablePDEV, (PFN) VGADDIDisablePDEV},
{INDEX_DrvDisableSurface, (PFN) VGADDIDisableSurface},
{INDEX_DrvEnablePDEV, (PFN) VGADDIEnablePDEV},
{INDEX_DrvEnableSurface, (PFN) VGADDIEnableSurface},
{INDEX_DrvGetModes, (PFN) VGADDIGetModes},
#if 0
/* Optional Display driver functions */
{INDEX_, (PFN) },
{INDEX_DrvBitBlt, (PFN) VGADDIBitBlt},
{INDEX_DrvCopyBits, (PFN) VGADDICopyBits},
{INDEX_DescribePixelFormat, (PFN) VGADDIDescribePixelFormat},
{INDEX_DrvDitherColor, (PFN) VGADDIDitherColor},
{INDEX_DrvFillPath, (PFN) VGADDIFillPath},
{INDEX_DrvGetTrueTypeFile, (PFN) VGADDIGetTrueTypeFile},
{INDEX_DrvLoadFontFile, (PFN) VGADDILoadFontFile},
{INDEX_DrvMovePointer, (PFN) VGADDIMovePointer},
{INDEX_DrvPaint, (PFN) VGADDIPaint}
{INDEX_DrvQueryFont, (PFN) VGADDIQueryFont},
{INDEX_DrvQueryFontCaps, (PFN) VGADDIQueryFontCaps},
{INDEX_DrvQueryFontData, (PFN) VGADDIQueryFontData},
{INDEX_DrvQueryFontFile, (PFN) VGADDIQueryFontFile},
{INDEX_DrvQueryFontTree, (PFN) VGADDIQueryFontTree},
{INDEX_DrvQueryTrueTypeOutline, (PFN) VGADDIQueryTrueTypeOutline},
{INDEX_DrvQueryTrueTypeTable, (PFN) VGADDIQueryTrueTypeTable},
{INDEX_DrvRealizeBrush, (PFN) VGADDIRealizeBrush},
{INDEX_DrvResetPDEV, (PFN) VGADDIResetPDEV},
{INDEX_DrvSetPalette, (PFN) VGADDISetPalette},
{INDEX_DrvSetPixelFormat, (PFN) VGADDISetPixelFormat},
{INDEX_DrvSetPointerShape, (PFN) VGADDISetPointerShape},
{INDEX_DrvStretchBlt, (PFN) VGADDIStretchBlt},
{INDEX_DrvStrokePath, (PFN) VGADDIStrokePath},
{INDEX_DrvSwapBuffers, (PFN) VGADDISwapBuffers},
{INDEX_DrvTextOut, (PFN) VGADDITextOut},
{INDEX_DrvUnloadFontFile, (PFN) VGADDIUnloadFontFile},
#endif
};
// ----------------------------------------------------- Public Interface
// DrvEnableDriver
// DESCRIPTION:
// This function is called by the KMGDI immediately after load of
// the DDI module. This is the entry point for the DDI.
// ARGUMENTS:
// IN ULONG EngineVersion Version of KMGDI
// IN ULONG SizeOfDED Size of the DRVENABLEDATA struct
// OUT PDRVENABLEDATA DriveEnableData Struct to fill in for KMGDI
// RETURNS:
// BOOL TRUE if driver is enabled, FALSE and log an error otherwise
BOOL
DrvEnableDriver(IN ULONG EngineVersion,
IN ULONG SizeOfDED,
OUT PDRVENABLEDATA DriveEnableData)
{
DriveEnableData->pdrvfn = FuncList;
DriveEnableData->c = sizeof FuncList / sizeof &FuncList[0];
DriveEnableData->iDriverVersion = DDI_DRIVER_VERSION;
return TRUE;
}
// DrvDisableDriver
// DESCRIPTION:
// This function is called by the KMGDI at exit. It should cleanup.
// ARGUMENTS:
// NONE
// RETURNS:
// NONE
VOID DrvDisableDriver(VOID)
{
return;
}
// ----------------------------------------------- Driver Implementation
// DrvEnablePDEV
// DESCRIPTION:
// This function is called after DrvEnableDriver to get information
// about the mode that is to be used. This function just returns
// information, and should not yet initialize the mode.
// ARGUMENTS:
// IN DEVMODEW * DM Describes the mode requested
// IN LPWSTR LogAddress
// IN ULONG PatternCount number of patterns expected
// OUT HSURF * SurfPatterns array to contain pattern handles
// IN ULONG CapsSize the size of the DevCaps object passed in
// OUT ULONG * DevCaps Device Capabilities object
// IN ULONG DevInfoSize the size of the DevInfo object passed in
// OUT DEVINFO * DI Device Info object
// IN LPWSTR DevDataFile ignore
// IN LPWSTR DeviceName Device name
// IN HANDLE Driver handle to KM driver
// RETURNS:
// DHPDEV a handle to a DPev object
DHPDEV VGADDIEnablePDEV(IN DEVMODEW *DM,
IN LPWSTR LogAddress,
IN ULONG PatternCount,
OUT HSURF *SurfPatterns,
IN ULONG CapsSize,
OUT ULONG *DevCaps,
IN ULONG DevInfoSize,
OUT DEVINFO *DI,
IN LPWSTR DevDataFile,
IN LPWSTR DeviceName,
IN HANDLE Driver)
{
PPDEV PDev;
PDev = EngAllocMem(FL_ZERO_MEMORY, sizeof(PDEV), ALLOC_TAG);
if (PDev == NULL)
{
EngDebugPrint(DBG_PREFIX, "EngAllocMem failed for PDEV\n", 0);
return NULL;
}
PDev->KMDriver = Driver;
/* FIXME: fill out DevCaps */
/* FIXME: full out DevInfo */
return PDev;
}
// DrvEnablePDEV
// DESCRIPTION
// Called after initialization of PDEV is complete. Supplies
// a reference to the GDI handle for the PDEV.
VOID VGADDICompletePDEV(IN DHPDEV PDev,
IN HDEV Dev)
{
((PPDEV) PDev)->GDIDevHandle = Dev;
}
VOID VGADDIAssertMode(IN DHPDEV DPev,
IN BOOL Enable)
{
EngDebugPrint(DBG_PREFIX, "UNIMPLEMENTED\n", 0);
}
VOID VGADDIDisablePDEV(IN DHPDEV PDev)
{
EngDebugPrint(DBG_PREFIX, "UNIMPLEMENTED\n", 0);
}
VOID VGADDIDisableSurface(IN DHPDEV PDev)
{
EngDebugPrint(DBG_PREFIX, "UNIMPLEMENTED\n", 0);
}
HSURF VGADDIEnableSurface(IN DHPDEV PDev)
{
EngDebugPrint(DBG_PREFIX, "UNIMPLEMENTED\n", 0);
}
ULONG VGADDIGetModes(IN HANDLE Driver,
IN ULONG DataSize,
OUT PDEVMODEW DM)
{
EngDebugPrint(DBG_PREFIX, "UNIMPLEMENTED\n", 0);
}

View file

@ -1,16 +0,0 @@
//
// PDEV
// DESCRIPTION
// This structure will contain all state information
// required to maintain the video device
// ACCESS
// Allocated from non-paged pool by the GDI
typedef struct _PDEV
{
HANDLE KMDriver;
HDEV GDIDevHandle;
} PDEV, *PPDEV;

View file

@ -1,39 +0,0 @@
#include <defines.h>
#include <reactos/resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "VGADDI Device Driver\0"
VALUE "FileVersion", "0.0.0\0"
VALUE "InternalName", "vgaddi\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "vgaddi.sys\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View file

@ -924,6 +924,8 @@ VOID APIENTRY EngDebugPrint(PCHAR StandardPrefix,
PCHAR DebugMessage,
va_list ArgList);
HANDLE EngLoadImage(LPWSTR DriverName);
/*
EngDeleteClip
EngDeleteDriverObj

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.54 2000/03/08 01:55:34 ekohl Exp $
; $Id: ntoskrnl.def,v 1.55 2000/03/08 21:23:13 jfilby Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -462,6 +462,7 @@ RtlxAnsiStringToUnicodeSize@4
RtlxOemStringToUnicodeSize@4
RtlxUnicodeStringToAnsiSize@4
RtlxUnicodeStringToOemSize@4
LdrLoadModule
WRITE_REGISTER_UCHAR
WRITE_REGISTER_ULONG
WRITE_REGISTER_USHORT

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.41 2000/03/08 01:55:34 ekohl Exp $
; $Id: ntoskrnl.edf,v 1.42 2000/03/08 21:23:13 jfilby Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -388,6 +388,7 @@ RtlxAnsiStringToUnicodeSize=RtlxAnsiStringToUnicodeSize@4
RtlxOemStringToUnicodeSize=RtlxOemStringToUnicodeSize@4
RtlxUnicodeStringToAnsiSize=RtlxUnicodeStringToAnsiSize@4
RtlxUnicodeStringToOemSize=RtlxUnicodeStringToOemSize@4
LdrLoadModule=LdrLoadModule
WRITE_REGISTER_UCHAR
WRITE_REGISTER_ULONG
WRITE_REGISTER_USHORT

View file

@ -0,0 +1,6 @@
#include <ddk/winddi.h>
HANDLE EngLoadImage(LPWSTR DriverName)
{
return LdrLoadModule(DriverName);
}

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.15 1999/11/12 00:16:51 rex Exp $
# $Id: makefile,v 1.16 2000/03/08 21:23:13 jfilby Exp $
#
# WIN32K.SYS build spec
#
@ -10,6 +10,7 @@ BASE_CFLAGS = -I../../include
ENG_OBJECTS= eng/debug.o eng/mem.o
MAIN_OBJECTS = main/dllmain.o
MISC_OBJECTS = misc/driver.o
LDR_OBJECTS = ldr/loader.o
OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \
objects/color.o objects/coord.o objects/dc.o \
objects/fillshap.o objects/gdiobj.o objects/icm.o \
@ -19,7 +20,7 @@ OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \
RESOURCE_OBJECT = $(TARGET).coff
STUBS_OBJECTS = stubs/stubs.o
OBJECTS = $(ENG_OBJECTS) $(MAIN_OBJECTS) $(MISC_OBJECTS) $(OBJECTS_OBJECTS) \
OBJECTS = $(ENG_OBJECTS) $(MAIN_OBJECTS) $(MISC_OBJECTS) $(LDR_OBJECTS) $(OBJECTS_OBJECTS) \
$(RESOURCE_OBJECT) $(STUBS_OBJECTS)
all: $(TARGET).sys
@ -27,11 +28,11 @@ all: $(TARGET).sys
$(TARGET).coff: $(TARGET).rc ../../include/reactos/resource.h
ifeq ($(DOSCLI),yes)
CLEAN_FILES = eng\*.o main\*.o misc\*.o stubs\*.o objects\*.o \
CLEAN_FILES = eng\*.o main\*.o misc\*.o ldr\*.o stubs\*.o objects\*.o \
$(TARGET).coff $(TARGET).o $(TARGET).a \
junk.tmp base.tmp temp.exp $(TARGET).sys $(TARGET).sym
else
CLEAN_FILES = eng/*.o main/*.o misc/*.o stubs/*.o objects/*.o \
CLEAN_FILES = eng/*.o main/*.o ldr\*.o misc/*.o stubs/*.o objects/*.o \
$(TARGET).coff $(TARGET).o $(TARGET).a \
junk.tmp base.tmp temp.exp $(TARGET).sys $(TARGET).sym
endif

View file

@ -1,4 +1,4 @@
/* $Id: driver.c,v 1.7 2000/03/01 03:23:42 ekohl Exp $
/* $Id: driver.c,v 1.8 2000/03/08 21:23:14 jfilby Exp $
*
* GDI Driver support routines
* (mostly swiped from Wine)
@ -6,10 +6,14 @@
*/
#undef WIN32_LEAN_AND_MEAN
#define WIN32_NO_PEHDR
#include <ddk/ntddk.h>
#include <windows.h>
#include <win32k/driver.h>
#include <wchar.h>
#include <internal/module.h>
#include <ddk/winddi.h>
//#define NDEBUG
#include <internal/debug.h>
@ -58,8 +62,12 @@ BOOL DRIVER_RegisterDriver(LPCWSTR Name, PGD_ENABLEDRIVER EnableDriver)
PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
{
UNICODE_STRING DriverNameW;
NTSTATUS Status;
PMODULE_OBJECT ModuleObject;
GRAPHICS_DRIVER *Driver = DriverList;
/* First see if the driver hasn't already been loaded */
while (Driver && Name)
{
if (!_wcsicmp( Driver->Name, Name))
@ -68,8 +76,11 @@ PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
}
Driver = Driver->Next;
}
return GenericDriver ? GenericDriver->EnableDriver : NULL;
/* If not, then load it */
RtlInitUnicodeString (&DriverNameW, Name);
ModuleObject = EngLoadImage(&DriverNameW);
return (PGD_ENABLEDRIVER)ModuleObject->EntryPoint;
}
BOOL DRIVER_BuildDDIFunctions(PDRVENABLEDATA DED,

View file

@ -1,4 +1,4 @@
/* $Id: dc.c,v 1.11 2000/03/01 03:23:57 ekohl Exp $
/* $Id: dc.c,v 1.12 2000/03/08 21:23:14 jfilby Exp $
*
* DC.C - Device context functions
*
@ -188,7 +188,8 @@ HDC STDCALL W32kCreateDC(LPCWSTR Driver,
}
/* Get the DDI driver's entry point */
if ((GDEnableDriver = DRIVER_FindDDIDriver(Driver)) == NULL)
/* FIXME: Retrieve DDI driver name from registry */
if ((GDEnableDriver = DRIVER_FindDDIDriver(L"\\??\\C:\\reactos\\system32\\drivers\\vgaddi.dll")) == NULL)
{
DbgPrint("FindDDIDriver failed\n");
goto Failure;