Author: tkreuzer
Date: Fri Apr 2 00:36:40 2010
New Revision: 46658
URL:
http://svn.reactos.org/svn/reactos?rev=46658&view=rev
Log:
[WIN32K]
- EngAcquireSemaphoreShared: update dwEngAcquireCount
- DC_LockDc/DC_UnlockDc: Acquire PDEV lock only for direct DCs, in that case also update
the pSurface pointer
- When copying DC states, copy the surface only for memory dcs
- after switching the mode, update system metrics and redraw the desktop window.
- Remove testdraw code.
Modified:
branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/semaphor.c
branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h
branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c
branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c
branches/reactos-yarotows/subsystems/win32/win32k/objects/dcstate.c
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1] Fri Apr
2 00:36:40 2010
@@ -329,37 +329,6 @@
ppdev2->pfn.CompletePDEV(ppdev2->dhpdev, (HDEV)ppdev2);
}
-void
-TestDraw()
-{
- RECTL rclTrg;
- PPDEVOBJ ppdev;
- PDC pdc;
-
- ppdev = EngpGetPDEV(0);
-
- pdc = DC_AllocDcWithHandle();
- DC_vInitDc(pdc, 0, ppdev);
-
-
- rclTrg.left = rclTrg.top = 0;
- rclTrg.right = rclTrg.bottom = 400;
-
- IntEngBitBltEx(&ppdev->pSurface->SurfObj,
- NULL,
- NULL,
- NULL,
- NULL,
- &rclTrg,
- NULL,
- NULL,
- &pdc->eboFill.BrushObject,
- NULL,
- ROP3_TO_ROP4(PATCOPY),
- FALSE);
-
- ASSERT(FALSE);
-}
BOOL
NTAPI
@@ -429,8 +398,6 @@
DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
ASSERT(ppdev->pSurface->BitsLock);
-
- TestDraw();
return retval;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/semaphor.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/semaphor.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/semaphor.c [iso-8859-1] Fri Apr
2 00:36:40 2010
@@ -74,8 +74,12 @@
EngAcquireSemaphoreShared(
IN HSEMAPHORE hsem)
{
+ PTHREADINFO pti;
+
ASSERT(hsem);
ExEnterCriticalRegionAndAcquireResourceShared((PERESOURCE)hsem);
+ pti = PsGetThreadWin32Thread(PsGetCurrentThread());
+ if (pti) ++pti->dwEngAcquireCount;
}
/*
Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h [iso-8859-1] Fri Apr 2
00:36:40 2010
@@ -169,7 +169,16 @@
{
PDC pdc;
pdc = GDIOBJ_LockObj(hdc, GDILoObjType_LO_DC_TYPE);
- if(pdc) EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
+
+ /* Direct DC's need PDEV locking */
+ if(pdc && pdc->dctype == DCTYPE_DIRECT)
+ {
+ /* Acquire shared PDEV lock */
+ EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
+
+ /* Get the current surface */
+ pdc->dclevel.pSurface = pdc->ppdev->pSurface;
+ }
return pdc;
}
@@ -177,7 +186,12 @@
FORCEINLINE
DC_UnlockDc(PDC pdc)
{
- EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
+ if(pdc->dctype == DCTYPE_DIRECT)
+ {
+ /* Release PDEV lock */
+ EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
+ }
+
GDIOBJ_UnlockObjByPtr(&pdc->BaseObject);
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] Fri
Apr 2 00:36:40 2010
@@ -710,6 +710,8 @@
return Status;
}
+BOOL APIENTRY UserClipCursor(RECTL *prcl);
+VOID APIENTRY UserRedrawDesktop();
LONG
APIENTRY
@@ -725,6 +727,7 @@
HKEY hkey;
NTSTATUS Status;
PPDEVOBJ ppdev;
+ PDESKTOP pdesk;
/* If no DEVMODE is given, use registry settings */
if (!pdm)
@@ -792,6 +795,19 @@
lResult = (lResult == DISP_CHANGE_NOTUPDATED) ?
DISP_CHANGE_FAILED : DISP_CHANGE_RESTART;
}
+
+ /* Update the system metrics */
+ InitMetrics();
+
+ /* Remove all cursor clipping */
+ UserClipCursor(NULL);
+
+ pdesk = IntGetActiveDesktop();
+ IntHideDesktop(pdesk);
+ co_IntShowDesktop(pdesk, ppdev->gdiinfo.ulHorzRes,
ppdev->gdiinfo.ulVertRes);
+ //UserRedrawDesktop();
+
+ //IntvGetDeviceCaps(&PrimarySurface, &GdiHandleTable->DevCaps);
/* Send message */
@@ -883,10 +899,13 @@
}
// FIXME: Copy videoparameters
+ UserEnterExclusive();
/* Call internal function */
Ret = UserChangeDisplaySettings(pustrDevice, lpDevMode, hwnd, dwflags, NULL);
+ UserLeave();
+
return Ret;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Fri
Apr 2 00:36:40 2010
@@ -117,8 +117,11 @@
DCTYPE dctype,
PPDEVOBJ ppdev)
{
- /* Lock ppdev */
- EngAcquireSemaphoreShared(ppdev->hsemDevLock);
+ if (dctype == DCTYPE_DIRECT)
+ {
+ /* Lock ppdev */
+ EngAcquireSemaphoreShared(ppdev->hsemDevLock);
+ }
/* Setup some basic fields */
pdc->dctype = dctype;
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dcstate.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] Fri
Apr 2 00:36:40 2010
@@ -41,7 +41,6 @@
pdcDst->dclevel.hpal = pdcSrc->dclevel.hpal;
/* Handle references here correctly */
- DC_vSelectSurface(pdcDst, pdcSrc->dclevel.pSurface);
DC_vSelectFillBrush(pdcDst, pdcSrc->dclevel.pbrFill);
DC_vSelectLineBrush(pdcDst, pdcSrc->dclevel.pbrLine);
DC_vSelectPalette(pdcDst, pdcSrc->dclevel.ppal);
@@ -160,6 +159,10 @@
/* Copy the state back */
DC_vCopyState(pdcSave, pdc, FALSE);
+ /* Only memory DC's change their surface */
+ if (pdcSave->dctype == DCTYPE_MEMORY)
+ DC_vSelectSurface(pdc, pdcSave->dclevel.pSurface);
+
// Restore Path by removing it, if the Save flag is set.
// BeginPath will takecare of the rest.
if (pdc->dclevel.hPath && pdc->dclevel.flPath &
DCPATH_SAVE)
@@ -274,6 +277,10 @@
/* Copy the current state */
DC_vCopyState(pdc, pdcSave, TRUE);
+ /* Only memory DC's change their surface */
+ if (pdc->dctype == DCTYPE_MEMORY)
+ DC_vSelectSurface(pdcSave, pdc->dclevel.pSurface);
+
/* Copy path. FIXME: why this way? */
pdcSave->dclevel.hPath = pdc->dclevel.hPath;
pdcSave->dclevel.flPath = pdc->dclevel.flPath | DCPATH_SAVESTATE;