Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c	(revision 33474)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c	(revision 33475)
@@ -70,4 +70,23 @@
 packSPUCleanup(void)
 {
+    int i;
+#ifdef CHROMIUM_THREADSAFE
+    crLockMutex(&_PackMutex);
+#endif
+    for (i=0; i<pack_spu.numThreads; ++i)
+    {
+        if (pack_spu.thread[i].packer)
+        {
+            crPackDeleteContext(pack_spu.thread[i].packer);
+        }
+    }
+
+    crFreeTSD(&_PackerTSD);
+    crFreeTSD(&_PackTSD);
+    
+#ifdef CHROMIUM_THREADSAFE
+    crUnlockMutex(&_PackMutex);
+    crFreeMutex(&_PackMutex);
+#endif
     return 1;
 }
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c	(revision 33474)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c	(revision 33475)
@@ -120,8 +120,13 @@
     CRPackBuffer *buf;
 
+#ifdef CHROMIUM_THREADSAFE
     crLockMutex(&_PackMutex);
+#endif
 
     /* we should _always_ pass a valid <arg> value */
     CRASSERT(thread);
+#ifdef CHROMIUM_THREADSAFE
+    CR_LOCK_PACKER_CONTEXT(thread->packer);
+#endif
     ctx = thread->currentContext;
     buf = &(thread->buffer);
@@ -145,5 +150,8 @@
            crPackSetBuffer( thread->packer, buf );
            crPackResetPointers(thread->packer);
+#ifdef CHROMIUM_THREADSAFE
+           CR_UNLOCK_PACKER_CONTEXT(thread->packer);
            crUnlockMutex(&_PackMutex);
+#endif
            return;
     }
@@ -173,5 +181,8 @@
     crPackResetPointers(thread->packer);
 
+#ifdef CHROMIUM_THREADSAFE
+    CR_UNLOCK_PACKER_CONTEXT(thread->packer);
     crUnlockMutex(&_PackMutex);
+#endif
 }
 
Index: trunk/src/VBox/GuestHost/OpenGL/include/cr_pack.h
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/include/cr_pack.h	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/include/cr_pack.h	(revision 33475)
@@ -67,4 +67,5 @@
     int swapping;
     CRPackBuffer *currentBuffer;
+    CRmutex mutex;
     char *file;  /**< for debugging only */
     int line;    /**< for debugging only */
@@ -73,4 +74,5 @@
 
 extern DECLEXPORT(CRPackContext *) crPackNewContext(int swapping);
+extern DECLEXPORT(void) crPackDeleteContext(CRPackContext *pc);
 extern DECLEXPORT(void) crPackSetContext( CRPackContext *pc );
 extern DECLEXPORT(CRPackContext *) crPackGetContext( void );
@@ -138,8 +140,12 @@
 #ifdef CHROMIUM_THREADSAFE
 extern CRtsd _PackerTSD;
-#define GET_PACKER_CONTEXT(C) CRPackContext *C = (CRPackContext *) crGetTSD(&_PackerTSD)
+#define CR_GET_PACKER_CONTEXT(C) CRPackContext *C = (CRPackContext *) crGetTSD(&_PackerTSD)
+#define CR_LOCK_PACKER_CONTEXT(PC) crLockMutex(&((PC)->mutex))
+#define CR_UNLOCK_PACKER_CONTEXT(PC) crUnlockMutex(&((PC)->mutex))
 #else
 extern DLLDATA(CRPackContext) cr_packer_globals;
-#define GET_PACKER_CONTEXT(C) CRPackContext *C = &cr_packer_globals
+#define CR_GET_PACKER_CONTEXT(C) CRPackContext *C = &cr_packer_globals
+#define CR_LOCK_PACKER_CONTEXT(PC)
+#define CR_UNLOCK_PACKER_CONTEXT(PC)
 #endif
 
@@ -189,14 +195,15 @@
  * Only flush if buffer is full.
  */
-#define GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, len )   \
-  do {                              \
-    THREADASSERT( pc );                     \
-    CRASSERT( pc->currentBuffer );              \
-    if ( !crPackCanHoldOpcode( pc, 1, (len) ) ) {       \
-      pc->Flush( pc->flush_arg );               \
-      CRASSERT(crPackCanHoldOpcode( pc, 1, (len) ) );       \
-    }                               \
-    data_ptr = pc->buffer.data_current;             \
-    pc->buffer.data_current += (len);               \
+#define CR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH(pc, len, lock)    \
+  do {                                                              \
+    THREADASSERT( pc );                                             \
+    if (lock) CR_LOCK_PACKER_CONTEXT(pc);                           \
+    CRASSERT( pc->currentBuffer );                                  \
+    if ( !crPackCanHoldOpcode( pc, 1, (len) ) ) {                   \
+      pc->Flush( pc->flush_arg );                                   \
+      CRASSERT(crPackCanHoldOpcode( pc, 1, (len) ) );               \
+    }                                                               \
+    data_ptr = pc->buffer.data_current;                             \
+    pc->buffer.data_current += (len);                               \
   } while (0)
 
@@ -206,12 +213,26 @@
  * no longer inside glBegin/glEnd.
  */
-#define GET_BUFFERED_POINTER( pc, len )                 \
-  do {                                  \
-    CRASSERT( pc->currentBuffer );                  \
+#define CR_GET_BUFFERED_POINTER( pc, len )                          \
+  do {                                                              \
+    CR_LOCK_PACKER_CONTEXT(pc);                                     \
+    CRASSERT( pc->currentBuffer );                                  \
     if ( pc->buffer.holds_BeginEnd && !pc->buffer.in_BeginEnd ) {   \
-      pc->Flush( pc->flush_arg );                   \
-      pc->buffer.holds_BeginEnd = 0;                    \
-    }                                   \
-    GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, len );          \
+      pc->Flush( pc->flush_arg );                                   \
+      pc->buffer.holds_BeginEnd = 0;                                \
+    }                                                               \
+    CR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, len, GL_FALSE ); \
+  } while (0)
+
+/**
+ * As above, but without lock.
+ */
+#define CR_GET_BUFFERED_POINTER_NOLOCK( pc, len )                   \
+  do {                                                              \
+    CRASSERT( pc->currentBuffer );                                  \
+    if ( pc->buffer.holds_BeginEnd && !pc->buffer.in_BeginEnd ) {   \
+      pc->Flush( pc->flush_arg );                                   \
+      pc->buffer.holds_BeginEnd = 0;                                \
+    }                                                               \
+    CR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, len, GL_FALSE ); \
   } while (0)
 
@@ -220,14 +241,15 @@
  * As above, but for vertex data between glBegin/End (counts vertices).
  */
