[Mesa-dev] [Bug 44697] Update from 7.12 to 8 (git) breaks compiz/unity

2012-03-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44697

arno.b  changed:

   What|Removed |Added

 Status|NEEDINFO|RESOLVED
 Resolution||FIXED

--- Comment #4 from arno.b  2012-03-14 01:22:59 PDT ---
Because I purged Nouveau drivers I cannot answer your question.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 47304] New: docs/banner.html is invalid

2012-03-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=47304

 Bug #: 47304
   Summary: docs/banner.html is invalid
Classification: Unclassified
   Product: Mesa
   Version: 8.0
  Platform: x86-64 (AMD64)
   URL: http://mesa3d.org/banner.html
OS/Version: Linux (All)
Status: NEW
  Severity: minor
  Priority: medium
 Component: Mesa core
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: giecr...@stegny.2a.pl


+ tidy banner.html 
line 8 column 1 - Warning:  lacks "summary" attribute
line 13 column 10 - Warning:  lacks "alt" attribute
line 18 column 10 - Warning:  lacks "alt" attribute

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 47304] docs/banner.html is invalid

2012-03-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=47304

--- Comment #1 from Christopher Yeleighton  2012-03-14 
05:21:09 PDT ---
Created attachment 58428
  --> https://bugs.freedesktop.org/attachment.cgi?id=58428
upgrade markup

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Is Mesa on win32 thread safe?

2012-03-14 Thread Jose Fonseca
I believe this was fixed in master with commit: 

commit 4a72d859b4f8d0444eb7f38606d59d7ddc9ea8fa 
Author: Brian Paul  
Date: Thu Feb 16 12:25:22 2012 -0700 

util: add mutex lock in u_debug_memory.c code 

The linked list of memory allocations was not protected by a mutex. 
This lead to sporadic failures with multi-threaded apps. 

Reviewed-by: Jose Fonseca  

I've crossported to 8.0 branch. 

In general Mesa is thread safe, but I don't think it has received much testing 
with multi-threaded apps, so it's likely there are issues. 

Jose 
- Original Message -

> Hi,

> Is Mesa 8.0 implementation on windows thread safe?

> I have some test code that is doing rendering in parallel threads
> using debug build of opengl32.dll and it is crashing in debug_free
> on list_del operation.

> The implementation of u_double_list.h does not seem to be thread
> safe, so I believe if concurrent debug_free/debug_malloc happen it
> can cause crashes. Is it possible or is there proper locking
> somewhere up in the calling stack?

> Thanks,
> Juraj
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 47304] docs/banner.html is invalid

2012-03-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=47304

Brian Paul  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #2 from Brian Paul  2012-03-14 07:10:13 PDT 
---
Committed as ea738548e58a76547a5cdd4b38ad354314c40e77

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallivm: Fix createOProfileJITEventListener namespace with llvm-3.1.

2012-03-14 Thread Brian Paul
On Tue, Mar 13, 2012 at 11:50 PM, Vinson Lee  wrote:
> llvm-3.1svn r15620 refactored the OProfile profiling code.
> createOProfileJITEventListener was moved from the llvm namespace to the
> llvm::JITEventListener namespace.
>
> Signed-off-by: Vinson Lee 
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp |    4 
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp 
> b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> index fe7616b..68f8808 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -62,7 +62,11 @@
>  extern "C" void
>  lp_register_oprofile_jit_event_listener(LLVMExecutionEngineRef EE)
>  {
> +#if HAVE_LLVM >= 0x0301
> +   
> llvm::unwrap(EE)->RegisterJITEventListener(llvm::JITEventListener::createOProfileJITEventListener());
> +#else
>    
> llvm::unwrap(EE)->RegisterJITEventListener(llvm::createOProfileJITEventListener());
> +#endif
>  }
>

Looks OK to me.

Reviewed-by: Brian Paul 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] autoconf: bail out if flex isn't found

2012-03-14 Thread Brian Paul
On Tue, Mar 13, 2012 at 9:14 PM, Matt Turner  wrote:
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=47248
> Signed-off-by: Matt Turner 
> ---
>  configure.ac |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index a2d906a..e7994b0 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -66,6 +66,9 @@ if test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.y"; then
>     fi
>  fi
>  AC_PROG_LEX
> +if test "x$LEX" != xflex; then
> +    AC_MSG_ERROR([flex not found - unable to compile glcpp-lex.l])
> +fi


What if the system actually has lex?  Would that work?  Do our .l
files use any flex-specific features?

-Brian
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: fix compiling warning from gcc 4.7

2012-03-14 Thread Brian Paul

On 03/13/2012 10:05 AM, Dave Airlie wrote:

From: Dave Airlie

