mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:03:12 +00:00
[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* svn path=/branches/reactos-yarotows/; revision=46733
This commit is contained in:
parent
6638a5b899
commit
243eeb574a
3 changed files with 19 additions and 33 deletions
|
@ -60,8 +60,7 @@ PDEVOBJ_vRelease(PPDEVOBJ ppdev)
|
||||||
/* Do we have a surface? */
|
/* Do we have a surface? */
|
||||||
if(ppdev->pSurface)
|
if(ppdev->pSurface)
|
||||||
{
|
{
|
||||||
/* Release the surface and let the driver free it */
|
/* No one should hold a lock on this surface */
|
||||||
SURFACE_ShareUnlockSurface(ppdev->pSurface);
|
|
||||||
ppdev->pfn.DisableSurface(ppdev->dhpdev);
|
ppdev->pfn.DisableSurface(ppdev->dhpdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +146,7 @@ PDEVOBJ_pSurface(
|
||||||
{
|
{
|
||||||
HSURF hsurf;
|
HSURF hsurf;
|
||||||
|
|
||||||
DPRINT1("PDEVOBJ_pSurface()\n");
|
DPRINT("PDEVOBJ_pSurface()\n");
|
||||||
|
|
||||||
/* Check if we already have a surface */
|
/* Check if we already have a surface */
|
||||||
if (ppdev->pSurface)
|
if (ppdev->pSurface)
|
||||||
|
@ -164,7 +163,7 @@ PDEVOBJ_pSurface(
|
||||||
ppdev->pSurface = SURFACE_ShareLockSurface(hsurf);
|
ppdev->pSurface = SURFACE_ShareLockSurface(hsurf);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface);
|
DPRINT("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface);
|
||||||
return ppdev->pSurface;
|
return ppdev->pSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +291,6 @@ PDEVOBJ_vSwitchPdev(
|
||||||
PPDEVOBJ ppdev2)
|
PPDEVOBJ ppdev2)
|
||||||
{
|
{
|
||||||
PDEVOBJ pdevTmp;
|
PDEVOBJ pdevTmp;
|
||||||
HDEV hdev;
|
|
||||||
|
|
||||||
/* Exchange data */
|
/* Exchange data */
|
||||||
pdevTmp = *ppdev;
|
pdevTmp = *ppdev;
|
||||||
|
@ -312,9 +310,10 @@ PDEVOBJ_vSwitchPdev(
|
||||||
/* Exchange surface */
|
/* Exchange surface */
|
||||||
ppdev->pSurface = ppdev2->pSurface;
|
ppdev->pSurface = ppdev2->pSurface;
|
||||||
ppdev2->pSurface = pdevTmp.pSurface;
|
ppdev2->pSurface = pdevTmp.pSurface;
|
||||||
hdev = ppdev->pSurface->SurfObj.hdev;
|
if(ppdev->pSurface)
|
||||||
ppdev->pSurface->SurfObj.hdev = ppdev2->pSurface->SurfObj.hdev;
|
ppdev->pSurface->SurfObj.hdev = (HDEV)ppdev;
|
||||||
ppdev2->pSurface->SurfObj.hdev = hdev;
|
if(ppdev2->pSurface)
|
||||||
|
ppdev2->pSurface->SurfObj.hdev = (HDEV)ppdev2;
|
||||||
|
|
||||||
/* Exchange devinfo */
|
/* Exchange devinfo */
|
||||||
ppdev->devinfo = ppdev2->devinfo;
|
ppdev->devinfo = ppdev2->devinfo;
|
||||||
|
@ -338,7 +337,6 @@ PDEVOBJ_bSwitchMode(
|
||||||
{
|
{
|
||||||
UNICODE_STRING ustrDevice;
|
UNICODE_STRING ustrDevice;
|
||||||
PPDEVOBJ ppdevTmp;
|
PPDEVOBJ ppdevTmp;
|
||||||
PSURFACE pSurface;
|
|
||||||
BOOL retval = FALSE;
|
BOOL retval = FALSE;
|
||||||
|
|
||||||
/* Lock the PDEV */
|
/* Lock the PDEV */
|
||||||
|
@ -367,25 +365,14 @@ PDEVOBJ_bSwitchMode(
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 3. Create a new surface */
|
/* 3. Get DirectDraw information */
|
||||||
pSurface = PDEVOBJ_pSurface(ppdevTmp);
|
/* 4. Enable DirectDraw Not traced */
|
||||||
if (!pSurface)
|
/* 5. Copy old PDEV state to new PDEV instance */
|
||||||
{
|
|
||||||
DPRINT1("DrvEnableSurface failed\n");
|
|
||||||
goto leave;
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT(pSurface->BitsLock);
|
/* 6. Switch the PDEVs */
|
||||||
|
|
||||||
/* 4. Get DirectDraw information */
|
|
||||||
/* 5. Enable DirectDraw Not traced */
|
|
||||||
/* 6. Copy old PDEV state to new PDEV instance */
|
|
||||||
|
|
||||||
/* 7. Switch the PDEVs */
|
|
||||||
PDEVOBJ_vSwitchPdev(ppdev, ppdevTmp);
|
PDEVOBJ_vSwitchPdev(ppdev, ppdevTmp);
|
||||||
ASSERT(ppdev->pSurface->BitsLock);
|
|
||||||
|
|
||||||
/* 8. Disable DirectDraw */
|
/* 7. Disable DirectDraw */
|
||||||
|
|
||||||
PDEVOBJ_vRelease(ppdevTmp);
|
PDEVOBJ_vRelease(ppdevTmp);
|
||||||
|
|
||||||
|
@ -397,7 +384,6 @@ leave:
|
||||||
EngReleaseSemaphore(ghsemPDEV);
|
EngReleaseSemaphore(ghsemPDEV);
|
||||||
|
|
||||||
DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
|
DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
|
||||||
ASSERT(ppdev->pSurface->BitsLock);
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,12 +176,9 @@ DC_LockDc(HDC hdc)
|
||||||
/* Acquire shared PDEV lock */
|
/* Acquire shared PDEV lock */
|
||||||
EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
|
EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
|
||||||
|
|
||||||
/* Update Surface if needed */
|
/* Assign Surface */
|
||||||
if(pdc->dclevel.pSurface != pdc->ppdev->pSurface)
|
pdc->dclevel.pSurface = PDEVOBJ_pSurface(pdc->ppdev);
|
||||||
{
|
|
||||||
if(pdc->dclevel.pSurface) SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
|
|
||||||
pdc->dclevel.pSurface = PDEVOBJ_pSurface(pdc->ppdev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return pdc;
|
return pdc;
|
||||||
}
|
}
|
||||||
|
@ -192,6 +189,8 @@ DC_UnlockDc(PDC pdc)
|
||||||
{
|
{
|
||||||
if(pdc->dctype == DCTYPE_DIRECT)
|
if(pdc->dctype == DCTYPE_DIRECT)
|
||||||
{
|
{
|
||||||
|
/* Release surface lock */
|
||||||
|
SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
|
||||||
/* Release PDEV lock */
|
/* Release PDEV lock */
|
||||||
EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
|
EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,7 +377,8 @@ ASSERT(pdc->rosdc.hGCClipRgn);
|
||||||
|
|
||||||
PATH_Delete(pdc->dclevel.hPath);
|
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);
|
SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
|
||||||
|
|
||||||
PDEVOBJ_vRelease(pdc->ppdev) ;
|
PDEVOBJ_vRelease(pdc->ppdev) ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue