Re: [Mesa-dev] [PATCH 14/18] i965/fs: Don't assign high regs for CS termination send

2015-03-16 Thread Kenneth Graunke
On Saturday, March 14, 2015 09:54:24 PM Jordan Justen wrote:
 Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
 ---
  src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
 index 1f30a19..fe3406c 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
 @@ -598,7 +598,7 @@ fs_visitor::assign_regs(bool allow_spilling)
* We could just do something high.  Instead, we just pick the
* highest register that works.
*/
 - if (inst-eot) {
 + if (stage != MESA_SHADER_COMPUTE  inst-eot) {
  int size = alloc.sizes[inst-src[0].reg];
  int reg = screen-wm_reg_sets[rsi].class_to_ra_reg_range[size] - 
 1;
  ra_set_node_reg(g, inst-src[0].reg, reg);
 

This looks wrong to me - the ISA reference for the SEND instruction
says:

A root thread originated from the media (generic) pipeline must terminate
 with a send instruction with message to the Thread Spawner unit. A
 child thread should also terminate with a send to TS. [...]

 The send with EOT should use register space R112-R127 for src.

which implies to me that this restriction is for any SEND with EOT,
including those sent to the thread spawner for compute.

Is there a particular need for this patch, or were you just trying to
remove unnecessary restrictions?


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 12/23] mesa: refactor GetFragDataLocation

2015-03-16 Thread Ilia Mirkin
On Fri, Mar 13, 2015 at 4:37 AM, Tapani Pälli tapani.pa...@intel.com wrote:
 Use program_resource_location to fetch location.

 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/mesa/main/shader_query.cpp | 28 ++--
  1 file changed, 6 insertions(+), 22 deletions(-)

 diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
 index 7e8cf9c..f576972 100644
 --- a/src/mesa/main/shader_query.cpp
 +++ b/src/mesa/main/shader_query.cpp
 @@ -473,31 +473,15 @@ _mesa_GetFragDataLocation(GLuint program, const GLchar 
 *name)
 if (shProg-_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL)
return -1;

 -   exec_list *ir = shProg-_LinkedShaders[MESA_SHADER_FRAGMENT]-ir;
 -   foreach_in_list(ir_instruction, node, ir) {
 -  const ir_variable *const var = node-as_variable();
 -
 -  /* The extra check against FRAG_RESULT_DATA0 is because
 -   * glGetFragDataLocation cannot be used on conventional attributes.
 -   *
 -   * From page 95 of the OpenGL 3.0 spec:
 -   *
 -   * If name is not an active attribute, if name is a conventional
 -   * attribute, or if an error occurs, -1 will be returned.
 -   */
 -  if (var == NULL
 - || var-data.mode != ir_var_shader_out
 - || var-data.location == -1
 - || var-data.location  FRAG_RESULT_DATA0)
 -continue;
 +   struct gl_program_resource *res =
 +  _mesa_program_resource_find_name(shProg, GL_PROGRAM_OUTPUT, name);

 -  int index = get_matching_index(var, (const char *) name);
 +   if (!res)
 +  return -1;

 -  if (index = 0)
 - return var-data.location + index - FRAG_RESULT_DATA0;
 -   }
 +   GLint loc = program_resource_location(shProg, res, name);

 -   return -1;
 +   return (loc = 0) ? loc : -1;

Same question about program_resource_location here. Either way,

Reviewed-by: Ilia Mirkin imir...@alum.mit.edu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] main: Add entry point for GetNamedBufferPointerv.

2015-03-16 Thread Laura Ekstrand
v3: Review from Fredrik Hoglund
   -Split cosmetic refactor of GetBufferPointerv out into a separate commit
---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  6 ++
 src/mesa/main/bufferobj.c  | 20 
 src/mesa/main/bufferobj.h  |  4 
 src/mesa/main/tests/dispatch_sanity.cpp|  1 +
 4 files changed, 31 insertions(+)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml 
b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index cb9f285..8bcbb08 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -98,6 +98,12 @@
   param name=params type=GLint64 * /
/function
 
+   function name=GetNamedBufferPointerv offset=assign
+  param name=buffer type=GLuint /
+  param name=pname type=GLenum /
+  param name=params type=GLvoid ** /
+   /function
+
!-- Texture object functions --
 
function name=CreateTextures offset=assign
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 4c2cdf4..2811604 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2066,6 +2066,26 @@ _mesa_GetBufferPointerv(GLenum target, GLenum pname, 
GLvoid **params)
*params = bufObj-Mappings[MAP_USER].Pointer;
 }
 
+void GLAPIENTRY
+_mesa_GetNamedBufferPointerv(GLuint buffer, GLenum pname, GLvoid **params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_buffer_object *bufObj;
+
+   if (pname != GL_BUFFER_MAP_POINTER) {
+  _mesa_error(ctx, GL_INVALID_ENUM, glGetNamedBufferPointerv(pname != 
+  GL_BUFFER_MAP_POINTER));
+  return;
+   }
+
+   bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
+   glGetNamedBufferPointerv);
+   if (!bufObj)
+  return;
+
+   *params = bufObj-Mappings[MAP_USER].Pointer;
+}
+
 
 void
 _mesa_copy_buffer_sub_data(struct gl_context *ctx,
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 6b29ce7..eee04fe 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -278,6 +278,10 @@ void GLAPIENTRY
 _mesa_GetBufferPointerv(GLenum target, GLenum pname, GLvoid **params);
 
 void GLAPIENTRY
+_mesa_GetNamedBufferPointerv(GLuint buffer, GLenum pname, GLvoid **params);
+
+
+void GLAPIENTRY
 _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
 GLintptr readOffset, GLintptr writeOffset,
 GLsizeiptr size);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index 336c41c..01b73a6 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -966,6 +966,7 @@ const struct function gl_core_functions_possible[] = {
{ glFlushMappedNamedBufferRange, 45, -1 },
{ glGetNamedBufferParameteriv, 45, -1 },
{ glGetNamedBufferParameteri64v, 45, -1 },
+   { glGetNamedBufferPointerv, 45, -1 },
{ glCreateTextures, 45, -1 },
{ glTextureStorage1D, 45, -1 },
{ glTextureStorage2D, 45, -1 },
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH 1/2] i965/fs: Force promotion of src0 immediates.

2015-03-16 Thread Kenneth Graunke
On Monday, March 16, 2015 03:16:32 PM Matt Turner wrote:
 On Mon, Mar 16, 2015 at 2:44 PM, Kenneth Graunke kenn...@whitecape.org 
 wrote:
  On Monday, March 16, 2015 07:54:45 AM Tapani Pälli wrote:
  My first attempt to fix the bug 89569 was to add check in combine
  constants but for some reason I did not get it to work. One reason is
  that inst-sources cannot be trusted
 
  I certainly hope we can trust it.  If it's wrong, we need to fix that.
 
 We don't bother changing inst-sources when we convert a MUL dst, x,
 0.0 into a MOV, but we do set its last source to reg_undef so it's
 safe.
 
 We could update inst-sources. It would at least let us skip a few
 iterations. It'd also make dump_instructions() output a bit prettier.

Ah.  Yeah, we should update that.


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] nir/peephole_select: Rename are_all_move_to_phi and use a switch

2015-03-16 Thread Jason Ekstrand
---
 src/glsl/nir/nir_opt_peephole_select.c | 54 +++---
 1 file changed, 30 insertions(+), 24 deletions(-)

diff --git a/src/glsl/nir/nir_opt_peephole_select.c 
b/src/glsl/nir/nir_opt_peephole_select.c
index ab08f28..8064f40 100644
--- a/src/glsl/nir/nir_opt_peephole_select.c
+++ b/src/glsl/nir/nir_opt_peephole_select.c
@@ -52,36 +52,41 @@ struct peephole_select_state {
 };
 
 static bool
-are_all_move_to_phi(nir_block *block)
+block_check_for_allowed_instrs(nir_block *block)
 {
nir_foreach_instr(block, instr) {
-  if (instr-type != nir_instr_type_alu)
- return false;
+  switch (instr-type) {
+  case nir_instr_type_alu: {
+ /* It must be a move operation */
+ nir_alu_instr *mov = nir_instr_as_alu(instr);
+ if (mov-op != nir_op_fmov  mov-op != nir_op_imov)
+return false;
 
-  /* It must be a move operation */
-  nir_alu_instr *mov = nir_instr_as_alu(instr);
-  if (mov-op != nir_op_fmov  mov-op != nir_op_imov)
- return false;
+ /* Can't handle saturate */
+ if (mov-dest.saturate)
+return false;
 
-  /* Can't handle saturate */
-  if (mov-dest.saturate)
- return false;
+ /* It must be SSA */
+ if (!mov-dest.dest.is_ssa)
+return false;
 
-  /* It must be SSA */
-  if (!mov-dest.dest.is_ssa)
- return false;
+ /* It cannot have any if-uses */
+ if (mov-dest.dest.ssa.if_uses-entries != 0)
+return false;
 
-  /* It cannot have any if-uses */
-  if (mov-dest.dest.ssa.if_uses-entries != 0)
- return false;
+ /* The only uses of this definition must be phi's in the successor */
+ struct set_entry *entry;
+ set_foreach(mov-dest.dest.ssa.uses, entry) {
+const nir_instr *dest_instr = entry-key;
+if (dest_instr-type != nir_instr_type_phi ||
+dest_instr-block != block-successors[0])
+   return false;
+ }
+ break;
+  }
 
-  /* The only uses of this definition must be phi's in the successor */
-  struct set_entry *entry;
-  set_foreach(mov-dest.dest.ssa.uses, entry) {
- const nir_instr *dest_instr = entry-key;
- if (dest_instr-type != nir_instr_type_phi ||
- dest_instr-block != block-successors[0])
-return false;
+  default:
+ return false;
   }
}
 
@@ -120,7 +125,8 @@ nir_opt_peephole_select_block(nir_block *block, void 
*void_state)
nir_block *else_block = nir_cf_node_as_block(else_node);
 
/* ... and those blocks must only contain move-to-phi. */
-   if (!are_all_move_to_phi(then_block) || !are_all_move_to_phi(else_block))
+   if (!block_check_for_allowed_instrs(then_block) ||
+   !block_check_for_allowed_instrs(else_block))
   return true;
 
/* At this point, we know that the previous CFG node is an if-then
-- 
2.3.2

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


[Mesa-dev] [Bug 89433] GCC 4.2 does not support -Wvla

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89433

Jonathan Gray j...@openbsd.org changed:

   What|Removed |Added

 Attachment #114016|0   |1
is obsolete||

--- Comment #3 from Jonathan Gray j...@openbsd.org ---
Created attachment 114359
  -- https://bugs.freedesktop.org/attachment.cgi?id=114359action=edit
check if compiler supports -Werror=vla

new patch that does a compile check for the flag

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 13/23] mesa: refactor GetFragDataIndex

2015-03-16 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin imir...@alum.mit.edu

On Fri, Mar 13, 2015 at 4:37 AM, Tapani Pälli tapani.pa...@intel.com wrote:
 Use _mesa_program_resource_location_index to fetch index.

 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/mesa/main/shader_query.cpp | 25 ++---
  1 file changed, 2 insertions(+), 23 deletions(-)

 diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
 index f576972..8b7105a 100644
 --- a/src/mesa/main/shader_query.cpp
 +++ b/src/mesa/main/shader_query.cpp
 @@ -417,29 +417,8 @@ _mesa_GetFragDataIndex(GLuint program, const GLchar 
 *name)
 if (shProg-_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL)
return -1;

 -   exec_list *ir = shProg-_LinkedShaders[MESA_SHADER_FRAGMENT]-ir;
 -   foreach_in_list(ir_instruction, node, ir) {
 -  const ir_variable *const var = node-as_variable();
 -
 -  /* The extra check against FRAG_RESULT_DATA0 is because
 -   * glGetFragDataLocation cannot be used on conventional attributes.
 -   *
 -   * From page 95 of the OpenGL 3.0 spec:
 -   *
 -   * If name is not an active attribute, if name is a conventional
 -   * attribute, or if an error occurs, -1 will be returned.
 -   */
 -  if (var == NULL
 -  || var-data.mode != ir_var_shader_out
 -  || var-data.location == -1
 -  || var-data.location  FRAG_RESULT_DATA0)
 - continue;
 -
 -  if (get_matching_index(var, (const char *) name) = 0)
 - return var-data.index;
 -   }
 -
 -   return -1;
 +   return _mesa_program_resource_location_index(shProg, GL_PROGRAM_OUTPUT,
 +name);
  }

  GLint GLAPIENTRY
 --
 2.1.0

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


[Mesa-dev] [PATCH 3/3] nir/peephole_select: Allow uniform/input loads and load_const

2015-03-16 Thread Jason Ekstrand
Shader-db results on HSW:

total instructions in shared programs: 4174156 - 4157291 (-0.40%)
instructions in affected programs: 145397 - 128532 (-11.60%)
helped:383
HURT:  0
GAINED:20
LOST:  22

There are two more tests lost than gained.  However, comparing this with
GLSL IR vs. NIR results, the overall delta is reduced from 85/44
gained/lost on current master to 71/32 with this commit.  Therefore, I
think it's probably a boon since we are getting closer to where we were
before.
---
 src/glsl/nir/nir_opt_peephole_select.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/src/glsl/nir/nir_opt_peephole_select.c 
