mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Move GDI drivers and win32k.sys from system32\drivers to system32
- Load GDI driver from registry key - Clean up hacks in videoprt (borrowed some code from scsiport) - Support for MS VGA driver under VMware, doesn't work yet under Bochs svn path=/trunk/; revision=4199
This commit is contained in:
parent
31f87c95ae
commit
991196c35e
24 changed files with 1095 additions and 446 deletions
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* entry.c
|
* entry.c
|
||||||
*
|
*
|
||||||
* $Revision: 1.23 $
|
* $Revision: 1.24 $
|
||||||
* $Author: dwelch $
|
* $Author: gvg $
|
||||||
* $Date: 2002/09/25 21:21:35 $
|
* $Date: 2003/02/25 23:08:52 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ DRVFN FuncList[] =
|
||||||
/* Required Display driver fuctions */
|
/* Required Display driver fuctions */
|
||||||
{INDEX_DrvAssertMode, (PFN) DrvAssertMode},
|
{INDEX_DrvAssertMode, (PFN) DrvAssertMode},
|
||||||
{INDEX_DrvCompletePDEV, (PFN) DrvCompletePDEV},
|
{INDEX_DrvCompletePDEV, (PFN) DrvCompletePDEV},
|
||||||
|
{INDEX_DrvCopyBits, (PFN) DrvCopyBits},
|
||||||
{INDEX_DrvDisablePDEV, (PFN) DrvDisablePDEV},
|
{INDEX_DrvDisablePDEV, (PFN) DrvDisablePDEV},
|
||||||
{INDEX_DrvDisableSurface, (PFN) DrvDisableSurface},
|
{INDEX_DrvDisableSurface, (PFN) DrvDisableSurface},
|
||||||
{INDEX_DrvEnablePDEV, (PFN) DrvEnablePDEV},
|
{INDEX_DrvEnablePDEV, (PFN) DrvEnablePDEV},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile,v 1.19 2002/09/25 21:21:35 dwelch Exp $
|
# $Id: makefile,v 1.20 2003/02/25 23:08:51 gvg Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../../../..
|
PATH_TO_TOP = ../../../..
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ OTHER_OBJECTS = \
|
||||||
objects/paint.o \
|
objects/paint.o \
|
||||||
objects/bitblt.o \
|
objects/bitblt.o \
|
||||||
objects/transblt.o \
|
objects/transblt.o \
|
||||||
objects/offscreen.o
|
objects/offscreen.o \
|
||||||
|
objects/copybits.o
|
||||||
|
|
||||||
VGAVIDEO_OBJECTS = \
|
VGAVIDEO_OBJECTS = \
|
||||||
vgavideo/vgavideo.o
|
vgavideo/vgavideo.o
|
||||||
|
|
|
@ -369,8 +369,15 @@ DrvBitBlt(SURFOBJ *Dest,
|
||||||
BrushPoint, rop4));
|
BrushPoint, rop4));
|
||||||
|
|
||||||
case SRCCOPY:
|
case SRCCOPY:
|
||||||
|
if (BMF_4BPP == Source->iBitmapFormat && BMF_4BPP == Dest->iBitmapFormat)
|
||||||
|
{
|
||||||
return(VGADDI_BltSrc(Dest, Source, ColorTranslation, DestRect,
|
return(VGADDI_BltSrc(Dest, Source, ColorTranslation, DestRect,
|
||||||
SourcePoint));
|
SourcePoint));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
case 0xAACC:
|
case 0xAACC:
|
||||||
return(VGADDI_BltMask(Dest, Mask, ColorTranslation, DestRect,
|
return(VGADDI_BltMask(Dest, Mask, ColorTranslation, DestRect,
|
||||||
|
|
39
reactos/drivers/dd/vga/display/objects/copybits.c
Normal file
39
reactos/drivers/dd/vga/display/objects/copybits.c
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#include "../vgaddi.h"
|
||||||
|
#include "../vgavideo/vgavideo.h"
|
||||||
|
|
||||||
|
#define DBG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
DrvCopyBits(OUT PSURFOBJ DestObj,
|
||||||
|
IN PSURFOBJ SourceObj,
|
||||||
|
IN PCLIPOBJ ClipObj,
|
||||||
|
IN PXLATEOBJ XLateObj,
|
||||||
|
IN PRECTL DestRectL,
|
||||||
|
IN PPOINTL SrcPointL)
|
||||||
|
{
|
||||||
|
BOOL Done = FALSE;
|
||||||
|
|
||||||
|
if (STYPE_BITMAP == DestObj->iType && BMF_4BPP == DestObj->iBitmapFormat &&
|
||||||
|
STYPE_DEVICE == SourceObj->iType)
|
||||||
|
{
|
||||||
|
/* Screen to 4 BPP DIB */
|
||||||
|
DIB_BltFromVGA(SrcPointL->x, SrcPointL->y,
|
||||||
|
DestRectL->right - DestRectL->left,
|
||||||
|
DestRectL->bottom - DestRectL->top,
|
||||||
|
DestObj->pvScan0, DestObj->lDelta);
|
||||||
|
Done = TRUE;
|
||||||
|
}
|
||||||
|
else if (STYPE_DEVICE == DestObj->iType &&
|
||||||
|
STYPE_BITMAP == SourceObj->iType && BMF_4BPP == SourceObj->iBitmapFormat)
|
||||||
|
{
|
||||||
|
/* 4 BPP DIB to Screen */
|
||||||
|
DIB_BltToVGA(DestRectL->left, DestRectL->top,
|
||||||
|
DestRectL->right - DestRectL->left,
|
||||||
|
DestRectL->bottom - DestRectL->top,
|
||||||
|
SourceObj->pvScan0, SourceObj->lDelta);
|
||||||
|
Done = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Done;
|
||||||
|
}
|
|
@ -1,31 +1,8 @@
|
||||||
/* $Id: videoprt.c,v 1.2 2003/02/17 21:24:42 gvg Exp $
|
/* $Id: videoprt.c,v 1.3 2003/02/25 23:08:52 gvg Exp $
|
||||||
*
|
*
|
||||||
* VideoPort driver
|
* VideoPort driver
|
||||||
* Written by Rex Jolliff
|
* Written by Rex Jolliff
|
||||||
*
|
*
|
||||||
* FIXME:
|
|
||||||
* There are two ugly and temporary hacks in this file, to get the VMware driver to
|
|
||||||
* work.
|
|
||||||
* First, the miniport driver is allowed to call VideoPortInitialize() multiple times.
|
|
||||||
* VideoPortInitialize() will create a device and then call the miniport's
|
|
||||||
* HwFindAdapter(). If that call returns with an error code, the device will be
|
|
||||||
* deleted. The next time VideoPortInitialize() is called, it will be create a
|
|
||||||
* new device with the same name as the first time. The first device was deleted so
|
|
||||||
* this shouldn't be a problem, the device is created successfully. Initialization
|
|
||||||
* then continues.
|
|
||||||
* The problems start when it's time to start the device. When the driver is opened,
|
|
||||||
* the caller will receive a pointer to the FIRST device, the one which was later
|
|
||||||
* deleted. This is propably due to a problem in the Io subsystem which needs to
|
|
||||||
* be investigated. To get around this, a pointer is kept to the last successfully
|
|
||||||
* opened device (pdoLastOpened) and this device is used instead of the pointer
|
|
||||||
* passed in.
|
|
||||||
* The second problem has to do with resources. The miniport driver will call
|
|
||||||
* VideoPortGetDeviceBase() to map a physical address to a virtual address. Later,
|
|
||||||
* it will call VideoPortMapMemory() with the same physical address. It should
|
|
||||||
* map to the same virtual address, but I couldn't get this to work at the moment.
|
|
||||||
* So, as a workaround, a maximum of 2 physical addresses with their corresponding
|
|
||||||
* virtual addresses saved. They are filled by VideoPortGetDeviceBase() and
|
|
||||||
* looked-up by VideoPortMapMemory().
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errors.h>
|
#include <errors.h>
|
||||||
|
@ -34,26 +11,56 @@
|
||||||
|
|
||||||
#include "../../../ntoskrnl/include/internal/v86m.h"
|
#include "../../../ntoskrnl/include/internal/v86m.h"
|
||||||
|
|
||||||
#include "videoprt.h"
|
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#define VERSION "0.0.0"
|
#define VERSION "0.0.0"
|
||||||
|
|
||||||
|
#define TAG_VIDEO_PORT TAG('V', 'I', 'D', 'P')
|
||||||
|
|
||||||
|
typedef struct _VIDEO_PORT_ADDRESS_MAPPING
|
||||||
|
{
|
||||||
|
LIST_ENTRY List;
|
||||||
|
|
||||||
|
PVOID MappedAddress;
|
||||||
|
ULONG NumberOfUchars;
|
||||||
|
PHYSICAL_ADDRESS IoAddress;
|
||||||
|
ULONG SystemIoBusNumber;
|
||||||
|
UINT MappingCount;
|
||||||
|
} VIDEO_PORT_ADDRESS_MAPPING, *PVIDEO_PORT_ADDRESS_MAPPING;
|
||||||
|
|
||||||
|
typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT DeviceObject;
|
||||||
|
PKINTERRUPT InterruptObject;
|
||||||
|
KSPIN_LOCK InterruptSpinLock;
|
||||||
|
ULONG InterruptLevel;
|
||||||
|
KIRQL IRQL;
|
||||||
|
KAFFINITY Affinity;
|
||||||
|
PVIDEO_HW_INITIALIZE HwInitialize;
|
||||||
|
LIST_ENTRY AddressMappingListHead;
|
||||||
|
INTERFACE_TYPE AdapterInterfaceType;
|
||||||
|
ULONG SystemIoBusNumber;
|
||||||
|
UNICODE_STRING RegistryPath;
|
||||||
|
|
||||||
|
UCHAR MiniPortDeviceExtension[1]; /* must be the last entry */
|
||||||
|
} VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
|
||||||
|
|
||||||
|
|
||||||
static VOID STDCALL VidStartIo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
static VOID STDCALL VidStartIo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
||||||
static NTSTATUS STDCALL VidDispatchOpenClose(IN PDEVICE_OBJECT pDO, IN PIRP Irp);
|
static NTSTATUS STDCALL VidDispatchOpenClose(IN PDEVICE_OBJECT pDO, IN PIRP Irp);
|
||||||
static NTSTATUS STDCALL VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
static NTSTATUS STDCALL VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
|
||||||
|
static PVOID STDCALL InternalMapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
|
IN PHYSICAL_ADDRESS IoAddress,
|
||||||
|
IN ULONG NumberOfUchars,
|
||||||
|
IN UCHAR InIoSpace);
|
||||||
|
static VOID STDCALL InternalUnmapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
|
IN PVOID MappedAddress);
|
||||||
|
|
||||||
static BOOLEAN CsrssInitialized = FALSE;
|
static BOOLEAN CsrssInitialized = FALSE;
|
||||||
static HANDLE CsrssHandle = 0;
|
static HANDLE CsrssHandle = 0;
|
||||||
static struct _EPROCESS* Csrss = NULL;
|
static struct _EPROCESS* Csrss = NULL;
|
||||||
|
|
||||||
/* FIXME: see file header */
|
|
||||||
static PDEVICE_OBJECT pdoLastOpened;
|
|
||||||
static PHYSICAL_ADDRESS Phys1, Phys2;
|
|
||||||
static PVOID Virt1, Virt2;
|
|
||||||
|
|
||||||
PBYTE ReturnCsrssAddress(void)
|
PBYTE ReturnCsrssAddress(void)
|
||||||
{
|
{
|
||||||
DPRINT("ReturnCsrssAddress()\n");
|
DPRINT("ReturnCsrssAddress()\n");
|
||||||
|
@ -126,7 +133,15 @@ STDCALL
|
||||||
VideoPortFreeDeviceBase(IN PVOID HwDeviceExtension,
|
VideoPortFreeDeviceBase(IN PVOID HwDeviceExtension,
|
||||||
IN PVOID MappedAddress)
|
IN PVOID MappedAddress)
|
||||||
{
|
{
|
||||||
DPRINT1("VideoPortFreeDeviceBase not implemented\n");
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
|
DPRINT("VideoPortFreeDeviceBase\n");
|
||||||
|
|
||||||
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
|
VIDEO_PORT_DEVICE_EXTENSION,
|
||||||
|
MiniPortDeviceExtension);
|
||||||
|
|
||||||
|
InternalUnmapMemory(DeviceExtension, MappedAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
|
@ -138,11 +153,16 @@ VideoPortGetBusData(IN PVOID HwDeviceExtension,
|
||||||
IN ULONG Offset,
|
IN ULONG Offset,
|
||||||
IN ULONG Length)
|
IN ULONG Length)
|
||||||
{
|
{
|
||||||
ULONG BusNumber = 0;
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
DPRINT("VideoPortGetBusData\n");
|
DPRINT("VideoPortGetBusData\n");
|
||||||
|
|
||||||
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
|
VIDEO_PORT_DEVICE_EXTENSION,
|
||||||
|
MiniPortDeviceExtension);
|
||||||
|
|
||||||
return HalGetBusDataByOffset(BusDataType,
|
return HalGetBusDataByOffset(BusDataType,
|
||||||
BusNumber,
|
DeviceExtension->SystemIoBusNumber,
|
||||||
SlotNumber,
|
SlotNumber,
|
||||||
Buffer,
|
Buffer,
|
||||||
Offset,
|
Offset,
|
||||||
|
@ -164,40 +184,15 @@ VideoPortGetDeviceBase(IN PVOID HwDeviceExtension,
|
||||||
IN ULONG NumberOfUchars,
|
IN ULONG NumberOfUchars,
|
||||||
IN UCHAR InIoSpace)
|
IN UCHAR InIoSpace)
|
||||||
{
|
{
|
||||||
PHYSICAL_ADDRESS TranslatedAddress;
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
PVOID Virtual;
|
|
||||||
ULONG AddressSpace;
|
|
||||||
PVIDEOPORT_EXTENSION_DATA ExtensionData =
|
|
||||||
MPExtensionToVPExtension(HwDeviceExtension);
|
|
||||||
|
|
||||||
DPRINT("VideoPortGetDeviceBase\n");
|
DPRINT("VideoPortGetDeviceBase\n");
|
||||||
AddressSpace = (InIoSpace ? 1 : 0);
|
|
||||||
|
|
||||||
if (HalTranslateBusAddress(PCIBus, 0, IoAddress, &AddressSpace, &TranslatedAddress))
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
{
|
VIDEO_PORT_DEVICE_EXTENSION,
|
||||||
if (AddressSpace)
|
MiniPortDeviceExtension);
|
||||||
{
|
|
||||||
return (PVOID)(DWORD)(TranslatedAddress.QuadPart);
|
return InternalMapMemory(DeviceExtension, IoAddress, NumberOfUchars, InIoSpace);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Virtual = MmMapIoSpace(TranslatedAddress, NumberOfUchars, MmNonCached);
|
|
||||||
/* FIXME: see file header */
|
|
||||||
DPRINT("Mapped 0x%08x to 0x%08x\n", IoAddress.u.LowPart, Virtual);
|
|
||||||
if (0 == Phys1.QuadPart)
|
|
||||||
{
|
|
||||||
Virt1 = Virtual;
|
|
||||||
}
|
|
||||||
if (0 == Phys2.QuadPart)
|
|
||||||
{
|
|
||||||
Virt2 = Virtual;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VP_STATUS
|
VP_STATUS
|
||||||
|
@ -226,15 +221,20 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
|
||||||
BOOLEAN FoundDevice;
|
BOOLEAN FoundDevice;
|
||||||
ULONG FunctionNumber;
|
ULONG FunctionNumber;
|
||||||
PCI_COMMON_CONFIG Config;
|
PCI_COMMON_CONFIG Config;
|
||||||
UINT BusNumber = 0;
|
|
||||||
PCM_RESOURCE_LIST AllocatedResources;
|
PCM_RESOURCE_LIST AllocatedResources;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UINT AssignedCount;
|
UINT AssignedCount;
|
||||||
CM_FULL_RESOURCE_DESCRIPTOR *FullList;
|
CM_FULL_RESOURCE_DESCRIPTOR *FullList;
|
||||||
CM_PARTIAL_RESOURCE_DESCRIPTOR *Descriptor;
|
CM_PARTIAL_RESOURCE_DESCRIPTOR *Descriptor;
|
||||||
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
DPRINT("VideoPortGetAccessRanges\n");
|
DPRINT("VideoPortGetAccessRanges\n");
|
||||||
if (0 == NumRequestedResources)
|
|
||||||
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
|
VIDEO_PORT_DEVICE_EXTENSION,
|
||||||
|
MiniPortDeviceExtension);
|
||||||
|
|
||||||
|
if (0 == NumRequestedResources && PCIBus == DeviceExtension->AdapterInterfaceType)
|
||||||
{
|
{
|
||||||
DPRINT("Looking for VendorId 0x%04x DeviceId 0x%04x\n", (int)*((USHORT *) VendorId),
|
DPRINT("Looking for VendorId 0x%04x DeviceId 0x%04x\n", (int)*((USHORT *) VendorId),
|
||||||
(int)*((USHORT *) DeviceId));
|
(int)*((USHORT *) DeviceId));
|
||||||
|
@ -244,8 +244,9 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
|
||||||
{
|
{
|
||||||
PciSlotNumber.u.bits.FunctionNumber = FunctionNumber;
|
PciSlotNumber.u.bits.FunctionNumber = FunctionNumber;
|
||||||
if (sizeof(PCI_COMMON_CONFIG) ==
|
if (sizeof(PCI_COMMON_CONFIG) ==
|
||||||
HalGetBusDataByOffset(PCIConfiguration, BusNumber, PciSlotNumber.u.AsULONG,
|
HalGetBusDataByOffset(PCIConfiguration, DeviceExtension->SystemIoBusNumber,
|
||||||
&Config, 0, sizeof(PCI_COMMON_CONFIG)))
|
PciSlotNumber.u.AsULONG,&Config, 0,
|
||||||
|
sizeof(PCI_COMMON_CONFIG)))
|
||||||
{
|
{
|
||||||
DPRINT("Slot 0x%02x (Device %d Function %d) VendorId 0x%04x DeviceId 0x%04x\n",
|
DPRINT("Slot 0x%02x (Device %d Function %d) VendorId 0x%04x DeviceId 0x%04x\n",
|
||||||
PciSlotNumber.u.AsULONG, PciSlotNumber.u.bits.DeviceNumber,
|
PciSlotNumber.u.AsULONG, PciSlotNumber.u.bits.DeviceNumber,
|
||||||
|
@ -258,7 +259,9 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
|
||||||
{
|
{
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
Status = HalAssignSlotResources(NULL, NULL, NULL, NULL, PCIBus, BusNumber,
|
Status = HalAssignSlotResources(NULL, NULL, NULL, NULL,
|
||||||
|
DeviceExtension->AdapterInterfaceType,
|
||||||
|
DeviceExtension->SystemIoBusNumber,
|
||||||
PciSlotNumber.u.AsULONG, &AllocatedResources);
|
PciSlotNumber.u.AsULONG, &AllocatedResources);
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -271,7 +274,7 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
|
||||||
FullList++)
|
FullList++)
|
||||||
{
|
{
|
||||||
assert(FullList->InterfaceType == PCIBus &&
|
assert(FullList->InterfaceType == PCIBus &&
|
||||||
FullList->BusNumber == BusNumber &&
|
FullList->BusNumber == DeviceExtension->SystemIoBusNumber &&
|
||||||
1 == FullList->PartialResourceList.Version &&
|
1 == FullList->PartialResourceList.Version &&
|
||||||
1 == FullList->PartialResourceList.Revision);
|
1 == FullList->PartialResourceList.Revision);
|
||||||
for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
|
for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
|
||||||
|
@ -310,6 +313,10 @@ VideoPortGetAccessRanges(IN PVOID HwDeviceExtension,
|
||||||
}
|
}
|
||||||
ExFreePool(AllocatedResources);
|
ExFreePool(AllocatedResources);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED
|
||||||
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -324,30 +331,67 @@ VideoPortGetRegistryParameters(IN PVOID HwDeviceExtension,
|
||||||
{
|
{
|
||||||
DPRINT("VideoPortGetRegistryParameters\n");
|
DPRINT("VideoPortGetRegistryParameters\n");
|
||||||
DPRINT("ParameterName %S\n", ParameterName);
|
DPRINT("ParameterName %S\n", ParameterName);
|
||||||
UNIMPLEMENTED;
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
|
/*
|
||||||
|
return NO_ERROR;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct _VIDEO_PORT_CONFIG_INFO_TODO {
|
||||||
|
ULONG Length;
|
||||||
|
ULONG SystemIoBusNumber;
|
||||||
|
INTERFACE_TYPE AdapterInterfaceType;
|
||||||
|
ULONG BusInterruptLevel;
|
||||||
|
ULONG BusInterruptVector;
|
||||||
|
KINTERRUPT_MODE InterruptMode;
|
||||||
|
ULONG NumEmulatorAccessEntries;
|
||||||
|
PEMULATOR_ACCESS_ENTRY EmulatorAccessEntries;
|
||||||
|
ULONG_PTR EmulatorAccessEntriesContext;
|
||||||
|
PHYSICAL_ADDRESS VdmPhysicalVideoMemoryAddress;
|
||||||
|
ULONG VdmPhysicalVideoMemoryLength;
|
||||||
|
ULONG HardwareStateSize;
|
||||||
|
ULONG DmaChannel;
|
||||||
|
ULONG DmaPort;
|
||||||
|
UCHAR DmaShareable;
|
||||||
|
UCHAR InterruptShareable;
|
||||||
|
BOOLEAN Master;
|
||||||
|
DMA_WIDTH DmaWidth;
|
||||||
|
DMA_SPEED DmaSpeed;
|
||||||
|
BOOLEAN bMapBuffers;
|
||||||
|
BOOLEAN NeedPhysicalAddresses;
|
||||||
|
BOOLEAN DemandMode;
|
||||||
|
ULONG MaximumTransferLength;
|
||||||
|
ULONG NumberOfPhysicalBreaks;
|
||||||
|
BOOLEAN ScatterGather;
|
||||||
|
ULONG MaximumScatterGatherChunkSize;
|
||||||
|
} VIDEO_PORT_CONFIG_INFO_TODO, *PVIDEO_PORT_CONFIG_INFO_TODO;
|
||||||
|
|
||||||
ULONG STDCALL
|
ULONG STDCALL
|
||||||
VideoPortInitialize(IN PVOID Context1,
|
VideoPortInitialize(IN PVOID Context1,
|
||||||
IN PVOID Context2,
|
IN PVOID Context2,
|
||||||
IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
|
IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
|
||||||
IN PVOID HwContext)
|
IN PVOID HwContext)
|
||||||
{
|
{
|
||||||
|
PUNICODE_STRING RegistryPath;
|
||||||
UCHAR Again;
|
UCHAR Again;
|
||||||
WCHAR DeviceBuffer[20];
|
WCHAR DeviceBuffer[20];
|
||||||
WCHAR SymlinkBuffer[20];
|
WCHAR SymlinkBuffer[20];
|
||||||
|
WCHAR DeviceVideoBuffer[20];
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PDRIVER_OBJECT MPDriverObject = (PDRIVER_OBJECT) Context1;
|
PDRIVER_OBJECT MPDriverObject = (PDRIVER_OBJECT) Context1;
|
||||||
PDEVICE_OBJECT MPDeviceObject;
|
PDEVICE_OBJECT MPDeviceObject;
|
||||||
VIDEO_PORT_CONFIG_INFO ConfigInfo;
|
VIDEO_PORT_CONFIG_INFO_TODO ConfigInfo;
|
||||||
PVIDEOPORT_EXTENSION_DATA ExtensionData;
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
ULONG DeviceNumber = 0;
|
ULONG DeviceNumber = 0;
|
||||||
UNICODE_STRING DeviceName;
|
UNICODE_STRING DeviceName;
|
||||||
UNICODE_STRING SymlinkName;
|
UNICODE_STRING SymlinkName;
|
||||||
CLIENT_ID Cid;
|
ULONG MaxBus;
|
||||||
|
ULONG MaxLen;
|
||||||
|
|
||||||
DPRINT("VideoPortInitialize\n");
|
DPRINT("VideoPortInitialize\n");
|
||||||
|
|
||||||
|
RegistryPath = (PUNICODE_STRING) Context2;
|
||||||
|
|
||||||
/* Build Dispatch table from passed data */
|
/* Build Dispatch table from passed data */
|
||||||
MPDriverObject->DriverStartIo = (PDRIVER_STARTIO) HwInitializationData->HwStartIO;
|
MPDriverObject->DriverStartIo = (PDRIVER_STARTIO) HwInitializationData->HwStartIO;
|
||||||
|
|
||||||
|
@ -361,7 +405,7 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
/* Create the device */
|
/* Create the device */
|
||||||
Status = IoCreateDevice(MPDriverObject,
|
Status = IoCreateDevice(MPDriverObject,
|
||||||
HwInitializationData->HwDeviceExtensionSize +
|
HwInitializationData->HwDeviceExtensionSize +
|
||||||
sizeof(VIDEOPORT_EXTENSION_DATA),
|
sizeof(VIDEO_PORT_DEVICE_EXTENSION),
|
||||||
&DeviceName,
|
&DeviceName,
|
||||||
FILE_DEVICE_VIDEO,
|
FILE_DEVICE_VIDEO,
|
||||||
0,
|
0,
|
||||||
|
@ -375,11 +419,73 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
|
|
||||||
MPDriverObject->DeviceObject = MPDeviceObject;
|
MPDriverObject->DeviceObject = MPDeviceObject;
|
||||||
|
|
||||||
/* initialize the miniport drivers dispatch table */
|
/* Initialize the miniport drivers dispatch table */
|
||||||
MPDriverObject->MajorFunction[IRP_MJ_CREATE] = VidDispatchOpenClose;
|
MPDriverObject->MajorFunction[IRP_MJ_CREATE] = VidDispatchOpenClose;
|
||||||
MPDriverObject->MajorFunction[IRP_MJ_CLOSE] = VidDispatchOpenClose;
|
MPDriverObject->MajorFunction[IRP_MJ_CLOSE] = VidDispatchOpenClose;
|
||||||
MPDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = VidDispatchDeviceControl;
|
MPDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = VidDispatchDeviceControl;
|
||||||
|
|
||||||
|
/* Initialize our device extension */
|
||||||
|
DeviceExtension =
|
||||||
|
(PVIDEO_PORT_DEVICE_EXTENSION) MPDeviceObject->DeviceExtension;
|
||||||
|
DeviceExtension->DeviceObject = MPDeviceObject;
|
||||||
|
DeviceExtension->HwInitialize = HwInitializationData->HwInitialize;
|
||||||
|
DeviceExtension->AdapterInterfaceType = HwInitializationData->AdapterInterfaceType;
|
||||||
|
DeviceExtension->SystemIoBusNumber = 0;
|
||||||
|
MaxLen = (wcslen(RegistryPath->Buffer) + 10) * sizeof(WCHAR);
|
||||||
|
DeviceExtension->RegistryPath.MaximumLength = MaxLen;
|
||||||
|
DeviceExtension->RegistryPath.Buffer = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
MaxLen,
|
||||||
|
TAG_VIDEO_PORT);
|
||||||
|
swprintf(DeviceExtension->RegistryPath.Buffer, L"%s\\Device%d",
|
||||||
|
RegistryPath->Buffer, DeviceNumber);
|
||||||
|
DeviceExtension->RegistryPath.Length = wcslen(DeviceExtension->RegistryPath.Buffer) *
|
||||||
|
sizeof(WCHAR);
|
||||||
|
|
||||||
|
MaxBus = (DeviceExtension->AdapterInterfaceType == PCIBus) ? 8 : 1;
|
||||||
|
DPRINT("MaxBus: %lu\n", MaxBus);
|
||||||
|
InitializeListHead(&DeviceExtension->AddressMappingListHead);
|
||||||
|
|
||||||
|
/* Set the buffering strategy here... */
|
||||||
|
/* If you change this, remember to change VidDispatchDeviceControl too */
|
||||||
|
MPDeviceObject->Flags |= DO_BUFFERED_IO;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
RtlZeroMemory(&DeviceExtension->MiniPortDeviceExtension,
|
||||||
|
HwInitializationData->HwDeviceExtensionSize);
|
||||||
|
DPRINT("Searching on bus %d\n", DeviceExtension->SystemIoBusNumber);
|
||||||
|
/* Setup configuration info */
|
||||||
|
RtlZeroMemory(&ConfigInfo, sizeof(VIDEO_PORT_CONFIG_INFO_TODO));
|
||||||
|
ConfigInfo.Length = sizeof(VIDEO_PORT_CONFIG_INFO_TODO);
|
||||||
|
ConfigInfo.AdapterInterfaceType = DeviceExtension->AdapterInterfaceType;
|
||||||
|
ConfigInfo.SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
|
||||||
|
ConfigInfo.InterruptMode = (PCIBus == DeviceExtension->AdapterInterfaceType) ?
|
||||||
|
LevelSensitive : Latched;
|
||||||
|
|
||||||
|
/* Call HwFindAdapter entry point */
|
||||||
|
/* FIXME: Need to figure out what string to pass as param 3 */
|
||||||
|
Status = HwInitializationData->HwFindAdapter(&DeviceExtension->MiniPortDeviceExtension,
|
||||||
|
Context2,
|
||||||
|
NULL,
|
||||||
|
&ConfigInfo,
|
||||||
|
&Again);
|
||||||
|
if (NO_ERROR != Status)
|
||||||
|
{
|
||||||
|
DPRINT("HwFindAdapter call failed with error %d\n", Status);
|
||||||
|
DeviceExtension->SystemIoBusNumber++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (NO_ERROR != Status && DeviceExtension->SystemIoBusNumber < MaxBus);
|
||||||
|
|
||||||
|
if (NO_ERROR != Status)
|
||||||
|
{
|
||||||
|
RtlFreeUnicodeString(&DeviceExtension->RegistryPath);
|
||||||
|
IoDeleteDevice(MPDeviceObject);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
DPRINT("Found adapter\n");
|
||||||
|
|
||||||
/* create symbolic link "\??\DISPLAYx" */
|
/* create symbolic link "\??\DISPLAYx" */
|
||||||
swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DeviceNumber+1);
|
swprintf(SymlinkBuffer, L"\\??\\DISPLAY%lu", DeviceNumber+1);
|
||||||
RtlInitUnicodeString (&SymlinkName,
|
RtlInitUnicodeString (&SymlinkName,
|
||||||
|
@ -387,36 +493,14 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
IoCreateSymbolicLink (&SymlinkName,
|
IoCreateSymbolicLink (&SymlinkName,
|
||||||
&DeviceName);
|
&DeviceName);
|
||||||
|
|
||||||
ExtensionData =
|
/* Add entry to DEVICEMAP\VIDEO key in registry */
|
||||||
(PVIDEOPORT_EXTENSION_DATA) MPDeviceObject->DeviceExtension;
|
swprintf(DeviceVideoBuffer, L"\\Device\\Video%d", DeviceNumber);
|
||||||
ExtensionData->DeviceObject = MPDeviceObject;
|
RtlWriteRegistryValue(RTL_REGISTRY_DEVICEMAP,
|
||||||
ExtensionData->HwInitialize = HwInitializationData->HwInitialize;
|
L"VIDEO",
|
||||||
|
DeviceVideoBuffer,
|
||||||
/* Set the buffering strategy here... */
|
REG_SZ,
|
||||||
/* If you change this, remember to change VidDispatchDeviceControl too */
|
DeviceExtension->RegistryPath.Buffer,
|
||||||
MPDeviceObject->Flags |= DO_BUFFERED_IO;
|
DeviceExtension->RegistryPath.Length + sizeof(WCHAR));
|
||||||
|
|
||||||
RtlZeroMemory(&ConfigInfo, sizeof(VIDEO_PORT_CONFIG_INFO));
|
|
||||||
ConfigInfo.Length = sizeof(VIDEO_PORT_CONFIG_INFO);
|
|
||||||
ConfigInfo.AdapterInterfaceType = HwInitializationData->AdapterInterfaceType;
|
|
||||||
/* Call HwFindAdapter entry point */
|
|
||||||
/* FIXME: Need to figure out what string to pass as param 3 */
|
|
||||||
Status = HwInitializationData->HwFindAdapter(VPExtensionToMPExtension(ExtensionData),
|
|
||||||
Context2,
|
|
||||||
NULL,
|
|
||||||
&ConfigInfo,
|
|
||||||
&Again);
|
|
||||||
if (NO_ERROR != Status)
|
|
||||||
{
|
|
||||||
DPRINT("HwFindAdapter call failed with error %d\n", Status);
|
|
||||||
IoDeleteDevice(MPDeviceObject);
|
|
||||||
IoDeleteSymbolicLink(&SymlinkName);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
/* FIXME: see file header */
|
|
||||||
pdoLastOpened = MPDeviceObject;
|
|
||||||
DPRINT("Setting last opened device to 0x%08x\n", pdoLastOpened);
|
|
||||||
|
|
||||||
/* FIXME: Allocate hardware resources for device */
|
/* FIXME: Allocate hardware resources for device */
|
||||||
|
|
||||||
|
@ -426,26 +510,26 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
ConfigInfo.BusInterruptVector == 0))
|
ConfigInfo.BusInterruptVector == 0))
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
ExtensionData->IRQL = ConfigInfo.BusInterruptLevel;
|
DeviceExtension->IRQL = ConfigInfo.BusInterruptLevel;
|
||||||
ExtensionData->InterruptLevel =
|
DeviceExtension->InterruptLevel =
|
||||||
HalGetInterruptVector(ConfigInfo.AdapterInterfaceType,
|
HalGetInterruptVector(ConfigInfo.AdapterInterfaceType,
|
||||||
ConfigInfo.SystemIoBusNumber,
|
ConfigInfo.SystemIoBusNumber,
|
||||||
ConfigInfo.BusInterruptLevel,
|
ConfigInfo.BusInterruptLevel,
|
||||||
ConfigInfo.BusInterruptVector,
|
ConfigInfo.BusInterruptVector,
|
||||||
&ExtensionData->IRQL,
|
&DeviceExtension->IRQL,
|
||||||
&ExtensionData->Affinity);
|
&DeviceExtension->Affinity);
|
||||||
KeInitializeSpinLock(&ExtensionData->InterruptSpinLock);
|
KeInitializeSpinLock(&DeviceExtension->InterruptSpinLock);
|
||||||
Status = IoConnectInterrupt(&ExtensionData->InterruptObject,
|
Status = IoConnectInterrupt(&DeviceExtension->InterruptObject,
|
||||||
(PKSERVICE_ROUTINE)
|
(PKSERVICE_ROUTINE)
|
||||||
HwInitializationData->HwInterrupt,
|
HwInitializationData->HwInterrupt,
|
||||||
VPExtensionToMPExtension(ExtensionData),
|
&DeviceExtension->MiniPortDeviceExtension,
|
||||||
&ExtensionData->InterruptSpinLock,
|
&DeviceExtension->InterruptSpinLock,
|
||||||
ExtensionData->InterruptLevel,
|
DeviceExtension->InterruptLevel,
|
||||||
ExtensionData->IRQL,
|
DeviceExtension->IRQL,
|
||||||
ExtensionData->IRQL,
|
DeviceExtension->IRQL,
|
||||||
ConfigInfo.InterruptMode,
|
ConfigInfo.InterruptMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
ExtensionData->Affinity,
|
DeviceExtension->Affinity,
|
||||||
FALSE);
|
FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -466,14 +550,14 @@ VideoPortInitialize(IN PVOID Context1,
|
||||||
Status = IoInitializeTimer(MPDeviceObject,
|
Status = IoInitializeTimer(MPDeviceObject,
|
||||||
(PIO_TIMER_ROUTINE)
|
(PIO_TIMER_ROUTINE)
|
||||||
HwInitializationData->HwTimer,
|
HwInitializationData->HwTimer,
|
||||||
VPExtensionToMPExtension(ExtensionData));
|
&DeviceExtension->MiniPortDeviceExtension);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("IoInitializeTimer failed with status 0x%08x\n", Status);
|
DPRINT("IoInitializeTimer failed with status 0x%08x\n", Status);
|
||||||
|
|
||||||
if (HwInitializationData->HwInterrupt != NULL)
|
if (HwInitializationData->HwInterrupt != NULL)
|
||||||
{
|
{
|
||||||
IoDisconnectInterrupt(ExtensionData->InterruptObject);
|
IoDisconnectInterrupt(DeviceExtension->InterruptObject);
|
||||||
}
|
}
|
||||||
IoDeleteDevice(MPDeviceObject);
|
IoDeleteDevice(MPDeviceObject);
|
||||||
|
|
||||||
|
@ -544,46 +628,19 @@ VideoPortMapMemory(IN PVOID HwDeviceExtension,
|
||||||
IN PULONG InIoSpace,
|
IN PULONG InIoSpace,
|
||||||
OUT PVOID *VirtualAddress)
|
OUT PVOID *VirtualAddress)
|
||||||
{
|
{
|
||||||
PHYSICAL_ADDRESS TranslatedAddress;
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
ULONG AddressSpace;
|
PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
|
||||||
PVIDEOPORT_EXTENSION_DATA ExtensionData =
|
PLIST_ENTRY Entry;
|
||||||
MPExtensionToVPExtension(HwDeviceExtension);
|
|
||||||
|
|
||||||
DPRINT("VideoPortMapMemory\n");
|
DPRINT("VideoPortMapMemory\n");
|
||||||
|
|
||||||
/* FIXME: see file header */
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
if (Phys1.QuadPart == PhysicalAddress.QuadPart)
|
VIDEO_PORT_DEVICE_EXTENSION,
|
||||||
{
|
MiniPortDeviceExtension);
|
||||||
DPRINT("Using saved mapping #1\n");
|
*VirtualAddress = InternalMapMemory(DeviceExtension, PhysicalAddress,
|
||||||
*VirtualAddress = Virt1;
|
*Length, *InIoSpace);
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
if (Phys2.QuadPart == PhysicalAddress.QuadPart)
|
|
||||||
{
|
|
||||||
DPRINT("Using saved mapping #2\n");
|
|
||||||
*VirtualAddress = Virt2;
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddressSpace = (*InIoSpace ? 1 : 0);
|
return NULL == *VirtualAddress ? STATUS_NO_MEMORY : STATUS_SUCCESS;
|
||||||
|
|
||||||
if (HalTranslateBusAddress(PCIBus, 0, PhysicalAddress, &AddressSpace, &TranslatedAddress))
|
|
||||||
{
|
|
||||||
if (AddressSpace)
|
|
||||||
{
|
|
||||||
*VirtualAddress = (PVOID)(DWORD)(TranslatedAddress.QuadPart);
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*VirtualAddress = MmMapIoSpace(TranslatedAddress, *Length, MmNonCached);
|
|
||||||
return NULL != *VirtualAddress ? STATUS_SUCCESS : STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UCHAR
|
UCHAR
|
||||||
|
@ -730,8 +787,21 @@ VideoPortSetRegistryParameters(IN PVOID HwDeviceExtension,
|
||||||
IN PVOID ValueData,
|
IN PVOID ValueData,
|
||||||
IN ULONG ValueLength)
|
IN ULONG ValueLength)
|
||||||
{
|
{
|
||||||
DPRINT1("VideoPortSetRegistryParameters not implemented\n");
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
return NO_ERROR;
|
|
||||||
|
DPRINT("VideoSetRegistryParameters\n");
|
||||||
|
|
||||||
|
assert_irql(PASSIVE_LEVEL);
|
||||||
|
|
||||||
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
|
VIDEO_PORT_DEVICE_EXTENSION,
|
||||||
|
MiniPortDeviceExtension);
|
||||||
|
return RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,
|
||||||
|
DeviceExtension->RegistryPath.Buffer,
|
||||||
|
ValueName,
|
||||||
|
REG_BINARY,
|
||||||
|
ValueData,
|
||||||
|
ValueLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
VP_STATUS
|
VP_STATUS
|
||||||
|
@ -748,22 +818,28 @@ VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
VideoPortStartTimer(IN PVOID HwDeviceExtension)
|
VideoPortStartTimer(IN PVOID HwDeviceExtension)
|
||||||
{
|
{
|
||||||
PVIDEOPORT_EXTENSION_DATA ExtensionData =
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
MPExtensionToVPExtension(HwDeviceExtension);
|
|
||||||
|
|
||||||
DPRINT("VideoPortStartTimer\n");
|
DPRINT("VideoPortStartTimer\n");
|
||||||
IoStartTimer(ExtensionData->DeviceObject);
|
|
||||||
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
|
VIDEO_PORT_DEVICE_EXTENSION,
|
||||||
|
MiniPortDeviceExtension);
|
||||||
|
IoStartTimer(DeviceExtension->DeviceObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
VideoPortStopTimer(IN PVOID HwDeviceExtension)
|
VideoPortStopTimer(IN PVOID HwDeviceExtension)
|
||||||
{
|
{
|
||||||
PVIDEOPORT_EXTENSION_DATA ExtensionData =
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
MPExtensionToVPExtension(HwDeviceExtension);
|
|
||||||
|
|
||||||
DPRINT("VideoPortStopTimer\n");
|
DPRINT("VideoPortStopTimer\n");
|
||||||
IoStopTimer(ExtensionData->DeviceObject);
|
|
||||||
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
|
VIDEO_PORT_DEVICE_EXTENSION,
|
||||||
|
MiniPortDeviceExtension);
|
||||||
|
IoStopTimer(DeviceExtension->DeviceObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
@ -783,8 +859,17 @@ VideoPortUnmapMemory(IN PVOID HwDeviceExtension,
|
||||||
IN PVOID VirtualAddress,
|
IN PVOID VirtualAddress,
|
||||||
IN HANDLE ProcessHandle)
|
IN HANDLE ProcessHandle)
|
||||||
{
|
{
|
||||||
DPRINT1("VideoPortUnmapMemory not implemented\n");
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
return NO_ERROR;
|
|
||||||
|
DPRINT("VideoPortFreeDeviceBase\n");
|
||||||
|
|
||||||
|
DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
|
VIDEO_PORT_DEVICE_EXTENSION,
|
||||||
|
MiniPortDeviceExtension);
|
||||||
|
|
||||||
|
InternalUnmapMemory(DeviceExtension, VirtualAddress);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
VP_STATUS
|
VP_STATUS
|
||||||
|
@ -820,7 +905,9 @@ STDCALL
|
||||||
VideoPortWritePortUlong(IN PULONG Port,
|
VideoPortWritePortUlong(IN PULONG Port,
|
||||||
IN ULONG Value)
|
IN ULONG Value)
|
||||||
{
|
{
|
||||||
|
#ifdef TODO
|
||||||
DPRINT("VideoPortWritePortUlong\n");
|
DPRINT("VideoPortWritePortUlong\n");
|
||||||
|
#endif
|
||||||
WRITE_PORT_ULONG(Port, Value);
|
WRITE_PORT_ULONG(Port, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -914,7 +1001,7 @@ VideoPortZeroDeviceMemory(OUT PVOID Destination,
|
||||||
IN ULONG Length)
|
IN ULONG Length)
|
||||||
{
|
{
|
||||||
DPRINT("VideoPortZeroDeviceMemory\n");
|
DPRINT("VideoPortZeroDeviceMemory\n");
|
||||||
UNIMPLEMENTED;
|
RtlZeroMemory(Destination, Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -940,13 +1027,10 @@ VidDispatchOpenClose(IN PDEVICE_OBJECT pDO,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION IrpStack;
|
PIO_STACK_LOCATION IrpStack;
|
||||||
PVIDEOPORT_EXTENSION_DATA ExtensionData;
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
DPRINT("VidDispatchOpenClose() called\n");
|
DPRINT("VidDispatchOpenClose() called\n");
|
||||||
|
|
||||||
/* FIXME: see file header */
|
|
||||||
DPRINT("Using device 0x%08x instead of 0x%08x\n", pdoLastOpened, pDO);
|
|
||||||
pDO = pdoLastOpened;
|
|
||||||
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
if (IrpStack->MajorFunction == IRP_MJ_CREATE &&
|
if (IrpStack->MajorFunction == IRP_MJ_CREATE &&
|
||||||
|
@ -956,8 +1040,8 @@ VidDispatchOpenClose(IN PDEVICE_OBJECT pDO,
|
||||||
Csrss = PsGetCurrentProcess();
|
Csrss = PsGetCurrentProcess();
|
||||||
CsrssInitialized = TRUE;
|
CsrssInitialized = TRUE;
|
||||||
DPRINT("Csrss %p\n", Csrss);
|
DPRINT("Csrss %p\n", Csrss);
|
||||||
ExtensionData = (PVIDEOPORT_EXTENSION_DATA) pDO->DeviceExtension;
|
DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION) pDO->DeviceExtension;
|
||||||
if (ExtensionData->HwInitialize(VPExtensionToMPExtension(ExtensionData)))
|
if (DeviceExtension->HwInitialize(&DeviceExtension->MiniPortDeviceExtension))
|
||||||
{
|
{
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1020,37 +1104,144 @@ VidDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION IrpStack;
|
PIO_STACK_LOCATION IrpStack;
|
||||||
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
PVIDEO_REQUEST_PACKET vrp;
|
PVIDEO_REQUEST_PACKET vrp;
|
||||||
|
|
||||||
DPRINT("VidDispatchDeviceControl\n");
|
DPRINT("VidDispatchDeviceControl\n");
|
||||||
/* FIXME: See file header */
|
|
||||||
DPRINT("Using device 0x%08x instead of 0x%08x\n", pdoLastOpened, DeviceObject);
|
|
||||||
DeviceObject = pdoLastOpened;
|
|
||||||
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
// Translate the IRP to a VRP
|
/* Translate the IRP to a VRP */
|
||||||
vrp = ExAllocatePool(PagedPool, sizeof(VIDEO_REQUEST_PACKET));
|
vrp = ExAllocatePool(PagedPool, sizeof(VIDEO_REQUEST_PACKET));
|
||||||
vrp->StatusBlock = ExAllocatePool(PagedPool, sizeof(STATUS_BLOCK));
|
if (NULL == vrp)
|
||||||
|
{
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
vrp->StatusBlock = (PSTATUS_BLOCK) &(Irp->IoStatus);
|
||||||
vrp->IoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
|
vrp->IoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
|
||||||
|
|
||||||
// We're assuming METHOD_BUFFERED
|
/* We're assuming METHOD_BUFFERED */
|
||||||
vrp->InputBuffer = Irp->AssociatedIrp.SystemBuffer;
|
vrp->InputBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||||
vrp->InputBufferLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
|
vrp->InputBufferLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
|
||||||
vrp->OutputBuffer = Irp->UserBuffer;
|
vrp->OutputBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||||
vrp->OutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;
|
vrp->OutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;
|
||||||
|
|
||||||
// Call the Miniport Driver with the VRP
|
/* Call the Miniport Driver with the VRP */
|
||||||
DeviceObject->DriverObject->DriverStartIo(VPExtensionToMPExtension(DeviceObject->DeviceExtension), (PIRP)vrp);
|
DeviceObject->DriverObject->DriverStartIo((PVOID) &DeviceExtension->MiniPortDeviceExtension, (PIRP)vrp);
|
||||||
|
|
||||||
// Translate the VRP back into the IRP for OutputBuffer
|
/* Free the VRP */
|
||||||
Irp->UserBuffer = vrp->OutputBuffer;
|
|
||||||
IrpStack->Parameters.DeviceIoControl.OutputBufferLength = vrp->OutputBufferLength;
|
|
||||||
Irp->IoStatus.Status = vrp->StatusBlock->Status;
|
|
||||||
Irp->IoStatus.Information = vrp->StatusBlock->Information;
|
|
||||||
|
|
||||||
// Free the VRP
|
|
||||||
ExFreePool(vrp->StatusBlock);
|
|
||||||
ExFreePool(vrp);
|
ExFreePool(vrp);
|
||||||
|
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PVOID STDCALL
|
||||||
|
InternalMapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
|
IN PHYSICAL_ADDRESS IoAddress,
|
||||||
|
IN ULONG NumberOfUchars,
|
||||||
|
IN UCHAR InIoSpace)
|
||||||
|
{
|
||||||
|
PHYSICAL_ADDRESS TranslatedAddress;
|
||||||
|
PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
|
||||||
|
ULONG AddressSpace;
|
||||||
|
PVOID MappedAddress;
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
|
INTERFACE_TYPE BusType = PCIBus;
|
||||||
|
|
||||||
|
if (0 != (InIoSpace & VIDEO_MEMORY_SPACE_P6CACHE))
|
||||||
|
{
|
||||||
|
DPRINT("VIDEO_MEMORY_SPACE_P6CACHE not supported, turning off\n");
|
||||||
|
InIoSpace &= ~VIDEO_MEMORY_SPACE_P6CACHE;
|
||||||
|
}
|
||||||
|
if (! IsListEmpty(&DeviceExtension->AddressMappingListHead))
|
||||||
|
{
|
||||||
|
Entry = DeviceExtension->AddressMappingListHead.Flink;
|
||||||
|
while (Entry != &DeviceExtension->AddressMappingListHead)
|
||||||
|
{
|
||||||
|
AddressMapping = CONTAINING_RECORD(Entry,
|
||||||
|
VIDEO_PORT_ADDRESS_MAPPING,
|
||||||
|
List);
|
||||||
|
if (IoAddress.QuadPart == AddressMapping->IoAddress.QuadPart &&
|
||||||
|
NumberOfUchars <= AddressMapping->NumberOfUchars)
|
||||||
|
{
|
||||||
|
AddressMapping->MappingCount++;
|
||||||
|
return AddressMapping->MappedAddress;
|
||||||
|
}
|
||||||
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AddressSpace = (ULONG)InIoSpace;
|
||||||
|
if (HalTranslateBusAddress(BusType,
|
||||||
|
DeviceExtension->SystemIoBusNumber,
|
||||||
|
IoAddress,
|
||||||
|
&AddressSpace,
|
||||||
|
&TranslatedAddress) == FALSE)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* i/o space */
|
||||||
|
if (AddressSpace != 0)
|
||||||
|
{
|
||||||
|
assert(0 == TranslatedAddress.u.HighPart);
|
||||||
|
return (PVOID) TranslatedAddress.u.LowPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
MappedAddress = MmMapIoSpace(TranslatedAddress,
|
||||||
|
NumberOfUchars,
|
||||||
|
FALSE);
|
||||||
|
|
||||||
|
AddressMapping = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
sizeof(VIDEO_PORT_ADDRESS_MAPPING),
|
||||||
|
TAG_VIDEO_PORT);
|
||||||
|
if (AddressMapping == NULL)
|
||||||
|
return MappedAddress;
|
||||||
|
|
||||||
|
AddressMapping->MappedAddress = MappedAddress;
|
||||||
|
AddressMapping->NumberOfUchars = NumberOfUchars;
|
||||||
|
AddressMapping->IoAddress = IoAddress;
|
||||||
|
AddressMapping->SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
|
||||||
|
AddressMapping->MappingCount = 1;
|
||||||
|
|
||||||
|
InsertHeadList(&DeviceExtension->AddressMappingListHead,
|
||||||
|
&AddressMapping->List);
|
||||||
|
|
||||||
|
return MappedAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID STDCALL
|
||||||
|
InternalUnmapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
|
IN PVOID MappedAddress)
|
||||||
|
{
|
||||||
|
PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
|
|
||||||
|
Entry = DeviceExtension->AddressMappingListHead.Flink;
|
||||||
|
while (Entry != &DeviceExtension->AddressMappingListHead)
|
||||||
|
{
|
||||||
|
AddressMapping = CONTAINING_RECORD(Entry,
|
||||||
|
VIDEO_PORT_ADDRESS_MAPPING,
|
||||||
|
List);
|
||||||
|
if (AddressMapping->MappedAddress == MappedAddress)
|
||||||
|
{
|
||||||
|
assert(0 <= AddressMapping->MappingCount);
|
||||||
|
AddressMapping->MappingCount--;
|
||||||
|
if (0 == AddressMapping->MappingCount)
|
||||||
|
{
|
||||||
|
#ifdef TODO
|
||||||
|
MmUnmapIoSpace(AddressMapping->MappedAddress,
|
||||||
|
AddressMapping->NumberOfUchars);
|
||||||
|
#else
|
||||||
|
DPRINT1("MmUnmapIoSpace(0x%08x, 0x%08x)\n", AddressMapping->MappedAddress, AddressMapping->NumberOfUchars);
|
||||||
|
#endif
|
||||||
|
RemoveEntryList(Entry);
|
||||||
|
ExFreePool(AddressMapping);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
|
|
||||||
typedef struct _VIDEOPORT_EXTENSTION_DATA
|
|
||||||
{
|
|
||||||
PDEVICE_OBJECT DeviceObject;
|
|
||||||
PKINTERRUPT InterruptObject;
|
|
||||||
KSPIN_LOCK InterruptSpinLock;
|
|
||||||
ULONG InterruptLevel;
|
|
||||||
KIRQL IRQL;
|
|
||||||
KAFFINITY Affinity;
|
|
||||||
PVIDEO_HW_INITIALIZE HwInitialize;
|
|
||||||
} VIDEOPORT_EXTENSION_DATA, *PVIDEOPORT_EXTENSION_DATA;
|
|
||||||
|
|
||||||
#define MPExtensionToVPExtension(MPX) \
|
|
||||||
((PVIDEOPORT_EXTENSION_DATA) ((DWORD) (MPX) - sizeof(VIDEOPORT_EXTENSION_DATA)))
|
|
||||||
#define VPExtensionToMPExtension(VPX) \
|
|
||||||
((PVOID) ((DWORD) (VPX) + sizeof(VIDEOPORT_EXTENSION_DATA)))
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ copy drivers\dd\null\null.sys %ROS_INSTALL%\system32\drivers
|
||||||
copy drivers\dd\serial\serial.sys %ROS_INSTALL%\system32\drivers
|
copy drivers\dd\serial\serial.sys %ROS_INSTALL%\system32\drivers
|
||||||
copy drivers\dd\serenum\serenum.sys %ROS_INSTALL%\system32\drivers
|
copy drivers\dd\serenum\serenum.sys %ROS_INSTALL%\system32\drivers
|
||||||
copy drivers\dd\vga\miniport\vgamp.sys %ROS_INSTALL%\system32\drivers
|
copy drivers\dd\vga\miniport\vgamp.sys %ROS_INSTALL%\system32\drivers
|
||||||
copy drivers\dd\vga\display\vgaddi.dll %ROS_INSTALL%\system32\drivers
|
copy drivers\dd\vga\display\vgaddi.dll %ROS_INSTALL%\system32
|
||||||
copy drivers\dd\videoprt\videoprt.sys %ROS_INSTALL%\system32\drivers
|
copy drivers\dd\videoprt\videoprt.sys %ROS_INSTALL%\system32\drivers
|
||||||
copy drivers\net\afd\afd.sys %ROS_INSTALL%\system32\drivers
|
copy drivers\net\afd\afd.sys %ROS_INSTALL%\system32\drivers
|
||||||
copy drivers\net\dd\ne2000\ne2000.sys %ROS_INSTALL%\system32\drivers
|
copy drivers\net\dd\ne2000\ne2000.sys %ROS_INSTALL%\system32\drivers
|
||||||
|
@ -97,7 +97,7 @@ copy lib\wsock32\wsock32.dll %ROS_INSTALL%\system32
|
||||||
copy subsys\smss\smss.exe %ROS_INSTALL%\system32
|
copy subsys\smss\smss.exe %ROS_INSTALL%\system32
|
||||||
copy subsys\csrss\csrss.exe %ROS_INSTALL%\system32
|
copy subsys\csrss\csrss.exe %ROS_INSTALL%\system32
|
||||||
copy subsys\ntvdm\ntvdm.exe %ROS_INSTALL%\system32
|
copy subsys\ntvdm\ntvdm.exe %ROS_INSTALL%\system32
|
||||||
copy subsys\win32k\win32k.sys %ROS_INSTALL%\system32\drivers
|
copy subsys\win32k\win32k.sys %ROS_INSTALL%\system32
|
||||||
copy subsys\system\usetup\usetup.exe %ROS_INSTALL%\system32
|
copy subsys\system\usetup\usetup.exe %ROS_INSTALL%\system32
|
||||||
copy apps\utils\cat\cat.exe %ROS_INSTALL%\bin
|
copy apps\utils\cat\cat.exe %ROS_INSTALL%\bin
|
||||||
copy apps\utils\partinfo\partinfo.exe %ROS_INSTALL%\bin
|
copy apps\utils\partinfo\partinfo.exe %ROS_INSTALL%\bin
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: init.c,v 1.44 2002/09/08 10:23:46 chorns Exp $
|
/* $Id: init.c,v 1.45 2003/02/25 23:08:52 gvg Exp $
|
||||||
*
|
*
|
||||||
* init.c - Session Manager initialization
|
* init.c - Session Manager initialization
|
||||||
*
|
*
|
||||||
|
@ -561,7 +561,7 @@ SmLoadSubsystems(VOID)
|
||||||
|
|
||||||
/* Load kernel mode subsystem (aka win32k.sys) */
|
/* Load kernel mode subsystem (aka win32k.sys) */
|
||||||
RtlInitUnicodeStringFromLiteral(&ImageInfo.ModuleName,
|
RtlInitUnicodeStringFromLiteral(&ImageInfo.ModuleName,
|
||||||
L"\\SystemRoot\\system32\\drivers\\win32k.sys");
|
L"\\SystemRoot\\system32\\win32k.sys");
|
||||||
|
|
||||||
Status = NtSetSystemInformation(SystemLoadAndCallImage,
|
Status = NtSetSystemInformation(SystemLoadAndCallImage,
|
||||||
&ImageInfo,
|
&ImageInfo,
|
||||||
|
|
|
@ -30,7 +30,7 @@ PFN_DIB_HLine DIB_4BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c
|
||||||
PBYTE addr = SurfObj->pvBits + (x1>>1) + y * SurfObj->lDelta;
|
PBYTE addr = SurfObj->pvBits + (x1>>1) + y * SurfObj->lDelta;
|
||||||
LONG cx = x1;
|
LONG cx = x1;
|
||||||
|
|
||||||
while(cx <= x2) {
|
while(cx < x2) {
|
||||||
*addr = (*addr & notmask[x1&1]) | (c << ((1-(x1&1))<<2));
|
*addr = (*addr & notmask[x1&1]) | (c << ((1-(x1&1))<<2));
|
||||||
if((++x1 & 1) == 0)
|
if((++x1 & 1) == 0)
|
||||||
++addr;
|
++addr;
|
||||||
|
@ -44,7 +44,7 @@ PFN_DIB_VLine DIB_4BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c
|
||||||
int lDelta = SurfObj->lDelta;
|
int lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
addr += (x>>1) + y1 * lDelta;
|
addr += (x>>1) + y1 * lDelta;
|
||||||
while(y1++ <= y2) {
|
while(y1++ < y2) {
|
||||||
*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
|
*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
|
||||||
addr += lDelta;
|
addr += lDelta;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,13 @@
|
||||||
#include "clip.h"
|
#include "clip.h"
|
||||||
#include "objects.h"
|
#include "objects.h"
|
||||||
#include "../dib/dib.h"
|
#include "../dib/dib.h"
|
||||||
|
#include "misc.h"
|
||||||
#include <include/mouse.h>
|
#include <include/mouse.h>
|
||||||
#include <include/object.h>
|
#include <include/object.h>
|
||||||
#include <include/dib.h>
|
#include <include/dib.h>
|
||||||
#include <include/surface.h>
|
#include <include/surface.h>
|
||||||
#include <include/copybits.h>
|
#include <include/copybits.h>
|
||||||
|
#include <include/inteng.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <win32k/debug1.h>
|
#include <win32k/debug1.h>
|
||||||
|
@ -123,7 +125,6 @@ BltPatCopy(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask,
|
||||||
LONG y;
|
LONG y;
|
||||||
ULONG LineWidth;
|
ULONG LineWidth;
|
||||||
|
|
||||||
MouseSafetyOnDrawStart(Dest, DestGDI, DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
|
||||||
// Assign DIB functions according to bytes per pixel
|
// Assign DIB functions according to bytes per pixel
|
||||||
DPRINT("BPF: %d\n", BitsPerFormat(Dest->iBitmapFormat));
|
DPRINT("BPF: %d\n", BitsPerFormat(Dest->iBitmapFormat));
|
||||||
switch(BitsPerFormat(Dest->iBitmapFormat))
|
switch(BitsPerFormat(Dest->iBitmapFormat))
|
||||||
|
@ -144,7 +145,6 @@ BltPatCopy(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask,
|
||||||
DbgPrint("BltPatCopy: unsupported DIB format %u (bitsPerPixel:%u)\n", Dest->iBitmapFormat,
|
DbgPrint("BltPatCopy: unsupported DIB format %u (bitsPerPixel:%u)\n", Dest->iBitmapFormat,
|
||||||
BitsPerFormat(Dest->iBitmapFormat));
|
BitsPerFormat(Dest->iBitmapFormat));
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,6 @@ BltPatCopy(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask,
|
||||||
{
|
{
|
||||||
DIB_HLine(Dest, DestRect->left, DestRect->right, y, Brush->iSolidColor);
|
DIB_HLine(Dest, DestRect->left, DestRect->right, y, Brush->iSolidColor);
|
||||||
}
|
}
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -161,8 +160,8 @@ BltPatCopy(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask,
|
||||||
INT abs(INT nm);
|
INT abs(INT nm);
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
EngBitBlt(SURFOBJ *Dest,
|
EngBitBlt(SURFOBJ *DestObj,
|
||||||
SURFOBJ *Source,
|
SURFOBJ *SourceObj,
|
||||||
SURFOBJ *Mask,
|
SURFOBJ *Mask,
|
||||||
CLIPOBJ *ClipRegion,
|
CLIPOBJ *ClipRegion,
|
||||||
XLATEOBJ *ColorTranslation,
|
XLATEOBJ *ColorTranslation,
|
||||||
|
@ -179,100 +178,86 @@ EngBitBlt(SURFOBJ *Dest,
|
||||||
POINTL ptlTmp;
|
POINTL ptlTmp;
|
||||||
RECT_ENUM RectEnum;
|
RECT_ENUM RectEnum;
|
||||||
BOOL EnumMore;
|
BOOL EnumMore;
|
||||||
PSURFGDI DestGDI, SourceGDI;
|
PSURFGDI OutputGDI, InputGDI;
|
||||||
HSURF hTemp;
|
POINTL InputPoint;
|
||||||
PSURFOBJ TempSurf = NULL;
|
RECTL InputRect;
|
||||||
BOOLEAN canCopyBits;
|
RECTL OutputRect;
|
||||||
POINTL TempPoint;
|
POINTL Translate;
|
||||||
RECTL TempRect;
|
INTENG_ENTER_LEAVE EnterLeaveSource;
|
||||||
SIZEL TempSize;
|
INTENG_ENTER_LEAVE EnterLeaveDest;
|
||||||
|
PSURFOBJ InputObj;
|
||||||
|
PSURFOBJ OutputObj;
|
||||||
|
|
||||||
if(Source != NULL) SourceGDI = (PSURFGDI)AccessInternalObjectFromUserObject(Source);
|
/* Check for degenerate case: if height or width of DestRect is 0 pixels there's
|
||||||
if(Dest != NULL) DestGDI = (PSURFGDI)AccessInternalObjectFromUserObject(Dest);
|
nothing to do */
|
||||||
|
if (DestRect->right == DestRect->left || DestRect->bottom == DestRect->top)
|
||||||
if (Source != NULL)
|
|
||||||
{
|
{
|
||||||
MouseSafetyOnDrawStart(Source, SourceGDI, SourcePoint->x, SourcePoint->y,
|
return TRUE;
|
||||||
(SourcePoint->x + abs(DestRect->right - DestRect->left)),
|
|
||||||
(SourcePoint->y + abs(DestRect->bottom - DestRect->top)));
|
|
||||||
}
|
|
||||||
MouseSafetyOnDrawStart(Dest, DestGDI, DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
|
||||||
|
|
||||||
// If we don't have to do anything special, we can punt to DrvCopyBits
|
|
||||||
// if it exists
|
|
||||||
if( (Mask == NULL) && (MaskOrigin == NULL) && (Brush == NULL) &&
|
|
||||||
(BrushOrigin == NULL) && (rop4 == 0) )
|
|
||||||
{
|
|
||||||
canCopyBits = TRUE;
|
|
||||||
} else
|
|
||||||
canCopyBits = FALSE;
|
|
||||||
|
|
||||||
// Check for CopyBits or BitBlt hooks if one is not a GDI managed bitmap, IF:
|
|
||||||
// * The destination bitmap is not managed by the GDI OR
|
|
||||||
if(Dest->iType != STYPE_BITMAP)
|
|
||||||
{
|
|
||||||
// Destination surface is device managed
|
|
||||||
if (DestGDI->BitBlt!=NULL)
|
|
||||||
{
|
|
||||||
if (Source!=NULL)
|
|
||||||
{
|
|
||||||
// Get the source into a format compatible surface
|
|
||||||
TempPoint.x = 0;
|
|
||||||
TempPoint.y = 0;
|
|
||||||
TempRect.top = 0;
|
|
||||||
TempRect.left = 0;
|
|
||||||
TempRect.bottom = DestRect->bottom - DestRect->top;
|
|
||||||
TempRect.right = DestRect->right - DestRect->left;
|
|
||||||
TempSize.cx = TempRect.right;
|
|
||||||
TempSize.cy = TempRect.bottom;
|
|
||||||
|
|
||||||
hTemp = EngCreateBitmap(TempSize,
|
|
||||||
DIB_GetDIBWidthBytes(DestRect->right - DestRect->left, BitsPerFormat(Dest->iBitmapFormat)),
|
|
||||||
Dest->iBitmapFormat, 0, NULL);
|
|
||||||
TempSurf = (PSURFOBJ)AccessUserObject((ULONG)hTemp);
|
|
||||||
|
|
||||||
// FIXME: Skip creating a TempSurf if we have the same BPP and palette
|
|
||||||
EngBitBlt(TempSurf, Source, NULL, NULL, ColorTranslation, &TempRect, SourcePoint, NULL, NULL, NULL, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = DestGDI->BitBlt(Dest, TempSurf, Mask, ClipRegion,
|
if (NULL != SourcePoint)
|
||||||
NULL, DestRect, &TempPoint,
|
{
|
||||||
MaskOrigin, Brush, BrushOrigin, rop4);
|
InputRect.left = SourcePoint->x;
|
||||||
|
InputRect.right = SourcePoint->x + (DestRect->right - DestRect->left);
|
||||||
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
InputRect.top = SourcePoint->y;
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
InputRect.bottom = SourcePoint->y + (DestRect->bottom - DestRect->top);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InputRect.left = 0;
|
||||||
|
InputRect.right = DestRect->right - DestRect->left;
|
||||||
|
InputRect.top = 0;
|
||||||
|
InputRect.bottom = DestRect->bottom - DestRect->top;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! IntEngEnter(&EnterLeaveSource, SourceObj, &InputRect, TRUE, &Translate, &InputObj))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL != SourcePoint)
|
||||||
|
{
|
||||||
|
InputPoint.x = SourcePoint->x + Translate.x;
|
||||||
|
InputPoint.y = SourcePoint->y + Translate.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InputPoint.x = 0;
|
||||||
|
InputPoint.y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL != InputObj)
|
||||||
|
{
|
||||||
|
InputGDI = (PSURFGDI) AccessInternalObjectFromUserObject(InputObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputRect = *DestRect;
|
||||||
|
|
||||||
|
if (! IntEngEnter(&EnterLeaveDest, DestObj, &OutputRect, FALSE, &Translate, &OutputObj))
|
||||||
|
{
|
||||||
|
IntEngLeave(&EnterLeaveSource);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputRect.left = DestRect->left + Translate.x;
|
||||||
|
OutputRect.right = DestRect->right + Translate.x;
|
||||||
|
OutputRect.top = DestRect->top + Translate.y;
|
||||||
|
OutputRect.bottom = DestRect->bottom + Translate.y;
|
||||||
|
|
||||||
|
|
||||||
|
if (NULL != OutputObj)
|
||||||
|
{
|
||||||
|
OutputGDI = (PSURFGDI)AccessInternalObjectFromUserObject(OutputObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The code currently assumes there will be a source bitmap. This is not true when, for example, using this function to
|
/* The code currently assumes there will be a source bitmap. This is not true when, for example, using this function to
|
||||||
* paint a brush pattern on the destination. */
|
* paint a brush pattern on the destination. */
|
||||||
if(!Source && 0xaacc != rop4 && PATCOPY != rop4)
|
if (NULL == InputObj && 0xaacc != rop4 && PATCOPY != rop4)
|
||||||
{
|
{
|
||||||
DbgPrint("EngBitBlt: A source is currently required, even though not all operations require one (FIXME)\n");
|
DbgPrint("EngBitBlt: A source is currently required, even though not all operations require one (FIXME)\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * The source bitmap is not managed by the GDI and we didn't already obtain it using EngCopyBits from the device
|
|
||||||
if(NULL != Source && STYPE_BITMAP != Source->iType && NULL == SourceGDI->CopyBits)
|
|
||||||
{
|
|
||||||
if (SourceGDI->BitBlt!=NULL)
|
|
||||||
{
|
|
||||||
// Request the device driver to return the bitmap in a format compatible with the device
|
|
||||||
ret = SourceGDI->BitBlt(Dest, Source, Mask, ClipRegion,
|
|
||||||
NULL, DestRect, SourcePoint,
|
|
||||||
MaskOrigin, Brush, BrushOrigin, rop4);
|
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
// Convert the surface from the driver into the required destination surface
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine clipping type
|
// Determine clipping type
|
||||||
if (ClipRegion == (CLIPOBJ *) NULL)
|
if (ClipRegion == (CLIPOBJ *) NULL)
|
||||||
{
|
{
|
||||||
|
@ -283,9 +268,15 @@ EngBitBlt(SURFOBJ *Dest,
|
||||||
|
|
||||||
if (0xaacc == rop4)
|
if (0xaacc == rop4)
|
||||||
{
|
{
|
||||||
return BltMask(Dest, DestGDI, Mask, DestRect, MaskOrigin, Brush, BrushOrigin);
|
ret = BltMask(OutputObj, OutputGDI, Mask, &OutputRect, MaskOrigin, Brush, BrushOrigin);
|
||||||
|
IntEngLeave(&EnterLeaveDest);
|
||||||
|
IntEngLeave(&EnterLeaveSource);
|
||||||
|
return ret;
|
||||||
} else if (PATCOPY == rop4) {
|
} else if (PATCOPY == rop4) {
|
||||||
return BltPatCopy(Dest, DestGDI, Mask, DestRect, MaskOrigin, Brush, BrushOrigin);
|
ret = BltPatCopy(OutputObj, OutputGDI, Mask, &OutputRect, MaskOrigin, Brush, BrushOrigin);
|
||||||
|
IntEngLeave(&EnterLeaveDest);
|
||||||
|
IntEngLeave(&EnterLeaveSource);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -293,23 +284,23 @@ EngBitBlt(SURFOBJ *Dest,
|
||||||
switch(clippingType)
|
switch(clippingType)
|
||||||
{
|
{
|
||||||
case DC_TRIVIAL:
|
case DC_TRIVIAL:
|
||||||
CopyBitsCopy(Dest, Source, DestGDI, SourceGDI, DestRect, SourcePoint, Source->lDelta, ColorTranslation);
|
CopyBitsCopy(OutputObj, InputObj, OutputGDI, InputGDI, &OutputRect, &InputPoint, InputObj->lDelta, ColorTranslation);
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
IntEngLeave(&EnterLeaveDest);
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
IntEngLeave(&EnterLeaveSource);
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
|
||||||
case DC_RECT:
|
case DC_RECT:
|
||||||
|
|
||||||
// Clip the blt to the clip rectangle
|
// Clip the blt to the clip rectangle
|
||||||
EngIntersectRect(&rclTmp, DestRect, &ClipRegion->rclBounds);
|
EngIntersectRect(&rclTmp, &OutputRect, &ClipRegion->rclBounds);
|
||||||
|
|
||||||
ptlTmp.x = SourcePoint->x + rclTmp.left - DestRect->left;
|
ptlTmp.x = InputPoint.x + rclTmp.left - OutputRect.left;
|
||||||
ptlTmp.y = SourcePoint->y + rclTmp.top - DestRect->top;
|
ptlTmp.y = InputPoint.y + rclTmp.top - OutputRect.top;
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
IntEngLeave(&EnterLeaveDest);
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
IntEngLeave(&EnterLeaveSource);
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
|
||||||
|
@ -326,10 +317,10 @@ EngBitBlt(SURFOBJ *Dest,
|
||||||
RECTL* prcl = &RectEnum.arcl[0];
|
RECTL* prcl = &RectEnum.arcl[0];
|
||||||
|
|
||||||
do {
|
do {
|
||||||
EngIntersectRect(prcl, prcl, DestRect);
|
EngIntersectRect(prcl, prcl, &OutputRect);
|
||||||
|
|
||||||
ptlTmp.x = SourcePoint->x + prcl->left - DestRect->left;
|
ptlTmp.x = InputPoint.x + prcl->left - OutputRect.left;
|
||||||
ptlTmp.y = SourcePoint->y + prcl->top - DestRect->top;
|
ptlTmp.y = InputPoint.y + prcl->top - OutputRect.top;
|
||||||
|
|
||||||
prcl++;
|
prcl++;
|
||||||
|
|
||||||
|
@ -338,14 +329,65 @@ EngBitBlt(SURFOBJ *Dest,
|
||||||
|
|
||||||
} while(EnumMore);
|
} while(EnumMore);
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
IntEngLeave(&EnterLeaveDest);
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
IntEngLeave(&EnterLeaveSource);
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
IntEngLeave(&EnterLeaveDest);
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
IntEngLeave(&EnterLeaveSource);
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
IntEngBitBlt(SURFOBJ *DestObj,
|
||||||
|
SURFOBJ *SourceObj,
|
||||||
|
SURFOBJ *Mask,
|
||||||
|
CLIPOBJ *ClipRegion,
|
||||||
|
XLATEOBJ *ColorTranslation,
|
||||||
|
RECTL *DestRect,
|
||||||
|
POINTL *SourcePoint,
|
||||||
|
POINTL *MaskOrigin,
|
||||||
|
BRUSHOBJ *Brush,
|
||||||
|
POINTL *BrushOrigin,
|
||||||
|
ROP4 rop4)
|
||||||
|
{
|
||||||
|
BOOLEAN ret;
|
||||||
|
SURFGDI *DestGDI;
|
||||||
|
SURFGDI *SourceGDI;
|
||||||
|
|
||||||
|
if (NULL != SourceObj)
|
||||||
|
{
|
||||||
|
SourceGDI = (PSURFGDI) AccessInternalObjectFromUserObject(SourceObj);
|
||||||
|
MouseSafetyOnDrawStart(SourceObj, SourceGDI, SourcePoint->x, SourcePoint->y,
|
||||||
|
(SourcePoint->x + abs(DestRect->right - DestRect->left)),
|
||||||
|
(SourcePoint->y + abs(DestRect->bottom - DestRect->top)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No success yet */
|
||||||
|
ret = FALSE;
|
||||||
|
DestGDI = (SURFGDI*)AccessInternalObjectFromUserObject(DestObj);
|
||||||
|
MouseSafetyOnDrawStart(DestObj, DestGDI, DestRect->left, DestRect->top,
|
||||||
|
DestRect->right, DestRect->bottom);
|
||||||
|
|
||||||
|
/* Call the driver's DrvBitBlt if available */
|
||||||
|
if (NULL != DestGDI->BitBlt) {
|
||||||
|
ret = DestGDI->BitBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation,
|
||||||
|
DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin, rop4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! ret) {
|
||||||
|
ret = EngBitBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation,
|
||||||
|
DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin, rop4);
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseSafetyOnDrawEnd(DestObj, DestGDI);
|
||||||
|
if (NULL != SourceObj)
|
||||||
|
{
|
||||||
|
MouseSafetyOnDrawEnd(SourceObj, SourceGDI);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
#include <ddk/winddi.h>
|
#include <ddk/winddi.h>
|
||||||
#include <include/inteng.h>
|
#include <include/inteng.h>
|
||||||
|
#include <include/dib.h>
|
||||||
#include "objects.h"
|
#include "objects.h"
|
||||||
#include "../dib/dib.h"
|
#include "../dib/dib.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
#include <include/mouse.h>
|
#include <include/mouse.h>
|
||||||
#include <include/object.h>
|
#include <include/object.h>
|
||||||
#include <include/surface.h>
|
#include <include/surface.h>
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
EngLineTo(SURFOBJ *Surface,
|
EngLineTo(SURFOBJ *DestObj,
|
||||||
CLIPOBJ *Clip,
|
CLIPOBJ *Clip,
|
||||||
BRUSHOBJ *Brush,
|
BRUSHOBJ *Brush,
|
||||||
LONG x1,
|
LONG x1,
|
||||||
|
@ -18,8 +20,12 @@ EngLineTo(SURFOBJ *Surface,
|
||||||
RECTL *RectBounds,
|
RECTL *RectBounds,
|
||||||
MIX mix)
|
MIX mix)
|
||||||
{
|
{
|
||||||
LONG x, y, deltax, deltay, i, length, xchange, ychange, error, hx, vy;
|
LONG x, y, deltax, deltay, i, xchange, ychange, error, hx, vy;
|
||||||
ULONG Pixel = Brush->iSolidColor;
|
ULONG Pixel = Brush->iSolidColor;
|
||||||
|
SURFOBJ *OutputObj;
|
||||||
|
RECTL DestRect;
|
||||||
|
POINTL Translate;
|
||||||
|
INTENG_ENTER_LEAVE EnterLeave;
|
||||||
|
|
||||||
// These functions are assigned if we're working with a DIB
|
// These functions are assigned if we're working with a DIB
|
||||||
// The assigned functions depend on the bitsPerPixel of the DIB
|
// The assigned functions depend on the bitsPerPixel of the DIB
|
||||||
|
@ -27,8 +33,37 @@ EngLineTo(SURFOBJ *Surface,
|
||||||
PFN_DIB_HLine DIB_HLine;
|
PFN_DIB_HLine DIB_HLine;
|
||||||
PFN_DIB_VLine DIB_VLine;
|
PFN_DIB_VLine DIB_VLine;
|
||||||
|
|
||||||
|
DestRect.left = x1;
|
||||||
|
if (x1 != x2)
|
||||||
|
{
|
||||||
|
DestRect.right = x2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DestRect.right = x2 + 1;
|
||||||
|
}
|
||||||
|
DestRect.top = y1;
|
||||||
|
if (y1 != y2)
|
||||||
|
{
|
||||||
|
DestRect.bottom = y2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DestRect.bottom = y2 + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! IntEngEnter(&EnterLeave, DestObj, &DestRect, FALSE, &Translate, &OutputObj))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
x1 += Translate.x;
|
||||||
|
x2 += Translate.x;
|
||||||
|
y1 += Translate.y;
|
||||||
|
y2 += Translate.y;
|
||||||
|
|
||||||
// Assign DIB functions according to bytes per pixel
|
// Assign DIB functions according to bytes per pixel
|
||||||
switch(BitsPerFormat(Surface->iBitmapFormat))
|
switch(BitsPerFormat(OutputObj->iBitmapFormat))
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_1BPP_PutPixel;
|
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_1BPP_PutPixel;
|
||||||
|
@ -55,8 +90,8 @@ EngLineTo(SURFOBJ *Surface,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DbgPrint("EngLineTo: unsupported DIB format %u (bitsPerPixel:%u)\n", Surface->iBitmapFormat,
|
DbgPrint("EngLineTo: unsupported DIB format %u (bitsPerPixel:%u)\n", OutputObj->iBitmapFormat,
|
||||||
BitsPerFormat(Surface->iBitmapFormat));
|
BitsPerFormat(OutputObj->iBitmapFormat));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +106,8 @@ EngLineTo(SURFOBJ *Surface,
|
||||||
xchange = -1;
|
xchange = -1;
|
||||||
deltax = - deltax;
|
deltax = - deltax;
|
||||||
hx = x2;
|
hx = x2;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
xchange = 1;
|
xchange = 1;
|
||||||
hx = x1;
|
hx = x1;
|
||||||
|
@ -82,40 +118,45 @@ EngLineTo(SURFOBJ *Surface,
|
||||||
ychange = -1;
|
ychange = -1;
|
||||||
deltay = - deltay;
|
deltay = - deltay;
|
||||||
vy = y2;
|
vy = y2;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ychange = 1;
|
ychange = 1;
|
||||||
vy = y1;
|
vy = y1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(y1==y2) { DIB_HLine(Surface, hx, hx + deltax, y1, Pixel); return TRUE; }
|
if (y1 == y2)
|
||||||
if(x1==x2) { DIB_VLine(Surface, x1, vy, vy + deltay, Pixel); return TRUE; }
|
{
|
||||||
|
DIB_HLine(OutputObj, hx, hx + deltax, y1, Pixel);
|
||||||
|
}
|
||||||
|
else if(x1==x2)
|
||||||
|
{
|
||||||
|
DIB_VLine(OutputObj, x1, vy, vy + deltay, Pixel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
error = 0;
|
error = 0;
|
||||||
i=0;
|
|
||||||
|
|
||||||
if (deltax < deltay)
|
if (deltax < deltay)
|
||||||
{
|
{
|
||||||
length=deltay+1;
|
for (i = 0; i < deltay; i++)
|
||||||
while(i<length)
|
|
||||||
{
|
{
|
||||||
DIB_PutPixel(Surface, x, y, Pixel);
|
DIB_PutPixel(OutputObj, x, y, Pixel);
|
||||||
y = y + ychange;
|
y = y + ychange;
|
||||||
error = error + deltax;
|
error = error + deltax;
|
||||||
|
|
||||||
if(error>deltay)
|
if (deltay < error)
|
||||||
{
|
{
|
||||||
x = x + xchange;
|
x = x + xchange;
|
||||||
error = error - deltay;
|
error = error - deltay;
|
||||||
}
|
}
|
||||||
i=i+1;
|
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
length=deltax+1;
|
for (i = 0; i < deltax; i++)
|
||||||
while(i<length)
|
|
||||||
{
|
{
|
||||||
DIB_PutPixel(Surface, x, y, Pixel);
|
DIB_PutPixel(OutputObj, x, y, Pixel);
|
||||||
x = x + xchange;
|
x = x + xchange;
|
||||||
error = error + deltay;
|
error = error + deltay;
|
||||||
if (error > deltax)
|
if (error > deltax)
|
||||||
|
@ -123,15 +164,15 @@ EngLineTo(SURFOBJ *Surface,
|
||||||
y = y + ychange;
|
y = y + ychange;
|
||||||
error = error - deltax;
|
error = error - deltax;
|
||||||
}
|
}
|
||||||
i=i+1;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return IntEngLeave(&EnterLeave);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
IntEngLineTo(SURFOBJ *Surface,
|
IntEngLineTo(SURFOBJ *DestSurf,
|
||||||
CLIPOBJ *Clip,
|
CLIPOBJ *Clip,
|
||||||
BRUSHOBJ *Brush,
|
BRUSHOBJ *Brush,
|
||||||
LONG x1,
|
LONG x1,
|
||||||
|
@ -146,13 +187,13 @@ IntEngLineTo(SURFOBJ *Surface,
|
||||||
|
|
||||||
/* No success yet */
|
/* No success yet */
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
SurfGDI = (SURFGDI*)AccessInternalObjectFromUserObject(Surface);
|
SurfGDI = (SURFGDI*)AccessInternalObjectFromUserObject(DestSurf);
|
||||||
|
|
||||||
MouseSafetyOnDrawStart(Surface, SurfGDI, x1, y1, x2, y2);
|
MouseSafetyOnDrawStart(DestSurf, SurfGDI, x1, y1, x2, y2);
|
||||||
|
|
||||||
if (NULL != SurfGDI->LineTo) {
|
if (NULL != SurfGDI->LineTo) {
|
||||||
/* Call the driver's DrvLineTo */
|
/* Call the driver's DrvLineTo */
|
||||||
ret = SurfGDI->LineTo(Surface, Clip, Brush, x1, y1, x2, y2, RectBounds, mix);
|
ret = SurfGDI->LineTo(DestSurf, Clip, Brush, x1, y1, x2, y2, RectBounds, mix);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -162,10 +203,10 @@ IntEngLineTo(SURFOBJ *Surface,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (! ret) {
|
if (! ret) {
|
||||||
ret = EngLineTo(Surface, Clip, Brush, x1, y1, x2, y2, RectBounds, mix);
|
ret = EngLineTo(DestSurf, Clip, Brush, x1, y1, x2, y2, RectBounds, mix);
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Surface, SurfGDI);
|
MouseSafetyOnDrawEnd(DestSurf, SurfGDI);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
119
reactos/subsys/win32k/eng/misc.c
Normal file
119
reactos/subsys/win32k/eng/misc.c
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
#include <ddk/winddi.h>
|
||||||
|
#include <include/dib.h>
|
||||||
|
#include <include/object.h>
|
||||||
|
#include <include/surface.h>
|
||||||
|
#include "misc.h"
|
||||||
|
#include "objects.h"
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
|
||||||
|
SURFOBJ *DestObj,
|
||||||
|
RECTL *DestRect,
|
||||||
|
BOOL ReadOnly,
|
||||||
|
POINTL *Translate,
|
||||||
|
SURFOBJ **OutputObj)
|
||||||
|
{
|
||||||
|
LONG Exchange;
|
||||||
|
SIZEL BitmapSize;
|
||||||
|
POINTL SrcPoint;
|
||||||
|
LONG Width;
|
||||||
|
|
||||||
|
/* Normalize */
|
||||||
|
if (DestRect->right < DestRect->left)
|
||||||
|
{
|
||||||
|
Exchange = DestRect->left;
|
||||||
|
DestRect->left = DestRect->right;
|
||||||
|
DestRect->right = Exchange;
|
||||||
|
}
|
||||||
|
if (DestRect->bottom < DestRect->top)
|
||||||
|
{
|
||||||
|
Exchange = DestRect->top;
|
||||||
|
DestRect->top = DestRect->bottom;
|
||||||
|
DestRect->bottom = Exchange;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL != DestObj && STYPE_BITMAP != DestObj->iType &&
|
||||||
|
(NULL == DestObj->pvScan0 || 0 == DestObj->lDelta))
|
||||||
|
{
|
||||||
|
EnterLeave->DestGDI = (SURFGDI*)AccessInternalObjectFromUserObject(DestObj);
|
||||||
|
/* Driver needs to support DrvCopyBits, else we can't do anything */
|
||||||
|
if (NULL == EnterLeave->DestGDI->CopyBits)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate a temporary bitmap */
|
||||||
|
BitmapSize.cx = DestRect->right - DestRect->left;
|
||||||
|
BitmapSize.cy = DestRect->bottom - DestRect->top;
|
||||||
|
Width = DIB_GetDIBWidthBytes(BitmapSize.cx, BitsPerFormat(DestObj->iBitmapFormat));
|
||||||
|
EnterLeave->OutputBitmap = EngCreateBitmap(BitmapSize, Width,
|
||||||
|
DestObj->iBitmapFormat,
|
||||||
|
BMF_NOZEROINIT, NULL);
|
||||||
|
*OutputObj = (SURFOBJ *) AccessUserObject((ULONG) EnterLeave->OutputBitmap);
|
||||||
|
|
||||||
|
EnterLeave->DestRect.left = 0;
|
||||||
|
EnterLeave->DestRect.top = 0;
|
||||||
|
EnterLeave->DestRect.right = BitmapSize.cx;
|
||||||
|
EnterLeave->DestRect.bottom = BitmapSize.cy;
|
||||||
|
SrcPoint.x = DestRect->left;
|
||||||
|
SrcPoint.y = DestRect->top;
|
||||||
|
EnterLeave->TrivialClipObj = EngCreateClip();
|
||||||
|
EnterLeave->TrivialClipObj->iDComplexity = DC_TRIVIAL;
|
||||||
|
if (! EnterLeave->DestGDI->CopyBits(*OutputObj, DestObj,
|
||||||
|
EnterLeave->TrivialClipObj, NULL,
|
||||||
|
&EnterLeave->DestRect, &SrcPoint))
|
||||||
|
{
|
||||||
|
EngDeleteClip(EnterLeave->TrivialClipObj);
|
||||||
|
EngFreeMem((*OutputObj)->pvBits);
|
||||||
|
EngDeleteSurface(EnterLeave->OutputBitmap);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
EnterLeave->DestRect.left = DestRect->left;
|
||||||
|
EnterLeave->DestRect.top = DestRect->top;
|
||||||
|
EnterLeave->DestRect.right = DestRect->right;
|
||||||
|
EnterLeave->DestRect.bottom = DestRect->bottom;
|
||||||
|
Translate->x = - DestRect->left;
|
||||||
|
Translate->y = - DestRect->top;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Translate->x = 0;
|
||||||
|
Translate->y = 0;
|
||||||
|
*OutputObj = DestObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
EnterLeave->DestObj = DestObj;
|
||||||
|
EnterLeave->OutputObj = *OutputObj;
|
||||||
|
EnterLeave->ReadOnly = ReadOnly;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
IntEngLeave(PINTENG_ENTER_LEAVE EnterLeave)
|
||||||
|
{
|
||||||
|
POINTL SrcPoint;
|
||||||
|
BOOL Result;
|
||||||
|
|
||||||
|
if (EnterLeave->OutputObj != EnterLeave->DestObj && NULL != EnterLeave->OutputObj)
|
||||||
|
{
|
||||||
|
if (! EnterLeave->ReadOnly)
|
||||||
|
{
|
||||||
|
SrcPoint.x = 0;
|
||||||
|
SrcPoint.y = 0;
|
||||||
|
Result = EnterLeave->DestGDI->CopyBits(EnterLeave->DestObj,
|
||||||
|
EnterLeave->OutputObj,
|
||||||
|
EnterLeave->TrivialClipObj, NULL,
|
||||||
|
&EnterLeave->DestRect, &SrcPoint);
|
||||||
|
}
|
||||||
|
EngFreeMem(EnterLeave->OutputObj->pvBits);
|
||||||
|
EngDeleteSurface(EnterLeave->OutputBitmap);
|
||||||
|
EngDeleteClip(EnterLeave->TrivialClipObj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Result = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
28
reactos/subsys/win32k/eng/misc.h
Normal file
28
reactos/subsys/win32k/eng/misc.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef __ENG_MISC_H
|
||||||
|
#define __ENG_MISC_H
|
||||||
|
|
||||||
|
#ifndef __ENG_OBJECTS_H
|
||||||
|
#include "objects.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct INTENG_ENTER_LEAVE_TAG
|
||||||
|
{
|
||||||
|
/* Contents is private to EngEnter/EngLeave */
|
||||||
|
SURFOBJ *DestObj;
|
||||||
|
SURFGDI *DestGDI;
|
||||||
|
SURFOBJ *OutputObj;
|
||||||
|
HBITMAP OutputBitmap;
|
||||||
|
CLIPOBJ *TrivialClipObj;
|
||||||
|
RECTL DestRect;
|
||||||
|
BOOL ReadOnly;
|
||||||
|
} INTENG_ENTER_LEAVE, *PINTENG_ENTER_LEAVE;
|
||||||
|
|
||||||
|
extern BOOL STDCALL IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
|
||||||
|
SURFOBJ *DestObj,
|
||||||
|
RECTL *DestRect,
|
||||||
|
BOOL ReadOnly,
|
||||||
|
POINTL *Translate,
|
||||||
|
SURFOBJ **OutputObj);
|
||||||
|
extern BOOL STDCALL IntEngLeave(PINTENG_ENTER_LEAVE EnterLeave);
|
||||||
|
|
||||||
|
#endif
|
|
@ -134,6 +134,7 @@ EngCreateBitmap(IN SIZEL Size,
|
||||||
SurfObj->sizlBitmap = Size;
|
SurfObj->sizlBitmap = Size;
|
||||||
SurfObj->iBitmapFormat = Format;
|
SurfObj->iBitmapFormat = Format;
|
||||||
SurfObj->iType = STYPE_BITMAP;
|
SurfObj->iType = STYPE_BITMAP;
|
||||||
|
SurfObj->pvScan0 = SurfObj->pvBits;
|
||||||
|
|
||||||
// Use flags to determine bitmap type -- TOP_DOWN or whatever
|
// Use flags to determine bitmap type -- TOP_DOWN or whatever
|
||||||
|
|
||||||
|
|
|
@ -12,5 +12,16 @@ extern BOOL STDCALL IntEngLineTo(SURFOBJ *Surface,
|
||||||
LONG y2,
|
LONG y2,
|
||||||
RECTL *RectBounds,
|
RECTL *RectBounds,
|
||||||
MIX mix);
|
MIX mix);
|
||||||
|
BOOL STDCALL IntEngBitBlt(SURFOBJ *DestObj,
|
||||||
|
SURFOBJ *SourceObj,
|
||||||
|
SURFOBJ *Mask,
|
||||||
|
CLIPOBJ *ClipRegion,
|
||||||
|
XLATEOBJ *ColorTranslation,
|
||||||
|
RECTL *DestRect,
|
||||||
|
POINTL *SourcePoint,
|
||||||
|
POINTL *MaskOrigin,
|
||||||
|
BRUSHOBJ *Brush,
|
||||||
|
POINTL *BrushOrigin,
|
||||||
|
ROP4 rop4);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# $Id: makefile,v 1.55 2003/02/15 19:16:33 gvg Exp $
|
# $Id: makefile,v 1.56 2003/02/25 23:08:52 gvg Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../..
|
PATH_TO_TOP = ../..
|
||||||
|
|
||||||
TARGET_TYPE = export_driver
|
TARGET_TYPE = subsystem
|
||||||
|
|
||||||
TARGET_NAME = win32k
|
TARGET_NAME = win32k
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@ TARGET_CFLAGS = $(CFLAGS_DBG) -I$(PATH_TO_TOP)/ntoskrnl/include -DUNICODE -Wall
|
||||||
|
|
||||||
ENG_OBJECTS= eng/debug.o eng/mem.o eng/brush.o eng/bitblt.o eng/clip.o \
|
ENG_OBJECTS= eng/debug.o eng/mem.o eng/brush.o eng/bitblt.o eng/clip.o \
|
||||||
eng/copybits.o eng/device.o eng/handle.o eng/lineto.o eng/paint.o \
|
eng/copybits.o eng/device.o eng/handle.o eng/lineto.o eng/paint.o \
|
||||||
eng/palette.o eng/surface.o eng/xlate.o eng/transblt.o eng/mouse.o
|
eng/palette.o eng/surface.o eng/xlate.o eng/transblt.o eng/mouse.o \
|
||||||
|
eng/misc.o
|
||||||
MAIN_OBJECTS = main/dllmain.o main/svctabm.o
|
MAIN_OBJECTS = main/dllmain.o main/svctabm.o
|
||||||
MISC_OBJECTS = misc/driver.o misc/error.o misc/math.o misc/object.o
|
MISC_OBJECTS = misc/driver.o misc/error.o misc/math.o misc/object.o
|
||||||
LDR_OBJECTS = ldr/loader.o
|
LDR_OBJECTS = ldr/loader.o
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: driver.c,v 1.22 2002/09/08 10:23:51 chorns Exp $
|
/* $Id: driver.c,v 1.23 2003/02/25 23:08:53 gvg Exp $
|
||||||
*
|
*
|
||||||
* GDI Driver support routines
|
* GDI Driver support routines
|
||||||
* (mostly swiped from Wine)
|
* (mostly swiped from Wine)
|
||||||
|
@ -12,13 +12,14 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <win32k/driver.h>
|
#include <win32k/driver.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
//#include "../../ntoskrnl/include/internal/module.h"
|
|
||||||
#include <ddk/winddi.h>
|
#include <ddk/winddi.h>
|
||||||
#include <ddk/ntddvid.h>
|
#include <ddk/ntddvid.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#define DRIVER_TAG TAG('G', 'D', 'R', 'V')
|
||||||
|
|
||||||
typedef struct _GRAPHICS_DRIVER
|
typedef struct _GRAPHICS_DRIVER
|
||||||
{
|
{
|
||||||
PWSTR Name;
|
PWSTR Name;
|
||||||
|
@ -32,14 +33,16 @@ static PGRAPHICS_DRIVER GenericDriver = 0;
|
||||||
|
|
||||||
BOOL DRIVER_RegisterDriver(LPCWSTR Name, PGD_ENABLEDRIVER EnableDriver)
|
BOOL DRIVER_RegisterDriver(LPCWSTR Name, PGD_ENABLEDRIVER EnableDriver)
|
||||||
{
|
{
|
||||||
PGRAPHICS_DRIVER Driver = ExAllocatePool(NonPagedPool, sizeof(*Driver));
|
PGRAPHICS_DRIVER Driver = ExAllocatePoolWithTag(NonPagedPool, sizeof(*Driver), DRIVER_TAG);
|
||||||
DPRINT( "DRIVER_RegisterDriver( Name: %S )\n", Name );
|
DPRINT( "DRIVER_RegisterDriver( Name: %S )\n", Name );
|
||||||
if (!Driver) return FALSE;
|
if (!Driver) return FALSE;
|
||||||
Driver->ReferenceCount = 0;
|
Driver->ReferenceCount = 0;
|
||||||
Driver->EnableDriver = EnableDriver;
|
Driver->EnableDriver = EnableDriver;
|
||||||
if (Name)
|
if (Name)
|
||||||
{
|
{
|
||||||
Driver->Name = ExAllocatePool(PagedPool, (wcslen(Name) + 1) * sizeof(WCHAR));
|
Driver->Name = ExAllocatePoolWithTag(PagedPool,
|
||||||
|
(wcslen(Name) + 1) * sizeof(WCHAR),
|
||||||
|
DRIVER_TAG);
|
||||||
wcscpy(Driver->Name, Name);
|
wcscpy(Driver->Name, Name);
|
||||||
Driver->Next = DriverList;
|
Driver->Next = DriverList;
|
||||||
DriverList = Driver;
|
DriverList = Driver;
|
||||||
|
@ -58,14 +61,67 @@ BOOL DRIVER_RegisterDriver(LPCWSTR Name, PGD_ENABLEDRIVER EnableDriver)
|
||||||
|
|
||||||
PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
|
PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
|
||||||
{
|
{
|
||||||
|
static WCHAR DefaultPath[] = L"\\SystemRoot\\System32\\";
|
||||||
|
static WCHAR DefaultExtension[] = L".DLL";
|
||||||
SYSTEM_LOAD_IMAGE GdiDriverInfo;
|
SYSTEM_LOAD_IMAGE GdiDriverInfo;
|
||||||
GRAPHICS_DRIVER *Driver = DriverList;
|
GRAPHICS_DRIVER *Driver = DriverList;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
WCHAR *FullName;
|
||||||
|
WCHAR *p;
|
||||||
|
BOOL PathSeparatorFound;
|
||||||
|
BOOL DotFound;
|
||||||
|
UINT Size;
|
||||||
|
|
||||||
|
DotFound = FALSE;
|
||||||
|
PathSeparatorFound = FALSE;
|
||||||
|
p = Name;
|
||||||
|
while (L'\0' != *p)
|
||||||
|
{
|
||||||
|
if (L'\\' == *p || L'/' == *p)
|
||||||
|
{
|
||||||
|
PathSeparatorFound = TRUE;
|
||||||
|
DotFound = FALSE;
|
||||||
|
}
|
||||||
|
else if (L'.' == *p)
|
||||||
|
{
|
||||||
|
DotFound = TRUE;
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Size = (wcslen(Name) + 1) * sizeof(WCHAR);
|
||||||
|
if (! PathSeparatorFound)
|
||||||
|
{
|
||||||
|
Size += sizeof(DefaultPath) - sizeof(WCHAR);
|
||||||
|
}
|
||||||
|
if (! DotFound)
|
||||||
|
{
|
||||||
|
Size += sizeof(DefaultExtension) - sizeof(WCHAR);
|
||||||
|
}
|
||||||
|
FullName = ExAllocatePoolWithTag(PagedPool, Size, DRIVER_TAG);
|
||||||
|
if (NULL == FullName)
|
||||||
|
{
|
||||||
|
DPRINT1("Out of memory\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (PathSeparatorFound)
|
||||||
|
{
|
||||||
|
FullName[0] = L'\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wcscpy(FullName, DefaultPath);
|
||||||
|
}
|
||||||
|
wcscat(FullName, Name);
|
||||||
|
if (! DotFound)
|
||||||
|
{
|
||||||
|
wcscat(FullName, DefaultExtension);
|
||||||
|
}
|
||||||
|
|
||||||
/* First see if the driver hasn't already been loaded */
|
/* First see if the driver hasn't already been loaded */
|
||||||
while (Driver && Name)
|
while (Driver && FullName)
|
||||||
{
|
{
|
||||||
if (!_wcsicmp( Driver->Name, Name))
|
if (!_wcsicmp( Driver->Name, FullName))
|
||||||
{
|
{
|
||||||
return Driver->EnableDriver;
|
return Driver->EnableDriver;
|
||||||
}
|
}
|
||||||
|
@ -73,8 +129,9 @@ PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If not, then load it */
|
/* If not, then load it */
|
||||||
RtlInitUnicodeString (&GdiDriverInfo.ModuleName, (LPWSTR)Name);
|
RtlInitUnicodeString (&GdiDriverInfo.ModuleName, (LPWSTR)FullName);
|
||||||
Status = ZwSetSystemInformation (SystemLoadImage, &GdiDriverInfo, sizeof(SYSTEM_LOAD_IMAGE));
|
Status = ZwSetSystemInformation (SystemLoadImage, &GdiDriverInfo, sizeof(SYSTEM_LOAD_IMAGE));
|
||||||
|
ExFreePool(FullName);
|
||||||
if (!NT_SUCCESS(Status)) return NULL;
|
if (!NT_SUCCESS(Status)) return NULL;
|
||||||
|
|
||||||
DRIVER_RegisterDriver( L"DISPLAY", GdiDriverInfo.EntryPoint);
|
DRIVER_RegisterDriver( L"DISPLAY", GdiDriverInfo.EntryPoint);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <win32k/bitmaps.h>
|
#include <win32k/bitmaps.h>
|
||||||
//#include <win32k/debug.h>
|
//#include <win32k/debug.h>
|
||||||
#include "../eng/handle.h"
|
#include "../eng/handle.h"
|
||||||
|
#include <include/inteng.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <win32k/debug1.h>
|
#include <win32k/debug1.h>
|
||||||
|
@ -86,7 +87,7 @@ BOOL STDCALL W32kBitBlt(HDC hDCDest,
|
||||||
|
|
||||||
// Perform the bitblt operation
|
// Perform the bitblt operation
|
||||||
|
|
||||||
Status = EngBitBlt(SurfDest, SurfSrc, NULL, NULL, XlateObj, &DestRect, &SourcePoint, NULL, NULL, NULL, ROP);
|
Status = IntEngBitBlt(SurfDest, SurfSrc, NULL, NULL, XlateObj, &DestRect, &SourcePoint, NULL, NULL, NULL, ROP);
|
||||||
|
|
||||||
if(SurfDestAlloc == TRUE) ExFreePool(SurfDest);
|
if(SurfDestAlloc == TRUE) ExFreePool(SurfDest);
|
||||||
if(SurfSrcAlloc == TRUE) ExFreePool(SurfSrc);
|
if(SurfSrcAlloc == TRUE) ExFreePool(SurfSrc);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: brush.c,v 1.18 2003/01/18 20:46:31 ei Exp $
|
/* $Id: brush.c,v 1.19 2003/02/25 23:08:54 gvg Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
||||||
#include <win32k/brush.h>
|
#include <win32k/brush.h>
|
||||||
//#include <win32k/debug.h>
|
//#include <win32k/debug.h>
|
||||||
#include <include/object.h>
|
#include <include/object.h>
|
||||||
|
#include <include/inteng.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <win32k/debug1.h>
|
#include <win32k/debug1.h>
|
||||||
|
@ -221,7 +222,7 @@ BOOL STDCALL W32kPatBlt(HDC hDC,
|
||||||
DestRect.top = YLeft + Height + dc->w.DCOrgY;
|
DestRect.top = YLeft + Height + dc->w.DCOrgY;
|
||||||
DestRect.bottom = YLeft + dc->w.DCOrgY;
|
DestRect.bottom = YLeft + dc->w.DCOrgY;
|
||||||
}
|
}
|
||||||
ret = EngBitBlt(SurfObj,
|
ret = IntEngBitBlt(SurfObj,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: dc.c,v 1.46 2003/02/15 19:16:34 gvg Exp $
|
/* $Id: dc.c,v 1.47 2003/02/25 23:08:54 gvg Exp $
|
||||||
*
|
*
|
||||||
* DC.C - Device context functions
|
* DC.C - Device context functions
|
||||||
*
|
*
|
||||||
|
@ -184,6 +184,51 @@ HDC STDCALL W32kCreateCompatableDC(HDC hDC)
|
||||||
return hNewDC;
|
return hNewDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL STDCALL FindDriverFileNames(PUNICODE_STRING DriverFileNames)
|
||||||
|
{
|
||||||
|
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
||||||
|
UNICODE_STRING RegistryPath;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
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].EntryContext = &RegistryPath;
|
||||||
|
|
||||||
|
Status = RtlQueryRegistryValues(RTL_REGISTRY_DEVICEMAP,
|
||||||
|
L"VIDEO",
|
||||||
|
QueryTable,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("No \\Device\\Video0 value in DEVICEMAP\\VIDEO found\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("RegistryPath %S\n", RegistryPath.Buffer);
|
||||||
|
|
||||||
|
QueryTable[0].Name = L"InstalledDisplayDrivers";
|
||||||
|
QueryTable[0].EntryContext = DriverFileNames;
|
||||||
|
|
||||||
|
Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
|
||||||
|
RegistryPath.Buffer,
|
||||||
|
QueryTable,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
RtlFreeUnicodeString(&RegistryPath);
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("No InstalledDisplayDrivers value in service entry found\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("DriverFileNames %S\n", DriverFileNames->Buffer);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL STDCALL W32kCreatePrimarySurface(LPCWSTR Driver,
|
BOOL STDCALL W32kCreatePrimarySurface(LPCWSTR Driver,
|
||||||
LPCWSTR Device)
|
LPCWSTR Device)
|
||||||
{
|
{
|
||||||
|
@ -191,6 +236,9 @@ BOOL STDCALL W32kCreatePrimarySurface(LPCWSTR Driver,
|
||||||
HANDLE DeviceDriver;
|
HANDLE DeviceDriver;
|
||||||
DRVENABLEDATA DED;
|
DRVENABLEDATA DED;
|
||||||
PSURFOBJ SurfObj;
|
PSURFOBJ SurfObj;
|
||||||
|
UNICODE_STRING DriverFileNames;
|
||||||
|
PWSTR CurrentName;
|
||||||
|
BOOL GotDriver;
|
||||||
|
|
||||||
/* Open the miniport driver */
|
/* Open the miniport driver */
|
||||||
if ((DeviceDriver = DRIVER_FindMPDriver(Driver)) == NULL)
|
if ((DeviceDriver = DRIVER_FindMPDriver(Driver)) == NULL)
|
||||||
|
@ -199,22 +247,64 @@ BOOL STDCALL W32kCreatePrimarySurface(LPCWSTR Driver,
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the DDI driver's entry point */
|
/* Retrieve DDI driver names from registry */
|
||||||
/* FIXME: Retrieve DDI driver name from registry */
|
RtlInitUnicodeString(&DriverFileNames, NULL);
|
||||||
if ((GDEnableDriver = DRIVER_FindDDIDriver(L"\\SystemRoot\\system32\\drivers\\vgaddi.dll")) == NULL)
|
if (! FindDriverFileNames(&DriverFileNames))
|
||||||
{
|
{
|
||||||
DPRINT("FindDDIDriver failed\n");
|
DPRINT("FindDriverFileNames failed\n");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
{
|
||||||
|
/* Get the DDI driver's entry point */
|
||||||
|
GDEnableDriver = DRIVER_FindDDIDriver(CurrentName);
|
||||||
|
if (NULL == GDEnableDriver)
|
||||||
|
{
|
||||||
|
DPRINT("FindDDIDriver failed for %S\n", CurrentName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* Call DDI driver's EnableDriver function */
|
/* Call DDI driver's EnableDriver function */
|
||||||
RtlZeroMemory(&DED, sizeof(DED));
|
RtlZeroMemory(&DED, sizeof(DED));
|
||||||
|
|
||||||
if (!GDEnableDriver(DDI_DRIVER_VERSION, sizeof(DED), &DED))
|
if (!GDEnableDriver(DDI_DRIVER_VERSION, sizeof(DED), &DED))
|
||||||
{
|
{
|
||||||
DPRINT("DrvEnableDriver failed\n");
|
DPRINT("DrvEnableDriver failed for %S\n", CurrentName);
|
||||||
return(FALSE);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GotDriver = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! GotDriver)
|
||||||
|
{
|
||||||
|
/* Skip to the next name but never get past the Unicode string */
|
||||||
|
while (L'\0' != *CurrentName &&
|
||||||
|
CurrentName < DriverFileNames.Buffer + DriverFileNames.Length)
|
||||||
|
{
|
||||||
|
CurrentName++;
|
||||||
|
}
|
||||||
|
if (CurrentName < DriverFileNames.Buffer + DriverFileNames.Length)
|
||||||
|
{
|
||||||
|
CurrentName++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RtlFreeUnicodeString(&DriverFileNames);
|
||||||
|
if (! GotDriver)
|
||||||
|
{
|
||||||
|
DPRINT("No suitable driver found\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("Display driver %S loaded\n", DriverName);
|
||||||
|
|
||||||
DPRINT("Building DDI Functions\n");
|
DPRINT("Building DDI Functions\n");
|
||||||
|
|
||||||
/* Construct DDI driver function dispatch table */
|
/* Construct DDI driver function dispatch table */
|
||||||
|
@ -338,7 +428,8 @@ HDC STDCALL W32kCreateDC(LPCWSTR Driver,
|
||||||
|
|
||||||
DPRINT("Bits per pel: %u\n", NewDC->w.bitsPerPixel);
|
DPRINT("Bits per pel: %u\n", NewDC->w.bitsPerPixel);
|
||||||
|
|
||||||
NewDC->w.hVisRgn = W32kCreateRectRgn(0, 0, 640, 480);
|
NewDC->w.hVisRgn = W32kCreateRectRgn(0, 0, SurfGDI->SurfObj.sizlBitmap.cx,
|
||||||
|
SurfGDI->SurfObj.sizlBitmap.cy);
|
||||||
DC_ReleasePtr( hNewDC );
|
DC_ReleasePtr( hNewDC );
|
||||||
|
|
||||||
/* Initialize the DC state */
|
/* Initialize the DC state */
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#include "../eng/handle.h"
|
#include "../eng/handle.h"
|
||||||
|
|
||||||
|
#include <include/inteng.h>
|
||||||
|
|
||||||
// #define NDEBUG
|
// #define NDEBUG
|
||||||
#include <win32k/debug1.h>
|
#include <win32k/debug1.h>
|
||||||
|
|
||||||
|
@ -713,8 +715,8 @@ W32kTextOut(HDC hDC,
|
||||||
DestRect.top = TextTop + yoff - glyph->bitmap_top;
|
DestRect.top = TextTop + yoff - glyph->bitmap_top;
|
||||||
DestRect.right = TextLeft + glyph->bitmap.width;
|
DestRect.right = TextLeft + glyph->bitmap.width;
|
||||||
DestRect.bottom = DestRect.top + glyph->bitmap.rows;
|
DestRect.bottom = DestRect.top + glyph->bitmap.rows;
|
||||||
bitSize.cx = pitch-1;
|
bitSize.cx = pitch;
|
||||||
bitSize.cy = glyph->bitmap.rows-1;
|
bitSize.cy = glyph->bitmap.rows;
|
||||||
MaskRect.right = glyph->bitmap.width;
|
MaskRect.right = glyph->bitmap.width;
|
||||||
MaskRect.bottom = glyph->bitmap.rows;
|
MaskRect.bottom = glyph->bitmap.rows;
|
||||||
|
|
||||||
|
@ -725,7 +727,7 @@ W32kTextOut(HDC hDC,
|
||||||
SourceGlyphSurf = (PSURFOBJ)AccessUserObject(HSourceGlyph);
|
SourceGlyphSurf = (PSURFOBJ)AccessUserObject(HSourceGlyph);
|
||||||
|
|
||||||
// Use the font data as a mask to paint onto the DCs surface using a brush
|
// Use the font data as a mask to paint onto the DCs surface using a brush
|
||||||
EngBitBlt(SurfObj, NULL, SourceGlyphSurf, NULL, NULL, &DestRect, &SourcePoint, &MaskRect, Brush, &BrushOrigin, 0xAACC);
|
IntEngBitBlt(SurfObj, NULL, SourceGlyphSurf, NULL, NULL, &DestRect, &SourcePoint, &MaskRect, Brush, &BrushOrigin, 0xAACC);
|
||||||
|
|
||||||
EngDeleteSurface(HSourceGlyph);
|
EngDeleteSurface(HSourceGlyph);
|
||||||
|
|
||||||
|
|
|
@ -290,6 +290,18 @@ REGEDIT4
|
||||||
"Start"=dword:00000001
|
"Start"=dword:00000001
|
||||||
"Type"=dword:00000001
|
"Type"=dword:00000001
|
||||||
|
|
||||||
|
[\Registry\Machine\SYSTEM\ControlSet001\Services\Vga\Device0]
|
||||||
|
"InstalledDisplayDrivers"=multi:"vgaddi"
|
||||||
|
[\Registry\Machine\SYSTEM\ControlSet001\Services\vmx_svga]
|
||||||
|
"ErrorControl"=dword:00000000
|
||||||
|
"Group"="Video"
|
||||||
|
"ImagePath"=expand:"system32\drivers\vmx_svga.sys"
|
||||||
|
"Start"=dword:00000004
|
||||||
|
"Type"=dword:00000001
|
||||||
|
|
||||||
|
[\Registry\Machine\SYSTEM\ControlSet001\Services\vmx_svga\Device0]
|
||||||
|
"InstalledDisplayDrivers"=multi:"vmx_fb"
|
||||||
|
|
||||||
[\Registry\Machine\SYSTEM\ControlSet002]
|
[\Registry\Machine\SYSTEM\ControlSet002]
|
||||||
|
|
||||||
[\Registry\Machine\SYSTEM\Select]
|
[\Registry\Machine\SYSTEM\Select]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: helper.mk,v 1.26 2003/01/15 20:18:12 chorns Exp $
|
# $Id: helper.mk,v 1.27 2003/02/25 23:08:54 gvg Exp $
|
||||||
#
|
#
|
||||||
# Helper makefile for ReactOS modules
|
# Helper makefile for ReactOS modules
|
||||||
# Variables this makefile accepts:
|
# Variables this makefile accepts:
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
# bootpgm = Boot program
|
# bootpgm = Boot program
|
||||||
# miniport = Kernel mode driver that does not link with ntoskrnl.exe or hal.dll
|
# miniport = Kernel mode driver that does not link with ntoskrnl.exe or hal.dll
|
||||||
# gdi_driver = Kernel mode graphics driver that link with win32k.sys
|
# gdi_driver = Kernel mode graphics driver that link with win32k.sys
|
||||||
|
# subsystem = Kernel subsystem
|
||||||
# $TARGET_APPTYPE = Application type (windows,native,console)
|
# $TARGET_APPTYPE = Application type (windows,native,console)
|
||||||
# $TARGET_NAME = Base name of output file and .rc, .def, and .edf files
|
# $TARGET_NAME = Base name of output file and .rc, .def, and .edf files
|
||||||
# $TARGET_OBJECTS = Object files that compose the module
|
# $TARGET_OBJECTS = Object files that compose the module
|
||||||
|
@ -275,7 +276,7 @@ ifeq ($(TARGET_TYPE),gdi_driver)
|
||||||
MK_IMPLIBONLY := no
|
MK_IMPLIBONLY := no
|
||||||
MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
|
MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
|
||||||
MK_IMPLIB_EXT := .a
|
MK_IMPLIB_EXT := .a
|
||||||
MK_INSTALLDIR := system32/drivers
|
MK_INSTALLDIR := system32
|
||||||
MK_DISTDIR := drivers
|
MK_DISTDIR := drivers
|
||||||
MK_RES_BASE := $(TARGET_NAME)
|
MK_RES_BASE := $(TARGET_NAME)
|
||||||
endif
|
endif
|
||||||
|
@ -321,6 +322,25 @@ ifeq ($(TARGET_TYPE),proglib)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_TYPE),subsystem)
|
||||||
|
MK_MODE := kernel
|
||||||
|
MK_EXETYPE := dll
|
||||||
|
MK_DEFEXT := .sys
|
||||||
|
MK_DEFENTRY := _DriverEntry@8
|
||||||
|
MK_DDKLIBS := ntoskrnl.a hal.a
|
||||||
|
MK_SDKLIBS :=
|
||||||
|
MK_CFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC)
|
||||||
|
MK_CPPFLAGS := -D__NTDRIVER__ -I./ -I$(DDK_PATH_INC)
|
||||||
|
MK_RCFLAGS := --include-dir $(SDK_PATH_INC)
|
||||||
|
MK_IMPLIB := yes
|
||||||
|
MK_IMPLIBONLY := no
|
||||||
|
MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
|
||||||
|
MK_IMPLIB_EXT := .a
|
||||||
|
MK_INSTALLDIR := system32
|
||||||
|
MK_DISTDIR := drivers
|
||||||
|
MK_RES_BASE := $(TARGET_NAME)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
MK_RESOURCE := $(MK_RES_BASE).coff
|
MK_RESOURCE := $(MK_RES_BASE).coff
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ blue.sys = 3
|
||||||
floppy.sys = 3
|
floppy.sys = 3
|
||||||
null.sys = 3
|
null.sys = 3
|
||||||
serial.sys = 3
|
serial.sys = 3
|
||||||
vgaddi.dll = 3
|
vgaddi.dll = 2
|
||||||
vgamp.sys = 3
|
vgamp.sys = 3
|
||||||
videoprt.sys = 3
|
videoprt.sys = 3
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ services.exe = 2
|
||||||
shell.exe = 2
|
shell.exe = 2
|
||||||
winlogon.exe = 2
|
winlogon.exe = 2
|
||||||
|
|
||||||
win32k.sys = 3
|
win32k.sys = 2
|
||||||
|
|
||||||
helb____.ttf = 6
|
helb____.ttf = 6
|
||||||
timr____.ttf = 6
|
timr____.ttf = 6
|
||||||
|
|
Loading…
Reference in a new issue