2004-03-06 Filip Navara <xnavara@volny.cz>

* drivers/video/videoprt/int10.c (VideoPortInt10):
	Print more debug informations.
	* drivers/video/videoprt/videoprt.c (VideoPortInitialize):
	Prevent conflicts when more miniport drivers are loaded.
	(VideoPortGetDeviceBase, VideoPortMapMemory, InternalMapMemory):
	Change way of reporting error to prevent reporting error when
	the resources were successfully mapped.
	(VideoPortDDCMonitorHelper): Add stub.
	(VidDispatchDeviceControl): Allocate memory from NonPagedPool.
	Add debug messages.
	* drivers/video/videoprt/videoprt.def (VideoPortDDCMonitorHelper):
	Add export.
	* drivers/video/videoprt/videoprt.edf (VideoPortDDCMonitorHelper):
	Ditto.
	* include/ddk/winddi.h (ENG_SYSTEM_ATTRIBUTE): Declare.
	* include/win32k/driver.h (DRIVER_FindMPDriver): Change declaration.
	* subsys/win32k/eng/surface.c (EngModifySurface): Implement.
	* subsys/win32k/misc/driver.c (DRIVER_FindMPDriver):
	Modify to open specific miniport driver depending on parameter.
	* subsys/win32k/objects/dc.c (GetRegistryPath):
	Add parameter to specify display driver number.
	(FindDriverFileNames): Ditto.
	(SetupDevMode): Ditto.
	(IntCreateDC): Correct DPRINT.
	(IntCreatePrimarySurface): Change to try more miniport drivers
	before giving up.
	* subsys/win32k/stubs/stubs.c (HeapVidMemAllocAligned, VidMemFree,
	EngDitherColor, EngQuerySystemAttribute): Add stubs.
	* subsys/win32k/win32k.edf (EngDitherColor, EngQuerySystemAttribute,
	HeapVidMemAllocAligned, VidMemFree, EngModifySurface):
	Add exports.
	* subsys/win32k/win32k.def: Ditto.

svn path=/trunk/; revision=8547
This commit is contained in:
Filip Navara 2004-03-06 01:22:04 +00:00
parent 30264d875a
commit f1d20bbf54
13 changed files with 472 additions and 233 deletions

View file

@ -18,7 +18,7 @@
* If not, write to the Free Software Foundation,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id: int10.c,v 1.2 2004/02/22 22:19:42 navaraf Exp $
* $Id: int10.c,v 1.3 2004/03/06 01:22:02 navaraf Exp $
*/
#include "videoprt.h"
@ -56,12 +56,19 @@ VideoPortInt10(
}
memset(&Regs, 0, sizeof(Regs));
DPRINT("- Input register Eax: %x\n", BiosArguments->Eax);
Regs.Eax = BiosArguments->Eax;
DPRINT("- Input register Ebx: %x\n", BiosArguments->Ebx);
Regs.Ebx = BiosArguments->Ebx;
DPRINT("- Input register Ecx: %x\n", BiosArguments->Ecx);
Regs.Ecx = BiosArguments->Ecx;
DPRINT("- Input register Edx: %x\n", BiosArguments->Edx);
Regs.Edx = BiosArguments->Edx;
DPRINT("- Input register Esi: %x\n", BiosArguments->Esi);
Regs.Esi = BiosArguments->Esi;
DPRINT("- Input register Edi: %x\n", BiosArguments->Edi);
Regs.Edi = BiosArguments->Edi;
DPRINT("- Input register Ebp: %x\n", BiosArguments->Ebp);
Regs.Ebp = BiosArguments->Ebp;
Status = Ke386CallBios(0x10, &Regs);

View file

@ -18,7 +18,7 @@
* If not, write to the Free Software Foundation,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id: videoprt.c,v 1.5 2004/03/04 18:51:58 navaraf Exp $
* $Id: videoprt.c,v 1.6 2004/03/06 01:22:02 navaraf Exp $
*/
#include "videoprt.h"
@ -155,7 +155,7 @@ VideoPortGetDeviceBase(IN PVOID HwDeviceExtension,
VIDEO_PORT_DEVICE_EXTENSION,
MiniPortDeviceExtension);
return InternalMapMemory(DeviceExtension, IoAddress, NumberOfUchars, InIoSpace);
return InternalMapMemory(DeviceExtension, IoAddress, NumberOfUchars, InIoSpace, NULL);
}
@ -207,9 +207,12 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
MiniPortDeviceExtension);
if (0 == NumRequestedResources && PCIBus == DeviceExtension->AdapterInterfaceType)
{
if (DeviceId != NULL && VendorId != NULL)
{
DPRINT("Looking for VendorId 0x%04x DeviceId 0x%04x\n", (int)*((USHORT *) VendorId),
(int)*((USHORT *) DeviceId));
}
FoundDevice = FALSE;
PciSlotNumber.u.AsULONG = *Slot;
for (FunctionNumber = 0; ! FoundDevice && FunctionNumber < 8; FunctionNumber++)
@ -219,12 +222,16 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
HalGetBusDataByOffset(PCIConfiguration, DeviceExtension->SystemIoBusNumber,
PciSlotNumber.u.AsULONG,&Config, 0,
sizeof(PCI_COMMON_CONFIG)))
{
if (DeviceId != NULL && VendorId != NULL)
{
DPRINT("Slot 0x%02x (Device %d Function %d) VendorId 0x%04x DeviceId 0x%04x\n",
PciSlotNumber.u.AsULONG, PciSlotNumber.u.bits.DeviceNumber,
PciSlotNumber.u.bits.FunctionNumber, Config.VendorID, Config.DeviceID);
FoundDevice = (Config.VendorID == *((USHORT *) VendorId) &&
Config.DeviceID == *((USHORT *) DeviceId));
}
FoundDevice = (VendorId == NULL || Config.VendorID == *((USHORT *) VendorId)) &&
(DeviceId == NULL || Config.DeviceID == *((USHORT *) DeviceId));
}
}
if (! FoundDevice)
@ -451,7 +458,7 @@ VideoPortInitialize(IN PVOID Context1,
IN PVOID HwContext)
{
PUNICODE_STRING RegistryPath;
UCHAR Again;
UCHAR Again = FALSE;
WCHAR DeviceBuffer[20];
WCHAR SymlinkBuffer[20];
WCHAR DeviceVideoBuffer[20];
@ -460,7 +467,7 @@ VideoPortInitialize(IN PVOID Context1,
PDEVICE_OBJECT MPDeviceObject;
VIDEO_PORT_CONFIG_INFO ConfigInfo;
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
ULONG DeviceNumber = 0;
ULONG DisplayNumber;
UNICODE_STRING DeviceName;
UNICODE_STRING SymlinkName;
ULONG MaxBus;
@ -468,6 +475,8 @@ VideoPortInitialize(IN PVOID Context1,
KIRQL IRQL;
KAFFINITY Affinity;
ULONG InterruptVector;
OBJECT_ATTRIBUTES Obj;
HANDLE ObjHandle;
DPRINT("VideoPortInitialize\n");
@ -476,15 +485,42 @@ VideoPortInitialize(IN PVOID Context1,
/* Build Dispatch table from passed data */
MPDriverObject->DriverStartIo = (PDRIVER_STARTIO) HwInitializationData->HwStartIO;
/* Create a unicode device name */
/* Find the first free device number */
for (DisplayNumber = 0;;)
{
swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DisplayNumber + 1);
RtlInitUnicodeString(&SymlinkName, SymlinkBuffer);
InitializeObjectAttributes(&Obj, &SymlinkName, 0, NULL, NULL);
Status = ZwOpenSymbolicLinkObject(&ObjHandle, GENERIC_READ, &Obj);
if (NT_SUCCESS(Status))
{
ZwClose(ObjHandle);
DisplayNumber++;
continue;
}
else if (Status == STATUS_NOT_FOUND || Status == STATUS_UNSUCCESSFUL)
{
break;
}
else
{
return Status;
}
}
DPRINT("- DisplayNumber: %d\n", DisplayNumber);
Again = FALSE;
do
{
swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
/* Create a unicode device name. */
swprintf(DeviceBuffer, L"\\Device\\Video%lu", DisplayNumber);
RtlInitUnicodeString(&DeviceName, DeviceBuffer);
/* Create the device */
Status = IoCreateDevice(MPDriverObject,
/* Create the device. */
Status = IoCreateDevice(
MPDriverObject,
HwInitializationData->HwDeviceExtensionSize +
sizeof(VIDEO_PORT_DEVICE_EXTENSION),
&DeviceName,
@ -518,8 +554,8 @@ VideoPortInitialize(IN PVOID Context1,
DeviceExtension->RegistryPath.Buffer = ExAllocatePoolWithTag(PagedPool,
MaxLen,
TAG_VIDEO_PORT);
swprintf(DeviceExtension->RegistryPath.Buffer, L"%s\\Device%d",
RegistryPath->Buffer, DeviceNumber);
swprintf(DeviceExtension->RegistryPath.Buffer, L"%s\\Device0",
RegistryPath->Buffer);
DeviceExtension->RegistryPath.Length = wcslen(DeviceExtension->RegistryPath.Buffer) *
sizeof(WCHAR);
@ -569,14 +605,14 @@ VideoPortInitialize(IN PVOID Context1,
DPRINT("Found adapter\n");
/* create symbolic link "\??\DISPLAYx" */
swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DeviceNumber+1);
swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DisplayNumber + 1);
RtlInitUnicodeString (&SymlinkName,
SymlinkBuffer);
IoCreateSymbolicLink (&SymlinkName,
&DeviceName);
/* Add entry to DEVICEMAP\VIDEO key in registry */
swprintf(DeviceVideoBuffer, L"\\Device\\Video%d", DeviceNumber);
swprintf(DeviceVideoBuffer, L"\\Device\\Video%d", DisplayNumber);
RtlWriteRegistryValue(RTL_REGISTRY_DEVICEMAP,
L"VIDEO",
DeviceVideoBuffer,
@ -632,7 +668,7 @@ VideoPortInitialize(IN PVOID Context1,
return Status;
}
}
DeviceNumber++;
DisplayNumber++;
}
while (Again);
@ -712,6 +748,7 @@ VideoPortMapMemory(IN PVOID HwDeviceExtension,
OUT PVOID *VirtualAddress)
{
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status;
DPRINT("VideoPortMapMemory\n");
@ -719,9 +756,9 @@ VideoPortMapMemory(IN PVOID HwDeviceExtension,
VIDEO_PORT_DEVICE_EXTENSION,
MiniPortDeviceExtension);
*VirtualAddress = InternalMapMemory(DeviceExtension, PhysicalAddress,
*Length, *InIoSpace);
*Length, *InIoSpace, &Status);
return NULL == *VirtualAddress ? STATUS_NO_MEMORY : STATUS_SUCCESS;
return Status;
}
@ -1133,7 +1170,7 @@ VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
DeviceExtension = DeviceObject->DeviceExtension;
/* Translate the IRP to a VRP */
vrp = ExAllocatePool(PagedPool, sizeof(VIDEO_REQUEST_PACKET));
vrp = ExAllocatePool(NonPagedPool, sizeof(VIDEO_REQUEST_PACKET));
if (NULL == vrp)
{
return STATUS_NO_MEMORY;
@ -1141,6 +1178,8 @@ VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
vrp->StatusBlock = (PSTATUS_BLOCK) &(Irp->IoStatus);
vrp->IoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
DPRINT("- IoControlCode: %x\n", vrp->IoControlCode);
/* We're assuming METHOD_BUFFERED */
vrp->InputBuffer = Irp->AssociatedIrp.SystemBuffer;
vrp->InputBufferLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
@ -1153,6 +1192,8 @@ VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
/* Free the VRP */
ExFreePool(vrp);
DPRINT("- Returned status: %x\n", Irp->IoStatus.Status);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
@ -1162,7 +1203,8 @@ PVOID STDCALL
InternalMapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
IN PHYSICAL_ADDRESS IoAddress,
IN ULONG NumberOfUchars,
IN UCHAR InIoSpace)
IN UCHAR InIoSpace,
OUT NTSTATUS *Status)
{
PHYSICAL_ADDRESS TranslatedAddress;
PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
@ -1187,6 +1229,10 @@ InternalMapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
NumberOfUchars <= AddressMapping->NumberOfUchars)
{
AddressMapping->MappingCount++;
if (Status)
{
*Status = STATUS_SUCCESS;
}
return AddressMapping->MappedAddress;
}
Entry = Entry->Flink;
@ -1199,12 +1245,22 @@ InternalMapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
IoAddress,
&AddressSpace,
&TranslatedAddress) == FALSE)
{
if (Status)
{
*Status = STATUS_NO_MEMORY;
}
return NULL;
}
/* i/o space */
if (AddressSpace != 0)
{
assert(0 == TranslatedAddress.u.HighPart);
if (Status)
{
*Status = STATUS_SUCCESS;
}
return (PVOID) TranslatedAddress.u.LowPart;
}
@ -1212,6 +1268,13 @@ InternalMapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
NumberOfUchars,
FALSE);
if (MappedAddress)
{
if (Status)
{
*Status = STATUS_SUCCESS;
}
AddressMapping = ExAllocatePoolWithTag(PagedPool,
sizeof(VIDEO_PORT_ADDRESS_MAPPING),
TAG_VIDEO_PORT);
@ -1229,6 +1292,16 @@ InternalMapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
return MappedAddress;
}
else
{
if (Status)
{
*Status = STATUS_NO_MEMORY;
}
return NULL;
}
}
VOID STDCALL
InternalUnmapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
@ -1261,3 +1334,14 @@ InternalUnmapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
Entry = Entry->Flink;
}
}
BOOLEAN STDCALL
VideoPortDDCMonitorHelper(
PVOID HwDeviceExtension,
/*PI2C_FNC_TABLE*/PVOID I2CFunctions,
PUCHAR pEdidBuffer,
ULONG EdidBufferSize
)
{
return FALSE;
}

