From: Jérôme Gardou Date: Fri, 16 Apr 2010 09:49:05 +0000 (+0000) Subject: revert the DC list stuff, it's not worth it (tm). Things will be done differently X-Git-Tag: backups/reactos-yarotows@57446~182 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=6a8d2ef67575c9de809abaf21786ae4ea7090252 revert the DC list stuff, it's not worth it (tm). Things will be done differently svn path=/branches/reactos-yarotows/; revision=46892 --- diff --git a/subsystems/win32/win32k/objects/dclife.c b/subsystems/win32/win32k/objects/dclife.c index 45851f3578d..1426770ab31 100644 --- a/subsystems/win32/win32k/objects/dclife.c +++ b/subsystems/win32/win32k/objects/dclife.c @@ -117,8 +117,8 @@ DC_vInitDc( { if (dctype == DCTYPE_DIRECT) { - /* Lock ppdev exclusively */ - EngAcquireSemaphore(ppdev->hsemDevLock); + /* Lock ppdev */ + EngAcquireSemaphoreShared(ppdev->hsemDevLock); } /* Setup some basic fields */ @@ -159,55 +159,9 @@ DC_vInitDc( if (dctype == DCTYPE_DIRECT) { - PDC pdcTmp; /* Direct DCs get the surface from the PDEV */ pdc->dclevel.pSurface = PDEVOBJ_pSurface(ppdev); - /* Maintain a list of DC attached to this device */ - /* We must sort them so when locking them one after the other we don't risk deadlocks */ - /* The greatest the first, as in GDIOBJ_LockMultiplObjs */ - if((ULONG_PTR)pdc->dclevel.pSurface->hDC < (ULONG_PTR)pdc->BaseObject.hHmgr) - { - /* Insert it at the head of the list */ - pdc->hdcNext = pdc->dclevel.pSurface->hDC ; - pdc->dclevel.pSurface->hDC = pdc->BaseObject.hHmgr ; - pdcTmp = DC_LockDc(pdc->hdcNext); - if(pdcTmp) - { - pdcTmp->hdcPrev = pdc->BaseObject.hHmgr ; - DC_UnlockDc(pdcTmp); - } - } - else - { - HDC hdcTmp = pdc->dclevel.pSurface->hDC; - HDC hdcNext = NULL ; - HDC hdcPrev = NULL ; - /* Find its place */ - while((ULONG_PTR)hdcTmp > (ULONG_PTR)pdc->BaseObject.hHmgr) - { - pdcTmp = DC_LockDc(hdcTmp); - hdcNext = hdcTmp ; - hdcPrev = pdcTmp->hdcPrev ; - hdcTmp = pdcTmp->hdcNext ; - DC_UnlockDc(pdcTmp); - } - pdc->hdcPrev = hdcPrev; - pdc->hdcNext = hdcNext; - /* Insert it */ - pdcTmp = DC_LockDc(hdcPrev); - ASSERT(pdcTmp) ; /* There should always be a previous */ - pdcTmp->hdcNext = pdc->BaseObject.hHmgr ; - DC_UnlockDc(pdcTmp) ; - - pdcTmp = DC_LockDc(hdcNext); - if(pdcTmp) /* Last one is NULL */ - { - pdcTmp->hdcPrev = pdc->BaseObject.hHmgr; - DC_UnlockDc(pdcTmp); - } - } - pdc->erclBounds.left = 0x7fffffff; pdc->erclBounds.top = 0x7fffffff; pdc->erclBounds.right = 0x80000000; @@ -370,6 +324,8 @@ DC_vInitDc( // pdc->dclevel.pFont = LFONT_ShareLockFont(pdc->dcattr.hlfntNew); /* Other stuff */ + pdc->hdcNext = NULL; + pdc->hdcPrev = NULL; pdc->ipfdDevMax = 0x0000ffff; pdc->ulCopyCount = -1; pdc->ptlDoBanding.x = 0; @@ -419,34 +375,9 @@ ASSERT(pdc->rosdc.hGCClipRgn); PATH_Delete(pdc->dclevel.hPath); - if(pdc->dctype == DCTYPE_DIRECT) - { - EngAcquireSemaphore(pdc->ppdev->hsemDevLock); - /* Remove it from the list of DC attached to the Device */ - PDC tmpDC = DC_LockDc(pdc->hdcNext); - if(tmpDC != NULL) - { - tmpDC->hdcPrev = pdc->hdcPrev ; - DC_UnlockDc(tmpDC); - } - tmpDC = DC_LockDc(pdc->hdcPrev); - if(tmpDC != NULL) - { - tmpDC->hdcNext = pdc->hdcNext ; - DC_UnlockDc(tmpDC); - } - /* Reassign list head if needed */ - if(pdc->BaseObject.hHmgr == pdc->dclevel.pSurface->hDC) - { - /* Sanity check */ - ASSERT(pdc->hdcPrev == NULL); - pdc->dclevel.pSurface->hDC = pdc->hdcNext; - } - EngReleaseSemaphore(pdc->ppdev->hsemDevLock) ; - } - if(pdc->dclevel.pSurface) SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface); + PDEVOBJ_vRelease(pdc->ppdev) ; return TRUE;