-#define GET_BUFFERED_COUNT_POINTER( pc, len )       \
-  do {                          \
-    CRASSERT( pc->currentBuffer );          \
-    if ( !crPackCanHoldOpcode( pc, 1, (len) ) ) {   \
-      pc->Flush( pc->flush_arg );           \
+#define CR_GET_BUFFERED_COUNT_POINTER( pc, len )        \
+  do {                                                  \
+    CR_LOCK_PACKER_CONTEXT(pc);                         \
+    CRASSERT( pc->currentBuffer );                      \
+    if ( !crPackCanHoldOpcode( pc, 1, (len) ) ) {       \
+      pc->Flush( pc->flush_arg );                       \
       CRASSERT( crPackCanHoldOpcode( pc, 1, (len) ) );  \
-    }                           \
-    data_ptr = pc->buffer.data_current;         \
-    pc->current.vtx_count++;                \
-    pc->buffer.data_current += (len);           \
+    }                                                   \
+    data_ptr = pc->buffer.data_current;                 \
+    pc->current.vtx_count++;                            \
+    pc->buffer.data_current += (len);                   \
   } while (0)
 
@@ -237,6 +259,6 @@
  * as glFinish().
  */
-#define GET_BUFFERED_POINTER_NO_ARGS( pc ) \
-  GET_BUFFERED_POINTER( pc, 4 );  \
+#define CR_GET_BUFFERED_POINTER_NO_ARGS( pc )  \
+  CR_GET_BUFFERED_POINTER( pc, 4 );            \
   WRITE_DATA( 0, GLuint, 0xdeadbeef )
 
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_arrays.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_arrays.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_arrays.c	(revision 33475)
@@ -30,8 +30,8 @@
      * Look at glgets regarding max vertices in arrays.
 	 */
-	GET_PACKER_CONTEXT(pc);
-	unsigned char *data_ptr;
-	int packet_length = 24;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_PACKER_CONTEXT(pc);
+	unsigned char *data_ptr;
+	int packet_length = 24;
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_VERTEXPOINTER_EXTEND_OPCODE );
@@ -41,12 +41,13 @@
 	WRITE_DATA( 20, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
 {
-	GET_PACKER_CONTEXT(pc);
-	unsigned char *data_ptr;
-	int packet_length = 24;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_PACKER_CONTEXT(pc);
+	unsigned char *data_ptr;
+	int packet_length = 24;
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_COLORPOINTER_EXTEND_OPCODE );
@@ -56,12 +57,13 @@
 	WRITE_DATA( 20, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackNormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer )
 {
-	GET_PACKER_CONTEXT(pc);
-	unsigned char *data_ptr;
-	int packet_length = 20;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_PACKER_CONTEXT(pc);
+	unsigned char *data_ptr;
+	int packet_length = 20;
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_NORMALPOINTER_EXTEND_OPCODE );
@@ -70,12 +72,13 @@
 	WRITE_DATA( 16, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
 {
-	GET_PACKER_CONTEXT(pc);
-	unsigned char *data_ptr;
-	int packet_length = 24;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_PACKER_CONTEXT(pc);
+	unsigned char *data_ptr;
+	int packet_length = 24;
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_TEXCOORDPOINTER_EXTEND_OPCODE );
@@ -85,12 +88,13 @@
 	WRITE_DATA( 20, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackEdgeFlagPointer( GLsizei stride, const GLvoid *pointer )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
 	int packet_length = 16;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_EDGEFLAGPOINTER_EXTEND_OPCODE );
@@ -98,12 +102,13 @@
 	WRITE_DATA( 12, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackIndexPointer( GLenum type, GLsizei stride, const GLvoid *pointer )
 {
-	GET_PACKER_CONTEXT(pc);
-	unsigned char *data_ptr;
-	int packet_length = 20;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_PACKER_CONTEXT(pc);
+	unsigned char *data_ptr;
+	int packet_length = 20;
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_INDEXPOINTER_EXTEND_OPCODE );
@@ -112,12 +117,13 @@
 	WRITE_DATA( 16, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackSecondaryColorPointerEXT( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
 {
-	GET_PACKER_CONTEXT(pc);
-	unsigned char *data_ptr;
-	int packet_length = 24;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_PACKER_CONTEXT(pc);
+	unsigned char *data_ptr;
+	int packet_length = 24;
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_SECONDARYCOLORPOINTEREXT_EXTEND_OPCODE );
@@ -127,12 +133,13 @@
 	WRITE_DATA( 20, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackFogCoordPointerEXT( GLenum type, GLsizei stride, const GLvoid * pointer )
 {
-	GET_PACKER_CONTEXT(pc);
-	unsigned char *data_ptr;
-	int packet_length = 20;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_PACKER_CONTEXT(pc);
+	unsigned char *data_ptr;
+	int packet_length = 20;
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_FOGCOORDPOINTEREXT_EXTEND_OPCODE );
@@ -141,12 +148,13 @@
 	WRITE_DATA( 16, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttribPointerARB( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
 	int packet_length = 32;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_VERTEXATTRIBPOINTERARB_EXTEND_OPCODE );
@@ -158,12 +166,13 @@
 	WRITE_DATA( 28, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttribPointerNV( GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
 	int packet_length = 28;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_VERTEXATTRIBPOINTERNV_EXTEND_OPCODE );
@@ -174,12 +183,13 @@
 	WRITE_DATA( 24, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer )
 {
-	GET_PACKER_CONTEXT(pc);
-	unsigned char *data_ptr;
-	int packet_length = 20;
-	GET_BUFFERED_POINTER( pc, packet_length );
+	CR_GET_PACKER_CONTEXT(pc);
+	unsigned char *data_ptr;
+	int packet_length = 20;
+	CR_GET_BUFFERED_POINTER( pc, packet_length );
 	WRITE_DATA( 0, GLint, packet_length );
 	WRITE_DATA( 4, GLenum, CR_INTERLEAVEDARRAYS_EXTEND_OPCODE );
@@ -188,4 +198,5 @@
 	WRITE_DATA( 16, GLuint, (GLuint) ((uintptr_t) pointer) );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_beginend.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_beginend.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_beginend.c	(revision 33475)
@@ -10,5 +10,5 @@
 void PACK_APIENTRY crPackBegin( GLenum mode )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
@@ -20,5 +20,5 @@
         pc->buffer.holds_BeginEnd = 1;
     }
-    GET_BUFFERED_POINTER( pc, 4 );
+    CR_GET_BUFFERED_POINTER( pc, 4 );
     pc->current.begin_data = data_ptr;
     pc->current.begin_op = pc->buffer.opcode_current;
@@ -26,9 +26,10 @@
     WRITE_DATA( 0, GLenum, mode );
     WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackBeginSWAP( GLenum mode )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
@@ -40,5 +41,5 @@
         pc->buffer.holds_BeginEnd = 1;
     }
-    GET_BUFFERED_POINTER( pc, 4 );
+    CR_GET_BUFFERED_POINTER( pc, 4 );
     pc->current.begin_data = data_ptr;
     pc->current.begin_op = pc->buffer.opcode_current;
@@ -46,24 +47,27 @@
     WRITE_DATA( 0, GLenum, SWAP32(mode) );
     WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackEnd( void )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
-    GET_BUFFERED_POINTER_NO_ARGS( pc );
+    CR_GET_BUFFERED_POINTER_NO_ARGS( pc );
     WRITE_OPCODE( pc, CR_END_OPCODE );
     pc->buffer.in_BeginEnd = 0;
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackEndSWAP( void )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
-    GET_BUFFERED_POINTER_NO_ARGS( pc );
+    CR_GET_BUFFERED_POINTER_NO_ARGS( pc );
     WRITE_OPCODE( pc, CR_END_OPCODE );
     pc->buffer.in_BeginEnd = 0;
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_bounds.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_bounds.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_bounds.c	(revision 33475)
@@ -11,11 +11,16 @@
 void PACK_APIENTRY crPackBoundsInfoCR( const CRrecti *bounds, const GLbyte *payload, GLint len, GLint num_opcodes )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     /* Don't get the buffered_ptr here because we've already 
      * verified that there's enough space for everything. */
 
-    unsigned char *data_ptr = pc->buffer.data_current;
-    int len_aligned     = ( len + 0x3 ) & ~0x3;
-    int total_len = 24 + len_aligned;
+    unsigned char *data_ptr;
+    int len_aligned, total_len;
+
+    CR_LOCK_PACKER_CONTEXT(pc);
+
+    data_ptr = pc->buffer.data_current;
+    len_aligned     = ( len + 0x3 ) & ~0x3;
+    total_len = 24 + len_aligned;
 
     WRITE_DATA( 0, int, total_len );
@@ -42,3 +47,4 @@
     WRITE_OPCODE( pc, CR_BOUNDSINFOCR_OPCODE );
     pc->buffer.data_current += 24 + len_aligned;
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_buffer.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_buffer.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_buffer.c	(revision 33475)
@@ -259,6 +259,10 @@
 	const int num_data = crPackNumData(src);
 	const int num_opcode = crPackNumOpcodes(src);
-	GET_PACKER_CONTEXT(pc);
-	return crPackCanHoldOpcode( pc, num_opcode, num_data );
+    int res;
+	CR_GET_PACKER_CONTEXT(pc);
+    CR_LOCK_PACKER_CONTEXT(pc);
+	res = crPackCanHoldOpcode( pc, num_opcode, num_data );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
+    return res;
 }
 
@@ -267,5 +271,5 @@
 {
 	const int len_aligned = (src->data_current - src->opcode_current - 1 + 3) & ~3;
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	/* 24 is the size of the bounds-info packet... */
 	return crPackCanHoldOpcode( pc, 1, len_aligned + 24 );
@@ -274,5 +278,5 @@
 void crPackAppendBuffer( const CRPackBuffer *src )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	const int num_data = crPackNumData(src);
 	const int num_opcode = crPackNumOpcodes(src);
@@ -280,4 +284,6 @@
 	CRASSERT(num_data >= 0);
 	CRASSERT(num_opcode >= 0);
+
+    CR_LOCK_PACKER_CONTEXT(pc);
 
 	/* don't append onto ourself! */
@@ -290,8 +296,12 @@
 		{
 			crWarning( "crPackAppendBuffer: overflowed the destination!" );
+            CR_UNLOCK_PACKER_CONTEXT(pc);
 			return;
 		}
 		else
+        {
 			crError( "crPackAppendBuffer: overflowed the destination!" );
+            CR_UNLOCK_PACKER_CONTEXT(pc);
+        }
 	}
 
@@ -308,4 +318,5 @@
 	pc->buffer.in_BeginEnd = src->in_BeginEnd;
 	pc->buffer.holds_List |= src->holds_List;
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -314,5 +325,5 @@
 crPackAppendBoundedBuffer( const CRPackBuffer *src, const CRrecti *bounds )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	const GLbyte *payload = (const GLbyte *) src->opcode_current + 1;
 	const int num_opcodes = crPackNumOpcodes(src);
@@ -320,4 +331,5 @@
 
 	CRASSERT(pc);
+    CR_LOCK_PACKER_CONTEXT(pc);
 	CRASSERT(pc->currentBuffer);
 	CRASSERT(pc->currentBuffer != src);
@@ -332,8 +344,12 @@
 		{
 			crWarning( "crPackAppendBoundedBuffer: overflowed the destination!" );
+            CR_UNLOCK_PACKER_CONTEXT(pc);
 			return;
 		}
 		else
+        {
 			crError( "crPackAppendBoundedBuffer: overflowed the destination!" );
+            CR_UNLOCK_PACKER_CONTEXT(pc);
+        }
 	}
 
@@ -346,4 +362,5 @@
 	pc->buffer.in_BeginEnd = src->in_BeginEnd;
 	pc->buffer.holds_List |= src->holds_List;
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -361,14 +378,16 @@
 void *crPackAlloc( unsigned int size )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
 
 	/* include space for the length and make the payload word-aligned */
 	size = ( size + sizeof(unsigned int) + 0x3 ) & ~0x3;
+
+    CR_LOCK_PACKER_CONTEXT(pc);
 
 	if ( crPackCanHoldOpcode( pc, 1, size ) )
 	{
 		/* we can just put it in the current buffer */
-		GET_BUFFERED_POINTER(pc, size );  /* NOTE: this sets data_ptr */
+		CR_GET_BUFFERED_POINTER_NOLOCK(pc, size );  /* NOTE: this sets data_ptr */
 	}
 	else 
@@ -378,5 +397,5 @@
 		if ( crPackCanHoldOpcode( pc, 1, size ) )
 		{
-			GET_BUFFERED_POINTER(pc, size );  /* NOTE: this sets data_ptr */
+			CR_GET_BUFFERED_POINTER_NOLOCK(pc, size );  /* NOTE: this sets data_ptr */
 		}
 		else
@@ -445,5 +464,5 @@
 void crHugePacket( CROpcode opcode, void *packet )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 #ifndef CHROMIUM_THREADSAFE
 	CRASSERT(sanityCheckPointer == packet);
@@ -459,7 +478,13 @@
 void crPackFree( void *packet )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
+    
 	if ( IS_BUFFERED( packet ) )
+    {
+        CR_UNLOCK_PACKER_CONTEXT(pc);
 		return;
+    }
+
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 	
 	/* the pointer passed in doesn't include the space for the single
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_bufferobject.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_bufferobject.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_bufferobject.c	(revision 33475)
@@ -88,8 +88,8 @@
 crPackGetBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data, int * writeback )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
 	(void) pc;
-	GET_BUFFERED_POINTER( pc, 36 );
+	CR_GET_BUFFERED_POINTER( pc, 36 );
 	WRITE_DATA( 0, GLint, 36 );
 	WRITE_DATA( 4, GLenum, CR_GETBUFFERSUBDATAARB_EXTEND_OPCODE );
@@ -100,4 +100,5 @@
 	WRITE_NETWORK_POINTER( 28, (void *) writeback );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_clipplane.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_clipplane.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_clipplane.c	(revision 33475)
@@ -10,8 +10,8 @@
 void PACK_APIENTRY crPackClipPlane( GLenum plane, const GLdouble *equation )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof( plane ) + 4*sizeof(*equation);
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, GLenum, plane );
     WRITE_DOUBLE( 4, equation[0] );
@@ -20,3 +20,4 @@
     WRITE_DOUBLE( 28, equation[3] );
     WRITE_OPCODE( pc, CR_CLIPPLANE_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_context.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_context.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_context.c	(revision 33475)
@@ -22,5 +22,5 @@
 {
 	char displayName[DISPLAY_NAME_LEN];
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
         int len = DISPLAY_NAME_LEN + 32;
@@ -37,5 +37,5 @@
 	}
 
-	GET_BUFFERED_POINTER(pc, len);
+	CR_GET_BUFFERED_POINTER(pc, len);
 	WRITE_DATA( 0, GLint, len );
 	WRITE_DATA( 4, GLenum, CR_CREATECONTEXT_EXTEND_OPCODE );
@@ -46,4 +46,5 @@
 	WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 24, (void *) writeback );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -53,5 +54,5 @@
 {
 	char displayName[DISPLAY_NAME_LEN];
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
         int len = DISPLAY_NAME_LEN + 32;
@@ -68,5 +69,5 @@
 	}
 
-	GET_BUFFERED_POINTER(pc, len);
+	CR_GET_BUFFERED_POINTER(pc, len);
 	WRITE_DATA( 0, GLint, SWAP32(len) );
 	WRITE_DATA( 4, GLenum, SWAP32(CR_CREATECONTEXT_EXTEND_OPCODE) );
@@ -77,4 +78,5 @@
 	WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 24, (void *) writeback );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -83,5 +85,5 @@
 {
 	char displayName[DISPLAY_NAME_LEN];
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
 
@@ -97,5 +99,5 @@
 	}
 
-	GET_BUFFERED_POINTER(pc, DISPLAY_NAME_LEN + 28 );
+	CR_GET_BUFFERED_POINTER(pc, DISPLAY_NAME_LEN + 28 );
 	WRITE_DATA( 0, GLint, 28 );
 	WRITE_DATA( 4, GLenum, CR_WINDOWCREATE_EXTEND_OPCODE );
@@ -105,4 +107,5 @@
 	WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 20, (void *) writeback );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -110,5 +113,5 @@
 {
 	char displayName[DISPLAY_NAME_LEN];
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
 
@@ -124,5 +127,5 @@
 	}
 
-	GET_BUFFERED_POINTER(pc, DISPLAY_NAME_LEN + 28 );
+	CR_GET_BUFFERED_POINTER(pc, DISPLAY_NAME_LEN + 28 );
 	WRITE_DATA( 0, GLint, SWAP32(28) );
 	WRITE_DATA( 4, GLenum, SWAP32(CR_WINDOWCREATE_EXTEND_OPCODE) );
@@ -132,3 +135,4 @@
 	WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 20, (void *) writeback );
 	WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_current.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_current.py	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_current.py	(revision 33475)
@@ -25,5 +25,5 @@
 void crPackOffsetCurrentPointers( int offset )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	GLnormal_p		*normal		= &(pc->current.c.normal);
 	GLcolor_p		*color		= &(pc->current.c.color);
@@ -60,5 +60,5 @@
 void crPackNullCurrentPointers( void )
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	CRCurrentStateAttr	*c		= &(pc->current.c);
 """
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_error.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_error.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_error.c	(revision 33475)
@@ -27,5 +27,5 @@
 void __PackError( int line, const char *file, GLenum error, const char *info)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
 
     if (pc->Error)
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_fog.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_fog.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_fog.c	(revision 33475)
@@ -10,5 +10,5 @@
 static GLboolean __handleFogData( GLenum pname, const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     int params_length = 0;
     int packet_length = sizeof( int ) + sizeof( pname );
@@ -39,5 +39,5 @@
     packet_length += params_length;
 
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, int, packet_length );
     WRITE_DATA( 4, GLenum, pname );
@@ -54,14 +54,16 @@
 void PACK_APIENTRY crPackFogfv(GLenum pname, const GLfloat *params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleFogData( pname, params ))
         WRITE_OPCODE( pc, CR_FOGFV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackFogiv(GLenum pname, const GLint *params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     /* floats and ints are the same size, so the packing should be the same */
     if (__handleFogData( pname, (const GLfloat *) params ))
         WRITE_OPCODE( pc, CR_FOGIV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_init.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_init.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_init.c	(revision 33475)
@@ -24,4 +24,5 @@
     if (!pc)
         return NULL;
+    crInitMutex(&pc->mutex);
 #else
     GET_PACKER_CONTEXT(pc);
@@ -35,4 +36,11 @@
 }
 
+void crPackDeleteContext(CRPackContext *pc)
+{
+#ifdef CHROMIUM_THREADSAFE
+    crFreeMutex(&pc->mutex);
+    crFree(pc);
+#endif
+}
 
 /* Set packing context for the calling thread */
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_lights.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_lights.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_lights.c	(revision 33475)
@@ -10,5 +10,5 @@
 static GLboolean __handleLightData( GLenum light, GLenum pname, const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned int packet_length = sizeof( int ) + sizeof( light ) + sizeof( pname );
     unsigned int params_length = 0;
@@ -38,5 +38,5 @@
     }
     packet_length += params_length;
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, int, packet_length );
     WRITE_DATA( sizeof( int ) + 0, GLenum, light );
@@ -57,7 +57,8 @@
 void PACK_APIENTRY crPackLightfv (GLenum light, GLenum pname, const GLfloat *params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleLightData( light, pname, params ))
         WRITE_OPCODE( pc, CR_LIGHTFV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -65,12 +66,13 @@
 {
     /* floats and ints are the same size, so the packing should be the same */
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleLightData( light, pname, (const GLfloat *) params ))
         WRITE_OPCODE( pc, CR_LIGHTIV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 static GLboolean __handleLightModelData( GLenum pname, const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned int packet_length = sizeof( int ) + sizeof( pname );
     unsigned int params_length = 0;
@@ -91,5 +93,5 @@
     }
     packet_length += params_length;
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, int, packet_length );
     WRITE_DATA( sizeof( int ) + 0, GLenum, pname );
@@ -106,7 +108,8 @@
 void PACK_APIENTRY crPackLightModelfv (GLenum pname, const GLfloat *params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleLightModelData( pname, params ))
         WRITE_OPCODE( pc, CR_LIGHTMODELFV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -114,6 +117,7 @@
 {
     /* floats and ints are the same size, so the packing should be the same */
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleLightModelData( pname, (const GLfloat *) params ))
         WRITE_OPCODE( pc, CR_LIGHTMODELIV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_lists.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_lists.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_lists.c	(revision 33475)
@@ -63,8 +63,8 @@
 void PACK_APIENTRY crPackNewList( GLuint list, GLenum mode )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
-    GET_BUFFERED_POINTER( pc, 16 );
+    CR_GET_BUFFERED_POINTER( pc, 16 );
     WRITE_DATA( 0, GLint, 16 );
     WRITE_DATA( 4, GLenum, CR_NEWLIST_EXTEND_OPCODE );
@@ -74,14 +74,16 @@
     pc->buffer.in_List = GL_TRUE;
     pc->buffer.holds_List = GL_TRUE;
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackEndList( void )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 8 );
+    CR_GET_BUFFERED_POINTER( pc, 8 );
     WRITE_DATA( 0, GLint, 8 );
     WRITE_DATA( 4, GLenum, CR_ENDLIST_EXTEND_OPCODE );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
     pc->buffer.in_List = GL_FALSE;
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_materials.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_materials.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_materials.c	(revision 33475)
@@ -10,5 +10,5 @@
 static void __handleMaterialData( GLenum face, GLenum pname, const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned int packet_length = sizeof( int ) + sizeof( face ) + sizeof( pname );
     unsigned int params_length = 0;
@@ -35,5 +35,5 @@
     packet_length += params_length;
 
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, int, packet_length );
     WRITE_DATA( sizeof( int ) + 0, GLenum, face );
@@ -53,7 +53,8 @@
 void PACK_APIENTRY crPackMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleMaterialData( face, pname, params );
     WRITE_OPCODE( pc, CR_MATERIALFV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -61,6 +62,7 @@
 {
     /* floats and ints are the same size, so the packing should be the same */
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleMaterialData( face, pname, (const GLfloat *) params );
     WRITE_OPCODE( pc, CR_MATERIALIV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_matrices.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_matrices.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_matrices.c	(revision 33475)
@@ -10,8 +10,8 @@
 void PACK_APIENTRY crPackMultMatrixd( const GLdouble *m )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    int packet_length = 16*sizeof( *m );
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    int packet_length = 16*sizeof( *m );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DOUBLE( 0*sizeof(double), m[ 0] );
     WRITE_DOUBLE( 1*sizeof(double), m[ 1] );
@@ -31,12 +31,13 @@
     WRITE_DOUBLE( 15*sizeof(double), m[15] );
     WRITE_OPCODE( pc, CR_MULTMATRIXD_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackMultMatrixf( const GLfloat *m )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    int packet_length = 16*sizeof( *m );
-    GET_BUFFERED_POINTER(pc, packet_length ); 
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    int packet_length = 16*sizeof( *m );
+    CR_GET_BUFFERED_POINTER(pc, packet_length ); 
     WRITE_DATA( 0*sizeof(GLfloat), GLfloat, m[ 0] );
     WRITE_DATA( 1*sizeof(GLfloat), GLfloat, m[ 1] );
@@ -56,12 +57,13 @@
     WRITE_DATA( 15*sizeof(GLfloat), GLfloat, m[15] );
     WRITE_OPCODE( pc, CR_MULTMATRIXF_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackLoadMatrixd( const GLdouble *m )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    int packet_length = 16*sizeof( *m );
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    int packet_length = 16*sizeof( *m );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DOUBLE( 0*sizeof(double), m[ 0] );
     WRITE_DOUBLE( 1*sizeof(double), m[ 1] );
@@ -81,12 +83,13 @@
     WRITE_DOUBLE( 15*sizeof(double), m[15] );
     WRITE_OPCODE( pc, CR_LOADMATRIXD_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackLoadMatrixf( const GLfloat *m )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    int packet_length = 16*sizeof( *m );
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    int packet_length = 16*sizeof( *m );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0*sizeof(GLfloat), GLfloat, m[ 0] );
     WRITE_DATA( 1*sizeof(GLfloat), GLfloat, m[ 1] );
@@ -106,12 +109,13 @@
     WRITE_DATA( 15*sizeof(GLfloat), GLfloat, m[15] );
     WRITE_OPCODE( pc, CR_LOADMATRIXF_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackMultTransposeMatrixdARB( const GLdouble *m )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, GLint, packet_length );
     WRITE_DATA( 4, GLenum, CR_MULTTRANSPOSEMATRIXDARB_EXTEND_OPCODE );
@@ -133,12 +137,13 @@
     WRITE_DOUBLE( 8 + 15*sizeof(double), m[15] );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackMultTransposeMatrixfARB( const GLfloat *m )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, GLint, packet_length );
     WRITE_DATA( 4, GLenum, CR_MULTTRANSPOSEMATRIXFARB_EXTEND_OPCODE );
@@ -160,12 +165,13 @@
     WRITE_DATA( 8 + 15*sizeof(GLfloat), GLfloat, m[15] );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackLoadTransposeMatrixdARB( const GLdouble *m )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, GLint, packet_length );
     WRITE_DATA( 4, GLenum, CR_LOADTRANSPOSEMATRIXDARB_EXTEND_OPCODE );
@@ -187,12 +193,13 @@
     WRITE_DOUBLE( 8 + 15*sizeof(double), m[15] );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackLoadTransposeMatrixfARB( const GLfloat *m )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    int packet_length = 16*sizeof( *m ) + sizeof(GLint) + sizeof(GLenum);
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, GLint, packet_length );
     WRITE_DATA( 4, GLenum, CR_LOADTRANSPOSEMATRIXFARB_EXTEND_OPCODE );
@@ -214,3 +221,4 @@
     WRITE_DATA( 8 + 15*sizeof(GLfloat), GLfloat, m[15] );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
-}
+    CR_UNLOCK_PACKER_CONTEXT(pc);
+}
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_misc.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_misc.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_misc.c	(revision 33475)
@@ -10,5 +10,5 @@
 void PACK_APIENTRY crPackChromiumParametervCR(GLenum target, GLenum type, GLsizei count, const GLvoid *values)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned int header_length = 2 * sizeof(int) + sizeof(target) + sizeof(type) + sizeof(count);
     unsigned int packet_length;
@@ -46,5 +46,5 @@
     packet_length = header_length + params_length;
 
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, GLint, packet_length );
     WRITE_DATA( 4, GLenum, CR_CHROMIUMPARAMETERVCR_EXTEND_OPCODE );
@@ -90,6 +90,8 @@
         __PackError( __LINE__, __FILE__, GL_INVALID_ENUM,
                                  "crPackChromiumParametervCR(bad type)" );
+        CR_UNLOCK_PACKER_CONTEXT(pc);
         return;
     }
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -98,5 +100,4 @@
     unsigned char *data_ptr;
     int packet_length = sizeof(GLenum)+sizeof(n)+n*sizeof(*ids);
-    GET_PACKER_CONTEXT(pc);
     if (!ids) return;
     data_ptr = (unsigned char *) crPackAlloc(packet_length);
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_pixels.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_pixels.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_pixels.c	(revision 33475)
@@ -64,5 +64,5 @@
                                     int *writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     GLint stride = 0;
@@ -89,5 +89,5 @@
     }
 
-    GET_BUFFERED_POINTER(pc, 48 + sizeof(CRNetworkPointer) );
+    CR_GET_BUFFERED_POINTER(pc, 48 + sizeof(CRNetworkPointer) );
     WRITE_DATA( 0,  GLint,  x );
     WRITE_DATA( 4,  GLint,  y );
@@ -104,4 +104,5 @@
     WRITE_NETWORK_POINTER( 48, (char *) pixels );
     WRITE_OPCODE( pc, CR_READPIXELS_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -205,8 +206,8 @@
                                      int * writeback )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
-    GET_BUFFERED_POINTER( pc, 40 );
+    CR_GET_BUFFERED_POINTER( pc, 40 );
     WRITE_DATA( 0, GLint, 40 );
     WRITE_DATA( 4, GLenum, CR_GETTEXIMAGE_EXTEND_OPCODE );
@@ -218,3 +219,4 @@
     WRITE_NETWORK_POINTER( 32, (void *) writeback );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
-}
+    CR_UNLOCK_PACKER_CONTEXT(pc);
+}
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_point.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_point.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_point.c	(revision 33475)
@@ -13,5 +13,5 @@
 static GLboolean __handlePointDataf( GLenum pname, const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     int params_length = 0;
     int packet_length = 2 * sizeof( int ) + sizeof( pname );
@@ -37,5 +37,5 @@
     packet_length += params_length;
 
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, GLint, packet_length );
     WRITE_DATA( 4, GLenum, CR_POINTPARAMETERFVARB_EXTEND_OPCODE );
@@ -52,7 +52,8 @@
 void PACK_APIENTRY crPackPointParameterfvARB(GLenum pname, const GLfloat *params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handlePointDataf( pname, params ))
         WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -61,5 +62,5 @@
 static GLboolean __handlePointDatai( GLenum pname, const GLint *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     int params_length = 0;
     int packet_length = 2 * sizeof( int ) + sizeof( pname );
@@ -85,5 +86,5 @@
     packet_length += params_length;
 
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, GLint, packet_length );
     WRITE_DATA( 4, GLenum, CR_POINTPARAMETERIV_EXTEND_OPCODE );
@@ -100,6 +101,7 @@
 void PACK_APIENTRY crPackPointParameteriv(GLenum pname, const GLint *params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handlePointDatai( pname, params ))
         WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_program.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_program.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_program.c	(revision 33475)
@@ -17,9 +17,9 @@
 void PACK_APIENTRY crPackProgramParameters4dvNV (GLenum target, GLuint index, GLuint num, const GLdouble * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int) + sizeof(target) + sizeof(index) + sizeof(num) + num * 4 * sizeof(GLdouble);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, int, packet_length);
     WRITE_DATA(sizeof(int) + 0, GLenum, target);
