Re: [Mesa-dev] Correct behaviour of glDrawPixels and glBitmap when texturing is enabled.

2015-03-24 Thread Michel Dänzer
On 24.03.2015 04:28, Matthew Dawson wrote:
 
 Moving forward, I'd like to work on making piglit pass on my hardware 
 (basically r600/radeonsi right now) for the non-skipped tests.  Would that be 
 ok to push forward within mesa, even it touches similar obscure features?  
 Or would it be preferred to simply remove those tests from piglit, since the 
 features under test are not wanted?

I think you should just let go of the idea of 'passing' piglit as a
whole. Even if you manage to fix all current tests (which will be a lot
of work for relatively little benefit), new tests are constantly added,
triggering more bugs in different parts of Mesa. The main point of
piglit isn't to pass every single test but to catch regressions.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer



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


Re: [Mesa-dev] [PATCH] nir: Handle vector arguments to logical and/or/xor.

2015-03-24 Thread Connor Abbott
We could already handle vector arguments to these -- we just couldn't
handle mixed scalar and vector arguments. So change the commit message
to something like nir: Handle mixed scalar/vector arguments to
logical and/or/xor. and fix the typo and then this is

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

On Mon, Mar 23, 2015 at 8:10 PM, Matt Turner matts...@gmail.com wrote:
 ---
  src/glsl/nir/glsl_to_nir.cpp | 39 +--
  1 file changed, 21 insertions(+), 18 deletions(-)

 diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
 index 357944d..e6f5ffc 100644
 --- a/src/glsl/nir/glsl_to_nir.cpp
 +++ b/src/glsl/nir/glsl_to_nir.cpp
 @@ -1210,6 +1210,9 @@ nir_visitor::visit(ir_expression *ir)
 case ir_binop_bit_and:
 case ir_binop_bit_or:
 case ir_binop_bit_xor:
 +   case ir_binop_logic_and:
 +   case ir_binop_logic_or:
 +   case ir_binop_logic_xor:
 case ir_binop_lshift:
 case ir_binop_rshift:
switch (ir-operation) {
 @@ -1270,6 +1273,24 @@ nir_visitor::visit(ir_expression *ir)
case ir_binop_bit_xor:
   op = nir_op_ixor;
   break;
 +  case ir_binop_logic_and:
 + if (supports_ints)
 +op = nir_op_iand;
 + else
 +op = nir_op_fand;
 + break;
 +  case ir_binop_logic_or:
 + if (supports_ints)
 +op = nir_op_ior;
 + else
 +op = nir_op_for;
 + break;
 +  case ir_binop_logic_xor:
 + if (supports_ints)
 +op - nir_op_ixor;
 + else
 +op = nir_op_fxor;
 + break;
case ir_binop_lshift:
   op = nir_op_ishl;
   break;
 @@ -1444,24 +1465,6 @@ nir_visitor::visit(ir_expression *ir)
   }
}
break;
 -   case ir_binop_logic_and:
 -  if (supports_ints)
 - emit(nir_op_iand, dest_size, srcs);
 -  else
 - emit(nir_op_fand, dest_size, srcs);
 -  break;
 -   case ir_binop_logic_or:
 -  if (supports_ints)
 - emit(nir_op_ior, dest_size, srcs);
 -  else
 - emit(nir_op_for, dest_size, srcs);
 -  break;
 -   case ir_binop_logic_xor:
 -  if (supports_ints)
 - emit(nir_op_ixor, dest_size, srcs);
 -  else
 - emit(nir_op_fxor, dest_size, srcs);
 -  break;
 case ir_binop_dot:
switch (ir-operands[0]-type-vector_elements) {
   case 2: emit(nir_op_fdot2, dest_size, srcs); break;
 --
 2.0.5

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


Re: [Mesa-dev] [PATCH 04/23] i965/fs: Don't emit dumb SEL

2015-03-24 Thread Tapani Pälli


On 03/20/2015 10:58 PM, Ian Romanick wrote:

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

With previous changes to emit more ir_triop_csel, the i965 channel
expressions pass can generate sequences like:

 mov(8)  g451F  1F
 (+f0) sel(8)g401F  g458,8,1F 1F

There are no shader-db changes now, but this prevents a large number of
regressions from a later commit (glsl: Optimize certain if-statements to
ir_triop_csel).

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Cc: Tapani Pälli tapani.pa...@intel.com
---
  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 9 +
  1 file changed, 9 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index e39dab3..1fbef5f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -708,6 +708,15 @@ fs_visitor::visit(ir_expression *ir)
break;

 case ir_triop_csel:
+  /* After splitting an expression like 'v = csel(cond, vec4(a, b, c, 1),
+   * vec4(d, e, f, 1))', there will be a 'v.w = csel(cond, 1, 1)'.  Detect
+   * this, and avoid emitting the spurious SEL.
+   */
+  if (ir-operands[1]-equals(ir-operands[2])) {
+ ir-operands[1]-accept(this);
+ return;


The result is correct but why is this done in the backend? Couldn't the 
later commit mentioned for glsl already detect this or maybe additional 
optimization pass there?



+  }
+
if (try_opt_frontfacing_ternary(ir))
   return;




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


Re: [Mesa-dev] [PATCH] radeonsi/compute: Default to the same PIPE_SHADER_CAP values as other shader types v2

2015-03-24 Thread Marek Olšák
Reviewed-by: Marek Olšák marek.ol...@amd.com

Marek

On Mon, Mar 23, 2015 at 3:53 PM, Tom Stellard thomas.stell...@amd.com wrote:
 v2:
   - Fix typo
 ---
  src/gallium/drivers/radeonsi/si_pipe.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

 diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
 b/src/gallium/drivers/radeonsi/si_pipe.c
 index d335bda..c7773b7 100644
 --- a/src/gallium/drivers/radeonsi/si_pipe.c
 +++ b/src/gallium/drivers/radeonsi/si_pipe.c
 @@ -376,8 +376,12 @@ static int si_get_shader_param(struct pipe_screen* 
 pscreen, unsigned shader, enu
 return max_const_buffer_size;
 }
 default:
 -   return 0;
 +   /* If compute shaders don't require a special value
 +* for this cap, we can return the same value we
 +* do for other shader types. */
 +   break;
 }
 +   break;
 default:
 /* TODO: support tessellation */
 return 0;
 --
 2.0.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] glsl: avoid calling base_alignment when samplers are involved

2015-03-24 Thread Tapani Pälli

Reviewed-by: Tapani Palli tapani.pa...@intel.com

On 03/23/2015 02:00 PM, Ilia Mirkin wrote:

Earlier commit 53bf7c8fd2e changed the logic to always call
base_alignment on structs. 1ec715ce8b12 hacked the function to return 0
for sampler fields, but didn't handle sampler arrays. Instead of
extending the hack, avoid calling base_alignment in the first place on
non-UBO uniforms.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89726
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
---

No regressions in a piglit run. This seems like the right thing to do
rather than further hacking base_alignment. I was in fix it now!
mode when I wrote the original logic, getting pretty frustrated at the
various UBO rules and the number of different places they were being
implemented inside mesa.

However I think that for uniforms, this is the one and only place. As
a side-benefit, this means that uniforms will be better packed in the
presence of structs. And this will hopefully fix a lot of
glsl_align(0) might happen, wa errors from static checkers.

  src/glsl/glsl_types.cpp| 9 -
  src/glsl/link_uniforms.cpp | 4 
  2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 38b37a6..be87b0a 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -1077,15 +1077,6 @@ glsl_type::std140_base_alignment(bool row_major) const
return base_alignment;
 }

-   /* A sampler may never occur in a UBO (without bindless of some sort),
-* however it is convenient to use this alignment function even with
-* regular uniforms. This allows use of this function on uniform structs
-* that contain samplers.
-*/
-   if (this-is_sampler()) {
-  return 0;
-   }
-
 assert(!not reached);
 return -1;
  }
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 799c74b..59adc29 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -547,6 +547,8 @@ private:
 virtual void enter_record(const glsl_type *type, const char *name,
   bool row_major) {
assert(type-is_record());
+  if (this-ubo_block_index == -1)
+ return;
this-ubo_byte_offset = glsl_align(
  this-ubo_byte_offset, type-std140_base_alignment(row_major));
 }
@@ -554,6 +556,8 @@ private:
 virtual void leave_record(const glsl_type *type, const char *name,
   bool row_major) {
assert(type-is_record());
+  if (this-ubo_block_index == -1)
+ return;
this-ubo_byte_offset = glsl_align(
  this-ubo_byte_offset, type-std140_base_alignment(row_major));
 }


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


Re: [Mesa-dev] [RFC] More ARB_arrays_of_arrays support

2015-03-24 Thread Timothy Arceri
On Sat, 2015-03-21 at 09:27 -0700, Jason Ekstrand wrote:
 
 On Mar 21, 2015 2:49 AM, Timothy Arceri t_arc...@yahoo.com.au
 wrote:
 
  This series adds most of the remaining glsl arrays of arrays
 support. Support for uniform blocks is still missing, I've played
 around with this but don't have anything working yet.
 
  What do you guys think about adding these changes without the
 uniform blocks support? Adding these changes now I assume would make
 it easy for the nir guys to start adding AoA support (if it doesn't
 exist already) and the intel backend changes could start to be worked
 on.
 
 Support in NIR should just work.  Of course that probably won't
 actually be the case.  However, if it does break something then that's
 a bug because the code is all there.  It should be easy to check since
 your already running on Intel.  If your i965 is IVB+, just do a piglit
 run with INTEL_USE_NIR=1.  If its older than that, I'll be pushing
 support for SNB and prior on Monday; just rebase.
 
 The one place I know of where this will get dicey is in the sampler
 arrays portion of the ARB_gpu_shader5 extension.  That implementation
 is rather hacky and I'm pretty sure will fall flat on its face if
 milti-level arrays are involved.  I know NIR's implementation will
 assert-fail; the i965 code may just do the wrong thing.  In other
 words, tests are needed for that specific case.  However, I guess that
 falls under the category of yet-to-be-done uniform stuff.

It's been a while since I last ran my changes on the i965 driver and it
seems to work a lot better now. Not sure if that's because of changes to
the i965 backend or just my code being less buggy.
Anyway the good news is at least on the tests I have so far running on
NIR produces the same results as without it.
There is also only one test that fails on the i965 backend but passes on
Gallium (although it is a very simple test).

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


Re: [Mesa-dev] [PATCH 2/6] nir: Implement a Mesa IR - NIR translator.

2015-03-24 Thread Connor Abbott
On Mon, Mar 23, 2015 at 8:37 PM, Kenneth Graunke kenn...@whitecape.org wrote:
 Shamelessly ripped off from Eric Anholt's tgsi_to_nir pass.

 Not compiled on SCons, like the rest of NIR.

 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/mesa/Makefile.am|2 +
  src/mesa/Makefile.sources   |5 +
  src/mesa/program/prog_instruction.h |2 +
  src/mesa/program/prog_to_nir.c  | 1189 
 +++
  src/mesa/program/prog_to_nir.h  |   37 ++
  5 files changed, 1235 insertions(+)
  create mode 100644 src/mesa/program/prog_to_nir.c
  create mode 100644 src/mesa/program/prog_to_nir.h

 diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
 index 3dab8f0..60114e4 100644
 --- a/src/mesa/Makefile.am
 +++ b/src/mesa/Makefile.am
 @@ -174,6 +174,7 @@ endif
  libmesa_la_SOURCES = \
 $(MESA_FILES) \
 $(PROGRAM_FILES) \
 +   $(PROGRAM_NIR_FILES) \
 $(MESA_ASM_FILES_FOR_ARCH)

  libmesa_la_LIBADD = \
 @@ -183,6 +184,7 @@ libmesa_la_LIBADD = \
  libmesagallium_la_SOURCES = \
 $(MESA_GALLIUM_FILES) \
 $(PROGRAM_FILES) \
 +   $(PROGRAM_NIR_FILES) \
 $(MESA_ASM_FILES_FOR_ARCH)

  libmesagallium_la_LIBADD = \
 diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
 index 217be9a..cc166ce 100644
 --- a/src/mesa/Makefile.sources
 +++ b/src/mesa/Makefile.sources
 @@ -520,6 +520,10 @@ PROGRAM_FILES = \
 program/symbol_table.c \
 program/symbol_table.h

 +PROGRAM_NIR_FILES = \
 +   program/prog_to_nir.c \
 +   program/prog_to_nir.h
 +
  ASM_C_FILES =  \
 x86/common_x86.c \
 x86/x86_xform.c \
 @@ -608,6 +612,7 @@ INCLUDE_DIRS = \
 -I$(top_srcdir)/src \
 -I$(top_srcdir)/src/glsl \
 -I$(top_builddir)/src/glsl \
 +   -I$(top_builddir)/src/glsl/nir \
 -I$(top_srcdir)/src/glsl/glcpp \
 -I$(top_srcdir)/src/mesa \
 -I$(top_builddir)/src/mesa \
 diff --git a/src/mesa/program/prog_instruction.h 
 b/src/mesa/program/prog_instruction.h
 index ab3acbc..96da198 100644
 --- a/src/mesa/program/prog_instruction.h
 +++ b/src/mesa/program/prog_instruction.h
 @@ -59,6 +59,8 @@
  #define SWIZZLE_NOOP   MAKE_SWIZZLE4(0,1,2,3)
  #define GET_SWZ(swz, idx)  (((swz)  ((idx)*3))  0x7)
  #define GET_BIT(msk, idx)  (((msk)  (idx))  0x1)
 +/** Determine if swz contains SWIZZLE_ZERO/ONE/NIL for any components. */
 +#define HAS_EXTENDED_SWIZZLE(swz) (swz  0x924)

  #define SWIZZLE_XYZW MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, 
 SWIZZLE_W)
  #define SWIZZLE_ MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, 
 SWIZZLE_X)
 diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
 new file mode 100644
 index 000..7093346
 --- /dev/null
 +++ b/src/mesa/program/prog_to_nir.c
 @@ -0,0 +1,1189 @@
 +/*
 + * Copyright © 2015 Intel Corporation
 + * Copyright © 2014-2015 Broadcom
 + * Copyright (C) 2014 Rob Clark robcl...@freedesktop.org
 + *
 + * 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 (including the next
 + * paragraph) shall be included in all copies or substantial portions of the
 + * Software.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 DEALINGS
 + * IN THE SOFTWARE.
 + */
 +
 +#include nir/nir.h
 +#include nir/nir_builder.h
 +#include glsl/list.h
 +#include main/imports.h
 +#include util/ralloc.h
 +
 +#include prog_to_nir.h
 +#include prog_instruction.h
 +#include prog_parameter.h
 +#include prog_print.h
 +
 +#define SWIZ(X, Y, Z, W) (unsigned[4]){ \
 +  SWIZZLE_##X,  \
 +  SWIZZLE_##Y,  \
 +  SWIZZLE_##Z,  \
 +  SWIZZLE_##W,  \
 +   }
 +
 +struct ptn_compile {
 +   struct gl_program *prog;
 +   struct nir_builder build;
 +   struct nir_shader *s;
 +   nir_function_impl *impl;
 +   struct exec_list *cf_node_list;
 +   bool error;
 +
 +   nir_variable *input_vars[VARYING_SLOT_MAX];
 +   nir_variable *output_vars[VARYING_SLOT_MAX];
 +   nir_register **output_regs;
 +   nir_register **temp_regs;
 +
 +   

Re: [Mesa-dev] [PATCH 1/3] mesa: Improve validation of target, format and type of glTexSubImage[2, 3]D

2015-03-24 Thread Laura Ekstrand
On Tue, Mar 24, 2015 at 11:34 AM, Eduardo Lima Mitev el...@igalia.com
wrote:

 Thanks for the review! Please see some comments inline:

 On 03/23/2015 06:53 PM, Laura Ekstrand wrote:
  I'm glad you found this target checking problem.  I have come across the
  same problem in other texture functions, but I have been too busy to
  find all instances of this.  It's kind of a natural, negative byproduct
  of adding DSA.
 
  [..]
 
  I recommend getting rid of the legal_texsubimage_target check in
  texsubimage_error_check and moving it up into texturesubimage, right
  after the texObj has been retrieved. Otherwise in the texsubimage case,
  the target will get checked twice, once in texsubimage and once in
  texsubimage-error-check.  In general, checking hurts driver performance,
  so we should aim to get rid of redundancies.
 
 

 Yes, will do that.

 
  This is not related to target checking and should be moved to a separate
  commit (with a name like gles 3 support for texsubimage_error_check).
 

 Ok, makes sense.

 
  I would also move this block up to about line 2508 so it can sit next to
  the other format and type checks there.  It would be nice to have all of
  the format_and_type_checks formatted into one if, else if, else block so
  it's really obvious what's going on, too.
 
  +   if (_mesa_is_gles3(ctx)) {
  +  /* Validation of format and type for ES3 has to be done here
  +   * after the texture image is resolved, because the internal
  +   * format is needed for the verification
  +   */
  +  err = _mesa_es3_error_check_format_and_type(ctx, format, type,
  +
  texImage-InternalFormat);
  +  if (err != GL_NO_ERROR) {
  + _mesa_error(ctx, err,
  + %s(incompatible format = %s, type = %s, 
  + internalformat = %s),
  + callerName, _mesa_lookup_enum_by_nr(format),
  + _mesa_lookup_enum_by_nr(type),
  +
   _mesa_lookup_enum_by_nr(texImage-InternalFormat));
  + return GL_TRUE;
  +  }
  +   }
  +

 Note that this error check has to be performed after the texture image
 is resolved, because the internal format is not known before.

 If we want to merge it with the above format and type error checks, the
 only choice is to move all down after:

 texImage = _mesa_select_tex_image(texObj, target, level);

 But then we have a chicken-egg situation, since that function requires
 target to be validated before.

 WDYT?

 cheers,
 Eduardo

 What does the (es)_error_check_format_and_type have to do with validating
the target?  I thought legal_texsubimage_target did all of the target
checking?  So if we move up _mesa_select_tex_image above the format and
type checks, it shouldn't be a problem because the target is already
checked.  (That's my understanding of the problem.)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] clover: Call clBuildProgram() notification function when build completes

2015-03-24 Thread Francisco Jerez
Tom Stellard thomas.stell...@amd.com writes:

 Cc: 10.5 10.4 mesa-sta...@lists.freedesktop.org
 ---
  src/gallium/state_trackers/clover/api/program.cpp | 4 
  1 file changed, 4 insertions(+)

 diff --git a/src/gallium/state_trackers/clover/api/program.cpp 
 b/src/gallium/state_trackers/clover/api/program.cpp
 index 60184ed..fcec1d7 100644
 --- a/src/gallium/state_trackers/clover/api/program.cpp
 +++ b/src/gallium/state_trackers/clover/api/program.cpp
 @@ -180,8 +180,12 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
 validate_build_program_common(prog, num_devs, d_devs, pfn_notify, 
 user_data);
  
 prog.build(devs, opts);
 +   if (pfn_notify)
 +  pfn_notify(d_prog, user_data);
 return CL_SUCCESS;
  } catch (error e) {
 +   if (pfn_notify)
 +  pfn_notify(d_prog, user_data);

AFAIK the notification function shouldn't be run in cases where
clBuildProgram() fails for reasons other than compilation failure, maybe
add another 'catch (const build_error e) { ... }' block and do this in
that case only?  And most likely clCompileProgram() needs to be fixed
too?

 if (e.get() == CL_INVALID_COMPILER_OPTIONS)
return CL_INVALID_BUILD_OPTIONS;

You could get rid of this conditional if you do it as I suggested.

 if (e.get() == CL_COMPILE_PROGRAM_FAILURE)
 -- 
 2.0.4

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


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 04/23] i965/fs: Don't emit dumb SEL

2015-03-24 Thread Ian Romanick
On 03/24/2015 05:01 AM, Tapani Pälli wrote:
 
 On 03/20/2015 10:58 PM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com

 With previous changes to emit more ir_triop_csel, the i965 channel
 expressions pass can generate sequences like:

  mov(8)  g451F  1F
  (+f0) sel(8)g401F  g458,8,1F 1F

 There are no shader-db changes now, but this prevents a large number of
 regressions from a later commit (glsl: Optimize certain if-statements to
 ir_triop_csel).

 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 Cc: Tapani Pälli tapani.pa...@intel.com
 ---
   src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 9 +
   1 file changed, 9 insertions(+)

 diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 index e39dab3..1fbef5f 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
 @@ -708,6 +708,15 @@ fs_visitor::visit(ir_expression *ir)
 break;

  case ir_triop_csel:
 +  /* After splitting an expression like 'v = csel(cond, vec4(a,
 b, c, 1),
 +   * vec4(d, e, f, 1))', there will be a 'v.w = csel(cond, 1,
 1)'.  Detect
 +   * this, and avoid emitting the spurious SEL.
 +   */
 +  if (ir-operands[1]-equals(ir-operands[2])) {
 + ir-operands[1]-accept(this);
 + return;
 
 The result is correct but why is this done in the backend? Couldn't the
 later commit mentioned for glsl already detect this or maybe additional
 optimization pass there?

I had assumed there was already an algebraic optimization for this case
that, for whatever reason, just wasn't triggering here.  I went to go
find it, and it does not exist... it looks like replacing this code with
a similar change to src/glsl/opt_algebraic.cpp is equally effective.
I'll do that instead.

 +  }
 +
 if (try_opt_frontfacing_ternary(ir))
return;


 
 // Tapani

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


Re: [Mesa-dev] [PATCH 7/9] nir/peephole_ffma: Be less agressive about fusing multiply-adds

2015-03-24 Thread Connor Abbott
I think this is being both too aggressive and not aggressive enough.
First, the too aggressive part. Imagine if we have something like:

a = mul b, c;
d = add a, 1.0;
e = add a, 2.0;
f = add a, 3.0;

In this case, we don't want to turn this into a series of 3 mad's
since the 3 load immediate instructions are going to hurt us more than
the elimination of the mul. When the only thing using the mul is a
bunch of add's, it's only profitable when there's at most one distinct
immediate that isn't used by other MAD's -- any more and we gain
instructions.

Also, I think that we might still want to fuse the multiply and the
add even if the mul is used somewhere else, since at least it gives
the scheduler some extra freedom to hide latency -- as long as we
don't have to emit any load immediate instructions. Of course, this is
all very backend-specific so at this point it would make sense to move
this to an i965 pass and leave in the general ffma peephole for
everyone else without these weird restrictions.

On Mon, Mar 23, 2015 at 11:13 PM, Jason Ekstrand ja...@jlekstrand.net wrote:
 shader-db results for fragment shaders on Haswell:
 total instructions in shared programs: 4395688 - 4389623 (-0.14%)
 instructions in affected programs: 355876 - 349811 (-1.70%)
 helped:1455
 HURT:  14
 GAINED:5
 LOST:  0
 ---
  src/glsl/nir/nir_opt_peephole_ffma.c | 41 
 
  1 file changed, 41 insertions(+)

 diff --git a/src/glsl/nir/nir_opt_peephole_ffma.c 
 b/src/glsl/nir/nir_opt_peephole_ffma.c
 index 4674505..b875bb6 100644
 --- a/src/glsl/nir/nir_opt_peephole_ffma.c
 +++ b/src/glsl/nir/nir_opt_peephole_ffma.c
 @@ -38,6 +38,41 @@ struct peephole_ffma_state {
 bool progress;
  };

 +static inline bool
 +are_all_uses_fadd(nir_ssa_def *def)
 +{
 +   if (def-if_uses-entries  0)
 +  return false;
 +
 +   struct set_entry *use_iter;
 +   set_foreach(def-uses, use_iter) {
 +  nir_instr *use_instr = (nir_instr *)use_iter-key;
 +
 +  if (use_instr-type != nir_instr_type_alu)
 + return false;
 +
 +  nir_alu_instr *use_alu = nir_instr_as_alu(use_instr);
 +  switch (use_alu-op) {
 +  case nir_op_fadd:
 + break; /* This one's ok */
 +
 +  case nir_op_imov:
 +  case nir_op_fmov:
 +  case nir_op_fneg:
 +  case nir_op_fabs:
 + assert(use_alu-dest.dest.is_ssa);
 + if (!are_all_uses_fadd(use_alu-dest.dest.ssa))
 +return false;
 + break;
 +
 +  default:
 + return false;
 +  }
 +   }
 +
 +   return true;
 +}
 +
  static inline nir_alu_instr *
  get_mul_for_src(nir_alu_src *src, uint8_t swizzle[4], bool *negate, bool 
 *abs)
  {
 @@ -66,6 +101,12 @@ get_mul_for_src(nir_alu_src *src, uint8_t swizzle[4], 
 bool *negate, bool *abs)
break;

 case nir_op_fmul:
 +  /* Only absorbe a fmul into a ffma if the fmul is is only used in fadd
 +   * operations.  This prevents us from being too agressive with our
 +   * fusing which can actually lead to more instructions.
 +   */
 +  if (!are_all_uses_fadd(alu-dest.dest.ssa))
 + return NULL;
break;

 default:
 --
 2.3.3

 ___
 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 v4 15/17] main: Added entry point for glGetNamedRenderbufferParameteriv

2015-03-24 Thread Laura Ekstrand
This looks good.

Reviewed-by: Laura Ekstrand la...@jlekstrand.net

On Tue, Mar 24, 2015 at 7:42 AM, Martin Peres martin.pe...@linux.intel.com
wrote:

 v2:
 - improve an error message

 Reviewed-by: Laura Ekstrand la...@jlekstrand.net

 v3:
 - move a test to less generic functions
 - fix an alignment

 v4:
 - take the caller as a parameter instead of bool dsa
 - check that the lookup returns a valid renderbuffer

 Signed-off-by: Martin Peres martin.pe...@linux.intel.com
 ---
  src/mapi/glapi/gen/ARB_direct_state_access.xml |  6 +++
  src/mesa/main/fbobject.c   | 63
 ++
  src/mesa/main/fbobject.h   |  4 ++
  src/mesa/main/tests/dispatch_sanity.cpp|  1 +
  4 files changed, 56 insertions(+), 18 deletions(-)

 diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml
 b/src/mapi/glapi/gen/ARB_direct_state_access.xml
 index 976dcc8..d4e1f7c 100644
 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
 +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
 @@ -159,6 +159,12 @@
param name=renderbuffers type=GLuint * /
 /function

 +   function name=GetNamedRenderbufferParameteriv offset=assign
 +  param name=renderbuffer type=GLuint /
 +  param name=pname type=GLenum /
 +  param name=params type=GLint * /
 +   /function
 +
 !-- Texture object functions --

 function name=CreateTextures offset=assign
 diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
 index 8083bc1..377f915 100644
 --- a/src/mesa/main/fbobject.c
 +++ b/src/mesa/main/fbobject.c
 @@ -1993,25 +1993,11 @@ _es_RenderbufferStorageEXT(GLenum target, GLenum
 internalFormat,
  }


 -void GLAPIENTRY
 -_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint
 *params)
 +static void
 +get_render_buffer_parameteriv(struct gl_context *ctx,
 +  struct gl_renderbuffer *rb, GLenum pname,
 +  GLint *params, const char *func)
  {
 -   struct gl_renderbuffer *rb;
 -   GET_CURRENT_CONTEXT(ctx);
 -
 -   if (target != GL_RENDERBUFFER_EXT) {
 -  _mesa_error(ctx, GL_INVALID_ENUM,
 -  glGetRenderbufferParameterivEXT(target));
 -  return;
 -   }
 -
 -   rb = ctx-CurrentRenderbuffer;
 -   if (!rb) {
 -  _mesa_error(ctx, GL_INVALID_OPERATION,
 -  glGetRenderbufferParameterivEXT);
 -  return;
 -   }
 -
 /* No need to flush here since we're just quering state which is
  * not effected by rendering.
  */
 @@ -2042,10 +2028,51 @@ _mesa_GetRenderbufferParameteriv(GLenum target,
 GLenum pname, GLint *params)
}
/* fallthrough */
 default:
 +  _mesa_error(ctx, GL_INVALID_ENUM, %s(invalid pname=%s), func,
 +  _mesa_lookup_enum_by_nr(pname));
 +  return;
 +   }
 +}
 +
 +
 +void GLAPIENTRY
 +_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint
 *params)
 +{
 +   GET_CURRENT_CONTEXT(ctx);
 +
 +   if (target != GL_RENDERBUFFER_EXT) {
_mesa_error(ctx, GL_INVALID_ENUM,
glGetRenderbufferParameterivEXT(target));
return;
 }
 +
 +   if (!ctx-CurrentRenderbuffer) {
 +  _mesa_error(ctx, GL_INVALID_OPERATION,
 glGetRenderbufferParameterivEXT
 +  (no renderbuffer bound));
 +  return;
 +   }
 +
 +   get_render_buffer_parameteriv(ctx, ctx-CurrentRenderbuffer, pname,
 + params, glGetRenderbufferParameteriv);
 +}
 +
 +
 +void GLAPIENTRY
 +_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
 +  GLint *params)
 +{
 +   GET_CURRENT_CONTEXT(ctx);
 +
 +   struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx,
 renderbuffer);
 +   if (!rb || rb == DummyRenderbuffer) {
 +  /* ID was reserved, but no real renderbuffer object made yet */
 +  _mesa_error(ctx, GL_INVALID_OPERATION,
 glGetNamedRenderbufferParameteriv
 +  (invalid renderbuffer %i), renderbuffer);
 +  return;
 +   }
 +
 +   get_render_buffer_parameteriv(ctx, rb, pname, params,
 + glGetNamedRenderbufferParameteriv);
  }


 diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
 index 9ab6b0b..b92149b 100644
 --- a/src/mesa/main/fbobject.h
 +++ b/src/mesa/main/fbobject.h
 @@ -137,6 +137,10 @@ extern void GLAPIENTRY
  _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname,
  GLint *params);

 +void GLAPIENTRY
 +_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
 +  GLint *params);
 +
  extern GLboolean GLAPIENTRY
  _mesa_IsFramebuffer(GLuint framebuffer);

 diff --git a/src/mesa/main/tests/dispatch_sanity.cpp
 b/src/mesa/main/tests/dispatch_sanity.cpp
 index 5383865..bb573d4 100644
 --- a/src/mesa/main/tests/dispatch_sanity.cpp
 +++ b/src/mesa/main/tests/dispatch_sanity.cpp
 @@ -944,6 +944,7 @@ const struct function 

