[Mesa-dev] [PATCH 2/2] st_glsl_to_tgsi: use ISSG

2012-01-09 Thread Dave Airlie
From: Dave Airlie 

Signed-off-by: Dave Airlie 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 3b8e2fe..460bc04 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1416,7 +1416,10 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
  emit(ir, TGSI_OPCODE_ABS, result_dst, op[0]);
   break;
case ir_unop_sign:
-  emit(ir, TGSI_OPCODE_SSG, result_dst, op[0]);
+  if (result_dst.type == GLSL_TYPE_INT || result_dst.type == 
GLSL_TYPE_UINT)
+ emit(ir, TGSI_OPCODE_ISSG, result_dst, op[0]);
+  else
+ emit(ir, TGSI_OPCODE_SSG, result_dst, op[0]);
   break;
case ir_unop_rcp:
   emit_scalar(ir, TGSI_OPCODE_RCP, result_dst, op[0]);
-- 
1.7.7.4

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


[Mesa-dev] [PATCH 1/2] tgsi: add ISSG support

2012-01-09 Thread Dave Airlie
From: Dave Airlie 

This adds integer version of SSG that GLSL 1.30 can produce.

Signed-off-by: Dave Airlie 
---
 src/gallium/auxiliary/tgsi/tgsi_exec.c |   14 ++
 src/gallium/auxiliary/tgsi/tgsi_info.c |1 +
 src/gallium/include/pipe/p_shader_tokens.h |3 ++-
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 61ab58a..3f62028 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -375,6 +375,16 @@ micro_sgn(union tgsi_exec_channel *dst,
 }
 
 static void
+micro_isgn(union tgsi_exec_channel *dst,
+  const union tgsi_exec_channel *src)
+{
+   dst->i[0] = src->i[0] < 0 ? -1 : src->i[0] > 0 ? 1 : 0;
+   dst->i[1] = src->i[1] < 0 ? -1 : src->i[1] > 0 ? 1 : 0;
+   dst->i[2] = src->i[2] < 0 ? -1 : src->i[2] > 0 ? 1 : 0;
+   dst->i[3] = src->i[3] < 0 ? -1 : src->i[3] > 0 ? 1 : 0;
+}
+
+static void
 micro_sgt(union tgsi_exec_channel *dst,
   const union tgsi_exec_channel *src0,
   const union tgsi_exec_channel *src1)
@@ -4203,6 +4213,10 @@ exec_instruction(
   exec_vector_unary(mach, inst, micro_iabs, TGSI_EXEC_DATA_INT, 
TGSI_EXEC_DATA_INT);
   break;
 
+   case TGSI_OPCODE_ISSG:
+  exec_vector_unary(mach, inst, micro_isgn, TGSI_EXEC_DATA_INT, 
TGSI_EXEC_DATA_INT);
+  break;
+
default:
   assert( 0 );
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c 
b/src/gallium/auxiliary/tgsi/tgsi_info.c
index c9acdb9..5b26d8f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -193,6 +193,7 @@ static const struct tgsi_opcode_info 
opcode_info[TGSI_OPCODE_LAST] =
{ 1, 1, 0, 0, 0, 0, "UARL", TGSI_OPCODE_UARL },
{ 1, 3, 0, 0, 0, 0, "UCMP", TGSI_OPCODE_UCMP },
{ 1, 1, 0, 0, 0, 0, "IABS", TGSI_OPCODE_IABS },
+   { 1, 1, 0, 0, 0, 0, "ISSG", TGSI_OPCODE_ISSG },
 };
 
 const struct tgsi_opcode_info *
diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
b/src/gallium/include/pipe/p_shader_tokens.h
index 75e17a1..c8c1cf2 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -377,8 +377,9 @@ struct tgsi_property_data {
 #define TGSI_OPCODE_UARL157
 #define TGSI_OPCODE_UCMP158
 #define TGSI_OPCODE_IABS159
+#define TGSI_OPCODE_ISSG160
 
-#define TGSI_OPCODE_LAST160
+#define TGSI_OPCODE_LAST161
 
 #define TGSI_SAT_NONE0  /* do not saturate */
 #define TGSI_SAT_ZERO_ONE1  /* clamp to [0,1] */
-- 
1.7.7.4

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


Re: [Mesa-dev] [PATCH] r600g: add support for virtual address space on cayman v8

2012-01-09 Thread Michel Dänzer
On Fre, 2012-01-06 at 10:42 -0500, j.gli...@gmail.com wrote: 
> From: Jerome Glisse 
> 
> Virtual address space put the userspace in charge of their GPU
> address space. It's up to userspace to bind bo into the virtual
> address space. Command stream can them be executed using the
> IB_VM chunck.
> 
> This patch add support for this configuration. It doesn't remove
> the 64K ib size limit thought this limit can be extanded up to
> 1M for IB_VM chunk.

[...]

> diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c 
> b/src/gallium/drivers/r600/evergreen_hw_context.c
> index 96e8d18..01764ed 100644
> --- a/src/gallium/drivers/r600/evergreen_hw_context.c
> +++ b/src/gallium/drivers/r600/evergreen_hw_context.c
> @@ -1174,8 +1175,10 @@ void evergreen_context_draw(struct r600_context *ctx, 
> const struct r600_draw *dr
>   pm4[2] = PKT3(PKT3_NUM_INSTANCES, 0, ctx->predicate_drawing);
>   pm4[3] = draw->vgt_num_instances;
>   if (draw->indices) {
> - pm4[4] = PKT3(PKT3_DRAW_INDEX, 3, ctx->predicate_drawing);
> - pm4[5] = draw->indices_bo_offset;
> + va = r600_resource_va(&ctx->screen->screen, 
> (void*)draw->indices);
> + va += draw->indices_bo_offset;
> + pm4[4] = PKT3(PKT3_DRAW_INDEX, 3, ctx->predicate_drawing);
> + pm4[5] = va;
>   pm4[6] = 0;

pm[6] = va >> 32;


> @@ -2517,15 +2529,20 @@ void evergreen_pipe_init_buffer_resource(struct 
> r600_pipe_context *rctx,
>  }
>  
> 
> -void evergreen_pipe_mod_buffer_resource(struct r600_pipe_resource_state 
> *rstate,
> +void evergreen_pipe_mod_buffer_resource(struct pipe_context *ctx,
> + struct r600_pipe_resource_state *rstate,
>   struct r600_resource *rbuffer,
>   unsigned offset, unsigned stride,
>   enum radeon_bo_usage usage)
>  {
> + uint64_t va;
> +
> + va = r600_resource_va(ctx->screen, (void *)rbuffer);
>   rstate->bo[0] = rbuffer;
>   rstate->bo_usage[0] = usage;
> - rstate->val[0] = offset;
> + rstate->val[0] = (offset + va) & 0xUL;
>   rstate->val[1] = rbuffer->buf->size - offset - 1;
>   rstate->val[2] = S_030008_ENDIAN_SWAP(r600_endian_swap(32)) |
> -  S_030008_STRIDE(stride);
> +  S_030008_STRIDE(stride) |
> +  ((va >> 32UL) & 0xFF);

(((va + offset) >> 32) & 0xFF);


> diff --git a/src/gallium/drivers/r600/r600_hw_context.c 
> b/src/gallium/drivers/r600/r600_hw_context.c
> index 52e0be7..93cb025 100644
> --- a/src/gallium/drivers/r600/r600_hw_context.c
> +++ b/src/gallium/drivers/r600/r600_hw_context.c
> @@ -1570,14 +1573,20 @@ void r600_context_flush(struct r600_context *ctx, 
> unsigned flags)
>  
>  void r600_context_emit_fence(struct r600_context *ctx, struct r600_resource 
> *fence_bo, unsigned offset, unsigned value)
>  {
> + uint64_t va;
> +
>   r600_need_cs_space(ctx, 10, FALSE);
>  
> + va = r600_resource_va(&ctx->screen->screen, (void*)fence_bo);
> + va = va + (offset << 2);
> +
>   ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0, 0);
>   ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) 
> | EVENT_INDEX(4);
>   ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE_EOP, 4, 0);
>   ctx->pm4[ctx->pm4_cdwords++] = 
> EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT) | EVENT_INDEX(5);
> - ctx->pm4[ctx->pm4_cdwords++] = offset << 2; /* ADDRESS_LO */
> - ctx->pm4[ctx->pm4_cdwords++] = (1 << 29) | (0 << 24);   /* DATA_SEL | 
> INT_EN | ADDRESS_HI */
> + ctx->pm4[ctx->pm4_cdwords++] = va & 0xUL;   /* ADDRESS_LO */
> + /* DATA_SEL | INT_EN | ADDRESS_HI */
> + ctx->pm4[ctx->pm4_cdwords++] = (1 << 29) | (0 << 24) | ((va >> 32UL) & 
> 0xUL);

ctx->pm4[ctx->pm4_cdwords++] = (1 << 29) | (0 << 24) | ((va >> 32) & 0xFF);


> @@ -1684,19 +1694,22 @@ void r600_query_begin(struct r600_context *ctx, 
> struct r600_query *query)
>   }
>  
>   /* emit begin query */
> + va = r600_resource_va(&ctx->screen->screen, (void*)query->buffer);
> + va += query->results_end;
> +
>   switch (query->type) {
>   case PIPE_QUERY_OCCLUSION_COUNTER:
>   case PIPE_QUERY_OCCLUSION_PREDICATE:
>   ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2, 0);
>   ctx->pm4[ctx->pm4_cdwords++] = 
> EVENT_TYPE(EVENT_TYPE_ZPASS_DONE) | EVENT_INDEX(1);
> - ctx->pm4[ctx->pm4_cdwords++] = query->results_end;
> - ctx->pm4[ctx->pm4_cdwords++] = 0;
> + ctx->pm4[ctx->pm4_cdwords++] = va & 0xUL;
> + ctx->pm4[ctx->pm4_cdwords++] = (va >> 32UL) & 0xUL;
>   break;
>   case PIPE_QUERY_TIME_ELAPSED:
>   ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE_EOP, 4, 0);
>   ctx->pm4[ctx->pm4_cdwor

[Mesa-dev] gallium and GL interpolation intersection issue

2012-01-09 Thread Dave Airlie
Okay so we have a gallium/GL/GLSL problem with interpolation, lets see
if I can describe the issue:

In the beginning there was GL interpolation rules, glShadeModel was
the only information you had.

Then came GLSL which allowed overriding the GL defaults using specifiers.

So the gl_FrontColor variant, if left unspecified would take the value
of the glShadeModel, if specified
it would over-rule the current ShadeModel setting.


So we end up something like this

if (glFrontColor attrib > 0) result = glFrontColor_attrib; else result
= shademodel.

Now when we convert to gallium we lose the unspecified interpolation,
and we generate a default interpolation
attribute, which should usually be SMOOTH. Now we've no idea then
inside the gallium drivers whether this smooth
is due to an explicit smooth at the GLSL level which we can't
override, or whether this smooth is something that we really
wanted to be overruled by the ShadeModel bit.

Now as discussed previously most hardware has support for the
ShadeModel bit so generating multiple shaders
for the unspecified case would be suboptimal for it.

So the options I see are:

(a) do it anyways, apply the patch I had earlier that derives the
setting at the glsl->tgsi translation stage, and pretty
much ignore it.

(b) add unspecified interpolation support for Color inputs, only
colors are affected by this, and since TGSI supports
Colors we should probably support all the features of the GL Color
output/inputs.

Anyone any other ideas?

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


Re: [Mesa-dev] [PATCH 1/2] tgsi: add ISSG support

2012-01-09 Thread Brian Paul

On 01/09/2012 04:54 AM, Dave Airlie wrote:

From: Dave Airlie

This adds integer version of SSG that GLSL 1.30 can produce.

Signed-off-by: Dave Airlie
---
  src/gallium/auxiliary/tgsi/tgsi_exec.c |   14 ++
  src/gallium/auxiliary/tgsi/tgsi_info.c |1 +
  src/gallium/include/pipe/p_shader_tokens.h |3 ++-
  3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 61ab58a..3f62028 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -375,6 +375,16 @@ micro_sgn(union tgsi_exec_channel *dst,
  }

  static void
+micro_isgn(union tgsi_exec_channel *dst,
+  const union tgsi_exec_channel *src)
+{
+   dst->i[0] = src->i[0]<  0 ? -1 : src->i[0]>  0 ? 1 : 0;
+   dst->i[1] = src->i[1]<  0 ? -1 : src->i[1]>  0 ? 1 : 0;
+   dst->i[2] = src->i[2]<  0 ? -1 : src->i[2]>  0 ? 1 : 0;
+   dst->i[3] = src->i[3]<  0 ? -1 : src->i[3]>  0 ? 1 : 0;
+}
+
+static void
  micro_sgt(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src0,
const union tgsi_exec_channel *src1)
@@ -4203,6 +4213,10 @@ exec_instruction(
exec_vector_unary(mach, inst, micro_iabs, TGSI_EXEC_DATA_INT, 
TGSI_EXEC_DATA_INT);
break;

+   case TGSI_OPCODE_ISSG:
+  exec_vector_unary(mach, inst, micro_isgn, TGSI_EXEC_DATA_INT, 
TGSI_EXEC_DATA_INT);
+  break;
+
 default:
assert( 0 );
 }
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c 
b/src/gallium/auxiliary/tgsi/tgsi_info.c
index c9acdb9..5b26d8f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -193,6 +193,7 @@ static const struct tgsi_opcode_info 
opcode_info[TGSI_OPCODE_LAST] =
 { 1, 1, 0, 0, 0, 0, "UARL", TGSI_OPCODE_UARL },
 { 1, 3, 0, 0, 0, 0, "UCMP", TGSI_OPCODE_UCMP },
 { 1, 1, 0, 0, 0, 0, "IABS", TGSI_OPCODE_IABS },
+   { 1, 1, 0, 0, 0, 0, "ISSG", TGSI_OPCODE_ISSG },
  };

  const struct tgsi_opcode_info *
diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
b/src/gallium/include/pipe/p_shader_tokens.h
index 75e17a1..c8c1cf2 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -377,8 +377,9 @@ struct tgsi_property_data {
  #define TGSI_OPCODE_UARL157
  #define TGSI_OPCODE_UCMP158
  #define TGSI_OPCODE_IABS159
+#define TGSI_OPCODE_ISSG160

-#define TGSI_OPCODE_LAST160
+#define TGSI_OPCODE_LAST161

  #define TGSI_SAT_NONE0  /* do not saturate */
  #define TGSI_SAT_ZERO_ONE1  /* clamp to [0,1] */


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 2/2] st_glsl_to_tgsi: use ISSG

2012-01-09 Thread Brian Paul

On 01/09/2012 04:54 AM, Dave Airlie wrote:

From: Dave Airlie

Signed-off-by: Dave Airlie
---
  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |5 -
  1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 3b8e2fe..460bc04 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1416,7 +1416,10 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
   emit(ir, TGSI_OPCODE_ABS, result_dst, op[0]);
break;
 case ir_unop_sign:
-  emit(ir, TGSI_OPCODE_SSG, result_dst, op[0]);
+  if (result_dst.type == GLSL_TYPE_INT || result_dst.type == 
GLSL_TYPE_UINT)
+ emit(ir, TGSI_OPCODE_ISSG, result_dst, op[0]);
+  else
+ emit(ir, TGSI_OPCODE_SSG, result_dst, op[0]);
break;
 case ir_unop_rcp:
emit_scalar(ir, TGSI_OPCODE_RCP, result_dst, op[0]);


Is ISSG going to work properly for unsigned integers?  Maybe 
ISSG(UINT) should be replaced by a set-not-equal-to-zero instruction?


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


Re: [Mesa-dev] [PATCH] intel: fix mapping of malloc'd renderbuffers

2012-01-09 Thread Brian Paul

On 01/07/2012 11:37 PM, Eric Anholt wrote:

On Sat,  7 Jan 2012 15:08:19 -0700, Brian Paul  wrote:

