diff --git a/subsystems/win32/win32k/eng/alphablend.c b/subsystems/win32/win32k/eng/alphablend.c index 3322dc2c0f9..d54af52e695 100644 --- a/subsystems/win32/win32k/eng/alphablend.c +++ b/subsystems/win32/win32k/eng/alphablend.c @@ -305,11 +305,6 @@ IntEngAlphaBlend(IN SURFOBJ *psoDest, return TRUE; } - SURFACE_LockBitmapBits(psurfDest); - - if (psoSource != psoDest) - SURFACE_LockBitmapBits(psurfSource); - /* Call the driver's DrvAlphaBlend if available */ if (psurfDest->flHooks & HOOK_ALPHABLEND) { @@ -324,10 +319,6 @@ IntEngAlphaBlend(IN SURFOBJ *psoDest, DestRect, SourceRect, BlendObj); } - if (psoSource != psoDest) - SURFACE_UnlockBitmapBits(psurfSource); - SURFACE_UnlockBitmapBits(psurfDest); - return ret; } diff --git a/subsystems/win32/win32k/eng/bitblt.c b/subsystems/win32/win32k/eng/bitblt.c index 88ee1902993..fdd5149a86e 100644 --- a/subsystems/win32/win32k/eng/bitblt.c +++ b/subsystems/win32/win32k/eng/bitblt.c @@ -582,19 +582,6 @@ IntEngBitBltEx( psurfSrc = NULL; } - if (bRemoveMouse) - { - SURFACE_LockBitmapBits(psurfTrg); - - if (psoSrc) - { - if (psoSrc != psoTrg) - { - SURFACE_LockBitmapBits(psurfSrc); - } - } - } - /* Is the target surface device managed? */ if (psurfTrg->flHooks & HOOK_BITBLT) { @@ -632,18 +619,6 @@ IntEngBitBltEx( // FIXME: cleanup temp surface! - if (bRemoveMouse) - { - if (psoSrc) - { - if (psoSrc != psoTrg) - { - SURFACE_UnlockBitmapBits(psurfSrc); - } - } - SURFACE_UnlockBitmapBits(psurfTrg); - } - return bResult; } @@ -972,8 +947,6 @@ IntEngMaskBlt(SURFOBJ *psoDest, ASSERT(psoDest); psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj); - SURFACE_LockBitmapBits(psurfDest); - /* Dummy BitBlt to let driver know that it should flush its changes. This should really be done using a call to DrvSynchronizeSurface, but the VMware driver doesn't hook that call. */ @@ -989,8 +962,6 @@ IntEngMaskBlt(SURFOBJ *psoDest, DestRect, pptlMask, pptlMask, pbo, BrushOrigin, R4_NOOP, FALSE); - SURFACE_UnlockBitmapBits(psurfDest); - return ret; } diff --git a/subsystems/win32/win32k/eng/copybits.c b/subsystems/win32/win32k/eng/copybits.c index 598f8ee761d..361c526e409 100644 --- a/subsystems/win32/win32k/eng/copybits.c +++ b/subsystems/win32/win32k/eng/copybits.c @@ -53,13 +53,7 @@ EngCopyBits(SURFOBJ *psoDest, ASSERT(psoDest != NULL && psoSource != NULL && DestRect != NULL && SourcePoint != NULL); psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj); - SURFACE_LockBitmapBits(psurfSource); - psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj); - if (psoDest != psoSource) - { - SURFACE_LockBitmapBits(psurfDest); - } // FIXME: Don't punt to the driver's DrvCopyBits immediately. Instead, // mark the copy block function to be DrvCopyBits instead of the @@ -180,12 +174,6 @@ EngCopyBits(SURFOBJ *psoDest, } cleanup: - if (psoDest != psoSource) - { - SURFACE_UnlockBitmapBits(psurfDest); - } - SURFACE_UnlockBitmapBits(psurfSource); - return ret; } diff --git a/subsystems/win32/win32k/eng/gradient.c b/subsystems/win32/win32k/eng/gradient.c index 34e5c3d92a4..c0ccaf84443 100644 --- a/subsystems/win32/win32k/eng/gradient.c +++ b/subsystems/win32/win32k/eng/gradient.c @@ -548,7 +548,6 @@ IntEngGradientFill( psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj); ASSERT(psurf); - SURFACE_LockBitmapBits(psurf); if(psurf->flHooks & HOOK_GRADIENTFILL) { Ret = GDIDEVFUNCS(psoDest).GradientFill( @@ -560,7 +559,6 @@ IntEngGradientFill( Ret = EngGradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, prclExtents, pptlDitherOrg, ulMode); } - SURFACE_UnlockBitmapBits(psurf); return Ret; } diff --git a/subsystems/win32/win32k/eng/lineto.c b/subsystems/win32/win32k/eng/lineto.c index dadb7228cf3..81bff70ebc0 100644 --- a/subsystems/win32/win32k/eng/lineto.c +++ b/subsystems/win32/win32k/eng/lineto.c @@ -565,8 +565,6 @@ IntEngLineTo(SURFOBJ *psoDest, if (b.left == b.right) b.right++; if (b.top == b.bottom) b.bottom++; - SURFACE_LockBitmapBits(psurfDest); - if (psurfDest->flHooks & HOOK_LINETO) { /* Call the driver's DrvLineTo */ @@ -586,8 +584,6 @@ IntEngLineTo(SURFOBJ *psoDest, ret = EngLineTo(psoDest, ClipObj, pbo, x1, y1, x2, y2, RectBounds, Mix); } - SURFACE_UnlockBitmapBits(psurfDest); - return ret; } diff --git a/subsystems/win32/win32k/eng/mouse.c b/subsystems/win32/win32k/eng/mouse.c index 6d35c9e8fa7..ab65381ac2b 100644 --- a/subsystems/win32/win32k/eng/mouse.c +++ b/subsystems/win32/win32k/eng/mouse.c @@ -540,14 +540,13 @@ IntEngMovePointer( IN LONG y, IN RECTL *prcl) { - SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj); PPDEVOBJ ppdev = (PPDEVOBJ)pso->hdev; if(ppdev->SafetyRemoveLevel) return ; - SURFACE_LockBitmapBits(psurf); + EngAcquireSemaphore(ppdev->hsemDevLock); ppdev->pfnMovePointer(pso, x, y, prcl); - SURFACE_UnlockBitmapBits(psurf); + EngReleaseSemaphore(ppdev->hsemDevLock); } ULONG APIENTRY @@ -564,13 +563,12 @@ IntEngSetPointerShape( IN FLONG fl) { ULONG ulResult = SPS_DECLINE; - SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj); PFN_DrvSetPointerShape pfnSetPointerShape; PPDEVOBJ ppdev = GDIDEV(pso); pfnSetPointerShape = GDIDEVFUNCS(pso).SetPointerShape; - SURFACE_LockBitmapBits(psurf); + EngAcquireSemaphore(ppdev->hsemDevLock); if (pfnSetPointerShape) { ulResult = pfnSetPointerShape(pso, @@ -608,7 +606,7 @@ IntEngSetPointerShape( ppdev->pfnMovePointer = EngMovePointer; } - SURFACE_UnlockBitmapBits(psurf); + EngReleaseSemaphore(ppdev->hsemDevLock); return ulResult; } diff --git a/subsystems/win32/win32k/eng/paint.c b/subsystems/win32/win32k/eng/paint.c index 36f27104cfe..9fd6565db1c 100644 --- a/subsystems/win32/win32k/eng/paint.c +++ b/subsystems/win32/win32k/eng/paint.c @@ -32,7 +32,7 @@ #define NDEBUG #include -static BOOL APIENTRY FillSolidUnlocked(SURFOBJ *pso, PRECTL pRect, ULONG iColor) +BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor) { LONG y; ULONG LineWidth; @@ -41,7 +41,6 @@ static BOOL APIENTRY FillSolidUnlocked(SURFOBJ *pso, PRECTL pRect, ULONG iColor) ASSERT(pso); ASSERT(pRect); psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj); - MouseSafetyOnDrawStart(pso, pRect->left, pRect->top, pRect->right, pRect->bottom); LineWidth = pRect->right - pRect->left; DPRINT(" LineWidth: %d, top: %d, bottom: %d\n", LineWidth, pRect->top, pRect->bottom); for (y = pRect->top; y < pRect->bottom; y++) @@ -49,22 +48,9 @@ static BOOL APIENTRY FillSolidUnlocked(SURFOBJ *pso, PRECTL pRect, ULONG iColor) DibFunctionsForBitmapFormat[pso->iBitmapFormat].DIB_HLine( pso, pRect->left, pRect->right, y, iColor); } - MouseSafetyOnDrawEnd(pso); - return TRUE; } -BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor) -{ - SURFACE *psurf; - BOOL Result; - psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj); - SURFACE_LockBitmapBits(psurf); - Result = FillSolidUnlocked(pso, pRect, iColor); - SURFACE_UnlockBitmapBits(psurf); - return Result; -} - BOOL APIENTRY EngPaintRgn(SURFOBJ *pso, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix, BRUSHOBJ *BrushObj, POINTL *BrushPoint) @@ -87,7 +73,7 @@ EngPaintRgn(SURFOBJ *pso, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix, if (ClipRegion->iDComplexity == DC_RECT) { - FillSolidUnlocked(pso, &(ClipRegion->rclBounds), iColor); + FillSolid(pso, &(ClipRegion->rclBounds), iColor); } else { /* Enumerate all the rectangles and draw them */ @@ -96,7 +82,7 @@ EngPaintRgn(SURFOBJ *pso, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix, do { EnumMore = CLIPOBJ_bEnum(ClipRegion, sizeof(RectEnum), (PVOID) &RectEnum); for (i = 0; i < RectEnum.c; i++) { - FillSolidUnlocked(pso, RectEnum.arcl + i, iColor); + FillSolid(pso, RectEnum.arcl + i, iColor); } } while (EnumMore); } @@ -141,11 +127,8 @@ IntEngPaint(IN SURFOBJ *pso, if((pso->iType!=STYPE_BITMAP) && (psurf->flHooks & HOOK_PAINT)) { // Call the driver's DrvPaint - SURFACE_LockBitmapBits(psurf); - ret = GDIDEVFUNCS(pso).Paint( pso, ClipRegion, Brush, BrushOrigin, Mix); - SURFACE_UnlockBitmapBits(psurf); return ret; } return EngPaint(pso, ClipRegion, Brush, BrushOrigin, Mix ); diff --git a/subsystems/win32/win32k/eng/pdevobj.c b/subsystems/win32/win32k/eng/pdevobj.c index 35c3ebfd0ff..412bbbd8111 100644 --- a/subsystems/win32/win32k/eng/pdevobj.c +++ b/subsystems/win32/win32k/eng/pdevobj.c @@ -373,15 +373,12 @@ PDEVOBJ_bSwitchMode( 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 */ PDEVOBJ_vSwitchPdev(ppdev, ppdevTmp); - ASSERT(ppdev->pSurface->BitsLock); /* 8. Disable DirectDraw */ @@ -395,7 +392,6 @@ leave: EngReleaseSemaphore(ghsemPDEV); DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface); - ASSERT(ppdev->pSurface->BitsLock); return retval; } diff --git a/subsystems/win32/win32k/eng/stretchblt.c b/subsystems/win32/win32k/eng/stretchblt.c index 15aed608c71..ca4c22e0800 100644 --- a/subsystems/win32/win32k/eng/stretchblt.c +++ b/subsystems/win32/win32k/eng/stretchblt.c @@ -462,15 +462,10 @@ IntEngStretchBlt(SURFOBJ *psoDest, /* No success yet */ ret = FALSE; - SURFACE_LockBitmapBits(psurfDest); if (UsesSource) { psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj); - if (psoSource != psoDest) - { - SURFACE_LockBitmapBits(psurfSource); - } } /* Prepare color adjustment */ @@ -510,15 +505,6 @@ IntEngStretchBlt(SURFOBJ *psoDest, ROP); } - if (UsesSource) - { - if (psoSource != psoDest) - { - SURFACE_UnlockBitmapBits(psurfSource); - } - } - SURFACE_UnlockBitmapBits(psurfDest); - return ret; } diff --git a/subsystems/win32/win32k/eng/surface.c b/subsystems/win32/win32k/eng/surface.c index 5a85d1ac1b6..1ec760c28cd 100644 --- a/subsystems/win32/win32k/eng/surface.c +++ b/subsystems/win32/win32k/eng/surface.c @@ -136,42 +136,9 @@ SURFACE_Cleanup(PVOID ObjectBody) } } - if (NULL != psurf->BitsLock) - { - ExFreePoolWithTag(psurf->BitsLock, TAG_SURFACE); - psurf->BitsLock = NULL; - } - return TRUE; } -BOOL INTERNAL_CALL -SURFACE_InitBitsLock(PSURFACE psurf) -{ - psurf->BitsLock = ExAllocatePoolWithTag(NonPagedPool, - sizeof(FAST_MUTEX), - TAG_SURFACE); - if (NULL == psurf->BitsLock) - { - return FALSE; - } - - ExInitializeFastMutex(psurf->BitsLock); - - return TRUE; -} - -void INTERNAL_CALL -SURFACE_CleanupBitsLock(PSURFACE psurf) -{ - if (NULL != psurf->BitsLock) - { - ExFreePoolWithTag(psurf->BitsLock, TAG_SURFACE); - psurf->BitsLock = NULL; - } -} - - /* * @implemented */ @@ -348,12 +315,6 @@ IntCreateBitmap(IN SIZEL Size, } hbmp = psurf->BaseObject.hHmgr; - if (! SURFACE_InitBitsLock(psurf)) - { - SURFACE_UnlockSurface(psurf); - SURFACE_FreeSurfaceByHandle(hbmp); - return 0; - } pso = &psurf->SurfObj; if (Format == BMF_4RLE) @@ -436,7 +397,7 @@ IntCreateBitmap(IN SIZEL Size, psurf->flFlags = 0; psurf->dimension.cx = 0; psurf->dimension.cy = 0; - + psurf->hSecure = NULL; psurf->hDIBSection = NULL; @@ -526,7 +487,7 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, /* The height times the bytes for each scanline */ Size = BitmapInfo->Height * ScanLine; } - + if (Size) { /* Check for allocation flag */ @@ -567,15 +528,6 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, return NULL; } - /* Lock down the surface */ - if (!SURFACE_InitBitsLock(psurf)) - { - /* Bail out if that failed */ - SURFACE_UnlockSurface(psurf); - SURFACE_FreeSurfaceByHandle(psurf->BaseObject.hHmgr); - return NULL; - } - /* We should now have our surface object */ pso = &psurf->SurfObj; @@ -588,7 +540,7 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, LocalSize.cx = BitmapInfo->Width; pso->sizlBitmap = LocalSize; pso->iType = STYPE_BITMAP; - + /* Device-managed surface, no flags or dimension */ pso->dhsurf = 0; pso->dhpdev = NULL; @@ -599,10 +551,10 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, psurf->hSecure = NULL; psurf->hDIBSection = NULL; psurf->flHooks = 0; - + /* Set bits */ pso->pvBits = Bits; - + /* Check for bitmap type */ if (!Compressed) { @@ -626,7 +578,7 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, /* Compressed surfaces don't have scanlines! */ pso->lDelta = 0; pso->cjBits = BitmapInfo->Size; - + /* Check for JPG or PNG */ if ((BitmapInfo->Format != BMF_JPEG) && (BitmapInfo->Format != BMF_PNG)) { @@ -640,11 +592,11 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, ASSERT(FALSE); // ENGDDI shouldn't be creating PNGs for drivers ;-) } } - + /* Finally set the handle and uniq */ pso->hsurf = (HSURF)psurf->BaseObject.hHmgr; pso->iUniq = 0; - + /* Unlock and return the surface */ SURFACE_UnlockSurface(psurf); return pso; @@ -663,7 +615,7 @@ EngCreateBitmap(IN SIZEL Size, { SURFOBJ* Surface; DEVBITMAPINFO BitmapInfo; - + /* Capture the parameters */ BitmapInfo.Format = Format; BitmapInfo.Width = Size.cx; @@ -700,7 +652,7 @@ EngCreateBitmap(IN SIZEL Size, break; } } - + /* Now create the surface */ Surface = SURFMEM_bCreateDib(&BitmapInfo, Bits); if (!Surface) return 0; @@ -731,12 +683,6 @@ EngCreateDeviceSurface(IN DHSURF dhsurf, hsurf = psurf->BaseObject.hHmgr; GDIOBJ_SetOwnership(hsurf, NULL); - if (!SURFACE_InitBitsLock(psurf)) - { - SURFACE_UnlockSurface(psurf); - SURFACE_FreeSurfaceByHandle(hsurf); - return 0; - } pso = &psurf->SurfObj; pso->dhsurf = dhsurf; diff --git a/subsystems/win32/win32k/eng/transblt.c b/subsystems/win32/win32k/eng/transblt.c index 370d95b2734..c2cef09663a 100644 --- a/subsystems/win32/win32k/eng/transblt.c +++ b/subsystems/win32/win32k/eng/transblt.c @@ -284,12 +284,6 @@ IntEngTransparentBlt(SURFOBJ *psoDest, OutputRect = InputClippedRect; } - if(psoSource != psoDest) - { - SURFACE_LockBitmapBits(psurfSource); - } - SURFACE_LockBitmapBits(psurfDest); - if(psurfDest->flHooks & HOOK_TRANSPARENTBLT) { Ret = GDIDEVFUNCS(psoDest).TransparentBlt( @@ -305,12 +299,6 @@ IntEngTransparentBlt(SURFOBJ *psoDest, &OutputRect, &InputRect, iTransColor, Reserved); } - SURFACE_UnlockBitmapBits(psurfDest); - if(psoSource != psoDest) - { - SURFACE_UnlockBitmapBits(psurfSource); - } - return Ret; } diff --git a/subsystems/win32/win32k/include/surface.h b/subsystems/win32/win32k/include/surface.h index 3fe90540467..fb73ab632fb 100644 --- a/subsystems/win32/win32k/include/surface.h +++ b/subsystems/win32/win32k/include/surface.h @@ -26,7 +26,7 @@ typedef struct _SURFACE to get width/height of bitmap, use bitmap.bmWidth/bitmap.bmHeight for that */ - + HDC hDC; // Doc in "Undocumented Windows", page 546, seems to be supported with XP. ULONG cRef; // 0x064 HPALETTE hpalHint; @@ -37,8 +37,6 @@ typedef struct _SURFACE DWORD dwOffset; /* reactos specific */ - PFAST_MUTEX BitsLock; /* You need to hold this lock before you touch - the actual bits in the bitmap */ HPALETTE hDIBPalette; DWORD dsBitfields[3]; // hack, should probably use palette instead DWORD biClrUsed; @@ -64,12 +62,7 @@ typedef struct _SURFACE #define SURFACE_ShareUnlockSurface(pBMObj) \ GDIOBJ_ShareUnlockObjByPtr ((POBJ)pBMObj) -#define SURFACE_LockBitmapBits(pBMObj) ExEnterCriticalRegionAndAcquireFastMutexUnsafe((pBMObj)->BitsLock) -#define SURFACE_UnlockBitmapBits(pBMObj) ExReleaseFastMutexUnsafeAndLeaveCriticalRegion((pBMObj)->BitsLock) - BOOL INTERNAL_CALL SURFACE_Cleanup(PVOID ObjectBody); -BOOL INTERNAL_CALL SURFACE_InitBitsLock(SURFACE *pBMObj); -void INTERNAL_CALL SURFACE_CleanupBitsLock(SURFACE *pBMObj); #define GDIDEV(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev)) #define GDIDEVFUNCS(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))->DriverFunctions