Re: [Mesa-dev] [PATCH 3/3] glsl: Reassociate multiplication of mat*mat*vec.

2015-03-28 Thread Chris Forbes
For the series:

Reviewed-by: Chris Forbes 

On Sat, Mar 28, 2015 at 5:22 PM, Matt Turner  wrote:
> The typical case of mat4*mat4*vec4 is 80 scalar multiplications, but
> mat4*(mat4*vec4) is only 32.
>
> On HSW (with vec4 vertex shaders):
> instructions in affected programs: 4420 -> 3194 (-27.74%)
>
> On BDW (with scalar vertex shaders):
> instructions in affected programs: 12756 -> 6726 (-47.27%)
>
> Implementing a general matrix chain ordering is harder (or at least
> tedious) because of having to walk the GLSL IR to create a list of
> multiplicands. I'm guessing that this patch handles 90+% of cases, but
> of course to tell definitively you'd have to implement the general
> thing.
> ---
>  src/glsl/opt_algebraic.cpp | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
> index 98c852a..a940d2f 100644
> --- a/src/glsl/opt_algebraic.cpp
> +++ b/src/glsl/opt_algebraic.cpp
> @@ -290,6 +290,20 @@ ir_algebraic_visitor::handle_expression(ir_expression 
> *ir)
> ir_expression *op_expr[4] = {NULL, NULL, NULL, NULL};
> unsigned int i;
>
> +   if (ir->operation == ir_binop_mul &&
> +   ir->operands[0]->type->is_matrix() &&
> +   ir->operands[1]->type->is_vector()) {
> +  ir_expression *matrix_mul = ir->operands[0]->as_expression();
> +
> +  if (matrix_mul && matrix_mul->operation == ir_binop_mul &&
> + matrix_mul->operands[0]->type->is_matrix() &&
> + matrix_mul->operands[1]->type->is_matrix()) {
> +
> + return mul(matrix_mul->operands[0],
> +mul(matrix_mul->operands[1], ir->operands[1]));
> +  }
> +   }
> +
> assert(ir->get_num_operands() <= 4);
> for (i = 0; i < ir->get_num_operands(); i++) {
>if (ir->operands[i]->type->is_matrix())
> --
> 2.0.5
>
> ___
> 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] nir: Fix copy and pasted error message in nir_validate.

2015-03-28 Thread Jason Ekstrand
On Mar 27, 2015 11:34 PM, "Ilia Mirkin"  wrote:
>
> On Sat, Mar 28, 2015 at 12:23 AM, Kenneth Graunke 
wrote:
> > These are nir_cf_nodes, not ALU instructions.
> > Also, use unreachable() to preempt said review feedback.
> >
> > Signed-off-by: Kenneth Graunke 
> > ---
> >  src/glsl/nir/nir_validate.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c
> > index f247ae0..79c23db 100644
> > --- a/src/glsl/nir/nir_validate.c
> > +++ b/src/glsl/nir/nir_validate.c
> > @@ -680,7 +680,7 @@ validate_cf_node(nir_cf_node *node, validate_state
*state)
> >break;
> >
> > default:
> > -  assert(!"Invalid ALU instruction type");
> > +  unreachable(!"Invalid CF node type");
>
> unreachable just takes a str, not a condition passed through to an assert.
>
> >break;
>
> should probably remove the break while you're at it.

Yes on both.  With that,
Reviewed-by: Jason Ekstrand 

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


[Mesa-dev] GL_TEXTURE_2D to wl_buffer

2015-03-28 Thread x414e54
I am attempting to pass a GL_TEXTURE_2D directly to a Wayland compositor by
first converting it so an EGLImageKHR and then to a wl_buffer.

eglCreateImageKHR appears to work fine but when calling
glCreateWaylandBufferFromImageWL I get EGL_BAD_MATCH "unsupported image
format".

The GL_TEXTURE_2D is in GL_RGBA format.

Is this going to be possible or should I look for an alternative way?


I was originally blitting the texture to the default framebuffer and then
trying to use eglSwapBuffers. But for some reason eglSwapBuffers was
returning EGL_BAD_SURFACE even though eglMakeCurrent had no errors.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] GL_TEXTURE_2D to wl_buffer

2015-03-28 Thread Axel Davy

GL_RGBA should corresponds to ABGR.

Try GL_BGRA, which is ARGB.

Note: Actually it is possible intel vs gallium drivers GL_RGBA and 
GL_BGRA have different argb ordering. So perhaps try both so that all 
drivers are happy.


Le 28/03/2015 14:57, x414e54 a écrit :
I am attempting to pass a GL_TEXTURE_2D directly to a Wayland 
compositor by first converting it so an EGLImageKHR and then to a 
wl_buffer.


eglCreateImageKHR appears to work fine but when calling 
glCreateWaylandBufferFromImageWL I get EGL_BAD_MATCH "unsupported 
image format".


The GL_TEXTURE_2D is in GL_RGBA format.

Is this going to be possible or should I look for an alternative way?


I was originally blitting the texture to the default framebuffer and 
then trying to use eglSwapBuffers. But for some reason eglSwapBuffers 
was returning EGL_BAD_SURFACE even though eglMakeCurrent had no errors.



___
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 14/23] main: Refactor MapBuffer[Range].

2015-03-28 Thread Ilia Mirkin
On Wed, Feb 11, 2015 at 9:05 PM, Laura Ekstrand  wrote:
> if (offset + length > bufObj->Size) {
>_mesa_error(ctx, GL_INVALID_VALUE,
> -  "glMapBufferRange(offset + length > size)");
> +  "%s(offset %d + length %d > buffer_size %d)", func,
> +  (int) offset, (int) length, (int) bufObj->Size);
>return NULL;
> }

I now get the following warning (on 32-bit ARM, but presumably 32-bit
x86 or even x32 would be the same thing):

main/bufferobj.c: In function '_mesa_map_buffer_range':
main/bufferobj.c:2340:19: warning: format '%ld' expects argument of
type 'long int', but argument 5 has type 'GLintptr' [-Wformat=]
   offset, length, bufObj->Size);
   ^
main/bufferobj.c:2340:19: warning: format '%ld' expects argument of
type 'long int', but argument 6 has type 'GLsizeiptr' [-Wformat=]
main/bufferobj.c:2340:19: warning: format '%ld' expects argument of
type 'long int', but argument 7 has type 'GLsizeiptrARB' [-Wformat=]

There's a %zu which might be old enough by now to work everywhere
(iirc it didn't exist in like GCC 2.95, but those days are thankfully
behind us). If not, there are the PRIuS style macros...

Looks like http://src.chromium.org/svn/trunk/src/base/format_macros.h does

#ifdef OS_POSIX

#if !defined(PRIuS)
#define PRIuS "zu"
#endif

#else /* OS_WIN */

#if !defined(PRIuS)
#define PRIuS "Iu"
#endif

#endif

Perhaps we could adapt something like that. Or perhaps there's an
existing way of dealing with such annoyances, like casting.

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


[Mesa-dev] [PATCH] mesa/state_tracker: Fix draw-pixel-with-texture piglit test.

2015-03-28 Thread Matthew Dawson
When glDrawPixels was used with an external texture, the pixels passed in
were sampled instead of the texture.  Change gallium to instead move the user
texture to a new sampler below the glDrawPixels samplers and use the texture
coordinates from the raster position.

This uses a uniform for the texture coordinates instead passing it through
the vertex shader as the texture coordinates are constant for the entire
operation.  While working the vertex shader would be possible, implementing
that solution would break several assumptions throughout the glDrawPixels
implementation as well as helper functions used by other code paths, increasing
the chance for breakage.

Tested on llvmpipe, r600, and radeonsi.

V2: Complete everything missing from V1.

v3:
 - Fix style issues.
 - Add comments about how the texture references are fixed up to be valid.
---
 src/mesa/state_tracker/st_cb_drawpixels.c  | 39 ++---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 40 ++
 2 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c 
b/src/mesa/state_tracker/st_cb_drawpixels.c
index 3edf31b..47abd16 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -44,6 +44,7 @@
 #include "main/texstore.h"
 #include "main/glformats.h"
 #include "program/program.h"
+#include "program/prog_parameter.h"
 #include "program/prog_print.h"
 #include "program/prog_instruction.h"
 
@@ -676,6 +677,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint 
y, GLfloat z,
GLfloat x0, y0, x1, y1;
GLsizei maxSize;
boolean normalized = sv[0]->texture->target != PIPE_TEXTURE_RECT;
+   GLuint num_user_samplers = st->state.num_samplers[PIPE_SHADER_FRAGMENT];
+   unsigned int i;
 
/* limit checks */
/* XXX if DrawPixels image is larger than max texture size, break
@@ -765,6 +768,10 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint 
y, GLfloat z,
   if (num_sampler_view > 1) {
  cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, 1, &sampler);
   }
+  for (i = 0; i < num_user_samplers; ++i) {
+ cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, i+num_sampler_view,
+&st->state.samplers[PIPE_SHADER_FRAGMENT][i]);
+  }
   cso_single_sampler_done(cso, PIPE_SHADER_FRAGMENT);
}
 
@@ -786,7 +793,14 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint 
y, GLfloat z,
cso_set_stream_outputs(st->cso_context, 0, NULL, NULL);
 
/* texture state: */
-   cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num_sampler_view, sv);
+   {
+  struct pipe_sampler_view *lsv[PIPE_MAX_SAMPLERS];
+  memcpy(lsv, sv, num_sampler_view*sizeof(struct pipe_sampler_view*));
+  memcpy(lsv+num_sampler_view, 
st->state.sampler_views[PIPE_SHADER_FRAGMENT],
+ num_user_samplers*sizeof(struct pipe_sampler_view*));
+  cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT,
+num_sampler_view+num_user_samplers, lsv);
+   }
 
/* Compute Gallium window coords (y=0=top) with pixel zoom.
 * Recall that these coords are transformed by the current
@@ -1160,8 +1174,27 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
   }
}
 
-   /* update fragment program constants */
-   st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT);
+   /* updated texture coordinates and fragment program constants. */
+   {
+  int i;
+  struct gl_program_parameter_list *parameters = fpv->parameters;
+  /* Update the texture coordinates from all the used texture units, using
+   * the values associated with the raster position */
+  for (i = 0; i < parameters->NumParameters; ++i) {
+ const char *name = parameters->Parameters[i].Name;
+ /* Any texture coordinate will use the parameter name texcoord_, where
+  * _ is the texture units id added to the ascii character 'A'.  This
+  * checks if a parameter matches this patterns, and updates the
+  * parameter's value with the appropriate raster position texture
+  * coordinate. */
+ if (strncmp("texcoord", name, 8) == 0 && strlen(name) == 9) {
+memcpy(parameters->ParameterValues[i],
+   st->ctx->Current.RasterTexCoords[name[8] - 'A'],
+   sizeof(GL_FLOAT) * 4);
+ }
+  }
+  st_upload_constants(st, parameters, PIPE_SHADER_FRAGMENT);
+   }
 
