From e99ab8c0fcf8046e700217964776f6055230035f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Tue, 21 Feb 2012 18:00:50 +0000 Subject: [PATCH] [WIN32K] - allocate FAST_MUTEX objects from non paged pool. This should ix a bunch of weird testbot failures. Any suggestion on the TAG is welcome svn path=/trunk/; revision=55784 --- .../subsystems/win32/win32k/include/tags.h | 29 ++++++++++--------- .../subsystems/win32/win32k/include/text.h | 12 -------- .../subsystems/win32/win32k/ntuser/timer.c | 12 ++++---- .../win32/win32k/objects/freetype.c | 23 ++++++++++++--- 4 files changed, 41 insertions(+), 35 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/tags.h b/reactos/subsystems/win32/win32k/include/tags.h index 310050dfd42..060d880f256 100644 --- a/reactos/subsystems/win32/win32k/include/tags.h +++ b/reactos/subsystems/win32/win32k/include/tags.h @@ -1,19 +1,20 @@ #pragma once -#define TAG_STRING ' RTS' /* String */ -#define TAG_HOOK 'ohsU' /* Hook */ -#define TAG_MENUITEM 'emsU' /* Menu item */ -#define TAG_MSG 'GSEM' /* Message */ -#define TAG_USRMSG 'GSMU' /* User message */ -#define TAG_SBARINFO 'NIBS' /* Scrollbar info */ -#define TAG_TIMERBMP 'BMIT' /* Timers bitmap */ -#define TAG_WINSTA 'ATSW' /* Window station */ -#define TAG_FONT 'ETNF' /* Font entry */ -#define TAG_BEZIER 'RZEB' /* Bezier */ -#define TAG_SHAPE 'phSG' /* Shape */ -#define TAG_COLORMAP 'MLOC' /* Color map */ -#define TAG_GDIHNDTBLE 'bthG' /* GDI handle table */ -#define TAG_DIB ' BID' /* Dib */ +#define TAG_STRING ' RTS' /* String */ +#define TAG_HOOK 'ohsU' /* Hook */ +#define TAG_MENUITEM 'emsU' /* Menu item */ +#define TAG_MSG 'GSEM' /* Message */ +#define TAG_USRMSG 'GSMU' /* User message */ +#define TAG_SBARINFO 'NIBS' /* Scrollbar info */ +#define TAG_TIMERBMP 'BMIT' /* Timers bitmap */ +#define TAG_WINSTA 'ATSW' /* Window station */ +#define TAG_FONT 'ETNF' /* Font entry */ +#define TAG_BEZIER 'RZEB' /* Bezier */ +#define TAG_SHAPE 'phSG' /* Shape */ +#define TAG_COLORMAP 'MLOC' /* Color map */ +#define TAG_GDIHNDTBLE 'bthG' /* GDI handle table */ +#define TAG_DIB ' BID' /* Dib */ +#define TAG_INTERNAL_SYNC 'sync' /* Internal synchronization object. Waiting for a better suggestion than 'sync' */ /* GDI objects from the handle table */ #define TAG_DC GDITAG_HMGR_LOOKASIDE_DC_TYPE diff --git a/reactos/subsystems/win32/win32k/include/text.h b/reactos/subsystems/win32/win32k/include/text.h index dfd9065df42..fe6379e6fc1 100644 --- a/reactos/subsystems/win32/win32k/include/text.h +++ b/reactos/subsystems/win32/win32k/include/text.h @@ -115,15 +115,3 @@ DWORD FASTCALL GreGetGlyphIndicesW(HDC,LPWSTR,INT,LPWORD,DWORD,DWORD); #define IntUnLockProcessPrivateFonts(W32Process) \ ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&W32Process->PrivateFontListLock) - -#define IntLockGlobalFonts \ - ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&FontListLock) - -#define IntUnLockGlobalFonts \ - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&FontListLock) - -#define IntLockFreeType \ - ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&FreeTypeLock) - -#define IntUnLockFreeType \ - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&FreeTypeLock) diff --git a/reactos/subsystems/win32/win32k/ntuser/timer.c b/reactos/subsystems/win32/win32k/ntuser/timer.c index e781aca29db..2172476d2d1 100644 --- a/reactos/subsystems/win32/win32k/ntuser/timer.c +++ b/reactos/subsystems/win32/win32k/ntuser/timer.c @@ -21,7 +21,7 @@ static LONG TimeLast = 0; /* Windows 2000 has room for 32768 window-less timers */ #define NUM_WINDOW_LESS_TIMERS 32768 -static FAST_MUTEX Mutex; +static PFAST_MUTEX Mutex; static RTL_BITMAP WindowLessTimersBitMap; static PVOID WindowLessTimersBitMapBuffer; static ULONG HintIndex = 1; @@ -29,10 +29,10 @@ static ULONG HintIndex = 1; ERESOURCE TimerLock; #define IntLockWindowlessTimerBitmap() \ - ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&Mutex) + ExEnterCriticalRegionAndAcquireFastMutexUnsafe(Mutex) #define IntUnlockWindowlessTimerBitmap() \ - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&Mutex) + ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(Mutex) #define TimerEnterExclusive() \ { \ @@ -584,8 +584,10 @@ NTAPI InitTimerImpl(VOID) { ULONG BitmapBytes; - - ExInitializeFastMutex(&Mutex); + + /* Allocate FAST_MUTEX from non paged pool */ + Mutex = ExAllocatePoolWithTag(NonPagedPool, sizeof(FAST_MUTEX), TAG_INTERNAL_SYNC); + ExInitializeFastMutex(Mutex); BitmapBytes = ROUND_UP(NUM_WINDOW_LESS_TIMERS, sizeof(ULONG) * 8) / 8; WindowLessTimersBitMapBuffer = ExAllocatePoolWithTag(NonPagedPool, BitmapBytes, TAG_TIMERBMP); diff --git a/reactos/subsystems/win32/win32k/objects/freetype.c b/reactos/subsystems/win32/win32k/objects/freetype.c index bee889d4339..f925e7057f0 100644 --- a/reactos/subsystems/win32/win32k/objects/freetype.c +++ b/reactos/subsystems/win32/win32k/objects/freetype.c @@ -32,12 +32,24 @@ typedef struct _FONT_ENTRY /* The FreeType library is not thread safe, so we have to serialize access to it */ -static FAST_MUTEX FreeTypeLock; +static PFAST_MUTEX FreeTypeLock; static LIST_ENTRY FontListHead; -static FAST_MUTEX FontListLock; +static PFAST_MUTEX FontListLock; static BOOL RenderingEnabled = TRUE; +#define IntLockGlobalFonts \ + ExEnterCriticalRegionAndAcquireFastMutexUnsafe(FontListLock) + +#define IntUnLockGlobalFonts \ + ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(FontListLock) + +#define IntLockFreeType \ + ExEnterCriticalRegionAndAcquireFastMutexUnsafe(FreeTypeLock) + +#define IntUnLockFreeType \ + ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(FreeTypeLock) + #define MAX_FONT_CACHE 256 typedef struct _FONT_CACHE_ENTRY @@ -128,8 +140,11 @@ InitFontSupport(VOID) InitializeListHead(&FontListHead); InitializeListHead(&FontCacheListHead); FontCacheNumEntries = 0; - ExInitializeFastMutex(&FontListLock); - ExInitializeFastMutex(&FreeTypeLock); + /* Fast Mutexes must be allocated from non paged pool */ + FontListLock = ExAllocatePoolWithTag(NonPagedPool, sizeof(FAST_MUTEX), TAG_INTERNAL_SYNC); + ExInitializeFastMutex(FontListLock); + FreeTypeLock = ExAllocatePoolWithTag(NonPagedPool, sizeof(FAST_MUTEX), TAG_INTERNAL_SYNC); + ExInitializeFastMutex(FreeTypeLock); ulError = FT_Init_FreeType(&library); if (ulError) -- 2.17.1