ir_validate.cpp: In member function ‘virtual ir_visitor_status 
ir_validate::visit_leave(ir_swizzle*)’:
ir_validate.cpp:458:66: warning: narrowing conversion of 
‘ir->ir_swizzle::mask.ir_swizzle_mask::x’ from ‘unsigned int’ to ‘int’ inside { 
} is ill-formed in C++11 [-Wnarrowing]
ir_validate.cpp:458:66: warning: narrowing conversion of 
‘ir->ir_swizzle::mask.ir_swizzle_mask::y’ from ‘unsigned int’ to ‘int’ inside { 
} is ill-formed in C++11 [-Wnarrowing]
ir_validate.cpp:458:66: warning: narrowing conversion of 
‘ir->ir_swizzle::mask.ir_swizzle_mask::z’ from ‘unsigned int’ to ‘int’ inside { 
} is ill-formed in C++11 [-Wnarrowing]
ir_validate.cpp:458:66: warning: narrowing conversion of 
‘ir->ir_swizzle::mask.ir_swizzle_mask::w’ from ‘unsigned int’ to ‘int’ inside { 
} is ill-formed in C++11 [-Wnarrowing]

Signed-off-by: Dave Airlie
---
  src/glsl/ir_validate.cpp |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 20a0377..101d999 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -455,7 +455,7 @@ ir_validate::visit_leave(ir_expression *ir)
  ir_visitor_status
  ir_validate::visit_leave(ir_swizzle *ir)
  {
-   int chans[4] = {ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w};
+   unsigned int chans[4] = {ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w};

 for (unsigned int i = 0; i<  ir->type->vector_elements; i++) {
if (chans[i]>= ir->val->type->vector_elements) {


Looks OK to me.

Reviewed-by: Brian Paul 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] autoconf: bail out if flex isn't found

2012-03-14 Thread Kenneth Graunke

On 03/14/2012 07:20 AM, Brian Paul wrote:

On Tue, Mar 13, 2012 at 9:14 PM, Matt Turner  wrote:

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=47248
Signed-off-by: Matt Turner
---
  configure.ac |3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index a2d906a..e7994b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,9 @@ if test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.y"; then
 fi
  fi
  AC_PROG_LEX
+if test "x$LEX" != xflex; then
+AC_MSG_ERROR([flex not found - unable to compile glcpp-lex.l])
+fi



What if the system actually has lex?  Would that work?  Do our .l
files use any flex-specific features?

-Brian


Yes, absolutely.  Bison as well.

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa (master): glsl: Avoid extra if statements for logic and/ or with no side effects.

2012-03-14 Thread Jose Fonseca
This commit caused the piglit tests

  glsl-algebraic-logicand-false-2
  glsl-algebraic-logicor-true

to start failing on llvmpipe.  Not sure if this is failing for all drivers or 
just llvmpipe/gallium.

Jose

- Original Message -
> Module: Mesa
> Branch: master
> Commit: ead3589aa2810b66164178a1d55d2063cfa3b041
> URL:
>
> http://cgit.freedesktop.org/mesa/mesa/commit/?id=ead3589aa2810b66164178a1d55d2063cfa3b041
> 
> Author: Eric Anholt 
> Date:   Tue Feb  7 22:59:24 2012 -0800
> 
> glsl: Avoid extra if statements for logic and/or with no side
> effects.
> 
> This avoids extra if statements in the common case of just comparing
> two expressions that don't involve assignments or function calls,
> along with simplifying the handling of constant expressions.  Reduces
> i965 instructions generated in unigine tropics and sanctuary,
> yofrankie, warsow, gstreamer shaders, and the weston compositor.
> 
> shader-db results:
> Total instructions: 213052 -> 212752
> 38/1246 programs affected (3.0%)
> 14309 -> 14009 instructions in affected programs (2.1% reduction)
> 
> ---
> 
>  src/glsl/ast_to_hir.cpp |   23 ++-
>  1 files changed, 6 insertions(+), 17 deletions(-)
> 
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index c580359..75d7e9d 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -1199,15 +1199,9 @@ ast_expression::hir(exec_list *instructions,
>op[1] = get_scalar_boolean_operand(&rhs_instructions, state,
>this, 1,
>"RHS", &error_emitted);
>  
> -  ir_constant *op0_const = op[0]->constant_expression_value();
> -  if (op0_const) {
> -  if (op0_const->value.b[0]) {
> - instructions->append_list(&rhs_instructions);
> - result = op[1];
> -  } else {
> - result = op0_const;
> -  }
> -  type = glsl_type::bool_type;
> +  if (rhs_instructions.is_empty()) {
> +  result = new(ctx) ir_expression(ir_binop_logic_and, op[0], op[1]);
> +  type = result->type;
>} else {
>ir_variable *const tmp = new(ctx)
>ir_variable(glsl_type::bool_type,
>  "and_tmp",
> @@ -1241,14 +1235,9 @@ ast_expression::hir(exec_list *instructions,
>op[1] = get_scalar_boolean_operand(&rhs_instructions, state,
>this, 1,
>"RHS", &error_emitted);
>  
> -  ir_constant *op0_const = op[0]->constant_expression_value();
> -  if (op0_const) {
> -  if (op0_const->value.b[0]) {
> - result = op0_const;
> -  } else {
> - result = op[1];
> -  }
> -  type = glsl_type::bool_type;
> +  if (rhs_instructions.is_empty()) {
> +  result = new(ctx) ir_expression(ir_binop_logic_or, op[0], op[1]);
> +  type = result->type;
>} else {
>ir_variable *const tmp = new(ctx)
>ir_variable(glsl_type::bool_type,
>  "or_tmp",
> 
> ___
> mesa-commit mailing list
> mesa-com...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-commit
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa (master): glsl: Avoid extra if statements for logic and/ or with no side effects.

2012-03-14 Thread Eric Anholt
On Wed, 14 Mar 2012 11:38:09 -0700 (PDT), Jose Fonseca  
wrote:
> This commit caused the piglit tests
> 
>   glsl-algebraic-logicand-false-2
>   glsl-algebraic-logicor-true
> 
> to start failing on llvmpipe.  Not sure if this is failing for all drivers or 
> just llvmpipe/gallium.

Sounds like you're running a stale piglit.


pgpjsLNLGDLhX.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 47324] New: [Intel HD3000] OpenGL content is not rendered correctly in Gnome fall-back mode

2012-03-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=47324

 Bug #: 47324
   Summary: [Intel HD3000] OpenGL content is not rendered
correctly in Gnome fall-back mode
Classification: Unclassified
   Product: Mesa
   Version: 8.0
  Platform: x86-64 (AMD64)
OS/Version: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Other
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: li...@foxmail.com


Created attachment 58453
  --> https://bugs.freedesktop.org/attachment.cgi?id=58453
screenshot of Google Earth under Gnome fall-back mode

The OpenGL content is not displayed correctly in Gnome fall-back mode. Only
right up corner of the content is available. When the window is dragged the
position of available content is fixed, and the other part keeps black or
nothing. For example, when the Google Earth window is dragged to the right part
of the screen there is no 3D content displayed in the window.
The same problem happened with glxgears, glxspheres, etc.
While glxgears can be seen when the window is inside a very small region of the
left up corner of the screen, glxspheres can displayed when the window is
inside a much larger part of the left up part of the screen.


1) System environment:
-- chipset: Intel HD Graphics 3000
-- system architecture: x86_64
-- xf86-video-intel version: 2.18.0
   xserver version: 7.6
   Mesa version: 8.0.1
   libdrm versoin: 2.4.31
-- kernel version: 3.2.0-18-generic
-- Linux distribution: 
 DISTRIB_ID=Ubuntu
 DISTRIB_RELEASE=12.04
 DISTRIB_CODENAME=precise
 DISTRIB_DESCRIPTION="Ubuntu precise (development branch)"
-- Machine or mobo model: Hasee K580P
-- Display connector: Laptop LED
2) Reproduce steps:
Just run any OpenGL program under Gnome fall-back mode or Unity 2D mode.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 47324] [Intel HD3000] OpenGL content is not rendered correctly in Gnome fall-back mode

2012-03-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=47324

--- Comment #1 from Chris Wilson  2012-03-14 15:08:23 
PDT ---
Please attach your Xorg.log.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 7/9] glsl: Add support for integer sampler2DRect variants in GLSL 1.40.

2012-03-14 Thread Kenneth Graunke

On 03/12/2012 06:08 PM, Eric Anholt wrote:

---
  src/glsl/builtin_types.h |   12 
  src/glsl/glsl_types.cpp  |   15 +--
  src/glsl/glsl_types.h|2 ++
  3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h
index cc99b1b..890c121 100644
--- a/src/glsl/builtin_types.h
+++ b/src/glsl/builtin_types.h
@@ -259,6 +259,18 @@ const glsl_type *const glsl_type::uvec3_type =&  
builtin_130_types[2];
  const glsl_type *const glsl_type::uvec4_type =&  builtin_130_types[3];
  /*@}*/

+
+/** \name Types added in GLSL 1.30
+ */
+/*@{*/
+const glsl_type glsl_type::builtin_140_types[] = {
+   glsl_type(GL_INT_SAMPLER_2D_RECT,
+GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT, "isampler2DRect"),
+   glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_RECT,
+GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT, "usampler2DRect"),
+};
+/*@}*/
+
  /** \name Sampler types added by GL_ARB_texture_rectangle
   */
  /*@{*/
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index a327197..4baec41 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -205,6 +205,16 @@ glsl_type::generate_130_types(glsl_symbol_table *symtab)


  void
+glsl_type::generate_140_types(glsl_symbol_table *symtab)
+{
+   generate_130_types(symtab);


We need to drop builtin_110_deprecated_structure_types here.
We can always do that as a subsequent patch though.

Reviewed-by: Kenneth Graunke 


+   add_types_to_symbol_table(symtab, builtin_140_types,
+Elements(builtin_140_types), false);
+}
+
+
+void
  glsl_type::generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab,
bool warn)
  {
@@ -258,14 +268,15 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state 
*state)
glsl_type::generate_130_types(state->symbols);
break;
 case 140:
-  glsl_type::generate_130_types(state->symbols);
+  glsl_type::generate_140_types(state->symbols);
break;
 default:
/* error */
break;
 }

-   if (state->ARB_texture_rectangle_enable) {
+   if (state->ARB_texture_rectangle_enable ||
+   state->language_version>= 140) {
glsl_type::generate_ARB_texture_rectangle_types(state->symbols,
   state->ARB_texture_rectangle_warn);
 }
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 2997c93..8f2a3ff 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -498,6 +498,7 @@ private:
 static const glsl_type builtin_110_types[];
 static const glsl_type builtin_120_types[];
 static const glsl_type builtin_130_types[];
+   static const glsl_type builtin_140_types[];
 static const glsl_type builtin_ARB_texture_rectangle_types[];
 static const glsl_type builtin_EXT_texture_array_types[];
 static const glsl_type builtin_EXT_texture_buffer_object_types[];
@@ -517,6 +518,7 @@ private:
 static void generate_110_types(glsl_symbol_table *);
 static void generate_120_types(glsl_symbol_table *);
 static void generate_130_types(glsl_symbol_table *);
+   static void generate_140_types(glsl_symbol_table *);
 static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, 
bool);
 static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
 static void generate_OES_texture_3D_types(glsl_symbol_table *, bool);


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 9/9] glsl: Add GLSL 1.40 textureSize() implementations for sampler2DRect.

2012-03-14 Thread Kenneth Graunke

On 03/12/2012 06:08 PM, Eric Anholt wrote:

By setting lod to 0 in the builtin function implementation, we avoid
needing to update all the visitors to ignore LOD in this case, when
the hardware drivers actually want to ask for LOD 0 for rectangular
textures.

Fixes piglit spec/GLSL-1.40/textureSize-*Rect.
---
  src/glsl/builtins/profiles/140.frag |5 +
  src/glsl/builtins/profiles/140.vert |5 +
  src/glsl/builtins/tools/texture_builtins.py |   11 +--
  3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/glsl/builtins/profiles/140.frag 
b/src/glsl/builtins/profiles/140.frag
index 1bf6c75..da28473 100644
--- a/src/glsl/builtins/profiles/140.frag
+++ b/src/glsl/builtins/profiles/140.frag
@@ -499,6 +499,11 @@ ivec3 textureSize(usampler2DArray sampler, int lod);
  ivec2 textureSize(sampler1DArrayShadow sampler, int lod);
  ivec3 textureSize(sampler2DArrayShadow sampler, int lod);

+ivec2 textureSize(sampler2DRect sampler);
+ivec2 textureSize(isampler2DRect sampler);
+ivec2 textureSize(usampler2DRect sampler);
+ivec2 textureSize(sampler2DRectShadow sampler);
+
  /* texture - no bias */
   vec4 texture( sampler1D sampler, float P);
  ivec4 texture(isampler1D sampler, float P);
diff --git a/src/glsl/builtins/profiles/140.vert 
b/src/glsl/builtins/profiles/140.vert
index 0fad767..bfef4ed 100644
--- a/src/glsl/builtins/profiles/140.vert
+++ b/src/glsl/builtins/profiles/140.vert
@@ -499,6 +499,11 @@ ivec3 textureSize(usampler2DArray sampler, int lod);
  ivec2 textureSize(sampler1DArrayShadow sampler, int lod);
  ivec3 textureSize(sampler2DArrayShadow sampler, int lod);

+ivec2 textureSize(sampler2DRect sampler);
+ivec2 textureSize(isampler2DRect sampler);
+ivec2 textureSize(usampler2DRect sampler);
+ivec2 textureSize(sampler2DRectShadow sampler);
+
  /* texture */
   vec4 texture( sampler1D sampler, float P);
  ivec4 texture(isampler1D sampler, float P);
diff --git a/src/glsl/builtins/tools/texture_builtins.py 
b/src/glsl/builtins/tools/texture_builtins.py
index 07d0a1b..35571e8 100755
--- a/src/glsl/builtins/tools/texture_builtins.py
+++ b/src/glsl/builtins/tools/texture_builtins.py
@@ -71,7 +71,7 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, 
unused_fields = 0):
  print "\n   (declare (in) " + vec_type("i" if tex_inst == "txf" else "", 
coord_dim + extra_dim) + " P)",
  if tex_inst == "txl":
  print "\n   (declare (in) float lod)",