/* draw with textured quad */
{
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e97ab83..b2f6e6e 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4256,6 +4256,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp,
st_src_reg coord, src0;
st_dst_reg dst0;
glsl_to_tgsi_instruction *inst;
+   unsigned int count_samplers_used = 0;
 
/* Copy 

Re: [Mesa-dev] [PATCH 3/3] glsl: Reassociate multiplication of mat*mat*vec.

2015-03-28 Thread Jason Ekstrand
On Fri, Mar 27, 2015 at 9:22 PM, Matt Turner  wrote:
> The typical case of mat4*mat4*vec4 is 80 scalar multiplications, but
> mat4*(mat4*vec4) is only 32.
>
> On HSW (with vec4 vertex shaders):
> instructions in affected programs: 4420 -> 3194 (-27.74%)
>
> On BDW (with scalar vertex shaders):
> instructions in affected programs: 12756 -> 6726 (-47.27%)

Do you have any actual benchmark results with something that's
affected?  That would be nice to know.
--Jason

> Implementing a general matrix chain ordering is harder (or at least
> tedious) because of having to walk the GLSL IR to create a list of
> multiplicands. I'm guessing that this patch handles 90+% of cases, but
> of course to tell definitively you'd have to implement the general
> thing.
> ---
>  src/glsl/opt_algebraic.cpp | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
> index 98c852a..a940d2f 100644
> --- a/src/glsl/opt_algebraic.cpp
> +++ b/src/glsl/opt_algebraic.cpp
> @@ -290,6 +290,20 @@ ir_algebraic_visitor::handle_expression(ir_expression 
> *ir)
> ir_expression *op_expr[4] = {NULL, NULL, NULL, NULL};
> unsigned int i;
>
> +   if (ir->operation == ir_binop_mul &&
> +   ir->operands[0]->type->is_matrix() &&
> +   ir->operands[1]->type->is_vector()) {
> +  ir_expression *matrix_mul = ir->operands[0]->as_expression();
> +
> +  if (matrix_mul && matrix_mul->operation == ir_binop_mul &&
> + matrix_mul->operands[0]->type->is_matrix() &&
> + matrix_mul->operands[1]->type->is_matrix()) {
> +
> + return mul(matrix_mul->operands[0],
> +mul(matrix_mul->operands[1], ir->operands[1]));
> +  }
> +   }
> +
> assert(ir->get_num_operands() <= 4);
> for (i = 0; i < ir->get_num_operands(); i++) {
>if (ir->operands[i]->type->is_matrix())
> --
> 2.0.5
>
> ___
> 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] Mesa 10.5.2

2015-03-28 Thread Emil Velikov
Mesa 10.5.2 is now available. This release addresses bugs in the common glsl 
code-base, the libGL and glapi libraries, and the dri modules. The tarball no 
longer contains hardlinks and has all the haiku files. With this release one 
can build mesa without the need of python and mako.


Anuj Phogat (1):
  glsl: Generate link error for non-matching gl_FragCoord redeclarations

Emil Velikov (8):
  docs: Add sha256 sums for the 10.5.1 release
  automake: add missing egl files to the tarball
  st/egl: don't ship the dri2.c link at the tarball
  loader: include  for non-sysfs builds
  auxiliary/os: fix the android build - s/drm_munmap/os_munmap/
  cherry-ignore: add commit non applicable for 10.5
  Update version to 10.5.2
  Add release notes for the 10.5.2 release

Felix Janda (1):
  c11/threads: Use PTHREAD_MUTEX_RECURSIVE by default

Francisco Jerez (1):
  i965: Set nr_params to the number of uniform components in the VS/GS path.

Ilia Mirkin (2):
  freedreno/a3xx: use the same layer size for all slices
  freedreno: fix slice pitch calculations

Marek Olšák (1):
  radeonsi: increase coords array size for 
radeon_llvm_emit_prepare_cube_coords

Mario Kleiner (2):
  glx: Handle out-of-sequence swap completion events correctly. (v2)
  mapi: Make private copies of name strings provided by client.

Rob Clark (1):
  freedreno: update generated headers

Samuel Iglesias Gonsalvez (2):
  glsl: optimize (0 cmp x + y) into (-x cmp y).
  configure: Introduce new output variable to ax_check_python_mako_module.m4

Tapani Pälli (1):
  glsl: fix names in lower_constant_arrays_to_uniforms

Tom Stellard (1):
  clover: Return 0 as storage size for local kernel args that are not set v2


git tag: mesa-10.5.2

ftp://ftp.freedesktop.org/pub/mesa/10.5.2/mesa-10.5.2.tar.gz
MD5: 5cbf3eacae8aba77e69ce32ff4738657  mesa-10.5.2.tar.gz
SHA1: b8a222a8b03e1eae0216ec2bc269f133c939f3c4  mesa-10.5.2.tar.gz
SHA256: 755220e160a9f22fda0dffd47746f997b6e196d03f8edc390df7793aecaaa541 
mesa-10.5.2.tar.gz
PGP: ftp://ftp.freedesktop.org/pub/mesa/10.5.2/mesa-10.5.2.tar.gz.sig


ftp://ftp.freedesktop.org/pub/mesa/10.5.2/mesa-10.5.2.tar.xz
MD5: 528b3b0c0ff330766b9788da04a9fabd  mesa-10.5.2.tar.xz
SHA1: e5659207105531385454e6fa08a1c3cf46a2ce95  mesa-10.5.2.tar.xz
SHA256: 2f4b6fb77c3e7d6f861558d0884a3073f575e1e673dad8d1b0624e78e9c4dd44 
mesa-10.5.2.tar.xz
PGP: ftp://ftp.freedesktop.org/pub/mesa/10.5.2/mesa-10.5.2.tar.xz.sig

--
-Emil




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


[Mesa-dev] [PATCH] gallivm: simplify sampler interface

2015-03-28 Thread sroland
From: Roland Scheidegger 

This has got a bit out of control with more and more parameters added.
Worse, whenever something in there changes all callees have to be updated
for that, even though they don't really do much with any parameter in there
except pass it on to the actual sampling function.
Hence simply put almost everything into a struct. Also instead of relying
on some arguments being NULL, be explicit and set this in a key (which is
just reused for function generation for simplicity). (The code still relies
on them being NULL in the end for now.)
Technically there is a minimal functional change here for shadow sampling:
if shadow sampling is done is now determined explicitly by the texture
function (either sample_c or the gl-style tex func inherit this from target)
instead of the static texture state. These two should always match, however.
Otherwise, it should generate all the same code.
---
 src/gallium/auxiliary/draw/draw_llvm_sample.c |  31 +--
 src/gallium/auxiliary/gallivm/lp_bld_sample.h |  48 +++--
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 227 +-
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h   |  17 +-
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c   | 133 +++--
 src/gallium/drivers/llvmpipe/lp_tex_sample.c  |  33 +---
 6 files changed, 218 insertions(+), 271 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c 
b/src/gallium/auxiliary/draw/draw_llvm_sample.c
index 16d075c..32cad59 100644
--- a/src/gallium/auxiliary/draw/draw_llvm_sample.c
+++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c
@@ -229,38 +229,19 @@ draw_llvm_sampler_soa_destroy(struct lp_build_sampler_soa 
*sampler)
 static void
 draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
struct gallivm_state *gallivm,
-   struct lp_type type,
-   boolean is_fetch,
-   unsigned texture_index,
-   unsigned sampler_index,
-   LLVMValueRef context_ptr,
-   const LLVMValueRef *coords,
-   const LLVMValueRef *offsets,
-   const struct lp_derivatives *derivs,
-   LLVMValueRef lod_bias, /* optional */
-   LLVMValueRef explicit_lod, /* optional 
*/
-   enum lp_sampler_lod_property 
lod_property,
-   LLVMValueRef *texel)
+   const struct lp_sampler_params *params)
 {
struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa 
*)base;
+   unsigned texture_index = params->texture_index;
+   unsigned sampler_index = params->sampler_index;
 
assert(texture_index < PIPE_MAX_SHADER_SAMPLER_VIEWS);
assert(sampler_index < PIPE_MAX_SAMPLERS);
 
-   lp_build_sample_soa(gallivm,
-   
&sampler->dynamic_state.static_state[texture_index].texture_state,
+   
lp_build_sample_soa(&sampler->dynamic_state.static_state[texture_index].texture_state,

&sampler->dynamic_state.static_state[sampler_index].sampler_state,
&sampler->dynamic_state.base,
-   type,
-   is_fetch,
-   texture_index,
-   sampler_index,
-   context_ptr,
-   coords,
-   offsets,
-   derivs,
-   lod_bias, explicit_lod, lod_property,
-   texel);
+   gallivm, params);
 }
 
 
