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

mesa: Changes to 'upstream-experimental'



Rebased ref, commits from common ancestor:
commit 33b581f6f6d4e5aab65983f24d06b1dd56882f37
Author: Jon Severinsson <jon@severinsson.net>
Date:   Sun Aug 11 19:37:01 2013 +0200

    radeon/llvm: Add missing "%s" format string to fprintf.
    
    This fixes a compilation warning with -Wformat-security.
    
    CC: "9.2" <mesa-stable@lists.freedesktop.org>
    
    Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
    (cherry picked from commit 9298f537a72dc2323898e91c40894f55e3c4754a)

diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c
index 1a4d4fd..2dd7bf7 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
@@ -124,7 +124,7 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_llvm_binary *binary,
 	r = LLVMTargetMachineEmitToMemoryBuffer(tm, M, LLVMObjectFile, &err,
 								 &out_buffer);
 	if (r) {
-		fprintf(stderr, err);
+		fprintf(stderr, "%s", err);
 		FREE(err);
 		return 1;
 	}

commit c088c24588365524f0106936f3d521c9866d9f95
Author: Tapani Pälli <tapani.palli@intel.com>
Date:   Fri Jul 26 10:21:56 2013 +0300

    glsl: disable ARB_texture_cube_map_array_enable keywords for glsl es
    
    Patch fixes a crash with Webgl 'shader-with-non-reserved-words'
    conformance test by ignoring desktop extension keywords on GLSL ES.
    
    v2: fix reserved and allowed desktop glsl versions (Chris)
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64087
    Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
    Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    (cherry picked from commit 8c211dd742669bc03b44186e41e5aa40081d6bcc)

diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index 6c5d003..3340c23 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -324,30 +324,11 @@ sampler2DMSArray   KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multi
 isampler2DMSArray  KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, ISAMPLER2DMSARRAY);
 usampler2DMSArray  KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, USAMPLER2DMSARRAY);
 
-samplerCubeArray	{
-			  if (yyextra->ARB_texture_cube_map_array_enable)
-			     return SAMPLERCUBEARRAY;
-			  else
-			     return IDENTIFIER;
-		}
-isamplerCubeArray	{
-			  if (yyextra->ARB_texture_cube_map_array_enable)
-			     return ISAMPLERCUBEARRAY;
-			  else
-			     return IDENTIFIER;
-		}
-usamplerCubeArray	{
-			  if (yyextra->ARB_texture_cube_map_array_enable)
-			     return USAMPLERCUBEARRAY;
-			  else
-			     return IDENTIFIER;
-		}
-samplerCubeArrayShadow	{
-			  if (yyextra->ARB_texture_cube_map_array_enable)
-			     return SAMPLERCUBEARRAYSHADOW;
-			  else
-			     return IDENTIFIER;
-		}
+   /* keywords available with ARB_texture_cube_map_array_enable extension on desktop GLSL */
+samplerCubeArray   KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAY);
+isamplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, ISAMPLERCUBEARRAY);
+usamplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, USAMPLERCUBEARRAY);
+samplerCubeArrayShadow   KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAYSHADOW);
 
 samplerExternalOES		{
 			  if (yyextra->OES_EGL_image_external_enable)

commit 7d6dcb61cdaba3a158b2b9635bf029a17cc8543d
Author: Armin K <krejzi@email.com>
Date:   Tue Aug 13 15:38:56 2013 -0700

    gbm: Link to libwayland-drm if Wayland EGL platform is enabled
    
    We were relying on libEGL to pull in libwayland-client symbols, but with
    commit 2c2e64edaba0f6aeb181ca5b51eb8dea8e9b39f9 cleaned up the
    symbol leak.
    
    CC: "9.2" <mesa-stable@lists.freedesktop.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67962
    Tested-by: Bryce Harrington <b.harrington@samsung.com>
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
    (cherry picked from commit f423eba46e080b975a2b8366b490d99dee4729ad)

diff --git a/src/Makefile.am b/src/Makefile.am
index b3dc44d..76280a0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,6 +29,10 @@ if HAVE_DRI_GLX
 SUBDIRS += glx
 endif
 
+if HAVE_EGL_PLATFORM_WAYLAND
+SUBDIRS += egl/wayland
+endif
+
 if HAVE_GBM
 SUBDIRS += gbm
 endif
diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index e6380ec..cff943f 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -21,8 +21,4 @@
 
 SUBDIRS=
 
-if HAVE_EGL_PLATFORM_WAYLAND
-SUBDIRS += wayland
-endif
-
 SUBDIRS += drivers main
diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
index e22c55c..1282b14 100644
--- a/src/gbm/Makefile.am
+++ b/src/gbm/Makefile.am
@@ -24,6 +24,7 @@ libgbm_la_LIBADD = $(LIBUDEV_LIBS) $(LIBKMS_LIBS) $(DLOPEN_LIBS)
 if HAVE_EGL_PLATFORM_WAYLAND
 AM_CPPFLAGS = -DHAVE_WAYLAND_PLATFORM
 AM_CFLAGS += $(WAYLAND_CFLAGS)
+libgbm_la_LIBADD += $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la $(WAYLAND_LIBS)
 endif
 
 if HAVE_DRI
@@ -38,7 +39,7 @@ libgbm_dri_la_CFLAGS = \
 	$(LIBDRM_CFLAGS)
 
 libgbm_la_LIBADD += \
-	libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la
+	libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la $(LIBDRM_LIBS)
 endif
 
 all-local: libgbm.la

commit 8025bac852dd059e164077522d3159d636ac2a9a
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Aug 8 17:40:38 2013 -0700

    glsl: Require function return type arrays be explicitly sized
    
    Fixes piglit array-function-return-unsized.vert.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Cc: "9.2" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit 1b35e33af420cd335610289aa2d8a175a7139a97)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 2706b38..992195c 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3359,6 +3359,18 @@ ast_function::hir(exec_list *instructions,
 		       "function `%s' return type has qualifiers", name);
    }
 