View file

@ -1,10 +1,11 @@
; $Id: videoprt.def,v 1.2 2004/02/25 02:59:55 jimtabor Exp $
; $Id: videoprt.def,v 1.3 2004/03/06 01:22:02 navaraf Exp $
;
; vidport.def - export definition file for ReactOS
;
EXPORTS
ReturnCsrssAddress
VideoPortCompareMemory@12
VideoPortDDCMonitorHelper@16
VideoPortDebugPrint
VideoPortDisableInterrupt@4
VideoPortEnableInterrupt@4

View file

@ -1,10 +1,11 @@
; $Id: videoprt.edf,v 1.2 2004/02/25 03:05:27 jimtabor Exp $
; $Id: videoprt.edf,v 1.3 2004/03/06 01:22:02 navaraf Exp $
;
; vidport.def - export definition file for ReactOS
;
EXPORTS
VideoPortCompareMemory=NTOSKRNL.RtlCompareMemory
VideoPortAllocatePool=VideoPortAllocatePool@16
VideoPortDDCMonitorHelper=VideoPortDDCMonitorHelper@16
VideoPortDebugPrint
VideoPortDisableInterrupt=VideoPortDisableInterrupt@4
VideoPortEnableInterrupt=VideoPortEnableInterrupt@4

View file

