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

mesa: Changes to 'upstream-experimental'



 VERSION                                                  |    2 
 src/gallium/docs/source/screen.rst                       |    6 +
 src/gallium/drivers/freedreno/freedreno_screen.c         |    5 
 src/gallium/drivers/i915/i915_screen.c                   |    5 
 src/gallium/drivers/ilo/ilo_screen.c                     |    3 
 src/gallium/drivers/llvmpipe/lp_screen.c                 |    3 
 src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp       |   39 ++++++-
 src/gallium/drivers/nouveau/nouveau_screen.h             |    5 
 src/gallium/drivers/nouveau/nouveau_vp3_video.c          |   78 ++++++++++++++-
 src/gallium/drivers/nouveau/nv30/nv30_screen.c           |    4 
 src/gallium/drivers/nouveau/nv50/nv50_screen.c           |    3 
 src/gallium/drivers/nouveau/nv50/nv84_video.c            |   68 ++++++++++++-
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c           |    3 
 src/gallium/drivers/r300/r300_screen.c                   |    2 
 src/gallium/drivers/r600/r600_hw_context.c               |    2 
 src/gallium/drivers/r600/r600_pipe.c                     |   14 +-
 src/gallium/drivers/r600/r600_pipe.h                     |    1 
 src/gallium/drivers/radeon/r600_buffer_common.c          |    2 
 src/gallium/drivers/radeon/r600_pipe_common.c            |    2 
 src/gallium/drivers/radeon/r600_pipe_common.h            |    3 
 src/gallium/drivers/radeon/r600_texture.c                |    2 
 src/gallium/drivers/radeonsi/si_hw_context.c             |    4 
 src/gallium/drivers/radeonsi/si_pipe.c                   |    6 +
 src/gallium/drivers/softpipe/sp_screen.c                 |    3 
 src/gallium/drivers/svga/svga_screen.c                   |    2 
 src/gallium/include/pipe/p_defines.h                     |    4 
 src/gallium/targets/r600/vdpau/Makefile.am               |    6 -
 src/glsl/ast_to_hir.cpp                                  |   13 +-
 src/glsl/builtin_functions.cpp                           |   11 +-
 src/glsl/glcpp/glcpp-parse.y                             |   22 +++-
 src/glsl/glcpp/tests/086-reserved-macro-names.c.expected |    4 
 src/glsl/linker.cpp                                      |    9 -
 src/glsl/opt_vectorize.cpp                               |   14 ++
 src/mesa/drivers/dri/i915/i830_vtbl.c                    |    8 -
 src/mesa/drivers/dri/i915/i915_context.c                 |    2 
 src/mesa/drivers/dri/i915/i915_texstate.c                |    2 
 src/mesa/drivers/dri/i915/i915_vtbl.c                    |    8 -
 src/mesa/drivers/dri/i915/intel_fbo.c                    |    2 
 src/mesa/drivers/dri/i915/intel_screen.c                 |    2 
 src/mesa/drivers/dri/i965/brw_blorp.cpp                  |    4 
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp             |    6 -
 src/mesa/drivers/dri/i965/brw_clear.c                    |    2 
 src/mesa/drivers/dri/i965/brw_context.c                  |   12 +-
 src/mesa/drivers/dri/i965/brw_misc_state.c               |    6 -
 src/mesa/drivers/dri/i965/brw_surface_formats.c          |   12 +-
 src/mesa/drivers/dri/i965/intel_fbo.c                    |    2 
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c            |    8 -
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h            |    4 
 src/mesa/drivers/dri/i965/intel_screen.c                 |    4 
 src/mesa/drivers/dri/nouveau/nouveau_context.c           |    7 -
 src/mesa/drivers/dri/nouveau/nouveau_context.h           |    3 
 src/mesa/drivers/dri/nouveau/nouveau_driver.h            |    1 
 src/mesa/drivers/dri/nouveau/nv04_context.c              |    5 
 src/mesa/drivers/dri/nouveau/nv04_surface.c              |    8 -
 src/mesa/drivers/dri/nouveau/nv10_context.c              |   13 +-
 src/mesa/drivers/dri/nouveau/nv10_state_fb.c             |    4 
 src/mesa/drivers/dri/nouveau/nv10_state_raster.c         |    3 
 src/mesa/drivers/dri/nouveau/nv20_context.c              |    5 
 src/mesa/drivers/dri/radeon/radeon_fbo.c                 |   10 -
 src/mesa/drivers/dri/radeon/radeon_screen.c              |    4 
 src/mesa/drivers/dri/radeon/radeon_texture.c             |    4 
 src/mesa/main/attrib.c                                   |    1 
 src/mesa/main/format_pack.c                              |   22 ++--
 src/mesa/main/format_unpack.c                            |   12 +-
 src/mesa/main/formats.c                                  |   16 +--
 src/mesa/main/formats.h                                  |    4 
 src/mesa/main/readpix.c                                  |    2 
 src/mesa/main/shaderapi.c                                |    1 
 src/mesa/main/shaderobj.c                                |    1 
 src/mesa/main/texformat.c                                |    6 -
 src/mesa/main/texparam.c                                 |    3 
 src/mesa/main/texstore.c                                 |    8 -
 src/mesa/state_tracker/st_extensions.c                   |    2 
 src/mesa/state_tracker/st_format.c                       |    8 -
 src/mesa/swrast/s_depth.c                                |   14 +-
 src/mesa/swrast/s_drawpix.c                              |    4 
 src/mesa/swrast/s_renderbuffer.c                         |    2 
 src/mesa/swrast/s_stencil.c                              |    2 
 src/mesa/swrast/s_texfetch.c                             |    4 
 src/mesa/swrast/s_texfetch_tmp.h                         |    4 
 80 files changed, 450 insertions(+), 167 deletions(-)