-elif tex_inst == "txf" or tex_inst == "txs":
+elif tex_inst == "txf" or (tex_inst == "txs" and sampler_type.find("Rect") 
== -1):


Could we please make this:

elif tex_inst == "txf" or (tex_inst == "txs" and "Rect" not in 
sampler_type):



  print "\n   (declare (in) int lod)",
  elif tex_inst == "txd":
  grad_type = vec_type("", coord_dim)
@@ -115,7 +115,12 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, 
unused_fields = 0):
  # Bias/explicit LOD/gradient:
  if tex_inst == "txb":
  print "(var_ref bias)",
-elif tex_inst == "txl" or tex_inst == "txf" or tex_inst == "txs":
+elif tex_inst == "txs":
+if sampler_type.find("Rect") == -1:


Ditto:
if "Rect" not in sampler_type:


+print "(var_ref lod)",
+else:
+print "(constant int (0))"
+elif tex_inst == "txl" or tex_inst == "txf":
  print "(var_ref lod)",
  elif tex_inst == "txd":
  print "((var_ref dPdx) (var_ref dPdy))",
@@ -153,6 +158,8 @@ def generate_texture_functions(fs):
  generate_sigs("", "txs", "CubeShadow")
  generate_sigs("", "txs", "1DArrayShadow")
  generate_sigs("", "txs", "2DArrayShadow")
