[ros-diffs] [jgardou] 47205: [WIN32K] - clean up some unused code - use GDIOBJ_IncrementShareCount on Timo suggestion - use ppdev semaphore as sort criterion in DC_vPrepareDCsForBlit, spotted by Timo - Get ownership before freeing the object in GDIOBJ_ShareUnlockObjByPtr, as whoever set it ready to die had the right to

jgardou at svn.reactos.org jgardou at svn.reactos.org
Fri May 14 22:19:47 CEST 2010


Author: jgardou
Date: Fri May 14 22:19:46 2010
New Revision: 47205

URL: http://svn.reactos.org/svn/reactos?rev=47205&view=rev
Log:
[WIN32K]
  - clean up some unused code
  - use GDIOBJ_IncrementShareCount on Timo suggestion
  - use ppdev semaphore as sort criterion in DC_vPrepareDCsForBlit, spotted by Timo
  - Get ownership before freeing the object in GDIOBJ_ShareUnlockObjByPtr, as whoever set it ready to die had the right to 

Modified:
    branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h
    branches/reactos-yarotows/subsystems/win32/win32k/include/gdiobj.h
    branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c
    branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c

Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h
URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h?rev=47205&r1=47204&r2=47205&view=diff
==============================================================================
--- 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 May 14 22:19:46 2010
@@ -152,52 +152,10 @@
 
 /* Internal functions *********************************************************/
 
-#if 1
 #define  DC_LockDc(hDC)  \
   ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
 #define  DC_UnlockDc(pDC)  \
   GDIOBJ_UnlockObjByPtr ((POBJ)pDC)
-#else
-
-VOID NTAPI EngAcquireSemaphoreShared(IN HSEMAPHORE hsem);
-
-PDC
-FORCEINLINE
-DC_LockDc(HDC hdc)
-{
-    PDC pdc;
-    pdc = GDIOBJ_LockObj(hdc, GDILoObjType_LO_DC_TYPE);
-
-    /* Direct DC's need PDEV locking */
-    if(pdc && pdc->dctype == DCTYPE_DIRECT)
-    {
-        /* 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);
-        }
-    }
-    return pdc;
-}
-
-void
-FORCEINLINE
-DC_UnlockDc(PDC pdc)
-{
-    if(pdc->dctype == DCTYPE_DIRECT)
-    {
-        /* Release PDEV lock */
-        EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
-    }
-
-    GDIOBJ_UnlockObjByPtr(&pdc->BaseObject);
-}
-#endif
-
 
 extern PDC defaultDCstate;
 

Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/gdiobj.h
URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/include/gdiobj.h?rev=47205&r1=47204&r2=47205&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] Fri May 14 22:19:46 2010
@@ -113,6 +113,7 @@
     ASSERT(cLocks >= 0);
     if ((flags & BASEFLAG_READY_TO_DIE) && (cLocks == 0))
     {
+        GDIOBJ_SetOwnership(hobj, PsGetCurrentProcess());
         GDIOBJ_FreeObjByHandle(hobj, GDI_OBJECT_TYPE_DONTCARE);
     }
     return cLocks;

Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c
URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c?rev=47205&r1=47204&r2=47205&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] Fri May 14 22:19:46 2010
@@ -95,7 +95,7 @@
     {
         case 1:
             psurfBmp->ppal = &gpalMono;
-            gpalMono.BaseObject.ulShareCount++;
+            GDIOBJ_IncrementShareCount((POBJ)&gpalMono);
             break;
         case 4:
         case 8:
@@ -103,16 +103,15 @@
             break;
         case 15:
             psurfBmp->ppal = &gpalRGB555;
-            gpalRGB555.BaseObject.ulShareCount++;
+            GDIOBJ_IncrementShareCount((POBJ)&gpalRGB555);
             break;
         case 16:
             psurfBmp->ppal = &gpalRGB565;
-            gpalRGB565.BaseObject.ulShareCount++;
-            break;
+            GDIOBJ_IncrementShareCount((POBJ)&gpalRGB565);
         case 24:
         case 32:
             psurfBmp->ppal = &gpalRGB;
-            gpalRGB.BaseObject.ulShareCount++;
+            GDIOBJ_IncrementShareCount((POBJ)&gpalRGB);
             break;
         default:
             DPRINT1("Could not determine palette for bit depth %u.\n", BitsPixel);

Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c
URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c?rev=47205&r1=47204&r2=47205&view=diff
==============================================================================
--- 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 May 14 22:19:46 2010
@@ -115,14 +115,6 @@
     DCTYPE dctype,
     PPDEVOBJ ppdev)
 {
-#if 0
-    if (dctype == DCTYPE_DIRECT)
-    {
-        /* Lock ppdev */
-        EngAcquireSemaphoreShared(ppdev->hsemDevLock);
-    }
-#endif
-
     /* Setup some basic fields */
     pdc->dctype = dctype;
     pdc->ppdev = ppdev;
@@ -496,7 +488,7 @@
     /* Lock them in good order */
     if(pdc2)
     {
-        if((ULONG_PTR)pdc1->BaseObject.hHmgr >= (ULONG_PTR)pdc2->BaseObject.hHmgr)
+        if((ULONG_PTR)pdc1->ppdev->hsemDevLock >= (ULONG_PTR)pdc2->ppdev->hsemDevLock)
         {
             pdcFirst = pdc1;
             prcFirst = &rc1;




More information about the Ros-diffs mailing list