+   /* Section 6.1 (Function Definitions) of the GLSL 1.20 spec says:
+    *
+    *     "Arrays are allowed as arguments and as the return type. In both
+    *     cases, the array must be explicitly sized."
+    */
+   if (return_type->is_array() && return_type->length == 0) {
+      YYLTYPE loc = this->get_location();
+      _mesa_glsl_error(& loc, state,
+		       "function `%s' return type array must be explicitly "
+		       "sized", name);
+   }
+
    /* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
     *
     *    "[Sampler types] can only be declared as function parameters

commit 5d6dc93490324cec64a9653068d4095505594a2c
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Aug 8 17:23:01 2013 -0700

    glsl: Move and refine test for unsized arrays in GLSL ES
    
    GLSL ES does not allow unsized arrays, and GLSL ES 1.00 does not allow
    array initializers.  However, GLSL ES 3.00 allows array initializers,
    and the initializer can explicitly size the array.  The specification
    even includes some examples of this:
    
        float x[] = float[2] (1.0, 2.0);     // declares an array of size 2
        float y[] = float[] (1.0, 2.0, 3.0); // declares an array of size 3
    
        float a[5];
        float b[] = a;
    
    Move the unsized array check to after the initializer has been
    processed.  If the array is still unsized, generate the error.  This
    should have no effect in GLSL ES 1.00 because, as previously mentioned,
    array initializers are not allowed.
    
    Fixes piglit "glsl-es-3.00 compiler array-sized-by-initializer.vert".
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Cc: "9.1 9.2" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit 42624b1c8145375f987e380bb78456658f845a17)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 932e38a..2706b38 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1771,12 +1771,6 @@ process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size,
 	    }
 	 }
       }
-   } else if (state->es_shader) {
-      /* Section 10.17 of the GLSL ES 1.00 specification states that unsized
-       * array declarations have been removed from the language.
-       */
-      _mesa_glsl_error(loc, state, "unsized array declarations are not "
-		       "allowed in GLSL ES 1.00.");
    }
 
    const glsl_type *array_type = glsl_type::get_array_instance(base, length);
@@ -3030,6 +3024,33 @@ ast_declarator_list::hir(exec_list *instructions,
 			  decl->identifier);
       }
 