New commits:
commit fcb4eabb5fc31f8902a6e917a4a008aaa90819c6
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Fri Feb 21 14:29:44 2014 -0800

    mesa: Bump version to 10.1-rc2
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>

diff --git a/VERSION b/VERSION
index ff3cc45..5364038 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-10.1.0-rc1
+10.1.0-rc2

commit 7cb4dea765b5b1fe8f14197084e2ccc864d525dd
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Wed Feb 19 17:20:11 2014 -0800

    i965: Create a hardware context before initializing state module.
    
    brw_init_state() calls brw_upload_initial_gpu_state().  If hardware
    contexts are enabled (brw->hw_ctx != NULL), this will upload some
    initial invariant state for the GPU.  Without hardware contexts, we
    rely on this state being uploaded via atoms that subscribe to the
    BRW_NEW_CONTEXT bit.
    
    Commit 46d3c2bf4ddd227193b98861f1e632498fe547d8 accidentally moved
    the call to brw_init_state() before creating a hardware context.
    This meant brw_upload_initial_gpu_state would always early return.
    Except on Gen6+, we stopped uploading the initial GPU state via
    state atoms, so it never happened.
    
    Fixes a regression since 46d3c2bf4ddd227193b98861f1e632498fe547d8.
    
    Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    (cherry picked from commit 3663bbe773187dee341556ef29e58b1143ef2f5c)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index d9d1ae5..d5dccaf 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -682,12 +682,6 @@ brwCreateContext(gl_api api,
 
    intel_batchbuffer_init(brw);
 
-   brw_init_state(brw);
-
-   intelInitExtensions(ctx);
-
-   intel_fbo_init(brw);
-
    if (brw->gen >= 6) {
       /* Create a new hardware context.  Using a hardware context means that
        * our GPU state will be saved/restored on context switch, allowing us
@@ -705,6 +699,12 @@ brwCreateContext(gl_api api,
       }
    }
 
+   brw_init_state(brw);
+
+   intelInitExtensions(ctx);
+
+   intel_fbo_init(brw);
+
    brw_init_surface_formats(brw);
 
    if (brw->is_g4x || brw->gen >= 5) {

commit b498fb95867f2b939c8e257a5cda959e42eae7b5
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Tue Feb 18 09:36:08 2014 -0800

    glsl: Only warn for macro names containing __
    
    From page 14 (page 20 of the PDF) of the GLSL 1.10 spec:
    
        "In addition, all identifiers containing two consecutive underscores
         (__) are reserved as possible future keywords."
    
    The intention is that names containing __ are reserved for internal use
    by the implementation, and names prefixed with GL_ are reserved for use
    by Khronos.  Names simply containing __ are dangerous to use, but should
    be allowed.
    
    Per the Khronos bug mentioned below, a future version of the GLSL
    specification will clarify this.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Tested-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
    Tested-by: Darius Spitznagel <d.spitznagel@goodbytez.de>
    Cc: Tapani Pälli <lemody@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
    Bugzilla: Khronos #11702
    (cherry picked from commit 2c85fd5a964a78c9f7a93994fb79f1723c6f45b5)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 8d096ad..624b813 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2853,10 +2853,17 @@ validate_identifier(const char *identifier, YYLTYPE loc,
        *     "In addition, all identifiers containing two
        *      consecutive underscores (__) are reserved as
        *      possible future keywords."
+       *
+       * The intention is that names containing __ are reserved for internal
+       * use by the implementation, and names prefixed with GL_ are reserved
+       * for use by Khronos.  Names simply containing __ are dangerous to use,
+       * but should be allowed.
+       *
+       * A future version of the GLSL specification will clarify this.
        */
-      _mesa_glsl_error(&loc, state,
-                       "identifier `%s' uses reserved `__' string",
-                       identifier);
+      _mesa_glsl_warning(&loc, state,
+                         "identifier `%s' uses reserved `__' string",
+                         identifier);
    }
 }
 