+generate_fiu_sigs("txs", "2DRect")
+generate_sigs("", "txs", "2DRectShadow")
  end_function(fs, "textureSize")

  start_function("texture")


With those changes,
Reviewed-by: Kenneth Graunke 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] GLSL 1.40 progress: hooking up builtin functions

2012-03-14 Thread Kenneth Graunke

On 03/12/2012 06:08 PM, Eric Anholt wrote:

This is a continuation of the GLSL 1.40 work, which now gets the
newly-submitted textureSize(*2DRect) tests working, with a brief
detour to fix the GPU hangs due to the discard-exiting-the-shader
test.  I want to rework that test, actually, because in my first
attempt at fixing it I only exited the shader if all pixels were
discarded, which missed the point of the spec change (stop computing
for *any* pixel which is discarded).

Much work remains to be done with hooking up the other new
texture*(*2DRect) builtins, and of course *samplerBuffer.

Do we want to encode what we know is remaining to be done in
docs/GL3.txt


We should document it somewhere.  I've never been a huge fan of GL3.txt, 
but it's probably as good a place as any.


Patches 1 and 3-9 are:
Reviewed-by: Kenneth Graunke 

I had comments on 7 and 9.

I haven't gotten through patch 2 yet, but plan to soon.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 47324] [Intel HD3000] OpenGL content is not rendered correctly in Gnome fall-back mode