+      if (state->es_shader) {
+	 const glsl_type *const t = (earlier == NULL)
+	    ? var->type : earlier->type;
+
+         if (t->is_array() && t->length == 0)
+            /* Section 10.17 of the GLSL ES 1.00 specification states that
+             * unsized array declarations have been removed from the language.
+             * Arrays that are sized using an initializer are still explicitly
+             * sized.  However, GLSL ES 1.00 does not allow array
+             * initializers.  That is only allowed in GLSL ES 3.00.
+             *
+             * Section 4.1.9 (Arrays) of the GLSL ES 3.00 spec says:
+             *
+             *     "An array type can also be formed without specifying a size
+             *     if the definition includes an initializer:
+             *
+             *         float x[] = float[2] (1.0, 2.0);     // declares an array of size 2
+             *         float y[] = float[] (1.0, 2.0, 3.0); // declares an array of size 3
+             *
+             *         float a[5];
+             *         float b[] = a;"
+             */
+            _mesa_glsl_error(& loc, state,
+                             "unsized array declarations are not allowed in "
+                             "GLSL ES");
+      }
+
       /* If the declaration is not a redeclaration, there are a few additional
        * semantic checks that must be applied.  In addition, variable that was
        * created for the declaration should be added to the IR stream.

commit 31f582abd479a82a2beb5f2b8fe6a79211e1519f
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Aug 8 18:17:24 2013 -0700

    glx: Generate GLXBadDrawable when drawable is zero
    
    Fixes piglit glx-query-drawable-GLXBadDrawable.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
    Cc: "9.2" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit d5aee174b88878e6d47dc1fadd3935f535fd85f0)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index f11305a..183fbaa 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -40,9 +40,10 @@
 #ifdef GLX_USE_APPLEGL
 #include <pthread.h>
 #include "apple_glx_drawable.h"
-#include "glx_error.h"
 #endif
 
+#include "glx_error.h"
+
 #define WARN_ONCE_GLX_1_3(a, b) {		\
 		static int warned=1;		\
 		if(warned) {			\
@@ -279,7 +280,16 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
    unsigned int num_attributes;
    GLboolean use_glx_1_3;
 
-   if ((dpy == NULL) || (drawable == 0)) {
+   if (dpy == NULL)
+      return 0;
+
+   /* Page 38 (page 52 of the PDF) of glxencode1.3.pdf says:
+    *
+    *     "If drawable is not a valid GLX drawable, a GLXBadDrawable error is
+    *     generated."
+    */
+   if (drawable == 0) {
+      __glXSendError(dpy, GLXBadDrawable, 0, X_GLXGetDrawableAttributes, false);
       return 0;
    }
 

