diff --git a/mesa-9.0-18-g5fe5aa8.patch b/mesa-9.0-18-g5fe5aa8.patch
deleted file mode 100644
index 312c72f..0000000
--- a/mesa-9.0-18-g5fe5aa8.patch
+++ /dev/null
@@ -1,464 +0,0 @@
-diff --git a/bin/get-pick-list.sh b/bin/get-pick-list.sh
-new file mode 100755
-index 0000000..7288090
---- /dev/null
-+++ b/bin/get-pick-list.sh
-@@ -0,0 +1,29 @@
-+#!/bin/sh
-+
-+# Script for generating a list of candidates for cherry-picking to a stable branch
-+
-+# Grep for commits with "cherry picked from commit" in the commit message.
-+git log --reverse --grep="cherry picked from commit" origin/master..HEAD |\
-+ grep "cherry picked from commit" |\
-+ sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
-+
-+# Grep for commits that were marked as a candidate for the stable tree.
-+git log --reverse --pretty=%H -i --grep='^[[:space:]]*NOTE: This is a candidate' HEAD..origin/master |\
-+while read sha
-+do
-+ # Check to see whether the patch is on the ignore list.
-+ if [ -f .git/cherry-ignore ] ; then
-+ if grep -q ^$sha .git/cherry-ignore ; then
-+ continue
-+ fi
-+ fi
-+
-+ # Check to see if it has already been picked over.
-+ if grep -q ^$sha already_picked ; then
-+ continue
-+ fi
-+
-+ git log -n1 --pretty=oneline $sha | cat
-+done
-+
-+rm -f already_picked
-diff --git a/docs/news.html b/docs/news.html
-index 541bde6..26e648b 100644
---- a/docs/news.html
-+++ b/docs/news.html
-@@ -9,6 +9,16 @@
-
-
News
-
-+October 8, 2012
-+
-+
-+Mesa 9.0 is released.
-+This is the first version of Mesa to support OpenGL 3.1 and GLSL 1.40
-+(with the i965 driver).
-+See the release notes for more information about the release.
-+
-+
-+
- July 10, 2012
-
-
-diff --git a/docs/relnotes-9.0.html b/docs/relnotes-9.0.html
-index d72c5bb..02b7324 100644
---- a/docs/relnotes-9.0.html
-+++ b/docs/relnotes-9.0.html
-@@ -26,7 +26,9 @@ because GL_ARB_compatibility is not supported.
-
-
MD5 checksums
-
--tbd
-+be4cd34c6599a7cb9d254b05c48bdb1f MesaLib-9.0.tar.gz
-+60e557ce407be3732711da484ab3db6c MesaLib-9.0.tar.bz2
-+16b128544cd3f7e237927bb9f8aab7ce MesaLib-9.0.zip
-
-
-
-diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
-index 7e67729..18e40e1 100644
---- a/src/gallium/drivers/nv30/nv30_miptree.c
-+++ b/src/gallium/drivers/nv30/nv30_miptree.c
-@@ -56,8 +56,7 @@ nv30_miptree_get_handle(struct pipe_screen *pscreen,
- if (!mt || !mt->base.bo)
- return FALSE;
-
-- stride = util_format_get_stride(mt->base.base.format,
-- mt->base.base.width0);
-+ stride = mt->level[0].pitch;
-
- return nouveau_screen_bo_get_handle(pscreen, mt->base.bo, stride, handle);
- }
-diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
-index 7b8dfb8..70e8c77 100644
---- a/src/gallium/drivers/nv50/nv50_miptree.c
-+++ b/src/gallium/drivers/nv50/nv50_miptree.c
-@@ -133,8 +133,7 @@ nv50_miptree_get_handle(struct pipe_screen *pscreen,
- if (!mt || !mt->base.bo)
- return FALSE;
-
-- stride = util_format_get_stride(mt->base.base.format,
-- mt->base.base.width0);
-+ stride = mt->level[0].pitch;
-
- return nouveau_screen_bo_get_handle(pscreen,
- mt->base.bo,
-diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
-index 751a18f..f83a7a7 100644
---- a/src/mapi/glapi/gen/gl_API.xml
-+++ b/src/mapi/glapi/gen/gl_API.xml
-@@ -2981,7 +2981,6 @@
-
-
-
--
-
-
-
-@@ -8089,6 +8088,8 @@
-
-
-
-+
-+
-
-
-
-diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
-index 6dfa08e..4799af2 100644
---- a/src/mesa/drivers/dri/i965/brw_misc_state.c
-+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
-@@ -413,8 +413,10 @@ static void emit_depthbuffer(struct brw_context *brw)
- * tile_x and tile_y to 0. This is a temporary workaround until we come
- * up with a better solution.
- */
-- tile_x &= ~7;
-- tile_y &= ~7;
-+ if (intel->gen >= 6) {
-+ tile_x &= ~7;
-+ tile_y &= ~7;
-+ }
-
- BEGIN_BATCH(len);
- OUT_BATCH(_3DSTATE_DEPTH_BUFFER << 16 | (len - 2));
-diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
-index f96583c..00a1b01 100644
---- a/src/mesa/drivers/dri/intel/intel_screen.c
-+++ b/src/mesa/drivers/dri/intel/intel_screen.c
-@@ -26,6 +26,7 @@
- **************************************************************************/
-
- #include
-+#include
- #include "main/glheader.h"
- #include "main/context.h"
- #include "main/framebuffer.h"
-diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
-index c0e6bc7..a21ae10 100644
---- a/src/mesa/main/context.c
-+++ b/src/mesa/main/context.c
-@@ -404,9 +404,6 @@ one_time_init( struct gl_context *ctx )
-
- _mesa_get_cpu_features();
-
-- /* context dependence is never a one-time thing... */
-- _mesa_init_get_hash(ctx);
--
- for (i = 0; i < 256; i++) {
- _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
- }
-@@ -425,6 +422,8 @@ one_time_init( struct gl_context *ctx )
-
- /* per-API one-time init */
- if (!(api_init_mask & (1 << ctx->API))) {
-+ _mesa_init_get_hash(ctx);
-+
- /*
- * This is fine as ES does not use the remap table, but it may not be
- * future-proof. We cannot always initialize the remap table because
-diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
-index fe1035b..e2ccc29 100644
---- a/src/mesa/main/get.c
-+++ b/src/mesa/main/get.c
-@@ -538,6 +538,11 @@ static const struct value_desc values[] = {
- /* GL_{APPLE,ARB,OES}_vertex_array_object */
- { GL_VERTEX_ARRAY_BINDING_APPLE, ARRAY_INT(Name), NO_EXTRA },
-
-+ /* GL_EXT_texture_filter_anisotropic */
-+ { GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
-+ CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy),
-+ extra_EXT_texture_filter_anisotropic },
-+
- #if FEATURE_GL || FEATURE_ES1
- /* Enums in OpenGL and GLES1 */
- { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGL_CORE_BIT, NO_EXTRA },
-@@ -687,11 +692,6 @@ static const struct value_desc values[] = {
- /* GL_EXT_texture_lod_bias */
- { GL_MAX_TEXTURE_LOD_BIAS_EXT, CONTEXT_FLOAT(Const.MaxTextureLodBias),
- NO_EXTRA },
--
-- /* GL_EXT_texture_filter_anisotropic */
-- { GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
-- CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy),
-- extra_EXT_texture_filter_anisotropic },
- #endif /* FEATURE_GL || FEATURE_ES1 */
-
- #if FEATURE_ES1
-@@ -791,6 +791,15 @@ static const struct value_desc values[] = {
-
- #endif /* FEATURE_GL || FEATURE_ES2 */
-
-+#if FEATURE_ES1 || FEATURE_ES2
-+ { 0, 0, TYPE_API_MASK, API_OPENGLES | API_OPENGLES2_BIT, NO_EXTRA },
-+ /* GL_OES_EGL_image_external */
-+ { GL_TEXTURE_BINDING_EXTERNAL_OES, LOC_CUSTOM,
-+ TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external },
-+ { GL_TEXTURE_EXTERNAL_OES, LOC_CUSTOM,
-+ TYPE_BOOLEAN, 0, extra_OES_EGL_image_external },
-+#endif
-+
- #if FEATURE_ES2
- /* Enums unique to OpenGL ES 2.0 */
- { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA },
-@@ -803,12 +812,6 @@ static const struct value_desc values[] = {
- { GL_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA },
- #endif /* FEATURE_ES2 */
-
-- /* GL_OES_EGL_image_external */
-- { GL_TEXTURE_BINDING_EXTERNAL_OES, LOC_CUSTOM,
-- TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external },
-- { GL_TEXTURE_EXTERNAL_OES, LOC_CUSTOM,
-- TYPE_BOOLEAN, 0, extra_OES_EGL_image_external },
--
- #if FEATURE_GL
- /* Remaining enums are only in OpenGL */
- { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGL_CORE_BIT, NO_EXTRA },
-@@ -1384,45 +1387,54 @@ static const struct value_desc values[] = {
- * collisions for any enum (typical numbers). And the code is very
- * simple, even though it feels a little magic. */
-
--static unsigned short table[1024];
-+static unsigned short table[API_LAST + 1][1024];
- static const int prime_factor = 89, prime_step = 281;
-
- #ifdef GET_DEBUG
- static void
--print_table_stats(void)
-+print_table_stats(int api)
- {
- int i, j, collisions[11], count, hash, mask;
- const struct value_desc *d;
--
-+ const char *api_names[] = {
-+ [API_OPENGL] = "GL",
-+ [API_OPENGL_CORE] = "GL_CORE",
-+ [API_OPENGLES] = "GLES",
-+ [API_OPENGLES2] = "GLES2",
-+ };
-+ const char *api_name;
-+
-+ api_name = api < Elements(api_names) ? api_names[api] : "N/A";
- count = 0;
-- mask = Elements(table) - 1;
-+ mask = Elements(table[api]) - 1;
- memset(collisions, 0, sizeof collisions);
-
-- for (i = 0; i < Elements(table); i++) {
-- if (!table[i])
-- continue;
-+ for (i = 0; i < Elements(table[api]); i++) {
-+ if (!table[api][i])
-+ continue;
- count++;
-- d = &values[table[i]];
-+ d = &values[table[api][i]];
- hash = (d->pname * prime_factor);
- j = 0;
- while (1) {
-- if (values[table[hash & mask]].pname == d->pname)
-- break;
-- hash += prime_step;
-- j++;
-+ if (values[table[api][hash & mask]].pname == d->pname)
-+ break;
-+ hash += prime_step;
-+ j++;
- }
-
- if (j < 10)
-- collisions[j]++;
-+ collisions[j]++;
- else
-- collisions[10]++;
-+ collisions[10]++;
- }
-
-- printf("number of enums: %d (total %d)\n", count, Elements(values));
-+ printf("number of enums for %s: %d (total %ld)\n",
-+ api_name, count, Elements(values));
- for (i = 0; i < Elements(collisions) - 1; i++)
- if (collisions[i] > 0)
-- printf(" %d enums with %d %scollisions\n",
-- collisions[i], i, i == 10 ? "or more " : "");
-+ printf(" %d enums with %d %scollisions\n",
-+ collisions[i], i, i == 10 ? "or more " : "");
- }
- #endif
-
-@@ -1437,27 +1449,30 @@ print_table_stats(void)
- void _mesa_init_get_hash(struct gl_context *ctx)
- {
- int i, hash, index, mask;
-+ int api;
- int api_mask = 0, api_bit;
-
-- mask = Elements(table) - 1;
-- api_bit = 1 << ctx->API;
-+ api = ctx->API;
-+
-+ mask = Elements(table[api]) - 1;
-+ api_bit = 1 << api;
-
- for (i = 0; i < Elements(values); i++) {
- if (values[i].type == TYPE_API_MASK) {
-- api_mask = values[i].offset;
-- continue;
-+ api_mask = values[i].offset;
-+ continue;
- }
- if (!(api_mask & api_bit))
-- continue;
-+ continue;
-
- hash = (values[i].pname * prime_factor) & mask;
- while (1) {
-- index = hash & mask;
-- if (!table[index]) {
-- table[index] = i;
-- break;
-- }
-- hash += prime_step;
-+ index = hash & mask;
-+ if (!table[api][index]) {
-+ table[api][index] = i;
-+ break;
-+ }
-+ hash += prime_step;
- }
- }
-
-@@ -1985,22 +2000,24 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
- struct gl_texture_unit *unit;
- int mask, hash;
- const struct value_desc *d;
-+ int api;
-
-- mask = Elements(table) - 1;
-+ api = ctx->API;
-+ mask = Elements(table[api]) - 1;
- hash = (pname * prime_factor);
- while (1) {
-- d = &values[table[hash & mask]];
-+ d = &values[table[api][hash & mask]];
-
- /* If the enum isn't valid, the hash walk ends with index 0,
- * which is the API mask entry at the beginning of values[]. */
- if (unlikely(d->type == TYPE_API_MASK)) {
-- _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
-- _mesa_lookup_enum_by_nr(pname));
-- return &error_value;
-+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
-+ _mesa_lookup_enum_by_nr(pname));
-+ return &error_value;
- }
-
- if (likely(d->pname == pname))
-- break;
-+ break;
-
- hash += prime_step;
- }
-diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
-index ba43e57..f185ffd 100644
---- a/src/mesa/main/mtypes.h
-+++ b/src/mesa/main/mtypes.h
-@@ -3340,6 +3340,8 @@ typedef enum
- API_OPENGLES,
- API_OPENGLES2,
- API_OPENGL_CORE,
-+
-+ API_LAST = API_OPENGL_CORE,
- } gl_api;
-
- /**
-diff --git a/src/mesa/main/tests/enum_strings.cpp b/src/mesa/main/tests/enum_strings.cpp
-index 7d46080..f4f424d 100644
---- a/src/mesa/main/tests/enum_strings.cpp
-+++ b/src/mesa/main/tests/enum_strings.cpp
-@@ -563,7 +563,7 @@ const struct enum_info everything[] = {
- { 0x8036, "GL_UNSIGNED_INT_10_10_10_2" },
- { 0x8037, "GL_POLYGON_OFFSET_FILL" },
- { 0x8038, "GL_POLYGON_OFFSET_FACTOR" },
-- { 0x8039, "GL_POLYGON_OFFSET_BIAS" },
-+ { 0x8039, "GL_POLYGON_OFFSET_BIAS_EXT" },
- { 0x803A, "GL_RESCALE_NORMAL" },
- { 0x803B, "GL_ALPHA4" },
- { 0x803C, "GL_ALPHA8" },
-diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
-index 21646cc..38fa9fa 100644
---- a/src/mesa/main/teximage.c
-+++ b/src/mesa/main/teximage.c
-@@ -3034,13 +3034,15 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
- border, internalFormat, texFormat);
-
- /* Give the texture to the driver. may be null. */
-- if (compressed) {
-- ctx->Driver.CompressedTexImage(ctx, dims, texImage,
-- imageSize, pixels);
-- }
-- else {
-- ctx->Driver.TexImage(ctx, dims, texImage, format,
-- type, pixels, unpack);
-+ if (width > 0 && height > 0 && depth > 0) {
-+ if (compressed) {
-+ ctx->Driver.CompressedTexImage(ctx, dims, texImage,
-+ imageSize, pixels);
-+ }
-+ else {
-+ ctx->Driver.TexImage(ctx, dims, texImage, format,
-+ type, pixels, unpack);
-+ }
- }
-
- check_gen_mipmap(ctx, target, texObj, level);
-@@ -3596,10 +3598,10 @@ compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions,
- if (!_mesa_is_compressed_format(ctx, format))
- return GL_INVALID_ENUM;
-
-- if (width < 1 || width > maxTextureSize)
-+ if (width < 0 || width > maxTextureSize)
- return GL_INVALID_VALUE;
-
-- if ((height < 1 || height > maxTextureSize)
-+ if ((height < 0 || height > maxTextureSize)
- && dimensions > 1)
- return GL_INVALID_VALUE;
-
-diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
-index ed3bbc7..b8e2538 100644
---- a/src/mesa/state_tracker/st_cb_texture.c
-+++ b/src/mesa/state_tracker/st_cb_texture.c
-@@ -1130,11 +1130,18 @@ copy_image_data_to_texture(struct st_context *st,
- /* Copy potentially with the blitter:
- */
- GLuint src_level;
-- if (stImage->pt != stObj->pt)
-+ if (stImage->pt->last_level == 0)
- src_level = 0;
- else
- src_level = stImage->base.Level;
-
-+ assert(src_level <= stImage->pt->last_level);
-+ assert(u_minify(stImage->pt->width0, src_level) == stImage->base.Width);
-+ assert(stImage->pt->target == PIPE_TEXTURE_1D_ARRAY ||
-+ u_minify(stImage->pt->height0, src_level) == stImage->base.Height);
-+ assert(stImage->pt->target == PIPE_TEXTURE_2D_ARRAY ||
-+ u_minify(stImage->pt->depth0, src_level) == stImage->base.Depth);
-+
- st_texture_image_copy(st->pipe,
- stObj->pt, dstLevel, /* dest texture, level */
- stImage->pt, src_level, /* src texture, level */
diff --git a/mesa-9.0-wayland-0.99.patch b/mesa-9.0-19-g895a587.patch
similarity index 50%
rename from mesa-9.0-wayland-0.99.patch
rename to mesa-9.0-19-g895a587.patch
index 0254ec4..c907bd7 100644
--- a/mesa-9.0-wayland-0.99.patch
+++ b/mesa-9.0-19-g895a587.patch
@@ -1,8 +1,99 @@
+diff --git a/Makefile.am b/Makefile.am
+index 9a0c1dd..3caa121 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -61,6 +61,7 @@ PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)
+ EXTRA_FILES = \
+ aclocal.m4 \
+ configure \
++ bin/install-sh \
+ src/glsl/glsl_parser.cc \
+ src/glsl/glsl_parser.h \
+ src/glsl/glsl_lexer.cc \
+diff --git a/bin/get-pick-list.sh b/bin/get-pick-list.sh
+new file mode 100755
+index 0000000..7288090
+--- /dev/null
++++ b/bin/get-pick-list.sh
+@@ -0,0 +1,29 @@
++#!/bin/sh
++
++# Script for generating a list of candidates for cherry-picking to a stable branch
++
++# Grep for commits with "cherry picked from commit" in the commit message.
++git log --reverse --grep="cherry picked from commit" origin/master..HEAD |\
++ grep "cherry picked from commit" |\
++ sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
++
++# Grep for commits that were marked as a candidate for the stable tree.
++git log --reverse --pretty=%H -i --grep='^[[:space:]]*NOTE: This is a candidate' HEAD..origin/master |\
++while read sha
++do
++ # Check to see whether the patch is on the ignore list.
++ if [ -f .git/cherry-ignore ] ; then
++ if grep -q ^$sha .git/cherry-ignore ; then
++ continue
++ fi
++ fi
++
++ # Check to see if it has already been picked over.
++ if grep -q ^$sha already_picked ; then
++ continue
++ fi
++
++ git log -n1 --pretty=oneline $sha | cat
++done
++
++rm -f already_picked
diff --git a/configure.ac b/configure.ac
-index 2d922f6..2b1b210 100644
+index 2d922f6..e7a7241 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -1518,7 +1518,7 @@ for plat in $egl_platforms; do
+@@ -160,13 +160,13 @@ DEFINES=""
+ AC_SUBST([DEFINES])
+ case "$host_os" in
+ linux*|*-gnu*|gnu*)
+- DEFINES="$DEFINES -D_GNU_SOURCE"
++ DEFINES="$DEFINES -D_GNU_SOURCE -DHAVE_PTHREAD"
+ ;;
+ solaris*)
+- DEFINES="$DEFINES -DSVR4"
++ DEFINES="$DEFINES -DHAVE_PTHREAD -DSVR4"
+ ;;
+ cygwin*)
+- DEFINES="$DEFINES"
++ DEFINES="$DEFINES -DHAVE_PTHREAD"
+ ;;
+ esac
+
+@@ -946,7 +946,7 @@ AC_ARG_ENABLE([glx-tls],
+ AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
+
+ AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
+- [DEFINES="${DEFINES} -DGLX_USE_TLS"])
++ [DEFINES="${DEFINES} -DGLX_USE_TLS -DHAVE_PTHREAD"])
+
+ dnl
+ dnl More DRI setup
+@@ -1030,7 +1030,7 @@ if test "x$enable_dri" = xyes; then
+ esac
+ ;;
+ freebsd* | dragonfly* | *netbsd*)
+- DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
++ DEFINES="$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1"
+ DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
+
+ if test "x$DRI_DIRS" = "xyes"; then
+@@ -1222,8 +1222,6 @@ if test "x$enable_gbm" = xyes; then
+ if test "x$enable_shared_glapi" = xno; then
+ AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
+ fi
+- PKG_CHECK_MODULES([LIBKMS], [libkms], [],
+- AC_MSG_ERROR([gbm needs libkms]))
+ fi
+ fi
+ GBM_PC_REQ_PRIV="libudev"
+@@ -1518,7 +1516,7 @@ for plat in $egl_platforms; do
;;
wayland)
@@ -11,6 +102,42 @@ index 2d922f6..2b1b210 100644
[AC_MSG_ERROR([cannot find libwayland-client])])
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
+diff --git a/docs/news.html b/docs/news.html
+index 541bde6..26e648b 100644
+--- a/docs/news.html
++++ b/docs/news.html
+@@ -9,6 +9,16 @@
+
+ News
+
++October 8, 2012
++
++
++Mesa 9.0 is released.
++This is the first version of Mesa to support OpenGL 3.1 and GLSL 1.40
++(with the i965 driver).
++See the release notes for more information about the release.
++
++
++
+ July 10, 2012
+
+
+diff --git a/docs/relnotes-9.0.html b/docs/relnotes-9.0.html
+index d72c5bb..02b7324 100644
+--- a/docs/relnotes-9.0.html
++++ b/docs/relnotes-9.0.html
+@@ -26,7 +26,9 @@ because GL_ARB_compatibility is not supported.
+
+
MD5 checksums
+
+-tbd
++be4cd34c6599a7cb9d254b05c48bdb1f MesaLib-9.0.tar.gz
++60e557ce407be3732711da484ab3db6c MesaLib-9.0.tar.bz2
++16b128544cd3f7e237927bb9f8aab7ce MesaLib-9.0.zip
+
+
+
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 81c1354..3c42338 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
@@ -450,6 +577,83 @@ index d291f0f..dcf3601 100644
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
dri2_dpy->authenticate = dri2_wayland_authenticate;
+diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
+index 71eca6f..4efb76b 100644
+--- a/src/egl/main/eglcontext.c
++++ b/src/egl/main/eglcontext.c
+@@ -229,17 +229,14 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
+ *
+ * "* If an OpenGL context is requested, the requested version
+ * is greater than 3.2, and the value for attribute
+- * EGL_CONTEXT_PROFILE_MASK_KHR has no bits set; has any
+- * bits set other than EGL_CONTEXT_CORE_PROFILE_BIT_KHR and
+- * EGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_KHR; has more than
+- * one of these bits set; or if the implementation does not
+- * support the requested profile, then an
+- * EGL_BAD_PROFILE_KHR error is generated."
+- *
+- * However, it does not define EGL_BAD_PROFILE_KHR. For now use
+- * EGL_BAD_ATTRIBUTE.
++ * EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR has no bits set; has
++ * any bits set other than EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR
++ * and EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; has
++ * more than one of these bits set; or if the implementation does
++ * not support the requested profile, then an EGL_BAD_MATCH error
++ * is generated."
+ */
+- err = EGL_BAD_ATTRIBUTE;
++ err = EGL_BAD_MATCH;
+ break;
+ }
+ }
+diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
+index 45b307f..d02aab6 100644
+--- a/src/egl/wayland/wayland-drm/wayland-drm.c
++++ b/src/egl/wayland/wayland-drm/wayland-drm.c
+@@ -36,17 +36,6 @@
+ #include "wayland-drm.h"
+ #include "wayland-drm-server-protocol.h"
+
+-/* Git master of Wayland is moving towards a stable version of the
+- * protocol, but breaking from 0.85 in the process. For the time
+- * being, it's convenient to be able to build Mesa against both master
+- * and 0.85.x of Wayland. To make this work we'll do a compile-time
+- * version check and work around the difference in API and protocol */
+-#if defined (WAYLAND_VERSION_MAJOR) && \
+- WAYLAND_VERSION_MAJOR == 0 && \
+- WAYLAND_VERSION_MINOR == 85
+-#define HAS_WAYLAND_0_85
+-#endif
+-
+ struct wl_drm {
+ struct wl_display *display;
+
+@@ -69,25 +58,10 @@ destroy_buffer(struct wl_resource *resource)
+ static void
+ buffer_destroy(struct wl_client *client, struct wl_resource *resource)
+ {
+-#ifdef HAS_WAYLAND_0_85
+- wl_resource_destroy(resource, 0);
+-#else
+ wl_resource_destroy(resource);
+-#endif
+-}
+-
+-#ifdef HAS_WAYLAND_0_85
+-static void
+-buffer_damage(struct wl_client *client, struct wl_resource *buffer,
+- int32_t x, int32_t y, int32_t width, int32_t height)
+-{
+ }
+-#endif
+
+ const static struct wl_buffer_interface drm_buffer_interface = {
+-#ifdef HAS_WAYLAND_0_85
+- buffer_damage,
+-#endif
+ buffer_destroy
+ };
+
diff --git a/src/egl/wayland/wayland-egl/wayland-egl-priv.h b/src/egl/wayland/wayland-egl/wayland-egl-priv.h
index accd2dd..bdbf32a 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl-priv.h
@@ -513,6 +717,34 @@ index e950b4a..c61fb4f 100644
-{
- return egl_pixmap->buffer;
-}
+diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
+index 7e67729..18e40e1 100644
+--- a/src/gallium/drivers/nv30/nv30_miptree.c
++++ b/src/gallium/drivers/nv30/nv30_miptree.c
+@@ -56,8 +56,7 @@ nv30_miptree_get_handle(struct pipe_screen *pscreen,
+ if (!mt || !mt->base.bo)
+ return FALSE;
+
+- stride = util_format_get_stride(mt->base.base.format,
+- mt->base.base.width0);
++ stride = mt->level[0].pitch;
+
+ return nouveau_screen_bo_get_handle(pscreen, mt->base.bo, stride, handle);
+ }
+diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
+index 7b8dfb8..70e8c77 100644
+--- a/src/gallium/drivers/nv50/nv50_miptree.c
++++ b/src/gallium/drivers/nv50/nv50_miptree.c
+@@ -133,8 +133,7 @@ nv50_miptree_get_handle(struct pipe_screen *pscreen,
+ if (!mt || !mt->base.bo)
+ return FALSE;
+
+- stride = util_format_get_stride(mt->base.base.format,
+- mt->base.base.width0);
++ stride = mt->level[0].pitch;
+
+ return nouveau_screen_bo_get_handle(pscreen,
+ mt->base.bo,
diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c b/src/gallium/state_trackers/egl/wayland/native_drm.c
index c6f6197..4671e33 100644
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -932,3 +1164,726 @@ index e6a914f..b623fee 100644
+wayland_roundtrip(struct wayland_display *drmdpy);
+
#endif /* _NATIVE_WAYLAND_H_ */
+diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
+index d8b1cc7..519929e 100644
+--- a/src/gbm/backends/dri/gbm_dri.c
++++ b/src/gbm/backends/dri/gbm_dri.c
+@@ -33,8 +33,10 @@
+ #include
+
+ #include
++#include
+ #include
+ #include
++#include
+
+ #include /* dri_interface needs GL types */
+ #include
+@@ -300,19 +302,12 @@ static int
+ gbm_dri_bo_write(struct gbm_bo *_bo, const void *buf, size_t count)
+ {
+ struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
+- void *ptr;
+- int ret;
+-
+- if (bo->bo == NULL)
+- return -1;
+
+- ret = kms_bo_map(bo->bo, &ptr);
+- if (ret < 0)
++ if (bo->image != NULL)
+ return -1;
+
+- memcpy(ptr, buf, count);
++ memcpy(bo->map, buf, count);
+
+- kms_bo_unmap(bo->bo);
+ return 0;
+ }
+
+@@ -321,11 +316,17 @@ gbm_dri_bo_destroy(struct gbm_bo *_bo)
+ {
+ struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm);
+ struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
++ struct drm_mode_destroy_dumb arg;
+
+- if (bo->image != NULL)
++ if (bo->image != NULL) {
+ dri->image->destroyImage(bo->image);
+- if (bo->bo != NULL)
+- kms_bo_destroy(&bo->bo);
++ } else {
++ munmap(bo->map, bo->size);
++ memset(&arg, 0, sizeof(arg));
++ arg.handle = bo->handle;
++ drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);
++ }
++
+ free(bo);
+ }
+
+@@ -375,6 +376,9 @@ gbm_dri_bo_import(struct gbm_device *gbm,
+ {
+ struct wl_drm_buffer *wb = (struct wl_drm_buffer *) buffer;
+
++ if (!wayland_buffer_is_drm(buffer))
++ return NULL;
++
+ image = wb->driver_buffer;
+
+ switch (wb->format) {
+@@ -445,49 +449,86 @@ gbm_dri_bo_import(struct gbm_device *gbm,
+ }
+
+ static struct gbm_bo *
+-gbm_dri_bo_create(struct gbm_device *gbm,
++create_dumb(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+ uint32_t format, uint32_t usage)
+ {
+ struct gbm_dri_device *dri = gbm_dri_device(gbm);
++ struct drm_mode_create_dumb create_arg;
++ struct drm_mode_map_dumb map_arg;
+ struct gbm_dri_bo *bo;
+- int dri_format;
+- unsigned dri_use = 0;
++ struct drm_mode_destroy_dumb destroy_arg;
++ int ret;
++
++ if (!(usage & GBM_BO_USE_CURSOR_64X64))
++ return NULL;
++ if (format != GBM_FORMAT_ARGB8888)
++ return NULL;
+
+ bo = calloc(1, sizeof *bo);
+ if (bo == NULL)
+ return NULL;
+
++ create_arg.bpp = 32;
++ create_arg.width = width;
++ create_arg.height = height;
++
++ ret = drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_arg);
++ if (ret)
++ goto free_bo;
++
+ bo->base.base.gbm = gbm;
+ bo->base.base.width = width;
+ bo->base.base.height = height;
++ bo->base.base.stride = create_arg.pitch;
++ bo->base.base.handle.u32 = create_arg.handle;
++ bo->handle = create_arg.handle;
++ bo->size = create_arg.size;
+
+- if (usage & GBM_BO_USE_WRITE) {
+- int ret;
+- unsigned attrs[7] = {
+- KMS_WIDTH, 64,
+- KMS_HEIGHT, 64,
+- KMS_BO_TYPE, KMS_BO_TYPE_SCANOUT_X8R8G8B8,
+- KMS_TERMINATE_PROP_LIST,
+- };
++ memset(&map_arg, 0, sizeof(map_arg));
++ map_arg.handle = bo->handle;
+
+- if (!(usage & GBM_BO_USE_CURSOR_64X64))
+- return NULL;
++ ret = drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_MAP_DUMB, &map_arg);
++ if (ret)
++ goto destroy_dumb;
+
+- if (dri->kms == NULL)
+- return NULL;
++ bo->map = mmap(0, bo->size, PROT_WRITE,
++ MAP_SHARED, dri->base.base.fd, map_arg.offset);
++ if (bo->map == MAP_FAILED)
++ goto destroy_dumb;
+
+- ret = kms_bo_create(dri->kms, attrs, &bo->bo);
+- if (ret < 0) {
+- free(bo);
+- return NULL;
+- }
++ return &bo->base.base;
+
+- kms_bo_get_prop(bo->bo, KMS_PITCH, &bo->base.base.stride);
+- kms_bo_get_prop(bo->bo, KMS_HANDLE, (unsigned*)&bo->base.base.handle);
++destroy_dumb:
++ memset(&destroy_arg, 0, sizeof destroy_arg);
++ destroy_arg.handle = create_arg.handle;
++ drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg);
++free_bo:
++ free(bo);
+
+- return &bo->base.base;
+- }
++ return NULL;
++}
++
++static struct gbm_bo *
++gbm_dri_bo_create(struct gbm_device *gbm,
++ uint32_t width, uint32_t height,
++ uint32_t format, uint32_t usage)
++{
++ struct gbm_dri_device *dri = gbm_dri_device(gbm);
++ struct gbm_dri_bo *bo;
++ int dri_format;
++ unsigned dri_use = 0;
++
++ if (usage & GBM_BO_USE_WRITE)
++ return create_dumb(gbm, width, height, format, usage);
++
++ bo = calloc(1, sizeof *bo);
++ if (bo == NULL)
++ return NULL;
++
++ bo->base.base.gbm = gbm;
++ bo->base.base.width = width;
++ bo->base.base.height = height;
+
+ switch (format) {
+ case GBM_FORMAT_RGB565:
+@@ -594,10 +635,6 @@ dri_device_create(int fd)
+ dri->base.type = GBM_DRM_DRIVER_TYPE_DRI;
+ dri->base.base.name = "drm";
+
+- kms_create(fd, &dri->kms);
+- if (dri->kms == NULL)
+- goto err_kms;
+-
+ ret = dri_screen_create(dri);
+ if (ret)
+ goto err_dri;
+@@ -605,9 +642,8 @@ dri_device_create(int fd)
+ return &dri->base.base;
+
+ err_dri:
+- kms_destroy(&dri->kms);
+-err_kms:
+ free(dri);
++
+ return NULL;
+ }
+
+diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
+index 4b619a0..18fc3c0 100644
+--- a/src/gbm/backends/dri/gbm_driint.h
++++ b/src/gbm/backends/dri/gbm_driint.h
+@@ -30,8 +30,6 @@
+
+ #include "gbmint.h"
+
+-#include "libkms.h"
+-
+ #include "common.h"
+ #include "common_drm.h"
+
+@@ -43,9 +41,6 @@ struct gbm_dri_surface;
+ struct gbm_dri_device {
+ struct gbm_drm_device base;
+
+- /* Only used for cursors */
+- struct kms_driver *kms;
+-
+ void *driver;
+
+ __DRIscreen *screen;
+@@ -79,7 +74,8 @@ struct gbm_dri_bo {
+ __DRIimage *image;
+
+ /* Only used for cursors */
+- struct kms_bo *bo;
++ uint32_t handle, size;
++ void *map;
+ };
+
+ struct gbm_dri_surface {
+diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
+index 34ce133..86371b5 100644
+--- a/src/glsl/linker.cpp
++++ b/src/glsl/linker.cpp
+@@ -882,6 +882,7 @@ move_non_declarations(exec_list *instructions, exec_node *last,
+
+ assert(inst->as_assignment()
+ || inst->as_call()
++ || inst->as_if() /* for initializers with the ?: operator */
+ || ((var != NULL) && (var->mode == ir_var_temporary)));
+
+ if (make_copies) {
+diff --git a/src/glsl/ralloc.c b/src/glsl/ralloc.c
+index 3da09b5..59e71c4 100644
+--- a/src/glsl/ralloc.c
++++ b/src/glsl/ralloc.c
+@@ -41,14 +41,6 @@ _CRTIMP int _vscprintf(const char *format, va_list argptr);
+
+ #include "ralloc.h"
+
+-#ifdef __GNUC__
+-#define likely(x) __builtin_expect(!!(x),1)
+-#define unlikely(x) __builtin_expect(!!(x),0)
+-#else
+-#define likely(x) !!(x)
+-#define unlikely(x) !!(x)
+-#endif
+-
+ #ifndef va_copy
+ #ifdef __va_copy
+ #define va_copy(dest, src) __va_copy((dest), (src))
+diff --git a/src/glsl/ralloc.h b/src/glsl/ralloc.h
+index 86306b1..67eb938 100644
+--- a/src/glsl/ralloc.h
++++ b/src/glsl/ralloc.h
+@@ -54,6 +54,7 @@ extern "C" {
+ #include
+ #include
+ #include
++#include "main/compiler.h"
+
+ /**
+ * \def ralloc(ctx, type)
+@@ -301,7 +302,7 @@ bool ralloc_strncat(char **dest, const char *str, size_t n);
+ *
+ * \return The newly allocated string.
+ */
+-char *ralloc_asprintf (const void *ctx, const char *fmt, ...);
++char *ralloc_asprintf (const void *ctx, const char *fmt, ...) PRINTFLIKE(2, 3);
+
+ /**
+ * Print to a string, given a va_list.
+@@ -334,7 +335,8 @@ char *ralloc_vasprintf(const void *ctx, const char *fmt, va_list args);
+ * \return True unless allocation failed.
+ */
+ bool ralloc_asprintf_rewrite_tail(char **str, size_t *start,
+- const char *fmt, ...);
++ const char *fmt, ...)
++ PRINTFLIKE(3, 4);
+
+ /**
+ * Rewrite the tail of an existing string, starting at a given index.
+@@ -376,7 +378,8 @@ bool ralloc_vasprintf_rewrite_tail(char **str, size_t *start, const char *fmt,
+ *
+ * \return True unless allocation failed.
+ */
+-bool ralloc_asprintf_append (char **str, const char *fmt, ...);
++bool ralloc_asprintf_append (char **str, const char *fmt, ...)
++ PRINTFLIKE(2, 3);
+
+ /**
+ * Append formatted text to the supplied string, given a va_list.
+diff --git a/src/glsl/tests/Makefile.am b/src/glsl/tests/Makefile.am
+index ee3cef6..957bb55 100644
+--- a/src/glsl/tests/Makefile.am
++++ b/src/glsl/tests/Makefile.am
+@@ -1,12 +1,9 @@
+-INC = \
++AM_CPPFLAGS = \
+ -I$(top_builddir)/src/gtest/include \
+ -I$(top_builddir)/src/mesa \
+ -I$(top_builddir)/src/mapi \
+ -I$(top_builddir)/src/glsl
+
+-AM_CFLAGS = $(INC)
+-AM_CXXFLAGS = $(INC)
+-
+ TESTS_ENVIRONMENT= \
+ export PYTHON2=$(PYTHON2); \
+ export PYTHON_FLAGS=$(PYTHON_FLAGS);
+diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
+index 4e8b351..15f590e 100644
+--- a/src/glx/dri2_glx.c
++++ b/src/glx/dri2_glx.c
+@@ -961,7 +961,7 @@ dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions)
+ __glXEnableDirectExtension(&psc->base, "GLX_SGI_make_current_read");
+
+ /* FIXME: if DRI2 version supports it... */
+- __glXEnableDirectExtension(&psc->base, "INTEL_swap_event");
++ __glXEnableDirectExtension(&psc->base, "GLX_INTEL_swap_event");
+
+ if (psc->dri2->base.version >= 3) {
+ const unsigned mask = psc->dri2->getAPIMask(psc->driScreen);
+diff --git a/src/glx/glxext.c b/src/glx/glxext.c
+index a4e76c1..420e677 100644
+--- a/src/glx/glxext.c
++++ b/src/glx/glxext.c
+@@ -83,6 +83,7 @@ static /* const */ char *error_list[] = {
+ "GLXBadPbuffer",
+ "GLXBadCurrentDrawable",
+ "GLXBadWindow",
++ "GLXBadProfileARB",
+ };
+
+ #ifdef GLX_USE_APPLEGL
+@@ -404,6 +405,8 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count,
+ #endif
+ }
+
++ config->sRGBCapable = GL_FALSE;
++
+ /*
+ ** Additional properties may be in a list at the end
+ ** of the reply. They are in pairs of property type
+diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
+index 751a18f..f83a7a7 100644
+--- a/src/mapi/glapi/gen/gl_API.xml
++++ b/src/mapi/glapi/gen/gl_API.xml
+@@ -2981,7 +2981,6 @@
+
+
+
+-
+
+
+
+@@ -8089,6 +8088,8 @@
+
+
+
++
++
+
+
+
+diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
+index 6dfa08e..4799af2 100644
+--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
++++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
+@@ -413,8 +413,10 @@ static void emit_depthbuffer(struct brw_context *brw)
+ * tile_x and tile_y to 0. This is a temporary workaround until we come
+ * up with a better solution.
+ */
+- tile_x &= ~7;
+- tile_y &= ~7;
++ if (intel->gen >= 6) {
++ tile_x &= ~7;
++ tile_y &= ~7;
++ }
+
+ BEGIN_BATCH(len);
+ OUT_BATCH(_3DSTATE_DEPTH_BUFFER << 16 | (len - 2));
+diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
+index f96583c..00a1b01 100644
+--- a/src/mesa/drivers/dri/intel/intel_screen.c
++++ b/src/mesa/drivers/dri/intel/intel_screen.c
+@@ -26,6 +26,7 @@
+ **************************************************************************/
+
+ #include
++#include
+ #include "main/glheader.h"
+ #include "main/context.h"
+ #include "main/framebuffer.h"
+diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
+index c0e6bc7..a21ae10 100644
+--- a/src/mesa/main/context.c
++++ b/src/mesa/main/context.c
+@@ -404,9 +404,6 @@ one_time_init( struct gl_context *ctx )
+
+ _mesa_get_cpu_features();
+
+- /* context dependence is never a one-time thing... */
+- _mesa_init_get_hash(ctx);
+-
+ for (i = 0; i < 256; i++) {
+ _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
+ }
+@@ -425,6 +422,8 @@ one_time_init( struct gl_context *ctx )
+
+ /* per-API one-time init */
+ if (!(api_init_mask & (1 << ctx->API))) {
++ _mesa_init_get_hash(ctx);
++
+ /*
+ * This is fine as ES does not use the remap table, but it may not be
+ * future-proof. We cannot always initialize the remap table because
+diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
+index fe1035b..e2ccc29 100644
+--- a/src/mesa/main/get.c
++++ b/src/mesa/main/get.c
+@@ -538,6 +538,11 @@ static const struct value_desc values[] = {
+ /* GL_{APPLE,ARB,OES}_vertex_array_object */
+ { GL_VERTEX_ARRAY_BINDING_APPLE, ARRAY_INT(Name), NO_EXTRA },
+
++ /* GL_EXT_texture_filter_anisotropic */
++ { GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
++ CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy),
++ extra_EXT_texture_filter_anisotropic },
++
+ #if FEATURE_GL || FEATURE_ES1
+ /* Enums in OpenGL and GLES1 */
+ { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGL_CORE_BIT, NO_EXTRA },
+@@ -687,11 +692,6 @@ static const struct value_desc values[] = {
+ /* GL_EXT_texture_lod_bias */
+ { GL_MAX_TEXTURE_LOD_BIAS_EXT, CONTEXT_FLOAT(Const.MaxTextureLodBias),
+ NO_EXTRA },
+-
+- /* GL_EXT_texture_filter_anisotropic */
+- { GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
+- CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy),
+- extra_EXT_texture_filter_anisotropic },
+ #endif /* FEATURE_GL || FEATURE_ES1 */
+
+ #if FEATURE_ES1
+@@ -791,6 +791,15 @@ static const struct value_desc values[] = {
+
+ #endif /* FEATURE_GL || FEATURE_ES2 */
+
++#if FEATURE_ES1 || FEATURE_ES2
++ { 0, 0, TYPE_API_MASK, API_OPENGLES | API_OPENGLES2_BIT, NO_EXTRA },
++ /* GL_OES_EGL_image_external */
++ { GL_TEXTURE_BINDING_EXTERNAL_OES, LOC_CUSTOM,
++ TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external },
++ { GL_TEXTURE_EXTERNAL_OES, LOC_CUSTOM,
++ TYPE_BOOLEAN, 0, extra_OES_EGL_image_external },
++#endif
++
+ #if FEATURE_ES2
+ /* Enums unique to OpenGL ES 2.0 */
+ { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA },
+@@ -803,12 +812,6 @@ static const struct value_desc values[] = {
+ { GL_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA },
+ #endif /* FEATURE_ES2 */
+
+- /* GL_OES_EGL_image_external */
+- { GL_TEXTURE_BINDING_EXTERNAL_OES, LOC_CUSTOM,
+- TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external },
+- { GL_TEXTURE_EXTERNAL_OES, LOC_CUSTOM,
+- TYPE_BOOLEAN, 0, extra_OES_EGL_image_external },
+-
+ #if FEATURE_GL
+ /* Remaining enums are only in OpenGL */
+ { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGL_CORE_BIT, NO_EXTRA },
+@@ -1384,45 +1387,54 @@ static const struct value_desc values[] = {
+ * collisions for any enum (typical numbers). And the code is very
+ * simple, even though it feels a little magic. */
+
+-static unsigned short table[1024];
++static unsigned short table[API_LAST + 1][1024];
+ static const int prime_factor = 89, prime_step = 281;
+
+ #ifdef GET_DEBUG
+ static void
+-print_table_stats(void)
++print_table_stats(int api)
+ {
+ int i, j, collisions[11], count, hash, mask;
+ const struct value_desc *d;
+-
++ const char *api_names[] = {
++ [API_OPENGL] = "GL",
++ [API_OPENGL_CORE] = "GL_CORE",
++ [API_OPENGLES] = "GLES",
++ [API_OPENGLES2] = "GLES2",
++ };
++ const char *api_name;
++
++ api_name = api < Elements(api_names) ? api_names[api] : "N/A";
+ count = 0;
+- mask = Elements(table) - 1;
++ mask = Elements(table[api]) - 1;
+ memset(collisions, 0, sizeof collisions);
+
+- for (i = 0; i < Elements(table); i++) {
+- if (!table[i])
+- continue;
++ for (i = 0; i < Elements(table[api]); i++) {
++ if (!table[api][i])
++ continue;
+ count++;
+- d = &values[table[i]];
++ d = &values[table[api][i]];
+ hash = (d->pname * prime_factor);
+ j = 0;
+ while (1) {
+- if (values[table[hash & mask]].pname == d->pname)
+- break;
+- hash += prime_step;
+- j++;
++ if (values[table[api][hash & mask]].pname == d->pname)
++ break;
++ hash += prime_step;
++ j++;
+ }
+
+ if (j < 10)
+- collisions[j]++;
++ collisions[j]++;
+ else
+- collisions[10]++;
++ collisions[10]++;
+ }
+
+- printf("number of enums: %d (total %d)\n", count, Elements(values));
++ printf("number of enums for %s: %d (total %ld)\n",
++ api_name, count, Elements(values));
+ for (i = 0; i < Elements(collisions) - 1; i++)
+ if (collisions[i] > 0)
+- printf(" %d enums with %d %scollisions\n",
+- collisions[i], i, i == 10 ? "or more " : "");
++ printf(" %d enums with %d %scollisions\n",
++ collisions[i], i, i == 10 ? "or more " : "");
+ }
+ #endif
+
+@@ -1437,27 +1449,30 @@ print_table_stats(void)
+ void _mesa_init_get_hash(struct gl_context *ctx)
+ {
+ int i, hash, index, mask;
++ int api;
+ int api_mask = 0, api_bit;
+
+- mask = Elements(table) - 1;
+- api_bit = 1 << ctx->API;
++ api = ctx->API;
++
++ mask = Elements(table[api]) - 1;
++ api_bit = 1 << api;
+
+ for (i = 0; i < Elements(values); i++) {
+ if (values[i].type == TYPE_API_MASK) {
+- api_mask = values[i].offset;
+- continue;
++ api_mask = values[i].offset;
++ continue;
+ }
+ if (!(api_mask & api_bit))
+- continue;
++ continue;
+
+ hash = (values[i].pname * prime_factor) & mask;
+ while (1) {
+- index = hash & mask;
+- if (!table[index]) {
+- table[index] = i;
+- break;
+- }
+- hash += prime_step;
++ index = hash & mask;
++ if (!table[api][index]) {
++ table[api][index] = i;
++ break;
++ }
++ hash += prime_step;
+ }
+ }
+
+@@ -1985,22 +2000,24 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
+ struct gl_texture_unit *unit;
+ int mask, hash;
+ const struct value_desc *d;
++ int api;
+
+- mask = Elements(table) - 1;
++ api = ctx->API;
++ mask = Elements(table[api]) - 1;
+ hash = (pname * prime_factor);
+ while (1) {
+- d = &values[table[hash & mask]];
++ d = &values[table[api][hash & mask]];
+
+ /* If the enum isn't valid, the hash walk ends with index 0,
+ * which is the API mask entry at the beginning of values[]. */
+ if (unlikely(d->type == TYPE_API_MASK)) {
+- _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
+- _mesa_lookup_enum_by_nr(pname));
+- return &error_value;
++ _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
++ _mesa_lookup_enum_by_nr(pname));
++ return &error_value;
+ }
+
+ if (likely(d->pname == pname))
+- break;
++ break;
+
+ hash += prime_step;
+ }
+diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
+index ba43e57..f185ffd 100644
+--- a/src/mesa/main/mtypes.h
++++ b/src/mesa/main/mtypes.h
+@@ -3340,6 +3340,8 @@ typedef enum
+ API_OPENGLES,
+ API_OPENGLES2,
+ API_OPENGL_CORE,
++
++ API_LAST = API_OPENGL_CORE,
+ } gl_api;
+
+ /**
+diff --git a/src/mesa/main/tests/enum_strings.cpp b/src/mesa/main/tests/enum_strings.cpp
+index 7d46080..f4f424d 100644
+--- a/src/mesa/main/tests/enum_strings.cpp
++++ b/src/mesa/main/tests/enum_strings.cpp
+@@ -563,7 +563,7 @@ const struct enum_info everything[] = {
+ { 0x8036, "GL_UNSIGNED_INT_10_10_10_2" },
+ { 0x8037, "GL_POLYGON_OFFSET_FILL" },
+ { 0x8038, "GL_POLYGON_OFFSET_FACTOR" },
+- { 0x8039, "GL_POLYGON_OFFSET_BIAS" },
++ { 0x8039, "GL_POLYGON_OFFSET_BIAS_EXT" },
+ { 0x803A, "GL_RESCALE_NORMAL" },
+ { 0x803B, "GL_ALPHA4" },
+ { 0x803C, "GL_ALPHA8" },
+diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
+index 21646cc..38fa9fa 100644
+--- a/src/mesa/main/teximage.c
++++ b/src/mesa/main/teximage.c
+@@ -3034,13 +3034,15 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
+ border, internalFormat, texFormat);
+
+ /* Give the texture to the driver. may be null. */
+- if (compressed) {
+- ctx->Driver.CompressedTexImage(ctx, dims, texImage,
+- imageSize, pixels);
+- }
+- else {
+- ctx->Driver.TexImage(ctx, dims, texImage, format,
+- type, pixels, unpack);
++ if (width > 0 && height > 0 && depth > 0) {
++ if (compressed) {
++ ctx->Driver.CompressedTexImage(ctx, dims, texImage,
++ imageSize, pixels);
++ }
++ else {
++ ctx->Driver.TexImage(ctx, dims, texImage, format,
++ type, pixels, unpack);
++ }
+ }
+
+ check_gen_mipmap(ctx, target, texObj, level);
+@@ -3596,10 +3598,10 @@ compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions,
+ if (!_mesa_is_compressed_format(ctx, format))
+ return GL_INVALID_ENUM;
+
+- if (width < 1 || width > maxTextureSize)
++ if (width < 0 || width > maxTextureSize)
+ return GL_INVALID_VALUE;
+
+- if ((height < 1 || height > maxTextureSize)
++ if ((height < 0 || height > maxTextureSize)
+ && dimensions > 1)
+ return GL_INVALID_VALUE;
+
+diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
+index ed3bbc7..b8e2538 100644
+--- a/src/mesa/state_tracker/st_cb_texture.c
++++ b/src/mesa/state_tracker/st_cb_texture.c
+@@ -1130,11 +1130,18 @@ copy_image_data_to_texture(struct st_context *st,
+ /* Copy potentially with the blitter:
+ */
+ GLuint src_level;
+- if (stImage->pt != stObj->pt)
++ if (stImage->pt->last_level == 0)
+ src_level = 0;
+ else
+ src_level = stImage->base.Level;
+
++ assert(src_level <= stImage->pt->last_level);
++ assert(u_minify(stImage->pt->width0, src_level) == stImage->base.Width);
++ assert(stImage->pt->target == PIPE_TEXTURE_1D_ARRAY ||
++ u_minify(stImage->pt->height0, src_level) == stImage->base.Height);
++ assert(stImage->pt->target == PIPE_TEXTURE_2D_ARRAY ||
++ u_minify(stImage->pt->depth0, src_level) == stImage->base.Depth);
++
+ st_texture_image_copy(st->pipe,
+ stObj->pt, dstLevel, /* dest texture, level */
+ stImage->pt, src_level, /* src texture, level */
diff --git a/mesa.spec b/mesa.spec
index d0e795e..0eae62c 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -45,7 +45,7 @@
Summary: Mesa graphics libraries
Name: mesa
Version: 9.0
-Release: 4%{?dist}
+Release: 5%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.mesa3d.org
@@ -56,13 +56,12 @@ Source0: ftp://ftp.freedesktop.org/pub/%{name}/%{version}/MesaLib-%{version}.tar
#Source0: %{name}-%{gitdate}.tar.xz
Source3: make-git-snapshot.sh
-Patch1: mesa-9.0-18-g5fe5aa8.patch
+Patch1: mesa-9.0-19-g895a587.patch
#Patch7: mesa-7.1-link-shared.patch
Patch9: mesa-8.0-llvmpipe-shmget.patch
Patch11: mesa-8.0-nouveau-tfp-blacklist.patch
Patch12: mesa-8.0.1-fix-16bpp.patch
-Patch13: mesa-9.0-wayland-0.99.patch
BuildRequires: pkgconfig autoconf automake libtool
%if %{with_hardware}
@@ -269,11 +268,6 @@ Mesa shared glapi
#setup -q -n mesa-%{gitdate}
%patch1 -p1 -b .git
%patch11 -p1 -b .nouveau
-# yes, conditional patch. sorry.
-%if 0%{?fedora} < 18
-%else
-%patch13 -p1 -b .wl099
-%endif
# this fastpath is:
# - broken with swrast classic
@@ -558,6 +552,10 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
+* Wed Nov 07 2012 Dave Airlie 9.0-5
+- mesa-9.0-19-g895a587.patch: sync with 9.0 branch with git
+- drop wayland patch its in git now.
+
* Thu Nov 01 2012 Adam Jackson 9.0-4
- mesa-9.0-18-g5fe5aa8: sync with 9.0 branch in git
- Portability fixes for F17: old wayland, old llvm.