This fixes accum buffer operations.  The accumulation buffer is the
only malloc-based renderbuffer for the intel drivers.
---
  src/mesa/drivers/dri/intel/intel_fbo.c |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index b95193d..8cb6c2a 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -132,6 +132,13 @@ intel_map_renderbuffer(struct gl_context *ctx,
 void *map;
 int stride;

+   if (!irb&&  rb->Data) {
+  /* this is a malloc'd renderbuffer (accum buffer) */
+  *out_map = rb->Data;
+  *out_stride = rb->RowStride * _mesa_get_format_bytes(rb->Format);
+  return;
+   }


Missing x/y handling, right?


D'oh, right.


I think I'd rather that we just allocate a
hardware renderbuffer -- shouldn't be hard.


OK, I'll post a new patch, but I'll leave it to you to implement a 
hardware buffer if you want to do that.


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


[Mesa-dev] [PATCH] intel: fix mapping of malloc'd renderbuffers

2012-01-09 Thread Brian Paul
This fixes accum buffer operations.  The accumulation buffer is the
only malloc-based renderbuffer for the intel drivers.

v2: apply x/y offset to returned pointer
---
 src/mesa/drivers/dri/intel/intel_fbo.c |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index b95193d..1d8b10e 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -132,6 +132,15 @@ intel_map_renderbuffer(struct gl_context *ctx,
void *map;
int stride;
 
+   if (!irb && rb->Data) {
+  /* this is a malloc'd renderbuffer (accum buffer) */
+  GLint bpp = _mesa_get_format_bytes(rb->Format);
+  GLint rowStride = rb->RowStride * bpp;
+  *out_map = (GLubyte *) rb->Data + y * rowStride + x * bpp;
+  *out_stride = rowStride;
+  return;
+   }
+
/* We sometimes get called with this by our intel_span.c usage. */
if (!irb->mt) {
   *out_map = NULL;
@@ -176,6 +185,12 @@ intel_unmap_renderbuffer(struct gl_context *ctx,
DBG("%s: rb %d (%s)\n", __FUNCTION__,
rb->Name, _mesa_get_format_name(rb->Format));
 
+   if (!irb && rb->Data) {
+  /* this is a malloc'd renderbuffer (accum buffer) */
+  /* nothing to do */
+  return;
+   }
+
intel_miptree_unmap(intel, irb->mt, irb->mt_level, irb->mt_layer);
 }
 
-- 
1.7.3.4

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


[Mesa-dev] [PATCH] gallium: introduce GLSL based interpolation rules.

2012-01-09 Thread Dave Airlie
From: Dave Airlie 

This introduces an unspecified interpolation paramter that is only allowed for
color semantics, so a specified GLSL interpolation will override the ShadeModel
specified interpolation, but not vice-versa.

This fixes a lot of the interpolation tests in piglit.

Signed-off-by: Dave Airlie 
---
 src/gallium/auxiliary/tgsi/tgsi_exec.c  |4 
 src/gallium/auxiliary/tgsi/tgsi_exec.h  |2 +-
 src/gallium/auxiliary/tgsi/tgsi_strings.c   |1 +
 src/gallium/drivers/softpipe/sp_quad_fs.c   |1 +
 src/gallium/drivers/softpipe/sp_state_derived.c |   10 --
 src/gallium/include/pipe/p_shader_tokens.h  |9 +
 src/mesa/state_tracker/st_program.c |2 +-
 7 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 61ab58a..451d84f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -2377,6 +2377,10 @@ exec_declaration(struct tgsi_exec_machine *mach,
eval = eval_perspective_coef;
break;
 
+case TGSI_INTERPOLATE_UNSPECIFIED:
+   eval = mach->flatshade_unspecified ? eval_constant_coef : 
eval_perspective_coef;
+   break;
+
 default:
assert(0);
return;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h 
b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index ac021ce..7b1e785 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -263,7 +263,7 @@ struct tgsi_exec_machine
const struct tgsi_interp_coef *InterpCoefs;
struct tgsi_exec_vector   QuadPos;
float Face;/**< +1 if front facing, -1 if back 
facing */
-
+   bool  flatshade_unspecified;
/* Conditional execution masks */
uint CondMask;  /**< For IF/ELSE/ENDIF */
uint LoopMask;  /**< For BGNLOOP/ENDLOOP */
diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c 
b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index 973b9fe..02d766e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -114,6 +114,7 @@ const char *tgsi_type_names[5] =
 
 const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] =
 {
+   "UNSPECIFIED",
"CONSTANT",
"LINEAR",
"PERSPECTIVE"
diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c 
b/src/gallium/drivers/softpipe/sp_quad_fs.c
index 7b08cd0..8720947 100644
--- a/src/gallium/drivers/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -74,6 +74,7 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad)
struct tgsi_exec_machine *machine = softpipe->fs_machine;
 
/* run shader */
+   machine->flatshade_unspecified = softpipe->rasterizer->flatshade ? TRUE : 
FALSE;
return softpipe->fs_variant->run( softpipe->fs_variant, machine, quad );
 }
 
diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c 
b/src/gallium/drivers/softpipe/sp_state_derived.c
index 5685997..1442a7e 100644
--- a/src/gallium/drivers/softpipe/sp_state_derived.c
+++ b/src/gallium/drivers/softpipe/sp_state_derived.c
@@ -100,6 +100,9 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
  case TGSI_INTERPOLATE_PERSPECTIVE:
 interp = INTERP_PERSPECTIVE;
 break;
+ case TGSI_INTERPOLATE_UNSPECIFIED:
+assert(fsInfo->input_semantic_name[i] == TGSI_SEMANTIC_COLOR);
+break;
  default:
 assert(0);
 interp = INTERP_LINEAR;
@@ -111,8 +114,11 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
 break;
 
  case TGSI_SEMANTIC_COLOR:
-if (softpipe->rasterizer->flatshade) {
-   interp = INTERP_CONSTANT;
+if (fsInfo->input_interpolate[i] == TGSI_INTERPOLATE_UNSPECIFIED) {
+   if (softpipe->rasterizer->flatshade)
+  interp = INTERP_CONSTANT;
+   else
+  interp = INTERP_PERSPECTIVE;
 }
 break;
  }
diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
b/src/gallium/include/pipe/p_shader_tokens.h
index 75e17a1..c9a79b4 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -97,10 +97,11 @@ enum tgsi_file_type {
 #define TGSI_WRITEMASK_YZW  0x0E
 #define TGSI_WRITEMASK_XYZW 0x0F
 
-#define TGSI_INTERPOLATE_CONSTANT  0
-#define TGSI_INTERPOLATE_LINEAR1
-#define TGSI_INTERPOLATE_PERSPECTIVE   2
-#define TGSI_INTERPOLATE_COUNT 3
+#define TGSI_INTERPOLATE_UNSPECIFIED   0 /* only legal for colors */
+#define TGSI_INTERPOLATE_CONSTANT  1
+#define TGSI_INTERPOLATE_LINEAR2
+#define TGSI_INTERPOLATE_PERSPECTIVE   3
+#define TGSI_INTERPOLATE_COUNT 4
 
 #define TGSI_CYLINDRICAL_WRAP_X (1 << 0)
 #define TGSI_CYLI

Re: [Mesa-dev] gallium and GL interpolation intersection issue

2012-01-09 Thread Brian Paul

On 01/09/2012 06:35 AM, Dave Airlie wrote:

Okay so we have a gallium/GL/GLSL problem with interpolation, lets see
if I can describe the issue:

In the beginning there was GL interpolation rules, glShadeModel was
the only information you had.

Then came GLSL which allowed overriding the GL defaults using specifiers.

So the gl_FrontColor variant, if left unspecified would take the value
of the glShadeModel, if specified
it would over-rule the current ShadeModel setting.


So we end up something like this

if (glFrontColor attrib>  0) result = glFrontColor_attrib; else result
= shademodel.

Now when we convert to gallium we lose the unspecified interpolation,
and we generate a default interpolation
attribute, which should usually be SMOOTH. Now we've no idea then
inside the gallium drivers whether this smooth
is due to an explicit smooth at the GLSL level which we can't
override, or whether this smooth is something that we really
wanted to be overruled by the ShadeModel bit.

Now as discussed previously most hardware has support for the
ShadeModel bit so generating multiple shaders
for the unspecified case would be suboptimal for it.

So the options I see are:

(a) do it anyways, apply the patch I had earlier that derives the
setting at the glsl->tgsi translation stage, and pretty
much ignore it.

(b) add unspecified interpolation support for Color inputs, only
colors are affected by this, and since TGSI supports
Colors we should probably support all the features of the GL Color
output/inputs.

Anyone any other ideas?


I'd probably go with (b), add a new TGSI_INTERPOLATE_COLOR mode that 
means "look at pipe_rasterizer_state::flatshade."


IMO, it's still attractive to get rid of 
pipe_rasterizer_state::flatshade someday.  glShadeModel no longer 
exists in OpenGL 3.2 core profile and later.


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


Re: [Mesa-dev] [PATCH] gallium: introduce GLSL based interpolation rules.

2012-01-09 Thread Brian Paul

On 01/09/2012 08:58 AM, Dave Airlie wrote:

From: Dave Airlie

This introduces an unspecified interpolation paramter that is only allowed for
color semantics, so a specified GLSL interpolation will override the ShadeModel
specified interpolation, but not vice-versa.

This fixes a lot of the interpolation tests in piglit.

Signed-off-by: Dave Airlie
---
  src/gallium/auxiliary/tgsi/tgsi_exec.c  |4 
  src/gallium/auxiliary/tgsi/tgsi_exec.h  |2 +-
  src/gallium/auxiliary/tgsi/tgsi_strings.c   |1 +
  src/gallium/drivers/softpipe/sp_quad_fs.c   |1 +
  src/gallium/drivers/softpipe/sp_state_derived.c |   10 --
  src/gallium/include/pipe/p_shader_tokens.h  |9 +
  src/mesa/state_tracker/st_program.c |2 +-
  7 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 61ab58a..451d84f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -2377,6 +2377,10 @@ exec_declaration(struct tgsi_exec_machine *mach,
 eval = eval_perspective_coef;
 break;

+case TGSI_INTERPOLATE_UNSPECIFIED:
+   eval = mach->flatshade_unspecified ? eval_constant_coef : 
eval_perspective_coef;
+   break;
+
  default:
 assert(0);
 return;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h 
b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index ac021ce..7b1e785 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -263,7 +263,7 @@ struct tgsi_exec_machine
 const struct tgsi_interp_coef *InterpCoefs;
 struct tgsi_exec_vector   QuadPos;
 float Face;/**<  +1 if front facing, -1 if 
back facing */
-
+   bool  flatshade_unspecified;
 /* Conditional execution masks */
 uint CondMask;  /**<  For IF/ELSE/ENDIF */
 uint LoopMask;  /**<  For BGNLOOP/ENDLOOP */
diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c 
b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index 973b9fe..02d766e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -114,6 +114,7 @@ const char *tgsi_type_names[5] =

  const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] =
  {
+   "UNSPECIFIED",
 "CONSTANT",
 "LINEAR",
 "PERSPECTIVE"
diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c 
b/src/gallium/drivers/softpipe/sp_quad_fs.c
index 7b08cd0..8720947 100644
--- a/src/gallium/drivers/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -74,6 +74,7 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad)
 struct tgsi_exec_machine *machine = softpipe->fs_machine;

 /* run shader */
+   machine->flatshade_unspecified = softpipe->rasterizer->flatshade ? TRUE : 
FALSE;
 return softpipe->fs_variant->run( softpipe->fs_variant, machine, quad );
  }

diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c 
b/src/gallium/drivers/softpipe/sp_state_derived.c
index 5685997..1442a7e 100644
--- a/src/gallium/drivers/softpipe/sp_state_derived.c
+++ b/src/gallium/drivers/softpipe/sp_state_derived.c
@@ -100,6 +100,9 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
   case TGSI_INTERPOLATE_PERSPECTIVE:
  interp = INTERP_PERSPECTIVE;
  break;
+ case TGSI_INTERPOLATE_UNSPECIFIED:
+assert(fsInfo->input_semantic_name[i] == TGSI_SEMANTIC_COLOR);
+break;
   default:
  assert(0);
  interp = INTERP_LINEAR;
@@ -111,8 +114,11 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
  break;

   case TGSI_SEMANTIC_COLOR:
-if (softpipe->rasterizer->flatshade) {
-   interp = INTERP_CONSTANT;
+if (fsInfo->input_interpolate[i] == TGSI_INTERPOLATE_UNSPECIFIED) {
+   if (softpipe->rasterizer->flatshade)
+  interp = INTERP_CONSTANT;
+   else
+  interp = INTERP_PERSPECTIVE;
  }
  break;
   }
diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
b/src/gallium/include/pipe/p_shader_tokens.h
index 75e17a1..c9a79b4 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -97,10 +97,11 @@ enum tgsi_file_type {
  #define TGSI_WRITEMASK_YZW  0x0E
  #define TGSI_WRITEMASK_XYZW 0x0F

-#define TGSI_INTERPOLATE_CONSTANT  0
-#define TGSI_INTERPOLATE_LINEAR1
-#define TGSI_INTERPOLATE_PERSPECTIVE   2
-#define TGSI_INTERPOLATE_COUNT 3
+#define TGSI_INTERPOLATE_UNSPECIFIED   0 /* only legal for colors */
+#define TGSI_INTERPOLATE_CONSTANT  1
+#define TGSI_INTERPOLATE_LINEAR2
+#define TGSI_INTERPOLATE_PERSPECTIVE   3
+#define TGSI_INTERPOLA

Re: [Mesa-dev] [RFC]Improves st_finalize_texture cycles consumption

2012-01-09 Thread Brian Paul


I don't really care for these patches.  They obfuscate the code and 
hide the real issue which Keith touched on.  We need to have some sort 
of additional dirty tracking logic to determine when there's no real 
changes to the pipe_resource for a texture.


One of the things on my to-do list is to re-examine how we track 
changed state to handle state changes more efficiently.


-Brian

On 01/08/2012 04:04 PM, Keith Whitwell wrote:

I don't have the code handy (and haven't looked at it in a while), but wonder 
if finer-grained tracking of dirtiness would help?  Or more generally trying to 
preserve more computed results across state changes?

Keith

- Original Message -

Hi,

I did some profiling with perf under nexuiz and found that
st_finalize_texture
function was one of the most cycle consumming. (~1,50% whereas
darkplaces took ~30%)

I rewrite some part of this function to make it a bit faster ; with
these 2 patches,
st_finalize_texture consumption went down to ~1%, so a 40-50% boost.
This does however not translate to more fps to Nexuiz : if there is
any improvement,
it is not noticeable (too much noise in measurements). On the other
hand, the function
has become less readable. I had to manually unroll loops and use
intermediate values
(gcc does not do it automaticaly, using default parameters).
Of course I think that we should make less call to this function to
see a true gain,
but this would require more work.

Regards,
Vincent

___
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 mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 02/11] i965: Add missing BRW_NEW_BATCH dirty bit to Gen6+ clip state atoms.

2012-01-09 Thread Eric Anholt
On Sun,  8 Jan 2012 14:43:51 -0800, Kenneth Graunke  
wrote:
> Without MI_SET_CONTEXT, there's no guarantee that another program hasn't
> reprogram the GPU's clip state since our last batch.  We need to submit
> it every time.
> 
> Found by inspection.

BRW_NEW_CONTEXT is the flag for "we might have lost our context because
everything got reprogrammed."

BRW_NEW_BATCH is the flag for "we have to program it again with a new
batch for other reasons (e.g. relocations ensuring that your buffer is
present).

The intent was that when we get MI_SET_CONTEXT, we just stop flagging
BRW_NEW_CONTEXT per batch.


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


Re: [Mesa-dev] [PATCH 08/11] i965: Move _NEW_PROGRAM dirty bit from gen7_sf_state to gen7_sbe_state.

2012-01-09 Thread Eric Anholt
On Sun,  8 Jan 2012 14:43:57 -0800, Kenneth Graunke  
wrote:
> According to a comment in gen6_sf_state.c, calls to get_attr_override
> need both _NEW_PROGRAM and _NEW_LIGHT.  Since Gen7 reuses the same
> function, the same dirty bits should apply.
> 
> When I performed the SF/SBE split, I partitioned the bits incorrectly:
> 3DSTATE_SBE (which contains the attribute setup) was missing _NEW_PROGRAM,
> while 3DSTATE_SF was listing it as a dependency for no reason.

I think the ctx->VertexProgram.PointSizeEnabled in SF is an un-annotated
dependency on _NEW_PROGRAM.


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


Re: [Mesa-dev] [PATCH 09/11] i965: Add missing _NEW_PROGRAM bit to brw_sf_unit and gen7_sf_state.

2012-01-09 Thread Eric Anholt
On Sun,  8 Jan 2012 14:43:58 -0800, Kenneth Graunke  
wrote:
> From my reading of main/enable.c:735, it appears that
> ctx->VertexProgram.PointSizeEnabled is covered by _NEW_PROGRAM.

Oh, and you go fix it here.  I'd rather not see the flag dropped in the
previous commit.


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


Re: [Mesa-dev] gallium and GL interpolation intersection issue

2012-01-09 Thread Marek Olšák
On Mon, Jan 9, 2012 at 5:06 PM, Brian Paul  wrote:
> On 01/09/2012 06:35 AM, Dave Airlie wrote:
>>
>> Okay so we have a gallium/GL/GLSL problem with interpolation, lets see
>> if I can describe the issue:
>>
>> In the beginning there was GL interpolation rules, glShadeModel was
>> the only information you had.
>>
>> Then came GLSL which allowed overriding the GL defaults using specifiers.
>>
>> So the gl_FrontColor variant, if left unspecified would take the value
>> of the glShadeModel, if specified
>> it would over-rule the current ShadeModel setting.
>>
>>
>> So we end up something like this
>>
>> if (glFrontColor attrib>  0) result = glFrontColor_attrib; else result
>> = shademodel.
>>
>> Now when we convert to gallium we lose the unspecified interpolation,
>> and we generate a default interpolation
>> attribute, which should usually be SMOOTH. Now we've no idea then
>> inside the gallium drivers whether this smooth
>> is due to an explicit smooth at the GLSL level which we can't
>> override, or whether this smooth is something that we really
>> wanted to be overruled by the ShadeModel bit.
>>
>> Now as discussed previously most hardware has support for the
>> ShadeModel bit so generating multiple shaders
>> for the unspecified case would be suboptimal for it.
>>
>> So the options I see are:
>>
>> (a) do it anyways, apply the patch I had earlier that derives the
>> setting at the glsl->tgsi translation stage, and pretty
>> much ignore it.
>>
>> (b) add unspecified interpolation support for Color inputs, only
>> colors are affected by this, and since TGSI supports
>> Colors we should probably support all the features of the GL Color
>> output/inputs.
>>
>> Anyone any other ideas?
>
>
> I'd probably go with (b), add a new TGSI_INTERPOLATE_COLOR mode that means
> "look at pipe_rasterizer_state::flatshade."
>
> IMO, it's still attractive to get rid of pipe_rasterizer_state::flatshade
> someday.  glShadeModel no longer exists in OpenGL 3.2 core profile and
> later.

Please note that the GLSL interpolation modes are a GLSL 1.3 feature.
We can't remove pipe_rasterizer_state::flatshade_first for non-GL3
drivers. And even with the interpolation modes available,
recompiling.shaders when glShadeModel changes is an anti-optimization
if drivers can do pipe_rasterizer_state::flatshade_first just fine. I
would prefer that if there's a driver which cannot do
pipe_rasterizer_state::flatshade_first (just svga?), let's add a CAP
for it and handle it in the state tracker.

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


Re: [Mesa-dev] i965: Fixing dirty bits

2012-01-09 Thread Eric Anholt
On Sun,  8 Jan 2012 14:43:49 -0800, Kenneth Graunke  
wrote:
> While investigating an etracer issue on Ivybridge, I did a lot of careful
> reading of the tracked state atoms' dirty bits.  Found a bunch of issues.
> Unfortunately, none of these patches fixed the issues I was seeing.
> 
> While we're at it: BRW_NEW_CONTEXT seems like the wrong thing in basically
> every case.  Until we get MI_SET_CONTEXT, we always want to use NEW_BATCH.
> Or am I missing something?  I mean, NEW_CONTEXT won't hurt, but seems
> superfluous.

1, 6, 7, 9, 10, 11 are Reviewed-by: Eric Anholt 

> I'm also uncertain whether things like gen6_cc need to listen to
> BRW_NEW_STATE_BASE_ADDRESS or not.

It might be more clear, but it's just NEW_BATCH anyway.


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


Re: [Mesa-dev] [PATCH] i965: Fix zeroing of unused attributes in 3DSTATE_SBE.

2012-01-09 Thread Eric Anholt
On Sun,  8 Jan 2012 16:30:29 -0800, Kenneth Graunke  
wrote:
> This brings the code in sync with gen6_sf_state.c; presumably the
> mistake was a botched rebase on initial Ivybridge bring-up patches.
> 
> Found by diffing batch buffer dumps and noticing the random values.
> Thanks to Eric for catching the obvious mistake.
> 
> NOTE: This is a candidate for the 7.11 branch.

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH] glsl: remove logical xor FINISHME

2012-01-09 Thread Eric Anholt
On Sun,  8 Jan 2012 22:44:17 -0500, Matt Turner  wrote:
> GLSL spec boneheadedly says (a ^^ a) must actually be evaluated.

What it's trying to say there is that any side-effects of both LHS and
RHS will occur (as opposed to how && or || work), not that you actually
compute the expression that you could just avoid.  Any side effects will
already be taken care of before opt_algebraic gets a look at the
ir_expression.


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


Re: [Mesa-dev] gallium and GL interpolation intersection issue

2012-01-09 Thread Marek Olšák
Sorry, I mean flatshade, not flatshade_first.

Marek

On Mon, Jan 9, 2012 at 5:30 PM, Marek Olšák  wrote:
> On Mon, Jan 9, 2012 at 5:06 PM, Brian Paul  wrote:
>> On 01/09/2012 06:35 AM, Dave Airlie wrote:
>>>
>>> Okay so we have a gallium/GL/GLSL problem with interpolation, lets see
>>> if I can describe the issue:
>>>
>>> In the beginning there was GL interpolation rules, glShadeModel was
>>> the only information you had.
>>>
>>> Then came GLSL which allowed overriding the GL defaults using specifiers.
>>>
>>> So the gl_FrontColor variant, if left unspecified would take the value
>>> of the glShadeModel, if specified
>>> it would over-rule the current ShadeModel setting.
>>>
>>>
>>> So we end up something like this
>>>
>>> if (glFrontColor attrib>  0) result = glFrontColor_attrib; else result
>>> = shademodel.
>>>
>>> Now when we convert to gallium we lose the unspecified interpolation,
>>> and we generate a default interpolation
>>> attribute, which should usually be SMOOTH. Now we've no idea then
>>> inside the gallium drivers whether this smooth
>>> is due to an explicit smooth at the GLSL level which we can't
>>> override, or whether this smooth is something that we really
>>> wanted to be overruled by the ShadeModel bit.
>>>
>>> Now as discussed previously most hardware has support for the
>>> ShadeModel bit so generating multiple shaders
>>> for the unspecified case would be suboptimal for it.
>>>
>>> So the options I see are:
>>>
>>> (a) do it anyways, apply the patch I had earlier that derives the
>>> setting at the glsl->tgsi translation stage, and pretty
>>> much ignore it.
>>>
>>> (b) add unspecified interpolation support for Color inputs, only
>>> colors are affected by this, and since TGSI supports
>>> Colors we should probably support all the features of the GL Color
>>> output/inputs.
>>>
>>> Anyone any other ideas?
>>
>>
>> I'd probably go with (b), add a new TGSI_INTERPOLATE_COLOR mode that means
>> "look at pipe_rasterizer_state::flatshade."
>>
>> IMO, it's still attractive to get rid of pipe_rasterizer_state::flatshade
>> someday.  glShadeModel no longer exists in OpenGL 3.2 core profile and
>> later.
>
> Please note that the GLSL interpolation modes are a GLSL 1.3 feature.
> We can't remove pipe_rasterizer_state::flatshade_first for non-GL3
> drivers. And even with the interpolation modes available,
> recompiling.shaders when glShadeModel changes is an anti-optimization
> if drivers can do pipe_rasterizer_state::flatshade_first just fine. I
> would prefer that if there's a driver which cannot do
> pipe_rasterizer_state::flatshade_first (just svga?), let's add a CAP
> for it and handle it in the state tracker.
>
> Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Drooping multiple driver support in EGL?

2012-01-09 Thread Jose Fonseca


- Original Message -
> On Fri, Dec 23, 2011 at 7:51 PM, Chia-I Wu  wrote:
> > On Sat, Dec 24, 2011 at 12:37 AM, Ian Romanick
> >  wrote:
> >> On 12/23/2011 07:20 AM, Jose Fonseca wrote:
> >>>
> >>> - Original Message -
> 
>  Hi list,
> 
>  Multiple driver support in EGL is hard to get right, if not
>  impossible.
>  On Linux desktop, we almost always want to use egl_dri2.  It
>  allows
>  EGL
>  to loads DRI2 drivers, thus allowing it to share DRI2 drivers
>  with
>  libGL.
> 
>  In one case where the app wants to use OpenVG, libEGL needs to
>  load
>  egl_gallium instead.  The problem comes from that we cannot know
>  that
>  an
>  OpenVG context is to be created until it is created.  But before
>  a
>  context can be created, EGL needs to be initialized and an
>  EGLConfig
>  needs to be chosen.  So when EGL is to be initialized, we need
>  to
>  load
>  and initilaize all EGL drivers.  When an EGLConfig is to be
>  picked,
>  we
>  need to pick it from all drivers.
> >>>
> >>>
> >>> Couldn't we restructure this such that OpenVG (and all other
> >>> state
> >>> trackers on Linux) still use a dri2 driver, but one which exposes
> >>> an
> >>> additional (gallium specific) interface?
> >> I was going to suggest something similar.  I think we want fewer
> >> EGL
> >> backends to test and maintain, not more.  Right?
> > I totally agree with that.  I even had an unfinished branch for
> > that.
> >
> > Note that this thread is about dropping multiple EGL driver
> > support.
> > The motivation for having OpenVG in DRI2 drivers is that we do not
> > want multiple EGL drivers.  The former should push the latter to
> > happen more quickly, instead of preventing it from happening.
> 
> The problem with exposing the Gallium Interface via the DRI interface
> is that the DRI interface is public and stable while the Gallium one
> is
> not.

I think one doesn't invalidate the other. That is, it is technically feasible 
to have an unstable interface on top of an stable interface. In detail, we 
could add a stable extension DRI , which exposes Gallium (eg. 
DRI2GetGalliumScreen). Obviously, for things to work, it would be imperative 
that the libEGL.so and foo_dri.so were built together, which is already the 
case today.

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


Re: [Mesa-dev] [PATCH] mesa: Bump version to 8.0 (devel)

2012-01-09 Thread Jason Wood
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/06/2012 05:54 PM, Kenneth Graunke wrote:
> --- Makefile|2 +- configs/default |
> 4 +- docs/relnotes-7.12.html |   83
> --- 
> docs/relnotes-8.0.html  |   83
> +++ docs/relnotes.html
> |2 +- src/mesa/main/version.h |6 ++-- 6 files changed, 90
> insertions(+), 90 deletions(-) delete mode 100644
> docs/relnotes-7.12.html create mode 100644 docs/relnotes-8.0.html
> 
> Good idea.  The earlier commits I was looking at didn't do that.
> 
> diff --git a/Makefile b/Makefile index c738947..4a41948 100644 ---
> a/Makefile +++ b/Makefile @@ -184,7 +184,7 @@ ultrix-gcc:
> 
> # Rules for making release tarballs
> 
> -PACKAGE_VERSION=7.12-devel +PACKAGE_VERSION=8.0-devel PACKAGE_DIR
> = Mesa-$(PACKAGE_VERSION) PACKAGE_NAME =
> MesaLib-$(PACKAGE_VERSION)
> 
> diff --git a/configs/default b/configs/default index
> 33e5f02..2ca6fe4 100644 --- a/configs/default +++
> b/configs/default @@ -8,8 +8,8 @@ CONFIG_NAME = default
> 
> # Version info -MESA_MAJOR=7 -MESA_MINOR=12 +MESA_MAJOR=8 
> +MESA_MINOR=0 MESA_TINY=0 MESA_VERSION =
> $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
> 
> diff --git a/docs/relnotes-7.12.html b/docs/relnotes-7.12.html 
> deleted file mode 100644 index 471bbda..000 ---
> a/docs/relnotes-7.12.html +++ /dev/null @@ -1,83 +0,0 @@ - - 
> - -Mesa Release Notes - type="text/css" href="mesa.css"> - content="text/html; charset=utf-8" /> - - - - - bgcolor="#ee"> - -Mesa 7.12 Release Notes / (release date
> TBD) - - -Mesa 7.12 is a new development release. -People
> who are concerned with stability and reliability should stick -with
> a previous release or wait for Mesa 7.12.1. - - -Mesa 7.12
> implements the OpenGL 2.1 API, but the version reported by 
> -glGetString(GL_VERSION) depends on the particular driver being
> used. -Some drivers don't support all the features required in
> OpenGL 2.1. - - -See the  href="install.html">Compiling/Installing page for
> prerequisites -for DRI hardware acceleration. - - - -MD5
> checksums - -tbd - - - -New features 
> - -GL_ARB_ES2_compatibility (r300g, r600g) 
> -GL_ARB_depth_buffer_float (r600g) 
> -GL_ARB_vertex_type_2_10_10_10_rev (r600g) 
> -GL_ARB_texture_storage (gallium drivers and swrast) 
> -GL_EXT_packed_float (i965) -GL_EXT_texture_array (r600g,
> i965) -GL_EXT_texture_shared_exponent (i965) 
> -GL_NV_fog_distance (all gallium drivers, nouveau classic) 
> -GL_NV_primitive_restart (r600g) -GL_OES_EGL_image_external
> (gallium drivers) -GL_OES_compressed_ETC1_RGB8_texture
> (softpipe, llvmpipe) -ARB_texture_rgb10_a2ui (softpipe, r600g) 
> -Many updates to the VMware svga Gallium driver - - - 
> -Bug fixes - - - - -Changes - 
> -Removed all DRI drivers that did not support DRI2.
> Specifically, -  i810, mach64, mga, r128, savage, sis, tdfx, and
> unichrome were -  removed. -Removed support for
> BeOS. -Removed the obsolete (and unmaintained) Windows
> "gldirect" and -  "ICD" drivers. -Removed the linux-fbdev
> software driver. -Removed all remnants of paletted texture
> support.  As required by -  desktop OpenGL, GL_COLOR_INDEX
> data can still be uploaded -  to a color (e.g., RGBA) texture.
> However, the data cannot be stored -  internally as
> color-index. -Removed support for GL_APPLE_client_storage
> extension. -Removed the classic Mesa r300 and r600
> drivers, which are superseded -  by the gallium drivers for this
> hardware. -Removed the dead Gallium i965, cell and
> failover drivers, which were -  either broken and with nobody in
> sight to fix the situation or -  deprecated. - - - 
> - - diff --git a/docs/relnotes-8.0.html
> b/docs/relnotes-8.0.html new file mode 100644 index
> 000..b7756c0 --- /dev/null +++ b/docs/relnotes-8.0.html @@ -0,0
> +1,83 @@ + + + +Mesa Release Notes 
> + + http-equiv="content-type" content="text/html; charset=utf-8" /> 
> + + + + + + +Mesa 8.0
> Release Notes / (release date TBD) + + +Mesa 8.0 is a new
> development release. +People who are concerned with stability and
> reliability should stick +with a previous release or wait for Mesa
> 8.0.1. + + +Mesa 8.0 implements the OpenGL 2.1 API, but the
> version reported by +glGetString(GL_VERSION) depends on the
> particular driver being used. +Some drivers don't support all the
> features required in OpenGL 2.1.


Should this be bumped to OpenGL 3.0?



> + + +See the Compiling/Installing
> page for prerequisites +for DRI hardware acceleration. + + 
> + +MD5 checksums + +tbd + + + +New
> features + +GL_ARB_ES2_compatibility (r300g, r600g) 
> +GL_ARB_depth_buffer_float (r600g) 
> +GL_ARB_vertex_type_2_10_10_10_rev (r600g) 
> +GL_ARB_texture_storage (gallium drivers and swrast) 
> +GL_EXT_packed_float (i965) +GL_EXT_texture_array (r600g,
> i965) +GL_EXT_texture_shared_exponent (i965) 
> +GL_NV_fog_distance (all gallium drivers, nouveau classic) 
> +GL_NV_primitive_restart (r600g) +GL_OES_EGL_image_exte

Re: [Mesa-dev] [PATCH] gallivm: Allow target specific intrinsics in lp_declare_intrinsic()

2012-01-09 Thread Jose Fonseca
Looks good Tom.

Jose

- Original Message -
> Target specific intrinsics are also prefixed with llvm, so this
> assert
> was preventing us from using them.
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_intr.c |7 ---
>  1 files changed, 0 insertions(+), 7 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.c
> b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
> index 518a01f..2323f12 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_intr.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
> @@ -70,13 +70,6 @@ lp_declare_intrinsic(LLVMModuleRef module,
>  
> assert(LLVMIsDeclaration(function));
>  
> -   if(name[0] == 'l' &&
> -  name[1] == 'l' &&
> -  name[2] == 'v' &&
> -  name[3] == 'm' &&
> -  name[4] == '.')
> -  assert(LLVMGetIntrinsicID(function));
> -
> return function;
>  }
>  
> --
> 1.7.3.4
> 
> ___
> 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] [PATCH 0/3] Softpipe draw de-LLVM-fication.

