Mesa (master): i965/vec4: Stop pretending to support indirect output stores

2015-12-03 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: b715e6d52832a0761ccec5c1252e7458499bf752
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b715e6d52832a0761ccec5c1252e7458499bf752

Author: Jason Ekstrand 
Date:   Thu Nov 26 00:05:32 2015 -0800

i965/vec4: Stop pretending to support indirect output stores

Since we're using nir_lower_outputs_to_temporaries to shadow all our
outputs, it's impossible to actually get an indirect store.  The code we
had to "handle" this was pretty bogus as it created a register with a
reladdr and then stuffed it in a fixed varying slot without so much as a
MOV.  Not only does this not do the MOV, it also puts the indirect on the
wrong side of the transaction.  Let's just delete the broken dead code.

Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp |   12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 86fcc97..1e03022 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -393,21 +393,15 @@ vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr 
*instr)
}
 
case nir_intrinsic_store_output_indirect:
-  has_indirect = true;
-  /* fallthrough */
+  unreachable("nir_lower_outputs_to_temporaries should prevent this");
+
case nir_intrinsic_store_output: {
   int varying = instr->const_index[0];
 
   src = get_nir_src(instr->src[0], BRW_REGISTER_TYPE_F,
 instr->num_components);
-  dest = dst_reg(src);
 
-  if (has_indirect) {
- dest.reladdr = new(mem_ctx) src_reg(get_nir_src(instr->src[1],
- BRW_REGISTER_TYPE_D,
- 1));
-  }
-  output_reg[varying] = dest;
+  output_reg[varying] = dst_reg(src);
   break;
}
 

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


Mesa (master): nir/lower_io: Pass the builder and type_size into get_io_offset

2015-12-03 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: c6bcc233696e0f716755ea588397206a339d2bca
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6bcc233696e0f716755ea588397206a339d2bca

Author: Jason Ekstrand 
Date:   Wed Nov 25 12:33:38 2015 -0800

nir/lower_io: Pass the builder and type_size into get_io_offset

Reviewed-by: Kenneth Graunke 

---

 src/glsl/nir/nir_lower_io.c |   30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c
index 5683e69..f64ac69 100644
--- a/src/glsl/nir/nir_lower_io.c
+++ b/src/glsl/nir/nir_lower_io.c
@@ -87,17 +87,11 @@ is_per_vertex_output(struct lower_io_state *state, 
nir_variable *var)
 }
 
 static unsigned
