[cogl/cogl-1.10] Workaround drisw bug where clipped redraws don't work



commit cb5efc11873a28409603094bb290c4736be83e6f
Author: Robert Bragg <robert linux intel com>
Date:   Mon May 14 15:02:52 2012 +0100

    Workaround drisw bug where clipped redraws don't work
    
    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
    
    Reviewed-by: Neil Roberts <neil linux intel com>
    
    (cherry picked from commit 11f2f6ebb42398978ec8dd92b3c332ae8140a728)

 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 09da40a..c74e05a 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -240,8 +240,6 @@ cogl_context_new (CoglDisplay *display,
       g_assert_not_reached ();
     }
 
-  _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 b35ddbe..ebba3bf 100644
--- a/cogl/driver/gl/cogl-gl.c
+++ b/cogl/driver/gl/cogl-gl.c
@@ -155,6 +155,8 @@ _cogl_gl_update_features (CoglContext *context,
 
   _cogl_get_gl_version (&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 8087ae0..ed1f0e2 100644
--- a/cogl/driver/gles/cogl-gles.c
+++ b/cogl/driver/gles/cogl-gles.c
@@ -60,6 +60,8 @@ _cogl_gles_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 79800ac..ae07d61 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -421,8 +421,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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]