2012-01-09 Thread Jakob Bornecrantz
So it turns out that softpipe uses LLVM in the draw module
since it has no way of telling draw not to use it. This patch
series fixes that. Also makes the draw initialization fail
if draw can't initialize LLVM in the normal case.

Cheers, Jakob.

Jakob Bornecrantz (3):
  draw: Make it possible to create a llvm free context
  draw: Fail if we fail to enable llvm when asked for it
  softpipe: Don't use llvm in draw

 src/gallium/auxiliary/draw/draw_context.c |   64 -
 src/gallium/auxiliary/draw/draw_context.h |2 +
 src/gallium/drivers/softpipe/sp_context.c |2 +-
 3 files changed, 47 insertions(+), 21 deletions(-)

-- 
1.7.5.4

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


[Mesa-dev] [PATCH 1/3] draw: Make it possible to create a llvm free context

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/auxiliary/draw/draw_context.c |   48 -
 src/gallium/auxiliary/draw/draw_context.h |2 +
 2 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c 
b/src/gallium/auxiliary/draw/draw_context.c
index 9c00687..f4b1f8c 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -65,30 +65,19 @@ draw_get_option_use_llvm(void)
 #endif
 
 
-
-/**
- * Create new draw module context.
- */
-struct draw_context *
-draw_create(struct pipe_context *pipe)
-{
-   return draw_create_gallivm(pipe, NULL);
-}
-
-
-
 /**
  * Create new draw module context with gallivm state for LLVM JIT.
  */