-get_io_offset(nir_deref_var *deref, nir_instr *instr,
+get_io_offset(nir_builder *b, nir_deref_var *deref,
   nir_ssa_def **vertex_index,
   nir_ssa_def **out_indirect,
-  struct lower_io_state *state)
+  int (*type_size)(const struct glsl_type *))
 {
-   nir_ssa_def *indirect = NULL;
-   unsigned base_offset = 0;
-
-   nir_builder *b = >builder;
-   b->cursor = nir_before_instr(instr);
-
nir_deref *tail = >deref;
 
/* For per-vertex input arrays (i.e. geometry shader inputs), keep the
@@ -115,13 +109,16 @@ get_io_offset(nir_deref_var *deref, nir_instr *instr,
   *vertex_index = vtx;
}
 
+   nir_ssa_def *indirect = NULL;
+   unsigned base_offset = 0;
+
while (tail->child != NULL) {
   const struct glsl_type *parent_type = tail->type;
   tail = tail->child;
 
   if (tail->deref_type == nir_deref_type_array) {
  nir_deref_array *deref_array = nir_deref_as_array(tail);
- unsigned size = state->type_size(tail->type);
+ unsigned size = type_size(tail->type);
 
  base_offset += size * deref_array->base_offset;
 
@@ -136,8 +133,7 @@ get_io_offset(nir_deref_var *deref, nir_instr *instr,
  nir_deref_struct *deref_struct = nir_deref_as_struct(tail);
 
  for (unsigned i = 0; i < deref_struct->index; i++) {
-base_offset +=
-   state->type_size(glsl_get_struct_field(parent_type, i));
+base_offset += type_size(glsl_get_struct_field(parent_type, i));
  }
   }
}
@@ -185,6 +181,8 @@ nir_lower_io_block(nir_block *block, void *void_state)
 {
struct lower_io_state *state = void_state;
 
+   nir_builder *b = >builder;
+
nir_foreach_instr_safe(block, instr) {
   if (instr->type != nir_instr_type_intrinsic)
  continue;
@@ -205,6 +203,8 @@ nir_lower_io_block(nir_block *block, void *void_state)
   mode != nir_var_uniform)
  continue;
 
+  b->cursor = nir_before_instr(instr);
+
   switch (intrin->intrinsic) {
   case nir_intrinsic_load_var: {
  bool per_vertex =
@@ -214,9 +214,9 @@ nir_lower_io_block(nir_block *block, void *void_state)
  nir_ssa_def *indirect;
  nir_ssa_def *vertex_index;
 
- unsigned offset = get_io_offset(intrin->variables[0], >instr,
+ unsigned offset = get_io_offset(b, intrin->variables[0],
  per_vertex ? _index : NULL,
- , state);
+ , state->type_size);
 
  nir_intrinsic_instr *load =
 nir_intrinsic_instr_create(state->mem_ctx,
@@ -261,9 +261,9 @@ nir_lower_io_block(nir_block *block, void *void_state)
  bool per_vertex =
 is_per_vertex_output(state, intrin->variables[0]->var);
 
- unsigned offset = get_io_offset(intrin->variables[0], >instr,
+ unsigned offset = get_io_offset(b, intrin->variables[0],
  per_vertex ? _index : NULL,
- , state);
+ , state->type_size);
  offset += intrin->variables[0]->var->data.driver_location;
 
  nir_intrinsic_op store_op;

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


Mesa (master): i965/vec4: Get rid of the nir_inputs array

2015-12-03 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: aa35b0c2c71f054f72df5a85779d0862fa7d6e4a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa35b0c2c71f054f72df5a85779d0862fa7d6e4a

Author: Jason Ekstrand 
Date:   Wed Nov 25 14:01:00 2015 -0800

i965/vec4: Get rid of the nir_inputs array

It's not really buying us anything at this point.  It's just a way of
remapping one offset namespace onto another.  We can just use the location
namespace the whole way through.

Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/brw_nir.c|   28 
 src/mesa/drivers/dri/i965/brw_vec4.h   |2 --
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp |   23 +--
 3 files changed, 13 insertions(+), 40 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_nir.c 
b/src/mesa/drivers/dri/i965/brw_nir.c
index f04c9f7..5182bca 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -61,13 +61,6 @@ brw_nir_lower_inputs(nir_shader *nir,
 {
switch (nir->stage) {
case MESA_SHADER_VERTEX:
-  /* For now, leave the vec4 backend doing the old method. */
-  if (!is_scalar) {
- nir_assign_var_locations(>inputs, >num_inputs,
-  type_size_vec4);
- break;
-  }
-
   /* Start with the location of the variable's base. */
   foreach_list_typed(nir_variable, var, node, >inputs) {
  var->data.driver_location = var->data.location;
@@ -79,15 +72,18 @@ brw_nir_lower_inputs(nir_shader *nir,
*/
   nir_lower_io(nir, nir_var_shader_in, type_size_vec4);
 
-  /* Finally, translate VERT_ATTRIB_* values into the actual registers.
-   *
-   * Note that we can use nir->info.inputs_read instead of key->inputs_read
-   * since the two are identical aside from Gen4-5 edge flag differences.
-   */
-  GLbitfield64 inputs_read = nir->info.inputs_read;
-  nir_foreach_overload(nir, overload) {
- if (overload->impl) {
-nir_foreach_block(overload->impl, remap_vs_attrs, _read);
+  if (is_scalar) {
+ /* Finally, translate VERT_ATTRIB_* values into the actual registers.
+  *
+  * Note that we can use nir->info.inputs_read instead of
+  * key->inputs_read since the two are identical aside from Gen4-5
+  * edge flag differences.
+  */
+ GLbitfield64 inputs_read = nir->info.inputs_read;
+ nir_foreach_overload(nir, overload) {
+if (overload->impl) {
+   nir_foreach_block(overload->impl, remap_vs_attrs, _read);
+}
  }
   }
   break;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index 25b1139..ae5bf69 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -314,7 +314,6 @@ public:
bool is_high_sampler(src_reg sampler);
 
virtual void emit_nir_code();
-   virtual void nir_setup_inputs();
virtual void nir_setup_uniforms();
virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
virtual void nir_setup_system_values();
@@ -347,7 +346,6 @@ public:
 
dst_reg *nir_locals;
dst_reg *nir_ssa_values;
-   src_reg *nir_inputs;
dst_reg *nir_system_values;
 
 protected:
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 4aed60e..86fcc97 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -35,9 +35,6 @@ namespace brw {
 void
 vec4_visitor::emit_nir_code()
 {
-   if (nir->num_inputs > 0)
-  nir_setup_inputs();
-
if (nir->num_uniforms > 0)
   nir_setup_uniforms();
 
@@ -118,24 +115,6 @@ vec4_visitor::nir_setup_system_values()
 }
 
 void
-vec4_visitor::nir_setup_inputs()
-{
-   nir_inputs = ralloc_array(mem_ctx, src_reg, nir->num_inputs);
-   for (unsigned i = 0; i < nir->num_inputs; i++) {
-  nir_inputs[i] = src_reg();
-   }
-
-   nir_foreach_variable(var, >inputs) {
-  int offset = var->data.driver_location;
-  unsigned size = type_size_vec4(var->type);
-  for (unsigned i = 0; i < size; i++) {
- src_reg src = src_reg(ATTR, var->data.location + i, var->type);
- nir_inputs[offset + i] = src;
-  }
-   }
-}
-
-void
 vec4_visitor::nir_setup_uniforms()
 {
uniforms = nir->num_uniforms;
@@ -399,7 +378,7 @@ vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
   /* fallthrough */
case nir_intrinsic_load_input: {
   int offset = instr->const_index[0];
-  src = nir_inputs[offset];
+  src = src_reg(ATTR, offset, glsl_type::uvec4_type);
 
   if (has_indirect) {
  dest.reladdr = new(mem_ctx) src_reg(get_nir_src(instr->src[0],

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org

Mesa (master): nv50/ir: replace zeros in movs as well

2015-12-03 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 204f803ce0e47720d072603fec8a2acde6993fed
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=204f803ce0e47720d072603fec8a2acde6993fed

Author: Ilia Mirkin 
Date:   Thu Dec  3 23:43:44 2015 -0500

nv50/ir: replace zeros in movs as well

The original change to put zeroes directly into instructions created
conditional mov's with the zero immediate. However that can't be
emitted, so make sure to replace the zero with r63.

Fixes: 52a800a68 (nv50/ir: allow immediate 0 to be loaded anywhere)
Signed-off-by: Ilia Mirkin 

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
index 397c5a9..df44a7b 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp
@@ -293,8 +293,7 @@ NV50LegalizePostRA::visit(BasicBlock *bb)
next = hi;
  }
 
- if (i->op != OP_MOV && i->op != OP_PFETCH &&
- i->op != OP_BAR &&
+ if (i->op != OP_PFETCH && i->op != OP_BAR &&
  (!i->defExists(0) || i->def(0).getFile() != FILE_ADDRESS))
 replaceZero(i);
   }

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


Mesa (master): nv50/ir: fix DCE to not generate 96-bit loads

2015-12-03 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 49692f86a1b77fac4634d2a3f0502ec7451c3435
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=49692f86a1b77fac4634d2a3f0502ec7451c3435

Author: Ilia Mirkin 
Date:   Thu Dec  3 14:04:06 2015 -0500

nv50/ir: fix DCE to not generate 96-bit loads

A situation where there's a 128-bit load where the last component gets
DCE'd causes a 96-bit load to be generated, which no GPU can actually
emit. Avoid generating such instructions by scaling back to 64-bit on
the first load when splitting.

Signed-off-by: Ilia Mirkin 
Cc: "11.0 11.1" 

---

 .../drivers/nouveau/codegen/nv50_ir_peephole.cpp   |   32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 0f3caa8..bb7f491 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -2962,6 +2962,16 @@ DeadCodeElim::visit(BasicBlock *bb)
return true;
 }
 
+// Each load can go into up to 4 destinations, any of which might potentially
+// be dead (i.e. a hole). These can always be split into 2 loads, independent
+// of where the holes are. We find the first contiguous region, put it into
+// the first load, and then put the second contiguous region into the second
+// load. There can be at most 2 contiguous regions.
+//
+// Note that there are some restrictions, for example it's not possible to do
+// a 64-bit load that's not 64-bit aligned, so such a load has to be split
+// up. Also hardware doesn't support 96-bit loads, so those also have to be
+// split into a 64-bit and 32-bit load.
 void
 DeadCodeElim::checkSplitLoad(Instruction *ld1)
 {
@@ -2982,6 +2992,8 @@ DeadCodeElim::checkSplitLoad(Instruction *ld1)
addr1 = ld1->getSrc(0)->reg.data.offset;
n1 = n2 = 0;
size1 = size2 = 0;
+
+   // Compute address/width for first load
for (d = 0; ld1->defExists(d); ++d) {
   if (mask & (1 << d)) {
  if (size1 && (addr1 & 0x7))
@@ -2995,16 +3007,34 @@ DeadCodeElim::checkSplitLoad(Instruction *ld1)
  break;
   }
}
+
+   // Scale back the size of the first load until it can be loaded. This
+   // typically happens for TYPE_B96 loads.
+   while (n1 &&
+  !prog->getTarget()->isAccessSupported(ld1->getSrc(0)->reg.file,
+typeOfSize(size1))) {
+  size1 -= def1[--n1]->reg.size;
+  d--;
+   }
+
+   // Compute address/width for second load
for (addr2 = addr1 + size1; ld1->defExists(d); ++d) {
   if (mask & (1 << d)) {
+ assert(!size2 || !(addr2 & 0x7));
  def2[n2] = ld1->getDef(d);
  size2 += def2[n2++]->reg.size;
-  } else {
+  } else if (!n2) {
  assert(!n2);
  addr2 += ld1->getDef(d)->reg.size;
+  } else {
+ break;
   }
}
 
+   // Make sure that we've processed all the values
+   for (; ld1->defExists(d); ++d)
+  assert(!(mask & (1 << d)));
+
updateLdStOffset(ld1, addr1, func);
ld1->setType(typeOfSize(size1));
for (d = 0; d < 4; ++d)

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


Mesa (master): nv50/ir: fold fma/mad when all 3 args are immediates

2015-12-03 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: a3722b81f534598f25d9d155a6d30bc59a6f4e59
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3722b81f534598f25d9d155a6d30bc59a6f4e59

Author: Ilia Mirkin 
Date:   Wed Dec  2 21:02:12 2015 -0500

nv50/ir: fold fma/mad when all 3 args are immediates

This happens pretty rarely, but might as well do it when it does.

Signed-off-by: Ilia Mirkin 

---

 .../drivers/nouveau/codegen/nv50_ir_peephole.cpp   |   30 
 1 file changed, 30 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index bb7f491..b79e465 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -670,6 +670,34 @@ ConstantFolding::expr(Instruction *i,
   res.data.u32 = ((a->data.u32 << offset) & bitmask) | (c->data.u32 & 
~bitmask);
   break;
}
+   case OP_MAD:
+   case OP_FMA: {
+  switch (i->dType) {
+  case TYPE_F32:
+ res.data.f32 = a->data.f32 * b->data.f32 * exp2f(i->postFactor) +
+c->data.f32;
+ break;
+  case TYPE_F64:
+ res.data.f64 = a->data.f64 * b->data.f64 + c->data.f64;
+ break;
+  case TYPE_S32:
+ if (i->subOp == NV50_IR_SUBOP_MUL_HIGH) {
+res.data.s32 = ((int64_t)a->data.s32 * b->data.s32 >> 32) + 
c->data.s32;
+break;
+ }
+ /* fallthrough */
+  case TYPE_U32:
+ if (i->subOp == NV50_IR_SUBOP_MUL_HIGH) {
+res.data.u32 = ((uint64_t)a->data.u32 * b->data.u32 >> 32) + 
c->data.u32;
+break;
+ }
+ res.data.u32 = a->data.u32 * b->data.u32 + c->data.u32;
+ break;
+  default:
+ return;
+  }
+  break;
+   }
default:
   return;
}
@@ -684,6 +712,8 @@ ConstantFolding::expr(Instruction *i,
i->setSrc(2, NULL);
 
i->getSrc(0)->reg.data = res.data;
+   i->getSrc(0)->reg.type = i->dType;
+   i->getSrc(0)->reg.size = typeSizeof(i->dType);
 
i->op = OP_MOV;
 }

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


Mesa (master): nv50/ir: avoid looking at uninitialized srcMods entries

2015-12-03 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 2b98914fe01f1c7b2de8a096c8923b3ab0a69578
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b98914fe01f1c7b2de8a096c8923b3ab0a69578

Author: Ilia Mirkin 
Date:   Thu Dec  3 22:37:22 2015 -0500

nv50/ir: avoid looking at uninitialized srcMods entries

Signed-off-by: Ilia Mirkin 
Cc: "11.0 11.1" 

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp |2 +-
 src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
index a0fb144..2d5baed 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
@@ -460,7 +460,7 @@ TargetNV50::isModSupported(const Instruction *insn, int s, 
Modifier mod) const
  return false;
   }
}
-   if (s >= 3)
+   if (s >= opInfo[insn->op].srcNr || s >= 3)
   return false;
return (mod & Modifier(opInfo[insn->op].srcMods[s])) == mod;
 }
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
index 8f59d86..0f1f4f8 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
@@ -439,7 +439,7 @@ TargetNVC0::isModSupported(const Instruction *insn, int s, 
Modifier mod) const
  return false;
   }
}
-   if (s >= 3)
+   if (s >= opInfo[insn->op].srcNr || s >= 3)
   return false;
return (mod & Modifier(opInfo[insn->op].srcMods[s])) == mod;
 }

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


Mesa (master): glsl: remove useless null checks and make match_explicit_outputs_to_inputs() static

2015-12-03 Thread Juha Pekka Heikkilä
Module: Mesa
Branch: master
Commit: d6d90750f129f4c43c55acfefa9b82d32b0b3e21
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d6d90750f129f4c43c55acfefa9b82d32b0b3e21

Author: Juha-Pekka Heikkila 
Date:   Wed Dec  2 11:48:46 2015 +0200

glsl: remove useless null checks and make match_explicit_outputs_to_inputs() 
static

match_explicit_outputs_to_inputs() cannot get null inputs and if it ever did
triggering first null check would later in the function cause segfault.

Signed-off-by: Juha-Pekka Heikkila 
CC: timothy.arc...@collabora.com
Reviewed-by: Timothy Arceri 

---

 src/glsl/linker.cpp |   10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 660c435..ae628cd 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2687,7 +2687,7 @@ assign_attribute_or_color_locations(gl_shader_program 
*prog,
  * Match explicit locations of outputs to inputs and deactivate the
  * unmatch flag if found so we don't optimise them away.
  */
-void
+static void
 match_explicit_outputs_to_inputs(struct gl_shader_program *prog,
  gl_shader *producer,
  gl_shader *consumer)
@@ -2703,10 +2703,6 @@ match_explicit_outputs_to_inputs(struct 
gl_shader_program *prog,
   if ((var == NULL) || (var->data.mode != ir_var_shader_out))
  continue;
 
-  /* Mark output as matched if separate shader with no linked consumer */
-  if (consumer == NULL)
- var->data.is_unmatched_generic_inout = 0;
-
   if (var->data.explicit_location &&
   var->data.location >= VARYING_SLOT_VAR0) {
  const unsigned idx = var->data.location - VARYING_SLOT_VAR0;
@@ -2722,10 +2718,6 @@ match_explicit_outputs_to_inputs(struct 
gl_shader_program *prog,
   if ((input == NULL) || (input->data.mode != ir_var_shader_in))
  continue;
 
-  /* Mark input as matched if separate shader with no linked producer */
-  if (producer == NULL)
- input->data.is_unmatched_generic_inout = 0;
-
   ir_variable *output = NULL;
   if (input->data.explicit_location
   && input->data.location >= VARYING_SLOT_VAR0) {

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


Mesa (master): st/wgl: add support for WGL_ARB_render_texture

2015-12-03 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e832b5b7fa196853bc61895869bd20c8b85f0ea9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e832b5b7fa196853bc61895869bd20c8b85f0ea9

Author: Brian Paul 
Date:   Thu Dec  3 09:12:20 2015 -0700

st/wgl: add support for WGL_ARB_render_texture

There are a few legacy OpenGL apps on Windows which need this extension.
We basically use glCopyTex[Sub]Image to implement wglBindTexImageARB (see
the implementation notes for details).

v2: refactor code to use st_copy_framebuffer_to_texture() helper function.

Reviewed-by: José Fonseca 
Reviewed-by: Charmaine Lee 

---

 src/gallium/state_trackers/wgl/Makefile.sources|1 +
 .../state_trackers/wgl/stw_ext_extensionsstring.c  |1 +
 src/gallium/state_trackers/wgl/stw_ext_pbuffer.c   |   63 ++--
 .../state_trackers/wgl/stw_ext_pixelformat.c   |   16 -
 src/gallium/state_trackers/wgl/stw_framebuffer.h   |   27 +
 .../state_trackers/wgl/stw_getprocaddress.c|5 ++
 src/gallium/state_trackers/wgl/stw_pixelformat.c   |6 ++
 src/gallium/state_trackers/wgl/stw_pixelformat.h   |4 ++
 src/gallium/state_trackers/wgl/stw_st.c|5 --
 9 files changed, 118 insertions(+), 10 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/Makefile.sources 
b/src/gallium/state_trackers/wgl/Makefile.sources
index 1e00caf..2630b44 100644
--- a/src/gallium/state_trackers/wgl/Makefile.sources
+++ b/src/gallium/state_trackers/wgl/Makefile.sources
@@ -5,6 +5,7 @@ C_SOURCES := \
stw_ext_extensionsstring.c \
stw_ext_pbuffer.c \
stw_ext_pixelformat.c \
+   stw_ext_rendertexture.c \
stw_ext_swapinterval.c \
stw_framebuffer.c \
stw_getprocaddress.c \
diff --git a/src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c 
b/src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c
index a8c085a..86b93fb 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c
@@ -41,6 +41,7 @@ static const char *stw_extension_string =
"WGL_ARB_multisample "
"WGL_ARB_pbuffer "
"WGL_ARB_pixel_format "
+   "WGL_ARB_render_texture "
"WGL_EXT_create_context_es_profile "
"WGL_EXT_create_context_es2_profile "
 /*   "WGL_EXT_swap_interval " */
diff --git a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c 
b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
index c99fa3e..d709faa 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
@@ -86,6 +86,9 @@ wglCreatePbufferARB(HDC hCurrentDC,
int iDisplayablePixelFormat;
PIXELFORMATDESCRIPTOR pfd;
BOOL bRet;
+   int textureFormat = WGL_NO_TEXTURE_ARB;
+   int textureTarget = WGL_NO_TEXTURE_ARB;
+   BOOL textureMipmap = FALSE;
 
info = stw_pixelformat_get_info(iPixelFormat - 1);
if (!info) {
@@ -104,8 +107,38 @@ wglCreatePbufferARB(HDC hCurrentDC,
  piAttrib++;
  useLargest = *piAttrib;
  break;
+   case WGL_TEXTURE_FORMAT_ARB:
+  /* WGL_ARB_render_texture */
+  piAttrib++;
+  textureFormat = *piAttrib;
+  if (textureFormat != WGL_TEXTURE_RGB_ARB &&
+ textureFormat != WGL_TEXTURE_RGBA_ARB &&
+ textureFormat != WGL_NO_TEXTURE_ARB) {
+ SetLastError(ERROR_INVALID_DATA);
+ return 0;
+  }
+  break;
+   case WGL_TEXTURE_TARGET_ARB:
+  /* WGL_ARB_render_texture */
+  piAttrib++;
+  textureTarget = *piAttrib;
+  if (textureTarget != WGL_TEXTURE_CUBE_MAP_ARB &&
+  textureTarget != WGL_TEXTURE_1D_ARB &&
+  textureTarget != WGL_TEXTURE_2D_ARB &&
+  textureTarget != WGL_NO_TEXTURE_ARB) {
+ SetLastError(ERROR_INVALID_DATA);
+ return 0;
+  }
+  break;
+  case WGL_MIPMAP_TEXTURE_ARB:
+ /* WGL_ARB_render_texture */
+ piAttrib++;
+ textureMipmap = !!*piAttrib;
+ break;
   default:
  SetLastError(ERROR_INVALID_DATA);
+ debug_printf("wgl: Unsupported attribute 0x%x in %s\n",
+  *piAttrib, __func__);
  return 0;
   }
}
@@ -220,6 +253,12 @@ wglCreatePbufferARB(HDC hCurrentDC,
}
 
fb->bPbuffer = TRUE;
+
+   /* WGL_ARB_render_texture fields */
+   fb->textureTarget = textureTarget;
+   fb->textureFormat = textureFormat;
+   fb->textureMipmap = textureMipmap;
+
iDisplayablePixelFormat = fb->iDisplayablePixelFormat;
 
stw_framebuffer_unlock(fb);
@@ -246,7 +285,7 @@ wglGetPbufferDCARB(HPBUFFERARB hPbuffer)
   return NULL;
}
 
-   fb = (struct stw_framebuffer *)hPbuffer;
+   fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer);
 
hDC = GetDC(fb->hWnd);
 
@@ -265,7 +304,7 @@ wglReleasePbufferDCARB(HPBUFFERARB hPbuffer,
   return 0;
}
 
-   fb = (struct 

Mesa (master): mesa: print enum names rather than hexadecimal values in error messages

2015-12-03 Thread Brian Paul
Module: Mesa
Branch: master
Commit: a0f1bc18e51566e62a0a0a314650b7aa8eb192e5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0f1bc18e51566e62a0a0a314650b7aa8eb192e5

Author: Brian Paul 
Date:   Thu Dec  3 09:40:38 2015 -0700

mesa: print enum names rather than hexadecimal values in error messages

Trivial.

---

 src/mesa/main/teximage.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d5fe034..60fc7cc 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2492,8 +2492,8 @@ copytexsubimage_error_check(struct gl_context *ctx, 
GLuint dimensions,
 
if (!_mesa_source_buffer_exists(ctx, texImage->_BaseFormat)) {
   _mesa_error(ctx, GL_INVALID_OPERATION,
-  "%s(missing readbuffer, format=0x%x)", caller,
-  texImage->_BaseFormat);
+  "%s(missing readbuffer, format=%s)", caller,
+  _mesa_enum_to_string(texImage->_BaseFormat));
   return GL_TRUE;
}
 
@@ -4310,8 +4310,8 @@ compressed_subtexture_error_check(struct gl_context *ctx, 
GLint dims,
 
if (compressedteximage_only_format(ctx, format)) {
   _mesa_error(ctx, GL_INVALID_OPERATION,
-   "%s(format=0x%x cannot be updated)",
-   callerName, format);
+  "%s(format=%s cannot be updated)",
+  callerName, _mesa_enum_to_string(format));
   return GL_TRUE;
}
 
@@ -4901,8 +4901,8 @@ _mesa_texture_buffer_range(struct gl_context *ctx,
 
format = _mesa_validate_texbuffer_format(ctx, internalFormat);
if (format == MESA_FORMAT_NONE) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  "%s(internalFormat 0x%x)", caller, internalFormat);
+  _mesa_error(ctx, GL_INVALID_ENUM, "%s(internalFormat %s)",
+  caller, _mesa_enum_to_string(internalFormat));
   return;
}
 

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


Mesa (master): st/mesa: add new st_copy_framebuffer_to_texture() function

2015-12-03 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 47b9ef872b70066756e004a6dd52482ea2899d43
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=47b9ef872b70066756e004a6dd52482ea2899d43

Author: Brian Paul 
Date:   Wed Dec  2 17:29:27 2015 -0700

st/mesa: add new st_copy_framebuffer_to_texture() function

This helper is used by the WGL state tracker to implement the
wglBindTexImageARB() function.

This is basically a new "meta" function.  However, we're not putting
it in the src/mesa/drivers/common/ directory because that code is not
linked with gallium-based drivers.

Reviewed-by: José Fonseca 
Reviewed-by: Charmaine Lee 

---

 src/mesa/Makefile.sources   |2 +
 src/mesa/state_tracker/st_copytex.c |  140 +++
 src/mesa/state_tracker/st_copytex.h |   36 +
 3 files changed, 178 insertions(+)

diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 778b92d..13a05f5 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -465,6 +465,8 @@ STATETRACKER_FILES = \
state_tracker/st_cb_xformfb.h \
state_tracker/st_context.c \
state_tracker/st_context.h \
+   state_tracker/st_copytex.c \
+   state_tracker/st_copytex.h \
state_tracker/st_debug.c \
state_tracker/st_debug.h \
state_tracker/st_draw.c \
diff --git a/src/mesa/state_tracker/st_copytex.c 
b/src/mesa/state_tracker/st_copytex.c
new file mode 100644
index 000..d246d8b
--- /dev/null
+++ b/src/mesa/state_tracker/st_copytex.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2015 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "main/mtypes.h"
+#include "main/buffers.h"
+#include "main/errors.h"
+#include "main/fbobject.h"
+#include "main/get.h"
+#include "main/teximage.h"
+#include "main/texparam.h"
+#include "st_copytex.h"
+
+
+/**
+ * Copy a colorbuffer from the window system framebuffer (a window or
+ * pbuffer) to a texture.
+ * This is a helper used by the wglBindTexImageARB() function.
+ *
+ * \param srcBuffer  source buffer (GL_FRONT_LEFT, GL_BACK_LEFT, etc)
+ * \param fbWidth  width of the source framebuffer
+ * \param fbHeight  height of the source framebuffer
+ * \param texTarget  which texture target to copy to 
(GL_TEXTURE_1D/2D/CUBE_MAP)
+ * \param texLevel  which texture mipmap level to copy to
+ * \param cubeFace  which cube face to copy to (in [0,5])
+ * \param texFormat  what texture format to use, if texture doesn't exist
+ */
+void
+st_copy_framebuffer_to_texture(GLenum srcBuffer,
+   GLint fbWidth, GLint fbHeight,
+   GLenum texTarget, GLint texLevel,
+   GLuint cubeFace, GLenum texFormat)
+{
+   GLint readFBOSave, readBufSave, width, height;
+
+   assert(cubeFace < 6);
+
+   /* Save current FBO / readbuffer */
+   _mesa_GetIntegerv(GL_READ_FRAMEBUFFER_BINDING, );
+   _mesa_GetIntegerv(GL_READ_BUFFER, );
+
+   /* Read from the winsys buffer */
+   _mesa_BindFramebuffer(GL_READ_BUFFER, 0);
+   _mesa_ReadBuffer(srcBuffer);
+
+   /* copy image from pbuffer to texture */
+   switch (texTarget) {
+   case GL_TEXTURE_1D:
+  _mesa_GetTexLevelParameteriv(GL_TEXTURE_1D, texLevel,
+   GL_TEXTURE_WIDTH, );
+  if (width == fbWidth) {
+ /* replace existing texture */
+ _mesa_CopyTexSubImage1D(GL_TEXTURE_1D,
+ texLevel,
+ 0,/* xoffset */
+ 0, 0, /* x, y */
+ fbWidth);
+  } else {
+ /* define initial texture */
+ _mesa_CopyTexImage1D(GL_TEXTURE_1D,
+  texLevel,
+  texFormat,
+  0, 0, /* x, y */
+  

Mesa (master): st/wgl: add new stw_ext_rendertexture.c file

2015-12-03 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 72a913ceb852a20f8e0cd83f692fa8adbda67ef8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=72a913ceb852a20f8e0cd83f692fa8adbda67ef8

Author: Brian Paul 
Date:   Thu Dec  3 09:32:53 2015 -0700

st/wgl: add new stw_ext_rendertexture.c file

This should have been included in the previous commit.

Signed-off-by: Brian Paul 

---

 .../state_trackers/wgl/stw_ext_rendertexture.c |  252 
 1 file changed, 252 insertions(+)

diff --git a/src/gallium/state_trackers/wgl/stw_ext_rendertexture.c 
b/src/gallium/state_trackers/wgl/stw_ext_rendertexture.c
new file mode 100644
index 000..18df2eb
--- /dev/null
+++ b/src/gallium/state_trackers/wgl/stw_ext_rendertexture.c
@@ -0,0 +1,252 @@
+/**
+ * Copyright 2015 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **/
+
+#include 
+
+#define WGL_WGLEXT_PROTOTYPES
+
+#include 
+#include 
+
+#include "state_tracker/st_copytex.h"
+
+#include "pipe/p_defines.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_state.h"
+
+#include "stw_icd.h"
+#include "stw_context.h"
+#include "stw_device.h"
+#include "stw_pixelformat.h"
+#include "stw_framebuffer.h"
+#include "stw_st.h"
+
+
+/** Translate a WGL buffer name to a GLenum */
+static GLenum
+translate_ibuffer(int iBuffer)
+{
+   switch (iBuffer) {
+   case WGL_FRONT_LEFT_ARB:
+  return GL_FRONT_LEFT;
+   case WGL_BACK_LEFT_ARB:
+  return GL_BACK_LEFT;
+   case WGL_FRONT_RIGHT_ARB:
+  return GL_FRONT_RIGHT;
+   case WGL_BACK_RIGHT_ARB:
+  return GL_BACK_RIGHT;
+   case WGL_AUX0_ARB:
+  return GL_AUX0;
+   default:
+  return GL_NONE;
+   }
+}
+
+
+/** Translate a WGL texture target type to a GLenum */
+static GLenum
+translate_target(unsigned textureTarget)
+{
+   switch (textureTarget) {
+   case WGL_TEXTURE_1D_ARB:
+  return GL_TEXTURE_1D;
+   case WGL_TEXTURE_2D_ARB:
+  return GL_TEXTURE_2D;
+   case WGL_TEXTURE_CUBE_MAP_ARB:
+  return GL_TEXTURE_CUBE_MAP;
+   case WGL_NO_TEXTURE_ARB:
+   default:
+  return GL_NONE;
+   }
+}
+
+
+/** Translate a WGL texture format to a GLenum */
+static GLenum
+translate_texture_format(unsigned wgl_format)
+{
+   switch (wgl_format) {
+   case WGL_TEXTURE_RGB_ARB:
+  return GL_RGB;
+   case WGL_TEXTURE_RGBA_ARB:
+  return GL_RGBA;
+   case WGL_NO_TEXTURE_ARB:
+   default:
+  return GL_NONE;
+   }
+}
+
+
+BOOL WINAPI
+wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer)
+{
+   HDC prevDrawable = stw_get_current_dc();
+   struct stw_context *curctx = stw_current_context();
+   struct stw_framebuffer *fb;
+   GLenum texFormat, srcBuffer, target;
+   boolean retVal;
+   int pixelFormatSave;
+
+   /*
+* Implementation notes:
+* Ideally, we'd implement this function with the
+* st_context_iface::teximage() function which replaces a specific
+* texture image with a different resource (the pbuffer).
+* The main problem however, is the pbuffer image is upside down relative
+* to the texture image.
+* Window system drawing surfaces (windows & pbuffers) are "top to bottom"
+* while OpenGL texture images are "bottom to top".  One possible solution
+* to this is to invert rendering to pbuffers (as we do for renderbuffers)
+* but that could lead to other issues (and would require extensive
+* testing).
+*
+* The simple alternative is to use a copy-based approach which copies the
+* pbuffer image into the texture via glCopyTex[Sub]Image.  That's what
+* we do here.
+*/
+
+   fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer);
+   if (!fb) {
+  debug_printf("Invalid pbuffer handle in wglBindTexImageARB()\n");
+  SetLastError(ERROR_INVALID_HANDLE);
+ 

Mesa (master): radeonsi: fix occlusion queries on Fiji

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: bfc14796b077444011c81f544ceec5d8592c5c77
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfc14796b077444011c81f544ceec5d8592c5c77

Author: Marek Olšák 
Date:   Tue Oct 27 23:10:51 2015 +0100

radeonsi: fix occlusion queries on Fiji

Tested.

---

 src/gallium/drivers/radeon/r600_pipe_common.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 27e1269..1ed5eb7 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -239,8 +239,8 @@ bool r600_common_context_init(struct r600_common_context 
*rctx,
rctx->family = rscreen->family;
rctx->chip_class = rscreen->chip_class;
 
-   if (rscreen->family == CHIP_HAWAII)
-   rctx->max_db = 16;
+   if (rscreen->chip_class >= CIK)
+   rctx->max_db = MAX2(8, rscreen->info.r600_num_backends);
else if (rscreen->chip_class >= EVERGREEN)
rctx->max_db = 8;
else

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


Mesa (master): radeonsi: fix Fiji for LLVM <= 3.7

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: dd27825c8cf0e7b55ebaa139e299f275943d22f6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dd27825c8cf0e7b55ebaa139e299f275943d22f6

Author: Marek Olšák 
Date:   Thu Dec  3 23:50:00 2015 +0100

radeonsi: fix Fiji for LLVM <= 3.7

Cc: 11.0 11.1 
Reviewed-by: Alex Deucher 

---

 src/gallium/drivers/radeon/r600_pipe_common.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 1ed5eb7..f566a29 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -555,10 +555,11 @@ const char *r600_get_llvm_processor_name(enum 
radeon_family family)
case CHIP_TONGA: return "tonga";
case CHIP_ICELAND: return "iceland";
case CHIP_CARRIZO: return "carrizo";
-   case CHIP_FIJI: return "fiji";
 #if HAVE_LLVM <= 0x0307
+   case CHIP_FIJI: return "tonga";
case CHIP_STONEY: return "carrizo";
 #else
+   case CHIP_FIJI: return "fiji";
case CHIP_STONEY: return "stoney";
 #endif
default: return "";

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


Mesa (master): ttn: Whitelist from -Werror=declaration-after-statement.

2015-12-03 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 071af9a511f1a6233eaab726f28efb96a86696d8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=071af9a511f1a6233eaab726f28efb96a86696d8

Author: Jose Fonseca 
Date:   Wed Dec  2 17:54:45 2015 +

ttn: Whitelist from -Werror=declaration-after-statement.

nir is the exception among gallium/auxiliary -- we don't need to compile
it with MSVC2008 yet.  And this enables us to use
-Werror=declaration-after-statement in the next commit as we should,
without complicated fixes to tgsi_to_nir module.

Trvial.  Tested with GCC and Clang.

---

 src/gallium/auxiliary/nir/tgsi_to_nir.c |4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c 
b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 86c2ffa..5fef542 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -22,6 +22,10 @@
  * IN THE SOFTWARE.
  */
 
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-Wdeclaration-after-statement"
+#endif
+
 #include "util/ralloc.h"
 #include "glsl/nir/nir.h"
 #include "glsl/nir/nir_control_flow.h"

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


Mesa (master): radeonsi: dump init_config IBs

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 0b03f2def0de8a7a5668e4ba9f0b4de64a2efe08
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b03f2def0de8a7a5668e4ba9f0b4de64a2efe08

Author: Marek Olšák 
Date:   Tue Nov 24 23:00:00 2015 +0100

radeonsi: dump init_config IBs

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeonsi/si_debug.c |   19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_debug.c 
b/src/gallium/drivers/radeonsi/si_debug.c
index b2b1010..0a4e0f9 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -312,9 +312,10 @@ static uint32_t *si_parse_packet3(FILE *f, uint32_t *ib, 
int *num_dw,
  * \param trace_id the last trace ID that is known to have been reached
  * and executed by the CP, typically read from a buffer
  */
-static void si_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id)
+static void si_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id,
+   const char *name)
 {
-   fprintf(f, "-- IB begin --\n");
+   fprintf(f, "-- %s begin --\n", name);
 
while (num_dw > 0) {
unsigned type = PKT_TYPE_G(ib[0]);
@@ -337,11 +338,12 @@ static void si_parse_ib(FILE *f, uint32_t *ib, int 
num_dw, int trace_id)
}
}
 
-   fprintf(f, "--- IB end ---\n");
+   fprintf(f, "--- %s end ---\n", name);
if (num_dw < 0) {
printf("Packet ends after the end of IB.\n");
exit(0);
}
+   fprintf(f, "\n");
 }
 
 static void si_dump_mmapped_reg(struct si_context *sctx, FILE *f,
@@ -413,8 +415,17 @@ static void si_dump_last_ib(struct si_context *sctx, FILE 
*f)
last_trace_id = *map;
}
 
+   if (sctx->init_config)
+   si_parse_ib(f, sctx->init_config->pm4, sctx->init_config->ndw,
+   -1, "IB2: Init config");
+
+   if (sctx->init_config_gs_rings)
+   si_parse_ib(f, sctx->init_config_gs_rings->pm4,
+   sctx->init_config_gs_rings->ndw,
+   -1, "IB2: Init GS rings");
+
si_parse_ib(f, sctx->last_ib, sctx->last_ib_dw_size,
-   last_trace_id);
+   last_trace_id, "IB");
free(sctx->last_ib); /* dump only once */
sctx->last_ib = NULL;
r600_resource_reference(>last_trace_buf, NULL);

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


Mesa (master): radeonsi: print framebuffer info into ddebug logs

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 3a6de8c86ee8a0a6d2f2fbc8cf2c461af0b9a007
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a6de8c86ee8a0a6d2f2fbc8cf2c461af0b9a007

Author: Marek Olšák 
Date:   Mon Nov 23 13:30:23 2015 +0100

radeonsi: print framebuffer info into ddebug logs

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeon/r600_pipe_common.h |1 +
 src/gallium/drivers/radeon/r600_texture.c |3 +--
 src/gallium/drivers/radeonsi/si_debug.c   |   25 +
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index cd2dd09..8c6c0c3 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -558,6 +558,7 @@ void r600_texture_get_cmask_info(struct r600_common_screen 
*rscreen,
 bool r600_init_flushed_depth_texture(struct pipe_context *ctx,
 struct pipe_resource *texture,
 struct r600_texture **staging);
+void r600_print_texture_info(struct r600_texture *rtex, FILE *f);
 struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
const struct pipe_resource *templ);
 struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe,
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index bf0358b..e2947d9 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -598,8 +598,7 @@ static void r600_texture_allocate_htile(struct 
r600_common_screen *rscreen,
}
 }
 
-static void
-r600_print_texture_info(struct r600_texture *rtex, FILE *f)
+void r600_print_texture_info(struct r600_texture *rtex, FILE *f)
 {
int i;
 
diff --git a/src/gallium/drivers/radeonsi/si_debug.c 
b/src/gallium/drivers/radeonsi/si_debug.c
index 5306218..b2b1010 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -528,6 +528,30 @@ static void si_dump_last_bo_list(struct si_context *sctx, 
FILE *f)
sctx->last_bo_list = NULL;
 }
 
+static void si_dump_framebuffer(struct si_context *sctx, FILE *f)
+{
+   struct pipe_framebuffer_state *state = >framebuffer.state;
+   struct r600_texture *rtex;
+   int i;
+
+   for (i = 0; i < state->nr_cbufs; i++) {
+   if (!state->cbufs[i])
+   continue;
+
+   rtex = (struct r600_texture*)state->cbufs[i]->texture;
+   fprintf(f, COLOR_YELLOW "Color buffer %i:" COLOR_RESET "\n", i);
+   r600_print_texture_info(rtex, f);
+   fprintf(f, "\n");
+   }
+
+   if (state->zsbuf) {
+   rtex = (struct r600_texture*)state->zsbuf->texture;
+   fprintf(f, COLOR_YELLOW "Depth-stencil buffer:" COLOR_RESET 
"\n");
+   r600_print_texture_info(rtex, f);
+   fprintf(f, "\n");
+   }
+}
+
 static void si_dump_debug_state(struct pipe_context *ctx, FILE *f,
unsigned flags)
 {
@@ -536,6 +560,7 @@ static void si_dump_debug_state(struct pipe_context *ctx, 
FILE *f,
if (flags & PIPE_DEBUG_DEVICE_IS_HUNG)
si_dump_debug_registers(sctx, f);
 
+   si_dump_framebuffer(sctx, f);
si_dump_shader(>vs_shader, "Vertex", f);
si_dump_shader(>tcs_shader, "Tessellation control", f);
si_dump_shader(>tes_shader, "Tessellation evaluation", f);

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


Mesa (master): gallium/radeon: rename fmask::pitch -> pitch_in_pixels

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 84fbb0aff98d6e90e4759bbe701c9484e569c869
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=84fbb0aff98d6e90e4759bbe701c9484e569c869

Author: Marek Olšák 
Date:   Sat Nov 21 23:46:01 2015 +0100

gallium/radeon: rename fmask::pitch -> pitch_in_pixels

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeon/r600_pipe_common.h |2 +-
 src/gallium/drivers/radeon/r600_texture.c |6 +++---
 src/gallium/drivers/radeonsi/si_state.c   |4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 9f2d50c..b6009d2 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -172,7 +172,7 @@ struct r600_fmask_info {
unsigned offset;
unsigned size;
unsigned alignment;
-   unsigned pitch;
+   unsigned pitch_in_pixels;
unsigned bank_height;
unsigned slice_tile_max;
unsigned tile_mode_index;
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index c787cfb..37cac91 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -336,7 +336,7 @@ void r600_texture_get_fmask_info(struct r600_common_screen 
*rscreen,
out->slice_tile_max -= 1;
 
out->tile_mode_index = fmask.tiling_index[0];
-   out->pitch = fmask.level[0].nblk_x;
+   out->pitch_in_pixels = fmask.level[0].nblk_x;
out->bank_height = fmask.bankh;
out->alignment = MAX2(256, fmask.bo_alignment);
out->size = fmask.bo_size;
@@ -608,10 +608,10 @@ r600_print_texture_info(struct r600_texture *rtex, FILE 
*f)
(rtex->surface.flags & RADEON_SURF_SCANOUT) != 0);
 
if (rtex->fmask.size)
-   fprintf(f, "  FMask: offset=%u, size=%u, alignment=%u, 
pitch=%u, "
+   fprintf(f, "  FMask: offset=%u, size=%u, alignment=%u, 
pitch_in_pixels=%u, "
"bankh=%u, slice_tile_max=%u, tile_mode_index=%u\n",
rtex->fmask.offset, rtex->fmask.size, 
rtex->fmask.alignment,
-   rtex->fmask.pitch, rtex->fmask.bank_height,
+   rtex->fmask.pitch_in_pixels, rtex->fmask.bank_height,
rtex->fmask.slice_tile_max, 
rtex->fmask.tile_mode_index);
 
if (rtex->cmask.size)
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 209b940..5b71389 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1912,7 +1912,7 @@ static void si_initialize_color_surface(struct si_context 
*sctx,
color_attrib |= 
S_028C74_FMASK_BANK_HEIGHT(fmask_bankh);
}
if (sctx->b.chip_class >= CIK) {
-   color_pitch |= 
S_028C64_FMASK_TILE_MAX(rtex->fmask.pitch / 8 - 1);
+   color_pitch |= 
S_028C64_FMASK_TILE_MAX(rtex->fmask.pitch_in_pixels / 8 - 1);
}
}
}
@@ -2701,7 +2701,7 @@ si_create_sampler_view_custom(struct pipe_context *ctx,
   S_008F1C_TYPE(si_tex_dim(texture->target,
state->target, 
0));
view->fmask_state[4] = S_008F20_DEPTH(depth - 1) |
-  S_008F20_PITCH(tmp->fmask.pitch - 1);
+  
S_008F20_PITCH(tmp->fmask.pitch_in_pixels - 1);
view->fmask_state[5] = 
S_008F24_BASE_ARRAY(state->u.tex.first_layer) |
   S_008F24_LAST_ARRAY(last_layer);
view->fmask_state[6] = 0;

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


Mesa (master): gallium/aux/util: Trivial, we already have format use it

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: a5055e2f86e698a35da850378cd2eaa128df978a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a5055e2f86e698a35da850378cd2eaa128df978a

Author: Edward O'Callaghan 
Date:   Thu Dec  3 20:44:16 2015 +1100

gallium/aux/util: Trivial, we already have format use it

No need to dereference again, fixup for clarity.

Signed-off-by: Edward O'Callaghan 
Signed-off-by: Marek Olšák 

---

 src/gallium/auxiliary/util/u_surface.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_surface.c 
b/src/gallium/auxiliary/util/u_surface.c
index 70ed911..6aa44f9 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -397,7 +397,7 @@ util_clear_render_target(struct pipe_context *pipe,
  }
   }
   else {
- util_pack_color(color->f, dst->format, );
+ util_pack_color(color->f, format, );
   }
 
   util_fill_box(dst_map, dst->format,

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


Mesa (master): gallium/radeon: print more info about HTILE

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: a0bfb2798d243a4685d6ea32e9a7091fcec74700
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0bfb2798d243a4685d6ea32e9a7091fcec74700

Author: Marek Olšák 
Date:   Sun Nov 22 00:02:53 2015 +0100

gallium/radeon: print more info about HTILE

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeon/r600_pipe_common.h |8 
 src/gallium/drivers/radeon/r600_texture.c |   11 +--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index e4d292a..cd2dd09 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -190,6 +190,13 @@ struct r600_cmask_info {
unsigned base_address_reg;
 };
 
+struct r600_htile_info {
+   unsigned pitch;
+   unsigned height;
+   unsigned xalign;
+   unsigned yalign;
+};
+
 struct r600_texture {
struct r600_resourceresource;
 
@@ -210,6 +217,7 @@ struct r600_texture {
unsignedcolor_clear_value[2];
 
/* Depth buffer compression and fast clear. */
+   struct r600_htile_info  htile;
struct r600_resource*htile_buffer;
booldepth_cleared; /* if it was cleared at 
least once */
float   depth_clear_value;
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index edd1636..bf0358b 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -568,6 +568,11 @@ static unsigned r600_texture_get_htile_size(struct 
r600_common_screen *rscreen,
pipe_interleave_bytes = rscreen->tiling_info.group_bytes;
base_align = num_pipes * pipe_interleave_bytes;
 
+   rtex->htile.pitch = width;
+   rtex->htile.height = height;
+   rtex->htile.xalign = cl_width * 8;
+   rtex->htile.yalign = cl_height * 8;
+
return (util_max_layer(>resource.b.b, 0) + 1) *
align(slice_bytes, base_align);
 }
@@ -630,9 +635,11 @@ r600_print_texture_info(struct r600_texture *rtex, FILE *f)
rtex->cmask.yalign, rtex->cmask.slice_tile_max);
 
if (rtex->htile_buffer)
-   fprintf(f, "  HTile: size=%u, alignment=%u\n",
+   fprintf(f, "  HTile: size=%u, alignment=%u, pitch=%u, 
height=%u, "
+   "xalign=%u, yalign=%u\n",
rtex->htile_buffer->b.b.width0,
-   rtex->htile_buffer->buf->alignment);
+   rtex->htile_buffer->buf->alignment, rtex->htile.pitch,
+   rtex->htile.height, rtex->htile.xalign, 
rtex->htile.yalign);
 
if (rtex->dcc_buffer) {
fprintf(f, "  DCC: size=%u, alignment=%u\n",

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


Mesa (master): gallium/radeon: move printing texture info into a separate function

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 2d712d35c57900fc0aa0f1455381de48cdda0073
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d712d35c57900fc0aa0f1455381de48cdda0073

Author: Marek Olšák 
Date:   Wed Dec  2 20:20:57 2015 +0100

gallium/radeon: move printing texture info into a separate function

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeon/r600_texture.c |   92 -
 1 file changed, 51 insertions(+), 41 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 3e7f191..a64683c 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -585,6 +585,54 @@ static void r600_texture_allocate_htile(struct 
r600_common_screen *rscreen,
}
 }
 
+static void
+r600_print_texture_info(struct r600_texture *rtex, FILE *f)
+{
+   int i;
+
+   fprintf(f, "  Info: npix_x=%u, npix_y=%u, npix_z=%u, blk_w=%u, "
+   "blk_h=%u, blk_d=%u, array_size=%u, last_level=%u, "
+   "bpe=%u, nsamples=%u, flags=0x%x, %s\n",
+   rtex->surface.npix_x, rtex->surface.npix_y,
+   rtex->surface.npix_z, rtex->surface.blk_w,
+   rtex->surface.blk_h, rtex->surface.blk_d,
+   rtex->surface.array_size, rtex->surface.last_level,
+   rtex->surface.bpe, rtex->surface.nsamples,
+   rtex->surface.flags, 
util_format_short_name(rtex->resource.b.b.format));
+   for (i = 0; i <= rtex->surface.last_level; i++) {
+   fprintf(f, "  L %i: offset=%"PRIu64", slice_size=%"PRIu64", 
npix_x=%u, "
+   "npix_y=%u, npix_z=%u, nblk_x=%u, nblk_y=%u, "
+   "nblk_z=%u, pitch_bytes=%u, mode=%u\n",
+   i, rtex->surface.level[i].offset,
+   rtex->surface.level[i].slice_size,
+   u_minify(rtex->resource.b.b.width0, i),
+   u_minify(rtex->resource.b.b.height0, i),
+   u_minify(rtex->resource.b.b.depth0, i),
+   rtex->surface.level[i].nblk_x,
+   rtex->surface.level[i].nblk_y,
+   rtex->surface.level[i].nblk_z,
+   rtex->surface.level[i].pitch_bytes,
+   rtex->surface.level[i].mode);
+   }
+   if (rtex->surface.flags & RADEON_SURF_SBUFFER) {
+   for (i = 0; i <= rtex->surface.last_level; i++) {
+   fprintf(f, "  S %i: offset=%"PRIu64", 
slice_size=%"PRIu64", npix_x=%u, "
+   "npix_y=%u, npix_z=%u, nblk_x=%u, nblk_y=%u, "
+   "nblk_z=%u, pitch_bytes=%u, mode=%u\n",
+   i, rtex->surface.stencil_level[i].offset,
+   rtex->surface.stencil_level[i].slice_size,
+   u_minify(rtex->resource.b.b.width0, i),
+   u_minify(rtex->resource.b.b.height0, i),
+   u_minify(rtex->resource.b.b.depth0, i),
+   rtex->surface.stencil_level[i].nblk_x,
+   rtex->surface.stencil_level[i].nblk_y,
+   rtex->surface.stencil_level[i].nblk_z,
+   rtex->surface.stencil_level[i].pitch_bytes,
+   rtex->surface.stencil_level[i].mode);
+   }
+   }
+}
+
 /* Common processing for r600_texture_create and r600_texture_from_handle */
 static struct r600_texture *
 r600_texture_create_object(struct pipe_screen *screen,
@@ -678,48 +726,10 @@ r600_texture_create_object(struct pipe_screen *screen,
}
 
if (rscreen->debug_flags & DBG_TEX) {
-   printf("Texture: npix_x=%u, npix_y=%u, npix_z=%u, blk_w=%u, "
-  "blk_h=%u, blk_d=%u, array_size=%u, last_level=%u, "
-  "bpe=%u, nsamples=%u, flags=0x%x, %s\n",
-  rtex->surface.npix_x, rtex->surface.npix_y,
-  rtex->surface.npix_z, rtex->surface.blk_w,
-  rtex->surface.blk_h, rtex->surface.blk_d,
-  rtex->surface.array_size, rtex->surface.last_level,
-  rtex->surface.bpe, rtex->surface.nsamples,
-  rtex->surface.flags, 
util_format_short_name(base->format));
-   for (int i = 0; i <= rtex->surface.last_level; i++) {
-   printf("  L %i: offset=%"PRIu64", slice_size=%"PRIu64", 
npix_x=%u, "
-  "npix_y=%u, npix_z=%u, nblk_x=%u, nblk_y=%u, "
-  "nblk_z=%u, pitch_bytes=%u, mode=%u\n",
-  i, rtex->surface.level[i].offset,
-  rtex->surface.level[i].slice_size,
-  

Mesa (master): gallium/radeon: remove unused r600_texture::pitch_override

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: c60d49161e3496b9e64b99ecbbc7ec9a02b15a17
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c60d49161e3496b9e64b99ecbbc7ec9a02b15a17

Author: Marek Olšák 
Date:   Sat Nov 21 23:03:52 2015 +0100

gallium/radeon: remove unused r600_texture::pitch_override

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeon/r600_pipe_common.h |1 -
 src/gallium/drivers/radeon/r600_texture.c |1 -
 2 files changed, 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 25a7e41..9f2d50c 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -190,7 +190,6 @@ struct r600_texture {
struct r600_resourceresource;
 
unsignedsize;
-   unsignedpitch_override;
boolis_depth;
unsigneddirty_level_mask; /* each bit says if 
that mipmap is compressed */
unsignedstencil_dirty_level_mask; /* each bit 
says if that mipmap is compressed */
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 9b1d8bb..3e7f191 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -606,7 +606,6 @@ r600_texture_create_object(struct pipe_screen *screen,
resource->b.vtbl = _texture_vtbl;
pipe_reference_init(>b.b.reference, 1);
resource->b.b.screen = screen;
-   rtex->pitch_override = pitch_in_bytes_override;
 
/* don't include stencil-only formats which we don't support for 
rendering */
rtex->is_depth = 
util_format_has_depth(util_format_description(rtex->resource.b.b.format));

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


Mesa (master): gallium/radeon: print more information about textures

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 19eaceb6edc6cd3a9ae878c89f9deb79afae4dd6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=19eaceb6edc6cd3a9ae878c89f9deb79afae4dd6

Author: Marek Olšák 
Date:   Sat Nov 21 23:43:41 2015 +0100

gallium/radeon: print more information about textures

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeon/r600_texture.c |   48 ++---
 1 file changed, 43 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index a64683c..c787cfb 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -599,9 +599,44 @@ r600_print_texture_info(struct r600_texture *rtex, FILE *f)
rtex->surface.array_size, rtex->surface.last_level,
rtex->surface.bpe, rtex->surface.nsamples,
rtex->surface.flags, 
util_format_short_name(rtex->resource.b.b.format));
-   for (i = 0; i <= rtex->surface.last_level; i++) {
-   fprintf(f, "  L %i: offset=%"PRIu64", slice_size=%"PRIu64", 
npix_x=%u, "
-   "npix_y=%u, npix_z=%u, nblk_x=%u, nblk_y=%u, "
+
+   fprintf(f, "  Layout: size=%"PRIu64", alignment=%"PRIu64", bankw=%u, "
+   "bankh=%u, nbanks=%u, mtilea=%u, tilesplit=%u, pipeconfig=%u, 
scanout=%u\n",
+   rtex->surface.bo_size, rtex->surface.bo_alignment, 
rtex->surface.bankw,
+   rtex->surface.bankh, rtex->surface.num_banks, 
rtex->surface.mtilea,
+   rtex->surface.tile_split, rtex->surface.pipe_config,
+   (rtex->surface.flags & RADEON_SURF_SCANOUT) != 0);
+
+   if (rtex->fmask.size)
+   fprintf(f, "  FMask: offset=%u, size=%u, alignment=%u, 
pitch=%u, "
+   "bankh=%u, slice_tile_max=%u, tile_mode_index=%u\n",
+   rtex->fmask.offset, rtex->fmask.size, 
rtex->fmask.alignment,
+   rtex->fmask.pitch, rtex->fmask.bank_height,
+   rtex->fmask.slice_tile_max, 
rtex->fmask.tile_mode_index);
+
+   if (rtex->cmask.size)
+   fprintf(f, "  CMask: offset=%u, size=%u, alignment=%u, "
+   "slice_tile_max=%u\n",
+   rtex->cmask.offset, rtex->cmask.size, 
rtex->cmask.alignment,
+   rtex->cmask.slice_tile_max);
+
+   if (rtex->htile_buffer)
+   fprintf(f, "  HTile: size=%u, alignment=%u\n",
+   rtex->htile_buffer->b.b.width0,
+   rtex->htile_buffer->buf->alignment);
+
+   if (rtex->dcc_buffer) {
+   fprintf(f, "  DCC: size=%u, alignment=%u\n",
+   rtex->dcc_buffer->b.b.width0,
+   rtex->dcc_buffer->buf->alignment);
+   for (i = 0; i <= rtex->surface.last_level; i++)
+   fprintf(f, "  DCCLevel[%i]: offset=%"PRIu64"\n",
+   i, rtex->surface.level[i].dcc_offset);
+   }
+
+   for (i = 0; i <= rtex->surface.last_level; i++)
+   fprintf(f, "  Level[%i]: offset=%"PRIu64", 
slice_size=%"PRIu64", "
+   "npix_x=%u, npix_y=%u, npix_z=%u, nblk_x=%u, nblk_y=%u, 
"
"nblk_z=%u, pitch_bytes=%u, mode=%u\n",
i, rtex->surface.level[i].offset,
rtex->surface.level[i].slice_size,
@@ -613,10 +648,13 @@ r600_print_texture_info(struct r600_texture *rtex, FILE 
*f)
rtex->surface.level[i].nblk_z,
rtex->surface.level[i].pitch_bytes,
rtex->surface.level[i].mode);
-   }
+
if (rtex->surface.flags & RADEON_SURF_SBUFFER) {
for (i = 0; i <= rtex->surface.last_level; i++) {
-   fprintf(f, "  S %i: offset=%"PRIu64", 
slice_size=%"PRIu64", npix_x=%u, "
+   fprintf(f, "  StencilLayout: tilesplit=%u\n",
+   rtex->surface.stencil_tile_split);
+   fprintf(f, "  StencilLevel[%i]: offset=%"PRIu64", "
+   "slice_size=%"PRIu64", npix_x=%u, "
"npix_y=%u, npix_z=%u, nblk_x=%u, nblk_y=%u, "
"nblk_z=%u, pitch_bytes=%u, mode=%u\n",
i, rtex->surface.stencil_level[i].offset,

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


Mesa (master): automake: Fix typo in MSVC2008 compat flags.

2015-12-03 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 5294debfa4910e4259112ce3c6d5a8c1cd346ae9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5294debfa4910e4259112ce3c6d5a8c1cd346ae9

Author: Jose Fonseca 
Date:   Wed Dec  2 17:56:13 2015 +

automake: Fix typo in MSVC2008 compat flags.

It should be MSVC2008_COMPAT_CFLAGS and not MSVC2008_COMPAT_CXXFLAGS.

This is why the recent util_blitter breakage went unnoticed on autotools
builds.

Trivial.

---

 src/gallium/auxiliary/Makefile.am |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/Makefile.am 
b/src/gallium/auxiliary/Makefile.am
index ee296ce..7b026b5 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -9,7 +9,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/gallium/auxiliary/util \
$(GALLIUM_CFLAGS) \
$(VISIBILITY_CFLAGS) \
-   $(MSVC2008_COMPAT_CXXFLAGS)
+   $(MSVC2008_COMPAT_CFLAGS)
 
 AM_CXXFLAGS = \
$(VISIBILITY_CXXFLAGS) \

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


Mesa (master): gallium/radeon: print more info about CMASK

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 1cca259d9942e2f453c65e8d7f9f79fe9dc5f0a7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1cca259d9942e2f453c65e8d7f9f79fe9dc5f0a7

Author: Marek Olšák 
Date:   Sat Nov 21 23:54:27 2015 +0100

gallium/radeon: print more info about CMASK

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeon/r600_pipe_common.h |4 
 src/gallium/drivers/radeon/r600_texture.c |   15 ---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index b6009d2..e4d292a 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -182,6 +182,10 @@ struct r600_cmask_info {
unsigned offset;
unsigned size;
unsigned alignment;
+   unsigned pitch;
+   unsigned height;
+   unsigned xalign;
+   unsigned yalign;
unsigned slice_tile_max;
unsigned base_address_reg;
 };
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 37cac91..edd1636 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -380,6 +380,10 @@ void r600_texture_get_cmask_info(struct r600_common_screen 
*rscreen,
assert(macro_tile_width % 128 == 0);
assert(macro_tile_height % 128 == 0);
 
+   out->pitch = pitch_elements;
+   out->height = height;
+   out->xalign = macro_tile_width;
+   out->yalign = macro_tile_height;
out->slice_tile_max = ((pitch_elements * height) / (128*128)) - 1;
out->alignment = MAX2(256, base_align);
out->size = (util_max_layer(>resource.b.b, 0) + 1) *
@@ -425,6 +429,10 @@ static void si_texture_get_cmask_info(struct 
r600_common_screen *rscreen,
/* Each element of CMASK is a nibble. */
unsigned slice_bytes = slice_elements / 2;
 
+   out->pitch = width;
+   out->height = height;
+   out->xalign = cl_width * 8;
+   out->yalign = cl_height * 8;
out->slice_tile_max = (width * height) / (128*128);
if (out->slice_tile_max)
out->slice_tile_max -= 1;
@@ -615,10 +623,11 @@ r600_print_texture_info(struct r600_texture *rtex, FILE 
*f)
rtex->fmask.slice_tile_max, 
rtex->fmask.tile_mode_index);
 
if (rtex->cmask.size)
-   fprintf(f, "  CMask: offset=%u, size=%u, alignment=%u, "
-   "slice_tile_max=%u\n",
+   fprintf(f, "  CMask: offset=%u, size=%u, alignment=%u, 
pitch=%u, "
+   "height=%u, xalign=%u, yalign=%u, slice_tile_max=%u\n",
rtex->cmask.offset, rtex->cmask.size, 
rtex->cmask.alignment,
-   rtex->cmask.slice_tile_max);
+   rtex->cmask.pitch, rtex->cmask.height, 
rtex->cmask.xalign,
+   rtex->cmask.yalign, rtex->cmask.slice_tile_max);
 
if (rtex->htile_buffer)
fprintf(f, "  HTile: size=%u, alignment=%u\n",

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


Mesa (master): gallium/radeon: remove DBG_TEXMIP

2015-12-03 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 75d64698f0b0c906d611e69d9f8b118c35026efa
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=75d64698f0b0c906d611e69d9f8b118c35026efa

Author: Marek Olšák 
Date:   Sat Nov 21 22:35:04 2015 +0100

gallium/radeon: remove DBG_TEXMIP

we don't need 2 flags for dumping texture info

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeon/r600_pipe_common.c |1 -
 src/gallium/drivers/radeon/r600_pipe_common.h |2 +-
 src/gallium/drivers/radeon/r600_texture.c |3 +--
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index aaea8fe..27e1269 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -344,7 +344,6 @@ void r600_context_add_resource_size(struct pipe_context 
*ctx, struct pipe_resour
 static const struct debug_named_value common_debug_options[] = {
/* logging */
{ "tex", DBG_TEX, "Print texture info" },
-   { "texmip", DBG_TEXMIP, "Print texture info (mipmapped only)" },
{ "compute", DBG_COMPUTE, "Print compute info" },
{ "vm", DBG_VM, "Print virtual addresses when creating resources" },
{ "trace_cs", DBG_TRACE_CS, "Trace cs and write rlockup_.c file 
with faulty cs" },
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index a4f3fce..25a7e41 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -56,7 +56,7 @@
 /* Debug flags. */
 /* logging */
 #define DBG_TEX(1 << 0)
-#define DBG_TEXMIP (1 << 1)
+/* gap - reuse */
 #define DBG_COMPUTE(1 << 2)
 #define DBG_VM (1 << 3)
 #define DBG_TRACE_CS   (1 << 4)
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 3126cce..9b1d8bb 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -678,8 +678,7 @@ r600_texture_create_object(struct pipe_screen *screen,
base->nr_samples ? base->nr_samples : 1, 
util_format_short_name(base->format));
}
 
-   if (rscreen->debug_flags & DBG_TEX ||
-   (rtex->resource.b.b.last_level > 0 && rscreen->debug_flags & 
DBG_TEXMIP)) {
+   if (rscreen->debug_flags & DBG_TEX) {
printf("Texture: npix_x=%u, npix_y=%u, npix_z=%u, blk_w=%u, "
   "blk_h=%u, blk_d=%u, array_size=%u, last_level=%u, "
   "bpe=%u, nsamples=%u, flags=0x%x, %s\n",

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


Mesa (11.0): 42 new commits

2015-12-03 Thread Emil Velikov
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=40440385b6001947b60d1ec891329f445a89362e
Author: Emil Velikov 
Date:   Wed Sep 2 17:36:22 2015 +0100

mesa; add get-extra-pick-list.sh script into bin/

This is a very rudimentary script that checks if any of the applied
cherry-picks have been referenced (fixed?) by another patch. With the
latter either missing the stable tag or hasn't yet been picked.

Signed-off-by: Emil Velikov 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=92b62b8870687f96adf101bc26ce61801dc4b29f
Author: Ilia Mirkin 
Date:   Thu Sep 10 23:58:17 2015 -0400

nvc0/ir: start offset at texBindBase for txq, like regular texturing

Curiously this has no actual effect. I think it's because the first 8
textures are bound in multiple slots for some reason. However seems
prudent to use these the same way as regular texturing, esp in the case
where there are more than 8 textures bound.

Signed-off-by: Ilia Mirkin 
(cherry picked from commit 5877a594d54fdd2b3aa329f4d35b3491a7ee8a33)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93110

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8be58198cf480cbab05b5fa42101294cb8c1d667
Author: Leo Liu 
Date:   Fri Nov 20 12:07:52 2015 -0500

radeon/vce: disable Stoney VCE for 11.0

Signed-off-by: Leo Liu 
Cc: "11.0" 
Reviewed-by: Alex Deucher 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=14c43df99676f4462fd70b04a22a3b6dd81bafd9
Author: François Tigeot 
Date:   Tue Nov 17 18:54:01 2015 +0100

xmlconfig: Add support for DragonFly

Signed-off-by: Emil Velikov 
(cherry picked from commit 8a94ba5e0cb738c6b1a817ea54afc5816d2bb596)

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=83d4fa41039b678bb2f0d5c099f4b23030338041
Author: Daniel Stone 
Date:   Sat Nov 7 18:25:31 2015 +

egl/wayland: Ignore rects from SwapBuffersWithDamage

eglSwapBuffersWithDamage accepts damage-region rectangles to hint the
compositor that it only needs to redraw certain areas, which was passed
through the wl_surface_damage request, as designed.

Wayland also offers a buffer transformation interface, e.g. to allow
users to render pre-rotated buffers. Unfortunately, there is no way to
query buffer transforms, and the damage region was provided in surface,
rather than buffer, co-ordinate space.

Users could in theory account for this themselves, but EGL also requires
co-ordinates to be passed in GL/mathematical co-ordinate space, with an
inversion to Wayland's natural/scanout co-ordinate space, so
transformations other than a 180-degree rotation will fail as EGL
attempts to subtract the region from (its view of the) surface height.

Pending creation and acceptance of a wl_surface.buffer_damage request,
which will accept co-ordinates in buffer co-ordinate space, pessimise to
always sending full-surface damage.

bce64c6c provides the explanation for why we send maximum-range damage,
rather than the full size of the surface: in the presence of buffer
transformations, full-surface damage may not actually cover the entire
surface.

Signed-off-by: Daniel Stone 
Reviewed-by: Pekka Paalanen 
Reviewed-by: Jason Ekstrand 
(cherry picked from commit d1314de293e9e4a63c35f094c3893aaaed8580b4)

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1f1c5edaa8fc39d7582e505c446f7a8ae11c4f2
Author: Jonathan Gray 
Date:   Mon Nov 23 14:22:24 2015 +1100

automake: fix some occurrences of hardcoded -ldl and -lpthread

Correct some occurrences of -ldl and -lpthread to use
$(DLOPEN_LIBS) and $(PTHREAD_LIBS) respectively.

Signed-off-by: Jonathan Gray 
Cc: "11.0 11.1" 
Reviewed-by: Emil Velikov 
(cherry picked from commit 99cd60083518ad4465e3e29996168e8fa8a89fbb)
[Emil Velikov: drop the unneeded i965 hunk]
Signed-off-by: Emil Velikov 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5474b52bba196af38f3eaacfce69285e7d768dad
Author: Dave Airlie 
Date:   Tue Feb 24 14:09:40 2015 +1000

r600: workaround empty geom shader.

We need to emit at least one cut/emit in every
geometry shader, the easiest workaround it to
stick a single CUT at the top of each geom shader.

Reviewed-by: Marek Olšák 
Cc: "10.6 11.0 11.1" 

Mesa (master): mesa: accept TYPE_PUSH/POP_GROUP with glDebugMessageInsert

2015-12-03 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 66fea8bd9662c8fc62d87cafce89adc27e3172a2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=66fea8bd9662c8fc62d87cafce89adc27e3172a2

Author: Emil Velikov 
Date:   Thu Nov 26 00:36:15 2015 +

mesa: accept TYPE_PUSH/POP_GROUP with glDebugMessageInsert

These new (relative to ARB_debug_output) tokens, have been explicitly
separated from the existing ones in the spec text. With the reference
to glDebugMessageInsert was dropped.

At the same time, further down the spec says:
   "The value of  must be one of the values from Table 5.4"

... and these two are listed in Table 5.4.

The GL 4.3 and GLES 3.2 do not give any hints on the former
'definition', plus CTS requires that the tokens are valid values for
glDebugMessageInsert.

Signed-off-by: Emil Velikov 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/errors.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index a247000..9fa2c49 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -922,9 +922,9 @@ validate_params(struct gl_context *ctx, unsigned caller,
case GL_DEBUG_TYPE_PORTABILITY_ARB:
case GL_DEBUG_TYPE_OTHER_ARB:
case GL_DEBUG_TYPE_MARKER:
-  break;
case GL_DEBUG_TYPE_PUSH_GROUP:
case GL_DEBUG_TYPE_POP_GROUP:
+  break;
case GL_DONT_CARE:
   if (caller == CONTROL)
  break;

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


Mesa (master): mesa: errors: validate the length of null terminated string

2015-12-03 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 622186fbdf47e4c77aadba3e38567636ecbcccf5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=622186fbdf47e4c77aadba3e38567636ecbcccf5

Author: Emil Velikov 
Date:   Thu Nov 26 00:36:16 2015 +

mesa: errors: validate the length of null terminated string

We're about to rework the meaning of gl_debug_message::length to only
store the user provided data. Thus we should add an explicit validation
for null terminated strings.

Signed-off-by: Emil Velikov 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/errors.c |   20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 9fa2c49..a6294e3 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -960,8 +960,22 @@ error:
 
 
 static GLboolean
-validate_length(struct gl_context *ctx, const char *callerstr, GLsizei length)
+validate_length(struct gl_context *ctx, const char *callerstr, GLsizei length,
+const GLchar *buf)
 {
+
+   if (length < 0) {
+  GLsizei len = strlen(buf);
+
+  if (len >= MAX_DEBUG_MESSAGE_LENGTH) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+"%s(null terminated string length=%d, is not less than "
+"GL_MAX_DEBUG_MESSAGE_LENGTH=%d)", callerstr, len,
+MAX_DEBUG_MESSAGE_LENGTH);
+ return GL_FALSE;
+  }
+   }
+
if (length >= MAX_DEBUG_MESSAGE_LENGTH) {
   _mesa_error(ctx, GL_INVALID_VALUE,
  "%s(length=%d, which is not less than "
@@ -992,7 +1006,7 @@ _mesa_DebugMessageInsert(GLenum source, GLenum type, 
GLuint id,
 
if (length < 0)
   length = strlen(buf);
-   if (!validate_length(ctx, callerstr, length))
+   if (!validate_length(ctx, callerstr, length, buf))
   return; /* GL_INVALID_VALUE */
 
log_msg(ctx, gl_enum_to_debug_source(source),
@@ -1161,7 +1175,7 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei 
length,
 
if (length < 0)
   length = strlen(message);
-   if (!validate_length(ctx, callerstr, length))
+   if (!validate_length(ctx, callerstr, length, message))
   return; /* GL_INVALID_VALUE */
 
debug = _mesa_lock_debug_state(ctx);

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


Mesa (master): mesa: rework the meaning of gl_debug_message::length

2015-12-03 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 5a23f6bd8d8d26e0e75801df44cc228f15f9768e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a23f6bd8d8d26e0e75801df44cc228f15f9768e

Author: Emil Velikov 
Date:   Thu Nov 26 00:36:17 2015 +

mesa: rework the meaning of gl_debug_message::length

Currently it stores strlen(buf) whenever the user originally provided a
negative value for length.

Although I've not seen any explicit text in the spec, CTS requires that
the very same length (be that negative value or not) is returned back on
Pop.

So let's push down the length < 0 checks, tweak the meaning of
gl_debug_message::length and fix GetDebugMessageLog to add and count the
null terminators, as required by the spec.

v2: return correct total length in GetDebugMessageLog
v3: rebase (drop _mesa_shader_debug hunk).

Signed-off-by: Emil Velikov 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/errors.c |   40 
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index a6294e3..9e66109 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -76,6 +76,8 @@ struct gl_debug_message
enum mesa_debug_type type;
GLuint id;
enum mesa_debug_severity severity;
+   /* length as given by the user - if message was explicitly null terminated,
+* length can be negative */
GLsizei length;
GLcharARB *message;
 };
@@ -211,14 +213,19 @@ debug_message_store(struct gl_debug_message *msg,
 enum mesa_debug_severity severity,
 GLsizei len, const char *buf)
 {
+   GLsizei length = len;
+
assert(!msg->message && !msg->length);
 
-   msg->message = malloc(len+1);
+   if (length < 0)
+  length = strlen(buf);
+
+   msg->message = malloc(length+1);
if (msg->message) {
-  (void) strncpy(msg->message, buf, (size_t)len);
-  msg->message[len] = '\0';
+  (void) strncpy(msg->message, buf, (size_t)length);
+  msg->message[length] = '\0';
 
-  msg->length = len+1;
+  msg->length = len;
   msg->source = source;
   msg->type = type;
   msg->id = id;
@@ -229,7 +236,7 @@ debug_message_store(struct gl_debug_message *msg,
 
   /* malloc failed! */
   msg->message = out_of_memory;
-  msg->length = strlen(out_of_memory)+1;
+  msg->length = -1;
   msg->source = MESA_DEBUG_SOURCE_OTHER;
   msg->type = MESA_DEBUG_TYPE_ERROR;
   msg->id = oom_msg_id;
@@ -607,7 +614,7 @@ debug_log_message(struct gl_debug_state *debug,
GLint nextEmpty;
struct gl_debug_message *emptySlot;
 
-   assert(len >= 0 && len < MAX_DEBUG_MESSAGE_LENGTH);
+   assert(len < MAX_DEBUG_MESSAGE_LENGTH);
 
if (log->NumMessages == MAX_DEBUG_LOGGED_MESSAGES)
   return;
@@ -1004,8 +1011,6 @@ _mesa_DebugMessageInsert(GLenum source, GLenum type, 
GLuint id,
if (!validate_params(ctx, INSERT, callerstr, source, type, severity))
   return; /* GL_INVALID_ENUM */
 
-   if (length < 0)
-  length = strlen(buf);
if (!validate_length(ctx, callerstr, length, buf))
   return; /* GL_INVALID_VALUE */
 
@@ -1047,23 +1052,28 @@ _mesa_GetDebugMessageLog(GLuint count, GLsizei logSize, 
GLenum *sources,
 
for (ret = 0; ret < count; ret++) {
   const struct gl_debug_message *msg = debug_fetch_message(debug);
+  GLsizei len;
 
   if (!msg)
  break;
 
-  if (logSize < msg->length && messageLog != NULL)
+  len = msg->length;
+  if (len < 0)
+ len = strlen(msg->message);
+
+  if (logSize < len+1 && messageLog != NULL)
  break;
 
   if (messageLog) {
- assert(msg->message[msg->length-1] == '\0');
- (void) strncpy(messageLog, msg->message, (size_t)msg->length);
+ assert(msg->message[len] == '\0');
+ (void) strncpy(messageLog, msg->message, (size_t)len+1);
 
- messageLog += msg->length;
- logSize -= msg->length;
+ messageLog += len+1;
+ logSize -= len+1;
   }
 
   if (lengths)
- *lengths++ = msg->length;
+ *lengths++ = len+1;
   if (severities)
  *severities++ = debug_severity_enums[msg->severity];
   if (sources)
@@ -1173,8 +1183,6 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei 
length,
   return;
}
 
-   if (length < 0)
-  length = strlen(message);
if (!validate_length(ctx, callerstr, length, message))
   return; /* GL_INVALID_VALUE */
 

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


Mesa (master): mesa: return the correct value for GroupStackDepth

2015-12-03 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 078dd6a0b4135b5181eea538473fe53a9bc61223
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=078dd6a0b4135b5181eea538473fe53a9bc61223

Author: Emil Velikov 
Date:   Thu Nov 26 00:36:13 2015 +

mesa: return the correct value for GroupStackDepth

We already have one group (the default) as specified in the spec. So
lets return its size, rather than the index of the current group.

Signed-off-by: Emil Velikov 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/errors.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 88fc028..fda5a90 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -775,7 +775,7 @@ _mesa_get_debug_state_int(struct gl_context *ctx, GLenum 
pname)
  debug->Log.Messages[debug->Log.NextMessage].length : 0;
   break;
case GL_DEBUG_GROUP_STACK_DEPTH:
-  val = debug->CurrentGroup;
+  val = debug->CurrentGroup + 1;
   break;
default:
   assert(!"unknown debug output param");

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


Mesa (master): mesa: do not enable KHR_debug for ES 1.0

2015-12-03 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 1ca735701bb4d66c95d2ab64c0d838608f7c3f96
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ca735701bb4d66c95d2ab64c0d838608f7c3f96

Author: Emil Velikov 
Date:   Thu Nov 26 00:36:11 2015 +

mesa: do not enable KHR_debug for ES 1.0

The extension requires (cough implements) GetPointervKHR (alias of
GetPointerv) which in itself is available for ES 1.1 enabled mesa.

Anyone willing to fish around and implement it for ES 1.0 is more than
welcome to revert this commit. Until then lets restrict things.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93048
Signed-off-by: Emil Velikov 
Reviewed-by: Timothy Arceri 

---

 src/mapi/glapi/gen/KHR_debug.xml |   20 ++--
 src/mesa/main/extensions_table.h |2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/mapi/glapi/gen/KHR_debug.xml b/src/mapi/glapi/gen/KHR_debug.xml
index 431a788..50daba3 100644
--- a/src/mapi/glapi/gen/KHR_debug.xml
+++ b/src/mapi/glapi/gen/KHR_debug.xml
@@ -146,7 +146,7 @@
   
 
   
-  
+  
 
 
 
@@ -155,7 +155,7 @@
 
   
 
-  
+  
 
 
 
@@ -164,12 +164,12 @@
 
   
 
-  
+  
 
 
   
 
-  
+  
 
 
 
@@ -186,23 +186,23 @@
 
   
 
-  
+  
 
 
 
 
   
 
-  
+  
 
-  
+  
 
 
 
 
   
 
-  
+  
 
 
 
@@ -210,13 +210,13 @@
 
   
 
-  
+  
 
 
 
   
 
-  
+  
 
 
 
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 051d69a..52a4ed6 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -258,7 +258,7 @@ EXT(INGR_blend_func_separate, 
EXT_blend_func_separate
 EXT(INTEL_performance_query , INTEL_performance_query  
  , GLL, GLC,  x , ES2, 2013)
 
 EXT(KHR_context_flush_control   , dummy_true   
  , GLL, GLC,  x , ES2, 2014)
-EXT(KHR_debug   , dummy_true   
  , GLL, GLC, ES1, ES2, 2012)
+EXT(KHR_debug   , dummy_true   
  , GLL, GLC,  11, ES2, 2012)
 EXT(KHR_texture_compression_astc_hdr, KHR_texture_compression_astc_hdr 
  , GLL, GLC,  x , ES2, 2012)
 EXT(KHR_texture_compression_astc_ldr, KHR_texture_compression_astc_ldr 
  , GLL, GLC,  x , ES2, 2012)
 

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


Mesa (master): mesa: add SEVERITY_NOTIFICATION to default state

2015-12-03 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 53be28107b44200a59c678c5d2234efeb48d0b35
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=53be28107b44200a59c678c5d2234efeb48d0b35

Author: Emil Velikov 
Date:   Thu Nov 26 00:36:14 2015 +

mesa: add SEVERITY_NOTIFICATION to default state

As per the spec quote:

"All messages are initially enabled unless their assigned severity
is DEBUG_SEVERITY_LOW"

We already had MEDIUM and HIGH set, let's toggle NOTIFICATION as well.

Signed-off-by: Emil Velikov 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/errors.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index fda5a90..a247000 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -243,8 +243,9 @@ debug_namespace_init(struct gl_debug_namespace *ns)
make_empty_list(>Elements);
 
/* Enable all the messages with severity HIGH or MEDIUM by default */
-   ns->DefaultState = (1 << MESA_DEBUG_SEVERITY_HIGH) |
-  (1 << MESA_DEBUG_SEVERITY_MEDIUM);
+   ns->DefaultState = (1 << MESA_DEBUG_SEVERITY_MEDIUM ) |
+  (1 << MESA_DEBUG_SEVERITY_HIGH) |
+  (1 << MESA_DEBUG_SEVERITY_NOTIFICATION);
 }
 
 static void

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


Mesa (master): mesa: rename GroupStackDepth to CurrentGroup

2015-12-03 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: f39954bf7cf09199a1cccb71e0e858c0b2054c6d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f39954bf7cf09199a1cccb71e0e858c0b2054c6d

Author: Emil Velikov 
Date:   Thu Nov 26 00:36:12 2015 +

mesa: rename GroupStackDepth to CurrentGroup

The variable is used as the actual index, rather than the size of the
group stack - rename it to reflect that.

Suggested-by: Ilia Mirkin 
Signed-off-by: Emil Velikov 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/errors.c |   32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 85e5bbd..88fc028 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -98,7 +98,7 @@ struct gl_debug_state
 
struct gl_debug_group *Groups[MAX_DEBUG_GROUP_STACK_DEPTH];
struct gl_debug_message GroupMessages[MAX_DEBUG_GROUP_STACK_DEPTH];
-   GLint GroupStackDepth;
+   GLint CurrentGroup; // GroupStackDepth - 1
 
struct gl_debug_log Log;
 };
@@ -422,7 +422,7 @@ debug_create(void)
 static bool
 debug_is_group_read_only(const struct gl_debug_state *debug)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
return (gstack > 0 && debug->Groups[gstack] == debug->Groups[gstack - 1]);
 }
 
@@ -432,7 +432,7 @@ debug_is_group_read_only(const struct gl_debug_state *debug)
 static bool
 debug_make_group_writable(struct gl_debug_state *debug)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
const struct gl_debug_group *src = debug->Groups[gstack];
struct gl_debug_group *dst;
int s, t;
@@ -472,7 +472,7 @@ debug_make_group_writable(struct gl_debug_state *debug)
 static void
 debug_clear_group(struct gl_debug_state *debug)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
 
if (!debug_is_group_read_only(debug)) {
   struct gl_debug_group *grp = debug->Groups[gstack];
@@ -496,9 +496,9 @@ debug_clear_group(struct gl_debug_state *debug)
 static void
 debug_destroy(struct gl_debug_state *debug)
 {
-   while (debug->GroupStackDepth > 0) {
+   while (debug->CurrentGroup > 0) {
   debug_clear_group(debug);
-  debug->GroupStackDepth--;
+  debug->CurrentGroup--;
}
 
debug_clear_group(debug);
@@ -514,7 +514,7 @@ debug_set_message_enable(struct gl_debug_state *debug,
  enum mesa_debug_type type,
  GLuint id, GLboolean enabled)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
struct gl_debug_namespace *ns;
 
debug_make_group_writable(debug);
@@ -541,7 +541,7 @@ debug_set_message_enable_all(struct gl_debug_state *debug,
  enum mesa_debug_severity severity,
  GLboolean enabled)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
int s, t, smax, tmax;
 
if (source == MESA_DEBUG_SOURCE_COUNT) {
@@ -579,7 +579,7 @@ debug_is_message_enabled(const struct gl_debug_state *debug,
  GLuint id,
  enum mesa_debug_severity severity)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
struct gl_debug_group *grp = debug->Groups[gstack];
struct gl_debug_namespace *nspace = >Namespaces[source][type];
 
@@ -657,24 +657,24 @@ debug_delete_messages(struct gl_debug_state *debug, int 
count)
 static struct gl_debug_message *
 debug_get_group_message(struct gl_debug_state *debug)
 {
-   return >GroupMessages[debug->GroupStackDepth];
+   return >GroupMessages[debug->CurrentGroup];
 }
 
 static void
 debug_push_group(struct gl_debug_state *debug)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
 
/* just point to the previous stack */
debug->Groups[gstack + 1] = debug->Groups[gstack];
-   debug->GroupStackDepth++;
+   debug->CurrentGroup++;
 }
 
 static void
 debug_pop_group(struct gl_debug_state *debug)
 {
debug_clear_group(debug);
-   debug->GroupStackDepth--;
+   debug->CurrentGroup--;
 }
 
 
@@ -775,7 +775,7 @@ _mesa_get_debug_state_int(struct gl_context *ctx, GLenum 
pname)
  debug->Log.Messages[debug->Log.NextMessage].length : 0;
   break;
case GL_DEBUG_GROUP_STACK_DEPTH:
-  val = debug->GroupStackDepth;
+  val = debug->CurrentGroup;
   break;
default:
   assert(!"unknown debug output param");
@@ -1167,7 +1167,7 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei 
length,
if (!debug)
   return;
 
-   if (debug->GroupStackDepth >= MAX_DEBUG_GROUP_STACK_DEPTH-1) {
+   if (debug->CurrentGroup >= MAX_DEBUG_GROUP_STACK_DEPTH-1) {
   _mesa_unlock_debug_state(ctx);
  

Mesa (master): glapi: add GetPointervKHR to the ES dispatch

2015-12-03 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: f53f9eb8d495a318bc8e6fd758df4ba4074599ef
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f53f9eb8d495a318bc8e6fd758df4ba4074599ef

Author: Emil Velikov 
Date:   Thu Nov 26 00:36:10 2015 +

glapi: add GetPointervKHR to the ES dispatch

The KHR_debug extension implements this.

Strictly speaking it could be used with ES 1.0, although as the original
function is available on ES 1.1, I'm inclined to lift the KHR_debug
requirement to ES 1.1.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93048
Signed-off-by: Emil Velikov 
Reviewed-by: Timothy Arceri 

---

 src/mapi/glapi/gen/KHR_debug.xml |5 +
 1 file changed, 5 insertions(+)

diff --git a/src/mapi/glapi/gen/KHR_debug.xml b/src/mapi/glapi/gen/KHR_debug.xml
index e4a5a5b..431a788 100644
--- a/src/mapi/glapi/gen/KHR_debug.xml
+++ b/src/mapi/glapi/gen/KHR_debug.xml
@@ -181,6 +181,11 @@
 
   
 
+  
+
+
+  
+
   
 
 

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


Mesa (master): vc4: Add the RCL to CL debug dumping when in simulator mode.

2015-12-03 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 83e65ca8314ab2cee65ff169d0ae296ee9cd2c5e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=83e65ca8314ab2cee65ff169d0ae296ee9cd2c5e

Author: Eric Anholt 
Date:   Sat Nov 21 19:10:02 2015 -0800

vc4: Add the RCL to CL debug dumping when in simulator mode.

We can't dump it in the real driver, since the kernel doesn't give us a
handle to it (except after a GPU hang, using a root ioctl).  In the
simulator we can.

---

 src/gallium/drivers/vc4/vc4_simulator.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/drivers/vc4/vc4_simulator.c 
b/src/gallium/drivers/vc4/vc4_simulator.c
index 10dabd0..4b1df92 100644
--- a/src/gallium/drivers/vc4/vc4_simulator.c
+++ b/src/gallium/drivers/vc4/vc4_simulator.c
@@ -177,6 +177,12 @@ vc4_simulator_flush(struct vc4_context *vc4, struct 
drm_vc4_submit_cl *args)
 if (ret)
 return ret;
 
+if (vc4_debug & VC4_DEBUG_CL) {
+fprintf(stderr, "RCL:\n");
+vc4_dump_cl(screen->simulator_mem_base + exec.ct1ca,
+exec.ct1ea - exec.ct1ca, true);
+}
+
 if (exec.ct0ca != exec.ct0ea) {
 int bfc = simpenrose_do_binning(exec.ct0ca, exec.ct0ea);
 if (bfc != 1) {

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


Mesa (master): draw: fix clipping of layer/vp index outputs

2015-12-03 Thread Roland Scheidegger
Module: Mesa
Branch: master
Commit: 51140f452a8623c9b912126b027f0f1819e72531
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=51140f452a8623c9b912126b027f0f1819e72531

Author: Roland Scheidegger 
Date:   Fri Dec  4 03:42:02 2015 +0100

draw: fix clipping of layer/vp index outputs

This was just plain broken. It used always the value from v0 (for vp_index)
but would pass the value from the provoking vertex to later stages - but only
if there was a corresponding fs input, otherwise the layer/vp index would get
lost completely (as it would try to interpolate the (unsigned) values as
floats).
So, make it obey provoking vertex rules (drivers relying on draw will need to
do the same). And make sure that the default interpolation mode (when no
corresponding fs input is found) for them is constant.
Also, change the code a bit so constant inputs aren't interpolated then
copied over later.

Fixes the new piglit test gl-layer-render-clipped.

v2: more consistent whitespaces fixes for function defs, and more tab killing
(overall still not quite right however).

Reviewed-by: Brian Paul 
Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/draw/draw_pipe_clip.c |  325 +++
 1 file changed, 186 insertions(+), 139 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c 
b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index c22758b..f2b56b0 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -58,19 +58,24 @@
 struct clip_stage {
struct draw_stage stage;  /**< base class */
 
-   /* List of the attributes to be flatshaded. */
-   uint num_flat_attribs;
-   uint flat_attribs[PIPE_MAX_SHADER_OUTPUTS];
-
-   /* Mask of attributes in noperspective mode */
-   boolean noperspective_attribs[PIPE_MAX_SHADER_OUTPUTS];
+   unsigned pos_attr;
+
+   /* List of the attributes to be constant interpolated. */
+   uint num_const_attribs;
+   uint8_t const_attribs[PIPE_MAX_SHADER_OUTPUTS];
+   /* List of the attributes to be linear interpolated. */
+   uint num_linear_attribs;
+   uint8_t linear_attribs[PIPE_MAX_SHADER_OUTPUTS];
+   /* List of the attributes to be perspective interpolated. */
+   uint num_perspect_attribs;
+   uint8_t perspect_attribs[PIPE_MAX_SHADER_OUTPUTS];
 
float (*plane)[4];
 };
 
 
 /** Cast wrapper */
-static inline struct clip_stage *clip_stage( struct draw_stage *stage )
+static inline struct clip_stage *clip_stage(struct draw_stage *stage)
 {
return (struct clip_stage *)stage;
 }
@@ -96,10 +101,10 @@ draw_viewport_index(struct draw_context *draw,
 
 /* All attributes are float[4], so this is easy:
  */
-static void interp_attr( float dst[4],
-float t,
-const float in[4],
-const float out[4] )
+static void interp_attr(float dst[4],
+float t,
+const float in[4],
+const float out[4])
 {
dst[0] = LINTERP( t, out[0], in[0] );
dst[1] = LINTERP( t, out[1], in[1] );
@@ -111,30 +116,28 @@ static void interp_attr( float dst[4],
 /**
  * Copy flat shaded attributes src vertex to dst vertex.
  */
-static void copy_flat( struct draw_stage *stage,
-   struct vertex_header *dst,
-   const struct vertex_header *src )
+static void copy_flat(struct draw_stage *stage,
+  struct vertex_header *dst,
+  const struct vertex_header *src)
 {
const struct clip_stage *clipper = clip_stage(stage);
uint i;
-   for (i = 0; i < clipper->num_flat_attribs; i++) {
-  const uint attr = clipper->flat_attribs[i];
+   for (i = 0; i < clipper->num_const_attribs; i++) {
+  const uint attr = clipper->const_attribs[i];
   COPY_4FV(dst->data[attr], src->data[attr]);
}
 }
 
 /* Interpolate between two vertices to produce a third.  
  */
-static void interp( const struct clip_stage *clip,
-   struct vertex_header *dst,
-   float t,
-   const struct vertex_header *out, 
-   const struct vertex_header *in,
-unsigned viewport_index )
+static void interp(const struct clip_stage *clip,
+   struct vertex_header *dst,
+   float t,
+   const struct vertex_header *out,
+   const struct vertex_header *in,
+   unsigned viewport_index)
 {
-   const unsigned nr_attrs = draw_num_shader_outputs(clip->stage.draw);
-   const unsigned pos_attr = 
draw_current_shader_position_output(clip->stage.draw);
-   const unsigned clip_attr = 
draw_current_shader_clipvertex_output(clip->stage.draw);
+   const unsigned pos_attr = clip->pos_attr;
unsigned j;
float t_nopersp;
 
@@ -168,6 +171,13 @@ static void interp( const struct clip_stage *clip,
   dst->data[pos_attr][3] = oow;

Mesa (master): llvmpipe: use provoking vertex for layer/viewport

2015-12-03 Thread Roland Scheidegger
Module: Mesa
Branch: master
Commit: ddaf8d7b10c57cc44ed0d69554e54b3573007315
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddaf8d7b10c57cc44ed0d69554e54b3573007315

Author: Roland Scheidegger 
Date:   Thu Dec  3 01:18:14 2015 +0100

llvmpipe: use provoking vertex for layer/viewport

d3d10 actually requires using provoking (first) vertex. GL is happy with
any vertex (as long as we say it's undefined in the corresponding queries).
Up to now we actually used vertex 0 for viewport index, and vertex 1 for
layer (for tris), which really didn't make sense (probably a typo). Also,$
since we reorder vertices of clockwise triangle, that actually meant we used
a different vertex depending if the traingle was cw or ccw (still ok by gl).
However, it should be consistent with what draw (clip) does, and using
provoking vertex seems like the sensible choice (draw clip will be fixed
next as it is totally broken there).
While here, also use the correct viewport always even when not needed
in setup (we pass it down to jit fragment shader it might be needed there
for getting correct near/far depth values).

No piglit changes.

Reviewed-by: Brian Paul 
Reviewed-by: Jose Fonseca 

---

 src/gallium/drivers/llvmpipe/lp_setup_line.c |   25 -
 src/gallium/drivers/llvmpipe/lp_setup_tri.c  |   24 
 2 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c 
b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index a190254..fac1cd6 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
@@ -311,6 +311,7 @@ try_setup_line( struct lp_setup_context *setup,
float y2diff;
float dx, dy;
float area;
+   const float (*pv)[4];
 
boolean draw_start;
boolean draw_end;
@@ -320,22 +321,28 @@ try_setup_line( struct lp_setup_context *setup,
if (0)
   print_line(setup, v1, v2);
 
-   if (setup->scissor_test) {
-  nr_planes = 8;
-  if (setup->viewport_index_slot > 0) {
- unsigned *udata = (unsigned*)v1[setup->viewport_index_slot];
- viewport_index = lp_clamp_viewport_idx(*udata);
-  }
+   if (setup->flatshade_first) {
+  pv = v1;
}
else {
-  nr_planes = 4;
+  pv = v2;
+   }
+   if (setup->viewport_index_slot > 0) {
+  unsigned *udata = (unsigned*)pv[setup->viewport_index_slot];
+  viewport_index = lp_clamp_viewport_idx(*udata);
}
-
if (setup->layer_slot > 0) {
-  layer = *(unsigned*)v1[setup->layer_slot];
+  layer = *(unsigned*)pv[setup->layer_slot];
   layer = MIN2(layer, scene->fb_max_layer);
}
 
+   if (setup->scissor_test) {
+  nr_planes = 8;
+   }
+   else {
+  nr_planes = 4;
+   }
+
dx = v1[0][0] - v2[0][0];
dy = v1[0][1] - v2[0][1];
area = (dx * dx  + dy * dy);
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c 
b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 98a9d4b..2c9d43f 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -276,6 +276,7 @@ do_triangle_ccw(struct lp_setup_context *setup,
int nr_planes = 3;
unsigned viewport_index = 0;
unsigned layer = 0;
+   const float (*pv)[4];
 
/* Area should always be positive here */
assert(position->area > 0);
@@ -283,21 +284,28 @@ do_triangle_ccw(struct lp_setup_context *setup,
if (0)
   lp_setup_print_triangle(setup, v0, v1, v2);
 
-   if (setup->scissor_test) {
-  nr_planes = 7;
-  if (setup->viewport_index_slot > 0) {
- unsigned *udata = (unsigned*)v0[setup->viewport_index_slot];
- viewport_index = lp_clamp_viewport_idx(*udata);
-  }
+   if (setup->flatshade_first) {
+  pv = v0;
}
else {
-  nr_planes = 3;
+  pv = v2;
+   }
+   if (setup->viewport_index_slot > 0) {
+  unsigned *udata = (unsigned*)pv[setup->viewport_index_slot];
+  viewport_index = lp_clamp_viewport_idx(*udata);
}
if (setup->layer_slot > 0) {
-  layer = *(unsigned*)v1[setup->layer_slot];
+  layer = *(unsigned*)pv[setup->layer_slot];
   layer = MIN2(layer, scene->fb_max_layer);
}
 
+   if (setup->scissor_test) {
+  nr_planes = 7;
+   }
+   else {
+  nr_planes = 3;
+   }
+
/* Bounding rectangle (in pixels) */
{
   /* Yes this is necessary to accurately calculate bounding boxes

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


Mesa (master): softpipe: use provoking vertex for layer

2015-12-03 Thread Roland Scheidegger
Module: Mesa
Branch: master
Commit: 5ea5b169e95358ec47615f43941e6949d4a7ad43
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ea5b169e95358ec47615f43941e6949d4a7ad43

Author: Roland Scheidegger 
Date:   Thu Dec  3 01:19:52 2015 +0100

softpipe: use provoking vertex for layer

Same as for llvmpipe, albeit softpipe only really handles multiple layers,
not multiple viewports/scissors.

Reviewed-by: Brian Paul 
Reviewed-by: Jose Fonseca 

---

 src/gallium/drivers/softpipe/sp_setup.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_setup.c 
b/src/gallium/drivers/softpipe/sp_setup.c
index ff3cb9f..973803e 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -840,7 +840,7 @@ sp_setup_tri(struct setup_context *setup,
setup->span.right[1] = 0;
/*   setup->span.z_mode = tri_z_mode( setup->ctx ); */
if (setup->softpipe->layer_slot > 0) {
-  layer = *(unsigned *)v1[setup->softpipe->layer_slot];
+  layer = *(unsigned *)setup->vprovoke[setup->softpipe->layer_slot];
   layer = MIN2(layer, setup->max_layer);
}
setup->quad[0].input.layer = layer;
@@ -1127,7 +1127,7 @@ sp_setup_line(struct setup_context *setup,
setup->quad[0].input.x0 = setup->quad[0].input.y0 = -1;
setup->quad[0].inout.mask = 0x0;
if (setup->softpipe->layer_slot > 0) {
-  layer = *(unsigned *)v1[setup->softpipe->layer_slot];
+  layer = *(unsigned *)setup->vprovoke[setup->softpipe->layer_slot];
   layer = MIN2(layer, setup->max_layer);
}
setup->quad[0].input.layer = layer;

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


Mesa (master): mesa/version: Update gl_extensions:: Version during version override

2015-12-03 Thread Nanley Chery
Module: Mesa
Branch: master
Commit: 808e75279618d887daeee8ab2025e39c863234ac
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=808e75279618d887daeee8ab2025e39c863234ac

Author: Nanley Chery 
Date:   Tue Dec  1 10:42:21 2015 -0800

mesa/version: Update gl_extensions::Version during version override

Commit a16ffb743ced9fde80b2485dfc2d86ae74e86f25, which introduced
gl_extensions::Version, updates the field when the context version
is computed and when entering/exiting meta. Update this field when
the version is overridden as well.

Cc: "11.1" 
Signed-off-by: Nanley Chery 
Reviewed-by: Marta Lofstedt 

---

 src/mesa/main/version.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 314b26d..e92bb11 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -199,6 +199,7 @@ _mesa_override_gl_version(struct gl_context *ctx)
* "
*/
   create_version_string(ctx, _mesa_is_gles(ctx) ? "OpenGL ES " : "");
+  ctx->Extensions.Version = ctx->Version;
}
 }
 

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