2012-03-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=47324

--- Comment #2 from Kenneth Graunke  2012-03-14 15:24:30 
PDT ---
Output of glxinfo would be great as well.

Also, how are you getting to GNOME Fallback mode?  I've only ever arrived in
that environment when my 3D driver is hosed.  At which point...well...bug
reports don't sound very interesting. :)  It sounds like you've explicitly
chosen to run in fallback mode though.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] mesa: Validate the drawing primitive against the transform feedback mode.

2012-03-14 Thread Eric Anholt
Fixes piglit GL_EXT_transform_feedback/negative-prims.
---
 src/mesa/main/api_validate.c  |   45 +++-
 src/mesa/main/transformfeedback.c |   27 --
 src/mesa/main/transformfeedback.h |3 --
 3 files changed, 43 insertions(+), 32 deletions(-)

diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 17da5d0..02495a1 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -29,6 +29,7 @@
 #include "imports.h"
 #include "mfeatures.h"
 #include "mtypes.h"
+#include "enums.h"
 #include "vbo/vbo.h"
 
 
@@ -215,9 +216,49 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, 
const char *name)
   _mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode);
   return GL_FALSE;
}
-   else {
-  return GL_TRUE;
+
+   /* From the GL_EXT_transform_feedback spec:
+*
+* "The error INVALID_OPERATION is generated if Begin, or any command
+*  that performs an explicit Begin, is called when:
+*
+*  * a geometry shader is not active and  does not match the
+*allowed begin modes for the current transform feedback state as
+*given by table X.1.
+*
+*  * a geometry shader is active and the output primitive type of the
+*geometry shader does not match the allowed begin modes for the
+*current transform feedback state as given by table X.1.
+*
+*/
+   if (ctx->TransformFeedback.CurrentObject->Active &&
+   !ctx->TransformFeedback.CurrentObject->Paused) {
+  GLboolean pass = GL_TRUE;
+
+  switch (mode) {
+  case GL_POINTS:
+ pass = ctx->TransformFeedback.Mode == GL_POINTS;
+break;
+  case GL_LINES:
+  case GL_LINE_STRIP:
+  case GL_LINE_LOOP:
+ pass = ctx->TransformFeedback.Mode == GL_LINES;
+break;
+  default:
+ pass = ctx->TransformFeedback.Mode == GL_TRIANGLES;
+break;
+  }
+  if (!pass) {
+_mesa_error(ctx, GL_INVALID_OPERATION,
+"%s(mode=%s vs transform feedback %s)",
+name,
+_mesa_lookup_prim_by_nr(mode),
+_mesa_lookup_prim_by_nr(ctx->TransformFeedback.Mode));
+return GL_FALSE;
+  }
}
+
+   return GL_TRUE;
 }
 
 