@@ -29,4 +29,5 @@
 
     WRITE_OPCODE(pc, CR_PROGRAMPARAMETERS4DVNV_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -34,9 +35,9 @@
 void PACK_APIENTRY crPackProgramParameters4fvNV (GLenum target, GLuint index, GLuint num, const GLfloat * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int) + sizeof(target) + sizeof(index) + sizeof(num) + num * 4 * sizeof(GLfloat);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, int, packet_length);
     WRITE_DATA(sizeof(int) + 0, GLenum, target);
@@ -46,4 +47,5 @@
 
     WRITE_OPCODE(pc, CR_PROGRAMPARAMETERS4FVNV_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -161,7 +163,7 @@
     const int packet_length = 32;
     unsigned char *data_ptr;
-    GET_PACKER_CONTEXT(pc);
-
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_PACKER_CONTEXT(pc);
+
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, int, packet_length);
     WRITE_DATA(4, GLenum, CR_EXECUTEPROGRAMNV_EXTEND_OPCODE);
@@ -173,4 +175,5 @@
     WRITE_DATA(28, GLfloat, params[3] );
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -179,7 +182,7 @@
     const int packet_length = 20 + len;
     unsigned char *data_ptr;
-    GET_PACKER_CONTEXT(pc);
-
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_PACKER_CONTEXT(pc);
+
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, int, packet_length);
     WRITE_DATA(4, GLenum, CR_LOADPROGRAMNV_EXTEND_OPCODE);
