17231372 update Mesa to 9.0.3 s11u2_24
authorNiveditha Rau <Niveditha.Rau@Oracle.COM>
Tue, 17 Sep 2013 07:37:05 -0700
changeset 1366 84a331b516f5
parent 1365 5d5b3d9ec868
child 1367 f94011dda343
17231372 update Mesa to 9.0.3
open-src/lib/Makefile
open-src/lib/libglu/Makefile
open-src/lib/libglu/glu-exports.patch
open-src/lib/mesa/COPYING
open-src/lib/mesa/Makefile
open-src/lib/mesa/bugfix-post804.patch
open-src/lib/mesa/install-pc-dir.patch
open-src/lib/mesa/mesa9-port.patch
open-src/lib/mesa/solaris-port.patch
pkg/manifests/developer-opensolaris-X.p5m
pkg/manifests/service-opengl-ogl-select.p5m
pkg/manifests/x11-library-mesa.p5m
--- a/open-src/lib/Makefile	Wed Sep 04 12:17:40 2013 -0700
+++ b/open-src/lib/Makefile	Tue Sep 17 07:37:05 2013 -0700
@@ -1,6 +1,6 @@
 # Makefile for X Consolidation Open Source Library modules
 #
-# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -86,6 +86,7 @@
 libXxf86vm: libX11 libXext
 libxkbfile: libX11
 mesa: libdrm libX11 libXext libXdamage libXfixes libXxf86vm
+libglu: mesa
 freeglut: mesa
 
 # pixman doesn't need these itself, but its test framework uses gtk,
@@ -147,6 +148,7 @@
 	libXxf86misc \
 	libXxf86vm \
 	mesa \
+	libglu \
 	freeglut \
 	pixman
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/lib/libglu/Makefile	Tue Sep 17 07:37:05 2013 -0700
@@ -0,0 +1,148 @@
+###############################################################################
+#
+# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+#
+
+# Package name used in tarballs
+MODULE_NAME=glu
+
+# Package metadata
+UPSTREAM	= The Mesa 3-D Graphics Library
+UPSTREAM_URL	= http://mesa3d.org/
+UPSTREAM_SET	= yes
+
+MODULE_LICENSE          = Mesa License (Mixed: MIT, LGPLv2, others)
+MODULE_LICENSE_SET      = yes
+MODULE_LICENSE_PREPEND	= $(GPL_CHOICE_FILE)
+MODULE_DESC		= the Mesa 3-D Graphics Libraries
+ORACLE_TPNO		= 9926
+
+# ARC cases that covered this module
+# LSARC/2005/109 MESA, Open Source OpenGL clone
+MODULE_ARC_CASES = LSARC/2005/109
+
+# Version number (used in path names)
+MODULE_VERSION=9.0.0
+
+# Checksums for upstream tarball
+TARBALL_MD5  = be9249132ff49275461cf92039083030
+TARBALL_SHA1 = c2814bbaf1e60e28a75ec80f4646047c0da742bd
+
+# Source tarball
+SOURCE_TARBALL_NAME=glu-$(MODULE_VERSION).tar.bz2
+SOURCE_TARBALL_NAME_SET=yes
+
+# Download site for source
+SOURCE_URL=ftp://ftp.freedesktop.org/pub/mesa/glu/$(SOURCE_TARBALL_NAME)
+SOURCE_URL_SET=yes
+GIT_URL=$(FDO_GIT_URL)/mesa/glu
+GIT_URL_SET=yes
+
+# Directory created by unpacking source
+SOURCE_DIRNAME=glu-$(MODULE_VERSION)
+SOURCE_DIRNAME_SET=yes
+SOURCE_DIR = $(BUILD_DIR)/$(SOURCE_DIRNAME)
+
+# Patches to apply to source after unpacking, in order
+SOURCE_PATCHES=glu-exports.patch
+
+# Build mesa with this define (CR 7032292)
+MODULE_CFLAGS = -D__EXTENSIONS__
+
+# Override LDFLAGS passed to configure to not include CFLAGS, since that
+# breaks building libGLU with Sun Studio C++ compiler
+MODULE_CONFIG_ENV = LDFLAGS="$(DEFAULT_CONFIG_LDFLAGS) $(ARCH_FLAGS) $(MODTYPE_LDFLAGS) $(MODULE_CFLAGS) $(MODULE_LDFLAGS)"
+
+# Add proto area to path to find makedepend
+MODULE_BUILD_ENV = PATH="$(PROTODIR)/$(X11_BIN_DIR):$(PATH)"
+MODULE_CONFIG_ENV += $(MODULE_BUILD_ENV)
+
+# Need to use GNU Make to build
+MODULE_MAKE=$(GNUMAKE)
+MODULE_MAKE_SET=yes
+
+# Need to use GNU indent
+MODULE_INDENT=$(GNUINDENT)
+MODULE_INDENT_SET=yes
+
+# To build with gcc, uncomment these lines and comment out the MODULE_CFLAGS
+MODULE_COMPILER=gcc
+MODULE_COMPILER_SET=yes
+
+# Tell Sun compiler to not apply optimizations that increase binary sizes
+# Without this flag, Studio 12 binaries are almost 2x bigger (CR 6808868)
+#MODULE_CFLAGS = -xspace
+
+# Add include paths and linker paths needed for DRM modules
+MODULE_CPPFLAGS = -I$(PROTODIR)/usr/include/libdrm
+
+MODULE_LDFLAGS= -L$(PROTODIR)$(X11_SERVERLIBS_DIR)$(ARCHLIBSUBDIR) \
+		-R$(X11_SERVERLIBS_DIR)$(ARCHLIBSUBDIR) -z ignore
+
+### Include common rulesets
+include ../Makefile.inc
+
+HEADERS_TO_MOVE = glu.h glu_mangle.h
+HEADERS_TO_DIRECT_LINK = glu.h
+LIBRARY_TO_LINK = libGLU.so.1.3.1
+
+# Run just once after all other install steps are done for both 32/64-bit
+install: install_ogl_layout
+
+install_ogl_layout:
+	-rm -f $(PROTODIR)/usr/lib/libGLU.so.1
+	-rm -f $(PROTODIR)/usr/lib/libGLU.so
+	-rm -f $(PROTODIR)/usr/lib/$(SUBDIR64)/libGLU.so.1
+	-rm -f $(PROTODIR)/usr/lib/$(SUBDIR64)/libGLU.so
+	mv $(PROTODIR)/usr/include/GL/glu.h $(PROTODIR)/usr/include/mesa
+	mv $(PROTODIR)/usr/include/GL/glu_mangle.h $(PROTODIR)/usr/include/mesa
+	ln -s $(HEADERS_TO_DIRECT_LINK:%=../mesa/%) \
+		$(PROTODIR)/usr/include/GL
+	mkdir -p $(PROTODIR)/usr/lib/GL/$(SUBDIR64) \
+		$(PROTODIR)/usr/lib/mesa/$(SUBDIR64)
+	mv $(LIBRARY_TO_LINK:%=$(PROTODIR)/usr/lib/%) \
+		$(PROTODIR)/usr/lib/mesa/
+	mv $(LIBRARY_TO_LINK:%=$(PROTODIR)/usr/lib/$(SUBDIR64)/%) \
+		$(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/
+	ln -s libGLU.so.1.3.1 $(PROTODIR)/usr/lib/mesa/libGLU.so.1
+	ln -s libGLU.so.1 $(PROTODIR)/usr/lib/mesa/libGLU.so
+	ln -s libGLU.so.1.3.1 $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/libGLU.so.1
+	ln -s libGLU.so.1 $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/libGLU.so
+	(cd $(PROTODIR)/usr/lib/GL; ln -s $(LIBRARY_TO_LINK:%=../mesa/%) .)
+	ln -s libGLU.so.1.3.1 $(PROTODIR)/usr/lib/GL/libGLU.so.1
+	ln -s libGLU.so.1 $(PROTODIR)/usr/lib/GL/libGLU.so
+	(cd $(PROTODIR)/usr/lib/GL/$(SUBDIR64); ln -s $(LIBRARY_TO_LINK:%=../../mesa/$(SUBDIR64)/%) .)
+	ln -s libGLU.so.1.3.1 $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libGLU.so.1
+	ln -s libGLU.so.1 $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libGLU.so
+	(cd $(PROTODIR)/usr/lib; ln -s $(LIBRARY_TO_LINK:%=GL/%) .)
+	ln -s libGLU.so.1.3.1 $(PROTODIR)/usr/lib/libGLU.so.1
+	ln -s libGLU.so.1 $(PROTODIR)/usr/lib/libGLU.so
+	(cd $(PROTODIR)/usr/lib/$(SUBDIR64); ln -s $(LIBRARY_TO_LINK:%=../GL/$(SUBDIR64)/%) .)
+	ln -s libGLU.so.1.3.1 $(PROTODIR)/usr/lib/$(SUBDIR64)/libGLU.so.1
+	ln -s libGLU.so.1 $(PROTODIR)/usr/lib/$(SUBDIR64)/libGLU.so
+	(cd $(PROTODIR)/usr/X11/lib; ln -s $(LIBRARY_TO_LINK:%=GL/%) .)
+	ln -s libGLU.so.1.3.1 $(PROTODIR)/usr/X11/lib/libGLU.so.1
+	ln -s libGLU.so.1 $(PROTODIR)/usr/X11/lib/libGLU.so
+	(cd $(PROTODIR)/usr/X11/lib/$(SUBDIR64); ln -s $(LIBRARY_TO_LINK:%=../GL/$(SUBDIR64)/%) .)
+	ln -s libGLU.so.1.3.1 $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/libGLU.so.1
+	ln -s libGLU.so.1 $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/libGLU.so
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/lib/libglu/glu-exports.patch	Tue Sep 17 07:37:05 2013 -0700
@@ -0,0 +1,11 @@
+--- Makefile.am	Mon Sep 17 14:03:38 2012
++++ Makefile.am	Tue Jul  9 12:56:59 2013
+@@ -131,7 +131,7 @@
+ 	src/libnurbs/nurbtess/sampledLine.cc			\
+ 	src/libnurbs/nurbtess/searchTree.cc
+ libGLU_la_LIBADD = $(GL_LIBS) $(OSMESA_LIBS)
+-libGLU_la_LDFLAGS = -version-number $(GLU_LIBRARY_VERSION) -no-undefined -export-symbols-regex '^glu'
++libGLU_la_LDFLAGS = -version-number $(GLU_LIBRARY_VERSION) -no-undefined -export-symbols-regex 'glu'
+ 
+ EXTRA_DIST =							\
+ 	include/GL/glu.h					\
--- a/open-src/lib/mesa/COPYING	Wed Sep 04 12:17:40 2013 -0700
+++ b/open-src/lib/mesa/COPYING	Tue Sep 17 07:37:05 2013 -0700
@@ -29865,3 +29865,144 @@
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 DEALINGS IN THE SOFTWARE.
+
+--------------------------------------------------------------------
+glx/apple/apple_glx_log.c
+glx/apple/apple_glx_log.h
+
+ Copyright (c) 2012 Apple Inc.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT.  IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization.
+
+--------------------------------------------------------------------
+mesa/main/pack_tmp.h
+
+ Copyright © 2012 Intel Corporation
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+
+--------------------------------------------------------------------
+src/glsl/glsl_parser.h
+
+      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+
+--------------------------------------------------------------------
+src/mesa/drivers/dri/i965/intel_span.c
+
+ Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ Copyright 2011 Intel Corporation
+ All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sub license, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice (including the
+ next paragraph) shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Authors:
+     Chad Versace <[email protected]>
+
+
+--------------------------------------------------------------------
+ Copyright © 2012 Jon TURNEY
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the next
+ paragraph) shall be included in all copies or substantial portions of the
+ Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+
--- a/open-src/lib/mesa/Makefile	Wed Sep 04 12:17:40 2013 -0700
+++ b/open-src/lib/mesa/Makefile	Tue Sep 17 07:37:05 2013 -0700
@@ -40,13 +40,15 @@
 # ARC cases that covered this module
 # LSARC/2005/109 MESA, Open Source OpenGL clone
 MODULE_ARC_CASES = LSARC/2005/109
+# PSARC/2013/264 Mesa 9.0.3
+MODULE_ARC_CASES += PSARC/2013/264
 
 # Version number (used in path names)
-MODULE_VERSION=8.0.4
+MODULE_VERSION=9.0.3
 
 # Checksums for upstream tarball
-TARBALL_MD5  = d546f988adfdf986cff45b1efa2d8a46
-TARBALL_SHA1 = c64f8c03caf9ededd5f7011e246c42a649096c8c
+TARBALL_MD5  = d7515cc5116c72ac63d735655bd63689
+TARBALL_SHA1 = c4d88d83d8dbe243e30dc07195888e19ddb1c402
 
 # Source tarball
 SOURCE_TARBALL_NAME=MesaLib-$(MODULE_VERSION).tar.bz2
@@ -67,9 +69,8 @@
 SOURCE_PATCHES= \
 	CVE-2013-1993.patch,-p1 \
 	install-pc-dir.patch \
-	glu-no-mangled-exports.patch \
 	solaris-port.patch \
-	bugfix-post804.patch
+	mesa9-port.patch
 
 # File created by running configure script
 AUTOCONF_TARGET=$(SOURCE_DIR)/configs/autoconf
@@ -130,23 +131,23 @@
 	echo 'INSTALL_PC_DIR=$(PKGCONFIG_DIR)' >> $(AUTOCONF_TARGET)
 
 # Move installed files to mesa subdirs and make links back
-LIBRARIES_TO_DIRECT_LINK = libGLU.so.1
-LIBRARIES_TO_RUNTIME_LINK = libGL.so.1
-LIBRARIES_TO_MOVE = $(LIBRARIES_TO_DIRECT_LINK) $(LIBRARIES_TO_RUNTIME_LINK)
+LIBRARIES_TO_LINK = libGL.so.1.2.0 libdricore9.0.3.so.1.0.0 libglapi.so.0.0.0
 MESA_LIBDIR = $(PROTODIR)/usr/lib/mesa$(ARCHLIBSUBDIR)
 
 HEADERS_TO_MOVE = gl.h gl_mangle.h glext.h \
-	glu.h glu_mangle.h glx.h glx_mangle.h glxext.h \
+	glx.h glx_mangle.h glxext.h \
 	osmesa.h vms_x_fix.h wglext.h wmesa.h
-HEADERS_TO_DIRECT_LINK = glu.h osmesa.h
+HEADERS_TO_DIRECT_LINK = osmesa.h
 HEADERS_TO_RUNTIME_LINK = gl.h glext.h glx.h glxext.h
 
 # Run just once after all other install steps are done for both 32/64-bit
 install: install_ogl_layout
 
-install_ogl_layout: $(INSTALL_RULES)
+install_ogl_layout:
 	-rm -rf $(PROTODIR)/usr/include/mesa
 	mkdir -p $(PROTODIR)/usr/include/mesa/internal
+	mkdir -p $(PROTODIR)/system/volatile/opengl/include
+	mkdir -p $(PROTODIR)/system/volatile/opengl/lib/$(SUBDIR64)
 	mv $(HEADERS_TO_MOVE:%=$(PROTODIR)/usr/include/GL/%) \
 		$(PROTODIR)/usr/include/mesa
 	mv $(PROTODIR)/usr/include/GL/internal/dri_interface.h \
@@ -154,65 +155,109 @@
 	ln -s ../../mesa/internal/dri_interface.h \
 		$(PROTODIR)/usr/include/GL/internal/
 	-rm -f $(HEADERS_TO_DIRECT_LINK:%=$(PROTODIR)/usr/include/GL/%) \
-	       $(HEADERS_TO_RUNTIME_LINK:%=$(PROTODIR)/usr/include/GL/%)
+		$(HEADERS_TO_RUNTIME_LINK:%=$(PROTODIR)/usr/include/GL/%)
 	ln -s $(HEADERS_TO_DIRECT_LINK:%=../mesa/%) \
-	      $(HEADERS_TO_RUNTIME_LINK:%=../../../system/volatile/opengl/include/%) \
-	      $(PROTODIR)/usr/include/GL
+		$(HEADERS_TO_RUNTIME_LINK:%=../../../system/volatile/opengl/include/%) \
+		$(PROTODIR)/usr/include/GL
 	mkdir -p $(PROTODIR)/usr/lib/GL/$(SUBDIR64) \
-		 $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)
+		$(PROTODIR)/usr/lib/mesa/$(SUBDIR64)
 	-rm -f $(PROTODIR)/usr/lib/GL/64 $(PROTODIR)/usr/lib/mesa/64
 	ln -s $(SUBDIR64) $(PROTODIR)/usr/lib/GL/64
 	ln -s $(SUBDIR64) $(PROTODIR)/usr/lib/mesa/64
-	-rm -f $(LIBRARIES_TO_MOVE:%=$(PROTODIR)/usr/lib/mesa/%) \
-	       $(LIBRARIES_TO_MOVE:%=$(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/%)
-	mv $(LIBRARIES_TO_MOVE:%=$(PROTODIR)/usr/lib/%) \
+	-rm -f $(LIBRARIES_TO_LINK:%=$(PROTODIR)/usr/lib/mesa/%) \
+		$(LIBRARIES_TO_LINK:%=$(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/%)
+	mv $(LIBRARIES_TO_LINK:%=$(PROTODIR)/usr/lib/%) \
 		$(PROTODIR)/usr/lib/mesa/
-	mv $(LIBRARIES_TO_MOVE:%=$(PROTODIR)/usr/lib/$(SUBDIR64)/%) \
+	mv $(LIBRARIES_TO_LINK:%=$(PROTODIR)/usr/lib/$(SUBDIR64)/%) \
 		$(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/
-	@for l in $(LIBRARIES_TO_MOVE) ; do \
-	    $(START_CMD_ECHO) ; \
-	    rm -f $(PROTODIR)/usr/lib/mesa/$${l%.1} \
-		  $(PROTODIR)/usr/lib/GL/$${l%.1} \
-		  $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/$${l%.1} \
-		  $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/$${l%.1} ; \
-	    ln -s $${l} $(PROTODIR)/usr/lib/mesa/$${l%.1} ; \
-	    ln -s $${l} $(PROTODIR)/usr/lib/GL/$${l%.1} ; \
-	    ln -s $${l} $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/$${l%.1} ; \
-	    ln -s $${l} $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/$${l%.1} ; \
-	done
-	(cd $(PROTODIR)/usr/lib ; ln -s $(LIBRARIES_TO_MOVE:%=GL/%) .)
-	(cd $(PROTODIR)/usr/lib/$(SUBDIR64) ; \
-	    ln -s $(LIBRARIES_TO_MOVE:%=../GL/$(SUBDIR64)/%) .)
-	-rm -f $(LIBRARIES_TO_DIRECT_LINK:%=$(PROTODIR)/usr/lib/GL/%)
-	(cd $(PROTODIR)/usr/lib/GL ; \
-	    ln -s $(LIBRARIES_TO_DIRECT_LINK:%=../mesa/%) .)
-	-rm -f $(LIBRARIES_TO_DIRECT_LINK:%=$(PROTODIR)/usr/lib/GL/$(SUBDIR64)/%)
-	(cd $(PROTODIR)/usr/lib/GL/$(SUBDIR64) ; \
-	    ln -s $(LIBRARIES_TO_DIRECT_LINK:%=../../mesa/$(SUBDIR64)/%) .)
-	-rm -f $(PROTODIR)/usr/lib/GL/libGL.so.1 \
-	       $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libGL.so.1
+	-rm -f $(PROTODIR)/usr/lib/mesa/libGL.so.1 
+	-rm -f $(PROTODIR)/usr/lib/mesa/libGL.so 
+	-rm -f $(PROTODIR)/usr/lib/mesa/libGLU.so.1
+	-rm -f $(PROTODIR)/usr/lib/GL/libGL.so.1
+	-rm -f $(PROTODIR)/usr/lib/GL/libGLU.so.1
+	-rm -f $(PROTODIR)/usr/lib/GL/libGL.so 
+	-rm -f $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/libGL.so.1 
+	-rm -f $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/libGLU.so.1
+	-rm -f $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libGL.so.1
+	-rm -f $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libGL.so
+	-rm -f $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libGLU.so.1
+	ln -s libGL.so.1.2.0 $(PROTODIR)/usr/lib/mesa/libGL.so.1
+	ln -s libGL.so.1 $(PROTODIR)/usr/lib/mesa/libGL.so
+	ln -s libdricore9.0.3.so.1.0.0 $(PROTODIR)/usr/lib/mesa/libdricore9.0.3.so.1
+	ln -s libdricore9.0.3.so.1 $(PROTODIR)/usr/lib/mesa/libdricore9.0.3.so
+	ln -s libglapi.so.0.0.0 $(PROTODIR)/usr/lib/mesa/libglapi.so.0
+	ln -s libglapi.so.0 $(PROTODIR)/usr/lib/mesa/libglapi.so
+	ln -s libGL.so.1.2.0 $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/libGL.so.1
+	ln -s libGL.so.1 $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/libGL.so
+	ln -s libdricore9.0.3.so.1.0.0 $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/libdricore9.0.3.so.1
+	ln -s libdricore9.0.3.so.1 $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/libdricore9.0.3.so
+	ln -s libglapi.so.0.0.0 $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/libglapi.so.0
+	ln -s libglapi.so.0 $(PROTODIR)/usr/lib/mesa/$(SUBDIR64)/libglapi.so
+	rm -f $(PROTODIR)/usr/lib/*libglapi*
+	rm -f $(PROTODIR)/usr/lib/*dricore9.0.3*
+	rm -f $(PROTODIR)/usr/lib/*libGL.*
+	rm -f $(PROTODIR)/usr/lib/$(SUBDIR64)/*libglapi*
+	rm -f $(PROTODIR)/usr/lib/$(SUBDIR64)/*libdricore*
+	rm -f $(PROTODIR)/usr/lib/$(SUBDIR64)/*libGL.*
+	rm -f $(PROTODIR)/usr/lib/xorg/modules/dri/*.la
+	rm -f $(PROTODIR)/usr/lib/xorg/modules/dri/$(SUBDIR64)/*.la
+	(cd $(PROTODIR)/usr/lib/GL; ln -s $(LIBRARIES_TO_LINK:%=../mesa/%) .)
+	rm -f $(PROTODIR)/usr/lib/GL/libGL.so.1.2.0
+	ln -s libGL.so.1 $(PROTODIR)/usr/lib/GL/libGL.so
+	ln -s libdricore9.0.3.so.1.0.0 $(PROTODIR)/usr/lib/GL/libdricore9.0.3.so.1
+	ln -s libdricore9.0.3.so.1 $(PROTODIR)/usr/lib/GL/libdricore9.0.3.so
+	ln -s libglapi.so.0.0.0 $(PROTODIR)/usr/lib/GL/libglapi.so.0
+	ln -s libglapi.so.0 $(PROTODIR)/usr/lib/GL/libglapi.so
+	(cd $(PROTODIR)/usr/lib/GL/$(SUBDIR64); ln -s $(LIBRARIES_TO_LINK:%=../../mesa/$(SUBDIR64)/%) .)
+	rm -f $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libGL.so.1.2.0
+	ln -s libGL.so.1 $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libGL.so
+	ln -s libdricore9.0.3.so.1.0.0 $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libdricore9.0.3.so.1
+	ln -s libdricore9.0.3.so.1 $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libdricore9.0.3.so
+	ln -s libglapi.so.0.0.0 $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libglapi.so.0
+	ln -s libglapi.so.0 $(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libglapi.so
+	(cd $(PROTODIR)/usr/lib; ln -s $(LIBRARIES_TO_LINK:%=GL/%) .)
+	rm -f $(PROTODIR)/usr/lib/libGL.so.1.2.0
+	ln -s GL/libGL.so.1 $(PROTODIR)/usr/lib/libGL.so.1
+	ln -s libGL.so.1 $(PROTODIR)/usr/lib/libGL.so
+	ln -s libdricore9.0.3.so.1.0.0 $(PROTODIR)/usr/lib/libdricore9.0.3.so.1
+	ln -s libdricore9.0.3.so.1 $(PROTODIR)/usr/lib/libdricore9.0.3.so
+	ln -s libglapi.so.0.0.0 $(PROTODIR)/usr/lib/libglapi.so.0
+	ln -s libglapi.so.0 $(PROTODIR)/usr/lib/libglapi.so
+	(cd $(PROTODIR)/usr/lib/$(SUBDIR64); ln -s $(LIBRARIES_TO_LINK:%=../GL/$(SUBDIR64)/%) .)
+	rm -f $(PROTODIR)/usr/lib/$(SUBDIR64)/libGL.so.1.2.0
+	ln -s ../GL/$(SUBDIR64)/libGL.so.1 $(PROTODIR)/usr/lib/$(SUBDIR64)/libGL.so.1
+	ln -s libGL.so.1 $(PROTODIR)/usr/lib/$(SUBDIR64)/libGL.so
+	ln -s libdricore9.0.3.so.1.0.0 $(PROTODIR)/usr/lib/$(SUBDIR64)/libdricore9.0.3.so.1
+	ln -s libdricore9.0.3.so.1 $(PROTODIR)/usr/lib/$(SUBDIR64)/libdricore9.0.3.so
+	ln -s libglapi.so.0.0.0 $(PROTODIR)/usr/lib/$(SUBDIR64)/libglapi.so.0
+	ln -s libglapi.so.0 $(PROTODIR)/usr/lib/$(SUBDIR64)/libglapi.so
 	ln -s ../../../system/volatile/opengl/lib/libGL.so.1 \
 		$(PROTODIR)/usr/lib/GL/libGL.so.1
 	ln -s ../../../../system/volatile/opengl/lib/$(SUBDIR64)/libGL.so.1 \
 		$(PROTODIR)/usr/lib/GL/$(SUBDIR64)/libGL.so.1
 	mkdir -p $(PROTODIR)/usr/X11/lib/$(SUBDIR64) \
-		 $(PROTODIR)/usr/X11/include
+		$(PROTODIR)/usr/X11/include
 	-rm -f $(PROTODIR)/usr/X11/lib/GL $(PROTODIR)/usr/X11/lib/mesa
 	ln -s ../../lib/GL $(PROTODIR)/usr/X11/lib/GL
 	ln -s ../../lib/mesa $(PROTODIR)/usr/X11/lib/mesa
 	-rm -f $(PROTODIR)/usr/X11/lib/64
 	ln -s $(SUBDIR64) $(PROTODIR)/usr/X11/lib/64
-	@for l in $(LIBRARIES_TO_MOVE) ; do \
-	    $(START_CMD_ECHO) ; \
-	    rm -f $(PROTODIR)/usr/X11/lib/$${l} \
-		  $(PROTODIR)/usr/X11/lib/$${l%.1} \
-		  $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/$${l} \
-		  $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/$${l%.1} ; \
-	    ln -s $${l} $(PROTODIR)/usr/X11/lib/$${l%.1} ; \
-	    ln -s GL/$${l} $(PROTODIR)/usr/X11/lib/$${l} ; \
-	    ln -s $${l} $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/$${l%.1} ; \
-	    ln -s ../GL/$(SUBDIR64)/$${l} $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/$${l} ; \
-	done
+	(cd $(PROTODIR)/usr/X11/lib; ln -s $(LIBRARIES_TO_LINK:%=GL/%) .)
+	rm -f $(PROTODIR)/usr/X11/lib/libGL.so.1.2.0
+	ln -s ../../lib/GL/libGL.so.1 $(PROTODIR)/usr/X11/lib/libGL.so.1
+	ln -s libGL.so.1 $(PROTODIR)/usr/X11/lib/libGL.so
+	ln -s libdricore9.0.3.so.1.0.0 $(PROTODIR)/usr/X11/lib/libdricore9.0.3.so.1
+	ln -s libdricore9.0.3.so.1 $(PROTODIR)/usr/X11/lib/libdricore9.0.3.so
+	ln -s libglapi.so.0.0.0 $(PROTODIR)/usr/X11/lib/libglapi.so.0
+	ln -s libglapi.so.0 $(PROTODIR)/usr/X11/lib/libglapi.so
+	(cd $(PROTODIR)/usr/X11/lib/$(SUBDIR64); ln -s $(LIBRARIES_TO_LINK:%=../GL/$(SUBDIR64)/%) .)
+	rm -f $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/libGL.so.1.2.0
+	ln -s ../../../lib/GL/$(SUBDIR64)/libGL.so.1 $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/libGL.so.1
+	ln -s libGL.so.1 $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/libGL.so
+	ln -s libdricore9.0.3.so.1.0.0 $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/libdricore9.0.3.so.1
+	ln -s libdricore9.0.3.so.1 $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/libdricore9.0.3.so
+	ln -s libglapi.so.0.0.0 $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/libglapi.so.0
+	ln -s libglapi.so.0 $(PROTODIR)/usr/X11/lib/$(SUBDIR64)/libglapi.so
 	-rm -f $(PROTODIR)/usr/X11/include/GL $(PROTODIR)/usr/X11/include/mesa
 	ln -s ../../include/GL ../../include/mesa $(PROTODIR)/usr/X11/include/
 	$(TOP)/open-src/data/ogl-select/mesa_vendor_select root="$(PROTODIR)"
--- a/open-src/lib/mesa/bugfix-post804.patch	Wed Sep 04 12:17:40 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1102 +0,0 @@
---- src/mesa/drivers/dri/i965/brw_context.c	Tue Oct  9 10:23:05 2012
-+++ src/mesa/drivers/dri/i965/brw_context.c	Tue Oct  9 10:31:57 2012
-@@ -240,7 +240,7 @@
-    /* WM maximum threads is number of EUs times number of threads per EU. */
-    if (intel->gen >= 7) {
-       if (intel->gt == 1) {
--	 brw->max_wm_threads = 86;
-+	 brw->max_wm_threads = 48;
- 	 brw->max_vs_threads = 36;
- 	 brw->max_gs_threads = 36;
- 	 brw->urb.size = 128;
---- src/mesa/drivers/dri/i965/brw_fs.h	Tue Oct  9 10:33:03 2012
-+++ src/mesa/drivers/dri/i965/brw_fs.h	Tue Oct  9 10:33:57 2012
-@@ -409,7 +409,7 @@
- 	 this->reg_null_cmp = reg_null_f;
- 
-       this->frag_depth = NULL;
--      memset(this->outputs, 0, sizeof(this->outputs));
-+      memset(this->output_components, 0, sizeof(this->output_components));
-       this->first_non_payload_grf = 0;
-       this->max_grf = intel->gen >= 7 ? GEN7_MRF_HACK_START : BRW_MAX_GRF;
- 
---- src/mesa/main/extensions.c	Tue Oct  9 10:34:28 2012
-+++ src/mesa/main/extensions.c	Tue Oct  9 10:36:24 2012
-@@ -916,7 +916,7 @@
- 
-    base = (GLboolean *) &ctx->Extensions;
-    for (i = extension_table; i->name != 0; ++i) {
--      if (base[i->offset]) {
-+      if (base[i->offset] && (i->api_set & (1 << ctx->API))) {
- 	 ctx->Extensions.Count++;
-       }
-    }
-@@ -939,10 +939,11 @@
-    base = (GLboolean*) &ctx->Extensions;
-    n = 0;
-    for (i = extension_table; i->name != 0; ++i) {
--      if (n == index && base[i->offset]) {
--	 return (GLubyte*) i->name;
--      } else if (base[i->offset]) {
--	 ++n;
-+      if (base[i->offset] & (i->api_set & (1 << ctx->API))) {
-+	 if (n == index)
-+	    return (const GLubyte*) i->name;
-+	 else
-+	    ++n;
-       }
-    }
- 
---- src/mesa/drivers/dri/i965/brw_vs_constval.c	Tue Oct  9 10:37:03 2012
-+++ src/mesa/drivers/dri/i965/brw_vs_constval.c	Tue Oct  9 10:37:48 2012
-@@ -143,14 +143,12 @@
-    /* Examine vertex program output sizes to set the size_masks[] info
-     * which describes the fragment program input sizes.
-     */
--   for (vertRes = VERT_RESULT_TEX0; vertRes < VERT_RESULT_MAX; vertRes++) {
-+   for (vertRes = 0; vertRes < VERT_RESULT_MAX; vertRes++) {
- 
-       /* map vertex program output index to fragment program input index */
-       GLint fragAttrib = _mesa_vert_result_to_frag_attrib(vertRes);
-       if (fragAttrib < 0)
-          continue;
--      assert(fragAttrib >= FRAG_ATTRIB_TEX0);
--      assert(fragAttrib <= FRAG_ATTRIB_MAX);
- 
-       switch (get_output_size(t, vertRes)) {
-       case 4: t->size_masks[4-1] |= 1 << fragAttrib;
---- src/mesa/main/pack.c	Tue Oct  9 10:38:12 2012
-+++ src/mesa/main/pack.c	Tue Oct  9 10:38:47 2012
-@@ -4900,7 +4900,7 @@
-       else {
-          /* need to use double precision to prevent overflow problems */
-          for (i = 0; i < n; i++) {
--            GLdouble z = depthValues[i] * (GLfloat) depthMax;
-+            GLdouble z = depthValues[i] * (GLdouble) depthMax;
-             if (z >= (GLdouble) 0xffffffff)
-                zValues[i] = 0xffffffff;
-             else
---- src/mesa/drivers/dri/i965/gen7_hiz.c	Tue Oct  9 10:39:24 2012
-+++ src/mesa/drivers/dri/i965/gen7_hiz.c	Tue Oct  9 10:40:58 2012
-@@ -349,6 +349,24 @@
-          offset = intel_renderbuffer_tile_offsets(&rb, &tile_x, &tile_y);
-       }
- 
-+     /* According to the Sandy Bridge PRM, volume 2 part 1, pp326-327
-+      * (3DSTATE_DEPTH_BUFFER dw5), in the documentation for "Depth
-+      * Coordinate Offset X/Y":
-+      *
-+      * "The 3 LSBs of both offsets must be zero to ensure correct
-+      * alignment"
-+      *
-+      * We have no guarantee that tile_x and tile_y are correctly aligned,
-+      * since they are determined by the mipmap layout, which is only aligned
-+      * to multiples of 4.
-+      *
-+      * So, to avoid hanging the GPU, just smash the low order 3 bits of
-+      * 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;
-+
-       intel_emit_depth_stall_flushes(intel);
- 
-       BEGIN_BATCH(7);
---- src/mesa/drivers/dri/i965/gen7_misc_state.c	Tue Oct  9 10:41:04 2012
-+++ src/mesa/drivers/dri/i965/gen7_misc_state.c	Tue Oct  9 10:42:30 2012
-@@ -92,6 +92,24 @@
-       uint32_t tile_x, tile_y, offset;
- 
-       offset = intel_renderbuffer_tile_offsets(drb, &tile_x, &tile_y);
-+ 
-+      /* According to the Sandy Bridge PRM, volume 2 part 1, pp326-327
-+       * (3DSTATE_DEPTH_BUFFER dw5), in the documentation for "Depth
-+       * Coordinate Offset X/Y":
-+       *
-+       * "The 3 LSBs of both offsets must be zero to ensure correct
-+       * alignment"
-+       *
-+       * We have no guarantee that tile_x and tile_y are correctly aligned,
-+       * since they are determined by the mipmap layout, which is only aligned
-+       * to multiples of 4.
-+       *
-+       * So, to avoid hanging the GPU, just smash the low order 3 bits of
-+       * 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;
- 
-       assert(region->tiling == I915_TILING_Y);
- 
---- src/mesa/main/formats.c	Tue Oct  9 10:43:08 2012
-+++ src/mesa/main/formats.c	Tue Oct  9 10:43:57 2012
-@@ -1860,8 +1860,7 @@
-       const GLuint wblocks = (width + bw - 1) / bw;
-       const GLuint hblocks = (height + bh - 1) / bh;
-       const GLuint sz = wblocks * hblocks * info->BytesPerBlock;
--      assert(depth == 1);
--      return sz;
-+      return sz * depth;
-    }
-    else {
-       /* non-compressed */
-@@ -1887,8 +1886,7 @@
-       const uint64_t wblocks = (width + bw - 1) / bw;
-       const uint64_t hblocks = (height + bh - 1) / bh;
-       const uint64_t sz = wblocks * hblocks * info->BytesPerBlock;
--      assert(depth == 1);
--      return sz;
-+      return sz * depth;
-    }
-    else {
-       /* non-compressed */
---- src/mesa/drivers/dri/i965/brw_misc_state.c	Tue Oct  9 10:44:17 2012
-+++ src/mesa/drivers/dri/i965/brw_misc_state.c	Tue Oct  9 10:45:24 2012
-@@ -376,6 +376,24 @@
-       assert(intel->gen < 6 || region->tiling == I915_TILING_Y);
-       assert(!hiz_region || region->tiling == I915_TILING_Y);
- 
-+      /* According to the Sandy Bridge PRM, volume 2 part 1, pp326-327
-+       * (3DSTATE_DEPTH_BUFFER dw5), in the documentation for "Depth
-+       * Coordinate Offset X/Y":
-+       *
-+       * "The 3 LSBs of both offsets must be zero to ensure correct
-+       * alignment"
-+       *
-+       * We have no guarantee that tile_x and tile_y are correctly aligned,
-+       * since they are determined by the mipmap layout, which is only aligned
-+       * to multiples of 4.
-+       *
-+       * So, to avoid hanging the GPU, just smash the low order 3 bits of
-+       * 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;
-+
-       BEGIN_BATCH(len);
-       OUT_BATCH(_3DSTATE_DEPTH_BUFFER << 16 | (len - 2));
-       OUT_BATCH(((region->pitch * region->cpp) - 1) |
---- src/mesa/drivers/dri/i965/gen6_hiz.c	Tue Oct  9 10:45:26 2012
-+++ src/mesa/drivers/dri/i965/gen6_hiz.c	Tue Oct  9 10:46:35 2012
-@@ -489,6 +489,24 @@
-          offset = intel_renderbuffer_tile_offsets(&rb, &tile_x, &tile_y);
-       }
- 
-+      /* According to the Sandy Bridge PRM, volume 2 part 1, pp326-327
-+       * (3DSTATE_DEPTH_BUFFER dw5), in the documentation for "Depth
-+       * Coordinate Offset X/Y":
-+       *
-+       * "The 3 LSBs of both offsets must be zero to ensure correct
-+       * alignment"
-+       *
-+       * We have no guarantee that tile_x and tile_y are correctly aligned,
-+       * since they are determined by the mipmap layout, which is only aligned
-+       * to multiples of 4.
-+       *
-+       * So, to avoid hanging the GPU, just smash the low order 3 bits of
-+       * 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;
-+
-       uint32_t format;
-       switch (mt->format) {
-       case MESA_FORMAT_Z16:       format = BRW_DEPTHFORMAT_D16_UNORM; break;
---- src/mesa/drivers/dri/i965/brw_fs.cpp	Tue Oct  9 10:46:47 2012
-+++ src/mesa/drivers/dri/i965/brw_fs.cpp	Tue Oct  9 10:47:54 2012
-@@ -1595,6 +1595,9 @@
-       }
-    }
- 
-+   if (progress)
-+      live_intervals_valid = false;
-+
-    return progress;
- }
- 
-@@ -1671,6 +1674,9 @@
-       }
-    }
- 
-+   if (progress)
-+	live_intervals_valid = false;
-+
-    return progress;
- }
- 
---- src/mesa/drivers/dri/i965/brw_fs.cpp	Tue Oct  9 10:46:47 2012
-+++ src/mesa/drivers/dri/i965/brw_fs.cpp	Tue Oct  9 10:50:34 2012
-@@ -1595,6 +1595,9 @@
-       }
-    }
- 
-+   if (progress)
-+      live_intervals_valid = false;
-+
-    return progress;
- }
- 
-@@ -1671,6 +1674,9 @@
-       }
-    }
- 
-+   if (progress)
-+	live_intervals_valid = false;
-+
-    return progress;
- }
- 
-@@ -1883,6 +1889,7 @@
-    struct gl_fragment_program *fp = (struct gl_fragment_program *)
-       prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
-    struct brw_fragment_program *bfp = brw_fragment_program(fp);
-+   bool program_uses_dfdy = fp->UsesDFdy;
- 
-    memset(&key, 0, sizeof(key));
- 
---- src/mesa/drivers/dri/i965/brw_fs_emit.cpp	Tue Oct  9 10:50:54 2012
-+++ src/mesa/drivers/dri/i965/brw_fs_emit.cpp	Tue Oct  9 10:52:38 2012
-@@ -913,7 +913,11 @@
- 	 generate_ddx(inst, dst, src[0]);
- 	 break;
-       case FS_OPCODE_DDY:
--	 generate_ddy(inst, dst, src[0]);
-+         /* Make sure fp->UsesDFdy flag got set (otherwise there's no
-+          * guarantee that c->key.render_to_fbo is set).
-+          */
-+         assert(fp->UsesDFdy);
-+	 generate_ddy(inst, dst, src[0], c->key.render_to_fbo);
- 	 break;
- 
-       case FS_OPCODE_SPILL:
---- src/mesa/drivers/dri/i965/brw_wm.c	Tue Oct  9 10:52:52 2012
-+++ src/mesa/drivers/dri/i965/brw_wm.c	Tue Oct  9 10:53:21 2012
-@@ -417,6 +417,8 @@
-    GLuint line_aa;
-    GLuint i;
- 
-+   bool program_uses_dfdy = fp->program.UsesDFdy;
-+
-    memset(key, 0, sizeof(*key));
- 
-    /* Build the index for table lookup
---- src/mesa/drivers/dri/i965/brw_wm_emit.c	Tue Oct  9 10:53:23 2012
-+++ src/mesa/drivers/dri/i965/brw_wm_emit.c	Tue Oct  9 10:54:30 2012
-@@ -1743,7 +1743,11 @@
- 	 break;
- 
-       case OPCODE_DDY:
--	 emit_ddxy(p, dst, dst_flags, false, args[0]);
-+	 /* Make sure fp->program.UsesDFdy flag got set (otherwise there's no
-+          * guarantee that c->key.render_to_fbo is set).
-+          */
-+         assert(c->fp->program.UsesDFdy);
-+	 emit_ddxy(p, dst, dst_flags, false, args[0], c->key.render_to_fbo);
- 	 break;
- 
-       case OPCODE_DP2:
---- src/mesa/main/mtypes.h	Tue Oct  9 10:54:55 2012
-+++ src/mesa/main/mtypes.h	Tue Oct  9 10:55:39 2012
-@@ -1974,6 +1974,7 @@
- {
-    struct gl_program Base;   /**< base class */
-    GLboolean UsesKill;          /**< shader uses KIL instruction */
-+   GLboolean UsesDFdy; 		/**< shader uses DDY instruction */
-    GLboolean OriginUpperLeft;
-    GLboolean PixelCenterInteger;
-    enum gl_frag_depth_layout FragDepthLayout;
---- src/mesa/program/program.c	Tue Oct  9 10:55:46 2012
-+++ src/mesa/program/program.c	Tue Oct  9 10:56:26 2012
-@@ -551,6 +551,7 @@
-             = (const struct gl_fragment_program *) prog;
-          struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone;
-          fpc->UsesKill = fp->UsesKill;
-+   	 fpc->UsesDFdy = fp->UsesDFdy;
-          fpc->OriginUpperLeft = fp->OriginUpperLeft;
-          fpc->PixelCenterInteger = fp->PixelCenterInteger;
-       }
-@@ -772,6 +773,7 @@
-       newFprog = (struct gl_fragment_program *) newProg;
- 
-       newFprog->UsesKill = fprogA->UsesKill || fprogB->UsesKill;
-+      newFprog->UsesDFdy = fprogA->UsesDFdy || fprogB->UsesDFdy;
- 
-       /* We'll do a search and replace for instances
-        * of progB_colorFile/progB_colorIndex below...
---- src/mesa/drivers/dri/i965/brw_fs_emit.cpp	Tue Oct  9 10:59:36 2012
-+++ src/mesa/drivers/dri/i965/brw_fs_emit.cpp	Tue Oct  9 11:02:03 2012
-@@ -475,8 +475,13 @@
-    brw_ADD(p, dst, src0, negate(src1));
- }
- 
-+/* The negate_value boolean is used to negate the derivative computation for
-+ * FBOs, since they place the origin at the upper left instead of the lower
-+ * left.
-+ */
- void
--fs_visitor::generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src)
-+fs_visitor::generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src,
-+		         bool negate_value)
- {
-    struct brw_reg src0 = brw_reg(src.file, src.nr, 0,
- 				 BRW_REGISTER_TYPE_F,
-@@ -490,7 +495,10 @@
- 				 BRW_WIDTH_4,
- 				 BRW_HORIZONTAL_STRIDE_0,
- 				 BRW_SWIZZLE_XYZW, WRITEMASK_XYZW);
--   brw_ADD(p, dst, src0, negate(src1));
-+   if (negate_value)
-+	brw_ADD(p, dst, src1, negate(src0));
-+   else
-+	brw_ADD(p, dst, src0, negate(src1));
- }
- 
- void
---- src/mesa/drivers/dri/i965/brw_wm.c	Tue Oct  9 11:02:28 2012
-+++ src/mesa/drivers/dri/i965/brw_wm.c	Tue Oct  9 11:04:07 2012
-@@ -517,8 +517,11 @@
-     */
-    if (fp->program.Base.InputsRead & FRAG_BIT_WPOS) {
-       key->drawable_height = ctx->DrawBuffer->Height;
--      key->render_to_fbo = ctx->DrawBuffer->Name != 0;
-    }
-+   
-+   if ((fp->program.Base.InputsRead & FRAG_BIT_WPOS) || program_uses_dfdy) {
-+      key->render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
-+   }
- 
-    /* _NEW_BUFFERS */
-    key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers;
---- src/mesa/drivers/dri/i965/brw_wm.h	Tue Oct  9 11:04:11 2012
-+++ src/mesa/drivers/dri/i965/brw_wm.h	Tue Oct  9 11:05:00 2012
-@@ -346,7 +346,8 @@
- 	       const struct brw_reg *dst,
- 	       GLuint mask,
- 	       bool is_ddx,
--	       const struct brw_reg *arg0);
-+	       const struct brw_reg *arg0,
-+	       bool negate_value);
- void emit_delta_xy(struct brw_compile *p,
- 		   const struct brw_reg *dst,
- 		   GLuint mask,
---- src/mesa/drivers/dri/i965/brw_wm_emit.c	Tue Oct  9 11:05:05 2012
-+++ src/mesa/drivers/dri/i965/brw_wm_emit.c	Tue Oct  9 11:06:53 2012
-@@ -462,7 +462,8 @@
- 	       const struct brw_reg *dst,
- 	       GLuint mask,
- 	       bool is_ddx,
--	       const struct brw_reg *arg0)
-+	       const struct brw_reg *arg0,
-+	       bool negate_value)
- {
-    int i;
-    struct brw_reg src0, src1;
-@@ -498,7 +499,10 @@
- 			   BRW_HORIZONTAL_STRIDE_0,
- 			   BRW_SWIZZLE_XYZW, WRITEMASK_XYZW);
- 	 }
--	 brw_ADD(p, dst[i], src0, negate(src1));
-+         if (negate_value)
-+		brw_ADD(p, dst[i], src1, negate(src0));
-+	 else
-+		brw_ADD(p, dst[i], src0, negate(src1));
-       }
-    }
-    if (mask & SATURATE)
-@@ -1739,7 +1743,7 @@
- 	 break;
- 
-       case OPCODE_DDX:
--	 emit_ddxy(p, dst, dst_flags, true, args[0]);
-+	 emit_ddxy(p, dst, dst_flags, true, args[0], false);
- 	 break;
- 
-       case OPCODE_DDY:
---- src/mesa/drivers/dri/i915/i830_state.c	Tue Oct  9 11:08:37 2012
-+++ src/mesa/drivers/dri/i915/i830_state.c	Tue Oct  9 11:09:25 2012
-@@ -30,6 +30,7 @@
- #include "main/context.h"
- #include "main/macros.h"
- #include "main/enums.h"
-+#include "main/fbobject.h"
- #include "main/dd.h"
- #include "main/state.h"
- 
-@@ -545,7 +546,7 @@
- 
-    DBG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h);
- 
--   if (ctx->DrawBuffer->Name == 0) {
-+   if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
-       x1 = x;
-       y1 = ctx->DrawBuffer->Height - (y + h);
-       x2 = x + w - 1;
---- src/mesa/drivers/dri/i915/i915_state.c	Tue Oct  9 11:09:25 2012
-+++ src/mesa/drivers/dri/i915/i915_state.c	Tue Oct  9 11:11:07 2012
-@@ -30,6 +30,7 @@
- #include "main/context.h"
- #include "main/macros.h"
- #include "main/enums.h"
-+#include "main/fbobject.h"
- #include "main/dd.h"
- #include "main/state.h"
- #include "tnl/tnl.h"
-@@ -400,7 +401,7 @@
- {
-    struct intel_context *intel = intel_context(ctx);
- 
--   if (ctx->DrawBuffer->Name == 0) {
-+   if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
-       _math_matrix_viewport(&intel->ViewportMatrix,
- 			    ctx->Viewport.X,
- 			    ctx->DrawBuffer->Height - ctx->Viewport.Y,
-@@ -518,7 +519,7 @@
- 
-    DBG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h);
- 
--   if (ctx->DrawBuffer->Name == 0) {
-+   if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
-       x1 = x;
-       y1 = ctx->DrawBuffer->Height - (y + h);
-       x2 = x + w - 1;
-@@ -577,7 +578,7 @@
-    else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
-       mode = S4_CULLMODE_CW;
- 
--      if (ctx->DrawBuffer && ctx->DrawBuffer->Name != 0)
-+      if (ctx->DrawBuffer && _mesa_is_user_fbo(ctx->DrawBuffer))
-          mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
-       if (ctx->Polygon.CullFaceMode == GL_FRONT)
-          mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
---- src/mesa/drivers/dri/i965/brw_fs.cpp	Tue Oct  9 11:11:13 2012
-+++ src/mesa/drivers/dri/i965/brw_fs.cpp	Tue Oct  9 11:11:53 2012
-@@ -35,6 +35,7 @@
- #include "main/macros.h"
- #include "main/shaderobj.h"
- #include "main/uniforms.h"
-+#include "main/fbobject.h"
- #include "program/prog_parameter.h"
- #include "program/prog_print.h"
- #include "program/register_allocate.h"
-@@ -1928,7 +1929,7 @@
- 
-    if (fp->Base.InputsRead & FRAG_BIT_WPOS) {
-       key.drawable_height = ctx->DrawBuffer->Height;
--      key.render_to_fbo = ctx->DrawBuffer->Name != 0;
-+      key.render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
-    }
- 
-    key.nr_color_regions = 1;
---- src/mesa/drivers/dri/i965/brw_misc_state.c	Tue Oct  9 11:12:03 2012
-+++ src/mesa/drivers/dri/i965/brw_misc_state.c	Tue Oct  9 12:54:26 2012
-@@ -40,6 +40,8 @@
- #include "brw_state.h"
- #include "brw_defines.h"
- 
-+#include "main/fbobject.h"
-+
- /* Constant single cliprect for framebuffer object or DRI2 drawing */
- static void upload_drawing_rect(struct brw_context *brw)
- {
-@@ -524,7 +526,7 @@
-     * to a FBO (i.e. any named frame buffer object), we *don't*
-     * need to invert - we already match the layout.
-     */
--   if (ctx->DrawBuffer->Name == 0) {
-+   if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
-       for (i = 0; i < 32; i++)
- 	  OUT_BATCH(ctx->PolygonStipple[31 - i]); /* invert */
-    }
-@@ -567,15 +569,13 @@
- 
-    /* _NEW_BUFFERS
-     *
--    * If we're drawing to a system window (ctx->DrawBuffer->Name == 0),
--    * we have to invert the Y axis in order to match the OpenGL
--    * pixel coordinate system, and our offset must be matched
--    * to the window position.  If we're drawing to a FBO
--    * (ctx->DrawBuffer->Name != 0), then our native pixel coordinate
--    * system works just fine, and there's no window system to
--    * worry about.
-+    * If we're drawing to a system window we have to invert the Y axis
-+    * in order to match the OpenGL pixel coordinate system, and our
-+    * offset must be matched to the window position. If we're drawing
-+    * to a user-created FBO then our native pixel coordinate system
-+    * works just fine, and there's no window system to worry about
-     */
--   if (brw->intel.ctx.DrawBuffer->Name == 0)
-+   if (_mesa_is_winsys_fbo(brw->intel.ctx.DrawBuffer))
-       OUT_BATCH((32 - (ctx->DrawBuffer->Height & 31)) & 31);
-    else
-       OUT_BATCH(0);
---- src/mesa/drivers/dri/i965/brw_sf.c	Tue Oct  9 12:54:49 2012
-+++ src/mesa/drivers/dri/i965/brw_sf.c	Tue Oct  9 12:55:45 2012
-@@ -32,7 +32,9 @@
- 
- #include "main/glheader.h"
- #include "main/macros.h"
-+#include "main/mtypes.h"
- #include "main/enums.h"
-+#include "main/fbobject.h"
- 
- #include "intel_batchbuffer.h"
- 
-@@ -136,7 +138,7 @@
-    struct gl_context *ctx = &brw->intel.ctx;
-    struct brw_sf_prog_key key;
-    /* _NEW_BUFFERS */
--   bool render_to_fbo = ctx->DrawBuffer->Name != 0;
-+   bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
- 
-    memset(&key, 0, sizeof(key));
- 
---- src/mesa/drivers/dri/i965/brw_sf_state.c	Tue Oct  9 12:55:43 2012
-+++ src/mesa/drivers/dri/i965/brw_sf_state.c	Tue Oct  9 12:56:51 2012
-@@ -30,11 +30,12 @@
-   */
-    
- 
--
-+#include "main/mtypes.h"
-+#include "main/macros.h"
-+#include "main/fbobject.h"
- #include "brw_context.h"
- #include "brw_state.h"
- #include "brw_defines.h"
--#include "main/macros.h"
- #include "brw_sf.h"
- 
- static void upload_sf_vp(struct brw_context *brw)
-@@ -44,7 +45,7 @@
-    const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
-    struct brw_sf_viewport *sfv;
-    GLfloat y_scale, y_bias;
--   const bool render_to_fbo = (ctx->DrawBuffer->Name != 0);
-+   const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
-    const GLfloat *v = ctx->Viewport._WindowMap.m;
- 
-    sfv = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
-@@ -142,7 +143,7 @@
-    struct brw_sf_unit_state *sf;
-    drm_intel_bo *bo = intel->batch.bo;
-    int chipset_max_threads;
--   bool render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
-+   bool render_to_fbo = _mesa_is_user_fbo(brw->intel.ctx.DrawBuffer);
- 
-    sf = brw_state_batch(brw, AUB_TRACE_SF_STATE,
- 			sizeof(*sf), 64, &brw->sf.state_offset);
---- src/mesa/drivers/dri/i965/brw_wm.c	Tue Oct  9 12:56:53 2012
-+++ src/mesa/drivers/dri/i965/brw_wm.c	Tue Oct  9 12:57:54 2012
-@@ -33,6 +33,7 @@
- #include "brw_wm.h"
- #include "brw_state.h"
- #include "main/formats.h"
-+#include "main/fbobject.h"
- #include "main/samplerobj.h"
- #include "program/prog_parameter.h"
- 
---- src/mesa/drivers/dri/i965/gen6_scissor_state.c	Tue Oct  9 12:57:55 2012
-+++ src/mesa/drivers/dri/i965/gen6_scissor_state.c	Tue Oct  9 12:58:26 2012
-@@ -29,6 +29,7 @@
- #include "brw_state.h"
- #include "brw_defines.h"
- #include "intel_batchbuffer.h"
-+#include "main/fbobject.h"
- 
- static void
- gen6_upload_scissor_state(struct brw_context *brw)
-@@ -35,7 +36,7 @@
- {
-    struct intel_context *intel = &brw->intel;
-    struct gl_context *ctx = &intel->ctx;
--   const bool render_to_fbo = (ctx->DrawBuffer->Name != 0);
-+   const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
-    struct gen6_scissor_rect *scissor;
-    uint32_t scissor_state_offset;
- 
---- src/mesa/drivers/dri/i965/gen6_sf_state.c	Tue Oct  9 12:58:30 2012
-+++ src/mesa/drivers/dri/i965/gen6_sf_state.c	Tue Oct  9 12:59:12 2012
-@@ -30,6 +30,7 @@
- #include "brw_defines.h"
- #include "brw_util.h"
- #include "main/macros.h"
-+#include "main/fbobject.h"
- #include "intel_batchbuffer.h"
- 
- /**
-@@ -123,7 +124,7 @@
-    uint32_t dw1, dw2, dw3, dw4, dw16, dw17;
-    int i;
-    /* _NEW_BUFFER */
--   bool render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
-+   bool render_to_fbo = _mesa_is_user_fbo(brw->intel.ctx.DrawBuffer);
-    int attr = 0, input_index = 0;
-    int urb_entry_read_offset = 1;
-    float point_size;
---- src/mesa/drivers/dri/i965/gen6_viewport_state.c	Tue Oct  9 12:59:16 2012
-+++ src/mesa/drivers/dri/i965/gen6_viewport_state.c	Tue Oct  9 12:59:51 2012
-@@ -29,6 +29,7 @@
- #include "brw_state.h"
- #include "brw_defines.h"
- #include "intel_batchbuffer.h"
-+#include "main/fbobject.h"
- 
- /* The clip VP defines the guardband region where expensive clipping is skipped
-  * and fragments are allowed to be generated and clipped out cheaply by the SF.
-@@ -70,7 +71,7 @@
-    const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
-    struct brw_sf_viewport *sfv;
-    GLfloat y_scale, y_bias;
--   const bool render_to_fbo = (ctx->DrawBuffer->Name != 0);
-+   const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
-    const GLfloat *v = ctx->Viewport._WindowMap.m;
- 
-    sfv = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
---- src/mesa/drivers/dri/i965/gen7_clip_state.c	Tue Oct  9 12:59:54 2012
-+++ src/mesa/drivers/dri/i965/gen7_clip_state.c	Tue Oct  9 13:00:49 2012
-@@ -26,6 +26,7 @@
- #include "brw_defines.h"
- #include "brw_util.h"
- #include "intel_batchbuffer.h"
-+#include "main/fbobject.h"
- 
- static void
- upload_clip_state(struct brw_context *brw)
-@@ -40,7 +41,7 @@
-    const struct gl_fragment_program *fprog = brw->fragment_program;
- 
-    /* _NEW_BUFFERS */
--   bool render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
-+   bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
- 
-    if (brw_fprog_uses_noperspective(fprog)) {
-       nonperspective_barycentric_enable_flag =
---- src/mesa/drivers/dri/i965/gen7_sf_state.c	Tue Oct  9 13:00:52 2012
-+++ src/mesa/drivers/dri/i965/gen7_sf_state.c	Tue Oct  9 13:01:35 2012
-@@ -26,6 +26,7 @@
- #include "brw_defines.h"
- #include "brw_util.h"
- #include "main/macros.h"
-+#include "main/fbobject.h"
- #include "intel_batchbuffer.h"
- 
- static void
-@@ -49,7 +50,7 @@
-    bool userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
-    uint16_t attr_overrides[FRAG_ATTRIB_MAX];
-    /* _NEW_BUFFERS */
--   bool render_to_fbo = ctx->DrawBuffer->Name != 0;
-+   bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
-    uint32_t point_sprite_origin;
- 
-    brw_compute_vue_map(&vue_map, intel, userclip_active, vs_outputs_written);
-@@ -163,7 +164,7 @@
-    uint32_t dw1, dw2, dw3;
-    float point_size;
-    /* _NEW_BUFFERS */
--   bool render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
-+   bool render_to_fbo = _mesa_is_user_fbo(brw->intel.ctx.DrawBuffer);
- 
-    dw1 = GEN6_SF_STATISTICS_ENABLE |
-          GEN6_SF_VIEWPORT_TRANSFORM_ENABLE;
---- src/mesa/drivers/dri/i965/gen7_viewport_state.c	Tue Oct  9 13:01:35 2012
-+++ src/mesa/drivers/dri/i965/gen7_viewport_state.c	Tue Oct  9 13:02:11 2012
-@@ -25,6 +25,7 @@
- #include "brw_state.h"
- #include "brw_defines.h"
- #include "intel_batchbuffer.h"
-+#include "main/fbobject.h"
- 
- static void
- gen7_upload_sf_clip_viewport(struct brw_context *brw)
-@@ -33,7 +34,7 @@
-    struct gl_context *ctx = &intel->ctx;
-    const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
-    GLfloat y_scale, y_bias;
--   const bool render_to_fbo = (ctx->DrawBuffer->Name != 0);
-+   const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
-    const GLfloat *v = ctx->Viewport._WindowMap.m;
-    struct gen7_sf_clip_viewport *vp;
- 
---- src/mesa/drivers/dri/intel/intel_buffers.c	Tue Oct  9 13:02:22 2012
-+++ src/mesa/drivers/dri/intel/intel_buffers.c	Tue Oct  9 13:03:25 2012
-@@ -30,6 +30,7 @@
- #include "intel_fbo.h"
- #include "intel_mipmap_tree.h"
- 
-+#include "main/fbobject.h"
- #include "main/framebuffer.h"
- #include "main/renderbuffer.h"
- 
-@@ -82,7 +83,7 @@
- static void
- intelDrawBuffer(struct gl_context * ctx, GLenum mode)
- {
--   if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
-+   if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
-       struct intel_context *const intel = intel_context(ctx);
-       const bool was_front_buffer_rendering =
- 	intel->is_front_buffer_rendering;
-@@ -105,7 +106,7 @@
- static void
- intelReadBuffer(struct gl_context * ctx, GLenum mode)
- {
--   if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
-+   if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer))  {
-       struct intel_context *const intel = intel_context(ctx);
-       const bool was_front_buffer_reading =
- 	intel->is_front_buffer_reading;
---- src/mesa/drivers/dri/intel/intel_context.c	Tue Oct  9 13:03:24 2012
-+++ src/mesa/drivers/dri/intel/intel_context.c	Tue Oct  9 13:04:08 2012
-@@ -206,7 +206,7 @@
-     __DRIcontext *driContext = intel->driContext;
-     __DRIscreen *const screen = intel->intelScreen->driScrnPriv;
- 
--   if ((ctx->DrawBuffer->Name == 0) && intel->front_buffer_dirty) {
-+   if (_mesa_is_winsys_fbo(ctx->DrawBuffer) && intel->front_buffer_dirty) {
-       if (screen->dri2.loader &&
-           (screen->dri2.loader->base.version >= 2)
- 	  && (screen->dri2.loader->flushFrontBuffer != NULL) &&
-@@ -445,7 +445,7 @@
-     if (intel->saved_viewport)
- 	intel->saved_viewport(ctx, x, y, w, h);
- 
--    if (ctx->DrawBuffer->Name == 0) {
-+    if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
-        dri2InvalidateDrawable(driContext->driDrawablePriv);
-        dri2InvalidateDrawable(driContext->driReadablePriv);
-     }
---- src/mesa/drivers/dri/intel/intel_pixel_read.c	Tue Oct  9 13:04:08 2012
-+++ src/mesa/drivers/dri/intel/intel_pixel_read.c	Tue Oct  9 13:06:10 2012
-@@ -29,6 +29,7 @@
- #include "main/enums.h"
- #include "main/mtypes.h"
- #include "main/macros.h"
-+#include "main/fbobject.h"
- #include "main/image.h"
- #include "main/bufferobj.h"
- #include "main/readpix.h"
-@@ -116,7 +117,7 @@
-       return false;
-    }
-    else {
--      if (ctx->ReadBuffer->Name == 0)
-+      if (_mesa_is_winsys_fbo(ctx->ReadBuffer))
- 	 rowLength = -rowLength;
-    }
- 
-@@ -145,7 +146,7 @@
- 				       all ? INTEL_WRITE_FULL :
- 				       INTEL_WRITE_PART);
- 
--   if (ctx->ReadBuffer->Name == 0)
-+   if (_mesa_is_winsys_fbo(ctx->ReadBuffer))
-       y = ctx->ReadBuffer->Height - (y + height);
- 
-    if (!intelEmitCopyBlit(intel,
---- src/mesa/main/buffers.c	Tue Oct  9 13:13:37 2012
-+++ src/mesa/main/buffers.c	Tue Oct  9 13:17:25 2012
-@@ -35,6 +35,7 @@
- #include "colormac.h"
- #include "context.h"
- #include "enums.h"
-+#include "fbobject.h"
- #include "mtypes.h"
- 
- 
-@@ -55,7 +56,7 @@
- {
-    GLbitfield mask = 0x0;
- 
--   if (fb->Name > 0) {
-+   if (_mesa_is_user_fbo(fb)) {
-       /* A user-created renderbuffer */
-       GLuint i;
-       ASSERT(ctx->Extensions.EXT_framebuffer_object);
-@@ -354,7 +355,7 @@
-       struct gl_framebuffer *fb = ctx->DrawBuffer;
- 
-       /* Flag the FBO as requiring validation. */
--      if (fb->Name != 0) {
-+      if (_mesa_is_user_fbo(fb)) {
- 	 fb->_Status = 0;
-       }
-    }
-@@ -448,7 +449,7 @@
-       fb->ColorDrawBuffer[buf] = GL_NONE;
-    }
- 
--   if (fb->Name == 0) {
-+   if (_mesa_is_winsys_fbo(fb)) {
-       /* also set context drawbuffer state */
-       for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
-          if (ctx->Color.DrawBuffer[buf] != fb->ColorDrawBuffer[buf]) {
-@@ -472,7 +473,7 @@
-    GLuint i;
- 
-    /* should be a window system FBO */
--   assert(ctx->DrawBuffer->Name == 0);
-+   assert(_mesa_is_winsys_fbo(ctx->DrawBuffer));
- 
-    for (i = 0; i < ctx->Const.MaxDrawBuffers; i++)
-       buffers[i] = ctx->Color.DrawBuffer[i];
-@@ -493,7 +494,7 @@
- {
-    struct gl_framebuffer *fb = ctx->ReadBuffer;
- 
--   if (fb->Name == 0) {
-+   if (_mesa_is_winsys_fbo(fb)) {
-       /* Only update the per-context READ_BUFFER state if we're bound to
-        * a window-system framebuffer.
-        */
-@@ -529,7 +530,7 @@
-    if (MESA_VERBOSE & VERBOSE_API)
-       _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
- 
--   if (fb->Name > 0 && buffer == GL_NONE) {
-+   if (_mesa_is_user_fbo(fb) && buffer == GL_NONE) {
-       /* This is legal for user-created framebuffer objects */
-       srcBuffer = -1;
-    }
---- src/mesa/main/fbobject.c	Tue Oct  9 13:17:25 2012
-+++ src/mesa/main/fbobject.c	Tue Oct  9 13:22:17 2012
-@@ -78,27 +78,6 @@
-  * drawable/surface in make current. */
- static struct gl_framebuffer IncompleteFramebuffer;
- 
--
--/**
-- * Is the given FBO a user-created FBO?
-- */
--static inline GLboolean
--is_user_fbo(const struct gl_framebuffer *fb)
--{
--   return fb->Name != 0;
--}
--
--
--/**
-- * Is the given FBO a window system FBO (like an X window)?
-- */
--static inline GLboolean
--is_winsys_fbo(const struct gl_framebuffer *fb)
--{
--   return fb->Name == 0;
--}
--
--
- static void
- delete_dummy_renderbuffer(struct gl_renderbuffer *rb)
- {
-@@ -214,7 +193,7 @@
- {
-    GLuint i;
- 
--   assert(is_user_fbo(fb));
-+   assert(_mesa_is_user_fbo(fb));
- 
-    switch (attachment) {
-    case GL_COLOR_ATTACHMENT0_EXT:
-@@ -265,7 +244,7 @@
- _mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
-                          GLenum attachment)
- {
--   assert(is_winsys_fbo(fb));
-+   assert(_mesa_is_user_fbo(fb));
- 
-    switch (attachment) {
-    case GL_FRONT_LEFT:
-@@ -1009,10 +988,10 @@
-                _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
-             }
- 
--            if (is_user_fbo(ctx->DrawBuffer)) {
-+            if (_mesa_is_user_fbo(ctx->DrawBuffer)) {
-                detach_renderbuffer(ctx, ctx->DrawBuffer, rb);
-             }
--            if (is_user_fbo(ctx->ReadBuffer)
-+            if (_mesa_is_user_fbo(ctx->ReadBuffer)
-                 && ctx->ReadBuffer != ctx->DrawBuffer) {
-                detach_renderbuffer(ctx, ctx->ReadBuffer, rb);
-             }
-@@ -1322,7 +1301,7 @@
-    struct gl_renderbuffer *rb = (struct gl_renderbuffer *) userData;
- 
-    /* If this is a user-created FBO */
--   if (is_user_fbo(fb)) {
-+   if (_mesa_is_user_fbo(fb)) {
-       GLuint i;
-       for (i = 0; i < BUFFER_COUNT; i++) {
-          struct gl_renderbuffer_attachment *att = fb->Attachment + i;
-@@ -1614,7 +1593,7 @@
-    GLuint i;
-    ASSERT(ctx->Driver.RenderTexture);
- 
--   if (is_winsys_fbo(fb))
-+   if (_mesa_is_winsys_fbo(fb))
-       return; /* can't render to texture with winsys framebuffers */
- 
-    for (i = 0; i < BUFFER_COUNT; i++) {
-@@ -1634,7 +1613,7 @@
- static void
- check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
- {
--   if (is_winsys_fbo(fb))
-+   if (_mesa_is_winsys_fbo(fb))
-       return; /* can't render to texture with winsys framebuffers */
- 
-    if (ctx->Driver.FinishRenderTexture) {
-@@ -1887,7 +1866,7 @@
-       return 0;
-    }
- 
--   if (is_winsys_fbo(buffer)) {
-+   if (_mesa_is_winsys_fbo(buffer)) {
-       /* The window system / default framebuffer is always complete */
-       return GL_FRAMEBUFFER_COMPLETE_EXT;
-    }
-@@ -1950,7 +1929,7 @@
-    }
- 
-    /* check framebuffer binding */
--   if (is_winsys_fbo(fb)) {
-+   if (_mesa_is_winsys_fbo(fb)) {
-       _mesa_error(ctx, GL_INVALID_OPERATION,
-                   "glFramebufferTexture%sEXT", caller);
-       return;
-@@ -2211,7 +2190,7 @@
-       return;
-    }
- 
--   if (is_winsys_fbo(fb)) {
-+   if (_mesa_is_winsys_fbo(fb)) {
-       /* Can't attach new renderbuffers to a window system framebuffer */
-       _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT");
-       return;
-@@ -2292,7 +2271,7 @@
-       return;
-    }
- 
--   if (is_winsys_fbo(buffer)) {
-+   if (_mesa_is_winsys_fbo(buffer)) {
-       /* Page 126 (page 136 of the PDF) of the OpenGL ES 2.0.25 spec
-        * says:
-        *
-@@ -2339,7 +2318,8 @@
- 
-    switch (pname) {
-    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
--      *params = is_winsys_fbo(buffer) ? GL_FRAMEBUFFER_DEFAULT : att->Type;
-+      *params = _mesa_is_winsys_fbo(buffer)
-+		? GL_FRAMEBUFFER_DEFAULT : att->Type;
-       return;
-    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT:
-       if (att->Type == GL_RENDERBUFFER_EXT) {
-No differences encountered
---- src/mesa/main/framebuffer.c	Tue Oct  9 13:23:05 2012
-+++ src/mesa/main/framebuffer.c	Tue Oct  9 13:24:10 2012
-@@ -281,8 +281,8 @@
-     * and return early.
-     */
- 
--   /* For window system framebuffers, Name is zero */
--   assert(fb->Name == 0);
-+   /* Can only resize win-sys framebuffer objects */
-+   assert(_mesa_is_winsys_fbo(fb));
- 
-    for (i = 0; i < BUFFER_COUNT; i++) {
-       struct gl_renderbuffer_attachment *att = &fb->Attachment[i];
-@@ -408,7 +408,7 @@
-    GLuint i;
- 
-    /* user-created framebuffers only */
--   assert(fb->Name);
-+   assert(_mesa_is_user_fbo(fb));
- 
-    for (i = 0; i < BUFFER_COUNT; i++) {
-       struct gl_renderbuffer_attachment *att = &fb->Attachment[i];
-@@ -687,7 +687,7 @@
- static void
- update_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
- {
--   if (fb->Name == 0) {
-+   if (_mesa_is_winsys_fbo(fb)) {
-       /* This is a window-system framebuffer */
-       /* Need to update the FB's GL_DRAW_BUFFER state to match the
-        * context state (GL_READ_BUFFER too).
---- src/mesa/main/renderbuffer.c	Tue Oct  9 13:24:08 2012
-+++ src/mesa/main/renderbuffer.c	Tue Oct  9 13:24:36 2012
-@@ -104,7 +104,7 @@
-           fb->Attachment[bufferName].Renderbuffer == NULL);
- 
-    /* winsys vs. user-created buffer cross check */
--   if (fb->Name) {
-+   if (_mesa_is_user_fbo(fb)) {
-       assert(rb->Name);
-    }
-    else {
---- src/mesa/main/texobj.c	Tue Oct  9 13:25:20 2012
-+++ src/mesa/main/texobj.c	Tue Oct  9 13:25:46 2012
-@@ -893,7 +893,7 @@
- 
-    for (i = 0; i < n; i++) {
-       struct gl_framebuffer *fb = (i == 0) ? ctx->DrawBuffer : ctx->ReadBuffer;
--      if (fb->Name) {
-+      if (_mesa_is_user_fbo(fb)) {
-          GLuint j;
-          for (j = 0; j < BUFFER_COUNT; j++) {
-             if (fb->Attachment[j].Type == GL_TEXTURE &&
---- src/mesa/main/fbobject.h	Tue Oct  9 14:22:02 2012
-+++ src/mesa/main/fbobject.h	Tue Oct  9 14:23:50 2012
-@@ -32,6 +32,24 @@
- struct gl_context;
- struct gl_texture_object;
- 
-+/**
-+ * Is the given FBO a user-created FBO?
-+ */
-+static inline GLboolean
-+_mesa_is_user_fbo(const struct gl_framebuffer *fb)
-+{
-+ return fb->Name != 0;
-+}
-+
-+/**
-+ * Is the given FBO a window system FBO (like an X window)?
-+ */
-+static inline GLboolean
-+_mesa_is_winsys_fbo(const struct gl_framebuffer *fb)
-+{
-+ return fb->Name == 0;
-+}
-+
- extern void
- _mesa_init_fbobjects(struct gl_context *ctx);
- 
---- src/mesa/main/fbobject.c	Tue Oct  9 14:26:31 2012
-+++ src/mesa/main/fbobject.c	Tue Oct  9 14:43:34 2012
-@@ -690,7 +690,7 @@
-    GLint i;
-    GLuint j;
- 
--   assert(is_user_fbo(fb));
-+   assert(_mesa_is_user_fbo(fb));
- 
-    numImages = 0;
-    fb->Width = 0;
---- src/mesa/drivers/dri/i965/brw_fs.h	Tue Oct  9 14:57:14 2012
-+++ src/mesa/drivers/dri/i965/brw_fs.h	Tue Oct  9 14:58:26 2012
-@@ -542,7 +542,8 @@
- 			   struct brw_reg src);
-    void generate_discard(fs_inst *inst);
-    void generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src);
--   void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src);
-+   void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src,
-+			bool negate_value);
-    void generate_spill(fs_inst *inst, struct brw_reg src);
-    void generate_unspill(fs_inst *inst, struct brw_reg dst);
-    void generate_pull_constant_load(fs_inst *inst, struct brw_reg dst);
--- a/open-src/lib/mesa/install-pc-dir.patch	Wed Sep 04 12:17:40 2013 -0700
+++ b/open-src/lib/mesa/install-pc-dir.patch	Tue Sep 17 07:37:05 2013 -0700
@@ -1,45 +1,6 @@
- # Where libGL will look for DRI hardware drivers
---- src/glu/Makefile	Mon Mar  1 09:54:01 2010
-+++ src/glu/Makefile	Mon Mar  1 09:56:50 2010
-@@ -29,9 +29,9 @@
- 
- install: glu.pc
- 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
--	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
-+	$(INSTALL) -d $(DESTDIR)$(INSTALL_PC_DIR)
- 	$(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLU_LIB_GLOB) $(DESTDIR)$(INSTALL_LIB_DIR)
--	$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
-+	$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_PC_DIR)
- 
- clean:
- 	-@for dir in $(SUBDIRS) ; do \
---- src/mesa/Makefile	Thu Sep  6 08:25:24 2012
-+++ src/mesa/Makefile	Thu Sep  6 08:26:13 2012
-@@ -205,17 +205,17 @@
- 
- install-libgl: default gl.pc install-headers
- 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
--	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
-+	$(INSTALL) -d $(DESTDIR)$(INSTALL_PC_DIR)
- 	$(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \
- 		$(DESTDIR)$(INSTALL_LIB_DIR)
--	$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
-+	$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_PC_DIR)
- 
- install-osmesa: default osmesa.pc
- 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
--	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
-+	$(INSTALL) -d $(DESTDIR)$(INSTALL_PC_DIR)
- 	$(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \
- 		$(DESTDIR)$(INSTALL_LIB_DIR)
--	$(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
-+	$(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_PC_DIR)
- 
- install-dri: default
- 	cd drivers/dri && $(MAKE) install
---- configs/default	Thu Sep  6 08:27:01 2012
-+++ configs/default	Thu Sep  6 08:27:19 2012
-@@ -152,6 +152,7 @@
+--- configs/default	Wed Jun 19 13:39:19 2013
++++ configs/default	Wed Jun 19 13:39:50 2013
+@@ -131,6 +131,7 @@
  INSTALL_DIR = /usr/local
  INSTALL_LIB_DIR = $(INSTALL_DIR)/$(LIB_DIR)
  INSTALL_INC_DIR = $(INSTALL_DIR)/include
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/lib/mesa/mesa9-port.patch	Tue Sep 17 07:37:05 2013 -0700
@@ -0,0 +1,141 @@
+--- src/mesa/drivers/dri/intel/intel_screen.c   Mon Mar 25 09:22:16 2013
++++ src/mesa/drivers/dri/intel/intel_screen.c   Mon Mar 25 10:14:00 2013
+@@ -36,6 +36,7 @@
+ #include "main/mfeatures.h"
+ #include "main/version.h"
+ #include "swrast/s_renderbuffer.h"
++#include "../../../../../include/GL/internal/dri_interface.h"
+
+ #include "utils.h"
+ #include "xmlpool.h"
+--- src/mesa/drivers/dri/i965/brw_context.c     Mon Mar 25 10:57:00 2013
++++ src/mesa/drivers/dri/i965/brw_context.c     Mon Mar 25 10:58:40 2013
+@@ -395,8 +395,10 @@
+    if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
+       ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
+
++#ifdef GL_VERSION_4_3
+    if ((flags & __DRI_CTX_FLAG_DEBUG) != 0)
+       ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
++#endif
+
+    return true;
+ }
+--- src/glx/dri2_glx.c  Thu Feb 21 06:25:41 2013
++++ src/glx/dri2_glx.c  Mon Mar 25 13:48:18 2013
+@@ -54,6 +54,11 @@
+ #define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
+ #define DRI_CONF_VBLANK_ALWAYS_SYNC 3
+
++#define __DRI_CTX_RESET_NO_NOTIFICATION         0
++#define __DRI_CTX_ATTRIB_RESET_STRATEGY         3
++#define __DRI2_ROBUSTNESS "DRI_Robustness"
++
++
+ #undef DRI2_MINOR
+ #define DRI2_MINOR 1
+
+--- src/glx/dri_common.c        Thu Feb 21 01:25:29 2013
++++ src/glx/dri_common.c        Mon Mar 25 13:45:06 2013
+@@ -48,6 +48,11 @@
+ #define RTLD_GLOBAL 0
+ #endif
+
++#define __DRI_CTX_RESET_NO_NOTIFICATION         0
++#define __DRI_CTX_RESET_LOSE_CONTEXT            1
++#define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS     0x00000004
++
++
+ /**
+  * Print informational message to stderr if LIBGL_DEBUG is set to
+  * "verbose".
+--- src/glx/drisw_glx.c Thu Feb 21 01:25:29 2013
++++ src/glx/drisw_glx.c Mon Mar 25 13:40:31 2013
+@@ -28,6 +28,9 @@
+ #include <dlfcn.h>
+ #include "dri_common.h"
+
++#define __DRI_CTX_RESET_NO_NOTIFICATION         0
++
++
+ struct drisw_display
+ {
+    __GLXDRIdisplay base;
+
+--- src/mesa/drivers/dri/i915/Makefile.am	Tue Jun 18 13:26:19 2013
++++ src/mesa/drivers/dri/i915/Makefile.am	Tue Jun 18 13:26:34 2013
+@@ -53,6 +53,7 @@
+ i915_dri_la_LDFLAGS = -module -avoid-version -shared
+ i915_dri_la_LIBADD = \
+ 	../common/libdricommon.la \
++	../../../../mapi/shared-glapi/libglapi.la \
+ 	$(DRI_LIB_DEPS) \
+ 	$(INTEL_LIBS)
+ 
+--- src/mesa/drivers/dri/radeon/Makefile.am	Tue Jun 18 13:27:05 2013
++++ src/mesa/drivers/dri/radeon/Makefile.am	Tue Jun 18 13:27:22 2013
+@@ -51,6 +51,7 @@
+ radeon_dri_la_LDFLAGS = -module -avoid-version -shared
+ radeon_dri_la_LIBADD = \
+ 	../common/libdricommon.la \
++	../../../../mapi/shared-glapi/libglapi.la \
+ 	$(DRI_LIB_DEPS) \
+ 	$(RADEON_LIBS)
+ 
+--- src/mesa/drivers/dri/swrast/Makefile.am	Tue Jun 18 13:27:34 2013
++++ src/mesa/drivers/dri/swrast/Makefile.am	Tue Jun 18 13:27:52 2013
+@@ -48,6 +48,7 @@
+ 
+ swrast_dri_la_LDFLAGS = -module -avoid-version -shared
+ swrast_dri_la_LIBADD = \
++	../../../../mapi/shared-glapi/libglapi.la \ 
+ 	$(DRI_LIB_DEPS)
+ 
+ # Provide compatibility with scripts for the old Mesa build system for
+--- src/mesa/drivers/dri/r200/Makefile.am	Tue Jun 18 13:27:56 2013
++++ src/mesa/drivers/dri/r200/Makefile.am	Tue Jun 18 13:28:03 2013
+@@ -51,6 +51,7 @@
+ r200_dri_la_LDFLAGS = -module -avoid-version -shared
+ r200_dri_la_LIBADD = \
+ 	../common/libdricommon.la \
++	../../../../mapi/shared-glapi/libglapi.la \
+ 	$(DRI_LIB_DEPS) \
+ 	$(RADEON_LIBS)
+
+--- src/mesa/drivers/dri/i965/Makefile.am	Tue Jun 18 13:45:59 2013
++++ src/mesa/drivers/dri/i965/Makefile.am	Tue Jun 18 13:39:37 2013
+@@ -54,6 +54,7 @@
+ i965_dri_la_LDFLAGS = -module -avoid-version -shared
+ i965_dri_la_LIBADD = \
+ 	../common/libdricommon.la \
++	../../../../mapi/shared-glapi/libglapi.la \
+ 	$(DRI_LIB_DEPS) \
+ 	$(INTEL_LIBS)
+
+diff -rupN Mesa-9.0.3.ori/src/mesa/libdricore/Makefile.am Mesa-9.0.3/src/mesa/libdricore/Makefile.am
+--- src/mesa/libdricore/Makefile.am	2013-03-21 23:26:42.497508661 +0800
++++ src/mesa/libdricore/Makefile.am	2013-03-22 00:23:31.688844257 +0800
+@@ -45,8 +45,9 @@ libdricore@VERSION@_la_SOURCES = \
+ 	$(LIBGLSL_CXX_FILES) \
+ 	$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
+ 	$(top_builddir)/src/glsl/builtin_function.cpp
+-libdricore@VERSION@_la_LDFLAGS = -version-number 1:0
+-libdricore@VERSION@_la_LIBADD = libdricore-asm.la
++libdricore@VERSION@_la_LDFLAGS = ../../mapi/shared-glapi/libglapi.la -version-number 1:0
++#libdricore@VERSION@_la_LIBADD = libdricore-asm.la
++libdricore@VERSION@_la_LIBADD = 
+ 
+ # This is separated from libdricore to avoid conflics in object
+ # outputs between main/clip.c and sparc/clip.c.  The documented way to
+--- configure.ac Thu Aug  1 09:21:32 2013
++++ configure.ac Mon Aug 12 15:50:47 2013
+@@ -1064,7 +1064,7 @@
+         DEFINES="$DEFINES -DHAVE_ALIAS"
+        ;;
+     solaris*)
+-        DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
++        DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=0 -DIN_DRI_DRIVER"
+         ;;
+     cygwin*)
+         DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
+
--- a/open-src/lib/mesa/solaris-port.patch	Wed Sep 04 12:17:40 2013 -0700
+++ b/open-src/lib/mesa/solaris-port.patch	Tue Sep 17 07:37:05 2013 -0700
@@ -89,19 +89,6 @@
  #define COPY_DWORDS( j, vb, vertsize, v )			\
  do {								\
     int __tmp;							\
---- src/glx/Makefile	Thu Sep  6 08:40:35 2012
-+++ src/glx/Makefile	Thu Sep  6 08:41:03 2012
-@@ -83,6 +83,10 @@
- 
- default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
- 
-+# Needed to truly hide symbols gcc treats as HIDDEN/INTERNAL but doesn't mark
-+# as hidden in the ELF files properly.
-+GL_LIB_DEPS += -Wl,-M,mapfile.scope
-+
- libglx.a: $(OBJECTS)
- 	$(MKLIB) -cplusplus -o glx -static $(OBJECTS)
- 
 --- configure.ac	Thu Sep  6 08:47:48 2012
 +++ configure.ac	Thu Sep  6 08:48:26 2012
 @@ -172,7 +172,7 @@
@@ -142,30 +129,6 @@
      CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
      ac_ext=cpp
  ac_cpp='$CXXCPP $CPPFLAGS'
---- src/mesa/drivers/dri/Makefile.targets	Thu Sep  6 08:52:48 2012
-+++ src/mesa/drivers/dri/Makefile.targets	Thu Sep  6 08:54:05 2012
-@@ -16,7 +16,12 @@
- 
- default: subdirs lib
- 
-+DRI_LIB_DEPS += -Wl,-M,$(TOP)/src/mesa/drivers/dri/mapfile.externs
- 
-+MESA_MODULES = $(TOP)/src/mesa/libmesa.a
-+
-+LIBGLSL_MOBULES = $(TOP)/src/glsl/libglsl.a
-+
- .PHONY: lib
- lib: symlinks subdirs depend
- 	@$(MAKE) $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
-@@ -24,7 +29,7 @@
- $(LIBNAME): $(OBJECTS) $(EXTRA_MODULES) $(MESA_MODULES) Makefile \
- 		$(TOP)/src/mesa/drivers/dri/Makefile.targets $(TOP)/src/mesa/drivers/dri/common/dri_test.o
- 	$(MKLIB) -o [email protected] -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
--		$(OBJECTS) $(EXTRA_MODULES) $(DRI_LIB_DEPS)
-+		$(OBJECTS) $(EXTRA_MODULES) $(DRI_LIB_DEPS) $(MESA_MODULES) $(LIBGLSL_MOBULES)
- 	$(CXX) $(CFLAGS) -o [email protected] $(TOP)/src/mesa/drivers/dri/common/dri_test.o [email protected] $(DRI_LIB_DEPS)
- 	@rm -f [email protected]
- 	mv -f [email protected] $@
 --- src/mesa/drivers/dri/intel/intel_context.c	Thu Sep  6 08:54:15 2012
 +++ src/mesa/drivers/dri/intel/intel_context.c	Thu Sep  6 08:54:55 2012
 @@ -638,7 +638,7 @@
--- a/pkg/manifests/developer-opensolaris-X.p5m	Wed Sep 04 12:17:40 2013 -0700
+++ b/pkg/manifests/developer-opensolaris-X.p5m	Tue Sep 17 07:37:05 2013 -0700
@@ -90,6 +90,9 @@
 # For now, this is the package that delivers pkg-config (Defect #15543)
 depend type=require fmri=pkg:/developer/gnome/gettext
 
+# Some packages need GNU indent to build
+depend type=require fmri=pkg:/developer/gnu-indent
+
 # xcb-util needs gperf to generate hash functions
 depend type=require fmri=pkg:/developer/gperf
 
@@ -136,7 +139,7 @@
     org.opensolaris.pkgdepend.resolve=true
 
 # intel-gpu-tools links against libcairo
-depend type=require fmri=pkg:/library/desktop/cairo \
+$(i386_ONLY)depend type=require fmri=pkg:/library/desktop/cairo \
     org.opensolaris.pkgdepend.resolve=true
 
 # lib/fontconfig links with libexpat
--- a/pkg/manifests/service-opengl-ogl-select.p5m	Wed Sep 04 12:17:40 2013 -0700
+++ b/pkg/manifests/service-opengl-ogl-select.p5m	Tue Sep 17 07:37:05 2013 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -67,11 +67,12 @@
 
 
 link path=usr/X11/lib/$(ARCH64)/libGL.so target=libGL.so.1
-link path=usr/X11/lib/$(ARCH64)/libGL.so.1 target=../GL/$(ARCH64)/libGL.so.1
+link path=usr/X11/lib/$(ARCH64)/libGL.so.1 \
+    target=../../../lib/GL/$(ARCH64)/libGL.so.1
 link path=usr/X11/lib/64 target=$(ARCH64)
 link path=usr/X11/lib/GL target=../../lib/GL
 link path=usr/X11/lib/libGL.so target=libGL.so.1
-link path=usr/X11/lib/libGL.so.1 target=GL/libGL.so.1
+link path=usr/X11/lib/libGL.so.1 target=../../lib/GL/libGL.so.1
 dir  path=usr/include/GL
 link path=usr/include/GL/gl.h \
     target=../../../system/volatile/opengl/include/gl.h
--- a/pkg/manifests/x11-library-mesa.p5m	Wed Sep 04 12:17:40 2013 -0700
+++ b/pkg/manifests/x11-library-mesa.p5m	Tue Sep 17 07:37:05 2013 -0700
@@ -26,9 +26,28 @@
     value="The Mesa 3-D graphics library is an open-source implementation of the OpenGL specification - a system for rendering interactive 3D graphics."
 link path=usr/X11/include/mesa target=../../include/mesa
 link path=usr/X11/lib/$(ARCH64)/libGLU.so target=libGLU.so.1
-link path=usr/X11/lib/$(ARCH64)/libGLU.so.1 target=../GL/$(ARCH64)/libGLU.so.1
+link path=usr/X11/lib/$(ARCH64)/libGLU.so.1 target=libGLU.so.1.3.1
+link path=usr/X11/lib/$(ARCH64)/libGLU.so.1.3.1 \
+    target=../GL/$(ARCH64)/libGLU.so.1.3.1
+link path=usr/X11/lib/$(ARCH64)/libdricore9.0.3.so target=libdricore9.0.3.so.1
+link path=usr/X11/lib/$(ARCH64)/libdricore9.0.3.so.1 \
+    target=libdricore9.0.3.so.1.0.0
+link path=usr/X11/lib/$(ARCH64)/libdricore9.0.3.so.1.0.0 \
+    target=../GL/$(ARCH64)/libdricore9.0.3.so.1.0.0
+link path=usr/X11/lib/$(ARCH64)/libglapi.so target=libglapi.so.0
+link path=usr/X11/lib/$(ARCH64)/libglapi.so.0 target=libglapi.so.0.0.0
+link path=usr/X11/lib/$(ARCH64)/libglapi.so.0.0.0 \
+    target=../GL/$(ARCH64)/libglapi.so.0.0.0
 link path=usr/X11/lib/libGLU.so target=libGLU.so.1
-link path=usr/X11/lib/libGLU.so.1 target=GL/libGLU.so.1
+link path=usr/X11/lib/libGLU.so.1 target=libGLU.so.1.3.1
+link path=usr/X11/lib/libGLU.so.1.3.1 target=GL/libGLU.so.1.3.1
+link path=usr/X11/lib/libdricore9.0.3.so target=libdricore9.0.3.so.1
+link path=usr/X11/lib/libdricore9.0.3.so.1 target=libdricore9.0.3.so.1.0.0
+link path=usr/X11/lib/libdricore9.0.3.so.1.0.0 \
+    target=GL/libdricore9.0.3.so.1.0.0
+link path=usr/X11/lib/libglapi.so target=libglapi.so.0
+link path=usr/X11/lib/libglapi.so.0 target=libglapi.so.0.0.0
+link path=usr/X11/lib/libglapi.so.0.0.0 target=GL/libglapi.so.0.0.0
 link path=usr/X11/lib/mesa target=../../lib/mesa
 dir  path=usr/include/GL
 link path=usr/include/GL/glu.h target=../mesa/glu.h
@@ -51,31 +70,87 @@
 file path=usr/include/mesa/vms_x_fix.h
 file path=usr/include/mesa/wglext.h
 file path=usr/include/mesa/wmesa.h
+link path=usr/lib/$(ARCH64)/libGL.so target=libGL.so.1
+link path=usr/lib/$(ARCH64)/libGL.so.1 target=../GL/$(ARCH64)/libGL.so.1
 link path=usr/lib/$(ARCH64)/libGLU.so target=libGLU.so.1
-link path=usr/lib/$(ARCH64)/libGLU.so.1 target=../GL/$(ARCH64)/libGLU.so.1
+link path=usr/lib/$(ARCH64)/libGLU.so.1 target=libGLU.so.1.3.1
+link path=usr/lib/$(ARCH64)/libGLU.so.1.3.1 \
+    target=../GL/$(ARCH64)/libGLU.so.1.3.1
+link path=usr/lib/$(ARCH64)/libdricore9.0.3.so target=libdricore9.0.3.so.1
+link path=usr/lib/$(ARCH64)/libdricore9.0.3.so.1 target=libdricore9.0.3.so.1.0.0
+link path=usr/lib/$(ARCH64)/libdricore9.0.3.so.1.0.0 \
+    target=../GL/$(ARCH64)/libdricore9.0.3.so.1.0.0
+link path=usr/lib/$(ARCH64)/libglapi.so target=libglapi.so.0
+link path=usr/lib/$(ARCH64)/libglapi.so.0 target=libglapi.so.0.0.0
+link path=usr/lib/$(ARCH64)/libglapi.so.0.0.0 \
+    target=../GL/$(ARCH64)/libglapi.so.0.0.0
 file path=usr/lib/$(ARCH64)/pkgconfig/dri.pc
 file path=usr/lib/$(ARCH64)/pkgconfig/gl.pc
 file path=usr/lib/$(ARCH64)/pkgconfig/glu.pc
 dir  path=usr/lib/GL
 dir  path=usr/lib/GL/$(ARCH64)
 link path=usr/lib/GL/$(ARCH64)/libGLU.so target=libGLU.so.1
-link path=usr/lib/GL/$(ARCH64)/libGLU.so.1 \
-    target=../../mesa/$(ARCH64)/libGLU.so.1
+link path=usr/lib/GL/$(ARCH64)/libGLU.so.1 target=libGLU.so.1.3.1
+link path=usr/lib/GL/$(ARCH64)/libGLU.so.1.3.1 \
+    target=../../mesa/$(ARCH64)/libGLU.so.1.3.1
+link path=usr/lib/GL/$(ARCH64)/libdricore9.0.3.so target=libdricore9.0.3.so.1
+link path=usr/lib/GL/$(ARCH64)/libdricore9.0.3.so.1 \
+    target=libdricore9.0.3.so.1.0.0
+link path=usr/lib/GL/$(ARCH64)/libdricore9.0.3.so.1.0.0 \
+    target=../../mesa/$(ARCH64)/libdricore9.0.3.so.1.0.0
+link path=usr/lib/GL/$(ARCH64)/libglapi.so target=libglapi.so.0
+link path=usr/lib/GL/$(ARCH64)/libglapi.so.0 target=libglapi.so.0.0.0
+link path=usr/lib/GL/$(ARCH64)/libglapi.so.0.0.0 \
+    target=../../mesa/$(ARCH64)/libglapi.so.0.0.0
 link path=usr/lib/GL/libGLU.so target=libGLU.so.1
-link path=usr/lib/GL/libGLU.so.1 target=../mesa/libGLU.so.1
+link path=usr/lib/GL/libGLU.so.1 target=libGLU.so.1.3.1
+link path=usr/lib/GL/libGLU.so.1.3.1 target=../mesa/libGLU.so.1.3.1
+link path=usr/lib/GL/libdricore9.0.3.so target=libdricore9.0.3.so.1
+link path=usr/lib/GL/libdricore9.0.3.so.1 target=libdricore9.0.3.so.1.0.0
+link path=usr/lib/GL/libdricore9.0.3.so.1.0.0 \
+    target=../mesa/libdricore9.0.3.so.1.0.0
+link path=usr/lib/GL/libglapi.so target=libglapi.so.0
+link path=usr/lib/GL/libglapi.so.0 target=libglapi.so.0.0.0
+link path=usr/lib/GL/libglapi.so.0.0.0 target=../mesa/libglapi.so.0.0.0
+link path=usr/lib/libGL.so target=libGL.so.1
+link path=usr/lib/libGL.so.1 target=GL/libGL.so.1
 link path=usr/lib/libGLU.so target=libGLU.so.1
-link path=usr/lib/libGLU.so.1 target=GL/libGLU.so.1
+link path=usr/lib/libGLU.so.1 target=libGLU.so.1.3.1
+link path=usr/lib/libGLU.so.1.3.1 target=GL/libGLU.so.1.3.1
+link path=usr/lib/libdricore9.0.3.so target=libdricore9.0.3.so.1
+link path=usr/lib/libdricore9.0.3.so.1 target=libdricore9.0.3.so.1.0.0
+link path=usr/lib/libdricore9.0.3.so.1.0.0 target=GL/libdricore9.0.3.so.1.0.0
+link path=usr/lib/libglapi.so target=libglapi.so.0
+link path=usr/lib/libglapi.so.0 target=libglapi.so.0.0.0
+link path=usr/lib/libglapi.so.0.0.0 target=GL/libglapi.so.0.0.0
 dir  path=usr/lib/mesa
 dir  path=usr/lib/mesa/$(ARCH64)
 link path=usr/lib/mesa/$(ARCH64)/libGL.so target=libGL.so.1
-file path=usr/lib/mesa/$(ARCH64)/libGL.so.1
+link path=usr/lib/mesa/$(ARCH64)/libGL.so.1 target=libGL.so.1.2.0
+file path=usr/lib/mesa/$(ARCH64)/libGL.so.1.2.0
 link path=usr/lib/mesa/$(ARCH64)/libGLU.so target=libGLU.so.1
-file path=usr/lib/mesa/$(ARCH64)/libGLU.so.1
+link path=usr/lib/mesa/$(ARCH64)/libGLU.so.1 target=libGLU.so.1.3.1
+file path=usr/lib/mesa/$(ARCH64)/libGLU.so.1.3.1
+link path=usr/lib/mesa/$(ARCH64)/libdricore9.0.3.so target=libdricore9.0.3.so.1
+link path=usr/lib/mesa/$(ARCH64)/libdricore9.0.3.so.1 \
+    target=libdricore9.0.3.so.1.0.0
+file path=usr/lib/mesa/$(ARCH64)/libdricore9.0.3.so.1.0.0
+link path=usr/lib/mesa/$(ARCH64)/libglapi.so target=libglapi.so.0
+link path=usr/lib/mesa/$(ARCH64)/libglapi.so.0 target=libglapi.so.0.0.0
+file path=usr/lib/mesa/$(ARCH64)/libglapi.so.0.0.0
 link path=usr/lib/mesa/64 target=$(ARCH64)
 link path=usr/lib/mesa/libGL.so target=libGL.so.1
-file path=usr/lib/mesa/libGL.so.1
+link path=usr/lib/mesa/libGL.so.1 target=libGL.so.1.2.0
+file path=usr/lib/mesa/libGL.so.1.2.0
 link path=usr/lib/mesa/libGLU.so target=libGLU.so.1
-file path=usr/lib/mesa/libGLU.so.1
+link path=usr/lib/mesa/libGLU.so.1 target=libGLU.so.1.3.1
+file path=usr/lib/mesa/libGLU.so.1.3.1
+link path=usr/lib/mesa/libdricore9.0.3.so target=libdricore9.0.3.so.1
+link path=usr/lib/mesa/libdricore9.0.3.so.1 target=libdricore9.0.3.so.1.0.0
+file path=usr/lib/mesa/libdricore9.0.3.so.1.0.0
+link path=usr/lib/mesa/libglapi.so target=libglapi.so.0
+link path=usr/lib/mesa/libglapi.so.0 target=libglapi.so.0.0.0
+file path=usr/lib/mesa/libglapi.so.0.0.0
 dir  path=usr/lib/mesa/modules
 dir  path=usr/lib/mesa/modules/extensions
 file path=usr/lib/mesa/modules/extensions/libglx.so