diff options
authorChad Versace <>2013-08-20 17:36:24 -0700
committerIan Romanick <>2013-08-22 11:46:24 -0700
commitdce3865306b11df1f92f0b54a34c35ea945ee293 (patch)
parent8efdaedfc2fca8fd179f6e2ee2f46db76fc2129f (diff)
i965: Fix misapplication of gles3 srgb workaround
Fixes inconsistent failure of gles2conform/GL2Tests/glUniform/glUniform.test under gnome-shell. What follows is a description of the bug and its fix. When intel_update_renderbuffers() allocates a miptree for a winsys renderbuffer, it propagates the renderbuffer's format to become also the miptree's format. If the winsys color buffer format is SARGB, then, in the first call to eglMakeCurrent, intel_gles3_srgb_workaround() changes the renderbuffer's format to ARGB. That is, it changes the format from sRGB to non-sRGB. However, it changes the renderbuffer's format *after* intel_update_renderbuffers() has allocated the renderbuffer's miptree. Therefore, when eglMakeCurrent returns, the miptree format (SARGB) differs from the renderbuffer format (ARGB). If the X server reallocates the color buffer, intel_update_renderbuffers() will create a new miptree for the renderbuffer. The new miptree's format (ARGB) will differ from old miptree's format (SARGB). This mismatch between old and new miptrees causes bugs. Fix the bug by moving intel_gles3_srgb_workaround() to occur *before* intel_update_renderbuffers(). CC: "9.2" <> Reviewed-by: Ian Romanick <> Reviewed-by: Kenneth Graunke <> Bugzilla: Signed-off-by: Chad Versace <> (cherry picked from commit ce8639a766d0c36e676eea6f55135d9dccf1cb90)
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c
index 2e15a55fc25..95fce2f963c 100644
--- a/src/mesa/drivers/dri/i965/intel_context.c
+++ b/src/mesa/drivers/dri/i965/intel_context.c
@@ -754,11 +754,15 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
driContextPriv->dri2.read_stamp = driReadPriv->dri2.stamp - 1;
+ /* The sRGB workaround changes the renderbuffer's format. We must change
+ * the format before the renderbuffer's miptree get's allocated, otherwise
+ * the formats of the renderbuffer and its miptree will differ.
+ */
+ intel_gles3_srgb_workaround(brw, fb);
+ intel_gles3_srgb_workaround(brw, readFb);
_mesa_make_current(ctx, fb, readFb);
- intel_gles3_srgb_workaround(brw, ctx->WinSysDrawBuffer);
- intel_gles3_srgb_workaround(brw, ctx->WinSysReadBuffer);
else {
_mesa_make_current(NULL, NULL, NULL);