@@ -189,9 +192,10 @@
     crMemcpy( (void *) (data_ptr + 20), program, len );
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackRequestResidentProgramsNV( GLsizei n, const GLuint *ids )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void) pc;
     (void) n;
@@ -203,9 +207,9 @@
 void PACK_APIENTRY crPackProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = 32 + len;
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, GLint, packet_length);
     WRITE_DATA(4, GLenum, CR_PROGRAMNAMEDPARAMETER4FNV_EXTEND_OPCODE);
@@ -218,13 +222,14 @@
     crMemcpy( (void *) (data_ptr + 32), name, len );
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = 48 + len;
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, GLint, packet_length);
     WRITE_DATA(4, GLenum, CR_PROGRAMNAMEDPARAMETER4DNV_EXTEND_OPCODE);
@@ -238,4 +243,5 @@
 
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -256,5 +262,5 @@
                                                         int *writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length;
@@ -268,5 +274,5 @@
         8 + 8;
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, int, packet_length);
     WRITE_DATA(4, GLenum, CR_AREPROGRAMSRESIDENTNV_EXTEND_OPCODE);
@@ -276,4 +282,5 @@
     WRITE_NETWORK_POINTER(20 + n * sizeof(*programs), (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -282,7 +289,7 @@
 {
     int packet_length = 32 + len;
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, packet_length );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, packet_length );
     WRITE_DATA( 0, GLint, packet_length );
     WRITE_DATA( 4, GLenum, CR_GETPROGRAMNAMEDPARAMETERFVNV_EXTEND_OPCODE );
@@ -293,4 +300,5 @@
     WRITE_NETWORK_POINTER( 16 + len + 8, (void *) writeback );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -298,7 +306,7 @@
 {
     int packet_length = 32 + len;
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, packet_length );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, packet_length );
     WRITE_DATA( 0, GLint, packet_length );
     WRITE_DATA( 4, GLenum, CR_GETPROGRAMNAMEDPARAMETERDVNV_EXTEND_OPCODE );