diff --git a/src/mesa/main/transformfeedback.c 
b/src/mesa/main/transformfeedback.c
index c2114c2..f2c1435 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -89,33 +89,6 @@ reference_transform_feedback_object(struct 
gl_transform_feedback_object **ptr,
 
 
 /**
- * Check if the given primitive mode (as in glBegin(mode)) is compatible
- * with the current transform feedback mode (if it's enabled).
- * This is to be called from glBegin(), glDrawArrays(), glDrawElements(), etc.
- *
- * \return GL_TRUE if the mode is OK, GL_FALSE otherwise.
- */
-GLboolean
-_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode)
-{
-   if (ctx->TransformFeedback.CurrentObject->Active &&
-   !ctx->TransformFeedback.CurrentObject->Paused) {
-  switch (mode) {
-  case GL_POINTS:
- return ctx->TransformFeedback.Mode == GL_POINTS;
-  case GL_LINES:
-  case GL_LINE_STRIP:
-  case GL_LINE_LOOP:
- return ctx->TransformFeedback.Mode == GL_LINES;
-  default:
- return ctx->TransformFeedback.Mode == GL_TRIANGLES;
-  }
-   }
-   return GL_TRUE;
-}
-
-
-/**
  * Check that all the buffer objects currently bound for transform
  * feedback actually exist.  Raise a GL_INVALID_OPERATION error if
  * any buffers are missing.
diff --git a/src/mesa/main/transformfeedback.h 
b/src/mesa/main/transformfeedback.h
index 8a6672d..7d63de0 100644
--- a/src/mesa/main/transformfeedback.h
+++ b/src/mesa/main/transformfeedback.h
@@ -42,9 +42,6 @@ _mesa_free_transform_feedback(struct gl_context *ctx);
 #if FEATURE_EXT_transform_feedback
 
 extern GLboolean
-_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode);
-
-extern GLboolean
 _mesa_validate_transform_feedback_buffers(struct gl_context *ctx);
 
 
-- 
1.7.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] mesa: Fold error generation into _mesa_valid_prim_mode().

2012-03-14 Thread Eric Anholt
We want to start emitting an INVALID_OPERATION from here for transform
feedback.  Note that this forced dlist.c to almost not use this
function, since it wants different behavior during dlist compile.
Just pull the non-TF, non-GS test out for compile, because:

1) TF doesn't matter in that case because there's no drawing.
2) I don't think we're going to see GSes and display lists in the same
   context, if we don't do GL_ARB_compatibility.
---
 src/mesa/main/api_validate.c |   24 +---
 src/mesa/main/api_validate.h |2 +-
 src/mesa/main/dlist.c|   10 --
 src/mesa/vbo/vbo_exec_api.c  |3 +--
 4 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 4e94f47..17da5d0 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -204,13 +204,15 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, 
GLenum type,
  * are supported.
  */
 GLboolean
-_mesa_valid_prim_mode(const struct gl_context *ctx, GLenum mode)
+_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
 {
if (ctx->Extensions.ARB_geometry_shader4 &&
mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) {
+  _mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode);
   return GL_FALSE;
}
else if (mode > GL_POLYGON) {
+  _mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode);
   return GL_FALSE;
}
else {
@@ -237,8 +239,7 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
   return GL_FALSE;
}
 
-   if (!_mesa_valid_prim_mode(ctx, mode)) {
-  _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" );
+   if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElements")) {
   return GL_FALSE;
}
 
@@ -294,8 +295,7 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, 
GLenum mode,
   return GL_FALSE;
}
 
-   if (!_mesa_valid_prim_mode(ctx, mode)) {
-  _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" );
+   if (!_mesa_valid_prim_mode(ctx, mode, "glDrawRangeElements")) {
   return GL_FALSE;
}
 
@@ -353,8 +353,7 @@ _mesa_validate_DrawArrays(struct gl_context *ctx,
   return GL_FALSE;
}
 
-   if (!_mesa_valid_prim_mode(ctx, mode)) {
-  _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
+   if (!_mesa_valid_prim_mode(ctx, mode, "glDrawArrays")) {
   return GL_FALSE;
}
 
@@ -389,9 +388,7 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, 
GLenum mode, GLint fi
   return GL_FALSE;
}
 
-   if (!_mesa_valid_prim_mode(ctx, mode)) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  "glDrawArraysInstanced(mode=0x%x)", mode);
+   if (!_mesa_valid_prim_mode(ctx, mode, "glDrawArraysInstanced")) {
   return GL_FALSE;
}
 
@@ -429,9 +426,7 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
   return GL_FALSE;
}
 
-   if (!_mesa_valid_prim_mode(ctx, mode)) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  "glDrawElementsInstanced(mode = 0x%x)", mode);
+   if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElementsInstanced")) {
   return GL_FALSE;
}
 
