Author: jgardou
Date: Mon Apr 19 02:56:25 2010
New Revision: 46935
URL:
http://svn.reactos.org/svn/reactos?rev=46935&view=rev
Log:
[WIN32K]
- Finally get rid of SURFACE::BitsLock
Modified:
branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/copybits.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/gradient.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/lineto.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/paint.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/transblt.c
branches/reactos-yarotows/subsystems/win32/win32k/include/surface.h
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c [iso-8859-1] Mon
Apr 19 02:56:25 2010
@@ -305,11 +305,6 @@
return TRUE;
}
- SURFACE_LockBitmapBits(psurfDest);
-
- if (psoSource != psoDest)
- SURFACE_LockBitmapBits(psurfSource);
-
/* Call the driver's DrvAlphaBlend if available */
if (psurfDest->flHooks & HOOK_ALPHABLEND)
{
@@ -323,10 +318,6 @@
ret = EngAlphaBlend(psoDest, psoSource, ClipRegion, ColorTranslation,
DestRect, SourceRect, BlendObj);
}
-
- if (psoSource != psoDest)
- SURFACE_UnlockBitmapBits(psurfSource);
- SURFACE_UnlockBitmapBits(psurfDest);
return ret;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] Mon Apr 19
02:56:25 2010
@@ -582,19 +582,6 @@
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)
{
@@ -631,18 +618,6 @@
rop4);
// FIXME: cleanup temp surface!
-
- if (bRemoveMouse)
- {
- if (psoSrc)
- {
- if (psoSrc != psoTrg)
- {
- SURFACE_UnlockBitmapBits(psurfSrc);
- }
- }
- SURFACE_UnlockBitmapBits(psurfTrg);
- }
return bResult;
}
@@ -972,8 +947,6 @@
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 @@
DestRect, pptlMask, pptlMask, pbo, BrushOrigin,
R4_NOOP, FALSE);
- SURFACE_UnlockBitmapBits(psurfDest);
-
return ret;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/copybits.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/copybits.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/copybits.c [iso-8859-1] Mon Apr
19 02:56:25 2010
@@ -53,13 +53,7 @@
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 @@
}
cleanup:
- if (psoDest != psoSource)
- {
- SURFACE_UnlockBitmapBits(psurfDest);
- }
- SURFACE_UnlockBitmapBits(psurfSource);
-
return ret;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/gradient.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/gradient.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/gradient.c [iso-8859-1] Mon Apr
19 02:56:25 2010
@@ -548,7 +548,6 @@
psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
ASSERT(psurf);
- SURFACE_LockBitmapBits(psurf);
if(psurf->flHooks & HOOK_GRADIENTFILL)
{
Ret = GDIDEVFUNCS(psoDest).GradientFill(
@@ -560,7 +559,6 @@
Ret = EngGradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh,
prclExtents,
pptlDitherOrg, ulMode);
}
- SURFACE_UnlockBitmapBits(psurf);
return Ret;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/lineto.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/lineto.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/lineto.c [iso-8859-1] Mon Apr 19
02:56:25 2010
@@ -565,8 +565,6 @@
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 */
@@ -585,8 +583,6 @@
{
ret = EngLineTo(psoDest, ClipObj, pbo, x1, y1, x2, y2, RectBounds, Mix);
}
-
- SURFACE_UnlockBitmapBits(psurfDest);
return ret;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c [iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/mouse.c [iso-8859-1] Mon Apr 19
02:56:25 2010
@@ -540,14 +540,13 @@
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 @@
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 @@
ppdev->pfnMovePointer = EngMovePointer;
}
- SURFACE_UnlockBitmapBits(psurf);
+ EngReleaseSemaphore(ppdev->hsemDevLock);
return ulResult;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/paint.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/paint.c [iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/paint.c [iso-8859-1] Mon Apr 19
02:56:25 2010
@@ -32,7 +32,7 @@
#define NDEBUG
#include <debug.h>
-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 @@
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,20 +48,7 @@
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
@@ -87,7 +73,7 @@
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 @@
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 @@
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 );
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1] Mon Apr
19 02:56:25 2010
@@ -373,15 +373,12 @@
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 @@
EngReleaseSemaphore(ghsemPDEV);
DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
- ASSERT(ppdev->pSurface->BitsLock);
return retval;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c [iso-8859-1] Mon
Apr 19 02:56:25 2010
@@ -462,15 +462,10 @@
/* 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 */
@@ -509,15 +504,6 @@
pbo,
ROP);
}
-
- if (UsesSource)
- {
- if (psoSource != psoDest)
- {
- SURFACE_UnlockBitmapBits(psurfSource);
- }
- }
- SURFACE_UnlockBitmapBits(psurfDest);
return ret;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c [iso-8859-1] Mon Apr
19 02:56:25 2010
@@ -136,41 +136,8 @@
}
}
- 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 @@
}
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 @@
psurf->flFlags = 0;
psurf->dimension.cx = 0;
psurf->dimension.cy = 0;
-
+
psurf->hSecure = NULL;
psurf->hDIBSection = NULL;
@@ -526,7 +487,7 @@
/* The height times the bytes for each scanline */
Size = BitmapInfo->Height * ScanLine;
}
-
+
if (Size)
{
/* Check for allocation flag */
@@ -564,15 +525,6 @@
else
EngFreeMem(Bits);
}
- 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;
}
@@ -588,7 +540,7 @@
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 @@
psurf->hSecure = NULL;
psurf->hDIBSection = NULL;
psurf->flHooks = 0;
-
+
/* Set bits */
pso->pvBits = Bits;
-
+
/* Check for bitmap type */
if (!Compressed)
{
@@ -626,7 +578,7 @@
/* 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 @@
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 @@
{
SURFOBJ* Surface;
DEVBITMAPINFO BitmapInfo;
-
+
/* Capture the parameters */
BitmapInfo.Format = Format;
BitmapInfo.Width = Size.cx;
@@ -700,7 +652,7 @@
break;
}
}
-
+
/* Now create the surface */
Surface = SURFMEM_bCreateDib(&BitmapInfo, Bits);
if (!Surface) return 0;
@@ -731,12 +683,6 @@
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;
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/transblt.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/transblt.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/transblt.c [iso-8859-1] Mon Apr
19 02:56:25 2010
@@ -284,12 +284,6 @@
OutputRect = InputClippedRect;
}
- if(psoSource != psoDest)
- {
- SURFACE_LockBitmapBits(psurfSource);
- }
- SURFACE_LockBitmapBits(psurfDest);
-
if(psurfDest->flHooks & HOOK_TRANSPARENTBLT)
{
Ret = GDIDEVFUNCS(psoDest).TransparentBlt(
@@ -305,12 +299,6 @@
&OutputRect, &InputRect, iTransColor, Reserved);
}
- SURFACE_UnlockBitmapBits(psurfDest);
- if(psoSource != psoDest)
- {
- SURFACE_UnlockBitmapBits(psurfSource);
- }
-
return Ret;
}
Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/surface.h
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/include/surface.h [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/include/surface.h [iso-8859-1] Mon
Apr 19 02:56:25 2010
@@ -26,7 +26,7 @@
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 @@
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 @@
#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