@@ -309,4 +317,5 @@
     WRITE_NETWORK_POINTER( 16 + len + 8, (void *) writeback );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -333,7 +342,7 @@
     const int packet_length = 20 + len;
     unsigned char *data_ptr;
-    GET_PACKER_CONTEXT(pc);
-
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_PACKER_CONTEXT(pc);
+
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, int, packet_length);
     WRITE_DATA(4, GLenum, CR_PROGRAMSTRINGARB_EXTEND_OPCODE);
@@ -343,4 +352,5 @@
     crMemcpy( (void *) (data_ptr + 20), string, len );
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -353,7 +363,7 @@
 void PACK_APIENTRY crPackVertexAttrib4NbvARB( GLuint index, const GLbyte *v )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 8 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 8 );
     pc->current.c.vertexAttrib.b4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -364,11 +374,12 @@
     WRITE_DATA( 7, GLbyte, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4NBVARB_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttrib4NivARB( GLuint index, const GLint *v )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 20 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 20 );
     pc->current.c.vertexAttrib.i4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -379,11 +390,12 @@
     WRITE_DATA( 16, GLint, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4NIVARB_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttrib4NsvARB( GLuint index, const GLshort *v )
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 12 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 12 );
     pc->current.c.vertexAttrib.s4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -394,11 +406,12 @@
     WRITE_DATA( 10, GLshort, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4NSVARB_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttrib4NubvARB(GLuint index, const GLubyte * v)
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 8 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 8 );
     pc->current.c.vertexAttrib.ub4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -409,11 +422,12 @@
     WRITE_DATA( 7, GLubyte, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4NUBVARB_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttrib4NuivARB(GLuint index, const GLuint * v)
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 20 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 20 );
     pc->current.c.vertexAttrib.ui4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -424,11 +438,12 @@
     WRITE_DATA( 16, GLuint, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4NUIVARB_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttrib4NusvARB(GLuint index, const GLushort * v)
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 12 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 12 );
     pc->current.c.vertexAttrib.s4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -439,11 +454,12 @@
     WRITE_DATA( 10, GLushort, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4NUSVARB_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttrib4bvARB(GLuint index, const GLbyte * v)
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 8 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 8 );
     pc->current.c.vertexAttrib.b4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -454,11 +470,12 @@
     WRITE_DATA( 7, GLbyte, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4BVARB_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttrib4ivARB(GLuint index, const GLint * v)
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 20 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 20 );
     pc->current.c.vertexAttrib.i4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -469,11 +486,12 @@
     WRITE_DATA( 16, GLint, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4IVARB_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttrib4uivARB(GLuint index, const GLuint * v)
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 20 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 20 );
     pc->current.c.vertexAttrib.ui4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -484,11 +502,12 @@
     WRITE_DATA( 16, GLuint, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4UIVARB_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackVertexAttrib4usvARB(GLuint index, const GLushort * v)
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 12 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 12 );
     pc->current.c.vertexAttrib.s4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -499,4 +518,5 @@
     WRITE_DATA( 10, GLushort, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4USVARB_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -504,7 +524,7 @@
 void PACK_APIENTRY crPackVertexAttrib4ubvARB(GLuint index, const GLubyte * v)
 {
-    GET_PACKER_CONTEXT(pc);
-    unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, 8 );
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    CR_GET_BUFFERED_POINTER( pc, 8 );
     pc->current.c.vertexAttrib.ub4[index] = data_ptr + 12;
     pc->current.attribsUsedMask |= (1 << index);
@@ -515,4 +535,5 @@
     WRITE_DATA( 7, GLubyte, v[3] );
     WRITE_OPCODE( pc, CR_VERTEXATTRIB4UBVARB_OPCODE );
-}
-
+    CR_UNLOCK_PACKER_CONTEXT(pc);
+}
+
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_regcombiner.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_regcombiner.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_regcombiner.c	(revision 33475)
@@ -10,5 +10,5 @@
 static GLboolean __handleCombinerParameterData( GLenum pname, const GLfloat *params, GLenum extended_opcode )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned int params_length = 0;
     unsigned int packet_length = sizeof( int ) + sizeof( extended_opcode ) + sizeof( pname );