commit 3731a4fae434ac61bd951009bd776d13ae3833b3
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Tue Feb 18 09:10:36 2014 -0800

    glcpp: Only warn for macro names containing __
    
    Section 3.3 (Preprocessor) of the GLSL 1.30 spec (and later) and the
    GLSL ES spec (all versions) say:
    
        "All macro names containing two consecutive underscores ( __ ) are
        reserved for future use as predefined macro names. All macro names
        prefixed with "GL_" ("GL" followed by a single underscore) are also
        reserved."
    
    The intention is that names containing __ are reserved for internal use
    by the implementation, and names prefixed with GL_ are reserved for use
    by Khronos.  Since every extension adds a name prefixed with GL_ (i.e.,
    the name of the extension), that should be an error.  Names simply
    containing __ are dangerous to use, but should be allowed.  In similar
    cases, the C++ preprocessor specification says, "no diagnostic is
    required."
    
    Per the Khronos bug mentioned below, a future version of the GLSL
    specification will clarify this.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Tested-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
    Tested-by: Darius Spitznagel <d.spitznagel@goodbytez.de>
    Cc: Tapani Pälli <lemody@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
    Bugzilla: Khronos #11702
    (cherry picked from commit 0bd78926304e72ef3566e977d0cb5a959d86b809)

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 0393ac7..7f4691a 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -1770,11 +1770,27 @@ static void
 _check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc,
 				const char *identifier)
 {
-	/* According to the GLSL specification, macro names starting with "__"
-	 * or "GL_" are reserved for future use.  So, don't allow them.
+	/* Section 3.3 (Preprocessor) of the GLSL 1.30 spec (and later) and
+	 * the GLSL ES spec (all versions) say:
+	 *
+	 *     "All macro names containing two consecutive underscores ( __ )
+	 *     are reserved for future use as predefined macro names. All
+	 *     macro names prefixed with "GL_" ("GL" followed by a single
+	 *     underscore) are also reserved."
+	 *
+	 * The intention is that names containing __ are reserved for internal
+	 * use by the implementation, and names prefixed with GL_ are reserved
+	 * for use by Khronos.  Since every extension adds a name prefixed
+	 * with GL_ (i.e., the name of the extension), that should be an
+	 * error.  Names simply containing __ are dangerous to use, but should
+	 * be allowed.
+	 *
+	 * A future version of the GLSL specification will clarify this.
 	 */
 	if (strstr(identifier, "__")) {
-		glcpp_error (loc, parser, "Macro names containing \"__\" are reserved.\n");
+		glcpp_warning(loc, parser,
+			      "Macro names containing \"__\" are reserved "
+			      "for use by the implementation.\n");
 	}
 	if (strncmp(identifier, "GL_", 3) == 0) {
 		glcpp_error (loc, parser, "Macro names starting with \"GL_\" are reserved.\n");
diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
index d8aa9f0..5ca42a9 100644
--- a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
+++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
@@ -1,8 +1,8 @@
-0:1(10): preprocessor error: Macro names containing "__" are reserved.
+0:1(10): preprocessor warning: Macro names containing "__" are reserved for use by the implementation.
 
 0:2(9): preprocessor error: Macro names starting with "GL_" are reserved.
 
-0:3(9): preprocessor error: Macro names containing "__" are reserved.
+0:3(9): preprocessor warning: Macro names containing "__" are reserved for use by the implementation.
 
 
 

commit d623eeb37a99ccc419e7475693b2712930aae8bf
Author: Anuj Phogat <anuj.phogat@gmail.com>
Date:   Thu Dec 19 14:17:19 2013 -0800

    glsl: Fix condition to generate shader link error
    
    GL_ARB_ES2_compatibility doesn't say anything about shader linking
    when one of the shaders (vertex or fragment shader) is absent. So,
    the extension shouldn't change the behavior specified in GLSL
    specification.
    
    Tested the behavior on proprietary linux drivers of NVIDIA and AMD.
    Both of them allow linking a version 100 shader program in OpenGL
    context, when one of the shaders is absent.
    
    Makes following Khronos CTS tests to pass:
    successfulcompilevert_linkprogram.test
    successfulcompilefrag_linkprogram.test
    
    Cc: mesa-stable@lists.freedesktop.org
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 03597cf802a7a89c4853794e6206ab8ab003898d)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 93b4754..5635b1d 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2329,11 +2329,12 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
       goto done;
 
    /* OpenGL ES requires that a vertex shader and a fragment shader both be
-    * present in a linked program.  By checking prog->IsES, we also
-    * catch the GL_ARB_ES2_compatibility case.
+    * present in a linked program. GL_ARB_ES2_compatibility doesn't say
+    * anything about shader linking when one of the shaders (vertex or
+    * fragment shader) is absent. So, the extension shouldn't change the
+    * behavior specified in GLSL specification.
     */
-   if (!prog->InternalSeparateShader &&
-       (ctx->API == API_OPENGLES2 || prog->IsES)) {
+   if (!prog->InternalSeparateShader && ctx->API == API_OPENGLES2) {
       if (prog->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) {
 	 linker_error(prog, "program lacks a vertex shader\n");
       } else if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) {

commit 6534d80ccac4a23f7959365bbfcd37626accc807
Author: Anuj Phogat <anuj.phogat@gmail.com>
Date:   Fri Feb 14 17:27:29 2014 -0800

    mesa: Add GL_TEXTURE_CUBE_MAP_ARRAY to legal_get_tex_level_parameter_target()
    
    Fixes failing Khronos CTS test packed_depth_stencil_init.test
    
    Cc: <mesa-stable@lists.freedesktop.org>
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 6bd2472a8b9a969d06dc110bd30ccd8daf713959)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index b7ed50d..bbdbc27 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -986,6 +986,9 @@ legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target)
    case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
    case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
       return ctx->Extensions.ARB_texture_cube_map;
+   case GL_TEXTURE_CUBE_MAP_ARRAY_ARB:
+   case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB:
+      return ctx->Extensions.ARB_texture_cube_map_array;
    case GL_TEXTURE_RECTANGLE_NV:
    case GL_PROXY_TEXTURE_RECTANGLE_NV:
       return ctx->Extensions.NV_texture_rectangle;

commit 20eb46699905e4ed9a4886fdb83caf72a344fb71
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Feb 13 11:51:09 2014 +0900

    r600g,radeonsi: Consolidate logic for short-circuiting flushes
    
    Fixes radeonsi emitting command streams to the kernel even when there
    have been no draw calls before a flush, potentially powering up the GPU
    needlessly.
    
    Incidentally, this also cuts the runtime of piglit gpu.py in about half
    on my Kaveri system, probably because an X11 client going away no longer
    always results in a command stream being submitted to the kernel via
    glamor.
    
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=65761
    Cc: "10.1" mesa-stable@lists.freedesktop.org
    Reviewed-by: Marek Olšák <marek.olsak@amd.com>
    (cherry picked from commit cf0172d46ab940a691da6516057c81f28961482f)

diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index fc81e95..358282a 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -352,7 +352,7 @@ void r600_begin_new_cs(struct r600_context *ctx)
 	ctx->last_primitive_type = -1;
 	ctx->last_start_instance = -1;
 
-	ctx->initial_gfx_cs_size = ctx->b.rings.gfx.cs->cdw;
+	ctx->b.initial_gfx_cs_size = ctx->b.rings.gfx.cs->cdw;
 }
 
 /* The max number of bytes to copy per packet. */
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 66996bd..4ca6a22 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -73,7 +73,7 @@ static void r600_flush(struct pipe_context *ctx, unsigned flags)
 	unsigned render_cond_mode = 0;
 	boolean render_cond_cond = FALSE;
 
-	if (rctx->b.rings.gfx.cs->cdw == rctx->initial_gfx_cs_size)
+	if (rctx->b.rings.gfx.cs->cdw == rctx->b.initial_gfx_cs_size)
 		return;
 
 	rctx->b.rings.gfx.flushing = true;
@@ -94,7 +94,7 @@ static void r600_flush(struct pipe_context *ctx, unsigned flags)
 		ctx->render_condition(ctx, render_cond, render_cond_cond, render_cond_mode);
 	}
 
-	rctx->initial_gfx_cs_size = rctx->b.rings.gfx.cs->cdw;
+	rctx->b.initial_gfx_cs_size = rctx->b.rings.gfx.cs->cdw;
 }
 
 static void r600_flush_from_st(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 9f27a17..0cc91dd 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -375,7 +375,6 @@ struct r600_context {
 	struct r600_screen		*screen;
 	struct blitter_context		*blitter;
 	struct u_suballocator		*allocator_fetch_shader;
-	unsigned			initial_gfx_cs_size;
 
 	/* Hardware info. */
 	boolean				has_vertex_cache;
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index d29671e..15eec55 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -59,7 +59,7 @@ void *r600_buffer_map_sync_with_rings(struct r600_common_context *ctx,
 		rusage = RADEON_USAGE_WRITE;
 	}
 
-	if (ctx->rings.gfx.cs->cdw &&
+	if (ctx->rings.gfx.cs->cdw != ctx->initial_gfx_cs_size &&
 	    ctx->ws->cs_is_buffer_referenced(ctx->rings.gfx.cs,
 					     resource->cs_buf, rusage)) {
 		if (usage & PIPE_TRANSFER_DONTBLOCK) {
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index aa1f3ed..3c22c0f 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -241,6 +241,7 @@ struct r600_common_context {
 	enum radeon_family		family;
 	enum chip_class			chip_class;
 	struct r600_rings		rings;
+	unsigned			initial_gfx_cs_size;
 
 	struct u_upload_mgr		*uploader;
 	struct u_suballocator		*allocator_so_filled_size;
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c
index 7e40255..3437f59 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -81,7 +81,7 @@ void si_context_flush(struct si_context *ctx, unsigned flags)
 {
 	struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
 
-	if (!cs->cdw)
+	if (cs->cdw == ctx->b.initial_gfx_cs_size)
 		return;
 
 	/* suspend queries */
@@ -177,6 +177,8 @@ void si_begin_new_cs(struct si_context *ctx)
 	}
 
 	si_all_descriptors_begin_new_cs(ctx);
+
+	ctx->b.initial_gfx_cs_size = ctx->b.rings.gfx.cs->cdw;
 }
 
 #if SI_TRACE_CS

commit 706eef0cfea4973e167bf531f4cf20683c4960bf
Author: Kusanagi Kouichi <slash@ac.auone-net.jp>
Date:   Wed Feb 12 16:07:55 2014 +0900

    targets/vdpau: Always use c++ to link
    
    If built without llvm, the following error occurs with mplayer:
    
    Failed to open VDPAU backend .../libvdpau_r600.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE
    [vo/vdpau] Error when calling vdp_device_create_x11: 1
    
    Cc: <mesa-stable@lists.freedesktop.org>
    Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
    Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
    (cherry picked from commit 61f6cddef72a49d87e2b31ed49cdbc941d3b1efc)

diff --git a/src/gallium/targets/r600/vdpau/Makefile.am b/src/gallium/targets/r600/vdpau/Makefile.am
index 7f43fbb..6e9f117 100644
--- a/src/gallium/targets/r600/vdpau/Makefile.am
+++ b/src/gallium/targets/r600/vdpau/Makefile.am
@@ -44,17 +44,13 @@ libvdpau_r600_la_LIBADD = \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(RADEON_LIBS)
 
-if HAVE_MESA_LLVM
 libvdpau_r600_la_LINK = $(CXXLINK) $(libvdpau_r600_la_LDFLAGS)
 # Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
 nodist_EXTRA_libvdpau_r600_la_SOURCES = dummy-cpp.cpp
 
+if HAVE_MESA_LLVM
 libvdpau_r600_la_LDFLAGS += $(LLVM_LDFLAGS)
 libvdpau_r600_la_LIBADD += $(LLVM_LIBS)
-else
-libvdpau_r600_la_LINK = $(LINK) $(libvdpau_r600_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libvdpau_r600_la_SOURCES = dummy-c.c
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for

commit a889b8e9aa76dbe960e6117347217529e2c4f714
Author: Carl Worth <cworth@cworth.org>
Date:   Thu Feb 13 09:49:27 2014 -0800

    main: Avoid double-free of shader Label
    
    As documented, the _mesa_free_shader_program_data function:
    
    	"Frees all the data that hangs off a shader program object, but not
    	the object itself."
    
    This means that this function may be called multiple times on the same object,
    (and has been observed to). Meanwhile, the shProg->Label field was not being
    set to NULL after its free(). This led to a second call to free() of the same
    address on the second call to this function.
    
    Fix this by setting this field to NULL after free(), (just as with all other
    calls to free() in this function).
    
    Reviewed-by: Brian Paul <brianp@vmware.com>
    
    CC: mesa-stable@lists.freedesktop.org
    (cherry picked from commit a92581acf2aba5e5e9fa199b778e649d5741754d)

diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 4f4bb69..d5c3d80 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -355,6 +355,7 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
    }
 
    free(shProg->Label);
+   shProg->Label = NULL;
 }
 
 

commit 02d96b7e9fa70c5af6179144e80ad2e7c4f4198a
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Wed Feb 12 12:00:17 2014 -0500

    radeon: reverse DBG_NO_HYPERZ logic
    
    Change the flag to DBG_HYPERZ and reverse the logic
    so setting the flag enabled the feature.  This disables
    hyperz on r600g and radeonsi by default.  It can be
    enabled by setting the env var.  There are just too
    many issues with certain apps so leave it disabled for
    now until we sort out the issues with the problematic
    apps.
    
    Bugs:
    https://bugs.freedesktop.org/show_bug.cgi?id=58660
    https://bugs.freedesktop.org/show_bug.cgi?id=64471
    https://bugs.freedesktop.org/show_bug.cgi?id=66352
    https://bugs.freedesktop.org/show_bug.cgi?id=68799
    https://bugs.freedesktop.org/show_bug.cgi?id=72685
    https://bugs.freedesktop.org/show_bug.cgi?id=73088
    https://bugs.freedesktop.org/show_bug.cgi?id=74428
    https://bugs.freedesktop.org/show_bug.cgi?id=74803
    https://bugs.freedesktop.org/show_bug.cgi?id=74863
    https://bugs.freedesktop.org/show_bug.cgi?id=74892
    https://bugzilla.kernel.org/show_bug.cgi?id=70411
    
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: "10.1" "10.0" <mesa-stable@lists.freedesktop.org>
    Acked-by: Marek Olšák <marek.olsak@amd.com>
    (cherry picked from commit 01e637114914453451becc0dc8afe60faff48d84)

diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index d4e06c5..66996bd 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -585,8 +585,8 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
 		rscreen->b.debug_flags |= DBG_COMPUTE;
 	if (debug_get_bool_option("R600_DUMP_SHADERS", FALSE))
 		rscreen->b.debug_flags |= DBG_FS | DBG_VS | DBG_GS | DBG_PS | DBG_CS;
-	if (!debug_get_bool_option("R600_HYPERZ", TRUE))
-		rscreen->b.debug_flags |= DBG_NO_HYPERZ;
+	if (debug_get_bool_option("R600_HYPERZ", FALSE))
+		rscreen->b.debug_flags |= DBG_HYPERZ;
 	if (!debug_get_bool_option("R600_LLVM", TRUE))
 		rscreen->b.debug_flags |= DBG_NO_LLVM;
 
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 98164f0..bfdfaf5 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -137,7 +137,7 @@ static const struct debug_named_value common_debug_options[] = {
 	{ "ps", DBG_PS, "Print pixel shaders" },
 	{ "cs", DBG_CS, "Print compute shaders" },
 
-	{ "nohyperz", DBG_NO_HYPERZ, "Disable Hyper-Z" },
+	{ "hyperz", DBG_HYPERZ, "Enable Hyper-Z" },
 	/* GL uses the word INVALIDATE, gallium uses the word DISCARD */
 	{ "noinvalrange", DBG_NO_DISCARD_RANGE, "Disable handling of INVALIDATE_RANGE map flags" },
 
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index 9fdfdfd..aa1f3ed 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -83,7 +83,7 @@
 #define DBG_PS			(1 << 11)
 #define DBG_CS			(1 << 12)
 /* features */
-#define DBG_NO_HYPERZ		(1 << 13)
+#define DBG_HYPERZ		(1 << 13)
 #define DBG_NO_DISCARD_RANGE	(1 << 14)
 /* The maximum allowed bit is 15. */
 
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 878b26f..8ea1565 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -596,7 +596,7 @@ r600_texture_create_object(struct pipe_screen *screen,
 	if (rtex->is_depth) {
 		if (!(base->flags & (R600_RESOURCE_FLAG_TRANSFER |
 				     R600_RESOURCE_FLAG_FLUSHED_DEPTH)) &&
-		    !(rscreen->debug_flags & DBG_NO_HYPERZ)) {
+		    (rscreen->debug_flags & DBG_HYPERZ)) {
 
 			r600_texture_allocate_htile(rscreen, rtex);
 		}

commit a1b6aa9fe254274dea1346332037bc3db2f924d3
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Wed Feb 12 18:22:56 2014 -0500

    nouveau: fix chipset checks for nv1a by using the oclass instead
    
    Commit f4ebcd133b9 ("dri/nouveau: NV17_3D class is not available for
    NV1a chipset") fixed this partially by using the correct 3d class.
    However there were a lot of checks left over comparing against the
    chipset.
    
    Reported-and-tested-by: John F. Godfrey <jfgodfrey@gmail.com>
    Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
    Cc: 9.2 10.0 10.1 <mesa-stable@lists.freedesktop.org>
    Reviewed-by: Francisco Jerez <currojerez@riseup.net>
    (cherry picked from commit 0c8b165366d68291e3013c7308b8b1fdd5ade2a2)

diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 904a410..00a9358 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -63,7 +63,7 @@ nv10_use_viewport_zclear(struct gl_context *ctx)
 	struct gl_framebuffer *fb = ctx->DrawBuffer;
 	struct gl_renderbuffer *depthRb = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
 
-	return context_chipset(ctx) < 0x17 &&
+	return context_eng3d(ctx)->oclass < NV17_3D_CLASS &&
 		!nctx->hierz.clear_blocked && depthRb &&
 		(_mesa_get_format_bits(depthRb->Format,
 				       GL_DEPTH_BITS) >= 24);
@@ -184,7 +184,7 @@ nv10_clear(struct gl_context *ctx, GLbitfield buffers)
 	}
 
 	if ((buffers & BUFFER_BIT_DEPTH) && ctx->Depth.Mask) {
-		if (context_chipset(ctx) >= 0x17)
+		if (context_eng3d(ctx)->oclass >= NV17_3D_CLASS)
 			nv17_zclear(ctx, &buffers);
 		else
 			nv10_zclear(ctx, &buffers);
@@ -245,7 +245,7 @@ nv10_hwctx_init(struct gl_context *ctx)
 	BEGIN_NV04(push, NV04_GRAPH(3D, NOP), 1);
 	PUSH_DATA (push, 0);
 
-	if (context_chipset(ctx) >= 0x17) {
+	if (context_eng3d(ctx)->oclass >= NV17_3D_CLASS) {
 		BEGIN_NV04(push, NV17_3D(UNK01AC), 2);
 		PUSH_DATA (push, fifo->vram);
 		PUSH_DATA (push, fifo->vram);
@@ -257,7 +257,7 @@ nv10_hwctx_init(struct gl_context *ctx)
 		PUSH_DATA (push, 1);
 	}
 
-	if (context_chipset(ctx) >= 0x11) {
+	if (context_eng3d(ctx)->oclass >= NV15_3D_CLASS) {
 		BEGIN_NV04(push, SUBC_3D(0x120), 3);
 		PUSH_DATA (push, 0);
 		PUSH_DATA (push, 1);
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index 19769e5..fb66b2d 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -106,7 +106,7 @@ nv10_emit_framebuffer(struct gl_context *ctx, int emit)
 
 	/* At least nv11 seems to get sad if we don't do this before
 	 * swapping RTs.*/
-	if (context_chipset(ctx) < 0x17) {
+	if (context_eng3d(ctx)->oclass < NV17_3D_CLASS) {
 		int i;
 
 		for (i = 0; i < 6; i++) {
@@ -140,7 +140,7 @@ nv10_emit_framebuffer(struct gl_context *ctx, int emit)
 		PUSH_MTHDl(push, NV10_3D(ZETA_OFFSET), BUFCTX_FB,
 				 s->bo, 0, bo_flags);
 
-		if (context_chipset(ctx) >= 0x17) {
+		if (context_eng3d(ctx)->oclass >= NV17_3D_CLASS) {
 			setup_hierz_buffer(ctx);
 			context_dirty(ctx, ZCLEAR);
 		}
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
index bd4a78e..da414a0 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c
@@ -28,6 +28,7 @@
 #include "nouveau_context.h"
 #include "nouveau_gldefs.h"
 #include "nouveau_util.h"
+#include "nv_object.xml.h"
 #include "nv10_3d.xml.h"
 #include "nv10_driver.h"
 
@@ -120,7 +121,7 @@ nv10_emit_logic_opcode(struct gl_context *ctx, int emit)
 	struct nouveau_pushbuf *push = context_push(ctx);
 
 	assert(!ctx->Color.ColorLogicOpEnabled
-	       || context_chipset(ctx) >= 0x11);
+	       || context_eng3d(ctx)->oclass >= NV15_3D_CLASS);
 
 	BEGIN_NV04(push, NV11_3D(COLOR_LOGIC_OP_ENABLE), 2);
 	PUSH_DATAb(push, ctx->Color.ColorLogicOpEnabled);

commit 150b1f0aac70921ff52c7dd9b9563981976c7982
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Fri Feb 7 20:34:08 2014 +0100

    mesa: Preserve the NewArrays state when copying a VAO
    
    Cc: "10.1" "10.0" <mesa-stable@lists.freedesktop.org>
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72895
    Reviewed-by: Brian Paul <brianp@vmware.com>
    (cherry picked from commit 9afbd04d892f96e7fc6b689ca57ea5da124f7560)

diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 7b7cf0e..fa19288 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1457,6 +1457,7 @@ copy_array_object(struct gl_context *ctx,
 
    /* _Enabled must be the same than on push */
    dest->_Enabled = src->_Enabled;
+   dest->NewArrays = src->NewArrays;
    dest->_MaxElement = src->_MaxElement;
 }
 

commit 50066dc544517cff09cdb11203d8d7213126ee78
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Feb 10 12:09:19 2014 -0800

    glsl: Do not vectorize vector array dereferences.
    
    Array dereferences must have scalar indices, so we cannot vectorize
    them.
    
    Cc: "10.1" <mesa-stable@lists.freedesktop.org>
    Reported-by: Andrew Guertin <lists@dolphinling.net>
    Tested-by: Andrew Guertin <lists@dolphinling.net>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 025d99ce3cea21c9ecea77b95655c0c838b2fa3c)

diff --git a/src/glsl/opt_vectorize.cpp b/src/glsl/opt_vectorize.cpp
index 8ee81f1..dba303d 100644
--- a/src/glsl/opt_vectorize.cpp
+++ b/src/glsl/opt_vectorize.cpp
@@ -82,6 +82,7 @@ public:
 
    virtual ir_visitor_status visit_enter(ir_assignment *);
    virtual ir_visitor_status visit_enter(ir_swizzle *);
+   virtual ir_visitor_status visit_enter(ir_dereference_array *);
    virtual ir_visitor_status visit_enter(ir_if *);
    virtual ir_visitor_status visit_enter(ir_loop *);
 
@@ -289,6 +290,19 @@ ir_vectorize_visitor::visit_enter(ir_swizzle *ir)
    return visit_continue;
 }
 
+/* Upon entering an ir_array_dereference, remove the current assignment from
+ * further consideration. Since the index of an array dereference must scalar,
+ * we are not able to vectorize it.
+ *
+ * FINISHME: If all of scalar indices are identical we could vectorize.
+ */
+ir_visitor_status
+ir_vectorize_visitor::visit_enter(ir_dereference_array *ir)
+{
+   this->current_assignment = NULL;
+   return visit_continue_with_parent;
+}
+
 /* Since there is no statement to visit between the "then" and "else"
  * instructions try to vectorize before, in between, and after them to avoid
  * combining statements from different basic blocks.

commit 088d642b8fc1e1cf5ae0ec7b222413218b177b63
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Sat Jan 25 15:23:41 2014 +0000

    dri/nouveau: Pass the API into _mesa_initialize_context
    
    Currently we create a OPENGL_COMPAT context regardless of
    what was requested by the program. Correct that by retaining
    the program's request and passing it into _mesa_initialize_context.
    
    Based on a similar commit for radeon/r200 by Ian Romanick.
    
    Cc: "9.1 9.2 10.0" <mesa-stable@lists.freedesktop.org>
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    (cherry picked from commit 76d9f6d9729db1c999317a6b44818aa90c30a0b3)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index b84205b..f8c8dc3 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -72,7 +72,7 @@ nouveau_context_create(gl_api api,
 		return false;
 	}
 
-	ctx = screen->driver->context_create(screen, visual, share_ctx);
+	ctx = screen->driver->context_create(screen, api, visual, share_ctx);
 	if (!ctx) {
 		*error = __DRI_CTX_ERROR_NO_MEMORY;
 		return GL_FALSE;
@@ -107,7 +107,8 @@ nouveau_context_create(gl_api api,
 }
 
 GLboolean
-nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
+nouveau_context_init(struct gl_context *ctx, gl_api api,
+		     struct nouveau_screen *screen,
 		     const struct gl_config *visual, struct gl_context *share_ctx)
 {
 	struct nouveau_context *nctx = to_nouveau_context(ctx);
@@ -125,7 +126,7 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
 	nouveau_fbo_functions_init(&functions);
 
 	/* Initialize the mesa context. */
-	_mesa_initialize_context(ctx, API_OPENGL_COMPAT, visual,
+	_mesa_initialize_context(ctx, api, visual,
                                  share_ctx, &functions);
 
 	nouveau_state_init(ctx);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index 07d9605..8ea431b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -115,7 +115,8 @@ nouveau_context_create(gl_api api,
 		       void *share_ctx);
 
 GLboolean
-nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
+nouveau_context_init(struct gl_context *ctx, gl_api api,
+		     struct nouveau_screen *screen,
 		     const struct gl_config *visual, struct gl_context *share_ctx);
 
 void
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.h b/src/mesa/drivers/dri/nouveau/nouveau_driver.h
index e03b2c1..b6a8276 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.h
@@ -48,6 +48,7 @@
 
 struct nouveau_driver {
 	struct gl_context *(*context_create)(struct nouveau_screen *screen,
+				     gl_api api,
 				     const struct gl_config *visual,
 				     struct gl_context *share_ctx);
 	void (*context_destroy)(struct gl_context *ctx);
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 93dcd87..cd6e876 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -138,7 +138,8 @@ nv04_context_destroy(struct gl_context *ctx)
 }
 
 static struct gl_context *
-nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visual,
+nv04_context_create(struct nouveau_screen *screen, gl_api api,
+		    const struct gl_config *visual,
 		    struct gl_context *share_ctx)
 {
 	struct nv04_context *nctx;
@@ -153,7 +154,7 @@ nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visua
 	ctx = &nctx->base.base;
 	hw = &nctx->base.hw;
 
-	if (!nouveau_context_init(ctx, screen, visual, share_ctx))
+	if (!nouveau_context_init(ctx, api, screen, visual, share_ctx))
 		goto fail;
 
 	/* GL constants. */
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 8582cb2..904a410 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -427,7 +427,8 @@ nv10_context_destroy(struct gl_context *ctx)
 }
 
 static struct gl_context *
-nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visual,
+nv10_context_create(struct nouveau_screen *screen, gl_api api,
+		    const struct gl_config *visual,
 		    struct gl_context *share_ctx)
 {
 	struct nouveau_context *nctx;
@@ -441,7 +442,7 @@ nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visua
 
 	ctx = &nctx->base;
 
-	if (!nouveau_context_init(ctx, screen, visual, share_ctx))
+	if (!nouveau_context_init(ctx, api, screen, visual, share_ctx))
 		goto fail;
 
 	ctx->Extensions.ARB_texture_env_crossbar = true;
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 618280f..14329a2 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -438,7 +438,8 @@ nv20_context_destroy(struct gl_context *ctx)
 }
 
 static struct gl_context *
-nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visual,
+nv20_context_create(struct nouveau_screen *screen, gl_api api,
+		    const struct gl_config *visual,
 		    struct gl_context *share_ctx)
 {
 	struct nouveau_context *nctx;
@@ -452,7 +453,7 @@ nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visua
 
 	ctx = &nctx->base;
 
-	if (!nouveau_context_init(ctx, screen, visual, share_ctx))
+	if (!nouveau_context_init(ctx, api, screen, visual, share_ctx))
 		goto fail;
 
 	ctx->Extensions.ARB_texture_env_crossbar = true;

commit 69bd4ed017f7cc8bae20fb6da0aba249025b0776
Author: Daniel Kurtz <djkurtz@chromium.org>
Date:   Fri Feb 7 19:29:06 2014 +0800

    glsl: Add locking to builtin_builder singleton
    
    Consider a multithreaded program with two contexts A and B, and the
    following scenario:
    
    1. Context A calls initialize(), which allocates mem_ctx and starts
       building built-ins.
    2. Context B calls initialize(), which sees mem_ctx != NULL and assumes
       everything is already set up.  It returns.
    3. Context B calls find(), which fails to find the built-in since it
       hasn't been created yet.
    4. Context A finally finishes initializing the built-ins.
    
    This will break at step 3.  Adding a lock ensures that subsequent
    callers of initialize() will wait until initialization is actually
    complete.
    
    Similarly, if any thread calls release while another thread is still
    initializing, or calling find(), the mem_ctx/shader would get free'd while
    from under it, leading to corruption or use-after-free crashes.
    
    Fixes sporadic failures in Piglit's glx-multithread-shader-compile.
    
    Bugzilla: https://bugs.freedesktop.org/69200
    Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>


Reply to: