Mesa (master): i915g: Silence warning.

2011-10-09 Thread Stephane Marchesin
Module: Mesa
Branch: master
Commit: e125786be8e19a9606afb91cd7e8bc37d035b63f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e125786be8e19a9606afb91cd7e8bc37d035b63f

Author: Stéphane Marchesin marc...@chromium.org
Date:   Sat Oct  8 20:19:53 2011 -0700

i915g: Silence warning.

---

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

diff --git a/src/gallium/drivers/i915/i915_state_static.c 
b/src/gallium/drivers/i915/i915_state_static.c
index 7f60311..1ef6a0d 100644
--- a/src/gallium/drivers/i915/i915_state_static.c
+++ b/src/gallium/drivers/i915/i915_state_static.c
@@ -198,7 +198,7 @@ static void update_dst_buf_vars(struct i915_context *i915)
struct pipe_surface *depth_surface = i915-framebuffer.zsbuf;
uint32_t dst_buf_vars, cformat, zformat;
uint32_t early_z = 0;
-   uint32_t fixup;
+   uint32_t fixup = 0;
int need_fixup;
 
if (cbuf_surface)

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


Mesa (master): i915g: Implement vertex textures.

2011-10-09 Thread Stephane Marchesin
Module: Mesa
Branch: master
Commit: 8a22064d316efcdc0d0107fe227a2ed5a746c4f8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a22064d316efcdc0d0107fe227a2ed5a746c4f8

Author: Stéphane Marchesin marc...@chromium.org
Date:   Sat Oct  8 23:54:53 2011 -0700

i915g: Implement vertex textures.

---

 src/gallium/drivers/i915/i915_context.c |8 ++
 src/gallium/drivers/i915/i915_context.h |   17 
 src/gallium/drivers/i915/i915_screen.c  |  129 +++-
 src/gallium/drivers/i915/i915_state.c   |  138 ++-
 4 files changed, 230 insertions(+), 62 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_context.c 
b/src/gallium/drivers/i915/i915_context.c
index 1b30309..ff6d715 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -79,6 +79,11 @@ i915_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
else
   draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0, NULL, 0);
 
+   if (i915-num_vertex_sampler_views  0)
+  i915_prepare_vertex_sampling(i915,
+   i915-num_vertex_sampler_views,
+   i915-vertex_sampler_views);
+
/*
 * Do the drawing
 */
@@ -86,6 +91,9 @@ i915_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
 
if (mapped_indices)
   draw_set_mapped_index_buffer(draw, NULL);
+
+   if (i915-num_vertex_sampler_views  0)
+  i915_cleanup_vertex_sampling(i915);
 }
 
 