@@ -32,5 +32,5 @@
     }
     packet_length += params_length;
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, int, packet_length );
     WRITE_DATA( sizeof( int ) + 0, GLenum, extended_opcode );
@@ -49,7 +49,8 @@
 void PACK_APIENTRY crPackCombinerParameterfvNV( GLenum pname, const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleCombinerParameterData( pname, params, CR_COMBINERPARAMETERFVNV_EXTEND_OPCODE ))
         WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -57,15 +58,16 @@
 {
     /* floats and ints are the same size, so the packing should be the same */
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleCombinerParameterData( pname, (const GLfloat *) params, CR_COMBINERPARAMETERIVNV_EXTEND_OPCODE ))
         WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackCombinerStageParameterfvNV( GLenum stage, GLenum pname, const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
 
-    GET_BUFFERED_POINTER(pc, 32 );
+    CR_GET_BUFFERED_POINTER(pc, 32 );
     WRITE_DATA( 0, GLint, 32 );
     WRITE_DATA( 4, GLenum, CR_COMBINERSTAGEPARAMETERFVNV_EXTEND_OPCODE );
@@ -77,3 +79,4 @@
     WRITE_DATA( 28, GLfloat, params[3] );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c	(revision 33475)
@@ -23,10 +23,10 @@
 void PACK_APIENTRY crPackBindAttribLocation(GLuint program, GLuint index, const char *name)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int cbName = crStrlen(name)+1;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(program)+sizeof(index) + cbName*sizeof(*name);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_BINDATTRIBLOCATION_EXTEND_OPCODE);
@@ -35,9 +35,10 @@
     crMemcpy(data_ptr, name, cbName*sizeof(*name));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackShaderSource(GLuint shader, GLsizei count, const char **string, const GLint *length)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     GLint *pLocalLength;
@@ -61,5 +62,5 @@
     }
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_SHADERSOURCE_EXTEND_OPCODE);
@@ -82,4 +83,5 @@
     }
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 
     crFree(pLocalLength);
@@ -88,9 +90,9 @@
 void PACK_APIENTRY crPackUniform1fv(GLint location, GLsizei count, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORM1FV_EXTEND_OPCODE);