@@ -485,8 +480,7 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx,
 {
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
 
-   if (!_mesa_valid_prim_mode(ctx, mode)) {
-  _mesa_error(ctx, GL_INVALID_ENUM, "glDrawTransformFeedback(mode)");
+   if (!_mesa_valid_prim_mode(ctx, mode, "glDrawTransformFeedback")) {
   return GL_FALSE;
}
 
diff --git a/src/mesa/main/api_validate.h b/src/mesa/main/api_validate.h
index f494842..d92fd43 100644
--- a/src/mesa/main/api_validate.h
+++ b/src/mesa/main/api_validate.h
@@ -43,7 +43,7 @@ _mesa_max_buffer_index(struct gl_context *ctx, GLuint count, 
GLenum type,
 
 
 extern GLboolean
-_mesa_valid_prim_mode(const struct gl_context *ctx, GLenum mode);
+_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name);
 
 
 extern GLboolean
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 420ddcc..f113573 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -5767,10 +5767,16 @@ save_Begin(GLenum mode)
Node *n;
GLboolean error = GL_FALSE;
 
-   if (!_mesa_valid_prim_mode(ctx, mode)) {
-  _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
+   if (mode > GL_POLYGON) {
+  _mesa_error(ctx, GL_INVALID_ENUM, "glBegin(mode=%x)", mode);
   error = GL_TRUE;
}
+   if (ctx->ExecuteFlag) {
+  if (!_mesa_valid_prim_mode(ctx, mode, "glBegin")) {
+error = GL_TRUE;
+  }
+   }
+
else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) {
   /* Typically the first begin.  This may raise an error on
* playback, depending on whether CallList is issued from inside
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index cb5f9ae..3061990 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -6

Re: [Mesa-dev] [PATCH 2/2] i965/fs: Try to avoid generating extra MOVs to do saturates.

2012-03-14 Thread Kenneth Graunke

On 03/13/2012 02:37 PM, Eric Anholt wrote:

shader-db results:
Total instructions: 212648 ->  206044
614/1246 programs affected (49.3%)
178350 ->  171746 instructions in affected programs (3.7% reduction)
---
  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |   24 +---
  1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index eb129ce..e7af75b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -172,12 +172,30 @@ fs_visitor::try_emit_saturate(ir_expression *ir)
 if (!sat_val)
return false;

+   fs_inst *pre_inst = (fs_inst *) this->instructions.get_tail();
+
 sat_val->accept(this);
 fs_reg src = this->result;

-   this->result = fs_reg(this, ir->type);
-   fs_inst *inst = emit(BRW_OPCODE_MOV, this->result, src);
-   inst->saturate = true;
+   fs_inst *last_inst = (fs_inst *) this->instructions.get_tail();
+
+   /* If the last instruction from our accept() didn't generate our
+* src, generate a saturated MOV
+*/
+   if (last_inst == pre_inst ||
+   last_inst->predicated ||
+   last_inst->force_uncompressed ||
+   last_inst->force_sechalf ||
+   !src.equals(&last_inst->dst) ||
+   last_inst->regs_written() != 1) {


This duplicates a bunch of conditions from try_rewrite_rhs_to_dest.  It 
also seems like something we're going to want to do more of.  Could we 
capture some of this in a predicate like "last_inst->writes(src)"?



+  this->result = fs_reg(this, ir->type);
+  fs_inst *inst = emit(BRW_OPCODE_MOV, this->result, src);
+  inst->saturate = true;
+   } else {
+  last_inst->saturate = true;
+  this->result = src;
+   }
+

 return true;
  }

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: Fold error generation into _mesa_valid_prim_mode().

2012-03-14 Thread Brian Paul

On 03/14/2012 04:25 PM, Eric Anholt wrote:

We want to start emitting an INVALID_OPERATION from here for transform
feedback.  Note that this forced dlist.c to almost not use this
function, since it wants different behavior during dlist compile.
Just pull the non-TF, non-GS test out for compile, because:

1) TF doesn't matter in that case because there's no drawing.
2) I don't think we're going to see GSes and display lists in the same
context, if we don't do GL_ARB_compatibility.
---
  src/mesa/main/api_validate.c |   24 +---
  src/mesa/main/api_validate.h |2 +-
  src/mesa/main/dlist.c|   10 --
  src/mesa/vbo/vbo_exec_api.c  |3 +--
  4 files changed, 19 insertions(+), 20 deletions(-)