@@ -306,7 +287,7 @@ draw_llvm_sampler_soa_create(const struct 
draw_sampler_static_state *static_stat
   return NULL;
 
sampler->base.destroy = draw_llvm_sampler_soa_destroy;
-   sampler->base.emit_fetch_texel = draw_llvm_sampler_soa_emit_fetch_texel;
+   sampler->base.emit_tex_sample = draw_llvm_sampler_soa_emit_fetch_texel;
sampler->base.emit_size_query = draw_llvm_sampler_soa_emit_size_query;
sampler->dynamic_state.base.width = draw_llvm_texture_width;
sampler->dynamic_state.base.height = draw_llvm_texture_height;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h 
b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index be41ca0..b95ee6f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -68,6 +68,37 @@ enum lp_sampler_lod_property {
 };
 
 
+enum lp_sampler_lod_control {
+   LP_SAMPLER_LOD_IMPLICIT,
+   LP_SAMPLER_LOD_BIAS,
+   LP_SAMPLER_LOD_EXPLICIT,
+   LP_SAMPLER_LOD_DERIVATIVES,
+};
+
+
+#define LP_SAMPLER_SHADOW (1 << 0)
+#define LP_SAMPLER_OFFSETS(1 << 1)
+#define LP_SAMPLER_FETCH  (1 << 

Re: [Mesa-dev] [PATCH v2 06/15] st/mesa: implement GL_AMD_performance_monitor

2015-03-28 Thread Martin Peres

On 22/03/2015 17:35, Samuel Pitoiset wrote:

From: Christoph Bumiller 

This is based on the original patch of Christoph Bumiller.
(source: http://people.freedesktop.org/~chrisbmr/perfmon.diff)


It would be nice if you could add "v2: Samuel Pitoiset" and tell what 
you changed. Christoph may delete his perfmon.diff and no-one will be 
able to diff the diffs :)


As for the Gallium HUD, we keep a list of busy queries in a ring
buffer in order to prevent stalls when reading queries.

Drivers must implement get_driver_query_group_info and
get_driver_query_info in order to enable this extension.

Signed-off-by: Samuel Pitoiset 
---
  src/mesa/Makefile.sources  |   2 +
  src/mesa/state_tracker/st_cb_perfmon.c | 455 +
  src/mesa/state_tracker/st_cb_perfmon.h |  70 +
  src/mesa/state_tracker/st_context.c|   4 +
  src/mesa/state_tracker/st_extensions.c |   3 +
  5 files changed, 534 insertions(+)
  create mode 100644 src/mesa/state_tracker/st_cb_perfmon.c
  create mode 100644 src/mesa/state_tracker/st_cb_perfmon.h

diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 217be9a..e54e618 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -432,6 +432,8 @@ STATETRACKER_FILES = \
state_tracker/st_cb_flush.h \
state_tracker/st_cb_msaa.c \
state_tracker/st_cb_msaa.h \
+   state_tracker/st_cb_perfmon.c \
+   state_tracker/st_cb_perfmon.h \
state_tracker/st_cb_program.c \
state_tracker/st_cb_program.h \
state_tracker/st_cb_queryobj.c \
diff --git a/src/mesa/state_tracker/st_cb_perfmon.c 
b/src/mesa/state_tracker/st_cb_perfmon.c
new file mode 100644
index 000..fb6774b
--- /dev/null
+++ b/src/mesa/state_tracker/st_cb_perfmon.c
@@ -0,0 +1,455 @@
+/*
+ * Copyright (C) 2013 Christoph Bumiller
+ * Copyright (C) 2015 Samuel Pitoiset
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * Performance monitoring counters interface to gallium.
+ */
+
+#include "st_context.h"
+#include "st_cb_bitmap.h"
+#include "st_cb_perfmon.h"
+
+#include "util/bitset.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "util/u_memory.h"
+
+/**
+ * Return a PIPE_QUERY_x type >= PIPE_QUERY_DRIVER_SPECIFIC, or -1 if
+ * the driver-specific query doesn't exist.
+ */
+static int
+find_query_type(struct pipe_screen *screen, const char *name)
+{
+   int num_queries;
+   int type = -1;
+   int i;
+
+   num_queries = screen->get_driver_query_info(screen, 0, NULL);
+   if (!num_queries)
+  return type;
+
+   for (i = 0; i < num_queries; i++) {
+  struct pipe_driver_query_info info;
+
+  if (!screen->get_driver_query_info(screen, i, &info))
+ continue;
+
+  if (!strncmp(info.name, name, strlen(name))) {
+ type = info.query_type;
+ break;
+  }
+   }
+   return type;
+}
+
+static bool
+init_perf_monitor(struct gl_context *ctx, struct gl_perf_monitor_object *m)
+{
+   struct st_perf_monitor_object *stm = st_perf_monitor_object(m);
+   struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+   int gid, cid;
+
+   st_flush_bitmap_cache(st_context(ctx));
+
+   /* Create a query for each active counter. */
+   for (gid = 0; gid < ctx->PerfMonitor.NumGroups; gid++) {
+  const struct gl_perf_monitor_group *g = &ctx->PerfMonitor.Groups[gid];
+  for (cid = 0; cid < g->NumCounters; cid++) {
+ const struct gl_perf_monitor_counter *c = &g->Counters[cid];
+ struct st_perf_counter_object *cntr;
+ int query_type;
+
+ if (!BITSET_TEST(m->ActiveCounters[gid], cid))
+continue;
It would seem like the extension would not work with more than 32 
counters per group.


This certainly is not a problem on the NVIDIA side but it may become a 
problem for another
GPU manufacturer. It may warrant a note disclosing this limitation

[Mesa-dev] [PATCH 00/16] Assorted Android patches

2015-03-28 Thread Emil Velikov
Hi all,

With a GSoC student interesting in going through and exploding the 
freedreno driver (amongst others) I've decided that it's a nice idea to 
double check how chaotic things are wrt the Android build.

Long story short - it's bad. The good news is that a couple of the 
Android-x86 guys (Chih-Wei, Mauro) have been picking on it slowly, so 
I've salvaged what I could from their work, and did a bit of a cleanup 
on top.

So far we've got (buildwise):
 - The classic drivers - i915/i965 are ok
 - NIR is in town.
 - Formats rework is good now.
 - Initial st/dri support.

From the above only the last one is missing in the series, as it's still 
a bit off from complete.

The series can be found in branch 'submit/android-fixes#1' at my github 
repo https://github.com/evelikov/Mesa/


Cheers,
Emil

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


[Mesa-dev] [PATCH 01/16] ilo: remove unused include from Android.mk

2015-03-28 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/gallium/drivers/ilo/Android.mk | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/gallium/drivers/ilo/Android.mk 
b/src/gallium/drivers/ilo/Android.mk
index 39de3a6..4204134 100644
--- a/src/gallium/drivers/ilo/Android.mk
+++ b/src/gallium/drivers/ilo/Android.mk
@@ -27,9 +27,6 @@ include $(LOCAL_PATH)/Makefile.sources
 
 include $(CLEAR_VARS)
 
-LOCAL_C_INCLUDES := \
-   $(LOCAL_PATH)/include
-
 LOCAL_SRC_FILES := $(C_SOURCES)
 
 LOCAL_MODULE := libmesa_pipe_ilo
-- 
2.1.3

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


[Mesa-dev] [PATCH 02/16] android: use LOCAL_SHARED_LIBRARIES over TARGET_OUT_HEADERS

2015-03-28 Thread Emil Velikov
... to manage the LIBDRM*_CFLAGS. The former is the recommended approach
by the Android build system developers while the latter has been
depreciated for quite some time.

Cc: "10.4 10.5" 
Signed-off-by: Emil Velikov 
---
 src/egl/drivers/dri2/Android.mk | 2 +-
 src/gallium/drivers/freedreno/Android.mk| 5 ++---
 src/gallium/drivers/nouveau/Android.mk  | 4 +---
 src/gallium/drivers/r300/Android.mk | 5 +++--
 src/gallium/drivers/r600/Android.mk | 3 +--
 src/gallium/drivers/radeon/Android.mk   | 3 +--
 src/gallium/drivers/radeonsi/Android.mk | 3 +--
 src/gallium/winsys/freedreno/drm/Android.mk | 5 +
 src/gallium/winsys/i915/drm/Android.mk  | 3 +--
 src/gallium/winsys/intel/drm/Android.mk | 3 +--
 src/gallium/winsys/nouveau/drm/Android.mk   | 3 +--
 src/gallium/winsys/radeon/drm/Android.mk| 3 +--
 src/gallium/winsys/svga/drm/Android.mk  | 4 ++--
 src/loader/Android.mk   | 2 +-
 src/mesa/drivers/dri/Android.mk | 1 -
 15 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/src/egl/drivers/dri2/Android.mk b/src/egl/drivers/dri2/Android.mk
index f91a903..d5ac8ee 100644
--- a/src/egl/drivers/dri2/Android.mk
+++ b/src/egl/drivers/dri2/Android.mk
@@ -40,12 +40,12 @@ LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/egl/main \
$(MESA_TOP)/src/loader \
-   $(TARGET_OUT_HEADERS)/libdrm \
$(DRM_GRALLOC_TOP)
 
 LOCAL_STATIC_LIBRARIES := \
libmesa_loader
 
+LOCAL_SHARED_LIBRARIES := libdrm
 LOCAL_MODULE := libmesa_egl_dri2
 
 include $(MESA_COMMON_MK)
diff --git a/src/gallium/drivers/freedreno/Android.mk 
b/src/gallium/drivers/freedreno/Android.mk
index 6cab31f..a6712b2 100644
--- a/src/gallium/drivers/freedreno/Android.mk
+++ b/src/gallium/drivers/freedreno/Android.mk
@@ -34,10 +34,9 @@ LOCAL_CFLAGS := \
-Wno-packed-bitfield-compat
 
 LOCAL_C_INCLUDES := \
-   $(LOCAL_PATH)/ir3 \
-   $(TARGET_OUT_HEADERS)/libdrm \
-   $(TARGET_OUT_HEADERS)/freedreno
+   $(LOCAL_PATH)/ir3
 
+LOCAL_SHARED_LIBRARIES := libdrm libdrm_freedreno
 LOCAL_MODULE := libmesa_pipe_freedreno
 
 include $(GALLIUM_COMMON_MK)
diff --git a/src/gallium/drivers/nouveau/Android.mk 
b/src/gallium/drivers/nouveau/Android.mk
index 3f6ec5b..420c8e5 100644
--- a/src/gallium/drivers/nouveau/Android.mk
+++ b/src/gallium/drivers/nouveau/Android.mk
@@ -36,9 +36,7 @@ LOCAL_SRC_FILES := \
$(NVC0_CODEGEN_SOURCES) \
$(NVC0_C_SOURCES)
 
-LOCAL_C_INCLUDES := \
-   $(TARGET_OUT_HEADERS)/libdrm
-
+LOCAL_SHARED_LIBRARIES := libdrm libdrm_nouveau
 LOCAL_MODULE := libmesa_pipe_nouveau
 
 include external/stlport/libstlport.mk
diff --git a/src/gallium/drivers/r300/Android.mk 
b/src/gallium/drivers/r300/Android.mk
index d3ef76d..7ff4f86 100644
--- a/src/gallium/drivers/r300/Android.mk
+++ b/src/gallium/drivers/r300/Android.mk
@@ -33,9 +33,10 @@ LOCAL_SRC_FILES := $(C_SOURCES)
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/glsl \
-   $(MESA_TOP)/src/mesa \
-   $(TARGET_OUT_HEADERS)/libdrm
+   $(MESA_TOP)/src/mesa
 
+
+LOCAL_SHARED_LIBRARIES := libdrm libdrm_radeon
 LOCAL_MODULE := libmesa_pipe_r300
 
 include $(GALLIUM_COMMON_MK)
diff --git a/src/gallium/drivers/r600/Android.mk 
b/src/gallium/drivers/r600/Android.mk
index 3b12dd6..e935759 100644
--- a/src/gallium/drivers/r600/Android.mk
+++ b/src/gallium/drivers/r600/Android.mk
@@ -30,8 +30,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES) $(CXX_SOURCES)
 
-LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/libdrm
-
+LOCAL_SHARED_LIBRARIES := libdrm libdrm_radeon
 LOCAL_MODULE := libmesa_pipe_r600
 
 include external/stlport/libstlport.mk
diff --git a/src/gallium/drivers/radeon/Android.mk 
b/src/gallium/drivers/radeon/Android.mk
index d562f4c..d615792 100644
--- a/src/gallium/drivers/radeon/Android.mk
+++ b/src/gallium/drivers/radeon/Android.mk
@@ -30,8 +30,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
 
-LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/libdrm
-
+LOCAL_SHARED_LIBRARIES := libdrm libdrm_radeon
 LOCAL_MODULE := libmesa_pipe_radeon
 
 include $(GALLIUM_COMMON_MK)
diff --git a/src/gallium/drivers/radeonsi/Android.mk 
b/src/gallium/drivers/radeonsi/Android.mk
index 22c0fdc..57f3bef 100644
--- a/src/gallium/drivers/radeonsi/Android.mk
+++ b/src/gallium/drivers/radeonsi/Android.mk
@@ -30,8 +30,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
 
-LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/libdrm
-
+LOCAL_SHARED_LIBRARIES := libdrm libdrm_radeon
 LOCAL_MODULE := libmesa_pipe_radeonsi
 
 include $(GALLIUM_COMMON_MK)
diff --git a/src/gallium/winsys/freedreno/drm/Android.mk 
b/src/gallium/winsys/freedreno/drm/Android.mk
index 7bd31d9..b45d3d4 100644
--- a/src/gallium/winsys/freedreno/drm/Android.mk
+++ b/src/gallium/winsys/freedreno/drm/Android.mk
@@ -27,10 +27,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
 
-LOCAL_C_INCLUDES := \
-   $(TAR

[Mesa-dev] [PATCH 05/16] android: use := operator for assigning MESA_VERSION

2015-03-28 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 Android.common.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Android.common.mk b/Android.common.mk
index 3e6d4c3..e34f206 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -33,7 +33,7 @@ endif
 LOCAL_C_INCLUDES += \
$(MESA_TOP)/include
 
-MESA_VERSION=$(shell cat $(MESA_TOP)/VERSION)
+MESA_VERSION := $(shell cat $(MESA_TOP)/VERSION)
 # define ANDROID_VERSION (e.g., 4.0.x => 0x0400)
 LOCAL_CFLAGS += \
-DPACKAGE_VERSION=\"$(MESA_VERSION)\" \
-- 
2.1.3

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


[Mesa-dev] [PATCH 11/16] android: add HAVE__BUILTIN_* and HAVE_FUNC_ATTRIBUTE_* defines

2015-03-28 Thread Emil Velikov
All of those are available on gcc 4.5 and later with the current android
build using gcc 4.7.

Cc: "10.4 10.5" 
Signed-off-by: Emil Velikov 
---
 Android.common.mk | 13 +
 1 file changed, 13 insertions(+)

diff --git a/Android.common.mk b/Android.common.mk
index f473a4b..a4ee181 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -42,6 +42,19 @@ LOCAL_CFLAGS += \

-DANDROID_VERSION=0x0$(MESA_ANDROID_MAJOR_VERSION)0$(MESA_ANDROID_MINOR_VERSION)
 
 LOCAL_CFLAGS += \
+   -DHAVE___BUILTIN_EXPECT \
+   -DHAVE___BUILTIN_FFS \
+   -DHAVE___BUILTIN_FFSLL \
+   -DHAVE_FUNC_ATTRIBUTE_FLATTEN \
+   -DHAVE_FUNC_ATTRIBUTE_UNUSED \
+   -DHAVE_FUNC_ATTRIBUTE_FORMAT \
+   -DHAVE_FUNC_ATTRIBUTE_PACKED \
+   -DHAVE___BUILTIN_CTZ \
+   -DHAVE___BUILTIN_POPCOUNT \
+   -DHAVE___BUILTIN_POPCOUNTLL \
+   -DHAVE___BUILTIN_CLZ \
+   -DHAVE___BUILTIN_CLZLL \
+   -DHAVE___BUILTIN_UNREACHABLE \
-DHAVE_PTHREAD=1 \
-fvisibility=hidden \
-Wno-sign-compare
-- 
2.1.3

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


[Mesa-dev] [PATCH 03/16] android: simplify the subdirs including rules

2015-03-28 Thread Emil Velikov
From: Chih-Wei Huang 

Use the macro defined in the Android build system.

Signed-off-by: Chih-Wei Huang 
---
 Android.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Android.mk b/Android.mk
index e190f74..87ed464 100644
--- a/Android.mk
+++ b/Android.mk
@@ -94,7 +94,6 @@ ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
 SUBDIRS += src/gallium
 endif
 
-mkfiles := $(patsubst %,$(MESA_TOP)/%/Android.mk,$(SUBDIRS))
-include $(mkfiles)
+include $(call all-named-subdir-makefiles,$(SUBDIRS))
 
 endif
-- 
2.1.3

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


[Mesa-dev] [PATCH 08/16] android: egl: add libsync_cflags to the build

2015-03-28 Thread Emil Velikov
... via local_shared_libraries. Otherwise the sync/sync.h header won't
be found.

Note: 10.5 and earlier will need similar change in st/egl.

Cc: "10.4 10.5" 
Signed-off-by: Emil Velikov 
---
 src/egl/drivers/dri2/Android.mk | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/egl/drivers/dri2/Android.mk b/src/egl/drivers/dri2/Android.mk
index d5ac8ee..53d3853 100644
--- a/src/egl/drivers/dri2/Android.mk
+++ b/src/egl/drivers/dri2/Android.mk
@@ -46,6 +46,12 @@ LOCAL_STATIC_LIBRARIES := \
libmesa_loader
 
 LOCAL_SHARED_LIBRARIES := libdrm
+
+ifeq ($(shell echo "$(MESA_ANDROID_VERSION) >= 4.2" | bc),1)
+LOCAL_SHARED_LIBRARIES := \
+   libsync
+endif
+
 LOCAL_MODULE := libmesa_egl_dri2
 
 include $(MESA_COMMON_MK)
-- 
2.1.3

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


[Mesa-dev] [PATCH 04/16] util: android: optimize the rules to generate format_srgb.c

2015-03-28 Thread Emil Velikov
From: Chih-Wei Huang 

Signed-off-by: Chih-Wei Huang 
---
 src/util/Android.mk | 32 ++--
 1 file changed, 10 insertions(+), 22 deletions(-)

diff --git a/src/util/Android.mk b/src/util/Android.mk
index 6b38cf9..2eb0ef7 100644
--- a/src/util/Android.mk
+++ b/src/util/Android.mk
@@ -42,21 +42,15 @@ LOCAL_MODULE := libmesa_util
 
 # Generated sources
 
-ifeq ($(LOCAL_MODULE_CLASS),)
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-endif
 
 intermediates := $(call local-intermediates-dir)
+LOCAL_GENERATED_SOURCES := $(addprefix 
$(intermediates)/,$(MESA_UTIL_GENERATED_FILES))
 
-# This is the list of auto-generated files: sources and headers
-sources := $(addprefix $(intermediates)/, $(MESA_UTIL_GENERATED_FILES))
-
-LOCAL_GENERATED_SOURCES += $(sources)
-
-FORMAT_SRGB := $(LOCAL_PATH)/format_srgb.py
-
-$(intermediates)/format_srgb.c: $(FORMAT_SRGB)
-   @$(MESA_PYTHON2) $(FORMAT_SRGB) $< > $@
+$(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
+$(LOCAL_GENERATED_SOURCES): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PYTHON) $^ > $@
+$(LOCAL_GENERATED_SOURCES): $(intermediates)/%.c: $(LOCAL_PATH)/%.py
+   $(transform-generated-source)
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
@@ -82,21 +76,15 @@ LOCAL_MODULE := libmesa_util
 
 # Generated sources
 
-ifeq ($(LOCAL_MODULE_CLASS),)
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-endif
 
 intermediates := $(call local-intermediates-dir)
+LOCAL_GENERATED_SOURCES := $(addprefix 
$(intermediates)/,$(MESA_UTIL_GENERATED_FILES))
 
-# This is the list of auto-generated files: sources and headers
-sources := $(addprefix $(intermediates)/, $(MESA_UTIL_GENERATED_FILES))
-
-LOCAL_GENERATED_SOURCES += $(sources)
-
-FORMAT_SRGB := $(LOCAL_PATH)/format_srgb.py
-
-$(intermediates)/format_srgb.c: $(FORMAT_SRGB)
-   @$(MESA_PYTHON2) $(FORMAT_SRGB) $< > $@
+$(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
+$(LOCAL_GENERATED_SOURCES): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PYTHON) $^ > $@
+$(LOCAL_GENERATED_SOURCES): $(intermediates)/%.c: $(LOCAL_PATH)/%.py
+   $(transform-generated-source)
 
 include $(MESA_COMMON_MK)
 include $(BUILD_HOST_STATIC_LIBRARY)
-- 
2.1.3

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


[Mesa-dev] [PATCH 13/16] android: dri: link against libmesa_util

2015-03-28 Thread Emil Velikov
The dri modules depend on symbols provided by it.

Cc: "10.5" 
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/Android.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index 28a332b..64e237b 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -45,7 +45,8 @@ MESA_DRI_WHOLE_STATIC_LIBRARIES := \
libmesa_glsl \
libmesa_megadriver_stub \
libmesa_dri_common \
-   libmesa_dricore
+   libmesa_dricore \
+   libmesa_util
 
 MESA_DRI_SHARED_LIBRARIES := \
libcutils \
-- 
2.1.3

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


[Mesa-dev] [PATCH 07/16] android: mesa: generate the format_{un, }pack.[ch] sources

2015-03-28 Thread Emil Velikov
From: Mauro Rossi 

Missed out with commit e1fdcddafe9(mesa: Autogenerate format_unpack.c)

Cc: "10.5" 
[Emil Velikov: Split our from a larger commit.]
Signed-off-by: Emil Velikov 
---
 src/mesa/Android.gen.mk | 21 +
 1 file changed, 21 insertions(+)

diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
index caae2c1..cc6b223 100644
--- a/src/mesa/Android.gen.mk
+++ b/src/mesa/Android.gen.mk
@@ -34,6 +34,9 @@ sources := \
main/enums.c \
main/api_exec.c \
main/dispatch.h \
+   main/format_pack.c \
+   main/format_unpack.c \
+   main/format_info.h \
main/remap_helper.h \
main/get_hash.h
 
@@ -124,3 +127,21 @@ format_info_deps := \
 
 $(intermediates)/main/format_info.h: $(format_info_deps)
@$(MESA_PYTHON2) $(FORMAT_INFO) $< > $@
+
+FORMAT_PACK := $(LOCAL_PATH)/main/format_pack.py
+format_pack_deps := \
+   $(LOCAL_PATH)/main/formats.csv \
+   $(LOCAL_PATH)/main/format_parser.py \
+   $(FORMAT_PACK)
+
+$(intermediates)/main/format_pack.c: $(format_pack_deps)
+   @$(MESA_PYTHON2) $(FORMAT_PACK) $< > $@
+
+FORMAT_UNPACK := $(LOCAL_PATH)/main/format_unpack.py
+format_unpack_deps := \
+   $(LOCAL_PATH)/main/formats.csv \
+   $(LOCAL_PATH)/main/format_parser.py \
+   $(FORMAT_UNPACK)
+
+$(intermediates)/main/format_unpack.c: $(format_unpack_deps)
+   @$(MESA_PYTHON2) $(FORMAT_UNPACK) $< > $@
-- 
2.1.3

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


[Mesa-dev] [PATCH 09/16] android: dri/common: conditionally include drm_cflags/set __NOT_HAVE_DRM_H

2015-03-28 Thread Emil Velikov
Otherwise we'll fail to find the drm.h header.

Cc: "10.4 10.5" 
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/common/Android.mk | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/mesa/drivers/dri/common/Android.mk 
b/src/mesa/drivers/dri/common/Android.mk
index b95feb6..03ea564 100644
--- a/src/mesa/drivers/dri/common/Android.mk
+++ b/src/mesa/drivers/dri/common/Android.mk
@@ -40,6 +40,13 @@ LOCAL_C_INCLUDES := \
 $(intermediates) \
 $(MESA_DRI_C_INCLUDES)
 
+# swrast only
+ifeq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_CFLAGS := -D__NOT_HAVE_DRM_H
+else
+LOCAL_SHARED_LIBRARIES := libdrm
+endif
+
 LOCAL_SRC_FILES := $(DRI_COMMON_FILES)
 
 LOCAL_GENERATED_SOURCES := \
@@ -99,6 +106,13 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 LOCAL_C_INCLUDES := \
 $(MESA_DRI_C_INCLUDES)
 
+# swrast only
+ifeq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_CFLAGS := -D__NOT_HAVE_DRM_H
+else
+LOCAL_SHARED_LIBRARIES := libdrm
+endif
+
 LOCAL_SRC_FILES := $(megadriver_stub_FILES)
 
 include $(MESA_COMMON_MK)
-- 
2.1.3

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


[Mesa-dev] [PATCH 06/16] android: add $(mesa_top)/src include to the whole of mesa

2015-03-28 Thread Emil Velikov
Many parts of mesa already have the include with others depending on it
but it's missing. Add it once at the top makefile and be done with it.

Cc: "10.4 10.5" 
Signed-off-by: Emil Velikov 
---
 Android.common.mk  | 1 +
 src/gallium/auxiliary/Android.mk   | 3 +--
 src/glsl/Android.mk| 2 --
 src/mesa/Android.libmesa_dricore.mk| 1 -
 src/mesa/Android.libmesa_glsl_utils.mk | 2 --
 src/mesa/Android.libmesa_st_mesa.mk| 1 -
 src/mesa/drivers/dri/Android.mk| 1 -
 src/mesa/program/Android.mk| 1 -
 src/util/Android.mk| 6 ++
 9 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index e34f206..f473a4b 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -31,6 +31,7 @@ endif
 endif
 
 LOCAL_C_INCLUDES += \
+   $(MESA_TOP)/src \
$(MESA_TOP)/include
 
 MESA_VERSION := $(shell cat $(MESA_TOP)/VERSION)
diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk
index 0bc1831..c7b2634 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -33,8 +33,7 @@ LOCAL_SRC_FILES := \
$(VL_STUB_SOURCES)
 
 LOCAL_C_INCLUDES := \
-   $(GALLIUM_TOP)/auxiliary/util \
-   $(MESA_TOP)/src
+   $(GALLIUM_TOP)/auxiliary/util
 
 LOCAL_MODULE := libmesa_gallium
 
diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk
index 38c2087..2ac1ffb 100644
--- a/src/glsl/Android.mk
+++ b/src/glsl/Android.mk
@@ -38,7 +38,6 @@ LOCAL_SRC_FILES := \
$(LIBGLSL_FILES)
 
 LOCAL_C_INCLUDES := \
-   $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa
 
@@ -59,7 +58,6 @@ LOCAL_SRC_FILES := \
$(GLSL_COMPILER_CXX_FILES)
 
 LOCAL_C_INCLUDES := \
-   $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa
 
diff --git a/src/mesa/Android.libmesa_dricore.mk 
b/src/mesa/Android.libmesa_dricore.mk
index e4a5267..73afcc7 100644
--- a/src/mesa/Android.libmesa_dricore.mk
+++ b/src/mesa/Android.libmesa_dricore.mk
@@ -61,7 +61,6 @@ endif
 
 LOCAL_C_INCLUDES := \
$(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
-   $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/glsl \
$(MESA_TOP)/src/gallium/auxiliary
diff --git a/src/mesa/Android.libmesa_glsl_utils.mk 
b/src/mesa/Android.libmesa_glsl_utils.mk
index a9f6ff5..b7e64c5 100644
--- a/src/mesa/Android.libmesa_glsl_utils.mk
+++ b/src/mesa/Android.libmesa_glsl_utils.mk
@@ -36,7 +36,6 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := libmesa_glsl_utils
 
 LOCAL_C_INCLUDES := \
-   $(MESA_TOP)/src \
$(MESA_TOP)/src/glsl \
$(MESA_TOP)/src/mapi
 
@@ -59,7 +58,6 @@ LOCAL_IS_HOST_MODULE := true
 LOCAL_CFLAGS := -D_POSIX_C_SOURCE=199309L
 
 LOCAL_C_INCLUDES := \
-   $(MESA_TOP)/src \
$(MESA_TOP)/src/glsl \
$(MESA_TOP)/src/mapi
 
diff --git a/src/mesa/Android.libmesa_st_mesa.mk 
b/src/mesa/Android.libmesa_st_mesa.mk
index a08366d..fdf847a 100644
--- a/src/mesa/Android.libmesa_st_mesa.mk
+++ b/src/mesa/Android.libmesa_st_mesa.mk
@@ -55,7 +55,6 @@ LOCAL_C_INCLUDES := \
$(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
$(MESA_TOP)/src/gallium/auxiliary \
$(MESA_TOP)/src/gallium/include \
-   $(MESA_TOP)/src \
$(MESA_TOP)/src/glsl \
$(MESA_TOP)/src/mapi
 
diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index d1c836b..e168fe0 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -35,7 +35,6 @@ MESA_DRI_CFLAGS := \
-DHAVE_ANDROID_PLATFORM
 
 MESA_DRI_C_INCLUDES := \
-   $(MESA_TOP)/src \
$(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_dri_common) \
$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
external/expat/lib
diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
index a237b65..e85afe6 100644
--- a/src/mesa/program/Android.mk
+++ b/src/mesa/program/Android.mk
@@ -71,7 +71,6 @@ $(intermediates)/program/lex.yy.c: 
$(LOCAL_PATH)/program_lexer.l
 
 LOCAL_C_INCLUDES := \
$(intermediates) \
-   $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa \
$(MESA_TOP)/src/glsl
diff --git a/src/util/Android.mk b/src/util/Android.mk
index 2eb0ef7..c2c0cb3 100644
--- a/src/util/Android.mk
+++ b/src/util/Android.mk
@@ -35,8 +35,7 @@ LOCAL_SRC_FILES := \
 
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mesa \
-   $(MESA_TOP)/src/mapi \
-   $(MESA_TOP)/src
+   $(MESA_TOP)/src/mapi
 
 LOCAL_MODULE := libmesa_util
 
@@ -69,8 +68,7 @@ LOCAL_SRC_FILES := \
 
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mesa \
-   $(MESA_TOP)/src/mapi \
-   $(MESA_TOP)/src
+   $(MESA_TOP)/src/mapi
 
 LOCAL_MODULE := libmesa_util
 
-- 
2.1.3

___
mesa-dev mailing list
mesa-dev@lists.freedes

[Mesa-dev] [PATCH 12/16] android: add $(mesa_top)/src/mesa/main to the includes list

2015-03-28 Thread Emil Velikov
Required by the format_{un,}pack rework. Otherwise the build will fail
to locate the respective headers - format_{un,}pack.h

Cc: "10.5" 
Signed-off-by: Emil Velikov 
---
 src/mesa/Android.libmesa_dricore.mk | 1 +
 src/mesa/Android.libmesa_st_mesa.mk | 7 ---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/Android.libmesa_dricore.mk 
b/src/mesa/Android.libmesa_dricore.mk
index 904a92f..c2a4c28 100644
--- a/src/mesa/Android.libmesa_dricore.mk
+++ b/src/mesa/Android.libmesa_dricore.mk
@@ -62,6 +62,7 @@ endif
 LOCAL_C_INCLUDES := \
$(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
$(MESA_TOP)/src/mapi \
+   $(MESA_TOP)/src/mesa/main \
$(MESA_TOP)/src/glsl \
$(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/gallium/auxiliary
diff --git a/src/mesa/Android.libmesa_st_mesa.mk 
b/src/mesa/Android.libmesa_st_mesa.mk
index fdf847a..e02030b 100644
--- a/src/mesa/Android.libmesa_st_mesa.mk
+++ b/src/mesa/Android.libmesa_st_mesa.mk
@@ -53,10 +53,11 @@ endif
 
 LOCAL_C_INCLUDES := \
$(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
-   $(MESA_TOP)/src/gallium/auxiliary \
-   $(MESA_TOP)/src/gallium/include \
+   $(MESA_TOP)/src/mapi \
+   $(MESA_TOP)/src/mesa/main \
$(MESA_TOP)/src/glsl \
-   $(MESA_TOP)/src/mapi
+   $(MESA_TOP)/src/gallium/auxiliary \
+   $(MESA_TOP)/src/gallium/include
 
 LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_program
-- 
2.1.3

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


[Mesa-dev] [PATCH 16/16] android: mesa: fix the path of the SSE4_1 optimisations

2015-03-28 Thread Emil Velikov
Commit dd6f641303c(mesa: Build with subdir-objects.) removed the SRCDIR
variable, but forgot to update all references of it.

Cc: "10.5" 
Signed-off-by: Emil Velikov 
---
 src/mesa/Android.libmesa_dricore.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/Android.libmesa_dricore.mk 
b/src/mesa/Android.libmesa_dricore.mk
index c2a4c28..da6176a 100644
--- a/src/mesa/Android.libmesa_dricore.mk
+++ b/src/mesa/Android.libmesa_dricore.mk
@@ -49,8 +49,8 @@ endif # MESA_ENABLE_ASM
 
 ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
 LOCAL_SRC_FILES += \
-   $(SRCDIR)main/streaming-load-memcpy.c \
-   $(SRCDIR)main/sse_minmax.c
+   $(MESA_TOP)/src/mesa/main/streaming-load-memcpy.c \
+   $(MESA_TOP)/src/mesa/main/sse_minmax.c
 LOCAL_CFLAGS := -msse4.1
 endif
 
-- 
2.1.3

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


[Mesa-dev] [PATCH 15/16] android: build the Mesa IR -> NIR translator

2015-03-28 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/mesa/program/Android.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
index e957a8d..374fcbf 100644
--- a/src/mesa/program/Android.mk
+++ b/src/mesa/program/Android.mk
@@ -55,7 +55,8 @@ generated_sources_basenames := \
program_parse.tab.h
 
 LOCAL_SRC_FILES := \
-   $(filter-out $(generated_sources_basenames),$(subst 
program/,,$(PROGRAM_FILES)))
+   $(filter-out $(generated_sources_basenames),$(subst 
program/,,$(PROGRAM_FILES))) \
+   $(subst program/,,$(PROGRAM_NIR_FILES))
 
 LOCAL_GENERATED_SOURCES := \
$(addprefix $(intermediates)/program/,$(generated_sources_basenames))
-- 
2.1.3

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


[Mesa-dev] [PATCH 14/16] android: add inital NIR build

2015-03-28 Thread Emil Velikov
From: Mauro Rossi 

Required by the i965 driver.

Cc: "10.5" 
[Emil Velikov: Split from a larger commit]
Signed-off-by: Emil Velikov 
---
 src/glsl/Android.gen.mk | 62 +++--
 src/glsl/Android.mk |  3 +-
 src/mesa/drivers/dri/Android.mk |  1 +
 3 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
index 7ec56d4..82f2bf1 100644
--- a/src/glsl/Android.gen.mk
+++ b/src/glsl/Android.gen.mk
@@ -33,11 +33,21 @@ sources := \
glsl_lexer.cpp \
glsl_parser.cpp \
glcpp/glcpp-lex.c \
-   glcpp/glcpp-parse.c
+   glcpp/glcpp-parse.c \
+   nir/nir_builder_opcodes.h \
+   nir/nir_constant_expressions.c \
+   nir/nir_opcodes.c \
+   nir/nir_opcodes.h \
+   nir/nir_opt_algebraic.c
 
 LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES))
 
-LOCAL_C_INCLUDES += $(intermediates) $(intermediates)/glcpp 
$(MESA_TOP)/src/glsl/glcpp
+LOCAL_C_INCLUDES += \
+   $(intermediates) \
+   $(intermediates)/glcpp \
+   $(intermediates)/nir \
+   $(MESA_TOP)/src/glsl/glcpp \
+   $(MESA_TOP)/src/glsl/nir
 
 sources := $(addprefix $(intermediates)/, $(sources))
 LOCAL_GENERATED_SOURCES += $(sources)
@@ -77,3 +87,51 @@ $(intermediates)/glcpp/glcpp-lex.c: 
$(LOCAL_PATH)/glcpp/glcpp-lex.l
 
 $(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
$(call glsl_local-y-to-c-and-h)
+
+nir_builder_opcodes_gen := $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
+nir_builder_opcodes_deps := \
+   $(LOCAL_PATH)/nir/nir_opcodes.py \
+   $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
+
+$(intermediates)/nir/nir_builder_opcodes.h: $(nir_builder_opcodes_deps)
+   @mkdir -p $(dir $@)
+   @$(MESA_PYTHON2) $(nir_builder_opcodes_gen) $< > $@
+
+nir_constant_expressions_gen := $(LOCAL_PATH)/nir/nir_constant_expressions.py
+nir_constant_expressions_deps := \
+   $(LOCAL_PATH)/nir/nir_opcodes.py \
+   $(LOCAL_PATH)/nir/nir_constant_expressions.py \
+   $(LOCAL_PATH)/nir/nir_constant_expressions.h
+
+$(intermediates)/nir/nir_constant_expressions.c: 
$(nir_constant_expressions_deps)
+   @mkdir -p $(dir $@)
+   @$(MESA_PYTHON2) $(nir_constant_expressions_gen) $< > $@
+
+nir_opcodes_h_gen := $(LOCAL_PATH)/nir/nir_opcodes_h.py
+nir_opcodes_h_deps := \
+   $(LOCAL_PATH)/nir/nir_opcodes.py \
+   $(LOCAL_PATH)/nir/nir_opcodes_h.py
+
+$(intermediates)/nir/nir_opcodes.h: $(nir_opcodes_h_deps)
+   @mkdir -p $(dir $@)
+   @$(MESA_PYTHON2) $(nir_opcodes_h_gen) $< > $@
+
+$(LOCAL_PATH)/nir/nir.h: $(intermediates)/nir/nir_opcodes.h
+
+nir_opcodes_c_gen := $(LOCAL_PATH)/nir/nir_opcodes_c.py
+nir_opcodes_c_deps := \
+   $(LOCAL_PATH)/nir/nir_opcodes.py \
+   $(LOCAL_PATH)/nir/nir_opcodes_c.py
+
+$(intermediates)/nir/nir_opcodes.c: $(nir_opcodes_c_deps)
+   @mkdir -p $(dir $@)
+   @$(MESA_PYTHON2) $(nir_opcodes_c_gen) $< > $@
+
+nir_opt_algebraic_gen := $(LOCAL_PATH)/nir/nir_opt_algebraic.py
+nir_opt_algebraic_deps := \
+   $(LOCAL_PATH)/nir/nir_opt_algebraic.py \
+   $(LOCAL_PATH)/nir/nir_algebraic.py
+
+$(intermediates)/nir/nir_opt_algebraic.c: $(nir_opt_algebraic_deps)
+   @mkdir -p $(dir $@)
+   @$(MESA_PYTHON2) $(nir_opt_algebraic_gen) $< > $@
diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk
index 356f44e..f20741e 100644
--- a/src/glsl/Android.mk
+++ b/src/glsl/Android.mk
@@ -35,7 +35,8 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
$(LIBGLCPP_FILES) \
-   $(LIBGLSL_FILES)
+   $(LIBGLSL_FILES) \
+   $(NIR_FILES)
 
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index 64e237b..764cd5a 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -36,6 +36,7 @@ MESA_DRI_CFLAGS := \
 
 MESA_DRI_C_INCLUDES := \
$(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_dri_common) \
+   $(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_glsl)/nir \
$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
$(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/gallium/auxiliary \
-- 
2.1.3

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


[Mesa-dev] [PATCH 10/16] android: add gallium dirs to more places in the tree

2015-03-28 Thread Emil Velikov
Similar to e8c5cbfd921(mesa: Add gallium include dirs to more parts of
the tree.)

Signed-off-by: Emil Velikov 
---
 src/glsl/Android.mk| 8 ++--
 src/mesa/Android.libmesa_dricore.mk| 1 +
 src/mesa/Android.libmesa_glsl_utils.mk | 8 ++--
 src/mesa/drivers/dri/Android.mk| 2 ++
 src/mesa/program/Android.mk| 4 +++-
 src/util/Android.mk| 8 ++--
 6 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk
index 2ac1ffb..356f44e 100644
--- a/src/glsl/Android.mk
+++ b/src/glsl/Android.mk
@@ -39,7 +39,9 @@ LOCAL_SRC_FILES := \
 
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
-   $(MESA_TOP)/src/mesa
+   $(MESA_TOP)/src/mesa \
+   $(MESA_TOP)/src/gallium/include \
+   $(MESA_TOP)/src/gallium/auxiliary
 
 LOCAL_MODULE := libmesa_glsl
 
@@ -59,7 +61,9 @@ LOCAL_SRC_FILES := \
 
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
-   $(MESA_TOP)/src/mesa
+   $(MESA_TOP)/src/mesa \
+   $(MESA_TOP)/src/gallium/include \
+   $(MESA_TOP)/src/gallium/auxiliary
 
 LOCAL_STATIC_LIBRARIES := libmesa_glsl libmesa_glsl_utils libmesa_util
 
diff --git a/src/mesa/Android.libmesa_dricore.mk 
b/src/mesa/Android.libmesa_dricore.mk
index 73afcc7..904a92f 100644
--- a/src/mesa/Android.libmesa_dricore.mk
+++ b/src/mesa/Android.libmesa_dricore.mk
@@ -63,6 +63,7 @@ LOCAL_C_INCLUDES := \
$(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/glsl \
+   $(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/gallium/auxiliary
 
 LOCAL_WHOLE_STATIC_LIBRARIES := \
diff --git a/src/mesa/Android.libmesa_glsl_utils.mk 
b/src/mesa/Android.libmesa_glsl_utils.mk
index b7e64c5..3497377 100644
--- a/src/mesa/Android.libmesa_glsl_utils.mk
+++ b/src/mesa/Android.libmesa_glsl_utils.mk
@@ -37,7 +37,9 @@ LOCAL_MODULE := libmesa_glsl_utils
 
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/glsl \
-   $(MESA_TOP)/src/mapi
+   $(MESA_TOP)/src/mapi \
+   $(MESA_TOP)/src/gallium/include \
+   $(MESA_TOP)/src/gallium/auxiliary
 
 LOCAL_SRC_FILES := \
main/imports.c \
@@ -59,7 +61,9 @@ LOCAL_CFLAGS := -D_POSIX_C_SOURCE=199309L
 
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/glsl \
-   $(MESA_TOP)/src/mapi
+   $(MESA_TOP)/src/mapi \
+   $(MESA_TOP)/src/gallium/include \
+   $(MESA_TOP)/src/gallium/auxiliary
 
 LOCAL_SRC_FILES := \
main/imports.c \
diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index e168fe0..28a332b 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -37,6 +37,8 @@ MESA_DRI_CFLAGS := \
 MESA_DRI_C_INCLUDES := \
$(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_dri_common) \
$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
+   $(MESA_TOP)/src/gallium/include \
+   $(MESA_TOP)/src/gallium/auxiliary \
external/expat/lib
 
 MESA_DRI_WHOLE_STATIC_LIBRARIES := \
diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
index e85afe6..e957a8d 100644
--- a/src/mesa/program/Android.mk
+++ b/src/mesa/program/Android.mk
@@ -73,7 +73,9 @@ LOCAL_C_INCLUDES := \
$(intermediates) \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa \
-   $(MESA_TOP)/src/glsl
+   $(MESA_TOP)/src/glsl \
+   $(MESA_TOP)/src/gallium/auxiliary \
+   $(MESA_TOP)/src/gallium/include
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
diff --git a/src/util/Android.mk b/src/util/Android.mk
index c2c0cb3..e6530ea 100644
--- a/src/util/Android.mk
+++ b/src/util/Android.mk
@@ -35,7 +35,9 @@ LOCAL_SRC_FILES := \
 
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mesa \
-   $(MESA_TOP)/src/mapi
+   $(MESA_TOP)/src/mapi \
+   $(MESA_TOP)/src/gallium/include \
+   $(MESA_TOP)/src/gallium/auxiliary
 
 LOCAL_MODULE := libmesa_util
 
@@ -68,7 +70,9 @@ LOCAL_SRC_FILES := \
 
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mesa \
-   $(MESA_TOP)/src/mapi
+   $(MESA_TOP)/src/mapi \
+   $(MESA_TOP)/src/gallium/include \
+   $(MESA_TOP)/src/gallium/auxiliary
 
 LOCAL_MODULE := libmesa_util
 
-- 
2.1.3

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


Re: [Mesa-dev] GL_TEXTURE_2D to wl_buffer

2015-03-28 Thread Jason Ekstrand
On Sat, Mar 28, 2015 at 6:57 AM, x414e54  wrote:
> I am attempting to pass a GL_TEXTURE_2D directly to a Wayland compositor
by
> first converting it so an EGLImageKHR and then to a wl_buffer.
>
> eglCreateImageKHR appears to work fine but when calling
> glCreateWaylandBufferFromImageWL I get EGL_BAD_MATCH "unsupported image
> format".
>
> The GL_TEXTURE_2D is in GL_RGBA format.
>
> Is this going to be possible or should I look for an alternative way?

I wouldn't expect this to work at all in general. The
glCreateWaylandBufferFromImageWL extension was initially created for nested
compositor. The intention was to take buffers recieved by a nested
compositor from Wayland client and then hand them directly off to the
parent compositor. In other words, the buffers were something that already
came from a Wayland client and so handing them off across the Wayland
protocol was always safe. This was never intended for passing around
arbitrary EGLImages.

Why not? There may be all sorts of tiling, stride, and color format
restrictions required by the compositor half of the graphics stack that may
not be required for a texture. For instance, if you want to be able to scan
out from the buffer directly, the restrictions are usually fairly heavy.

How can you do this?  One way would be to use GBM to allocate your buffer
and then import it into egl to render and then talk the wl_drm protocol
directly.  However, this is far more complicated than you probably want
and, while it will work with mesa, it is not a general solution.

If you gave a more high-level description of what you are trying to do, I
may be able to help better.  It's quite possible that there is a fairly
simple way to do it.

> I was originally blitting the texture to the default framebuffer and then
> trying to use eglSwapBuffers. But for some reason eglSwapBuffers was
> returning EGL_BAD_SURFACE even though eglMakeCurrent had no errors.

Can you render to it?  That sounds like something is wrong in the way
you're setting up your EGLSurface.  Of you can render you should be able to
blit.
--Jason
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/9] nir: Allocate register fields out of the register itself.

2015-03-28 Thread Kenneth Graunke
The lifetime of each register's use/def/if_use sets needs to match the
register itself.  So, allocate them using the register itself as the
context.

Signed-off-by: Kenneth Graunke 
---
 src/glsl/nir/nir.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 0311d8d..e96f113 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -58,11 +58,11 @@ reg_create(void *mem_ctx, struct exec_list *list)
nir_register *reg = ralloc(mem_ctx, nir_register);
 
reg->parent_instr = NULL;
-   reg->uses = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   reg->uses = _mesa_set_create(reg, _mesa_hash_pointer,
 _mesa_key_pointer_equal);
-   reg->defs = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   reg->defs = _mesa_set_create(reg, _mesa_hash_pointer,
 _mesa_key_pointer_equal);
-   reg->if_uses = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   reg->if_uses = _mesa_set_create(reg, _mesa_hash_pointer,
_mesa_key_pointer_equal);
 
reg->num_components = 0;
-- 
2.3.4

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


[Mesa-dev] [PATCH 6/9] nir: Allocate nir_tex_instr::sources out of the instruction itself.

2015-03-28 Thread Kenneth Graunke
The lifetime of the sources array needs to be match the nir_tex_instr
itself.  So, allocate it using the instruction itself as the context.

Signed-off-by: Kenneth Graunke 
---
 src/glsl/nir/nir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 73d3008..5f86eca 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -460,7 +460,7 @@ nir_tex_instr_create(void *mem_ctx, unsigned num_srcs)
dest_init(&instr->dest);
 
instr->num_srcs = num_srcs;
-   instr->src = ralloc_array(mem_ctx, nir_tex_src, num_srcs);
+   instr->src = ralloc_array(instr, nir_tex_src, num_srcs);
for (unsigned i = 0; i < num_srcs; i++)
   src_init(&instr->src[i].src);
 
-- 
2.3.4

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


[Mesa-dev] [PATCH 7/9] ralloc: Implement a new ralloc_adopt() API.

2015-03-28 Thread Kenneth Graunke
ralloc_adopt() reparents all children from one context to another.
Conceptually, ralloc_adopt(new_ctx, old_ctx) behaves like this
pseudocode:

   foreach child of old_ctx:
  ralloc_steal(new_ctx, child)

However, ralloc provides no way to iterate over a memory context's
children, and ralloc_adopt does this task more efficiently anyway.

One potential use of this is to implement a memory-sweeper pass: first,
steal all of a context's memory to a temporary context.  Then, walk over
anything that should be kept, and ralloc_steal it back to the original
context.  Finally, free the temporary context.  This works when the
context is something that can't be freed (i.e. an important structure).

Signed-off-by: Kenneth Graunke 
---
 src/util/ralloc.c | 26 ++
 src/util/ralloc.h |  7 +++
 2 files changed, 33 insertions(+)

diff --git a/src/util/ralloc.c b/src/util/ralloc.c
index 36bc61f..01719c8 100644
--- a/src/util/ralloc.c
+++ b/src/util/ralloc.c
@@ -271,6 +271,32 @@ ralloc_steal(const void *new_ctx, void *ptr)
add_child(parent, info);
 }
 
+void
+ralloc_adopt(const void *new_ctx, void *old_ctx)
+{
+   ralloc_header *new_info, *old_info, *child;
+
+   if (unlikely(old_ctx == NULL))
+  return;
+
+   old_info = get_header(old_ctx);
+   new_info = get_header(new_ctx);
+
+   /* If there are no children, bail. */
+   if (unlikely(old_info->child == NULL))
+  return;
+
+   /* Set all the children's parent to new_ctx; get a pointer to the last 
child. */
+   for (child = old_info->child; child->next != NULL; child = child->next) {
+  child->parent = new_info;
+   }
+
+   /* Connect the two lists together; parent them to new_ctx; make old_ctx 
empty. */
+   child->next = new_info->child;
+   new_info->child = old_info->child;
+   old_info->child = NULL;
+}
+
 void *
 ralloc_parent(const void *ptr)
 {
diff --git a/src/util/ralloc.h b/src/util/ralloc.h
index f088a36..01f102b 100644
--- a/src/util/ralloc.h
+++ b/src/util/ralloc.h
@@ -235,6 +235,13 @@ void ralloc_free(void *ptr);
 void ralloc_steal(const void *new_ctx, void *ptr);
 
 /**
+ * Reparent all children from one context to another.
+ *
+ * This effectively calls ralloc_steal(new_ctx, child) for all children of \p 
old_ctx.
+ */
+void ralloc_adopt(const void *new_ctx, void *old_ctx);
+
+/**
  * Return the given pointer's ralloc context.
  */
 void *ralloc_parent(const void *ptr);
-- 
2.3.4

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


[Mesa-dev] [PATCH 2/9] nir: Free dead variables when removing them.

2015-03-28 Thread Kenneth Graunke
Signed-off-by: Kenneth Graunke 
---
 src/glsl/nir/nir_remove_dead_variables.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir_remove_dead_variables.c 
b/src/glsl/nir/nir_remove_dead_variables.c
index baa321e..4417e2a 100644
--- a/src/glsl/nir/nir_remove_dead_variables.c
+++ b/src/glsl/nir/nir_remove_dead_variables.c
@@ -102,8 +102,10 @@ remove_dead_vars(struct exec_list *var_list, struct set 
*live)
 {
foreach_list_typed_safe(nir_variable, var, node, var_list) {
   struct set_entry *entry = _mesa_set_search(live, var);
-  if (entry == NULL)
+  if (entry == NULL) {
  exec_node_remove(&var->node);
+ ralloc_free(var);
+  }
}
 }
 
-- 
2.3.4

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


[Mesa-dev] [PATCH 9/9] [AUTONAK] i965/nir: Call nir_sweep().

2015-03-28 Thread Kenneth Graunke
Mostly a proof of concept that it works; we free the memory shortly
afterwards anyway, so it's kind of dumb to do this.

The plan is to instead build nir_shaders at link time, rather than when
compiling each shader specialization, and delete the GLSL IR.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 56 ++--
 1 file changed, 32 insertions(+), 24 deletions(-)

This definitely shouldn't land.  However, I ran full Piglit and shader-db runs 
with
this enabled, and got no crashes or validation failures.  I sent it to the list 
so
people can see how I tested nir_sweep().

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 21e52fe..5218d20 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -29,33 +29,41 @@
 #include "brw_nir.h"
 
 static void
+boo(nir_shader *nir)
+{
+   nir_validate_shader(nir);
+   nir_sweep(nir);
+   nir_validate_shader(nir);
+}
+
+static void
 nir_optimize(nir_shader *nir)
 {
bool progress;
do {
   progress = false;
   nir_lower_vars_to_ssa(nir);
-  nir_validate_shader(nir);
+  boo(nir);
   nir_lower_alu_to_scalar(nir);
-  nir_validate_shader(nir);
+  boo(nir);
   progress |= nir_copy_prop(nir);
-  nir_validate_shader(nir);
+  boo(nir);
   nir_lower_phis_to_scalar(nir);
-  nir_validate_shader(nir);
+  boo(nir);
   progress |= nir_copy_prop(nir);
-  nir_validate_shader(nir);
+  boo(nir);
   progress |= nir_opt_dce(nir);
-  nir_validate_shader(nir);
+  boo(nir);
   progress |= nir_opt_cse(nir);
-  nir_validate_shader(nir);
+  boo(nir);
   progress |= nir_opt_peephole_select(nir);
-  nir_validate_shader(nir);
+  boo(nir);
   progress |= nir_opt_algebraic(nir);
-  nir_validate_shader(nir);
+  boo(nir);
   progress |= nir_opt_constant_folding(nir);
-  nir_validate_shader(nir);
+  boo(nir);
   progress |= nir_opt_remove_phis(nir);
-  nir_validate_shader(nir);
+  boo(nir);
} while (progress);
 }
 
@@ -96,19 +104,19 @@ fs_visitor::emit_nir_code()
   nir = prog_to_nir(prog, options);
   nir_convert_to_ssa(nir); /* turn registers into SSA */
}
-   nir_validate_shader(nir);
+   boo(nir);
 
nir_lower_global_vars_to_local(nir);
-   nir_validate_shader(nir);
+   boo(nir);
 
nir_split_var_copies(nir);
-   nir_validate_shader(nir);
+   boo(nir);
 
nir_optimize(nir);
 
/* Lower a bunch of stuff */
nir_lower_var_copies(nir);
-   nir_validate_shader(nir);
+   boo(nir);
 
/* Get rid of split copies */
nir_optimize(nir);
@@ -129,31 +137,31 @@ fs_visitor::emit_nir_code()
nir_assign_var_locations_scalar(&nir->outputs, &nir->num_outputs);
 
nir_lower_io(nir);
-   nir_validate_shader(nir);
+   boo(nir);
 
nir_remove_dead_variables(nir);
-   nir_validate_shader(nir);
+   boo(nir);
 
if (shader_prog) {
   nir_lower_samplers(nir, shader_prog, shader->base.Program);
-  nir_validate_shader(nir);
+  boo(nir);
}
 
nir_lower_system_values(nir);
-   nir_validate_shader(nir);
+   boo(nir);
 
nir_lower_atomics(nir);
-   nir_validate_shader(nir);
+   boo(nir);
 
nir_optimize(nir);
 
nir_lower_locals_to_regs(nir);
-   nir_validate_shader(nir);
+   boo(nir);
 
nir_lower_to_source_mods(nir);
-   nir_validate_shader(nir);
+   boo(nir);
nir_copy_prop(nir);
-   nir_validate_shader(nir);
+   boo(nir);
 
if (unlikely(debug_enabled)) {
   fprintf(stderr, "NIR (SSA form) for %s shader:\n", stage_name);
@@ -172,7 +180,7 @@ fs_visitor::emit_nir_code()
}
 
nir_convert_from_ssa(nir);
-   nir_validate_shader(nir);
+   boo(nir);
 
/* This is the last pass we run before we start emitting stuff.  It
 * determines when we need to insert boolean resolves on Gen <= 5.  We
-- 
2.3.4

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


[Mesa-dev] [PATCH 1/9] nir: Combine remove_dead_local_vars() and remove_dead_global_vars().

2015-03-28 Thread Kenneth Graunke
We can just pass a pointer to the list of variables, and reuse the code.

Signed-off-by: Kenneth Graunke 
---
 src/glsl/nir/nir_remove_dead_variables.c | 18 --
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/src/glsl/nir/nir_remove_dead_variables.c 
b/src/glsl/nir/nir_remove_dead_variables.c
index e7f8aea..baa321e 100644
--- a/src/glsl/nir/nir_remove_dead_variables.c
+++ b/src/glsl/nir/nir_remove_dead_variables.c
@@ -98,19 +98,9 @@ add_var_use_shader(nir_shader *shader, struct set *live)
 }
 
 static void
-remove_dead_local_vars(nir_function_impl *impl, struct set *live)
+remove_dead_vars(struct exec_list *var_list, struct set *live)
 {
-   foreach_list_typed_safe(nir_variable, var, node, &impl->locals) {
-  struct set_entry *entry = _mesa_set_search(live, var);
-  if (entry == NULL)
- exec_node_remove(&var->node);
-   }
-}
-
-static void
-remove_dead_global_vars(nir_shader *shader, struct set *live)
-{
-   foreach_list_typed_safe(nir_variable, var, node, &shader->globals) {
+   foreach_list_typed_safe(nir_variable, var, node, var_list) {
   struct set_entry *entry = _mesa_set_search(live, var);
   if (entry == NULL)
  exec_node_remove(&var->node);
@@ -125,11 +115,11 @@ nir_remove_dead_variables(nir_shader *shader)
 
add_var_use_shader(shader, live);
 
-   remove_dead_global_vars(shader, live);
+   remove_dead_vars(&shader->globals, live);
 
nir_foreach_overload(shader, overload) {
   if (overload->impl)
- remove_dead_local_vars(overload->impl, live);
+ remove_dead_vars(&overload->impl->locals, live);
}
 
_mesa_set_destroy(live, NULL);
-- 
2.3.4

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


[Mesa-dev] [PATCH 3/9] nir: Make nir_create_function() strdup the function name.

2015-03-28 Thread Kenneth Graunke
glsl_to_nir passes in the ir_function's name field; we were copying the
pointer, but not duplicating the memory.

We want to be able to free the linked GLSL IR program after translating
to NIR, so we'll need to create a copy of the function name that the NIR
shader actually owns.

Signed-off-by: Kenneth Graunke 
---
 src/glsl/nir/nir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 6459d51..0311d8d 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -108,7 +108,7 @@ nir_function_create(nir_shader *shader, const char *name)
 
exec_list_push_tail(&shader->functions, &func->node);
exec_list_make_empty(&func->overload_list);
-   func->name = name;
+   func->name = ralloc_strdup(func, name);
func->shader = shader;
 
return func;
-- 
2.3.4

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


[Mesa-dev] [PATCH 8/9] nir: Implement a nir_sweep() pass.

2015-03-28 Thread Kenneth Graunke
This pass performs a mark and sweep pass over a nir_shader's associated
memory - anything still connected to the program will be kept, and any
dead memory we dropped on the floor will be freed.

The expectation is that this will be called when finished building and
optimizing the shader.  However, it's also fine to call it earlier, and
many times, to free up memory earlier.

Signed-off-by: Kenneth Graunke 
---
 src/glsl/Makefile.sources |   1 +
 src/glsl/nir/nir.h|   2 +
 src/glsl/nir/nir_sweep.c  | 299 ++
 3 files changed, 302 insertions(+)
 create mode 100644 src/glsl/nir/nir_sweep.c

diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index 8d29c55..7046407 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -54,6 +54,7 @@ NIR_FILES = \
nir/nir_search.c \
nir/nir_search.h \
nir/nir_split_var_copies.c \
+   nir/nir_sweep.c \
nir/nir_to_ssa.c \
nir/nir_types.h \
nir/nir_validate.c \
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 7b886e3..946f895 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1632,6 +1632,8 @@ bool nir_opt_peephole_ffma(nir_shader *shader);
 
 bool nir_opt_remove_phis(nir_shader *shader);
 
+void nir_sweep(nir_shader *shader);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
diff --git a/src/glsl/nir/nir_sweep.c b/src/glsl/nir/nir_sweep.c
new file mode 100644
index 000..cba5be7
--- /dev/null
+++ b/src/glsl/nir/nir_sweep.c
@@ -0,0 +1,299 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * 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.h"
+
+/**
+ * \file nir_sweep.c
+ *
+ * The nir_sweep() pass performs a mark and sweep pass over a nir_shader's 
associated
+ * memory - anything still connected to the program will be kept, and any dead 
memory
+ * we dropped on the floor will be freed.
+ *
+ * The expectation is that drivers should call this when finished compiling 
the shader
+ * (after any optimization, lowering, and so on).  However, it's also fine to 
call it
+ * earlier, and even many times, trading CPU cycles for memory savings.
+ */
+
+#define steal_list(mem_ctx, type, list) \
+   foreach_list_typed(type, obj, node, list) { ralloc_steal(mem_ctx, obj); }
+
+static void sweep_cf_node(nir_shader *nir, nir_cf_node *cf_node);
+
+static void
+sweep_ssa_def(nir_shader *nir, nir_ssa_def *ssa)
+{
+   ralloc_steal(nir, ssa->uses);
+   ralloc_steal(nir, ssa->if_uses);
+}
+
+static void
+sweep_src(nir_shader *nir, nir_src *src)
+{
+   if (!src)
+  return;
+
+   if (src->is_ssa) {
+  sweep_ssa_def(nir, src->ssa);
+   } else {
+  sweep_src(nir, src->reg.indirect);
+   }
+}
+
+static void
+sweep_dest(nir_shader *nir, nir_dest *dest)
+{
+   if (dest->is_ssa) {
+  sweep_ssa_def(nir, &dest->ssa);
+   } else {
+  sweep_src(nir, dest->reg.indirect);
+   }
+}
+
+static void
+sweep_deref_chain(nir_shader *nir, nir_deref *deref)
+{
+   for (; deref; deref = deref->child) {
+  ralloc_steal(nir, deref);
+   }
+}
+
+static void
+sweep_alu_instr(nir_shader *nir, nir_alu_instr *alu)
+{
+   for (int i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
+  sweep_src(nir, &alu->src[i].src);
+   }
+
+   sweep_dest(nir, &alu->dest.dest);
+}
+
+static void
+sweep_call_instr(nir_shader *nir, nir_call_instr *call)
+{
+   ralloc_steal(nir, call->params);
+   for (int i = 0; i < call->num_params; i++) {
+  sweep_deref_chain(nir, &call->params[i]->deref);
+   }
+   if (call->return_deref)
+  sweep_deref_chain(nir, &call->return_deref->deref);
+}
+
+static void
+sweep_tex_instr(nir_shader *nir, nir_tex_instr *tex)
+{
+   if (tex->sampler)
+  sweep_deref_chain(nir, &tex->sampler->deref);
+
+   ralloc_steal(nir, tex->src);
+   for (int i = 0; i < tex->num_srcs; i++) {
+  sweep_src(nir, &tex->src[i].src);
+   }
+}
+
+static void
+sweep_intr

[Mesa-dev] [PATCH 5/9] nir: Allocate predecessor and dominance frontier sets from block itself.

2015-03-28 Thread Kenneth Graunke
These sets are part of the block, and their lifetime needs to match the
block itself.  So, allocate them using the block itself as the context.

Signed-off-by: Kenneth Graunke 
---
 src/glsl/nir/nir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index e96f113..73d3008 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -285,10 +285,10 @@ nir_block_create(void *mem_ctx)
cf_init(&block->cf_node, nir_cf_node_block);
 
block->successors[0] = block->successors[1] = NULL;
-   block->predecessors = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   block->predecessors = _mesa_set_create(block, _mesa_hash_pointer,
   _mesa_key_pointer_equal);
block->imm_dom = NULL;
-   block->dom_frontier = _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+   block->dom_frontier = _mesa_set_create(block, _mesa_hash_pointer,
   _mesa_key_pointer_equal);
 
exec_list_make_empty(&block->instr_list);
-- 
2.3.4

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


[Mesa-dev] [Bug 89328] python required to build Mesa release tarballs

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

Emil Velikov  changed:

   What|Removed |Added

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

--- Comment #5 from Emil Velikov  ---
Hi Jonathan,

Can you give mesa 10.5.2 a try and reopen if this is still an issue. It's not
perfect solution atm, as configure will error out if you have python while mako
is not found. There are some patches that should resolve this but they haven't
been reviewed yet.

Thanks
Emil

-- 
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 89680] Hard link exist in Mesa 10.5.1 sources

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

Emil Velikov  changed:

   What|Removed |Added

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

--- Comment #3 from Emil Velikov  ---
Upon closer look the r200 ones are dereferenced upon compression, so a second
copy of the files is shipped.

Alexander, 10.5.2 should resolve this bug plus it adds the egl/haiku files, so
that you guys actually have the source to actually build stuff :-)

Thanks
Emil

-- 
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 81992] mapi_stub->name points to caller memory leads heap-use-after-free bug

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

Emil Velikov  changed:

   What|Removed |Added

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

--- Comment #2 from Emil Velikov  ---
A similar commit landed recently in master and is in mesa 10.5.2. Don't think
that we'll be doing any more 10.3 or 10.4 releases, but if we do this commit
will be in there.

commit 1110113a7f0b6f9b21dd26dee8e95a021041c71c
Author: Mario Kleiner 
Date:   Thu Mar 12 23:34:12 2015 +0100

mapi: Make private copies of name strings provided by client.

glXGetProcAddress("glFoo") ends up in stub_add_dynamic() to

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


Re: [Mesa-dev] [PATCH 8/9] nir: Implement a nir_sweep() pass.

2015-03-28 Thread Jason Ekstrand
Two comments at the moment.

1) s/sweep/steal/
2) I think I'll have more comments and would like you to wait for me to get
a chance to look through it before pushing.
--Jason
On Mar 28, 2015 4:29 PM, "Kenneth Graunke"  wrote:

> This pass performs a mark and sweep pass over a nir_shader's associated
> memory - anything still connected to the program will be kept, and any
> dead memory we dropped on the floor will be freed.
>
> The expectation is that this will be called when finished building and
> optimizing the shader.  However, it's also fine to call it earlier, and
> many times, to free up memory earlier.
>
> Signed-off-by: Kenneth Graunke 
> ---
>  src/glsl/Makefile.sources |   1 +
>  src/glsl/nir/nir.h|   2 +
>  src/glsl/nir/nir_sweep.c  | 299
> ++
>  3 files changed, 302 insertions(+)
>  create mode 100644 src/glsl/nir/nir_sweep.c
>
> diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
> index 8d29c55..7046407 100644
> --- a/src/glsl/Makefile.sources
> +++ b/src/glsl/Makefile.sources
> @@ -54,6 +54,7 @@ NIR_FILES = \
> nir/nir_search.c \
> nir/nir_search.h \
> nir/nir_split_var_copies.c \
> +   nir/nir_sweep.c \
> nir/nir_to_ssa.c \
> nir/nir_types.h \
> nir/nir_validate.c \
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 7b886e3..946f895 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -1632,6 +1632,8 @@ bool nir_opt_peephole_ffma(nir_shader *shader);
>
>  bool nir_opt_remove_phis(nir_shader *shader);
>
> +void nir_sweep(nir_shader *shader);
> +
>  #ifdef __cplusplus
>  } /* extern "C" */
>  #endif
> diff --git a/src/glsl/nir/nir_sweep.c b/src/glsl/nir/nir_sweep.c
> new file mode 100644
> index 000..cba5be7
> --- /dev/null
> +++ b/src/glsl/nir/nir_sweep.c
> @@ -0,0 +1,299 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * 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.h"
> +
> +/**
> + * \file nir_sweep.c
> + *
> + * The nir_sweep() pass performs a mark and sweep pass over a
> nir_shader's associated
> + * memory - anything still connected to the program will be kept, and any
> dead memory
> + * we dropped on the floor will be freed.
> + *
> + * The expectation is that drivers should call this when finished
> compiling the shader
> + * (after any optimization, lowering, and so on).  However, it's also
> fine to call it
> + * earlier, and even many times, trading CPU cycles for memory savings.
> + */
> +
> +#define steal_list(mem_ctx, type, list) \
> +   foreach_list_typed(type, obj, node, list) { ralloc_steal(mem_ctx,
> obj); }
> +
> +static void sweep_cf_node(nir_shader *nir, nir_cf_node *cf_node);
> +
> +static void
> +sweep_ssa_def(nir_shader *nir, nir_ssa_def *ssa)
> +{
> +   ralloc_steal(nir, ssa->uses);
> +   ralloc_steal(nir, ssa->if_uses);
> +}
> +
> +static void
> +sweep_src(nir_shader *nir, nir_src *src)
> +{
> +   if (!src)
> +  return;
> +
> +   if (src->is_ssa) {
> +  sweep_ssa_def(nir, src->ssa);
> +   } else {
> +  sweep_src(nir, src->reg.indirect);
> +   }
> +}
> +
> +static void
> +sweep_dest(nir_shader *nir, nir_dest *dest)
> +{
> +   if (dest->is_ssa) {
> +  sweep_ssa_def(nir, &dest->ssa);
> +   } else {
> +  sweep_src(nir, dest->reg.indirect);
> +   }
> +}
> +
> +static void
> +sweep_deref_chain(nir_shader *nir, nir_deref *deref)
> +{
> +   for (; deref; deref = deref->child) {
> +  ralloc_steal(nir, deref);
> +   }
> +}
> +
> +static void
> +sweep_alu_instr(nir_shader *nir, nir_alu_instr *alu)
> +{
> +   for (int i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
> +  sweep_src(nir, &alu->src[i].src);
> +   }
> +
> +   sweep_dest(nir, &alu->dest.dest);
> +}
> +
> +static void
> +sweep_call_instr(nir_shader *nir, nir_call_instr *call)
> +{
> +   ralloc_s

Re: [Mesa-dev] [Piglit] [PATCH] mesa/state_tracker: Fix draw-pixel-with-texture piglit test.

2015-03-28 Thread Emil Velikov
Hi Matthew

I'm suspecting that this patch was meant for mesa-dev ?

-Emil

On 28/03/15 17:07, Matthew Dawson wrote:
> When glDrawPixels was used with an external texture, the pixels passed in
> were sampled instead of the texture.  Change gallium to instead move the user
> texture to a new sampler below the glDrawPixels samplers and use the texture
> coordinates from the raster position.
> 
> This uses a uniform for the texture coordinates instead passing it through
> the vertex shader as the texture coordinates are constant for the entire
> operation.  While working the vertex shader would be possible, implementing
> that solution would break several assumptions throughout the glDrawPixels
> implementation as well as helper functions used by other code paths, 
> increasing
> the chance for breakage.
> 
> Tested on llvmpipe, r600, and radeonsi.
> 
> V2: Complete everything missing from V1.
> 
> v3:
>  - Fix style issues.
>  - Add comments about how the texture references are fixed up to be valid.
> ---
>  src/mesa/state_tracker/st_cb_drawpixels.c  | 39 ++---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 40 
> ++
>  2 files changed, 76 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c 
> b/src/mesa/state_tracker/st_cb_drawpixels.c
> index 3edf31b..47abd16 100644
> --- a/src/mesa/state_tracker/st_cb_drawpixels.c
> +++ b/src/mesa/state_tracker/st_cb_drawpixels.c
> @@ -44,6 +44,7 @@
>  #include "main/texstore.h"
>  #include "main/glformats.h"
>  #include "program/program.h"
> +#include "program/prog_parameter.h"
>  #include "program/prog_print.h"
>  #include "program/prog_instruction.h"
>  
> @@ -676,6 +677,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint 
> y, GLfloat z,
> GLfloat x0, y0, x1, y1;
> GLsizei maxSize;
> boolean normalized = sv[0]->texture->target != PIPE_TEXTURE_RECT;
> +   GLuint num_user_samplers = st->state.num_samplers[PIPE_SHADER_FRAGMENT];
> +   unsigned int i;
>  
> /* limit checks */
> /* XXX if DrawPixels image is larger than max texture size, break
> @@ -765,6 +768,10 @@ draw_textured_quad(struct gl_context *ctx, GLint x, 
> GLint y, GLfloat z,
>if (num_sampler_view > 1) {
>   cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, 1, &sampler);
>}
> +  for (i = 0; i < num_user_samplers; ++i) {
> + cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, i+num_sampler_view,
> +&st->state.samplers[PIPE_SHADER_FRAGMENT][i]);
> +  }
>cso_single_sampler_done(cso, PIPE_SHADER_FRAGMENT);
> }
>  
> @@ -786,7 +793,14 @@ draw_textured_quad(struct gl_context *ctx, GLint x, 
> GLint y, GLfloat z,
> cso_set_stream_outputs(st->cso_context, 0, NULL, NULL);
>  
> /* texture state: */
> -   cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num_sampler_view, sv);
> +   {
> +  struct pipe_sampler_view *lsv[PIPE_MAX_SAMPLERS];
> +  memcpy(lsv, sv, num_sampler_view*sizeof(struct pipe_sampler_view*));
> +  memcpy(lsv+num_sampler_view, 
> st->state.sampler_views[PIPE_SHADER_FRAGMENT],
> + num_user_samplers*sizeof(struct pipe_sampler_view*));
> +  cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT,
> +num_sampler_view+num_user_samplers, lsv);
> +   }
>  
> /* Compute Gallium window coords (y=0=top) with pixel zoom.
>  * Recall that these coords are transformed by the current
> @@ -1160,8 +1174,27 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
>}
> }
>  
> -   /* update fragment program constants */
> -   st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT);
> +   /* updated texture coordinates and fragment program constants. */
> +   {
> +  int i;
> +  struct gl_program_parameter_list *parameters = fpv->parameters;
> +  /* Update the texture coordinates from all the used texture units, 
> using
> +   * the values associated with the raster position */
> +  for (i = 0; i < parameters->NumParameters; ++i) {
> + const char *name = parameters->Parameters[i].Name;
> + /* Any texture coordinate will use the parameter name texcoord_, 
> where
> +  * _ is the texture units id added to the ascii character 'A'.  This
> +  * checks if a parameter matches this patterns, and updates the
> +  * parameter's value with the appropriate raster position texture
> +  * coordinate. */
> + if (strncmp("texcoord", name, 8) == 0 && strlen(name) == 9) {
> +memcpy(parameters->ParameterValues[i],
> +   st->ctx->Current.RasterTexCoords[name[8] - 'A'],
> +   sizeof(GL_FLOAT) * 4);
> + }
> +  }
> +  st_upload_constants(st, parameters, PIPE_SHADER_FRAGMENT);
> +   }
>  
> /* draw with textured quad */
> {
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> i

Re: [Mesa-dev] [PATCH 14/16] android: add inital NIR build

2015-03-28 Thread Emil Velikov
On 28 March 2015 at 20:54, Emil Velikov  wrote:
> From: Mauro Rossi 
>
> Required by the i965 driver.
>
> Cc: "10.5" 
> [Emil Velikov: Split from a larger commit]
> Signed-off-by: Emil Velikov 
> ---
>  src/glsl/Android.gen.mk | 62 
> +++--
>  src/glsl/Android.mk |  3 +-
>  src/mesa/drivers/dri/Android.mk |  1 +
>  3 files changed, 63 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
> index 7ec56d4..82f2bf1 100644
> --- a/src/glsl/Android.gen.mk
> +++ b/src/glsl/Android.gen.mk
> @@ -33,11 +33,21 @@ sources := \
> glsl_lexer.cpp \
> glsl_parser.cpp \
> glcpp/glcpp-lex.c \
> -   glcpp/glcpp-parse.c
> +   glcpp/glcpp-parse.c \
> +   nir/nir_builder_opcodes.h \

Seems like the nir_builder_opcodes.h addition came after the 10.5
branchpoint. So in order to get this for 10.5 we'll need to split them
out into a separate patch.

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


Re: [Mesa-dev] [PATCH 2/2] configure.ac: error out if python/mako is not found when required

2015-03-28 Thread Bernd Kuhls
Hi,

Emil Velikov  wrote in news:1427132964-21468-2-
git-send-email-emil.l.veli...@gmail.com:

> In case of using a distribution tarball (or a dirty git tree) one can
> have the generated sources locally. Make configure.ac error out
> otherwise, to alert that about the unmet requirement(s) of python/mako.

[...]

> +if test "x$acv_mako_found" = xno; then
> +if test ! -f "$srcdir/src/glsl/nir/nir_builder_opcodes.h" -o \

I can not find any reference to this file in the mesa3d 10.5.2 tarball. Is 
it save to assume that the check for this file can be removed from the 
patch when applied to 10.5 branch?

When python is missing on the build machine there is still an error using 
these configure options:

--disable-glx --disable-xa --disable-static --enable-shared-glapi --with-
gallium-drivers=nouveau,r600,svga,swrast --without-dri-drivers --disable-
dri3 --enable-opengl --enable-gbm --enable-egl --with-egl-platforms=drm --
enable-gles1 --enable-gles2

make[7]: Entering directory `/home/br/br3/output/build/mesa3d-
10.5.2/src/mesa/drivers/dri/common/xmlpool'
Updating (ca) ca/LC_MESSAGES/options.mo from ca.po.
Updating (de) de/LC_MESSAGES/options.mo from de.po.
Updating (es) es/LC_MESSAGES/options.mo from es.po.
Updating (nl) nl/LC_MESSAGES/options.mo from nl.po.
Updating (fr) fr/LC_MESSAGES/options.mo from fr.po.
Updating (sv) sv/LC_MESSAGES/options.mo from sv.po.
  GEN  options.h
/bin/bash: ./gen_xmlpool.py: Permission denied
make[7]: *** [options.h] Error 126

The reason is src/mesa/drivers/dri/common/xmlpool/Makefile.am, line 66

options.h: t_options.h $(MOS)

Files mentioned in $(MOS) are newer after their creation during the build 
than the pre-supplied options.h.

This hack fixes the build error here:

-options.h: t_options.h $(MOS)
+options.h: t_options.h

Regards, Bernd

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


[Mesa-dev] [PATCH] nir: acknowledge the existence of nir_builder.h

2015-03-28 Thread Emil Velikov
The header was added with commit 2a135c470e3(nir: Add an ALU op builder
kind of like ir_builder.h) but did not made it into to the sources list,
and its dependency of nir_builder_opcodes.h was missing.

Fortunately it remained unused until resent commit faf6106c6f6(nir:
Implement a Mesa IR -> NIR translator.)

Cc: Kenneth Graunke 
Cc: Eric Anholt 
Signed-off-by: Emil Velikov 
---

Not sure how the out-of-tree build was able to finish without this, 
although the commit looks like a must have if we want the file in the 
tarball.

Based on top of the earlier Android series.

-Emil

---
 src/glsl/Android.gen.mk   | 2 ++
 src/glsl/Makefile.am  | 2 ++
 src/glsl/Makefile.sources | 1 +
 3 files changed, 5 insertions(+)

diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
index 82f2bf1..2f54da4 100644
--- a/src/glsl/Android.gen.mk
+++ b/src/glsl/Android.gen.mk
@@ -97,6 +97,8 @@ $(intermediates)/nir/nir_builder_opcodes.h: 
$(nir_builder_opcodes_deps)
@mkdir -p $(dir $@)
@$(MESA_PYTHON2) $(nir_builder_opcodes_gen) $< > $@
 
+$(LOCAL_PATH)/nir/nir_builder.h: $(intermediates)/nir/nir_builder_opcodes.h
+
 nir_constant_expressions_gen := $(LOCAL_PATH)/nir/nir_constant_expressions.py
 nir_constant_expressions_deps := \
$(LOCAL_PATH)/nir/nir_opcodes.py \
diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index ed90366..58af166 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -244,6 +244,8 @@ nir/nir_builder_opcodes.h: nir/nir_opcodes.py 
nir/nir_builder_opcodes_h.py
$(MKDIR_P) nir; \
$(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_builder_opcodes_h.py > $@
 
+nir/nir_builder.h: nir/nir_builder_opcodes.h
+
 nir/nir_constant_expressions.c: nir/nir_opcodes.py 
nir/nir_constant_expressions.py nir/nir_constant_expressions.h
$(MKDIR_P) nir; \
$(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/nir/nir_constant_expressions.py > 
$@
diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index 8d29c55..c3b63d1 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -22,6 +22,7 @@ NIR_FILES = \
nir/glsl_to_nir.h \
nir/nir.c \
nir/nir.h \
+   nir/nir_builder.h \
nir/nir_constant_expressions.h \
nir/nir_dominance.c \
nir/nir_from_ssa.c \
-- 
2.3.1

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


[Mesa-dev] [PATCH] osmesa: don't try to bundle osmesa.def SConscript

2015-03-28 Thread Emil Velikov
Both of which were removed with commit 69db422218b(scons: Don't build
osmesa.)

Cc: Jose Fonseca 
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/osmesa/Makefile.am | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/mesa/drivers/osmesa/Makefile.am 
b/src/mesa/drivers/osmesa/Makefile.am
index 60048cc..9a388d6 100644
--- a/src/mesa/drivers/osmesa/Makefile.am
+++ b/src/mesa/drivers/osmesa/Makefile.am
@@ -21,8 +21,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-EXTRA_DIST = osmesa.def SConscript
-
 AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-- 
2.3.1

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


Re: [Mesa-dev] [PATCH v2 06/15] st/mesa: implement GL_AMD_performance_monitor

2015-03-28 Thread Marek Olšák
On Sat, Mar 28, 2015 at 9:43 PM, Martin Peres  wrote:
> On 22/03/2015 17:35, Samuel Pitoiset wrote:
>>
>> From: Christoph Bumiller 
>>
>> This is based on the original patch of Christoph Bumiller.
>> (source: http://people.freedesktop.org/~chrisbmr/perfmon.diff)
>
>
> It would be nice if you could add "v2: Samuel Pitoiset" and tell what you
> changed. Christoph may delete his perfmon.diff and no-one will be able to
> diff the diffs :)
>
>>
>> As for the Gallium HUD, we keep a list of busy queries in a ring
>> buffer in order to prevent stalls when reading queries.
>>
>> Drivers must implement get_driver_query_group_info and
>> get_driver_query_info in order to enable this extension.
>>
>> Signed-off-by: Samuel Pitoiset 
>> ---
>>   src/mesa/Makefile.sources  |   2 +
>>   src/mesa/state_tracker/st_cb_perfmon.c | 455
>> +
>>   src/mesa/state_tracker/st_cb_perfmon.h |  70 +
>>   src/mesa/state_tracker/st_context.c|   4 +
>>   src/mesa/state_tracker/st_extensions.c |   3 +
>>   5 files changed, 534 insertions(+)
>>   create mode 100644 src/mesa/state_tracker/st_cb_perfmon.c
>>   create mode 100644 src/mesa/state_tracker/st_cb_perfmon.h
>>
>> diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
>> index 217be9a..e54e618 100644
>> --- a/src/mesa/Makefile.sources
>> +++ b/src/mesa/Makefile.sources
>> @@ -432,6 +432,8 @@ STATETRACKER_FILES = \
>> state_tracker/st_cb_flush.h \
>> state_tracker/st_cb_msaa.c \
>> state_tracker/st_cb_msaa.h \
>> +   state_tracker/st_cb_perfmon.c \
>> +   state_tracker/st_cb_perfmon.h \
>> state_tracker/st_cb_program.c \
>> state_tracker/st_cb_program.h \
>> state_tracker/st_cb_queryobj.c \
>> diff --git a/src/mesa/state_tracker/st_cb_perfmon.c
>> b/src/mesa/state_tracker/st_cb_perfmon.c
>> new file mode 100644
>> index 000..fb6774b
>> --- /dev/null
>> +++ b/src/mesa/state_tracker/st_cb_perfmon.c
>> @@ -0,0 +1,455 @@
>> +/*
>> + * Copyright (C) 2013 Christoph Bumiller
>> + * Copyright (C) 2015 Samuel Pitoiset
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining
>> a
>> + * copy of this software and associated documentation files (the
>> "Software"),
>> + * to deal in the Software without restriction, including without
>> limitation
>> + * the rights to use, copy, modify, merge, publish, distribute,
>> sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice shall be
>> included in
>> + * all copies or substantial portions of the Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
>> SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
>> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
>> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
>> + * OTHER DEALINGS IN THE SOFTWARE.
>> + */
>> +
>> +/**
>> + * Performance monitoring counters interface to gallium.
>> + */
>> +
>> +#include "st_context.h"
>> +#include "st_cb_bitmap.h"
>> +#include "st_cb_perfmon.h"
>> +
>> +#include "util/bitset.h"
>> +
>> +#include "pipe/p_context.h"
>> +#include "pipe/p_screen.h"
>> +#include "util/u_memory.h"
>> +
>> +/**
>> + * Return a PIPE_QUERY_x type >= PIPE_QUERY_DRIVER_SPECIFIC, or -1 if
>> + * the driver-specific query doesn't exist.
>> + */
>> +static int
>> +find_query_type(struct pipe_screen *screen, const char *name)
>> +{
>> +   int num_queries;
>> +   int type = -1;
>> +   int i;
>> +
>> +   num_queries = screen->get_driver_query_info(screen, 0, NULL);
>> +   if (!num_queries)
>> +  return type;
>> +
>> +   for (i = 0; i < num_queries; i++) {
>> +  struct pipe_driver_query_info info;
>> +
>> +  if (!screen->get_driver_query_info(screen, i, &info))
>> + continue;
>> +
>> +  if (!strncmp(info.name, name, strlen(name))) {
>> + type = info.query_type;
>> + break;
>> +  }
>> +   }
>> +   return type;
>> +}
>> +
>> +static bool
>> +init_perf_monitor(struct gl_context *ctx, struct gl_perf_monitor_object
>> *m)
>> +{
>> +   struct st_perf_monitor_object *stm = st_perf_monitor_object(m);
>> +   struct pipe_screen *screen = st_context(ctx)->pipe->screen;
>> +   struct pipe_context *pipe = st_context(ctx)->pipe;
>> +   int gid, cid;
>> +
>> +   st_flush_bitmap_cache(st_context(ctx));
>> +
>> +   /* Create a query for each active counter. */
>> +   for (gid = 0; gid < ctx->PerfMonitor.NumGroups; gid++) {
>> +  const struct gl_perf_monitor_group *g =
>> &ctx->PerfMonitor.Groups[gid];
>> +  for (cid = 0; cid < g->NumCounters; cid++) {
>> + con

Re: [Mesa-dev] [PATCH 14/16] android: add inital NIR build

2015-03-28 Thread Kenneth Graunke
On Sunday, March 29, 2015 12:14:50 AM Emil Velikov wrote:
> On 28 March 2015 at 20:54, Emil Velikov  wrote:
> > From: Mauro Rossi 
> >
> > Required by the i965 driver.
> >
> > Cc: "10.5" 
> > [Emil Velikov: Split from a larger commit]
> > Signed-off-by: Emil Velikov 
> > ---
> >  src/glsl/Android.gen.mk | 62 
+++--
> >  src/glsl/Android.mk |  3 +-
> >  src/mesa/drivers/dri/Android.mk |  1 +
> >  3 files changed, 63 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
> > index 7ec56d4..82f2bf1 100644
> > --- a/src/glsl/Android.gen.mk
> > +++ b/src/glsl/Android.gen.mk
> > @@ -33,11 +33,21 @@ sources := \
> > glsl_lexer.cpp \
> > glsl_parser.cpp \
> > glcpp/glcpp-lex.c \
> > -   glcpp/glcpp-parse.c
> > +   glcpp/glcpp-parse.c \
> > +   nir/nir_builder_opcodes.h \
> 
> Seems like the nir_builder_opcodes.h addition came after the 10.5
> branchpoint. So in order to get this for 10.5 we'll need to split them
> out into a separate patch.
> 
> -Emil

Building NIR on 10.5 isn't really worth doing - the version we've got in
master now is pretty solid, but the version in 10.5 offers only bugs,
and no actual performance benefits.

I'd just skip it, honestly - I've actually thought about just patching
it out of 10.5 so people don't report bugs against outdated code.

We're aiming to have NIR up and running in 10.6.

--Ken


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