commit 0b131ae24fb3acaebbc8ac2c595818574d26c388
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Aug 8 15:41:36 2013 -0700

    mesa: Use _mesa_detach_renderbuffer when deleting a texture
    
    The functional change is that now invalidate_framebuffer is called if
    the texture is actually detached from one of the currently bound FBOs.
    Previously this was only done for renderbuffers.
    
    The remaining changes make the texture delete path look more similar to
    the renderbuffer delete path.  This includes adding relevant spec
    quotations to justify the behavior.
    
    Fixes piglit fbo-incomplete "delete texture of bound FBO" test.
    
    v2: Move 'fb->Attachment[i].Texture == att' check from previous patch to
    this patch... where it was intended to be in the first place.  Noticed
    by Chad.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
    Cc: "9.2" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit ef83bd2b9581c680439a5d22979c2f1b49b2834d)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index f5a2851..53e2ab7 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1223,10 +1223,8 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
 
 
 /**
- * If the given renderbuffer is anywhere attached to the framebuffer, detach
- * the renderbuffer.
- * This is used when a renderbuffer object is deleted.
- * The spec calls for unbinding.
+ * Remove the specified renderbuffer or texture from any attachment point in
+ * the framebuffer.
  *
  * \returns
  * \c true if the renderbuffer was detached from an attachment point.  \c
@@ -1241,7 +1239,8 @@ _mesa_detach_renderbuffer(struct gl_context *ctx,
    bool progress = false;
 
    for (i = 0; i < BUFFER_COUNT; i++) {
-      if (fb->Attachment[i].Renderbuffer == att) {
+      if (fb->Attachment[i].Texture == att
+          || fb->Attachment[i].Renderbuffer == att) {
          _mesa_remove_attachment(ctx, &fb->Attachment[i]);
          progress = true;
       }
@@ -1286,6 +1285,23 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
                _mesa_BindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
             }
 
+            /* Section 4.4.2 (Attaching Images to Framebuffer Objects),
+             * subsection "Attaching Renderbuffer Images to a Framebuffer," of
+             * the OpenGL 3.1 spec says:
+             *
+             *     "If a renderbuffer object is deleted while its image is
+             *     attached to one or more attachment points in the currently
+             *     bound framebuffer, then it is as if FramebufferRenderbuffer
+             *     had been called, with a renderbuffer of 0, for each
+             *     attachment point to which this image was attached in the
+             *     currently bound framebuffer. In other words, this
+             *     renderbuffer image is first detached from all attachment
+             *     points in the currently bound framebuffer. Note that the
+             *     renderbuffer image is specifically not detached from any
+             *     non-bound framebuffers. Detaching the image from any
+             *     non-bound framebuffers is the responsibility of the
+             *     application.
+             */
             if (_mesa_is_user_fbo(ctx->DrawBuffer)) {
                _mesa_detach_renderbuffer(ctx, ctx->DrawBuffer, rb);
             }
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 334dee7..9942fb1 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1040,23 +1040,35 @@ static void
 unbind_texobj_from_fbo(struct gl_context *ctx,
                        struct gl_texture_object *texObj)
 {
-   const GLuint n = (ctx->DrawBuffer == ctx->ReadBuffer) ? 1 : 2;
-   GLuint i;
+   bool progress = false;
 
-   for (i = 0; i < n; i++) {
-      struct gl_framebuffer *fb = (i == 0) ? ctx->DrawBuffer : ctx->ReadBuffer;
-      if (_mesa_is_user_fbo(fb)) {
-         GLuint j;
-         for (j = 0; j < BUFFER_COUNT; j++) {
-            if (fb->Attachment[j].Type == GL_TEXTURE &&
-                fb->Attachment[j].Texture == texObj) {
-	       /* Vertices are already flushed by _mesa_DeleteTextures */
-	       ctx->NewState |= _NEW_BUFFERS;
-               _mesa_remove_attachment(ctx, fb->Attachment + j);         
-            }
-         }
-      }
+   /* Section 4.4.2 (Attaching Images to Framebuffer Objects), subsection
+    * "Attaching Texture Images to a Framebuffer," of the OpenGL 3.1 spec
+    * says:
+    *
+    *     "If a texture object is deleted while its image is attached to one
+    *     or more attachment points in the currently bound framebuffer, then
+    *     it is as if FramebufferTexture* had been called, with a texture of
+    *     zero, for each attachment point to which this image was attached in
+    *     the currently bound framebuffer. In other words, this texture image
+    *     is first detached from all attachment points in the currently bound
+    *     framebuffer. Note that the texture image is specifically not
+    *     detached from any other framebuffer objects. Detaching the texture
+    *     image from any other framebuffer objects is the responsibility of
+    *     the application."
+    */
+   if (_mesa_is_user_fbo(ctx->DrawBuffer)) {
+      progress = _mesa_detach_renderbuffer(ctx, ctx->DrawBuffer, texObj);
    }
+   if (_mesa_is_user_fbo(ctx->ReadBuffer)
+       && ctx->ReadBuffer != ctx->DrawBuffer) {
+      progress = _mesa_detach_renderbuffer(ctx, ctx->ReadBuffer, texObj)
+         || progress;
+   }
+
+   if (progress)
+      /* Vertices are already flushed by _mesa_DeleteTextures */
+      ctx->NewState |= _NEW_BUFFERS;
 }
 
 

commit 8ee4a4e417b5f53215177f445afa7fa8618da5e1
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Aug 8 15:26:36 2013 -0700

    mesa: Make detach_renderbuffer available outside fbobject.c
    
    Also add a return value indicating whether any work was done.
    
    This will be used by the next patch.
    
    v2: Move 'fb->Attachment[i].Texture == att' check to the next
    patch... where it was intended to be in the first place.  Noticed by
    Chad.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
    Cc: "9.2" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit 438cc6bc49d109f9ddeed6a741c4f0b8f1c4ffe2)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index a0d6cc2..f5a2851 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1227,19 +1227,42 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
  * the renderbuffer.
  * This is used when a renderbuffer object is deleted.
  * The spec calls for unbinding.
+ *
+ * \returns
+ * \c true if the renderbuffer was detached from an attachment point.  \c
+ * false otherwise.
  */