@@ -99,13 +101,14 @@
     crMemcpy(data_ptr, value, count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniform1iv(GLint location, GLsizei count, const GLint *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORM1IV_EXTEND_OPCODE);
@@ -114,13 +117,14 @@
     crMemcpy(data_ptr, value, count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniform2fv(GLint location, GLsizei count, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 2*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORM2FV_EXTEND_OPCODE);
@@ -129,13 +133,14 @@
     crMemcpy(data_ptr, value, 2*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniform2iv(GLint location, GLsizei count, const GLint *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 2*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORM2IV_EXTEND_OPCODE);
@@ -144,13 +149,14 @@
     crMemcpy(data_ptr, value, 2*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniform3fv(GLint location, GLsizei count, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 3*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORM3FV_EXTEND_OPCODE);
@@ -159,13 +165,14 @@
     crMemcpy(data_ptr, value, 3*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniform3iv(GLint location, GLsizei count, const GLint *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 3*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORM3IV_EXTEND_OPCODE);
@@ -174,13 +181,14 @@
     crMemcpy(data_ptr, value, 3*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniform4fv(GLint location, GLsizei count, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 4*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORM4FV_EXTEND_OPCODE);
@@ -189,13 +197,14 @@
     crMemcpy(data_ptr, value, 4*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniform4iv(GLint location, GLsizei count, const GLint *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 4*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORM4IV_EXTEND_OPCODE);
@@ -204,13 +213,14 @@
     crMemcpy(data_ptr, value, 4*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 2*2*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX2FV_EXTEND_OPCODE);
@@ -220,13 +230,14 @@
     crMemcpy(data_ptr, value, 2*2*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 3*3*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX3FV_EXTEND_OPCODE);
@@ -236,13 +247,14 @@
     crMemcpy(data_ptr, value, 3*3*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 4*4*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX4FV_EXTEND_OPCODE);
@@ -252,14 +264,15 @@
     crMemcpy(data_ptr, value, 4*4*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
                         + 2*3*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX2X3FV_EXTEND_OPCODE);
@@ -269,14 +282,15 @@
     crMemcpy(data_ptr, value, 2*3*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
                         + 3*2*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX3X2FV_EXTEND_OPCODE);
@@ -286,14 +300,15 @@
     crMemcpy(data_ptr, value, 3*2*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
                         + 2*4*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX2X4FV_EXTEND_OPCODE);
@@ -303,14 +318,15 @@
     crMemcpy(data_ptr, value, 2*4*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
                         + 4*2*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX4X2FV_EXTEND_OPCODE);
@@ -320,14 +336,15 @@
     crMemcpy(data_ptr, value, 4*2*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
                         + 3*4*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX3X4FV_EXTEND_OPCODE);
@@ -337,14 +354,15 @@
     crMemcpy(data_ptr, value, 3*4*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose)
                         + 4*3*count*sizeof(*value);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX4X3FV_EXTEND_OPCODE);
@@ -354,13 +372,14 @@
     crMemcpy(data_ptr, value, 4*3*count*sizeof(*value));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackDrawBuffers(GLsizei n, const GLenum *bufs)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(n) + n*sizeof(*bufs);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_DRAWBUFFERS_EXTEND_OPCODE);
@@ -368,4 +387,5 @@
     crMemcpy(data_ptr, bufs, n*sizeof(*bufs));
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -376,5 +396,5 @@
 void PACK_APIENTRY crPackGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, char * name, int * writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
@@ -382,5 +402,5 @@
     (void) type;
     (void) name;
-    GET_BUFFERED_POINTER(pc, 36);
+    CR_GET_BUFFERED_POINTER(pc, 36);
     WRITE_DATA(0, GLint, 36);
     WRITE_DATA(4, GLenum, CR_GETACTIVEATTRIB_EXTEND_OPCODE);
@@ -391,9 +411,10 @@
     WRITE_NETWORK_POINTER(28, (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, char * name, int * writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
@@ -401,5 +422,5 @@
     (void) type;
     (void) name;
-    GET_BUFFERED_POINTER(pc, 36);
+    CR_GET_BUFFERED_POINTER(pc, 36);
     WRITE_DATA(0, GLint, 36);
     WRITE_DATA(4, GLenum, CR_GETACTIVEUNIFORM_EXTEND_OPCODE);
@@ -410,13 +431,14 @@
     WRITE_NETWORK_POINTER(28, (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders, int * writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
     (void) shaders;
-    GET_BUFFERED_POINTER(pc, 32);
+    CR_GET_BUFFERED_POINTER(pc, 32);
     WRITE_DATA(0, GLint, 32);
     WRITE_DATA(4, GLenum, CR_GETATTACHEDSHADERS_EXTEND_OPCODE);
@@ -426,12 +448,13 @@
     WRITE_NETWORK_POINTER(24, (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackGetAttachedObjectsARB(GLhandleARB containerObj, GLsizei maxCount, GLsizei * count, GLhandleARB * obj, int * writeback)
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
 	(void) pc;
-	GET_BUFFERED_POINTER(pc, 32);
+	CR_GET_BUFFERED_POINTER(pc, 32);
 	WRITE_DATA(0, GLint, 32);
 	WRITE_DATA(4, GLenum, CR_GETATTACHEDOBJECTSARB_EXTEND_OPCODE);
@@ -441,12 +464,13 @@
 	WRITE_NETWORK_POINTER(24, (void *) writeback);
 	WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackGetInfoLogARB(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog, int * writeback)
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
 	unsigned char *data_ptr;
 	(void) pc;
-	GET_BUFFERED_POINTER(pc, 32);
+	CR_GET_BUFFERED_POINTER(pc, 32);
 	WRITE_DATA(0, GLint, 32);
 	WRITE_DATA(4, GLenum, CR_GETINFOLOGARB_EXTEND_OPCODE);
@@ -456,13 +480,14 @@
 	WRITE_NETWORK_POINTER(24, (void *) writeback);
 	WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei * length, char * infoLog, int * writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
     (void) infoLog;
-    GET_BUFFERED_POINTER(pc, 32);
+    CR_GET_BUFFERED_POINTER(pc, 32);
     WRITE_DATA(0, GLint, 32);
     WRITE_DATA(4, GLenum, CR_GETPROGRAMINFOLOG_EXTEND_OPCODE);
@@ -472,13 +497,14 @@
     WRITE_NETWORK_POINTER(24, (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei * length, char * infoLog, int * writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
     (void) infoLog;
-    GET_BUFFERED_POINTER(pc, 32);
+    CR_GET_BUFFERED_POINTER(pc, 32);
     WRITE_DATA(0, GLint, 32);
     WRITE_DATA(4, GLenum, CR_GETSHADERINFOLOG_EXTEND_OPCODE);
@@ -488,13 +514,14 @@
     WRITE_NETWORK_POINTER(24, (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei * length, char * source, int * writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
     (void) source;
-    GET_BUFFERED_POINTER(pc, 32);
+    CR_GET_BUFFERED_POINTER(pc, 32);
     WRITE_DATA(0, GLint, 32);
     WRITE_DATA(4, GLenum, CR_GETSHADERSOURCE_EXTEND_OPCODE);
@@ -504,12 +531,13 @@
     WRITE_NETWORK_POINTER(24, (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackGetUniformsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData, int * writeback)
 {
-	GET_PACKER_CONTEXT(pc);
+	CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pData;
-    GET_BUFFERED_POINTER(pc, 32);
+    CR_GET_BUFFERED_POINTER(pc, 32);
     WRITE_DATA(0, GLint, 32);
     WRITE_DATA(4, GLenum, CR_GETUNIFORMSLOCATIONS_EXTEND_OPCODE);
@@ -519,14 +547,15 @@
     WRITE_NETWORK_POINTER(24, (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackGetAttribLocation(GLuint program, const char * name, GLint * return_value, int * writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int cbName = crStrlen(name)+1;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(program)+cbName*sizeof(*name)+16;
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_GETATTRIBLOCATION_EXTEND_OPCODE);
@@ -537,14 +566,15 @@
     WRITE_NETWORK_POINTER(8, (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackGetUniformLocation(GLuint program, const char * name, GLint * return_value, int * writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int cbName = crStrlen(name)+1;
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(program)+cbName*sizeof(*name)+16;
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA_AI(int, packet_length);
     WRITE_DATA_AI(GLenum, CR_GETUNIFORMLOCATION_EXTEND_OPCODE);
@@ -555,9 +585,10 @@
     WRITE_NETWORK_POINTER(8, (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
 void PACK_APIENTRY crPackBindAttribLocationSWAP(GLuint program, GLuint index, const char *name)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)program;
     (void)index;
@@ -569,5 +600,5 @@
 void PACK_APIENTRY crPackShaderSourceSWAP(GLuint shader, GLsizei count, const char **string, const GLint *length)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)shader;
     (void)count;
@@ -580,5 +611,5 @@
 void PACK_APIENTRY crPackUniform1fvSWAP(GLint location, GLsizei count, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -591,5 +622,5 @@
 void PACK_APIENTRY crPackUniform1ivSWAP(GLint location, GLsizei count, const GLint *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -601,5 +632,5 @@
 void PACK_APIENTRY crPackUniform2fvSWAP(GLint location, GLsizei count, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -611,5 +642,5 @@
 void PACK_APIENTRY crPackUniform2ivSWAP(GLint location, GLsizei count, const GLint * value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -621,5 +652,5 @@
 void PACK_APIENTRY crPackUniform3fvSWAP(GLint location, GLsizei count, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -631,5 +662,5 @@
 void PACK_APIENTRY crPackUniform3ivSWAP(GLint location, GLsizei count, const GLint *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -641,5 +672,5 @@
 void PACK_APIENTRY crPackUniform4fvSWAP(GLint location, GLsizei count, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -651,5 +682,5 @@
 void PACK_APIENTRY crPackUniform4ivSWAP(GLint location, GLsizei count, const GLint *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -661,5 +692,5 @@
 void PACK_APIENTRY crPackUniformMatrix2fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -672,5 +703,5 @@
 void PACK_APIENTRY crPackUniformMatrix3fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -683,5 +714,5 @@
 void PACK_APIENTRY crPackUniformMatrix4fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -694,5 +725,5 @@
 void PACK_APIENTRY crPackUniformMatrix2x3fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -705,5 +736,5 @@
 void PACK_APIENTRY crPackUniformMatrix3x2fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -716,5 +747,5 @@
 void PACK_APIENTRY crPackUniformMatrix2x4fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -727,5 +758,5 @@
 void PACK_APIENTRY crPackUniformMatrix4x2fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -738,5 +769,5 @@
 void PACK_APIENTRY crPackUniformMatrix3x4fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -749,5 +780,5 @@
 void PACK_APIENTRY crPackUniformMatrix4x3fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)location;
     (void)count;
@@ -760,5 +791,5 @@
 void PACK_APIENTRY crPackDrawBuffersSWAP(GLsizei n, const GLenum *bufs)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)n;
     (void)bufs;
@@ -769,5 +800,5 @@
 void PACK_APIENTRY crPackGetAttribLocationSWAP(GLuint program, const char * name, GLint * return_value, int * writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)program;
     (void)name;
@@ -780,5 +811,5 @@
 void PACK_APIENTRY crPackGetUniformLocationSWAP(GLuint program, const char * name, GLint * return_value, int * writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     (void)program;
     (void)name;
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_stipple.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_stipple.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_stipple.c	(revision 33475)
@@ -12,5 +12,5 @@
 void PACK_APIENTRY crPackPolygonStipple( const GLubyte *mask )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int nodata = crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
@@ -22,5 +22,5 @@
         packet_length += 32*32/8;
 
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA_AI(int, nodata);
     if (nodata)
@@ -33,3 +33,4 @@
     }
     WRITE_OPCODE( pc, CR_POLYGONSTIPPLE_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_swap_lists.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_swap_lists.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_swap_lists.c	(revision 33475)
@@ -87,8 +87,8 @@
 void PACK_APIENTRY crPackNewListSWAP( GLuint list, GLenum mode )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
-    GET_BUFFERED_POINTER( pc, 16 );
+    CR_GET_BUFFERED_POINTER( pc, 16 );
     WRITE_DATA( 0, GLint, SWAP32(16) );
     WRITE_DATA( 4, GLenum, SWAP32(CR_NEWLIST_EXTEND_OPCODE) );
@@ -98,4 +98,5 @@
     pc->buffer.in_List = GL_TRUE;
     pc->buffer.holds_List = GL_TRUE;
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -103,11 +104,12 @@
 void PACK_APIENTRY crPackEndListSWAP( void )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
-    GET_BUFFERED_POINTER( pc, 8 );
+    CR_GET_BUFFERED_POINTER( pc, 8 );
     WRITE_DATA( 0, GLint, SWAP32(8) );
     WRITE_DATA( 4, GLenum, SWAP32(CR_ENDLIST_EXTEND_OPCODE) );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
     pc->buffer.in_List = GL_FALSE;
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_swap_texture.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_swap_texture.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_swap_texture.c	(revision 33475)
@@ -285,5 +285,5 @@
 static void __handleTexEnvData( GLenum target, GLenum pname, const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int num_params;
@@ -303,5 +303,5 @@
     packet_length += num_params*sizeof(*params);
 
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, int, SWAP32(packet_length) );
     WRITE_DATA( sizeof( int ) + 0, GLenum, SWAP32(target) );
@@ -317,7 +317,8 @@
         const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleTexEnvData( target, pname, params );
     WRITE_OPCODE( pc, CR_TEXENVFV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -326,7 +327,8 @@
 {
     /* floats and ints are the same size, so the packing should be the same */
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleTexEnvData( target, pname, (const GLfloat *) params );
     WRITE_OPCODE( pc, CR_TEXENVIV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -370,5 +372,5 @@
         int sizeof_param, const GLvoid *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof( int ) + sizeof( coord ) + sizeof( pname );
@@ -381,5 +383,5 @@
     packet_length += num_params * sizeof_param;
     
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, int, SWAP32(packet_length) );
     WRITE_DATA( sizeof( int ) + 0, GLenum, SWAP32(coord) );
@@ -394,7 +396,8 @@
         const GLdouble *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleTexGenData( coord, pname, sizeof( *params ), params );
     WRITE_OPCODE( pc, CR_TEXGENDV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -402,7 +405,8 @@
         const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleTexGenData( coord, pname, sizeof( *params ), params );
     WRITE_OPCODE( pc, CR_TEXGENFV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -410,7 +414,8 @@
         const GLint *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleTexGenData( coord, pname, sizeof( *params ), params );
     WRITE_OPCODE( pc, CR_TEXGENIV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -432,5 +437,5 @@
 static GLboolean __handleTexParameterData( GLenum target, GLenum pname, const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof( int ) + sizeof( target ) + sizeof( pname );
@@ -495,5 +500,5 @@
     packet_length += num_params * sizeof(*params);
 
-    GET_BUFFERED_POINTER(pc, packet_length );
+    CR_GET_BUFFERED_POINTER(pc, packet_length );
     WRITE_DATA( 0, int, SWAP32(packet_length) );
     WRITE_DATA( sizeof( int ) + 0, GLenum, SWAP32(target) );
@@ -509,7 +514,8 @@
         const GLfloat *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleTexParameterData( target, pname, params ))
         WRITE_OPCODE( pc, CR_TEXPARAMETERFV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -517,7 +523,8 @@
         const GLint *params )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleTexParameterData( target, pname, (GLfloat *) params ))
         WRITE_OPCODE( pc, CR_TEXPARAMETERIV_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -654,5 +661,5 @@
 void PACK_APIENTRY crPackAreTexturesResidentSWAP( GLsizei n, const GLuint *textures, GLboolean *residences, GLboolean *return_val, int *writeback )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length;
@@ -666,5 +673,5 @@
         8 + 8 + 8;               /* return pointers */
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA( 0, int, SWAP32(packet_length) );
     WRITE_DATA( sizeof( int ) + 0, GLenum, SWAP32(CR_ARETEXTURESRESIDENT_EXTEND_OPCODE) );
@@ -678,4 +685,5 @@
     WRITE_NETWORK_POINTER( sizeof( int ) + 24 + n*sizeof( *textures ), (void *) writeback );
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -963,5 +971,5 @@
 void PACK_APIENTRY crPackGetCompressedTexImageARBSWAP( GLenum target, GLint level, GLvoid *img, int *writeback )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     crError ( "GetCompressedTexImageARB needs to be special cased!");
     (void) pc;
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_texture.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_texture.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_texture.c	(revision 33475)
@@ -298,5 +298,5 @@
 __handleTexEnvData(GLenum target, GLenum pname, const GLfloat * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int params_length;
@@ -318,5 +318,5 @@
     packet_length += params_length;
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, int, packet_length);
     WRITE_DATA(sizeof(int) + 0, GLenum, target);
@@ -329,7 +329,8 @@
 crPackTexEnvfv(GLenum target, GLenum pname, const GLfloat * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleTexEnvData(target, pname, params);
     WRITE_OPCODE(pc, CR_TEXENVFV_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -338,7 +339,8 @@
 {
     /* floats and ints are the same size, so the packing should be the same */
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleTexEnvData(target, pname, (const GLfloat *) params);
     WRITE_OPCODE(pc, CR_TEXENVIV_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -380,5 +382,5 @@
                                      int sizeof_param, const GLvoid * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length =
@@ -391,5 +393,5 @@
     }
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, int, packet_length);
     WRITE_DATA(sizeof(int) + 0, GLenum, coord);
@@ -401,7 +403,8 @@
 crPackTexGendv(GLenum coord, GLenum pname, const GLdouble * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleTexGenData(coord, pname, sizeof(*params), params);
     WRITE_OPCODE(pc, CR_TEXGENDV_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -409,7 +412,8 @@
 crPackTexGenfv(GLenum coord, GLenum pname, const GLfloat * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleTexGenData(coord, pname, sizeof(*params), params);
     WRITE_OPCODE(pc, CR_TEXGENFV_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -417,7 +421,8 @@
 crPackTexGeniv(GLenum coord, GLenum pname, const GLint * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     __handleTexGenData(coord, pname, sizeof(*params), params);
     WRITE_OPCODE(pc, CR_TEXGENIV_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -443,5 +448,5 @@
 __handleTexParameterData(GLenum target, GLenum pname, const GLfloat * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length = sizeof(int) + sizeof(target) + sizeof(pname);
@@ -504,5 +509,5 @@
     packet_length += num_params * sizeof(*params);
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, int, packet_length);
     WRITE_DATA(sizeof(int) + 0, GLenum, target);
@@ -515,7 +520,8 @@
 crPackTexParameterfv(GLenum target, GLenum pname, const GLfloat * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleTexParameterData(target, pname, params))
         WRITE_OPCODE(pc, CR_TEXPARAMETERFV_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -523,7 +529,8 @@
 crPackTexParameteriv(GLenum target, GLenum pname, const GLint * params)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     if (__handleTexParameterData(target, pname, (GLfloat *) params))
         WRITE_OPCODE(pc, CR_TEXPARAMETERIV_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -688,5 +695,5 @@
                                                     int *writeback)
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     int packet_length;
@@ -700,5 +707,5 @@
         8 + 8;
 
-    GET_BUFFERED_POINTER(pc, packet_length);
+    CR_GET_BUFFERED_POINTER(pc, packet_length);
     WRITE_DATA(0, int, packet_length);
     WRITE_DATA(4, GLenum, CR_ARETEXTURESRESIDENT_EXTEND_OPCODE);
@@ -708,4 +715,5 @@
     WRITE_NETWORK_POINTER(20 + n * sizeof(*textures), (void *) writeback);
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
@@ -1002,8 +1010,8 @@
 void PACK_APIENTRY crPackGetCompressedTexImageARB( GLenum target, GLint level, GLvoid *img, int *writeback )
 {
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(target)+sizeof(level)+2*8;
     unsigned char *data_ptr;
-    GET_BUFFERED_POINTER( pc, packet_length );
+    CR_GET_BUFFERED_POINTER( pc, packet_length );
 
     WRITE_DATA_AI(int, packet_length);
@@ -1014,3 +1022,4 @@
     WRITE_NETWORK_POINTER(8, (void *) writeback );
     WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
-}
+    CR_UNLOCK_PACKER_CONTEXT(pc);
+}
Index: trunk/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c	(revision 33475)
@@ -27,9 +27,9 @@
     GLint i, size, cnt;
 
-    GET_PACKER_CONTEXT(pc);
+    CR_GET_PACKER_CONTEXT(pc);
     unsigned char *data_ptr;
     (void) pc;
     size = 16 + cRects * 4 * sizeof(GLint);
-    GET_BUFFERED_POINTER( pc, size );
+    CR_GET_BUFFERED_POINTER( pc, size );
     WRITE_DATA( 0, GLint, size );
     WRITE_DATA( 4, GLenum, CR_WINDOWVISIBLEREGION_EXTEND_OPCODE );
@@ -47,4 +47,5 @@
     }
     WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
+    CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
Index: trunk/src/VBox/GuestHost/OpenGL/packer/packer.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/packer.py	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/packer.py	(revision 33475)
@@ -118,5 +118,5 @@
         print 'void PACK_APIENTRY crPack%s( %s )' % (func_name, apiutil.MakeDeclarationString(params))
     print '{'
-    print '\tGET_PACKER_CONTEXT(pc);'
+    print '\tCR_GET_PACKER_CONTEXT(pc);'
 
     # Save original function name
@@ -168,14 +168,14 @@
 
     if packet_length == 0 and not is_extended:
-        print "\tGET_BUFFERED_POINTER_NO_ARGS( pc );"
+        print "\tCR_GET_BUFFERED_POINTER_NO_ARGS( pc );"
     elif func_name[:9] == "Translate" or func_name[:5] == "Color":
         # XXX WTF is the purpose of this?
         if is_extended:
             packet_length += 8
-        print "\tGET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, %d );" % packet_length
+        print "\tCR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, %d, GL_TRUE );" % packet_length
     else:
         if is_extended:
             packet_length += 8
-        print "\tGET_BUFFERED_POINTER( pc, %d );" % packet_length
+        print "\tCR_GET_BUFFERED_POINTER( pc, %d );" % packet_length
     UpdateCurrentPointer( func_name )
 
@@ -209,4 +209,6 @@
     else:
         print "\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name )
+
+    print '\tCR_UNLOCK_PACKER_CONTEXT(pc);'
     print '}\n'
 
Index: trunk/src/VBox/GuestHost/OpenGL/packer/packer_bbox.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/packer/packer_bbox.py	(revision 33474)
+++ trunk/src/VBox/GuestHost/OpenGL/packer/packer_bbox.py	(revision 33475)
@@ -167,5 +167,5 @@
 
 
-	print "\tGET_PACKER_CONTEXT(pc);"
+	print "\tCR_GET_PACKER_CONTEXT(pc);"
 	print "\tunsigned char *data_ptr;"
 
@@ -195,5 +195,5 @@
 			print "\tCREATE_%dD_FLOATS();" % num_coords
 
-	print "\tGET_BUFFERED%s_POINTER( pc, %d );" % (countSuffix, packet_length)
+	print "\tCR_GET_BUFFERED%s_POINTER( pc, %d );" % (countSuffix, packet_length)
 
 	# Bounding box code
@@ -260,4 +260,7 @@
 		else:
 			print "\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name )
+
+	print "\tCR_UNLOCK_PACKER_CONTEXT(pc);"
+
 
 	print '}\n'