Re: [Mesa-dev] [PATCH 2/6] nir: Implement a Mesa IR - NIR translator.

2015-03-24 Thread Kenneth Graunke
On Tuesday, March 24, 2015 08:52:01 PM Emil Velikov wrote:
 Hi Ken,
 
 On 24/03/15 00:37, Kenneth Graunke wrote:
  Shamelessly ripped off from Eric Anholt's tgsi_to_nir pass.
  
  Not compiled on SCons, like the rest of NIR.
  
  Signed-off-by: Kenneth Graunke kenn...@whitecape.org
  ---
   src/mesa/Makefile.am|2 +
   src/mesa/Makefile.sources   |5 +
   src/mesa/program/prog_instruction.h |2 +
   src/mesa/program/prog_to_nir.c  | 1189 
+++
   src/mesa/program/prog_to_nir.h  |   37 ++
   5 files changed, 1235 insertions(+)
   create mode 100644 src/mesa/program/prog_to_nir.c
   create mode 100644 src/mesa/program/prog_to_nir.h
  
  diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
  index 3dab8f0..60114e4 100644
  --- a/src/mesa/Makefile.am
  +++ b/src/mesa/Makefile.am
  @@ -174,6 +174,7 @@ endif
   libmesa_la_SOURCES = \
  $(MESA_FILES) \
  $(PROGRAM_FILES) \
  +   $(PROGRAM_NIR_FILES) \
  $(MESA_ASM_FILES_FOR_ARCH)
   
   libmesa_la_LIBADD = \
  @@ -183,6 +184,7 @@ libmesa_la_LIBADD = \
   libmesagallium_la_SOURCES = \
  $(MESA_GALLIUM_FILES) \
  $(PROGRAM_FILES) \
  +   $(PROGRAM_NIR_FILES) \
  $(MESA_ASM_FILES_FOR_ARCH)
   
   libmesagallium_la_LIBADD = \
  diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
  index 217be9a..cc166ce 100644
  --- a/src/mesa/Makefile.sources
  +++ b/src/mesa/Makefile.sources
  @@ -520,6 +520,10 @@ PROGRAM_FILES = \
  program/symbol_table.c \
  program/symbol_table.h
   
  +PROGRAM_NIR_FILES = \
  +   program/prog_to_nir.c \
  +   program/prog_to_nir.h
  +
   ASM_C_FILES =  \
  x86/common_x86.c \
  x86/x86_xform.c \
  @@ -608,6 +612,7 @@ INCLUDE_DIRS = \
  -I$(top_srcdir)/src \
  -I$(top_srcdir)/src/glsl \
  -I$(top_builddir)/src/glsl \
  +   -I$(top_builddir)/src/glsl/nir \
 Hi Ken,
 
 Thanks for handling all the build cruft :)
 
 Noticed that you mentioned some build issues - was it locally or with
 jenkins ? I've just pushed a series has some related patches. If you're
 still seeing those can you open a bug report and/or post the build log
 somewhere.
 
 Cheers,
 Emil

It seems to be working fine now - I figured it out :)

prog_to_nir.c includes nir.h, which contains #include nir_opcodes.h.
nir_opcodes.h is autogenerated, so it lives in $(top_builddir)/src/glsl/nir.
I normally do in-tree builds, so it worked fine for me, but broke on
Jenkins (which is doing out-of-tree builds).  Ilia reminded me how to do
out of tree builds and then the solution was easy - add the -I line
above.

Thanks!


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 7/9] nir/peephole_ffma: Be less agressive about fusing multiply-adds

2015-03-24 Thread Jason Ekstrand
First off, these are all heuristics and we need to keep that in mind.

On Tue, Mar 24, 2015 at 3:39 PM, Connor Abbott cwabbo...@gmail.com wrote:
 I think this is being both too aggressive and not aggressive enough.
 First, the too aggressive part. Imagine if we have something like:

 a = mul b, c;
 d = add a, 1.0;
 e = add a, 2.0;
 f = add a, 3.0;

 In this case, we don't want to turn this into a series of 3 mad's
 since the 3 load immediate instructions are going to hurt us more than
 the elimination of the mul. When the only thing using the mul is a
 bunch of add's, it's only profitable when there's at most one distinct
 immediate that isn't used by other MAD's -- any more and we gain
 instructions.

Yes and no.  Thanks to Matt's constant-combine stuff, if the constants
are used elsewhere we can consider them to be pretty-much free.  Also,
once we get VF constants working, things will get even more free.
It's never going to be 100% free but we are probably ok fusing them.
Of course, since there's only one mul, maybe not.  Heursistics!

 Also, I think that we might still want to fuse the multiply and the
 add even if the mul is used somewhere else, since at least it gives
 the scheduler some extra freedom to hide latency -- as long as we
 don't have to emit any load immediate instructions. Of course, this is
 all very backend-specific so at this point it would make sense to move
 this to an i965 pass and leave in the general ffma peephole for
 everyone else without these weird restrictions.

Yes, there are times where we probably want to fuse anyway.  Again,
it's not 100% clear when that is, and this is certainly better than we
were doing before.
--Jason

 On Mon, Mar 23, 2015 at 11:13 PM, Jason Ekstrand ja...@jlekstrand.net wrote:
 shader-db results for fragment shaders on Haswell:
 total instructions in shared programs: 4395688 - 4389623 (-0.14%)
 instructions in affected programs: 355876 - 349811 (-1.70%)
 helped:1455
 HURT:  14
 GAINED:5
 LOST:  0
 ---
  src/glsl/nir/nir_opt_peephole_ffma.c | 41 
 
  1 file changed, 41 insertions(+)

 diff --git a/src/glsl/nir/nir_opt_peephole_ffma.c 
 b/src/glsl/nir/nir_opt_peephole_ffma.c
 index 4674505..b875bb6 100644
 --- a/src/glsl/nir/nir_opt_peephole_ffma.c
 +++ b/src/glsl/nir/nir_opt_peephole_ffma.c
 @@ -38,6 +38,41 @@ struct peephole_ffma_state {
 bool progress;
  };

 +static inline bool
 +are_all_uses_fadd(nir_ssa_def *def)
 +{
 +   if (def-if_uses-entries  0)
 +  return false;
 +
 +   struct set_entry *use_iter;
 +   set_foreach(def-uses, use_iter) {
 +  nir_instr *use_instr = (nir_instr *)use_iter-key;
 +
 +  if (use_instr-type != nir_instr_type_alu)
 + return false;
 +
 +  nir_alu_instr *use_alu = nir_instr_as_alu(use_instr);
 +  switch (use_alu-op) {
 +  case nir_op_fadd:
 + break; /* This one's ok */
 +
 +  case nir_op_imov:
 +  case nir_op_fmov:
 +  case nir_op_fneg:
 +  case nir_op_fabs:
 + assert(use_alu-dest.dest.is_ssa);
 + if (!are_all_uses_fadd(use_alu-dest.dest.ssa))
 +return false;
 + break;
 +
 +  default:
 + return false;
 +  }
 +   }
 +
 +   return true;
 +}
 +
  static inline nir_alu_instr *
  get_mul_for_src(nir_alu_src *src, uint8_t swizzle[4], bool *negate, bool 
 *abs)
  {
 @@ -66,6 +101,12 @@ get_mul_for_src(nir_alu_src *src, uint8_t swizzle[4], 
 bool *negate, bool *abs)
break;

 case nir_op_fmul:
 +  /* Only absorbe a fmul into a ffma if the fmul is is only used in fadd
 +   * operations.  This prevents us from being too agressive with our
 +   * fusing which can actually lead to more instructions.
 +   */
 +  if (!are_all_uses_fadd(alu-dest.dest.ssa))
 + return NULL;
break;

 default:
 --
 2.3.3

 ___
 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/6] i965/fs: Implement nir_opcode_fsub/isub support.

2015-03-24 Thread Connor Abbott
We already have a lower_negate compiler option, so I think it would be
better to add the 1 line of code to lower sub - neg predicated on
!lower_neg to nir_opt_algebraic.

On Mon, Mar 23, 2015 at 8:37 PM, Kenneth Graunke kenn...@whitecape.org wrote:
 prog_to_nir uses this for OPCODE_SUB.

 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 6 ++
  1 file changed, 6 insertions(+)

 diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 index 69f296c..094303f 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 @@ -905,6 +905,12 @@ fs_visitor::nir_emit_alu(nir_alu_instr *instr)
inst-saturate = instr-dest.saturate;
break;

 +   case nir_op_fsub:
 +   case nir_op_isub:
 +  inst = emit(ADD(result, op[0], negate(op[1])));
 +  inst-saturate = instr-dest.saturate;
 +  break;
 +
 case nir_op_fmul:
inst = emit(MUL(result, op[0], op[1]));
inst-saturate = instr-dest.saturate;
 --
 2.3.3

 ___
 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 v4 16/17] main: Added entry points for NamedRenderbufferStorage/Multisample

2015-03-24 Thread Laura Ekstrand
Looks good to me.

Reviewed-by: Laura Ekstrand la...@jlekstrand.net

On Tue, Mar 24, 2015 at 7:43 AM, Martin Peres martin.pe...@linux.intel.com
wrote:

 v2: Review from Laura Ekstrand
 - get rid of a change that should not have happened in this patch
 - improve the error messages
 - fix alignments
 - fix a capitalization in a function name in an error message

 v3: Review from Laura Ekstrand
 - move the test for the validity of the renderbuffer to less generic
   functions
 - get rid of some changes that accidentally landed in the wrong commit
 - revert some alignment fixes

 v3: Review from Laura Ekstrand
 - check that the lookup returns a valid renderbuffer
 - cosmetic changes to some error messages

 Signed-off-by: Martin Peres martin.pe...@linux.intel.com
 ---
  src/mapi/glapi/gen/ARB_direct_state_access.xml |  15 +++
  src/mesa/main/fbobject.c   | 157
 ++---
  src/mesa/main/fbobject.h   |   9 ++
  src/mesa/main/tests/dispatch_sanity.cpp|   2 +
  4 files changed, 142 insertions(+), 41 deletions(-)

 diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml
 b/src/mapi/glapi/gen/ARB_direct_state_access.xml
 index d4e1f7c..8a092d6 100644
 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
 +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
 @@ -159,6 +159,21 @@
param name=renderbuffers type=GLuint * /
 /function

 +   function name=NamedRenderbufferStorage offset=assign
 +  param name=renderbuffer type=GLuint /
 +  param name=internalformat type=GLenum /
 +  param name=width type=GLsizei /
 +  param name=height type=GLsizei /
 +   /function
 +
 +   function name=NamedRenderbufferStorageMultisample offset=assign
 +  param name=renderbuffer type=GLuint /
 +  param name=samples type=GLsizei /
 +  param name=internalformat type=GLenum /
 +  param name=width type=GLsizei /
 +  param name=height type=GLsizei /
 +   /function
 +
 function name=GetNamedRenderbufferParameteriv offset=assign
