Author: jgardou
Date: Mon Apr 5 12:58:43 2010
New Revision: 46733
URL:
http://svn.reactos.org/svn/reactos?rev=46733&view=rev
Log:
[WIN32K]
-Make direct DC release shared lock on surface each time they're unlocked.
-Now they don't hold it unless they're locked themselves.
-Do not create the device surface when switching modes, this is inconsistent with the
PDEVOBJ creation, which does not.
*No more "you are freeing a surface which is still hold" debug message when
switching modes*
Modified:
branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c
branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h
branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.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] Mon Apr
5 12:58:43 2010
@@ -60,8 +60,7 @@
/* Do we have a surface? */
if(ppdev->pSurface)
{
- /* Release the surface and let the driver free it */
- SURFACE_ShareUnlockSurface(ppdev->pSurface);
+ /* No one should hold a lock on this surface */
ppdev->pfn.DisableSurface(ppdev->dhpdev);
}
@@ -147,7 +146,7 @@
{
HSURF hsurf;
- DPRINT1("PDEVOBJ_pSurface()\n");
+ DPRINT("PDEVOBJ_pSurface()\n");
/* Check if we already have a surface */
if (ppdev->pSurface)
@@ -164,7 +163,7 @@
ppdev->pSurface = SURFACE_ShareLockSurface(hsurf);
}
- DPRINT1("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface);
+ DPRINT("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface);
return ppdev->pSurface;
}
@@ -292,7 +291,6 @@
PPDEVOBJ ppdev2)
{
PDEVOBJ pdevTmp;
- HDEV hdev;
/* Exchange data */
pdevTmp = *ppdev;
@@ -312,9 +310,10 @@
/* Exchange surface */
ppdev->pSurface = ppdev2->pSurface;
ppdev2->pSurface = pdevTmp.pSurface;
- hdev = ppdev->pSurface->SurfObj.hdev;
- ppdev->pSurface->SurfObj.hdev = ppdev2->pSurface->SurfObj.hdev;
- ppdev2->pSurface->SurfObj.hdev = hdev;
+ if(ppdev->pSurface)
+ ppdev->pSurface->SurfObj.hdev = (HDEV)ppdev;
+ if(ppdev2->pSurface)
+ ppdev2->pSurface->SurfObj.hdev = (HDEV)ppdev2;
/* Exchange devinfo */
ppdev->devinfo = ppdev2->devinfo;
@@ -338,7 +337,6 @@
{
UNICODE_STRING ustrDevice;
PPDEVOBJ ppdevTmp;
- PSURFACE pSurface;
BOOL retval = FALSE;
/* Lock the PDEV */
@@ -367,25 +365,14 @@
goto leave;
}
- /* 3. Create a new surface */
- pSurface = PDEVOBJ_pSurface(ppdevTmp);
- if (!pSurface)
- {
- DPRINT1("DrvEnableSurface failed\n");
- goto leave;
- }
-
- ASSERT(pSurface->BitsLock);
-
- /* 4. Get DirectDraw information */
- /* 5. Enable DirectDraw Not traced */
- /* 6. Copy old PDEV state to new PDEV instance */
-
- /* 7. Switch the PDEVs */
+ /* 3. Get DirectDraw information */
+ /* 4. Enable DirectDraw Not traced */
+ /* 5. Copy old PDEV state to new PDEV instance */
+
+ /* 6. Switch the PDEVs */
PDEVOBJ_vSwitchPdev(ppdev, ppdevTmp);
- ASSERT(ppdev->pSurface->BitsLock);
-
- /* 8. Disable DirectDraw */
+
+ /* 7. Disable DirectDraw */
PDEVOBJ_vRelease(ppdevTmp);
@@ -397,7 +384,6 @@
EngReleaseSemaphore(ghsemPDEV);
DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
- ASSERT(ppdev->pSurface->BitsLock);
return retval;
}
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] Mon Apr 5
12:58:43 2010
@@ -176,12 +176,9 @@
/* Acquire shared PDEV lock */
EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
- /* Update Surface if needed */
- if(pdc->dclevel.pSurface != pdc->ppdev->pSurface)
- {
- if(pdc->dclevel.pSurface)
SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
- pdc->dclevel.pSurface = PDEVOBJ_pSurface(pdc->ppdev);
- }
+ /* Assign Surface */
+ pdc->dclevel.pSurface = PDEVOBJ_pSurface(pdc->ppdev);
+
}
return pdc;
}
@@ -192,6 +189,8 @@
{
if(pdc->dctype == DCTYPE_DIRECT)
{
+ /* Release surface lock */
+ SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
/* Release PDEV lock */
EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
}
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] Mon
Apr 5 12:58:43 2010
@@ -377,7 +377,8 @@
PATH_Delete(pdc->dclevel.hPath);
- if(pdc->dclevel.pSurface)
+ /* Ideally, no DC should hold a lock on a surface when being deleted */
+ if(pdc->dclevel.pSurface && pdc->dctype != DCTYPE_DIRECT)
SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
PDEVOBJ_vRelease(pdc->ppdev) ;