Mesa (master): i915g: fix warning about void pointer arithmetic

2011-10-11 Thread Brian Paul
Module: Mesa
Branch: master
Commit: f0c036536f5acea90f12130dc712ea6b97d488b6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0c036536f5acea90f12130dc712ea6b97d488b6

Author: Brian Paul bri...@vmware.com
Date:   Mon Oct 10 16:35:22 2011 -0600

i915g: fix warning about void pointer arithmetic

---

 src/gallium/drivers/i915/i915_state.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_state.c 
b/src/gallium/drivers/i915/i915_state.c
index a233a04..f018f52 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -384,7 +384,7 @@ i915_prepare_vertex_sampling(struct i915_context *i915,
   if (view) {
  struct pipe_resource *tex = view-texture;
  struct i915_texture *i915_tex = i915_texture(tex);
- void* addr;
+ ubyte *addr;
 
  /* We're referencing the texture's internal data, so save a
   * reference to it.

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


Mesa (master): draw/llvm: fix hard-coded number of total clip planes

2011-10-11 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e6c237cfd6f53ff569f68255d5d6da15148cd0f5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6c237cfd6f53ff569f68255d5d6da15148cd0f5

Author: Brian Paul bri...@vmware.com
Date:   Mon Oct 10 17:43:59 2011 -0600

draw/llvm: fix hard-coded number of total clip planes

Instead of 12 use DRAW_TOTAL_CLIP_PLANES.  The max number of user-defined
clip planes was increased to 8 so the total number of planes is 14.
This doesn't fix any specific bug, but clearly the old code was wrong.

Reviewed-by: José Fonseca jfons...@vmware.com

---

 src/gallium/auxiliary/draw/draw_context.c  |2 +-
 src/gallium/auxiliary/draw/draw_llvm.c |   19 ---
 src/gallium/auxiliary/draw/draw_llvm.h |2 +-
 src/gallium/auxiliary/draw/draw_private.h  |   12 
 .../draw/draw_pt_fetch_shade_pipeline_llvm.c   |2 +-
 5 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c 
b/src/gallium/auxiliary/draw/draw_context.c
index 6a85b79..e1b9a15 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -369,7 +369,7 @@ draw_set_mapped_constant_buffer(struct draw_context *draw,
case PIPE_SHADER_VERTEX:
   draw-pt.user.vs_constants[slot] = buffer;
   draw-pt.user.vs_constants_size[slot] = size;
-  draw-pt.user.planes = (float (*) [12][4]) (draw-plane[0]);
+  draw-pt.user.planes = (float (*) [DRAW_TOTAL_CLIP_PLANES][4]) 
(draw-plane[0]);
   draw_vs_set_constants(draw, slot, buffer, size);
   break;
case PIPE_SHADER_GEOMETRY:
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c 
b/src/gallium/auxiliary/draw/draw_llvm.c
index d427d2c..01659fe 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -191,7 +191,8 @@ create_jit_context_type(struct gallivm_state *gallivm,
 
elem_types[0] = LLVMPointerType(float_type, 0); /* vs_constants */
elem_types[1] = LLVMPointerType(float_type, 0); /* gs_constants */
-   elem_types[2] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4), 
12), 0); /* planes */
+   elem_types[2] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4),
+ DRAW_TOTAL_CLIP_PLANES), 0);
elem_types[3] = LLVMPointerType(float_type, 0); /* viewport */
elem_types[4] = LLVMArrayType(texture_type,
  PIPE_MAX_VERTEX_SAMPLERS); /* textures */