param name=renderbuffer type=GLuint /
param name=pname type=GLenum /
 diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
 index 377f915..072e1a8 100644
 --- a/src/mesa/main/fbobject.c
 +++ b/src/mesa/main/fbobject.c
 @@ -1785,40 +1785,17 @@ invalidate_rb(GLuint key, void *data, void
 *userData)


  /**
 - * Helper function used by _mesa_RenderbufferStorage() and
 - * _mesa_RenderbufferStorageMultisample().
 - * samples will be NO_SAMPLES if called by _mesa_RenderbufferStorage().
 + * Helper function used by renderbuffer_storage_direct() and
 + * renderbuffer_storage_target().
 + * samples will be NO_SAMPLES if called by a non-multisample function.
   */
  static void
 -renderbuffer_storage(GLenum target, GLenum internalFormat,
 - GLsizei width, GLsizei height, GLsizei samples)
 +renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
 + GLenum internalFormat, GLsizei width,
 + GLsizei height, GLsizei samples, const char *func)
  {
 -   const char *func = samples == NO_SAMPLES ?
 -  glRenderbufferStorage : glRenderbufferStorageMultisample;
 -   struct gl_renderbuffer *rb;
 GLenum baseFormat;
 GLenum sample_count_error;
 -   GET_CURRENT_CONTEXT(ctx);
 -
 -   if (MESA_VERBOSE  VERBOSE_API) {
 -  if (samples == NO_SAMPLES)
 - _mesa_debug(ctx, %s(%s, %s, %d, %d)\n,
 - func,
 - _mesa_lookup_enum_by_nr(target),
 - _mesa_lookup_enum_by_nr(internalFormat),
 - width, height);
 -  else
 - _mesa_debug(ctx, %s(%s, %s, %d, %d, %d)\n,
 - func,
 - _mesa_lookup_enum_by_nr(target),
 - _mesa_lookup_enum_by_nr(internalFormat),
 - width, height, samples);
 -   }
 -
 -   if (target != GL_RENDERBUFFER_EXT) {
 -  _mesa_error(ctx, GL_INVALID_ENUM, %s(target), func);
 -  return;
 -   }

 baseFormat = _mesa_base_fbo_format(ctx, internalFormat);
 if (baseFormat == 0) {
 @@ -1828,12 +1805,14 @@ renderbuffer_storage(GLenum target, GLenum
 internalFormat,
 }

 if (width  0 || width  (GLsizei) ctx-Const.MaxRenderbufferSize) {
 -  _mesa_error(ctx, GL_INVALID_VALUE, %s(width), func);
 +  _mesa_error(ctx, GL_INVALID_VALUE, %s(invalid width %d), func,
 +  width);
return;
 }

 if (height  0 || height  (GLsizei) ctx-Const.MaxRenderbufferSize) {
 -  _mesa_error(ctx, GL_INVALID_VALUE, %s(height), func);
 +  _mesa_error(ctx, GL_INVALID_VALUE, %s(invalid height %d), func,
 +  height);
return;
 }

 @@ -1845,7 +1824,7 @@ renderbuffer_storage(GLenum target, GLenum
 internalFormat,
/* check the sample count;
 * note: driver may choose to use more samples than what's requested
 */
 -  sample_count_error = 

Re: [Mesa-dev] [PATCH 8/8] util/u_atomic: Ignore warnings interlocked accesses.

2015-03-24 Thread Brian Paul

On 03/24/2015 03:16 PM, Jose Fonseca wrote:

These are due how we implemented the atomic tests, not the atomic
implementation itself.  It's also difficult to refactor the code to
avoid the warnings due to the use of macros -- the code would be quite
hairy.
---
  src/util/u_atomic_test.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/src/util/u_atomic_test.c b/src/util/u_atomic_test.c
index 939cfe4..7844f61 100644
--- a/src/util/u_atomic_test.c
+++ b/src/util/u_atomic_test.c
@@ -36,6 +36,11 @@

  #include u_atomic.h

+#ifdef _MSC_VER
+#pragma warning( disable : 28112 ) /* Accessing a local variable via an 
Interlocked function */
+#pragma warning( disable : 28113 ) /* A variable which is accessed via an 
Interlocked function must always be accessed via an Interlocked function */
+#endif
+

  /* Test only assignment-like operations, which are supported on all types */
  #define test_atomic_assign(type, ones) \



Series looks OK to me.
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 v4 16/17] main: Added entry points for NamedRenderbufferStorage/Multisample

2015-03-24 Thread Martin Peres
v2: Review from Laura Ekstrand
- get rid of a change that should not have happened in this patch
- improve the error messages
- fix alignments
- fix a capitalization in a function name in an error message

v3: Review from Laura Ekstrand
- move the test for the validity of the renderbuffer to less generic
  functions
- get rid of some changes that accidentally landed in the wrong commit
- revert some alignment fixes

v3: Review from Laura Ekstrand
- check that the lookup returns a valid renderbuffer
- cosmetic changes to some error messages

Signed-off-by: Martin Peres martin.pe...@linux.intel.com
---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  15 +++
 src/mesa/main/fbobject.c   | 157 ++---
 src/mesa/main/fbobject.h   |   9 ++
 src/mesa/main/tests/dispatch_sanity.cpp|   2 +
 4 files changed, 142 insertions(+), 41 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml 
b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index d4e1f7c..8a092d6 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -159,6 +159,21 @@
   param name=renderbuffers type=GLuint * /
/function
 
+   function name=NamedRenderbufferStorage offset=assign
+  param name=renderbuffer type=GLuint /
+  param name=internalformat type=GLenum /
+  param name=width type=GLsizei /
+  param name=height type=GLsizei /
+   /function
+
+   function name=NamedRenderbufferStorageMultisample offset=assign
+  param name=renderbuffer type=GLuint /
+  param name=samples type=GLsizei /
+  param name=internalformat type=GLenum /
+  param name=width type=GLsizei /
+  param name=height type=GLsizei /
+   /function
+
function name=GetNamedRenderbufferParameteriv offset=assign
   param name=renderbuffer type=GLuint /
   param name=pname type=GLenum /
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 377f915..072e1a8 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1785,40 +1785,17 @@ invalidate_rb(GLuint key, void *data, void *userData)
 
 
 /**
- * Helper function used by _mesa_RenderbufferStorage() and
- * _mesa_RenderbufferStorageMultisample().
- * samples will be NO_SAMPLES if called by _mesa_RenderbufferStorage().
+ * Helper function used by renderbuffer_storage_direct() and
+ * renderbuffer_storage_target().
+ * samples will be NO_SAMPLES if called by a non-multisample function.
  */
 static void
-renderbuffer_storage(GLenum target, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei samples)
+renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei samples, const char *func)
 {
-   const char *func = samples == NO_SAMPLES ?
-  glRenderbufferStorage : glRenderbufferStorageMultisample;
-   struct gl_renderbuffer *rb;
GLenum baseFormat;
GLenum sample_count_error;
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE  VERBOSE_API) {
-  if (samples == NO_SAMPLES)
- _mesa_debug(ctx, %s(%s, %s, %d, %d)\n,
- func,
- _mesa_lookup_enum_by_nr(target),
- _mesa_lookup_enum_by_nr(internalFormat),
- width, height);
-  else
- _mesa_debug(ctx, %s(%s, %s, %d, %d, %d)\n,
- func,
- _mesa_lookup_enum_by_nr(target),
- _mesa_lookup_enum_by_nr(internalFormat),
- width, height, samples);
-   }
-
-   if (target != GL_RENDERBUFFER_EXT) {
-  _mesa_error(ctx, GL_INVALID_ENUM, %s(target), func);
-  return;
-   }
 
baseFormat = _mesa_base_fbo_format(ctx, internalFormat);
if (baseFormat == 0) {
@@ -1828,12 +1805,14 @@ renderbuffer_storage(GLenum target, GLenum 
internalFormat,
}
 
if (width  0 || width  (GLsizei) ctx-Const.MaxRenderbufferSize) {
-  _mesa_error(ctx, GL_INVALID_VALUE, %s(width), func);
+  _mesa_error(ctx, GL_INVALID_VALUE, %s(invalid width %d), func,
+  width);
   return;
}
 
if (height  0 || height  (GLsizei) ctx-Const.MaxRenderbufferSize) {
-  _mesa_error(ctx, GL_INVALID_VALUE, %s(height), func);
+  _mesa_error(ctx, GL_INVALID_VALUE, %s(invalid height %d), func,
+  height);
   return;
}
 
@@ -1845,7 +1824,7 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
   /* check the sample count;
* note: driver may choose to use more samples than what's requested
*/
-  sample_count_error = _mesa_check_sample_count(ctx, target,
+  sample_count_error = _mesa_check_sample_count(ctx, GL_RENDERBUFFER,
 internalFormat, samples);
   if (sample_count_error != GL_NO_ERROR) {
  _mesa_error(ctx, sample_count_error, %s(samples), func);
@@ -1853,12 

[Mesa-dev] [Bug 89726] [Bisected] dEQP-GLES3: uniform linking logic in the presence of structs

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

Ilia Mirkin imir...@alum.mit.edu changed:

   What|Removed |Added

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

--- Comment #6 from Ilia Mirkin imir...@alum.mit.edu ---
Pushed as baa22c8825133a69fd0657f09d2a027236233eb1 upstream. Sorry for the
breakage!

-- 
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 7/9] nir/peephole_ffma: Be less agressive about fusing multiply-adds

2015-03-24 Thread Matt Turner
On Tue, Mar 24, 2015 at 3:39 PM, Connor Abbott cwabbo...@gmail.com wrote:
 I think this is being both too aggressive and not aggressive enough.
 First, the too aggressive part. Imagine if we have something like:

 a = mul b, c;
 d = add a, 1.0;
 e = add a, 2.0;
 f = add a, 3.0;

 In this case, we don't want to turn this into a series of 3 mad's
 since the 3 load immediate instructions are going to hurt us more than
 the elimination of the mul. When the only thing using the mul is a
 bunch of add's, it's only profitable when there's at most one distinct
 immediate that isn't used by other MAD's -- any more and we gain
 instructions.

I think most importantly, we want to match the current try_emit_mad()
behavior (and just do it better) and make incremental progress from
there.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 89754] vertexAttrib fails WebGL Conformance test with mesa drivers

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

Bug ID: 89754
   Summary: vertexAttrib fails WebGL Conformance test with mesa
drivers
   Product: Mesa
   Version: unspecified
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: lukebe...@hotmail.com
QA Contact: mesa-dev@lists.freedesktop.org

Steps to reproduce:
1. Using an Mesa driver (nouveau or radeon) visit 
https://www.khronos.org/registry/webgl/conformance-suites/1.0.2/conformance/attribs/gl-vertex-attrib-render.html
2. Using a proprietary driver visit
https://www.khronos.org/registry/webgl/conformance-suites/1.0.2/conformance/attribs/gl-vertex-attrib-render.html

Expected results:
Both sets of drivers pass

Actual results:
With both Firefox and Chrome, only the proprietary drivers pass.

-- 
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


[Mesa-dev] Building Mesa for Windows using Visual Studio

2015-03-24 Thread Shervin Sharifi
Hi,
 I'm new to Mesa.
 I'm trying to build Mesa for Windows using Visual Studio, but couldn't
find instructions for that. The related threads on this mailing list also
seem outdated.
 Could anyone give me some hint or point me to instructions if there is
any?

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


[Mesa-dev] [PATCH] mesa: Apply visibility flags to src/Makefile.am targets

2015-03-24 Thread Kristian Høgsberg
From: Kristian Høgsberg k...@bitplanet.net

We were building libglsl_util.la without our visibility flags and
leaking hash_table_* symbols.

Signed-off-by: Kristian Høgsberg kristian.h.kristen...@intel.com
---
 src/Makefile.am | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/Makefile.am b/src/Makefile.am
index 8edf333..874a333 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,6 +55,9 @@ endif
 
 EXTRA_DIST = egl/docs getopt hgl SConscript
 
+AM_CFLAGS = $(VISIBILITY_CFLAGS)
+AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
+
 AM_CPPFLAGS = \
-I$(top_srcdir)/include/ \
-I$(top_srcdir)/src/mapi/ \
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH 2/6] nir: Implement a Mesa IR - NIR translator.

2015-03-24 Thread Eric Anholt
Kenneth Graunke kenn...@whitecape.org writes:

 Shamelessly ripped off from Eric Anholt's tgsi_to_nir pass.

 Not compiled on SCons, like the rest of NIR.

 Signed-off-by: Kenneth Graunke kenn...@whitecape.org

Nice.  I think at some point we'll want a lowering pass for texture
projection.  The recommendation to do fsub in algebraic instead of i965
sounded good.  The use of nir variables here also looks way less
unpleasant than my first interaction with them was, so I may take a look
at it again for my pass.

This patch is:

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

Possible improvement: ptn_imm_f()/d() could get a scalar value instead of a
vector.  I found that this was a win (now that nir_builder can handle
scalars mixed with vectors reasonably).  Similarly, ttn_channel()
returning a scalar helped.


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] mesa: Apply visibility flags to src/Makefile.am targets

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


[Mesa-dev] [Bug 89754] vertexAttrib fails WebGL Conformance test with mesa drivers

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

--- Comment #1 from Tapani Pälli lem...@gmail.com ---
test passes on i965 driver

-- 
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


[Mesa-dev] [PATCH] i965/fs: Allow CSE to handle MULs with negated arguments.

2015-03-24 Thread Matt Turner
mul x, -y is equivalent to mul -x, y; and mul x, y is the negation of
mul x, -y.

Without NIR:
total instructions in shared programs: 6192304 - 6185280 (-0.11%)
instructions in affected programs: 987931 - 980907 (-0.71%)
helped:4146
HURT:  16
GAINED:16
LOST:  0

NIR:
total instructions in shared programs: 6207173 - 6200379 (-0.11%)
instructions in affected programs: 988070 - 981276 (-0.69%)
helped:4104
HURT:  16
GAINED:18
LOST:  4
---
 src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 42 
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index ca5b32f..f2c4098 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -109,7 +109,7 @@ is_expression(const fs_inst *const inst)
 }
 
 static bool
-operands_match(const fs_inst *a, const fs_inst *b)
+operands_match(const fs_inst *a, const fs_inst *b, bool *negate)
 {
fs_reg *xs = a-src;
fs_reg *ys = b-src;
@@ -118,6 +118,35 @@ operands_match(const fs_inst *a, const fs_inst *b)
   return xs[0].equals(ys[0]) 
  ((xs[1].equals(ys[1])  xs[2].equals(ys[2])) ||
   (xs[2].equals(ys[1])  xs[1].equals(ys[2])));
+   } else if (a-opcode == BRW_OPCODE_MUL  a-dst.type == 
BRW_REGISTER_TYPE_F) {
+  bool xs0_negate = xs[0].negate;
+  bool xs1_negate = xs[1].file == IMM ? xs[1].fixed_hw_reg.dw1.f  0.0f
+  : xs[1].negate;
+  bool ys0_negate = ys[0].negate;
+  bool ys1_negate = ys[1].file == IMM ? ys[1].fixed_hw_reg.dw1.f  0.0f
+  : ys[1].negate;
+  float xs1_imm = xs[1].fixed_hw_reg.dw1.f;
+  float ys1_imm = ys[1].fixed_hw_reg.dw1.f;
+
+  xs[0].negate = false;
+  xs[1].negate = false;
+  ys[0].negate = false;
+  ys[1].negate = false;
+  xs[1].fixed_hw_reg.dw1.f = fabsf(xs[1].fixed_hw_reg.dw1.f);
+  ys[1].fixed_hw_reg.dw1.f = fabsf(ys[1].fixed_hw_reg.dw1.f);
+
+  bool ret = (xs[0].equals(ys[0])  xs[1].equals(ys[1])) ||
+ (xs[1].equals(ys[0])  xs[0].equals(ys[1]));
+
+  xs[0].negate = xs0_negate;
+  xs[1].negate = xs[1].file == IMM ? false : xs1_negate;
+  ys[0].negate = ys0_negate;
+  ys[1].negate = ys[1].file == IMM ? false : ys1_negate;
+  xs[1].fixed_hw_reg.dw1.f = xs1_imm;
+  ys[1].fixed_hw_reg.dw1.f = ys1_imm;
+
+  *negate = (xs0_negate + xs1_negate) != (ys0_negate + ys1_negate);
+  return ret;
} else if (!a-is_commutative()) {
   bool match = true;
   for (int i = 0; i  a-sources; i++) {
@@ -134,7 +163,7 @@ operands_match(const fs_inst *a, const fs_inst *b)
 }
 
 static bool
-instructions_match(fs_inst *a, fs_inst *b)
+instructions_match(fs_inst *a, fs_inst *b, bool *negate)
 {
return a-opcode == b-opcode 
   a-saturate == b-saturate 
@@ -151,7 +180,7 @@ instructions_match(fs_inst *a, fs_inst *b)
   a-header_present == b-header_present 
   a-shadow_compare == b-shadow_compare)
: true) 
-  operands_match(a, b);
+  operands_match(a, b, negate);
 }
 
 bool
@@ -169,11 +198,12 @@ fs_visitor::opt_cse_local(bblock_t *block)
   (inst-dst.file != HW_REG || inst-dst.is_null()))
   {
  bool found = false;
+ bool negate = false;
 
  foreach_in_list_use_after(aeb_entry, entry, aeb) {
 /* Match current instruction's expression against those in AEB. */
 if (!(entry-generator-dst.is_null()  !inst-dst.is_null()) 
-instructions_match(inst, entry-generator)) {
+instructions_match(inst, entry-generator, negate)) {
found = true;
progress = true;
break;
@@ -239,6 +269,7 @@ fs_visitor::opt_cse_local(bblock_t *block)
} else {
   copy = MOV(dst, tmp);
   copy-force_writemask_all = inst-force_writemask_all;
+  copy-src[0].negate = negate;
}
inst-insert_before(block, copy);
 }
@@ -259,9 +290,10 @@ fs_visitor::opt_cse_local(bblock_t *block)
   * the flag register if we just wrote it.
   */
  if (inst-writes_flag()) {
+bool negate; /* dummy */
 if (entry-generator-reads_flag() ||
 (entry-generator-writes_flag() 
- !instructions_match(inst, entry-generator))) {
+ !instructions_match(inst, entry-generator, negate))) {
entry-remove();
ralloc_free(entry);
continue;
-- 
2.0.5

Re: [Mesa-dev] [PATCH v3 15/17] main: Added entry point for glGetNamedRenderbufferParameteriv

2015-03-24 Thread Martin Peres

On 24/03/15 00:12, Laura Ekstrand wrote:



On Mon, Mar 23, 2015 at 12:04 PM, Martin Peres 
martin.pe...@linux.intel.com mailto:martin.pe...@linux.intel.com 
wrote:


v2:
- improve an error message

Reviewed-by: Laura Ekstrand la...@jlekstrand.net
mailto:la...@jlekstrand.net

v3:
- move a test to less generic functions
- fix an alignment

Signed-off-by: Martin Peres martin.pe...@linux.intel.com
mailto:martin.pe...@linux.intel.com
---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  6 +++
 src/mesa/main/fbobject.c   | 63
+++---
 src/mesa/main/fbobject.h  |  4 ++
 src/mesa/main/tests/dispatch_sanity.cpp|  1 +
 4 files changed, 57 insertions(+), 17 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml
b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 976dcc8..d4e1f7c 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -159,6 +159,12 @@
   param name=renderbuffers type=GLuint * /
/function

+   function name=GetNamedRenderbufferParameteriv offset=assign
+  param name=renderbuffer type=GLuint /
+  param name=pname type=GLenum /
+  param name=params type=GLint * /
+   /function
+
!-- Texture object functions --

function name=CreateTextures offset=assign
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 8083bc1..ee4ad1f 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1993,24 +1993,13 @@ _es_RenderbufferStorageEXT(GLenum target,
GLenum internalFormat,
 }


-void GLAPIENTRY
-_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname,
GLint *params)
+static void
+get_render_buffer_parameteriv(struct gl_context *ctx,
+  struct gl_renderbuffer *rb, GLenum
pname,
+  GLint *params, bool dsa)
 {
-   struct gl_renderbuffer *rb;
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (target != GL_RENDERBUFFER_EXT) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
- glGetRenderbufferParameterivEXT(target));
-  return;
-   }
-
-   rb = ctx-CurrentRenderbuffer;
-   if (!rb) {
-  _mesa_error(ctx, GL_INVALID_OPERATION,
-  glGetRenderbufferParameterivEXT);
-  return;
-   }

I think passing in a const char *caller would be better than a bool 
dsa, since the only thing you are using dsa for is determining the 
name of the calling function.


Agreed. I used func as a name to stay consistent with the rest of my code.


+   const char *func = dsa ? glGetNamedRenderbufferParameteriv :
+ glGetRenderbufferParameteriv;

/* No need to flush here since we're just quering state which is
 * not effected by rendering.
@@ -2042,10 +2031,50 @@ _mesa_GetRenderbufferParameteriv(GLenum
target, GLenum pname, GLint *params)
   }
   /* fallthrough */
default:
+  _mesa_error(ctx, GL_INVALID_ENUM, %s(invalid pname=%s), func,
+  _mesa_lookup_enum_by_nr(pname));
+  return;
+   }
+}
+
+
+void GLAPIENTRY
+_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname,
GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (target != GL_RENDERBUFFER_EXT) {
   _mesa_error(ctx, GL_INVALID_ENUM,
 glGetRenderbufferParameterivEXT(target));
   return;
}
+
+   if (!ctx-CurrentRenderbuffer) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
glGetRenderbufferParameterivEXT
+  (no renderbuffer bound));
+  return;
+   }
+
+   get_render_buffer_parameteriv(ctx, ctx-CurrentRenderbuffer,
pname,
+ params, false);
+}
+
+
+void GLAPIENTRY
+_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum
pname,
+  GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx,
renderbuffer);

You need to check if !rb here, too, in case you get rb = NULL.


Done, this is indeed necessary after this small re-factoring.


+   if (rb == DummyRenderbuffer) {
+  /* ID was reserved, but no real renderbuffer object made yet */
+  _mesa_error(ctx, GL_INVALID_OPERATION,
glGetNamedRenderbufferParameteriv
+  (invalid renderbuffer %i), renderbuffer);
+  return;
+   }
+
+   get_render_buffer_parameteriv(ctx, rb, pname, params, true);
 }


diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 9ab6b0b..b92149b 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h

Re: [Mesa-dev] [PATCH v3 16/17] main: Added entry points for NamedRenderbufferStorage/Multisample

2015-03-24 Thread Martin Peres

On 24/03/15 00:37, Laura Ekstrand wrote:



On Mon, Mar 23, 2015 at 12:14 PM, Martin Peres 
martin.pe...@linux.intel.com mailto:martin.pe...@linux.intel.com 
wrote:


v2: Review from Laura Ekstrand
- get rid of a change that should not have happened in this patch
- improve the error messages
- fix alignments
- fix a capitalization in a function name in an error message

v3: Review from Laura Ekstrand
- move the test for the validity of the renderbuffer to less generic
  functions
- get rid of some changes that accidentally landed in the wrong commit
- revert some alignment fixes

Signed-off-by: Martin Peres martin.pe...@linux.intel.com
mailto:martin.pe...@linux.intel.com
---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  15 +++
 src/mesa/main/fbobject.c   | 157
++---
 src/mesa/main/fbobject.h   |   9 ++
 src/mesa/main/tests/dispatch_sanity.cpp|   2 +
 4 files changed, 142 insertions(+), 41 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml
b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index d4e1f7c..8a092d6 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -159,6 +159,21 @@
   param name=renderbuffers type=GLuint * /
/function

+   function name=NamedRenderbufferStorage offset=assign
+  param name=renderbuffer type=GLuint /
+  param name=internalformat type=GLenum /
+  param name=width type=GLsizei /
+  param name=height type=GLsizei /
+   /function
+
+   function name=NamedRenderbufferStorageMultisample
offset=assign
+  param name=renderbuffer type=GLuint /
+  param name=samples type=GLsizei /
+  param name=internalformat type=GLenum /
+  param name=width type=GLsizei /
+  param name=height type=GLsizei /
+   /function
+
function name=GetNamedRenderbufferParameteriv offset=assign
   param name=renderbuffer type=GLuint /
   param name=pname type=GLenum /
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ee4ad1f..d688195 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1785,40 +1785,17 @@ invalidate_rb(GLuint key, void *data, void
*userData)


 /**
- * Helper function used by _mesa_RenderbufferStorage() and
- * _mesa_RenderbufferStorageMultisample().
- * samples will be NO_SAMPLES if called by
_mesa_RenderbufferStorage().
+ * Helper function used by renderbuffer_storage_direct() and
+ * renderbuffer_storage_target().
+ * samples will be NO_SAMPLES if called by a non-multisample
function.
  */
 static void
-renderbuffer_storage(GLenum target, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei samples)
+renderbuffer_storage(struct gl_context *ctx, struct
gl_renderbuffer *rb,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei samples, const char
*func)
 {
-   const char *func = samples == NO_SAMPLES ?
-  glRenderbufferStorage : glRenderbufferStorageMultisample;
-   struct gl_renderbuffer *rb;
GLenum baseFormat;
GLenum sample_count_error;
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE  VERBOSE_API) {
-  if (samples == NO_SAMPLES)
- _mesa_debug(ctx, %s(%s, %s, %d, %d)\n,
- func,
- _mesa_lookup_enum_by_nr(target),
-  _mesa_lookup_enum_by_nr(internalFormat),
- width, height);
-  else
- _mesa_debug(ctx, %s(%s, %s, %d, %d, %d)\n,
- func,
- _mesa_lookup_enum_by_nr(target),
-  _mesa_lookup_enum_by_nr(internalFormat),
- width, height, samples);
-   }
-
-   if (target != GL_RENDERBUFFER_EXT) {
-  _mesa_error(ctx, GL_INVALID_ENUM, %s(target), func);
-  return;
-   }

