[Cogl] [PATCH 2/2] Workaround drisw bug where clipped redraws don't work

Robert Bragg robert at sixbynine.org
Mon May 14 14:18:15 PDT 2012


From: Robert Bragg <robert at linux.intel.com>

This detects when we are running on any of Mesa's software rasterizer
backends and disables use of glBlitFramebuffer and glXCopySubBuffer.
Both of these currently result in full-screen copies so there's little
point in using these to optimize how much of the screen we present.

To help ensure we re-evaluate this workaround periodically we have added
a comment marker of "ONGOING BUG" above the workaround and added a note
to our RELEASING document that says we should grep for this marker and
write a NEWS section about ongoing bug workarounds.

https://bugzilla.gnome.org/show_bug.cgi?id=674208
---
 cogl/cogl-context.c           |    2 --
 cogl/driver/gl/cogl-gl.c      |    2 ++
 cogl/driver/gles/cogl-gles.c  |    2 ++
 cogl/winsys/cogl-winsys-glx.c |   26 ++++++++++++++++++++++++--
 doc/RELEASING                 |    3 +++
 5 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index b989a8a..73871d4 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -244,8 +244,6 @@ cogl_context_new (CoglDisplay *display,
       return NULL;
     }
 
-  _cogl_gpu_info_init (context, &context->gpu);
-
   context->attribute_name_states_hash =
     g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
   context->attribute_name_index_map = NULL;
diff --git a/cogl/driver/gl/cogl-gl.c b/cogl/driver/gl/cogl-gl.c
index 1ff3f2c..1a020ed 100644
--- a/cogl/driver/gl/cogl-gl.c
+++ b/cogl/driver/gl/cogl-gl.c
@@ -339,6 +339,8 @@ _cogl_driver_update_features (CoglContext *ctx,
 
   _cogl_get_gl_version (ctx, &gl_major, &gl_minor);
 
+  _cogl_gpu_info_init (ctx, &ctx->gpu);
+
   flags = (COGL_FEATURE_TEXTURE_READ_PIXELS
            | COGL_FEATURE_UNSIGNED_INT_INDICES
            | COGL_FEATURE_DEPTH_RANGE);
diff --git a/cogl/driver/gles/cogl-gles.c b/cogl/driver/gles/cogl-gles.c
index 1e07f20..b570fea 100644
--- a/cogl/driver/gles/cogl-gles.c
+++ b/cogl/driver/gles/cogl-gles.c
@@ -184,6 +184,8 @@ _cogl_driver_update_features (CoglContext *context,
              context->glGetString (GL_VERSION),
              context->glGetString (GL_EXTENSIONS));
 
+  _cogl_gpu_info_init (context, &context->gpu);
+
   gl_extensions = (const char*) context->glGetString (GL_EXTENSIONS);
 
   _cogl_feature_check_ext_functions (context,
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index 4e2249c..e6ca6ac 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -420,8 +420,30 @@ update_winsys_features (CoglContext *context, GError **error)
                     TRUE);
 
   if (glx_renderer->pf_glXCopySubBuffer || context->glBlitFramebuffer)
-    COGL_FLAGS_SET (context->winsys_features,
-                    COGL_WINSYS_FEATURE_SWAP_REGION, TRUE);
+    {
+      CoglGpuInfoArchitecture arch;
+
+      /* XXX: ONGOING BUG:
+       * (Don't change the line above since we use this to grep for
+       * un-resolved bug workarounds as part of the release process.)
+       *
+       * "The "drisw" binding in Mesa for loading sofware renderers is
+       * broken, and neither glBlitFramebuffer nor glXCopySubBuffer
+       * work correctly."
+       * - ajax
+       * - https://bugzilla.gnome.org/show_bug.cgi?id=674208
+       *
+       * This is broken in software Mesa at least as of 7.10
+       */
+      arch = context->gpu.architecture;
+      if (arch == COGL_GPU_INFO_ARCHITECTURE_LLVMPIPE ||
+          arch == COGL_GPU_INFO_ARCHITECTURE_SOFTPIPE ||
+          arch == COGL_GPU_INFO_ARCHITECTURE_SWRAST)
+	{
+	  COGL_FLAGS_SET (context->winsys_features,
+			  COGL_WINSYS_FEATURE_SWAP_REGION, TRUE);
+	}
+    }
 
   /* Note: glXCopySubBuffer and glBlitFramebuffer won't be throttled
    * by the SwapInterval so we have to throttle swap_region requests
diff --git a/doc/RELEASING b/doc/RELEASING
index 4fa0ebc..4f23f15 100644
--- a/doc/RELEASING
+++ b/doc/RELEASING
@@ -52,6 +52,9 @@ When making a new release;
         - Use git shortlog -n -s to get the list of authors
         - The following bash snippet may help with extracting the list of
           bugs closed:
+        - Grep the source code for "XXX: ONGOING BUG" and add a
+          section about workarounds for un-resolved upstream bugs.
+
 
 URLS=$(git log $1|grep bugzilla|sort|uniq)
 for i in $URLS
-- 
1.7.7.6



More information about the Cogl mailing list