From 124f98907634d53644782d242a6bb265aeea8c38 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Tue, 4 Dec 2007 07:51:03 +0000 Subject: [PATCH] Fix NtGdiFlush so it will not spam the debug list. Add changes and fixups. svn path=/trunk/; revision=30994 --- reactos/subsystems/win32/win32k/include/dc.h | 4 +- reactos/subsystems/win32/win32k/objects/dc.c | 16 ++++++- .../win32/win32k/objects/gdibatch.c | 47 ++++++++++++++++++- 3 files changed, 63 insertions(+), 4 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/dc.h b/reactos/subsystems/win32/win32k/include/dc.h index 4c400427717..5b5d97fca39 100644 --- a/reactos/subsystems/win32/win32k/include/dc.h +++ b/reactos/subsystems/win32/win32k/include/dc.h @@ -51,7 +51,7 @@ typedef struct _GDIPOINTER /* should stay private to ENG */ typedef struct { - HANDLE Handle; + HANDLE Handle; // HSURF PVOID pvEntry; ULONG lucExcLock; ULONG Tid; @@ -60,7 +60,6 @@ typedef struct PERESOURCE hsemDevLock; PVOID pvGammaRamp; - PVOID pfnSync; DHPDEV PDev; DEVMODEW DMW; @@ -94,6 +93,7 @@ typedef struct NTSTATUS FASTCALL InitDcImpl(VOID); HDC FASTCALL RetrieveDisplayHDC(VOID); +PGDIDEVICE FASTCALL IntEnumHDev(VOID); HDC FASTCALL DC_AllocDC(PUNICODE_STRING Driver); VOID FASTCALL DC_InitDC(HDC DCToInit); HDC FASTCALL DC_FindOpenDC(PUNICODE_STRING Driver); diff --git a/reactos/subsystems/win32/win32k/objects/dc.c b/reactos/subsystems/win32/win32k/objects/dc.c index e82a8452ed6..cbe1df2e0c1 100644 --- a/reactos/subsystems/win32/win32k/objects/dc.c +++ b/reactos/subsystems/win32/win32k/objects/dc.c @@ -541,7 +541,7 @@ IntPrepareDriver() PrimarySurface.PreparedDriver = TRUE; PrimarySurface.DisplayNumber = DisplayNumber; - + PrimarySurface.flFlags = PDEV_DISPLAY; // Hard set,, add more flags. PrimarySurface.hsemDevLock = (PERESOURCE)EngCreateSemaphore(); ret = TRUE; @@ -827,6 +827,9 @@ IntGdiCreateDC(PUNICODE_STRING Driver, ((PGDIDEVICE)NewDC->pPDev)->GDIInfo.cPlanes; DPRINT("Bits per pel: %u\n", NewDC->w.bitsPerPixel); + NewDC->flGraphics = PrimarySurface.DevInfo.flGraphicsCaps; + NewDC->flGraphics2 = PrimarySurface.DevInfo.flGraphicsCaps2; + if (!CreateAsIC) { NewDC->PalIndexed = NtGdiGetStockObject(DEFAULT_PALETTE); @@ -2678,6 +2681,17 @@ IntIsPrimarySurface(SURFOBJ *SurfObj) return SurfObj->hsurf == PrimarySurface.Handle; } +// +// Enumerate HDev +// +PGDIDEVICE FASTCALL +IntEnumHDev(VOID) +{ +// I guess we will soon have more than one primary surface. +// This will do for now. + return &PrimarySurface; +} + #define SIZEOF_DEVMODEW_300 188 #define SIZEOF_DEVMODEW_400 212 #define SIZEOF_DEVMODEW_500 220 diff --git a/reactos/subsystems/win32/win32k/objects/gdibatch.c b/reactos/subsystems/win32/win32k/objects/gdibatch.c index da0a8a348cf..bcbfb62b157 100644 --- a/reactos/subsystems/win32/win32k/objects/gdibatch.c +++ b/reactos/subsystems/win32/win32k/objects/gdibatch.c @@ -10,6 +10,51 @@ // Gdi Batch Flush support functions. // +// +// DoDeviceSync +// +// based on IntEngEnter from eng/engmisc.c +// +VOID +FASTCALL +DoDeviceSync( SURFOBJ *Surface, PRECTL Rect, FLONG fl) +{ + PGDIDEVICE Device = (GDIDEVICE*)Surface->hdev; +// No punting and "Handle to a surface, provided that the surface is device-managed. +// Otherwise, dhsurf is zero". + if (!(Device->flFlags & PDEV_DRIVER_PUNTED_CALL) && (Surface->dhsurf)) + { + if (Device->DriverFunctions.SynchronizeSurface) + return Device->DriverFunctions.SynchronizeSurface(Surface, Rect, fl); + else + { + if (Device->DriverFunctions.Synchronize) + return Device->DriverFunctions.Synchronize(Surface->dhpdev, Rect); + } + } + return; +} + +VOID +FASTCALL +SynchonizeDriver(FLONG Flags) +{ + SURFOBJ *SurfObj; + PGDIDEVICE Device; + + if (Flags & GCAPS2_SYNCFLUSH) + Flags = DSS_FLUSH_EVENT; + if (Flags & GCAPS2_SYNCTIMER) + Flags = DSS_TIMER_EVENT; + + Device = IntEnumHDev(); + + SurfObj = EngLockSurface((HSURF)Device->Handle); + if(!SurfObj) return; + DoDeviceSync( SurfObj, NULL, Flags); + EngUnlockSurface(SurfObj); + return; +} // // Process the batch. @@ -80,7 +125,7 @@ VOID APIENTRY NtGdiFlush(VOID) { - UNIMPLEMENTED; + SynchonizeDriver(GCAPS2_SYNCFLUSH); } /*