-static void
-detach_renderbuffer(struct gl_context *ctx,
-                    struct gl_framebuffer *fb,
-                    struct gl_renderbuffer *rb)
+bool
+_mesa_detach_renderbuffer(struct gl_context *ctx,
+                          struct gl_framebuffer *fb,
+                          const void *att)
 {
-   GLuint i;
+   unsigned i;
+   bool progress = false;
+
    for (i = 0; i < BUFFER_COUNT; i++) {
-      if (fb->Attachment[i].Renderbuffer == rb) {
+      if (fb->Attachment[i].Renderbuffer == att) {
          _mesa_remove_attachment(ctx, &fb->Attachment[i]);
+         progress = true;
       }
    }
-   invalidate_framebuffer(fb);
+
+   /* Section 4.4.4 (Framebuffer Completeness), subsection "Whole Framebuffer
+    * Completeness," of the OpenGL 3.1 spec says:
+    *
+    *     "Performing any of the following actions may change whether the
+    *     framebuffer is considered complete or incomplete:
+    *
+    *     ...
+    *
+    *        - Deleting, with DeleteTextures or DeleteRenderbuffers, an object
+    *          containing an image that is attached to a framebuffer object
+    *          that is bound to the framebuffer."
+    */
+   if (progress)
+      invalidate_framebuffer(fb);
+
+   return progress;
 }
 
 
@@ -1264,11 +1287,11 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
             }
 
             if (_mesa_is_user_fbo(ctx->DrawBuffer)) {
-               detach_renderbuffer(ctx, ctx->DrawBuffer, rb);
+               _mesa_detach_renderbuffer(ctx, ctx->DrawBuffer, rb);
             }
             if (_mesa_is_user_fbo(ctx->ReadBuffer)
                 && ctx->ReadBuffer != ctx->DrawBuffer) {
-               detach_renderbuffer(ctx, ctx->ReadBuffer, rb);
+               _mesa_detach_renderbuffer(ctx, ctx->ReadBuffer, rb);
             }
 
 	    /* Remove from hash table immediately, to free the ID.
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 0a2a5cc..ab138cf 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -28,6 +28,7 @@
 
 #include "compiler.h"
 #include "glheader.h"
+#include <stdbool.h>
 
 struct gl_context;
 struct gl_texture_object;
@@ -113,6 +114,11 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
 extern GLenum
 _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat);
 
+extern bool
+_mesa_detach_renderbuffer(struct gl_context *ctx,
+                          struct gl_framebuffer *fb,
+                          const void *att);
+
 extern GLboolean GLAPIENTRY
 _mesa_IsRenderbuffer(GLuint renderbuffer);
 

commit 0c405cd0e827eaa4c5d6ec3f533616208c73baf5
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Aug 8 12:33:04 2013 -0700

    meta: Don't call _mesa_Ortho with width or height of 0
    
    Fixes failures in oglconform fbo mipmap.manual.color,
    mipmap.manual.colorAndDepth, mipmap.automatic, and
    mipmap.manualIterateTexTargets subtests.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
    Cc: "9.2" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit 341fb93c162052e0b1eff7f5e53c49aba498ee9a)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 4a3497c..286f32e 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -704,9 +704,14 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
       _mesa_LoadIdentity();
       _mesa_MatrixMode(GL_PROJECTION);
       _mesa_LoadIdentity();
-      _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
-                  0.0, ctx->DrawBuffer->Height,
-                  -1.0, 1.0);
+
+      /* glOrtho with width = 0 or height = 0 generates GL_INVALID_VALUE.
+       * This can occur when there is no draw buffer.
+       */
+      if (ctx->DrawBuffer->Width != 0 && ctx->DrawBuffer->Height != 0)
+         _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
+                     0.0, ctx->DrawBuffer->Height,
+                     -1.0, 1.0);
    }
 
    if (state & MESA_META_CLIP) {

commit b76ff3dbcdb8ccbbd3426a6fef7688fbdb9ba46d
Author: Vadim Girlin <vadimgirlin@gmail.com>
Date:   Sun Aug 11 02:52:34 2013 +0400

    r600g/sb: use MULADD workaround on R7xx for MULADD_IEEE
    
    Looks like the same issue that was seen with MULADD in trans slot on
    R7xx also affects MULADD_IEEE (maybe all OP3 instructions and MULADD is
    just a most frequently used?). So the workaround is to not allow affected
    instructions to be placed into the trans slot.
    
    Fixes https://bugs.freedesktop.org/show_bug.cgi?id=67927
    
    Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
    Cc: "9.2" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit 17bb96b03d340c0aee8e1a332fdcd695e9179486)

diff --git a/src/gallium/drivers/r600/sb/sb_sched.cpp b/src/gallium/drivers/r600/sb/sb_sched.cpp
index f0e41f5..2792315 100644
--- a/src/gallium/drivers/r600/sb/sb_sched.cpp
+++ b/src/gallium/drivers/r600/sb/sb_sched.cpp
@@ -1490,7 +1490,8 @@ unsigned post_scheduler::try_add_instruction(node *n) {
 
 		// FIXME workaround for some problems with MULADD in trans slot on r700,
 		// (is it really needed on r600?)
-		if (a->bc.op == ALU_OP3_MULADD && !ctx.is_egcm()) {
+		if ((a->bc.op == ALU_OP3_MULADD || a->bc.op == ALU_OP3_MULADD_IEEE) &&
+				!ctx.is_egcm()) {
 			allowed_slots &= 0x0F;
 		}
 

commit cb8e109492a911977fd646343a26169edd4a9aee
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Aug 8 16:42:37 2013 -0700

    glsl: Don't allow const on out or inout function parameters
    
    Fixes piglit tests const-inout-parameter.frag and
    const-out-parameter.frag.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Matt Turner <mattst88@gmail.com>
    Cc: "9.2" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit 58948981480c1fe93a171373c7676761e4d0b41e)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index be7755d..932e38a 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1963,6 +1963,21 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
 		       _mesa_glsl_shader_target_name(state->target));
    }
 
