Index: /trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk
===================================================================
--- /trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk	(revision 55761)
+++ /trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk	(revision 55762)
@@ -101,4 +101,7 @@
 ifdef VBOX_WITH_CRHGSMI
 VBoxSharedCrOpenGL_DEFS += VBOX_WITH_CRHGSMI
+endif
+ifdef VBOX_WITH_CR_DISPLAY_LISTS
+VBoxSharedCrOpenGL_LIBS += $(PATH_STAGE_LIB)/VBoxOGLcrdlm$(VBOX_SUFF_LIB)
 endif
 
Index: /trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
===================================================================
--- /trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c	(revision 55761)
+++ /trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c	(revision 55762)
@@ -16,4 +16,9 @@
 #include "cr_environment.h"
 #include "cr_pixeldata.h"
+
+#ifdef VBOX_WITH_CR_DISPLAY_LISTS
+# include "cr_dlm.h"
+#endif
+
 #include "server_dispatch.h"
 #include "state/cr_texture.h"
@@ -1671,4 +1676,9 @@
         }
     }
+
+#ifdef VBOX_WITH_CR_DISPLAY_LISTS
+    rc = crDLMSaveState();
+    AssertRCReturn(rc, rc);
+#endif
 
     rc = crServerPendSaveState(pSSM);
Index: /trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm.c
===================================================================
--- /trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm.c	(revision 55761)
+++ /trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm.c	(revision 55762)
@@ -733,2 +733,7 @@
 		(*ErrorCallback)(line, file, error, info);
 }
+
+int32_t DLM_APIENTRY crDLMSaveState(void)
+{
+    return 0;
+}
Index: /trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_generated.py
===================================================================
--- /trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_generated.py	(revision 55761)
+++ /trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_generated.py	(revision 55762)
@@ -85,4 +85,5 @@
 	print '	DLMInstanceList *next;'
 	print '	DLMInstanceList *stateNext;'
+	print '	int cbInstance;'
 	print '	void (DLM_APIENTRY *execute)(DLMInstanceList *instance, SPUDispatchTable *dispatchTable);'
 	for (name, type, vecSize) in params:
@@ -286,5 +287,5 @@
 	print '	CRDLMContextState *state = CURRENT_STATE();'
 	print '	struct instance%s *instance;' % (functionName)
-
+	
 	# The calling SPU is supposed to verify that the element is supposed to be
 	# compiled before it is actually compiled; typically, this is done based
@@ -318,5 +319,8 @@
 			name = params[index][0]
 			print '\tinstance->%s = %s;' % (name, name)
-
+	
+	# We need to know instance size in bytes in order to save its state later.
+	print '\tinstance->cbInstance = sizeof(struct instance%s);' % functionName
+	
 	# If there's a pointer parameter, apply it.
 	if len(pointers) == 1:
@@ -328,13 +332,13 @@
 		print '\t}'
 		if pointersize == 'special':
-			print '\t(void) crdlm_pointers_%s(instance, %s);' % (functionName, callstring)
+			print '\tinstance->cbInstance += crdlm_pointers_%s(instance, %s);' % (functionName, callstring)
 		else:
 			print '\tcrMemcpy((void *)instance->%s, (void *) %s, %s*sizeof(%s));' % (params[pointers[0]][0], params[pointers[0]][0], pointersize, pointertype)
 	elif len(pointers) == 2:
 		# this seems to work
-		print '\t(void) crdlm_pointers_%s(instance, %s);' % (functionName, callstring)
+		print '\tinstance->cbInstance += crdlm_pointers_%s(instance, %s);' % (functionName, callstring)
 	elif len(pointers) > 2:
 		print "#error don't know how to handle pointer parameters for %s" % (functionName)
-
+	
 	# Add the element to the current display list
 	AddInstanceToList('\t')
Index: /trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_header.py
===================================================================
--- /trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_header.py	(revision 55761)
+++ /trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_header.py	(revision 55762)
@@ -52,4 +52,5 @@
 	('GLuint DLM_APIENTRY', 'crDLMGenLists', 'GLsizei range'),
 	('void DLM_APIENTRY', 'crDLMListBase', 'GLuint base'),
+	('int32_t DLM_APIENTRY', 'crDLMSaveState', 'void'),
 	#('void DLM_APIENTRY', 'crDLMListSent', 'CRDLM *dlm, unsigned long listIdentifier'),
 	#('GLboolean DLM_APIENTRY', 'crDLMIsListSent', 'CRDLM *dlm, unsigned long listIdentifier'),
@@ -95,4 +96,5 @@
 	struct DLMInstanceList *next;
 	struct DLMInstanceList *stateNext;
+	int    cbInstance;
 	void (*execute)(struct DLMInstanceList *instance, SPUDispatchTable *dispatchTable);
 } DLMInstanceList;
