[WIN32K]
authorJérôme Gardou <jerome.gardou@reactos.org>
Mon, 5 Apr 2010 11:53:36 +0000 (11:53 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Mon, 5 Apr 2010 11:53:36 +0000 (11:53 +0000)
  Partially revert 46733
  Silence some debug output

svn path=/branches/reactos-yarotows/; revision=46734

subsystems/win32/win32k/eng/pdevobj.c

index 5445e91..35c3ebf 100644 (file)
@@ -60,7 +60,8 @@ PDEVOBJ_vRelease(PPDEVOBJ ppdev)
         /* Do we have a surface? */
         if(ppdev->pSurface)
         {
-            /* No one should hold a lock on this surface */
+            /* Release the surface and let the driver free it */
+            SURFACE_ShareUnlockSurface(ppdev->pSurface);
             ppdev->pfn.DisableSurface(ppdev->dhpdev);
         }
 
@@ -146,8 +147,6 @@ PDEVOBJ_pSurface(
 {
     HSURF hsurf;
 
-    DPRINT("PDEVOBJ_pSurface()\n");
-
     /* Check if we already have a surface */
     if (ppdev->pSurface)
     {
@@ -291,6 +290,7 @@ PDEVOBJ_vSwitchPdev(
     PPDEVOBJ ppdev2)
 {
     PDEVOBJ pdevTmp;
+    HDEV hdev;
 
     /* Exchange data */
     pdevTmp = *ppdev;
@@ -310,10 +310,9 @@ PDEVOBJ_vSwitchPdev(
     /* Exchange surface */
     ppdev->pSurface = ppdev2->pSurface;
     ppdev2->pSurface = pdevTmp.pSurface;
-    if(ppdev->pSurface)
-        ppdev->pSurface->SurfObj.hdev = (HDEV)ppdev;
-    if(ppdev2->pSurface)
-        ppdev2->pSurface->SurfObj.hdev = (HDEV)ppdev2;
+    hdev = ppdev->pSurface->SurfObj.hdev;
+    ppdev->pSurface->SurfObj.hdev = ppdev2->pSurface->SurfObj.hdev;
+    ppdev2->pSurface->SurfObj.hdev = hdev;
 
     /* Exchange devinfo */
     ppdev->devinfo = ppdev2->devinfo;
@@ -337,6 +336,7 @@ PDEVOBJ_bSwitchMode(
 {
     UNICODE_STRING ustrDevice;
     PPDEVOBJ ppdevTmp;
+    PSURFACE pSurface;
     BOOL retval = FALSE;
 
     /* Lock the PDEV */
@@ -365,14 +365,25 @@ PDEVOBJ_bSwitchMode(
         goto leave;
     }
 
-    /* 3. Get DirectDraw information */
-    /* 4. Enable DirectDraw Not traced */
-    /* 5. Copy old PDEV state to new PDEV instance */
+    /* 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 */
 
-    /* 6. Switch the PDEVs */
+    /* 7. Switch the PDEVs */
     PDEVOBJ_vSwitchPdev(ppdev, ppdevTmp);
+    ASSERT(ppdev->pSurface->BitsLock);
 
-    /* 7. Disable DirectDraw */
+    /* 8. Disable DirectDraw */
 
     PDEVOBJ_vRelease(ppdevTmp);
 
@@ -384,6 +395,7 @@ leave:
     EngReleaseSemaphore(ghsemPDEV);
 
     DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
+    ASSERT(ppdev->pSurface->BitsLock);
 
     return retval;
 }