diff --git a/src/gallium/drivers/i915/i915_context.h 
b/src/gallium/drivers/i915/i915_context.h
index dacd0a6..7f67f5f 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -225,6 +225,7 @@ struct i915_context {
 */
const struct i915_blend_state   *blend;
const struct i915_sampler_state *sampler[PIPE_MAX_SAMPLERS];
+   struct pipe_sampler_state *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
const struct i915_depth_stencil_state   *depth_stencil;
const struct i915_rasterizer_state  *rasterizer;
 
@@ -238,13 +239,19 @@ struct i915_context {
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
+   struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_index_buffer index_buffer;
 
unsigned dirty;
 
+   struct pipe_resource *mapped_vs_tex[PIPE_MAX_VERTEX_SAMPLERS];
+   struct i915_winsys_buffer* mapped_vs_tex_buffer[PIPE_MAX_VERTEX_SAMPLERS];
+
unsigned num_samplers;
unsigned num_fragment_sampler_views;
+   unsigned num_vertex_samplers;
+   unsigned num_vertex_sampler_views;
 
struct i915_winsys_batchbuffer *batch;
 
@@ -361,6 +368,16 @@ struct draw_stage *i915_draw_vbuf_stage( struct 
i915_context *i915 );
 
 
 /***
+ * i915_state.c:
+ */
+void i915_prepare_vertex_sampling(struct i915_context *i915,
+  unsigned num,
+  struct pipe_sampler_view **views);
+void i915_cleanup_vertex_sampling(struct i915_context *i915);
+
+
+
+/***
  * i915_state_emit.c: 
  */
 void i915_emit_hardware_state(struct i915_context *i915 );
diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c
index cc81835..7d9b865 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -100,6 +100,69 @@ i915_get_name(struct pipe_screen *screen)
 }
 
 static int
+i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum 
pipe_shader_cap cap)
+{
+   switch(shader) {
+   case PIPE_SHADER_VERTEX:
+  switch (cap) {
+  case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
+ if (debug_get_bool_option(DRAW_USE_LLVM, TRUE))
+return PIPE_MAX_VERTEX_SAMPLERS;
+ else
+return 0;
+  default:
+ return draw_get_shader_param(shader, cap);
+  }
+   case PIPE_SHADER_FRAGMENT:
+  /* XXX: these are just shader model 2.0 values, fix this! */
+  switch(cap) {
+  case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ return 96;
+  case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ return 64;
+  case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ return 32;
+  case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ return 8;
+  case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ return 0;
+  case PIPE_SHADER_CAP_MAX_INPUTS:
+ return 10;
+  case PIPE_SHADER_CAP_MAX_CONSTS:
+ return 32;
+  case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+  case PIPE_SHADER_CAP_MAX_TEMPS:
+ return 12; /* XXX: 12 - 32 ? */
+  case PIPE_SHADER_CAP_MAX_ADDRS:
+ return 0;
+  case 

Mesa (master): i915g: Fix comment.

2011-10-09 Thread Stephane Marchesin
Module: Mesa
Branch: master
Commit: 03cd54dc6044264ee7bf03541e37d9c3e18a834d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=03cd54dc6044264ee7bf03541e37d9c3e18a834d

Author: Stéphane Marchesin marc...@chromium.org
Date:   Sat Oct  8 23:57:27 2011 -0700

i915g: Fix comment.

---

 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 f6e5310..a233a04 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -361,7 +361,7 @@ static void i915_delete_sampler_state(struct pipe_context 
*pipe,
 
 
 /**
- * Called during state validation when LP_NEW_SAMPLER_VIEW is set.
+ * Called before drawing VBO to map vertex samplers and hand them to draw
  */
 void
 i915_prepare_vertex_sampling(struct i915_context *i915,

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


Mesa (master): i915g: Remove a TODO item.

2011-10-09 Thread Stephane Marchesin
Module: Mesa
Branch: master
Commit: 5dfeab71cf02d29259b72635ca04962dc192b596
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5dfeab71cf02d29259b72635ca04962dc192b596

Author: Stéphane Marchesin marc...@chromium.org
Date:   Sat Oct  8 23:58:06 2011 -0700

i915g: Remove a TODO item.

---

 src/gallium/drivers/i915/TODO |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/i915/TODO b/src/gallium/drivers/i915/TODO
index c26db19..802a62a 100644
--- a/src/gallium/drivers/i915/TODO
+++ b/src/gallium/drivers/i915/TODO
@@ -33,7 +33,6 @@ Random list of problems with i915g:
 
 - Leverage draw to enable more caps:
   * PIPE_CAP_TGSI_INSTANCEID
-  * PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS
 
 - Finish front/back face. We need to add face support to 
lp_build_system_values_array and use it in draw_llvm.c.
 

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


Mesa (master): i915g: Remove another TODO item which was done a while ago.

2011-10-09 Thread Stephane Marchesin
Module: Mesa
Branch: master
Commit: 06415d3fab443d95c666a7c1be46c27f27000529
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=06415d3fab443d95c666a7c1be46c27f27000529

Author: Stéphane Marchesin marc...@chromium.org
Date:   Sat Oct  8 23:58:46 2011 -0700

i915g: Remove another TODO item which was done a while ago.

---

 src/gallium/drivers/i915/TODO |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/i915/TODO b/src/gallium/drivers/i915/TODO
index 802a62a..2898969 100644
--- a/src/gallium/drivers/i915/TODO
+++ b/src/gallium/drivers/i915/TODO
@@ -1,8 +1,5 @@
 Random list of problems with i915g:
 
-- Check if PIPE_CAP_BLEND_EQUATION_SEPARATE work, the code is there.
-  If not fix it! A simple task, good for beginners.
-
 - Add support for PIPE_CAP_POINT_SPRITE either via the draw module or directly
   via the hardware, look at the classic driver, more advanced.
 

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


Mesa (master): u_blitter: add integer clear support

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

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

u_blitter: add integer clear support

We need add a new set of fragment shader variants, along with new vertex
elements for signed and unsigned clears.

The new fragment shader variants are due to the integers values requiring
CONSTANT interpolation. The new vertex element descriptions are for passing
the clear color as an unsigned or signed integer value.

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

---

 src/gallium/auxiliary/util/u_blitter.c |   89 
 src/gallium/auxiliary/util/u_blitter.h |1 +
 src/gallium/drivers/r300/r300_blit.c   |3 +-
 src/gallium/drivers/r600/r600_blit.c   |6 +-
 4 files changed, 74 insertions(+), 25 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 1500aa4..1f8b679 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -68,6 +68,7 @@ struct blitter_context_priv
/* Fragment shaders. */
/* The shader at index i outputs color to color buffers 0,1,...,i-1. */
void *fs_col[PIPE_MAX_COLOR_BUFS+1];
+   void *fs_col_int[PIPE_MAX_COLOR_BUFS+1];
 
/* FS which outputs a color from a texture,
   where the index is PIPE_TEXTURE_* to be sampled. */
@@ -88,6 +89,8 @@ struct blitter_context_priv
void *dsa_keep_depth_write_stencil;
 
void *velem_state;
+   void *velem_uint_state;
+   void *velem_sint_state;
 
/* Sampler state for clamping to a miplevel. */
void *sampler_state[PIPE_MAX_TEXTURE_LEVELS * 2];
@@ -208,6 +211,27 @@ struct blitter_context *util_blitter_create(struct 
pipe_context *pipe)
}
ctx-velem_state = pipe-create_vertex_elements_state(pipe, 2, velem[0]);
 
+   memset(velem[0], 0, sizeof(velem[0]) * 2);
+   for (i = 0; i  2; i++) {
+  velem[i].src_offset = i * 4 * sizeof(float);
+  if (i == 0) {
+ velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+  } else {
+ velem[i].src_format = PIPE_FORMAT_R32G32B32A32_SINT;
+  }
+   }
+   ctx-velem_sint_state = pipe-create_vertex_elements_state(pipe, 2, 
velem[0]);
+
+   memset(velem[0], 0, sizeof(velem[0]) * 2);
+   for (i = 0; i  2; i++) {
+  velem[i].src_offset = i * 4 * sizeof(float);
+  if (i == 0) {
+ velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+  } else {
+ velem[i].src_format = PIPE_FORMAT_R32G32B32A32_UINT;
+  }
+   }
+   ctx-velem_uint_state = pipe-create_vertex_elements_state(pipe, 2, 
velem[0]);
/* fragment shaders are created on-demand */
 
/* vertex shader */
@@ -250,6 +274,8 @@ void util_blitter_destroy(struct blitter_context *blitter)
pipe-delete_rasterizer_state(pipe, ctx-rs_state);
pipe-delete_vs_state(pipe, ctx-vs);
pipe-delete_vertex_elements_state(pipe, ctx-velem_state);
+   pipe-delete_vertex_elements_state(pipe, ctx-velem_sint_state);
+   pipe-delete_vertex_elements_state(pipe, ctx-velem_uint_state);
 
for (i = 0; i  PIPE_MAX_TEXTURE_TYPES; i++) {
   if (ctx-fs_texfetch_col[i])
@@ -258,9 +284,12 @@ void util_blitter_destroy(struct blitter_context *blitter)
  pipe-delete_fs_state(pipe, ctx-fs_texfetch_depth[i]);
}
 
-   for (i = 0; i = PIPE_MAX_COLOR_BUFS; i++)
+   for (i = 0; i = PIPE_MAX_COLOR_BUFS; i++) {
   if (ctx-fs_col[i])
  pipe-delete_fs_state(pipe, ctx-fs_col[i]);
+  if (ctx-fs_col_int[i])
+ pipe-delete_fs_state(pipe, ctx-fs_col_int[i]);
+   }
 
for (i = 0; i  PIPE_MAX_TEXTURE_LEVELS * 2; i++)
   if (ctx-sampler_state[i])
@@ -451,10 +480,11 @@ static void blitter_set_clear_color(struct 
blitter_context_priv *ctx,
 
if (color) {
   for (i = 0; i  4; i++) {
- ctx-vertices[i][1][0] = color-f[0];
- ctx-vertices[i][1][1] = color-f[1];
- ctx-vertices[i][1][2] = color-f[2];
- ctx-vertices[i][1][3] = color-f[3];
+ uint32_t *uiverts = (uint32_t *)ctx-vertices[i][1];
+ uiverts[0] = color-ui[0];
+ uiverts[1] = color-ui[1];
+ uiverts[2] = color-ui[2];
+ uiverts[3] = color-ui[3];
   }
} else {
   for (i = 0; i  4; i++) {
@@ -609,19 +639,28 @@ void **blitter_get_sampler_state(struct 
blitter_context_priv *ctx,
 }
 
 static INLINE
-void *blitter_get_fs_col(struct blitter_context_priv *ctx, unsigned num_cbufs)
+void *blitter_get_fs_col(struct blitter_context_priv *ctx, unsigned num_cbufs,
+ boolean int_format)
 {
struct pipe_context *pipe = ctx-base.pipe;
 
assert(num_cbufs = PIPE_MAX_COLOR_BUFS);
 
-   if (!ctx-fs_col[num_cbufs])
-  ctx-fs_col[num_cbufs] =
- util_make_fragment_cloneinput_shader(pipe, num_cbufs,
-  TGSI_SEMANTIC_GENERIC,
-

Mesa (master): r600g/eg: add integer types support

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

Author: Dave Airlie airl...@redhat.com
Date:   Mon Sep 26 19:06:40 2011 +0100

r600g/eg: add integer types support

adds handling for int texture/vertices to evergreen.

TODO r600/700 support.

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

---

 src/gallium/drivers/r600/evergreen_state.c |   52 ++-
 src/gallium/drivers/r600/r600_asm.c|   22 
 src/gallium/drivers/r600/r600_texture.c|2 +-
 3 files changed, 66 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index a6fcfe0..bc16be7 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -281,10 +281,16 @@ static uint32_t r600_translate_colorswap(enum pipe_format 
format)
return V_028C70_SWAP_ALT;
 
case PIPE_FORMAT_A8_UNORM:
+   case PIPE_FORMAT_A8_UINT:
+   case PIPE_FORMAT_A8_SINT:
case PIPE_FORMAT_R4A4_UNORM:
return V_028C70_SWAP_ALT_REV;
case PIPE_FORMAT_I8_UNORM:
case PIPE_FORMAT_L8_UNORM:
+   case PIPE_FORMAT_I8_UINT:
+   case PIPE_FORMAT_I8_SINT:
+   case PIPE_FORMAT_L8_UINT:
+   case PIPE_FORMAT_L8_SINT:
case PIPE_FORMAT_L8_SRGB:
case PIPE_FORMAT_R8_UNORM:
case PIPE_FORMAT_R8_SNORM:
@@ -306,12 +312,18 @@ static uint32_t r600_translate_colorswap(enum pipe_format 
format)
return V_028C70_SWAP_STD;
 
case PIPE_FORMAT_L8A8_UNORM:
+   case PIPE_FORMAT_L8A8_UINT:
+   case PIPE_FORMAT_L8A8_SINT:
case PIPE_FORMAT_L8A8_SRGB:
return V_028C70_SWAP_ALT;
case PIPE_FORMAT_R8G8_UNORM:
+   case PIPE_FORMAT_R8G8_UINT:
+   case PIPE_FORMAT_R8G8_SINT:
return V_028C70_SWAP_STD;
 
case PIPE_FORMAT_R16_UNORM:
+   case PIPE_FORMAT_R16_UINT:
+   case PIPE_FORMAT_R16_SINT:
case PIPE_FORMAT_R16_FLOAT:
return V_028C70_SWAP_STD;
 
@@ -332,6 +344,8 @@ static uint32_t r600_translate_colorswap(enum pipe_format 
format)
case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_R8G8B8A8_SSCALED:
case PIPE_FORMAT_R8G8B8A8_USCALED:
+   case PIPE_FORMAT_R8G8B8A8_SINT:
+   case PIPE_FORMAT_R8G8B8A8_UINT:
case PIPE_FORMAT_R8G8B8X8_UNORM:
return V_028C70_SWAP_STD;
 
@@ -358,17 +372,25 @@ static uint32_t r600_translate_colorswap(enum pipe_format 
format)
 
case PIPE_FORMAT_R11G11B10_FLOAT:
case PIPE_FORMAT_R32_FLOAT:
+   case PIPE_FORMAT_R32_UINT:
+   case PIPE_FORMAT_R32_SINT:
case PIPE_FORMAT_Z32_FLOAT:
case PIPE_FORMAT_R16G16_FLOAT:
case PIPE_FORMAT_R16G16_UNORM:
+   case PIPE_FORMAT_R16G16_UINT:
+   case PIPE_FORMAT_R16G16_SINT:
return V_028C70_SWAP_STD;
 
/* 64-bit buffers. */
case PIPE_FORMAT_R32G32_FLOAT:
+   case PIPE_FORMAT_R32G32_UINT:
+   case PIPE_FORMAT_R32G32_SINT:
case PIPE_FORMAT_R16G16B16A16_UNORM:
case PIPE_FORMAT_R16G16B16A16_SNORM:
case PIPE_FORMAT_R16G16B16A16_USCALED:
case PIPE_FORMAT_R16G16B16A16_SSCALED:
+   case PIPE_FORMAT_R16G16B16A16_UINT:
+   case PIPE_FORMAT_R16G16B16A16_SINT:
case PIPE_FORMAT_R16G16B16A16_FLOAT:
case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED:
 
@@ -378,6 +400,8 @@ static uint32_t r600_translate_colorswap(enum pipe_format 
format)
case PIPE_FORMAT_R32G32B32A32_UNORM:
case PIPE_FORMAT_R32G32B32A32_SSCALED:
case PIPE_FORMAT_R32G32B32A32_USCALED:
+   case PIPE_FORMAT_R32G32B32A32_SINT:
+   case PIPE_FORMAT_R32G32B32A32_UINT:
return V_028C70_SWAP_STD;
default:
R600_ERR(unsupported colorswap format %d\n, format);
@@ -396,11 +420,19 @@ static uint32_t r600_translate_colorformat(enum 
pipe_format format)
return V_028C70_COLOR_4_4;
 
case PIPE_FORMAT_A8_UNORM:
+   case PIPE_FORMAT_A8_UINT:
+   case PIPE_FORMAT_A8_SINT:
case PIPE_FORMAT_I8_UNORM:
+   case PIPE_FORMAT_I8_UINT:
+   case PIPE_FORMAT_I8_SINT:
case PIPE_FORMAT_L8_UNORM:
+   case PIPE_FORMAT_L8_UINT:
+   case PIPE_FORMAT_L8_SINT:
case PIPE_FORMAT_L8_SRGB:
case PIPE_FORMAT_R8_UNORM:
case PIPE_FORMAT_R8_SNORM:
+   case PIPE_FORMAT_R8_UINT:
+   case PIPE_FORMAT_R8_SINT:
return V_028C70_COLOR_8;
 
/* 16-bit buffers. */
@@ -419,11 +451,17 @@ static uint32_t r600_translate_colorformat(enum 
pipe_format format)
return V_028C70_COLOR_16;
 
case PIPE_FORMAT_L8A8_UNORM:
+   case PIPE_FORMAT_L8A8_UINT:
+   case PIPE_FORMAT_L8A8_SINT:
case PIPE_FORMAT_L8A8_SRGB:
case 

Mesa (master): nv50,nvc0: avoid unnecessary flushes

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

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sun Oct  9 00:10:47 2011 +0200

nv50,nvc0: avoid unnecessary flushes

Relocations don't consume pushbuffer space, so there is no need to
ensure there is any space in pushbuffer.

---

 src/gallium/drivers/nv50/nv50_context.c |2 +-
 src/gallium/drivers/nv50/nv50_screen.c  |2 +-
 src/gallium/drivers/nvc0/nvc0_context.c |2 +-
 src/gallium/drivers/nvc0/nvc0_screen.c  |2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_context.c 
b/src/gallium/drivers/nv50/nv50_context.c
index 0d46406..a48b864 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -205,7 +205,7 @@ nv50_bufctx_emit_relocs(struct nv50_context *nv50)
n  = nv50-residents_size / sizeof(struct resident);
n += NV50_SCREEN_RESIDENT_BO_COUNT;
 
-   MARK_RING(nv50-screen-base.channel, n, n);
+   MARK_RING(nv50-screen-base.channel, 0, n);
 
for (ctx = 0; ctx  NV50_BUFCTX_COUNT; ++ctx) {
   array = nv50-residents[ctx];
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 7ff11ea..fe8712d 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -641,7 +641,7 @@ nv50_screen_make_buffers_resident(struct nv50_screen 
*screen)
 
const unsigned flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD;
 
-   MARK_RING(chan, 5, 5);
+   MARK_RING(chan, 0, 5);
nouveau_bo_validate(chan, screen-code, flags);
nouveau_bo_validate(chan, screen-uniforms, flags);
nouveau_bo_validate(chan, screen-txc, flags);
diff --git a/src/gallium/drivers/nvc0/nvc0_context.c 
b/src/gallium/drivers/nvc0/nvc0_context.c
index 8fa1675..d493d4b 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nvc0/nvc0_context.c
@@ -209,7 +209,7 @@ nvc0_bufctx_emit_relocs(struct nvc0_context *nvc0)
n  = nvc0-residents_size / sizeof(struct resident);
n += NVC0_SCREEN_RESIDENT_BO_COUNT;
 
-   MARK_RING(nvc0-screen-base.channel, n, n);
+   MARK_RING(nvc0-screen-base.channel, 0, n);
 
for (ctx = 0; ctx  NVC0_BUFCTX_COUNT; ++ctx) {
   array = nvc0-residents[ctx];
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nvc0/nvc0_screen.c
index 292cbdd..0da7be4 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -659,7 +659,7 @@ nvc0_screen_make_buffers_resident(struct nvc0_screen 
*screen)
 
const unsigned flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD;
 
-   MARK_RING(chan, 5, 5);
+   MARK_RING(chan, 0, 5);
nouveau_bo_validate(chan, screen-text, flags);
nouveau_bo_validate(chan, screen-uniforms, flags);
nouveau_bo_validate(chan, screen-txc, flags);

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


Mesa (master): nouveau: fix fence hang

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

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sat Oct  8 23:05:25 2011 +0200

nouveau: fix fence hang

If there is not enough space in pushbuffer for fence emission
(nouveau_fence_emit - nv50_screen_fence_emit - MARK_RING),
the pushbuffer is flushed, which through flush_notify -
nv50_default_flush_notify - nouveau_fence_update marks currently
emitting fence as flushed. But actual emission is done after this mark.
So later when there is a need to wait on this fence and pushbuffer
was not flushed in between, fence wait will never finish causing
application to hang.

To fix this, introduce new fence state between AVAILABLE and EMITTED,
set it before emission and handle it everywhere.

Additionally obtain fence sequence numbers after possible flush in
MARK_RING, because we want to emit fences in correct order.

Reviewed-by: Christoph Bumiller e0425...@student.tuwien.ac.at

Note: This is a candidate for the 7.11 branch.

---

 src/gallium/drivers/nouveau/nouveau_fence.c  |   17 +++--
 src/gallium/drivers/nouveau/nouveau_fence.h  |7 ---
 src/gallium/drivers/nouveau/nouveau_screen.h |2 +-
 src/gallium/drivers/nv50/nv50_screen.c   |8 ++--
 src/gallium/drivers/nvc0/nvc0_screen.c   |8 ++--
 5 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c 
b/src/gallium/drivers/nouveau/nouveau_fence.c
index 26e4775..a2fcafe 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -86,12 +86,10 @@ nouveau_fence_emit(struct nouveau_fence *fence)
 {
struct nouveau_screen *screen = fence-screen;
 
-   fence-sequence = ++screen-fence.sequence;
-
assert(fence-state == NOUVEAU_FENCE_STATE_AVAILABLE);
 
/* set this now, so that if fence.emit triggers a flush we don't recurse */
-   fence-state = NOUVEAU_FENCE_STATE_EMITTED;
+   fence-state = NOUVEAU_FENCE_STATE_EMITTING;
 
++fence-ref;
 
@@ -102,7 +100,10 @@ nouveau_fence_emit(struct nouveau_fence *fence)
 
screen-fence.tail = fence;
 
-   screen-fence.emit(screen-base, fence-sequence);
+   screen-fence.emit(screen-base, fence-sequence);
+
+   assert(fence-state == NOUVEAU_FENCE_STATE_EMITTING);
+   fence-state = NOUVEAU_FENCE_STATE_EMITTED;
 }
 
 void
@@ -162,7 +163,8 @@ nouveau_fence_update(struct nouveau_screen *screen, boolean 
flushed)
 
if (flushed) {
   for (fence = next; fence; fence = fence-next)
- fence-state = NOUVEAU_FENCE_STATE_FLUSHED;
+ if (fence-state == NOUVEAU_FENCE_STATE_EMITTED)
+fence-state = NOUVEAU_FENCE_STATE_FLUSHED;
}
 }
 
@@ -185,6 +187,9 @@ nouveau_fence_wait(struct nouveau_fence *fence)
struct nouveau_screen *screen = fence-screen;
uint32_t spins = 0;
 
+   /* wtf, someone is waiting on a fence in flush_notify handler? */
+   assert(fence-state != NOUVEAU_FENCE_STATE_EMITTING);
+
if (fence-state  NOUVEAU_FENCE_STATE_EMITTED) {
   nouveau_fence_emit(fence);
 
@@ -216,7 +221,7 @@ nouveau_fence_wait(struct nouveau_fence *fence)
 void
 nouveau_fence_next(struct nouveau_screen *screen)
 {
-   if (screen-fence.current-state  NOUVEAU_FENCE_STATE_EMITTED)
+   if (screen-fence.current-state  NOUVEAU_FENCE_STATE_EMITTING)
   nouveau_fence_emit(screen-fence.current);
 
nouveau_fence_ref(NULL, screen-fence.current);
diff --git a/src/gallium/drivers/nouveau/nouveau_fence.h 
b/src/gallium/drivers/nouveau/nouveau_fence.h
index 680c75e..3984a9a 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.h
+++ b/src/gallium/drivers/nouveau/nouveau_fence.h
@@ -6,9 +6,10 @@
 #include util/u_double_list.h
 
 #define NOUVEAU_FENCE_STATE_AVAILABLE 0
-#define NOUVEAU_FENCE_STATE_EMITTED   1
-#define NOUVEAU_FENCE_STATE_FLUSHED   2
-#define NOUVEAU_FENCE_STATE_SIGNALLED 3
+#define NOUVEAU_FENCE_STATE_EMITTING  1
+#define NOUVEAU_FENCE_STATE_EMITTED   2
+#define NOUVEAU_FENCE_STATE_FLUSHED   3
+#define NOUVEAU_FENCE_STATE_SIGNALLED 4
 
 struct nouveau_fence_work {
struct list_head list;
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h 
b/src/gallium/drivers/nouveau/nouveau_screen.h
index cf291c6..808500f 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -24,7 +24,7 @@ struct nouveau_screen {
struct nouveau_fence *current;
u32 sequence;
u32 sequence_ack;
-   void (*emit)(struct pipe_screen *, u32 sequence);
+   void (*emit)(struct pipe_screen *, u32 *sequence);
u32  (*update)(struct pipe_screen *);
} fence;
 
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index c36f3cd..7ff11ea 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ 

Mesa (master): nouveau: hide some debugging messages behind environment variable

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

Author: Marcin Slusarz marcin.slus...@gmail.com
Date:   Sat Oct  8 23:58:32 2011 +0200

nouveau: hide some debugging messages behind environment variable

They spam console, but are not very useful - hide them behind
NOUVEAU_MESA_DEBUG environment variable.

---

 src/gallium/drivers/nouveau/nouveau_buffer.c |3 ++-
 src/gallium/drivers/nouveau/nouveau_mm.c |5 +++--
 src/gallium/drivers/nouveau/nouveau_screen.c |7 +++
 src/gallium/drivers/nouveau/nouveau_screen.h |2 ++
 src/gallium/drivers/nv50/nv50_screen.c   |5 +++--
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c 
b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 01d3aa4..60d8e37 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -431,7 +431,8 @@ nouveau_buffer_migrate(struct nouveau_context *nv,
  /* keep a system memory copy of our data in case we hit a fallback */
  if (!nouveau_buffer_data_fetch(buf, buf-bo, buf-offset, size))
 return FALSE;
- debug_printf(migrating %u KiB to VRAM\n, size / 1024);
+ if (nouveau_mesa_debug)
+debug_printf(migrating %u KiB to VRAM\n, size / 1024);
   }
 
   offset = buf-offset;
diff --git a/src/gallium/drivers/nouveau/nouveau_mm.c 
b/src/gallium/drivers/nouveau/nouveau_mm.c
index 2a4e322..8d0b7bf 100644
--- a/src/gallium/drivers/nouveau/nouveau_mm.c
+++ b/src/gallium/drivers/nouveau/nouveau_mm.c
@@ -145,8 +145,9 @@ mm_slab_new(struct nouveau_mman *cache, int chunk_order)
 
cache-allocated += size;
 
-   debug_printf(MM: new slab, total memory = %PRIu64 KiB\n,
-cache-allocated / 1024);
+   if (nouveau_mesa_debug)
+  debug_printf(MM: new slab, total memory = %PRIu64 KiB\n,
+   cache-allocated / 1024);
 
return PIPE_OK;
 }
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c 
b/src/gallium/drivers/nouveau/nouveau_screen.c
index 223e768..cdc2bff 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -10,6 +10,7 @@
 
 #include stdio.h
 #include errno.h
+#include stdlib.h
 
 #include nouveau/nouveau_bo.h
 #include nouveau/nouveau_mm.h
@@ -21,6 +22,8 @@
 #include state_tracker/drm_driver.h
 #include util/u_simple_screen.h
 
+int nouveau_mesa_debug = 0;
+
 static const char *
 nouveau_screen_get_name(struct pipe_screen *pscreen)
 {
@@ -202,6 +205,10 @@ nouveau_screen_init(struct nouveau_screen *screen, struct 
nouveau_device *dev)
struct pipe_screen *pscreen = screen-base;
int ret;
 
+   char *nv_dbg = getenv(NOUVEAU_MESA_DEBUG);
+   if (nv_dbg)
+  nouveau_mesa_debug = atoi(nv_dbg);
+
ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202,
512*1024, screen-channel);
if (ret)
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h 
b/src/gallium/drivers/nouveau/nouveau_screen.h
index 808500f..d2003e6 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -5,6 +5,8 @@
 #include util/u_memory.h
 typedef uint32_t u32;
 
+extern int nouveau_mesa_debug;
+
 struct nouveau_bo;
 
 struct nouveau_screen {
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index fe8712d..0bd6057 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -502,8 +502,9 @@ nv50_screen_create(struct pipe_winsys *ws, struct 
nouveau_device *dev)
 
screen-tls_size = tls_space * max_warps * 32;
 
-   debug_printf(max_warps = %i, tls_size = %PRIu64 KiB\n,
-max_warps, screen-tls_size  10);
+   if (nouveau_mesa_debug)
+  debug_printf(max_warps = %i, tls_size = %PRIu64 KiB\n,
+ max_warps, screen-tls_size  10);
 
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1  16, screen-tls_size,
 screen-tls_bo);

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


Mesa (master): st/glx/xlib: Advertise GLX_ARB_create_context(_profile)

2011-10-09 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: ee1487953bdbe8694fc76b9fe398d0384cd9e3b4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee1487953bdbe8694fc76b9fe398d0384cd9e3b4

Author: José Fonseca jose.r.fons...@gmail.com
Date:   Sun Oct  9 13:20:00 2011 +0100

st/glx/xlib: Advertise GLX_ARB_create_context(_profile)

They were already implemented, but not advertised.

---

 src/gallium/state_trackers/glx/xlib/glx_api.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c 
b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 824fdab..d978286 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -53,6 +53,8 @@
GLX_MESA_copy_sub_buffer  \
GLX_MESA_pixmap_colormap  \
GLX_MESA_release_buffers  \
+   GLX_ARB_create_context  \
+   GLX_ARB_create_context_profile  \
GLX_ARB_get_proc_address  \
GLX_EXT_texture_from_pixmap  \
GLX_EXT_visual_info  \

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


Mesa (master): u_blitter: don' t create integer vertex elements unless shader supports them

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

Author: Dave Airlie airl...@redhat.com
Date:   Sun Oct  9 16:35:28 2011 +0100

u_blitter: don't create integer vertex elements unless shader supports them

Should fix https://bugs.freedesktop.org/show_bug.cgi?id=41613

We don't want to create these vertex elements unless the pipe driver
vertex stage can handle integers.

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

---

 src/gallium/auxiliary/util/u_blitter.c |   49 +++-
 1 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 1f8b679..73d1af0 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -109,6 +109,7 @@ struct blitter_context_priv
unsigned dst_height;
 
boolean has_geometry_shader;
+   boolean vertex_has_integers;
 };
 
 static void blitter_draw_rectangle(struct blitter_context *blitter,
@@ -152,6 +153,9 @@ struct blitter_context *util_blitter_create(struct 
pipe_context *pipe)
ctx-has_geometry_shader =
   pipe-screen-get_shader_param(pipe-screen, PIPE_SHADER_GEOMETRY,
  PIPE_SHADER_CAP_MAX_INSTRUCTIONS)  0;
+   ctx-vertex_has_integers =
+  pipe-screen-get_shader_param(pipe-screen, PIPE_SHADER_GEOMETRY,
+ PIPE_SHADER_CAP_INTEGERS);
 
/* blend state objects */
memset(blend, 0, sizeof(blend));
@@ -211,27 +215,30 @@ struct blitter_context *util_blitter_create(struct 
pipe_context *pipe)
}
ctx-velem_state = pipe-create_vertex_elements_state(pipe, 2, velem[0]);
 
-   memset(velem[0], 0, sizeof(velem[0]) * 2);
-   for (i = 0; i  2; i++) {
-  velem[i].src_offset = i * 4 * sizeof(float);
-  if (i == 0) {
- velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
-  } else {
- velem[i].src_format = PIPE_FORMAT_R32G32B32A32_SINT;
+   if (ctx-vertex_has_integers) {
+  memset(velem[0], 0, sizeof(velem[0]) * 2);
+  for (i = 0; i  2; i++) {
+ velem[i].src_offset = i * 4 * sizeof(float);
+ if (i == 0) {
+velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ } else {
+velem[i].src_format = PIPE_FORMAT_R32G32B32A32_SINT;
+ }
   }
-   }
-   ctx-velem_sint_state = pipe-create_vertex_elements_state(pipe, 2, 
velem[0]);
-
-   memset(velem[0], 0, sizeof(velem[0]) * 2);
-   for (i = 0; i  2; i++) {
-  velem[i].src_offset = i * 4 * sizeof(float);
-  if (i == 0) {
- velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
-  } else {
- velem[i].src_format = PIPE_FORMAT_R32G32B32A32_UINT;
+  ctx-velem_sint_state = pipe-create_vertex_elements_state(pipe, 2, 
velem[0]);
+
+  memset(velem[0], 0, sizeof(velem[0]) * 2);
+  for (i = 0; i  2; i++) {
+ velem[i].src_offset = i * 4 * sizeof(float);
+ if (i == 0) {
+velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ } else {
+velem[i].src_format = PIPE_FORMAT_R32G32B32A32_UINT;
+ }
   }
+  ctx-velem_uint_state = pipe-create_vertex_elements_state(pipe, 2, 
velem[0]);
}
-   ctx-velem_uint_state = pipe-create_vertex_elements_state(pipe, 2, 
velem[0]);
+
/* fragment shaders are created on-demand */
 
/* vertex shader */
@@ -274,8 +281,10 @@ void util_blitter_destroy(struct blitter_context *blitter)
pipe-delete_rasterizer_state(pipe, ctx-rs_state);
pipe-delete_vs_state(pipe, ctx-vs);
pipe-delete_vertex_elements_state(pipe, ctx-velem_state);
-   pipe-delete_vertex_elements_state(pipe, ctx-velem_sint_state);
-   pipe-delete_vertex_elements_state(pipe, ctx-velem_uint_state);
+   if (ctx-vertex_has_integers) {
+  pipe-delete_vertex_elements_state(pipe, ctx-velem_sint_state);
+  pipe-delete_vertex_elements_state(pipe, ctx-velem_uint_state);
+   }
 
for (i = 0; i  PIPE_MAX_TEXTURE_TYPES; i++) {
   if (ctx-fs_texfetch_col[i])

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


Mesa (master): r600g: enable integer shader cap for evergreen.

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

Author: Dave Airlie airl...@redhat.com
Date:   Sun Oct  9 16:47:03 2011 +0100

r600g: enable integer shader cap for evergreen.

Will get to adding r600/r700/cayman support, have it mostly written on
another PC.

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

---

 src/gallium/drivers/r600/r600_pipe.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe.c 
b/src/gallium/drivers/r600/r600_pipe.c
index 73c2b33..d0a86de 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -441,6 +441,7 @@ static float r600_get_paramf(struct pipe_screen* pscreen, 
enum pipe_cap param)
 
 static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, 
enum pipe_shader_cap param)
 {
+   struct r600_screen *rscreen = (struct r600_screen *)pscreen;
switch(shader)
{
case PIPE_SHADER_FRAGMENT:
@@ -489,6 +490,8 @@ static int r600_get_shader_param(struct pipe_screen* 
pscreen, unsigned shader, e
case PIPE_SHADER_CAP_SUBROUTINES:
return 0;
case PIPE_SHADER_CAP_INTEGERS:
+   if (rscreen-chip_class == EVERGREEN)
+   return 1;
return 0;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 16;

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


Mesa (master): r600g: uarl fixes.

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

Author: Dave Airlie airl...@redhat.com
Date:   Sun Sep 25 15:41:59 2011 +0100

r600g: uarl fixes.

Not 100% sure these are correct yet

---

 src/gallium/drivers/r600/r600_asm.c|3 ++
 src/gallium/drivers/r600/r600_shader.c |   58 ++--
 2 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c 
b/src/gallium/drivers/r600/r600_asm.c
index 663e41f..597be69 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -55,7 +55,10 @@ static inline unsigned int 
r600_bytecode_get_num_operands(struct r600_bytecode *
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE:
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE:
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL:
+   case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_INT:
+   case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_INT:
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT:
+   case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT:
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX:
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN:
case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE:
diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 1280355..b385524 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1036,7 +1036,7 @@ static int tgsi_int_to_flt(struct r600_shader_ctx *ctx)
return 0;
 }
 
-static int tgsi_op2_s(struct r600_shader_ctx *ctx, int swap)
+static int tgsi_op2_s(struct r600_shader_ctx *ctx, int swap, int trans_only)
 {
struct tgsi_full_instruction *inst = 
ctx-parse.FullToken.FullInstruction;
struct r600_bytecode_alu alu;
@@ -1070,7 +1070,7 @@ static int tgsi_op2_s(struct r600_shader_ctx *ctx, int 
swap)
default:
break;
}
-   if (i == lasti) {
+   if (i == lasti || trans_only) {
alu.last = 1;
}
r = r600_bytecode_add_alu(ctx-bc, alu);
@@ -1082,12 +1082,17 @@ static int tgsi_op2_s(struct r600_shader_ctx *ctx, int 
swap)
 
 static int tgsi_op2(struct r600_shader_ctx *ctx)
 {
-   return tgsi_op2_s(ctx, 0);
+   return tgsi_op2_s(ctx, 0, 0);
 }
 
 static int tgsi_op2_swap(struct r600_shader_ctx *ctx)
 {
-   return tgsi_op2_s(ctx, 1);
+   return tgsi_op2_s(ctx, 1, 0);
+}
+
+static int tgsi_op2_trans(struct r600_shader_ctx *ctx)
+{
+   return tgsi_op2_s(ctx, 0, 1);
 }
 
 static int tgsi_ineg(struct r600_shader_ctx *ctx)
@@ -2912,18 +2917,22 @@ static int tgsi_eg_arl(struct r600_shader_ctx *ctx)
case TGSI_OPCODE_ARR:
alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT;
break;
+   case TGSI_OPCODE_UARL:
+   break;
default:
assert(0);
return -1;
}
 
-   r600_bytecode_src(alu.src[0], ctx-src[0], 0);
-   alu.last = 1;
-   alu.dst.sel = ctx-ar_reg;
-   alu.dst.write = 1;
-   r = r600_bytecode_add_alu(ctx-bc, alu);
-   if (r)
-   return r;
+   if (alu.inst) {
+   r600_bytecode_src(alu.src[0], ctx-src[0], 0);
+   alu.last = 1;
+   alu.dst.sel = ctx-ar_reg;
+   alu.dst.write = 1;
+   r = r600_bytecode_add_alu(ctx-bc, alu);
+   if (r)
+   return r;
+   }
 
/* TODO: Note that the MOVA can be avoided if we never use AR for
 * indexing non-CB registers in the current ALU clause. Similarly, we
@@ -2933,8 +2942,12 @@ static int tgsi_eg_arl(struct r600_shader_ctx *ctx)
 * has been modified in each clause. */
memset(alu, 0, sizeof(struct r600_bytecode_alu));
alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT;
-   alu.src[0].sel = ctx-ar_reg;
-   alu.src[0].chan = 0;
+   if (inst-Instruction.Opcode == TGSI_OPCODE_UARL)
+   r600_bytecode_src(alu.src[0], ctx-src[0], 0);
+   else {
+   alu.src[0].sel = ctx-ar_reg;
+   alu.src[0].chan = 0;
+   }
alu.last = 1;
r = r600_bytecode_add_alu(ctx-bc, alu);
if (r)
@@ -2981,6 +2994,8 @@ static int tgsi_r600_arl(struct r600_shader_ctx *ctx)
if ((r = r600_bytecode_add_alu(ctx-bc, alu)))
return r;
break;
+   case TGSI_OPCODE_UARL:
+   break;
default:
assert(0);
return -1;
@@ -2988,7 +3003,10 @@ static int tgsi_r600_arl(struct r600_shader_ctx *ctx)
 
memset(alu, 0, sizeof(alu));
alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT;

Mesa (master): u_blitter: query vertex shader caps instead of geometry for int vertices

2011-10-09 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 0f55f133f1e5b72e463441d2d388a1ec4deac1da
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f55f133f1e5b72e463441d2d388a1ec4deac1da

Author: Marek Olšák mar...@gmail.com
Date:   Sun Oct  9 18:19:58 2011 +0200

u_blitter: query vertex shader caps instead of geometry for int vertices

---

 src/gallium/auxiliary/util/u_blitter.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 73d1af0..89dae95 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -154,7 +154,7 @@ struct blitter_context *util_blitter_create(struct 
pipe_context *pipe)
   pipe-screen-get_shader_param(pipe-screen, PIPE_SHADER_GEOMETRY,
  PIPE_SHADER_CAP_MAX_INSTRUCTIONS)  0;
ctx-vertex_has_integers =
-  pipe-screen-get_shader_param(pipe-screen, PIPE_SHADER_GEOMETRY,
+  pipe-screen-get_shader_param(pipe-screen, PIPE_SHADER_VERTEX,
  PIPE_SHADER_CAP_INTEGERS);
 
/* blend state objects */

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