b/src/glsl/nir/nir_opt_peephole_select.c
index 7463079..4f953c0 100644
--- a/src/glsl/nir/nir_opt_peephole_select.c
+++ b/src/glsl/nir/nir_opt_peephole_select.c
@@ -56,6 +56,31 @@ block_check_for_allowed_instrs(nir_block *block)
 {
nir_foreach_instr(block, instr) {
   switch (instr-type) {
+  case nir_instr_type_intrinsic: {
+ nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
+
+ switch (intrin-intrinsic) {
+ case nir_intrinsic_load_var:
+switch (intrin-variables[0]-var-data.mode) {
+case nir_var_shader_in:
+case nir_var_uniform:
+   break;
+
+default:
+   return false;
+}
+break;
+
+ default:
+return false;
+ }
+
+ break;
+  }
+
+  case nir_instr_type_load_const:
+ break;
+
   case nir_instr_type_alu: {
  /* It must be a move operation */
  nir_alu_instr *mov = nir_instr_as_alu(instr);
-- 
2.3.2

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


[Mesa-dev] [PATCH 2/3] nir/peephole_select: Copy instructions into the block before the if

2015-03-16 Thread Jason Ekstrand
Previously we tried to do poor-man's copy propagation as we created the
select instructions.  Instead, this commit just moves the instructions from
the blocks inside the if into the block before.  Copy propagation will take
care of making sure we don't have any extra mov's in there for us.
---
 src/glsl/nir/nir_opt_peephole_select.c | 33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/src/glsl/nir/nir_opt_peephole_select.c 
b/src/glsl/nir/nir_opt_peephole_select.c
index 8064f40..7463079 100644
--- a/src/glsl/nir/nir_opt_peephole_select.c
+++ b/src/glsl/nir/nir_opt_peephole_select.c
@@ -135,6 +135,25 @@ nir_opt_peephole_select_block(nir_block *block, void 
*void_state)
 * selects.
 */
 
+   nir_block *prev_block = nir_cf_node_as_block(nir_cf_node_prev(prev_node));
+   assert(prev_block-cf_node.type == nir_cf_node_block);
+
+   /* First, we move the remaining instructions from the blocks to the
+* block before.  We have already guaranteed that this is safe by
+* calling block_check_for_allowed_instrs()
+*/
+   nir_foreach_instr_safe(then_block, instr) {
+  exec_node_remove(instr-node);
+  instr-block = prev_block;
+  exec_list_push_tail(prev_block-instr_list, instr-node);
+   }
+
+   nir_foreach_instr_safe(else_block, instr) {
+  exec_node_remove(instr-node);
+  instr-block = prev_block;
+  exec_list_push_tail(prev_block-instr_list, instr-node);
+   }
+
nir_foreach_instr_safe(block, instr) {
   if (instr-type != nir_instr_type_phi)
  break;
@@ -151,19 +170,7 @@ nir_opt_peephole_select_block(nir_block *block, void 
*void_state)
  assert(src-src.is_ssa);
 
  unsigned idx = src-pred == then_block ? 1 : 2;
-
- if (src-src.ssa-parent_instr-block == src-pred) {
-/* We already know that this instruction must be a move with
- * this phi's in this block as its only users.
- */
-nir_alu_instr *mov = nir_instr_as_alu(src-src.ssa-parent_instr);
-assert(mov-instr.type == nir_instr_type_alu);
-assert(mov-op == nir_op_fmov || mov-op == nir_op_imov);
-
-nir_alu_src_copy(sel-src[idx], mov-src[0], state-mem_ctx);
- } else {
-nir_src_copy(sel-src[idx].src, src-src, state-mem_ctx);
- }
+ nir_src_copy(sel-src[idx].src, src-src, state-mem_ctx);
   }
 
   nir_ssa_dest_init(sel-instr, sel-dest.dest,
-- 
2.3.2

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


Re: [Mesa-dev] [PATCH 1/2] docs/GL3: don't list r300

2015-03-16 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin imir...@alum.mit.edu

Feel free to also nuke nv30.

On Mon, Mar 16, 2015 at 6:37 PM, Matt Turner matts...@gmail.com wrote:
 On Mon, Mar 16, 2015 at 3:28 PM, Marek Olšák mar...@gmail.com wrote:
 From: Marek Olšák marek.ol...@amd.com

 r300g already supports everything it can. There's no point in listing
 the driver here.
 ---

 FWIW, I always thought it was weird to list non-GL3 capable (not
 really even GL2 capable, right?!) hardware here, so this seems like a
 fine plan to me.
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] nir/peephole_select: Rename are_all_move_to_phi and use a switch

2015-03-16 Thread Jason Ekstrand
On Mon, Mar 16, 2015 at 6:52 PM, Connor Abbott cwabbo...@gmail.com wrote:
 On Mon, Mar 16, 2015 at 9:23 PM, Jason Ekstrand ja...@jlekstrand.net wrote:
 ---
  src/glsl/nir/nir_opt_peephole_select.c | 54 
 +++---
  1 file changed, 30 insertions(+), 24 deletions(-)

 diff --git a/src/glsl/nir/nir_opt_peephole_select.c 
 b/src/glsl/nir/nir_opt_peephole_select.c
 index ab08f28..8064f40 100644
 --- a/src/glsl/nir/nir_opt_peephole_select.c
 +++ b/src/glsl/nir/nir_opt_peephole_select.c
 @@ -52,36 +52,41 @@ struct peephole_select_state {
  };

  static bool
 -are_all_move_to_phi(nir_block *block)
 +block_check_for_allowed_instrs(nir_block *block)
  {
 nir_foreach_instr(block, instr) {
 -  if (instr-type != nir_instr_type_alu)
 - return false;
 +  switch (instr-type) {
 +  case nir_instr_type_alu: {
 + /* It must be a move operation */
 + nir_alu_instr *mov = nir_instr_as_alu(instr);
 + if (mov-op != nir_op_fmov  mov-op != nir_op_imov)
 +return false;

 -  /* It must be a move operation */
 -  nir_alu_instr *mov = nir_instr_as_alu(instr);
 -  if (mov-op != nir_op_fmov  mov-op != nir_op_imov)
 - return false;
 + /* Can't handle saturate */
 + if (mov-dest.saturate)
 +return false;

 -  /* Can't handle saturate */
 -  if (mov-dest.saturate)
 - return false;
 + /* It must be SSA */
 + if (!mov-dest.dest.is_ssa)
 +return false;

 -  /* It must be SSA */
 -  if (!mov-dest.dest.is_ssa)
 - return false;
 + /* It cannot have any if-uses */
 + if (mov-dest.dest.ssa.if_uses-entries != 0)
 +return false;

 -  /* It cannot have any if-uses */
 -  if (mov-dest.dest.ssa.if_uses-entries != 0)
 - return false;
 + /* The only uses of this definition must be phi's in the successor 
 */
 + struct set_entry *entry;
 + set_foreach(mov-dest.dest.ssa.uses, entry) {
 +const nir_instr *dest_instr = entry-key;
 +if (dest_instr-type != nir_instr_type_phi ||
 +dest_instr-block != block-successors[0])
 +   return false;
 + }
 + break;
 +  }

 -  /* The only uses of this definition must be phi's in the successor */
 -  struct set_entry *entry;
 -  set_foreach(mov-dest.dest.ssa.uses, entry) {
 - const nir_instr *dest_instr = entry-key;
 - if (dest_instr-type != nir_instr_type_phi ||
 - dest_instr-block != block-successors[0])
 -return false;
 +  default:
 + return false;
}
 }

 @@ -120,7 +125,8 @@ nir_opt_peephole_select_block(nir_block *block, void 
 *void_state)
 nir_block *else_block = nir_cf_node_as_block(else_node);

 /* ... and those blocks must only contain move-to-phi. */

 You should change this comment in patch 3 before it becomes stale.
 Otherwise, the series is

I changed it in patch 1 because that's where we did the rename.  I
hope that's ok.

 Reviewed-by: Connor Abbott cwabbo...@gmail.com

Thanks!

 So a good improvement, but not quite parity with GLSL IR yet. Any
 ideas what other silly things like this are holding us back from
 finally doing better?

There are a couple issues with constant-combine (Matt has a patch),
I've got a patch to fix up types on some things which will hopefully
help after matt's patch.  Then we have way too much mov-to-flag.  I'm
going to play with that last one a bit tonight.
--Jason

 -   if (!are_all_move_to_phi(then_block) || !are_all_move_to_phi(else_block))
 +   if (!block_check_for_allowed_instrs(then_block) ||
 +   !block_check_for_allowed_instrs(else_block))
return true;

 /* At this point, we know that the previous CFG node is an if-then
 --
 2.3.2

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


Re: [Mesa-dev] [PATCH] gallium/util: Define ffsll on OpenBSD.

2015-03-16 Thread Jonathan Gray
On Mon, Mar 16, 2015 at 08:37:28PM +, Emil Velikov wrote:
 On 26/02/15 13:49, Jose Fonseca wrote:
  On 26/02/15 13:42, Jose Fonseca wrote:
  On 26/02/15 03:55, Jonathan Gray wrote:
  On Wed, Feb 25, 2015 at 07:09:26PM -0800, Matt Turner wrote:
  On Wed, Feb 25, 2015 at 7:03 PM, Jonathan Gray j...@jsg.id.au wrote:
  On Wed, Feb 25, 2015 at 06:53:14PM -0800, Matt Turner wrote:
  On Wed, Feb 25, 2015 at 5:37 PM, Jonathan Gray j...@jsg.id.au wrote:
  If it isn't going to be configure checks could someone merge the
  original patch in this thread?
 
  I committed
 
  commit 3492e88090d2d0c0bfbc934963b8772b45fc8880
  Author: Matt Turner matts...@gmail.com
  Date:   Fri Feb 20 18:46:43 2015 -0800
 
   gallium/util: Use HAVE___BUILTIN_* macros.
 
   Reviewed-by: Eric Anholt e...@anholt.net
   Reviewed-by: Jose Fonseca jfons...@vmware.com
 
  which switched over a bunch of preprocessor checks around __builtin*
  calls to use the macros defined by autotools.
 
  So I think cleaning it up to use __builtin_ffs* first #ifdef
  HAVE___BUILTIN_* can go forward now.
 
  Yes but there is no HAVE_FFSLL for constructs like
 
  #if !defined(HAVE_FFSLL)  defined(HAVE___BUILTIN_FFSLL)
 
  or is it ok to always use the builtin?
 
  I think the question is whether it's okay to always use the builtin if
  it's available (as opposed to libc functions). I think the answer to
  that is yes.
 
  So in that case how about the following?  Or is it going to break
  the android scons build?
 
   From cba39ba72115e57d262cb4b099c4e72106f01812 Mon Sep 17 00:00:00 2001
  From: Jonathan Gray j...@jsg.id.au
  Date: Thu, 26 Feb 2015 14:46:45 +1100
  Subject: [PATCH] gallium/util: use ffs* builtins if available
 
  Required to build on OpenBSD which doesn't have ffsll in libc.
 
  Signed-off-by: Jonathan Gray j...@jsg.id.au
  ---
src/gallium/auxiliary/util/u_math.h | 11 ---
1 file changed, 8 insertions(+), 3 deletions(-)
 
  diff --git a/src/gallium/auxiliary/util/u_math.h
  b/src/gallium/auxiliary/util/u_math.h
  index b4a65e4..5bc9b97 100644
  --- a/src/gallium/auxiliary/util/u_math.h
  +++ b/src/gallium/auxiliary/util/u_math.h
  @@ -384,9 +384,6 @@ unsigned ffs( unsigned u )
 
   return i;
}
  -#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
  -#define ffs __builtin_ffs
  -#define ffsll __builtin_ffsll
 
  Scons does define HAVE___BUILTIN_FFS for mingw.
 
  However `git grep '\ffs\` shows ffs is used directly in many other
  places.  So I suspect this change will break them.
 
#endif
 
#endif /* FFS_DEFINED */
  @@ -435,7 +432,11 @@ util_last_bit_signed(int i)
static INLINE int
u_bit_scan(unsigned *mask)
{
  +#if defined(HAVE___BUILTIN_FFS)
  +   int i = __builtin_ffs(*mask) - 1;
  +#else
   int i = ffs(*mask) - 1;
  +#endif
   *mask = ~(1  i);
   return i;
}
  @@ -444,7 +445,11 @@ u_bit_scan(unsigned *mask)
static INLINE int
u_bit_scan64(uint64_t *mask)
{
  +#if defined(HAVE___BUILTIN_FFSLL)
  +   int i = __builtin_ffsll(*mask) - 1;
  +#else
   int i = ffsll(*mask) - 1;
  +#endif
   *mask = ~(1llu  i);
   return i;
}
 
 
 
  I think the right thing long term is to provide ffs and ffsll in
  c99_compat.h or c99_math.h for all platforms.  And let the rest of the
  code just always assume it's available somehow.
 
 
  Otherwise, let's just '#define ffs __builtin_ffs' on OpenBSD too.
  
  In other words, the original patch on this thread
  
http://lists.freedesktop.org/archives/mesa-dev/2015-February/076071.html
  
  is the only patch I've seen so far that doesn't break Mingw.
  
  If you rather use HAVE___BUILTIN_FFSLL, then just do
  
  diff --git a/src/gallium/auxiliary/util/u_math.h
  b/src/gallium/auxiliary/util/u_math.h
  index 959f76e..d372cfd 100644
  --- a/src/gallium/auxiliary/util/u_math.h
  +++ b/src/gallium/auxiliary/util/u_math.h
  @@ -384,7 +384,7 @@ unsigned ffs( unsigned u )
  
  return i;
   }
  -#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
  +#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID) ||
  defined(HAVE___BUILTIN_FFSLL)
   #define ffs __builtin_ffs
   #define ffsll __builtin_ffsll
   #endif
  
 Jonathan
 
 Seems like this has ended up a longer discussion that anticipated :\
 Can you please confirm if the above works for you ?
 
 Thanks
 Emil

It looks like that diff was mangled by the mail client and doesn't have
the newline escaped.  It also assumes a ffsll builtin implies a ffs
builtin is present.  So how about the following instead:

diff --git a/src/gallium/auxiliary/util/u_math.h 
b/src/gallium/auxiliary/util/u_math.h
index 8f62cac..89c63d7 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -383,14 +383,28 @@ unsigned ffs( unsigned u )
 
return i;
 }
-#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
+#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID) || \
+defined(HAVE___BUILTIN_FFS) 
 #define ffs __builtin_ffs
-#define 

Re: [Mesa-dev] [PATCH 1/3] nir/peephole_select: Rename are_all_move_to_phi and use a switch

2015-03-16 Thread Connor Abbott
On Mon, Mar 16, 2015 at 9:23 PM, Jason Ekstrand ja...@jlekstrand.net wrote:
 ---
  src/glsl/nir/nir_opt_peephole_select.c | 54 
 +++---
  1 file changed, 30 insertions(+), 24 deletions(-)

 diff --git a/src/glsl/nir/nir_opt_peephole_select.c 
 b/src/glsl/nir/nir_opt_peephole_select.c
 index ab08f28..8064f40 100644
 --- a/src/glsl/nir/nir_opt_peephole_select.c
 +++ b/src/glsl/nir/nir_opt_peephole_select.c
 @@ -52,36 +52,41 @@ struct peephole_select_state {
  };

  static bool
 -are_all_move_to_phi(nir_block *block)
 +block_check_for_allowed_instrs(nir_block *block)
  {
 nir_foreach_instr(block, instr) {
 -  if (instr-type != nir_instr_type_alu)
 - return false;
 +  switch (instr-type) {
 +  case nir_instr_type_alu: {
 + /* It must be a move operation */
 + nir_alu_instr *mov = nir_instr_as_alu(instr);
 + if (mov-op != nir_op_fmov  mov-op != nir_op_imov)
 +return false;

 -  /* It must be a move operation */
 -  nir_alu_instr *mov = nir_instr_as_alu(instr);
 -  if (mov-op != nir_op_fmov  mov-op != nir_op_imov)
 - return false;
 + /* Can't handle saturate */
 + if (mov-dest.saturate)
 +return false;

 -  /* Can't handle saturate */
 -  if (mov-dest.saturate)
 - return false;
 + /* It must be SSA */
 + if (!mov-dest.dest.is_ssa)
 +return false;

 -  /* It must be SSA */
 -  if (!mov-dest.dest.is_ssa)
 - return false;
 + /* It cannot have any if-uses */
 + if (mov-dest.dest.ssa.if_uses-entries != 0)
 +return false;

 -  /* It cannot have any if-uses */
 -  if (mov-dest.dest.ssa.if_uses-entries != 0)
 - return false;
 + /* The only uses of this definition must be phi's in the successor 
 */
 + struct set_entry *entry;
 + set_foreach(mov-dest.dest.ssa.uses, entry) {
 +const nir_instr *dest_instr = entry-key;
 +if (dest_instr-type != nir_instr_type_phi ||
 +dest_instr-block != block-successors[0])
 +   return false;
 + }
 + break;
 +  }

 -  /* The only uses of this definition must be phi's in the successor */
 -  struct set_entry *entry;
 -  set_foreach(mov-dest.dest.ssa.uses, entry) {
 - const nir_instr *dest_instr = entry-key;
 - if (dest_instr-type != nir_instr_type_phi ||
 - dest_instr-block != block-successors[0])
 -return false;
 +  default:
 + return false;
}
 }

 @@ -120,7 +125,8 @@ nir_opt_peephole_select_block(nir_block *block, void 
 *void_state)
 nir_block *else_block = nir_cf_node_as_block(else_node);

 /* ... and those blocks must only contain move-to-phi. */

You should change this comment in patch 3 before it becomes stale.
Otherwise, the series is

Reviewed-by: Connor Abbott cwabbo...@gmail.com

So a good improvement, but not quite parity with GLSL IR yet. Any
ideas what other silly things like this are holding us back from
finally doing better?

 -   if (!are_all_move_to_phi(then_block) || !are_all_move_to_phi(else_block))
 +   if (!block_check_for_allowed_instrs(then_block) ||
 +   !block_check_for_allowed_instrs(else_block))
return true;

 /* At this point, we know that the previous CFG node is an if-then
 --
 2.3.2

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


Re: [Mesa-dev] [PATCH] util: port _mesa_strto[df] to C

2015-03-16 Thread Erik Faye-Lund
On Tue, Mar 17, 2015 at 12:32 AM, Ian Romanick i...@freedesktop.org wrote:
 On 03/15/2015 12:05 PM, Erik Faye-Lund wrote:
 _mesa_strtod and _mesa_strtof are only used from the GLSL compiler,

 It's also used in the ARB_vertex_program / ARB_fragment_program
 assembler in src/prog.

Oh, right. Thanks for pointing that out.

 so the locale doesn't need to be initialized before the first context
 gets initialized. So let's use explicit initialization from the
 one-time init code instead of depending on a C++ compiler to initialize
 at image-load time.

 This is fairly close to the way Chia-I originally had it:

 http://lists.freedesktop.org/archives/mesa-dev/2014-April/058215.html

 Some discussion of alternate methods started:

 http://lists.freedesktop.org/archives/mesa-dev/2014-May/058861.html

Thanks for pointing me at this discussion, very useful.

 I'm a little concerned that having the initialization in Mesa and the
 function accessible to both Mesa and Gallium that we may set ourselves
 up for problems later.

Doesn't really sound like a ground-shattering risk to me. But perhaps
adding an assert verifying that initialization was done could offset
that risk?

 It also occurs to me that the neither the old code nor the new code ever
 call freelocale.

In OpenGL ES 2.0 and OpenGL 4.1, you have glReleaseShaderCompiler
which is intended for this kind of work. But I'm not sure a single
leak of a locale is really worth the implementation-effort.

 I think that's easier to fix with the static object
 method (using a destructor).

 I guess I'm kind of ambivalent about the change.

Yeah, especially initialization having to be done in three different
locations causes me to start losing some confidence that this is a
good idea.

 Signed-off-by: Erik Faye-Lund kusmab...@gmail.com
 ---

 Because of the recent discussion on libc++ and Mesa, I thought I'd
 have a look into what parts of mesa depended on libc++, and I spotted
 this file.

 In this case, it was rather trivial to port the code to plain C, making
 it dead obvious that it doesn't depend on libc++. I'm not proposing all
 C++ gets this treatment, but in this case it seems like a pretty
 straight-forward way to make it obvious that this code does not depend
 on libc++.

  src/mesa/main/context.c   |  3 +++
  src/util/Makefile.sources |  2 +-
  src/util/{strtod.cpp = strtod.c} | 14 --
  src/util/strtod.h |  3 +++
  4 files changed, 15 insertions(+), 7 deletions(-)
  rename src/util/{strtod.cpp = strtod.c} (89%)

 diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
 index 22c2341..de6a016 100644
 --- a/src/mesa/main/context.c
 +++ b/src/mesa/main/context.c
 @@ -119,6 +119,7 @@
  #include shared.h
  #include shaderobj.h
  #include util/simple_list.h
 +#include util/strtod.h
  #include state.h
  #include stencil.h
  #include texcompress_s3tc.h
 @@ -398,6 +399,8 @@ one_time_init( struct gl_context *ctx )
assert( sizeof(GLint) == 4 );
assert( sizeof(GLuint) == 4 );

 +  _mesa_locale_init();
 +
_mesa_one_time_init_extension_overrides();

_mesa_get_cpu_features();
 diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources
 index 560ea83..f930790 100644
 --- a/src/util/Makefile.sources
 +++ b/src/util/Makefile.sources
 @@ -17,7 +17,7 @@ MESA_UTIL_FILES :=  \
   set.c \
   set.h \
   simple_list.h \
 - strtod.cpp \
 + strtod.c \
   strtod.h \
   texcompress_rgtc_tmp.h \
   u_atomic.h
 diff --git a/src/util/strtod.cpp b/src/util/strtod.c
 similarity index 89%
 rename from src/util/strtod.cpp
 rename to src/util/strtod.c
 index 2b4dd98..a4a60e0 100644
 --- a/src/util/strtod.cpp
 +++ b/src/util/strtod.c
 @@ -30,18 +30,20 @@
  #include locale.h
  #ifdef HAVE_XLOCALE_H
  #include xlocale.h
 +static locale_t loc;
  #endif
  #endif

  #include strtod.h


 +void
 +_mesa_locale_init(void)
 +{
  #if defined(_GNU_SOURCE)  defined(HAVE_XLOCALE_H)
 -static struct locale_initializer {
 -   locale_initializer() { loc = newlocale(LC_CTYPE_MASK, C, NULL); }
 -   locale_t loc;
 -} loc_init;
 +   loc = newlocale(LC_CTYPE_MASK, C, NULL);
  #endif
 +}

  /**
   * Wrapper around strtod which uses the C locale so the decimal
 @@ -51,7 +53,7 @@ double
  _mesa_strtod(const char *s, char **end)
  {
  #if defined(_GNU_SOURCE)  defined(HAVE_XLOCALE_H)
 -   return strtod_l(s, end, loc_init.loc);
 +   return strtod_l(s, end, loc);
  #else
 return strtod(s, end);
  #endif
 @@ -66,7 +68,7 @@ float
  _mesa_strtof(const char *s, char **end)
  {
  #if defined(_GNU_SOURCE)  defined(HAVE_XLOCALE_H)
 -   return strtof_l(s, end, loc_init.loc);
 +   return strtof_l(s, end, loc);
  #elif defined(HAVE_STRTOF)
 return strtof(s, end);
  #else
 diff --git a/src/util/strtod.h b/src/util/strtod.h
 index 02c25dd..b7e2beb 100644
 --- a/src/util/strtod.h
 +++ b/src/util/strtod.h
 @@ -31,6 +31,9 @@
  extern C {
  #endif

 +extern void
 +_mesa_locale_init(void);
 +
  extern double
 

Re: [Mesa-dev] [PATCH 1/3] nir/peephole_select: Rename are_all_move_to_phi and use a switch

2015-03-16 Thread Connor Abbott
On Mon, Mar 16, 2015 at 10:08 PM, Jason Ekstrand ja...@jlekstrand.net wrote:
 On Mon, Mar 16, 2015 at 6:52 PM, Connor Abbott cwabbo...@gmail.com wrote:
 On Mon, Mar 16, 2015 at 9:23 PM, Jason Ekstrand ja...@jlekstrand.net wrote:
 ---
  src/glsl/nir/nir_opt_peephole_select.c | 54 
 +++---
  1 file changed, 30 insertions(+), 24 deletions(-)

 diff --git a/src/glsl/nir/nir_opt_peephole_select.c 
 b/src/glsl/nir/nir_opt_peephole_select.c
 index ab08f28..8064f40 100644
 --- a/src/glsl/nir/nir_opt_peephole_select.c
 +++ b/src/glsl/nir/nir_opt_peephole_select.c
 @@ -52,36 +52,41 @@ struct peephole_select_state {
  };

  static bool
 -are_all_move_to_phi(nir_block *block)
 +block_check_for_allowed_instrs(nir_block *block)
  {
 nir_foreach_instr(block, instr) {
 -  if (instr-type != nir_instr_type_alu)
 - return false;
 +  switch (instr-type) {
 +  case nir_instr_type_alu: {
 + /* It must be a move operation */
 + nir_alu_instr *mov = nir_instr_as_alu(instr);
 + if (mov-op != nir_op_fmov  mov-op != nir_op_imov)
 +return false;

 -  /* It must be a move operation */
 -  nir_alu_instr *mov = nir_instr_as_alu(instr);
 -  if (mov-op != nir_op_fmov  mov-op != nir_op_imov)
 - return false;
 + /* Can't handle saturate */
 + if (mov-dest.saturate)
 +return false;

 -  /* Can't handle saturate */
 -  if (mov-dest.saturate)
 - return false;
 + /* It must be SSA */
 + if (!mov-dest.dest.is_ssa)
 +return false;

 -  /* It must be SSA */
 -  if (!mov-dest.dest.is_ssa)
 - return false;
 + /* It cannot have any if-uses */
 + if (mov-dest.dest.ssa.if_uses-entries != 0)
 +return false;

 -  /* It cannot have any if-uses */
 -  if (mov-dest.dest.ssa.if_uses-entries != 0)
 - return false;
 + /* The only uses of this definition must be phi's in the 
 successor */
 + struct set_entry *entry;
 + set_foreach(mov-dest.dest.ssa.uses, entry) {
 +const nir_instr *dest_instr = entry-key;
 +if (dest_instr-type != nir_instr_type_phi ||
 +dest_instr-block != block-successors[0])
 +   return false;
 + }
 + break;
 +  }

 -  /* The only uses of this definition must be phi's in the successor */
 -  struct set_entry *entry;
 -  set_foreach(mov-dest.dest.ssa.uses, entry) {
 - const nir_instr *dest_instr = entry-key;
 - if (dest_instr-type != nir_instr_type_phi ||
 - dest_instr-block != block-successors[0])
 -return false;
 +  default:
 + return false;
}
 }

 @@ -120,7 +125,8 @@ nir_opt_peephole_select_block(nir_block *block, void 
 *void_state)
 nir_block *else_block = nir_cf_node_as_block(else_node);

 /* ... and those blocks must only contain move-to-phi. */

 You should change this comment in patch 3 before it becomes stale.
 Otherwise, the series is

 I changed it in patch 1 because that's where we did the rename.  I
 hope that's ok.

That's fine by me.


 Reviewed-by: Connor Abbott cwabbo...@gmail.com

 Thanks!

 So a good improvement, but not quite parity with GLSL IR yet. Any
 ideas what other silly things like this are holding us back from
 finally doing better?

 There are a couple issues with constant-combine (Matt has a patch),
 I've got a patch to fix up types on some things which will hopefully
 help after matt's patch.  Then we have way too much mov-to-flag.  I'm
 going to play with that last one a bit tonight.
 --Jason

 -   if (!are_all_move_to_phi(then_block) || 
 !are_all_move_to_phi(else_block))
 +   if (!block_check_for_allowed_instrs(then_block) ||
 +   !block_check_for_allowed_instrs(else_block))
return true;

 /* At this point, we know that the previous CFG node is an if-then
 --
 2.3.2

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


Re: [Mesa-dev] [PATCH 1/6] c11: add c11 compatibility wrapper around stdlib.h

2015-03-16 Thread Emil Velikov
On 06/03/15 18:26, Brian Paul wrote:
 On Fri, Mar 6, 2015 at 9:32 AM, Emil Velikov emil.l.veli...@gmail.com
 mailto:emil.l.veli...@gmail.com wrote:
 
 Used for aligned_alloc and other C11 functions missing from the header.
 
 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
 mailto:emil.l.veli...@gmail.com
 ---
  include/c11_stdlib.h | 118 ++
 
 
 I wonder if this should be include/c11/stdlib.h instead.
 
 I also wonder if I should have put c99_math.h in c99/math.h  Jose
 followed my pattern with c99_alloca.h
 
 We should probably be more consistent about this.  What do you think?
 
 
  
 
 +
  1 file changed, 118 insertions(+)
  create mode 100644 include/c11_stdlib.h
 
 diff --git a/include/c11_stdlib.h b/include/c11_stdlib.h
 new file mode 100644
 index 000..04e494f
 --- /dev/null
 +++ b/include/c11_stdlib.h
 @@ -0,0 +1,118 @@
 +/*
 + * Mesa 3-D graphics library
 + *
 + * Copyright (C) 1999-2007  Brian Paul   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.
 + */
 +
 +/**
 + * Wrapper for stdlib.h which makes sure we have definitions of all
 the c11
 + * functions.
 + */
 +
 +#ifndef _C11_STDLIB_H_
 +#define _C11_STDLIB_H_
 +
 +#include stdint.h
 
 
 I stdint.h really needed here?
 
 Otherwise than the naming issue and the stdint.h question, the series
 looks good to me.  Reviewed-by: Brian Paul bri...@vmware.com
 mailto:bri...@vmware.com
 
I've included it due to the uintptr_t below. I'm not 100% sure that
stdlib.h will be sufficient to provide it for platforms which lack both
posix_memalign and _aligned_malloc.

So better be safe than sorry :)


-Emil

...
 +static inline void *
 +aligned_alloc(size_t alignment, size_t size)
 +{
 +#if defined(HAVE_POSIX_MEMALIGN)
 +   void *mem;
 +   int err = posix_memalign(mem, alignment, size);
 +   if (err)
 +  return NULL;
 +   return mem;
 +#elif defined(_WIN32)  !defined(__CYGWIN__)
 +   return _aligned_malloc(size, alignment);
 +#else
 +   uintptr_t ptr, buf;
 +
 +   assert( alignment  0 );
 +
 +   ptr = (uintptr_t)malloc(size + alignment + sizeof(void *));
 +   if (!ptr)
 +  return NULL;
 +
 +   buf = (ptr + alignment + sizeof(void *)) 
 ~(uintptr_t)(alignment - 1);
 +   *(uintptr_t *)(buf - sizeof(void *)) = ptr;

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


Re: [Mesa-dev] [PATCH] gallium/util: Define ffsll on OpenBSD.

2015-03-16 Thread Emil Velikov
On 26/02/15 13:49, Jose Fonseca wrote:
 On 26/02/15 13:42, Jose Fonseca wrote:
 On 26/02/15 03:55, Jonathan Gray wrote:
 On Wed, Feb 25, 2015 at 07:09:26PM -0800, Matt Turner wrote:
 On Wed, Feb 25, 2015 at 7:03 PM, Jonathan Gray j...@jsg.id.au wrote:
 On Wed, Feb 25, 2015 at 06:53:14PM -0800, Matt Turner wrote:
 On Wed, Feb 25, 2015 at 5:37 PM, Jonathan Gray j...@jsg.id.au wrote:
 If it isn't going to be configure checks could someone merge the
 original patch in this thread?

 I committed

 commit 3492e88090d2d0c0bfbc934963b8772b45fc8880
 Author: Matt Turner matts...@gmail.com
 Date:   Fri Feb 20 18:46:43 2015 -0800

  gallium/util: Use HAVE___BUILTIN_* macros.

  Reviewed-by: Eric Anholt e...@anholt.net
  Reviewed-by: Jose Fonseca jfons...@vmware.com

 which switched over a bunch of preprocessor checks around __builtin*
 calls to use the macros defined by autotools.

 So I think cleaning it up to use __builtin_ffs* first #ifdef
 HAVE___BUILTIN_* can go forward now.

 Yes but there is no HAVE_FFSLL for constructs like

 #if !defined(HAVE_FFSLL)  defined(HAVE___BUILTIN_FFSLL)

 or is it ok to always use the builtin?

 I think the question is whether it's okay to always use the builtin if
 it's available (as opposed to libc functions). I think the answer to
 that is yes.

 So in that case how about the following?  Or is it going to break
 the android scons build?

  From cba39ba72115e57d262cb4b099c4e72106f01812 Mon Sep 17 00:00:00 2001
 From: Jonathan Gray j...@jsg.id.au
 Date: Thu, 26 Feb 2015 14:46:45 +1100
 Subject: [PATCH] gallium/util: use ffs* builtins if available

 Required to build on OpenBSD which doesn't have ffsll in libc.

 Signed-off-by: Jonathan Gray j...@jsg.id.au
 ---
   src/gallium/auxiliary/util/u_math.h | 11 ---
   1 file changed, 8 insertions(+), 3 deletions(-)

 diff --git a/src/gallium/auxiliary/util/u_math.h
 b/src/gallium/auxiliary/util/u_math.h
 index b4a65e4..5bc9b97 100644
 --- a/src/gallium/auxiliary/util/u_math.h
 +++ b/src/gallium/auxiliary/util/u_math.h
 @@ -384,9 +384,6 @@ unsigned ffs( unsigned u )

  return i;
   }
 -#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
 -#define ffs __builtin_ffs
 -#define ffsll __builtin_ffsll

 Scons does define HAVE___BUILTIN_FFS for mingw.

 However `git grep '\ffs\` shows ffs is used directly in many other
 places.  So I suspect this change will break them.

   #endif

   #endif /* FFS_DEFINED */
 @@ -435,7 +432,11 @@ util_last_bit_signed(int i)
   static INLINE int
   u_bit_scan(unsigned *mask)
   {
 +#if defined(HAVE___BUILTIN_FFS)
 +   int i = __builtin_ffs(*mask) - 1;
 +#else
  int i = ffs(*mask) - 1;
 +#endif
  *mask = ~(1  i);
  return i;
   }
 @@ -444,7 +445,11 @@ u_bit_scan(unsigned *mask)
   static INLINE int
   u_bit_scan64(uint64_t *mask)
   {
 +#if defined(HAVE___BUILTIN_FFSLL)
 +   int i = __builtin_ffsll(*mask) - 1;
 +#else
  int i = ffsll(*mask) - 1;
 +#endif
  *mask = ~(1llu  i);
  return i;
   }



 I think the right thing long term is to provide ffs and ffsll in
 c99_compat.h or c99_math.h for all platforms.  And let the rest of the
 code just always assume it's available somehow.


 Otherwise, let's just '#define ffs __builtin_ffs' on OpenBSD too.
 
 In other words, the original patch on this thread
 
   http://lists.freedesktop.org/archives/mesa-dev/2015-February/076071.html
 
 is the only patch I've seen so far that doesn't break Mingw.
 
 If you rather use HAVE___BUILTIN_FFSLL, then just do
 
 diff --git a/src/gallium/auxiliary/util/u_math.h
 b/src/gallium/auxiliary/util/u_math.h
 index 959f76e..d372cfd 100644
 --- a/src/gallium/auxiliary/util/u_math.h
 +++ b/src/gallium/auxiliary/util/u_math.h
 @@ -384,7 +384,7 @@ unsigned ffs( unsigned u )
 
 return i;
  }
 -#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
 +#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID) ||
 defined(HAVE___BUILTIN_FFSLL)
  #define ffs __builtin_ffs
  #define ffsll __builtin_ffsll
  #endif
 
Jonathan

Seems like this has ended up a longer discussion that anticipated :\
Can you please confirm if the above works for you ?

Thanks
Emil


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


Re: [Mesa-dev] [PATCH] util: port _mesa_strto[df] to C

2015-03-16 Thread Matt Turner
On Sun, Mar 15, 2015 at 12:05 PM, Erik Faye-Lund kusmab...@gmail.com wrote:
 _mesa_strtod and _mesa_strtof are only used from the GLSL compiler,
 so the locale doesn't need to be initialized before the first context
 gets initialized. So let's use explicit initialization from the
 one-time init code instead of depending on a C++ compiler to initialize
 at image-load time.

 Signed-off-by: Erik Faye-Lund kusmab...@gmail.com
 ---

 Because of the recent discussion on libc++ and Mesa, I thought I'd
 have a look into what parts of mesa depended on libc++, and I spotted
 this file.

 In this case, it was rather trivial to port the code to plain C, making
 it dead obvious that it doesn't depend on libc++. I'm not proposing all
 C++ gets this treatment, but in this case it seems like a pretty
 straight-forward way to make it obvious that this code does not depend
 on libc++.

This looks good to me. It'd be nice if idr could take a look as well.

Reviewed-by: Matt Turner matts...@gmail.com

The one annoyance is that autotools doesn't work across this change.
After applying this patch to a configured and built tree, you'll get

make[4]: *** No rule to make target
'../../../mesa/src/util/strtod.cpp', needed by
'libmesautil_la-strtod.lo'.  Stop.

when running make.

To fix, run

sed -i -e 's/strtod.cpp/strtod.c/' src/util/.deps/libmesautil_la-strtod.Plo

The file will be in your build tree.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] radeonsi: add a helper for extracting bitfields from parameters (v2)

2015-03-16 Thread Tom Stellard
On Sun, Mar 15, 2015 at 07:59:51PM +0100, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 This will be used a lot (especially by tessellation).
 
 v2: don't use the bfe intrinsic

Reviewed-by: Tom Stellard thomas.stell...@amd.com

 ---
  src/gallium/drivers/radeonsi/si_shader.c | 43 
 
  1 file changed, 27 insertions(+), 16 deletions(-)
 
 diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
 b/src/gallium/drivers/radeonsi/si_shader.c
 index e70a318..e43b588 100644
 --- a/src/gallium/drivers/radeonsi/si_shader.c
 +++ b/src/gallium/drivers/radeonsi/si_shader.c
 @@ -192,6 +192,30 @@ static int get_param_index(unsigned semantic_name, 
 unsigned index,
  }
  
  /**
 + * Get the value of a shader input parameter and extract a bitfield.
 + */
 +static LLVMValueRef unpack_param(struct si_shader_context *si_shader_ctx,
 +  unsigned param, unsigned rshift,
 +  unsigned bitwidth)
 +{
 + struct gallivm_state *gallivm = si_shader_ctx-radeon_bld.gallivm;
 + LLVMValueRef value = LLVMGetParam(si_shader_ctx-radeon_bld.main_fn,
 +   param);
 +
 + if (rshift)
 + value = LLVMBuildLShr(gallivm-builder, value,
 +   lp_build_const_int32(gallivm, rshift), 
 );
 +
 + if (rshift + bitwidth  32) {
 + unsigned mask = (1  bitwidth) - 1;
 + value = LLVMBuildAnd(gallivm-builder, value,
 +  lp_build_const_int32(gallivm, mask), );
 + }
 +
 + return value;
 +}
 +
 +/**
   * Build an LLVM bytecode indexed load using LLVMBuildGEP + LLVMBuildLoad.
   * It's equivalent to doing a load from base_ptr[index].
   *
 @@ -561,14 +585,8 @@ static void declare_input_fs(
  
  static LLVMValueRef get_sample_id(struct radeon_llvm_context *radeon_bld)
  {
 - struct gallivm_state *gallivm = radeon_bld-gallivm;
 - LLVMValueRef value = LLVMGetParam(radeon_bld-main_fn,
 -   SI_PARAM_ANCILLARY);
 - value = LLVMBuildLShr(gallivm-builder, value,
 -   lp_build_const_int32(gallivm, 8), );
 - value = LLVMBuildAnd(gallivm-builder, value,
 -  lp_build_const_int32(gallivm, 0xf), );
 - return value;
 + return unpack_param(si_shader_context(radeon_bld-soa.bld_base),
 + SI_PARAM_ANCILLARY, 8, 4);
  }
  
  /**
 @@ -980,16 +998,9 @@ static void si_llvm_emit_streamout(struct 
 si_shader_context *shader,
  
   LLVMTypeRef i32 = LLVMInt32TypeInContext(gallivm-context);
  
 - LLVMValueRef so_param =
 - LLVMGetParam(shader-radeon_bld.main_fn,
 -  shader-param_streamout_config);
 -
   /* Get bits [22:16], i.e. (so_param  16)  127; */
   LLVMValueRef so_vtx_count =
 - LLVMBuildAnd(builder,
 -  LLVMBuildLShr(builder, so_param,
 -LLVMConstInt(i32, 16, 0), ),
 -  LLVMConstInt(i32, 127, 0), );
 + unpack_param(shader, shader-param_streamout_config, 16, 7);
  
   LLVMValueRef tid = build_intrinsic(builder, llvm.SI.tid, i32,
  NULL, 0, LLVMReadNoneAttribute);
 -- 
 2.1.0
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] util: Change util/set to use quadratic probing

2015-03-16 Thread Thomas Helland
2015-03-16 6:49 GMT+01:00 Connor Abbott cwabbo...@gmail.com:
 Ok, so I think I managed to find the source of the bug. When inserting
 elements into the set/hash table, we computed the initial probe
 address *before* doing the rehash. In the case where inserting an
 element led to a rehash, this meant that we'd use the wrong starting
 address when actually inserting it, and then afterwards when we'd go
 back and search for it we'd start at a different address = boom.

Thanks for tracking this down!
That does indeed look like it's it.
I'll send an updated version once I get the time.

 Fixing that makes the pubilc shader-db run without any errors, at
 least for me. In addition, while examining the algorithm I found one
 other thing that I've mentioned inline. Obviously, all these comments
 apply equally to the hash table code as well, although I'm not sure
 why the bug didn't affect it as well, or for that matter why we didn't
 notice the bug with the old code as it also seems to have it. As Jason
 said, hash table bugs are really terrible and tricky.

 On Fri, Mar 13, 2015 at 6:37 PM, Thomas Helland
 thomashellan...@gmail.com wrote:
 The same rationale applies here as for the hash table.
 Power of two size should give better performance,
 and using the algorithm hash = sh + i/2 + i*i/2
 should result in only distinct hash values when hitting collisions.
 Should give a performance increase as we can do bitmasking instead
 of a modulo operation for fitting the hash in the address space.
 ---
  src/util/set.c | 103 
 ++---
  src/util/set.h |   1 -
  2 files changed, 54 insertions(+), 50 deletions(-)

 diff --git a/src/util/set.c b/src/util/set.c
 index f01f869..8f0ad0d 100644
 --- a/src/util/set.c
 +++ b/src/util/set.c
 @@ -48,40 +48,46 @@
  uint32_t deleted_key_value;
  const void *deleted_key = deleted_key_value;

 +/**
 + * We chose table sizes that's a power of two.
 + * This is computationally less expensive than primes.
 + * FNV-1a has good avalanche properties, so collision is not an issue.
 + * These tables are sized to have an extra 10% free to avoid
 + * exponential performance degradation as the hash table fills
 + */
  static const struct {
 -   uint32_t max_entries, size, rehash;
 +   uint32_t max_entries, size;
  } hash_sizes[] = {
 -   { 2,5,3},
 -   { 4,7,5},
 -   { 8,13,   11   },
 -   { 16,   19,   17   },
 -   { 32,   43,   41   },
 -   { 64,   73,   71   },
 -   { 128,  151,  149  },
 -   { 256,  283,  281  },
 -   { 512,  571,  569  },
 -   { 1024, 1153, 1151 },
 -   { 2048, 2269, 2267 },
 -   { 4096, 4519, 4517 },
 -   { 8192, 9013, 9011 },
 -   { 16384,18043,18041},
 -   { 32768,36109,36107},
 -   { 65536,72091,72089},
 -   { 131072,   144409,   144407   },
 -   { 262144,   288361,   288359   },
 -   { 524288,   576883,   576881   },
 -   { 1048576,  1153459,  1153457  },
 -   { 2097152,  2307163,  2307161  },
 -   { 4194304,  4613893,  4613891  },
 -   { 8388608,  9227641,  9227639  },
 -   { 16777216, 18455029, 18455027 },
 -   { 33554432, 36911011, 36911009 },
 -   { 67108864, 73819861, 73819859 },
 -   { 134217728,147639589,147639587},
 -   { 268435456,295279081,295279079},
 -   { 536870912,590559793,590559791},
 -   { 1073741824,   1181116273,   1181116271   },
 -   { 2147483648ul, 2362232233ul, 2362232231ul }
 +   { 3,4},
 +   { 7,8},
 +   { 14,   16   },
 +   { 28,   32   },
 +   { 57,   64   },
 +   { 115,  128  },
 +   { 230,  256  },
 +   { 460,  512  },
 +   { 921,  1024 },
 +   { 1843, 2048 },
 +   { 3686, 4096 },
 +   { 7372, 8192 },
 +   { 14745,16384},
 +   { 29491,32768},
 +   { 58982,65536},
 +   { 117964,   131072   },
 +   { 235929,   262144   },
 +   { 471859,   524288   },
 +   { 943718,   1048576  },
 +   { 1887436,  2097152  },
 +   { 3774873,  4194304  },
 +   { 7549747,  8388608  },
 +   { 15099494, 16777216 },
 +   { 30198988, 33554432 },
 +   { 60397977, 67108864 },
 +   { 120795955,134217728},
 +   { 241591910,268435456},
 +   { 483183820,536870912},
 +   { 966367641,1073741824   },
 +   { 

Re: [Mesa-dev] [PATCH] Allow static libstdc++/libgcc linking if selected

2015-03-16 Thread Vivek Das Mohapatra

You do realize that statically linking libstdc++ and libgcc_s while
dynamically linking LLVM won't work around the problem caused by Steam
overriding an older version of libstdc++, because LLVM will still be
dynamically linked against that?


As you'll note from my first submission, I sent a patchset (for LLVM)
which addressed that too, and if LLVM is statically linked you can also
end up with no libstdcc++.so linkage there either.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] rbug: update the READMEs to reflect the import of rbug-gui

2015-03-16 Thread Emil Velikov
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/auxiliary/rbug/README |  2 +-
 src/gallium/docs/source/debugging.rst |  4 ++--
 src/gallium/docs/source/distro.rst|  2 +-
 src/gallium/drivers/rbug/README   |  5 ++---
 src/gallium/tools/rbug-gui/README | 28 +---
 5 files changed, 15 insertions(+), 26 deletions(-)

diff --git a/src/gallium/auxiliary/rbug/README 
b/src/gallium/auxiliary/rbug/README
index c515643..0fe172a 100644
--- a/src/gallium/auxiliary/rbug/README
+++ b/src/gallium/auxiliary/rbug/README
@@ -18,7 +18,7 @@ progs/rbug/README
 
 for a GUI see:
 
-  http://cgit.freedesktop.org/mesa/rbug-gui
+src/gallium/tools/rbug-gui
 
 
 --
diff --git a/src/gallium/docs/source/debugging.rst 
b/src/gallium/docs/source/debugging.rst
index 8566dbd..e38a700 100644
--- a/src/gallium/docs/source/debugging.rst
+++ b/src/gallium/docs/source/debugging.rst
@@ -104,6 +104,6 @@ Remote Debugger
 
 The remote debugger, commonly known as rbug, allows for runtime inspections of
 :ref:`Context`, :ref:`Screen`, :ref:`Resource` and :ref:`Shader` objects; and
-pausing and stepping of :ref:`Draw` calls. Is used with rbug-gui which is
-hosted outside of the main mesa repository. rbug is can be used over a network
+pausing and stepping of :ref:`Draw` calls. It is used with rbug-gui which is
+localted in src/gallium/tools/rbug-gui. rbug can be used over a network
 connection, so the debugger does not need to be on the same machine.
diff --git a/src/gallium/docs/source/distro.rst 
b/src/gallium/docs/source/distro.rst
index 000b031..bf97033 100644
--- a/src/gallium/docs/source/distro.rst
+++ b/src/gallium/docs/source/distro.rst
@@ -83,7 +83,7 @@ Wrapper driver. Trace dumps an XML record of the calls made 
to the
 Rbug
 
 
-Wrapper driver. :ref:`rbug` driver used with stand alone rbug-gui.
+Wrapper driver. :ref:`rbug` driver used with the rbug-gui tool.
 
 .. _galahad:
 
diff --git a/src/gallium/drivers/rbug/README b/src/gallium/drivers/rbug/README
index 0edf0ad..f31bdec 100644
--- a/src/gallium/drivers/rbug/README
+++ b/src/gallium/drivers/rbug/README
@@ -15,9 +15,8 @@ Do
 
 which should open gallium remote debugging session. While the program is 
running
 you can launch the small remote debugging application from progs/rbug. More
-information is in that directory. Also for a gui see:
-
-   http://cgit.freedesktop.org/mesa/rbug-gui
+information is in that directory. For interactive debugging the GUI is located
+under src/gallium/tools/rbug-gui.
 
 
 = Integrating =
diff --git a/src/gallium/tools/rbug-gui/README 
b/src/gallium/tools/rbug-gui/README
index 4e6744a..bc583ab 100644
--- a/src/gallium/tools/rbug-gui/README
+++ b/src/gallium/tools/rbug-gui/README
@@ -7,32 +7,20 @@ It is written in C and uses gtk, gtkglext and Gallium.
 
 
 For information about protocol (de)marshaling see:
-$(MESA)/src/gallium/auxiliary/rbug/README
+src/gallium/auxiliary/rbug/README
 
 for information about driver integration look in:
-$(MESA)/src/gallium/drivers/rbug/README
+src/gallium/drivers/rbug/README
 
 
-= Building =
+= Dependencies =
 
-You need to have checked out a mesa repository in a sibling directory to this
-directory called mesa, as currently the build looks for mesa in ../mesa/.
-You also need to build a debug build of mesa with with gallium so that the
-needed library exist:
-
-   $(MESA)/src/gallium/auxiliary/libgallium.a
-
-
-The gtk dependancies should be satisfied on debian based system with:
+The tool uses GTK for its GUI. The dependancies on a Debian based system should
+be satisfied with:
 
 sudo apt-get install libgtk2.0-dev libgtkglext1-dev
 
 
-Then just do:
- ./autogen.sh
- make
-
-
 = Usage =
 
 Make sure that you driver has trace integration, see above. Then from on
@@ -46,8 +34,10 @@ From the debugging computer launch rbug-gui from this folder.
 
 ./rbug-gui [ip|hostname]
 
-If no ip/hostname is give rbug-gui will ask you for a ip and port. You can
-also call make run which will connect automaticaly to localhost.
+If no ip/hostname is given rbug-gui will ask you for a ip and port. To connect
+to localhost run
+
+./rbug-gui localhost
 
 
 You should now see the debugger. On the left you have a list of resources
-- 
2.3.1

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


Re: [Mesa-dev] Summer of Code ideas (maybe just an idea wishlist?)

2015-03-16 Thread Marek Olšák
On Fri, Mar 13, 2015 at 6:24 PM, Laura Ekstrand la...@jlekstrand.net wrote:
 We should try to steer people away from just writing Piglit tests for GSoC,
 unless they have a specific mentor in mind and have already talked to him or
 her.  In my experience, Piglit tests are difficult to do well because each
 one is drastically different from the others and involves cultivating a
 fairly deep understanding of the the OpenGL function in question.

 A project pairing a specific extension with relevant tests (like Martin and
 I have done with ARB_dsa) would be better as long as it's a fairly specific
 domain of the OpenGL spec.  That way, the student can study the spec for one
 specific set of objects or entry points and cultivate the necessary
 understanding they need to write the related tests.

 A lot of the emails we've gotten from students saying I want to write 4.x
 Piglit tests have been too broad/generic and would be difficult for a
 student to master in a summer without lots of mentoring/direction from the
 community.

We should also take into account that there are people having a degree
in or studying computer science with specialization in computer
graphics or having strong knowledge of OpenGL already. Such people are
difficult to find, but they would be very effective with very little
(if any) mentoring. Gamedev-related forums (gamedev.net, opengl.org,
etc.) should have a lot of talented people suited for this job, but
none of them are probably aware of the Mesa/Piglit GSoC.

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


[Mesa-dev] [Bug 86326] clEnqueueNDRangeKernel global_work_offset ignored

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=86326

--- Comment #5 from Tom Stellard tstel...@gmail.com ---
Comment on attachment 114337
  -- https://bugs.freedesktop.org/attachment.cgi?id=114337
libclc get_global_offset() and get_global_id() patch

Review of attachment 114337:
-

Hi,

Thanks for the patch.  Would you be able to send your updated version to:
libclc-...@pcc.me.uk

::: ptx-nvidiacl/lib/workitem/get_global_offset.cl
@@ +6,5 @@
 +  case 1:  return __builtin_ptx_read_global_offset_y();
 +  case 2:  return __builtin_ptx_read_global_offset_z();*/
 +  default: return 0;
 +  }
 +}

Why is this commented out?  Also the function name is wrong:
get_local_offset().

::: r600/lib/workitem/get_global_offset.ll
@@ +14,5 @@
 +  %z = call i32 @llvm.AMDGPU.read.global.offset.z() nounwind readnone
 +  ret i32 %z
 +default:
 +  ret i32 0
 +}

This should be implemented in OpenCL C rather than LLVM IR.  Now that
DataLayouts are mandatory, it makes implementing common code in LLVM IR much
more difficult.

You can use the builtins defined in your previous patch for this:

__builtin_amdgpu_read_global_offset_x ...

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallium/sw/kms: trivial cleanups

2015-03-16 Thread Brian Paul

On 03/16/2015 05:50 AM, Emil Velikov wrote:

Remove the forward declaration and make use of the DEBUG_PRINT macro for
debug builds.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
  src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c | 6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c 
b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
index ce3de78..e61a173 100644
--- a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
+++ b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
@@ -51,16 +51,14 @@

  #include state_tracker/sw_winsys.h
  #include state_tracker/drm_driver.h
+#include kms_dri_sw_winsys.h

-#if 0
+#ifdef DEBUG
  #define DEBUG_PRINT(msg, ...) fprintf(stderr, msg, __VA_ARGS__)
  #else
  #define DEBUG_PRINT(msg, ...)
  #endif

-struct sw_winsys;
-
-struct sw_winsys *kms_dri_create_winsys(int fd);

  struct kms_sw_displaytarget
  {



Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Mesa-dev] [PATCH 2/2] radeonsi: implement TGSI_OPCODE_BFI (v2)

2015-03-16 Thread Tom Stellard
On Sun, Mar 15, 2015 at 07:59:52PM +0100, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 v2: Don't use the intrinsics, the shader backend can recognize these
 patterns and generates optimal code automatically.

Reviewed-by: Tom Stellard thomas.stell...@amd.com

 ---
  .../drivers/radeon/radeon_setup_tgsi_llvm.c| 34 
 ++
  1 file changed, 34 insertions(+)
 
 diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c 
 b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
 index 0034b56..d89e2b4 100644
 --- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
 +++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
 @@ -1234,6 +1234,39 @@ build_tgsi_intrinsic_nomem(
   build_tgsi_intrinsic(action, bld_base, emit_data, 
 LLVMReadNoneAttribute);
  }
  
 +static void emit_bfi(const struct lp_build_tgsi_action * action,
 +  struct lp_build_tgsi_context * bld_base,
 +  struct lp_build_emit_data * emit_data)
 +{
 + struct gallivm_state *gallivm = bld_base-base.gallivm;
 + LLVMBuilderRef builder = gallivm-builder;
 + LLVMValueRef bfi_args[3];
 +
 + // Calculate the bitmask: (((1  src3) - 1)  src2
 + bfi_args[0] = LLVMBuildShl(builder,
 +LLVMBuildSub(builder,
 + LLVMBuildShl(builder,
 +  
 bld_base-int_bld.one,
 +  
 emit_data-args[3], ),
 + bld_base-int_bld.one, ),
 +emit_data-args[2], );
 +
 + bfi_args[1] = LLVMBuildShl(builder, emit_data-args[1],
 +emit_data-args[2], );
 +
 + bfi_args[2] = emit_data-args[0];
 +
 + /* Calculate:
 +  *   (arg0  arg1) | (~arg0  arg2) = arg2 ^ (arg0  (arg1 ^ arg2)
 +  * Use the right-hand side, which the LLVM backend can convert to V_BFI.
 +  */
 + emit_data-output[emit_data-chan] =
 + LLVMBuildXor(builder, bfi_args[2],
 + LLVMBuildAnd(builder, bfi_args[0],
 + LLVMBuildXor(builder, bfi_args[1], bfi_args[2],
 +  ), ), );
 +}
 +
  /* this is ffs in C */
  static void emit_lsb(const struct lp_build_tgsi_action * action,
struct lp_build_tgsi_context * bld_base,
 @@ -1381,6 +1414,7 @@ void radeon_llvm_context_init(struct 
 radeon_llvm_context * ctx)
   bld_base-op_actions[TGSI_OPCODE_ABS].intr_name = fabs;
   bld_base-op_actions[TGSI_OPCODE_AND].emit = emit_and;
   bld_base-op_actions[TGSI_OPCODE_ARL].emit = emit_arl;
 + bld_base-op_actions[TGSI_OPCODE_BFI].emit = emit_bfi;
   bld_base-op_actions[TGSI_OPCODE_BGNLOOP].emit = bgnloop_emit;
   bld_base-op_actions[TGSI_OPCODE_BREV].emit = 
 build_tgsi_intrinsic_nomem;
   bld_base-op_actions[TGSI_OPCODE_BREV].intr_name = llvm.AMDGPU.brev;
 -- 
 2.1.0
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 86326] clEnqueueNDRangeKernel global_work_offset ignored

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=86326

--- Comment #4 from Tom Stellard tstel...@gmail.com ---
Comment on attachment 114336
  -- https://bugs.freedesktop.org/attachment.cgi?id=114336
LLVM AMDGPU get_global_offset() patch

Review of attachment 114336:
-

Hi, Thanks for the patch.  After making the changes below, could you send the
new patch to llvm-comm...@cs.uiuc.edu?

::: lib/Target/R600/SIInstrInfo.h
@@ -371,4 +371,4 @@
 GLOBAL_SIZE_Z = 20,
 LOCAL_SIZE_X = 24,
 LOCAL_SIZE_Y = 28,
  -  LOCAL_SIZE_Z = 32
  +  LOCAL_SIZE_Z = 32,

  +  LOCAL_SIZE_Z = 32,

This additional comma is unnecessary.

We should add another enum here for KernelABIInputOffsets and then add entries
for WORK_DIM and GLOBAL_OFFSET_{X,Y,Z}, and use these instead of constants in
SIISelLowering.cp

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Summer of Code ideas (maybe just an idea wishlist?)

2015-03-16 Thread Martin Peres

On 13/03/15 19:24, Laura Ekstrand wrote:
We should try to steer people away from just writing Piglit tests for 
GSoC, unless they have a specific mentor in mind and have already 
talked to him or her.  In my experience, Piglit tests are difficult to 
do well because each one is drastically different from the others and 
involves cultivating a fairly deep understanding of the the OpenGL 
function in question.


A project pairing a specific extension with relevant tests (like 
Martin and I have done with ARB_dsa) would be better as long as it's a 
fairly specific domain of the OpenGL spec. That way, the student can 
study the spec for one specific set of objects or entry points and 
cultivate the necessary understanding they need to write the related 
tests.


That is indeed something ideal, but 3 months is likely too short for 
this unless it is done on some trivial extensions.




A lot of the emails we've gotten from students saying I want to write 
4.x Piglit tests have been too broad/generic and would be difficult 
for a student to master in a summer without lots of 
mentoring/direction from the community.


I was the one who moved this task from last year's ideas list. The way I 
see it is that many are more familiar with writing opengl code than 
writing drivers. For those students, this project could make sense. The 
questions we got so far did not answer the list of requirements so I 
would say that the students have not been reading this properly.


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


[Mesa-dev] Merging rbug-gui into mesa

2015-03-16 Thread Emil Velikov
Hi all,

As mentioned in another thread [1] there is interest in keeping the rbug 
driver. Although it's user - rbug-gui, lives in a repo outside of mesa 
leading to issues whenever we change/re-factor mesa. Considering that 
the tool/repo does not have branches that follow mesa's and the mesa 
and gallium's interfaces are not backward compatible, the consensus was 
to merge the tool into mesa.

The history of the tool (apart form configure.ac/Makefile.in) has been 
preserved, to ease git log/blame.

A branch rbug-gui-import at https://github.com/evelikov/Mesa/ is 
available for testing.

-Emil

[1] http://lists.freedesktop.org/archives/mesa-dev/2015-March/078393.html


Merge remote-tracking branch 'rbug-gui/rbug-gui-import' into rbug-gui-import

This merges the rbui-gui tool within the main mesa tree. This allows us
to keep the tool in sync, due to its dependency of internal mesa/gallium
components.

This import was done with commit c041f74a49a(rbug-gui: add a spin button
to select the layer index to display) as a base and running the script

$ git filter-branch -f --tree-filter /tmp/rbug-gui-filter
mkdir -p src1/gallium/tools/rbug-gui

rm -f autogen.sh configure.ac Makefile.in .gitignore
mv README res src todo.txt src1/gallium/tools/rbug-gui/
mv src1 src



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


Re: [Mesa-dev] [PATCH 11/13] i965: Add untyped surface write opcode.

2015-03-16 Thread Francisco Jerez
Pohjolainen, Topi topi.pohjolai...@intel.com writes:

 On Fri, Feb 27, 2015 at 05:34:54PM +0200, Francisco Jerez wrote:
 ---
  src/mesa/drivers/dri/i965/brw_defines.h|  1 +
  src/mesa/drivers/dri/i965/brw_eu.h |  7 +++
  src/mesa/drivers/dri/i965/brw_eu_emit.c| 51 
 ++
  src/mesa/drivers/dri/i965/brw_fs.cpp   |  4 ++
  src/mesa/drivers/dri/i965/brw_fs_generator.cpp |  6 +++
  .../drivers/dri/i965/brw_schedule_instructions.cpp |  1 +
  src/mesa/drivers/dri/i965/brw_shader.cpp   |  3 ++
  src/mesa/drivers/dri/i965/brw_vec4.cpp |  2 +
  src/mesa/drivers/dri/i965/brw_vec4_generator.cpp   |  6 +++
  9 files changed, 81 insertions(+)

 Just a few formatting nits:

 Reviewed-by: Topi Pohjolainen topi.pohjolai...@intel.com

Okay, I've taken your suggestions into account.  Thanks!

 
 diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
 b/src/mesa/drivers/dri/i965/brw_defines.h
 index 7660feb..e56f49c 100644
 --- a/src/mesa/drivers/dri/i965/brw_defines.h
 +++ b/src/mesa/drivers/dri/i965/brw_defines.h
 @@ -904,6 +904,7 @@ enum opcode {
  
 SHADER_OPCODE_UNTYPED_ATOMIC,
 SHADER_OPCODE_UNTYPED_SURFACE_READ,
 +   SHADER_OPCODE_UNTYPED_SURFACE_WRITE,
  
 SHADER_OPCODE_GEN4_SCRATCH_READ,
 SHADER_OPCODE_GEN4_SCRATCH_WRITE,
 diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
 b/src/mesa/drivers/dri/i965/brw_eu.h
 index 9cc9123..cad956b 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu.h
 +++ b/src/mesa/drivers/dri/i965/brw_eu.h
 @@ -414,6 +414,13 @@ brw_untyped_surface_read(struct brw_compile *p,
   unsigned num_channels);
  
  void
 +brw_untyped_surface_write(struct brw_compile *p,
 +  struct brw_reg payload,
 +  struct brw_reg surface,
 +  unsigned msg_length,
 +  unsigned num_channels);
 +
 +void
  brw_pixel_interpolator_query(struct brw_compile *p,
   struct brw_reg dest,
   struct brw_reg mrf,
 diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
 b/src/mesa/drivers/dri/i965/brw_eu_emit.c
 index 34695bf..f5b8fa9 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
 +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
 @@ -2893,6 +2893,57 @@ brw_untyped_surface_read(struct brw_compile *p,
p, insn, num_channels);
  }
  
 +static void
 +brw_set_dp_untyped_surface_write_message(struct brw_compile *p,
 + struct brw_inst *insn,
 + unsigned num_channels)
 +{
 +   const struct brw_context *brw = p-brw;
 +   /* Set mask of 32-bit channels to drop. */
 +   unsigned msg_control = (0xf  (0xf  num_channels));

 Could drop the extra () here.

 +
 +   if (brw_inst_access_mode(brw, p-current) == BRW_ALIGN_1) {
 +  if (p-compressed)
 + msg_control |= 1  4; /* SIMD16 mode */
 +  else
 + msg_control |= 2  4; /* SIMD8 mode */
 +   } else {
 +  if (brw-gen = 8 || brw-is_haswell)
 + msg_control |= 0  4; /* SIMD4x2 mode */
 +  else
 + msg_control |= 2  4; /* SIMD8 mode */
 +   }
 +
 +   brw_inst_set_dp_msg_type(brw, insn,
 +(brw-gen = 8 || brw-is_haswell ?
 + HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_WRITE :
 + GEN7_DATAPORT_DC_UNTYPED_SURFACE_WRITE));

 Same here.

 +   brw_inst_set_dp_msg_control(brw, insn, msg_control);
 +}
 +
 +void
 +brw_untyped_surface_write(struct brw_compile *p,
 +  struct brw_reg payload,
 +  struct brw_reg surface,
 +  unsigned msg_length,
 +  unsigned num_channels)
 +{
 +   const struct brw_context *brw = p-brw;
 +   const unsigned sfid = (brw-gen = 8 || p-brw-is_haswell ?
 +  HSW_SFID_DATAPORT_DATA_CACHE_1 :
 +  GEN7_SFID_DATAPORT_DATA_CACHE);
 +   const bool align1 = (brw_inst_access_mode(brw, p-current) == 
 BRW_ALIGN_1);

 And here.

 +   /* Mask out unused components -- See comment in brw_untyped_atomic(). */
 +   const unsigned mask = (brw-gen == 7  !brw-is_haswell  !align1 ?
 +  WRITEMASK_X : WRITEMASK_XYZW);

 And here.

 +   struct brw_inst *insn = brw_send_indirect_surface_message(
 +  p, sfid, brw_writemask(brw_null_reg(), mask),
 +  payload, surface, msg_length, 0, align1);
 +
 +   brw_set_dp_untyped_surface_write_message(
 +  p, insn, num_channels);
 +}
 +
  void
  brw_pixel_interpolator_query(struct brw_compile *p,
   struct brw_reg dest,
 diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs.cpp
 index 6e6ce58..6d363f1 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
 @@ -508,6 +508,7 @@ fs_inst::is_send_from_grf() const
 

[Mesa-dev] [PATCH 1/2] tools/rbug-gui: add it to the existing automake build

2015-03-16 Thread Emil Velikov
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 Makefile.am|  3 ++-
 configure.ac   | 15 +++
 src/gallium/Makefile.am|  6 +-
 src/gallium/tools/rbug-gui/.gitignore  |  1 +
 src/gallium/tools/rbug-gui/Makefile.am | 27 +++
 5 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 src/gallium/tools/rbug-gui/.gitignore
 create mode 100644 src/gallium/tools/rbug-gui/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index f4f0912..91388b9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,7 +32,8 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \
--enable-vdpau \
--enable-xa \
--enable-xvmc \
-   --with-egl-platforms=x11,wayland,drm
+   --with-egl-platforms=x11,wayland,drm \
+   --enable-gallium-rbug-gui
 
 ACLOCAL_AMFLAGS = -I m4
 
diff --git a/configure.ac b/configure.ac
index a3b0ebd..a9a0436 100644
--- a/configure.ac
+++ b/configure.ac
@@ -808,6 +808,12 @@ AC_ARG_ENABLE([gallium-tests],
 [enable_gallium_tests=$enableval],
 [enable_gallium_tests=no])
 
+AC_ARG_ENABLE([gallium-rbug-gui],
+[AS_HELP_STRING([--enable-gallium-rbug-gui],
+[Enable the GUI tool for the Gallium Remote Debugger) 
@:@default=disabled@:@])],
+[enable_gallium_rbug_gui=$enableval],
+[enable_gallium_rbug_gui=no])
+
 # Option for Gallium drivers
 
 # Keep this in sync with the --with-gallium-drivers help string default value
@@ -1987,6 +1993,14 @@ if test x$enable_gallium_tests = xyes; then
 fi
 AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test x$enable_gallium_tests = xyes)
 
+if test x$enable_gallium_rbug_gui = xyes; then
+if test -z $with_gallium_drivers; then
+AC_MSG_ERROR([Building the rbug GUI requires gallium.])
+fi
+PKG_CHECK_MODULES(GTK, [gtkglext-1.0])
+fi
+AM_CONDITIONAL(HAVE_GALLIUM_RBUG_GUI, test x$enable_gallium_rbug_gui = xyes)
+
 dnl Directory for VDPAU libs
 AC_ARG_WITH([vdpau-libdir],
 [AS_HELP_STRING([--with-vdpau-libdir=DIR],
@@ -2399,6 +2413,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/xvmc/Makefile
src/gallium/tests/trivial/Makefile
src/gallium/tests/unit/Makefile
+   src/gallium/tools/rbug-gui/Makefile
src/gallium/winsys/freedreno/drm/Makefile
src/gallium/winsys/i915/drm/Makefile
src/gallium/winsys/intel/drm/Makefile
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
index 652cb13..3688a74 100644
--- a/src/gallium/Makefile.am
+++ b/src/gallium/Makefile.am
@@ -178,8 +178,12 @@ EXTRA_DIST += \
state_trackers/wgl targets/libgl-gdi \
targets/graw-gdi targets/graw-null  targets/graw-xlib \
state_trackers/hgl targets/haiku-softpipe \
-   tools
+   tools/addr2line.sh tools/trace
 
+if HAVE_GALLIUM_RBUG_GUI
+SUBDIRS += \
+   tools/rbug-gui
+endif
 
 ##
 ## Gallium tests
diff --git a/src/gallium/tools/rbug-gui/.gitignore 
b/src/gallium/tools/rbug-gui/.gitignore
new file mode 100644
index 000..fb6cbdd
--- /dev/null
+++ b/src/gallium/tools/rbug-gui/.gitignore
@@ -0,0 +1 @@
+rbug-gui
diff --git a/src/gallium/tools/rbug-gui/Makefile.am 
b/src/gallium/tools/rbug-gui/Makefile.am
new file mode 100644
index 000..99c8b22
--- /dev/null
+++ b/src/gallium/tools/rbug-gui/Makefile.am
@@ -0,0 +1,27 @@
+include $(top_srcdir)/src/gallium/Automake.inc
+
+AM_CFLAGS = \
+   -I$(srcdir)/src \
+   $(GALLIUM_CFLAGS) \
+   $(VISIBILITY_CFLAGS) \
+   $(GTK_CFLAGS)
+
+noinst_PROGRAMS = rbug-gui
+
+rbug_gui_SOURCES = \
+   src/ask.c \
+   src/context.c \
+   src/draw.c \
+   src/main.c \
+   src/program.h \
+   src/rbug.c \
+   src/shader.c \
+   src/texture.c
+
+rbug_gui_LDADD = \
+   $(top_builddir)/src/gallium/auxiliary/libgallium.la \
+   $(top_builddir)/src/util/libmesautil.la \
+   $(GALLIUM_COMMON_LIB_DEPS) \
+   $(GTK_LIBS)
+
+EXTRA_DIST = README todo.txt res
-- 
2.3.1

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


Re: [Mesa-dev] [PATCH 2/5] i965/fs: Emit better b2f of an expression on GEN4 and GEN5

2015-03-16 Thread Tapani Pälli

Hi Ian;

Is there some particular Piglit test case that hits this path and is it 
possible with gen5 (by removing gen check)? I've tried this with 
handicrafted shader_test and also shader-db and cannot hit the 
conditions for changes to happen. Would be nice to be able to run 
examine changes and understand this better.



On 03/11/2015 10:44 PM, Ian Romanick wrote:

From: Ian Romanick ian.d.roman...@intel.com

On platforms that do not natively generate 0u and ~0u for Boolean
results, b2f expressions that look like

f = b2f(expr cmp 0)

will generate better code by pretending the expression is

 f = ir_triop_sel(0.0, 1.0, expr cmp 0)

This is because the last instruction of expr can generate the
condition code for the cmp 0.  This avoids having to do the -(b  1)
trick to generate 0u or ~0u for the Boolean result.  This means code like

 mov(16) g161F 1F
 mul.ge.f0(16)   nullg68,8,1F  g148,8,1F
 (+f0) sel(16)   m61F  g168,8,1F 0F

will be generated instead of

 mul(16) g21F  g128,8,1F g48,8,1F
 cmp.ge.f0(16)   g21D  g48,8,1F  0F
 and(16) g41D  g28,8,1D  1D
 and(16) m61D  -g48,8,1D 0x3f80UD

v2: When the comparison is either == 0.0 or != 0.0 use the knowledge
that the true (or false) case already results in zero would allow better
code generation by possibly avoiding a load-immediate instruction.

v3: Apply the optimization even when neither comparitor is zero.

Shader-db results:

GM45 (0x2A42):
total instructions in shared programs: 3551002 - 3550829 (-0.00%)
instructions in affected programs: 33269 - 33096 (-0.52%)
helped:121

Iron Lake (0x0046):
total instructions in shared programs: 4993327 - 4993146 (-0.00%)
instructions in affected programs: 34199 - 34018 (-0.53%)
helped:129

No change on other platforms.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Cc: Tapani Palli tapani.pa...@intel.com
---
  src/mesa/drivers/dri/i965/brw_fs.h   |   2 +
  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 101 +--
  2 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index d9d5858..075e90c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -307,6 +307,7 @@ public:
   const fs_reg a);
 void emit_minmax(enum brw_conditional_mod conditionalmod, const fs_reg 
dst,
  const fs_reg src0, const fs_reg src1);
+   bool try_emit_b2f_of_comparison(ir_expression *ir);
 bool try_emit_saturate(ir_expression *ir);
 bool try_emit_line(ir_expression *ir);
 bool try_emit_mad(ir_expression *ir);
@@ -317,6 +318,7 @@ public:
 bool opt_saturate_propagation();
 bool opt_cmod_propagation();
 void emit_bool_to_cond_code(ir_rvalue *condition);
+   void emit_bool_to_cond_code_of_reg(ir_expression *expr, fs_reg op[3]);
 void emit_if_gen6(ir_if *ir);
 void emit_unspill(bblock_t *block, fs_inst *inst, fs_reg reg,
   uint32_t spill_offset, int count);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 3025a9d..3d79796 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -475,6 +475,87 @@ fs_visitor::try_emit_mad(ir_expression *ir)
 return true;
  }

+bool
+fs_visitor::try_emit_b2f_of_comparison(ir_expression *ir)
+{
+   /* On platforms that do not natively generate 0u and ~0u for Boolean
+* results, b2f expressions that look like
+*
+* f = b2f(expr cmp 0)
+*
+* will generate better code by pretending the expression is
+*
+* f = ir_triop_csel(0.0, 1.0, expr cmp 0)
+*
+* This is because the last instruction of expr can generate the
+* condition code for the cmp 0.  This avoids having to do the -(b  1)
+* trick to generate 0u or ~0u for the Boolean result.  This means code like
+*
+* mov(16) g161F 1F
+* mul.ge.f0(16)   nullg68,8,1F  g148,8,1F
+* (+f0) sel(16)   m61F  g168,8,1F 0F
+*
+* will be generated instead of
+*
+* mul(16) g21F  g128,8,1F g48,8,1F
+* cmp.ge.f0(16)   g21D  g48,8,1F  0F
+* and(16) g41D  g28,8,1D  1D
+* and(16) m61D  -g48,8,1D 0x3f80UD
+*
+* When the comparison is either == 0.0 or != 0.0 using the knowledge that
+* the true (or false) case already results in zero would allow better code
+* generation by possibly avoiding a load-immediate instruction.
+*/
+   ir_expression *cmp = ir-operands[0]-as_expression();
+   if (cmp == NULL)
+  return false;
+
+   if (cmp-operation 

Re: [Mesa-dev] [PATCH 00/10] radeonsi: Line and polygon smoothing

2015-03-16 Thread Alex Deucher
On Mon, Mar 16, 2015 at 7:20 AM, Marek Olšák mar...@gmail.com wrote:
 I'm pretty sure this was first supported in SI. See register deltas or
 DB block deltas.

The DB_EQAA stuff was added in cayman, but I don't remember what
specific features it supported relative to SI.  You would probably
know better.

Alex


 Marek

 On Sun, Mar 15, 2015 at 11:07 PM, Alex Deucher alexdeuc...@gmail.com wrote:
 On Sun, Mar 15, 2015 at 3:48 PM, Marek Olšák mar...@gmail.com wrote:
 This mainly adds support for line and polygon smoothing. Only GCN supports 
 it in hardware.


 I think technically cayman and TN/RL support this as well.

 Alex

 1-2: cleanups
 3-6: smoothing
 7-10: more cleanups

 I think point smoothing is the last missing thing as far as legacy features 
 are concerned.

 Please review.

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


[Mesa-dev] [PATCH] gallium/sw/kms: trivial cleanups

2015-03-16 Thread Emil Velikov
Remove the forward declaration and make use of the DEBUG_PRINT macro for
debug builds.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c 
b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
index ce3de78..e61a173 100644
--- a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
+++ b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
@@ -51,16 +51,14 @@
 
 #include state_tracker/sw_winsys.h
 #include state_tracker/drm_driver.h
+#include kms_dri_sw_winsys.h
 
-#if 0
+#ifdef DEBUG
 #define DEBUG_PRINT(msg, ...) fprintf(stderr, msg, __VA_ARGS__)
 #else
 #define DEBUG_PRINT(msg, ...)
 #endif
 
-struct sw_winsys;
-
-struct sw_winsys *kms_dri_create_winsys(int fd);
 
 struct kms_sw_displaytarget
 {
-- 
2.3.1

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


Re: [Mesa-dev] [PATCH] i965: Emit IF/ELSE/ENDIF/WHILE JIP with type W on Gen7

2015-03-16 Thread Antía Puentes
Hi!,

On vie, 2015-03-13 at 10:42 -0700, Matt Turner wrote:
 On Fri, Mar 13, 2015 at 3:41 AM, Antia Puentes apuen...@igalia.com wrote:
  IvyBridge and Haswell PRM say that the JIP should be emitted
  with type W but we were using UD. The previous implementation
  did not show adverse effects, however changing the type to
  D caused a GPU hang, see bug 84557; IMHO it is safer to
  follow the specification thoroughly.
  ---
 
 The change seems fine to me, though changing the type to D never
 seemed like the thing that was actually causing the hang. It seemed
 much more likely that allowing the ELSE and ENDIF instructions to be
 compacted violated some assumption in our code and we misaligned some
 jump target by 8-bytes.
 
 I should investigate more.
 
 I'd probably remove the however changing the type to D caused a GPU
 hang, see bug 84557 comment from the commit.

I will remove the comment.

 Reviewed-by: Matt Turner matts...@gmail.com

Thanks for reviewing!


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


[Mesa-dev] [Bug 79629] [Dri3 bisected] piglit glx_GLX_ARB_create_context_current_with_no_framebuffer fail

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=79629

Gordon Jin gordon@intel.com changed:

   What|Removed |Added

   Priority|highest |high

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 89590] Crash in glLinkProgram with shaders with multiple constant arrays

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89590

Bug ID: 89590
   Summary: Crash in glLinkProgram with shaders with multiple
constant arrays
   Product: Mesa
   Version: 10.5
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: jl...@feralinteractive.com
QA Contact: mesa-dev@lists.freedesktop.org

Created attachment 114347
  -- https://bugs.freedesktop.org/attachment.cgi?id=114347action=edit
Reproducer

glLinkProgram crashes if there are multiple shaders with used arrays of
constants attached to the program, and the arrays have different numbers of
elements. For example:

Vertex shader:
#version 330
in vec2 in_position;
void main()
{
const float zs[4] = float[4](0, 0, 0, 0);
gl_Position = vec4(in_position, zs[int(in_position.x) % 4], 1.0);
}


Fragment shader:
#version 330
void main()
{
const vec4 colours[2] = vec4[2](vec4(1, 0, 0, 0), vec4(0, 1, 0, 0));
gl_FragColor = colours[int(gl_FragCoord.x) % 2];
}

The attached program uses these shaders and reproduces the bug.

Backtrace from Mesa 10.5.1:
 #0 linker::copy_constant_to_storage(gl_constant_value*, ir_constant const*, 
 glsl_base_type, unsigned int, unsigned int) 
 glsl/link_uniform_initializers.cpp:66
 #1 linker::set_uniform_initializer(void*, gl_shader_program*, char const*, 
 glsl_type const*, ir_constant*, unsigned int) 
 glsl/link_uniform_initializers.cpp:210
 #2 link_set_uniform_initializers(gl_shader_program*, unsigned int) 
 glsl/link_uniform_initializers.cpp:309
 #3 link_assign_uniform_locations(gl_shader_program*, unsigned int) 
 glsl/link_uniforms.cpp:1034
 #4 link_shaders(gl_context*, gl_shader_program*) glsl/linker.cpp:2869
 #5 _mesa_glsl_link_shader mesa/program/ir_to_mesa.cpp:3031
 #6 link_program mesa/main/shaderapi.c:932

The second argument to linker::copy_constant_to_storage, val, appears bogus, as
it points to something near 0x0.

The arrays of constants do not have to be declared const in the shader, as long
as all the element's values are known at compile time.

I found this using an AMD PITCAIRN gpu on Fedora 21, x86_64 architecture.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/10] radeonsi: Line and polygon smoothing

2015-03-16 Thread Marek Olšák
I'm pretty sure this was first supported in SI. See register deltas or
DB block deltas.

Marek

On Sun, Mar 15, 2015 at 11:07 PM, Alex Deucher alexdeuc...@gmail.com wrote:
 On Sun, Mar 15, 2015 at 3:48 PM, Marek Olšák mar...@gmail.com wrote:
 This mainly adds support for line and polygon smoothing. Only GCN supports 
 it in hardware.


 I think technically cayman and TN/RL support this as well.

 Alex

 1-2: cleanups
 3-6: smoothing
 7-10: more cleanups

 I think point smoothing is the last missing thing as far as legacy features 
 are concerned.

 Please review.

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


Re: [Mesa-dev] [PATCH] i965: Set nr_params to the number of uniform components in the VS/GS path.

2015-03-16 Thread Francisco Jerez
Francisco Jerez curroje...@riseup.net writes:

 Both do_vs_prog and do_gs_prog initialize brw_stage_prog_data::nr_params to
 the number of uniform *vectors* required by the shader rather than the number
 of uniform components, contradicting the comment.  This is inconsistent with
 what the state upload code and scalar path expect but it happens to work until
 Gen8 because vec4_visitor interprets it as a number of vectors on construction
 and later on overwrites its original value with the number of uniform
 components referenced by the shader.

 Also there's no need to add the number of samplers, they're not actually
 passed in as uniforms.

 Fixes a memory corruption issue on BDW with SIMD8 VS.

Ping?

 ---
  src/mesa/drivers/dri/i965/brw_gs.c |  6 +-
  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |  3 ++-
  src/mesa/drivers/dri/i965/brw_vs.c | 10 +-
  3 files changed, 4 insertions(+), 15 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_gs.c 
 b/src/mesa/drivers/dri/i965/brw_gs.c
 index c7ebe5f..ce3cba4 100644
 --- a/src/mesa/drivers/dri/i965/brw_gs.c
 +++ b/src/mesa/drivers/dri/i965/brw_gs.c
 @@ -69,11 +69,7 @@ do_gs_prog(struct brw_context *brw,
rzalloc_array(NULL, const gl_constant_value *, param_count);
 c.prog_data.base.base.pull_param =
rzalloc_array(NULL, const gl_constant_value *, param_count);
 -   /* Setting nr_params here NOT to the size of the param and pull_param
 -* arrays, but to the number of uniform components vec4_visitor
 -* needs. vec4_visitor::setup_uniforms() will set it back to a proper 
 value.
 -*/
 -   c.prog_data.base.base.nr_params = ALIGN(param_count, 4) / 4 + 
 gs-num_samplers;
 +   c.prog_data.base.base.nr_params = param_count;
  
 if (brw-gen = 7) {
if (gp-program.OutputType == GL_POINTS) {
 diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
 b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
 index 8b8b27f..f06ee53 100644
 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
 @@ -3624,7 +3624,8 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
  */
 this-uniform_array_size = 1;
 if (prog_data) {
 -  this-uniform_array_size = MAX2(stage_prog_data-nr_params, 1);
 +  this-uniform_array_size = MAX2(CEILING(stage_prog_data-nr_params, 4),
 +  1);
 }
  
 this-uniform_size = rzalloc_array(mem_ctx, int, 
 this-uniform_array_size);
 diff --git a/src/mesa/drivers/dri/i965/brw_vs.c 
 b/src/mesa/drivers/dri/i965/brw_vs.c
 index 2d56b74..f360d4e 100644
 --- a/src/mesa/drivers/dri/i965/brw_vs.c
 +++ b/src/mesa/drivers/dri/i965/brw_vs.c
 @@ -241,15 +241,7 @@ do_vs_prog(struct brw_context *brw,
rzalloc_array(NULL, const gl_constant_value *, param_count);
 stage_prog_data-pull_param =
rzalloc_array(NULL, const gl_constant_value *, param_count);
 -
 -   /* Setting nr_params here NOT to the size of the param and pull_param
 -* arrays, but to the number of uniform components vec4_visitor
 -* needs. vec4_visitor::setup_uniforms() will set it back to a proper 
 value.
 -*/
 -   stage_prog_data-nr_params = ALIGN(param_count, 4) / 4;
 -   if (vs) {
 -  stage_prog_data-nr_params += vs-num_samplers;
 -   }
 +   stage_prog_data-nr_params = param_count;
  
 GLbitfield64 outputs_written = vp-program.Base.OutputsWritten;
 prog_data.inputs_read = vp-program.Base.InputsRead;
 -- 
 2.1.3

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


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


Re: [Mesa-dev] [PATCH] gallivm: abort properly when running out of buffer space in lp_disassembly

2015-03-16 Thread Brian Paul

On 03/13/2015 04:46 PM, srol...@vmware.com wrote:

From: Roland Scheidegger srol...@vmware.com

Before this actually ran into an infinite loop printing out invalid...
---
  src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 12 
  1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
index 402d29e..2c4ed21 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
@@ -399,19 +399,23 @@ disassemble(const void* func, llvm::raw_ostream  Out)
  break;
   }
}
+
+  if (pc = extent) {
+ Out  disassembly larger than   extent  bytes, aborting\n;
+ break;
+  }
 }

+   Out  \n;
+   Out.flush();
+
 /*
  * Print GDB command, useful to verify output.
  */
-
 if (0) {
_debug_printf(disassemble %p %p\n, bytes, bytes + pc);
 }

-   Out  \n;
-   Out.flush();
-
 return pc;
  }




Reviewed-by: Brian Paul bri...@vmware.com

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


[Mesa-dev] [Bug 89584] Minor bug in OpenCL example

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89584

Tom Stellard tstel...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Tom Stellard tstel...@gmail.com ---
Thanks for the patch, I have pushed this to my repository.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl: don't fill client apis string forever.

2015-03-16 Thread Matt Turner
On Sun, Mar 15, 2015 at 10:22 PM, Dave Airlie airl...@gmail.com wrote:
 We never reset the string on eglTerminate, so it grows
 for ever on multiple eglInitialise.

 Signed-off-by: Dave Airlie airl...@redhat.com
 ---
  src/egl/main/eglapi.c | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
 index bd8ffa0..d139038 100644
 --- a/src/egl/main/eglapi.c
 +++ b/src/egl/main/eglapi.c
 @@ -514,6 +514,7 @@ eglTerminate(EGLDisplay dpy)

drv-API.Terminate(drv, disp);
/* do not reset disp-Driver */
 +  disp-ClientAPIsString[0] = 0;

Don't you need to do the same for dpy-ExtensionsString?

With that added, or me told why it's not needed

Reviewed-by: Matt Turner matts...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/1] Fix runtime error with uClibc

2015-03-16 Thread Emil Velikov
Hi Bernd,
On 15/03/15 11:27, Bernd Kuhls wrote:
 Patch inspired by
 https://www.winehq.org/pipermail/wine-bugs/2011-September/288987.html
 http://git.alpinelinux.org/cgit/aports/tree/main/wine/uclibc-fmaxf-fminf.patch?id=c9b491b6099eec02a835ffd05539b5c783c6c43a
 
 Starting an app using mesa3d 10.5.x, Kodi for example, fails:
 
 /usr/lib/kodi/kodi.bin: symbol 'fminf': can't resolve symbol in lib 
 '/usr/lib/dri/i965_dri.so'.
 libGL error: unable to load driver: i965_dri.so
 libGL error: driver pointer missing
 libGL error: failed to load driver: i965
 libGL error: unable to load driver: swrast_dri.so
 libGL error: failed to load driver: swrast
 
 Here is some background information about the fminf/fmaxf situation in uClibc:
 http://thread.gmane.org/gmane.comp.lib.uclibc.general/24189
 
 Please backport this patch to the 10.5 branch.
 
I second Matt's concern here. It seems that the uclibc devs are pulling
a silly excuse here. That aside I believe everyone will be happy with a
solution like the following:

 - Add a check in configure that the function is declared, but the
binary fails to link. AC_CHECK_FUNC or AC_COMPILE_IFELSE/AC_LINK_IFELSE
+ AC_LANG_PROGRAM, are the things you're interested.

 - If that's the case set a define, and use it to guard a custom
solution in include/c99_math.h. Please do consider that one or both
floats can be NaN.


To nominate the patch for 10.5 just add the following line in the commit
message.

Cc: 10.5 mesa-sta...@lists.freedesktop.org


Thanks
Emil

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


Re: [Mesa-dev] [PATCH] gallivm: abort properly when running out of buffer space in lp_disassembly

2015-03-16 Thread Jose Fonseca

On 13/03/15 22:46, srol...@vmware.com wrote:

From: Roland Scheidegger srol...@vmware.com

Before this actually ran into an infinite loop printing out invalid...
---
  src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 12 
  1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
index 402d29e..2c4ed21 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
@@ -399,19 +399,23 @@ disassemble(const void* func, llvm::raw_ostream  Out)
  break;
   }
}
+
+  if (pc = extent) {
+ Out  disassembly larger than   extent  bytes, aborting\n;
+ break;
+  }
 }

+   Out  \n;
+   Out.flush();
+
 /*
  * Print GDB command, useful to verify output.
  */
-
 if (0) {
_debug_printf(disassemble %p %p\n, bytes, bytes + pc);
 }

-   Out  \n;
-   Out.flush();
-
 return pc;
  }




Looks good to me too.

Reviewed-by: Jose Fonseca jfons...@vmware.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Summer of Code ideas (maybe just an idea wishlist?)

2015-03-16 Thread Laura Ekstrand
That was basically my background (mechanical engineering + lots of OpenGL)
when I started six months ago, but I have found the lack of mentoring to be
a large roadblock.  At that time, I wrote tests, but there were few people
willing to review them and give timely feedback.  I was advised to go ahead
and push the tests after a month, but then others came back weeks later
with lots of late reviews after the fact.  They were highly critical and
made me feel unwelcome in the community.  I've had more success working
directly on the Mesa driver.

So I'm not sure we can attract and retain these types of students.

On Mon, Mar 16, 2015 at 6:23 AM, Marek Olšák mar...@gmail.com wrote:

 On Fri, Mar 13, 2015 at 6:24 PM, Laura Ekstrand la...@jlekstrand.net
 wrote:
  We should try to steer people away from just writing Piglit tests for
 GSoC,
  unless they have a specific mentor in mind and have already talked to
 him or
  her.  In my experience, Piglit tests are difficult to do well because
 each
  one is drastically different from the others and involves cultivating a
  fairly deep understanding of the the OpenGL function in question.
 
  A project pairing a specific extension with relevant tests (like Martin
 and
  I have done with ARB_dsa) would be better as long as it's a fairly
 specific
  domain of the OpenGL spec.  That way, the student can study the spec for
 one
  specific set of objects or entry points and cultivate the necessary
  understanding they need to write the related tests.
 
  A lot of the emails we've gotten from students saying I want to write
 4.x
  Piglit tests have been too broad/generic and would be difficult for a
  student to master in a summer without lots of mentoring/direction from
 the
  community.

 We should also take into account that there are people having a degree
 in or studying computer science with specialization in computer
 graphics or having strong knowledge of OpenGL already. Such people are
 difficult to find, but they would be very effective with very little
 (if any) mentoring. Gamedev-related forums (gamedev.net, opengl.org,
 etc.) should have a lot of talented people suited for this job, but
 none of them are probably aware of the Mesa/Piglit GSoC.

 Marek

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


Re: [Mesa-dev] [PATCH 2/5] i965/fs: Emit better b2f of an expression on GEN4 and GEN5

2015-03-16 Thread Matt Turner
On Mon, Mar 16, 2015 at 4:54 AM, Tapani Pälli tapani.pa...@intel.com wrote:
 Is there some particular Piglit test case that hits this path and is it
 possible with gen5 (by removing gen check)? I've tried this with
 handicrafted shader_test and also shader-db and cannot hit the conditions
 for changes to happen. Would be nice to be able to run examine changes and
 understand this better.

Well, from the shader-db stats there must be some shaders affected in shader-db.

Use INTEL_DEVID_OVERRIDE=... with a Gen4 or Gen5 PCI ID from
include/pci_ids/i965_pci_ids.h.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] auxiliary/os: fix the android build - s/drm_munmap/os_munmap/

2015-03-16 Thread Emil Velikov
Squash this silly typo introduced with commit c63eb5dd5ec(auxiliary/os: get
the mmap/munmap wrappers working with android)

Cc: 10.4 10.5 mesa-sta...@lists.freedesktop.org
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/auxiliary/os/os_mman.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_mman.h 
b/src/gallium/auxiliary/os/os_mman.h
index 19c9a5b..3fc8c43 100644
--- a/src/gallium/auxiliary/os/os_mman.h
+++ b/src/gallium/auxiliary/os/os_mman.h
@@ -70,8 +70,8 @@ static INLINE void *os_mmap(void *addr, size_t length, int 
prot, int flags,
return __mmap2(addr, length, prot, flags, fd, (size_t) (offset  12));
 }
 
-#  define drm_munmap(addr, length) \
-  munmap(addr, length)
+#  define os_munmap(addr, length) \
+ munmap(addr, length)
 
 #else
 /* assume large file support exists */
-- 
2.3.1

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


[Mesa-dev] [PATCH 3/3] r600g: constify r600_shader_tgsi_instruction lists.

2015-03-16 Thread Emil Velikov
Massive list of constant data. Annotate it as such.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/drivers/r600/r600_shader.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index acac89f..28b290a 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -283,7 +283,7 @@ struct r600_shader_ctx {
unsignedtype;
unsignedfile_offset[TGSI_FILE_COUNT];
unsignedtemp_reg;
-   struct r600_shader_tgsi_instruction *inst_info;
+   const struct r600_shader_tgsi_instruction   *inst_info;
struct r600_bytecode*bc;
struct r600_shader  *shader;
struct r600_shader_src  src[4];
@@ -316,7 +316,7 @@ struct r600_shader_tgsi_instruction {
 };
 
 static int emit_gs_ring_writes(struct r600_shader_ctx *ctx, bool ind);
-static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[], 
eg_shader_tgsi_instruction[], cm_shader_tgsi_instruction[];
+static const struct r600_shader_tgsi_instruction 
r600_shader_tgsi_instruction[], eg_shader_tgsi_instruction[], 
cm_shader_tgsi_instruction[];
 static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx);
 static inline void callstack_push(struct r600_shader_ctx *ctx, unsigned 
reason);
 static void fc_pushlevel(struct r600_shader_ctx *ctx, int type);
@@ -7270,7 +7270,7 @@ static int tgsi_umad(struct r600_shader_ctx *ctx)
return 0;
 }
 
-static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = {
+static const struct r600_shader_tgsi_instruction 
r600_shader_tgsi_instruction[] = {
[TGSI_OPCODE_ARL]   = { ALU_OP0_NOP, tgsi_r600_arl},
[TGSI_OPCODE_MOV]   = { ALU_OP1_MOV, tgsi_op2},
[TGSI_OPCODE_LIT]   = { ALU_OP0_NOP, tgsi_lit},
@@ -7475,7 +7475,7 @@ static struct r600_shader_tgsi_instruction 
r600_shader_tgsi_instruction[] = {
[TGSI_OPCODE_LAST]  = { ALU_OP0_NOP, tgsi_unsupported},
 };
 
-static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] = {
+static const struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] 
= {
[TGSI_OPCODE_ARL]   = { ALU_OP0_NOP, tgsi_eg_arl},
[TGSI_OPCODE_MOV]   = { ALU_OP1_MOV, tgsi_op2},
[TGSI_OPCODE_LIT]   = { ALU_OP0_NOP, tgsi_lit},
@@ -7674,7 +7674,7 @@ static struct r600_shader_tgsi_instruction 
eg_shader_tgsi_instruction[] = {
[TGSI_OPCODE_LAST]  = { ALU_OP0_NOP, tgsi_unsupported},
 };
 
-static struct r600_shader_tgsi_instruction cm_shader_tgsi_instruction[] = {
+static const struct r600_shader_tgsi_instruction cm_shader_tgsi_instruction[] 
= {
[TGSI_OPCODE_ARL]   = { ALU_OP0_NOP, tgsi_eg_arl},
[TGSI_OPCODE_MOV]   = { ALU_OP1_MOV, tgsi_op2},
[TGSI_OPCODE_LIT]   = { ALU_OP0_NOP, tgsi_lit},
-- 
2.3.1

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


[Mesa-dev] [PATCH 1/3] r600g: use the tgsi opcode from parse.FullToken.FullInstruction

2015-03-16 Thread Emil Velikov
... rather than the local one in inst_info-tgsi_opcode.

This will allow us to simplify struct r600_shader_tgsi_instruction.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/drivers/r600/r600_shader.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 54540c3..4e67447 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -2543,8 +2543,10 @@ out_err:
 
 static int tgsi_unsupported(struct r600_shader_ctx *ctx)
 {
+   const unsigned tgsi_opcode =
+   ctx-parse.FullToken.FullInstruction.Instruction.Opcode;
R600_ERR(%s tgsi opcode unsupported\n,
-tgsi_get_opcode_name(ctx-inst_info-tgsi_opcode));
+tgsi_get_opcode_name(tgsi_opcode));
return -EINVAL;
 }
 
@@ -2639,7 +2641,7 @@ static int tgsi_op2_s(struct r600_shader_ctx *ctx, int 
swap, int trans_only)
r600_bytecode_src(alu.src[1], ctx-src[0], i);
}
/* handle some special cases */
-   switch (ctx-inst_info-tgsi_opcode) {
+   switch (inst-Instruction.Opcode) {
case TGSI_OPCODE_SUB:
r600_bytecode_src_toggle_neg(alu.src[1]);
break;
@@ -2738,7 +2740,7 @@ static int cayman_emit_float_instr(struct r600_shader_ctx 
*ctx)
r600_bytecode_src(alu.src[j], ctx-src[j], 0);
 
/* RSQ should take the absolute value of src */
-   if (ctx-inst_info-tgsi_opcode == TGSI_OPCODE_RSQ) {
+   if (inst-Instruction.Opcode == TGSI_OPCODE_RSQ) {
r600_bytecode_src_set_abs(alu.src[j]);
}
}
@@ -3079,6 +3081,7 @@ static int tgsi_scs(struct r600_shader_ctx *ctx)
 
 static int tgsi_kill(struct r600_shader_ctx *ctx)
 {
+   const struct tgsi_full_instruction *inst = 
ctx-parse.FullToken.FullInstruction;
struct r600_bytecode_alu alu;
int i, r;
 
@@ -3090,7 +3093,7 @@ static int tgsi_kill(struct r600_shader_ctx *ctx)
 
alu.src[0].sel = V_SQ_ALU_SRC_0;
 
-   if (ctx-inst_info-tgsi_opcode == TGSI_OPCODE_KILL) {
+   if (inst-Instruction.Opcode == TGSI_OPCODE_KILL) {
alu.src[1].sel = V_SQ_ALU_SRC_1;
alu.src[1].neg = 1;
} else {
@@ -4945,7 +4948,7 @@ static int tgsi_dp(struct r600_shader_ctx *ctx)
alu.dst.chan = i;
alu.dst.write = (inst-Dst[0].Register.WriteMask  i)  1;
/* handle some special cases */
-   switch (ctx-inst_info-tgsi_opcode) {
+   switch (inst-Instruction.Opcode) {
case TGSI_OPCODE_DP2:
if (i  1) {
alu.src[0].sel = alu.src[1].sel = 
V_SQ_ALU_SRC_0;
-- 
2.3.1

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


[Mesa-dev] [Bug 77449] Tracker bug for all bugs related to Steam titles

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=77449
Bug 77449 depends on bug 88781, which changed state.

Bug 88781 Summary: Unity3D based games exhibit problems with texture scaling in 
menus on high resolutions
https://bugs.freedesktop.org/show_bug.cgi?id=88781

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |NOTOURBUG

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] auxiliary/os: fix the android build - s/drm_munmap/os_munmap/

2015-03-16 Thread Emil Velikov
On 16/03/15 15:00, Emil Velikov wrote:
 Squash this silly typo introduced with commit c63eb5dd5ec(auxiliary/os: get
 the mmap/munmap wrappers working with android)
 
A couple of bits:

 - More is needed than this patch to get master (and the stable
branches) building properly. Those will be coming in due time.

 - There is no patch 3/3 in this series. I've had another patch which
adds android support for st/dri, but it needs more work.


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


Re: [Mesa-dev] [PATCH] egl: don't fill client apis string forever.

2015-03-16 Thread Brian Paul

On 03/15/2015 11:22 PM, Dave Airlie wrote:

We never reset the string on eglTerminate, so it grows
for ever on multiple eglInitialise.

Signed-off-by: Dave Airlie airl...@redhat.com
---
  src/egl/main/eglapi.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index bd8ffa0..d139038 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -514,6 +514,7 @@ eglTerminate(EGLDisplay dpy)

drv-API.Terminate(drv, disp);
/* do not reset disp-Driver */
+  disp-ClientAPIsString[0] = 0;
disp-Initialized = EGL_FALSE;
 }




Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Mesa-dev] [PATCH] common.py: Fix PEP 8 issues.

2015-03-16 Thread Brian Paul

Reviewed-by: Brian Paul bri...@vmware.com

On 03/14/2015 02:46 AM, Vinson Lee wrote:

Signed-off-by: Vinson Lee v...@freedesktop.org
---
  common.py | 97 ++-
  1 file changed, 53 insertions(+), 44 deletions(-)

diff --git a/common.py b/common.py
index 1d2d586..7a93941 100644
--- a/common.py
+++ b/common.py
@@ -26,28 +26,28 @@ else:
  target_platform = host_platform

  _machine_map = {
-   'x86': 'x86',
-   'i386': 'x86',
-   'i486': 'x86',
-   'i586': 'x86',
-   'i686': 'x86',
-   'BePC': 'x86',
-   'Intel': 'x86',
-   'ppc' : 'ppc',
-   'BeBox': 'ppc',
-   'BeMac': 'ppc',
-   'AMD64': 'x86_64',
-   'x86_64': 'x86_64',
-   'sparc': 'sparc',
-   'sun4u': 'sparc',
+'x86': 'x86',
+'i386': 'x86',
+'i486': 'x86',
+'i586': 'x86',
+'i686': 'x86',
+'BePC': 'x86',
+'Intel': 'x86',
+'ppc': 'ppc',
+'BeBox': 'ppc',
+'BeMac': 'ppc',
+'AMD64': 'x86_64',
+'x86_64': 'x86_64',
+'sparc': 'sparc',
+'sun4u': 'sparc',
  }


  # find host_machine value
  if 'PROCESSOR_ARCHITECTURE' in os.environ:
-   host_machine = os.environ['PROCESSOR_ARCHITECTURE']
+host_machine = os.environ['PROCESSOR_ARCHITECTURE']
  else:
-   host_machine = _platform.machine()
+host_machine = _platform.machine()
  host_machine = _machine_map.get(host_machine, 'generic')

  default_machine = host_machine
@@ -65,7 +65,8 @@ else:
  default_llvm = 'no'
  try:
  if target_platform != 'windows' and \
-   subprocess.call(['llvm-config', '--version'], 
stdout=subprocess.PIPE) == 0:
+   subprocess.call(['llvm-config', '--version'],
+   stdout=subprocess.PIPE) == 0:
  default_llvm = 'yes'
  except:
  pass
@@ -75,30 +76,38 @@ else:
  # Common options

  def AddOptions(opts):
-   try:
-   from SCons.Variables.BoolVariable import BoolVariable as 
BoolOption
-   except ImportError:
-   from SCons.Options.BoolOption import BoolOption
-   try:
-   from SCons.Variables.EnumVariable import EnumVariable as 
EnumOption
-   except ImportError:
-   from SCons.Options.EnumOption import EnumOption
-   opts.Add(EnumOption('build', 'build type', 'debug',
- allowed_values=('debug', 'checked', 'profile', 
'release')))
-   opts.Add(BoolOption('verbose', 'verbose output', 'no'))
-   opts.Add(EnumOption('machine', 'use machine-specific assembly code', 
default_machine,
-   
 allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
-   opts.Add(EnumOption('platform', 'target platform', host_platform,
-   
 allowed_values=('cygwin', 'darwin', 'freebsd', 'haiku', 'linux', 
'sunos', 'windows')))
-   opts.Add(BoolOption('embedded', 'embedded build', 'no'))
-   opts.Add(BoolOption('analyze', 'enable static code analysis where 
available', 'no'))
-   opts.Add('toolchain', 'compiler toolchain', default_toolchain)
-   opts.Add(BoolOption('gles', 'EXPERIMENTAL: enable OpenGL ES support', 
'no'))
-   opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
-   opts.Add(BoolOption('openmp', 'EXPERIMENTAL: compile with openmp 
(swrast)', 'no'))
-   opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
-   opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
-   opts.Add(BoolOption('quiet', 'DEPRECATED: profile build', 'yes'))
-   opts.Add(BoolOption('texture_float', 'enable floating-point textures 
and renderbuffers', 'no'))
-   if host_platform == 'windows':
-   opts.Add('MSVC_VERSION', 'Microsoft Visual C/C++ version')
+try:
+from SCons.Variables.BoolVariable import BoolVariable as BoolOption
+except ImportError:
+from SCons.Options.BoolOption import BoolOption
+try:
+from SCons.Variables.EnumVariable import EnumVariable as EnumOption
+except ImportError:
+from SCons.Options.EnumOption import EnumOption
+opts.Add(EnumOption('build', 'build type', 'debug',
+allowed_values=('debug', 'checked', 'profile',
+'release')))
+opts.Add(BoolOption('verbose', 'verbose output', 'no'))
+opts.Add(EnumOption('machine', 'use machine-specific assembly code',
+default_machine,
+allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
+opts.Add(EnumOption('platform', 'target platform', host_platform,
+allowed_values=('cygwin', 'darwin', 'freebsd', 'haiku',
+'linux', 'sunos', 'windows')))
+opts.Add(BoolOption('embedded', 'embedded build', 'no'))
+

[Mesa-dev] [PATCH 2/3] r600g: kill off r600_shader_tgsi_instruction::{tgsi_opcode, is_op3}

2015-03-16 Thread Emil Velikov
Both of which are no longer used. Use designated initializer to make
things obvious as people add/remove TGSI_OPCODEs.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/drivers/r600/r600_shader.c | 1180 
 1 file changed, 589 insertions(+), 591 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 4e67447..acac89f 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -311,8 +311,6 @@ struct r600_shader_ctx {
 };
 
 struct r600_shader_tgsi_instruction {
-   unsignedtgsi_opcode;
-   unsignedis_op3;
unsignedop;
int (*process)(struct r600_shader_ctx *ctx);
 };
@@ -7273,604 +7271,604 @@ static int tgsi_umad(struct r600_shader_ctx *ctx)
 }
 
 static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = {
-   {TGSI_OPCODE_ARL,   0, ALU_OP0_NOP, tgsi_r600_arl},
-   {TGSI_OPCODE_MOV,   0, ALU_OP1_MOV, tgsi_op2},
-   {TGSI_OPCODE_LIT,   0, ALU_OP0_NOP, tgsi_lit},
+   [TGSI_OPCODE_ARL]   = { ALU_OP0_NOP, tgsi_r600_arl},
+   [TGSI_OPCODE_MOV]   = { ALU_OP1_MOV, tgsi_op2},
+   [TGSI_OPCODE_LIT]   = { ALU_OP0_NOP, tgsi_lit},
 
/* XXX:
 * For state trackers other than OpenGL, we'll want to use
 * _RECIP_IEEE instead.
 */
-   {TGSI_OPCODE_RCP,   0, ALU_OP1_RECIP_CLAMPED, 
tgsi_trans_srcx_replicate},
-
-   {TGSI_OPCODE_RSQ,   0, ALU_OP0_NOP, tgsi_rsq},
-   {TGSI_OPCODE_EXP,   0, ALU_OP0_NOP, tgsi_exp},
-   {TGSI_OPCODE_LOG,   0, ALU_OP0_NOP, tgsi_log},
-   {TGSI_OPCODE_MUL,   0, ALU_OP2_MUL, tgsi_op2},
-   {TGSI_OPCODE_ADD,   0, ALU_OP2_ADD, tgsi_op2},
-   {TGSI_OPCODE_DP3,   0, ALU_OP2_DOT4, tgsi_dp},
-   {TGSI_OPCODE_DP4,   0, ALU_OP2_DOT4, tgsi_dp},
-   {TGSI_OPCODE_DST,   0, ALU_OP0_NOP, tgsi_opdst},
-   {TGSI_OPCODE_MIN,   0, ALU_OP2_MIN, tgsi_op2},
-   {TGSI_OPCODE_MAX,   0, ALU_OP2_MAX, tgsi_op2},
-   {TGSI_OPCODE_SLT,   0, ALU_OP2_SETGT, tgsi_op2_swap},
-   {TGSI_OPCODE_SGE,   0, ALU_OP2_SETGE, tgsi_op2},
-   {TGSI_OPCODE_MAD,   1, ALU_OP3_MULADD, tgsi_op3},
-   {TGSI_OPCODE_SUB,   0, ALU_OP2_ADD, tgsi_op2},
-   {TGSI_OPCODE_LRP,   0, ALU_OP0_NOP, tgsi_lrp},
-   {TGSI_OPCODE_FMA,   0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_SQRT,  0, ALU_OP1_SQRT_IEEE, 
tgsi_trans_srcx_replicate},
-   {TGSI_OPCODE_DP2A,  0, ALU_OP0_NOP, tgsi_unsupported},
-   {22,0, ALU_OP0_NOP, tgsi_unsupported},
-   {23,0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_FRC,   0, ALU_OP1_FRACT, tgsi_op2},
-   {TGSI_OPCODE_CLAMP, 0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_FLR,   0, ALU_OP1_FLOOR, tgsi_op2},
-   {TGSI_OPCODE_ROUND, 0, ALU_OP1_RNDNE, tgsi_op2},
-   {TGSI_OPCODE_EX2,   0, ALU_OP1_EXP_IEEE, tgsi_trans_srcx_replicate},
-   {TGSI_OPCODE_LG2,   0, ALU_OP1_LOG_IEEE, tgsi_trans_srcx_replicate},
-   {TGSI_OPCODE_POW,   0, ALU_OP0_NOP, tgsi_pow},
-   {TGSI_OPCODE_XPD,   0, ALU_OP0_NOP, tgsi_xpd},
-   {32,0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_ABS,   0, ALU_OP1_MOV, tgsi_op2},
-   {34,0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_DPH,   0, ALU_OP2_DOT4, tgsi_dp},
-   {TGSI_OPCODE_COS,   0, ALU_OP1_COS, tgsi_trig},
-   {TGSI_OPCODE_DDX,   0, FETCH_OP_GET_GRADIENTS_H, tgsi_tex},
-   {TGSI_OPCODE_DDY,   0, FETCH_OP_GET_GRADIENTS_V, tgsi_tex},
-   {TGSI_OPCODE_KILL,  0, ALU_OP2_KILLGT, tgsi_kill},  /* 
unconditional kill */
-   {TGSI_OPCODE_PK2H,  0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_PK2US, 0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_PK4B,  0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_PK4UB, 0, ALU_OP0_NOP, tgsi_unsupported},
-   {44,0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_SEQ,   0, ALU_OP2_SETE, tgsi_op2},
-   {46,0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_SGT,   0, ALU_OP2_SETGT, tgsi_op2},
-   {TGSI_OPCODE_SIN,   0, ALU_OP1_SIN, tgsi_trig},
-   {TGSI_OPCODE_SLE,   0, ALU_OP2_SETGE, tgsi_op2_swap},
-   {TGSI_OPCODE_SNE,   0, ALU_OP2_SETNE, tgsi_op2},
-   {51,0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_TEX,   0, FETCH_OP_SAMPLE, tgsi_tex},
-   {TGSI_OPCODE_TXD,   0, FETCH_OP_SAMPLE_G, tgsi_tex},
-   {TGSI_OPCODE_TXP,   0, FETCH_OP_SAMPLE, tgsi_tex},
-   {TGSI_OPCODE_UP2H,  0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_UP2US, 0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_UP4B,  0, ALU_OP0_NOP, 

[Mesa-dev] [PATCH 2/3] st/dri: remove unused include from the automake/scons build

2015-03-16 Thread Emil Velikov
st/dri/common hasn't been around for a while.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/state_trackers/dri/Makefile.am | 1 -
 src/gallium/state_trackers/dri/SConscript  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/Makefile.am 
b/src/gallium/state_trackers/dri/Makefile.am
index 5d701f7..d2c7a82 100644
--- a/src/gallium/state_trackers/dri/Makefile.am
+++ b/src/gallium/state_trackers/dri/Makefile.am
@@ -30,7 +30,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa \
-   -I$(top_srcdir)/src/gallium/state_trackers/dri/common \
-I$(top_srcdir)/src/mesa/drivers/dri/common \
-I$(top_builddir)/src/mesa/drivers/dri/common \
$(GALLIUM_CFLAGS) \
diff --git a/src/gallium/state_trackers/dri/SConscript 
b/src/gallium/state_trackers/dri/SConscript
index 9b0dc64..89b5e61 100644
--- a/src/gallium/state_trackers/dri/SConscript
+++ b/src/gallium/state_trackers/dri/SConscript
@@ -14,7 +14,6 @@ env.Append(CPPPATH = [
 '#/src',
 '#/src/mapi',
 '#/src/mesa',
-'#/src/gallium/state_trackers/dri/common',
 '#/src/mesa/drivers/dri/common',
 xmlpool_options.dir.dir, # Dir to generated xmlpool/options.h
 ])
-- 
2.3.1

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


Re: [Mesa-dev] [PATCH 2/5] i965/fs: Emit better b2f of an expression on GEN4 and GEN5

2015-03-16 Thread Matt Turner
On Wed, Mar 11, 2015 at 1:44 PM, Ian Romanick i...@freedesktop.org wrote:
 From: Ian Romanick ian.d.roman...@intel.com

 On platforms that do not natively generate 0u and ~0u for Boolean
 results, b2f expressions that look like

f = b2f(expr cmp 0)

 will generate better code by pretending the expression is

 f = ir_triop_sel(0.0, 1.0, expr cmp 0)

 This is because the last instruction of expr can generate the
 condition code for the cmp 0.  This avoids having to do the -(b  1)
 trick to generate 0u or ~0u for the Boolean result.  This means code like

 mov(16) g161F 1F
 mul.ge.f0(16)   nullg68,8,1F  g148,8,1F
 (+f0) sel(16)   m61F  g168,8,1F 0F

 will be generated instead of

 mul(16) g21F  g128,8,1F g48,8,1F
 cmp.ge.f0(16)   g21D  g48,8,1F  0F

Presumably this g4 should be g2?

 and(16) g41D  g28,8,1D  1D
 and(16) m61D  -g48,8,1D 0x3f80UD

 v2: When the comparison is either == 0.0 or != 0.0 use the knowledge
 that the true (or false) case already results in zero would allow better
 code generation by possibly avoiding a load-immediate instruction.

 v3: Apply the optimization even when neither comparitor is zero.

 Shader-db results:

 GM45 (0x2A42):
 total instructions in shared programs: 3551002 - 3550829 (-0.00%)
 instructions in affected programs: 33269 - 33096 (-0.52%)
 helped:121

 Iron Lake (0x0046):
 total instructions in shared programs: 4993327 - 4993146 (-0.00%)
 instructions in affected programs: 34199 - 34018 (-0.53%)
 helped:129

 No change on other platforms.

 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 Cc: Tapani Palli tapani.pa...@intel.com
 ---
  src/mesa/drivers/dri/i965/brw_fs.h   |   2 +
  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 101 
 +--
  2 files changed, 99 insertions(+), 4 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
 b/src/mesa/drivers/dri/i965/brw_fs.h
 index d9d5858..075e90c 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.h
 +++ b/src/mesa/drivers/dri/i965/brw_fs.h
 @@ -307,6 +307,7 @@ public:
   const fs_reg a);
 void emit_minmax(enum brw_conditional_mod conditionalmod, const fs_reg 
 dst,
  const fs_reg src0, const fs_reg src1);
 +   bool try_emit_b2f_of_comparison(ir_expression *ir);
 bool try_emit_saturate(ir_expression *ir);
 bool try_emit_line(ir_expression *ir);
 bool try_emit_mad(ir_expression *ir);
 @@ -317,6 +318,7 @@ public:
 bool opt_saturate_propagation();
 bool opt_cmod_propagation();
 void emit_bool_to_cond_code(ir_rvalue *condition);
 +   void emit_bool_to_cond_code_of_reg(ir_expression *expr, fs_reg op[3]);
 void emit_if_gen6(ir_if *ir);
 void emit_unspill(bblock_t *block, fs_inst *inst, fs_reg reg,
   uint32_t spill_offset, int count);
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 index 3025a9d..3d79796 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 @@ -475,6 +475,87 @@ fs_visitor::try_emit_mad(ir_expression *ir)
 return true;
  }

 +bool
 +fs_visitor::try_emit_b2f_of_comparison(ir_expression *ir)
 +{
 +   /* On platforms that do not natively generate 0u and ~0u for Boolean
 +* results, b2f expressions that look like
 +*
 +* f = b2f(expr cmp 0)
 +*
 +* will generate better code by pretending the expression is
 +*
 +* f = ir_triop_csel(0.0, 1.0, expr cmp 0)
 +*
 +* This is because the last instruction of expr can generate the
 +* condition code for the cmp 0.  This avoids having to do the -(b  
 1)
 +* trick to generate 0u or ~0u for the Boolean result.  This means code 
 like
 +*
 +* mov(16) g161F 1F
 +* mul.ge.f0(16)   nullg68,8,1F  g148,8,1F
 +* (+f0) sel(16)   m61F  g168,8,1F 0F
 +*
 +* will be generated instead of
 +*
 +* mul(16) g21F  g128,8,1F g48,8,1F
 +* cmp.ge.f0(16)   g21D  g48,8,1F  0F
 +* and(16) g41D  g28,8,1D  1D
 +* and(16) m61D  -g48,8,1D 0x3f80UD
 +*
 +* When the comparison is either == 0.0 or != 0.0 using the knowledge that
 +* the true (or false) case already results in zero would allow better 
 code
 +* generation by possibly avoiding a load-immediate instruction.
 +*/
 +   ir_expression *cmp = ir-operands[0]-as_expression();
 +   if (cmp == NULL)
 +  return false;
 +
 +   if (cmp-operation == ir_binop_equal || cmp-operation == 
 ir_binop_nequal) {
 +  for (unsigned i = 0; i  2; i++) {
 + ir_constant *c = cmp-operands[i]-as_constant();
 + if (c 

Re: [Mesa-dev] [PATCH 06/23] mesa: glGetProgramResourceLocation

2015-03-16 Thread Ilia Mirkin
On Fri, Mar 13, 2015 at 4:37 AM, Tapani Pälli tapani.pa...@intel.com wrote:
 Patch adds required helper functions to shaderapi.h and
 the actual implementation.

 corresponding Piglit test:
arb_program_interface_query-resource-location

 The added functionality can be tested by tests for following
 functions that are refactored by later patches:

GetAttribLocation
GetUniformLocation
GetFragDataLocation

 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/mesa/main/program_resource.c | 81 
 +++-
  src/mesa/main/shader_query.cpp   | 64 +++
  src/mesa/main/shaderapi.h|  4 ++
  3 files changed, 148 insertions(+), 1 deletion(-)

 diff --git a/src/mesa/main/program_resource.c 
 b/src/mesa/main/program_resource.c
 index 4fa6ac6..87a0144 100644
 --- a/src/mesa/main/program_resource.c
 +++ b/src/mesa/main/program_resource.c
 @@ -243,11 +243,90 @@ _mesa_GetProgramResourceiv(GLuint program, GLenum 
 programInterface,
  {
  }

 +/**
 + * Function verifies syntax of given name for GetProgramResourceLocation
 + * and GetProgramResourceLocationIndex for the following cases:
 + *
 + * array element portion of a string passed to GetProgramResourceLocation
 + * or GetProgramResourceLocationIndex must not have, a + sign, extra
 + * leading zeroes, or whitespace.
 + *
 + * Check is written to be compatible with GL_ARB_array_of_arrays.
 + */
 +static bool
 +invalid_array_element_syntax(const GLchar *name)
 +{
 +   char *array = strrchr(name, '[');
 +
 +   if (!array)
 +  return false;
 +
 +   /* No '+' or ' ' allowed anywhere. */
 +   if (strchr(name, '+') || strchr(name, ' '))

I guess it'd be mildly better to do a strchr('[') and use that for the
second strchr's? You could do it like

char *first = strchr(name, '[');
char *last = strrchr(first, '[');
if (strchr(first, '+') || ... )

That way you avoid iterating over the name portion of it
unnecessarily. Probably doesn't amount to too much.

 +  return true;
 +
 +   /* Check that last array index is 0. */
 +   if (array[1] == '0'  array[2] != ']')
 +  return true;
 +
 +   return false;
 +}
 +
 +static struct gl_shader_program *
 +lookup_linked_program(GLuint program, const char *caller)
 +{
 +   GET_CURRENT_CONTEXT(ctx);
 +   struct gl_shader_program *prog =
 +  _mesa_lookup_shader_program_err(ctx, program, caller);
 +
 +   if (!prog)
 +  return NULL;
 +
 +   if (prog-LinkStatus == GL_FALSE) {
 +  _mesa_error(ctx, GL_INVALID_OPERATION,
 +  %s(program not linked), caller);
 +  return NULL;
 +   }
 +   return prog;
 +}
 +
  GLint GLAPIENTRY
  _mesa_GetProgramResourceLocation(GLuint program, GLenum programInterface,
   const GLchar *name)
  {
 -   return -1;
 +   GET_CURRENT_CONTEXT(ctx);
 +   struct gl_shader_program *shProg =
 +  lookup_linked_program(program, glGetProgramResourceLocation);
 +
 +   if (!shProg || invalid_array_element_syntax(name))
 +  return -1;
 +
 +   /* Validate programInterface. */
 +   switch (programInterface) {
 +   case GL_UNIFORM:
 +   case GL_PROGRAM_INPUT:
 +   case GL_PROGRAM_OUTPUT:
 +  break;
 +
 +   /* For reference valid cases requiring addition extension support:
 +* GL_ARB_shader_subroutine
 +* GL_ARB_tessellation_shader
 +* GL_ARB_compute_shader
 +*/
 +   case GL_VERTEX_SUBROUTINE_UNIFORM:
 +   case GL_TESS_CONTROL_SUBROUTINE_UNIFORM:
 +   case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM:
 +   case GL_GEOMETRY_SUBROUTINE_UNIFORM:
 +   case GL_FRAGMENT_SUBROUTINE_UNIFORM:
 +   case GL_COMPUTE_SUBROUTINE_UNIFORM:
 +
 +   default:
 +  _mesa_error(ctx, GL_INVALID_ENUM,
 +  glGetProgramResourceLocation(%s %s),
 +  _mesa_lookup_enum_by_nr(programInterface), name);
 +   }
 +
 +   return _mesa_program_resource_location(shProg, programInterface, name);
  }

  GLint GLAPIENTRY
 diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
 index 77a4af0..4ae00a6 100644
 --- a/src/mesa/main/shader_query.cpp
 +++ b/src/mesa/main/shader_query.cpp
 @@ -743,3 +743,67 @@ _mesa_get_program_resource_name(struct gl_shader_program 
 *shProg,
 }
 return true;
  }
 +
 +static GLint
 +program_resource_location(struct gl_shader_program *shProg,
 +  struct gl_program_resource *res, const char *name)
 +{
 +   unsigned index, offset;
 +   int array_index = -1;

And I suppose leaving off the initializer here makes gcc complain?

 +
 +   if (res-Type == GL_PROGRAM_INPUT ||
 +   res-Type == GL_PROGRAM_OUTPUT) {

put all on one line?

 +  array_index = array_index_of_resource(res, name);
 +  if (array_index  0)
 + return -1;
 +   }
 +
 +   switch (res-Type) {
 +   case GL_PROGRAM_INPUT:
 +  return RESOURCE_VAR(res)-data.location + array_index - 
 VERT_ATTRIB_GENERIC0;
 +   case GL_PROGRAM_OUTPUT:
 +  return RESOURCE_VAR(res)-data.location + array_index - 
 

Re: [Mesa-dev] [PATCH 07/23] mesa: glGetProgramResourceLocationIndex

2015-03-16 Thread Ilia Mirkin
On Fri, Mar 13, 2015 at 4:37 AM, Tapani Pälli tapani.pa...@intel.com wrote:
 Patch adds required helper functions to shaderapi.h and
 the actual implementation.

 The added functionality can be tested by tests for following
 functions that are refactored by later patches:

GetFragDataIndex

 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/mesa/main/program_resource.c | 25 -
  src/mesa/main/shader_query.cpp   | 18 ++
  src/mesa/main/shaderapi.h|  4 
  3 files changed, 46 insertions(+), 1 deletion(-)

 diff --git a/src/mesa/main/program_resource.c 
 b/src/mesa/main/program_resource.c
 index 87a0144..ae987de 100644
 --- a/src/mesa/main/program_resource.c
 +++ b/src/mesa/main/program_resource.c
 @@ -329,9 +329,32 @@ _mesa_GetProgramResourceLocation(GLuint program, GLenum 
 programInterface,
 return _mesa_program_resource_location(shProg, programInterface, name);
  }

 +/**
 + * Returns output index for dual source blending.
 + */
  GLint GLAPIENTRY
  _mesa_GetProgramResourceLocationIndex(GLuint program, GLenum 
 programInterface,
const GLchar *name)
  {
 -   return -1;
 +   GET_CURRENT_CONTEXT(ctx);
 +   struct gl_shader_program *shProg =
 +  lookup_linked_program(program, glGetProgramResourceLocationIndex);
 +
 +   if (!shProg || invalid_array_element_syntax(name))
 +  return -1;
 +
 +   /* From the GL_ARB_program_interface_query spec:
 +*
 +* For GetProgramResourceLocationIndex, programInterface must be
 +* PROGRAM_OUTPUT.
 +*/

And presumably it must be a program with a fragment shader (which
might not be there for a no-rast or compute pipeline).

 +   if (programInterface != GL_PROGRAM_OUTPUT) {
 +  _mesa_error(ctx, GL_INVALID_ENUM,
 +  glGetProgramResourceLocationIndex (%s),
 +  _mesa_lookup_enum_by_nr(programInterface));
 +  return -1;
 +   }
 +
 +   return _mesa_program_resource_location_index(shProg, programInterface,
 +name);
  }
 diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
 index 4ae00a6..d3264db 100644
 --- a/src/mesa/main/shader_query.cpp
 +++ b/src/mesa/main/shader_query.cpp
 @@ -807,3 +807,21 @@ _mesa_program_resource_location(struct gl_shader_program 
 *shProg,

 return program_resource_location(shProg, res, name);
  }
 +
 +/**
 + * Function implements following index queries:
 + *glGetFragDataIndex
 + */
 +GLint
 +_mesa_program_resource_location_index(struct gl_shader_program *shProg,
 +  GLenum interface, const char *name)
 +{
 +   struct gl_program_resource *res =
 +  _mesa_program_resource_find_name(shProg, interface, name);
 +
 +   /* Non-existent (inactive) variable. */
 +   if (!res)
 +  return -1;
 +
 +   return RESOURCE_VAR(res)-data.index;
 +}
 diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
 index 73ebf60..5046018 100644
 --- a/src/mesa/main/shaderapi.h
 +++ b/src/mesa/main/shaderapi.h
 @@ -248,6 +248,10 @@ extern GLint
  _mesa_program_resource_location(struct gl_shader_program *shProg,
  GLenum interface, const char *name);

 +extern GLint
 +_mesa_program_resource_location_index(struct gl_shader_program *shProg,
 +  GLenum interface, const char *name);
 +
  #ifdef __cplusplus
  }
  #endif
 --
 2.1.0

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


Re: [Mesa-dev] [PATCH 05/23] mesa: glGetProgramResourceName

2015-03-16 Thread Ilia Mirkin
On Fri, Mar 13, 2015 at 4:37 AM, Tapani Pälli tapani.pa...@intel.com wrote:
 Patch adds required helper functions to shaderapi.h and
 the actual implementation.

 Name generation copied from '_mesa_get_uniform_name' which can
 be removed later by refactoring functions to use resource list.

 The added functionality can be tested by tests for following
 functions that are refactored by later patches:

GetActiveUniformName
GetActiveUniformBlockName

 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/mesa/main/program_resource.c | 22 +
  src/mesa/main/shader_query.cpp   | 96 
 
  src/mesa/main/shaderapi.h| 10 +
  3 files changed, 128 insertions(+)

 diff --git a/src/mesa/main/program_resource.c 
 b/src/mesa/main/program_resource.c
 index 4190f98..4fa6ac6 100644
 --- a/src/mesa/main/program_resource.c
 +++ b/src/mesa/main/program_resource.c
 @@ -211,6 +211,28 @@ _mesa_GetProgramResourceName(GLuint program, GLenum 
 programInterface,
   GLuint index, GLsizei bufSize, GLsizei *length,
   GLchar *name)
  {
 +   GET_CURRENT_CONTEXT(ctx);
 +   struct gl_shader_program *shProg =
 +  _mesa_lookup_shader_program_err(ctx, program,
 +  glGetProgramResourceIndex);
 +   if (!shProg)
 +  return;
 +
 +   /* Set user friendly return values in case of errors. */

Should this be done above the if (!shProg) return thing then?

 +   *name = '\0';
 +   if (length)
 +  *length = 0;
 +
 +   if (programInterface == GL_ATOMIC_COUNTER_BUFFER) {
 +  _mesa_error(ctx, GL_INVALID_ENUM,
 +  glGetProgramResourceName(%s),
 +  _mesa_lookup_enum_by_nr(programInterface));
 +  return;
 +   }
 +
 +   _mesa_get_program_resource_name(shProg, programInterface, index,
 +   bufSize, length, name,
 +   glGetProgramResourceName);
  }

  void GLAPIENTRY
 diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
 index d1974a4..77a4af0 100644
 --- a/src/mesa/main/shader_query.cpp
 +++ b/src/mesa/main/shader_query.cpp
 @@ -647,3 +647,99 @@ _mesa_program_resource_index(struct gl_shader_program 
 *shProg,
return calc_resource_index(shProg, res);
 }
  }
 +
 +/* Find a program resource with specific index in given interface.
 + */
 +struct gl_program_resource *
 +_mesa_program_resource_find_index(struct gl_shader_program *shProg,
 +  GLenum interface, GLuint index)

I feel like I've seen a very similar function before. TBH I can't
remember which patch it was in, but if there's any unification
possibility, please do so.

 +{
 +   struct gl_program_resource *res = shProg-ProgramResourceList;
 +   int idx = -1;
 +
 +   for (unsigned i = 0; i  shProg-NumProgramResourceList; i++, res++) {
 +  if (res-Type != interface)
 + continue;
 +
 +  switch (res-Type) {
 +  case GL_UNIFORM_BLOCK:
 +  case GL_ATOMIC_COUNTER_BUFFER:
 + if (_mesa_program_resource_index(shProg, res) == index)
 +return res;
 +
 +  case GL_TRANSFORM_FEEDBACK_VARYING:
 +  case GL_PROGRAM_INPUT:
 +  case GL_PROGRAM_OUTPUT:
 +  case GL_UNIFORM:
 + if (++idx == (int) index)
 +return res;
 + break;
 +  default:
 + assert(!not implemented for given interface);
 +  }
 +   }
 +   return NULL;
 +}
 +
 +/* Get full name of a program resource.
 + */
 +bool
 +_mesa_get_program_resource_name(struct gl_shader_program *shProg,
 +GLenum interface, GLuint index,
 +GLsizei bufSize, GLsizei *length,
 +GLchar *name, const char *caller)
 +{
 +   GET_CURRENT_CONTEXT(ctx);
 +
 +   /* Find resource with given interface and index. */
 +   struct gl_program_resource *res =
 +  _mesa_program_resource_find_index(shProg, interface, index);
 +
 +   /* The error INVALID_VALUE is generated if index is greater than
 +   * or equal to the number of entries in the active resource list for
 +   * programInterface.
 +   */
 +   if (!res) {
 +  _mesa_error(ctx, GL_INVALID_VALUE, %s(index %u), caller, index);
 +  return false;
 +   }
 +
 +   GLsizei localLength;
 +
 +   if (length == NULL)
 +  length = localLength;
 +
 +   _mesa_copy_string(name, bufSize, length, 
 _mesa_program_resource_name(res));
 +
 +   /* Page 61 (page 73 of the PDF) in section 2.11 of the OpenGL ES 3.0
 +* spec says:
 +*
 +* If the active uniform is an array, the uniform name returned in
 +* name will always be the name of the uniform array appended with
 +* [0].
 +*
 +* The same text also appears in the OpenGL 4.2 spec.  It does not,
 +* however, appear in any previous spec.  Previous specifications are
 +* ambiguous in this regard.  However, either name can 

Re: [Mesa-dev] [PATCH 1/3] auxiliary/os: fix the android build - s/drm_munmap/os_munmap/

2015-03-16 Thread Brian Paul

On 03/16/2015 09:00 AM, Emil Velikov wrote:

Squash this silly typo introduced with commit c63eb5dd5ec(auxiliary/os: get
the mmap/munmap wrappers working with android)

Cc: 10.4 10.5 mesa-sta...@lists.freedesktop.org
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
  src/gallium/auxiliary/os/os_mman.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_mman.h 
b/src/gallium/auxiliary/os/os_mman.h
index 19c9a5b..3fc8c43 100644
--- a/src/gallium/auxiliary/os/os_mman.h
+++ b/src/gallium/auxiliary/os/os_mman.h
@@ -70,8 +70,8 @@ static INLINE void *os_mmap(void *addr, size_t length, int 
prot, int flags,
 return __mmap2(addr, length, prot, flags, fd, (size_t) (offset  12));
  }

-#  define drm_munmap(addr, length) \
-  munmap(addr, length)
+#  define os_munmap(addr, length) \
+ munmap(addr, length)

  #else
  /* assume large file support exists */



Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Mesa-dev] [PATCH 2/3] st/dri: remove unused include from the automake/scons build

2015-03-16 Thread Brian Paul

On 03/16/2015 09:00 AM, Emil Velikov wrote:

st/dri/common hasn't been around for a while.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
  src/gallium/state_trackers/dri/Makefile.am | 1 -
  src/gallium/state_trackers/dri/SConscript  | 1 -
  2 files changed, 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/Makefile.am 
b/src/gallium/state_trackers/dri/Makefile.am
index 5d701f7..d2c7a82 100644
--- a/src/gallium/state_trackers/dri/Makefile.am
+++ b/src/gallium/state_trackers/dri/Makefile.am
@@ -30,7 +30,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa \
-   -I$(top_srcdir)/src/gallium/state_trackers/dri/common \
-I$(top_srcdir)/src/mesa/drivers/dri/common \
-I$(top_builddir)/src/mesa/drivers/dri/common \
$(GALLIUM_CFLAGS) \
diff --git a/src/gallium/state_trackers/dri/SConscript 
b/src/gallium/state_trackers/dri/SConscript
index 9b0dc64..89b5e61 100644
--- a/src/gallium/state_trackers/dri/SConscript
+++ b/src/gallium/state_trackers/dri/SConscript
@@ -14,7 +14,6 @@ env.Append(CPPPATH = [
  '#/src',
  '#/src/mapi',
  '#/src/mesa',
-'#/src/gallium/state_trackers/dri/common',
  '#/src/mesa/drivers/dri/common',
  xmlpool_options.dir.dir, # Dir to generated xmlpool/options.h
  ])



Reviewed-by: Brian Paul bri...@vmware.com

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


[Mesa-dev] [PATCH] i965: Mark paths in linear - tiled functions as unreachable().

2015-03-16 Thread Matt Turner
textdata bss dec hex filename
9663   0   0966325bf intel_tiled_memcpy.o   before
8215   0   082152017 intel_tiled_memcpy.o   after
---
 src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c 
b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
index 2097aaa..dcf0462 100644
--- a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
+++ b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
@@ -398,6 +398,8 @@ linear_to_xtiled_faster(uint32_t x0, uint32_t x1, uint32_t 
x2, uint32_t x3,
  return linear_to_xtiled(0, 0, xtile_width, xtile_width, 0, 
xtile_height,
  dst, src, src_pitch, swizzle_bit,
  rgba8_copy_aligned_dst);
+  else
+ unreachable(not reached);
} else {
   if (mem_copy == memcpy)
  return linear_to_xtiled(x0, x1, x2, x3, y0, y1,
@@ -406,6 +408,8 @@ linear_to_xtiled_faster(uint32_t x0, uint32_t x1, uint32_t 
x2, uint32_t x3,
  return linear_to_xtiled(x0, x1, x2, x3, y0, y1,
  dst, src, src_pitch, swizzle_bit,
  rgba8_copy_aligned_dst);
+  else
+ unreachable(not reached);
}
linear_to_xtiled(x0, x1, x2, x3, y0, y1,
 dst, src, src_pitch, swizzle_bit, mem_copy);
@@ -436,6 +440,8 @@ linear_to_ytiled_faster(uint32_t x0, uint32_t x1, uint32_t 
x2, uint32_t x3,
  return linear_to_ytiled(0, 0, ytile_width, ytile_width, 0, 
ytile_height,
  dst, src, src_pitch, swizzle_bit,
  rgba8_copy_aligned_dst);
+  else
+ unreachable(not reached);
} else {
   if (mem_copy == memcpy)
  return linear_to_ytiled(x0, x1, x2, x3, y0, y1,
@@ -444,6 +450,8 @@ linear_to_ytiled_faster(uint32_t x0, uint32_t x1, uint32_t 
x2, uint32_t x3,
  return linear_to_ytiled(x0, x1, x2, x3, y0, y1,
  dst, src, src_pitch, swizzle_bit,
  rgba8_copy_aligned_dst);
+  else
+ unreachable(not reached);
}
linear_to_ytiled(x0, x1, x2, x3, y0, y1,
 dst, src, src_pitch, swizzle_bit, mem_copy);
@@ -474,6 +482,8 @@ xtiled_to_linear_faster(uint32_t x0, uint32_t x1, uint32_t 
x2, uint32_t x3,
  return xtiled_to_linear(0, 0, xtile_width, xtile_width, 0, 
xtile_height,
  dst, src, dst_pitch, swizzle_bit,
  rgba8_copy_aligned_src);
+  else
+ unreachable(not reached);
} else {
   if (mem_copy == memcpy)
  return xtiled_to_linear(x0, x1, x2, x3, y0, y1,
@@ -482,6 +492,8 @@ xtiled_to_linear_faster(uint32_t x0, uint32_t x1, uint32_t 
x2, uint32_t x3,
  return xtiled_to_linear(x0, x1, x2, x3, y0, y1,
  dst, src, dst_pitch, swizzle_bit,
  rgba8_copy_aligned_src);
+  else
+ unreachable(not reached);
}
xtiled_to_linear(x0, x1, x2, x3, y0, y1,
 dst, src, dst_pitch, swizzle_bit, mem_copy);
@@ -512,6 +524,8 @@ ytiled_to_linear_faster(uint32_t x0, uint32_t x1, uint32_t 
x2, uint32_t x3,
  return ytiled_to_linear(0, 0, ytile_width, ytile_width, 0, 
ytile_height,
  dst, src, dst_pitch, swizzle_bit,
  rgba8_copy_aligned_src);
+  else
+ unreachable(not reached);
} else {
   if (mem_copy == memcpy)
  return ytiled_to_linear(x0, x1, x2, x3, y0, y1,
@@ -520,6 +534,8 @@ ytiled_to_linear_faster(uint32_t x0, uint32_t x1, uint32_t 
x2, uint32_t x3,
  return ytiled_to_linear(x0, x1, x2, x3, y0, y1,
  dst, src, dst_pitch, swizzle_bit,
  rgba8_copy_aligned_src);
+  else
+ unreachable(not reached);
}
ytiled_to_linear(x0, x1, x2, x3, y0, y1,
 dst, src, dst_pitch, swizzle_bit, mem_copy);
-- 
2.0.5

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


Re: [Mesa-dev] [PATCH] i965: Mark paths in linear - tiled functions as unreachable().

2015-03-16 Thread Carl Worth
On Mon, Mar 16 2015, Matt Turner wrote:
 textdata bss dec hex filename
 9663   0   0966325bf intel_tiled_memcpy.o   before
 8215   0   082152017 intel_tiled_memcpy.o   after

Reviewed-by: Carl Worth cwo...@cworth.org

-Carl



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


Re: [Mesa-dev] [PATCH 2/5] i965/fs: Emit better b2f of an expression on GEN4 and GEN5

2015-03-16 Thread Ian Romanick
On 03/16/2015 09:37 AM, Matt Turner wrote:
 On Mon, Mar 16, 2015 at 4:54 AM, Tapani Pälli tapani.pa...@intel.com wrote:
 Is there some particular Piglit test case that hits this path and is it
 possible with gen5 (by removing gen check)? I've tried this with
 handicrafted shader_test and also shader-db and cannot hit the conditions
 for changes to happen. Would be nice to be able to run examine changes and
 understand this better.
 
 Well, from the shader-db stats there must be some shaders affected in 
 shader-db.

For example, shaders/anholt/6.shader_test was helped.  That appears to
be the smallest (and one of the only open-source) shaders that is
helped.

helped:   shaders/anholt/6.shader_test FS SIMD16:   86 - 85 (-1.16%)
helped:   shaders/anholt/6.shader_test FS SIMD8:77 - 76 (-1.30%)

The part of that shader that generates the code we care about is:

gl_FragColor = step(0.0, n_dot_l) *
vec4((diffuse + vec3(specular)) * shadow, material_color.w);

It should be easy enough to create a test using step() that generates
similar code on GEN4 and GEN5.

 Use INTEL_DEVID_OVERRIDE=... with a Gen4 or Gen5 PCI ID from
 include/pci_ids/i965_pci_ids.h.

That's part of the reason I include the platform name and the PCI ID in
the shader-db log in the commit message. :)

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


Re: [Mesa-dev] [PATCH 2/2] main: Change the type argument of use_shader_program() to gl_shader_stage.

2015-03-16 Thread Kristian Høgsberg
On Wed, Mar 11, 2015 at 3:43 PM, Jordan Justen
jordan.l.jus...@intel.com wrote:
 From: Paul Berry stereotype...@gmail.com

 This allows it to be called from a loop.

 Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

Reviewed-by: Kristian Høgsberg k...@bitplanet.net

 ---
  src/mesa/main/shaderapi.c | 23 +++
  1 file changed, 11 insertions(+), 12 deletions(-)

 diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
 index 872b559..9409536 100644
 --- a/src/mesa/main/shaderapi.c
 +++ b/src/mesa/main/shaderapi.c
 @@ -1027,12 +1027,11 @@ _mesa_active_program(struct gl_context *ctx, struct 
 gl_shader_program *shProg,


  static void
 -use_shader_program(struct gl_context *ctx, GLenum type,
 +use_shader_program(struct gl_context *ctx, gl_shader_stage stage,
 struct gl_shader_program *shProg,
 struct gl_pipeline_object *shTarget)
  {
 struct gl_shader_program **target;
 -   gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(type);

 target = shTarget-CurrentProgram[stage];
 if ((shProg != NULL)  (shProg-_LinkedShaders[stage] == NULL))
 @@ -1048,17 +1047,17 @@ use_shader_program(struct gl_context *ctx, GLenum 
 type,
 * it from that binding point as well.  This ensures that the correct
 * semantics of glDeleteProgram are maintained.
 */
 -  switch (type) {
 -  case GL_VERTEX_SHADER:
 +  switch (stage) {
 +  case MESA_SHADER_VERTEX:
  /* Empty for now. */
  break;
 -  case GL_GEOMETRY_SHADER_ARB:
 +  case MESA_SHADER_GEOMETRY:
  /* Empty for now. */
  break;
 -  case GL_COMPUTE_SHADER:
 +  case MESA_SHADER_COMPUTE:
   /* Empty for now. */
   break;
 -  case GL_FRAGMENT_SHADER:
 +  case MESA_SHADER_FRAGMENT:
   if (*target == ctx-_Shader-_CurrentFragmentProgram) {
 _mesa_reference_shader_program(ctx,
 
 ctx-_Shader-_CurrentFragmentProgram,
 @@ -1079,10 +1078,9 @@ use_shader_program(struct gl_context *ctx, GLenum type,
  void
  _mesa_use_program(struct gl_context *ctx, struct gl_shader_program *shProg)
  {
 -   use_shader_program(ctx, GL_VERTEX_SHADER, shProg, ctx-Shader);
 -   use_shader_program(ctx, GL_GEOMETRY_SHADER_ARB, shProg, ctx-Shader);
 -   use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg, ctx-Shader);
 -   use_shader_program(ctx, GL_COMPUTE_SHADER, shProg, ctx-Shader);
 +   int i;
 +   for (i = 0; i  MESA_SHADER_STAGES; i++)
 +  use_shader_program(ctx, i, shProg, ctx-Shader);
 _mesa_active_program(ctx, shProg, glUseProgram);

 if (ctx-Driver.UseProgram)
 @@ -1889,7 +1887,8 @@ _mesa_use_shader_program(struct gl_context *ctx, GLenum 
 type,
   struct gl_shader_program *shProg,
   struct gl_pipeline_object *shTarget)
  {
 -   use_shader_program(ctx, type, shProg, shTarget);
 +   gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(type);
 +   use_shader_program(ctx, stage, shProg, shTarget);

 if (ctx-Driver.UseProgram)
ctx-Driver.UseProgram(ctx, shProg);
 --
 2.1.4

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


Re: [Mesa-dev] [PATCH 2/2] i965/nir: Re-emit instructions instead of doing mov-to-flag when possible

2015-03-16 Thread Jason Ekstrand
On Mon, Mar 16, 2015 at 9:21 PM, Jason Ekstrand ja...@jlekstrand.net wrote:
 Because of the way that NIR does conditionals, we get them in any old SSA
 value.  The actual boolean value used in the select or if is x != 0.
 Previously, we handled this by emitting a mov.nz to move the value to the
 flag register.  However, this almost always adds at least one if not two
 instructions because we have to go through the VGRF when we could be
 comparing directly to the flag and then using the flag.

 With this commit, we simply re-emit the instruction that produces the value
 when we can.  By doing so, we can use the flag directly and we trust in CSE
 to clean up for us if it can.

 Shader-db results:

 total instructions in shared programs: 4164120 - 4110511 (-1.29%)
 instructions in affected programs: 2397042 - 2343433 (-2.24%)
 helped:13167
 HURT:  31
 GAINED:4
 LOST:  4

With this series, the peephole series I sent out earlier, and one more
patch to fix up types in the NIR - FS pass, we have the following
delta between GLSL IR and NIR:

total instructions in shared programs: 4090061 - 4085083 (-0.12%)
instructions in affected programs: 2554907 - 2549929 (-0.19%)
helped:6311
HURT:  9448
GAINED:67
LOST:  30

Yes, NIR is doing better!
--Jason

 ---
  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 87 
 ++--
  1 file changed, 84 insertions(+), 3 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 index 492767b..4ff1b4d 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 @@ -1283,12 +1283,93 @@ fs_visitor::get_nir_src(nir_src src, brw_reg_type 
 type)
 }
  }

 +static nir_alu_instr *
 +get_bool_alu_parent_instr(nir_src src)
 +{
 +   nir_instr *parent_instr = src.is_ssa ? src.ssa-parent_instr :
 +  src.reg.reg-parent_instr;
 +   if (!parent_instr || parent_instr-type != nir_instr_type_alu)
 +  return NULL;
 +
 +   nir_alu_instr *alu = nir_instr_as_alu(parent_instr);
 +
 +   /* Instead of trying to algorithmically determine what instructions can
 +* or cannot be reconstructed to make a boolean, we give and explicit
 +* list for now.  This has three primary benifits.  1) It's simple.
 +* 2) It's not liable to hit strange edge-cases that don't have piglit
 +* tests.  3) All of these instructions we *know* get emitted in a
 +* single instruction so we won't hurt too much by re-emitting them.
 +*/
 +   switch (alu-op) {
 +   case nir_op_flt:
 +   case nir_op_ilt:
 +   case nir_op_ult:
 +   case nir_op_fge:
 +   case nir_op_ige:
 +   case nir_op_uge:
 +   case nir_op_feq:
 +   case nir_op_ieq:
 +   case nir_op_fne:
 +   case nir_op_ine:
 +   case nir_op_inot:
 +   case nir_op_ixor:
 +   case nir_op_ior:
 +   case nir_op_iand:
 +   case nir_op_f2b:
 +   case nir_op_i2b:
 +  break;
 +   default:
 +  return NULL;
 +   }
 +
 +   /* Now we need to check that all of the sources are at least psudo-ssa.
 +* If one of them was involved in a phi node then we can't be sure that
 +* just re-creating the value will work.
 +*/
 +   for (unsigned i = 0; i  nir_op_infos[alu-op].num_inputs; i++)
 +  if (!alu-src[i].src.is_ssa 
 +  alu-src[i].src.reg.reg-parent_instr == NULL)
 + return NULL;
 +
 +   switch (nir_op_infos[alu-op].output_type) {
 +   case nir_type_int:
 +   case nir_type_unsigned:
 +   case nir_type_bool:
 +  return alu;
 +
 +   case nir_type_float:
 +   default:
 +  /* We can't treat a float-destination instruction as if it were a
 +   * bool.  Doing so would require messing with the types which might
 +   * be bad and could even hang the GPU.
 +   */
 +  return NULL;
 +   }
 +}
 +
  void
  fs_visitor::get_nir_src_as_flag(nir_src src, unsigned comp)
  {
 -   fs_reg cond_src = get_nir_src(src, BRW_REGISTER_TYPE_UD);
 -   fs_inst *inst = emit(MOV(reg_null_d, offset(cond_src, comp)));
 -   inst-conditional_mod = BRW_CONDITIONAL_NZ;
 +   nir_alu_instr *bool_alu = get_bool_alu_parent_instr(src);
 +
 +   if (bool_alu) {
 +  /* If it's an ALU instruction, we're *probably* better off just
 +   * re-emitting it with a conditional mod than actually saving off the
 +   * value and copying it to the flag register.
 +   */
 +  assert(bool_alu-dest.write_mask == 1);
 +  nir_emit_alu(bool_alu);
 +  fs_inst *alu_inst = (fs_inst *) this-instructions.get_tail();
 +  alu_inst-dst = retype(reg_null_d, alu_inst-dst.type);
 +
 +  if (alu_inst-conditional_mod == BRW_CONDITIONAL_NONE)
 + alu_inst-conditional_mod = BRW_CONDITIONAL_NZ;
 +   } else {
 +  /* The 

[Mesa-dev] [Bug 86326] clEnqueueNDRangeKernel global_work_offset ignored

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=86326

Ronie Salgado ronies...@gmail.com changed:

   What|Removed |Added

 Attachment #114337|0   |1
is obsolete||

--- Comment #7 from Ronie Salgado ronies...@gmail.com ---
Created attachment 114364
  -- https://bugs.freedesktop.org/attachment.cgi?id=114364action=edit
Updated libclc patch

Updated libclc patch. I am also taking the opportunity to use C builtin
functions for the r600/lib/workitem/*.ll implementation.

Removed the comment from the ptx version of get_global_offset(). The comment
was there because I had not implemented those builtin intrinsics. Now I am just
leaving some potential stub in LLVM for its implementation.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 86326] clEnqueueNDRangeKernel global_work_offset ignored

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=86326

--- Comment #8 from Ronie Salgado ronies...@gmail.com ---
Created attachment 114365
  -- https://bugs.freedesktop.org/attachment.cgi?id=114365action=edit
Clang patch

Clang patch to be able to use the new/old builtin functions.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 13/18] i965/fs: Support compute programs in fs_visitor

2015-03-16 Thread Kristian Høgsberg
On Sat, Mar 14, 2015 at 9:54 PM, Jordan Justen
jordan.l.jus...@intel.com wrote:
 Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
 ---
  src/mesa/drivers/dri/i965/brw_fs.cpp | 82 
 +++-
  src/mesa/drivers/dri/i965/brw_fs.h   | 10 
  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 23 
  3 files changed, 112 insertions(+), 3 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs.cpp
 index 8702ea8..6427ffb 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
 @@ -1699,9 +1699,15 @@ fs_visitor::assign_curb_setup()
 if (dispatch_width == 8) {
prog_data-dispatch_grf_start_reg = payload.num_regs;
 } else {
 -  assert(stage == MESA_SHADER_FRAGMENT);
 -  brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this-prog_data;
 -  prog_data-dispatch_grf_start_reg_16 = payload.num_regs;
 +  if (stage == MESA_SHADER_FRAGMENT) {
 + brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this-prog_data;
 + prog_data-dispatch_grf_start_reg_16 = payload.num_regs;
 +  } else if (stage == MESA_SHADER_COMPUTE) {
 + brw_cs_prog_data *prog_data = (brw_cs_prog_data*) this-prog_data;
 + prog_data-dispatch_grf_start_reg_16 = payload.num_regs;
 +  } else {
 + unreachable(Unsupported shader type!);
 +  }
 }

 prog_data-curb_read_length = ALIGN(stage_prog_data-nr_params, 8) / 8;
 @@ -3634,6 +3640,14 @@ fs_visitor::setup_vs_payload()
  }

  void
 +fs_visitor::setup_cs_payload()
 +{
 +   assert(brw-gen = 7);
 +
 +   payload.num_regs = 1;
 +}
 +
 +void
  fs_visitor::assign_binding_table_offsets()
  {
 assert(stage == MESA_SHADER_FRAGMENT);
 @@ -3969,6 +3983,68 @@ fs_visitor::run_fs()
 return !failed;
  }

 +bool
 +fs_visitor::run_cs()
 +{
 +   assert(stage == MESA_SHADER_COMPUTE);
 +
 +   sanity_param_count = prog-Parameters-NumParameters;
 +
 +   assign_common_binding_table_offsets(0);
 +
 +   setup_cs_payload();
 +
 +   if (0) {
 +  emit_dummy_fs();
 +   } else if (brw-use_rep_send  dispatch_width == 16) {
 +  emit_repclear_shader();
 +   } else {

We don't need the dummy_fs or repclear shaders in run_cs().

Kristian

 +  if (INTEL_DEBUG  DEBUG_SHADER_TIME)
 + emit_shader_time_begin();
 +
 +  /* Generate CS IR for main().  (the visitor only descends into
 +   * functions called main).
 +   */
 +  if (shader) {
 + if (getenv(INTEL_USE_NIR) != NULL) {
 +emit_nir_code();
 + } else {
 +foreach_in_list(ir_instruction, ir, shader-base.ir) {
 +   base_ir = ir;
 +   this-result = reg_undef;
 +   ir-accept(this);
 +}
 + }
 +  }
 +  base_ir = NULL;
 +  if (failed)
 +return false;
 +
 +  emit_cs_terminate();
 +
 +  calculate_cfg();
 +
 +  optimize();
 +
 +  assign_curb_setup();
 +
 +  fixup_3src_null_dest();
 +  allocate_registers();
 +
 +  if (failed)
 + return false;
 +   }
 +
 +   /* If any state parameters were appended, then ParameterValues could have
 +* been realloced, in which case the driver uniform storage set up by
 +* _mesa_associate_uniform_storage() would point to freed memory.  Make
 +* sure that didn't happen.
 +*/
 +   assert(sanity_param_count == prog-Parameters-NumParameters);
 +
 +   return !failed;
 +}
 +
  const unsigned *
  brw_wm_fs_emit(struct brw_context *brw,
 void *mem_ctx,
 diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
 b/src/mesa/drivers/dri/i965/brw_fs.h
 index b8b26a4..5a243d0 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.h
 +++ b/src/mesa/drivers/dri/i965/brw_fs.h
 @@ -89,6 +89,14 @@ public:
struct gl_vertex_program *cp,
unsigned dispatch_width);

 +   fs_visitor(struct brw_context *brw,
 +  void *mem_ctx,
 +  const struct brw_cs_prog_key *key,
 +  struct brw_cs_prog_data *prog_data,
 +  struct gl_shader_program *shader_prog,
 +  struct gl_compute_program *cp,
 +  unsigned dispatch_width);
 +
 ~fs_visitor();
 void init();

 @@ -189,12 +197,14 @@ public:

 bool run_fs();
 bool run_vs();
 +   bool run_cs();
 void optimize();
 void allocate_registers();
 void assign_binding_table_offsets();
 void setup_payload_gen4();
 void setup_payload_gen6();
 void setup_vs_payload();
 +   void setup_cs_payload();
 void fixup_3src_null_dest();
 void assign_curb_setup();
 void calculate_urb_setup();
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 index 88df0a2..c3cf6ba 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 @@ -39,6 +39,7 @@
  #include brw_context.h
  #include brw_eu.h
  #include brw_wm.h
 

[Mesa-dev] [Bug 86326] clEnqueueNDRangeKernel global_work_offset ignored

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=86326

Ronie Salgado ronies...@gmail.com changed:

   What|Removed |Added

 Attachment #114336|0   |1
is obsolete||

--- Comment #6 from Ronie Salgado ronies...@gmail.com ---
Created attachment 114363
  -- https://bugs.freedesktop.org/attachment.cgi?id=114363action=edit
LLVM intrinsics patch

I tried to use the builtin function, but it did not work. Clang uses the triple
target prefix when trying to map GGC builtins into LLVM intrinsics.

In the case of the R600, the triple target prefix is amdgpu, but
IntrinsicsR600.td declares some intrinsics in the separate r600 and AMDGPU
namespaces.

So I decided to put all of them in the amdgpu namespace. Then table gen
complained that they have to start amdgpu. So I made the subsequent changes
until I made it work, and the tests in opencl-example are all passing in
capeverde.

I'am leaving those updated patches here for reviewing and documentation before
sending them to the respective mailing lists.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 86326] clEnqueueNDRangeKernel global_work_offset ignored

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=86326

Ronie Salgado ronies...@gmail.com changed:

   What|Removed |Added

 Attachment #114363|0   |1
is obsolete||

--- Comment #9 from Ronie Salgado ronies...@gmail.com ---
Created attachment 114366
  -- https://bugs.freedesktop.org/attachment.cgi?id=114366action=edit
LLVM intrinsics patch (v2)

Added a missing file, whith an enum for the kernel abi offsets.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/5] i965/fs: Emit better b2f of an expression on GEN4 and GEN5

2015-03-16 Thread Tapani Pälli



On 03/16/2015 06:37 PM, Matt Turner wrote:

On Mon, Mar 16, 2015 at 4:54 AM, Tapani Pälli tapani.pa...@intel.com wrote:

Is there some particular Piglit test case that hits this path and is it
possible with gen5 (by removing gen check)? I've tried this with
handicrafted shader_test and also shader-db and cannot hit the conditions
for changes to happen. Would be nice to be able to run examine changes and
understand this better.


Well, from the shader-db stats there must be some shaders affected in shader-db.

Use INTEL_DEVID_OVERRIDE=... with a Gen4 or Gen5 PCI ID from
include/pci_ids/i965_pci_ids.h.



Yeah, got that but run.py for me says following error so I did not want 
to try manually go one by one. The amount of tests it runs before error 
changes between runs.


--- 8 ---
[tpalli@localhost shader-db]$ ./run.py shaders
shaders/humus-domino/1.shader_test   vs   : 140.073 secs
shaders/nexuiz/43.shader_testvs   : 250.092 secs
shaders/anholt/12.shader_testvs   :  80.062 secs
Traceback (most recent call last):
  File ./run.py, line 149, in module
main()
  File ./run.py, line 142, in main
for t in executor.map(run_test, filenames):
  File /usr/lib64/python3.4/concurrent/futures/_base.py, line 549, in 
result_iterator

yield future.result()
  File /usr/lib64/python3.4/concurrent/futures/_base.py, line 395, in 
result

return self.__get_result()
  File /usr/lib64/python3.4/concurrent/futures/_base.py, line 354, in 
__get_result

raise self._exception
  File /usr/lib64/python3.4/concurrent/futures/thread.py, line 54, in run
result = self.fn(*self.args, **self.kwargs)
  File ./run.py, line 95, in run_test
counts[current_type] = counts[current_type] + 1
KeyError: 'UNKNOWN'

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


Re: [Mesa-dev] [PATCH 14/18] i965/fs: Don't assign high regs for CS termination send

2015-03-16 Thread Jordan Justen
On 2015-03-16 13:49:29, Kenneth Graunke wrote:
 On Saturday, March 14, 2015 09:54:24 PM Jordan Justen wrote:
  Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
  ---
   src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
  
  diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp 
  b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
  index 1f30a19..fe3406c 100644
  --- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
  +++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
  @@ -598,7 +598,7 @@ fs_visitor::assign_regs(bool allow_spilling)
 * We could just do something high.  Instead, we just pick the
 * highest register that works.
 */
  - if (inst-eot) {
  + if (stage != MESA_SHADER_COMPUTE  inst-eot) {
   int size = alloc.sizes[inst-src[0].reg];
   int reg = screen-wm_reg_sets[rsi].class_to_ra_reg_range[size] 
  - 1;
   ra_set_node_reg(g, inst-src[0].reg, reg);
  
 
 This looks wrong to me - the ISA reference for the SEND instruction
 says:
 
 A root thread originated from the media (generic) pipeline must terminate
  with a send instruction with message to the Thread Spawner unit. A
  child thread should also terminate with a send to TS. [...]
 
  The send with EOT should use register space R112-R127 for src.
 
 which implies to me that this restriction is for any SEND with EOT,
 including those sent to the thread spawner for compute.
 
 Is there a particular need for this patch, or were you just trying to
 remove unnecessary restrictions?

I think the original motivation was to avoid the 'assert(!inst-eot);'
that you have since removed in 10d8a1a8.

I wrote it this way (and kept it around) because the comment (When we
do send-from-GRF for FB writes, we need to ensure that the last write
instruction sends from a high register.) didn't sound like something
applicable to CS.

So, I expect that thanks to your 10d8a1a8 patch I can drop this one.

That said, I did try removing it, and hit some issue in register
allocation, so it looks like something else is needed in its place...

Thanks,

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


[Mesa-dev] [PATCH 2/2] i965/nir: Re-emit instructions instead of doing mov-to-flag when possible

2015-03-16 Thread Jason Ekstrand
Because of the way that NIR does conditionals, we get them in any old SSA
value.  The actual boolean value used in the select or if is x != 0.
Previously, we handled this by emitting a mov.nz to move the value to the
flag register.  However, this almost always adds at least one if not two
instructions because we have to go through the VGRF when we could be
comparing directly to the flag and then using the flag.

With this commit, we simply re-emit the instruction that produces the value
when we can.  By doing so, we can use the flag directly and we trust in CSE
to clean up for us if it can.

Shader-db results:

total instructions in shared programs: 4164120 - 4110511 (-1.29%)
instructions in affected programs: 2397042 - 2343433 (-2.24%)
helped:13167
HURT:  31
GAINED:4
LOST:  4
---
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 87 ++--
 1 file changed, 84 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 492767b..4ff1b4d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -1283,12 +1283,93 @@ fs_visitor::get_nir_src(nir_src src, brw_reg_type type)
}
 }
 
+static nir_alu_instr *
+get_bool_alu_parent_instr(nir_src src)
+{
+   nir_instr *parent_instr = src.is_ssa ? src.ssa-parent_instr :
+  src.reg.reg-parent_instr;
+   if (!parent_instr || parent_instr-type != nir_instr_type_alu)
+  return NULL;
+
+   nir_alu_instr *alu = nir_instr_as_alu(parent_instr);
+
+   /* Instead of trying to algorithmically determine what instructions can
+* or cannot be reconstructed to make a boolean, we give and explicit
+* list for now.  This has three primary benifits.  1) It's simple.
+* 2) It's not liable to hit strange edge-cases that don't have piglit
+* tests.  3) All of these instructions we *know* get emitted in a
+* single instruction so we won't hurt too much by re-emitting them.
+*/
+   switch (alu-op) {
+   case nir_op_flt:
+   case nir_op_ilt:
+   case nir_op_ult:
+   case nir_op_fge:
+   case nir_op_ige:
+   case nir_op_uge:
+   case nir_op_feq:
+   case nir_op_ieq:
+   case nir_op_fne:
+   case nir_op_ine:
+   case nir_op_inot:
+   case nir_op_ixor:
+   case nir_op_ior:
+   case nir_op_iand:
+   case nir_op_f2b:
+   case nir_op_i2b:
+  break;
+   default:
+  return NULL;
+   }
+
+   /* Now we need to check that all of the sources are at least psudo-ssa.
+* If one of them was involved in a phi node then we can't be sure that
+* just re-creating the value will work.
+*/
+   for (unsigned i = 0; i  nir_op_infos[alu-op].num_inputs; i++)
+  if (!alu-src[i].src.is_ssa 
+  alu-src[i].src.reg.reg-parent_instr == NULL)
+ return NULL;
+
+   switch (nir_op_infos[alu-op].output_type) {
+   case nir_type_int:
+   case nir_type_unsigned:
+   case nir_type_bool:
+  return alu;
+
+   case nir_type_float:
+   default:
+  /* We can't treat a float-destination instruction as if it were a
+   * bool.  Doing so would require messing with the types which might
+   * be bad and could even hang the GPU.
+   */
+  return NULL;
+   }
+}
+
 void
 fs_visitor::get_nir_src_as_flag(nir_src src, unsigned comp)
 {
-   fs_reg cond_src = get_nir_src(src, BRW_REGISTER_TYPE_UD);
-   fs_inst *inst = emit(MOV(reg_null_d, offset(cond_src, comp)));
-   inst-conditional_mod = BRW_CONDITIONAL_NZ;
+   nir_alu_instr *bool_alu = get_bool_alu_parent_instr(src);
+
+   if (bool_alu) {
+  /* If it's an ALU instruction, we're *probably* better off just
+   * re-emitting it with a conditional mod than actually saving off the
+   * value and copying it to the flag register.
+   */
+  assert(bool_alu-dest.write_mask == 1);
+  nir_emit_alu(bool_alu);
+  fs_inst *alu_inst = (fs_inst *) this-instructions.get_tail();
+  alu_inst-dst = retype(reg_null_d, alu_inst-dst.type);
+
+  if (alu_inst-conditional_mod == BRW_CONDITIONAL_NONE)
+ alu_inst-conditional_mod = BRW_CONDITIONAL_NZ;
+   } else {
+  /* The tried-and-true solution */
+  fs_reg cond_src = get_nir_src(src, BRW_REGISTER_TYPE_UD);
+  fs_inst *inst = emit(MOV(reg_null_d, offset(cond_src, comp)));
+  inst-conditional_mod = BRW_CONDITIONAL_NZ;
+   }
 }
 
 fs_reg
-- 
2.3.2

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


[Mesa-dev] [PATCH 1/2] i965/nir: Factor out code to convert a nir_src to a flag register

2015-03-16 Thread Jason Ekstrand
---
 src/mesa/drivers/dri/i965/brw_fs.h   |  1 +
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 16 ++--
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index 08c2b89..105973e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -364,6 +364,7 @@ public:
void nir_emit_texture(nir_tex_instr *instr);
void nir_emit_jump(nir_jump_instr *instr);
fs_reg get_nir_src(nir_src src, brw_reg_type type);
+   void get_nir_src_as_flag(nir_src src, unsigned comp);
fs_reg get_nir_dest(nir_dest dest);
void emit_percomp(fs_inst *inst, unsigned wr_mask);
 
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 4ca07e3..492767b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -506,10 +506,7 @@ fs_visitor::nir_emit_cf_list(exec_list *list)
 void
 fs_visitor::nir_emit_if(nir_if *if_stmt)
 {
-   /* first, put the condition into f0 */
-   fs_inst *inst = emit(MOV(reg_null_d, get_nir_src(if_stmt-condition,
-BRW_REGISTER_TYPE_UD)));
-   inst-conditional_mod = BRW_CONDITIONAL_NZ;
+   get_nir_src_as_flag(if_stmt-condition, 0);
 
emit(IF(BRW_PREDICATE_NORMAL));
 
@@ -1247,8 +1244,7 @@ fs_visitor::nir_emit_alu(nir_alu_instr *instr)
case nir_op_bcsel:
   if (optimize_frontfacing_ternary(instr, result))
  return;
-
-  emit(CMP(reg_null_d, op[0], fs_reg(0), BRW_CONDITIONAL_NZ));
+  get_nir_src_as_flag(instr-src[0].src, instr-src[0].swizzle[0]);
   inst = emit(SEL(result, op[1], op[2]));
   inst-predicate = BRW_PREDICATE_NORMAL;
   break;
@@ -1287,6 +1283,14 @@ fs_visitor::get_nir_src(nir_src src, brw_reg_type type)
}
 }
 
+void
+fs_visitor::get_nir_src_as_flag(nir_src src, unsigned comp)
+{
+   fs_reg cond_src = get_nir_src(src, BRW_REGISTER_TYPE_UD);
+   fs_inst *inst = emit(MOV(reg_null_d, offset(cond_src, comp)));
+   inst-conditional_mod = BRW_CONDITIONAL_NZ;
+}
+
 fs_reg
 fs_visitor::get_nir_dest(nir_dest dest)
 {
-- 
2.3.2

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


[Mesa-dev] [Bug 89586] Drivers/DRI/swrast

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89586

Dan Sebald daniel.seb...@ieee.org changed:

   What|Removed |Added

 CC||daniel.seb...@ieee.org

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 3/4] i965/state: Create separate dirty state bits for each pipeline

2015-03-16 Thread Kristian Høgsberg
On Wed, Mar 11, 2015 at 11:53 AM, Jordan Justen
jordan.l.jus...@intel.com wrote:
 When uploading state for a pipeline, we will save changed state for
 the other pipelines.

 Signed-off-by: Jordan Justen jordan.l.jus...@intel.com

In reviewing this again, I realize I'm not completely comfortable with
how this is done. The overall approach is great, I'm happy to see the
dual pipeline flags contained in brw_state_upload.c, but I think we
need to keep brw_upload_pipeline_state() a no-op in case it fails.  I
can't think of a case where it might bite us, but currently, the
expectation is that if it fails, nothing changes and you can call it
again after flushing the batch.  This patch changes that in two ways:
1) we merge the pipeline brw-state.dirty into state and clear the
pipeline state and 2) we copy the dirty state into the other pipeline.
Suppose we call with the render pipeline and fail, flush the batch,
then call with the compute pipeline and clear the dirty flags [1]. If
we then go back and try to emit render state again, there are no
longer any dirty bits and we fail to emit render state.

This may be far-fetched and, as I said, I don't think we can hit this.
But I'd rather not break the contract that brw_upload_pipeline_state()
doesn't change state in case of failure - I know I'd hate to debug
that. We can just introduce a brw_clear_pipeline_dirty_bits() function
that will be called on successful state upload and merge the state
bits to the other pipeline and then clear the selected pipeline dirty
flags as well as brw-state.dirty.  And we need to use a local copy of
brw-state.dirty in brw_upload_pipeline_state() for merging in the
pipeline dirty flags so we don't modify brw-state.dirty on error.

[1] I don't see how we'd get into that, but with fast clear resolve
using meta we end up running the render pipeline at unexpected places.

 ---
  src/mesa/drivers/dri/i965/brw_context.h  |  1 +
  src/mesa/drivers/dri/i965/brw_state_upload.c | 42 
 ++--
  2 files changed, 35 insertions(+), 8 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
 b/src/mesa/drivers/dri/i965/brw_context.h
 index 91b4054..e693f50 100644
 --- a/src/mesa/drivers/dri/i965/brw_context.h
 +++ b/src/mesa/drivers/dri/i965/brw_context.h
 @@ -1101,6 +1101,7 @@ struct brw_context
 GLuint NewGLState;
 struct {
struct brw_state_flags dirty;
 +  struct brw_state_flags pipelines[BRW_NUM_PIPELINES];
 } state;

 struct brw_cache cache;
 diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c 
 b/src/mesa/drivers/dri/i965/brw_state_upload.c
 index 4f21002..55a9050 100644
 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c
 +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
 @@ -586,15 +586,16 @@ brw_upload_programs(struct brw_context *brw)
 brw_upload_wm_prog(brw);
  }

 -/***
 - * Emit all state:
 - */
 -void brw_upload_render_state(struct brw_context *brw)
 +static inline void
 +brw_upload_pipeline_state(struct brw_context *brw,
 +  enum brw_pipeline pipeline)
  {
 struct gl_context *ctx = brw-ctx;
 struct brw_state_flags *state = brw-state.dirty;
 int i;
 static int dirty_count = 0;
 +   struct brw_state_flags *pipeline_state =
 +  brw-state.pipelines[pipeline];

 state-mesa |= brw-NewGLState;
 brw-NewGLState = 0;
 @@ -633,6 +634,12 @@ void brw_upload_render_state(struct brw_context *brw)
brw-state.dirty.brw |= BRW_NEW_NUM_SAMPLES;
 }

 +   if ((pipeline_state-mesa | pipeline_state-brw) != 0) {
 +  state-mesa |= pipeline_state-mesa;
 +  state-brw |= pipeline_state-brw;
 +  memset(pipeline_state, 0, sizeof(struct brw_state_flags));
 +   }
 +
 if ((state-mesa | state-brw) == 0)
return;

 @@ -642,6 +649,10 @@ void brw_upload_render_state(struct brw_context *brw)

 brw_upload_programs(brw);

 +   const struct brw_tracked_state *atoms =
 +  brw_get_pipeline_atoms(brw, pipeline);
 +   const int num_atoms = brw-num_atoms[pipeline];
 +
 if (unlikely(INTEL_DEBUG)) {
/* Debug version which enforces various sanity checks on the
 * state flags which are generated and checked to help ensure
 @@ -651,8 +662,8 @@ void brw_upload_render_state(struct brw_context *brw)
memset(examined, 0, sizeof(examined));
prev = *state;

 -  for (i = 0; i  brw-num_atoms[BRW_RENDER_PIPELINE]; i++) {
 -const struct brw_tracked_state *atom = brw-render_atoms[i];
 +  for (i = 0; i  num_atoms; i++) {
 +const struct brw_tracked_state *atom = atoms[i];
  struct brw_state_flags generated;

  if (check_state(state, atom-dirty)) {
 @@ -671,8 +682,8 @@ void brw_upload_render_state(struct brw_context *brw)
}
 }
 else {
 -  for (i = 0; i  brw-num_atoms[BRW_RENDER_PIPELINE]; i++) {
 -const struct brw_tracked_state *atom = brw-render_atoms[i];
 +  

[Mesa-dev] [Bug 86326] clEnqueueNDRangeKernel global_work_offset ignored

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=86326

--- Comment #10 from Ronie Salgado ronies...@gmail.com ---
Created attachment 114367
  -- https://bugs.freedesktop.org/attachment.cgi?id=114367action=edit
Radeon patch for the other patches

It seems that the radeon driver depends in some of the llvm intrinsics.
Perphaps some refactoring is required. This patch makes glxgears working again.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 89586] Drivers/DRI/swrast

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89586

--- Comment #7 from Ilia Mirkin imir...@alum.mit.edu ---
Would you be able to supply a short program that reproduces the issue that
could be added to the piglit test suite? (http://cgit.freedesktop.org/piglit)
There are two tests in there that make use of glPixelZoom, but very far from a
thorough test.

Also, you're using swrast, which has seen very little activity of late -- do
these issues happen with the more up-to-date and commonly used gallium-based
softpipe or llvmpipe drivers?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/5] i965/fs: Emit better b2f of an expression on GEN4 and GEN5

2015-03-16 Thread Tapani Pälli


On 03/17/2015 07:42 AM, Tapani Pälli wrote:



On 03/16/2015 06:37 PM, Matt Turner wrote:

On Mon, Mar 16, 2015 at 4:54 AM, Tapani Pälli tapani.pa...@intel.com
wrote:

Is there some particular Piglit test case that hits this path and is it
possible with gen5 (by removing gen check)? I've tried this with
handicrafted shader_test and also shader-db and cannot hit the
conditions
for changes to happen. Would be nice to be able to run examine
changes and
understand this better.


Well, from the shader-db stats there must be some shaders affected in
shader-db.

Use INTEL_DEVID_OVERRIDE=... with a Gen4 or Gen5 PCI ID from
include/pci_ids/i965_pci_ids.h.



Yeah, got that but run.py for me says following error so I did not want
to try manually go one by one. The amount of tests it runs before error
changes between runs.


seems I did not have the latest head, did git pull and now shader-db 
works for me, not sure what that error was.

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


Re: [Mesa-dev] [PATCH] util: port _mesa_strto[df] to C

2015-03-16 Thread Emil Velikov
On 15/03/15 19:05, Erik Faye-Lund wrote:
 _mesa_strtod and _mesa_strtof are only used from the GLSL compiler,
 so the locale doesn't need to be initialized before the first context
 gets initialized. So let's use explicit initialization from the
 one-time init code instead of depending on a C++ compiler to initialize
 at image-load time.
 
 Signed-off-by: Erik Faye-Lund kusmab...@gmail.com
 ---
 
 Because of the recent discussion on libc++ and Mesa, I thought I'd
 have a look into what parts of mesa depended on libc++, and I spotted
 this file.
 
 In this case, it was rather trivial to port the code to plain C, making
 it dead obvious that it doesn't depend on libc++. I'm not proposing all
 C++ gets this treatment, but in this case it seems like a pretty
 straight-forward way to make it obvious that this code does not depend
 on libc++.
 
Fwiw this file/code should not cause any linkage to the C++ runtime,
although it's a nice cleanup imho.

There is a small catch though - _mesa_strtof can be used by the
standalone glsl_compiler and perhaps glcpp. I could not find any
references in the manpages about locale_t's implementation although it
guaranteed to be a struct for every platform we can just add an assert
in _mesa_strtof and fix the fallouts later ?

-Emil

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


Re: [Mesa-dev] [PATCH 15/23] mesa: refactor GetActiveUniformsiv, use _mesa_program_resource_prop

2015-03-16 Thread Ilia Mirkin
On Fri, Mar 13, 2015 at 4:38 AM, Tapani Pälli tapani.pa...@intel.com wrote:
 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/mesa/main/uniform_query.cpp | 107 
 ++--
  1 file changed, 38 insertions(+), 69 deletions(-)

 diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
 index 9f82de9..217473a 100644
 --- a/src/mesa/main/uniform_query.cpp
 +++ b/src/mesa/main/uniform_query.cpp
 @@ -79,6 +79,33 @@ _mesa_GetActiveUniform(GLuint program, GLuint index,
 }
  }

 +static GLenum
 +resource_prop_from_uniform_prop(GLenum uni_prop)
 +{
 +   switch (uni_prop) {
 +   case GL_UNIFORM_TYPE:
 +  return GL_TYPE;
 +   case GL_UNIFORM_SIZE:
 +  return GL_ARRAY_SIZE;
 +   case GL_UNIFORM_NAME_LENGTH:
 +  return GL_NAME_LENGTH;
 +   case GL_UNIFORM_BLOCK_INDEX:
 +  return GL_BLOCK_INDEX;
 +   case GL_UNIFORM_OFFSET:
 +  return GL_OFFSET;
 +   case GL_UNIFORM_ARRAY_STRIDE:
 +  return GL_ARRAY_STRIDE;
 +   case GL_UNIFORM_MATRIX_STRIDE:
 +  return GL_MATRIX_STRIDE;
 +   case GL_UNIFORM_IS_ROW_MAJOR:
 +  return GL_IS_ROW_MAJOR;
 +   case GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX:
 +  return GL_ATOMIC_COUNTER_BUFFER_INDEX;
 +   default:
 +  return 0;
 +   }
 +}
 +
  extern C void GLAPIENTRY
  _mesa_GetActiveUniformsiv(GLuint program,
   GLsizei uniformCount,
 @@ -88,7 +115,8 @@ _mesa_GetActiveUniformsiv(GLuint program,
  {
 GET_CURRENT_CONTEXT(ctx);
 struct gl_shader_program *shProg;
 -   GLsizei i;
 +   struct gl_program_resource *res;
 +   GLenum res_prop;

 if (uniformCount  0) {
_mesa_error(ctx, GL_INVALID_VALUE,
 @@ -100,80 +128,21 @@ _mesa_GetActiveUniformsiv(GLuint program,
 if (!shProg)
return;

 -   for (i = 0; i  uniformCount; i++) {
 -  GLuint index = uniformIndices[i];
 +   res_prop = resource_prop_from_uniform_prop(pname);

 -  if (index = shProg-NumUserUniformStorage) {
 +   for (int i = 0; i  uniformCount; i++) {
 +  res = _mesa_program_resource_find_index(shProg, GL_UNIFORM,
 +  uniformIndices[i]);
 +  if (!res) {
  _mesa_error(ctx, GL_INVALID_VALUE, glGetActiveUniformsiv(index));
 -return;
 + break;

indent is funny here.

}
 -   }
 -
 -   for (i = 0; i  uniformCount; i++) {
 -  GLuint index = uniformIndices[i];
 -  const struct gl_uniform_storage *uni = shProg-UniformStorage[index];
 -
 -  switch (pname) {
 -  case GL_UNIFORM_TYPE:
 -params[i] = uni-type-gl_type;
 -break;
 -
 -  case GL_UNIFORM_SIZE:
 -/* array_elements is zero for non-arrays, but the API requires that 
 1 be
 - * returned.
 - */
 -params[i] = MAX2(1, uni-array_elements);
 -break;
 -
 -  case GL_UNIFORM_NAME_LENGTH:
 -params[i] = strlen(uni-name) + 1;
 -
 - /* Page 61 (page 73 of the PDF) in section 2.11 of the OpenGL ES 3.0
 -  * spec says:
 -  *
 -  * If the active uniform is an array, the uniform name returned
 -  * in name will always be the name of the uniform array appended
 -  * with [0].
 -  */
 - if (uni-array_elements != 0)
 -params[i] += 3;
 -break;

 -  case GL_UNIFORM_BLOCK_INDEX:
 -params[i] = uni-block_index;
 -break;
 -
 -  case GL_UNIFORM_OFFSET:
 -params[i] = uni-offset;
 -break;
 -
 -  case GL_UNIFORM_ARRAY_STRIDE:
 -params[i] = uni-array_stride;
 -break;
 -
 -  case GL_UNIFORM_MATRIX_STRIDE:
 -params[i] = uni-matrix_stride;
 -break;
 -
 -  case GL_UNIFORM_IS_ROW_MAJOR:
 -params[i] = uni-row_major;
 -break;
 -
 -  case GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX:
 - if (!ctx-Extensions.ARB_shader_atomic_counters)
 -goto invalid_enum;
 - params[i] = uni-atomic_buffer_index;
 +  if (!_mesa_program_resource_prop(shProg, res, uniformIndices[i],
 +   res_prop, params[i],
 +   glGetActiveUniformsiv))

Will this return GL_INVALID_ENUM if res_prop == 0? If not, you need to
handle that above.

With that answered or taken care of,

Reviewed-by: Ilia Mirkin imir...@alum.mit.edu

   break;
 -
 -  default:
 - goto invalid_enum;
 -  }
 }
 -
 -   return;
 -
 - invalid_enum:
 -   _mesa_error(ctx, GL_INVALID_ENUM, glGetActiveUniformsiv(pname));
  }

  static struct gl_uniform_storage *
 --
 2.1.0

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


Re: [Mesa-dev] [PATCH] i965: Mark paths in linear - tiled functions as unreachable().

2015-03-16 Thread Jason Ekstrand
LGTM

On Mon, Mar 16, 2015 at 10:25 AM, Matt Turner matts...@gmail.com wrote:
 textdata bss dec hex filename
 9663   0   0966325bf intel_tiled_memcpy.o   before
 8215   0   082152017 intel_tiled_memcpy.o   after
 ---
  src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 16 
  1 file changed, 16 insertions(+)

 diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c 
 b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
 index 2097aaa..dcf0462 100644
 --- a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
 +++ b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
 @@ -398,6 +398,8 @@ linear_to_xtiled_faster(uint32_t x0, uint32_t x1, 
 uint32_t x2, uint32_t x3,
   return linear_to_xtiled(0, 0, xtile_width, xtile_width, 0, 
 xtile_height,
   dst, src, src_pitch, swizzle_bit,
   rgba8_copy_aligned_dst);
 +  else
 + unreachable(not reached);
 } else {
if (mem_copy == memcpy)
   return linear_to_xtiled(x0, x1, x2, x3, y0, y1,
 @@ -406,6 +408,8 @@ linear_to_xtiled_faster(uint32_t x0, uint32_t x1, 
 uint32_t x2, uint32_t x3,
   return linear_to_xtiled(x0, x1, x2, x3, y0, y1,
   dst, src, src_pitch, swizzle_bit,
   rgba8_copy_aligned_dst);
 +  else
 + unreachable(not reached);
 }
 linear_to_xtiled(x0, x1, x2, x3, y0, y1,
  dst, src, src_pitch, swizzle_bit, mem_copy);
 @@ -436,6 +440,8 @@ linear_to_ytiled_faster(uint32_t x0, uint32_t x1, 
 uint32_t x2, uint32_t x3,
   return linear_to_ytiled(0, 0, ytile_width, ytile_width, 0, 
 ytile_height,
   dst, src, src_pitch, swizzle_bit,
   rgba8_copy_aligned_dst);
 +  else
 + unreachable(not reached);
 } else {
if (mem_copy == memcpy)
   return linear_to_ytiled(x0, x1, x2, x3, y0, y1,
 @@ -444,6 +450,8 @@ linear_to_ytiled_faster(uint32_t x0, uint32_t x1, 
 uint32_t x2, uint32_t x3,
   return linear_to_ytiled(x0, x1, x2, x3, y0, y1,
   dst, src, src_pitch, swizzle_bit,
   rgba8_copy_aligned_dst);
 +  else
 + unreachable(not reached);
 }
 linear_to_ytiled(x0, x1, x2, x3, y0, y1,
  dst, src, src_pitch, swizzle_bit, mem_copy);
 @@ -474,6 +482,8 @@ xtiled_to_linear_faster(uint32_t x0, uint32_t x1, 
 uint32_t x2, uint32_t x3,
   return xtiled_to_linear(0, 0, xtile_width, xtile_width, 0, 
 xtile_height,
   dst, src, dst_pitch, swizzle_bit,
   rgba8_copy_aligned_src);
 +  else
 + unreachable(not reached);
 } else {
if (mem_copy == memcpy)
   return xtiled_to_linear(x0, x1, x2, x3, y0, y1,
 @@ -482,6 +492,8 @@ xtiled_to_linear_faster(uint32_t x0, uint32_t x1, 
 uint32_t x2, uint32_t x3,
   return xtiled_to_linear(x0, x1, x2, x3, y0, y1,
   dst, src, dst_pitch, swizzle_bit,
   rgba8_copy_aligned_src);
 +  else
 + unreachable(not reached);
 }
 xtiled_to_linear(x0, x1, x2, x3, y0, y1,
  dst, src, dst_pitch, swizzle_bit, mem_copy);
 @@ -512,6 +524,8 @@ ytiled_to_linear_faster(uint32_t x0, uint32_t x1, 
 uint32_t x2, uint32_t x3,
   return ytiled_to_linear(0, 0, ytile_width, ytile_width, 0, 
 ytile_height,
   dst, src, dst_pitch, swizzle_bit,
   rgba8_copy_aligned_src);
 +  else
 + unreachable(not reached);
 } else {
if (mem_copy == memcpy)
   return ytiled_to_linear(x0, x1, x2, x3, y0, y1,
 @@ -520,6 +534,8 @@ ytiled_to_linear_faster(uint32_t x0, uint32_t x1, 
 uint32_t x2, uint32_t x3,
   return ytiled_to_linear(x0, x1, x2, x3, y0, y1,
   dst, src, dst_pitch, swizzle_bit,
   rgba8_copy_aligned_src);
 +  else
 + unreachable(not reached);
 }
 ytiled_to_linear(x0, x1, x2, x3, y0, y1,
  dst, src, dst_pitch, swizzle_bit, mem_copy);
 --
 2.0.5

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


Re: [Mesa-dev] [PATCH 10/23] mesa: refactor GetActiveAttrib

2015-03-16 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin imir...@alum.mit.edu

One minor note -- not sure if it makes sense to call the
_mesa_program_resource_prop helpers, but it is nicely generic. However
you already have the ir_variable *var, so might as well use it? Your
call.

On Fri, Mar 13, 2015 at 4:37 AM, Tapani Pälli tapani.pa...@intel.com wrote:
 Instead of iterating IR, retrieve required information through
 the new program resource functions.

 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/mesa/main/shader_query.cpp | 58 
 --
  1 file changed, 27 insertions(+), 31 deletions(-)

 diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
 index 749cd32..8134d4b 100644
 --- a/src/mesa/main/shader_query.cpp
 +++ b/src/mesa/main/shader_query.cpp
 @@ -147,45 +147,41 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint 
 desired_index,
return;
 }

 -   exec_list *const ir = shProg-_LinkedShaders[MESA_SHADER_VERTEX]-ir;
 -   unsigned current_index = 0;
 -
 -   foreach_in_list(ir_instruction, node, ir) {
 -  const ir_variable *const var = node-as_variable();
 -
 -  if (!is_active_attrib(var))
 - continue;
 +   struct gl_program_resource *res =
 +  _mesa_program_resource_find_index(shProg, GL_PROGRAM_INPUT,
 +desired_index);

 -  if (current_index == desired_index) {
 - const char *var_name = var-name;
 +   /* User asked for index that does not exist. */
 +   if (!res) {
 +  _mesa_error(ctx, GL_INVALID_VALUE, glGetActiveAttrib(index));
 +  return;
 +   }

 - /* Since gl_VertexID may be lowered to gl_VertexIDMESA, we need to
 -  * consider gl_VertexIDMESA as gl_VertexID for purposes of checking
 -  * active attributes.
 -  */
 - if (var-data.mode == ir_var_system_value 
 - var-data.location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) {
 -var_name = gl_VertexID;
 - }
 +   const ir_variable *const var = RESOURCE_VAR(res);

 -_mesa_copy_string(name, maxLength, length, var_name);
 +   if (!is_active_attrib(var))
 +  return;

 -if (size)
 -   *size = (var-type-is_array()) ? var-type-length : 1;
 +   const char *var_name = var-name;

 -if (type)
 -   *type = var-type-gl_type;
 +   /* Since gl_VertexID may be lowered to gl_VertexIDMESA, we need to
 +* consider gl_VertexIDMESA as gl_VertexID for purposes of checking
 +* active attributes.
 +*/
 +   if (var-data.mode == ir_var_system_value 
 +   var-data.location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) {
 +  var_name = gl_VertexID;
 +   }

 -return;
 -  }
 +   _mesa_copy_string(name, maxLength, length, var_name);

 -  current_index++;
 -   }
 +   if (size)
 +  _mesa_program_resource_prop(shProg, res, desired_index, GL_ARRAY_SIZE,
 +  size, glGetActiveAttrib);

 -   /* If the loop did not return early, the caller must have asked for
 -* an index that did not exit.  Set an error.
 -*/
 -   _mesa_error(ctx, GL_INVALID_VALUE, glGetActiveAttrib(index));
 +   if (type)
 +  _mesa_program_resource_prop(shProg, res, desired_index, GL_TYPE,
 +  (GLint *) type, glGetActiveAttrib);
  }

  /* Locations associated with shader variables (array or non-array) can be
 --
 2.1.0

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


[Mesa-dev] [Bug 88534] include/c11/threads_posix.h PTHREAD_MUTEX_RECURSIVE_NP not defined

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=88534

Emil Velikov emil.l.veli...@gmail.com changed:

   What|Removed |Added

 Resolution|MOVED   |FIXED

--- Comment #2 from Emil Velikov emil.l.veli...@gmail.com ---
Thanks for the patch. Pushed to master

commit aead7fe2e2b6c89258f80a25299f4ec0fece2d95
Author: Felix Janda felix.ja...@posteo.de
Date:   Mon Feb 2 20:04:16 2015 +0100

c11/threads: Use PTHREAD_MUTEX_RECURSIVE by default

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 89530] FTBFS in loader: missing fstat

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89530

Emil Velikov emil.l.veli...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Emil Velikov emil.l.veli...@gmail.com ---
 Rebuild mesa from master with this patch, so +1 from me
What is G+ doing to us :P

Pushed to master

commit 771cd266b9d00bdcf2cf7acaa3c8363c358d7478
Author: Emil Velikov emil.l.veli...@gmail.com
Date:   Wed Mar 11 19:12:35 2015 +

loader: include sys/stat.h for non-sysfs builds

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] util: port _mesa_strto[df] to C

2015-03-16 Thread Erik Faye-Lund
On Mon, Mar 16, 2015 at 10:13 PM, Emil Velikov emil.l.veli...@gmail.com wrote:
 On 15/03/15 19:05, Erik Faye-Lund wrote:
 _mesa_strtod and _mesa_strtof are only used from the GLSL compiler,
 so the locale doesn't need to be initialized before the first context
 gets initialized. So let's use explicit initialization from the
 one-time init code instead of depending on a C++ compiler to initialize
 at image-load time.

 Signed-off-by: Erik Faye-Lund kusmab...@gmail.com
 ---

 Because of the recent discussion on libc++ and Mesa, I thought I'd
 have a look into what parts of mesa depended on libc++, and I spotted
 this file.

 In this case, it was rather trivial to port the code to plain C, making
 it dead obvious that it doesn't depend on libc++. I'm not proposing all
 C++ gets this treatment, but in this case it seems like a pretty
 straight-forward way to make it obvious that this code does not depend
 on libc++.

 Fwiw this file/code should not cause any linkage to the C++ runtime,
 although it's a nice cleanup imho.

 There is a small catch though - _mesa_strtof can be used by the
 standalone glsl_compiler and perhaps glcpp.

Good point, so perhaps this on top?

---8---
diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c
index 5144516..c62f4ef 100644
--- a/src/glsl/glcpp/glcpp.c
+++ b/src/glsl/glcpp/glcpp.c
@@ -29,6 +29,7 @@
 #include glcpp.h
 #include main/mtypes.h
 #include main/shaderobj.h
+#include util/strtod.h

 extern int glcpp_parser_debug;

@@ -168,6 +169,8 @@ main (int argc, char *argv[])
  if (shader == NULL)
return 1;

+ _mesa_locale_init();
+
  ret = glcpp_preprocess(ctx, shader, info_log, NULL, gl_ctx);

  printf(%s, shader);
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index ccac839..b23b583 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -38,6 +38,7 @@
 #include program/hash_table.h
 #include loop_analysis.h
 #include standalone_scaffolding.h
+#include util/strtod.h

 static int glsl_version = 330;

@@ -52,6 +53,8 @@ initialize_context(struct gl_context *ctx, gl_api api)
 {
initialize_context_to_defaults(ctx, api);

+   _mesa_locale_init();
+
/* The standalone compiler needs to claim support for almost
 * everything in order to compile the built-in functions.
 */
---8---
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] docs/GL3: don't list r300

2015-03-16 Thread Marek Olšák
From: Marek Olšák marek.ol...@amd.com

r300g already supports everything it can. There's no point in listing
the driver here.
---
 docs/GL3.txt | 56 
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 5d59341..1ca4502 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -21,23 +21,23 @@ Feature   Status
 GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, 
softpipe
 
   glBindFragDataLocation, glGetFragDataLocation DONE
-  Conditional rendering (GL_NV_conditional_render)  DONE (r300, swrast)
-  Map buffer subranges (GL_ARB_map_buffer_range)DONE (r300, swrast)
-  Clamping controls (GL_ARB_color_buffer_float) DONE (r300)
-  Float textures, renderbuffers (GL_ARB_texture_float)  DONE (r300)
+  Conditional rendering (GL_NV_conditional_render)  DONE (swrast)
+  Map buffer subranges (GL_ARB_map_buffer_range)DONE (swrast)
+  Clamping controls (GL_ARB_color_buffer_float) DONE ()
+  Float textures, renderbuffers (GL_ARB_texture_float)  DONE ()
   GL_EXT_packed_float   DONE ()
   GL_EXT_texture_shared_exponentDONE (swrast)
   Float depth buffers (GL_ARB_depth_buffer_float)   DONE ()
-  Framebuffer objects (GL_ARB_framebuffer_object)   DONE (r300, swrast)
+  Framebuffer objects (GL_ARB_framebuffer_object)   DONE (swrast)
   GL_ARB_half_float_pixel   DONE (all drivers)
-  GL_ARB_half_float_vertex  DONE (r300, swrast)
+  GL_ARB_half_float_vertex  DONE (swrast)
   GL_EXT_texture_integerDONE ()
   GL_EXT_texture_array  DONE ()
   Per-buffer blend and masks (GL_EXT_draw_buffers2) DONE (swrast)
-  GL_EXT_texture_compression_rgtc   DONE (r300, swrast)
-  GL_ARB_texture_rg DONE (r300, swrast)
+  GL_EXT_texture_compression_rgtc   DONE (swrast)
+  GL_ARB_texture_rg DONE (swrast)
   Transform feedback (GL_EXT_transform_feedback)DONE ()
-  Vertex array objects (GL_ARB_vertex_array_object) DONE (all drivers)
+  Vertex array objects (GL_ARB_vertex_array_object) DONE ()
   sRGB framebuffer format (GL_EXT_framebuffer_sRGB) DONE ()
   glClearBuffer commandsDONE
   glGetStringi command  DONE
@@ -45,7 +45,7 @@ GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, 
radeonsi, llvmpipe, soft
   glVertexAttribI commands  DONE
   Depth format cube texturesDONE ()
   GLX_ARB_create_context (GLX 1.4 is required)  DONE
-  Multisample anti-aliasing DONE (llvmpipe (*), 
softpipe (*), r300)
+  Multisample anti-aliasing DONE (llvmpipe (*), 
softpipe (*))
 
 (*) llvmpipe and softpipe have fake Multisample anti-aliasing support
 
@@ -54,27 +54,27 @@ GL 3.1, GLSL 1.40 --- all DONE: i965, nv50, nvc0, r600, 
radeonsi, llvmpipe, soft
 
   Forward compatible context support/deprecations   DONE ()
   Instanced drawing (GL_ARB_draw_instanced) DONE (swrast)
-  Buffer copying (GL_ARB_copy_buffer)   DONE (r300, swrast)
-  Primitive restart (GL_NV_primitive_restart)   DONE (r300)
+  Buffer copying (GL_ARB_copy_buffer)   DONE (swrast)
+  Primitive restart (GL_NV_primitive_restart)   DONE ()
   16 vertex texture image units DONE ()
   Texture buffer objs (GL_ARB_texture_buffer_object)DONE for OpenGL 3.1 
contexts ()
-  Rectangular textures (GL_ARB_texture_rectangle)   DONE (r300, swrast)
+  Rectangular textures (GL_ARB_texture_rectangle)   DONE (swrast)
   Uniform buffer objs (GL_ARB_uniform_buffer_object)DONE (swrast)
-  Signed normalized textures (GL_EXT_texture_snorm) DONE (r300)
+  Signed normalized textures (GL_EXT_texture_snorm) DONE ()
 
 
 GL 3.2, GLSL 1.50 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, 
softpipe
 
   Core/compatibility profiles   DONE
   Geometry shaders  DONE ()
-  BGRA vertex order (GL_ARB_vertex_array_bgra)  DONE (r300, swrast)
-  Base vertex offset(GL_ARB_draw_elements_base_vertex)  DONE (r300, swrast)
-  Frag shader coord (GL_ARB_fragment_coord_conventions) DONE (r300, swrast)
-  Provoking vertex (GL_ARB_provoking_vertex)DONE (r300, swrast)
+  BGRA vertex order (GL_ARB_vertex_array_bgra)  DONE (swrast)
+  Base vertex offset(GL_ARB_draw_elements_base_vertex)  DONE (swrast)
+  Frag shader coord (GL_ARB_fragment_coord_conventions) DONE (swrast)
+  Provoking vertex (GL_ARB_provoking_vertex) 

Re: [Mesa-dev] [PATCH 2/4] util: Change hash_table to use quadratic probing

2015-03-16 Thread Eric Anholt
Thomas Helland thomashellan...@gmail.com writes:

 This should give better cache locality, less memory consumption,
 and should also be faster since we avoid a modulo operation.
 Also change table size to be power of two.
 This gives better performance as we can do bitmasking instead of
 modulo operations for fitting the hash in the address space.
 By using the algorithm hash = sh + i/2 + i*i/2
 ee are guaranteed that all retries from the quad probing
 are distinct, and so should be able to completely fill the table.
 This passes the test added to exercise a worst case collision scenario.
 ---
  src/util/hash_table.c | 101 
 +-
  src/util/hash_table.h |   1 -
  2 files changed, 50 insertions(+), 52 deletions(-)

 diff --git a/src/util/hash_table.c b/src/util/hash_table.c
 index 3247593..92ffc10 100644
 --- a/src/util/hash_table.c
 +++ b/src/util/hash_table.c
 @@ -33,7 +33,7 @@
   */
  
  /**
 - * Implements an open-addressing, linear-reprobing hash table.
 + * Implements an open-addressing, quadratic probing hash table.
   *
   * For more information, see:
   *
 @@ -51,44 +51,45 @@
  static const uint32_t deleted_key_value;
  
  /**
 - * From Knuth -- a good choice for hash/rehash values is p, p-2 where
 - * p and p-2 are both prime.  These tables are sized to have an extra 10%
 - * free to avoid exponential performance degradation as the hash table fills
 + * We chose table sizes that's a power of two.
 + * This is computationally less expensive than primes.
 + * FNV-1a has good avalanche properties, so collision is not an issue.
 + * These tables are sized to have an extra 10% free to avoid
 + * exponential performance degradation as the hash table fills
   */
  static const struct {
 -   uint32_t max_entries, size, rehash;
 +   uint32_t max_entries, size;
  } hash_sizes[] = {
 -   { 2,  5,  3 },
 -   { 4,  7,  5 },
 -   { 8,  13, 11},
 -   { 16, 19, 17},
 -   { 32, 43, 41},
 -   { 64, 73, 71},
 -   { 128,151,149   },
 -   { 256,283,281   },
 -   { 512,571,569   },
 -   { 1024,   1153,   1151  },
 -   { 2048,   2269,   2267  },
 -   { 4096,   4519,   4517  },
 -   { 8192,   9013,   9011  },
 -   { 16384,  18043,  18041 },
 -   { 32768,  36109,  36107 },
 -   { 65536,  72091,  72089 },
 -   { 131072, 144409, 144407},
 -   { 262144, 288361, 288359},
 -   { 524288, 576883, 576881},
 -   { 1048576,1153459,1153457   },
 -   { 2097152,2307163,2307161   },
 -   { 4194304,4613893,4613891   },
 -   { 8388608,9227641,9227639   },
 -   { 16777216,   18455029,   18455027  },
 -   { 33554432,   36911011,   36911009  },
 -   { 67108864,   73819861,   73819859  },
 -   { 134217728,  147639589,  147639587 },
 -   { 268435456,  295279081,  295279079 },
 -   { 536870912,  590559793,  590559791 },
 -   { 1073741824, 1181116273, 1181116271},
 -   { 2147483648ul,   2362232233ul,   2362232231ul}
 +  { 3,4},
 +  { 7,8},
 +  { 14,   16   },
 +  { 28,   32   },
 +  { 57,   64   },
 +  { 115,  128  },
 +  { 230,  256  },
 +  { 460,  512  },
 +  { 921,  1024 },
 +  { 1843, 2048 },
 +  { 3686, 4096 },
 +  { 7372, 8192 },
 +  { 14745,16384},
 +  { 29491,32768},
 +  { 58982,65536},
 +  { 117964,   131072   },
 +  { 235929,   262144   },
 +  { 471859,   524288   },
 +  { 943718,   1048576  },
 +  { 1887436,  2097152  },
 +  { 3774873,  4194304  },
 +  { 7549747,  8388608  },
 +  { 15099494, 16777216 },
 +  { 30198988, 33554432 },
 +  { 60397977, 67108864 },
 +  { 120795955,134217728},
 +  { 241591910,268435456},
 +  { 483183820,536870912},
 +  { 966367641,1073741824   },
 +  { 1932735283ul, 2147483648ul }
  };
  
  static int
 @@ -123,7 +124,6 @@ _mesa_hash_table_create(void *mem_ctx,
  
 ht-size_index = 0;
 ht-size = hash_sizes[ht-size_index].size;
 -   ht-rehash = hash_sizes[ht-size_index].rehash;
 

Re: [Mesa-dev] [PATCH 08/18] i965/cs: Mark g0 as used by CS_OPCODE_CS_TERMINATE

2015-03-16 Thread Kenneth Graunke
On Saturday, March 14, 2015 09:54:18 PM Jordan Justen wrote:
 Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
 ---
  src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 4 
  1 file changed, 4 insertions(+)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
 index 72c490b..1f30a19 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
 @@ -405,6 +405,10 @@ fs_visitor::setup_payload_interference(struct ra_graph 
 *g,
   }
   break;
  
 +  case CS_OPCODE_CS_TERMINATE:
 + payload_last_use_ip[0] = use_ip;
 + break;
 +
default:
   if (inst-eot) {
  /* We could omit this for the !inst-header_present case, except
 

I was going to ask why we didn't just fall through to the inst-eot case
below, but...it looks like the VS, GS, and FS all want g0/g1 reserved,
while compute only needs g0.  So this looks like a sensible solution.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] docs/GL3: don't list swrast

2015-03-16 Thread Marek Olšák
From: Marek Olšák marek.ol...@amd.com

Let's face it: This driver is unlikely to get more love.
---
 docs/GL3.txt | 42 +-
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 1ca4502..bd17743 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -21,21 +21,21 @@ Feature   Status
 GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, 
softpipe
 
   glBindFragDataLocation, glGetFragDataLocation DONE
-  Conditional rendering (GL_NV_conditional_render)  DONE (swrast)
-  Map buffer subranges (GL_ARB_map_buffer_range)DONE (swrast)
+  Conditional rendering (GL_NV_conditional_render)  DONE ()
+  Map buffer subranges (GL_ARB_map_buffer_range)DONE ()
   Clamping controls (GL_ARB_color_buffer_float) DONE ()
   Float textures, renderbuffers (GL_ARB_texture_float)  DONE ()
   GL_EXT_packed_float   DONE ()
-  GL_EXT_texture_shared_exponentDONE (swrast)
+  GL_EXT_texture_shared_exponentDONE ()
   Float depth buffers (GL_ARB_depth_buffer_float)   DONE ()
-  Framebuffer objects (GL_ARB_framebuffer_object)   DONE (swrast)
+  Framebuffer objects (GL_ARB_framebuffer_object)   DONE ()
   GL_ARB_half_float_pixel   DONE (all drivers)
-  GL_ARB_half_float_vertex  DONE (swrast)
+  GL_ARB_half_float_vertex  DONE ()
   GL_EXT_texture_integerDONE ()
   GL_EXT_texture_array  DONE ()
-  Per-buffer blend and masks (GL_EXT_draw_buffers2) DONE (swrast)
-  GL_EXT_texture_compression_rgtc   DONE (swrast)
-  GL_ARB_texture_rg DONE (swrast)
+  Per-buffer blend and masks (GL_EXT_draw_buffers2) DONE ()
+  GL_EXT_texture_compression_rgtc   DONE ()
+  GL_ARB_texture_rg DONE ()
   Transform feedback (GL_EXT_transform_feedback)DONE ()
   Vertex array objects (GL_ARB_vertex_array_object) DONE ()
   sRGB framebuffer format (GL_EXT_framebuffer_sRGB) DONE ()
@@ -53,13 +53,13 @@ GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, 
radeonsi, llvmpipe, soft
 GL 3.1, GLSL 1.40 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, 
softpipe
 
   Forward compatible context support/deprecations   DONE ()
-  Instanced drawing (GL_ARB_draw_instanced) DONE (swrast)
-  Buffer copying (GL_ARB_copy_buffer)   DONE (swrast)
+  Instanced drawing (GL_ARB_draw_instanced) DONE ()
+  Buffer copying (GL_ARB_copy_buffer)   DONE ()
   Primitive restart (GL_NV_primitive_restart)   DONE ()
   16 vertex texture image units DONE ()
   Texture buffer objs (GL_ARB_texture_buffer_object)DONE for OpenGL 3.1 
contexts ()
-  Rectangular textures (GL_ARB_texture_rectangle)   DONE (swrast)
-  Uniform buffer objs (GL_ARB_uniform_buffer_object)DONE (swrast)
+  Rectangular textures (GL_ARB_texture_rectangle)   DONE ()
+  Uniform buffer objs (GL_ARB_uniform_buffer_object)DONE ()
   Signed normalized textures (GL_EXT_texture_snorm) DONE ()
 
 
@@ -67,14 +67,14 @@ GL 3.2, GLSL 1.50 --- all DONE: i965, nv50, nvc0, r600, 
radeonsi, llvmpipe, soft
 
   Core/compatibility profiles   DONE
   Geometry shaders  DONE ()
-  BGRA vertex order (GL_ARB_vertex_array_bgra)  DONE (swrast)
-  Base vertex offset(GL_ARB_draw_elements_base_vertex)  DONE (swrast)
-  Frag shader coord (GL_ARB_fragment_coord_conventions) DONE (swrast)
-  Provoking vertex (GL_ARB_provoking_vertex)DONE (swrast)
+  BGRA vertex order (GL_ARB_vertex_array_bgra)  DONE ()
+  Base vertex offset(GL_ARB_draw_elements_base_vertex)  DONE ()
+  Frag shader coord (GL_ARB_fragment_coord_conventions) DONE ()
+  Provoking vertex (GL_ARB_provoking_vertex)DONE ()
   Seamless cubemaps (GL_ARB_seamless_cube_map)  DONE ()
   Multisample textures (GL_ARB_texture_multisample) DONE ()
-  Frag depth clamp (GL_ARB_depth_clamp) DONE (swrast)
-  Fence objects (GL_ARB_sync)   DONE (swrast)
+  Frag depth clamp (GL_ARB_depth_clamp) DONE ()
+  Fence objects (GL_ARB_sync)   DONE ()
   GLX_ARB_create_context_profileDONE
 
 
@@ -82,11 +82,11 @@ GL 3.3, GLSL 3.30 --- all DONE: i965, nv50, nvc0, r600, 
radeonsi, llvmpipe, soft
 
   GL_ARB_blend_func_extendedDONE ()
   GL_ARB_explicit_attrib_location   DONE (all drivers that 
support GLSL)
-  GL_ARB_occlusion_query2   DONE (swrast)
+  GL_ARB_occlusion_query2  

Re: [Mesa-dev] Statically linking libstdc++ and libgcc

2015-03-16 Thread Ian Romanick
On 03/13/2015 02:32 PM, Emil Velikov wrote:
  * Allow people to static link against libgcc/libstdc++.
 
 Imho this should be option, disabled by default provided at configure
 time. This way builders/distributions can op-in if they choose to do so.

I'm very strongly opposed to this.

We already have too many build ABI options.  Each and every one of them
has caused some level of support pain (TLS vs. non-TLS, shared glapi vs
non-shared, etc.).  I have absolutely no interest in seeing another knob
added.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965/skl: Send a message header when doing constant loads SIMD4x2

2015-03-16 Thread Anuj Phogat
This patch fixes the misrendering in etqw-demo.
https://bugs.freedesktop.org/show_bug.cgi?id=89039

Tested-by: Anuj Phogat anuj.pho...@gmail.com

On Fri, Mar 13, 2015 at 9:29 AM, Neil Roberts n...@linux.intel.com wrote:
 Commit 0ac4c272755c7 made it add a header for the send message when
 using SIMD4x2 on Skylake because without this it will end up using
 SIMD8D. However the patch missed the case when a sampler is being used
 to implement constant loads from a buffer surface in a SIMD4x2 vertex
 shader.

 This fixes 29 Piglit tests, mostly related to the ARL instruction in
 vertex programs.

 Cc: Kristian Høgsberg k...@bitplanet.net
 ---
  src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 32 
 +++-
  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp   | 18 +
  src/mesa/drivers/dri/i965/brw_vec4_vp.cpp|  9 +++
  3 files changed, 53 insertions(+), 6 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp 
 b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
 index 010a5c4..e3a94ff 100644
 --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
 @@ -1049,18 +1049,38 @@ 
 vec4_generator::generate_pull_constant_load_gen7(vec4_instruction *inst,
  {
 assert(surf_index.type == BRW_REGISTER_TYPE_UD);

 +   struct brw_reg src = offset;
 +   bool header_present = false;
 +   int mlen = 1;
 +
 +   if (brw-gen = 9) {
 +  /* Skylake requires a message header in order to use SIMD4x2 mode. */
 +  src = retype(brw_vec4_grf(offset.nr - 1, 0), BRW_REGISTER_TYPE_UD);
 +  mlen = 2;
 +  header_present = true;
 +
 +  brw_push_insn_state(p);
 +  brw_set_default_mask_control(p, BRW_MASK_DISABLE);
 +  brw_MOV(p, src, retype(brw_vec4_grf(0, 0), BRW_REGISTER_TYPE_UD));
 +  brw_set_default_access_mode(p, BRW_ALIGN_1);
 +
 +  brw_MOV(p, get_element_ud(src, 2),
 +  brw_imm_ud(GEN9_SAMPLER_SIMD_MODE_EXTENSION_SIMD4X2));
 +  brw_pop_insn_state(p);
 +   }
 +
 if (surf_index.file == BRW_IMMEDIATE_VALUE) {

brw_inst *insn = brw_next_insn(p, BRW_OPCODE_SEND);
brw_set_dest(p, insn, dst);
 -  brw_set_src0(p, insn, offset);
 +  brw_set_src0(p, insn, src);
brw_set_sampler_message(p, insn,
surf_index.dw1.ud,
0, /* LD message ignores sampler unit */
GEN5_SAMPLER_MESSAGE_SAMPLE_LD,
1, /* rlen */
 -  1, /* mlen */
 -  false, /* no header */
 +  mlen,
 +  header_present,
BRW_SAMPLER_SIMD_MODE_SIMD4X2,
0);

 @@ -1089,8 +1109,8 @@ 
 vec4_generator::generate_pull_constant_load_gen7(vec4_instruction *inst,
0 /* sampler */,
GEN5_SAMPLER_MESSAGE_SAMPLE_LD,
1 /* rlen */,
 -  1 /* mlen */,
 -  false /* header */,
 +  mlen /* mlen */,
 +  header_present /* header */,
BRW_SAMPLER_SIMD_MODE_SIMD4X2,
0);
brw_inst_set_exec_size(p-brw, insn_or, BRW_EXECUTE_1);
 @@ -1102,7 +1122,7 @@ 
 vec4_generator::generate_pull_constant_load_gen7(vec4_instruction *inst,
/* dst = send(offset, a0.0) */
brw_inst *insn_send = brw_next_insn(p, BRW_OPCODE_SEND);
brw_set_dest(p, insn_send, dst);
 -  brw_set_src0(p, insn_send, offset);
 +  brw_set_src0(p, insn_send, src);
brw_set_indirect_send_descriptor(p, insn_send, BRW_SFID_SAMPLER, addr);

brw_pop_insn_state(p);
 diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
 b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
 index 5bf9e1b..38eb4ce 100644
 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
 @@ -1770,6 +1770,15 @@ vec4_visitor::visit(ir_expression *ir)

if (brw-gen = 7) {
   dst_reg grf_offset = dst_reg(this, glsl_type::int_type);
 +
 + /* We have to use a message header on Skylake to get SIMD4x2 mode.
 +  * Reserve space for the register.
 +  */
 + if (brw-gen = 9) {
 +grf_offset.reg_offset++;
 +alloc.sizes[grf_offset.reg] = 2;
 + }
 +
   grf_offset.type = offset.type;

   emit(MOV(grf_offset, offset));
 @@ -3464,6 +3473,15 @@ vec4_visitor::emit_pull_constant_load(bblock_t *block, 
 vec4_instruction *inst,

 if (brw-gen = 7) {
dst_reg grf_offset = dst_reg(this, glsl_type::int_type);
 +
 +  /* We have to use a message header on Skylake to get SIMD4x2 mode.
 +   * Reserve space for the register.
 +   */
 +  if 

Re: [Mesa-dev] [PATCH 1/2] i965/fs: Force promotion of src0 immediates.

2015-03-16 Thread Matt Turner
On Mon, Mar 16, 2015 at 2:44 PM, Kenneth Graunke kenn...@whitecape.org wrote:
 On Monday, March 16, 2015 07:54:45 AM Tapani Pälli wrote:
 My first attempt to fix the bug 89569 was to add check in combine
 constants but for some reason I did not get it to work. One reason is
 that inst-sources cannot be trusted

 I certainly hope we can trust it.  If it's wrong, we need to fix that.

We don't bother changing inst-sources when we convert a MUL dst, x,
0.0 into a MOV, but we do set its last source to reg_undef so it's
safe.

We could update inst-sources. It would at least let us skip a few
iterations. It'd also make dump_instructions() output a bit prettier.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 89599] symbol 'x86_64_entry_start' is already defined

2015-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89599

Bug ID: 89599
   Summary: symbol 'x86_64_entry_start' is already defined
   Product: Mesa
   Version: 10.5
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: major
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: tpg...@gmail.com
QA Contact: mesa-dev@lists.freedesktop.org

Mesa 10.5.1 does not build with LLVM/clang-3.6

Makefile:1426: recipe for target 'shared_glapi_libglapi_la-entry.lo' failed
make[4]: Leaving directory '/builddir/build/BUILD/mesa-10.5.1/src/mapi'
In file included from entry.c:49:
./entry_x86-64_tls.h:66:1: warning: tentative array definition assumed to have
one element
x86_64_entry_start[];
^
fatal error: error in backend: symbol 'x86_64_entry_start' is already defined
clang: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 3.6.0 (tags/RELEASE_360/final)

Detailed rpm-build.log can be found here
https://abf.io/build_lists/2473123

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 09/23] mesa: enable GL_ARB_program_interface_query extension

2015-03-16 Thread Ilia Mirkin
On Fri, Mar 13, 2015 at 4:37 AM, Tapani Pälli tapani.pa...@intel.com wrote:
 (and mark it as DONE in docs/GL3.txt)

And add to relnotes?


 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  docs/GL3.txt   | 4 ++--
  src/mesa/main/extensions.c | 1 +
  src/mesa/main/mtypes.h | 1 +
  3 files changed, 4 insertions(+), 2 deletions(-)

 diff --git a/docs/GL3.txt b/docs/GL3.txt
 index 43bbf85..eedbf0d 100644
 --- a/docs/GL3.txt
 +++ b/docs/GL3.txt
 @@ -160,7 +160,7 @@ GL 4.3, GLSL 4.30:
GL_ARB_internalformat_query2 not started
GL_ARB_invalidate_subdataDONE (all drivers)
GL_ARB_multi_draw_indirect   DONE (i965, nvc0, 
 r600, radeonsi, llvmpipe, softpipe)
 -  GL_ARB_program_interface_query   not started
 +  GL_ARB_program_interface_query   DONE (all drivers)
GL_ARB_robust_buffer_access_behavior not started
GL_ARB_shader_image_size not started
GL_ARB_shader_storage_buffer_object  not started
 @@ -215,7 +215,7 @@ GLES3.1, GLSL ES 3.1
GL_ARB_draw_indirect DONE (i965, nvc0, 
 r600, radeonsi, llvmpipe, softpipe)
GL_ARB_explicit_uniform_location DONE (all drivers 
 that support GLSL)
GL_ARB_framebuffer_no_attachmentsnot started
 -  GL_ARB_program_interface_query   not started
 +  GL_ARB_program_interface_query   DONE (all drivers)
GL_ARB_shader_atomic_countersDONE (i965)
GL_ARB_shader_image_load_store   in progress (curro)
GL_ARB_shader_storage_buffer_object  not started
 diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
 index f212015..861b150 100644
 --- a/src/mesa/main/extensions.c
 +++ b/src/mesa/main/extensions.c
 @@ -139,6 +139,7 @@ static const struct extension extension_table[] = {
 { GL_ARB_pixel_buffer_object, 
 o(EXT_pixel_buffer_object), GL, 2004 },
 { GL_ARB_point_parameters,o(EXT_point_parameters),  
   GLL,1997 },
 { GL_ARB_point_sprite,o(ARB_point_sprite),  
   GL, 2003 },
 +   { GL_ARB_program_interface_query, o(dummy_true),
   GL, 2012 },
 { GL_ARB_provoking_vertex,o(EXT_provoking_vertex),  
   GL, 2009 },
 { GL_ARB_robustness,  o(dummy_true),
   GL, 2010 },
 { GL_ARB_sample_shading,  o(ARB_sample_shading),
   GL, 2009 },
 diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
 index 4f18044..4865926 100644
 --- a/src/mesa/main/mtypes.h
 +++ b/src/mesa/main/mtypes.h
 @@ -3788,6 +3788,7 @@ struct gl_extensions
 GLboolean ARB_occlusion_query2;
 GLboolean ARB_pipeline_statistics_query;
 GLboolean ARB_point_sprite;
 +   GLboolean ARB_program_interface_query;

Not needed, right?

 GLboolean ARB_sample_shading;
 GLboolean ARB_seamless_cube_map;
 GLboolean ARB_shader_atomic_counters;
 --
 2.1.0

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


Re: [Mesa-dev] [PATCH 1/2] i965/fs: Force promotion of src0 immediates.

2015-03-16 Thread Kenneth Graunke
On Monday, March 16, 2015 07:54:45 AM Tapani Pälli wrote:
 My first attempt to fix the bug 89569 was to add check in combine 
 constants but for some reason I did not get it to work. One reason is 
 that inst-sources cannot be trusted

I certainly hope we can trust it.  If it's wrong, we need to fix that.

 so there's no 'easy way' to know how many sources instruction has (?)

There's also opcode_descs[i].nsrc as long as i  127.  But inst-sources
should be sufficient.

 Plan would be that for any 
 instruction it would check that last one is the only immediate.


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] docs/GL3: don't list r300

2015-03-16 Thread Matt Turner
On Mon, Mar 16, 2015 at 3:28 PM, Marek Olšák mar...@gmail.com wrote:
 From: Marek Olšák marek.ol...@amd.com

 r300g already supports everything it can. There's no point in listing
 the driver here.
 ---

FWIW, I always thought it was weird to list non-GL3 capable (not
really even GL2 capable, right?!) hardware here, so this seems like a
fine plan to me.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] util: port _mesa_strto[df] to C

2015-03-16 Thread Ian Romanick
On 03/15/2015 12:05 PM, Erik Faye-Lund wrote:
 _mesa_strtod and _mesa_strtof are only used from the GLSL compiler,

It's also used in the ARB_vertex_program / ARB_fragment_program
assembler in src/prog.

 so the locale doesn't need to be initialized before the first context
 gets initialized. So let's use explicit initialization from the
 one-time init code instead of depending on a C++ compiler to initialize
 at image-load time.

This is fairly close to the way Chia-I originally had it:

http://lists.freedesktop.org/archives/mesa-dev/2014-April/058215.html

Some discussion of alternate methods started:

http://lists.freedesktop.org/archives/mesa-dev/2014-May/058861.html

I'm a little concerned that having the initialization in Mesa and the
function accessible to both Mesa and Gallium that we may set ourselves
up for problems later.

It also occurs to me that the neither the old code nor the new code ever
call freelocale.  I think that's easier to fix with the static object
method (using a destructor).

I guess I'm kind of ambivalent about the change.

 Signed-off-by: Erik Faye-Lund kusmab...@gmail.com
 ---
 
 Because of the recent discussion on libc++ and Mesa, I thought I'd
 have a look into what parts of mesa depended on libc++, and I spotted
 this file.
 
 In this case, it was rather trivial to port the code to plain C, making
 it dead obvious that it doesn't depend on libc++. I'm not proposing all
 C++ gets this treatment, but in this case it seems like a pretty
 straight-forward way to make it obvious that this code does not depend
 on libc++.
 
  src/mesa/main/context.c   |  3 +++
  src/util/Makefile.sources |  2 +-
  src/util/{strtod.cpp = strtod.c} | 14 --
  src/util/strtod.h |  3 +++
  4 files changed, 15 insertions(+), 7 deletions(-)
  rename src/util/{strtod.cpp = strtod.c} (89%)
 
 diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
 index 22c2341..de6a016 100644
 --- a/src/mesa/main/context.c
 +++ b/src/mesa/main/context.c
 @@ -119,6 +119,7 @@
  #include shared.h
  #include shaderobj.h
  #include util/simple_list.h
 +#include util/strtod.h
  #include state.h
  #include stencil.h
  #include texcompress_s3tc.h
 @@ -398,6 +399,8 @@ one_time_init( struct gl_context *ctx )
assert( sizeof(GLint) == 4 );
assert( sizeof(GLuint) == 4 );
  
 +  _mesa_locale_init();
 +
_mesa_one_time_init_extension_overrides();
  
_mesa_get_cpu_features();
 diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources
 index 560ea83..f930790 100644
 --- a/src/util/Makefile.sources
 +++ b/src/util/Makefile.sources
 @@ -17,7 +17,7 @@ MESA_UTIL_FILES :=  \
   set.c \
   set.h \
   simple_list.h \
 - strtod.cpp \
 + strtod.c \
   strtod.h \
   texcompress_rgtc_tmp.h \
   u_atomic.h
 diff --git a/src/util/strtod.cpp b/src/util/strtod.c
 similarity index 89%
 rename from src/util/strtod.cpp
 rename to src/util/strtod.c
 index 2b4dd98..a4a60e0 100644
 --- a/src/util/strtod.cpp
 +++ b/src/util/strtod.c
 @@ -30,18 +30,20 @@
  #include locale.h
  #ifdef HAVE_XLOCALE_H
  #include xlocale.h
 +static locale_t loc;
  #endif
  #endif
  
  #include strtod.h
  
  
 +void
 +_mesa_locale_init(void)
 +{
  #if defined(_GNU_SOURCE)  defined(HAVE_XLOCALE_H)
 -static struct locale_initializer {
 -   locale_initializer() { loc = newlocale(LC_CTYPE_MASK, C, NULL); }
 -   locale_t loc;
 -} loc_init;
 +   loc = newlocale(LC_CTYPE_MASK, C, NULL);
  #endif
 +}
  
  /**
   * Wrapper around strtod which uses the C locale so the decimal
 @@ -51,7 +53,7 @@ double
  _mesa_strtod(const char *s, char **end)
  {
  #if defined(_GNU_SOURCE)  defined(HAVE_XLOCALE_H)
 -   return strtod_l(s, end, loc_init.loc);
 +   return strtod_l(s, end, loc);
  #else
 return strtod(s, end);
  #endif
 @@ -66,7 +68,7 @@ float
  _mesa_strtof(const char *s, char **end)
  {
  #if defined(_GNU_SOURCE)  defined(HAVE_XLOCALE_H)
 -   return strtof_l(s, end, loc_init.loc);
 +   return strtof_l(s, end, loc);
  #elif defined(HAVE_STRTOF)
 return strtof(s, end);
  #else
 diff --git a/src/util/strtod.h b/src/util/strtod.h
 index 02c25dd..b7e2beb 100644
 --- a/src/util/strtod.h
 +++ b/src/util/strtod.h
 @@ -31,6 +31,9 @@
  extern C {
  #endif
  
 +extern void
 +_mesa_locale_init(void);
 +
  extern double
  _mesa_strtod(const char *s, char **end);
  

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


Re: [Mesa-dev] [PATCH] glx: Handle out-of-sequence swap completion events correctly. (v2)

2015-03-16 Thread Emil Velikov
On 12/03/15 19:34, Mario Kleiner wrote:
 The code for emitting INTEL_swap_events swap completion
 events needs to translate from 32-Bit sbc on the wire to
 64-Bit sbc for the events and handle wraparound accordingly.
 
 It assumed that events would be sent by the server in the
 order their corresponding swap requests were emitted from
 the client, iow. sbc count should be always increasing. This
 was correct for DRI2.
 
 This is not always the case under the DRI3/Present backend,
 where the Present extension can execute presents and send out
 completion events in a different order than the submission
 order of the present requests, due to client code specifying
 targetMSC target vblank counts which are not strictly
 monotonically increasing. This confused the wraparound
 handling. This patch fixes the problem by handling 32-Bit
 wraparound in both directions. As long as successive swap
 completion events real 64-Bit sbc's don't differ by more
 than 2^30, this should be able to do the right thing.
 
 How this is supposed to work:
 
 awire-sbc contains the low 32-Bits of the true 64-Bit sbc
 of the current swap event, transmitted over the wire.
 
 glxDraw-lastEventSbc contains the low 32-Bits of the 64-Bit
 sbc of the most recently processed swap event.
 
 glxDraw-eventSbcWrap is a 64-Bit offset which tracks the upper
 32-Bits of the current sbc. The final 64-Bit output sbc
 aevent-sbc is computed from the sum of awire-sbc and
 glxDraw-eventSbcWrap.
 
 Under DRI3/Present, swap completion events can be received
 slightly out of order due to non-monotic targetMsc specified
 by client code, e.g., present request submission:
 
 Submission sbc:   1   2   3
 targetMsc:10  11  9
 
 Reception of completion events:
 Completion sbc:   3   1   2
 
 The completion sequence 3, 1, 2 would confuse the old wraparound
 handling made for DRI2 as 1  3 -- Assumes a 32-Bit wraparound
 has happened when it hasn't.
 
 The client can queue multiple present requests, in the case of
 Mesa up to n requests for n-buffered rendering, e.g., n =  2-4 in
 the current Mesa GLX DRI3/Present implementation. In the case of
 direct Pixmap presents via xcb_present_pixmap() the number n is
 limited by the amount of memory available.
 
 We reasonably assume that the number of outstanding requests n is
 much less than 2 billion due to memory contraints and common sense.
 Therefore while the order of received sbc's can be a bit scrambled,
 successive 64-Bit sbc's won't deviate by much, a given sbc may be
 a few counts lower or higher than the previous received sbc.
 
 Therefore any large difference between the incoming awire-sbc and
 the last recorded glxDraw-lastEventSbc will be due to 32-Bit
 wraparound and we need to adapt glxDraw-eventSbcWrap accordingly
 to adjust the upper 32-Bits of the sbc.
 
 Two cases, correponding to the two if-statements in the patch:
 
 a) Previous sbc event was below the last 2^32 boundary, in the previous
 glxDraw-eventSbcWrap epoch, the new sbc event is in the next 2^32
 epoch, therefore the low 32-Bit awire-sbc wrapped around to zero,
 or close to zero -- awire-sbc is apparently much lower than the
 glxDraw-lastEventSbc recorded for the previous epoch
 
 -- We need to increment glxDraw-eventSbcWrap by 2^32 to adjust
 the current epoch to be one higher than the previous one.
 
 -- Case a) also handles the old DRI2 behaviour.
 
 b) Previous sbc event was above closest 2^32 boundary, but now a
 late event from the previous 2^32 epoch arrives, with a true sbc
 that belongs to the previous 2^32 segment, so the awire-sbc of
 this late event has a high count close to 2^32, whereas
 glxDraw-lastEventSbc is closer to zero -- awire-sbc is much
 greater than glXDraw-lastEventSbc.
 
 -- We need to decrement glxDraw-eventSbcWrap by 2^32 to adjust
 the current epoch back to the previous lower epoch of this late
 completion event.
 
 We assume such a wraparound to a higher (a) epoch or lower (b)
 epoch has happened if awire-sbc and glxDraw-lastEventSbc differ
 by more than 2^30 counts, as such a difference can only happen
 on wraparound, or if somehow 2^30 present requests would be pending
 for a given drawable inside the server, which is rather unlikely.
 
 v2: Explain the reason for this patch and the new wraparound handling
 much more extensive in commit message, no code change wrt. initial
 version.
 
 Cc: 10.3 10.4 10.5 mesa-sta...@lists.freedesktop.org
 Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com
Thanks for keeping up Mario !

Planning to commit this (with Michel's r-b) tomorrow morning unless
there are any objections/comments.

-Emil

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


  1   2   >