+   /* Section 6.1.1 (Function Calling Conventions) of the GLSL 1.10 spec says:
+    *
+    *     "However, the const qualifier cannot be used with out or inout."
+    *
+    * The same section of the GLSL 4.40 spec further clarifies this saying:
+    *
+    *     "The const qualifier cannot be used with out or inout, or a
+    *     compile-time error results."
+    */
+   if (is_parameter && qual->flags.q.constant && qual->flags.q.out) {
+      _mesa_glsl_error(loc, state,
+                       "`const' may not be applied to `out' or `inout' "
+                       "function parameters");
+   }
+
    /* If there is no qualifier that changes the mode of the variable, leave
     * the setting alone.
     */

commit 4006fc46563cd14e05ffb0a97888d7e8d06b979c
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Thu Aug 8 21:11:22 2013 -0400

    r600g: disable GPUVM by default
    
    Cayman and trinity systems still seem to suffer from
    stability problems with GPUVM.  This also fixes compute
    on these asics.  It can still be enabled for testing
    by setting env var RADEON_VA=true.
    
    Fixes:
    https://bugs.freedesktop.org/show_bug.cgi?id=65958
    
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    CC: "9.2" <mesa-stable@lists.freedesktop.org>
    CC: "9.1" <mesa-stable@lists.freedesktop.org>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    (cherry picked from commit c88783047e2a0faa39d6f3ac6fbd3f26a480d5d3)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index 033e78f..69c42a0 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -404,7 +404,7 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
                                       &ws->info.r600_ib_vm_max_size))
                 ws->info.r600_virtual_address = FALSE;
         }
-	if (ws->gen == DRV_R600 && !debug_get_bool_option("RADEON_VA", TRUE))
+	if (ws->gen == DRV_R600 && !debug_get_bool_option("RADEON_VA", FALSE))
 		ws->info.r600_virtual_address = FALSE;
     }
 

commit 731a08341efa398244b3e871442a7a0b107a1fb9
Author: Chad Versace <chad.versace@linux.intel.com>
Date:   Thu Aug 1 08:10:31 2013 -0700

    egl: Do not export private symbols
    
    libEGL was incorrectly exporting *all* symbols, public and private.
    This patch adds -fvisibility=hidden to libEGL's linker flags to ensure
    that only symbols annotated with __attribute__((visibility("default")))
    get exported.
    
    Sanity-checked with libEGL's builtin DRI2 driver and the i965 DRI driver
    by running Piglit on X/EGL and by running weston-gears on Weston as an
    X client.
    
    Sanity-checked with libEGL's Gallium driver (which is not built-in) and
    the swrast Gallium driver by running es2gears_x11.
    
    Kristian reviewed the symbol diff in `nm libEGL.so`.
    
    CC: "9.2" <mesa-stable@lists.freedesktop.org>
    CC: Ian Romanick <idr@freedesktop.org>
    Acked-by: Kristian Høgsberg <krh@bitplanet.net>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
    Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
    (cherry picked from commit 2c2e64edaba0f6aeb181ca5b51eb8dea8e9b39f9)

diff --git a/src/egl/drivers/dri2/Makefile.am b/src/egl/drivers/dri2/Makefile.am
index 45f7dfa..823ef5e 100644
--- a/src/egl/drivers/dri2/Makefile.am
+++ b/src/egl/drivers/dri2/Makefile.am
@@ -28,6 +28,7 @@ AM_CFLAGS = \
 	-I$(top_srcdir)/src/egl/wayland/wayland-drm \
 	-I$(top_builddir)/src/egl/wayland/wayland-drm \
 	$(DEFINES) \
+	$(VISIBILITY_CFLAGS) \
 	$(LIBDRM_CFLAGS) \
 	$(LIBUDEV_CFLAGS) \
 	$(LIBKMS_CFLAGS) \
diff --git a/src/egl/drivers/glx/Makefile.am b/src/egl/drivers/glx/Makefile.am
index 6bf67ea..6db95b4 100644
--- a/src/egl/drivers/glx/Makefile.am
+++ b/src/egl/drivers/glx/Makefile.am
@@ -22,6 +22,7 @@
 AM_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/egl/main \
+	$(VISIBILITY_CFLAGS) \
 	$(X11_CFLAGS) \
 	$(DEFINES)
 
diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
index ca5257a..cbb6a4d 100644
--- a/src/egl/main/Makefile.am
+++ b/src/egl/main/Makefile.am
@@ -29,6 +29,7 @@ AM_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/gbm/main \
 	$(DEFINES) \
+	$(VISIBILITY_CFLAGS) \
 	$(EGL_CFLAGS) \
 	-D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
 	-D_EGL_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\" \
diff --git a/src/egl/wayland/wayland-drm/Makefile.am b/src/egl/wayland/wayland-drm/Makefile.am
index 4b2aeb3..08ee497 100644
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -1,6 +1,7 @@
 AM_CFLAGS = -I$(top_srcdir)/src/egl/main \
 	    -I$(top_srcdir)/include \
 	    $(DEFINES) \
+	    $(VISIBILITY_CFLAGS) \
 	    $(WAYLAND_CFLAGS) 
 
 noinst_LTLIBRARIES = libwayland-drm.la
diff --git a/src/egl/wayland/wayland-egl/Makefile.am b/src/egl/wayland/wayland-egl/Makefile.am
index 7d20a1a..138c170 100644
--- a/src/egl/wayland/wayland-egl/Makefile.am
+++ b/src/egl/wayland/wayland-egl/Makefile.am
@@ -2,6 +2,7 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = wayland-egl.pc
 
 AM_CFLAGS = $(DEFINES) \
+	    $(VISIBILITY_CFLAGS) \
 	    $(WAYLAND_CFLAGS)
 
 lib_LTLIBRARIES = libwayland-egl.la

commit 3da0c76ec0717f61d1fd6d60baacc75ed67c2bce
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Tue Aug 6 14:36:09 2013 -0700

    i965: Remember to call intel_prepare_render() before blitting.
    
    Otherwise, blits to the window system buffer may cause crashes,
    since dst_irb->mt may be NULL.
    
    This code is lifted straight out of brw_blorp_framebuffer()'s
    try_blorp_blit() helper.
    
    Fixes crashes in Piglit's fbo-sys-blit on systems without BLORP.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65919
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Ian Romanick <idr@freedesktop.org>
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
    Cc: "9.2" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit fb3d62fe3d4fc40ba4ad9804d8b6f451316c9ae2)

diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index e746cb4..73cc43a 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -665,6 +665,11 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
 {
    struct brw_context *brw = brw_context(ctx);
 
+   /* Sync up the state of window system buffers.  We need to do this before
+    * we go looking for the buffers.
+    */
+   intel_prepare_render(brw);
+
    if (mask & GL_COLOR_BUFFER_BIT) {
       GLint i;
       const struct gl_framebuffer *drawFb = ctx->DrawBuffer;

commit 10ff10c89e8a3d65c9c97564e010884ac8610ca5
Author: Tom Stellard <thomas.stellard@amd.com>
Date:   Wed Aug 7 17:26:17 2013 -0700

    r300g/compiler/tests: Pass the required LDFLAGS when building the test program
    
    CC: "9.2 <mesa-stable@lists.freedesktop.org>"
    (cherry picked from commit d0c13fba172c56c3670bc8bebf453d98e455d482)

diff --git a/src/gallium/drivers/r300/Makefile.am b/src/gallium/drivers/r300/Makefile.am
index ab8b4e8..14aaf03 100644
--- a/src/gallium/drivers/r300/Makefile.am
+++ b/src/gallium/drivers/r300/Makefile.am
@@ -18,7 +18,8 @@ AM_CFLAGS = \
 	$(RADEON_CFLAGS)
 
 r300_compiler_tests_LDADD = libr300.la libr300-helper.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la
+	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(GALLIUM_DRI_LIB_DEPS)
 r300_compiler_tests_CPPFLAGS = \
 	-I$(top_srcdir)/src/gallium/drivers/r300/compiler
 r300_compiler_tests_SOURCES = \

commit 12da1bcb3b3e9f859439a9aceff47ea04f3550c7
Author: Tom Stellard <thomas.stellard@amd.com>
Date:   Wed Aug 7 17:26:01 2013 -0700

    r300g/compiler/tests: Fix segfault
    
    CC: "9.2" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit d691ba4d9412b68dd56a300549bafc733e1bb7ee)

diff --git a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_optimize_tests.c b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_optimize_tests.c
index 819fb6c..3244d93 100644
--- a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_optimize_tests.c
+++ b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_optimize_tests.c
@@ -80,7 +80,7 @@ static void test_runner_rc_optimize(struct test_result * result)
 
 unsigned radeon_compiler_optimize_run_tests()
 {
-	struct test tests[] = {
+	static struct test tests[] = {
 		{"rc_optimize() => peephole_mul_omod()", test_runner_rc_optimize},
 		{NULL, NULL}
 	};
diff --git a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_regalloc_tests.c b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_regalloc_tests.c
index eeb6b07..511596c 100644
--- a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_regalloc_tests.c
+++ b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_regalloc_tests.c
@@ -91,8 +91,8 @@ static void tex_1d_swizzle(struct test_result *result)
 
 unsigned radeon_compiler_regalloc_run_tests()
 {
-	struct test tests[] = {
-		{"rc_pair_regalloc() => TEX 1D Swizzle - r300", tex_1d_swizzle},
+	static struct test tests[] = {
+		{"rc_pair_regalloc() => TEX 1D Swizzle - r300", tex_1d_swizzle },
 		{NULL, NULL}
 	};
 	return run_tests(tests);
diff --git a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c
index 33b27fc..3e97594 100644
--- a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c
+++ b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c
@@ -96,7 +96,7 @@ static void test_runner_rc_inst_can_use_presub(struct test_result * result)
 
 unsigned radeon_compiler_util_run_tests()
 {
-	struct test tests[] = {
+	static struct test tests[] = {
 		{"rc_inst_can_use_presub()", test_runner_rc_inst_can_use_presub},
 		{NULL, NULL}
 	};

commit 195e995968b31dbde8c223d306b2dbf56170d1e5
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Fri Jun 21 18:04:55 2013 +0100

    nv50: handle pure integer vertex attributes
    
    And as a side effect fix a crash in the following piglit test:
    general/attribs GL3
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Cc: "9.2 and 9.1" mesa-stable@lists.freedesktop.org
    (cherry picked from commit 07c8f7a6f8dfe724c1ae92ec45dd04532b6fd453)

diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c
index 9033fa5..9f00c02 100644
--- a/src/gallium/drivers/nv30/nv30_vbo.c
+++ b/src/gallium/drivers/nv30/nv30_vbo.c
@@ -40,13 +40,15 @@ nv30_emit_vtxattr(struct nv30_context *nv30, struct pipe_vertex_buffer *vb,
    const unsigned nc = util_format_get_nr_components(ve->src_format);
    struct nouveau_pushbuf *push = nv30->base.pushbuf;
    struct nv04_resource *res = nv04_resource(vb->buffer);
+   const struct util_format_description *desc =
+      util_format_description(ve->src_format);
    const void *data;
    float v[4];
 
    data = nouveau_resource_map_offset(&nv30->base, res, vb->buffer_offset +
                                       ve->src_offset, NOUVEAU_BO_RD);
 
-   util_format_read_4f(ve->src_format, v, 0, data, 0, 0, 0, 1, 1);
+   desc->unpack_rgba_float(v, 0, data, 0, 1, 1);
 
    switch (nc) {
    case 4:
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index db4e0cd..ca46f6c 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -140,10 +140,20 @@ nv50_emit_vtxattr(struct nv50_context *nv50, struct pipe_vertex_buffer *vb,
    const void *data = (const uint8_t *)vb->user_buffer + ve->src_offset;
    float v[4];
    const unsigned nc = util_format_get_nr_components(ve->src_format);
+   const struct util_format_description *desc =
+      util_format_description(ve->src_format);
 
    assert(vb->user_buffer);
 
-   util_format_read_4f(ve->src_format, v, 0, data, 0, 0, 0, 1, 1);
+   if (desc->channel[0].pure_integer) {
+      if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
+         desc->unpack_rgba_sint((int32_t *)v, 0, data, 0, 1, 1);
+      } else {
+         desc->unpack_rgba_uint((uint32_t *)v, 0, data, 0, 1, 1);
+      }
+   } else {
+      desc->unpack_rgba_float(v, 0, data, 0, 1, 1);
+   }
 
    switch (nc) {
    case 4:

commit 6f9b090719062ded2021ebfb6b79ec84cc6a244a
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Sun Jul 28 13:08:27 2013 -0700

    mesa: Generate a renderbuffer wrapper even if the texture has no image
    
    This prevents a segfault in check_begin_texture_render when an FBO is
    rebound while in this state.  This fixes the piglit test
    fbo-incomplete-invalid-texture.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Acked-by: Kenneth Graunke <kenneth@whitecape.org>
    Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
    (cherry picked from commit 2f9fe2d80a35b8857682771fddbee628213da7b3)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 8c096f5..a0d6cc2 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -385,8 +385,6 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx,
    struct gl_renderbuffer *rb;
 
    texImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
-   if (!texImage)
-      return;
 
    rb = att->Renderbuffer;
    if (!rb) {
@@ -405,6 +403,9 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx,
       rb->NeedsFinishRenderTexture = ctx->Driver.FinishRenderTexture != NULL;
    }


Reply to: