summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2013-05-08 18:03:21 -0400
committerAdam Jackson <ajax@redhat.com>2013-05-08 18:03:21 -0400
commit4c06853833996d990eb76b195ca5d6838c6f3d6b (patch)
treeb48173a1ea80d283de2541271b47bdd082fd668f
parent2b9d3cd65095f3261846d2be914dbcb2e206f9d1 (diff)
downloadmesa-4c06853833996d990eb76b195ca5d6838c6f3d6b.tar.gz
mesa-4c06853833996d990eb76b195ca5d6838c6f3d6b.tar.xz
mesa-4c06853833996d990eb76b195ca5d6838c6f3d6b.zip
Switch to Mesa master (pre 9.2)
- Fix llvmpipe on big-endian and enable llvmpipe everywhere - Build vdpau drivers for r600/radeonsi/nouveau - Enable hardware floating-point texture support - Drop GLESv1, nothing's using it, let's not start
-rw-r--r--.gitignore3
-rw-r--r--0001-mesa-Be-less-casual-about-texture-formats-in-st_fina.patch39
-rw-r--r--intel-revert-gl3.patch57
-rwxr-xr-xmake-git-snapshot.sh2
-rw-r--r--make-release-tarball.sh5
-rw-r--r--mesa-9.2-hardware-float.patch131
-rw-r--r--mesa-9.2-llvmpipe-on-big-endian.patch1588
-rw-r--r--mesa-9.2-no-useless-vdpau.patch27
-rw-r--r--mesa.spec135
-rwxr-xr-xsanitize-tarball.sh45
-rw-r--r--sources2
11 files changed, 1902 insertions, 132 deletions
diff --git a/.gitignore b/.gitignore
index 78b25bc..85fc5ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
*.jx
+*.src.rpm
+.build*
mesa-20100208.tar.bz2
gl-manpages-1.0.1.tar.bz2
xdriinfo-1.0.3.tar.bz2
@@ -47,3 +49,4 @@ mesa-20100720.tar.bz2
/mesa-20130213.tar.xz
/MesaLib-9.1.tar.bz2
/MesaLib-9.1.1.tar.bz2
+/mesa-20130508.tar.xz
diff --git a/0001-mesa-Be-less-casual-about-texture-formats-in-st_fina.patch b/0001-mesa-Be-less-casual-about-texture-formats-in-st_fina.patch
new file mode 100644
index 0000000..45c5ea8
--- /dev/null
+++ b/0001-mesa-Be-less-casual-about-texture-formats-in-st_fina.patch
@@ -0,0 +1,39 @@
+From dfe652d12c62c270e00f093518a05c6966661b8a Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Mon, 6 May 2013 16:04:03 -0400
+Subject: [PATCH] mesa: Be less casual about texture formats in
+ st_finalize_texture
+
+Commit 62452883 removed a hunk like
+
+ if (firstImageFormat != stObj->pt->format)
+ st_view_format = firstImageFormat;
+
+from update_single_texture(). This broke piglit/glx-tfp on AMD Barts
+(and probably others), as that hunk was compensating for the mesa and
+gallium layers disagreeing about the format.
+
+Fix this by not ignoring the alpha channel in st_finalize_texture when
+considering whether two 32-bit formats are sufficiently compatible.
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+ src/mesa/state_tracker/st_cb_texture.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
+index 123ed2b..0f2656c 100644
+--- a/src/mesa/state_tracker/st_cb_texture.c
++++ b/src/mesa/state_tracker/st_cb_texture.c
+@@ -1567,7 +1567,7 @@ st_finalize_texture(struct gl_context *ctx,
+ */
+ if (stObj->pt) {
+ if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
+- !st_sampler_compat_formats(stObj->pt->format, firstImageFormat) ||
++ stObj->pt->format != firstImageFormat ||
+ stObj->pt->last_level < stObj->lastLevel ||
+ stObj->pt->width0 != ptWidth ||
+ stObj->pt->height0 != ptHeight ||
+--
+1.8.2.1
+
diff --git a/intel-revert-gl3.patch b/intel-revert-gl3.patch
deleted file mode 100644
index e7fa559..0000000
--- a/intel-revert-gl3.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-diff -up Mesa-9.1/src/mesa/drivers/dri/intel/intel_extensions.c.jx Mesa-9.1/src/mesa/drivers/dri/intel/intel_extensions.c
---- Mesa-9.1/src/mesa/drivers/dri/intel/intel_extensions.c.jx 2013-02-22 20:45:52.000000000 -0500
-+++ Mesa-9.1/src/mesa/drivers/dri/intel/intel_extensions.c 2013-03-11 17:39:07.069991819 -0400
-@@ -137,9 +137,11 @@ intelInitExtensions(struct gl_context *c
- ctx->Extensions.ARB_seamless_cube_map = true;
- ctx->Extensions.ARB_shader_bit_encoding = true;
- ctx->Extensions.ARB_shader_texture_lod = true;
-+#ifdef TEXTURE_FLOAT_ENABLED
- ctx->Extensions.ARB_texture_float = true;
- ctx->Extensions.EXT_texture_shared_exponent = true;
- ctx->Extensions.EXT_packed_float = true;
-+#endif
- ctx->Extensions.ARB_texture_compression_rgtc = true;
- ctx->Extensions.ARB_texture_rg = true;
- ctx->Extensions.ARB_texture_rgb10_a2ui = true;
-diff -up Mesa-9.1/src/mesa/drivers/dri/intel/intel_screen.c.jx Mesa-9.1/src/mesa/drivers/dri/intel/intel_screen.c
---- Mesa-9.1/src/mesa/drivers/dri/intel/intel_screen.c.jx 2013-02-22 20:46:23.000000000 -0500
-+++ Mesa-9.1/src/mesa/drivers/dri/intel/intel_screen.c 2013-03-11 17:40:31.235111004 -0400
-@@ -1038,9 +1038,15 @@ intel_screen_make_configs(__DRIscreen *d
- static void
- set_max_gl_versions(struct intel_screen *screen)
- {
-+#ifdef TEXTURE_FLOAT_ENABLED
-+ bool has_texture_float = true;
-+#else
-+ bool has_texture_float = false;
-+#endif
-+
- switch (screen->gen) {
- case 7:
-- if (screen->kernel_has_gen7_sol_reset) {
-+ if (has_texture_float && screen->kernel_has_gen7_sol_reset) {
- screen->max_gl_core_version = 31;
- screen->max_gl_compat_version = 30;
- screen->max_gl_es1_version = 11;
-@@ -1053,10 +1059,17 @@ set_max_gl_versions(struct intel_screen
- }
- break;
- case 6:
-- screen->max_gl_core_version = 31;
-- screen->max_gl_compat_version = 30;
-- screen->max_gl_es1_version = 11;
-- screen->max_gl_es2_version = 30;
-+ if (has_texture_float) {
-+ screen->max_gl_core_version = 31;
-+ screen->max_gl_compat_version = 30;
-+ screen->max_gl_es1_version = 11;
-+ screen->max_gl_es2_version = 30;
-+ } else {
-+ screen->max_gl_core_version = 0;
-+ screen->max_gl_compat_version = 21;
-+ screen->max_gl_es1_version = 11;
-+ screen->max_gl_es2_version = 20;
-+ }
- break;
- case 5:
- case 4:
diff --git a/make-git-snapshot.sh b/make-git-snapshot.sh
index d66977d..a4beb3f 100755
--- a/make-git-snapshot.sh
+++ b/make-git-snapshot.sh
@@ -13,7 +13,7 @@ echo HEAD ${1:-HEAD}
rm -rf $DIRNAME
-git clone --depth 1 -b 9.1 ${REF:+--reference $REF} \
+git clone --depth 1 ${REF:+--reference $REF} \
git://git.freedesktop.org/git/mesa/mesa $DIRNAME
GIT_DIR=$DIRNAME/.git git archive --format=tar --prefix=$DIRNAME/ ${1:-HEAD} \
diff --git a/make-release-tarball.sh b/make-release-tarball.sh
new file mode 100644
index 0000000..93d65f2
--- /dev/null
+++ b/make-release-tarball.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+#
+# usage: make-release-tarball.sh [version]
+
+curl -O ftp://ftp.freedesktop.org/pub/mesa/$1/MesaLib-$1.tar.bz2
diff --git a/mesa-9.2-hardware-float.patch b/mesa-9.2-hardware-float.patch
new file mode 100644
index 0000000..42987af
--- /dev/null
+++ b/mesa-9.2-hardware-float.patch
@@ -0,0 +1,131 @@
+From 5bfa2890c634883260429e7360a3a0367ef47316 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Wed, 1 May 2013 13:23:13 -0400
+Subject: [PATCH] configure: --enable-texture-float={yes,no,hardware}
+
+This enables building float-texture support for hardware drivers but not
+software drivers.
+
+This is obviously not upstreamable in its current form.
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+ configure.ac | 6 +++---
+ src/gallium/drivers/llvmpipe/lp_screen.c | 9 +++++++++
+ src/gallium/drivers/softpipe/sp_screen.c | 9 +++++++++
+ 3 files changed, 21 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 81d4a3f..970dacf 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -381,15 +381,15 @@ dnl
+ dnl potentially-infringing-but-nobody-knows-for-sure stuff
+ dnl
+ AC_ARG_ENABLE([texture-float],
+- [AS_HELP_STRING([--enable-texture-float],
++ [AS_HELP_STRING([--enable-texture-float=yes,no,hardware],
+ [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
+ [enable_texture_float="$enableval"],
+ [enable_texture_float=no]
+ )
+-if test "x$enable_texture_float" = xyes; then
++if test "x$enable_texture_float" = xyes -o "x$enable_texture_float" = xhardware; then
+ AC_MSG_WARN([Floating-point textures enabled.])
+ AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
+- DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
++ DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED=$enable_texture_float"
+ fi
+
+ GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
+diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
+index 5ec1df6..a0406fc 100644
+--- a/src/gallium/drivers/llvmpipe/lp_screen.c
++++ b/src/gallium/drivers/llvmpipe/lp_screen.c
+@@ -306,6 +306,15 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
+ if (!format_desc)
+ return FALSE;
+
++#if 1
++ if ((bind & PIPE_BIND_RENDER_TARGET) &&
++ format != PIPE_FORMAT_R9G9B9E5_FLOAT &&
++ format != PIPE_FORMAT_R11G11B10_FLOAT &&
++ util_format_is_float(format)) {
++ return FALSE;
++ }
++#endif
++
+ assert(target == PIPE_BUFFER ||
+ target == PIPE_TEXTURE_1D ||
+ target == PIPE_TEXTURE_1D_ARRAY ||
+diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
+index 937035e..2f5e571 100644
+--- a/src/gallium/drivers/softpipe/sp_screen.c
++++ b/src/gallium/drivers/softpipe/sp_screen.c
+@@ -291,6 +291,15 @@ softpipe_is_format_supported( struct pipe_screen *screen,
+ if (!format_desc)
+ return FALSE;
+
++#if 1
++ if ((bind & PIPE_BIND_RENDER_TARGET) &&
++ format != PIPE_FORMAT_R9G9B9E5_FLOAT &&
++ format != PIPE_FORMAT_R11G11B10_FLOAT &&
++ util_format_is_float(format)) {
++ return FALSE;
++ }
++#endif
++
+ if (sample_count > 1)
+ return FALSE;
+
+--
+1.8.2.1
+
+diff -up mesa-20130508/src/gallium/auxiliary/util/u_format_table.py.jx mesa-20130508/src/gallium/auxiliary/util/u_format_table.py
+--- mesa-20130508/src/gallium/auxiliary/util/u_format_table.py.jx 2013-05-08 13:23:41.000000000 -0400
++++ mesa-20130508/src/gallium/auxiliary/util/u_format_table.py 2013-05-08 15:20:02.145510681 -0400
+@@ -133,15 +133,35 @@ def write_format_table(formats):
+ print " },"
+ print " %s," % (colorspace_map(format.colorspace),)
+ if format.colorspace != ZS and format.channels[0].pure == False:
+- print " &util_format_%s_unpack_rgba_8unorm," % format.short_name()
+- print " &util_format_%s_pack_rgba_8unorm," % format.short_name()
+- if format.layout == 's3tc' or format.layout == 'rgtc':
+- print " &util_format_%s_fetch_rgba_8unorm," % format.short_name()
+- else:
+- print " NULL, /* fetch_rgba_8unorm */"
+- print " &util_format_%s_unpack_rgba_float," % format.short_name()
+- print " &util_format_%s_pack_rgba_float," % format.short_name()
+- print " &util_format_%s_fetch_rgba_float," % format.short_name()
++ if "float" in format.short_name():
++ print "#if 0"
++ print " &util_format_%s_unpack_rgba_8unorm," % format.short_name()
++ print " &util_format_%s_pack_rgba_8unorm," % format.short_name()
++ if format.layout == 's3tc' or format.layout == 'rgtc':
++ print " &util_format_%s_fetch_rgba_8unorm," % format.short_name()
++ else:
++ print " NULL, /* fetch_rgba_8unorm */"
++ print " &util_format_%s_unpack_rgba_float," % format.short_name()
++ print " &util_format_%s_pack_rgba_float," % format.short_name()
++ print " &util_format_%s_fetch_rgba_float," % format.short_name()
++ print "#else"
++ print " NULL, /* unpack_rgba_8unorm */"
++ print " NULL, /* pack_rgba_8unorm */"
++ print " NULL, /* fetch_rgba_8unorm */"
++ print " NULL, /* unpack_rgba_float */"
++ print " NULL, /* pack_rgba_float */"
++ print " NULL, /* fetch_rgba_float */"
++ print "#endif"
++ else:
++ print " &util_format_%s_unpack_rgba_8unorm," % format.short_name()
++ print " &util_format_%s_pack_rgba_8unorm," % format.short_name()
++ if format.layout == 's3tc' or format.layout == 'rgtc':
++ print " &util_format_%s_fetch_rgba_8unorm," % format.short_name()
++ else:
++ print " NULL, /* fetch_rgba_8unorm */"
++ print " &util_format_%s_unpack_rgba_float," % format.short_name()
++ print " &util_format_%s_pack_rgba_float," % format.short_name()
++ print " &util_format_%s_fetch_rgba_float," % format.short_name()
+ else:
+ print " NULL, /* unpack_rgba_8unorm */"
+ print " NULL, /* pack_rgba_8unorm */"
diff --git a/mesa-9.2-llvmpipe-on-big-endian.patch b/mesa-9.2-llvmpipe-on-big-endian.patch
new file mode 100644
index 0000000..1e5fe76
--- /dev/null
+++ b/mesa-9.2-llvmpipe-on-big-endian.patch
@@ -0,0 +1,1588 @@
+diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
+index 602d076..c524b44 100644
+--- a/src/gallium/auxiliary/draw/draw_pt.c
++++ b/src/gallium/auxiliary/draw/draw_pt.c
+@@ -326,6 +326,13 @@ draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count)
+ (void *) u);
+ }
+ break;
++ case PIPE_FORMAT_A8R8G8B8_UNORM:
++ {
++ ubyte *u = (ubyte *) ptr;
++ debug_printf("ARGB %d %d %d %d @ %p\n", u[0], u[1], u[2], u[3],
++ (void *) u);
++ }
++ break;
+ default:
+ debug_printf("other format %s (fix me)\n",
+ util_format_name(draw->pt.vertex_element[j].src_format));
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c
+index eb2d096..cf86f4d 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c
+@@ -80,82 +80,6 @@
+
+
+ /**
+- * Byte swap on element. It will construct a call to intrinsic llvm.bswap
+- * based on the type.
+- *
+- * @param res element to byte swap.
+- * @param type int16_t, int32_t, int64_t, float or double
+- * @param
+- */
+-LLVMValueRef
+-lp_build_bswap(struct gallivm_state *gallivm,
+- LLVMValueRef res,
+- struct lp_type type)
+-{
+- LLVMTypeRef int_type = LLVMIntTypeInContext(gallivm->context,
+- type.width);
+- const char *intrinsic = NULL;
+- if (type.width == 8)
+- return res;
+- if (type.width == 16)
+- intrinsic = "llvm.bswap.i16";
+- else if (type.width == 32)
+- intrinsic = "llvm.bswap.i32";
+- else if (type.width == 64)
+- intrinsic = "llvm.bswap.i64";
+-
+- assert (intrinsic != NULL);
+-
+- /* In case of a floating-point type cast to a int of same size and then
+- * cast back to fp type.
+- */
+- if (type.floating)
+- res = LLVMBuildBitCast(gallivm->builder, res, int_type, "");
+- res = lp_build_intrinsic_unary(gallivm->builder, intrinsic, int_type, res);
+- if (type.floating)
+- res = LLVMBuildBitCast(gallivm->builder, res,
+- lp_build_elem_type(gallivm, type), "");
+- return res;
+-}
+-
+-
+-/**
+- * Byte swap every element in the vector.
+- *
+- * @param packed <vector> to convert
+- * @param src_type <vector> type of int16_t, int32_t, int64_t, float or
+- * double
+- * @param dst_type <vector> type to return
+- */
+-LLVMValueRef
+-lp_build_bswap_vec(struct gallivm_state *gallivm,
+- LLVMValueRef packed,
+- struct lp_type src_type_vec,
+- struct lp_type dst_type_vec)
+-{
+- LLVMBuilderRef builder = gallivm->builder;
+- LLVMTypeRef dst_type = lp_build_elem_type(gallivm, dst_type_vec);
+- LLVMValueRef res;
+-
+- if (src_type_vec.length == 1) {
+- res = lp_build_bswap(gallivm, packed, src_type_vec);
+- res = LLVMBuildBitCast(gallivm->builder, res, dst_type, "");
+- } else {
+- unsigned i;
+- res = LLVMGetUndef(lp_build_vec_type(gallivm, dst_type_vec));
+- for (i = 0; i < src_type_vec.length; ++i) {
+- LLVMValueRef index = lp_build_const_int32(gallivm, i);
+- LLVMValueRef elem = LLVMBuildExtractElement(builder, packed, index, "");
+- elem = lp_build_bswap(gallivm, elem, src_type_vec);
+- elem = LLVMBuildBitCast(gallivm->builder, elem, dst_type, "");
+- res = LLVMBuildInsertElement(gallivm->builder, res, elem, index, "");
+- }
+- }
+- return res;
+-}
+-
+-
+-/**
+ * Converts int16 half-float to float32
+ * Note this can be performed in 1 instruction if vcvtph2ps exists (f16c/cvt16)
+ * [llvm.x86.vcvtph2ps / _mm_cvtph_ps]
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.h b/src/gallium/auxiliary/gallivm/lp_bld_conv.h
+index d7dfed8..42a1113 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_conv.h
++++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.h
+@@ -43,17 +43,6 @@
+ struct lp_type;
+
+ LLVMValueRef
+-lp_build_bswap(struct gallivm_state *gallivm,
+- LLVMValueRef res,
+- struct lp_type type);
+-
+-LLVMValueRef
+-lp_build_bswap_vec(struct gallivm_state *gallivm,
+- LLVMValueRef packed,
+- struct lp_type src_type,
+- struct lp_type dst_type);
+-
+-LLVMValueRef
+ lp_build_half_to_float(struct gallivm_state *gallivm,
+ LLVMValueRef src);
+
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
+index 6a1bf67..af755d4 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
+@@ -139,12 +139,12 @@ format_matches_type(const struct util_format_description *desc,
+
+
+ /**
+- * Unpack a single pixel into its RGBA components.
++ * Unpack a single pixel into its XYZW components.
+ *
+ * @param desc the pixel format for the packed pixel value
+ * @param packed integer pixel in a format such as PIPE_FORMAT_B8G8R8A8_UNORM
+ *
+- * @return RGBA in a float[4] or ubyte[4] or ushort[4] vector.
++ * @return XYZW in a float[4] or ubyte[4] or ushort[4] vector.
+ */
+ static INLINE LLVMValueRef
+ lp_build_unpack_arith_rgba_aos(struct gallivm_state *gallivm,
+@@ -159,7 +159,6 @@ lp_build_unpack_arith_rgba_aos(struct gallivm_state *gallivm,
+
+ boolean normalized;
+ boolean needs_uitofp;
+- unsigned shift;
+ unsigned i;
+
+ /* TODO: Support more formats */
+@@ -172,10 +171,6 @@ lp_build_unpack_arith_rgba_aos(struct gallivm_state *gallivm,
+ * matches floating point size */
+ assert (LLVMTypeOf(packed) == LLVMInt32TypeInContext(gallivm->context));
+
+-#ifdef PIPE_ARCH_BIG_ENDIAN
+- packed = lp_build_bswap(gallivm, packed, lp_type_uint(32));
+-#endif
+-
+ /* Broadcast the packed value to all four channels
+ * before: packed = BGRA
+ * after: packed = {BGRA, BGRA, BGRA, BGRA}
+@@ -194,11 +189,11 @@ lp_build_unpack_arith_rgba_aos(struct gallivm_state *gallivm,
+ /* Initialize vector constants */
+ normalized = FALSE;
+ needs_uitofp = FALSE;
+- shift = 0;
+
+ /* Loop over 4 color components */
+ for (i = 0; i < 4; ++i) {
+ unsigned bits = desc->channel[i].size;
++ unsigned shift = desc->channel[i].shift;
+
+ if (desc->channel[i].type == UTIL_FORMAT_TYPE_VOID) {
+ shifts[i] = LLVMGetUndef(LLVMInt32TypeInContext(gallivm->context));
+@@ -224,12 +219,10 @@ lp_build_unpack_arith_rgba_aos(struct gallivm_state *gallivm,
+ else
+ scales[i] = lp_build_const_float(gallivm, 1.0);
+ }
+-
+- shift += bits;
+ }
+
+- /* Ex: convert packed = {BGRA, BGRA, BGRA, BGRA}
+- * into masked = {B, G, R, A}
++ /* Ex: convert packed = {XYZW, XYZW, XYZW, XYZW}
++ * into masked = {X, Y, Z, W}
+ */
+ shifted = LLVMBuildLShr(builder, packed, LLVMConstVector(shifts, 4), "");
+ masked = LLVMBuildAnd(builder, shifted, LLVMConstVector(masks, 4), "");
+@@ -276,7 +269,6 @@ lp_build_pack_rgba_aos(struct gallivm_state *gallivm,
+ LLVMValueRef shifts[4];
+ LLVMValueRef scales[4];
+ boolean normalized;
+- unsigned shift;
+ unsigned i, j;
+
+ assert(desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
+@@ -302,9 +294,9 @@ lp_build_pack_rgba_aos(struct gallivm_state *gallivm,
+ LLVMConstVector(swizzles, 4), "");
+
+ normalized = FALSE;
+- shift = 0;
+ for (i = 0; i < 4; ++i) {
+ unsigned bits = desc->channel[i].size;
++ unsigned shift = desc->channel[i].shift;
+
+ if (desc->channel[i].type == UTIL_FORMAT_TYPE_VOID) {
+ shifts[i] = LLVMGetUndef(LLVMInt32TypeInContext(gallivm->context));
+@@ -325,8 +317,6 @@ lp_build_pack_rgba_aos(struct gallivm_state *gallivm,
+ else
+ scales[i] = lp_build_const_float(gallivm, 1.0);
+ }
+-
+- shift += bits;
+ }
+
+ if (normalized)
+@@ -410,16 +400,11 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm,
+
+ packed = lp_build_gather(gallivm, type.length/4,
+ format_desc->block.bits, type.width*4,
+- base_ptr, offset);
++ base_ptr, offset, TRUE);
+
+ assert(format_desc->block.bits <= vec_len);
+
+ packed = LLVMBuildBitCast(gallivm->builder, packed, dst_vec_type, "");
+-#ifdef PIPE_ARCH_BIG_ENDIAN
+- if (type.floating)
+- packed = lp_build_bswap_vec(gallivm, packed, type,
+- lp_type_float_vec(type.width, vec_len));
+-#endif
+ return lp_build_format_swizzle_aos(format_desc, &bld, packed);
+ }
+
+@@ -453,7 +438,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm,
+
+ packed = lp_build_gather_elem(gallivm, num_pixels,
+ format_desc->block.bits, 32,
+- base_ptr, offset, k);
++ base_ptr, offset, k, FALSE);
+
+ tmps[k] = lp_build_unpack_arith_rgba_aos(gallivm,
+ format_desc,
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c
+index 3402a0b..ee3ca86 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c
+@@ -40,58 +40,6 @@
+ #include "pipe/p_state.h"
+
+
+-#ifdef PIPE_ARCH_BIG_ENDIAN
+-static LLVMValueRef
+-lp_build_read_int_bswap(struct gallivm_state *gallivm,
+- LLVMValueRef base_ptr,
+- unsigned src_width,
+- LLVMTypeRef src_type,
+- unsigned i,
+- LLVMTypeRef dst_type)
+-{
+- LLVMBuilderRef builder = gallivm->builder;
+- LLVMValueRef index = lp_build_const_int32(gallivm, i);
+- LLVMValueRef ptr = LLVMBuildGEP(builder, base_ptr, &index, 1, "");
+- LLVMValueRef res = LLVMBuildLoad(builder, ptr, "");
+- res = lp_build_bswap(gallivm, res, lp_type_uint(src_width));
+- return LLVMBuildBitCast(builder, res, dst_type, "");
+-}
+-
+-static LLVMValueRef
+-lp_build_fetch_read_big_endian(struct gallivm_state *gallivm,
+- struct lp_type src_type,
+- LLVMValueRef base_ptr)
+-{
+- LLVMBuilderRef builder = gallivm->builder;
+- unsigned src_width = src_type.width;
+- unsigned length = src_type.length;
+- LLVMTypeRef src_elem_type = LLVMIntTypeInContext(gallivm->context, src_width);
+- LLVMTypeRef dst_elem_type = lp_build_elem_type (gallivm, src_type);
+- LLVMTypeRef src_ptr_type = LLVMPointerType(src_elem_type, 0);
+- LLVMValueRef res;
+-
+- base_ptr = LLVMBuildPointerCast(builder, base_ptr, src_ptr_type, "");
+- if (length == 1) {
+- /* Scalar */
+- res = lp_build_read_int_bswap(gallivm, base_ptr, src_width, src_elem_type,
+- 0, dst_elem_type);
+- } else {
+- /* Vector */
+- LLVMTypeRef dst_vec_type = LLVMVectorType(dst_elem_type, length);
+- unsigned i;
+-
+- res = LLVMGetUndef(dst_vec_type);
+- for (i = 0; i < length; ++i) {
+- LLVMValueRef index = lp_build_const_int32(gallivm, i);
+- LLVMValueRef elem = lp_build_read_int_bswap(gallivm, base_ptr, src_width,
+- src_elem_type, i, dst_elem_type);
+- res = LLVMBuildInsertElement(builder, res, elem, index, "");
+- }
+- }
+-
+- return res;
+-}
+-#endif
+
+ /**
+ * @brief lp_build_fetch_rgba_aos_array
+@@ -124,13 +72,9 @@ lp_build_fetch_rgba_aos_array(struct gallivm_state *gallivm,
+
+ /* Read whole vector from memory, unaligned */
+ ptr = LLVMBuildGEP(builder, base_ptr, &offset, 1, "");
+-#ifdef PIPE_ARCH_BIG_ENDIAN
+- res = lp_build_fetch_read_big_endian(gallivm, src_type, ptr);
+-#else
+ ptr = LLVMBuildPointerCast(builder, ptr, LLVMPointerType(src_vec_type, 0), "");
+ res = LLVMBuildLoad(builder, ptr, "");
+ lp_set_load_alignment(res, src_type.width / 8);
+-#endif
+
+ /* Truncate doubles to float */
+ if (src_type.floating && src_type.width == 64) {
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+index 54ca61a..cf51b34 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+@@ -106,7 +106,6 @@ lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
+ LLVMBuilderRef builder = gallivm->builder;
+ struct lp_build_context bld;
+ LLVMValueRef inputs[4];
+- unsigned start;
+ unsigned chan;
+
+ assert(format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
+@@ -119,9 +118,9 @@ lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
+ lp_build_context_init(&bld, gallivm, type);
+
+ /* Decode the input vector components */
+- start = 0;
+ for (chan = 0; chan < format_desc->nr_channels; ++chan) {
+ const unsigned width = format_desc->channel[chan].size;
++ const unsigned start = format_desc->channel[chan].shift;
+ const unsigned stop = start + width;
+ LLVMValueRef input;
+
+@@ -247,8 +246,6 @@ lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
+ }
+
+ inputs[chan] = input;
+-
+- start = stop;
+ }
+
+ lp_build_format_swizzle_soa(format_desc, &bld, inputs, rgba_out);
+@@ -282,7 +279,11 @@ lp_build_rgba8_to_fi32_soa(struct gallivm_state *gallivm,
+
+ /* Decode the input vector components */
+ for (chan = 0; chan < 4; ++chan) {
++#ifdef PIPE_ARCH_LITTLE_ENDIAN
+ unsigned start = chan*8;
++#else
++ unsigned start = (3-chan)*8;
++#endif
+ unsigned stop = start + 8;
+ LLVMValueRef input;
+
+@@ -351,13 +352,14 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm,
+
+ /*
+ * gather the texels from the texture
+- * Ex: packed = {BGRA, BGRA, BGRA, BGRA}.
++ * Ex: packed = {XYZW, XYZW, XYZW, XYZW}
+ */
++ assert(format_desc->block.bits <= type.width);
+ packed = lp_build_gather(gallivm,
+ type.length,
+ format_desc->block.bits,
+ type.width,
+- base_ptr, offset);
++ base_ptr, offset, FALSE);
+
+ /*
+ * convert texels to float rgba
+@@ -382,7 +384,8 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm,
+
+ packed = lp_build_gather(gallivm, type.length,
+ format_desc->block.bits,
+- type.width, base_ptr, offset);
++ type.width, base_ptr, offset,
++ FALSE);
+ if (format_desc->format == PIPE_FORMAT_R11G11B10_FLOAT) {
+ lp_build_r11g11b10_to_float(gallivm, packed, rgba_out);
+ }
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
+index e542abc..873f354 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
+@@ -497,7 +497,7 @@ lp_build_fetch_subsampled_rgba_aos(struct gallivm_state *gallivm,
+ assert(format_desc->block.width == 2);
+ assert(format_desc->block.height == 1);
+
+- packed = lp_build_gather(gallivm, n, 32, 32, base_ptr, offset);
++ packed = lp_build_gather(gallivm, n, 32, 32, base_ptr, offset, FALSE);
+
+ (void)j;
+
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_gather.c b/src/gallium/auxiliary/gallivm/lp_bld_gather.c
+index eefb23a..9155d81 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_gather.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_gather.c
+@@ -78,7 +78,8 @@ lp_build_gather_elem(struct gallivm_state *gallivm,
+ unsigned dst_width,
+ LLVMValueRef base_ptr,
+ LLVMValueRef offsets,
+- unsigned i)
++ unsigned i,
++ boolean vector_justify)
+ {
+ LLVMTypeRef src_type = LLVMIntTypeInContext(gallivm->context, src_width);
+ LLVMTypeRef src_ptr_type = LLVMPointerType(src_type, 0);
+@@ -97,10 +98,12 @@ lp_build_gather_elem(struct gallivm_state *gallivm,
+ res = LLVMBuildTrunc(gallivm->builder, res, dst_elem_type, "");
+ } else if (src_width < dst_width) {
+ res = LLVMBuildZExt(gallivm->builder, res, dst_elem_type, "");
++ if (vector_justify) {
+ #ifdef PIPE_ARCH_BIG_ENDIAN
+- res = LLVMBuildShl(gallivm->builder, res,
+- LLVMConstInt(dst_elem_type, dst_width - src_width, 0), "");
++ res = LLVMBuildShl(gallivm->builder, res,
++ LLVMConstInt(dst_elem_type, dst_width - src_width, 0), "");
+ #endif
++ }
+ }
+
+ return res;
+@@ -112,11 +115,20 @@ lp_build_gather_elem(struct gallivm_state *gallivm,
+ * Use for fetching texels from a texture.
+ * For SSE, typical values are length=4, src_width=32, dst_width=32.
+ *
++ * When src_width < dst_width, the return value can be justified in
++ * one of two ways:
++ * "integer justification" is used when the caller treats the destination
++ * as a packed integer bitmask, as described by the channels' "shift" and
++ * "width" fields;
++ * "vector justification" is used when the caller casts the destination
++ * to a vector and needs channel X to be in vector element 0.
++ *
+ * @param length length of the offsets
+ * @param src_width src element width in bits
+ * @param dst_width result element width in bits (src will be expanded to fit)
+ * @param base_ptr base pointer, should be a i8 pointer type.
+ * @param offsets vector with offsets
++ * @param vector_justify select vector rather than integer justification
+ */
+ LLVMValueRef
+ lp_build_gather(struct gallivm_state *gallivm,
+@@ -124,7 +136,8 @@ lp_build_gather(struct gallivm_state *gallivm,
+ unsigned src_width,
+ unsigned dst_width,
+ LLVMValueRef base_ptr,
+- LLVMValueRef offsets)
++ LLVMValueRef offsets,
++ boolean vector_justify)
+ {
+ LLVMValueRef res;
+
+@@ -132,7 +145,7 @@ lp_build_gather(struct gallivm_state *gallivm,
+ /* Scalar */
+ return lp_build_gather_elem(gallivm, length,
+ src_width, dst_width,
+- base_ptr, offsets, 0);
++ base_ptr, offsets, 0, vector_justify);
+ } else {
+ /* Vector */
+
+@@ -146,7 +159,7 @@ lp_build_gather(struct gallivm_state *gallivm,
+ LLVMValueRef elem;
+ elem = lp_build_gather_elem(gallivm, length,
+ src_width, dst_width,
+- base_ptr, offsets, i);
++ base_ptr, offsets, i, vector_justify);
+ res = LLVMBuildInsertElement(gallivm->builder, res, elem, index, "");
+ }
+ }
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_gather.h b/src/gallium/auxiliary/gallivm/lp_bld_gather.h
+index 8e4c07d..ee69473 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_gather.h
++++ b/src/gallium/auxiliary/gallivm/lp_bld_gather.h
+@@ -47,7 +47,8 @@ lp_build_gather_elem(struct gallivm_state *gallivm,
+ unsigned dst_width,
+ LLVMValueRef base_ptr,
+ LLVMValueRef offsets,
+- unsigned i);
++ unsigned i,
++ boolean vector_justify);
+
+ LLVMValueRef
+ lp_build_gather(struct gallivm_state *gallivm,
+@@ -55,7 +56,8 @@ lp_build_gather(struct gallivm_state *gallivm,
+ unsigned src_width,
+ unsigned dst_width,
+ LLVMValueRef base_ptr,
+- LLVMValueRef offsets);
++ LLVMValueRef offsets,
++ boolean vector_justify);
+
+ LLVMValueRef
+ lp_build_gather_values(struct gallivm_state * gallivm,
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
+index 16d5718..0808db7 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
+@@ -533,7 +533,7 @@ lp_build_sample_fetch_image_nearest(struct lp_build_sample_context *bld,
+ bld->texel_type.length,
+ bld->format_desc->block.bits,
+ bld->texel_type.width,
+- data_ptr, offset);
++ data_ptr, offset, TRUE);
+
+ rgba8 = LLVMBuildBitCast(builder, rgba8, u8n_vec_type, "");
+ }
+@@ -922,7 +922,7 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld,
+ bld->texel_type.length,
+ bld->format_desc->block.bits,
+ bld->texel_type.width,
+- data_ptr, offset[k][j][i]);
++ data_ptr, offset[k][j][i], TRUE);
+
+ rgba8 = LLVMBuildBitCast(builder, rgba8, u8n_vec_type, "");
+ }
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+index 08d817a..79116bc 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+@@ -217,6 +217,20 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
+
+ a = LLVMBuildBitCast(builder, a, lp_build_vec_type(bld->gallivm, type2), "");
+
++ /*
++ * Vector element 0 is always channel X.
++ *
++ * 76 54 32 10 (array numbering)
++ * Little endian reg in: YX YX YX YX
++ * Little endian reg out: YY YY YY YY if shift right (shift == -1)
++ * XX XX XX XX if shift left (shift == 1)
++ *
++ * 01 23 45 67 (array numbering)
++ * Big endian reg in: XY XY XY XY
++ * Big endian reg out: YY YY YY YY if shift left (shift == 1)
++ * XX XX XX XX if shift right (shift == -1)
++ *
++ */
+ #ifdef PIPE_ARCH_LITTLE_ENDIAN
+ shift = channel == 0 ? 1 : -1;
+ #else
+@@ -240,10 +254,23 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
+ /*
+ * Bit mask and recursive shifts
+ *
++ * Little-endian registers:
++ *
++ * 7654 3210
++ * WZYX WZYX .... WZYX <= input
++ * 00Y0 00Y0 .... 00Y0 <= mask
++ * 00YY 00YY .... 00YY <= shift right 1 (shift amount -1)
++ * YYYY YYYY .... YYYY <= shift left 2 (shift amount 2)
++ *
++ * Big-endian registers:
++ *
++ * 0123 4567
+ * XYZW XYZW .... XYZW <= input
+- * 0Y00 0Y00 .... 0Y00
+- * YY00 YY00 .... YY00
+- * YYYY YYYY .... YYYY <= output
++ * 0Y00 0Y00 .... 0Y00 <= mask
++ * YY00 YY00 .... YY00 <= shift left 1 (shift amount 1)
++ * YYYY YYYY .... YYYY <= shift right 2 (shift amount -2)
++ *
++ * shifts[] gives little-endian shift amounts; we need to negate for big-endian.
+ */
+ struct lp_type type4;
+ const int shifts[4][2] = {
+@@ -274,14 +301,15 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
+ LLVMValueRef tmp = NULL;
+ int shift = shifts[channel][i];
+
+-#ifdef PIPE_ARCH_LITTLE_ENDIAN
++ /* See endianness diagram above */
++#ifdef PIPE_ARCH_BIG_ENDIAN
+ shift = -shift;
+ #endif
+
+ if(shift > 0)
+- tmp = LLVMBuildLShr(builder, a, lp_build_const_int_vec(bld->gallivm, type4, shift*type.width), "");
++ tmp = LLVMBuildShl(builder, a, lp_build_const_int_vec(bld->gallivm, type4, shift*type.width), "");
+ if(shift < 0)
+- tmp = LLVMBuildShl(builder, a, lp_build_const_int_vec(bld->gallivm, type4, -shift*type.width), "");
++ tmp = LLVMBuildLShr(builder, a, lp_build_const_int_vec(bld->gallivm, type4, -shift*type.width), "");
+
+ assert(tmp);
+ if(tmp)
+@@ -474,21 +502,39 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
+
+ /*
+ * Mask and shift the channels, trying to group as many channels in the
+- * same shift as possible
++ * same shift as possible. The shift amount is positive for shifts left
++ * and negative for shifts right.
+ */
+ for (shift = -3; shift <= 3; ++shift) {
+ uint64_t mask = 0;
+
+ assert(type4.width <= sizeof(mask)*8);
+
++ /*
++ * Vector element numbers follow the XYZW order, so 0 is always X, etc.
++ * After widening 4 times we have:
++ *
++ * 3210
++ * Little-endian register layout: WZYX
++ *
++ * 0123
++ * Big-endian register layout: XYZW
++ *
++ * For little-endian, higher-numbered channels are obtained by a shift right
++ * (negative shift amount) and lower-numbered channels by a shift left
++ * (positive shift amount). The opposite is true for big-endian.
++ */
+ for (chan = 0; chan < 4; ++chan) {
+- /* FIXME: big endian */
+- if (swizzles[chan] < 4 &&
+- chan - swizzles[chan] == shift) {
++ if (swizzles[chan] < 4) {
++ /* We need to move channel swizzles[chan] into channel chan */
+ #ifdef PIPE_ARCH_LITTLE_ENDIAN
+- mask |= ((1ULL << type.width) - 1) << (swizzles[chan] * type.width);
++ if (swizzles[chan] - chan == -shift) {
++ mask |= ((1ULL << type.width) - 1) << (swizzles[chan] * type.width);
++ }
+ #else
+- mask |= ((1ULL << type.width) - 1) << (type4.width - type.width) >> (swizzles[chan] * type.width);
++ if (swizzles[chan] - chan == shift) {
++ mask |= ((1ULL << type.width) - 1) << (type4.width - type.width) >> (swizzles[chan] * type.width);
++ }
+ #endif
+ }
+ }
+@@ -502,21 +548,11 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
+ masked = LLVMBuildAnd(builder, a,
+ lp_build_const_int_vec(bld->gallivm, type4, mask), "");
+ if (shift > 0) {
+-#ifdef PIPE_ARCH_LITTLE_ENDIAN
+ shifted = LLVMBuildShl(builder, masked,
+ lp_build_const_int_vec(bld->gallivm, type4, shift*type.width), "");
+-#else
+- shifted = LLVMBuildLShr(builder, masked,
+- lp_build_const_int_vec(bld->gallivm, type4, shift*type.width), "");
+-#endif
+ } else if (shift < 0) {
+-#ifdef PIPE_ARCH_LITTLE_ENDIAN
+ shifted = LLVMBuildLShr(builder, masked,
+ lp_build_const_int_vec(bld->gallivm, type4, -shift*type.width), "");
+-#else
+- shifted = LLVMBuildShl(builder, masked,
+- lp_build_const_int_vec(bld->gallivm, type4, -shift*type.width), "");
+-#endif
+ } else {
+ shifted = masked;
+ }
+diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
+index e4b9c36..3a04d89 100644
+--- a/src/gallium/auxiliary/util/u_format.h
++++ b/src/gallium/auxiliary/util/u_format.h
+@@ -132,6 +132,7 @@ struct util_format_channel_description
+ unsigned normalized:1;
+ unsigned pure_integer:1;
+ unsigned size:9; /**< bits per channel */
++ unsigned shift:16; /** number of bits from lsb */
+ };
+
+
+@@ -178,9 +179,31 @@ struct util_format_description
+ unsigned is_mixed:1;
+
+ /**
+- * Input channel description.
++ * Input channel description, in the order XYZW.
+ *
+ * Only valid for UTIL_FORMAT_LAYOUT_PLAIN formats.
++ *
++ * If each channel is accessed as an individual N-byte value, X is always
++ * at the lowest address in memory, Y is always next, and so on. For all
++ * currently-defined formats, the N-byte value has native endianness.
++ *
++ * If instead a group of channels is accessed as a single N-byte value,
++ * the order of the channels within that value depends on endianness.
++ * For big-endian targets, X is the most significant subvalue,
++ * otherwise it is the least significant one.
++ *
++ * For example, if X is 8 bits and Y is 24 bits, the memory order is:
++ *
++ * 0 1 2 3
++ * little-endian: X Yl Ym Yu (l = lower, m = middle, u = upper)
++ * big-endian: X Yu Ym Yl
++ *
++ * If X is 5 bits, Y is 5 bits, Z is 5 bits and W is 1 bit, the layout is:
++ *
++ * 0 1
++ * msb lsb msb lsb
++ * little-endian: YYYXXXXX WZZZZZYY
++ * big-endian: XXXXXYYY YYZZZZZW
+ */
+ struct util_format_channel_description channel[4];
+
+diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
+index 565d059..d1f68c8 100644
+--- a/src/gallium/auxiliary/util/u_format_pack.py
++++ b/src/gallium/auxiliary/util/u_format_pack.py
+@@ -99,15 +99,6 @@ def generate_format_type(format):
+ print
+
+
+-def bswap_format(format):
+- '''Generate a structure that describes the format.'''
+-
+- if format.is_bitmask() and not format.is_array() and format.block_size() > 8:
+- print '#ifdef PIPE_ARCH_BIG_ENDIAN'
+- print ' pixel.value = util_bswap%u(pixel.value);' % format.block_size()
+- print '#endif'
+-
+-
+ def is_format_supported(format):
+ '''Determines whether we actually have the plumbing necessary to generate the
+ to read/write to/from this format.'''
+@@ -423,16 +414,11 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
+ elif src_channel.type == SIGNED:
+ print ' int%u_t %s;' % (depth, src_channel.name)
+
+- if depth > 8:
+- print '#ifdef PIPE_ARCH_BIG_ENDIAN'
+- print ' value = util_bswap%u(value);' % depth
+- print '#endif'
+-
+ # Compute the intermediate unshifted values
+- shift = 0
+ for i in range(format.nr_channels()):
+ src_channel = format.channels[i]
+ value = 'value'
++ shift = src_channel.shift
+ if src_channel.type == UNSIGNED:
+ if shift:
+ value = '%s >> %u' % (value, shift)
+@@ -455,8 +441,6 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
+ if value is not None:
+ print ' %s = %s;' % (src_channel.name, value)
+
+- shift += src_channel.size
+-
+ # Convert, swizzle, and store final values
+ for i in range(4):
+ swizzle = format.swizzles[i]
+@@ -484,7 +468,6 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
+ else:
+ print ' union util_format_%s pixel;' % format.short_name()
+ print ' memcpy(&pixel, src, sizeof pixel);'
+- bswap_format(format)
+
+ for i in range(4):
+ swizzle = format.swizzles[i]
+@@ -525,9 +508,9 @@ def generate_pack_kernel(format, src_channel, src_native_type):
+ depth = format.block_size()
+ print ' uint%u_t value = 0;' % depth
+
+- shift = 0
+ for i in range(4):
+ dst_channel = format.channels[i]
++ shift = dst_channel.shift
+ if inv_swizzle[i] is not None:
+ value ='src[%u]' % inv_swizzle[i]
+ dst_colorspace = format.colorspace
+@@ -551,13 +534,6 @@ def generate_pack_kernel(format, src_channel, src_native_type):
+ if value is not None:
+ print ' value |= %s;' % (value)
+
+- shift += dst_channel.size
+-
+- if depth > 8:
+- print '#ifdef PIPE_ARCH_BIG_ENDIAN'
+- print ' value = util_bswap%u(value);' % depth
+- print '#endif'
+-
+ print ' *(uint%u_t *)dst = value;' % depth
+
+ else:
+@@ -579,7 +555,6 @@ def generate_pack_kernel(format, src_channel, src_native_type):
+ dst_colorspace = dst_colorspace)
+ print ' pixel.chan.%s = %s;' % (dst_channel.name, value)
+
+- bswap_format(format)
+ print ' memcpy(dst, &pixel, sizeof pixel);'
+
+
+diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py
+index 07052b9..e202099 100755
+--- a/src/gallium/auxiliary/util/u_format_parse.py
++++ b/src/gallium/auxiliary/util/u_format_parse.py
+@@ -30,6 +30,8 @@
+ '''
+
+
++import sys
++
+ VOID, UNSIGNED, SIGNED, FIXED, FLOAT = range(5)
+
+ SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_0, SWIZZLE_1, SWIZZLE_NONE, = range(7)
+@@ -42,6 +44,9 @@ YUV = 'yuv'
+ ZS = 'zs'
+
+
++# Not cross-compiler friendly
++is_big_endian = sys.byteorder == 'big'
++
+ def is_pot(x):
+ return (x & (x - 1)) == 0
+
+@@ -307,6 +312,11 @@ def parse(filename):
+ channel = Channel(type, norm, pure, size, names[i])
+ channels.append(channel)
+
++ shift = 0
++ for channel in channels[3::-1] if is_big_endian else channels:
++ channel.shift = shift
++ shift += channel.size
++
+ format = Format(name, layout, block_width, block_height, channels, swizzles, colorspace)
+ formats.append(format)
+ return formats
+diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
+index 8edb505..9d44cf3 100755
+--- a/src/gallium/auxiliary/util/u_format_table.py
++++ b/src/gallium/auxiliary/util/u_format_table.py
+@@ -114,9 +114,9 @@ def write_format_table(formats):
+ else:
+ sep = ""
+ if channel.size:
+- print " {%s, %s, %s, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), channel.size, sep, "xyzw"[i], channel.name)
++ print " {%s, %s, %s, %u, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), channel.size, channel.shift, sep, "xyzw"[i], channel.name)
+ else:
+- print " {0, 0, 0, 0}%s" % (sep,)
++ print " {0, 0, 0, 0, 0}%s" % (sep,)
+ print " },"
+ print " {"
+ for i in range(4):
+diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h
+index 1f6a56a..9c25451 100644
+--- a/src/gallium/auxiliary/util/u_pack_color.h
++++ b/src/gallium/auxiliary/util/u_pack_color.h
+@@ -65,32 +65,32 @@ util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a,
+ enum pipe_format format, union util_color *uc)
+ {
+ switch (format) {
+- case PIPE_FORMAT_A8B8G8R8_UNORM:
++ case PIPE_FORMAT_RGBA8888_UNORM:
+ {
+ uc->ui = (r << 24) | (g << 16) | (b << 8) | a;
+ }
+ return;
+- case PIPE_FORMAT_X8B8G8R8_UNORM:
++ case PIPE_FORMAT_RGBX8888_UNORM:
+ {
+ uc->ui = (r << 24) | (g << 16) | (b << 8) | 0xff;
+ }
+ return;
+- case PIPE_FORMAT_B8G8R8A8_UNORM:
++ case PIPE_FORMAT_ARGB8888_UNORM:
+ {
+ uc->ui = (a << 24) | (r << 16) | (g << 8) | b;
+ }
+ return;
+- case PIPE_FORMAT_B8G8R8X8_UNORM:
++ case PIPE_FORMAT_XRGB8888_UNORM:
+ {
+ uc->ui = (0xff << 24) | (r << 16) | (g << 8) | b;
+ }
+ return;
+- case PIPE_FORMAT_A8R8G8B8_UNORM:
++ case PIPE_FORMAT_BGRA8888_UNORM:
+ {
+ uc->ui = (b << 24) | (g << 16) | (r << 8) | a;
+ }
+ return;
+- case PIPE_FORMAT_X8R8G8B8_UNORM:
++ case PIPE_FORMAT_BGRX8888_UNORM:
+ {
+ uc->ui = (b << 24) | (g << 16) | (r << 8) | 0xff;
+ }
+@@ -166,7 +166,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
+ ubyte *r, ubyte *g, ubyte *b, ubyte *a)
+ {
+ switch (format) {
+- case PIPE_FORMAT_A8B8G8R8_UNORM:
++ case PIPE_FORMAT_RGBA8888_UNORM:
+ {
+ uint p = uc->ui;
+ *r = (ubyte) ((p >> 24) & 0xff);
+@@ -175,7 +175,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
+ *a = (ubyte) ((p >> 0) & 0xff);
+ }
+ return;
+- case PIPE_FORMAT_X8B8G8R8_UNORM:
++ case PIPE_FORMAT_RGBX8888_UNORM:
+ {
+ uint p = uc->ui;
+ *r = (ubyte) ((p >> 24) & 0xff);
+@@ -184,7 +184,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
+ *a = (ubyte) 0xff;
+ }
+ return;
+- case PIPE_FORMAT_B8G8R8A8_UNORM:
++ case PIPE_FORMAT_ARGB8888_UNORM:
+ {
+ uint p = uc->ui;
+ *r = (ubyte) ((p >> 16) & 0xff);
+@@ -193,7 +193,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
+ *a = (ubyte) ((p >> 24) & 0xff);
+ }
+ return;
+- case PIPE_FORMAT_B8G8R8X8_UNORM:
++ case PIPE_FORMAT_XRGB8888_UNORM:
+ {
+ uint p = uc->ui;
+ *r = (ubyte) ((p >> 16) & 0xff);
+@@ -202,7 +202,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
+ *a = (ubyte) 0xff;
+ }
+ return;
+- case PIPE_FORMAT_A8R8G8B8_UNORM:
++ case PIPE_FORMAT_BGRA8888_UNORM:
+ {
+ uint p = uc->ui;
+ *r = (ubyte) ((p >> 8) & 0xff);
+@@ -211,7 +211,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
+ *a = (ubyte) ((p >> 0) & 0xff);
+ }
+ return;
+- case PIPE_FORMAT_X8R8G8B8_UNORM:
++ case PIPE_FORMAT_BGRX8888_UNORM:
+ {
+ uint p = uc->ui;
+ *r = (ubyte) ((p >> 8) & 0xff);
+@@ -350,32 +350,32 @@ util_pack_color(const float rgba[4], enum pipe_format format, union util_color *
+ }
+
+ switch (format) {
+- case PIPE_FORMAT_A8B8G8R8_UNORM:
++ case PIPE_FORMAT_RGBA8888_UNORM:
+ {
+ uc->ui = (r << 24) | (g << 16) | (b << 8) | a;
+ }
+ return;
+- case PIPE_FORMAT_X8B8G8R8_UNORM:
++ case PIPE_FORMAT_RGBX8888_UNORM:
+ {
+ uc->ui = (r << 24) | (g << 16) | (b << 8) | 0xff;
+ }
+ return;
+- case PIPE_FORMAT_B8G8R8A8_UNORM:
++ case PIPE_FORMAT_ARGB8888_UNORM:
+ {
+ uc->ui = (a << 24) | (r << 16) | (g << 8) | b;
+ }
+ return;
+- case PIPE_FORMAT_B8G8R8X8_UNORM:
++ case PIPE_FORMAT_XRGB8888_UNORM:
+ {
+ uc->ui = (0xff << 24) | (r << 16) | (g << 8) | b;
+ }
+ return;
+- case PIPE_FORMAT_A8R8G8B8_UNORM:
++ case PIPE_FORMAT_BGRA8888_UNORM:
+ {
+ uc->ui = (b << 24) | (g << 16) | (r << 8) | a;
+ }
+ return;
+- case PIPE_FORMAT_X8R8G8B8_UNORM:
++ case PIPE_FORMAT_BGRX8888_UNORM:
+ {
+ uc->ui = (b << 24) | (g << 16) | (r << 8) | 0xff;
+ }
+diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
+index c4d04a2..008e38e 100644
+--- a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
++++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
+@@ -245,10 +245,6 @@ lp_build_blend_factor(struct lp_build_blend_aos_context *bld,
+ LLVMValueRef rgb_factor_, alpha_factor_;
+ enum lp_build_blend_swizzle rgb_swizzle;
+
+- if (alpha_swizzle == 0) {
+- return lp_build_blend_factor_unswizzled(bld, alpha_factor, TRUE);
+- }
+-
+ rgb_factor_ = lp_build_blend_factor_unswizzled(bld, rgb_factor, FALSE);
+
+ if (alpha_swizzle != UTIL_FORMAT_SWIZZLE_NONE) {
+diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
+index 1cd36b8..29ef379 100644
+--- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c
++++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
+@@ -349,8 +349,6 @@ get_z_shift_and_mask(const struct util_format_description *format_desc,
+ {
+ const unsigned total_bits = format_desc->block.bits;
+ unsigned z_swizzle;
+- unsigned chan;
+- unsigned padding_left, padding_right;
+
+ assert(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS);
+ assert(format_desc->block.width == 1);
+@@ -362,25 +360,14 @@ get_z_shift_and_mask(const struct util_format_description *format_desc,
+ return FALSE;
+
+ *width = format_desc->channel[z_swizzle].size;
++ *shift = format_desc->channel[z_swizzle].shift;
+
+- padding_right = 0;
+- for (chan = 0; chan < z_swizzle; ++chan)
+- padding_right += format_desc->channel[chan].size;
+-
+- padding_left =
+- total_bits - (padding_right + *width);
+-
+- if (padding_left || padding_right) {
+- unsigned long long mask_left = (1ULL << (total_bits - padding_left)) - 1;
+- unsigned long long mask_right = (1ULL << (padding_right)) - 1;
+- *mask = mask_left ^ mask_right;
+- }
+- else {
++ if (*width == total_bits) {
+ *mask = 0xffffffff;
++ } else {
++ *mask = ((1 << *width) - 1) << *shift;
+ }
+
+- *shift = padding_right;
+-
+ return TRUE;
+ }
+
+@@ -395,17 +382,14 @@ get_s_shift_and_mask(const struct util_format_description *format_desc,
+ unsigned *shift, unsigned *mask)
+ {
+ unsigned s_swizzle;
+- unsigned chan, sz;
++ unsigned sz;
+
+ s_swizzle = format_desc->swizzle[1];
+
+ if (s_swizzle == UTIL_FORMAT_SWIZZLE_NONE)
+ return FALSE;
+
+- *shift = 0;
+- for (chan = 0; chan < s_swizzle; chan++)
+- *shift += format_desc->channel[chan].size;
+-
++ *shift = format_desc->channel[s_swizzle].shift;
+ sz = format_desc->channel[s_swizzle].size;
+ *mask = (1U << sz) - 1U;
+
+diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
+index 6921210..0691a40 100644
+--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
++++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
+@@ -987,12 +987,17 @@ convert_to_blend_type(struct gallivm_state *gallivm,
+ for (i = 0; i < num_srcs; ++i) {
+ LLVMValueRef chans[4];
+ LLVMValueRef res = NULL;
+- unsigned sa = 0;
+
+ dst[i] = LLVMBuildZExt(builder, src[i], lp_build_vec_type(gallivm, src_type), "");
+
+ for (j = 0; j < src_fmt->nr_channels; ++j) {
+ unsigned mask = 0;
++ unsigned sa = src_fmt->channel[j].shift;
++#ifdef PIPE_ARCH_LITTLE_ENDIAN
++ unsigned from_lsb = j;
++#else
++ unsigned from_lsb = src_fmt->nr_channels - j - 1;
++#endif
+
+ for (k = 0; k < src_fmt->channel[j].size; ++k) {
+ mask |= 1 << k;
+@@ -1018,11 +1023,9 @@ convert_to_blend_type(struct gallivm_state *gallivm,
+ /* Insert bits into correct position */
+ chans[j] = LLVMBuildShl(builder,
+ chans[j],
+- lp_build_const_int_vec(gallivm, src_type, j * blend_type.width),
++ lp_build_const_int_vec(gallivm, src_type, from_lsb * blend_type.width),
+ "");
+
+- sa += src_fmt->channel[j].size;
+-
+ if (j == 0) {
+ res = chans[j];
+ } else {
+@@ -1136,12 +1139,17 @@ convert_from_blend_type(struct gallivm_state *gallivm,
+ for (i = 0; i < num_srcs; ++i) {
+ LLVMValueRef chans[4];
+ LLVMValueRef res = NULL;
+- unsigned sa = 0;
+
+ dst[i] = LLVMBuildBitCast(builder, src[i], lp_build_vec_type(gallivm, src_type), "");
+
+ for (j = 0; j < src_fmt->nr_channels; ++j) {
+ unsigned mask = 0;
++ unsigned sa = src_fmt->channel[j].shift;
++#ifdef PIPE_ARCH_LITTLE_ENDIAN
++ unsigned from_lsb = j;
++#else
++ unsigned from_lsb = src_fmt->nr_channels - j - 1;
++#endif
+
+ assert(blend_type.width > src_fmt->channel[j].size);
+
+@@ -1152,7 +1160,7 @@ convert_from_blend_type(struct gallivm_state *gallivm,
+ /* Extract bits */
+ chans[j] = LLVMBuildLShr(builder,
+ dst[i],
+- lp_build_const_int_vec(gallivm, src_type, j * blend_type.width),
++ lp_build_const_int_vec(gallivm, src_type, from_lsb * blend_type.width),
+ "");
+
+ chans[j] = LLVMBuildAnd(builder,
+diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
+index 098b25b..1289983 100644
+--- a/src/gallium/include/pipe/p_format.h
++++ b/src/gallium/include/pipe/p_format.h
+@@ -33,6 +33,7 @@
+ extern "C" {
+ #endif
+
++#include "p_config.h"
+
+ enum pipe_type {
+ PIPE_TYPE_UNORM = 0,
+@@ -53,10 +54,10 @@ enum pipe_type {
+
+ enum pipe_format {
+ PIPE_FORMAT_NONE = 0,
+- PIPE_FORMAT_B8G8R8A8_UNORM = 1,
+- PIPE_FORMAT_B8G8R8X8_UNORM = 2,
+- PIPE_FORMAT_A8R8G8B8_UNORM = 3,
+- PIPE_FORMAT_X8R8G8B8_UNORM = 4,
++ PIPE_FORMAT_ARGB8888_UNORM = 1,
++ PIPE_FORMAT_XRGB8888_UNORM = 2,
++ PIPE_FORMAT_BGRA8888_UNORM = 3,
++ PIPE_FORMAT_BGRX8888_UNORM = 4,
+ PIPE_FORMAT_B5G5R5A1_UNORM = 5,
+ PIPE_FORMAT_B4G4R4A4_UNORM = 6,
+ PIPE_FORMAT_B5G6R5_UNORM = 7,
+@@ -119,8 +120,8 @@ enum pipe_format {
+ PIPE_FORMAT_R8_UNORM = 64,
+ PIPE_FORMAT_R8G8_UNORM = 65,
+ PIPE_FORMAT_R8G8B8_UNORM = 66,
+- PIPE_FORMAT_R8G8B8A8_UNORM = 67,
+- PIPE_FORMAT_X8B8G8R8_UNORM = 68,
++ PIPE_FORMAT_ABGR8888_UNORM = 67,
++ PIPE_FORMAT_RGBX8888_UNORM = 68,
+ PIPE_FORMAT_R8_USCALED = 69,
+ PIPE_FORMAT_R8G8_USCALED = 70,
+ PIPE_FORMAT_R8G8B8_USCALED = 71,
+@@ -180,7 +181,7 @@ enum pipe_format {
+ PIPE_FORMAT_R5SG5SB6U_NORM = 120,
+
+ /* TODO: re-order these */
+- PIPE_FORMAT_A8B8G8R8_UNORM = 121,
++ PIPE_FORMAT_RGBA8888_UNORM = 121,
+ PIPE_FORMAT_B5G5R5X1_UNORM = 122,
+ PIPE_FORMAT_R10G10B10A2_USCALED = 123,
+ PIPE_FORMAT_R11G11B10_FLOAT = 124,
+@@ -193,7 +194,7 @@ enum pipe_format {
+ PIPE_FORMAT_B10G10R10A2_UNORM = 131,
+ PIPE_FORMAT_R10SG10SB10SA2U_NORM = 132,
+ PIPE_FORMAT_R8G8Bx_SNORM = 133,
+- PIPE_FORMAT_R8G8B8X8_UNORM = 134,
++ PIPE_FORMAT_XBGR8888_UNORM = 134,
+ PIPE_FORMAT_B4G4R4X4_UNORM = 135,
+
+ /* some stencil samplers formats */
+@@ -343,6 +344,27 @@ enum pipe_format {
+ PIPE_FORMAT_COUNT
+ };
+
++#if defined(PIPE_ARCH_LITTLE_ENDIAN)
++#define PIPE_FORMAT_R8G8B8A8_UNORM PIPE_FORMAT_ABGR8888_UNORM
++#define PIPE_FORMAT_R8G8B8X8_UNORM PIPE_FORMAT_XBGR8888_UNORM
++#define PIPE_FORMAT_B8G8R8X8_UNORM PIPE_FORMAT_XRGB8888_UNORM
++#define PIPE_FORMAT_B8G8R8A8_UNORM PIPE_FORMAT_ARGB8888_UNORM
++#define PIPE_FORMAT_B8G8R8X8_UNORM PIPE_FORMAT_XRGB8888_UNORM
++#define PIPE_FORMAT_A8R8G8B8_UNORM PIPE_FORMAT_BGRA8888_UNORM
++#define PIPE_FORMAT_X8R8G8B8_UNORM PIPE_FORMAT_BGRX8888_UNORM
++#define PIPE_FORMAT_A8B8G8R8_UNORM PIPE_FORMAT_RGBA8888_UNORM
++#define PIPE_FORMAT_X8B8G8R8_UNORM PIPE_FORMAT_RGBX8888_UNORM
++#elif defined(PIPE_ARCH_BIG_ENDIAN)
++#define PIPE_FORMAT_R8G8B8A8_UNORM PIPE_FORMAT_RGBA8888_UNORM
++#define PIPE_FORMAT_R8G8B8X8_UNORM PIPE_FORMAT_RGBX8888_UNORM
++#define PIPE_FORMAT_B8G8R8A8_UNORM PIPE_FORMAT_BGRA8888_UNORM
++#define PIPE_FORMAT_B8G8R8X8_UNORM PIPE_FORMAT_BGRX8888_UNORM
++#define PIPE_FORMAT_A8R8G8B8_UNORM PIPE_FORMAT_ARGB8888_UNORM
++#define PIPE_FORMAT_X8R8G8B8_UNORM PIPE_FORMAT_XRGB8888_UNORM
++#define PIPE_FORMAT_A8B8G8R8_UNORM PIPE_FORMAT_ABGR8888_UNORM
++#define PIPE_FORMAT_X8B8G8R8_UNORM PIPE_FORMAT_XBGR8888_UNORM
++#endif
++
+ enum pipe_video_chroma_format
+ {
+ PIPE_VIDEO_CHROMA_FORMAT_420,
+diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
+index e09fe1d..43cca30 100644
+--- a/src/gallium/state_trackers/dri/common/dri_screen.c
++++ b/src/gallium/state_trackers/dri/common/dri_screen.c
+@@ -87,8 +87,8 @@ dri_fill_in_modes(struct dri_screen *screen)
+ MESA_FORMAT_RGB565,
+ };
+ static const enum pipe_format pipe_formats[3] = {
+- PIPE_FORMAT_B8G8R8A8_UNORM,
+- PIPE_FORMAT_B8G8R8X8_UNORM,
++ PIPE_FORMAT_ARGB8888_UNORM,
++ PIPE_FORMAT_XRGB8888_UNORM,
+ PIPE_FORMAT_B5G6R5_UNORM,
+ };
+ gl_format format;
+@@ -250,11 +250,11 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
+
+ if (mode->redBits == 8) {
+ if (mode->alphaBits == 8)
+- stvis->color_format = PIPE_FORMAT_B8G8R8A8_UNORM;
++ stvis->color_format = PIPE_FORMAT_ARGB8888_UNORM;
+ else
+- stvis->color_format = PIPE_FORMAT_B8G8R8X8_UNORM;
++ stvis->color_format = PIPE_FORMAT_XRGB8888_UNORM;
+ } else {
+- stvis->color_format = PIPE_FORMAT_B5G6R5_UNORM;
++ stvis->color_format = PIPE_FORMAT_B5G6R5_UNORM; /* XXX big-endian? */
+ }
+
+ if (mode->sampleBuffers) {
+diff --git a/src/gallium/state_trackers/gbm/gbm_drm.c b/src/gallium/state_trackers/gbm/gbm_drm.c
+index 8490480..4f76b0f 100644
+--- a/src/gallium/state_trackers/gbm/gbm_drm.c
++++ b/src/gallium/state_trackers/gbm/gbm_drm.c
+@@ -45,9 +45,9 @@ gbm_format_to_gallium(enum gbm_bo_format format)
+ {
+ switch (format) {
+ case GBM_BO_FORMAT_XRGB8888:
+- return PIPE_FORMAT_B8G8R8X8_UNORM;
++ return PIPE_FORMAT_XRGB8888_UNORM;
+ case GBM_BO_FORMAT_ARGB8888:
+- return PIPE_FORMAT_B8G8R8A8_UNORM;
++ return PIPE_FORMAT_ARGB8888_UNORM;
+ default:
+ return PIPE_FORMAT_NONE;
+ }
+@@ -145,10 +145,10 @@ gbm_gallium_drm_bo_import(struct gbm_device *gbm,
+ bo->base.base.height = resource->height0;
+
+ switch (resource->format) {
+- case PIPE_FORMAT_B8G8R8X8_UNORM:
++ case PIPE_FORMAT_XRGB8888_UNORM:
+ bo->base.base.format = GBM_BO_FORMAT_XRGB8888;
+ break;
+- case PIPE_FORMAT_B8G8R8A8_UNORM:
++ case PIPE_FORMAT_ARGB8888_UNORM:
+ bo->base.base.format = GBM_BO_FORMAT_ARGB8888;
+ break;
+ default:
+diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
+index e426192..6792ef2 100644
+--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
++++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
+@@ -329,10 +329,10 @@ choose_pixel_format(XMesaVisual v)
+ && v->BitsPerPixel == 32) {
+ if (native_byte_order) {
+ /* no byteswapping needed */
+- return PIPE_FORMAT_R8G8B8A8_UNORM;
++ return PIPE_FORMAT_ABGR8888_UNORM;
+ }
+ else {
+- return PIPE_FORMAT_A8B8G8R8_UNORM;
++ return PIPE_FORMAT_RGBA8888_UNORM;
+ }
+ }
+ else if ( GET_REDMASK(v) == 0xff0000
+@@ -341,10 +341,10 @@ choose_pixel_format(XMesaVisual v)
+ && v->BitsPerPixel == 32) {
+ if (native_byte_order) {
+ /* no byteswapping needed */
+- return PIPE_FORMAT_B8G8R8A8_UNORM;
++ return PIPE_FORMAT_ARGB8888_UNORM;
+ }
+ else {
+- return PIPE_FORMAT_A8R8G8B8_UNORM;
++ return PIPE_FORMAT_BGRA8888_UNORM;
+ }
+ }
+ else if ( GET_REDMASK(v) == 0x0000ff00
+@@ -353,10 +353,10 @@ choose_pixel_format(XMesaVisual v)
+ && v->BitsPerPixel == 32) {
+ if (native_byte_order) {
+ /* no byteswapping needed */
+- return PIPE_FORMAT_A8R8G8B8_UNORM;
++ return PIPE_FORMAT_BGRA8888_UNORM;
+ }
+ else {
+- return PIPE_FORMAT_B8G8R8A8_UNORM;
++ return PIPE_FORMAT_ARGB8888_UNORM;
+ }
+ }
+ else if ( GET_REDMASK(v) == 0xf800
+diff --git a/src/gallium/targets/graw-xlib/graw_xlib.c b/src/gallium/targets/graw-xlib/graw_xlib.c
+index 2827747..ed112b9 100644
+--- a/src/gallium/targets/graw-xlib/graw_xlib.c
++++ b/src/gallium/targets/graw-xlib/graw_xlib.c
+@@ -89,13 +89,13 @@ graw_create_window_and_screen( int x,
+ if (visinfo->red_mask == 0xff0000 &&
+ visinfo->green_mask == 0xff00 &&
+ visinfo->blue_mask == 0xff) {
+- if (format != PIPE_FORMAT_B8G8R8A8_UNORM)
++ if (format != PIPE_FORMAT_ARGB8888_UNORM)
+ goto fail;
+ }
+ else if (visinfo->red_mask == 0xff &&
+ visinfo->green_mask == 0xff00 &&
+ visinfo->blue_mask == 0xff0000) {
+- if (format != PIPE_FORMAT_R8G8B8A8_UNORM)
++ if (format != PIPE_FORMAT_ABGR8888_UNORM)
+ goto fail;
+ }
+ else {
+diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c
+index 6afdf40..e591d90 100644
+--- a/src/gallium/tests/graw/clear.c
++++ b/src/gallium/tests/graw/clear.c
+@@ -10,8 +10,8 @@
+ #include "pipe/p_defines.h"
+
+ enum pipe_format formats[] = {
+- PIPE_FORMAT_R8G8B8A8_UNORM,
+- PIPE_FORMAT_B8G8R8A8_UNORM,
++ PIPE_FORMAT_ABGR8888_UNORM,
++ PIPE_FORMAT_ARGB8888_UNORM,
+ PIPE_FORMAT_NONE
+ };
+
+diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
+index e59377f..0269ae0 100644
+--- a/src/gallium/tests/graw/fs-test.c
++++ b/src/gallium/tests/graw/fs-test.c
+@@ -31,8 +31,8 @@ static void usage(char *name)
+
+
+ enum pipe_format formats[] = {
+- PIPE_FORMAT_R8G8B8A8_UNORM,
+- PIPE_FORMAT_B8G8R8A8_UNORM,
++ PIPE_FORMAT_ABGR8888_UNORM,
++ PIPE_FORMAT_ARGB8888_UNORM,
+ PIPE_FORMAT_NONE
+ };
+
+diff --git a/src/gallium/tests/graw/graw_util.h b/src/gallium/tests/graw/graw_util.h
+index febdf44..08f18f7 100644
+--- a/src/gallium/tests/graw/graw_util.h
++++ b/src/gallium/tests/graw/graw_util.h
+@@ -32,8 +32,8 @@ graw_util_create_window(struct graw_info *info,
+ int num_cbufs, bool zstencil_buf)
+ {
+ static const enum pipe_format formats[] = {
+- PIPE_FORMAT_R8G8B8A8_UNORM,
+- PIPE_FORMAT_B8G8R8A8_UNORM,
++ PIPE_FORMAT_ABGR8888_UNORM,
++ PIPE_FORMAT_ARGB8888_UNORM,
+ PIPE_FORMAT_NONE
+ };
+ enum pipe_format format;
+@@ -226,7 +226,7 @@ graw_util_create_tex2d(const struct graw_info *info,
+ struct pipe_box box;
+
+ temp.target = PIPE_TEXTURE_2D;
+- temp.format = PIPE_FORMAT_B8G8R8A8_UNORM;
++ temp.format = format;
+ temp.width0 = width;
+ temp.height0 = height;
+ temp.depth0 = 1;
+diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c
+index dd2865d..cfc4129 100644
+--- a/src/gallium/tests/graw/quad-sample.c
++++ b/src/gallium/tests/graw/quad-sample.c
+@@ -18,8 +18,8 @@
+ #include <stdio.h>
+
+ enum pipe_format formats[] = {
+- PIPE_FORMAT_R8G8B8A8_UNORM,
+- PIPE_FORMAT_B8G8R8A8_UNORM,
++ PIPE_FORMAT_ABGR8888_UNORM,
++ PIPE_FORMAT_ARGB8888_UNORM,
+ PIPE_FORMAT_NONE
+ };
+
+diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c
+index 9c6e0eb..1fdfb95 100644
+--- a/src/gallium/tests/graw/shader-leak.c
++++ b/src/gallium/tests/graw/shader-leak.c
+@@ -18,8 +18,8 @@ static int num_iters = 100;
+
+
+ enum pipe_format formats[] = {
+- PIPE_FORMAT_R8G8B8A8_UNORM,
+- PIPE_FORMAT_B8G8R8A8_UNORM,
++ PIPE_FORMAT_ABGR8888_UNORM,
++ PIPE_FORMAT_ARGB8888_UNORM,
+ PIPE_FORMAT_NONE
+ };
+
+diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c
+index 03b5234..0bb45fb 100644
+--- a/src/gallium/tests/graw/tri-gs.c
++++ b/src/gallium/tests/graw/tri-gs.c
+@@ -14,8 +14,8 @@
+ #include "util/u_inlines.h"
+
+ enum pipe_format formats[] = {
+- PIPE_FORMAT_R8G8B8A8_UNORM,
+- PIPE_FORMAT_B8G8R8A8_UNORM,
++ PIPE_FORMAT_ABGR8888_UNORM,
++ PIPE_FORMAT_ARGB8888_UNORM,
+ PIPE_FORMAT_NONE
+ };
+
+diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c
+index 901ac86..41caae9 100644
+--- a/src/gallium/tests/graw/tri-instanced.c
++++ b/src/gallium/tests/graw/tri-instanced.c
+@@ -17,8 +17,8 @@
+
+
+ enum pipe_format formats[] = {
+- PIPE_FORMAT_R8G8B8A8_UNORM,
+- PIPE_FORMAT_B8G8R8A8_UNORM,
++ PIPE_FORMAT_ABGR8888_UNORM,
++ PIPE_FORMAT_ARGB8888_UNORM,
+ PIPE_FORMAT_NONE
+ };
+
+diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c
+index 1ab6732..d63372d 100644
+--- a/src/gallium/tests/graw/vs-test.c
++++ b/src/gallium/tests/graw/vs-test.c
+@@ -32,8 +32,8 @@ static void usage(char *name)
+
+
+ enum pipe_format formats[] = {
+- PIPE_FORMAT_R8G8B8A8_UNORM,
+- PIPE_FORMAT_B8G8R8A8_UNORM,
++ PIPE_FORMAT_ABGR8888_UNORM,
++ PIPE_FORMAT_ARGB8888_UNORM,
+ PIPE_FORMAT_NONE
+ };
+
+diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
+index c9c6163..719acde 100644
+--- a/src/mesa/state_tracker/st_format.c
++++ b/src/mesa/state_tracker/st_format.c
+@@ -55,21 +55,21 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
+ {
+ switch (mesaFormat) {
+ case MESA_FORMAT_RGBA8888:
+- return PIPE_FORMAT_A8B8G8R8_UNORM;
++ return PIPE_FORMAT_RGBA8888_UNORM;
+ case MESA_FORMAT_RGBA8888_REV:
+- return PIPE_FORMAT_R8G8B8A8_UNORM;
++ return PIPE_FORMAT_ABGR8888_UNORM;
+ case MESA_FORMAT_ARGB8888:
+- return PIPE_FORMAT_B8G8R8A8_UNORM;
++ return PIPE_FORMAT_ARGB8888_UNORM;
+ case MESA_FORMAT_ARGB8888_REV:
+- return PIPE_FORMAT_A8R8G8B8_UNORM;
++ return PIPE_FORMAT_BGRA8888_UNORM;
+ case MESA_FORMAT_RGBX8888:
+- return PIPE_FORMAT_X8B8G8R8_UNORM;
++ return PIPE_FORMAT_RGBX8888_UNORM;
+ case MESA_FORMAT_RGBX8888_REV:
+- return PIPE_FORMAT_R8G8B8X8_UNORM;
++ return PIPE_FORMAT_XBGR8888_UNORM;
+ case MESA_FORMAT_XRGB8888:
+- return PIPE_FORMAT_B8G8R8X8_UNORM;
++ return PIPE_FORMAT_XRGB8888_UNORM;
+ case MESA_FORMAT_XRGB8888_REV:
+- return PIPE_FORMAT_X8R8G8B8_UNORM;
++ return PIPE_FORMAT_BGRX8888_UNORM;
+ case MESA_FORMAT_ARGB1555:
+ return PIPE_FORMAT_B5G5R5A1_UNORM;
+ case MESA_FORMAT_ARGB4444:
+@@ -401,21 +401,21 @@ gl_format
+ st_pipe_format_to_mesa_format(enum pipe_format format)
+ {
+ switch (format) {
+- case PIPE_FORMAT_A8B8G8R8_UNORM:
++ case PIPE_FORMAT_RGBA8888_UNORM:
+ return MESA_FORMAT_RGBA8888;
+- case PIPE_FORMAT_R8G8B8A8_UNORM:
++ case PIPE_FORMAT_ABGR8888_UNORM:
+ return MESA_FORMAT_RGBA8888_REV;
+- case PIPE_FORMAT_B8G8R8A8_UNORM:
++ case PIPE_FORMAT_ARGB8888_UNORM:
+ return MESA_FORMAT_ARGB8888;
+- case PIPE_FORMAT_A8R8G8B8_UNORM:
++ case PIPE_FORMAT_BGRA8888_UNORM:
+ return MESA_FORMAT_ARGB8888_REV;
+- case PIPE_FORMAT_X8B8G8R8_UNORM:
++ case PIPE_FORMAT_RGBX8888_UNORM:
+ return MESA_FORMAT_RGBX8888;
+- case PIPE_FORMAT_R8G8B8X8_UNORM:
++ case PIPE_FORMAT_XBGR8888_UNORM:
+ return MESA_FORMAT_RGBX8888_REV;
+- case PIPE_FORMAT_B8G8R8X8_UNORM:
++ case PIPE_FORMAT_XRGB8888_UNORM:
+ return MESA_FORMAT_XRGB8888;
+- case PIPE_FORMAT_X8R8G8B8_UNORM:
++ case PIPE_FORMAT_BGRX8888_UNORM:
+ return MESA_FORMAT_XRGB8888_REV;
+ case PIPE_FORMAT_B5G5R5A1_UNORM:
+ return MESA_FORMAT_ARGB1555;
+@@ -1521,12 +1521,12 @@ struct exact_format_mapping
+
+ static const struct exact_format_mapping rgba8888_tbl[] =
+ {
+- { GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_A8B8G8R8_UNORM },
+- { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_A8B8G8R8_UNORM },
+- { GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_R8G8B8A8_UNORM },
+- { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_R8G8B8A8_UNORM },
+- { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_A8R8G8B8_UNORM },
+- { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_B8G8R8A8_UNORM },
++ { GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_RGBA8888_UNORM },
++ { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_RGBA8888_UNORM },
++ { GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_ABGR8888_UNORM },
++ { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_ABGR8888_UNORM },
++ { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_BGRA8888_UNORM },
++ { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_ARGB8888_UNORM },
+ { GL_RGBA, GL_UNSIGNED_BYTE, PIPE_FORMAT_R8G8B8A8_UNORM },
+ { GL_ABGR_EXT, GL_UNSIGNED_BYTE, PIPE_FORMAT_A8B8G8R8_UNORM },
+ { GL_BGRA, GL_UNSIGNED_BYTE, PIPE_FORMAT_B8G8R8A8_UNORM },
+@@ -1535,15 +1535,15 @@ static const struct exact_format_mapping rgba8888_tbl[] =
+
+ static const struct exact_format_mapping rgbx8888_tbl[] =
+ {
+- { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_X8R8G8B8_UNORM },
+- { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_B8G8R8X8_UNORM },
+- { GL_BGRA, GL_UNSIGNED_BYTE, PIPE_FORMAT_B8G8R8X8_UNORM },
+- { GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_X8B8G8R8_UNORM },
+- { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_X8B8G8R8_UNORM },
+- { GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_R8G8B8X8_UNORM },
+- { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_R8G8B8X8_UNORM },
++ { GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_RGBX8888_UNORM },
++ { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_RGBX8888_UNORM },
++ { GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_XBGR8888_UNORM },
++ { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_XBGR8888_UNORM },
++ { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, PIPE_FORMAT_BGRX8888_UNORM },
++ { GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, PIPE_FORMAT_XRGB8888_UNORM },
+ { GL_RGBA, GL_UNSIGNED_BYTE, PIPE_FORMAT_R8G8B8X8_UNORM },
+ { GL_ABGR_EXT, GL_UNSIGNED_BYTE, PIPE_FORMAT_X8B8G8R8_UNORM },
++ { GL_BGRA, GL_UNSIGNED_BYTE, PIPE_FORMAT_B8G8R8X8_UNORM },
+ { 0, 0, 0 }
+ };
+
+diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
+index ff52aa1..1f8b941 100644
+--- a/src/mesa/state_tracker/st_manager.c
++++ b/src/mesa/state_tracker/st_manager.c
+@@ -532,7 +532,7 @@ st_context_teximage(struct st_context_iface *stctxi,
+ internalFormat = GL_RGB;
+
+ texFormat = st_ChooseTextureFormat(ctx, target, internalFormat,
+- GL_BGRA, GL_UNSIGNED_BYTE);
++ GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV);
+
+ _mesa_init_teximage_fields(ctx, texImage,
+ tex->width0, tex->height0, 1, 0,
diff --git a/mesa-9.2-no-useless-vdpau.patch b/mesa-9.2-no-useless-vdpau.patch
new file mode 100644
index 0000000..0be3d3a
--- /dev/null
+++ b/mesa-9.2-no-useless-vdpau.patch
@@ -0,0 +1,27 @@
+Neither of these drivers does anything on-GPU, so, no.
+
+diff -up mesa-20130508/src/gallium/targets/Makefile.am.jx mesa-20130508/src/gallium/targets/Makefile.am
+--- mesa-20130508/src/gallium/targets/Makefile.am.jx 2013-05-08 13:23:41.000000000 -0400
++++ mesa-20130508/src/gallium/targets/Makefile.am 2013-05-08 14:59:50.897835932 -0400
+@@ -78,10 +78,6 @@ endif
+ if HAVE_ST_XVMC
+ SUBDIRS += xvmc-r300
+ endif
+-
+-if HAVE_ST_VDPAU
+-SUBDIRS += vdpau-r300
+-endif
+ endif
+
+ if HAVE_GALLIUM_R600
+@@ -142,10 +138,6 @@ endif
+ if HAVE_ST_XVMC
+ SUBDIRS += xvmc-softpipe
+ endif
+-
+-if HAVE_ST_VDPAU
+-SUBDIRS += vdpau-softpipe
+-endif
+ endif
+
+ if NEED_GALLIUM_LOADER
diff --git a/mesa.spec b/mesa.spec
index 562e412..2782529 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -16,14 +16,8 @@
# S390 doesn't have video cards, but we need swrast for xserver's GLX
%ifarch s390 s390x
%define with_hardware 0
-%define dri_drivers --with-dri-drivers=swrast
+%define dri_drivers --with-dri-drivers=
%else
-# llvm support only works on some arches (ppc back off for the moment)
-%ifarch %{ix86} x86_64 %{arm}
-%define with_llvm 1
-%else
-%define swrastc ,swrast
-%endif
%define with_hardware 1
%define base_drivers nouveau,radeon,r200
%ifarch %{ix86}
@@ -34,28 +28,28 @@
%define platform_drivers ,i915,i965
%define with_vmware 1
%endif
-%ifarch ia64
-%define platform_drivers ,i915
-%endif
-%define dri_drivers --with-dri-drivers=%{base_drivers}%{?platform_drivers}%{?swrastc}
+%define dri_drivers --with-dri-drivers=%{base_drivers}%{?platform_drivers}
%endif
%define _default_patch_fuzz 2
-#define gitdate 20130213
+%define gitdate 20130508
#% define snapshot
Summary: Mesa graphics libraries
Name: mesa
-Version: 9.1.1
-Release: 1%{?dist}
+Version: 9.2
+Release: 0.1.%{gitdate}%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.mesa3d.org
#Source0: http://www.mesa3d.org/beta/MesaLib-%{version}%{?snapshot}.tar.bz2
-Source0: ftp://ftp.freedesktop.org/pub/%{name}/%{version}/MesaLib-%{version}.tar.bz2
-#Source0: %{name}-%{gitdate}.tar.xz
+#Source0: ftp://ftp.freedesktop.org/pub/%{name}/%{version}/MesaLib-%{version}.tar.bz2
+# Source0: MesaLib-%{version}.tar.xz
+Source0: %{name}-%{gitdate}.tar.xz
+Source1: sanitize-tarball.sh
+Source2: make-release-tarball.sh
Source3: make-git-snapshot.sh
# src/gallium/auxiliary/postprocess/pp_mlaa* have an ... interestingly worded license.
@@ -67,13 +61,15 @@ Source4: Mesa-MLAA-License-Clarification-Email.txt
Patch0: mesa-9.1.1-53-g3cff41c.patch
Patch1: nv50-fix-build.patch
-Patch2: intel-revert-gl3.patch
-#Patch7: mesa-7.1-link-shared.patch
Patch9: mesa-8.0-llvmpipe-shmget.patch
-#Patch11: mesa-8.0-nouveau-tfp-blacklist.patch
Patch12: mesa-8.0.1-fix-16bpp.patch
Patch14: i965-hack-hiz-snb-fix.patch
-Patch15: 0001-llvmpipe-Work-without-sse2-if-llvm-is-new-enough.patch
+Patch15: mesa-9.2-hardware-float.patch
+Patch16: mesa-9.2-no-useless-vdpau.patch
+# this is suboptimal, or so dave says:
+# http://lists.freedesktop.org/archives/mesa-dev/2013-May/039169.html
+Patch17: 0001-mesa-Be-less-casual-about-texture-formats-in-st_fina.patch
+Patch18: mesa-9.2-llvmpipe-on-big-endian.patch
BuildRequires: pkgconfig autoconf automake libtool
%if %{with_hardware}
@@ -94,15 +90,12 @@ BuildRequires: libXmu-devel
BuildRequires: elfutils
BuildRequires: python
BuildRequires: gettext
-%if %{with_hardware}
-%if 0%{?with_llvm}
%if 0%{?with_private_llvm}
BuildRequires: mesa-private-llvm-devel
%else
BuildRequires: llvm-devel >= 3.0
%endif
-%endif
-%endif
+BuildRequires: elfutils-libelf-devel
BuildRequires: libxml2-python
BuildRequires: libudev-devel
BuildRequires: bison flex
@@ -111,6 +104,7 @@ BuildRequires: pkgconfig(wayland-client) >= %{min_wayland_version}
BuildRequires: pkgconfig(wayland-server) >= %{min_wayland_version}
%endif
BuildRequires: mesa-libGL-devel
+BuildRequires: libvdpau-devel
%description
Mesa
@@ -119,11 +113,6 @@ Mesa
Summary: Mesa libGL runtime libraries and DRI drivers
Group: System Environment/Libraries
Provides: libGL
-# F17+'s libX11 changes extension libs to use _XGetRequest(), so if we built
-# against that, require it too
-%if 0%{?fedora} > 16
-Requires: libX11 >= 1.4.99.1
-%endif
%description libGL
Mesa libGL runtime library.
@@ -158,6 +147,13 @@ Obsoletes: mesa-dri-llvmcore <= 7.12
%description dri-drivers
Mesa-based DRI drivers.
+%package vdpau-drivers
+Summary: Mesa-based DRI drivers
+Group: User Interface/X Hardware Support
+Requires: mesa-dri-filesystem%{?_isa}
+%description vdpau-drivers
+Mesa-based VDPAU drivers.
+
%package -n khrplatform-devel
Summary: Khronos platform development package
Group: Development/Libraries
@@ -280,12 +276,11 @@ Group: System Environment/Libraries
Mesa shared glapi
%prep
-%setup -q -n Mesa-%{version}%{?snapshot}
-#setup -q -n mesa-%{gitdate}
-%patch0 -p1 -b .git
+#setup -q -n Mesa-%{version}%{?snapshot}
+%setup -q -n mesa-%{gitdate}
+grep -q ^/ src/gallium/auxiliary/vl/vl_decoder.c && exit 1
+#patch0 -p1 -b .git
%patch1 -p1 -b .nv50rtti
-%patch2 -p1 -b .nogl3
-#%patch11 -p1 -b .nouveau
# this fastpath is:
# - broken with swrast classic
@@ -300,10 +295,11 @@ Mesa shared glapi
# hack from chromium - awaiting real upstream fix
%patch14 -p1 -b .snbfix
-%patch15 -p1 -b .sse2
-# default to dri (not xlib) for libGL on all arches
-# XXX please fix upstream
-sed -i 's/^default_driver.*$/default_driver="dri"/' configure.ac
+
+%patch15 -p1 -b .hwfloat
+%patch16 -p1 -b .vdpau
+%patch17 -p1 -b .tfp
+%patch18 -p1 -b .be
%if 0%{with_private_llvm}
sed -i 's/llvm-config/mesa-private-llvm-config-%{__isa_bits}/g' configure.ac
@@ -339,30 +335,27 @@ export CXXFLAGS="$RPM_OPT_FLAGS -fno-rtti -fno-exceptions"
%configure %{common_flags} \
--enable-osmesa \
- --enable-xcb \
--with-dri-driverdir=%{_libdir}/dri \
--enable-egl \
- --enable-gles1 \
+ --disable-gles1 \
--enable-gles2 \
--disable-gallium-egl \
+ --disable-xvmc \
+ --enable-vdpau \
--with-egl-platforms=x11,drm%{?with_wayland:,wayland} \
--enable-shared-glapi \
--enable-gbm \
--disable-opencl \
--enable-glx-tls \
+ --enable-texture-float=hardware \
+ --enable-gallium-llvm \
+ --with-llvm-shared-libs \
+ --enable-dri \
%if %{with_hardware}
%{?with_vmware:--enable-xa} \
-%if 0%{?with_llvm}
--with-gallium-drivers=%{?with_vmware:svga,}r300,r600,%{?with_radeonsi:radeonsi,}nouveau,swrast \
- --enable-gallium-llvm \
- --with-llvm-shared-libs \
%else
- --with-gallium-drivers=%{?with_vmware:svga,}r300,r600,nouveau \
-%endif
-%else
- --disable-gallium-llvm \
- --with-gallium-drivers= \
- --enable-dri \
+ --with-gallium-drivers=swrast \
%endif
%{?dri_drivers}
@@ -371,22 +364,15 @@ make %{?_smp_mflags} MKDEP=/bin/true
%install
rm -rf $RPM_BUILD_ROOT
-# core libs and headers, but not drivers.
-make install DESTDIR=$RPM_BUILD_ROOT DRI_DIRS=
-
-# not installed by make install, grr
-mkdir -p $RPM_BUILD_ROOT%{_includedir}/KHR
-install -m 0644 include/KHR/*.h $RPM_BUILD_ROOT%{_includedir}/KHR
+make install DESTDIR=$RPM_BUILD_ROOT
%if 0%{?rhel}
# remove pre-DX9 drivers
rm -f $RPM_BUILD_ROOT%{_libdir}/dri/{radeon,r200,nouveau_vieux}_dri.*
%endif
-# strip out undesirable headers
-pushd $RPM_BUILD_ROOT%{_includedir}/GL
-rm -f [vw]*.h
-popd
+# strip out useless headers
+rm -f $RPM_BUILD_ROOT%{_includedir}/GL/w*.h
# remove .la files
find $RPM_BUILD_ROOT -name \*.la | xargs rm -f
@@ -439,8 +425,6 @@ rm -rf $RPM_BUILD_ROOT
%files libGLES
%defattr(-,root,root,-)
%doc docs/COPYING
-%{_libdir}/libGLESv1_CM.so.1
-%{_libdir}/libGLESv1_CM.so.1.*
%{_libdir}/libGLESv2.so.2
%{_libdir}/libGLESv2.so.2.*
@@ -448,6 +432,7 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root,-)
%doc docs/COPYING docs/Mesa-MLAA-License-Clarification-Email.txt
%dir %{_libdir}/dri
+%dir %{_libdir}/vdpau
%files libglapi
%{_libdir}/libglapi.so.0
@@ -464,16 +449,13 @@ rm -rf $RPM_BUILD_ROOT
%endif
%{_libdir}/dri/r300_dri.so
%{_libdir}/dri/r600_dri.so
-%if 0%{?with_llvm} && 0%{?with_radeonsi}
+%if 0%{?with_radeonsi}
%{_libdir}/dri/radeonsi_dri.so
-%{_libdir}/libllvmradeon9.1.1.so
%endif
-%ifarch %{ix86} x86_64 ia64
+%ifarch %{ix86} x86_64
%{_libdir}/dri/i915_dri.so
-%ifnarch ia64
%{_libdir}/dri/i965_dri.so
%endif
-%endif
%{_libdir}/dri/nouveau_dri.so
%if 0%{?with_vmware}
%{_libdir}/dri/vmwgfx_dri.so
@@ -484,6 +466,13 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libdricore*.so*
%{_libdir}/dri/swrast_dri.so
+%if %{with_hardware}
+# should be explicit here but meh
+%files vdpau-drivers
+%defattr(-,root,root,-)
+%{_libdir}/vdpau/*.so*
+%endif
+
%files -n khrplatform-devel
%defattr(-,root,root,-)
%{_includedir}/KHR
@@ -517,11 +506,6 @@ rm -rf $RPM_BUILD_ROOT
%files libGLES-devel
%defattr(-,root,root,-)
-%dir %{_includedir}/GLES
-%{_includedir}/GLES/egl.h
-%{_includedir}/GLES/gl.h
-%{_includedir}/GLES/glext.h
-%{_includedir}/GLES/glplatform.h
%dir %{_includedir}/GLES2
%{_includedir}/GLES2/gl2platform.h
%{_includedir}/GLES2/gl2.h
@@ -529,9 +513,7 @@ rm -rf $RPM_BUILD_ROOT
%{_includedir}/GLES3/gl3platform.h
%{_includedir}/GLES3/gl3.h
%{_includedir}/GLES3/gl3ext.h
-%{_libdir}/pkgconfig/glesv1_cm.pc
%{_libdir}/pkgconfig/glesv2.pc
-%{_libdir}/libGLESv1_CM.so
%{_libdir}/libGLESv2.so
%files libOSMesa
@@ -592,6 +574,13 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
+* Wed May 08 2013 Adam Jackson <ajax@redhat.com> 9.2-0.1.20130508
+- Switch to Mesa master (pre 9.2)
+- Fix llvmpipe on big-endian and enable llvmpipe everywhere
+- Build vdpau drivers for r600/radeonsi/nouveau
+- Enable hardware floating-point texture support
+- Drop GLESv1, nothing's using it, let's not start
+
* Sat Apr 27 2013 Dave Airlie <airlied@redhat.com> 9.1.1-1
- rebase to Mesa 9.1.1 + fixes from git
diff --git a/sanitize-tarball.sh b/sanitize-tarball.sh
new file mode 100755
index 0000000..77b6aef
--- /dev/null
+++ b/sanitize-tarball.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# usage: sanitize-tarball.sh [tarball]
+
+dirname=$(basename $(basename "$1" .tar.bz2) .tar.xz)
+
+tar xf "$1"
+pushd $dirname
+
+cat > src/gallium/auxiliary/vl/vl_mpeg12_decoder.c << EOF
+#include "vl_mpeg12_decoder.h"
+struct pipe_video_decoder *
+vl_create_mpeg12_decoder(struct pipe_context *context,
+ enum pipe_video_profile profile,
+ enum pipe_video_entrypoint entrypoint,
+ enum pipe_video_chroma_format chroma_format,
+ unsigned width, unsigned height,
+ unsigned max_references,
+ bool expect_chunked_decode)
+{
+ return NULL;
+}
+EOF
+
+cat > src/gallium/auxiliary/vl/vl_decoder.c << EOF
+#include "vl_decoder.h"
+bool vl_profile_supported(struct pipe_screen *screen,
+ enum pipe_video_profile profile)
+{
+ return false;
+}
+struct pipe_video_decoder *
+vl_create_decoder(struct pipe_context *pipe,
+ enum pipe_video_profile profile,
+ enum pipe_video_entrypoint entrypoint,
+ enum pipe_video_chroma_format chroma_format,
+ unsigned width, unsigned height, unsigned max_references,
+ bool expect_chunked_decode)
+{
+ return NULL;
+}
+EOF
+
+popd
+tar Jcf $dirname.tar.xz $dirname
diff --git a/sources b/sources
index 7ecd241..cd9670a 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-6ea2bdc3b7ecfb4257b39814b4182580 MesaLib-9.1.1.tar.bz2
+50ffa2d23bc11686e29e836013ef917f mesa-20130508.tar.xz