[WIN32K]
authorJérôme Gardou <jerome.gardou@reactos.org>
Tue, 21 Feb 2012 18:00:50 +0000 (18:00 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Tue, 21 Feb 2012 18:00:50 +0000 (18:00 +0000)
 - 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

reactos/subsystems/win32/win32k/include/tags.h
reactos/subsystems/win32/win32k/include/text.h
reactos/subsystems/win32/win32k/ntuser/timer.c
reactos/subsystems/win32/win32k/objects/freetype.c

index 310050d..060d880 100644 (file)
@@ -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
index dfd9065..fe6379e 100644 (file)
@@ -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)
index e781aca..2172476 100644 (file)
@@ -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);
index bee889d..f925e70 100644 (file)
@@ -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)