@@ -708,17 +709,21 @@ store_aos(struct gallivm_state *gallivm,
LLVMValueRef id_ptr = draw_jit_header_id(gallivm, io_ptr);
LLVMValueRef data_ptr = draw_jit_header_data(gallivm, io_ptr);
LLVMValueRef indices[3];
-   LLVMValueRef val, shift;
+   LLVMValueRef val;
+   int vertex_id_pad_edgeflag;
 
indices[0] = lp_build_const_int32(gallivm, 0);
indices[1] = index;
indices[2] = lp_build_const_int32(gallivm, 0);
 
-   /* initialize vertex id:16 = 0x, pad:3 = 0, edgeflag:1 = 1 */
-   val = lp_build_const_int32(gallivm, 0x1);
-   shift = lp_build_const_int32(gallivm, 12);
-   val = LLVMBuildShl(builder, val, shift, );
-   /* add clipmask:12 */   
+   /* If this assertion fails, it means we need to update the bit twidding
+* code here.  See struct vertex_header in draw_private.h.
+*/
+   assert(DRAW_TOTAL_CLIP_PLANES==14);
+   /* initialize vertex id:16 = 0x, pad:1 = 0, edgeflag:1 = 1 */
+   vertex_id_pad_edgeflag = (0x  16) | (1  DRAW_TOTAL_CLIP_PLANES);
+   val = lp_build_const_int32(gallivm, vertex_id_pad_edgeflag);
+   /* OR with the clipmask */
val = LLVMBuildOr(builder, val, clipmask, );   
 
/* store vertex header */
diff --git a/src/gallium/auxiliary/draw/draw_llvm.h 
b/src/gallium/auxiliary/draw/draw_llvm.h
index 375b7b8..bc36135 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.h
+++ b/src/gallium/auxiliary/draw/draw_llvm.h
@@ -98,7 +98,7 @@ struct draw_jit_context
 {
const float *vs_constants;
const float *gs_constants;
-   float (*planes) [12][4];
+   float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
float *viewport;
 
struct draw_jit_texture textures[PIPE_MAX_VERTEX_SAMPLERS];
diff --git a/src/gallium/auxiliary/draw/draw_private.h 
b/src/gallium/auxiliary/draw/draw_private.h
index ef77266..b84d2b7 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -52,6 +52,10 @@ struct draw_llvm;
 #endif
 
 
+/** Sum of frustum planes and user-defined planes */
+#define DRAW_TOTAL_CLIP_PLANES (6 + PIPE_MAX_CLIP_PLANES)
+
+
 struct pipe_context;
 struct draw_vertex_shader;
 struct draw_context;
@@ -66,9 +70,9 @@ struct tgsi_sampler;
  * Carry some useful information around with the vertices in the prim pipe.  
  */
 struct vertex_header {
-   unsigned clipmask:12;
+   unsigned clipmask:DRAW_TOTAL_CLIP_PLANES;
unsigned edgeflag:1;
-   unsigned pad:3;
+   unsigned pad:1;
unsigned 

Mesa (master): draw/llvm: set draw-pt.user. planes field in draw_set_clip_state()

2011-10-11 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 11938c87a3e5a5b0a16b22f1913567a64015a92d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=11938c87a3e5a5b0a16b22f1913567a64015a92d

Author: Brian Paul bri...@vmware.com
Date:   Mon Oct 10 17:49:27 2011 -0600

draw/llvm: set draw-pt.user.planes field in draw_set_clip_state()

Previously it was getting set in draw_set_mapped_constant_buffer() but
if there were no shader constants, that function wasn't called.  So the
pt.user.planes field was null and we died when we tried to access the
clip planes in the LLVM-generated code.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41663

Note: This is a candidate for the 7.11 branch.

Reviewed-by: José Fonseca jfons...@vmware.com

---

 src/gallium/auxiliary/draw/draw_context.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c 
b/src/gallium/auxiliary/draw/draw_context.c
index e1b9a15..a444793 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -292,6 +292,8 @@ void draw_set_clip_state( struct draw_context *draw,
draw-nr_planes = 6 + clip-nr;
draw-depth_clamp = clip-depth_clamp;
 
+   draw-pt.user.planes = (float (*) [DRAW_TOTAL_CLIP_PLANES][4]) 
(draw-plane[0]);
+
update_clip_flags(draw);
 }
 
@@ -369,7 +371,6 @@ draw_set_mapped_constant_buffer(struct draw_context *draw,
case PIPE_SHADER_VERTEX:
   draw-pt.user.vs_constants[slot] = buffer;
   draw-pt.user.vs_constants_size[slot] = size;
-  draw-pt.user.planes = (float (*) [DRAW_TOTAL_CLIP_PLANES][4]) 
(draw-plane[0]);
   draw_vs_set_constants(draw, slot, buffer, size);
   break;
case PIPE_SHADER_GEOMETRY:

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


Mesa (master): llvmpipe: don't support rendering to sRGB surfaces

2011-10-11 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6b3e75de7c2dd6be6bf1acd0e996bdb1def702a1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b3e75de7c2dd6be6bf1acd0e996bdb1def702a1

Author: Brian Paul bri...@vmware.com
Date:   Thu Oct  6 17:01:48 2011 -0600

llvmpipe: don't support rendering to sRGB surfaces

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=34199

---

 src/gallium/drivers/llvmpipe/lp_screen.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c
index 7848d80..1464776 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -249,7 +249,8 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
   return FALSE;
 
if (bind  PIPE_BIND_RENDER_TARGET) {
-  if (format_desc-colorspace == UTIL_FORMAT_COLORSPACE_ZS)
+  if (format_desc-colorspace == UTIL_FORMAT_COLORSPACE_ZS ||
+  format_desc-colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
  return FALSE;
 
   if (format_desc-layout != UTIL_FORMAT_LAYOUT_PLAIN)

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


Mesa (master): gallium: rename ZS stencil type to UINT (v2)

2011-10-11 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 866f9b18c68ede63c00917ec9c3dae3524ca8826
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=866f9b18c68ede63c00917ec9c3dae3524ca8826

Author: Dave Airlie airl...@redhat.com
Date:   Sun Sep 11 09:45:10 2011 +0100

gallium: rename ZS stencil type to UINT (v2)

these are never USCALED, always UINT in reality.

taken from some work by Christoph Bumiller

v2: fixup formatting of table + tabs

Signed-off-by: Dave Airlie airl...@redhat.com

---

 src/gallium/auxiliary/postprocess/pp_init.c|4 +-
 src/gallium/auxiliary/util/u_format.c  |8 +-
 src/gallium/auxiliary/util/u_format.csv|   17 +++---
 src/gallium/auxiliary/util/u_format.h  |   16 +++---
 src/gallium/auxiliary/util/u_format_table.py   |   12 ++--
 src/gallium/auxiliary/util/u_format_tests.c|   26 
 src/gallium/auxiliary/util/u_format_zs.c   |   64 ++--
 src/gallium/auxiliary/util/u_format_zs.h   |   52 
 src/gallium/auxiliary/util/u_pack_color.h  |   32 +-
 src/gallium/auxiliary/util/u_surface.c |8 +-
 src/gallium/auxiliary/util/u_tile.c|   36 ++--
 src/gallium/drivers/cell/ppu/cell_gen_fragment.c   |   12 ++--
 src/gallium/drivers/cell/ppu/cell_screen.c |2 +-
 src/gallium/drivers/cell/spu/spu_command.c |4 +-
 src/gallium/drivers/cell/spu/spu_per_fragment_op.c |4 +-
 src/gallium/drivers/i915/i915_clear.c  |4 +-
 src/gallium/drivers/i915/i915_screen.c |4 +-
 src/gallium/drivers/i915/i915_state_sampler.c  |4 +-
 src/gallium/drivers/i915/i915_state_static.c   |2 +-
 src/gallium/drivers/i915/i915_surface.c|2 +-
 src/gallium/drivers/i965/brw_misc_state.c  |2 +-
 src/gallium/drivers/i965/brw_pipe_clear.c  |4 +-
 src/gallium/drivers/i965/brw_resource_texture.c|2 +-
 src/gallium/drivers/i965/brw_screen.c  |4 +-
 src/gallium/drivers/llvmpipe/lp_bld_depth.c|4 +-
 src/gallium/drivers/nv50/nv50_formats.c|6 +-
 src/gallium/drivers/nv50/nv50_miptree.c|6 +-
 src/gallium/drivers/nv50/nv50_surface.c|   12 ++--
 src/gallium/drivers/nvc0/nvc0_formats.c|6 +-
 src/gallium/drivers/nvc0/nvc0_miptree.c|6 +-
 src/gallium/drivers/nvc0/nvc0_surface.c|   12 ++--
 src/gallium/drivers/nvfx/nvfx_fragtex.c|2 +-
 src/gallium/drivers/nvfx/nvfx_screen.c |2 +-
 src/gallium/drivers/nvfx/nvfx_state_fb.c   |2 +-
 src/gallium/drivers/r300/r300_blit.c   |2 +-
 src/gallium/drivers/r300/r300_state_derived.c  |2 +-
 src/gallium/drivers/r300/r300_texture.c|6 +-
 src/gallium/drivers/r600/evergreen_state.c |   20 +++---
 src/gallium/drivers/r600/r600_state.c  |   20 +++---
 src/gallium/drivers/r600/r600_texture.c|   24 
 src/gallium/drivers/softpipe/sp_quad_depth_test.c  |   22 
 src/gallium/drivers/svga/svga_format.c |2 +-
 src/gallium/drivers/svga/svga_pipe_clear.c |2 +-
 src/gallium/drivers/svga/svga_pipe_misc.c  |4 +-
 src/gallium/drivers/svga/svga_state_framebuffer.c  |4 +-
 src/gallium/include/pipe/p_format.h|   14 ++--
 .../d3d1x/d3d1xstutil/src/dxgi_enums.cpp   |   14 ++--
 src/gallium/state_trackers/dri/common/dri_screen.c |8 +-
 src/gallium/state_trackers/egl/common/egl_g3d.c|2 +-
 src/gallium/state_trackers/glx/xlib/xm_api.c   |4 +-
 src/gallium/state_trackers/vega/vg_context.c   |4 +-
 src/gallium/state_trackers/wgl/stw_pixelformat.c   |4 +-
 src/gallium/state_trackers/xa/xa_tracker.c |4 +-
 src/gallium/state_trackers/xorg/xorg_dri2.c|4 +-
 src/gallium/tests/unit/u_format_test.c |   24 
 src/mesa/state_tracker/st_cb_drawpixels.c  |   40 ++--
 src/mesa/state_tracker/st_cb_eglimage.c|2 +-
 src/mesa/state_tracker/st_cb_fbo.c |6 +-
 src/mesa/state_tracker/st_cb_readpixels.c  |   14 ++--
 src/mesa/state_tracker/st_extensions.c |   10 ++--
 src/mesa/state_tracker/st_format.c |   34 +-
 61 files changed, 340 insertions(+), 339 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=866f9b18c68ede63c00917ec9c3dae3524ca8826
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): softpipe: add integer support

2011-10-11 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 396ac41fc285f0d7c8545f2b32ba373693a7a326
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=396ac41fc285f0d7c8545f2b32ba373693a7a326

Author: Dave Airlie airl...@redhat.com
Date:   Mon Sep 19 15:05:51 2011 +0100

softpipe: add integer support

This adds support to the clear and tile caches for integer storage
and clearing, avoiding any floating paths.

Signed-off-by: Dave Airlie airl...@redhat.com

---

 src/gallium/drivers/softpipe/sp_clear.c  |7 +-
 src/gallium/drivers/softpipe/sp_tex_tile_cache.c |   32 -
 src/gallium/drivers/softpipe/sp_tex_tile_cache.h |2 +
 src/gallium/drivers/softpipe/sp_tile_cache.c |  142 +-
 src/gallium/drivers/softpipe/sp_tile_cache.h |7 +-
 5 files changed, 146 insertions(+), 44 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_clear.c 
b/src/gallium/drivers/softpipe/sp_clear.c
index bfb16be..3cb3b72 100644
--- a/src/gallium/drivers/softpipe/sp_clear.c
+++ b/src/gallium/drivers/softpipe/sp_clear.c
@@ -68,17 +68,16 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers,
   for (i = 0; i  softpipe-framebuffer.nr_cbufs; i++) {
  struct pipe_surface *ps = softpipe-framebuffer.cbufs[i];
 
- util_pack_color(color-f, ps-format, uc);
- sp_tile_cache_clear(softpipe-cbuf_cache[i], color-f, uc.ui);
+ sp_tile_cache_clear(softpipe-cbuf_cache[i], color, 0);
   }
}
 
if (buffers  PIPE_CLEAR_DEPTHSTENCIL) {
-  static const float zero[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
+  static const union pipe_color_union zero;
   struct pipe_surface *ps = softpipe-framebuffer.zsbuf;
 
   cv = util_pack_z_stencil(ps-format, depth, stencil);
-  sp_tile_cache_clear(softpipe-zsbuf_cache, zero, cv);
+  sp_tile_cache_clear(softpipe-zsbuf_cache, zero, cv);
}
 
softpipe-dirty_render_cache = TRUE;
diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c 
b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
index e589ee7..2e665c9 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
@@ -35,6 +35,7 @@
 #include util/u_inlines.h
 #include util/u_memory.h
 #include util/u_tile.h
+#include util/u_format.h
 #include util/u_math.h
 #include sp_context.h
 #include sp_texture.h
@@ -228,7 +229,7 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
 union tex_tile_address addr )
 {
struct softpipe_tex_cached_tile *tile;
-   
+
tile = tc-entries + tex_cache_pos( addr );
 
if (addr.value != tile-addr.value) {
@@ -290,15 +291,34 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache 
*tc,
   /* Get tile from the transfer (view into texture), explicitly passing
* the image format.
*/
-  pipe_get_tile_rgba_format(tc-pipe,
+  if (util_format_is_pure_uint(tc-format)) {
+ pipe_get_tile_ui_format(tc-pipe,
+ tc-tex_trans,
+ addr.bits.x * TILE_SIZE,
+ addr.bits.y * TILE_SIZE,
+ TILE_SIZE,
+ TILE_SIZE,
+ tc-format,
+ (unsigned *) tile-data.colorui);
+  } else if (util_format_is_pure_sint(tc-format)) {
+ pipe_get_tile_i_format(tc-pipe,
 tc-tex_trans,
-addr.bits.x * TILE_SIZE, 
+addr.bits.x * TILE_SIZE,
 addr.bits.y * TILE_SIZE,
 TILE_SIZE,
-TILE_SIZE,
+ TILE_SIZE,
 tc-format,
-(float *) tile-data.color);
-
+(int *) tile-data.colori);
+  } else {
+ pipe_get_tile_rgba_format(tc-pipe,
+   tc-tex_trans,
+   addr.bits.x * TILE_SIZE,
+   addr.bits.y * TILE_SIZE,
+   TILE_SIZE,
+   TILE_SIZE,
+   tc-format,
+   (float *) tile-data.color);
+  }
   tile-addr = addr;
}
 
diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h 
b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h
index 9bced37..4098aa1 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h
@@ -68,6 +68,8 @@ struct softpipe_tex_cached_tile
union tex_tile_address addr;
union {
   float color[TILE_SIZE][TILE_SIZE][4];
+  unsigned int colorui[TILE_SIZE][TILE_SIZE][4];
+  int colori[TILE_SIZE][TILE_SIZE][4];
} data;
 };
 
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c 

Mesa (master): svga: remove support for shader model 2.0

2011-10-11 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 94b219b9e2c20711078b1628cf1fa599a29bf67f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=94b219b9e2c20711078b1628cf1fa599a29bf67f

Author: Brian Paul bri...@vmware.com
Date:   Tue Oct 11 09:30:09 2011 -0600

svga: remove support for shader model 2.0

We've been requiring SM 3.0 all along so this just removes unused code.

Reviewed-by: Jose Fonseca jfons...@vmware.com

---

 src/gallium/drivers/svga/Makefile.sources  |1 -
 src/gallium/drivers/svga/svga_pipe_fs.c|3 -
 src/gallium/drivers/svga/svga_pipe_vs.c|3 -
 src/gallium/drivers/svga/svga_screen.c |   38 ++--
 src/gallium/drivers/svga/svga_screen.h |3 -
 src/gallium/drivers/svga/svga_tgsi.c   |7 +-
 src/gallium/drivers/svga/svga_tgsi_decl_sm20.c |  277 
 src/gallium/drivers/svga/svga_tgsi_emit.h  |5 -
 src/gallium/drivers/svga/svga_tgsi_insn.c  |   62 +-
 9 files changed, 25 insertions(+), 374 deletions(-)

diff --git a/src/gallium/drivers/svga/Makefile.sources 
b/src/gallium/drivers/svga/Makefile.sources
index 5e714fc..de4622b 100644
--- a/src/gallium/drivers/svga/Makefile.sources
+++ b/src/gallium/drivers/svga/Makefile.sources
@@ -37,7 +37,6 @@ C_SOURCES := \
svga_swtnl_draw.c \
svga_swtnl_state.c \
svga_tgsi.c \
-   svga_tgsi_decl_sm20.c \
svga_tgsi_decl_sm30.c \
svga_tgsi_insn.c \
svga_sampler_view.c \
diff --git a/src/gallium/drivers/svga/svga_pipe_fs.c 
b/src/gallium/drivers/svga/svga_pipe_fs.c
index b71bc66..347341e 100644
--- a/src/gallium/drivers/svga/svga_pipe_fs.c
+++ b/src/gallium/drivers/svga/svga_pipe_fs.c
@@ -29,7 +29,6 @@
 #include util/u_bitmask.h
 #include tgsi/tgsi_parse.h
 
-#include svga_screen.h
 #include svga_context.h
 #include svga_tgsi.h
 #include svga_hw_reg.h
@@ -46,7 +45,6 @@ svga_create_fs_state(struct pipe_context *pipe,
  const struct pipe_shader_state *templ)
 {
struct svga_context *svga = svga_context(pipe);
-   struct svga_screen *svgascreen = svga_screen(pipe-screen);
struct svga_fragment_shader *fs;
 
fs = CALLOC_STRUCT(svga_fragment_shader);
@@ -60,7 +58,6 @@ svga_create_fs_state(struct pipe_context *pipe,
tgsi_scan_shader(fs-base.tokens, fs-base.info);
 
fs-base.id = svga-debug.shader_id++;
-   fs-base.use_sm30 = svgascreen-use_ps30;

if (SVGA_DEBUG  DEBUG_TGSI || 0) {
   debug_printf(%s id: %u, inputs: %u, outputs: %u\n,
diff --git a/src/gallium/drivers/svga/svga_pipe_vs.c 
b/src/gallium/drivers/svga/svga_pipe_vs.c
index de8c919..11d1dc3 100644
--- a/src/gallium/drivers/svga/svga_pipe_vs.c
+++ b/src/gallium/drivers/svga/svga_pipe_vs.c
@@ -31,7 +31,6 @@
 #include tgsi/tgsi_parse.h
 #include tgsi/tgsi_text.h
 
-#include svga_screen.h
 #include svga_context.h
 #include svga_tgsi.h
 #include svga_hw_reg.h
@@ -101,7 +100,6 @@ svga_create_vs_state(struct pipe_context *pipe,
  const struct pipe_shader_state *templ)
 {
struct svga_context *svga = svga_context(pipe);
-   struct svga_screen *svgascreen = svga_screen(pipe-screen);
struct svga_vertex_shader *vs = CALLOC_STRUCT(svga_vertex_shader);
if (!vs)
   return NULL;
@@ -126,7 +124,6 @@ svga_create_vs_state(struct pipe_context *pipe,
}
 
vs-base.id = svga-debug.shader_id++;
-   vs-base.use_sm30 = svgascreen-use_vs30;
 
if (SVGA_DEBUG  DEBUG_TGSI || 0) {
   debug_printf(%s id: %u, inputs: %u, outputs: %u\n,
diff --git a/src/gallium/drivers/svga/svga_screen.c 
b/src/gallium/drivers/svga/svga_screen.c
index a624cd9..7c4aa31 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -129,7 +129,7 @@ svga_get_paramf(struct pipe_screen *screen, enum pipe_cap 
param)
case PIPE_CAP_TWO_SIDED_STENCIL:
   return 1;
case PIPE_CAP_GLSL:
-  return svgascreen-use_ps30  svgascreen-use_vs30;
+  return 1;
case PIPE_CAP_ANISOTROPIC_FILTER:
   return 1;
case PIPE_CAP_POINT_SPRITE:
@@ -220,18 +220,18 @@ static int svga_get_shader_param(struct pipe_screen 
*screen, unsigned shader, en
   case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
   case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
   case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
- return svgascreen-use_ps30 ? 512 : 96;
+ return 512;
   case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
  return SVGA3D_MAX_NESTING_LEVEL;
   case PIPE_SHADER_CAP_MAX_INPUTS:
  return 10;
   case PIPE_SHADER_CAP_MAX_CONSTS:
- return svgascreen-use_ps30 ? 224 : 16;
+ return 224;
   case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
  return 1;
   case PIPE_SHADER_CAP_MAX_TEMPS:
  if (!sws-get_cap(sws, SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS, 
result))
-return svgascreen-use_ps30 ? 32 : 12;
+return 32;
  return result.u;
   case PIPE_SHADER_CAP_MAX_ADDRS:
   case 

Mesa (master): svga: remove old, unused sincos code for SM2.0

2011-10-11 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b875838ec302c4e830e13ebd5fa834fd22830279
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b875838ec302c4e830e13ebd5fa834fd22830279

Author: Brian Paul bri...@vmware.com
Date:   Tue Oct 11 09:39:28 2011 -0600

svga: remove old, unused sincos code for SM2.0

---

 src/gallium/drivers/svga/svga_tgsi_emit.h |3 --
 src/gallium/drivers/svga/svga_tgsi_insn.c |   48 -
 2 files changed, 0 insertions(+), 51 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h 
b/src/gallium/drivers/svga/svga_tgsi_emit.h
index 717a0af..8ff25d6 100644
--- a/src/gallium/drivers/svga/svga_tgsi_emit.h
+++ b/src/gallium/drivers/svga/svga_tgsi_emit.h
@@ -89,9 +89,6 @@ struct svga_shader_emitter
boolean created_loop_const;
int loop_const_idx;
 
-   boolean created_sincos_consts;
-   int sincos_consts_idx;
-
unsigned inverted_texcoords;  /** bitmask of which texcoords are flipped */
struct src_register ps_true_texcoord[PIPE_MAX_ATTRIBS];
struct src_register ps_inverted_texcoord[PIPE_MAX_ATTRIBS];
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c 
b/src/gallium/drivers/svga/svga_tgsi_insn.c
index 0e8f63d..5a9af89 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -657,33 +657,6 @@ create_loop_const( struct svga_shader_emitter *emit )
 }
 
 static INLINE boolean
-create_sincos_consts( struct svga_shader_emitter *emit )
-{
-   unsigned idx = emit-nr_hw_float_const++;
-
-   if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx,
--1.5500992e-006f,
--2.1701389e-005f,
-0.0026041667f,
-0.00026041668f ))
-  return FALSE;
-
-   emit-sincos_consts_idx = idx;
-   idx = emit-nr_hw_float_const++;
-
-   if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx,
--0.02084f,
--0.1250f,
-1.0f,
-0.5000f ))
-  return FALSE;
-
-   emit-created_sincos_consts = TRUE;
-
-   return TRUE;
-}
-
-static INLINE boolean
 create_arl_consts( struct svga_shader_emitter *emit )
 {
int i;
@@ -762,18 +735,6 @@ get_loop_const( struct svga_shader_emitter *emit )
 emit-loop_const_idx );
 }
 
-/* returns a sincos const */
-static INLINE struct src_register
-get_sincos_const( struct svga_shader_emitter *emit,
-  unsigned index )
-{
-   assert(emit-created_sincos_consts);
-   assert(emit-sincos_consts_idx = 0);
-   assert(index == 0 || index == 1);
-   return src_register( SVGA3DREG_CONST,
-emit-sincos_consts_idx + index );
-}
-
 static INLINE struct src_register
 get_fake_arl_const( struct svga_shader_emitter *emit )
 {
@@ -3071,12 +3032,6 @@ needs_to_create_loop_const( struct svga_shader_emitter 
*emit )
 }
 
 static INLINE boolean
-needs_to_create_sincos_consts( struct svga_shader_emitter *emit )
-{
-   return FALSE;
-}
-
-static INLINE boolean
 needs_to_create_arl_consts( struct svga_shader_emitter *emit )
 {
return (emit-num_arl_consts  0);
@@ -3177,9 +3132,6 @@ static boolean svga_shader_emit_helpers( struct 
svga_shader_emitter *emit )
if (needs_to_create_loop_const( emit )) {
   create_loop_const( emit );
}
-   if (needs_to_create_sincos_consts( emit )) {
-  create_sincos_consts( emit );
-   }
if (needs_to_create_arl_consts( emit )) {
   create_arl_consts( emit );
}

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


Mesa (master): mesa: Accept GL_DEPTH and GL_STENCIL for window system FBO only

2011-10-11 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: a8328cc132e9edd55141e8e7822909a85bda12d6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8328cc132e9edd55141e8e7822909a85bda12d6

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Mon Oct  3 12:02:18 2011 -0700

mesa: Accept GL_DEPTH and GL_STENCIL for window system FBO only

Previously GL_DEPTH_BUFFER and GL_STENCIL_BUFFER were (incorrectly)
allowed for both.  Those enums don't even really exist!  Now GL_DEPTH
and GL_STENCIL are only allowed for the window system FBO.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Jose Fonseca jfons...@vmware.com

---

 src/mesa/main/fbobject.c |   39 +++
 1 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 7571155..e945f0b 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -254,14 +254,8 @@ _mesa_get_attachment(struct gl_context *ctx, struct 
gl_framebuffer *fb,
   if (ctx-API != API_OPENGL)
 return NULL;
   /* fall-through */
-   case GL_DEPTH_BUFFER:
-  /* fall-through / new in GL 3.0 */
case GL_DEPTH_ATTACHMENT_EXT:
   return fb-Attachment[BUFFER_DEPTH];
-   case GL_STENCIL_BUFFER:
-  if (ctx-API != API_OPENGL)
-return NULL;
-  /* fall-through / new in GL 3.0 */
case GL_STENCIL_ATTACHMENT_EXT:
   return fb-Attachment[BUFFER_STENCIL];
default:
@@ -294,13 +288,34 @@ _mesa_get_fb0_attachment(struct gl_context *ctx, struct 
gl_framebuffer *fb,
  return fb-Attachment[BUFFER_AUX0];
   }
   return NULL;
-   case GL_DEPTH_BUFFER:
-  /* fall-through / new in GL 3.0 */
-   case GL_DEPTH_ATTACHMENT_EXT:
+
+   /* Page 336 (page 352 of the PDF) of the OpenGL 3.0 spec says:
+*
+* If the default framebuffer is bound to target, then attachment must
+* be one of FRONT LEFT, FRONT RIGHT, BACK LEFT, BACK RIGHT, or AUXi,
+* identifying a color buffer; DEPTH, identifying the depth buffer; or
+* STENCIL, identifying the stencil buffer.
+*
+* Revision #34 of the ARB_framebuffer_object spec has essentially the same
+* language.  However, revision #33 of the ARB_framebuffer_object spec
+* says:
+*
+* If the default framebuffer is bound to target, then attachment
+* must be one of FRONT_LEFT, FRONT_RIGHT, BACK_LEFT, BACK_RIGHT, AUXi,
+* DEPTH_BUFFER, or STENCIL_BUFFER, identifying a color buffer, the
+* depth buffer, or the stencil buffer, and pname may be
+* FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE or
+* FRAMEBUFFER_ATTACHMENT_OBJECT_NAME.
+*
+* The enum values for DEPTH_BUFFER and STENCIL_BUFFER have been removed
+* from glext.h, so shipping apps should not use those values.
+*
+* Note that neither EXT_framebuffer_object nor OES_framebuffer_object
+* support queries of the window system FBO.
+*/
+   case GL_DEPTH:
   return fb-Attachment[BUFFER_DEPTH];
-   case GL_STENCIL_BUFFER:
-  /* fall-through / new in GL 3.0 */
-   case GL_STENCIL_ATTACHMENT_EXT:
+   case GL_STENCIL:
   return fb-Attachment[BUFFER_STENCIL];
default:
   return NULL;

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


Mesa (master): mesa: Only allow queries of window system FBO on desktop GL w/ARB_fbo

2011-10-11 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: da2e41cd88dd68b658534390ed69dd422172d07b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=da2e41cd88dd68b658534390ed69dd422172d07b

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Mon Oct  3 12:04:09 2011 -0700

mesa: Only allow queries of window system FBO on desktop GL w/ARB_fbo

Neither OES_framebuffer_object nor EXT_framebuffer_object allow
querying the window system FBO.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Jose Fonseca jfons...@vmware.com

---

 src/mesa/main/fbobject.c |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index e945f0b..f9da54e 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2276,6 +2276,21 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum 
target, GLenum attachment,
}
 
if (is_winsys_fbo(buffer)) {
+  /* Page 126 (page 136 of the PDF) of the OpenGL ES 2.0.25 spec
+   * says:
+   *
+   * If the framebuffer currently bound to target is zero, then
+   * INVALID_OPERATION is generated.
+   *
+   * The EXT_framebuffer_object spec has the same wording, and the
+   * OES_framebuffer_object spec refers to the EXT_framebuffer_object
+   * spec.
+   */
+  if (ctx-API != API_OPENGL || !ctx-Extensions.ARB_framebuffer_object) {
+_mesa_error(ctx, GL_INVALID_OPERATION,
+glGetFramebufferAttachmentParameteriv(bound FBO = 0));
+return;
+  }
   /* the default / window-system FBO */
   att = _mesa_get_fb0_attachment(ctx, buffer, attachment);
}

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


Mesa (master): i965: Replace incorrect use of GLboolean with enum brw_compression.

2011-10-11 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 3f5e938a9ded42ae8dc9ae2486e8d5c8b64cfe07
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f5e938a9ded42ae8dc9ae2486e8d5c8b64cfe07

Author: Kenneth Graunke kenn...@whitecape.org
Date:   Fri Oct  7 12:32:52 2011 -0700

i965: Replace incorrect use of GLboolean with enum brw_compression.

brw_set_compression_control took a GLboolean as an argument, then
promptly used a switch statement to compare it with various enumeration
values.  Clearly it's not actually a boolean.

Introduce a new enumeration type, enum brw_compression, and use that.

Found by converting GLboolean to bool; clang then gave warnings about
switching on a boolean and ultimately duplicated case errors.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Eric Anholt e...@anholt.net
Reviewed-by: Chad Versace c...@chad-versace.us

---

 src/mesa/drivers/dri/i965/brw_defines.h |8 +---
 src/mesa/drivers/dri/i965/brw_eu.c  |4 +++-
 src/mesa/drivers/dri/i965/brw_eu.h  |2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
b/src/mesa/drivers/dri/i965/brw_defines.h
index a111630..21a115b 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -486,9 +486,11 @@
 #define BRW_CHANNEL_Z 2
 #define BRW_CHANNEL_W 3
 
-#define BRW_COMPRESSION_NONE  0
-#define BRW_COMPRESSION_2NDHALF   1
-#define BRW_COMPRESSION_COMPRESSED2
+enum brw_compression {
+   BRW_COMPRESSION_NONE   = 0,
+   BRW_COMPRESSION_2NDHALF= 1,
+   BRW_COMPRESSION_COMPRESSED = 2,
+};
 
 #define GEN6_COMPRESSION_1Q0
 #define GEN6_COMPRESSION_2Q1
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c 
b/src/mesa/drivers/dri/i965/brw_eu.c
index 0e04af9..b5a858b 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -99,7 +99,9 @@ void brw_set_access_mode( struct brw_compile *p, GLuint 
access_mode )
p-current-header.access_mode = access_mode;
 }
 
-void brw_set_compression_control( struct brw_compile *p, GLboolean 
compression_control )
+void
+brw_set_compression_control(struct brw_compile *p,
+   enum brw_compression compression_control)
 {
p-compressed = (compression_control == BRW_COMPRESSION_COMPRESSED);
 
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
b/src/mesa/drivers/dri/i965/brw_eu.h
index 31334ce..8bb 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -790,7 +790,7 @@ void brw_push_insn_state( struct brw_compile *p );
 void brw_set_mask_control( struct brw_compile *p, GLuint value );
 void brw_set_saturate( struct brw_compile *p, GLuint value );
 void brw_set_access_mode( struct brw_compile *p, GLuint access_mode );
-void brw_set_compression_control( struct brw_compile *p, GLboolean control );
+void brw_set_compression_control(struct brw_compile *p, enum brw_compression 
c);
 void brw_set_predicate_control_flag_value( struct brw_compile *p, GLuint value 
);
 void brw_set_predicate_control( struct brw_compile *p, GLuint pc );
 void brw_set_predicate_inverse(struct brw_compile *p, bool predicate_inverse);

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


Mesa (master): nv50: don't crash on TXD opcode

2011-10-11 Thread Marcin Ślusarz
Module: Mesa
Branch: master
Commit: 7f3de70c3c8e9ec9dfc34ddd3a08c4b73c007541
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f3de70c3c8e9ec9dfc34ddd3a08c4b73c007541

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Mon Oct 10 23:31:04 2011 +0200

nv50: don't crash on TXD opcode

It doesn't implement full TXD, but at least it does not crash.
Fixes arb_shader_texture_lod-texgrad and glsl-fs-shadow2DGradARB-*
piglit tests.

---

 src/gallium/drivers/nv50/nv50_tgsi_to_nc.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c 
b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
index 4b11ae1..717a902 100644
--- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
+++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
@@ -847,6 +847,7 @@ translate_opcode(uint opcode)
case TGSI_OPCODE_TXP: return NV_OP_TEX;
case TGSI_OPCODE_TXB: return NV_OP_TXB;
case TGSI_OPCODE_TXL: return NV_OP_TXL;
+   case TGSI_OPCODE_TXD: return NV_OP_TEX;
case TGSI_OPCODE_XOR: return NV_OP_XOR;
default:
   return NV_OP_NOP;
@@ -1960,6 +1961,7 @@ bld_instruction(struct bld_context *bld,
case TGSI_OPCODE_TXB:
case TGSI_OPCODE_TXL:
case TGSI_OPCODE_TXP:
+   case TGSI_OPCODE_TXD: // fake
   bld_tex(bld, dst0, insn);
   break;
case TGSI_OPCODE_XPD:

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


Mesa (master): i965: Fix computation of abs(-x) in FS

2011-10-11 Thread Paul Berry
Module: Mesa
Branch: master
Commit: d06cc42c3c85382600176d118d8bf492b4de6a55
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d06cc42c3c85382600176d118d8bf492b4de6a55

Author: Paul Berry stereotype...@gmail.com
Date:   Thu Oct  6 20:58:18 2011 -0700

i965: Fix computation of abs(-x) in FS

When updating a register reference to reflect the fact that we were
taking its absolute value, the fragment shader back-end failed to
clear the negate flag, resulting in abs(-x) getting computed as
-abs(x).

I also found (and fixed) a similar problem in brw_eu.h, but I'm not
aware of an actual manifestation of that problem.

Fixes piglit test glsl-fs-abs-neg-with-intermediate.

---

 src/mesa/drivers/dri/i965/brw_eu.h   |1 +
 src/mesa/drivers/dri/i965/brw_fs.cpp |5 -
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
b/src/mesa/drivers/dri/i965/brw_eu.h
index 8bb..adc09f8 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -698,6 +698,7 @@ static INLINE struct brw_reg negate( struct brw_reg reg )
 static INLINE struct brw_reg brw_abs( struct brw_reg reg )
 {
reg.abs = 1;
+   reg.negate = 0;
return reg;
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 6d17839..f731662 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1363,8 +1363,11 @@ fs_visitor::register_coalesce()
scan_inst-src[i].reg == inst-dst.reg 
scan_inst-src[i].reg_offset == inst-dst.reg_offset) {
   fs_reg new_src = inst-src[0];
+   if (scan_inst-src[i].abs) {
+  new_src.negate = 0;
+  new_src.abs = 1;
+   }
   new_src.negate ^= scan_inst-src[i].negate;
-  new_src.abs |= scan_inst-src[i].abs;
   scan_inst-src[i] = new_src;
}
 }

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


Mesa (master): intel: Assert that no batch is emitted if a region is mapped

2011-10-11 Thread Chad Versace
Module: Mesa
Branch: master
Commit: e9adfa2ba1af9c3579b25327335c47118b6c7c3f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e9adfa2ba1af9c3579b25327335c47118b6c7c3f

Author: Chad Versace c...@chad-versace.us
Date:   Thu Oct  6 14:18:35 2011 -0700

intel: Assert that no batch is emitted if a region is mapped

What I would prefer to assert is that, for each region that is currently
mapped, no batch is emitted that uses that region's bo. However, it's much
easier to implement this big hammer.

Observe that this requires that the batch flush in intel_region_map() be
moved to within the map_refcount guard.

v2: Add comments (borrowed from anholt's reply) explaining why the
assertion is a good idea.

Reviewed-by: Eric Anholt e...@anholt.net
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Signed-off-by: Chad Versace c...@chad-versace.us

---

 src/mesa/drivers/dri/intel/intel_batchbuffer.c |7 +++
 src/mesa/drivers/dri/intel/intel_context.h |8 
 src/mesa/drivers/dri/intel/intel_regions.c |   18 +-
 3 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c 
b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 37c13c9..8dfae67 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -148,6 +148,13 @@ void
 _intel_batchbuffer_flush(struct intel_context *intel,
 const char *file, int line)
 {
+   /* No batch should be emitted that uses a mapped region, because that would
+* cause the map to be incoherent with GPU rendering done by the
+* batchbuffer. To ensure that condition, we assert a condition that is
+* stronger but easier to implement: that *no* region is mapped.
+*/
+   assert(intel-num_mapped_regions == 0);
+
if (intel-batch.used == 0)
   return;
 
diff --git a/src/mesa/drivers/dri/intel/intel_context.h 
b/src/mesa/drivers/dri/intel/intel_context.h
index cf7ab9e..cb316e8 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -287,6 +287,14 @@ struct intel_context
 */
GLboolean is_front_buffer_reading;
 
+   /**
+* Count of intel_regions that are mapped.
+*
+* This allows us to assert that no batch buffer is emitted if a
+* region is mapped.
+*/
+   int num_mapped_regions;
+
GLboolean use_texture_tiling;
GLboolean use_early_z;
 
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c 
b/src/mesa/drivers/dri/intel/intel_regions.c
index 7faf4ca..67142a1 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -111,15 +111,28 @@ debug_backtrace(void)
 GLubyte *
 intel_region_map(struct intel_context *intel, struct intel_region *region)
 {
-   intel_flush(intel-ctx);
+   /* We have the region-map_refcount controlling mapping of the BO because
+* in software fallbacks we may end up mapping the same buffer multiple
+* times on Mesa's behalf, so we refcount our mappings to make sure that
+* the pointer stays valid until the end of the unmap chain.  However, we
+* must not emit any batchbuffers between the start of mapping and the end
+* of unmapping, or further use of the map will be incoherent with the GPU
+* rendering done by that batchbuffer. Hence we assert in
+* intel_batchbuffer_flush() that that doesn't happen, which means that the
+* flush is only needed on first map of the buffer.
+*/
 
_DBG(%s %p\n, __FUNCTION__, region);
if (!region-map_refcount++) {
+  intel_flush(intel-ctx);
+
   if (region-tiling != I915_TILING_NONE)
 drm_intel_gem_bo_map_gtt(region-bo);
   else
 drm_intel_bo_map(region-bo, GL_TRUE);
+
   region-map = region-bo-virtual;
+  ++intel-num_mapped_regions;
}
 
return region-map;
@@ -134,7 +147,10 @@ intel_region_unmap(struct intel_context *intel, struct 
intel_region *region)
 drm_intel_gem_bo_unmap_gtt(region-bo);
   else
 drm_intel_bo_unmap(region-bo);
+
   region-map = NULL;
+  --intel-num_mapped_regions;
+  assert(intel-num_mapped_regions = 0);
}
 }
 

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


Mesa (master): mesa: make _mesa_update_depth/stencil_buffer() static

2011-10-11 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 7aab0fbaa6ec41c720bed6cfcb53a50c2a646a26
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7aab0fbaa6ec41c720bed6cfcb53a50c2a646a26

Author: Brian Paul bri...@vmware.com
Date:   Mon Oct 10 21:00:01 2011 -0600

mesa: make _mesa_update_depth/stencil_buffer() static

These functions were only called in framebuffer.c where they were defined.
Remove the unneeded attIndex parameter too.

Reviewed-by: Eric Anholt e...@anholt.net

---

 src/mesa/main/framebuffer.c |   34 ++
 src/mesa/main/framebuffer.h |8 
 2 files changed, 10 insertions(+), 32 deletions(-)

diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 42da176..8beda31 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -608,19 +608,12 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
  * create and install a depth wrapper/adaptor.
  *
  * \param fb  the framebuffer whose _DepthBuffer field to update
- * \param attIndex  indicates the renderbuffer to possibly wrap
  */
-void
-_mesa_update_depth_buffer(struct gl_context *ctx,
-  struct gl_framebuffer *fb,
-  GLuint attIndex)
+static void
+update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb)
 {
-   struct gl_renderbuffer *depthRb;
-
-   /* only one possiblity for now */
-   ASSERT(attIndex == BUFFER_DEPTH);
-
-   depthRb = fb-Attachment[attIndex].Renderbuffer;
+   struct gl_renderbuffer *depthRb =
+  fb-Attachment[BUFFER_DEPTH].Renderbuffer;
 
if (depthRb  _mesa_is_format_packed_depth_stencil(depthRb-Format)) {
   /* The attached depth buffer is a GL_DEPTH_STENCIL renderbuffer */
@@ -655,19 +648,12 @@ _mesa_update_depth_buffer(struct gl_context *ctx,
  * create and install a stencil wrapper/adaptor.
  *
  * \param fb  the framebuffer whose _StencilBuffer field to update
- * \param attIndex  indicates the renderbuffer to possibly wrap
  */
-void
-_mesa_update_stencil_buffer(struct gl_context *ctx,
-struct gl_framebuffer *fb,
-GLuint attIndex)
+static void
+update_stencil_buffer(struct gl_context *ctx, struct gl_framebuffer *fb)
 {
-   struct gl_renderbuffer *stencilRb;
-
-   ASSERT(attIndex == BUFFER_DEPTH ||
-  attIndex == BUFFER_STENCIL);
-
-   stencilRb = fb-Attachment[attIndex].Renderbuffer;
+   struct gl_renderbuffer *stencilRb =
+  fb-Attachment[BUFFER_STENCIL].Renderbuffer;
 
if (stencilRb  _mesa_is_format_packed_depth_stencil(stencilRb-Format)) {
   /* The attached stencil buffer is a GL_DEPTH_STENCIL renderbuffer */
@@ -826,8 +812,8 @@ update_framebuffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
 */
update_color_draw_buffers(ctx, fb);
update_color_read_buffer(ctx, fb);
-   _mesa_update_depth_buffer(ctx, fb, BUFFER_DEPTH);
-   _mesa_update_stencil_buffer(ctx, fb, BUFFER_STENCIL);
+   update_depth_buffer(ctx, fb);
+   update_stencil_buffer(ctx, fb);
 
compute_depth_max(fb);
 }
diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
index 7aef3e0..ad53d8c 100644
--- a/src/mesa/main/framebuffer.h
+++ b/src/mesa/main/framebuffer.h
@@ -82,14 +82,6 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
struct gl_framebuffer *fb);
 
 extern void
-_mesa_update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
-GLuint attIndex);
-
-extern void
-_mesa_update_stencil_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
-GLuint attIndex);
-
-extern void
 _mesa_update_framebuffer(struct gl_context *ctx);
 
 extern GLboolean

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