Skip to content

Commit e99ab8c

Browse files
committed
[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
1 parent 216a2fe commit e99ab8c

File tree

4 files changed

+41
-35
lines changed

4 files changed

+41
-35
lines changed

reactos/subsystems/win32/win32k/include/tags.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
#pragma once
22

3-
#define TAG_STRING ' RTS' /* String */
4-
#define TAG_HOOK 'ohsU' /* Hook */
5-
#define TAG_MENUITEM 'emsU' /* Menu item */
6-
#define TAG_MSG 'GSEM' /* Message */
7-
#define TAG_USRMSG 'GSMU' /* User message */
8-
#define TAG_SBARINFO 'NIBS' /* Scrollbar info */
9-
#define TAG_TIMERBMP 'BMIT' /* Timers bitmap */
10-
#define TAG_WINSTA 'ATSW' /* Window station */
11-
#define TAG_FONT 'ETNF' /* Font entry */
12-
#define TAG_BEZIER 'RZEB' /* Bezier */
13-
#define TAG_SHAPE 'phSG' /* Shape */
14-
#define TAG_COLORMAP 'MLOC' /* Color map */
15-
#define TAG_GDIHNDTBLE 'bthG' /* GDI handle table */
16-
#define TAG_DIB ' BID' /* Dib */
3+
#define TAG_STRING ' RTS' /* String */
4+
#define TAG_HOOK 'ohsU' /* Hook */
5+
#define TAG_MENUITEM 'emsU' /* Menu item */
6+
#define TAG_MSG 'GSEM' /* Message */
7+
#define TAG_USRMSG 'GSMU' /* User message */
8+
#define TAG_SBARINFO 'NIBS' /* Scrollbar info */
9+
#define TAG_TIMERBMP 'BMIT' /* Timers bitmap */
10+
#define TAG_WINSTA 'ATSW' /* Window station */
11+
#define TAG_FONT 'ETNF' /* Font entry */
12+
#define TAG_BEZIER 'RZEB' /* Bezier */
13+
#define TAG_SHAPE 'phSG' /* Shape */
14+
#define TAG_COLORMAP 'MLOC' /* Color map */
15+
#define TAG_GDIHNDTBLE 'bthG' /* GDI handle table */
16+
#define TAG_DIB ' BID' /* Dib */
17+
#define TAG_INTERNAL_SYNC 'sync' /* Internal synchronization object. Waiting for a better suggestion than 'sync' */
1718

1819
/* GDI objects from the handle table */
1920
#define TAG_DC GDITAG_HMGR_LOOKASIDE_DC_TYPE

reactos/subsystems/win32/win32k/include/text.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,3 @@ DWORD FASTCALL GreGetGlyphIndicesW(HDC,LPWSTR,INT,LPWORD,DWORD,DWORD);
115115

116116
#define IntUnLockProcessPrivateFonts(W32Process) \
117117
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&W32Process->PrivateFontListLock)
118-
119-
#define IntLockGlobalFonts \
120-
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&FontListLock)
121-
122-
#define IntUnLockGlobalFonts \
123-
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&FontListLock)
124-
125-
#define IntLockFreeType \
126-
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&FreeTypeLock)
127-
128-
#define IntUnLockFreeType \
129-
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&FreeTypeLock)

reactos/subsystems/win32/win32k/ntuser/timer.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ static LONG TimeLast = 0;
2121
/* Windows 2000 has room for 32768 window-less timers */
2222
#define NUM_WINDOW_LESS_TIMERS 32768
2323

24-
static FAST_MUTEX Mutex;
24+
static PFAST_MUTEX Mutex;
2525
static RTL_BITMAP WindowLessTimersBitMap;
2626
static PVOID WindowLessTimersBitMapBuffer;
2727
static ULONG HintIndex = 1;
2828

2929
ERESOURCE TimerLock;
3030

3131
#define IntLockWindowlessTimerBitmap() \
32-
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&Mutex)
32+
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(Mutex)
3333

3434
#define IntUnlockWindowlessTimerBitmap() \
35-
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&Mutex)
35+
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(Mutex)
3636

3737
#define TimerEnterExclusive() \
3838
{ \
@@ -584,8 +584,10 @@ NTAPI
584584
InitTimerImpl(VOID)
585585
{
586586
ULONG BitmapBytes;
587-
588-
ExInitializeFastMutex(&Mutex);
587+
588+
/* Allocate FAST_MUTEX from non paged pool */
589+
Mutex = ExAllocatePoolWithTag(NonPagedPool, sizeof(FAST_MUTEX), TAG_INTERNAL_SYNC);
590+
ExInitializeFastMutex(Mutex);
589591

590592
BitmapBytes = ROUND_UP(NUM_WINDOW_LESS_TIMERS, sizeof(ULONG) * 8) / 8;
591593
WindowLessTimersBitMapBuffer = ExAllocatePoolWithTag(NonPagedPool, BitmapBytes, TAG_TIMERBMP);

reactos/subsystems/win32/win32k/objects/freetype.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,24 @@ typedef struct _FONT_ENTRY
3232

3333
/* The FreeType library is not thread safe, so we have
3434
to serialize access to it */
35-
static FAST_MUTEX FreeTypeLock;
35+
static PFAST_MUTEX FreeTypeLock;
3636

3737
static LIST_ENTRY FontListHead;
38-
static FAST_MUTEX FontListLock;
38+
static PFAST_MUTEX FontListLock;
3939
static BOOL RenderingEnabled = TRUE;
4040

41+
#define IntLockGlobalFonts \
42+
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(FontListLock)
43+
44+
#define IntUnLockGlobalFonts \
45+
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(FontListLock)
46+
47+
#define IntLockFreeType \
48+
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(FreeTypeLock)
49+
50+
#define IntUnLockFreeType \
51+
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(FreeTypeLock)
52+
4153
#define MAX_FONT_CACHE 256
4254

4355
typedef struct _FONT_CACHE_ENTRY
@@ -128,8 +140,11 @@ InitFontSupport(VOID)
128140
InitializeListHead(&FontListHead);
129141
InitializeListHead(&FontCacheListHead);
130142
FontCacheNumEntries = 0;
131-
ExInitializeFastMutex(&FontListLock);
132-
ExInitializeFastMutex(&FreeTypeLock);
143+
/* Fast Mutexes must be allocated from non paged pool */
144+
FontListLock = ExAllocatePoolWithTag(NonPagedPool, sizeof(FAST_MUTEX), TAG_INTERNAL_SYNC);
145+
ExInitializeFastMutex(FontListLock);
146+
FreeTypeLock = ExAllocatePoolWithTag(NonPagedPool, sizeof(FAST_MUTEX), TAG_INTERNAL_SYNC);
147+
ExInitializeFastMutex(FreeTypeLock);
133148

134149
ulError = FT_Init_FreeType(&library);
135150
if (ulError)

0 commit comments

Comments
 (0)