baseFormat = _mesa_base_fbo_format(ctx, internalFormat);
if (baseFormat == 0) {
@@ -1828,12 +1805,14 @@ renderbuffer_storage(GLenum target, GLenum
internalFormat,
}

if (width  0 || width  (GLsizei)
ctx-Const.MaxRenderbufferSize) {
-  _mesa_error(ctx, GL_INVALID_VALUE, %s(width), func);
+  _mesa_error(ctx, GL_INVALID_VALUE, %s(invalid width %d),
func,
+  width);
   return;
}

if (height  0 || height  (GLsizei)
ctx-Const.MaxRenderbufferSize) {
-  _mesa_error(ctx, GL_INVALID_VALUE, %s(height), func);
+  _mesa_error(ctx, GL_INVALID_VALUE, %s(invalid height %d),
func,
+  height);
   return;
}

@@ 

[Mesa-dev] [PATCH 18.2/23] glsl: Implement remaining as_foo functions with macros

2015-03-24 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

The downcast functions for non-leaf classes were previously implemented
by hand.  Now they are implemented using macros based on the is_foo
functions added in the previous patch.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Cc: Francisco Jerez curroje...@riseup.net
---
 src/glsl/ir.h | 40 +---
 1 file changed, 9 insertions(+), 31 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index b2b4822..ff30263 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -142,39 +142,17 @@ public:
 * Additional downcast functions will be added as needed.
 */
/*@{*/
-   class ir_rvalue *as_rvalue()
-   {
-  assume(this != NULL);
-  if (ir_type == ir_type_dereference_array ||
-  ir_type == ir_type_dereference_record ||
-  ir_type == ir_type_dereference_variable ||
-  ir_type == ir_type_constant ||
-  ir_type == ir_type_expression ||
-  ir_type == ir_type_swizzle ||
-  ir_type == ir_type_texture)
- return (class ir_rvalue *) this;
-  return NULL;
-   }
-
-   class ir_dereference *as_dereference()
-   {
-  assume(this != NULL);
-  if (ir_type == ir_type_dereference_array ||
-  ir_type == ir_type_dereference_record ||
-  ir_type == ir_type_dereference_variable)
- return (class ir_dereference *) this;
-  return NULL;
+   #define AS_BASE(TYPE)\
+   class ir_##TYPE *as_##TYPE() \
+   {\
+  assume(this != NULL); \
+  return (is_##TYPE()) ? (ir_##TYPE *) this : NULL; \
}
 
-   class ir_jump *as_jump()
-   {
-  assume(this != NULL);
-  if (ir_type == ir_type_loop_jump ||
-  ir_type == ir_type_return ||
-  ir_type == ir_type_discard)
- return (class ir_jump *) this;
-  return NULL;
-   }
+   AS_BASE(rvalue)
+   AS_BASE(dereference)
+   AS_BASE(jump)
+   #undef AS_BASE
 
#define AS_CHILD(TYPE) \
class ir_##TYPE * as_##TYPE() \
-- 
2.1.0

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


[Mesa-dev] [PATCH 18.3/23] glsl: Constify the as_foo functions

2015-03-24 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Now that they're all implemented using macros, this is trivial.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Cc: Francisco Jerez curroje...@riseup.net
---
 src/glsl/ir.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index ff30263..7294629 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -147,6 +147,11 @@ public:
{\
   assume(this != NULL); \
   return (is_##TYPE()) ? (ir_##TYPE *) this : NULL; \
+   }\
+   const class ir_##TYPE *as_##TYPE() const \
+   {\
+  assume(this != NULL); \
+  return (is_##TYPE()) ? (ir_##TYPE *) this : NULL; \
}
 
AS_BASE(rvalue)
@@ -159,6 +164,11 @@ public:
{ \
   assume(this != NULL); \
   return ir_type == ir_type_##TYPE ? (ir_##TYPE *) this : NULL; \
+   }  \
+   const class ir_##TYPE * as_##TYPE() const  \
+   {  \
+  assume(this != NULL);   \
+  return ir_type == ir_type_##TYPE ? (const ir_##TYPE *) this : NULL; \
}
AS_CHILD(variable)
AS_CHILD(function)
-- 
2.1.0

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


[Mesa-dev] [PATCH 18.4/23] glsl: Constify ir_instruction::equals

2015-03-24 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

v2: Don't be lazy.  Constify the as_foo functions and use those instead
of ugly casts.  Suggested by Curro.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Cc: Francisco Jerez curroje...@riseup.net
---
 src/glsl/ir.h  | 21 ++---
 src/glsl/ir_equals.cpp | 20 
 2 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 7294629..a318be4 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -196,7 +196,8 @@ public:
 * in particular.  No support for other instruction types (assignments,
 * jumps, calls, etc.) is planned.
 */
-   virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = 
ir_type_unset);
+   virtual bool equals(const ir_instruction *ir,
+   enum ir_node_type ignore = ir_type_unset) const;
 
 protected:
ir_instruction(enum ir_node_type t)
@@ -1611,7 +1612,8 @@ public:
 */
ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1, ir_rvalue *op2);
 
-   virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = 
ir_type_unset);
+   virtual bool equals(const ir_instruction *ir,
+   enum ir_node_type ignore = ir_type_unset) const;
 
virtual ir_expression *clone(void *mem_ctx, struct hash_table *ht) const;
 
@@ -1922,7 +1924,8 @@ public:
 
virtual ir_visitor_status accept(ir_hierarchical_visitor *);
 
-   virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = 
ir_type_unset);
+   virtual bool equals(const ir_instruction *ir,
+   enum ir_node_type ignore = ir_type_unset) const;
 
/**
 * Return a string representing the ir_texture_opcode.
@@ -2023,7 +2026,8 @@ public:
 
virtual ir_visitor_status accept(ir_hierarchical_visitor *);
 
-   virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = 
ir_type_unset);
+   virtual bool equals(const ir_instruction *ir,
+   enum ir_node_type ignore = ir_type_unset) const;
 
bool is_lvalue() const
{
@@ -2076,7 +2080,8 @@ public:
 
virtual ir_constant *constant_expression_value(struct hash_table 
*variable_context = NULL);
 
-   virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = 
ir_type_unset);
+   virtual bool equals(const ir_instruction *ir,
+   enum ir_node_type ignore = ir_type_unset) const;
 
/**
 * Get the variable that is ultimately referenced by an r-value
@@ -2122,7 +2127,8 @@ public:
 
virtual ir_constant *constant_expression_value(struct hash_table 
*variable_context = NULL);
 
-   virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = 
ir_type_unset);
+   virtual bool equals(const ir_instruction *ir,
+   enum ir_node_type ignore = ir_type_unset) const;
 
/**
 * Get the variable that is ultimately referenced by an r-value
@@ -2232,7 +2238,8 @@ public:
 
virtual ir_visitor_status accept(ir_hierarchical_visitor *);
 
-   virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = 
ir_type_unset);
+   virtual bool equals(const ir_instruction *ir,
+   enum ir_node_type ignore = ir_type_unset) const;
 
/**
 * Get a particular component of a constant as a specific type
diff --git a/src/glsl/ir_equals.cpp b/src/glsl/ir_equals.cpp
index 65376cd..cc1964e 100644
--- a/src/glsl/ir_equals.cpp
+++ b/src/glsl/ir_equals.cpp
@@ -28,7 +28,8 @@
  * can't access a's vtable in that case.
  */
 static bool
-possibly_null_equals(ir_instruction *a, ir_instruction *b, enum ir_node_type 
ignore)
+possibly_null_equals(const ir_instruction *a, const ir_instruction *b,
+ enum ir_node_type ignore)
 {
if (!a || !b)
   return !a  !b;
@@ -41,13 +42,13 @@ possibly_null_equals(ir_instruction *a, ir_instruction *b, 
enum ir_node_type ign
  * about.
  */
 bool
-ir_instruction::equals(ir_instruction *, enum ir_node_type)
+ir_instruction::equals(const ir_instruction *, enum ir_node_type) const
 {
return false;
 }
 
 bool
-ir_constant::equals(ir_instruction *ir, enum ir_node_type)
+ir_constant::equals(const ir_instruction *ir, enum ir_node_type) const
 {
const ir_constant *other = ir-as_constant();
if (!other)
@@ -65,7 +66,8 @@ ir_constant::equals(ir_instruction *ir, enum ir_node_type)
 }
 
 bool
-ir_dereference_variable::equals(ir_instruction *ir, enum ir_node_type)
+ir_dereference_variable::equals(const ir_instruction *ir,
+enum ir_node_type) const
 {
const ir_dereference_variable *other = ir-as_dereference_variable();
if (!other)
@@ -75,7 +77,8 @@ ir_dereference_variable::equals(ir_instruction *ir, enum 
ir_node_type)
 }
 
 bool
-ir_dereference_array::equals(ir_instruction *ir, enum ir_node_type ignore)
+ir_dereference_array::equals(const ir_instruction *ir,
+ enum ir_node_type ignore) const
 {
const ir_dereference_array *other = ir-as_dereference_array();
   

[Mesa-dev] [PATCH 18.1/23] glsl: Add is_rvalue, is_dereference, and is_jump methods

2015-03-24 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

These functions deteremine when an IR node is one of the non-leaf
classes.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Cc: Francisco Jerez curroje...@riseup.net
---
 src/glsl/ir.h | 25 +
 1 file changed, 25 insertions(+)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index fdc22ed..b2b4822 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -109,6 +109,31 @@ public:
virtual ir_instruction *clone(void *mem_ctx,
 struct hash_table *ht) const = 0;
 
+   bool is_rvalue() const
+   {
+  return ir_type == ir_type_dereference_array ||
+ ir_type == ir_type_dereference_record ||
+ ir_type == ir_type_dereference_variable ||
+ ir_type == ir_type_constant ||
+ ir_type == ir_type_expression ||
+ ir_type == ir_type_swizzle ||
+ ir_type == ir_type_texture;
+   }
+
+   bool is_dereference() const
+   {
+  return ir_type == ir_type_dereference_array ||
+ ir_type == ir_type_dereference_record ||
+ ir_type == ir_type_dereference_variable;
+   }
+
+   bool is_jump() const
+   {
+  return ir_type == ir_type_loop_jump ||
+ ir_type == ir_type_return ||
+ ir_type == ir_type_discard;
+   }
+
/**
 * \name IR instruction downcast functions
 *
-- 
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/3] mesa: Improve validation of target, format and type of glTexSubImage[2, 3]D

2015-03-24 Thread Eduardo Lima Mitev
Thanks for the review! Please see some comments inline:

On 03/23/2015 06:53 PM, Laura Ekstrand wrote:
 I'm glad you found this target checking problem.  I have come across the
 same problem in other texture functions, but I have been too busy to
 find all instances of this.  It's kind of a natural, negative byproduct
 of adding DSA.
 
 [..]
 
 I recommend getting rid of the legal_texsubimage_target check in
 texsubimage_error_check and moving it up into texturesubimage, right
 after the texObj has been retrieved. Otherwise in the texsubimage case,
 the target will get checked twice, once in texsubimage and once in
 texsubimage-error-check.  In general, checking hurts driver performance,
 so we should aim to get rid of redundancies.
  
 

Yes, will do that.

 
 This is not related to target checking and should be moved to a separate
 commit (with a name like gles 3 support for texsubimage_error_check).


Ok, makes sense.


 I would also move this block up to about line 2508 so it can sit next to
 the other format and type checks there.  It would be nice to have all of
 the format_and_type_checks formatted into one if, else if, else block so
 it's really obvious what's going on, too.
 
 +   if (_mesa_is_gles3(ctx)) {
 +  /* Validation of format and type for ES3 has to be done here
 +   * after the texture image is resolved, because the internal
 +   * format is needed for the verification
 +   */
 +  err = _mesa_es3_error_check_format_and_type(ctx, format, type,
 + 
 texImage-InternalFormat);
 +  if (err != GL_NO_ERROR) {
 + _mesa_error(ctx, err,
 + %s(incompatible format = %s, type = %s, 
 + internalformat = %s),
 + callerName, _mesa_lookup_enum_by_nr(format),
 + _mesa_lookup_enum_by_nr(type),
 +   
  _mesa_lookup_enum_by_nr(texImage-InternalFormat));
 + return GL_TRUE;
 +  }
 +   }
 +

Note that this error check has to be performed after the texture image
is resolved, because the internal format is not known before.

If we want to merge it with the above format and type error checks, the
only choice is to move all down after:

texImage = _mesa_select_tex_image(texObj, target, level);

But then we have a chicken-egg situation, since that function requires
target to be validated before.

WDYT?

cheers,
Eduardo

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


Re: [Mesa-dev] [PATCH] r600g/sb: Enable SB for geometry shaders

2015-03-24 Thread Dieter Nützel

Am 20.03.2015 14:13, schrieb Glenn Kennard:

Add SV_GEOMETRY_EMIT special variable type to track the
implicit dependencies between CUT/EMIT_VERTEX/MEM_RING
instructions so GCM/scheduler doesn't reorder them.

Mark emit instructions as unkillable so DCE doesn't eat them.

Signed-off-by: Glenn Kennard glenn.kenn...@gmail.com
---
The hangs with SB on geometry shaders were all due to the CUT/EMIT
instructions either being DCE:d or emitted out of order from the
memory ring writes, so the hardware stalled forever waiting for
completed primitives.

Tested only on a Turks so far, but should behave the same across
all R600 generations.


Hello Glenn,

what tests are preferred?
Starting with a Turks XT here, too and could do some tests on RV730 
(AGP) then.


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


Re: [Mesa-dev] [PATCH 2/2] clover: Add support for handling reqd_work_group_size attribute

2015-03-24 Thread Francisco Jerez
Tom Stellard thomas.stell...@amd.com writes:

 This patch enables clover to return the correct value for
 CL_KERNEL_COMPILE_WORK_GROUP_SIZE and also verify that the correct
 local_work_size is used when enqueuing kernels with this attribute.

I doubt it makes sense to pass these around as kernel arguments.
module::arguments represents a formal parameter of the kernel that is
determined at run-time and uploaded to the GPU via the input buffer,
reqd_work_group_size OTOH is a compile-time constant.  Is there any
reason why you want these to be part of the kernel input?  If not, this
should probably be a separate vector of integers part of module::symbol.

 ---
  src/gallium/state_trackers/clover/api/kernel.cpp   |  9 +++-
  src/gallium/state_trackers/clover/core/kernel.cpp  | 31 +-
  src/gallium/state_trackers/clover/core/kernel.hpp  |  2 +-
  src/gallium/state_trackers/clover/core/module.cpp  |  1 +
  src/gallium/state_trackers/clover/core/module.hpp  | 12 --
  .../state_trackers/clover/llvm/invocation.cpp  | 48 
 ++
  6 files changed, 95 insertions(+), 8 deletions(-)

 diff --git a/src/gallium/state_trackers/clover/api/kernel.cpp 
 b/src/gallium/state_trackers/clover/api/kernel.cpp
 index 05cc392..8d8694c 100644
 --- a/src/gallium/state_trackers/clover/api/kernel.cpp
 +++ b/src/gallium/state_trackers/clover/api/kernel.cpp
 @@ -24,6 +24,8 @@
  #include core/kernel.hpp
  #include core/event.hpp
  
 +#include functional
 +
  using namespace clover;
  
  CLOVER_API cl_kernel
 @@ -161,7 +163,7 @@ clGetKernelWorkGroupInfo(cl_kernel d_kern, cl_device_id 
 d_dev,
break;
  
 case CL_KERNEL_COMPILE_WORK_GROUP_SIZE:
 -  buf.as_vectorsize_t() = kern.required_block_size();
 +  buf.as_vectorsize_t() = kern.required_block_size(dev);
break;
  
 case CL_KERNEL_LOCAL_MEM_SIZE:
 @@ -242,12 +244,15 @@ namespace {
  
if (d_block_size) {
   auto block_size = range(d_block_size, dims);
 + auto reqd_block_size = kern.required_block_size(q.device());
  
   if (any_of(is_zero(), block_size) ||
   any_of(greater(), block_size, q.device().max_block_size()))
  throw error(CL_INVALID_WORK_ITEM_SIZE);
  
 - if (any_of(modulus(), grid_size, block_size))
 + if (any_of(modulus(), grid_size, block_size) ||
 + (fold(multiplies(), 1u, reqd_block_size) 
 + any_of(std::not_equal_tosize_t(), block_size, 
 reqd_block_size)))
  throw error(CL_INVALID_WORK_GROUP_SIZE);
  
   if (fold(multiplies(), 1u, block_size) 
 diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp 
 b/src/gallium/state_trackers/clover/core/kernel.cpp
 index 442762c..f788812 100644
 --- a/src/gallium/state_trackers/clover/core/kernel.cpp
 +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
 @@ -120,8 +120,27 @@ kernel::optimal_block_size(const command_queue q,
  }
  
  std::vectorsize_t
 -kernel::required_block_size() const {
 -   return { 0, 0, 0 };
 +kernel::required_block_size(const device dev) const {
 +   std::vectorsize_t block_size(3);
 +
 +   const clover::module m = program().binary(dev);
 +   auto margs = find(name_equals(name()), m.syms).args;
 +
 +   for (auto marg : margs) {
 +  switch (marg.semantic) {
 +  default: break;
 +  case module::argument::reqd_work_group_size_x:
 + block_size[0] = marg.value;
 + break;
 +  case module::argument::reqd_work_group_size_y:
 + block_size[1] = marg.value;
 + break;
 +  case module::argument::reqd_work_group_size_z:
 + block_size[2] = marg.value;
 + break;
 +  }
 +   }
 +   return block_size;
  }
  
  kernel::argument_range
 @@ -182,6 +201,14 @@ kernel::exec_context::bind(intrusive_ptrcommand_queue 
 _q,
   }
   break;
}
 +  case module::argument::reqd_work_group_size_x:
 +  case module::argument::reqd_work_group_size_y:
 +  case module::argument::reqd_work_group_size_z: {
 +auto arg = argument::create(marg);
 +arg-set(sizeof(cl_uint), marg.value);
 +arg-bind(*this, marg);
 +break;
 +  }
}
 }
  
 diff --git a/src/gallium/state_trackers/clover/core/kernel.hpp 
 b/src/gallium/state_trackers/clover/core/kernel.hpp
 index d6432a4..4bef5b8 100644
 --- a/src/gallium/state_trackers/clover/core/kernel.hpp
 +++ b/src/gallium/state_trackers/clover/core/kernel.hpp
 @@ -130,7 +130,7 @@ namespace clover {
optimal_block_size(const command_queue q,
   const std::vectorsize_t grid_size) const;
std::vectorsize_t
 -  required_block_size() const;
 +  required_block_size(const device dev) const;
  
argument_range args();
const_argument_range args() const;
 diff --git a/src/gallium/state_trackers/clover/core/module.cpp 
 b/src/gallium/state_trackers/clover/core/module.cpp
 index be10e35..fbd5dba 100644
 --- 

[Mesa-dev] [PATCH 2/2] clover: Add support for handling reqd_work_group_size attribute

2015-03-24 Thread Tom Stellard
This patch enables clover to return the correct value for
CL_KERNEL_COMPILE_WORK_GROUP_SIZE and also verify that the correct
local_work_size is used when enqueuing kernels with this attribute.
---
 src/gallium/state_trackers/clover/api/kernel.cpp   |  9 +++-
 src/gallium/state_trackers/clover/core/kernel.cpp  | 31 +-
 src/gallium/state_trackers/clover/core/kernel.hpp  |  2 +-
 src/gallium/state_trackers/clover/core/module.cpp  |  1 +
 src/gallium/state_trackers/clover/core/module.hpp  | 12 --
 .../state_trackers/clover/llvm/invocation.cpp  | 48 ++
 6 files changed, 95 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/kernel.cpp 
b/src/gallium/state_trackers/clover/api/kernel.cpp
index 05cc392..8d8694c 100644
--- a/src/gallium/state_trackers/clover/api/kernel.cpp
+++ b/src/gallium/state_trackers/clover/api/kernel.cpp
@@ -24,6 +24,8 @@
 #include core/kernel.hpp
 #include core/event.hpp
 
+#include functional
+
 using namespace clover;
 
 CLOVER_API cl_kernel
@@ -161,7 +163,7 @@ clGetKernelWorkGroupInfo(cl_kernel d_kern, cl_device_id 
d_dev,
   break;
 
case CL_KERNEL_COMPILE_WORK_GROUP_SIZE:
-  buf.as_vectorsize_t() = kern.required_block_size();
+  buf.as_vectorsize_t() = kern.required_block_size(dev);
   break;
 
case CL_KERNEL_LOCAL_MEM_SIZE:
@@ -242,12 +244,15 @@ namespace {
 
   if (d_block_size) {
  auto block_size = range(d_block_size, dims);
+ auto reqd_block_size = kern.required_block_size(q.device());
 
  if (any_of(is_zero(), block_size) ||
  any_of(greater(), block_size, q.device().max_block_size()))
 throw error(CL_INVALID_WORK_ITEM_SIZE);
 
- if (any_of(modulus(), grid_size, block_size))
+ if (any_of(modulus(), grid_size, block_size) ||
+ (fold(multiplies(), 1u, reqd_block_size) 
+ any_of(std::not_equal_tosize_t(), block_size, reqd_block_size)))
 throw error(CL_INVALID_WORK_GROUP_SIZE);
 
  if (fold(multiplies(), 1u, block_size) 
diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp 
b/src/gallium/state_trackers/clover/core/kernel.cpp
index 442762c..f788812 100644
--- a/src/gallium/state_trackers/clover/core/kernel.cpp
+++ b/src/gallium/state_trackers/clover/core/kernel.cpp
@@ -120,8 +120,27 @@ kernel::optimal_block_size(const command_queue q,
 }
 
 std::vectorsize_t
-kernel::required_block_size() const {
-   return { 0, 0, 0 };
+kernel::required_block_size(const device dev) const {
+   std::vectorsize_t block_size(3);
+
+   const clover::module m = program().binary(dev);
+   auto margs = find(name_equals(name()), m.syms).args;
+
+   for (auto marg : margs) {
+  switch (marg.semantic) {
+  default: break;
+  case module::argument::reqd_work_group_size_x:
+ block_size[0] = marg.value;
+ break;
+  case module::argument::reqd_work_group_size_y:
+ block_size[1] = marg.value;
+ break;
+  case module::argument::reqd_work_group_size_z:
+ block_size[2] = marg.value;
+ break;
+  }
+   }
+   return block_size;
 }
 
 kernel::argument_range
@@ -182,6 +201,14 @@ kernel::exec_context::bind(intrusive_ptrcommand_queue _q,
  }
  break;
   }
+  case module::argument::reqd_work_group_size_x:
+  case module::argument::reqd_work_group_size_y:
+  case module::argument::reqd_work_group_size_z: {
+auto arg = argument::create(marg);
+arg-set(sizeof(cl_uint), marg.value);
+arg-bind(*this, marg);
+break;
+  }
   }
}
 
diff --git a/src/gallium/state_trackers/clover/core/kernel.hpp 
b/src/gallium/state_trackers/clover/core/kernel.hpp
index d6432a4..4bef5b8 100644
--- a/src/gallium/state_trackers/clover/core/kernel.hpp
+++ b/src/gallium/state_trackers/clover/core/kernel.hpp
@@ -130,7 +130,7 @@ namespace clover {
   optimal_block_size(const command_queue q,
  const std::vectorsize_t grid_size) const;
   std::vectorsize_t
-  required_block_size() const;
+  required_block_size(const device dev) const;
 
   argument_range args();
   const_argument_range args() const;
diff --git a/src/gallium/state_trackers/clover/core/module.cpp 
b/src/gallium/state_trackers/clover/core/module.cpp
index be10e35..fbd5dba 100644
--- a/src/gallium/state_trackers/clover/core/module.cpp
+++ b/src/gallium/state_trackers/clover/core/module.cpp
@@ -158,6 +158,7 @@ namespace {
  _proc(s, x.target_align);
  _proc(s, x.ext_type);
  _proc(s, x.semantic);
+ _proc(s, x.value);
   }
};
 
diff --git a/src/gallium/state_trackers/clover/core/module.hpp 
b/src/gallium/state_trackers/clover/core/module.hpp
index ee6caf9..866e53f 100644
--- a/src/gallium/state_trackers/clover/core/module.hpp
+++ b/src/gallium/state_trackers/clover/core/module.hpp
@@ -71,16 +71,21 @@ namespace clover {
  enum semantic {
   

[Mesa-dev] [PATCH 1/2] clover: Use a structure to hold information about llvm kernel functions

2015-03-24 Thread Tom Stellard
---
 .../state_trackers/clover/llvm/invocation.cpp  | 71 +-
 1 file changed, 41 insertions(+), 30 deletions(-)

diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index 4da62b9..28198a5 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -127,6 +127,16 @@ namespace {
   return module::deserialize(cs);
}
 #endif
+
+   struct llvm_kernel {
+
+  llvm_kernel() : fn(NULL), offset(0) {
+  }
+
+  llvm::Function *fn;
+  size_t offset;
+   };
+
void debug_log(const std::string msg, const std::string suffix) {
   const char *dbg_file = debug_get_option(CLOVER_DEBUG_FILE, stderr);
   if (!strcmp(stderr, dbg_file)) {
@@ -277,7 +287,7 @@ namespace {
}
 
void
-   find_kernels(llvm::Module *mod, std::vectorllvm::Function * kernels) {
+   find_kernels(llvm::Module *mod, std::vectorllvm_kernel kernels) {
   const llvm::NamedMDNode *kernel_node =
  mod-getNamedMetadata(opencl.kernels);
   // This means there are no kernels in the program.  The spec does not
@@ -288,18 +298,20 @@ namespace {
   }
 
   for (unsigned i = 0; i  kernel_node-getNumOperands(); ++i) {
+ kernels.resize(i + 1);
+ llvm_kernel kernel = kernels[i];
 #if HAVE_LLVM = 0x0306
- kernels.push_back(llvm::mdconst::dyn_extractllvm::Function(
+ kernel.fn = llvm::mdconst::dyn_extractllvm::Function(
 #else
- kernels.push_back(llvm::dyn_castllvm::Function(
+ kernel.fn = llvm::dyn_castllvm::Function(
 #endif
-
kernel_node-getOperand(i)-getOperand(0)));
+kernel_node-getOperand(i)-getOperand(0));
   }
}
 
void
optimize(llvm::Module *mod, unsigned optimization_level,
-const std::vectorllvm::Function * kernels) {
+const std::vectorllvm_kernel kernels) {
 
 #if HAVE_LLVM = 0x0307
   llvm::legacy::PassManager PM;
@@ -322,10 +334,10 @@ namespace {
   // treat the functions in the list as main functions and internalize
   // all of the other functions.
   std::vectorconst char* export_list;
-  for (std::vectorllvm::Function *::const_iterator I = kernels.begin(),
+  for (std::vectorllvm_kernel::const_iterator I = kernels.begin(),
  E = kernels.end();
  I != E; ++I) {
- llvm::Function *kernel = *I;
+ llvm::Function *kernel = (*I).fn;
  export_list.push_back(kernel-getName().data());
   }
 #if HAVE_LLVM  0x0305
@@ -350,11 +362,11 @@ namespace {
}
 
compat::vectormodule::argument
-   get_kernel_args(const llvm::Module *mod, const std::string kernel_name,
+   get_kernel_args(const llvm::Module *mod, const llvm_kernel kernel,
const clang::LangAS::Map address_spaces) {
 
   compat::vectormodule::argument args;
-  llvm::Function *kernel_func = mod-getFunction(kernel_name);
+  llvm::Function *kernel_func = kernel.fn;
 
 #if HAVE_LLVM  0x0305
  llvm::DataLayout TD(kernel_func-getParent()-getDataLayout());
@@ -448,7 +460,7 @@ namespace {
 
module
build_module_llvm(llvm::Module *mod,
- const std::vectorllvm::Function * kernels,
+ const std::vectorllvm_kernel kernels,
  clang::LangAS::Map address_spaces) {
 
   module m;
@@ -461,9 +473,10 @@ namespace {
   bitcode_ostream.flush();
 
   for (unsigned i = 0; i  kernels.size(); ++i) {
- std::string kernel_name = kernels[i]-getName();
+ const llvm_kernel kernel = kernels[i];
  compat::vectormodule::argument args =
-   get_kernel_args(mod, kernel_name, address_spaces);
+   get_kernel_args(mod, kernel, address_spaces);
+ std::string kernel_name = kernel.fn-getName().str();
 
  m.syms.push_back(module::symbol(kernel_name, 0, i, args ));
   }
@@ -555,9 +568,9 @@ namespace {
   return code;
}
 
-   std::mapstd::string, unsigned
-   get_kernel_offsets(std::vectorchar code,
-  const std::vectorllvm::Function * kernels,
+   void
+   set_kernel_offsets(std::vectorchar code,
+  std::vectorllvm_kernel kernels,
   compat::string r_log) {
 
   // One of the libelf implementations
@@ -602,32 +615,29 @@ namespace {
   GElf_Sym *symbol;
   GElf_Sym s;
 
-  std::mapstd::string, unsigned kernel_offsets;
   symtab_data = elf_getdata(symtab, symtab_data);
 
   // Determine the offsets for each kernel
   for (int i = 0; (symbol = gelf_getsym(symtab_data, i, s)); i++) {
  char *name = elf_strptr(elf, symtab_header.sh_link, symbol-st_name);
- for 

Re: [Mesa-dev] [PATCH 1/2] clover: Use a structure to hold information about llvm kernel functions

2015-03-24 Thread Francisco Jerez
Tom Stellard thomas.stell...@amd.com writes:

 ---
  .../state_trackers/clover/llvm/invocation.cpp  | 71 
 +-
  1 file changed, 41 insertions(+), 30 deletions(-)


This seems kind of ugly to me, what are you trying to achieve exactly?

 diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
 b/src/gallium/state_trackers/clover/llvm/invocation.cpp
 index 4da62b9..28198a5 100644
 --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
 +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
 @@ -127,6 +127,16 @@ namespace {
return module::deserialize(cs);
 }
  #endif
 +
 +   struct llvm_kernel {
 +
 +  llvm_kernel() : fn(NULL), offset(0) {
 +  }
 +
 +  llvm::Function *fn;
 +  size_t offset;
 +   };
 +
 void debug_log(const std::string msg, const std::string suffix) {
const char *dbg_file = debug_get_option(CLOVER_DEBUG_FILE, stderr);
if (!strcmp(stderr, dbg_file)) {
 @@ -277,7 +287,7 @@ namespace {
 }
  
 void
 -   find_kernels(llvm::Module *mod, std::vectorllvm::Function * kernels) {
 +   find_kernels(llvm::Module *mod, std::vectorllvm_kernel kernels) {
const llvm::NamedMDNode *kernel_node =
   mod-getNamedMetadata(opencl.kernels);
// This means there are no kernels in the program.  The spec does not
 @@ -288,18 +298,20 @@ namespace {
}
  
for (unsigned i = 0; i  kernel_node-getNumOperands(); ++i) {
 + kernels.resize(i + 1);
 + llvm_kernel kernel = kernels[i];
  #if HAVE_LLVM = 0x0306
 - kernels.push_back(llvm::mdconst::dyn_extractllvm::Function(
 + kernel.fn = llvm::mdconst::dyn_extractllvm::Function(
  #else
 - kernels.push_back(llvm::dyn_castllvm::Function(
 + kernel.fn = llvm::dyn_castllvm::Function(
  #endif
 -
 kernel_node-getOperand(i)-getOperand(0)));
 +
 kernel_node-getOperand(i)-getOperand(0));
}
 }
  
 void
 optimize(llvm::Module *mod, unsigned optimization_level,
 -const std::vectorllvm::Function * kernels) {
 +const std::vectorllvm_kernel kernels) {
  
  #if HAVE_LLVM = 0x0307
llvm::legacy::PassManager PM;
 @@ -322,10 +334,10 @@ namespace {
// treat the functions in the list as main functions and internalize
// all of the other functions.
std::vectorconst char* export_list;
 -  for (std::vectorllvm::Function *::const_iterator I = kernels.begin(),
 +  for (std::vectorllvm_kernel::const_iterator I = kernels.begin(),
   E = kernels.end();
   I != E; ++I) {
 - llvm::Function *kernel = *I;
 + llvm::Function *kernel = (*I).fn;
   export_list.push_back(kernel-getName().data());
}
  #if HAVE_LLVM  0x0305
 @@ -350,11 +362,11 @@ namespace {
 }
  
 compat::vectormodule::argument
 -   get_kernel_args(const llvm::Module *mod, const std::string kernel_name,
 +   get_kernel_args(const llvm::Module *mod, const llvm_kernel kernel,
 const clang::LangAS::Map address_spaces) {
  
compat::vectormodule::argument args;
 -  llvm::Function *kernel_func = mod-getFunction(kernel_name);
 +  llvm::Function *kernel_func = kernel.fn;
  
  #if HAVE_LLVM  0x0305
   llvm::DataLayout TD(kernel_func-getParent()-getDataLayout());
 @@ -448,7 +460,7 @@ namespace {
  
 module
 build_module_llvm(llvm::Module *mod,
 - const std::vectorllvm::Function * kernels,
 + const std::vectorllvm_kernel kernels,
   clang::LangAS::Map address_spaces) {
  
module m;
 @@ -461,9 +473,10 @@ namespace {
bitcode_ostream.flush();
  
for (unsigned i = 0; i  kernels.size(); ++i) {
 - std::string kernel_name = kernels[i]-getName();
 + const llvm_kernel kernel = kernels[i];
   compat::vectormodule::argument args =
 -   get_kernel_args(mod, kernel_name, address_spaces);
 +   get_kernel_args(mod, kernel, address_spaces);
 + std::string kernel_name = kernel.fn-getName().str();
  
   m.syms.push_back(module::symbol(kernel_name, 0, i, args ));
}
 @@ -555,9 +568,9 @@ namespace {
return code;
 }
  
 -   std::mapstd::string, unsigned
 -   get_kernel_offsets(std::vectorchar code,
 -  const std::vectorllvm::Function * kernels,
 +   void
 +   set_kernel_offsets(std::vectorchar code,
 +  std::vectorllvm_kernel kernels,
compat::string r_log) {
  
// One of the libelf implementations
 @@ -602,32 +615,29 @@ namespace {
GElf_Sym *symbol;
GElf_Sym s;
  
 -  std::mapstd::string, unsigned kernel_offsets;
symtab_data = elf_getdata(symtab, symtab_data);
 

Re: [Mesa-dev] [PATCH 1/2] clover: Use a structure to hold information about llvm kernel functions

2015-03-24 Thread Tom Stellard
On Tue, Mar 24, 2015 at 06:51:31PM +0200, Francisco Jerez wrote:
 Tom Stellard thomas.stell...@amd.com writes:
 
  ---
   .../state_trackers/clover/llvm/invocation.cpp  | 71 
  +-
   1 file changed, 41 insertions(+), 30 deletions(-)
 
 
 This seems kind of ugly to me, what are you trying to achieve exactly?
 

This made a little more sense with my previous attempt at handling the
reqd_work_group_size attribute.  I think I may be able to re-work this so
the struct is no longer necessary.

-Tom

  diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
  b/src/gallium/state_trackers/clover/llvm/invocation.cpp
  index 4da62b9..28198a5 100644
  --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
  +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
  @@ -127,6 +127,16 @@ namespace {
 return module::deserialize(cs);
  }
   #endif
  +
  +   struct llvm_kernel {
  +
  +  llvm_kernel() : fn(NULL), offset(0) {
  +  }
  +
  +  llvm::Function *fn;
  +  size_t offset;
  +   };
  +
  void debug_log(const std::string msg, const std::string suffix) {
 const char *dbg_file = debug_get_option(CLOVER_DEBUG_FILE, 
  stderr);
 if (!strcmp(stderr, dbg_file)) {
  @@ -277,7 +287,7 @@ namespace {
  }
   
  void
  -   find_kernels(llvm::Module *mod, std::vectorllvm::Function * kernels) 
  {
  +   find_kernels(llvm::Module *mod, std::vectorllvm_kernel kernels) {
 const llvm::NamedMDNode *kernel_node =
mod-getNamedMetadata(opencl.kernels);
 // This means there are no kernels in the program.  The spec does not
  @@ -288,18 +298,20 @@ namespace {
 }
   
 for (unsigned i = 0; i  kernel_node-getNumOperands(); ++i) {
  + kernels.resize(i + 1);
  + llvm_kernel kernel = kernels[i];
   #if HAVE_LLVM = 0x0306
  - kernels.push_back(llvm::mdconst::dyn_extractllvm::Function(
  + kernel.fn = llvm::mdconst::dyn_extractllvm::Function(
   #else
  - kernels.push_back(llvm::dyn_castllvm::Function(
  + kernel.fn = llvm::dyn_castllvm::Function(
   #endif
  -
  kernel_node-getOperand(i)-getOperand(0)));
  +
  kernel_node-getOperand(i)-getOperand(0));
 }
  }
   
  void
  optimize(llvm::Module *mod, unsigned optimization_level,
  -const std::vectorllvm::Function * kernels) {
  +const std::vectorllvm_kernel kernels) {
   
   #if HAVE_LLVM = 0x0307
 llvm::legacy::PassManager PM;
  @@ -322,10 +334,10 @@ namespace {
 // treat the functions in the list as main functions and 
  internalize
 // all of the other functions.
 std::vectorconst char* export_list;
  -  for (std::vectorllvm::Function *::const_iterator I = 
  kernels.begin(),
  +  for (std::vectorllvm_kernel::const_iterator I = kernels.begin(),
E = kernels.end();
I != E; ++I) {
  - llvm::Function *kernel = *I;
  + llvm::Function *kernel = (*I).fn;
export_list.push_back(kernel-getName().data());
 }
   #if HAVE_LLVM  0x0305
  @@ -350,11 +362,11 @@ namespace {
  }
   
  compat::vectormodule::argument
  -   get_kernel_args(const llvm::Module *mod, const std::string kernel_name,
  +   get_kernel_args(const llvm::Module *mod, const llvm_kernel kernel,
  const clang::LangAS::Map address_spaces) {
   
 compat::vectormodule::argument args;
  -  llvm::Function *kernel_func = mod-getFunction(kernel_name);
  +  llvm::Function *kernel_func = kernel.fn;
   
   #if HAVE_LLVM  0x0305
llvm::DataLayout TD(kernel_func-getParent()-getDataLayout());
  @@ -448,7 +460,7 @@ namespace {
   
  module
  build_module_llvm(llvm::Module *mod,
  - const std::vectorllvm::Function * kernels,
  + const std::vectorllvm_kernel kernels,
clang::LangAS::Map address_spaces) {
   
 module m;
  @@ -461,9 +473,10 @@ namespace {
 bitcode_ostream.flush();
   
 for (unsigned i = 0; i  kernels.size(); ++i) {
  - std::string kernel_name = kernels[i]-getName();
  + const llvm_kernel kernel = kernels[i];
compat::vectormodule::argument args =
  -   get_kernel_args(mod, kernel_name, address_spaces);
  +   get_kernel_args(mod, kernel, address_spaces);
  + std::string kernel_name = kernel.fn-getName().str();
   
m.syms.push_back(module::symbol(kernel_name, 0, i, args ));
 }
  @@ -555,9 +568,9 @@ namespace {
 return code;
  }
   
  -   std::mapstd::string, unsigned
  -   get_kernel_offsets(std::vectorchar code,
  -  const std::vectorllvm::Function * kernels,
  +   void
  

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

2015-03-24 Thread Emil Velikov
On 23/03/15 20:45, Bernd Kuhls wrote:
 Matt Turner matts...@gmail.com wrote in 
 news:caedq38ela86kqtjkagscovt70ep8ato3aeqtowbuvk-+xuf...@mail.gmail.com:
 
 so maybe uclibc just needs to add them.
 
 Hi,
 
 they did :) http://git.uclibc.org/uClibc/commit/?id=
 6c4538905e65ceb203f59aaa9a61728e81c6bc0a
 
 Run-time testing was positive, so my patch is obsolete now.
 
Perfect. Glad to hear !

Thanks Bernd
Emil

___
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-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89586

--- Comment #25 from Dan Sebald daniel.seb...@ieee.org ---
I will attach an initial attempt at a Piglit test suite for glPixelZoom() in
combination with glDrawPixels().  I tried (but failed) to set something up in
which if a test fails the associated image is displayed for a couple seconds,
but there is no good way in the framework of creating a delay.  As with modern
design for program flow, there shouldn't be any type of linear pause.  Given
that, it would take a bit to make registered callback functions work to
recursively called tests because of the way the piglit_display is defined. 
Changing that is too much work/modification for this new test.  Not even sure
that is worth doing because big delays in rendering are usually a nuisance. 
The thing to do would be making each test a separate rendering, but that could
be a lot of C files.  In any case, if there is a failure, one has to manually
pre-compile out most of the code, i.e., #if 0 .. #endif to make the failed test
the last image displayed.  For now, I've done that and assembled the images in
PNG files for convenience.

Originally I had put the test in tests/general/zoom-pixels.c to complement
tests/general/draw-pixels.c, then moved it to where I.M. suggested,
tests/spec/gl-1.0/pixelzoom.c.

I've created several tests, and I attempted to make them specific yet not too
specific (such as matching exact expected values) as to not cause any false
negatives due to numerical effects.  The tests are:

1) Monotonicity:  With an input image in which one dimension is 2.5 times
GL_MAX_TEXTURE_SIZE there is a ramp function for the RGB components of RGBA. 
Hence the output image should be a ramp.  If it isn't, then that is a failure. 
This will catch the type of problem I originally ran across in which vertical
lines are appearing in the image due to dropped pixels.  This test is done for
both x and y dimensions and for both positive and negative scaling factors.

2) Exact value at the edge:  Using the OpenGL formulas, I derived the needed
scaling factors to make the last pixel of the input image correspond to the
last pixel of the output image.  With that same ramp image from the previous
test, the last pixel of the ramp is 1.0, so the last pixel of the output should
be 1.0.  Formulas are slightly different for positive and negative scaling.  We
can discuss whether this test is accurate.  (More later.)

3) Scaling over or underrun:  One thing I want to test is what I'm calling
overrun or underrun, which means that the output image falls one pixel too
long or one pixel too short of its expected size.  This effect can often be
seen when resizing the output image (e.g., using the mouse to resize a window
via a corner).  That is, for some non-whole number numerator/divisor scalings,
it might be that the pixel zoom indeces aren't working out right because of
some inexact formula (e.g., the problems I saw in the original problem for
swrast-legacy).  What this test does is draw successive rectangles using an
input image all of the same intensity but decrementing the zoom width or height
and alternating the input image intensity.  The residue left for each iteration
is a single line, so when the process nears the end, the result is a
framebuffer image of alternating lines.  If that isn't correct, then for some
zoom factor along the way there was a mistake.  This is done for both
directions, both postive and negative scaling factors and both magnification
and condensation...  I've had to put a small tolerance in the test for pixel
values in the over/underrun tests.  Does it work that the driver sets the value
as close to, say, 0.25 as possible, and then returns what the actual value is? 
E.g., say the driver is 7 bits, so the resolution is 1/2^7.  (Incidently, every
driver returns an exact value for 1.0?)

OK, please give this test suite a try and let me know what you think.  I'm sure
adjustments need to be made, and we can discuss the validity of the tests with
regard to the OpenGL standard formulas, and refine them if warranted.

Here is a summary of the results I'm currently seeing and a few comments.  I've
made screen captures and assembled the results into collective bitmaps so there
aren't so many individual files.  The four different drivers are as follows:

(1) swrast-legacy: The repository legacy swrast_dri.so driver for which my
system and others is using and exibits vertical lines.

(2) swrast-legacy-patch: The legacy swrast_dri.co patched with the changeset I
originally attached to this bug report.

(3) swrast-gallium: The repository Gallium/llvm swrast_dri.so driver.

(4) swrast-gallium-patch: The Gallium swrast_dri.co patched by removing the
line of code that limits the size of the image.

TEST   (1)   (2)   (3)   (4)

positive monotonic x   fail  pass  fail  fail
positive edge xfail  pass  fail  fail
positive over/underrun x   fail  fail  pass  pass
negative 

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

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

--- Comment #27 from Dan Sebald daniel.seb...@ieee.org ---
Created attachment 114592
  -- https://bugs.freedesktop.org/attachment.cgi?id=114592action=edit
swrast legacy Piglit test images

SWRAST_DRI.SO LEGACY

This is the current repository version of the legacy swrast driver.  The first
image (upper left corner) shows the original problem I and others had
experienced: vertical lines due to dropped pixels associated with
GL_MAX_TEXTURE_SIZE transition.  Interestingly, this doesn't happen when
xfactor is negative (one of the pass tests).  The Y-direction exhibits a good
gradient ramp, except for the very last pixel in the positive direction, which
is missing (look for the dark line near the top of the window), so this test
fails for reasons different than in the X direction.

The positive over/underrun with magnification X test actually looks good, and I
don't know why the test is failing.  These things can be looked at in greater
detail later.  The other three over/underrun tests in the X direction clearly
show that glDrawPixels isn't zooming to the right scale.  This is the other
potential bug I've wondered about.

-- 
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


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

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

--- Comment #26 from Dan Sebald daniel.seb...@ieee.org ---
Created attachment 114591
  -- https://bugs.freedesktop.org/attachment.cgi?id=114591action=edit
Piglit pixelzoom test suite

See https://bugs.freedesktop.org/show_bug.cgi?id=89586#c25 for a description of
this changeset.

-- 
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


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

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

--- Comment #28 from Dan Sebald daniel.seb...@ieee.org ---
Created attachment 114593
  -- https://bugs.freedesktop.org/attachment.cgi?id=114593action=edit
swrast legacy with patch Piglit test images

SWRAST_DRI.SO LEGACY PATCH

With the Mesa changeset I attached to this bug report, the legacy driver now
produces good results as far as the monotonicity tests.  The vertical lines due
to the GL_MAX_TEXTURE_SIZE boundary are gone in the X direction, and the
positive Y-gradient image no longer has a missing last pixel (line).  So that
is making progress.  However, it's clear that the changeset has solved the
issue with glDrawPixels not scaling precisely, and I still don't see why the
positive X/Y over/underrun tests are failing--the associated images look
correct.

-- 
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


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

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

--- Comment #30 from Dan Sebald daniel.seb...@ieee.org ---
Created attachment 114595
  -- https://bugs.freedesktop.org/attachment.cgi?id=114595action=edit
swrast Gallium with patch Piglit test images

SWRAST_DRI.SO GALLIUM PATCH

By making that simple change in src/mesa/state_tracker/st_cb_drawpixels.c that
allows the driver to proceed if the input image size is greater than
GL_MAX_TEXTURE_SIZE, I've found that the Gallium driver will complete the
monotonic image grandients and generally looks good except for the last pixel
(line) missing for both positive X and Y tests.  Again, this is just an initial
investigation, so we aren't sure yet whether there is a shortcoming in the test
algorithm, or whether the Gallium driver might not be meeting the OpenGL
standard for glDrawPixels() exactly, e.g., a boundary condition isn't being
satisfied such as pixel centers on the left or bottom box boundary are
considered in the box.

-- 
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/2] st/egl: don't ship the dri2, c link at the tarball

2015-03-24 Thread Jose Fonseca

On 23/03/15 16:15, Emil Velikov wrote:

During 'make dist' the path of the symbolic link (x11/dri2.c) becomes
too long, and tar converts it to hard one. To make it more complicated
on Haiku tar errors out (due to lack of hardlink support) rather than
falling back to the next best thing.
So remove the symlink from git, and disable the scons x11_drm egl code.
The offending code is not build with either automake nor android.

Brian, Jose would you have any objections against this ? I was
playing around to get the symlink resolved, although I could not get the
dependency tracking resolved, so env.Command() was never executed :-\


No objections from me.

Jose



Bugzilla: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D89680d=AwIBAgc=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEsr=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzEm=kbkQvZ91MLwWiICIjaqFjJvTbTcid8jb6N_JvWRj5RUs=0lsus4gaJqwWUadyxbcfiCq529HufHm5uSHMHUmqj7se=
Cc: mesa-sta...@lists.freedesktop.org
Cc: Brian Paul bri...@vmware.com
Cc: Jose Fonseca jfons...@vmware.com
Cc: Alexander von Gluck IV kallis...@unixzen.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---

Alexander this and the previous patch things should get mesa 10.5
building correctly on your platform. I have uploaded temporary tarballs
at 
https://urldefense.proofpoint.com/v2/url?u=http-3A__people.freedesktop.org_-7Eevelikov_fdo89680_d=AwIBAgc=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEsr=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzEm=kbkQvZ91MLwWiICIjaqFjJvTbTcid8jb6N_JvWRj5RUs=JZ1rv3J0vuOmjLmYDnILD7VMo-ktGY2JW5q0v3ZPM0ge=

Can you give them a try ?

Thanks
Emil


  src/gallium/state_trackers/egl/Makefile.sources | 1 -
  src/gallium/state_trackers/egl/SConscript   | 3 ++-
  src/gallium/state_trackers/egl/x11/dri2.c   | 1 -
  3 files changed, 2 insertions(+), 3 deletions(-)
  delete mode 12 src/gallium/state_trackers/egl/x11/dri2.c

diff --git a/src/gallium/state_trackers/egl/Makefile.sources 
b/src/gallium/state_trackers/egl/Makefile.sources
index 03ded58..0551c16 100644
--- a/src/gallium/state_trackers/egl/Makefile.sources
+++ b/src/gallium/state_trackers/egl/Makefile.sources
@@ -52,6 +52,5 @@ x11_FILES := \
x11/native_ximage.c

  x11_drm_FILES := \
-   x11/dri2.c \
x11/x11_screen.c \
x11/x11_screen.h
diff --git a/src/gallium/state_trackers/egl/SConscript 
b/src/gallium/state_trackers/egl/SConscript
index 3727fb2..a94abc2 100644
--- a/src/gallium/state_trackers/egl/SConscript
+++ b/src/gallium/state_trackers/egl/SConscript
@@ -39,7 +39,8 @@ else:
  '#/src/mapi',
  ])
  sources.append(env.ParseSourceList('Makefile.sources', 'x11_FILES'))
-if env['drm']:
+if env['drm'] and False:
+# XXX: Disabled as we're don't generate the x11/dri2.c symlink at 
buildtime.
  env.Append(CPPDEFINES = ['GLX_DIRECT_RENDERING'])
  sources.append(env.ParseSourceList('Makefile.sources', 
'x11_drm_FILES'))
  if env['drm'] and False:
diff --git a/src/gallium/state_trackers/egl/x11/dri2.c 
b/src/gallium/state_trackers/egl/x11/dri2.c
deleted file mode 12
index 344a11c..000
--- a/src/gallium/state_trackers/egl/x11/dri2.c
+++ /dev/null
@@ -1 +0,0 @@
-../../../../glx/dri2.c
\ No newline at end of file



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


Re: [Mesa-dev] [PATCH] r600g/sb: Enable SB for geometry shaders

2015-03-24 Thread Glenn Kennard
On Tue, 24 Mar 2015 17:21:35 +0100, Dieter Nützel die...@nuetzel-hh.de  
wrote:



Am 20.03.2015 14:13, schrieb Glenn Kennard:

Add SV_GEOMETRY_EMIT special variable type to track the
implicit dependencies between CUT/EMIT_VERTEX/MEM_RING
instructions so GCM/scheduler doesn't reorder them.
 Mark emit instructions as unkillable so DCE doesn't eat them.
 Signed-off-by: Glenn Kennard glenn.kenn...@gmail.com
---
The hangs with SB on geometry shaders were all due to the CUT/EMIT
instructions either being DCE:d or emitted out of order from the
memory ring writes, so the hardware stalled forever waiting for
completed primitives.
 Tested only on a Turks so far, but should behave the same across
all R600 generations.


Hello Glenn,

what tests are preferred?
Starting with a Turks XT here, too and could do some tests on RV730  
(AGP) then.


-Dieter


Just the usual piglit regression testing, at this point it's been tested  
on a Turks XT, and a RV770. A R6xx card and some VLIW4 gpu would complete  
the coverage needed.



/Glenn
___
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-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89586

--- Comment #29 from Dan Sebald daniel.seb...@ieee.org ---
Created attachment 114594
  -- https://bugs.freedesktop.org/attachment.cgi?id=114594action=edit
swrast Gallium Piglit test images

SWRAST_DRI.SO GALLIUM

The test images illustrate how the Gallium/LLVM driver is not displaying
anything beyond the GL_MAX_TEXTURE_SIZE boundary of the input image.  For all
four monotonicity tests, only the darker portion of the gradient appears and
from there it is the last draw/render that remains in the frame buffer.  E.g.,
the Positive Monotonicity Y image still has the vertical alternating lines from
the Negative Over/Underrun X test.  It's no wonder all the monotonicity and
edge tests fail.  But the good news is that for input images with sizes less
than GL_MAX_TEXTURE_SIZE, the Gallium driver is accurate for scaling.  That's
very nice.

-- 
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


[Mesa-dev] [PATCH V2 06/12] glsl: dont allow gl_PerVertex to be redeclared as an array of arrays

2015-03-24 Thread Timothy Arceri
V2: move single dimensionial array detection into a helper

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
---
 src/glsl/ast.h  | 8 
 src/glsl/ast_to_hir.cpp | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index ef74e51..3f67907 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -328,6 +328,14 @@ public:
   array_dimensions.push_tail(dim-link);
}
 
+   bool is_single_dimension()
+   {
+  return (this-is_unsized_array  this-array_dimensions.is_empty()) ||
+ (!this-is_unsized_array 
+  this-array_dimensions.tail_pred-prev != NULL 
+  this-array_dimensions.tail_pred-prev-is_head_sentinel());
+   }
+
virtual void print(void) const;
 
/* If true, this means that the array has an unsized outermost dimension. */
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 36f3eb7..d9ce6c9 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -5595,7 +5595,8 @@ ast_interface_block::hir(exec_list *instructions,
  _mesa_shader_stage_to_string(state-stage));
  }
  if (this-instance_name == NULL ||
- strcmp(this-instance_name, gl_in) != 0 || 
this-array_specifier == NULL) {
+ strcmp(this-instance_name, gl_in) != 0 || 
this-array_specifier == NULL ||
+ !this-array_specifier-is_single_dimension()) {
 _mesa_glsl_error(loc, state,
  gl_PerVertex input must be redeclared as 
  gl_in[]);
-- 
2.1.0

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


[Mesa-dev] [Bug 88885] Transform feedback uses incorrect interleaving if a previous draw did not write gl_Position

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

--- Comment #3 from Tapani Pälli lem...@gmail.com ---
Thanks Chris! This commit has fixed also rendering issues with some of the
heavyweight UE4 demos where we had 'yellow tint' colors.

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


Re: [Mesa-dev] [PATCH] dri3_glx.c: Pass NULL DRI drawables into driver for None GLX drawables

2015-03-24 Thread Axel Davy

Le 24/03/2015 06:50, Zhang, Xiong Y a écrit :

You seem to miss the case when one is None and not the other.
It should return BadDrawable too.

This particular case seems not handled by the dri2 code either, and the gallium
state tracker seems to handle it in bindContext, but not the intel code for
example.

[Zhang, Xiong Y] For this particular case, are you mean this case:
(draw == None  read != None) || (draw != None  read == None)
If it is yes, it's better to add this judgement into MakeContextCurrent() in 
src/glx/glxcurrent.c, so that both dri2_glx and dri3_glx could use it.
  
thanks



Yes.

I imagine putting it into MakeContextCurrent is not a solution, since it 
means GLXBadContext will be returned instead of GLXBadDrawable.


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


Re: [Mesa-dev] [PATCH 1/2] configure.ac: move AC_MSG_RESULT reportging back into the m4 macro

2015-03-24 Thread Samuel Iglesias Gonsálvez
Thanks Emil!

Reviewed-by: Samuel Iglesias Gonsalvez sigles...@igalia.com

Sam

On Monday 23 March 2015 17:49:23 Emil Velikov wrote:
 The one who does AC_MSG_CHECKING should provide the AC_MSG_RESULT.
 
 Fixed: ced9425327b (configure: Introduce new output variable to
 ax_check_python_mako_module.m4
 Cc: Samuel Iglesias Gonsalvez sigles...@igalia.com
 Cc: 10.5 mesa-sta...@lists.freedesktop.org
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89328
 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
 ---
 Strictly speaking not a hard requirement for 10.5, although the original
 commit which resolves the bug is missing the Cc and Bugzilla tags. This
 will allow us to kill two birds with one stone.
 
 -Emil
 
  configure.ac  | 4 +---
  m4/ax_check_python_mako_module.m4 | 2 ++
  2 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/configure.ac b/configure.ac
 index 08378f5..3e5b6f5 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -123,9 +123,7 @@ if test x$INDENT != xcat; then
  fi
 
  AX_CHECK_PYTHON_MAKO_MODULE($PYTHON_MAKO_REQUIRED)
 -if test -n $PYTHON2 -a x$acv_mako_found = xyes; then
 -AC_MSG_RESULT(yes)
 -else
 +if test -n $PYTHON2 -a x$acv_mako_found != xyes; then
  AC_MSG_ERROR([Python mako module v$PYTHON_MAKO_REQUIRED or higher not
 found]) fi
 
 diff --git a/m4/ax_check_python_mako_module.m4
 b/m4/ax_check_python_mako_module.m4 index ee68a7c..7d9bb51 100644
 --- a/m4/ax_check_python_mako_module.m4
 +++ b/m4/ax_check_python_mako_module.m4
 @@ -54,8 +54,10 @@ else:
   | $PYTHON2 -
 
  if test $? -ne 0 ; then
 +   AC_MSG_RESULT(no)
 AC_SUBST(acv_mako_found, 'no')
  else
 +   AC_MSG_RESULT(yes)
 AC_SUBST(acv_mako_found, 'yes')
  fi
  ])


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 V2 12/12] glsl: Add support for lowering interface block arrays of arrays

2015-03-24 Thread Timothy Arceri
V2: make array processing functions static
---
 src/glsl/lower_named_interface_blocks.cpp | 51 ++-
 1 file changed, 37 insertions(+), 14 deletions(-)

diff --git a/src/glsl/lower_named_interface_blocks.cpp 
b/src/glsl/lower_named_interface_blocks.cpp
index 7304c51..5f0d944 100644
--- a/src/glsl/lower_named_interface_blocks.cpp
+++ b/src/glsl/lower_named_interface_blocks.cpp
@@ -65,6 +65,38 @@
 #include ir_rvalue_visitor.h
 #include program/hash_table.h
 
+static const glsl_type *
+process_array_type(const glsl_type *type, unsigned idx)
+{
+   const glsl_type *element_type = type-fields.array;
+   if (element_type-is_array()) {
+  const glsl_type *new_array_type = process_array_type(element_type, idx);
+  return glsl_type::get_array_instance(new_array_type, type-length);
+   } else {
+  return glsl_type::get_array_instance(
+element_type-fields.structure[idx].type, type-length);
+   }
+}
+
+static ir_rvalue *
+process_array_ir(void * const mem_ctx,
+ ir_dereference_array *deref_array_prev,
+ ir_rvalue *deref_var)
+{
+   ir_dereference_array *deref_array =
+  deref_array_prev-array-as_dereference_array();
+
+   if (deref_array == NULL) {
+  return new(mem_ctx) ir_dereference_array(deref_var,
+   deref_array_prev-array_index);
+   } else {
+  deref_array = (ir_dereference_array *)
+   process_array_ir(mem_ctx, deref_array, deref_var);
+  return new(mem_ctx) ir_dereference_array(deref_array,
+   deref_array_prev-array_index);
+   }
+}
+
 namespace {
 
 class flatten_named_interface_blocks_declarations : public ir_rvalue_visitor
@@ -111,15 +143,9 @@ flatten_named_interface_blocks_declarations::run(exec_list 
*instructions)
   if (var-data.mode == ir_var_uniform)
  continue;
 
-  const glsl_type * iface_t = var-type;
-  const glsl_type * array_t = NULL;
+  const glsl_type * iface_t = var-type-without_array();
   exec_node *insert_pos = var;
 
-  if (iface_t-is_array()) {
- array_t = iface_t;
- iface_t = array_t-fields.array;
-  }
-
   assert (iface_t-is_interface());
 
   for (unsigned i = 0; i  iface_t-length; i++) {
@@ -135,7 +161,7 @@ flatten_named_interface_blocks_declarations::run(exec_list 
*instructions)
 ir_variable *new_var;
 char *var_name =
ralloc_strdup(mem_ctx, iface_t-fields.structure[i].name);
-if (array_t == NULL) {
+if (!var-type-is_array()) {
new_var =
   new(mem_ctx) ir_variable(iface_t-fields.structure[i].type,
var_name,
@@ -143,9 +169,7 @@ flatten_named_interface_blocks_declarations::run(exec_list 
*instructions)
new_var-data.from_named_ifc_block_nonarray = 1;
 } else {
const glsl_type *new_array_type =
-  glsl_type::get_array_instance(
- iface_t-fields.structure[i].type,
- array_t-length);
+  process_array_type(var-type, i);
new_var =
   new(mem_ctx) ir_variable(new_array_type,
var_name,
@@ -231,9 +255,8 @@ 
flatten_named_interface_blocks_declarations::handle_rvalue(ir_rvalue **rvalue)
   ir_dereference_array *deref_array =
  ir-record-as_dereference_array();
   if (deref_array != NULL) {
- *rvalue =
-new(mem_ctx) ir_dereference_array(deref_var,
-  deref_array-array_index);
+ *rvalue = process_array_ir(mem_ctx, deref_array,
+(ir_rvalue *)deref_var);
   } else {
  *rvalue = deref_var;
   }
-- 
2.1.0

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


[Mesa-dev] [PATCH v4 15/17] main: Added entry point for glGetNamedRenderbufferParameteriv

2015-03-24 Thread Martin Peres
v2:
- improve an error message

Reviewed-by: Laura Ekstrand la...@jlekstrand.net

v3:
- move a test to less generic functions
- fix an alignment

v4:
- take the caller as a parameter instead of bool dsa
- check that the lookup returns a valid renderbuffer

Signed-off-by: Martin Peres martin.pe...@linux.intel.com
---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  6 +++
 src/mesa/main/fbobject.c   | 63 ++
 src/mesa/main/fbobject.h   |  4 ++
 src/mesa/main/tests/dispatch_sanity.cpp|  1 +
 4 files changed, 56 insertions(+), 18 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml 
b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 976dcc8..d4e1f7c 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -159,6 +159,12 @@
   param name=renderbuffers type=GLuint * /
/function
 
+   function name=GetNamedRenderbufferParameteriv offset=assign
+  param name=renderbuffer type=GLuint /
+  param name=pname type=GLenum /
+  param name=params type=GLint * /
+   /function
+
!-- Texture object functions --
 
function name=CreateTextures offset=assign
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 8083bc1..377f915 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1993,25 +1993,11 @@ _es_RenderbufferStorageEXT(GLenum target, GLenum 
internalFormat,
 }
 
 
-void GLAPIENTRY
-_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
+static void
+get_render_buffer_parameteriv(struct gl_context *ctx,
+  struct gl_renderbuffer *rb, GLenum pname,
+  GLint *params, const char *func)
 {
-   struct gl_renderbuffer *rb;
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (target != GL_RENDERBUFFER_EXT) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  glGetRenderbufferParameterivEXT(target));
-  return;
-   }
-
-   rb = ctx-CurrentRenderbuffer;
-   if (!rb) {
-  _mesa_error(ctx, GL_INVALID_OPERATION,
-  glGetRenderbufferParameterivEXT);
-  return;
-   }
-
/* No need to flush here since we're just quering state which is
 * not effected by rendering.
 */
@@ -2042,10 +2028,51 @@ _mesa_GetRenderbufferParameteriv(GLenum target, GLenum 
pname, GLint *params)
   }
   /* fallthrough */
default:
+  _mesa_error(ctx, GL_INVALID_ENUM, %s(invalid pname=%s), func,
+  _mesa_lookup_enum_by_nr(pname));
+  return;
+   }
+}
+
+
+void GLAPIENTRY
+_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (target != GL_RENDERBUFFER_EXT) {
   _mesa_error(ctx, GL_INVALID_ENUM,
   glGetRenderbufferParameterivEXT(target));
   return;
}
+
+   if (!ctx-CurrentRenderbuffer) {
+  _mesa_error(ctx, GL_INVALID_OPERATION, glGetRenderbufferParameterivEXT
+  (no renderbuffer bound));
+  return;
+   }
+
+   get_render_buffer_parameteriv(ctx, ctx-CurrentRenderbuffer, pname,
+ params, glGetRenderbufferParameteriv);
+}
+
+
+void GLAPIENTRY
+_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
+  GLint *params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
+   if (!rb || rb == DummyRenderbuffer) {
+  /* ID was reserved, but no real renderbuffer object made yet */
+  _mesa_error(ctx, GL_INVALID_OPERATION, 
glGetNamedRenderbufferParameteriv
+  (invalid renderbuffer %i), renderbuffer);
+  return;
+   }
+
+   get_render_buffer_parameteriv(ctx, rb, pname, params,
+ glGetNamedRenderbufferParameteriv);
 }
 
 
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 9ab6b0b..b92149b 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -137,6 +137,10 @@ extern void GLAPIENTRY
 _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname,
 GLint *params);
 
+void GLAPIENTRY
+_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
+  GLint *params);
+
 extern GLboolean GLAPIENTRY
 _mesa_IsFramebuffer(GLuint framebuffer);
 
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index 5383865..bb573d4 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -944,6 +944,7 @@ const struct function gl_core_functions_possible[] = {
{ glGetNamedBufferPointerv, 45, -1 },
{ glGetNamedBufferSubData, 45, -1 },
{ glCreateRenderbuffers, 45, -1 },
+   { glGetNamedRenderbufferParameteriv, 45, -1 },
{ glCreateTextures, 45, -1 },
{ glTextureStorage1D, 45, -1 },
{ 

Re: [Mesa-dev] [PATCH] clover: Return CL_BUILD_ERROR for CL_PROGRAM_BUILD_STATUS when compilation fails

2015-03-24 Thread Francisco Jerez
Jan Vesely jan.ves...@rutgers.edu writes:

 On Tue, 2015-03-24 at 22:24 +0200, Francisco Jerez wrote:
 Tom Stellard thomas.stell...@amd.com writes:
 
  Cc: 10.5 10.4 mesa-sta...@lists.freedesktop.org
  ---
   src/gallium/state_trackers/clover/core/program.cpp | 6 +-
   src/gallium/state_trackers/clover/core/program.hpp | 1 +
   2 files changed, 6 insertions(+), 1 deletion(-)
 
  diff --git a/src/gallium/state_trackers/clover/core/program.cpp 
  b/src/gallium/state_trackers/clover/core/program.cpp
  index 8553ca7..06a6d92 100644
  --- a/src/gallium/state_trackers/clover/core/program.cpp
  +++ b/src/gallium/state_trackers/clover/core/program.cpp
  @@ -49,6 +49,7 @@ program::build(const ref_vectordevice devs, const 
  char *opts,
_binaries.erase(dev);
_logs.erase(dev);
_opts.erase(dev);
  + _errs.erase(dev);
   
_opts.insert({ dev, opts });
   
  @@ -65,6 +66,7 @@ program::build(const ref_vectordevice devs, const 
  char *opts,
   _logs.insert({ dev, log });
} catch (const build_error ) {
   _logs.insert({ dev, log });
  +_errs.insert(dev);
   throw;
}
 }
  @@ -88,7 +90,9 @@ program::binary(const device dev) const {
   
   cl_build_status
   program::build_status(const device dev) const {
  -   if (_binaries.count(dev))
  +   if (_errs.count(dev))
  +  return CL_BUILD_ERROR;
  +   else if (_binaries.count(dev))
 return CL_BUILD_SUCCESS;
  else
 return CL_BUILD_NONE;
 
 Any reason you couldn't do something like:
 
 |   if (_binaries.count(dev))
 |  return CL_BUILD_SUCCESS;
 |   else if (_log.count(dev))
 |  return CL_BUILD_ERROR;
 |   else
 |  return CL_BUILD_NONE;
 

 Wouldn't this return error even if only warnings are produced?

No, warnings alone wouldn't cause _binaries.count(dev) to be zero.

 
  diff --git a/src/gallium/state_trackers/clover/core/program.hpp 
  b/src/gallium/state_trackers/clover/core/program.hpp
  index 661fa03..8c90199 100644
  --- a/src/gallium/state_trackers/clover/core/program.hpp
  +++ b/src/gallium/state_trackers/clover/core/program.hpp
  @@ -73,6 +73,7 @@ namespace clover {
 std::mapconst device *, module _binaries;
 std::mapconst device *, std::string _logs;
 std::mapconst device *, std::string _opts;
  +  std::setconst device * _errs;
 std::string _source;
 ref_counter _kernel_ref_counter;
  };
  -- 
  2.0.4
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev

 -- 
 Jan Vesely jan.ves...@rutgers.edu


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] gallium/util: Define ffsll on OpenBSD.

2015-03-24 Thread Emil Velikov
On 21/03/15 17:12, Matt Turner wrote:
 On Sat, Mar 21, 2015 at 10:10 AM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 On 17/03/15 23:44, Emil Velikov wrote:
 On 17/03/15 01:25, Jonathan Gray wrote:
 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) 

Re: [Mesa-dev] [PATCH] clover: Return CL_BUILD_ERROR for CL_PROGRAM_BUILD_STATUS when compilation fails

2015-03-24 Thread Tom Stellard
On Tue, Mar 24, 2015 at 10:36:19PM +0200, Francisco Jerez wrote:
 Jan Vesely jan.ves...@rutgers.edu writes:
 
  On Tue, 2015-03-24 at 22:24 +0200, Francisco Jerez wrote:
  Tom Stellard thomas.stell...@amd.com writes:
  
   Cc: 10.5 10.4 mesa-sta...@lists.freedesktop.org
   ---
src/gallium/state_trackers/clover/core/program.cpp | 6 +-
src/gallium/state_trackers/clover/core/program.hpp | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
  
   diff --git a/src/gallium/state_trackers/clover/core/program.cpp 
   b/src/gallium/state_trackers/clover/core/program.cpp
   index 8553ca7..06a6d92 100644
   --- a/src/gallium/state_trackers/clover/core/program.cpp
   +++ b/src/gallium/state_trackers/clover/core/program.cpp
   @@ -49,6 +49,7 @@ program::build(const ref_vectordevice devs, const 
   char *opts,
 _binaries.erase(dev);
 _logs.erase(dev);
 _opts.erase(dev);
   + _errs.erase(dev);

 _opts.insert({ dev, opts });

   @@ -65,6 +66,7 @@ program::build(const ref_vectordevice devs, const 
   char *opts,
_logs.insert({ dev, log });
 } catch (const build_error ) {
_logs.insert({ dev, log });
   +_errs.insert(dev);
throw;
 }
  }
   @@ -88,7 +90,9 @@ program::binary(const device dev) const {

cl_build_status
program::build_status(const device dev) const {
   -   if (_binaries.count(dev))
   +   if (_errs.count(dev))
   +  return CL_BUILD_ERROR;
   +   else if (_binaries.count(dev))
  return CL_BUILD_SUCCESS;
   else
  return CL_BUILD_NONE;
  
  Any reason you couldn't do something like:
  
  |   if (_binaries.count(dev))
  |  return CL_BUILD_SUCCESS;
  |   else if (_log.count(dev))
  |  return CL_BUILD_ERROR;
  |   else
  |  return CL_BUILD_NONE;
  
 
  Wouldn't this return error even if only warnings are produced?
 
 No, warnings alone wouldn't cause _binaries.count(dev) to be zero.
 

At first I was thinking this wouldn't work, because we might get an
empty log message, but I realize now that this doesn't matter, because
dev will still be a key in the map even if log is empty.
I will fix this.

-Tom

  
   diff --git a/src/gallium/state_trackers/clover/core/program.hpp 
   b/src/gallium/state_trackers/clover/core/program.hpp
   index 661fa03..8c90199 100644
   --- a/src/gallium/state_trackers/clover/core/program.hpp
   +++ b/src/gallium/state_trackers/clover/core/program.hpp
   @@ -73,6 +73,7 @@ namespace clover {
  std::mapconst device *, module _binaries;
  std::mapconst device *, std::string _logs;
  std::mapconst device *, std::string _opts;
   +  std::setconst device * _errs;
  std::string _source;
  ref_counter _kernel_ref_counter;
   };
   -- 
   2.0.4
  ___
  mesa-dev mailing list
  mesa-dev@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 
  -- 
  Jan Vesely jan.ves...@rutgers.edu




 ___
 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] makefile: add all headers to the tarball

2015-03-24 Thread Emil Velikov
On 23/03/15 17:16, Matt Turner wrote:
 Thanks Emil. For the series
 
 Reviewed-by: Matt Turner matts...@gmail.com
 
YW. I'll get those in asap, seeing that Ken has been having fun on
(somewhat related) topic.

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


[Mesa-dev] [PATCH] clover: Call clBuildProgram() notification function when build completes

2015-03-24 Thread Tom Stellard
Cc: 10.5 10.4 mesa-sta...@lists.freedesktop.org
---
 src/gallium/state_trackers/clover/api/program.cpp | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/state_trackers/clover/api/program.cpp 
b/src/gallium/state_trackers/clover/api/program.cpp
index 60184ed..fcec1d7 100644
--- a/src/gallium/state_trackers/clover/api/program.cpp
+++ b/src/gallium/state_trackers/clover/api/program.cpp
@@ -180,8 +180,12 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
validate_build_program_common(prog, num_devs, d_devs, pfn_notify, 
user_data);
 
prog.build(devs, opts);
+   if (pfn_notify)
+  pfn_notify(d_prog, user_data);
return CL_SUCCESS;
 } catch (error e) {
+   if (pfn_notify)
+  pfn_notify(d_prog, user_data);
if (e.get() == CL_INVALID_COMPILER_OPTIONS)
   return CL_INVALID_BUILD_OPTIONS;
if (e.get() == CL_COMPILE_PROGRAM_FAILURE)
-- 
2.0.4

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


Re: [Mesa-dev] [PATCH 2/6] nir: Implement a Mesa IR - NIR translator.

2015-03-24 Thread Emil Velikov
Hi Ken,

On 24/03/15 00:37, Kenneth Graunke wrote:
 Shamelessly ripped off from Eric Anholt's tgsi_to_nir pass.
 
 Not compiled on SCons, like the rest of NIR.
 
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/mesa/Makefile.am|2 +
  src/mesa/Makefile.sources   |5 +
  src/mesa/program/prog_instruction.h |2 +
  src/mesa/program/prog_to_nir.c  | 1189 
 +++
  src/mesa/program/prog_to_nir.h  |   37 ++
  5 files changed, 1235 insertions(+)
  create mode 100644 src/mesa/program/prog_to_nir.c
  create mode 100644 src/mesa/program/prog_to_nir.h
 
 diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
 index 3dab8f0..60114e4 100644
 --- a/src/mesa/Makefile.am
 +++ b/src/mesa/Makefile.am
 @@ -174,6 +174,7 @@ endif
  libmesa_la_SOURCES = \
   $(MESA_FILES) \
   $(PROGRAM_FILES) \
 + $(PROGRAM_NIR_FILES) \
   $(MESA_ASM_FILES_FOR_ARCH)
  
  libmesa_la_LIBADD = \
 @@ -183,6 +184,7 @@ libmesa_la_LIBADD = \
  libmesagallium_la_SOURCES = \
   $(MESA_GALLIUM_FILES) \
   $(PROGRAM_FILES) \
 + $(PROGRAM_NIR_FILES) \
   $(MESA_ASM_FILES_FOR_ARCH)
  
  libmesagallium_la_LIBADD = \
 diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
 index 217be9a..cc166ce 100644
 --- a/src/mesa/Makefile.sources
 +++ b/src/mesa/Makefile.sources
 @@ -520,6 +520,10 @@ PROGRAM_FILES = \
   program/symbol_table.c \
   program/symbol_table.h
  
 +PROGRAM_NIR_FILES = \
 + program/prog_to_nir.c \
 + program/prog_to_nir.h
 +
  ASM_C_FILES =\
   x86/common_x86.c \
   x86/x86_xform.c \
 @@ -608,6 +612,7 @@ INCLUDE_DIRS = \
   -I$(top_srcdir)/src \
   -I$(top_srcdir)/src/glsl \
   -I$(top_builddir)/src/glsl \
 + -I$(top_builddir)/src/glsl/nir \
Hi Ken,

Thanks for handling all the build cruft :)

Noticed that you mentioned some build issues - was it locally or with
jenkins ? I've just pushed a series has some related patches. If you're
still seeing those can you open a bug report and/or post the build log
somewhere.

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


[Mesa-dev] [PATCH] clover: Return CL_BUILD_ERROR for CL_PROGRAM_BUILD_STATUS when compilation fails

2015-03-24 Thread Tom Stellard
Cc: 10.5 10.4 mesa-sta...@lists.freedesktop.org
---
 src/gallium/state_trackers/clover/core/program.cpp | 6 +-
 src/gallium/state_trackers/clover/core/program.hpp | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/clover/core/program.cpp 
b/src/gallium/state_trackers/clover/core/program.cpp
index 8553ca7..06a6d92 100644
--- a/src/gallium/state_trackers/clover/core/program.cpp
+++ b/src/gallium/state_trackers/clover/core/program.cpp
@@ -49,6 +49,7 @@ program::build(const ref_vectordevice devs, const char 
*opts,
  _binaries.erase(dev);
  _logs.erase(dev);
  _opts.erase(dev);
+ _errs.erase(dev);
 
  _opts.insert({ dev, opts });
 
@@ -65,6 +66,7 @@ program::build(const ref_vectordevice devs, const char 
*opts,
 _logs.insert({ dev, log });
  } catch (const build_error ) {
 _logs.insert({ dev, log });
+_errs.insert(dev);
 throw;
  }
   }
@@ -88,7 +90,9 @@ program::binary(const device dev) const {
 
 cl_build_status
 program::build_status(const device dev) const {
-   if (_binaries.count(dev))
+   if (_errs.count(dev))
+  return CL_BUILD_ERROR;
+   else if (_binaries.count(dev))
   return CL_BUILD_SUCCESS;
else
   return CL_BUILD_NONE;
diff --git a/src/gallium/state_trackers/clover/core/program.hpp 
b/src/gallium/state_trackers/clover/core/program.hpp
index 661fa03..8c90199 100644
--- a/src/gallium/state_trackers/clover/core/program.hpp
+++ b/src/gallium/state_trackers/clover/core/program.hpp
@@ -73,6 +73,7 @@ namespace clover {
   std::mapconst device *, module _binaries;
   std::mapconst device *, std::string _logs;
   std::mapconst device *, std::string _opts;
+  std::setconst device * _errs;
   std::string _source;
   ref_counter _kernel_ref_counter;
};
-- 
2.0.4

___
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-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89586

--- Comment #33 from Dan Sebald daniel.seb...@ieee.org ---
Created attachment 114598
  -- https://bugs.freedesktop.org/attachment.cgi?id=114598action=edit
swrast Gallium Piglit test images

SWRAST_DRI.SO GALLIUM

The test images illustrate how the Gallium/LLVM driver is not displaying
anything beyond the GL_MAX_TEXTURE_SIZE boundary of the input image.  For all
four monotonicity tests, only the darker portion of the gradient appears and
from there it is the last draw/render that remains in the frame buffer.  E.g.,
the Positive Monotonicity Y image still has the vertical alternating lines from
the Negative Over/Underrun X test.  It's no wonder all the monotonicity and
edge tests fail.  But the good news is that for input images with sizes less
than GL_MAX_TEXTURE_SIZE, the Gallium driver is accurate for scaling.  That's
very nice.

-- 
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


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

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

--- Comment #34 from Dan Sebald daniel.seb...@ieee.org ---
Created attachment 114599
  -- https://bugs.freedesktop.org/attachment.cgi?id=114599action=edit
swrast Gallium with patch Piglit test images

SWRAST_DRI.SO GALLIUM PATCH

By making that simple change in src/mesa/state_tracker/st_cb_drawpixels.c that
allows the driver to proceed if the input image size is greater than
GL_MAX_TEXTURE_SIZE, I've found that the Gallium driver will complete the
monotonic image grandients and generally looks good except for the last pixel
(line) missing for both positive X and Y tests.  Again, this is just an initial
investigation, so we aren't sure yet whether there is a shortcoming in the test
algorithm, or whether the Gallium driver might not be meeting the OpenGL
standard for glDrawPixels exactly, e.g., a boundary condition isn't being
satisfy such as pixel centers on the left or bottom box boundary are considered
in the box.

-- 
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] clover: Return CL_BUILD_ERROR for CL_PROGRAM_BUILD_STATUS when compilation fails

2015-03-24 Thread Francisco Jerez
Tom Stellard thomas.stell...@amd.com writes:

 Cc: 10.5 10.4 mesa-sta...@lists.freedesktop.org
 ---
  src/gallium/state_trackers/clover/core/program.cpp | 6 +-
  src/gallium/state_trackers/clover/core/program.hpp | 1 +
  2 files changed, 6 insertions(+), 1 deletion(-)

 diff --git a/src/gallium/state_trackers/clover/core/program.cpp 
 b/src/gallium/state_trackers/clover/core/program.cpp
 index 8553ca7..06a6d92 100644
 --- a/src/gallium/state_trackers/clover/core/program.cpp
 +++ b/src/gallium/state_trackers/clover/core/program.cpp
 @@ -49,6 +49,7 @@ program::build(const ref_vectordevice devs, const char 
 *opts,
   _binaries.erase(dev);
   _logs.erase(dev);
   _opts.erase(dev);
 + _errs.erase(dev);
  
   _opts.insert({ dev, opts });
  
 @@ -65,6 +66,7 @@ program::build(const ref_vectordevice devs, const char 
 *opts,
  _logs.insert({ dev, log });
   } catch (const build_error ) {
  _logs.insert({ dev, log });
 +_errs.insert(dev);
  throw;
   }
}
 @@ -88,7 +90,9 @@ program::binary(const device dev) const {
  
  cl_build_status
  program::build_status(const device dev) const {
 -   if (_binaries.count(dev))
 +   if (_errs.count(dev))
 +  return CL_BUILD_ERROR;
 +   else if (_binaries.count(dev))
return CL_BUILD_SUCCESS;
 else
return CL_BUILD_NONE;

Any reason you couldn't do something like:

|   if (_binaries.count(dev))
|  return CL_BUILD_SUCCESS;
|   else if (_log.count(dev))
|  return CL_BUILD_ERROR;
|   else
|  return CL_BUILD_NONE;


 diff --git a/src/gallium/state_trackers/clover/core/program.hpp 
 b/src/gallium/state_trackers/clover/core/program.hpp
 index 661fa03..8c90199 100644
 --- a/src/gallium/state_trackers/clover/core/program.hpp
 +++ b/src/gallium/state_trackers/clover/core/program.hpp
 @@ -73,6 +73,7 @@ namespace clover {
std::mapconst device *, module _binaries;
std::mapconst device *, std::string _logs;
std::mapconst device *, std::string _opts;
 +  std::setconst device * _errs;
std::string _source;
ref_counter _kernel_ref_counter;
 };
 -- 
 2.0.4


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] clover: Return CL_BUILD_ERROR for CL_PROGRAM_BUILD_STATUS when compilation fails

2015-03-24 Thread Jan Vesely
On Tue, 2015-03-24 at 22:24 +0200, Francisco Jerez wrote:
 Tom Stellard thomas.stell...@amd.com writes:
 
  Cc: 10.5 10.4 mesa-sta...@lists.freedesktop.org
  ---
   src/gallium/state_trackers/clover/core/program.cpp | 6 +-
   src/gallium/state_trackers/clover/core/program.hpp | 1 +
   2 files changed, 6 insertions(+), 1 deletion(-)
 
  diff --git a/src/gallium/state_trackers/clover/core/program.cpp 
  b/src/gallium/state_trackers/clover/core/program.cpp
  index 8553ca7..06a6d92 100644
  --- a/src/gallium/state_trackers/clover/core/program.cpp
  +++ b/src/gallium/state_trackers/clover/core/program.cpp
  @@ -49,6 +49,7 @@ program::build(const ref_vectordevice devs, const char 
  *opts,
_binaries.erase(dev);
_logs.erase(dev);
_opts.erase(dev);
  + _errs.erase(dev);
   
_opts.insert({ dev, opts });
   
  @@ -65,6 +66,7 @@ program::build(const ref_vectordevice devs, const char 
  *opts,
   _logs.insert({ dev, log });
} catch (const build_error ) {
   _logs.insert({ dev, log });
  +_errs.insert(dev);
   throw;
}
 }
  @@ -88,7 +90,9 @@ program::binary(const device dev) const {
   
   cl_build_status
   program::build_status(const device dev) const {
  -   if (_binaries.count(dev))
  +   if (_errs.count(dev))
  +  return CL_BUILD_ERROR;
  +   else if (_binaries.count(dev))
 return CL_BUILD_SUCCESS;
  else
 return CL_BUILD_NONE;
 
 Any reason you couldn't do something like:
 
 |   if (_binaries.count(dev))
 |  return CL_BUILD_SUCCESS;
 |   else if (_log.count(dev))
 |  return CL_BUILD_ERROR;
 |   else
 |  return CL_BUILD_NONE;
 

Wouldn't this return error even if only warnings are produced?

 
  diff --git a/src/gallium/state_trackers/clover/core/program.hpp 
  b/src/gallium/state_trackers/clover/core/program.hpp
  index 661fa03..8c90199 100644
  --- a/src/gallium/state_trackers/clover/core/program.hpp
  +++ b/src/gallium/state_trackers/clover/core/program.hpp
  @@ -73,6 +73,7 @@ namespace clover {
 std::mapconst device *, module _binaries;
 std::mapconst device *, std::string _logs;
 std::mapconst device *, std::string _opts;
  +  std::setconst device * _errs;
 std::string _source;
 ref_counter _kernel_ref_counter;
  };
  -- 
  2.0.4
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev

-- 
Jan Vesely jan.ves...@rutgers.edu


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] [Bug 89586] Drivers/DRI/swrast

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

--- Comment #31 from Dan Sebald daniel.seb...@ieee.org ---
Created attachment 114596
  -- https://bugs.freedesktop.org/attachment.cgi?id=114596action=edit
swrast legacy Piglit test images

SWRAST_DRI.SO LEGACY

This is the current repository version of the legacy swrast driver.  The first
image (upper left corner) shows the original problem I and others had
experienced: vertical lines due to dropped pixels associated with
GL_MAX_TEXTURE_SIZE transition.  Interestingly, this doesn't happen when
xfactor is negative (one of the pass tests).  The Y-direction exhibits a good
gradient ramp, except for the very last pixel in the positive direction, which
is missing (look for the dark line near the top of the window), so this test
fails for reasons different than in the X direction.

The positive over/underrun with magnification X test actually looks good, and I
don't know why the test is failing.  These things can be looked at in greater
detail later.  The other three over/underrun tests in the X direction clearly
show that glDrawPixels isn't zooming to the right scale.  This is the other
potential bug I've wondered about.

-- 
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


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

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

--- Comment #32 from Dan Sebald daniel.seb...@ieee.org ---
Created attachment 114597
  -- https://bugs.freedesktop.org/attachment.cgi?id=114597action=edit
swrast legacy with patch Piglit test images

SWRAST_DRI.SO LEGACY PATCH

With the Mesa changeset I attached to this bug report, the legacy driver now
produces good results as far as the monotonicity tests.  The vertical lines due
to the GL_MAX_TEXTURE_SIZE boundary are gone in the X direction, and the
positive Y-gradient image no longer has a missing last pixel (line).  So that
is making progress.  However, it's clear that the changeset has solved the
issue with glDrawPixels not scaling precisely, and I still don't see why the
positive X/Y over/underrun tests are failing--the associated images look
correct.

-- 
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


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

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

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

   What|Removed |Added

 Attachment #114594|0   |1
is obsolete||

-- 
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


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

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

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

   What|Removed |Added

 Attachment #114593|0   |1
is obsolete||

-- 
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


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

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

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

   What|Removed |Added

 Attachment #114595|0   |1
is obsolete||

-- 
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


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

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

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

   What|Removed |Added

 Attachment #114592|0   |1
is obsolete||

-- 
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] glsl: avoid calling base_alignment when samplers are involved

2015-03-24 Thread Ian Romanick
On 03/23/2015 05:00 AM, Ilia Mirkin wrote:
 Earlier commit 53bf7c8fd2e changed the logic to always call
 base_alignment on structs. 1ec715ce8b12 hacked the function to return 0
 for sampler fields, but didn't handle sampler arrays. Instead of
 extending the hack, avoid calling base_alignment in the first place on
 non-UBO uniforms.
 
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89726
 Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
 ---
 
 No regressions in a piglit run. This seems like the right thing to do
 rather than further hacking base_alignment. I was in fix it now!
 mode when I wrote the original logic, getting pretty frustrated at the
 various UBO rules and the number of different places they were being
 implemented inside mesa.
 
 However I think that for uniforms, this is the one and only place. As
 a side-benefit, this means that uniforms will be better packed in the
 presence of structs. And this will hopefully fix a lot of
 glsl_align(0) might happen, wa errors from static checkers.
 
  src/glsl/glsl_types.cpp| 9 -
  src/glsl/link_uniforms.cpp | 4 
  2 files changed, 4 insertions(+), 9 deletions(-)
 
 diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
 index 38b37a6..be87b0a 100644
 --- a/src/glsl/glsl_types.cpp
 +++ b/src/glsl/glsl_types.cpp
 @@ -1077,15 +1077,6 @@ glsl_type::std140_base_alignment(bool row_major) const
return base_alignment;
 }
  
 -   /* A sampler may never occur in a UBO (without bindless of some sort),
 -* however it is convenient to use this alignment function even with
 -* regular uniforms. This allows use of this function on uniform structs
 -* that contain samplers.
 -*/
 -   if (this-is_sampler()) {
 -  return 0;
 -   }
 -
 assert(!not reached);
 return -1;

I will also accept a follow-up patch that replaces this with
unreachable(). :)

  }
 diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
 index 799c74b..59adc29 100644
 --- a/src/glsl/link_uniforms.cpp
 +++ b/src/glsl/link_uniforms.cpp
 @@ -547,6 +547,8 @@ private:
 virtual void enter_record(const glsl_type *type, const char *name,
   bool row_major) {
assert(type-is_record());
 +  if (this-ubo_block_index == -1)
 + return;

Hmm... would deleting the 'else process(var)' block from
parcel_out_uniform_storage::set_and_process achieve the same result?

this-ubo_byte_offset = glsl_align(
  this-ubo_byte_offset, type-std140_base_alignment(row_major));
 }
 @@ -554,6 +556,8 @@ private:
 virtual void leave_record(const glsl_type *type, const char *name,
   bool row_major) {
assert(type-is_record());
 +  if (this-ubo_block_index == -1)
 + return;
this-ubo_byte_offset = glsl_align(
  this-ubo_byte_offset, type-std140_base_alignment(row_major));
 }
 

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


Re: [Mesa-dev] OpenGL ES 3.0 support

2015-03-24 Thread Shervin Sharifi
Thank you Ilia and Rob for your responses.

On Mon, Mar 23, 2015 at 3:39 PM, Rob Clark robdcl...@gmail.com wrote:

 On Mon, Mar 23, 2015 at 3:59 PM, Ilia Mirkin imir...@alum.mit.edu wrote:
  On Mon, Mar 23, 2015 at 3:57 PM, Shervin Sharifi sherv...@gmail.com
 wrote:
  Hi,
 
   I'm new to Mesa and I'm trying to understand the status of OpenGL ES
 3.0
  support in Mesa.
   I'm mainly interested in using llvm-pipe backend (software rendering).
 
  http://people.freedesktop.org/~imirkin/glxinfo/glxinfo.html#p=es
 
  Most modern GPU's (as well as both llvmpipe and softpipe) support ES
  3.0 as well as a number of extensions.

 note that you probably need to rebuild mesa w/ --enable-texture-float

 BR,
 -R

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

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


[Mesa-dev] [PATCH] i965/fs: Use NIR by default for fragment shaders

2015-03-24 Thread Jason Ekstrand
shader-db results for fragment shaders on i965:

   total instructions in shared programs: 2908521 - 2921865 (0.46%)
   instructions in affected programs: 2203215 - 2216559 (0.61%)
   helped:2637
   HURT:  5084

shader-db results for fragment shaders on g4x:

   total instructions in shared programs: 2565728 - 2575036 (0.36%)
   instructions in affected programs: 1798342 - 1807650 (0.52%)
   helped:1693
   HURT:  4822

shader-db results for fragment shaders on Iron Lake:

   total instructions in shared programs: 4081505 - 4099772 (0.45%)
   instructions in affected programs: 2616538 - 2634805 (0.70%)
   helped:1947
   HURT:  8222
   GAINED:817
   LOST:  55

shader-db results for fragment shaders on Sandy Bridge:

   total instructions in shared programs: 5322203 - 5283959 (-0.72%)
   instructions in affected programs: 3121485 - 3083241 (-1.23%)
   helped:8685
   HURT:  6229
   GAINED:147
   LOST:  11

shader-db results for fragment shaders on Ivy Bridge:

   total instructions in shared programs: 4938162 - 4899197 (-0.79%)
   instructions in affected programs: 2845664 - 2806699 (-1.37%)
   helped:8639
   HURT:  5116
   GAINED:145
   LOST:  13

shader-db results for fragment shaders on Bay Trail:

   total instructions in shared programs: 4938162 - 4899197 (-0.79%)
   instructions in affected programs: 2845664 - 2806699 (-1.37%)
   helped:8639
   HURT:  5116
   GAINED:145
   LOST:  13

shader-db results for fragment shaders on Haswell:

   total instructions in shared programs: 4400090 - 4350596 (-1.12%)
   instructions in affected programs: 2536991 - 2487497 (-1.95%)
   helped:9624
   HURT:  4136
   GAINED:145
   LOST:  13

shader-db results for fragment shaders on Broadwell:

   total instructions in shared programs: 4387200 - 4339681 (-1.08%)
   instructions in affected programs: 2479350 - 2431831 (-1.92%)
   helped:9053
   HURT:  4362
   GAINED:92
   LOST:  13
---

The shader-db results reported above are based off the series I sent
yesterday for better handling of ffma.

 src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index a57f501..019bfc7 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3955,7 +3955,7 @@ fs_visitor::run_fs()
* functions called main).
*/
   if (shader) {
- if (env_var_as_boolean(INTEL_USE_NIR, false)) {
+ if (env_var_as_boolean(INTEL_USE_NIR, true)) {
 emit_nir_code();
  } else {
 foreach_in_list(ir_instruction, ir, shader-base.ir) {
-- 
2.3.3

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


Re: [Mesa-dev] [PATCH] glsl: avoid calling base_alignment when samplers are involved

2015-03-24 Thread Ilia Mirkin
On Tue, Mar 24, 2015 at 1:55 PM, Ian Romanick i...@freedesktop.org wrote:
 On 03/23/2015 05:00 AM, Ilia Mirkin wrote:
 diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
 index 799c74b..59adc29 100644
 --- a/src/glsl/link_uniforms.cpp
 +++ b/src/glsl/link_uniforms.cpp
 @@ -547,6 +547,8 @@ private:
 virtual void enter_record(const glsl_type *type, const char *name,
   bool row_major) {
assert(type-is_record());
 +  if (this-ubo_block_index == -1)
 + return;

 Hmm... would deleting the 'else process(var)' block from
 parcel_out_uniform_storage::set_and_process achieve the same result?

It'd achieve a little too much... that would cause none of the
processing to take place afaik for non-UBO's, which means that we also
wouldn't process samplers and images, which are presumably there for a
reason.


this-ubo_byte_offset = glsl_align(
  this-ubo_byte_offset, type-std140_base_alignment(row_major));
 }
 @@ -554,6 +556,8 @@ private:
 virtual void leave_record(const glsl_type *type, const char *name,
   bool row_major) {
assert(type-is_record());
 +  if (this-ubo_block_index == -1)
 + return;
this-ubo_byte_offset = glsl_align(
  this-ubo_byte_offset, type-std140_base_alignment(row_major));
 }


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


Re: [Mesa-dev] [PATCH 2/6] i965/skl: Layout a 1D miptree horizontally

2015-03-24 Thread Anuj Phogat
On Fri, Feb 20, 2015 at 2:31 PM, Neil Roberts n...@linux.intel.com wrote:
 On Gen9+ the 1D miptree is laid out with all of the mipmap levels in a
 horizontal line.
 ---
  src/mesa/drivers/dri/i965/brw_tex_layout.c | 62 
 +-
  1 file changed, 60 insertions(+), 2 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
 b/src/mesa/drivers/dri/i965/brw_tex_layout.c
 index 57922e9..851742b 100644
 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
 +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
 @@ -158,6 +158,36 @@ intel_vertical_texture_alignment_unit(struct brw_context 
 *brw,
  }

  static void
 +gen9_miptree_layout_1d(struct intel_mipmap_tree *mt)
 +{
 +   unsigned x = 0;
 +   unsigned width = mt-physical_width0;
 +   unsigned depth = mt-physical_depth0; /* number of array layers. */
 +
 +   /* When this layout is used the horizontal alignment is fixed at 64 and 
 the
 +* hardware ignores the value given in the surface state
 +*/
 +   const unsigned int align_w = 64;
 +
 +   mt-total_height = mt-physical_height0;
 +   mt-total_width = 0;
 +
 +   for (unsigned level = mt-first_level; level = mt-last_level; level++) {
 +  unsigned img_width;
 +
 +  intel_miptree_set_level_info(mt, level, x, 0, depth);
 +
 +  img_width = ALIGN(width, align_w);
 +
 +  mt-total_width = MAX2(mt-total_width, x + img_width);
 +
 +  x += img_width;
 +
 +  width = minify(width, 1);
 +   }
 +}
 +
 +static void
  brw_miptree_layout_2d(struct intel_mipmap_tree *mt)
  {
 unsigned x = 0;
 @@ -242,12 +272,34 @@ align_cube(struct intel_mipmap_tree *mt)
mt-total_height += 2;
  }

 +static bool
 +use_linear_1d_layout(struct brw_context *brw,
 + struct intel_mipmap_tree *mt)
 +{
 +   /* On Gen9+ the mipmap levels of a 1D surface are all laid out in a
 +* horizontal line. This isn't done for depth/stencil buffers however
 +* because those will be using a tiled layout
 +*/
 +   if (brw-gen = 9 
 +   (mt-target == GL_TEXTURE_1D ||
 +mt-target == GL_TEXTURE_1D_ARRAY)) {
 +  GLenum base_format = _mesa_get_format_base_format(mt-format);
 +
 +  if (base_format != GL_DEPTH_COMPONENT 
 +  base_format != GL_DEPTH_STENCIL)
 base_format != GL_STENCIL_INDEX ?
You missed it or there is a reason to not do this check?
 + return true;
 +   }
 +
 +   return false;
 +}
 +
  static void
  brw_miptree_layout_texture_array(struct brw_context *brw,
  struct intel_mipmap_tree *mt)
  {
 int h0, h1;
 unsigned height = mt-physical_height0;
 +   bool layout_1d = use_linear_1d_layout(brw, mt);

 h0 = ALIGN(mt-physical_height0, mt-align_h);
 h1 = ALIGN(minify(mt-physical_height0, 1), mt-align_h);
 @@ -258,7 +310,10 @@ brw_miptree_layout_texture_array(struct brw_context *brw,

 int physical_qpitch = mt-compressed ? mt-qpitch / 4 : mt-qpitch;

 -   brw_miptree_layout_2d(mt);
 +   if (layout_1d)
 +  gen9_miptree_layout_1d(mt);
 +   else
 +  brw_miptree_layout_2d(mt);

 for (unsigned level = mt-first_level; level = mt-last_level; level++) {
unsigned img_height;
 @@ -392,7 +447,10 @@ brw_miptree_layout(struct brw_context *brw, struct 
 intel_mipmap_tree *mt)
   break;
case INTEL_MSAA_LAYOUT_NONE:
case INTEL_MSAA_LAYOUT_IMS:
 - brw_miptree_layout_2d(mt);
 + if (use_linear_1d_layout(brw, mt))
 +gen9_miptree_layout_1d(mt);
 + else
 +brw_miptree_layout_2d(mt);
   break;
}
break;
 --
 1.9.3

 ___
 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] dri3_glx.c: Pass NULL DRI drawables into driver for None GLX drawables

2015-03-24 Thread Zhang, Xiong Y
 Le 24/03/2015 06:50, Zhang, Xiong Y a écrit :
  You seem to miss the case when one is None and not the other.
  It should return BadDrawable too.
 
  This particular case seems not handled by the dri2 code either, and
  the gallium state tracker seems to handle it in bindContext, but not
  the intel code for example.
  [Zhang, Xiong Y] For this particular case, are you mean this case:
  (draw == None  read != None) || (draw != None  read == None) If it
  is yes, it's better to add this judgement into MakeContextCurrent() in
 src/glx/glxcurrent.c, so that both dri2_glx and dri3_glx could use it.
 
  thanks
 
 Yes.
 
 I imagine putting it into MakeContextCurrent is not a solution, since it means
 GLXBadContext will be returned instead of GLXBadDrawable.

[Zhang, Xiong Y]  Yes, I agree with you.
But it is strange that both macro GLXBadContext and Success are value 0. This 
means we can't identify them in bindContext().
 
 Axel Davy
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri3_glx.c: Pass NULL DRI drawables into driver for None GLX drawables

2015-03-24 Thread Axel Davy

On 24/03/2015 08:33, Zhang, Xiong Y wrote :


Yes.

I imagine putting it into MakeContextCurrent is not a solution, since it means
GLXBadContext will be returned instead of GLXBadDrawable.

[Zhang, Xiong Y]  Yes, I agree with you.
But it is strange that both macro GLXBadContext and Success are value 0. This 
means we can't identify them in bindContext().


Good point, also the function is BOOL, and GLXBadDrawable worths two...

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


Re: [Mesa-dev] [PATCH] clover: Return CL_BUILD_ERROR for CL_PROGRAM_BUILD_STATUS when compilation fails

2015-03-24 Thread Jan Vesely
On Tue, 2015-03-24 at 22:36 +0200, Francisco Jerez wrote:
 Jan Vesely jan.ves...@rutgers.edu writes:
 
  On Tue, 2015-03-24 at 22:24 +0200, Francisco Jerez wrote:
  Tom Stellard thomas.stell...@amd.com writes:
  
   Cc: 10.5 10.4 mesa-sta...@lists.freedesktop.org
   ---
src/gallium/state_trackers/clover/core/program.cpp | 6 +-
src/gallium/state_trackers/clover/core/program.hpp | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
  
   diff --git a/src/gallium/state_trackers/clover/core/program.cpp 
   b/src/gallium/state_trackers/clover/core/program.cpp
   index 8553ca7..06a6d92 100644
   --- a/src/gallium/state_trackers/clover/core/program.cpp
   +++ b/src/gallium/state_trackers/clover/core/program.cpp
   @@ -49,6 +49,7 @@ program::build(const ref_vectordevice devs, const 
   char *opts,
 _binaries.erase(dev);
 _logs.erase(dev);
 _opts.erase(dev);
   + _errs.erase(dev);

 _opts.insert({ dev, opts });

   @@ -65,6 +66,7 @@ program::build(const ref_vectordevice devs, const 
   char *opts,
_logs.insert({ dev, log });
 } catch (const build_error ) {
_logs.insert({ dev, log });
   +_errs.insert(dev);
throw;
 }
  }
   @@ -88,7 +90,9 @@ program::binary(const device dev) const {

cl_build_status
program::build_status(const device dev) const {
   -   if (_binaries.count(dev))
   +   if (_errs.count(dev))
   +  return CL_BUILD_ERROR;
   +   else if (_binaries.count(dev))
  return CL_BUILD_SUCCESS;
   else
  return CL_BUILD_NONE;
  
  Any reason you couldn't do something like:
  
  |   if (_binaries.count(dev))
  |  return CL_BUILD_SUCCESS;
  |   else if (_log.count(dev))
  |  return CL_BUILD_ERROR;
  |   else
  |  return CL_BUILD_NONE;
  
 
  Wouldn't this return error even if only warnings are produced?
 
 No, warnings alone wouldn't cause _binaries.count(dev) to be zero.

ah right, missed that part.
thanks

 
  
   diff --git a/src/gallium/state_trackers/clover/core/program.hpp 
   b/src/gallium/state_trackers/clover/core/program.hpp
   index 661fa03..8c90199 100644
   --- a/src/gallium/state_trackers/clover/core/program.hpp
   +++ b/src/gallium/state_trackers/clover/core/program.hpp
   @@ -73,6 +73,7 @@ namespace clover {
  std::mapconst device *, module _binaries;
  std::mapconst device *, std::string _logs;
  std::mapconst device *, std::string _opts;
   +  std::setconst device * _errs;
  std::string _source;
  ref_counter _kernel_ref_counter;
   };
   -- 
   2.0.4
  ___
  mesa-dev mailing list
  mesa-dev@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 
  -- 
  Jan Vesely jan.ves...@rutgers.edu

-- 
Jan Vesely jan.ves...@rutgers.edu


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 18.1/23] glsl: Add is_rvalue, is_dereference, and is_jump methods

2015-03-24 Thread Matt Turner
On Tue, Mar 24, 2015 at 11:25 AM, Ian Romanick i...@freedesktop.org wrote:
 From: Ian Romanick ian.d.roman...@intel.com

 These functions deteremine when an IR node is one of the non-leaf
 classes.

 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 Cc: Francisco Jerez curroje...@riseup.net
 ---
  src/glsl/ir.h | 25 +
  1 file changed, 25 insertions(+)

 diff --git a/src/glsl/ir.h b/src/glsl/ir.h
 index fdc22ed..b2b4822 100644
 --- a/src/glsl/ir.h
 +++ b/src/glsl/ir.h
 @@ -109,6 +109,31 @@ public:
 virtual ir_instruction *clone(void *mem_ctx,
  struct hash_table *ht) const = 0;

 +   bool is_rvalue() const
 +   {
 +  return ir_type == ir_type_dereference_array ||
 + ir_type == ir_type_dereference_record ||
 + ir_type == ir_type_dereference_variable ||
 + ir_type == ir_type_constant ||
 + ir_type == ir_type_expression ||
 + ir_type == ir_type_swizzle ||
 + ir_type == ir_type_texture;
 +   }
 +
 +   bool is_dereference() const
 +   {
 +  return ir_type == ir_type_dereference_array ||
 + ir_type == ir_type_dereference_record ||
 + ir_type == ir_type_dereference_variable;
 +   }
 +
 +   bool is_jump() const
 +   {
 +  return ir_type == ir_type_loop_jump ||
 + ir_type == ir_type_return ||
 + ir_type == ir_type_discard;

Indent these expressions to line up with the first one after the return.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/8] scons: Don't build egl on Windows.

2015-03-24 Thread Jose Fonseca
Useless, as there are no drivers for it.
---
 src/SConscript   |  2 +-
 src/egl/main/Makefile.am |  1 -
 src/egl/main/SConscript  | 11 +--
 3 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/SConscript b/src/SConscript
index 188ab08..40b7fc1 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -30,7 +30,7 @@ SConscript('mesa/SConscript')
 if not env['embedded']:
 if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 
'windows'):
 SConscript('glx/SConscript')
-if env['platform'] not in ['darwin', 'haiku', 'sunos']:
+if env['platform'] not in ['darwin', 'haiku', 'sunos', 'windows']:
 if env['dri']:
 SConscript('egl/drivers/dri2/SConscript')
 SConscript('egl/main/SConscript')
diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
index 893ad26..b661736 100644
--- a/src/egl/main/Makefile.am
+++ b/src/egl/main/Makefile.am
@@ -26,7 +26,6 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/gbm/main \
$(DEFINES) \
$(VISIBILITY_CFLAGS) \
-   $(MSVC2013_COMPAT_CFLAGS) \
$(EGL_CFLAGS) \
-D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
-D_EGL_DRIVER_SEARCH_DIR=\$(libdir)/egl\ \
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index b4e9b67..c001283 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -6,20 +6,11 @@ Import('*')
 
 env = env.Clone()
 
-env.MSVC2013Compat()
-
 env.Append(CPPDEFINES = [
 '_EGL_DRIVER_SEARCH_DIR=',
 ])
 
-if env['platform'] == 'windows':
-env.Append(CPPDEFINES = [
-'_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
-'_EGL_OS_WINDOWS',
-'_EGL_GET_CORE_ADDRESSES',
-'KHRONOS_DLL_EXPORTS',
-])
-elif env['platform'] == 'haiku':
+if env['platform'] == 'haiku':
 env.Append(CPPDEFINES = [
 '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_HAIKU',
 '_EGL_OS_UNIX',
-- 
2.1.0

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


[Mesa-dev] [PATCH 6/8] mesa: Avoid MSVC C6334 warning in /analyze mode.

2015-03-24 Thread Jose Fonseca
MSVC's implementation of signbit(x) uses sizeof(x) with expressions to
dispatch to an internal function based on the argument's type (float,
double, etc), but that raises a flag with MSVC's own static analyzer,
and because this is an inline function in a header it causes substantial
warning spam.
---
 src/mesa/main/macros.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 2d7a6a1..3344ec8 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -789,7 +789,14 @@ NORMALIZE_3FV(GLfloat v[3])
 static inline GLboolean
 DIFFERENT_SIGNS(GLfloat x, GLfloat y)
 {
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable : 6334 ) /* sizeof operator applied to an expression 
with an operator may yield unexpected results */
+#endif
return signbit(x) != signbit(y);
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
 }
 
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 5/8] c99_math: Don't reimplement lrint and friends on MSVC 2013.

2015-03-24 Thread Jose Fonseca
MSVC 2013 declares these functions, both for C and C++ source files.

This was caught with MSVC in analyze mode.
---
 include/c99_math.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/c99_math.h b/include/c99_math.h
index 5b01d53..ee0dd10 100644
--- a/include/c99_math.h
+++ b/include/c99_math.h
@@ -82,7 +82,8 @@ roundf(float x)
 #endif /* _MSC_VER */
 
 
-#if __STDC_VERSION__  199901L  (!defined(__cplusplus) || defined(_MSC_VER))
+#if (defined(_MSC_VER)  _MSC_VER  1800) || \
+(!defined(_MSC_VER)  __STDC_VERSION__  199901L  !defined(__cplusplus))
 static inline long int
 lrint(double d)
 {
-- 
2.1.0

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


[Mesa-dev] [PATCH 4/8] scons: Don't build osmesa.

2015-03-24 Thread Jose Fonseca
There doesn't seem much interest on osmesa on Windows, particularly classic 
osmesa.

If there is indeed interest in osmesa on Windows, we should instead
integrate src/gallium/targets/osmesa into SCons.
---
 src/mesa/drivers/SConscript|  2 --
 src/mesa/drivers/osmesa/SConscript | 39 --
 src/mesa/drivers/osmesa/osmesa.def | 15 ---
 3 files changed, 56 deletions(-)
 delete mode 100644 src/mesa/drivers/osmesa/SConscript
 delete mode 100644 src/mesa/drivers/osmesa/osmesa.def

diff --git a/src/mesa/drivers/SConscript b/src/mesa/drivers/SConscript
index 17813da..db65678 100644
--- a/src/mesa/drivers/SConscript
+++ b/src/mesa/drivers/SConscript
@@ -1,7 +1,5 @@
 Import('*')
 
-SConscript('osmesa/SConscript')
-
 if env['x11']:
 SConscript('x11/SConscript')
 
diff --git a/src/mesa/drivers/osmesa/SConscript 
b/src/mesa/drivers/osmesa/SConscript
deleted file mode 100644
index caa14d3..000
--- a/src/mesa/drivers/osmesa/SConscript
+++ /dev/null
@@ -1,39 +0,0 @@
-Import('*')
-
-env = env.Clone()
-
-env.Prepend(CPPPATH = [
-'#src',
-'#src/mapi',
-'#src/mesa',
-Dir('../../../mapi'), # src/mapi build path for python-generated GL API 
files/headers
-])
-
-env.Prepend(LIBS = [
-mesautil,
-glapi,
-mesa,
-glsl,
-])
-
-sources = [
-'osmesa.c',
-]
-
-if env['platform'] == 'windows':
-env.AppendUnique(CPPDEFINES = [
-'_GDI32_', # prevent wgl* being declared __declspec(dllimport)
-'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers 
-])
-if not env['gles']:
-# prevent _glapi_* from being declared __declspec(dllimport)
-env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
-
-sources += ['osmesa.def']
-
-osmesa = env.SharedLibrary(
-target ='osmesa',
-source = sources,
-)
-
-env.Alias('osmesa', osmesa)
diff --git a/src/mesa/drivers/osmesa/osmesa.def 
b/src/mesa/drivers/osmesa/osmesa.def
deleted file mode 100644
index 06afab7..000
--- a/src/mesa/drivers/osmesa/osmesa.def
+++ /dev/null
@@ -1,15 +0,0 @@
-;DESCRIPTION 'Mesa OSMesa lib for Win32'
-VERSION 4.1
-
-EXPORTS
-   OSMesaColorClamp
-   OSMesaCreateContext
-   OSMesaCreateContextExt
-   OSMesaDestroyContext
-   OSMesaMakeCurrent
-   OSMesaGetCurrentContext
-   OSMesaPixelStore
-   OSMesaGetIntegerv
-   OSMesaGetDepthBuffer
-   OSMesaGetColorBuffer
-   OSMesaGetProcAddress
-- 
2.1.0

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


[Mesa-dev] [PATCH 7/8] scons: Disable MSVC warnings about inconsistent function annotation.

2015-03-24 Thread Jose Fonseca
Somehow, merely including any of the *intrin.h headers causes dozens of
this warnings (when compiling pretty much every source file).  MSVC does
not always complain the same -- so it's possible we're doing something
weird --, but silence these warnings in the meanwhile.
---
 scons/gallium.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scons/gallium.py b/scons/gallium.py
index efc65e7..51b84d7 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -549,6 +549,7 @@ def generate(env):
 env.Append(CCFLAGS = [
 '/analyze',
 #'/analyze:log', '${TARGET.base}.xml',
+'/wd28251', # Inconsistent annotation for function
 ])
 if env['clang']:
 # scan-build will produce more comprehensive output
-- 
2.1.0

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


[Mesa-dev] [PATCH 1/8] scons: Fix git_sha1.h generation fallback.

2015-03-24 Thread Jose Fonseca
I didn't meant to remove the 'if not os.path.exists(filename)' statement.
---
 src/mesa/SConscript | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index a563fd2..5b80a21 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -130,9 +130,10 @@ def write_git_sha1_h_file(filename):
 (commit, foo) = subprocess.Popen(args, 
stdout=subprocess.PIPE).communicate()
 except:
 # git log command didn't work
-dirname = os.path.dirname(filename)
-if not os.path.exists(dirname):
-os.makedirs(dirname)
+if not os.path.exists(filename):
+dirname = os.path.dirname(filename)
+if not os.path.exists(dirname):
+os.makedirs(dirname)
 # create an empty file if none already exists
 f = open(filename, w)
 f.close()
-- 
2.1.0

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


[Mesa-dev] [PATCH 3/8] scons: Don't build loader on Windows.

2015-03-24 Thread Jose Fonseca
EGL was the last user.
---
 src/SConscript | 3 ++-
 src/loader/Makefile.am | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/SConscript b/src/SConscript
index 40b7fc1..b0578e8 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -12,7 +12,8 @@ if env['hostonly']:
 # compilation
 Return()
 
-SConscript('loader/SConscript')
+if env['platform'] != 'windows':
+SConscript('loader/SConscript')
 
 # When env['gles'] is set, the targets defined in mapi/glapi/SConscript are not
 # used.  libgl-xlib and libgl-gdi adapt themselves to use the targets defined
diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am
index 3d32279..36ddba8 100644
--- a/src/loader/Makefile.am
+++ b/src/loader/Makefile.am
@@ -30,7 +30,6 @@ libloader_la_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
$(VISIBILITY_CFLAGS) \
-   $(MSVC2013_COMPAT_CFLAGS) \
$(LIBUDEV_CFLAGS)
 
 libloader_la_SOURCES = $(LOADER_C_FILES)
-- 
2.1.0

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


[Mesa-dev] [PATCH 8/8] util/u_atomic: Ignore warnings interlocked accesses.

2015-03-24 Thread Jose Fonseca
These are due how we implemented the atomic tests, not the atomic
implementation itself.  It's also difficult to refactor the code to
avoid the warnings due to the use of macros -- the code would be quite
hairy.
---
 src/util/u_atomic_test.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/util/u_atomic_test.c b/src/util/u_atomic_test.c
index 939cfe4..7844f61 100644
--- a/src/util/u_atomic_test.c
+++ b/src/util/u_atomic_test.c
@@ -36,6 +36,11 @@
 
 #include u_atomic.h
 
+#ifdef _MSC_VER
+#pragma warning( disable : 28112 ) /* Accessing a local variable via an 
Interlocked function */
+#pragma warning( disable : 28113 ) /* A variable which is accessed via an 
Interlocked function must always be accessed via an Interlocked function */
+#endif
+
 
 /* Test only assignment-like operations, which are supported on all types */
 #define test_atomic_assign(type, ones) \
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH 18.1/23] glsl: Add is_rvalue, is_dereference, and is_jump methods

2015-03-24 Thread Ian Romanick
On 03/24/2015 02:14 PM, Matt Turner wrote:
 On Tue, Mar 24, 2015 at 11:25 AM, Ian Romanick i...@freedesktop.org wrote:
 From: Ian Romanick ian.d.roman...@intel.com

 These functions deteremine when an IR node is one of the non-leaf
 classes.

 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 Cc: Francisco Jerez curroje...@riseup.net
 ---
  src/glsl/ir.h | 25 +
  1 file changed, 25 insertions(+)

 diff --git a/src/glsl/ir.h b/src/glsl/ir.h
 index fdc22ed..b2b4822 100644
 --- a/src/glsl/ir.h
 +++ b/src/glsl/ir.h
 @@ -109,6 +109,31 @@ public:
 virtual ir_instruction *clone(void *mem_ctx,
  struct hash_table *ht) const = 0;

 +   bool is_rvalue() const
 +   {
 +  return ir_type == ir_type_dereference_array ||
 + ir_type == ir_type_dereference_record ||
 + ir_type == ir_type_dereference_variable ||
 + ir_type == ir_type_constant ||
 + ir_type == ir_type_expression ||
 + ir_type == ir_type_swizzle ||
 + ir_type == ir_type_texture;
 +   }
 +
 +   bool is_dereference() const
 +   {
 +  return ir_type == ir_type_dereference_array ||
 + ir_type == ir_type_dereference_record ||
 + ir_type == ir_type_dereference_variable;
 +   }
 +
 +   bool is_jump() const
 +   {
 +  return ir_type == ir_type_loop_jump ||
 + ir_type == ir_type_return ||
 + ir_type == ir_type_discard;
 
 Indent these expressions to line up with the first one after the return.

By any chance... Do you know a way to get emacs to do that automatically
without putting extra parenthesis around the whole expression?

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