-struct draw_context *
-draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm)
+static struct draw_context *
+draw_create_context(struct pipe_context *pipe, boolean try_llvm,
+struct gallivm_state *gallivm)
 {
struct draw_context *draw = CALLOC_STRUCT( draw_context );
if (draw == NULL)
   goto fail;
 
 #if HAVE_LLVM
-   if (draw_get_option_use_llvm()) {
+   if (try_llvm && draw_get_option_use_llvm()) {
   if (!gallivm) {
  gallivm = gallivm_create();
  draw->own_gallivm = gallivm;
@@ -112,6 +101,35 @@ fail:
 }
 
 
+/**
+ * Create new draw module context, with LLVM JIT.
+ */
+struct draw_context *
+draw_create(struct pipe_context *pipe)
+{
+   return draw_create_context(pipe, TRUE, NULL);
+}
+
+
+/**
+ * Create a new draw context, without LLVM JIT.
+ */
+struct draw_context *
+draw_create_no_llvm(struct pipe_context *pipe)
+{
+   return draw_create_context(pipe, FALSE, NULL);
+}
+
+
+/**
+ * Create new draw module context with gallivm state for LLVM JIT.
+ */
+struct draw_context *
+draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm)
+{
+   return draw_create_context(pipe, TRUE, gallivm);
+}
+
 
 boolean draw_init(struct draw_context *draw)
 {
diff --git a/src/gallium/auxiliary/draw/draw_context.h 
b/src/gallium/auxiliary/draw/draw_context.h
index 93577d0..7655ad0 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -54,6 +54,8 @@ struct gallivm_state;
 
 struct draw_context *draw_create( struct pipe_context *pipe );
 
+struct draw_context *draw_create_no_llvm(struct pipe_context *pipe);
+
 struct draw_context *
 draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm);
 
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 2/3] draw: Fail if we fail to enable llvm when asked for it

2012-01-09 Thread Jakob Bornecrantz
The r300 driver requires LLVM when building and other drivers that
depend on it for all TNL, like i915g will be a lot slower without it.

Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/auxiliary/draw/draw_context.c |   16 +++-
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c 
b/src/gallium/auxiliary/draw/draw_context.c
index f4b1f8c..f6db95d 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -74,7 +74,7 @@ draw_create_context(struct pipe_context *pipe, boolean 
try_llvm,
 {
struct draw_context *draw = CALLOC_STRUCT( draw_context );
if (draw == NULL)
-  goto fail;
+  goto err_out;
 
 #if HAVE_LLVM
if (try_llvm && draw_get_option_use_llvm()) {
@@ -83,20 +83,26 @@ draw_create_context(struct pipe_context *pipe, boolean 
try_llvm,
  draw->own_gallivm = gallivm;
   }
 
-  if (gallivm)
- draw->llvm = draw_llvm_create(draw, gallivm);
+  if (!gallivm)
+ goto err_destroy;
+
+  draw->llvm = draw_llvm_create(draw, gallivm);
+
+  if (!draw->llvm)
+ goto err_destroy;
}
 #endif
 
if (!draw_init(draw))
-  goto fail;
+  goto err_destroy;
 
draw->pipe = pipe;
 
return draw;
 
-fail:
+err_destroy:
draw_destroy( draw );
+err_out:
return NULL;
 }
 
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 3/3] softpipe: Don't use llvm in draw

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/drivers/softpipe/sp_context.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_context.c 
b/src/gallium/drivers/softpipe/sp_context.c
index a720600..dd81442 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -305,7 +305,7 @@ softpipe_create_context( struct pipe_screen *screen,
/*
 * Create drawing context and plug our rendering stage into it.
 */
-   softpipe->draw = draw_create(&softpipe->pipe);
+   softpipe->draw = draw_create_no_llvm(&softpipe->pipe);
if (!softpipe->draw) 
   goto fail;
 
-- 
1.7.5.4

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


Re: [Mesa-dev] [PATCH] gallium: improve the pipe_stream_output_info struct

2012-01-09 Thread Jose Fonseca


- Original Message -
> There are 3 changes:
> 
> 1) stride is specified for each buffer, not just one, so that drivers
> don't
>have to derive it from the outputs
> 
> 2) new per-output property dst_offset, which specifies the offset
>into the buffer in dwords where the output should be stored,
>so that drivers don't have to compute the offsets manually;
>this will also be useful for gl_SkipComponents
>from ARB_transform_feedback3
> 
> 3) register_mask is removed, instead, there is start_component
>and num_components; register_mask with non-consecutive 1s
>doesn't make much sense (some hardware cannot do packing of
>components)
> 
> Christoph Bumiller: fixed nvc0.
> ---
>  src/gallium/auxiliary/draw/draw_pt_so_emit.c |4 ++-
>  src/gallium/auxiliary/util/u_blitter.c   |4 +-
>  src/gallium/auxiliary/util/u_dump_state.c|6 ++-
>  src/gallium/drivers/llvmpipe/lp_state_so.c   |2 +-
>  src/gallium/drivers/nvc0/nvc0_program.c  |   11 ++
>  src/gallium/drivers/r600/r600.h  |4 +-
>  src/gallium/drivers/r600/r600_hw_context.c   |8 ++--
>  src/gallium/drivers/r600/r600_pipe.h |1 -
>  src/gallium/drivers/r600/r600_shader.c   |   46
>  +++---
>  src/gallium/drivers/r600/r600_state_common.c |2 +-
>  src/gallium/drivers/softpipe/sp_state_so.c   |2 +-
>  src/gallium/drivers/trace/tr_dump_state.c|6 ++-
>  src/gallium/include/pipe/p_state.h   |   13 ---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp   |   18 --
>  14 files changed, 53 insertions(+), 74 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> index 2dc9e29..7dc6937 100644
> --- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> +++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> @@ -144,7 +144,9 @@ static void so_emit_prim(struct pt_so_emit *so,
>   (const char *)input_ptr + (indices[i] *
>   input_vertex_stride));
>for (slot = 0; slot < state->num_outputs; ++slot) {
>   unsigned idx = state->output[slot].register_index;
> - unsigned writemask = state->output[slot].register_mask;
> + unsigned writemask =
> +   ((1 << state->output[slot].num_components) - 1) <<
> +   state->output[slot].start_component;
>   unsigned written_compos = 0;
>   unsigned compo;
>  
> diff --git a/src/gallium/auxiliary/util/u_blitter.c
> b/src/gallium/auxiliary/util/u_blitter.c
> index 80fdfe0..94012c5 100644
> --- a/src/gallium/auxiliary/util/u_blitter.c
> +++ b/src/gallium/auxiliary/util/u_blitter.c
> @@ -266,8 +266,8 @@ struct blitter_context
> *util_blitter_create(struct pipe_context *pipe)
>  
>memset(&so, 0, sizeof(so));
>so.num_outputs = 1;
> -  so.output[0].register_mask = TGSI_WRITEMASK_XYZW;
> -  so.stride = 4;
> +  so.output[0].num_components = 4;
> +  so.stride[0] = 4;
>  
>ctx->vs_pos_only =
>   util_make_vertex_passthrough_shader_with_so(pipe, 1,
>   semantic_names,
> diff --git a/src/gallium/auxiliary/util/u_dump_state.c
> b/src/gallium/auxiliary/util/u_dump_state.c
> index e44c619..4b5a042 100644
> --- a/src/gallium/auxiliary/util/u_dump_state.c
> +++ b/src/gallium/auxiliary/util/u_dump_state.c
> @@ -441,13 +441,15 @@ util_dump_shader_state(FILE *stream, const
> struct pipe_shader_state *state)
> util_dump_member_begin(stream, "stream_output");
> util_dump_struct_begin(stream, "pipe_stream_output_info");
> util_dump_member(stream, uint, &state->stream_output,
> num_outputs);
> -   util_dump_member(stream, uint, &state->stream_output, stride);
> +   util_dump_array(stream, uint, state->stream_output.stride,
> +   Elements(state->stream_output.stride));
> util_dump_array_begin(stream);
> for(i = 0; i < state->stream_output.num_outputs; ++i) {
>util_dump_elem_begin(stream);
>util_dump_struct_begin(stream, ""); /* anonymous */
>util_dump_member(stream, uint,
>&state->stream_output.output[i], register_index);
> -  util_dump_member(stream, uint,
> &state->stream_output.output[i], register_mask);
> +  util_dump_member(stream, uint,
> &state->stream_output.output[i], start_component);
> +  util_dump_member(stream, uint,
> &state->stream_output.output[i], num_components);
>util_dump_member(stream, uint,
>&state->stream_output.output[i], output_buffer);
>util_dump_struct_end(stream);
>util_dump_elem_end(stream);
> diff --git a/src/gallium/drivers/llvmpipe/lp_state_so.c
> b/src/gallium/drivers/llvmpipe/lp_state_so.c
> index 108f3aa..ed2272d 100644
> --- a/src/gallium/drivers/llvmpipe/lp_state_so.c
> +++ b/src/gallium/drivers/llvmpipe/lp_state_so.c
> @@ -42,7 +42,7 @@ llvmpipe_create_stream_output_state(struct
> pipe_context *pipe,
>  
> if (so) {
>so->base.num_outputs = templ->num_o

Re: [Mesa-dev] [PATCH 2/3] mesa: add _mesa_unpack_ubyte_rgba_row() function

2012-01-09 Thread Jose Fonseca
Looks good to me AFAICT.

Jose

- Original Message -
> ---
>  src/mesa/main/format_unpack.c |  499
>  +
>  src/mesa/main/format_unpack.h |3 +
>  2 files changed, 502 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/main/format_unpack.c
> b/src/mesa/main/format_unpack.c
> index c723e89..a7308a1 100644
> --- a/src/mesa/main/format_unpack.c
> +++ b/src/mesa/main/format_unpack.c
> @@ -29,6 +29,22 @@
>  #include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
>  
>  
> +
> +/* Expand 1, 2, 3, 4, 5, 6-bit values to fill 8 bits */
> +
> +#define EXPAND_1_8(X)  ( (X) ? 0xff : 0x0 )
> +
> +#define EXPAND_2_8(X)  ( ((X) << 6) | ((X) << 4) | ((X) << 2) | (X)
> )
> +
> +#define EXPAND_3_8(X)  ( ((X) << 5) | ((X) << 2) | ((X) > 1) )



> +
> +#define EXPAND_4_8(X)  ( ((X) << 4) | (X) )
> +
> +#define EXPAND_5_8(X)  ( ((X) << 3) | ((X) >> 2) )
> +
> +#define EXPAND_6_8(X)  ( ((X) << 2) | ((X) >> 4) )
> +
> +
>  /**
>   * Convert an 8-bit sRGB value from non-linear space to a
>   * linear RGB value in [0, 1].
> @@ -57,6 +73,10 @@ nonlinear_to_linear(GLubyte cs8)
>  }
>  
>  
> +/**/
> +/*  Unpack, returning GLfloat colors
>  */
> +/**/
> +
>  typedef void (*unpack_rgba_func)(const void *src, GLfloat dst[][4],
>  GLuint n);
>  
>  
> @@ -1566,6 +1586,9 @@ get_unpack_rgba_function(gl_format format)
>  }
>  
>  
> +/**
> + * Unpack rgba colors, returning as GLfloat values.
> + */
>  void
>  _mesa_unpack_rgba_row(gl_format format, GLuint n,
>const void *src, GLfloat dst[][4])
> @@ -1574,6 +1597,482 @@ _mesa_unpack_rgba_row(gl_format format,
> GLuint n,
> unpack(src, dst, n);
>  }
>  
> +
> +/**/
> +/*  Unpack, returning GLubyte colors
>  */
> +/**/
> +
> +
> +static void
> +unpack_ubyte_RGBA(const void *src, GLubyte dst[][4], GLuint n)
> +{
> +   const GLuint *s = ((const GLuint *) src);
> +   GLuint i;
> +   for (i = 0; i < n; i++) {
> +  dst[i][RCOMP] = (s[i] >> 24);
> +  dst[i][GCOMP] = (s[i] >> 16) & 0xff;
> +  dst[i][BCOMP] = (s[i] >>  8) & 0xff;
> +  dst[i][ACOMP] = (s[i]  ) & 0xff;
> +   }
> +}
> +
> +static void
> +unpack_ubyte_RGBA_REV(const void *src, GLubyte dst[][4], GLuint
> n)
> +{
> +   const GLuint *s = ((const GLuint *) src);
> +   GLuint i;
> +   for (i = 0; i < n; i++) {
> +  dst[i][RCOMP] = (s[i]  ) & 0xff;
> +  dst[i][GCOMP] = (s[i] >>  8) & 0xff;
> +  dst[i][BCOMP] = (s[i] >> 16) & 0xff;
> +  dst[i][ACOMP] = (s[i] >> 24);
> +   }
> +}
> +
> +static void
> +unpack_ubyte_ARGB(const void *src, GLubyte dst[][4], GLuint n)
> +{
> +   const GLuint *s = ((const GLuint *) src);
> +   GLuint i;
> +   for (i = 0; i < n; i++) {
> +  dst[i][RCOMP] = (s[i] >> 16) & 0xff;
> +  dst[i][GCOMP] = (s[i] >>  8) & 0xff;
> +  dst[i][BCOMP] = (s[i]  ) & 0xff;
> +  dst[i][ACOMP] = (s[i] >> 24);
> +   }
> +}
> +
> +static void
> +unpack_ubyte_ARGB_REV(const void *src, GLubyte dst[][4], GLuint
> n)
> +{
> +   const GLuint *s = ((const GLuint *) src);
> +   GLuint i;
> +   for (i = 0; i < n; i++) {
> +  dst[i][RCOMP] = (s[i] >>  8) & 0xff;
> +  dst[i][GCOMP] = (s[i] >> 16) & 0xff;
> +  dst[i][BCOMP] = (s[i] >> 24);
> +  dst[i][ACOMP] = (s[i]  ) & 0xff;
> +   }
> +}
> +
> +static void
> +unpack_ubyte_RGBX(const void *src, GLubyte dst[][4], GLuint n)
> +{
> +   const GLuint *s = ((const GLuint *) src);
> +   GLuint i;
> +   for (i = 0; i < n; i++) {
> +  dst[i][RCOMP] = (s[i] >> 24);
> +  dst[i][GCOMP] = (s[i] >> 16) & 0xff;
> +  dst[i][BCOMP] = (s[i] >>  8) & 0xff;
> +  dst[i][ACOMP] = 0xff;
> +   }
> +}
> +
> +static void
> +unpack_ubyte_RGBX_REV(const void *src, GLubyte dst[][4], GLuint
> n)
> +{
> +   const GLuint *s = ((const GLuint *) src);
> +   GLuint i;
> +   for (i = 0; i < n; i++) {
> +  dst[i][RCOMP] = (s[i]  ) & 0xff;
> +  dst[i][GCOMP] = (s[i] >>  8) & 0xff;
> +  dst[i][BCOMP] = (s[i] >> 16) & 0xff;
> +  dst[i][ACOMP] = 0xff;
> +   }
> +}
> +
> +static void
> +unpack_ubyte_XRGB(const void *src, GLubyte dst[][4], GLuint n)
> +{
> +   const GLuint *s = ((const GLuint *) src);
> +   GLuint i;
> +   for (i = 0; i < n; i++) {
> +  dst[i][RCOMP] = (s[i] >> 16) & 0xff;
> +  dst[i][GCOMP] = (s[i] >>  8) & 0xff;
> +  dst[i][BCOMP] = (s[i]  ) & 0xff;
> +  dst[i][ACOMP] = 0xff;
> +   }
> +}
> +
> +static void
> +unpack_ubyte_XRGB_REV(const void *src, GLubyte dst[][4], GLuint
> n)
> +{
> +   const GLuint *s = ((const GLuint *) src);
> +   GLuint i;
> +   for (i = 0; i < n; i++) {
> +  dst[i][RCOMP] = (s[i] >>  8) & 0xff;
> +  dst[i][GCO

Re: [Mesa-dev] [PATCH 3/3] swrast: convert blit_linear() to Map/UnmapRenderbuffer()

2012-01-09 Thread Jose Fonseca
Looks good to me.

Jose

- Original Message -
> ---
>  src/mesa/swrast/s_blit.c |  183
>  +++--
>  1 files changed, 158 insertions(+), 25 deletions(-)
> 
> diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c
> index 1063024..34317cc 100644
> --- a/src/mesa/swrast/s_blit.c
> +++ b/src/mesa/swrast/s_blit.c
> @@ -423,9 +423,66 @@ resample_linear_row_ub(GLint srcWidth, GLint
> dstWidth,
>  }
>  
>  
> +/**
> + * Bilinear interpolation of two source rows.  floating point
> pixels.
> + */
> +static void
> +resample_linear_row_float(GLint srcWidth, GLint dstWidth,
> +  const GLvoid *srcBuffer0, const GLvoid
> *srcBuffer1,
> +  GLvoid *dstBuffer, GLboolean flip, GLfloat
> rowWeight)
> +{
> +   const GLfloat (*srcColor0)[4] = (const GLfloat (*)[4])
> srcBuffer0;
> +   const GLfloat (*srcColor1)[4] = (const GLfloat (*)[4])
> srcBuffer1;
> +   GLfloat (*dstColor)[4] = (GLfloat (*)[4]) dstBuffer;
> +   const GLfloat dstWidthF = (GLfloat) dstWidth;
> +   GLint dstCol;
> +
> +   for (dstCol = 0; dstCol < dstWidth; dstCol++) {
> +  const GLfloat srcCol = (dstCol * srcWidth) / dstWidthF;
> +  GLint srcCol0 = IFLOOR(srcCol);
> +  GLint srcCol1 = srcCol0 + 1;
> +  GLfloat colWeight = srcCol - srcCol0; /* fractional part of
> srcCol */
> +  GLfloat red, green, blue, alpha;
> +
> +  ASSERT(srcCol0 >= 0);
> +  ASSERT(srcCol0 < srcWidth);
> +  ASSERT(srcCol1 <= srcWidth);
> +
> +  if (srcCol1 == srcWidth) {
> + /* last column fudge */
> + srcCol1--;
> + colWeight = 0.0;
> +  }
> +
> +  if (flip) {
> + srcCol0 = srcWidth - 1 - srcCol0;
> + srcCol1 = srcWidth - 1 - srcCol1;
> +  }
> +
> +  red = lerp_2d(colWeight, rowWeight,
> +srcColor0[srcCol0][RCOMP],
> srcColor0[srcCol1][RCOMP],
> +srcColor1[srcCol0][RCOMP],
> srcColor1[srcCol1][RCOMP]);
> +  green = lerp_2d(colWeight, rowWeight,
> +srcColor0[srcCol0][GCOMP],
> srcColor0[srcCol1][GCOMP],
> +srcColor1[srcCol0][GCOMP],
> srcColor1[srcCol1][GCOMP]);
> +  blue = lerp_2d(colWeight, rowWeight,
> +srcColor0[srcCol0][BCOMP],
> srcColor0[srcCol1][BCOMP],
> +srcColor1[srcCol0][BCOMP],
> srcColor1[srcCol1][BCOMP]);
> +  alpha = lerp_2d(colWeight, rowWeight,
> +srcColor0[srcCol0][ACOMP],
> srcColor0[srcCol1][ACOMP],
> +srcColor1[srcCol0][ACOMP],
> srcColor1[srcCol1][ACOMP]);
> +
> +  dstColor[dstCol][RCOMP] = red;
> +  dstColor[dstCol][GCOMP] = green;
> +  dstColor[dstCol][BCOMP] = blue;
> +  dstColor[dstCol][ACOMP] = alpha;
> +   }
> +}
> +
> +
>  
>  /**
> - * Bilinear filtered blit (color only).
> + * Bilinear filtered blit (color only, non-integer values).
>   */
>  static void
>  blit_linear(struct gl_context *ctx,
> @@ -456,23 +513,25 @@ blit_linear(struct gl_context *ctx,
> GLint srcBufferY0 = -1, srcBufferY1 = -1;
> GLvoid *dstBuffer;
>  
> -   switch (readRb->DataType) {
> -   case GL_UNSIGNED_BYTE:
> +   gl_format readFormat = readRb->Format;
> +   gl_format drawFormat = drawRb->Format;
> +   GLuint bpp = _mesa_get_format_bytes(readFormat);
> +
> +   GLenum pixelType;
> +
> +   GLubyte *srcMap, *dstMap;
> +   GLint srcRowStride, dstRowStride;
> +
> +
> +   /* Determine datatype for resampling */
> +   if (_mesa_get_format_max_bits(readFormat) == 8 &&
> +   _mesa_get_format_datatype(readFormat) ==
> GL_UNSIGNED_NORMALIZED) {
> +  pixelType = GL_UNSIGNED_BYTE;
>pixelSize = 4 * sizeof(GLubyte);
> -  break;
> -   case GL_UNSIGNED_SHORT:
> -  pixelSize = 4 * sizeof(GLushort);
> -  break;
> -   case GL_UNSIGNED_INT:
> -  pixelSize = 4 * sizeof(GLuint);
> -  break;
> -   case GL_FLOAT:
> +   }
> +   else {
> +  pixelType = GL_FLOAT;
>pixelSize = 4 * sizeof(GLfloat);
> -  break;
> -   default:
> -  _mesa_problem(ctx, "unexpected buffer type (0x%x) in
> blit_nearest",
> -readRb->DataType);
> -  return;
> }
>  
> /* Allocate the src/dst row buffers.
> @@ -497,6 +556,45 @@ blit_linear(struct gl_context *ctx,
>return;
> }
>  
> +   /*
> +* Map src / dst renderbuffers
> +*/
> +   if (readRb == drawRb) {
> +  /* map whole buffer for read/write */
> +  ctx->Driver.MapRenderbuffer(ctx, readRb,
> +  0, 0, readRb->Width,
> readRb->Height,
> +  GL_MAP_READ_BIT |
> GL_MAP_WRITE_BIT,
> +  &srcMap, &srcRowStride);
> +  if (!srcMap) {
> + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFramebuffer");
> + return;
> +  }
> +
> +  dstMap = srcMap;
> +  dstRowStride = srcRowStride;
> +   }
> +   else {
> +  /* different src/dst buffers */
> +  /* XXX with a bit of work we c

Re: [Mesa-dev] softpipe GL3 status

2012-01-09 Thread Jose Fonseca


- Original Message -
> Hi guys,
> 
> Just a quick note, I've just spent a week or so trying to see where
> gallium and softpipe were w.r.t GL3.0 support.
> 
> I've pushed a branch to my repo called softpipe-gl3. It contains
> patches in various state of usefulness but it brings the piglit
> results to 220 failures in 7623 tests, which isn't bad.
> 
> Outstanding known problems (stuff I've dug into).
> 
> smooth interpolation is broken in softpipe, worth about 70-100 fixes
> at a quick guess.
> 
> integer abs - we have no TGSI representation for this, should we
> lower
> it to something?
> integer SSG (set sign) - no TGSI for this, lower it?
> 
> roundEven - need to implement softpipe round to match hw rounds which
> are roundEven.
> 
> cube shadow sampling, some reason ends up getting info from the
> fallback texture
> 
> fbo-stencil tests, st/mesa needs to implement
> st_BlitFramebuffer(GL_STENCIL).
> 
> minmax: need to increase texture array levels to 256 and missing
> multisample support.
> 
> the unknown stuff includes some GLSL compiler failures and generic
> GLX issues.
> 
> Oh and this is all only available when DRAW_USE_LLVM=false is set,
> adding integer support to LLVM is a bit of a bigger task, and I'm not
> sure I can really get into it at the moment.
> 
> in case anyone is looking for any motivation on why I've been working
> on this, it just seemed like it would be nice to have a reference sw
> GL3.0 compatible renderer in Mesa 8.0.

A bit late, but just wanted to say nice stuff Dave.

I also like the idea of softpipe as reference driver.

llvmpipe is definitely the software renderer to bet for performance, but it's 
far from trivial to add features given the complexity of everything being code 
generated Just-In-Time.  softpipe is really easy to maintain by comparison.

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


Re: [Mesa-dev] [PATCH] mesa: add missing color buffer datatype check for glBlitFramebuffer()

2012-01-09 Thread Jose Fonseca
Looks good to me.

Jose

- Original Message -
> ---
>  src/mesa/main/fbobject.c |   44
>  
>  1 files changed, 44 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index ddd70be..6ff09f7 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2579,6 +2579,44 @@ find_attachment(const struct gl_framebuffer
> *fb,
>  }
>  
>  
> +/**
> + * Helper function for checking if the datatypes of color buffers
> are
> + * compatible for glBlitFramebuffer.  From the spec:
> + *
> + * "GL_INVALID_OPERATION is generated if mask contains
> GL_COLOR_BUFFER_BIT
> + *  and any of the following conditions hold:
> + *   - The read buffer contains fixed-point or floating-point values
> and any
> + * draw buffer contains neither fixed-point nor floating-point
> values.
> + *   - The read buffer contains unsigned integer values and any draw
> buffer
> + * does not contain unsigned integer values.
> + *   - The read buffer contains signed integer values and any draw
> buffer
> + * does not contain signed integer values."
> + */
> +static GLboolean
> +compatible_color_datatypes(gl_format srcFormat, gl_format dstFormat)
> +{
> +   GLenum srcType = _mesa_get_format_datatype(srcFormat);
> +   GLenum dstType = _mesa_get_format_datatype(dstFormat);
> +
> +   if (srcType != GL_INT && srcType != GL_UNSIGNED_INT) {
> +  assert(srcType == GL_UNSIGNED_NORMALIZED ||
> + srcType == GL_SIGNED_NORMALIZED ||
> + srcType == GL_FLOAT);
> +  /* Boil any of those types down to GL_FLOAT */
> +  srcType = GL_FLOAT;
> +   }
> +
> +   if (dstType != GL_INT && dstType != GL_UNSIGNED_INT) {
> +  assert(dstType == GL_UNSIGNED_NORMALIZED ||
> + dstType == GL_SIGNED_NORMALIZED ||
> + dstType == GL_FLOAT);
> +  /* Boil any of those types down to GL_FLOAT */
> +  dstType = GL_FLOAT;
> +   }
> +
> +   return srcType == dstType;
> +}
> +
>  
>  /**
>   * Blit rectangular region, optionally from one framebuffer to
>   another.
> @@ -2663,6 +2701,12 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint
> srcY0, GLint srcX1, GLint srcY1,
>colorReadRb = colorDrawRb = NULL;
>mask &= ~GL_COLOR_BUFFER_BIT;
>}
> +  else if (!compatible_color_datatypes(colorReadRb->Format,
> +   colorDrawRb->Format)) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> + "glBlitFramebufferEXT(color buffer datatypes
> mismatch)");
> + return;
> +  }
> }
> else {
>colorReadRb = colorDrawRb = NULL;
> --
> 1.7.3.4
> 
> ___
> 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


Re: [Mesa-dev] [PATCH] RFC: tgsi: Add output_type to struct tgsi_opcode_info

2012-01-09 Thread Jose Fonseca
Tom,

I think this is perfectly sensible thing to do if it helps, but 
tgsi_output_type definition should be added to tgsi_info.h  and not 
src/gallium/include/pipe/p_shader_tokens.h as it is not really used anywhere in 
the tokenized representation.

Jose

- Original Message -
> I've been working more on the TGSI->LLVM converter, and I've found
> that
> it would be useful to be able to look up information about how an
> opcode
> calculates its result.
> 
> I'm looking for feedback on whether adding a field to struct
> tgsi_opcode_info is the right way to do this, and also if the
> enumerations in enum tgsi_output_type make sense.
> ---
>  src/gallium/auxiliary/tgsi/tgsi_info.h |1 +
>  src/gallium/include/pipe/p_shader_tokens.h |   33
>  
>  2 files changed, 34 insertions(+), 0 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h
> b/src/gallium/auxiliary/tgsi/tgsi_info.h
> index 1992d11..4fc19e9 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_info.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_info.h
> @@ -43,6 +43,7 @@ struct tgsi_opcode_info
> unsigned is_branch:1;
> int pre_dedent:2;
> int post_indent:2;
> +   enum tgsi_output_type output_type:3;
> const char *mnemonic;
> uint opcode;
>  };

> diff --git a/src/gallium/include/pipe/p_shader_tokens.h
> b/src/gallium/include/pipe/p_shader_tokens.h
> index 330e0ba..8a1d60c 100644
> --- a/src/gallium/include/pipe/p_shader_tokens.h
> +++ b/src/gallium/include/pipe/p_shader_tokens.h
> @@ -216,6 +216,39 @@ struct tgsi_property_data {
> unsigned Data;
>  };
>  
> +/* This enum describes how an opcode calculates its result. */
> +enum tgsi_output_type {
> +   /** The opcode produces no result. */
> +   TGSI_OUTPUT_NONE= 0,
> +
> +   /** When this opcode writes to a channel of the destination
> register,
> +*  it takes as arguments values from the same channel of the
> source
> +*  register(s).
> +*
> +*  Example: TGSI_OPCODE_ADD
> +*/
> +   TGSI_OUTPUT_COMPONENTWISE   = 1,
> +
> +   /** This opcode writes the same value to all enabled channels of
> the
> +* destination register.
> +*
> +*  Example: TGSI_OPCODE_RSQ
> +*/
> +   TGSI_OUTPUT_REPLICATE   = 2,
> +
> +   /** The operation performed by this opcode is dependent on which
> channel
> +*  of the destination register is being written.
> +*
> +*  Example: TGSI_OPCODE_LOG
> +*/
> +   TGSI_OUTPUT_CHAN_DEPENDENT  = 3,
> +
> +   /**
> +* Example: TGSI_OPCODE_TEX
> +*/
> +   TGSI_OUTPUT_OTHER   = 4
> +};
> +
>  /* TGSI opcodes.
>   *
>   * For more information on semantics of opcodes and
> --
> 1.7.6
> 
> ___
> 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] [PATCH] i965/vs: Try to emit more components of constant vectors at once.

2012-01-09 Thread Eric Anholt
We were naively emitting each component at a time, even if we were
emitting the same value to multiple channels.  Improves on a codegen
regression from the old VS to the new VS on some unigine shaders
(because we emit constant vecs/matrices as immediates instead of
loading them as push constants, so we had over 4x the instructions for
using them).

shader-db results:
Total instructions: 58594 -> 58540
11/870 programs affected (1.3%)
765 -> 711 instructions in affected programs (7.1% reduction)
---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |   29 ++-
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 20da487..5df2470 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1701,22 +1701,45 @@ vec4_visitor::emit_constant_values(dst_reg *dst, 
ir_constant *ir)
 
if (ir->type->is_matrix()) {
   for (int i = 0; i < ir->type->matrix_columns; i++) {
+float *vec = &ir->value.f[i * ir->type->vector_elements];
+
 for (int j = 0; j < ir->type->vector_elements; j++) {
dst->writemask = 1 << j;
dst->type = BRW_REGISTER_TYPE_F;
 
-   emit(MOV(*dst,
-src_reg(ir->value.f[i * ir->type->vector_elements + j])));
+   emit(MOV(*dst, src_reg(vec[j])));
 }
 dst->reg_offset++;
   }
   return;
}
 
+   int remaining_writemask = (1 << ir->type->vector_elements) - 1;
+
for (int i = 0; i < ir->type->vector_elements; i++) {
+  if (!(remaining_writemask & (1 << i)))
+continue;
+
   dst->writemask = 1 << i;
   dst->type = brw_type_for_base_type(ir->type);
 
+  /* Find other components that match the one we're about to
+   * write.  Emits fewer instructions for things like vec4(0.5,
+   * 1.5, 1.5, 1.5).
+   */
+  for (int j = i + 1; j < ir->type->vector_elements; j++) {
+if (ir->type->base_type == GLSL_TYPE_BOOL) {
+   if (ir->value.b[i] == ir->value.b[j])
+  dst->writemask |= (1 << j);
+} else {
+   /* u, i, and f storage all line up, so no need for a
+* switch case for comparing each type.
+*/
+   if (ir->value.u[i] == ir->value.u[j])
+  dst->writemask |= (1 << j);
+}
+  }
+
   switch (ir->type->base_type) {
   case GLSL_TYPE_FLOAT:
 emit(MOV(*dst, src_reg(ir->value.f[i])));
@@ -1734,6 +1757,8 @@ vec4_visitor::emit_constant_values(dst_reg *dst, 
ir_constant *ir)
 assert(!"Non-float/uint/int/bool constant");
 break;
   }
+
+  remaining_writemask &= ~dst->writemask;
}
dst->reg_offset++;
 }
-- 
1.7.7.3

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


Re: [Mesa-dev] [PATCH] swrast: fix Z testing of points/lines for 16-bit depth buffers

2012-01-09 Thread Jose Fonseca
- Original Message -
> We were comparing 32-bit Z buffer values against 16-bit fragment
> values.
> Need to do scaling like for the 24-bit case.
> 
> Triangle Z testing was OK since it didn't hit this code path.
> ---
>  src/mesa/swrast/s_depth.c |   36
>  +---
>  1 files changed, 29 insertions(+), 7 deletions(-)
> 
> diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
> index 53f21cb..42724c7 100644
> --- a/src/mesa/swrast/s_depth.c
> +++ b/src/mesa/swrast/s_depth.c
> @@ -205,6 +205,7 @@ _swrast_depth_clamp_span( struct gl_context *ctx,
> SWspan *span )
>  
>  /**
>   * Get array of 32-bit z values from the depth buffer.  With
>   clipping.
> + * Note: the returned values are always in the range [0, 2^32-1].
>   */
>  static void
>  get_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
> @@ -235,6 +236,11 @@ get_z32_values(struct gl_context *ctx, struct
> gl_renderbuffer *rb,
> }
>  }
>  
> +
> +/**
> + * Put an array of 32-bit z values into the depth buffer.
> + * Note: the z values are always in the range [0, 2^32-1].
> + */
>  static void
>  put_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
> GLuint count, const GLint x[], const GLint y[],
> @@ -284,8 +290,8 @@ _swrast_depth_test_span(struct gl_context *ctx,
> SWspan *span)
> void *zBufferVals;
> GLuint *zBufferTemp = NULL;
> GLuint passed;
> +   GLuint zBits = _mesa_get_format_bits(rb->Format, GL_DEPTH_BITS);
> GLboolean ztest16 = GL_FALSE;

is ztest16 still necessary?

Otherwise looks good.

Jose

> -   GLboolean ztest24 = _mesa_get_format_bits(rb->Format,
> GL_DEPTH_BITS) == 24;
>  
> if (rb->Format == MESA_FORMAT_Z16 && !(span->arrayMask &
> SPAN_XY)) {
>/* directly read/write row of 16-bit Z values */
> @@ -310,7 +316,7 @@ _swrast_depth_test_span(struct gl_context *ctx,
> SWspan *span)
>   _mesa_unpack_uint_z_row(rb->Format, count, zStart,
>   zBufferTemp);
>}
>  
> -  if (ztest24) {
> +  if (zBits == 24) {
>   GLuint i;
>   /* Convert depth buffer values from 32 to 24 bits to match
>   the
>* fragment Z values generated by rasterization.
> @@ -319,6 +325,16 @@ _swrast_depth_test_span(struct gl_context *ctx,
> SWspan *span)
>  zBufferTemp[i] >>= 8;
>   }
>}
> +  else if (zBits == 16) {
> + GLuint i;
> + /* Convert depth buffer values from 32 to 16 bits */
> + for (i = 0; i < count; i++) {
> +zBufferTemp[i] >>= 16;
> + }
> +  }
> +  else {
> + assert(zBits == 32);
> +  }
>  
>zBufferVals = zBufferTemp;
> }
> @@ -332,16 +348,22 @@ _swrast_depth_test_span(struct gl_context *ctx,
> SWspan *span)
> if (zBufferTemp) {
>/* need to write temp Z values back into the buffer */
>  
> -  if (ztest24) {
> +  /* Convert depth buffer values back to 32-bit values.  The
> least
> +   * significant bits don't matter since they'll get dropped
> when
> +   * they're packed back into the depth buffer.
> +   */
> +  if (zBits == 24) {
>   GLuint i;
> - /* Convert depth buffer values back to 32-bit values.  The
> least
> -  * significant bits don't matter since they'll get dropped
> when
> -  * they're packed back into the depth buffer.
> -  */
>   for (i = 0; i < count; i++) {
>  zBufferTemp[i] = (zBufferTemp[i] << 8);
>   }
>}
> +  else if (zBits == 16) {
> + GLuint i;
> + for (i = 0; i < count; i++) {
> +zBufferTemp[i] = zBufferTemp[i] << 16;
> + }
> +  }
>  
>if (span->arrayMask & SPAN_XY) {
>   /* random locations */
> --
> 1.7.3.4
> 
> ___
> 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


Re: [Mesa-dev] [PATCH] gallium: improve the pipe_stream_output_info struct

2012-01-09 Thread Marek Olšák
On Mon, Jan 9, 2012 at 7:31 PM, Jose Fonseca  wrote:
>
>
> - Original Message -
>> There are 3 changes:
>>
>> 1) stride is specified for each buffer, not just one, so that drivers
>> don't
>>    have to derive it from the outputs
>>
>> 2) new per-output property dst_offset, which specifies the offset
>>    into the buffer in dwords where the output should be stored,
>>    so that drivers don't have to compute the offsets manually;
>>    this will also be useful for gl_SkipComponents
>>    from ARB_transform_feedback3
>>
>> 3) register_mask is removed, instead, there is start_component
>>    and num_components; register_mask with non-consecutive 1s
>>    doesn't make much sense (some hardware cannot do packing of
>>    components)
>>
>> Christoph Bumiller: fixed nvc0.
>> ---
>>  src/gallium/auxiliary/draw/draw_pt_so_emit.c |    4 ++-
>>  src/gallium/auxiliary/util/u_blitter.c       |    4 +-
>>  src/gallium/auxiliary/util/u_dump_state.c    |    6 ++-
>>  src/gallium/drivers/llvmpipe/lp_state_so.c   |    2 +-
>>  src/gallium/drivers/nvc0/nvc0_program.c      |   11 ++
>>  src/gallium/drivers/r600/r600.h              |    4 +-
>>  src/gallium/drivers/r600/r600_hw_context.c   |    8 ++--
>>  src/gallium/drivers/r600/r600_pipe.h         |    1 -
>>  src/gallium/drivers/r600/r600_shader.c       |   46
>>  +++---
>>  src/gallium/drivers/r600/r600_state_common.c |    2 +-
>>  src/gallium/drivers/softpipe/sp_state_so.c   |    2 +-
>>  src/gallium/drivers/trace/tr_dump_state.c    |    6 ++-
>>  src/gallium/include/pipe/p_state.h           |   13 ---
>>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp   |   18 --
>>  14 files changed, 53 insertions(+), 74 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
>> b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
>> index 2dc9e29..7dc6937 100644
>> --- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
>> +++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
>> @@ -144,7 +144,9 @@ static void so_emit_prim(struct pt_so_emit *so,
>>           (const char *)input_ptr + (indices[i] *
>>           input_vertex_stride));
>>        for (slot = 0; slot < state->num_outputs; ++slot) {
>>           unsigned idx = state->output[slot].register_index;
>> -         unsigned writemask = state->output[slot].register_mask;
>> +         unsigned writemask =
>> +               ((1 << state->output[slot].num_components) - 1) <<
>> +               state->output[slot].start_component;
>>           unsigned written_compos = 0;
>>           unsigned compo;
>>
>> diff --git a/src/gallium/auxiliary/util/u_blitter.c
>> b/src/gallium/auxiliary/util/u_blitter.c
>> index 80fdfe0..94012c5 100644
>> --- a/src/gallium/auxiliary/util/u_blitter.c
>> +++ b/src/gallium/auxiliary/util/u_blitter.c
>> @@ -266,8 +266,8 @@ struct blitter_context
>> *util_blitter_create(struct pipe_context *pipe)
>>
>>        memset(&so, 0, sizeof(so));
>>        so.num_outputs = 1;
>> -      so.output[0].register_mask = TGSI_WRITEMASK_XYZW;
>> -      so.stride = 4;
>> +      so.output[0].num_components = 4;
>> +      so.stride[0] = 4;
>>
>>        ctx->vs_pos_only =
>>           util_make_vertex_passthrough_shader_with_so(pipe, 1,
>>           semantic_names,
>> diff --git a/src/gallium/auxiliary/util/u_dump_state.c
>> b/src/gallium/auxiliary/util/u_dump_state.c
>> index e44c619..4b5a042 100644
>> --- a/src/gallium/auxiliary/util/u_dump_state.c
>> +++ b/src/gallium/auxiliary/util/u_dump_state.c
>> @@ -441,13 +441,15 @@ util_dump_shader_state(FILE *stream, const
>> struct pipe_shader_state *state)
>>     util_dump_member_begin(stream, "stream_output");
>>     util_dump_struct_begin(stream, "pipe_stream_output_info");
>>     util_dump_member(stream, uint, &state->stream_output,
>>     num_outputs);
>> -   util_dump_member(stream, uint, &state->stream_output, stride);
>> +   util_dump_array(stream, uint, state->stream_output.stride,
>> +                   Elements(state->stream_output.stride));
>>     util_dump_array_begin(stream);
>>     for(i = 0; i < state->stream_output.num_outputs; ++i) {
>>        util_dump_elem_begin(stream);
>>        util_dump_struct_begin(stream, ""); /* anonymous */
>>        util_dump_member(stream, uint,
>>        &state->stream_output.output[i], register_index);
>> -      util_dump_member(stream, uint,
>> &state->stream_output.output[i], register_mask);
>> +      util_dump_member(stream, uint,
>> &state->stream_output.output[i], start_component);
>> +      util_dump_member(stream, uint,
>> &state->stream_output.output[i], num_components);
>>        util_dump_member(stream, uint,
>>        &state->stream_output.output[i], output_buffer);
>>        util_dump_struct_end(stream);
>>        util_dump_elem_end(stream);
>> diff --git a/src/gallium/drivers/llvmpipe/lp_state_so.c
>> b/src/gallium/drivers/llvmpipe/lp_state_so.c
>> index 108f3aa..ed2272d 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_state_so.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_state_so

Re: [Mesa-dev] [PATCH] gallium: improve the pipe_stream_output_info struct

2012-01-09 Thread Jose Fonseca


- Original Message -
> On Mon, Jan 9, 2012 at 7:31 PM, Jose Fonseca 
> wrote:
> >
> >
> > - Original Message -
> >> There are 3 changes:
> >>
> >> 1) stride is specified for each buffer, not just one, so that
> >> drivers
> >> don't
> >>    have to derive it from the outputs
> >>
> >> 2) new per-output property dst_offset, which specifies the offset
> >>    into the buffer in dwords where the output should be stored,
> >>    so that drivers don't have to compute the offsets manually;
> >>    this will also be useful for gl_SkipComponents
> >>    from ARB_transform_feedback3
> >>
> >> 3) register_mask is removed, instead, there is start_component
> >>    and num_components; register_mask with non-consecutive 1s
> >>    doesn't make much sense (some hardware cannot do packing of
> >>    components)
> >>
> >> Christoph Bumiller: fixed nvc0.
> >> ---
> >>  src/gallium/auxiliary/draw/draw_pt_so_emit.c |    4 ++-
> >>  src/gallium/auxiliary/util/u_blitter.c       |    4 +-
> >>  src/gallium/auxiliary/util/u_dump_state.c    |    6 ++-
> >>  src/gallium/drivers/llvmpipe/lp_state_so.c   |    2 +-
> >>  src/gallium/drivers/nvc0/nvc0_program.c      |   11 ++
> >>  src/gallium/drivers/r600/r600.h              |    4 +-
> >>  src/gallium/drivers/r600/r600_hw_context.c   |    8 ++--
> >>  src/gallium/drivers/r600/r600_pipe.h         |    1 -
> >>  src/gallium/drivers/r600/r600_shader.c       |   46
> >>  +++---
> >>  src/gallium/drivers/r600/r600_state_common.c |    2 +-
> >>  src/gallium/drivers/softpipe/sp_state_so.c   |    2 +-
> >>  src/gallium/drivers/trace/tr_dump_state.c    |    6 ++-
> >>  src/gallium/include/pipe/p_state.h           |   13 ---
> >>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp   |   18 --
> >>  14 files changed, 53 insertions(+), 74 deletions(-)
> >>
> >> diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> >> b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> >> index 2dc9e29..7dc6937 100644
> >> --- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> >> +++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
> >> @@ -144,7 +144,9 @@ static void so_emit_prim(struct pt_so_emit
> >> *so,
> >>           (const char *)input_ptr + (indices[i] *
> >>           input_vertex_stride));
> >>        for (slot = 0; slot < state->num_outputs; ++slot) {
> >>           unsigned idx = state->output[slot].register_index;
> >> -         unsigned writemask = state->output[slot].register_mask;
> >> +         unsigned writemask =
> >> +               ((1 << state->output[slot].num_components) - 1) <<
> >> +               state->output[slot].start_component;
> >>           unsigned written_compos = 0;
> >>           unsigned compo;
> >>
> >> diff --git a/src/gallium/auxiliary/util/u_blitter.c
> >> b/src/gallium/auxiliary/util/u_blitter.c
> >> index 80fdfe0..94012c5 100644
> >> --- a/src/gallium/auxiliary/util/u_blitter.c
> >> +++ b/src/gallium/auxiliary/util/u_blitter.c
> >> @@ -266,8 +266,8 @@ struct blitter_context
> >> *util_blitter_create(struct pipe_context *pipe)
> >>
> >>        memset(&so, 0, sizeof(so));
> >>        so.num_outputs = 1;
> >> -      so.output[0].register_mask = TGSI_WRITEMASK_XYZW;
> >> -      so.stride = 4;
> >> +      so.output[0].num_components = 4;
> >> +      so.stride[0] = 4;
> >>
> >>        ctx->vs_pos_only =
> >>           util_make_vertex_passthrough_shader_with_so(pipe, 1,
> >>           semantic_names,
> >> diff --git a/src/gallium/auxiliary/util/u_dump_state.c
> >> b/src/gallium/auxiliary/util/u_dump_state.c
> >> index e44c619..4b5a042 100644
> >> --- a/src/gallium/auxiliary/util/u_dump_state.c
> >> +++ b/src/gallium/auxiliary/util/u_dump_state.c
> >> @@ -441,13 +441,15 @@ util_dump_shader_state(FILE *stream, const
> >> struct pipe_shader_state *state)
> >>     util_dump_member_begin(stream, "stream_output");
> >>     util_dump_struct_begin(stream, "pipe_stream_output_info");
> >>     util_dump_member(stream, uint, &state->stream_output,
> >>     num_outputs);
> >> -   util_dump_member(stream, uint, &state->stream_output, stride);
> >> +   util_dump_array(stream, uint, state->stream_output.stride,
> >> +                   Elements(state->stream_output.stride));
> >>     util_dump_array_begin(stream);
> >>     for(i = 0; i < state->stream_output.num_outputs; ++i) {
> >>        util_dump_elem_begin(stream);
> >>        util_dump_struct_begin(stream, ""); /* anonymous */
> >>        util_dump_member(stream, uint,
> >>        &state->stream_output.output[i], register_index);
> >> -      util_dump_member(stream, uint,
> >> &state->stream_output.output[i], register_mask);
> >> +      util_dump_member(stream, uint,
> >> &state->stream_output.output[i], start_component);
> >> +      util_dump_member(stream, uint,
> >> &state->stream_output.output[i], num_components);
> >>        util_dump_member(stream, uint,
> >>        &state->stream_output.output[i], output_buffer);
> >>        util_dump_struct_end(stream);
> >>        util_dump_elem_e

Re: [Mesa-dev] [PATCH 0/3] Softpipe draw de-LLVM-fication.

2012-01-09 Thread Brian Paul

On 01/09/2012 11:28 AM, Jakob Bornecrantz wrote:

So it turns out that softpipe uses LLVM in the draw module
since it has no way of telling draw not to use it. This patch
series fixes that. Also makes the draw initialization fail
if draw can't initialize LLVM in the normal case.

Cheers, Jakob.

Jakob Bornecrantz (3):
   draw: Make it possible to create a llvm free context
   draw: Fail if we fail to enable llvm when asked for it
   softpipe: Don't use llvm in draw

  src/gallium/auxiliary/draw/draw_context.c |   64 -
  src/gallium/auxiliary/draw/draw_context.h |2 +
  src/gallium/drivers/softpipe/sp_context.c |2 +-
  3 files changed, 47 insertions(+), 21 deletions(-)



I guess I'd like a way to keep using LLVM with softpipe in some 
circumstances (with a config/env var option).  I sometimes debug 
things using softpipe and losing LLVM vertex processing would be a 
slow-down in some cases.


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


Re: [Mesa-dev] [PATCH] swrast: fix Z testing of points/lines for 16-bit depth buffers

2012-01-09 Thread Brian Paul

On 01/09/2012 12:09 PM, Jose Fonseca wrote:

- Original Message -

We were comparing 32-bit Z buffer values against 16-bit fragment
values.
Need to do scaling like for the 24-bit case.

Triangle Z testing was OK since it didn't hit this code path.
---
  src/mesa/swrast/s_depth.c |   36
  +---
  1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 53f21cb..42724c7 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -205,6 +205,7 @@ _swrast_depth_clamp_span( struct gl_context *ctx,
SWspan *span )

  /**
   * Get array of 32-bit z values from the depth buffer.  With
   clipping.
+ * Note: the returned values are always in the range [0, 2^32-1].
   */
  static void
  get_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
@@ -235,6 +236,11 @@ get_z32_values(struct gl_context *ctx, struct
gl_renderbuffer *rb,
 }
  }

+
+/**
+ * Put an array of 32-bit z values into the depth buffer.
+ * Note: the z values are always in the range [0, 2^32-1].
+ */
  static void
  put_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
 GLuint count, const GLint x[], const GLint y[],
@@ -284,8 +290,8 @@ _swrast_depth_test_span(struct gl_context *ctx,
SWspan *span)
 void *zBufferVals;
 GLuint *zBufferTemp = NULL;
 GLuint passed;
+   GLuint zBits = _mesa_get_format_bits(rb->Format, GL_DEPTH_BITS);
 GLboolean ztest16 = GL_FALSE;


is ztest16 still necessary?


Yes, for the case of depth-testing 16-bit Z values for a horizontal 
run of pixels using a MESA_FORMAT_Z16 buffer, we can do an optimized 
16-bit depth test.




Otherwise looks good.


-Brian

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


Re: [Mesa-dev] [PATCH 0/3] Softpipe draw de-LLVM-fication.

2012-01-09 Thread Jakob Bornecrantz
On Mon, Jan 9, 2012 at 8:35 PM, Brian Paul  wrote:
> On 01/09/2012 11:28 AM, Jakob Bornecrantz wrote:
>>
>> So it turns out that softpipe uses LLVM in the draw module
>> since it has no way of telling draw not to use it. This patch
>> series fixes that. Also makes the draw initialization fail
>> if draw can't initialize LLVM in the normal case.
>>
>> Cheers, Jakob.
>>
>> Jakob Bornecrantz (3):
>>   draw: Make it possible to create a llvm free context
>>   draw: Fail if we fail to enable llvm when asked for it
>>   softpipe: Don't use llvm in draw
>>
>>  src/gallium/auxiliary/draw/draw_context.c |   64
>> -
>>  src/gallium/auxiliary/draw/draw_context.h |    2 +
>>  src/gallium/drivers/softpipe/sp_context.c |    2 +-
>>  3 files changed, 47 insertions(+), 21 deletions(-)
>>
>
> I guess I'd like a way to keep using LLVM with softpipe in some
> circumstances (with a config/env var option).  I sometimes debug things
> using softpipe and losing LLVM vertex processing would be a slow-down in
> some cases.

Would SOFTPIPE_FORCE_LLVM/SOFTPIPE_LLVM_VS work?

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


Re: [Mesa-dev] [PATCH] mesa: Bump version to 8.0 (devel)

2012-01-09 Thread Kenneth Graunke

On 01/09/2012 09:16 AM, Jason Wood wrote:

On 01/06/2012 05:54 PM, Kenneth Graunke wrote:

+Mesa 8.0 implements the OpenGL 2.1 API, but the
version reported by +glGetString(GL_VERSION) depends on the
particular driver being used. +Some drivers don't support all the
features required in OpenGL 2.1.


Should this be bumped to OpenGL 3.0?


Yes, it should - thanks!

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


[Mesa-dev] [PATCH] mesa: Move transform feedback error check to reduce array overflow risk.

2012-01-09 Thread Paul Berry
Previous to this patch, we didn't do the limit check for
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS until the end of the
store_tfeedback_info() function, *after* storing all of the transform
feedback info in the gl_transform_feedback_info::Outputs array.  This
meant that the limit check wouldn't prevent us from overflowing the
array and corrupting memory.

This patch moves the limit check to the top of tfeedback_decl::store()
so that there is no risk of overflowing the array.  It also adds
assertions to verify that the checks for
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS and
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS are sufficient to avoid
array overflow.

Note: strictly speaking this patch isn't necessary, since the maximum
possible number of varyings is MAX_VARYING (16), whereas the size of
the Outputs array is MAX_PROGRAM_OUTPUTS (64), so it's impossible to
have enough varyings to overflow the array.  However it seems prudent
to do the limit check before the array access in case these limits
change in the future.
---
 src/glsl/linker.cpp |   52 +++---
 1 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 39a9c46..0d85aee 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1388,7 +1388,7 @@ public:
static bool is_same(const tfeedback_decl &x, const tfeedback_decl &y);
bool assign_location(struct gl_context *ctx, struct gl_shader_program *prog,
 ir_variable *output_var);
-   bool store(struct gl_shader_program *prog,
+   bool store(struct gl_context *ctx, struct gl_shader_program *prog,
   struct gl_transform_feedback_info *info, unsigned buffer,
  unsigned varying) const;
 
@@ -1631,7 +1631,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
  * is returned.
  */
 bool
-tfeedback_decl::store(struct gl_shader_program *prog,
+tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program *prog,
   struct gl_transform_feedback_info *info,
   unsigned buffer, unsigned varying) const
 {
@@ -1647,6 +1647,35 @@ tfeedback_decl::store(struct gl_shader_program *prog,
this->orig_name);
   return false;
}
+
+   /* From GL_EXT_transform_feedback:
+*   A program will fail to link if:
+*
+* * the total number of components to capture is greater than
+*   the constant MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT
+*   and the buffer mode is INTERLEAVED_ATTRIBS_EXT.
+*/
+   if (prog->TransformFeedback.BufferMode == GL_INTERLEAVED_ATTRIBS &&
+   info->BufferStride[buffer] + this->num_components() >
+   ctx->Const.MaxTransformFeedbackInterleavedComponents) {
+  linker_error(prog, "The MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS "
+   "limit has been exceeded.");
+  return false;
+   }
+
+   /* Verify that the checks on MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS
+* and MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS are sufficient to prevent
+* overflow of info->Outputs[].  In worst case we generate one entry in
+* Outputs[] per component so a conservative check is to verify that the
+* size of the array is greater than or equal to both
+* MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS and
+* MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS.
+*/
+   assert(Elements(info->Outputs) >=
+  ctx->Const.MaxTransformFeedbackInterleavedComponents);
+   assert(Elements(info->Outputs) >=
+  ctx->Const.MaxTransformFeedbackSeparateComponents);
+
unsigned translated_size = this->size;
if (this->is_clip_distance_mesa)
   translated_size = (translated_size + 3) / 4;
@@ -1943,7 +1972,6 @@ store_tfeedback_info(struct gl_context *ctx, struct 
gl_shader_program *prog,
  unsigned num_tfeedback_decls,
  tfeedback_decl *tfeedback_decls)
 {
-   unsigned total_tfeedback_components = 0;
bool separate_attribs_mode =
   prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS;
 
@@ -1962,25 +1990,9 @@ store_tfeedback_info(struct gl_context *ctx, struct 
gl_shader_program *prog,
 
for (unsigned i = 0; i < num_tfeedback_decls; ++i) {
   unsigned buffer = separate_attribs_mode ? i : 0;
-  if (!tfeedback_decls[i].store(prog, &prog->LinkedTransformFeedback,
+  if (!tfeedback_decls[i].store(ctx, prog, &prog->LinkedTransformFeedback,
 buffer, i))
  return false;
-  total_tfeedback_components += tfeedback_decls[i].num_components();
-   }
-
-   /* From GL_EXT_transform_feedback:
-*   A program will fail to link if:
-*
-* * the total number of components to capture is greater than
-*   the constant MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT
-*   and the buffer mode is INTERLEAVED_ATTRIBS_EXT.
-*/
-   if (prog->TransformFeedback.Bu

Re: [Mesa-dev] [PATCH 02/11] i965: Add missing BRW_NEW_BATCH dirty bit to Gen6+ clip state atoms.

2012-01-09 Thread Kenneth Graunke

On 01/09/2012 08:24 AM, Eric Anholt wrote:

On Sun,  8 Jan 2012 14:43:51 -0800, Kenneth Graunke  
wrote:

Without MI_SET_CONTEXT, there's no guarantee that another program hasn't
reprogram the GPU's clip state since our last batch.  We need to submit
it every time.

Found by inspection.


BRW_NEW_CONTEXT is the flag for "we might have lost our context because
everything got reprogrammed."

BRW_NEW_BATCH is the flag for "we have to program it again with a new
batch for other reasons (e.g. relocations ensuring that your buffer is
present).

The intent was that when we get MI_SET_CONTEXT, we just stop flagging
BRW_NEW_CONTEXT per batch.


Oh...thanks.  Somehow I forgot that we currently flag BRW_NEW_CONTEXT on 
every batch.  I was thinking it was once, at the start of the program, 
which would only work if we had MI_SET_CONTEXT.


I agree, these aren't necessary.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/3] Softpipe draw de-LLVM-fication.

2012-01-09 Thread Brian Paul

On 01/09/2012 12:51 PM, Jakob Bornecrantz wrote:

On Mon, Jan 9, 2012 at 8:35 PM, Brian Paul  wrote:

On 01/09/2012 11:28 AM, Jakob Bornecrantz wrote:


So it turns out that softpipe uses LLVM in the draw module
since it has no way of telling draw not to use it. This patch
series fixes that. Also makes the draw initialization fail
if draw can't initialize LLVM in the normal case.

Cheers, Jakob.

Jakob Bornecrantz (3):
   draw: Make it possible to create a llvm free context
   draw: Fail if we fail to enable llvm when asked for it
   softpipe: Don't use llvm in draw

  src/gallium/auxiliary/draw/draw_context.c |   64
-
  src/gallium/auxiliary/draw/draw_context.h |2 +
  src/gallium/drivers/softpipe/sp_context.c |2 +-
  3 files changed, 47 insertions(+), 21 deletions(-)



I guess I'd like a way to keep using LLVM with softpipe in some
circumstances (with a config/env var option).  I sometimes debug things
using softpipe and losing LLVM vertex processing would be a slow-down in
some cases.


Would SOFTPIPE_FORCE_LLVM/SOFTPIPE_LLVM_VS work?


How about SOFTPIPE_USE_LLVM?

-Brian

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


[Mesa-dev] [PATCH 3/3] softpipe: Don't use llvm in draw

2012-01-09 Thread Jakob Bornecrantz
But add a option to force it on for testing.

Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/drivers/softpipe/sp_context.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_context.c 
b/src/gallium/drivers/softpipe/sp_context.c
index a720600..324d9fd 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -305,7 +305,10 @@ softpipe_create_context( struct pipe_screen *screen,
/*
 * Create drawing context and plug our rendering stage into it.
 */
-   softpipe->draw = draw_create(&softpipe->pipe);
+   if (debug_get_bool_option("SOFTPIPE_USE_LLVM", FALSE))
+  softpipe->draw = draw_create(&softpipe->pipe);
+   else
+  softpipe->draw = draw_create_no_llvm(&softpipe->pipe);
if (!softpipe->draw) 
   goto fail;
 
-- 
1.7.5.4

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


Re: [Mesa-dev] [PATCH 0/3] Softpipe draw de-LLVM-fication.

2012-01-09 Thread Jakob Bornecrantz
On Mon, Jan 9, 2012 at 9:27 PM, Brian Paul  wrote:
> On 01/09/2012 12:51 PM, Jakob Bornecrantz wrote:
>>
>> On Mon, Jan 9, 2012 at 8:35 PM, Brian Paul  wrote:
>>>
>>> On 01/09/2012 11:28 AM, Jakob Bornecrantz wrote:


 So it turns out that softpipe uses LLVM in the draw module
 since it has no way of telling draw not to use it. This patch
 series fixes that. Also makes the draw initialization fail
 if draw can't initialize LLVM in the normal case.

 Cheers, Jakob.

 Jakob Bornecrantz (3):
   draw: Make it possible to create a llvm free context
   draw: Fail if we fail to enable llvm when asked for it
   softpipe: Don't use llvm in draw

  src/gallium/auxiliary/draw/draw_context.c |   64
 -
  src/gallium/auxiliary/draw/draw_context.h |    2 +
  src/gallium/drivers/softpipe/sp_context.c |    2 +-
  3 files changed, 47 insertions(+), 21 deletions(-)

>>>
>>> I guess I'd like a way to keep using LLVM with softpipe in some
>>> circumstances (with a config/env var option).  I sometimes debug things
>>> using softpipe and losing LLVM vertex processing would be a slow-down in
>>> some cases.
>>
>>
>> Would SOFTPIPE_FORCE_LLVM/SOFTPIPE_LLVM_VS work?
>
>
> How about SOFTPIPE_USE_LLVM?

Sounds good, updated patch sent.

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


[Mesa-dev] [PATCH] r600g: add support for virtual address space on cayman v9

2012-01-09 Thread j . glisse
From: Jerome Glisse 

Virtual address space put the userspace in charge of their GPU
address space. It's up to userspace to bind bo into the virtual
address space. Command stream can them be executed using the
IB_VM chunck.

This patch add support for this configuration. It doesn't remove
the 64K ib size limit thought this limit can be extanded up to
1M for IB_VM chunk.

v2: fix rendering
v3: fix rendering when using index buffer
v4: make vm conditional on kernel support add basic va management
v5: catch the case when we already have va for a bo
v6: agd5f: update on top of ioctl changes
v7: agd5f: further ioctl updates
v8: indentation cleanup + fix non cayman
v9: rebase against lastest mesa + improvement from Marek & Michel

Signed-off-by: Jerome Glisse 
Signed-off-by: Alex Deucher 
---
 src/gallium/drivers/r600/evergreen_hw_context.c   |9 +-
 src/gallium/drivers/r600/evergreen_state.c|   49 --
 src/gallium/drivers/r600/r600_hw_context.c|   47 --
 src/gallium/drivers/r600/r600_pipe.h  |3 +-
 src/gallium/drivers/r600/r600_resource.c  |   11 ++
 src/gallium/drivers/r600/r600_resource.h  |2 +
 src/gallium/drivers/r600/r600_state_common.c  |   14 +-
 src/gallium/winsys/radeon/drm/radeon_drm_bo.c |  177 +
 src/gallium/winsys/radeon/drm/radeon_drm_bo.h |2 +
 src/gallium/winsys/radeon/drm/radeon_drm_cs.c |   21 ++-
 src/gallium/winsys/radeon/drm/radeon_drm_cs.h |4 +-
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c |   10 ++
 src/gallium/winsys/radeon/drm/radeon_winsys.h |   11 ++
 13 files changed, 312 insertions(+), 48 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c 
b/src/gallium/drivers/r600/evergreen_hw_context.c
index bd1d969..e75eaf2 100644
--- a/src/gallium/drivers/r600/evergreen_hw_context.c
+++ b/src/gallium/drivers/r600/evergreen_hw_context.c
@@ -1135,6 +1135,7 @@ void evergreen_context_draw(struct r600_context *ctx, 
const struct r600_draw *dr
struct r600_block *dirty_block = NULL;
struct r600_block *next_block;
uint32_t *pm4;
+   uint64_t va;
 
if (draw->indices) {
ndwords = 11;
@@ -1174,9 +1175,11 @@ void evergreen_context_draw(struct r600_context *ctx, 
const struct r600_draw *dr
pm4[2] = PKT3(PKT3_NUM_INSTANCES, 0, ctx->predicate_drawing);
pm4[3] = draw->vgt_num_instances;
if (draw->indices) {
-   pm4[4] = PKT3(PKT3_DRAW_INDEX, 3, ctx->predicate_drawing);
-   pm4[5] = draw->indices_bo_offset;
-   pm4[6] = 0;
+   va = r600_resource_va(&ctx->screen->screen, 
(void*)draw->indices);
+   va += draw->indices_bo_offset;
+   pm4[4] = PKT3(PKT3_DRAW_INDEX, 3, ctx->predicate_drawing);
+   pm4[5] = va;
+   pm4[6] = (va >> 32UL) & 0xFF;
pm4[7] = draw->vgt_num_indices;
pm4[8] = draw->vgt_draw_initiator;
pm4[9] = PKT3(PKT3_NOP, 0, ctx->predicate_drawing);
diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 7ded03d..aca6136 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1101,8 +1101,8 @@ static struct pipe_sampler_view 
*evergreen_create_sampler_view(struct pipe_conte
rstate->val[1] = (S_030004_TEX_HEIGHT(height - 1) |
  S_030004_TEX_DEPTH(depth - 1) |
  S_030004_ARRAY_MODE(array_mode));
-   rstate->val[2] = tmp->offset[0] >> 8;
-   rstate->val[3] = tmp->offset[1] >> 8;
+   rstate->val[2] = (tmp->offset[0] + r600_resource_va(ctx->screen, 
texture)) >> 8;
+   rstate->val[3] = (tmp->offset[1] + r600_resource_va(ctx->screen, 
texture)) >> 8;
rstate->val[4] = (word4 |
  
S_030010_SRF_MODE_ALL(V_030010_SRF_MODE_ZERO_CLAMP_MINUS_ONE) |
  S_030010_ENDIAN_SWAP(endian) |
@@ -1343,7 +1343,7 @@ static void evergreen_cb(struct r600_pipe_context *rctx, 
struct r600_pipe_state
unsigned pitch, slice;
unsigned color_info;
unsigned format, swap, ntype, endian;
-   unsigned offset;
+   uint64_t offset;
unsigned tile_type;
const struct util_format_description *desc;
int i;
@@ -1443,10 +1443,13 @@ static void evergreen_cb(struct r600_pipe_context 
*rctx, struct r600_pipe_state
} else /* workaround for linear buffers */
tile_type = 1;
 
+   offset += r600_resource_va(rctx->context.screen, 
state->cbufs[cb]->texture);
+   offset >>= 8;
+
/* FIXME handle enabling of CB beyond BASE8 which has different offset 
*/
r600_pipe_state_add_reg(rstate,
R_028C60_CB_COLOR0_BASE + cb * 0x3C,
-   offset >> 8, 0x, &rtex->resource, 
RADEON_USAGE_READWRITE);
+   

Re: [Mesa-dev] [PATCH 0/3] Softpipe draw de-LLVM-fication.

2012-01-09 Thread Brian Paul

On 01/09/2012 01:32 PM, Jakob Bornecrantz wrote:

On Mon, Jan 9, 2012 at 9:27 PM, Brian Paul  wrote:

On 01/09/2012 12:51 PM, Jakob Bornecrantz wrote:


On Mon, Jan 9, 2012 at 8:35 PM, Brian Paulwrote:


On 01/09/2012 11:28 AM, Jakob Bornecrantz wrote:



So it turns out that softpipe uses LLVM in the draw module
since it has no way of telling draw not to use it. This patch
series fixes that. Also makes the draw initialization fail
if draw can't initialize LLVM in the normal case.

Cheers, Jakob.

Jakob Bornecrantz (3):
   draw: Make it possible to create a llvm free context
   draw: Fail if we fail to enable llvm when asked for it
   softpipe: Don't use llvm in draw

  src/gallium/auxiliary/draw/draw_context.c |   64
-
  src/gallium/auxiliary/draw/draw_context.h |2 +
  src/gallium/drivers/softpipe/sp_context.c |2 +-
  3 files changed, 47 insertions(+), 21 deletions(-)



I guess I'd like a way to keep using LLVM with softpipe in some
circumstances (with a config/env var option).  I sometimes debug things
using softpipe and losing LLVM vertex processing would be a slow-down in
some cases.



Would SOFTPIPE_FORCE_LLVM/SOFTPIPE_LLVM_VS work?



How about SOFTPIPE_USE_LLVM?


Sounds good, updated patch sent.


Thanks.

For the series:
Reviewed-by: Brian Paul 

BTW, you might want to document this var in docs/envvars.html

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


Re: [Mesa-dev] [PATCH] mesa: add missing color buffer datatype check for glBlitFramebuffer()

2012-01-09 Thread Ian Romanick

On 01/06/2012 04:13 PM, Brian Paul wrote:

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

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ddd70be..6ff09f7 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2579,6 +2579,44 @@ find_attachment(const struct gl_framebuffer *fb,
  }


+/**
+ * Helper function for checking if the datatypes of color buffers are
+ * compatible for glBlitFramebuffer.  From the spec:


Where is this language from?  I was trying to find it, but I can't find 
it in the GL3.0 spec, the EXT_texture_integer spec, the 
EXT_framebuffer_blit spec, or the ARB_framebuffer_object spec.  I did 
find the following on page 277 (page 293 of the PDF) of the OpenGL 3.0 spec:


Format conversion is not supported for all data types. If the read
buffer contains floating-point values and any draw buffer does not
contain floating-point values, or if the read buffer contains
non-floating-point values and any draw buffer contains
floating-point values, an INVALID OPERATION error is generated.

Question 2, do we have any tests that check this error?


+ *
+ * "GL_INVALID_OPERATION is generated if mask contains GL_COLOR_BUFFER_BIT
+ *  and any of the following conditions hold:
+ *   - The read buffer contains fixed-point or floating-point values and any
+ * draw buffer contains neither fixed-point nor floating-point values.
+ *   - The read buffer contains unsigned integer values and any draw buffer
+ * does not contain unsigned integer values.
+ *   - The read buffer contains signed integer values and any draw buffer
+ * does not contain signed integer values."
+ */
+static GLboolean
+compatible_color_datatypes(gl_format srcFormat, gl_format dstFormat)
+{
+   GLenum srcType = _mesa_get_format_datatype(srcFormat);
+   GLenum dstType = _mesa_get_format_datatype(dstFormat);
+
+   if (srcType != GL_INT&&  srcType != GL_UNSIGNED_INT) {
+  assert(srcType == GL_UNSIGNED_NORMALIZED ||
+ srcType == GL_SIGNED_NORMALIZED ||
+ srcType == GL_FLOAT);
+  /* Boil any of those types down to GL_FLOAT */
+  srcType = GL_FLOAT;
+   }
+
+   if (dstType != GL_INT&&  dstType != GL_UNSIGNED_INT) {
+  assert(dstType == GL_UNSIGNED_NORMALIZED ||
+ dstType == GL_SIGNED_NORMALIZED ||
+ dstType == GL_FLOAT);
+  /* Boil any of those types down to GL_FLOAT */
+  dstType = GL_FLOAT;
+   }
+
+   return srcType == dstType;
+}
+

  /**
   * Blit rectangular region, optionally from one framebuffer to another.
@@ -2663,6 +2701,12 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint 
srcX1, GLint srcY1,
 colorReadRb = colorDrawRb = NULL;
 mask&= ~GL_COLOR_BUFFER_BIT;
}
+  else if (!compatible_color_datatypes(colorReadRb->Format,
+   colorDrawRb->Format)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBlitFramebufferEXT(color buffer datatypes mismatch)");
+ return;
+  }
 }
 else {
colorReadRb = colorDrawRb = NULL;


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


Re: [Mesa-dev] [PATCH] mesa: Move transform feedback error check to reduce array overflow risk.

2012-01-09 Thread Ian Romanick

On 01/09/2012 12:02 PM, Paul Berry wrote:

Previous to this patch, we didn't do the limit check for
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS until the end of the
store_tfeedback_info() function, *after* storing all of the transform
feedback info in the gl_transform_feedback_info::Outputs array.  This
meant that the limit check wouldn't prevent us from overflowing the
array and corrupting memory.

This patch moves the limit check to the top of tfeedback_decl::store()
so that there is no risk of overflowing the array.  It also adds
assertions to verify that the checks for
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS and
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS are sufficient to avoid
array overflow.

Note: strictly speaking this patch isn't necessary, since the maximum
possible number of varyings is MAX_VARYING (16), whereas the size of
the Outputs array is MAX_PROGRAM_OUTPUTS (64), so it's impossible to
have enough varyings to overflow the array.  However it seems prudent


Why is Outputs so large?


to do the limit check before the array access in case these limits
change in the future.
---
  src/glsl/linker.cpp |   52 +++---
  1 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 39a9c46..0d85aee 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1388,7 +1388,7 @@ public:
 static bool is_same(const tfeedback_decl&x, const tfeedback_decl&y);
 bool assign_location(struct gl_context *ctx, struct gl_shader_program 
*prog,
  ir_variable *output_var);
-   bool store(struct gl_shader_program *prog,
+   bool store(struct gl_context *ctx, struct gl_shader_program *prog,
struct gl_transform_feedback_info *info, unsigned buffer,
  unsigned varying) const;

@@ -1631,7 +1631,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
   * is returned.
   */
  bool
-tfeedback_decl::store(struct gl_shader_program *prog,
+tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program *prog,
struct gl_transform_feedback_info *info,
unsigned buffer, unsigned varying) const
  {
@@ -1647,6 +1647,35 @@ tfeedback_decl::store(struct gl_shader_program *prog,
 this->orig_name);
return false;
 }
+
+   /* From GL_EXT_transform_feedback:
+*   A program will fail to link if:
+*
+* * the total number of components to capture is greater than
+*   the constant MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT
+*   and the buffer mode is INTERLEAVED_ATTRIBS_EXT.
+*/
+   if (prog->TransformFeedback.BufferMode == GL_INTERLEAVED_ATTRIBS&&
+   info->BufferStride[buffer] + this->num_components()>
+   ctx->Const.MaxTransformFeedbackInterleavedComponents) {
+  linker_error(prog, "The MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS "
+   "limit has been exceeded.");
+  return false;
+   }
+
+   /* Verify that the checks on MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS
+* and MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS are sufficient to prevent
+* overflow of info->Outputs[].  In worst case we generate one entry in
+* Outputs[] per component so a conservative check is to verify that the
+* size of the array is greater than or equal to both
+* MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS and
+* MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS.
+*/
+   assert(Elements(info->Outputs)>=
+  ctx->Const.MaxTransformFeedbackInterleavedComponents);
+   assert(Elements(info->Outputs)>=
+  ctx->Const.MaxTransformFeedbackSeparateComponents);
+
 unsigned translated_size = this->size;
 if (this->is_clip_distance_mesa)
translated_size = (translated_size + 3) / 4;
@@ -1943,7 +1972,6 @@ store_tfeedback_info(struct gl_context *ctx, struct 
gl_shader_program *prog,
   unsigned num_tfeedback_decls,
   tfeedback_decl *tfeedback_decls)
  {
-   unsigned total_tfeedback_components = 0;
 bool separate_attribs_mode =
prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS;

@@ -1962,25 +1990,9 @@ store_tfeedback_info(struct gl_context *ctx, struct 
gl_shader_program *prog,

 for (unsigned i = 0; i<  num_tfeedback_decls; ++i) {
unsigned buffer = separate_attribs_mode ? i : 0;
-  if (!tfeedback_decls[i].store(prog,&prog->LinkedTransformFeedback,
+  if (!tfeedback_decls[i].store(ctx, prog,&prog->LinkedTransformFeedback,
  buffer, i))
   return false;
-  total_tfeedback_components += tfeedback_decls[i].num_components();
-   }
-
-   /* From GL_EXT_transform_feedback:
-*   A program will fail to link if:
-*
-* * the total number of components to capture is greater than
-*   the constant MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT
-*   

Re: [Mesa-dev] [PATCH 08/11] i965: Move _NEW_PROGRAM dirty bit from gen7_sf_state to gen7_sbe_state.

2012-01-09 Thread Kenneth Graunke

On 01/09/2012 08:28 AM, Eric Anholt wrote:

On Sun,  8 Jan 2012 14:43:57 -0800, Kenneth Graunke  
wrote:

According to a comment in gen6_sf_state.c, calls to get_attr_override
need both _NEW_PROGRAM and _NEW_LIGHT.  Since Gen7 reuses the same
function, the same dirty bits should apply.

When I performed the SF/SBE split, I partitioned the bits incorrectly:
3DSTATE_SBE (which contains the attribute setup) was missing _NEW_PROGRAM,
while 3DSTATE_SF was listing it as a dependency for no reason.


I think the ctx->VertexProgram.PointSizeEnabled in SF is an un-annotated
dependency on _NEW_PROGRAM.


Whoops.  Yeah.  Will fix before pushing...thanks.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] glsl optimizations infinite loop patch

2012-01-09 Thread Eric Anholt
On Thu,  5 Jan 2012 21:17:52 -0600, Andy Clayton  wrote:
> Hi all,
> 
> So this is my attempt at a fix for
> https://bugs.freedesktop.org/show_bug.cgi?id=34006. Any feedback on if
> this looks right to anyone is much appreciated. Sven Arvidsson did
> confirm on bugzilla that the patch does not cause any piglit
> regressions and does also fix the infinite loop issue for him.

I'm so sorry this languished for so long -- I don't see bugzilla mails
in my inbox, and it wasn't part of the driver, so I never saw the bug
report.

I've added more details to the commit message and pushed your patch --
it was definitely a good improvement over what was there before.  I
think the more serious problem is that we do copy propagation for the R0
to R0 assignemnt in general -- I think we're going to have actual
rendering bugs from that once I cook up a testcase.


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


[Mesa-dev] [Bug 41152] [glsl] Shader backend in Regnum Online does not work

2012-01-09 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=41152

Bug 41152 depends on bug 34006, which changed state.

Bug 34006 Summary: [glsl regression] multiple games under wine trigger infinite 
loop in glsl optimization
https://bugs.freedesktop.org/show_bug.cgi?id=34006

   What|Old Value   |New Value

 Resolution||FIXED
 Status|NEW |RESOLVED

-- 
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] mesa: Move transform feedback error check to reduce array overflow risk.

2012-01-09 Thread Paul Berry
On 9 January 2012 13:00, Ian Romanick  wrote:

> On 01/09/2012 12:02 PM, Paul Berry wrote:
>
>> Previous to this patch, we didn't do the limit check for
>> MAX_TRANSFORM_FEEDBACK_**INTERLEAVED_COMPONENTS until the end of the
>> store_tfeedback_info() function, *after* storing all of the transform
>> feedback info in the gl_transform_feedback_info::**Outputs array.  This
>> meant that the limit check wouldn't prevent us from overflowing the
>> array and corrupting memory.
>>
>> This patch moves the limit check to the top of tfeedback_decl::store()
>> so that there is no risk of overflowing the array.  It also adds
>> assertions to verify that the checks for
>> MAX_TRANSFORM_FEEDBACK_**INTERLEAVED_COMPONENTS and
>> MAX_TRANSFORM_FEEDBACK_**SEPARATE_COMPONENTS are sufficient to avoid
>> array overflow.
>>
>> Note: strictly speaking this patch isn't necessary, since the maximum
>> possible number of varyings is MAX_VARYING (16), whereas the size of
>> the Outputs array is MAX_PROGRAM_OUTPUTS (64), so it's impossible to
>> have enough varyings to overflow the array.  However it seems prudent
>>
>
> Why is Outputs so large?
>

According to the spec, MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS must
be at least 64.  In the worst case, one element of the Outputs array will
be used up per component, so the array size needs to be at least 64.


>
>  to do the limit check before the array access in case these limits
>> change in the future.
>> ---
>>  src/glsl/linker.cpp |   52 ++**
>> +---
>>  1 files changed, 32 insertions(+), 20 deletions(-)
>>
>> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
>> index 39a9c46..0d85aee 100644
>> --- a/src/glsl/linker.cpp
>> +++ b/src/glsl/linker.cpp
>> @@ -1388,7 +1388,7 @@ public:
>> static bool is_same(const tfeedback_decl&x, const tfeedback_decl&y);
>> bool assign_location(struct gl_context *ctx, struct gl_shader_program
>> *prog,
>>  ir_variable *output_var);
>> -   bool store(struct gl_shader_program *prog,
>> +   bool store(struct gl_context *ctx, struct gl_shader_program *prog,
>>struct gl_transform_feedback_info *info, unsigned buffer,
>>  unsigned varying) const;
>>
>> @@ -1631,7 +1631,7 @@ tfeedback_decl::assign_**location(struct
>> gl_context *ctx,
>>   * is returned.
>>   */
>>  bool
>> -tfeedback_decl::store(struct gl_shader_program *prog,
>> +tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program
>> *prog,
>>struct gl_transform_feedback_info *info,
>>unsigned buffer, unsigned varying) const
>>  {
>> @@ -1647,6 +1647,35 @@ tfeedback_decl::store(struct gl_shader_program
>> *prog,
>> this->orig_name);
>>return false;
>> }
>> +
>> +   /* From GL_EXT_transform_feedback:
>> +*   A program will fail to link if:
>> +*
>> +* * the total number of components to capture is greater than
>> +*   the constant MAX_TRANSFORM_FEEDBACK_**
>> INTERLEAVED_COMPONENTS_EXT
>> +*   and the buffer mode is INTERLEAVED_ATTRIBS_EXT.
>> +*/
>> +   if (prog->TransformFeedback.**BufferMode == GL_INTERLEAVED_ATTRIBS&&
>> +   info->BufferStride[buffer] + this->num_components()>
>> +   ctx->Const.**MaxTransformFeedbackInterleave**dComponents) {
>> +  linker_error(prog, "The 
>> MAX_TRANSFORM_FEEDBACK_**INTERLEAVED_COMPONENTS
>> "
>> +   "limit has been exceeded.");
>> +  return false;
>> +   }
>> +
>> +   /* Verify that the checks on MAX_TRANSFORM_FEEDBACK_**
>> INTERLEAVED_COMPONENTS
>> +* and MAX_TRANSFORM_FEEDBACK_**SEPARATE_COMPONENTS are sufficient
>> to prevent
>> +* overflow of info->Outputs[].  In worst case we generate one entry
>> in
>> +* Outputs[] per component so a conservative check is to verify that
>> the
>> +* size of the array is greater than or equal to both
>> +* MAX_TRANSFORM_FEEDBACK_**INTERLEAVED_COMPONENTS and
>> +* MAX_TRANSFORM_FEEDBACK_**SEPARATE_COMPONENTS.
>> +*/
>> +   assert(Elements(info->Outputs)**>=
>> +  ctx->Const.**MaxTransformFeedbackInterleave**dComponents);
>> +   assert(Elements(info->Outputs)**>=
>> +  ctx->Const.**MaxTransformFeedbackSeparateCo**mponents);
>> +
>> unsigned translated_size = this->size;
>> if (this->is_clip_distance_mesa)
>>translated_size = (translated_size + 3) / 4;
>> @@ -1943,7 +1972,6 @@ store_tfeedback_info(struct gl_context *ctx, struct
>> gl_shader_program *prog,
>>   unsigned num_tfeedback_decls,
>>   tfeedback_decl *tfeedback_decls)
>>  {
>> -   unsigned total_tfeedback_components = 0;
>> bool separate_attribs_mode =
>>prog->TransformFeedback.**BufferMode == GL_SEPARATE_ATTRIBS;
>>
>> @@ -1962,25 +1990,9 @@ store_tfeedback_info(struct gl_context *ctx,
>> struct gl_shader_program *prog,
>>
>> for (unsigned i = 0; i<  num_tfeedback_decls; ++i) {
>> 

[Mesa-dev] [PATCH] glx: Suppress unused variable warning for cmdlen

2012-01-09 Thread Paul Berry
No functional change.  In the function
__indirect_glAreTexturesResident(), the variable cmdlen is only used
if USE_XCB is not defined.  This patch avoids a compile warning in the
event that USE_XCB is defined.
---
 src/glx/single2.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/glx/single2.c b/src/glx/single2.c
index 66281fa..a4355fc 100644
--- a/src/glx/single2.c
+++ b/src/glx/single2.c
@@ -890,6 +890,7 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * 
textures,
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
 #ifdef USE_XCB
+  (void) cmdlen;
   xcb_connection_t *c = XGetXCBConnection(dpy);
   (void) __glXFlushRenderBuffer(gc, gc->pc);
   xcb_glx_are_textures_resident_reply_t *reply =
-- 
1.7.6.5

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


[Mesa-dev] [PATCH] glsl: Fix copy_propagation_elements bug in handling self-copies.

2012-01-09 Thread Eric Anholt
We were doing the kill of the updated channels, then adding our copy
to the list of available stuff to copy.  But if the copy was updating
its own source channels, we didn't notice, breaking this code:

R0.xyzw = arg0 + arg1;
R0.xyzw = R0.wwwx;
gl_FragColor.xyzw = clamp(R0.xyzw, 0.0, 1.0);

Fixes piglit glsl-copy-propagation-self-2.
---
 src/glsl/opt_copy_propagation_elements.cpp |   15 ++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/glsl/opt_copy_propagation_elements.cpp 
b/src/glsl/opt_copy_propagation_elements.cpp
index be446bc..ebfd4fd 100644
--- a/src/glsl/opt_copy_propagation_elements.cpp
+++ b/src/glsl/opt_copy_propagation_elements.cpp
@@ -461,7 +461,20 @@ 
ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir)
 swizzle[i] = orig_swizzle[j++];
}
 
-   entry = new(this->mem_ctx) acp_entry(lhs->var, rhs->var, ir->write_mask,
+   int write_mask = ir->write_mask;
+   if (lhs->var == rhs->var) {
+  /* If this is a copy from the variable to itself, then we need
+   * to be sure not to include the updated channels from this
+   * instruction in the set of new source channels to be
+   * copy-propagated from.
+   */
+  for (int i = 0; i < 4; i++) {
+if (ir->write_mask & (1 << orig_swizzle[i]))
+   write_mask &= ~(1 << i);
+  }
+   }
+
+   entry = new(this->mem_ctx) acp_entry(lhs->var, rhs->var, write_mask,
swizzle);
this->acp->push_tail(entry);
 }
-- 
1.7.7.3

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


[Mesa-dev] [PATCH] mesa: fix situations where ffs or ffsl may not be defined

2012-01-09 Thread Alexander von Gluck


---
 src/mesa/main/imports.h |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index b7e8743..522ffeb 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -568,13 +568,19 @@ _mesa_init_sqrt_table(void);

 #ifdef __GNUC__

-#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) || 
defined(__APPLE__)

+#if ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) /* gcc 3.4 or later */
 #define ffs __builtin_ffs
 #define ffsll __builtin_ffsll
+#define _mesa_ffs __builtin_ffs
+#define _mesa_ffsll __builtin_ffsll
+#else /* older GCC, no builtin */
+#include 
+extern int
+_mesa_ffs(int32_t i);
+extern int
+_mesa_ffsll(int64_t i);
 #endif

-#define _mesa_ffs(i)  ffs(i)
-#define _mesa_ffsll(i)  ffsll(i)

 #if ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) /* gcc 3.4 or later */
 #define _mesa_bitcount(i) __builtin_popcount(i)
@@ -586,7 +592,9 @@ extern unsigned int
 _mesa_bitcount_64(uint64_t n);
 #endif

-#else
+#else /* non-GNUC */
+#include 
+
 extern int
 _mesa_ffs(int32_t i);

--
1.7.7.2

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


Re: [Mesa-dev] [PATCH] mesa: add missing color buffer datatype check for glBlitFramebuffer()

2012-01-09 Thread Brian Paul

On 01/09/2012 01:54 PM, Ian Romanick wrote:

On 01/06/2012 04:13 PM, Brian Paul wrote:

---
src/mesa/main/fbobject.c | 44

1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ddd70be..6ff09f7 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2579,6 +2579,44 @@ find_attachment(const struct gl_framebuffer *fb,
}


+/**
+ * Helper function for checking if the datatypes of color buffers are
+ * compatible for glBlitFramebuffer. From the spec:


Where is this language from? I was trying to find it, but I can't find
it in the GL3.0 spec, the EXT_texture_integer spec, the
EXT_framebuffer_blit spec, or the ARB_framebuffer_object spec. I did
find the following on page 277 (page 293 of the PDF) of the OpenGL 3.0
spec:

Format conversion is not supported for all data types. If the read
buffer contains floating-point values and any draw buffer does not
contain floating-point values, or if the read buffer contains
non-floating-point values and any draw buffer contains
floating-point values, an INVALID OPERATION error is generated.


As I mentioned in my other message, the check comes from the 3.1 spec 
(or the glBlitFramebuffer man page).




Question 2, do we have any tests that check this error?


Probably not.  Added the check didn't cause any regressions though.

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


Re: [Mesa-dev] [PATCH] glx: Suppress unused variable warning for cmdlen

2012-01-09 Thread Ian Romanick

On 01/09/2012 01:27 PM, Paul Berry wrote:

No functional change.  In the function
__indirect_glAreTexturesResident(), the variable cmdlen is only used
if USE_XCB is not defined.  This patch avoids a compile warning in the
event that USE_XCB is defined.
---
  src/glx/single2.c |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/glx/single2.c b/src/glx/single2.c
index 66281fa..a4355fc 100644
--- a/src/glx/single2.c
+++ b/src/glx/single2.c
@@ -890,6 +890,7 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * 
textures,
 const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
 if (__builtin_expect((n>= 0)&&  (dpy != NULL), 1)) {
  #ifdef USE_XCB
+  (void) cmdlen;


Maybe just move cmdlen declaration inside the #else part?


xcb_connection_t *c = XGetXCBConnection(dpy);
(void) __glXFlushRenderBuffer(gc, gc->pc);
xcb_glx_are_textures_resident_reply_t *reply =


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


[Mesa-dev] [PATCH 1/3] i965: Fix misnamed GEN7_WM_DEPTH_RESOLVE

2012-01-09 Thread Chad Versace
It was named GEN6_WM_DEPTH_RESOLVE. Luckily, this caused no conflict,
because the value is identical for gen6 and gen7.

Signed-off-by: Chad Versace 
---
 src/mesa/drivers/dri/i965/brw_defines.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
b/src/mesa/drivers/dri/i965/brw_defines.h
index f7bb05a..4d90a99 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -1345,7 +1345,7 @@ enum brw_wm_barycentric_interp_mode {
 # define GEN7_WM_STATISTICS_ENABLE (1 << 31)
 # define GEN7_WM_DEPTH_CLEAR   (1 << 30)
 # define GEN7_WM_DISPATCH_ENABLE   (1 << 29)
-# define GEN6_WM_DEPTH_RESOLVE (1 << 28)
+# define GEN7_WM_DEPTH_RESOLVE (1 << 28)
 # define GEN7_WM_HIERARCHICAL_DEPTH_RESOLVE(1 << 27)
 # define GEN7_WM_KILL_ENABLE   (1 << 25)
 # define GEN7_WM_PSCDEPTH_OFF  (0 << 23)
-- 
1.7.7.4

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


[Mesa-dev] [PATCH 2/3] i965: Replace references to stencil region size with buffer size

2012-01-09 Thread Chad Versace
It is unwise to use a stencil region's size to determine its
renderbuffer's size, because at region creation we fudge the width and
height to accomodate interleaved rows. (See the comment for MESA_FORMAT_S8
in intel_miptree_create()). Most users of stencil_region->{width,height}
should be converted to use stencil_rb->{Width,Height}.

We have already done the replacement in several locations. This patch
continues the replacement in {brw,gen7}_emit_depthbuffer(). To make those
functions look consistent, I've also done the equivalent replacement for
the depth buffer.

Signed-off-by: Chad Versace 
---
 src/mesa/drivers/dri/i965/brw_misc_state.c  |8 
 src/mesa/drivers/dri/i965/gen7_misc_state.c |6 --
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c 
b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 1c0c52b..726d8d8 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -343,8 +343,8 @@ static void emit_depthbuffer(struct brw_context *brw)
(1 << 27) | /* tiled surface */
(BRW_SURFACE_2D << 29));
   OUT_BATCH(0);
-  OUT_BATCH(((region->width - 1) << 6) |
-(2 * region->height - 1) << 19);
+  OUT_BATCH(((stencil_irb->Base.Width - 1) << 6) |
+(stencil_irb->Base.Height - 1) << 19);
   OUT_BATCH(0);
   OUT_BATCH(0);
 
@@ -378,8 +378,8 @@ static void emit_depthbuffer(struct brw_context *brw)
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
offset);
   OUT_BATCH((BRW_SURFACE_MIPMAPLAYOUT_BELOW << 1) |
-   ((region->width - 1) << 6) |
-   ((region->height - 1) << 19));
+   ((depth_irb->Base.Width - 1) << 6) |
+   ((depth_irb->Base.Height - 1) << 19));
   OUT_BATCH(0);
 
   if (intel->is_g4x || intel->gen >= 5)
diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c 
b/src/mesa/drivers/dri/i965/gen7_misc_state.c
index 89a4e71..9c93046 100644
--- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
@@ -71,7 +71,8 @@ static void emit_depthbuffer(struct brw_context *brw)
 
 /* 3DSTATE_STENCIL_BUFFER inherits surface type and dimensions. */
 dw1 |= (BRW_SURFACE_2D << 29);
-dw3 = ((region->width - 1) << 4) | ((2 * region->height - 1) << 18);
+dw3 = ((srb->Base.Width - 1) << 4) |
+  ((srb->Base.Height - 1) << 18);
   }
 
   BEGIN_BATCH(7);
@@ -103,7 +104,8 @@ static void emit_depthbuffer(struct brw_context *brw)
   OUT_RELOC(region->bo,
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
offset);
-  OUT_BATCH(((region->width - 1) << 4) | ((region->height - 1) << 18));
+  OUT_BATCH(((drb->Base.Width - 1) << 4) |
+((drb->Base.Height - 1) << 18));
   OUT_BATCH(0);
   OUT_BATCH(tile_x | (tile_y << 16));
   OUT_BATCH(0);
-- 
1.7.7.4

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


[Mesa-dev] [PATCH 3/3] i965/gen7: Enable HiZ

2012-01-09 Thread Chad Versace
This patch modifies all batches needed for HiZ. The batch length for
3DSTATE_HIER_DEPTH_BUFFER is also corrected from 4 to 3.

Performance +6.7% on Citybench.
num-frames: 400
resolution: 1918x1031
avg-hiz-off: 127.90 fps
avg-hiz-on: 136.50 fps
kernel: git://people.freedesktop.org/~anholt/linux.git 
branch=gen7-reset-sol sha=23360e4

Signed-off-by: Chad Versace 
---
 src/mesa/drivers/dri/i965/gen7_clip_state.c |   20 -
 src/mesa/drivers/dri/i965/gen7_misc_state.c |   31 ---
 src/mesa/drivers/dri/i965/gen7_sf_state.c   |   18 +--
 src/mesa/drivers/dri/i965/gen7_wm_state.c   |   18 +++
 src/mesa/drivers/dri/intel/intel_screen.c   |2 +-
 5 files changed, 76 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_clip_state.c 
b/src/mesa/drivers/dri/i965/gen7_clip_state.c
index c32cd98..9be3ce9 100644
--- a/src/mesa/drivers/dri/i965/gen7_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_clip_state.c
@@ -39,6 +39,23 @@ upload_clip_state(struct brw_context *brw)
/* BRW_NEW_FRAGMENT_PROGRAM */
const struct gl_fragment_program *fprog = brw->fragment_program;
 
+   if (brw->hiz.op) {
+  /* HiZ operations emit a rectangle primitive, which requires clipping to
+   * be disabled. From page 10 of the Sandy Bridge PRM Volume 2 Part 1
+   * Section 1.3 3D Primitives Overview:
+   *RECTLIST:
+   *Either the CLIP unit should be DISABLED, or the CLIP unit's Clip
+   *Mode should be set to a value other than CLIPMODE_NORMAL.
+   */
+  BEGIN_BATCH(4);
+  OUT_BATCH(_3DSTATE_CLIP << 16 | (4 - 2));
+  OUT_BATCH(0);
+  OUT_BATCH(0);
+  OUT_BATCH(0);
+  ADVANCE_BATCH();
+  return;
+   }
+
/* _NEW_BUFFERS */
bool render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
 
@@ -116,7 +133,8 @@ const struct brw_tracked_state gen7_clip_state = {
 _NEW_LIGHT |
 _NEW_TRANSFORM),
   .brw   = (BRW_NEW_CONTEXT |
-BRW_NEW_FRAGMENT_PROGRAM),
+BRW_NEW_FRAGMENT_PROGRAM |
+BRW_NEW_HIZ),
   .cache = 0
},
.emit = upload_clip_state,
diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c 
b/src/mesa/drivers/dri/i965/gen7_misc_state.c
index 9c93046..f287485 100644
--- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
@@ -38,11 +38,16 @@ static void emit_depthbuffer(struct brw_context *brw)
/* _NEW_BUFFERS */
struct intel_renderbuffer *drb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
struct intel_renderbuffer *srb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
-   struct intel_mipmap_tree *depth_mt = NULL, *stencil_mt = NULL;
+   struct intel_mipmap_tree *depth_mt = NULL,
+   *stencil_mt = NULL,
+   *hiz_mt = NULL;
 
if (drb)
   depth_mt = drb->mt;
 
+   if (depth_mt)
+  hiz_mt = depth_mt->hiz_mt;
+
if (srb) {
   stencil_mt = srb->mt;
   if (stencil_mt->stencil_mt)
@@ -97,7 +102,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2));
   OUT_BATCH(((region->pitch * region->cpp) - 1) |
(brw_depthbuffer_format(brw) << 18) |
-   (0 << 22) /* no HiZ buffer */ |
+   ((hiz_mt ? 1 : 0) << 22) | /* hiz enable */
((stencil_mt != NULL && ctx->Stencil.WriteMask != 0) << 27) |
((ctx->Depth.Mask != 0) << 28) |
(BRW_SURFACE_2D << 29));
@@ -112,12 +117,22 @@ static void emit_depthbuffer(struct brw_context *brw)
   ADVANCE_BATCH();
}
 
-   BEGIN_BATCH(4);
-   OUT_BATCH(GEN7_3DSTATE_HIER_DEPTH_BUFFER << 16 | (4 - 2));
-   OUT_BATCH(0);
-   OUT_BATCH(0);
-   OUT_BATCH(0);
-   ADVANCE_BATCH();
+   if (hiz_mt == NULL) {
+  BEGIN_BATCH(5);
+  OUT_BATCH(GEN7_3DSTATE_HIER_DEPTH_BUFFER << 16 | (3 - 2));
+  OUT_BATCH(0);
+  OUT_BATCH(0);
+  ADVANCE_BATCH();
+   } else {
+  BEGIN_BATCH(5);
+  OUT_BATCH(GEN7_3DSTATE_HIER_DEPTH_BUFFER << 16 | (3 - 2));
+  OUT_BATCH(hiz_mt->region->pitch * hiz_mt->region->cpp - 1);
+  OUT_RELOC(hiz_mt->region->bo,
+I915_GEM_DOMAIN_RENDER,
+I915_GEM_DOMAIN_RENDER,
+0);
+  ADVANCE_BATCH();
+   }
 
if (stencil_mt == NULL) {
   BEGIN_BATCH(3);
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index c4cacf0..7691cb2 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -137,7 +137,8 @@ const struct brw_tracked_state gen7_sbe_state = {
_NEW_PROGRAM |
_NEW_TRANSFORM),
   .brw   = (BRW_NEW_CONTEXT |
-   BRW_NEW_FRAGMENT_PROGRAM),
+   BRW_NEW_FRAGMENT_PROGRAM |
+   BRW_NEW_HIZ),
   .cache = CACHE_NEW_VS_PROG
},
.e

[Mesa-dev] [PATCH 0/3] i965/gen7: Enable HiZ

2012-01-09 Thread Chad Versace
Chad Versace (3):
  i965: Fix misnamed GEN7_WM_DEPTH_RESOLVE
  i965: Replace references to stencil region size with buffer size
  i965/gen7: Enable HiZ

 src/mesa/drivers/dri/i965/brw_defines.h |2 +-
 src/mesa/drivers/dri/i965/brw_misc_state.c  |8 +++---
 src/mesa/drivers/dri/i965/gen7_clip_state.c |   20 ++-
 src/mesa/drivers/dri/i965/gen7_misc_state.c |   37 +++---
 src/mesa/drivers/dri/i965/gen7_sf_state.c   |   18 +++--
 src/mesa/drivers/dri/i965/gen7_wm_state.c   |   18 +
 src/mesa/drivers/dri/intel/intel_screen.c   |2 +-
 7 files changed, 85 insertions(+), 20 deletions(-)

-- 
1.7.7.4

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


[Mesa-dev] [PATCH 00/12] Mostly harmless warning silencers

2012-01-09 Thread Jakob Bornecrantz
The first patch is a fix for the scons release build of the vmwgfx-dri driver
I managed to break without noticing it. The others are mostly warning
silencers that I found when doing a scons release build, I'm not sure if this
is the good way of doing them, but it got rid of the warnings at least. And
some git ignores.

Cheers, Jakob.

Jakob Bornecrantz (12):
  target-helpers: If neither softpipe or llvmpipe is used just return the screen
  draw: Silence warning
  rbug: Silence warning
  mesa: Silence warning
  mesa: Silence warning
  mesa: Ignores
  svga: Ignores
  svga: Silence warning
  svga: Silence warning
  svga: Silence warning
  svga: Add somewhat sensible fallback and silence warning
  svga: Drop execbuf throttling

 .../draw/draw_pt_fetch_shade_pipeline_llvm.c   |   12 --
 .../target-helpers/inline_wrapper_sw_helper.h  |2 +
 src/gallium/drivers/rbug/rbug_core.c   |3 +-
 src/gallium/drivers/svga/svga_pipe_draw.c  |3 ++
 src/gallium/drivers/svga/svga_tgsi_decl_sm30.c |   12 +-
 src/gallium/targets/dri-vmwgfx/target.c|1 -
 src/gallium/targets/xa-vmwgfx/.gitignore   |2 +
 src/gallium/winsys/svga/drm/vmw_context.c  |   22 +--
 src/gallium/winsys/svga/drm/vmw_context.h  |4 ---
 src/gallium/winsys/svga/drm/vmw_screen.c   |   10 -
 src/gallium/winsys/svga/drm/vmw_screen.h   |1 -
 src/mesa/.gitignore|1 +
 src/mesa/program/nvvertparse.c |1 +
 src/mesa/program/symbol_table.c|1 +
 14 files changed, 16 insertions(+), 59 deletions(-)
 create mode 100644 src/gallium/targets/xa-vmwgfx/.gitignore

-- 
1.7.5.4

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


[Mesa-dev] [PATCH 01/12] target-helpers: If neither softpipe or llvmpipe is used just return the screen

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 .../target-helpers/inline_wrapper_sw_helper.h  |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h 
b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h
index e4effa7..0a2e215 100644
--- a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h
+++ b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h
@@ -12,6 +12,7 @@
 static INLINE struct pipe_screen *
 sw_screen_wrap(struct pipe_screen *screen)
 {
+#if defined(GALLIUM_SOFTPIPE) || defined(GALLIUM_LLVMPIPE)
struct sw_winsys *sws;
struct pipe_screen *sw_screen = NULL;
const char *driver;
@@ -34,6 +35,7 @@ sw_screen_wrap(struct pipe_screen *screen)
 err_winsys:
return wrapper_sw_winsys_dewrap_pipe_screen(sws);
 err:
+#endif
return screen;
 }
 
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 02/12] draw: Silence warning

2012-01-09 Thread Jakob Bornecrantz
This peice of code has been here since the inital commit (c5c5cd71) and the
code that used instance_id_index was removed in (caede752) by José.

Signed-off-by: Jakob Bornecrantz 
---
 .../draw/draw_pt_fetch_shade_pipeline_llvm.c   |   12 
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c 
b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
index de6ce7f..1e17f80 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
@@ -71,8 +71,6 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
struct draw_llvm_variant_key *key;
struct draw_llvm_variant *variant = NULL;
struct draw_llvm_variant_list_item *li;
-   unsigned i;
-   unsigned instance_id_index = ~0;
const unsigned out_prim = (draw->gs.geometry_shader ? 
   draw->gs.geometry_shader->output_primitive :
   in_prim);
@@ -83,16 +81,6 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
const unsigned nr = MAX2( shader->base.info.num_inputs,
  shader->base.info.num_outputs + 1 );
 
-   /* Scan for instanceID system value.
-* XXX but we never use instance_id_index?!
-*/
-   for (i = 0; i < shader->base.info.num_inputs; i++) {
-  if (shader->base.info.input_semantic_name[i] == 
TGSI_SEMANTIC_INSTANCEID) {
- instance_id_index = i;
- break;
-  }
-   }
-
fpme->input_prim = in_prim;
fpme->opt = opt;
 
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 03/12] rbug: Silence warning

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/drivers/rbug/rbug_core.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/rbug/rbug_core.c 
b/src/gallium/drivers/rbug/rbug_core.c
index b80bcd4..253d21b 100644
--- a/src/gallium/drivers/rbug/rbug_core.c
+++ b/src/gallium/drivers/rbug/rbug_core.c
@@ -104,7 +104,8 @@ rbug_shader_create_locked(struct pipe_context *pipe,
   struct tgsi_token *tokens)
 {
void *state = NULL;
-   struct pipe_shader_state pss = { 0 };
+   struct pipe_shader_state pss;
+   memset(&pss, 0, sizeof(pss));
pss.tokens = tokens;
 
switch(rb_shader->type) {
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 04/12] mesa: Silence warning

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/mesa/program/symbol_table.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/program/symbol_table.c b/src/mesa/program/symbol_table.c
index 004f1f8..4f6f31f 100644
--- a/src/mesa/program/symbol_table.c
+++ b/src/mesa/program/symbol_table.c
@@ -255,6 +255,7 @@ _mesa_symbol_table_iterator_next(struct 
_mesa_symbol_table_iterator *iter)
 
 while (iter->curr != NULL) {
 assert(iter->curr->hdr == hdr);
+(void)hdr;
 
 if ((iter->name_space == -1)
 || (iter->curr->name_space == iter->name_space)) {
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 05/12] mesa: Silence warning

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/mesa/program/nvvertparse.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/program/nvvertparse.c b/src/mesa/program/nvvertparse.c
index 91fe2c4..7b46bef 100644
--- a/src/mesa/program/nvvertparse.c
+++ b/src/mesa/program/nvvertparse.c
@@ -1424,6 +1424,7 @@ _mesa_parse_nv_vertex_program(struct gl_context *ctx, 
GLenum dstTarget,
 index = _mesa_add_state_reference(program->Base.Parameters,
   state_tokens);
 assert(index == i);
+(void)index;
   }
   program->Base.NumParameters = program->Base.Parameters->NumParameters;
 
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 06/12] mesa: Ignores

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/mesa/.gitignore |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/.gitignore b/src/mesa/.gitignore
index ce83eaf..0cf001e 100644
--- a/src/mesa/.gitignore
+++ b/src/mesa/.gitignore
@@ -3,3 +3,4 @@
 depend.es*
 depend.es*
 objs-es*
+git_sha1.h.tmp
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 07/12] svga: Ignores

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/targets/xa-vmwgfx/.gitignore |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 src/gallium/targets/xa-vmwgfx/.gitignore

diff --git a/src/gallium/targets/xa-vmwgfx/.gitignore 
b/src/gallium/targets/xa-vmwgfx/.gitignore
new file mode 100644
index 000..c9a6869
--- /dev/null
+++ b/src/gallium/targets/xa-vmwgfx/.gitignore
@@ -0,0 +1,2 @@
+exptmp
+xa_symbols
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 08/12] svga: Silence warning

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/winsys/svga/drm/vmw_context.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/winsys/svga/drm/vmw_context.c 
b/src/gallium/winsys/svga/drm/vmw_context.c
index b5ca841..2edb5ea 100644
--- a/src/gallium/winsys/svga/drm/vmw_context.c
+++ b/src/gallium/winsys/svga/drm/vmw_context.c
@@ -300,6 +300,7 @@ vmw_swc_region_relocation(struct svga_winsys_context *swc,
ret = pb_validate_add_buffer(vswc->validate, reloc->buffer, 
translated_flags);
/* TODO: Update pipebuffer to reserve buffers and not fail here */
assert(ret == PIPE_OK);
+   (void)ret;
 
/*
 * Flush preemptively the FIFO commands to keep the GMR working set within
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 09/12] svga: Silence warning

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/drivers/svga/svga_pipe_draw.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c 
b/src/gallium/drivers/svga/svga_pipe_draw.c
index c61d5d0..541a234 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -399,6 +399,9 @@ svga_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
   }
}
 
+   /* XXX: Silence warnings, do something sensible here? */
+   (void)ret;
+
svga_release_user_upl_buffers( svga );
 
if (SVGA_DEBUG & DEBUG_FLUSH) {
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 10/12] svga: Silence warning

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/drivers/svga/svga_tgsi_decl_sm30.c |7 ---
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c 
b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
index 15cd402..0c5cb90 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -528,15 +528,8 @@ svga_translate_decl_sm30( struct svga_shader_emitter *emit,
 {
unsigned first = decl->Range.First;
unsigned last = decl->Range.Last;
-   unsigned semantic = 0;
-   unsigned semantic_idx = 0;
unsigned idx;
 
-   if (decl->Declaration.Semantic) {
-  semantic = decl->Semantic.Name;
-  semantic_idx = decl->Semantic.Index;
-   }
-
for( idx = first; idx <= last; idx++ ) {
   boolean ok;
 
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 11/12] svga: Add somewhat sensible fallback and silence warning

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/drivers/svga/svga_tgsi_decl_sm30.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c 
b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
index 0c5cb90..a4e80b5 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -318,8 +318,6 @@ ps30_output(struct svga_shader_emitter *emit,
 struct tgsi_declaration_semantic semantic,
 unsigned idx)
 {
-   SVGA3dShaderDestToken reg;
-
switch (semantic.Name) {
case TGSI_SEMANTIC_COLOR:
   if (emit->unit == PIPE_SHADER_FRAGMENT &&
@@ -345,7 +343,8 @@ ps30_output(struct svga_shader_emitter *emit,
   break;
default:
   assert(0);
-  reg = dst_register( SVGA3DREG_COLOROUT, 0 );
+  /* A wild stab in the dark. */
+  emit->output_map[idx] = dst_register( SVGA3DREG_COLOROUT, 0 );
   break;
}
 
-- 
1.7.5.4

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


[Mesa-dev] [PATCH 12/12] svga: Drop execbuf throttling

2012-01-09 Thread Jakob Bornecrantz
Signed-off-by: Jakob Bornecrantz 
---
 src/gallium/targets/dri-vmwgfx/target.c   |1 -
 src/gallium/winsys/svga/drm/vmw_context.c |   21 +
 src/gallium/winsys/svga/drm/vmw_context.h |4 
 src/gallium/winsys/svga/drm/vmw_screen.c  |   10 --
 src/gallium/winsys/svga/drm/vmw_screen.h  |1 -
 5 files changed, 1 insertions(+), 36 deletions(-)

diff --git a/src/gallium/targets/dri-vmwgfx/target.c 
b/src/gallium/targets/dri-vmwgfx/target.c
index 442e31b..e01e465 100644
--- a/src/gallium/targets/dri-vmwgfx/target.c
+++ b/src/gallium/targets/dri-vmwgfx/target.c
@@ -19,7 +19,6 @@ create_screen(int fd)
if (!screen)
   return NULL;
 
-   vmw_winsys_screen_set_throttling(screen, 0);
screen = sw_screen_wrap(screen);
 
screen = debug_screen_wrap(screen);
diff --git a/src/gallium/winsys/svga/drm/vmw_context.c 
b/src/gallium/winsys/svga/drm/vmw_context.c
index 2edb5ea..e08a48c 100644
--- a/src/gallium/winsys/svga/drm/vmw_context.c
+++ b/src/gallium/winsys/svga/drm/vmw_context.c
@@ -101,9 +101,6 @@ struct vmw_svga_winsys_context
 * referred.
 */
boolean preemptive_flush;
-
-   boolean throttle_set;
-   uint32_t throttle_us;
 };
 
 
@@ -136,7 +133,6 @@ vmw_swc_flush(struct svga_winsys_context *swc,
struct pipe_fence_handle *fence = NULL;
unsigned i;
enum pipe_error ret;
-   uint32_t throttle_us;
 
ret = pb_validate_validate(vswc->validate);
assert(ret == PIPE_OK);
@@ -155,13 +151,10 @@ vmw_swc_flush(struct svga_winsys_context *swc,
  *reloc->where = ptr;
   }
 
-  throttle_us = vswc->throttle_set ?
-vswc->throttle_us : vswc->vws->default_throttle_us;
-
   if (vswc->command.used || pfence != NULL)
  vmw_ioctl_command(vswc->vws,
   vswc->base.cid,
-  throttle_us,
+  0,
vswc->command.buffer,
vswc->command.used,
&fence);
@@ -401,15 +394,3 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen 
*sws)
 
return &vswc->base;
 }
-
-
-void
-vmw_svga_context_set_throttling(struct pipe_context *pipe,
-   uint32_t throttle_us)
-{
-   struct svga_winsys_context *swc = svga_winsys_context(pipe);
-   struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
-
-   vswc->throttle_us = throttle_us;
-   vswc->throttle_set = TRUE;
-}
diff --git a/src/gallium/winsys/svga/drm/vmw_context.h 
b/src/gallium/winsys/svga/drm/vmw_context.h
index aed8b93..b27e0b8 100644
--- a/src/gallium/winsys/svga/drm/vmw_context.h
+++ b/src/gallium/winsys/svga/drm/vmw_context.h
@@ -52,8 +52,4 @@ struct pipe_screen;
 struct svga_winsys_context *
 vmw_svga_winsys_context_create(struct svga_winsys_screen *sws);
 
-void
-vmw_svga_context_set_throttling(struct pipe_context *pipe,
-   uint32_t throttle_us);
-
 #endif /* VMW_CONTEXT_H_ */
diff --git a/src/gallium/winsys/svga/drm/vmw_screen.c 
b/src/gallium/winsys/svga/drm/vmw_screen.c
index cc3003d..f7799ce 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen.c
@@ -73,13 +73,3 @@ vmw_winsys_destroy(struct vmw_winsys_screen *vws)
vmw_ioctl_cleanup(vws);
FREE(vws);
 }
-
-void
-vmw_winsys_screen_set_throttling(struct pipe_screen *screen,
-uint32_t throttle_us)
-{
-   struct vmw_winsys_screen  *vws =
-  vmw_winsys_screen(svga_winsys_screen(screen));
-
-   vws->default_throttle_us = throttle_us;
-}
diff --git a/src/gallium/winsys/svga/drm/vmw_screen.h 
b/src/gallium/winsys/svga/drm/vmw_screen.h
index 1ddebf2..bdc1c7b 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen.h
+++ b/src/gallium/winsys/svga/drm/vmw_screen.h
@@ -59,7 +59,6 @@ struct vmw_winsys_screen
struct svga_winsys_screen base;
 
boolean use_old_scanout_flag;
-   uint32_t default_throttle_us;
 
struct {
   int drm_fd;
-- 
1.7.5.4

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


Re: [Mesa-dev] [PATCH 03/12] rbug: Silence warning

2012-01-09 Thread Alan Coopersmith

On 01/ 9/12 02:53 PM, Jakob Bornecrantz wrote:

-   struct pipe_shader_state pss = { 0 };
+   struct pipe_shader_state pss;
+   memset(&pss, 0, sizeof(pss));


Those do the same thing, just via a function call instead of compiler builtin.
What warning is being silenced by that change?

--
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

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


Re: [Mesa-dev] [PATCH 12/12] svga: Drop execbuf throttling

2012-01-09 Thread Brian Paul

On 01/09/2012 03:53 PM, Jakob Bornecrantz wrote:

Signed-off-by: Jakob Bornecrantz


Maybe you could elaborate in the comment why the code is being 
dropped.  Was it just unused or something else?


-Brian


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


Re: [Mesa-dev] [PATCH 11/12] svga: Add somewhat sensible fallback and silence warning

2012-01-09 Thread Brian Paul

On 01/09/2012 03:53 PM, Jakob Bornecrantz wrote:

Signed-off-by: Jakob Bornecrantz
---
  src/gallium/drivers/svga/svga_tgsi_decl_sm30.c |5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c 
b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
index 0c5cb90..a4e80b5 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -318,8 +318,6 @@ ps30_output(struct svga_shader_emitter *emit,
  struct tgsi_declaration_semantic semantic,
  unsigned idx)
  {
-   SVGA3dShaderDestToken reg;
-
 switch (semantic.Name) {
 case TGSI_SEMANTIC_COLOR:
if (emit->unit == PIPE_SHADER_FRAGMENT&&
@@ -345,7 +343,8 @@ ps30_output(struct svga_shader_emitter *emit,
break;
 default:
assert(0);
-  reg = dst_register( SVGA3DREG_COLOROUT, 0 );
+  /* A wild stab in the dark. */
+  emit->output_map[idx] = dst_register( SVGA3DREG_COLOROUT, 0 );
break;
 }



That looks fine.  If we find a PS with an output other than color or 
depth we've got a serious problem somewhere else.


-Brian

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


Re: [Mesa-dev] [PATCH 00/12] Mostly harmless warning silencers

2012-01-09 Thread Brian Paul

On 01/09/2012 03:53 PM, Jakob Bornecrantz wrote:

The first patch is a fix for the scons release build of the vmwgfx-dri driver
I managed to break without noticing it. The others are mostly warning
silencers that I found when doing a scons release build, I'm not sure if this
is the good way of doing them, but it got rid of the warnings at least. And
some git ignores.

Cheers, Jakob.

Jakob Bornecrantz (12):
   target-helpers: If neither softpipe or llvmpipe is used just return the 
screen
   draw: Silence warning
   rbug: Silence warning
   mesa: Silence warning
   mesa: Silence warning
   mesa: Ignores
   svga: Ignores
   svga: Silence warning
   svga: Silence warning
   svga: Silence warning
   svga: Add somewhat sensible fallback and silence warning
   svga: Drop execbuf throttling

  .../draw/draw_pt_fetch_shade_pipeline_llvm.c   |   12 --
  .../target-helpers/inline_wrapper_sw_helper.h  |2 +
  src/gallium/drivers/rbug/rbug_core.c   |3 +-
  src/gallium/drivers/svga/svga_pipe_draw.c  |3 ++
  src/gallium/drivers/svga/svga_tgsi_decl_sm30.c |   12 +-
  src/gallium/targets/dri-vmwgfx/target.c|1 -
  src/gallium/targets/xa-vmwgfx/.gitignore   |2 +
  src/gallium/winsys/svga/drm/vmw_context.c  |   22 +--
  src/gallium/winsys/svga/drm/vmw_context.h  |4 ---
  src/gallium/winsys/svga/drm/vmw_screen.c   |   10 -
  src/gallium/winsys/svga/drm/vmw_screen.h   |1 -
  src/mesa/.gitignore|1 +
  src/mesa/program/nvvertparse.c |1 +
  src/mesa/program/symbol_table.c|1 +
  14 files changed, 16 insertions(+), 59 deletions(-)
  create mode 100644 src/gallium/targets/xa-vmwgfx/.gitignore



I think patch 12 could use more comments.  Otherwise, the series is 
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 04/12] mesa: Silence warning

2012-01-09 Thread Ian Romanick

On 01/09/2012 02:53 PM, Jakob Bornecrantz wrote:

Signed-off-by: Jakob Bornecrantz


Reviewed-by: Ian Romanick 


---
  src/mesa/program/symbol_table.c |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/program/symbol_table.c b/src/mesa/program/symbol_table.c
index 004f1f8..4f6f31f 100644
--- a/src/mesa/program/symbol_table.c
+++ b/src/mesa/program/symbol_table.c
@@ -255,6 +255,7 @@ _mesa_symbol_table_iterator_next(struct 
_mesa_symbol_table_iterator *iter)

  while (iter->curr != NULL) {
  assert(iter->curr->hdr == hdr);
+(void)hdr;

  if ((iter->name_space == -1)
  || (iter->curr->name_space == iter->name_space)) {


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


Re: [Mesa-dev] [PATCH 05/12] mesa: Silence warning

2012-01-09 Thread Ian Romanick

On 01/09/2012 02:53 PM, Jakob Bornecrantz wrote:

Signed-off-by: Jakob Bornecrantz


Reviewed-by: Ian Romanick 


---
  src/mesa/program/nvvertparse.c |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/program/nvvertparse.c b/src/mesa/program/nvvertparse.c
index 91fe2c4..7b46bef 100644
--- a/src/mesa/program/nvvertparse.c
+++ b/src/mesa/program/nvvertparse.c
@@ -1424,6 +1424,7 @@ _mesa_parse_nv_vertex_program(struct gl_context *ctx, 
GLenum dstTarget,
 index = _mesa_add_state_reference(program->Base.Parameters,
   state_tokens);
 assert(index == i);
+(void)index;
}
program->Base.NumParameters = program->Base.Parameters->NumParameters;



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


Re: [Mesa-dev] [PATCH] glx: Suppress unused variable warning for cmdlen

2012-01-09 Thread Paul Berry
On 9 January 2012 14:28, Ian Romanick  wrote:

> On 01/09/2012 01:27 PM, Paul Berry wrote:
>
>> No functional change.  In the function
>> __indirect_**glAreTexturesResident(), the variable cmdlen is only used
>> if USE_XCB is not defined.  This patch avoids a compile warning in the
>> event that USE_XCB is defined.
>> ---
>>  src/glx/single2.c |1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/glx/single2.c b/src/glx/single2.c
>> index 66281fa..a4355fc 100644
>> --- a/src/glx/single2.c
>> +++ b/src/glx/single2.c
>> @@ -890,6 +890,7 @@ __indirect_**glAreTexturesResident(GLsizei n, const
>> GLuint * textures,
>> const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
>> if (__builtin_expect((n>= 0)&&  (dpy != NULL), 1)) {
>>
>>  #ifdef USE_XCB
>> +  (void) cmdlen;
>>
>
> Maybe just move cmdlen declaration inside the #else part?


Ok, that seems reasonable.  I'll follow up with a revised patch.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glx: Suppress unused variable warning for cmdlen

2012-01-09 Thread Paul Berry
No functional change.  In the function
__indirect_glAreTexturesResident(), the variable cmdlen is only used
if USE_XCB is not defined.  This patch avoids a compile warning in the
event that USE_XCB is defined.

v2: just move cmdlen declaration inside the #else part.
---
 src/glx/single2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glx/single2.c b/src/glx/single2.c
index 66281fa..259c4fe 100644
--- a/src/glx/single2.c
+++ b/src/glx/single2.c
@@ -887,7 +887,6 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * 
textures,
struct glx_context *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
-   const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
 #ifdef USE_XCB
   xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -903,6 +902,7 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * 
textures,
   retval = reply->ret_val;
   free(reply);
 #else
+  const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
   GLubyte const *pc =
  __glXSetupSingleRequest(gc, X_GLsop_AreTexturesResident, cmdlen);
   (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-- 
1.7.6.5

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


Re: [Mesa-dev] [PATCH] glx: Suppress unused variable warning for cmdlen

2012-01-09 Thread Ian Romanick

On 01/09/2012 03:56 PM, Paul Berry wrote:

No functional change.  In the function
__indirect_glAreTexturesResident(), the variable cmdlen is only used
if USE_XCB is not defined.  This patch avoids a compile warning in the
event that USE_XCB is defined.

v2: just move cmdlen declaration inside the #else part.


Reviewed-by: Ian Romanick 


---
  src/glx/single2.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glx/single2.c b/src/glx/single2.c
index 66281fa..259c4fe 100644
--- a/src/glx/single2.c
+++ b/src/glx/single2.c
@@ -887,7 +887,6 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * 
textures,
 struct glx_context *const gc = __glXGetCurrentContext();
 Display *const dpy = gc->currentDpy;
 GLboolean retval = (GLboolean) 0;
-   const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
 if (__builtin_expect((n>= 0)&&  (dpy != NULL), 1)) {
  #ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -903,6 +902,7 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * 
textures,
retval = reply->ret_val;
free(reply);
  #else
+  const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
GLubyte const *pc =
   __glXSetupSingleRequest(gc, X_GLsop_AreTexturesResident, cmdlen);
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);


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


[Mesa-dev] [PATCH 1/2] gallium: add PIPE_CAP_GLSL130

2012-01-09 Thread Christoph Bumiller
Enabled only for nvc0 at the moment.
---
 src/gallium/docs/source/screen.rst   |2 ++
 src/gallium/drivers/i915/i915_screen.c   |1 +
 src/gallium/drivers/llvmpipe/lp_screen.c |2 ++
 src/gallium/drivers/nv50/nv50_screen.c   |2 ++
 src/gallium/drivers/nvc0/nvc0_screen.c   |1 +
 src/gallium/drivers/nvfx/nvfx_screen.c   |2 ++
 src/gallium/drivers/r300/r300_screen.c   |1 +
 src/gallium/drivers/r600/r600_pipe.c |1 +
 src/gallium/drivers/softpipe/sp_screen.c |2 ++
 src/gallium/include/pipe/p_defines.h |5 +++--
 10 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/gallium/docs/source/screen.rst 
b/src/gallium/docs/source/screen.rst
index a1cd075..6cc6da4 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -74,6 +74,8 @@ The integer capabilities:
   property FS_COORD_PIXEL_CENTER with value HALF_INTEGER is supported.
 * ``PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER``: Whether the TGSI
   property FS_COORD_PIXEL_CENTER with value INTEGER is supported.
+* ``PIPE_CAP_GLSL130``: Whether the shader processors support all features
+  necessary for GLSL 1.3. Implies PIPE_SHADER_CAP_INTEGERS.
 
 
 .. _pipe_capf:
diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c
index 525..2afcaa5 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -193,6 +193,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap 
cap)
case PIPE_CAP_TEXTURE_SWIZZLE:
case PIPE_CAP_TIMER_QUERY:
case PIPE_CAP_SM3:
+   case PIPE_CAP_GLSL130:
case PIPE_CAP_SEAMLESS_CUBE_MAP:
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
case PIPE_CAP_SCALED_RESOLVE:
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c
index 5798a19..1fa9545 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -112,6 +112,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
pipe_cap param)
   return 1;
case PIPE_CAP_SM3:
   return 1;
+   case PIPE_CAP_GLSL130:
+  return 0;
case PIPE_CAP_ANISOTROPIC_FILTER:
   return 0;
case PIPE_CAP_POINT_SPRITE:
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 7ee90f1..bf4e421 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -110,6 +110,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
   return 1;
case PIPE_CAP_SM3:
   return 1;
+   case PIPE_CAP_GLSL130:
+  return 0;
case PIPE_CAP_MAX_RENDER_TARGETS:
   return 8;
case PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL:
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nvc0/nvc0_screen.c
index a991e67..9906dd6 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -97,6 +97,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_POINT_SPRITE:
   return 1;
case PIPE_CAP_SM3:
+   case PIPE_CAP_GLSL130:
   return 1;
case PIPE_CAP_MAX_RENDER_TARGETS:
   return 8;
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c 
b/src/gallium/drivers/nvfx/nvfx_screen.c
index b4a1b3a..6803342 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -34,6 +34,8 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_SM3:
/* TODO: >= nv4x support Shader Model 3.0 */
return 0;
+   case PIPE_CAP_GLSL130:
+   return 0;
case PIPE_CAP_ANISOTROPIC_FILTER:
return 1;
case PIPE_CAP_POINT_SPRITE:
diff --git a/src/gallium/drivers/r300/r300_screen.c 
b/src/gallium/drivers/r300/r300_screen.c
index 763321b..06d56ea 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -135,6 +135,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum 
pipe_cap param)
 case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS:
 case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
 case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
+case PIPE_CAP_GLSL130:
 return 0;
 
 /* SWTCL-only features. */
diff --git a/src/gallium/drivers/r600/r600_pipe.c 
b/src/gallium/drivers/r600/r600_pipe.c
index e50b5cc..738e61d 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -385,6 +385,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum 
pipe_cap param)
case PIPE_CAP_SCALED_RESOLVE:
case PIPE_CAP_TGSI_CAN_COMPACT_VARYINGS:
case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
+   case PIPE_CAP_GLSL130:
return 0;
 
/* Stream output. */
diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
b/src/gallium/d

[Mesa-dev] [PATCH 2/2] st/mesa: enable GLSL 1.3 for drivers with PIPE_CAP_GLSL130

2012-01-09 Thread Christoph Bumiller
---
 src/mesa/state_tracker/st_extensions.c |8 
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   14 +++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index a9d4054..c8171ef 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -261,6 +261,8 @@ void st_init_extensions(struct st_context *st)
int i;
 
ctx->Const.GLSLVersion = 120;
+   if (screen->get_param(screen, PIPE_CAP_GLSL130))
+  ctx->Const.GLSLVersion = 130;
_mesa_override_glsl_version(st->ctx);
 
/* Extensions that only depend on the GLSL version:
@@ -268,6 +270,12 @@ void st_init_extensions(struct st_context *st)
if (ctx->Const.GLSLVersion >= 130) {
   ctx->Extensions.ARB_conservative_depth = GL_TRUE;
}
+   /* Limits / preferences that only depend on the GLSL version:
+*/
+   if (ctx->Const.GLSLVersion >= 130) {
+  ctx->Const.NativeIntegers = GL_TRUE;
+  ctx->Const.MaxClipPlanes = 8;
+   }
 
/*
 * Extensions that are supported by all Gallium drivers:
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 3b8e2fe..be9a422d 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5010,13 +5010,21 @@ st_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
   num_clip_distances[i] = get_clip_distance_size(ir);
 
   do {
+ unsigned what_to_lower =
+MOD_TO_FRACT |
+DIV_TO_MUL_RCP |
+EXP_TO_EXP2 |
+LOG_TO_LOG2;
+ if (options->EmitNoPow)
+what_to_lower |= POW_TO_EXP2;
+ if (!ctx->Const.NativeIntegers)
+what_to_lower |= INT_DIV_TO_MUL_RCP;
+
  progress = false;
 
  /* Lowering */
  do_mat_op_to_vec(ir);
- lower_instructions(ir, (MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2
-| LOG_TO_LOG2 | INT_DIV_TO_MUL_RCP
-| ((options->EmitNoPow) ? POW_TO_EXP2 : 0)));
+ lower_instructions(ir, what_to_lower);
 
  progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, 
options->EmitNoCont, options->EmitNoLoops) || progress;
 
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH 0/3] i965/gen7: Enable HiZ

2012-01-09 Thread Kenneth Graunke

On 01/09/2012 02:30 PM, Chad Versace wrote:

Chad Versace (3):
   i965: Fix misnamed GEN7_WM_DEPTH_RESOLVE
   i965: Replace references to stencil region size with buffer size
   i965/gen7: Enable HiZ

  src/mesa/drivers/dri/i965/brw_defines.h |2 +-
  src/mesa/drivers/dri/i965/brw_misc_state.c  |8 +++---
  src/mesa/drivers/dri/i965/gen7_clip_state.c |   20 ++-
  src/mesa/drivers/dri/i965/gen7_misc_state.c |   37 +++---
  src/mesa/drivers/dri/i965/gen7_sf_state.c   |   18 +++--
  src/mesa/drivers/dri/i965/gen7_wm_state.c   |   18 +
  src/mesa/drivers/dri/intel/intel_screen.c   |2 +-
  7 files changed, 85 insertions(+), 20 deletions(-)


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

Patch 2 is:
Acked-by: Kenneth Graunke 

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


Re: [Mesa-dev] [PATCH] glx: Suppress unused variable warning for cmdlen

2012-01-09 Thread Kenneth Graunke

On 01/09/2012 03:56 PM, Paul Berry wrote:

No functional change.  In the function
__indirect_glAreTexturesResident(), the variable cmdlen is only used
if USE_XCB is not defined.  This patch avoids a compile warning in the
event that USE_XCB is defined.

v2: just move cmdlen declaration inside the #else part.
---
  src/glx/single2.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glx/single2.c b/src/glx/single2.c
index 66281fa..259c4fe 100644
--- a/src/glx/single2.c
+++ b/src/glx/single2.c
@@ -887,7 +887,6 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * 
textures,
 struct glx_context *const gc = __glXGetCurrentContext();
 Display *const dpy = gc->currentDpy;
 GLboolean retval = (GLboolean) 0;
-   const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
 if (__builtin_expect((n>= 0)&&  (dpy != NULL), 1)) {
  #ifdef USE_XCB
xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -903,6 +902,7 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * 
textures,
retval = reply->ret_val;
free(reply);
  #else
+  const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
GLubyte const *pc =
   __glXSetupSingleRequest(gc, X_GLsop_AreTexturesResident, cmdlen);
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);


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


Re: [Mesa-dev] [PATCH] glsl: Fix copy_propagation_elements bug in handling self-copies.

2012-01-09 Thread Kenneth Graunke

On 01/09/2012 01:36 PM, Eric Anholt wrote:

We were doing the kill of the updated channels, then adding our copy
to the list of available stuff to copy.  But if the copy was updating
its own source channels, we didn't notice, breaking this code:

R0.xyzw = arg0 + arg1;
R0.xyzw = R0.wwwx;
gl_FragColor.xyzw = clamp(R0.xyzw, 0.0, 1.0);

Fixes piglit glsl-copy-propagation-self-2.
---
  src/glsl/opt_copy_propagation_elements.cpp |   15 ++-
  1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/glsl/opt_copy_propagation_elements.cpp 
b/src/glsl/opt_copy_propagation_elements.cpp
index be446bc..ebfd4fd 100644
--- a/src/glsl/opt_copy_propagation_elements.cpp
+++ b/src/glsl/opt_copy_propagation_elements.cpp
@@ -461,7 +461,20 @@ 
ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir)
 swizzle[i] = orig_swizzle[j++];
 }

-   entry = new(this->mem_ctx) acp_entry(lhs->var, rhs->var, ir->write_mask,
+   int write_mask = ir->write_mask;
+   if (lhs->var == rhs->var) {
+  /* If this is a copy from the variable to itself, then we need
+   * to be sure not to include the updated channels from this
+   * instruction in the set of new source channels to be
+   * copy-propagated from.
+   */
+  for (int i = 0; i<  4; i++) {
+if (ir->write_mask&  (1<<  orig_swizzle[i]))
+   write_mask&= ~(1<<  i);
+  }
+   }
+
+   entry = new(this->mem_ctx) acp_entry(lhs->var, rhs->var, write_mask,
swizzle);
 this->acp->push_tail(entry);
  }


Whoops.  Yeah, that's definitely necessary.

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


Re: [Mesa-dev] [PATCH] glsl: remove logical xor FINISHME

2012-01-09 Thread Kenneth Graunke

On 01/09/2012 08:36 AM, Eric Anholt wrote:

On Sun,  8 Jan 2012 22:44:17 -0500, Matt Turner  wrote:

GLSL spec boneheadedly says (a ^^ a) must actually be evaluated.


What it's trying to say there is that any side-effects of both LHS and
RHS will occur (as opposed to how&&  or || work), not that you actually
compute the expression that you could just avoid.  Any side effects will
already be taken care of before opt_algebraic gets a look at the
ir_expression.


In fact, with my patches that change ir_call to be a statement rather 
than an ir_rvalue, all expression trees are pure and there can be no 
side-effects.  I'm hoping to land those for Mesa 8.1.


Even now, though, there shouldn't be side-effects in expression trees. 
My patches just make it more explicit.


So I think it's actually safe to optimize a ^^ a == false.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/14] i965: Remove brw_vs_precompile

2012-01-09 Thread Eric Anholt
On Fri,  6 Jan 2012 16:49:59 -0800, "Ian Romanick"  wrote:
> From: Ian Romanick 
> 
> The only error that the vertex shader precompile could generate is
> when register allocation fails.  Since i965 can spill registers, this
> should never happen.  It's also not something that can cause a link
> error.

This change will take those shaders from failing to link to segfaulting.

Yeah, it would be nice to finish register allocation.


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


Re: [Mesa-dev] [PATCH 12/12] svga: Drop execbuf throttling

2012-01-09 Thread Jakob Bornecrantz
On Tue, Jan 10, 2012 at 12:26 AM, Brian Paul  wrote:
> On 01/09/2012 03:53 PM, Jakob Bornecrantz wrote:
>>
>> Signed-off-by: Jakob Bornecrantz
>
>
> Maybe you could elaborate in the comment why the code is being dropped.  Was
> it just unused or something else?

It was unused, I'll add a comment about that and then push it.

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


Re: [Mesa-dev] [PATCH 09/14] i965: Remove brw_fs_precompile

2012-01-09 Thread Eric Anholt
On Fri,  6 Jan 2012 16:50:00 -0800, "Ian Romanick"  wrote:
> From: Ian Romanick 
> 
> There are several things that could cause the fragment shader
> precompile to fail.  Looking for calls to 'fail' in brw_fs_visitor.cpp
> finds three classes of things:
> 
>   * Trying to emit instructions that are invalid in 16-wide mode.
> 
>   * Trying to emit instructions that should have been lowered.
> 
>   * Register allocation failures.

I'm really sad to see this code go.  It's been incredibly useful for
tracking regressions in our code generation quality -- we have no other
current tool for doing so, since doing actual measurement requires
testing infrastructure we don't have.

Apitracing single frames of apps would get us close to this, but it will
miss shaders not involved in the frame you choose, the disk space cost
is still stunning, redistribution of a collection of traces is even more
difficult to accomplish while respecting copyright than shader-db, and
we don't have any current collection of traces at all.

If there's any way to retain this code, I'd like to.


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


Re: [Mesa-dev] [PATCH] Enable is_front_buffer_rendering variable in case of GL_FRONT_AND_BACK

2012-01-09 Thread Sun, Yi
> glDrawBuffer(GL_FRONT_AND_BACK) results in to segmentation fault if

> intel->is_front_buffer_rendering is not enabled with GL_FRONT_AND_BACK.

> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44153

>

> Reported-by: Yi Sun 

> Signed-off-by: Anuj Phogat 

> ---

>  src/mesa/drivers/dri/intel/intel_buffers.c |2 +-

>  1 files changed, 1 insertions(+), 1 deletions(-)

>

> diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c

> b/src/mesa/drivers/dri/intel/intel_buffers.c

> index 4632751..9809f79 100644

> --- a/src/mesa/drivers/dri/intel/intel_buffers.c

> +++ b/src/mesa/drivers/dri/intel/intel_buffers.c

> @@ -88,7 +88,7 @@ intelDrawBuffer(struct gl_context * ctx, GLenum mode)

>intel->is_front_buffer_rendering;

>

>intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT)

> - || (mode == GL_FRONT);

> +|| (mode == GL_FRONT) || (mode == GL_FRONT_AND_BACK);

>

>/* If we weren't front-buffer rendering before but we are now,

> * invalidate our DRI drawable so we'll ask for new buffers

> --

> 1.7.7.4

This patch fixes the segmentation fault issue while calling function 
glDrawBuffer.

Tested-by: Sun Yi 

Thanks
   --Yi,Sun

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


Re: [Mesa-dev] [PATCH 12/14] i965: Make sure gl_fragment_program::UsesKill is set for GLSL shaders

2012-01-09 Thread Eric Anholt
On Fri,  6 Jan 2012 16:50:03 -0800, "Ian Romanick"  wrote:
> From: Ian Romanick 
> 
> Signed-off-by: Ian Romanick 

Instead of making the compile process whack the assembly prog struct as
a side-effect, I think better would be to put uses_kill in the prog_data
during the GLSL and the ARB compile, and use that from the unit state.

(Long term, I've got a goal of moving the VS/WM state info to prog_data
output, so that when we detect identical compile results from different
shaders, we don't trigger state changes)


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


Re: [Mesa-dev] [PATCH 03/12] rbug: Silence warning

2012-01-09 Thread Jakob Bornecrantz
On Tue, Jan 10, 2012 at 12:01 AM, Alan Coopersmith
 wrote:
> On 01/ 9/12 02:53 PM, Jakob Bornecrantz wrote:
>>
>> -   struct pipe_shader_state pss = { 0 };
>> +   struct pipe_shader_state pss;
>> +   memset(&pss, 0, sizeof(pss));
>
>
> Those do the same thing, just via a function call instead of compiler
> builtin.
> What warning is being silenced by that change?

I don't have the build log with me right, but I think it was something
about uninitialized field near "pss.tokens = tokens;", I will take a
closer look. That struct has substruct it seems that GCC wants you to
initialize all of them.

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


Re: [Mesa-dev] [PATCH 00/12] Mostly harmless warning silencers

2012-01-09 Thread Jakob Bornecrantz
On Tue, Jan 10, 2012 at 12:29 AM, Brian Paul  wrote:
> On 01/09/2012 03:53 PM, Jakob Bornecrantz wrote:
>>
>> The first patch is a fix for the scons release build of the vmwgfx-dri
>> driver
>> I managed to break without noticing it. The others are mostly warning
>> silencers that I found when doing a scons release build, I'm not sure if
>> this
>> is the good way of doing them, but it got rid of the warnings at least.
>> And
>> some git ignores.
>>
>> Cheers, Jakob.
>>
>> Jakob Bornecrantz (12):
>>   target-helpers: If neither softpipe or llvmpipe is used just return the
>> screen
>>   draw: Silence warning
>>   rbug: Silence warning
>>   mesa: Silence warning
>>   mesa: Silence warning
>>   mesa: Ignores
>>   svga: Ignores
>>   svga: Silence warning
>>   svga: Silence warning
>>   svga: Silence warning
>>   svga: Add somewhat sensible fallback and silence warning
>>   svga: Drop execbuf throttling
>>
>>  .../draw/draw_pt_fetch_shade_pipeline_llvm.c       |   12 --
>>  .../target-helpers/inline_wrapper_sw_helper.h      |    2 +
>>  src/gallium/drivers/rbug/rbug_core.c               |    3 +-
>>  src/gallium/drivers/svga/svga_pipe_draw.c          |    3 ++
>>  src/gallium/drivers/svga/svga_tgsi_decl_sm30.c     |   12 +-
>>  src/gallium/targets/dri-vmwgfx/target.c            |    1 -
>>  src/gallium/targets/xa-vmwgfx/.gitignore           |    2 +
>>  src/gallium/winsys/svga/drm/vmw_context.c          |   22
>> +--
>>  src/gallium/winsys/svga/drm/vmw_context.h          |    4 ---
>>  src/gallium/winsys/svga/drm/vmw_screen.c           |   10 -
>>  src/gallium/winsys/svga/drm/vmw_screen.h           |    1 -
>>  src/mesa/.gitignore                                |    1 +
>>  src/mesa/program/nvvertparse.c                     |    1 +
>>  src/mesa/program/symbol_table.c                    |    1 +
>>  14 files changed, 16 insertions(+), 59 deletions(-)
>>  create mode 100644 src/gallium/targets/xa-vmwgfx/.gitignore
>>
>
> I think patch 12 could use more comments.  Otherwise, the series is
> Reviewed-by: Brian Paul 

Thanks!

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


Re: [Mesa-dev] [PATCH 13/14] i965: Don't use _mesa_ir_link_shader to do our dirty work

2012-01-09 Thread Eric Anholt
On Fri,  6 Jan 2012 16:50:04 -0800, "Ian Romanick"  wrote:
> From: Ian Romanick 
> 
> Instead, do the uniform setting and input / output mapping directly in
> brw_link_shader.  Hurray for not generating Mesa IR!
> 
> Signed-off-by: Ian Romanick 
> ---
>  src/mesa/drivers/dri/i965/brw_shader.cpp |   60 
> +++---
>  1 files changed, 54 insertions(+), 6 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp 
> b/src/mesa/drivers/dri/i965/brw_shader.cpp
> index fa325ba..f32f045 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp

> +  /* Make a pass over the IR to add state references for any built-in
> +   * uniforms that are used.  This has to be done now (during linking).
> +   * Code generation doesn't happen until the first time this shader is
> +   * used for rendering.  Waiting until then to generate the parameters 
> is
> +   * too late.  At that point, the values for the built-in informs won't
> +   * get sent to the shader.
> +   */

I actually can't find how that is too late -- compile happens before we
decide on how to upload parameters (obviously), so it must be that the
NEW_PROGRAM_CONSTANTS flag (set by mesa core) is not set.  Mesa core
appears to set it when any program uniform is changed and when programs
are bound.  I guess the exception I haven't found is that when programs
are relinked, we don't flag it.  That looks like a bug to me.

On the other hand, this seems like a totally reasonable and appropriate
place to be doing this work rather than per-recompile.

I haven't actually reviewed that this is the set of work necessary for
this code, but I'm fine with this in principle, at least.


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


Re: [Mesa-dev] [PATCH 00/14] Fix some linker stuff, kill one more user of ir_to_mesa

2012-01-09 Thread Eric Anholt
On Fri,  6 Jan 2012 16:49:51 -0800, "Ian Romanick"  wrote:
> Patches 01/14 through 03/14 was previously sent to the list.  It
> tickled a pre-existing bug (fixed by patch recently posted to the list
> by Eric) on some Intel chipsets.

Patches 1-7 and 11 are:

Reviewed-by: Eric Anholt 


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


  1   2   >