[cairo-commit] glitz/src/glx glitz_glx_context.c, 1.9, 1.10 glitz_glx_drawable.c, 1.7, 1.8 glitz_glx_info.c, 1.6, 1.7 glitz_glxint.h, 1.6, 1.7

David Reveman commit at pdx.freedesktop.org
Mon Mar 13 06:23:46 PST 2006


Committed by: davidr

Update of /cvs/cairo/glitz/src/glx
In directory kemper:/tmp/cvs-serv20671/src/glx

Modified Files:
	glitz_glx_context.c glitz_glx_drawable.c glitz_glx_info.c 
	glitz_glxint.h 
Log Message:
Add support for avoiding context switches

Index: glitz_glx_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glx/glitz_glx_context.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- glitz_glx_context.c	13 Mar 2006 13:42:46 -0000	1.9
+++ glitz_glx_context.c	13 Mar 2006 14:23:44 -0000	1.10
@@ -379,7 +379,10 @@
 	drawable->screen_info->display_info;
 
     if (finish)
+    {
 	glFinish ();
+	drawable->base.finished = 1;
+    }
 
     if (display_info->thread_info->cctx)
     {
@@ -404,11 +407,23 @@
 
 static void
 _glitz_glx_context_update (glitz_glx_drawable_t *drawable,
-			   glitz_constraint_t   constraint)
+			   glitz_constraint_t   constraint,
+			   glitz_bool_t         *restore_state)
 {
     glitz_glx_display_info_t *dinfo = drawable->screen_info->display_info;
     GLXContext context = NULL;
 
+    if (restore_state && constraint == GLITZ_ANY_CONTEXT_CURRENT)
+    {
+	if (dinfo->thread_info->cctx)
+	{
+	    *restore_state = 1;
+	    return;
+	}
+    }
+
+    drawable->base.flushed = drawable->base.finished = 0;
+
     switch (constraint) {
     case GLITZ_NONE:
 	break;
@@ -446,13 +461,17 @@
 glitz_bool_t
 glitz_glx_push_current (void               *abstract_drawable,
 			glitz_surface_t    *surface,
-			glitz_constraint_t constraint)
+			glitz_constraint_t constraint,
+			glitz_bool_t       *restore_state)
 {
     glitz_glx_drawable_t *drawable = (glitz_glx_drawable_t *)
 	abstract_drawable;
     glitz_glx_context_info_t *context_info;
     int index;
 
+    if (restore_state)
+	*restore_state = 0;
+
     index = drawable->screen_info->context_stack_size++;
 
     context_info = &drawable->screen_info->context_stack[index];
@@ -460,7 +479,8 @@
     context_info->surface = surface;
     context_info->constraint = constraint;
 
-    _glitz_glx_context_update (context_info->drawable, constraint);
+    _glitz_glx_context_update (context_info->drawable, constraint,
+			       restore_state);
 
     return 1;
 }
@@ -480,7 +500,8 @@
 
     if (context_info->drawable)
 	_glitz_glx_context_update (context_info->drawable,
-				   context_info->constraint);
+				   context_info->constraint,
+				   NULL);
 
     if (context_info->constraint == GLITZ_DRAWABLE_CURRENT)
 	return context_info->surface;

Index: glitz_glx_drawable.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glx/glitz_glx_drawable.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- glitz_glx_drawable.c	13 Mar 2006 13:42:46 -0000	1.7
+++ glitz_glx_drawable.c	13 Mar 2006 14:23:44 -0000	1.8
@@ -57,7 +57,7 @@
 			  width, height);
 
     if (!context->initialized) {
-	glitz_glx_push_current (drawable, NULL, GLITZ_CONTEXT_CURRENT);
+	glitz_glx_push_current (drawable, NULL, GLITZ_CONTEXT_CURRENT, NULL);
 	glitz_glx_pop_current (drawable);
     }
 
@@ -213,7 +213,7 @@
 	 * be our last chance to have a context current.
 	 */
 	glitz_glx_push_current (abstract_drawable, NULL,
-				GLITZ_CONTEXT_CURRENT);
+				GLITZ_CONTEXT_CURRENT, NULL);
 	glitz_program_map_fini (drawable->base.backend->gl,
 				&drawable->screen_info->program_map);
 	glitz_program_map_init (&drawable->screen_info->program_map);

Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glx/glitz_glx_info.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- glitz_glx_info.c	13 Mar 2006 13:42:46 -0000	1.6
+++ glitz_glx_info.c	13 Mar 2006 14:23:44 -0000	1.7
@@ -258,9 +258,9 @@
 
     if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_COPY_SUB_BUFFER_MASK)
     {
-	screen_info->glx.copy_sub_buffer = (glitz_glx_copy_sub_buffer_t)
-	    glitz_glx_get_proc_address ("glXCopySubBufferMESA",
-					(void *) screen_info);
+        screen_info->glx.copy_sub_buffer = (glitz_glx_copy_sub_buffer_t)
+            glitz_glx_get_proc_address ("glXCopySubBufferMESA",
+                                        (void *) screen_info);
 
 	if (!screen_info->glx.copy_sub_buffer)
 	    screen_info->glx_feature_mask &=

Index: glitz_glxint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glx/glitz_glxint.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- glitz_glxint.h	13 Mar 2006 13:42:46 -0000	1.6
+++ glitz_glxint.h	13 Mar 2006 14:23:44 -0000	1.7
@@ -167,7 +167,8 @@
 extern glitz_bool_t __internal_linkage
 glitz_glx_push_current (void               *abstract_drawable,
 			glitz_surface_t    *surface,
-			glitz_constraint_t constraint);
+			glitz_constraint_t constraint,
+			glitz_bool_t       *restore_state);
 
 extern glitz_surface_t __internal_linkage *
 glitz_glx_pop_current (void *abstract_drawable);



More information about the cairo-commit mailing list