diff --git a/mesa-9.0-12-gd56ee24.patch b/mesa-9.0-12-gd56ee24.patch
deleted file mode 100644
index 1e100af..0000000
--- a/mesa-9.0-12-gd56ee24.patch
+++ /dev/null
@@ -1,351 +0,0 @@
-% git describe origin/9.0
-mesa-9.0-12-gd56ee24
-
-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/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/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/mesa-9.0-18-g5fe5aa8.patch b/mesa-9.0-18-g5fe5aa8.patch
new file mode 100644
index 0000000..19bbfdd
--- /dev/null
+++ b/mesa-9.0-18-g5fe5aa8.patch
@@ -0,0 +1,3 @@
+:040000 040000 783d843afb5b990dddb72f80b8552dd25a037e14 b0634d6f8c35a8818de8deafb489ae241d7da731 M bin
+:040000 040000 cf01085ae9dc0db75248d24f708d443915233bbd ea926add0d4467e23e720ecacec7efc81c956b62 M docs
+:040000 040000 c8647a09670c3b12bffe3a23aa8943e28960e17f 0748aa483366688ba4017daa597c95664715aa50 M src
diff --git a/mesa.spec b/mesa.spec
index 21eb94f..1931bfa 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -2,6 +2,14 @@
%define rhel_no_hw_arches ppc ppc64 ppc64p7
%endif
+# f17 support wayland 0.85, llvm 3.0 means no radeonsi
+%if 0%{?fedora} < 18
+%define min_wayland_version 0.85
+%else
+%define min_wayland_version 1.0
+%define with_radeonsi 1
+%endif
+
# S390 doesn't have video cards, but we need swrast for xserver's GLX
%ifarch s390 s390x %{?rhel_no_hw_arches}
%define with_hardware 0
@@ -37,7 +45,7 @@
Summary: Mesa graphics libraries
Name: mesa
Version: 9.0
-Release: 3%{?dist}
+Release: 4%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.mesa3d.org
@@ -48,7 +56,7 @@ 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-12-gd56ee24.patch
+Patch1: mesa-9.0-18-g5fe5aa8.patch
#Patch7: mesa-7.1-link-shared.patch
Patch9: mesa-8.0-llvmpipe-shmget.patch
@@ -76,7 +84,7 @@ BuildRequires: elfutils
BuildRequires: python
%if %{with_hardware}
%if 0%{?with_llvm}
-BuildRequires: llvm-devel >= 3.1
+BuildRequires: llvm-devel >= 3.0
%endif
%endif
BuildRequires: libxml2-python
@@ -84,8 +92,8 @@ BuildRequires: libudev-devel
BuildRequires: libtalloc-devel
BuildRequires: bison flex
%if !0%{?rhel}
-BuildRequires: pkgconfig(wayland-client) >= 0.99
-BuildRequires: pkgconfig(wayland-server) >= 0.99
+BuildRequires: pkgconfig(wayland-client) >= %{min_wayland_version}
+BuildRequires: pkgconfig(wayland-server) >= %{min_wayland_version}
%endif
BuildRequires: mesa-libGL-devel
@@ -261,7 +269,11 @@ 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
@@ -274,12 +286,17 @@ Mesa shared glapi
#patch9 -p1 -b .shmget
#patch12 -p1 -b .16bpp
-%build
-
# default to dri (not xlib) for libGL on all arches
# XXX please fix upstream
sed -i 's/^default_driver.*$/default_driver="dri"/' configure.ac
+# need to use libdrm_nouveau2 on F17
+%if 0%{?fedora} < 18
+sed -i 's/\/&2/' configure.ac
+%endif
+
+%build
+
autoreconf --install
export CFLAGS="$RPM_OPT_FLAGS"
@@ -305,7 +322,7 @@ export CXXFLAGS="$RPM_OPT_FLAGS"
%if %{with_hardware}
%{?with_vmware:--enable-xa} \
%if 0%{?with_llvm}
- --with-gallium-drivers=%{?with_vmware:svga,}r300,r600,radeonsi,nouveau,swrast \
+ --with-gallium-drivers=%{?with_vmware:svga,}r300,r600,%{?with_radeonsi:radeonsi,}nouveau,swrast \
--enable-gallium-llvm \
--with-llvm-shared-libs \
%else
@@ -417,7 +434,7 @@ rm -rf $RPM_BUILD_ROOT
%endif
%{_libdir}/dri/r300_dri.so
%{_libdir}/dri/r600_dri.so
-%if 0%{?with_llvm}
+%if 0%{?with_llvm} && 0%{?with_radeonsi}
%{_libdir}/dri/radeonsi_dri.so
%endif
%ifarch %{ix86} x86_64 ia64
@@ -539,6 +556,10 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
+* 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.
+
* Sat Oct 27 2012 Dan HorĂ¡k 9.0-3
- gallium drivers must be set explicitely for s390(x) otherwise also r300, r600 and vmwgfx are built