For both: Reviewed-by: Brian Paul 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 47126] tests/fbo/fbo-array.c:109: create_array_fbo: Assertion `glGetError() == 0' failed.

2012-03-14 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=47126

Gordon Jin  changed:

   What|Removed |Added

 AssignedTo|e...@anholt.net |mesa-dev@lists.freedesktop.
   ||org
  QAContact|e...@anholt.net |
Product|piglit  |Mesa
Version|unspecified |git
  Component|tests   |Mesa core

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Doing 8.0.1 release?

2012-03-14 Thread Yuanhan Liu
On Tue, Mar 13, 2012 at 07:29:02AM -0700, Jakob Bornecrantz wrote:
> - Original Message -
> > On Mon, Mar 12, 2012 at 05:05:08PM -0700, Jakob Bornecrantz wrote:
> > > Hi all
> > > 
> > > We well over due for a 8.0.1 release, so I thought
> > > we do it aggressively this week. A quick rc tomorrow
> > > and a release on Thursday or Friday? Is that okay with
> > > people, comments please?
> > 
> > Did you mean 8.1? 8.0.1 has been relased for a while, see
> > http://lists.freedesktop.org/archives/mesa-dev/2012-February/019167.html
> 
> I meant 8.0.2, sorry for any confusion.

Thanks.

BTW, I have some commites which should be inclued in the next
release(aka 8.0.2 here). Should I do cherry-pick myself? (Usually, Ian
will do that for me before).

Thanks,
Yuanhan Liu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] intel:i915:i965: enable mipmap layout right mode

2012-03-14 Thread Yuanhan Liu
There are two mipmap layout modes: below and right. And we currently just
use _below_ mode. And in some cases, like height is greater than width,
it would be better to use the _right_ mode for saving memory.

And it also fix some issues like the gl-max-texture-dimensions.html webglc
test case on pineview in a hardware way(no fallback). Since when
rendering with 1x2048 texture using below mode would make the draw
offset exceed the max allowed size, but will not when using right mode.

Signed-off-by: Yuanhan Liu 
---
 src/mesa/drivers/dri/i915/i915_reg.h |1 +
 src/mesa/drivers/dri/i915/i915_tex_layout.c  |4 +-
 src/mesa/drivers/dri/i915/i915_texstate.c|2 +
 src/mesa/drivers/dri/i965/brw_tex_layout.c   |4 +-
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |2 +-
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c   |2 +-
 src/mesa/drivers/dri/intel/intel_mipmap_tree.h   |7 ++-
 src/mesa/drivers/dri/intel/intel_tex_layout.c|   70 +++---
 src/mesa/drivers/dri/intel/intel_tex_layout.h|3 +-
 9 files changed, 65 insertions(+), 30 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i915_reg.h 
b/src/mesa/drivers/dri/i915/i915_reg.h
index 766547a..0ca0acf 100644
--- a/src/mesa/drivers/dri/i915/i915_reg.h
+++ b/src/mesa/drivers/dri/i915/i915_reg.h
@@ -645,6 +645,7 @@
 #define MS4_CUBE_FACE_ENA_MASK  (0x3f<<15)
 #define MS4_MAX_LOD_SHIFT  9
 #define MS4_MAX_LOD_MASK   (0x3f<<9)
+#define MS4_MIP_LAYOUT_MODE_SHIFT   8
 #define MS4_MIP_LAYOUT_LEGACY   (0<<8)
 #define MS4_MIP_LAYOUT_BELOW_LPT(0<<8)
 #define MS4_MIP_LAYOUT_RIGHT_LPT(1<<8)
diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c 
b/src/mesa/drivers/dri/i915/i915_tex_layout.c
index 1e3cfad..6600734 100644
--- a/src/mesa/drivers/dri/i915/i915_tex_layout.c
+++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c
@@ -454,7 +454,7 @@ i945_miptree_layout_3d(struct intel_mipmap_tree * mt)
 }
 
 void
-i945_miptree_layout(struct intel_mipmap_tree * mt)
+i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt)
 {
switch (mt->target) {
case GL_TEXTURE_CUBE_MAP:
@@ -469,7 +469,7 @@ i945_miptree_layout(struct intel_mipmap_tree * mt)
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
case GL_TEXTURE_RECTANGLE_ARB:
-  i945_miptree_layout_2d(mt);
+  i945_miptree_layout_2d(intel, mt);
   break;
default:
   _mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()");
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c 
b/src/mesa/drivers/dri/i915/i915_texstate.c
index 9022548..54f32a4 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -192,6 +192,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
(U_FIXED(CLAMP(maxlod, 0.0, 11.0), 2) << MS4_MAX_LOD_SHIFT) |
((firstImage->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT));
 
+   if (intel->is_945)
+  state[I915_TEXREG_MS4] |= intelObj->mt->layout << 
MS4_MIP_LAYOUT_MODE_SHIFT;
 
{
   GLuint minFilt, mipFilt, magFilt;
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 7a1b91f..5a66f90 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -53,7 +53,7 @@ brw_miptree_layout_texture_array(struct intel_context *intel,
if (mt->compressed)
   qpitch /= 4;
 
-   i945_miptree_layout_2d(mt);
+   i945_miptree_layout_2d(intel, mt);
 
for (level = mt->first_level; level <= mt->last_level; level++) {
   for (q = 0; q < mt->depth0; q++) {
@@ -164,7 +164,7 @@ brw_miptree_layout(struct intel_context *intel, struct 
intel_mipmap_tree *mt)
   break;
 
default:
-  i945_miptree_layout_2d(mt);
+  i945_miptree_layout_2d(intel, mt);
   break;
}
DBG("%s: %dx%dx%d\n", __FUNCTION__,
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index a3de2e3..b6565fe 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -654,7 +654,7 @@ brw_update_texture_surface( struct gl_context *ctx, GLuint 
unit )
  6 * 4, 32, &brw->wm.surf_offset[surf_index]);
 
surf[0] = (translate_tex_target(tObj->Target) << BRW_SURFACE_TYPE_SHIFT |
- BRW_SURFACE_MIPMAPLAYOUT_BELOW << BRW_SURFACE_MIPLAYOUT_SHIFT |
+ mt->layout << BRW_SURFACE_MIPLAYOUT_SHIFT |
  BRW_SURFACE_CUBEFACE_ENABLES |
  (translate_tex_format(mt->format,
firstImage->InternalFormat,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 3601f5e..cb97ebe 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -151,7 +