@ -18,7 +18,7 @@
* If not, write to the Free Software Foundation,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id: videoprt.h,v 1.1 2004/01/19 15:56:53 navaraf Exp $
* $Id: videoprt.h,v 1.2 2004/03/06 01:22:02 navaraf Exp $
*/
#ifndef VIDEOPRT_H
@ -88,7 +88,8 @@ InternalMapMemory(
IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
IN PHYSICAL_ADDRESS IoAddress,
IN ULONG NumberOfUchars,
IN UCHAR InIoSpace);
IN UCHAR InIoSpace,
OUT NTSTATUS *Status);
VOID STDCALL
InternalUnmapMemory(

View file

@ -867,6 +867,13 @@ typedef struct _ENG_TIME_FIELDS
USHORT usWeekday;
} ENG_TIME_FIELDS, *PENG_TIME_FIELDS;
typedef enum _ENG_SYSTEM_ATTRIBUTE {
EngProcessorFeature = 1,
EngNumberOfProcessors,
EngOptimumAvailableUserMemory,
EngOptimumAvailableSystemMemory,
} ENG_SYSTEM_ATTRIBUTE;
typedef struct _LINEATTRS
{
FLONG fl;

View file

@ -162,7 +162,7 @@ typedef struct _DRIVER_FUNCTIONS
BOOL DRIVER_RegisterDriver(LPCWSTR Name, PGD_ENABLEDRIVER EnableDriver);
PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name);
PFILE_OBJECT DRIVER_FindMPDriver(LPCWSTR Name);
PFILE_OBJECT DRIVER_FindMPDriver(ULONG DisplayNumber);
BOOL DRIVER_BuildDDIFunctions(PDRVENABLEDATA DED,
PDRIVER_FUNCTIONS DF);
BOOL DRIVER_UnregisterDriver(LPCWSTR Name);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: surface.c,v 1.32 2004/02/14 22:24:54 navaraf Exp $
/* $Id: surface.c,v 1.33 2004/03/06 01:22:03 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -477,6 +477,42 @@ EngAssociateSurface(IN HSURF Surface,
return TRUE;
}
/*
* @implemented
*/
BOOL STDCALL
EngModifySurface(
IN HSURF hsurf,
IN HDEV hdev,
IN FLONG flHooks,
IN FLONG flSurface,
IN DHSURF dhsurf,
OUT VOID *pvScan0,
IN LONG lDelta,
IN VOID *pvReserved)
{
SURFOBJ *pso;
pso = EngLockSurface(hsurf);
if (pso == NULL)
{
return FALSE;
}
if (!EngAssociateSurface(hsurf, hdev, flHooks))
{
return FALSE;
}
pso->dhsurf = dhsurf;
pso->lDelta = lDelta;
pso->pvScan0 = pvScan0;
EngUnlockSurface(pso);
return TRUE;
}
/*
* @implemented
*/

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: driver.c,v 1.36 2004/02/22 12:06:43 weiden Exp $
/* $Id: driver.c,v 1.37 2004/03/06 01:22:03 navaraf Exp $
*
* GDI Driver support routines
* (mostly swiped from Wine)
@ -236,16 +236,18 @@ BOOL DRIVER_BuildDDIFunctions(PDRVENABLEDATA DED,
typedef VP_STATUS (*PMP_DRIVERENTRY)(PVOID, PVOID);
PFILE_OBJECT DRIVER_FindMPDriver(LPCWSTR Name)
PFILE_OBJECT DRIVER_FindMPDriver(ULONG DisplayNumber)
{
OBJECT_ATTRIBUTES ObjectAttributes;
WCHAR DeviceNameBuffer[20];
UNICODE_STRING DeviceName;
IO_STATUS_BLOCK Iosb;
HANDLE DisplayHandle;
NTSTATUS Status;
PFILE_OBJECT VideoFileObject;
RtlRosInitUnicodeStringFromLiteral(&DeviceName, L"\\??\\DISPLAY1");
swprintf(DeviceNameBuffer, L"\\??\\DISPLAY%d", DisplayNumber + 1);
RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
InitializeObjectAttributes(&ObjectAttributes,
&DeviceName,
0,

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dc.c,v 1.122 2004/03/05 09:02:42 hbirr Exp $
/* $Id: dc.c,v 1.123 2004/03/06 01:22:03 navaraf Exp $
*
* DC.C - Device context functions
*
@ -239,15 +239,17 @@ NtGdiCreateCompatableDC(HDC hDC)
}
static BOOL FASTCALL
GetRegistryPath(PUNICODE_STRING RegistryPath)
GetRegistryPath(PUNICODE_STRING RegistryPath, ULONG DisplayNumber)
{
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
WCHAR DeviceNameBuffer[20];
NTSTATUS Status;
swprintf(DeviceNameBuffer, L"\\Device\\Video%d", DisplayNumber);
RtlInitUnicodeString(RegistryPath, NULL);
RtlZeroMemory(QueryTable, sizeof(QueryTable));
QueryTable[0].Flags = RTL_QUERY_REGISTRY_REQUIRED | RTL_QUERY_REGISTRY_DIRECT;
QueryTable[0].Name = L"\\Device\\Video0";
QueryTable[0].Name = DeviceNameBuffer;
QueryTable[0].EntryContext = RegistryPath;
Status = RtlQueryRegistryValues(RTL_REGISTRY_DEVICEMAP,
@ -257,7 +259,7 @@ GetRegistryPath(PUNICODE_STRING RegistryPath)
NULL);
if (! NT_SUCCESS(Status))
{
DPRINT1("No \\Device\\Video0 value in DEVICEMAP\\VIDEO found\n");
DPRINT1("No \\Device\\Video%d value in DEVICEMAP\\VIDEO found\n", DisplayNumber);
return FALSE;
}
@ -267,13 +269,13 @@ GetRegistryPath(PUNICODE_STRING RegistryPath)
}
static BOOL FASTCALL
FindDriverFileNames(PUNICODE_STRING DriverFileNames)
FindDriverFileNames(PUNICODE_STRING DriverFileNames, ULONG DisplayNumber)
{
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
UNICODE_STRING RegistryPath;
NTSTATUS Status;
if (! GetRegistryPath(&RegistryPath))
if (! GetRegistryPath(&RegistryPath, DisplayNumber))
{
DPRINT("GetRegistryPath failed\n");
return FALSE;
@ -350,7 +352,7 @@ DevModeCallback(IN PWSTR ValueName,
}
static BOOL FASTCALL
SetupDevMode(PDEVMODEW DevMode)
SetupDevMode(PDEVMODEW DevMode, ULONG DisplayNumber)
{
static WCHAR RegistryMachineSystem[] = L"\\REGISTRY\\MACHINE\\SYSTEM\\";
static WCHAR CurrentControlSet[] = L"CURRENTCONTROLSET\\";
@ -363,7 +365,7 @@ SetupDevMode(PDEVMODEW DevMode)
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
NTSTATUS Status;
if (! GetRegistryPath(&RegistryPath))
if (! GetRegistryPath(&RegistryPath, DisplayNumber))
{
DPRINT("GetRegistryPath failed\n");
return FALSE;
@ -472,13 +474,19 @@ IntCreatePrimarySurface()
PWSTR CurrentName;
BOOL GotDriver;
BOOL DoDefault;
ULONG DisplayNumber;
for (DisplayNumber = 0; ; DisplayNumber++)
{
DPRINT("Trying to load display driver no. %d\n", DisplayNumber);
RtlZeroMemory(&PrimarySurface, sizeof(PrimarySurface));
ExInitializeFastMutex(&PrimarySurface.DriverLock);
PrimarySurface.VideoFileObject = DRIVER_FindMPDriver(DisplayNumber);
/* Open the miniport driver */
if ((PrimarySurface.VideoFileObject = DRIVER_FindMPDriver(L"DISPLAY")) == NULL)
if (PrimarySurface.VideoFileObject == NULL)
{
DPRINT1("FindMPDriver failed\n");
return FALSE;
@ -486,17 +494,21 @@ IntCreatePrimarySurface()
/* Retrieve DDI driver names from registry */
RtlInitUnicodeString(&DriverFileNames, NULL);
if (! FindDriverFileNames(&DriverFileNames))
if (!FindDriverFileNames(&DriverFileNames, DisplayNumber))
{
DPRINT1("FindDriverFileNames failed\n");
return FALSE;
/* return FALSE; */
continue;
}
/* DriverFileNames may be a list of drivers in REG_SZ_MULTI format, scan all of
them until a good one found */
/*
* DriverFileNames may be a list of drivers in REG_SZ_MULTI format,
* scan all of them until a good one found.
*/
CurrentName = DriverFileNames.Buffer;
GotDriver = FALSE;
while (! GotDriver && CurrentName < DriverFileNames.Buffer + DriverFileNames.Length)
while (!GotDriver &&
CurrentName < DriverFileNames.Buffer + DriverFileNames.Length)
{
/* Get the DDI driver's entry point */
GDEnableDriver = DRIVER_FindDDIDriver(CurrentName);
@ -533,12 +545,15 @@ IntCreatePrimarySurface()
}
}
}
RtlFreeUnicodeString(&DriverFileNames);
if (!GotDriver)
{
ObDereferenceObject(PrimarySurface.VideoFileObject);
DPRINT1("No suitable DDI driver found\n");
return FALSE;
/* return FALSE; */
continue;
}
DPRINT("Display driver %S loaded\n", CurrentName);
@ -554,10 +569,10 @@ IntCreatePrimarySurface()
}
/* Allocate a phyical device handle from the driver */
if (SetupDevMode(&PrimarySurface.DMW))
if (SetupDevMode(&PrimarySurface.DMW, DisplayNumber))
{
PrimarySurface.PDev =
PrimarySurface.DriverFunctions.EnablePDev(&PrimarySurface.DMW,
PrimarySurface.PDev = PrimarySurface.DriverFunctions.EnablePDev(
&PrimarySurface.DMW,
L"",
HS_DDI_MAX,
PrimarySurface.FillPatterns,
@ -582,8 +597,8 @@ IntCreatePrimarySurface()
if (DoDefault)
{
RtlZeroMemory(&(PrimarySurface.DMW), sizeof(DEVMODEW));
PrimarySurface.PDev =
PrimarySurface.DriverFunctions.EnablePDev(&PrimarySurface.DMW,
PrimarySurface.PDev = PrimarySurface.DriverFunctions.EnablePDev(
&PrimarySurface.DMW,
L"",
HS_DDI_MAX,
PrimarySurface.FillPatterns,
@ -600,7 +615,8 @@ IntCreatePrimarySurface()
ObDereferenceObject(PrimarySurface.VideoFileObject);
DPRINT1("DrvEnablePDEV with default parameters failed\n");
DPRINT1("Perhaps DDI driver doesn't match miniport driver?\n");
return FALSE;
/* return FALSE; */
continue;
}
}
@ -618,7 +634,8 @@ IntCreatePrimarySurface()
DPRINT("calling completePDev\n");
/* Complete initialization of the physical device */
PrimarySurface.DriverFunctions.CompletePDev(PrimarySurface.PDev,
PrimarySurface.DriverFunctions.CompletePDev(
PrimarySurface.PDev,
&PrimarySurface);
DPRINT("calling DRIVER_ReferenceDriver\n");
@ -632,17 +649,23 @@ IntCreatePrimarySurface()
PrimarySurface.DriverFunctions.EnableSurface(PrimarySurface.PDev);
if (NULL == PrimarySurface.Handle)
{
/* PrimarySurface.DriverFunctions.AssertMode(PrimarySurface.PDev, FALSE);*/
PrimarySurface.DriverFunctions.DisablePDev(PrimarySurface.PDev);
ObDereferenceObject(PrimarySurface.VideoFileObject);
DPRINT1("DrvEnableSurface failed\n");
return FALSE;
/* return FALSE; */
continue;
}
SurfObj = (PSURFOBJ)AccessUserObject((ULONG) PrimarySurface.Handle);
SurfObj->dhpdev = PrimarySurface.PDev;
SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) PrimarySurface.Handle);
IntShowDesktop(IntGetActiveDesktop(),
IntShowDesktop(
IntGetActiveDesktop(),
SurfGDI->SurfObj.sizlBitmap.cx,
SurfGDI->SurfObj.sizlBitmap.cy);
break;
}
return TRUE;
}
@ -704,7 +727,10 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
return NtGdiCreateCompatableDC(hDC);
}
DPRINT("NAME: %S\n", Driver); // FIXME: Should not crash if NULL
if (Driver != NULL && Driver->Buffer != NULL)
{
DPRINT("NAME: %S\n", Driver->Buffer); // FIXME: Should not crash if NULL
}
/* Allocate a DC object */
if ((hNewDC = DC_AllocDC(Driver)) == NULL)

View file

@ -1235,3 +1235,67 @@ STUB(FLOATOBJ_AddFloatObj)
STUB(FLOATOBJ_DivFloatObj)
STUB(FLOATOBJ_MulFloatObj)
STUB(FLOATOBJ_SubFloatObj)
/*
* @unimplemented
*/
ULONG STDCALL
EngDitherColor(
IN HDEV hdev,
IN ULONG iMode,
IN ULONG rgb,
OUT ULONG *pul)
{
return DCR_SOLID;
}
/*
* @unimplemented
*/
BOOL STDCALL
EngQuerySystemAttribute(
IN ENG_SYSTEM_ATTRIBUTE CapNum,
OUT PDWORD pCapability)
{
switch (CapNum)
{
case EngNumberOfProcessors:
*pCapability = 1;
return TRUE;
case EngProcessorFeature:
*pCapability = 0;
return TRUE;
default:
break;
}
return FALSE;
}
/*
* @unimplemented
*/
FLATPTR STDCALL
HeapVidMemAllocAligned(
IN VIDEOMEMORY *lpVidMem,
IN DWORD dwWidth,
IN DWORD dwHeight,
IN /*LPSURFACEALIGNMENT*/LPVOID lpAlignment,
OUT LPLONG lpNewPitch)
{
UNIMPLEMENTED;
return 0;
}
/*
* @unimplemented
*/
VOID STDCALL
VidMemFree(
IN LPVMEMHEAP pvmh,
IN FLATPTR ptr)
{
UNIMPLEMENTED;
}

View file

@ -1,4 +1,4 @@
; $Id: win32k.def,v 1.24 2004/02/11 19:26:51 weiden Exp $
; $Id: win32k.def,v 1.25 2004/03/06 01:22:04 navaraf Exp $
;
; win32k.def
;
@ -41,6 +41,7 @@ EngDeleteSemaphore@4
EngDeleteSurface@4
EngDeleteWnd@4
EngDeviceIoControl@28
EngDitherColor@16
EngEnumForms@24
EngEraseSurface@12
EngFillPath@28
@ -73,6 +74,7 @@ EngMapEvent@20
EngMapFontFile@12
EngMapModule@8
EngMarkBandingSurface@4
EngModifySurface@32
EngMovePointer@16
EngMulDiv@12
EngMultiByteToUnicodeN@20
@ -84,6 +86,7 @@ EngQueryLocalTime@4
EngQueryPalette@16
EngQueryPerformanceCounter@4
EngQueryPerformanceFrequency@4
EngQuerySystemAttribute@8
EngReleaseSemaphore@4
EngRestoreFloatingPointState@4
EngSaveFloatingPointState@8
@ -142,6 +145,7 @@ FONTOBJ_pifi@4
FONTOBJ_pvTrueTypeFontFile@8
FONTOBJ_pxoGetXform@4
FONTOBJ_vGetInfo@12
HeapVidMemAllocAligned@20
HT_ComputeRGBGammaTable@24
HT_Get8BPPFormatPalette
PALOBJ_cGetColors@16
@ -165,6 +169,7 @@ RtlUpcaseUnicodeToMultiByteN@20
STROBJ_bEnum@12
STROBJ_dwGetCodePage@4
STROBJ_vEnumStart@4
VidMemFree@8
Win32kInitialize@0
WNDOBJ_bEnum@12
WNDOBJ_cEnumStart@16

View file

@ -1,4 +1,4 @@
; $Id: win32k.edf,v 1.20 2004/02/11 19:26:51 weiden Exp $
; $Id: win32k.edf,v 1.21 2004/03/06 01:22:04 navaraf Exp $
;
; win32k.def
;
@ -41,6 +41,7 @@ EngDeleteSemaphore=EngDeleteSemaphore@4
EngDeleteSurface=EngDeleteSurface@4
EngDeleteWnd=EngDeleteWnd@4
EngDeviceIoControl=EngDeviceIoControl@28
EngDitherColor=EngDitherColor@16
EngEnumForms=EngEnumForms@24
EngEraseSurface=EngEraseSurface@12
EngFillPath=EngFillPath@28
@ -73,6 +74,7 @@ EngMapEvent=EngMapEvent@20
EngMapFontFile=EngMapFontFile@12
EngMapModule=EngMapModule@8
EngMarkBandingSurface=EngMarkBandingSurface@4
EngModifySurface=EngModifySurface@32
EngMovePointer=EngMovePointer@16
EngMulDiv=EngMulDiv@12
EngMultiByteToUnicodeN=EngMultiByteToUnicodeN@20
@ -84,6 +86,7 @@ EngQueryLocalTime=EngQueryLocalTime@4
EngQueryPalette=EngQueryPalette@16
EngQueryPerformanceCounter=EngQueryPerformanceCounter@4
EngQueryPerformanceFrequency=EngQueryPerformanceFrequency@4
EngQuerySystemAttribute=EngQuerySystemAttribute@8
EngReleaseSemaphore=EngReleaseSemaphore@4
EngRestoreFloatingPointState=EngRestoreFloatingPointState@4
EngSaveFloatingPointState=EngSaveFloatingPointState@8
@ -143,6 +146,7 @@ FONTOBJ_pifi=FONTOBJ_pifi@4
FONTOBJ_pvTrueTypeFontFile=FONTOBJ_pvTrueTypeFontFile@8
FONTOBJ_pxoGetXform=FONTOBJ_pxoGetXform@4
FONTOBJ_vGetInfo=FONTOBJ_vGetInfo@12
HeapVidMemAllocAligned=HeapVidMemAllocAligned@20
HT_ComputeRGBGammaTable=HT_ComputeRGBGammaTable@24
HT_Get8BPPFormatPalette=HT_Get8BPPFormatPalette@16
PALOBJ_cGetColors=PALOBJ_cGetColors@16
@ -166,6 +170,7 @@ RtlUpcaseUnicodeToMultiByteN=NTOSKRNL.RtlUpcaseUnicodeToMultiByteN
STROBJ_bEnum=STROBJ_bEnum@12
STROBJ_dwGetCodePage=STROBJ_dwGetCodePage@4
STROBJ_vEnumStart=STROBJ_vEnumStart@4
VidMemFree=VidMemFree@8
Win32kInitialize=Win32kInitialize@0
WNDOBJ_bEnum=WNDOBJ_bEnum@12
WNDOBJ_cEnumStart=WNDOBJ_cEnumStart@16