Re: [Mesa-dev] [PATCH] glsl: Properly lex extra tokens when handling # directives.

2014-06-12 Thread Matt Turner
How did you notice this? (More specifically than semicolons being
printed in your terminals!)

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


Re: [Mesa-dev] [PATCH] configure: correctly autodetect xvmc/vdpau/omx

2014-06-12 Thread Christian König

Am 11.06.2014 23:46, schrieb Emil Velikov:

Commit e62b7d38a1d (configure: autodetect video state-trackers
when non swrast driver is present) added a check that caused
the autodetection to be omitted when we have the swrast gallium
driver. Whereas it should have skipped the VL targets when only
swrast was selected.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79907
Cc: 10.2 mesa-sta...@lists.freedesktop.org
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com


I was already wondering what's going wrong there. Thanks for all the 
work maintaining the build system.


Patch is Reviewed-by: Christian König christian.koe...@amd.com


---
  configure.ac | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 7b0009d..a19f777 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1412,7 +1412,7 @@ AM_CONDITIONAL(HAVE_OPENVG, test x$enable_openvg = xyes)
  dnl
  dnl Gallium G3DVL configuration
  dnl
-if test -n $with_gallium_drivers  ! echo $with_gallium_drivers | grep -q 
'swrast'; then
+if test -n $with_gallium_drivers -a x$with_gallium_drivers != xswrast; then
  if test x$enable_xvmc = xauto; then
PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no])
  fi


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


Re: [Mesa-dev] [PATCH 01/18] glsl: Add parsing support for multi-stream output in geometry shaders.

2014-06-12 Thread Samuel Iglesias Gonsálvez
On Wed, 2014-06-11 at 15:29 -0700, Ian Romanick wrote:
 On 06/11/2014 12:49 AM, Iago Toral Quiroga wrote:
  From: Samuel Iglesias Gonsalvez sigles...@igalia.com
  
  This implements parsing requirements for multi-stream support in
  geometry shaders as defined in ARB_gpu_shader5.
  
  Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
  ---
   src/glsl/ast.h  |  5 +
   src/glsl/ast_to_hir.cpp |  6 ++
   src/glsl/ast_type.cpp   | 19 ++-
   src/glsl/glsl_parser.yy | 45 +
   src/glsl/ir.h   |  5 +
   5 files changed, 79 insertions(+), 1 deletion(-)
  
  diff --git a/src/glsl/ast.h b/src/glsl/ast.h
  index 56e7bd8..823b1d2 100644
  --- a/src/glsl/ast.h
  +++ b/src/glsl/ast.h
  @@ -509,6 +509,8 @@ struct ast_type_qualifier {
/** \name Layout qualifiers for GL_ARB_gpu_shader5 */
/** \{ */
unsigned invocations:1;
  + unsigned streamId:1; /* Has streamId value assigned  */
  + unsigned explicit_streamId:1; /* streamId value assigned 
  explicitely by shader code */
/** \} */
 }
 /** \brief Set of flags, accessed by name. */
  @@ -542,6 +544,9 @@ struct ast_type_qualifier {
  /** Maximum output vertices in GLSL 1.50 geometry shaders. */
  int max_vertices;
   
  +   /** Stream ID in GLSL 1.50 geometry shaders. */
  +   unsigned streamId;
  +
  /** Input or output primitive type in GLSL 1.50 geometry shaders */
  GLenum prim_type;
   
  diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
  index 140bb74..ab0f50f 100644
  --- a/src/glsl/ast_to_hir.cpp
  +++ b/src/glsl/ast_to_hir.cpp
  @@ -2426,6 +2426,11 @@ apply_type_qualifier_to_variable(const struct 
  ast_type_qualifier *qual,
  if (qual-flags.q.sample)
 var-data.sample = 1;
   
  +   if (state-stage == MESA_SHADER_GEOMETRY 
  +   qual-flags.q.out  qual-flags.q.streamId) {
  +  var-data.streamId = qual-streamId;
  +   }
  +
  if (qual-flags.q.attribute  state-stage != MESA_SHADER_VERTEX) {
 var-type = glsl_type::error_type;
 _mesa_glsl_error(loc, state,
  @@ -5455,6 +5460,7 @@ ast_interface_block::hir(exec_list *instructions,
var-data.centroid = fields[i].centroid;
var-data.sample = fields[i].sample;
var-init_interface_type(block_type);
  + var-data.streamId = this-layout.streamId;
   
if (redeclaring_per_vertex) {
   ir_variable *earlier =
  diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
  index 0ee2c49..749f161 100644
  --- a/src/glsl/ast_type.cpp
  +++ b/src/glsl/ast_type.cpp
  @@ -125,9 +125,13 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
  /* Uniform block layout qualifiers get to overwrite each
   * other (rightmost having priority), while all other
   * qualifiers currently don't allow duplicates.
  +*
  +* Geometry shaders can have several layout qualifiers
  +* assigning different stream ID values.
   */
   
  -   if ((this-flags.i  q.flags.i  ~(ubo_mat_mask.flags.i |
  +   if ((state-stage != MESA_SHADER_GEOMETRY) 
  +   (this-flags.i  q.flags.i  ~(ubo_mat_mask.flags.i |
ubo_layout_mask.flags.i |
 ubo_binding_mask.flags.i)) != 0) {
 
 I think this will allow multiply layout(location=) qualifiers on
 geometry shader inputs / outputs.  So...
 
 #version 150
 #extension GL_ARB_separate_shader_objects: require
 
 layout(location=1) layout(location=2) in vec4 v;
 
 should generate an error, but I think this change will disable that error.
 

OK, we will test it and modify the patch accordingly.

Thanks for the review!

Sam


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


Re: [Mesa-dev] [PATCH 05/18] glsl: Fail to link if inter-stage input/outputs are not assigned to stream 0

2014-06-12 Thread Iago Toral
It may be a bit less confusing to read if I take the inner if out, so
I'll rewrite it like this:

if (input_var || (prog-SeparateShader  consumer == NULL)) {
   matches.record(output_var, input_var);
}

if (input_var  output_var-data.streamId != 0) {
   linker_error(prog, ...);
   return false;
}

On Thu, 2014-06-12 at 07:43 +1200, Chris Forbes wrote:
 I had misread it -- yes, this looks correct.
 
 On Thu, Jun 12, 2014 at 12:02 AM, Iago Toral ito...@igalia.com wrote:
  I am a bit confused here:
 
  Reading the code it looks like input_var should be NULL if there is no
  consumer stage. In that case, if this is a separable program and there
  is no consumer, then input_var must be NULL too, in which case the
  linker_error would never take place.
 
  If input_var is not NULL then there has to be a consumer stage, and in
  that case we should check that we can link both stages, right?
 
  Iago
 
  On Wed, 2014-06-11 at 20:48 +1200, Chris Forbes wrote:
  This would appear to prohibit the use of multiple streams in separable
  programs entirely. I don't think that's the right thing.
 
  On Wed, Jun 11, 2014 at 7:49 PM, Iago Toral Quiroga ito...@igalia.com 
  wrote:
   Outputs that are linked to inputs in the next stage must be output to 
   stream 0,
   otherwise we should fail to link.
   ---
src/glsl/link_varyings.cpp | 7 +++
1 file changed, 7 insertions(+)
  
   diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
   index 9883c0b..0066b4e 100644
   --- a/src/glsl/link_varyings.cpp
   +++ b/src/glsl/link_varyings.cpp
   @@ -1343,6 +1343,13 @@ assign_varying_locations(struct gl_context *ctx,
  * consumer stage, add the output.
  */
 if (input_var || (prog-SeparateShader  consumer == NULL)) {
   +/* Only stream 0 outputs can be consumed in the next stage 
   */
   +if (input_var  output_var-data.streamId != 0) {
   +   linker_error(prog, output %s is assigned to stream=%d 
   but 
   +is linked to an input, which requires 
   stream=0,
   +output_var-name, 
   output_var-data.streamId);
   +   return false;
   +}
matches.record(output_var, input_var);
 }
  }
   --
   1.9.1
  
   ___
   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 v2] glsl: parser changes for GL_ARB_explicit_uniform_location

2014-06-12 Thread Petri Latvala


On 06/05/2014 08:08 AM, Tapani Pälli wrote:

Patch adds a preprocessor define for the extension and stores explicit
location data for uniforms during AST-HIR conversion. It also sets
layout token to be available when having the extension in place.

v2: change parser check to require GLSL 330 or enabling
 GL_ARB_explicit_attrib_location (Ian)

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
  src/glsl/ast_to_hir.cpp   | 36 
  src/glsl/glcpp/glcpp-parse.y  |  3 +++
  src/glsl/glsl_lexer.ll|  1 +
  src/glsl/glsl_parser_extras.h | 15 +++
  4 files changed, 55 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index d1c77f1..04452b8 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2182,6 +2182,42 @@ validate_explicit_location(const struct 
ast_type_qualifier *qual,
  {
 bool fail = false;
  
+   /* Checks for GL_ARB_explicit_uniform_location. */

+   if (qual-flags.q.uniform) {
+  if (!state-check_explicit_uniform_location_allowed(loc, var))
+ return;
+
+  const struct gl_context *const ctx = state-ctx;
+  unsigned max_loc = qual-location + var-type-component_slots() - 1;


var-type-uniform_locations() ?



+
+  /* ARB_explicit_uniform_location specification states:
+   *
+   * The explicitly defined locations and the generated locations
+   * must be in the range of 0 to MAX_UNIFORM_LOCATIONS minus one.
+   *
+   * Valid locations for default-block uniform variable locations
+   * are in the range of 0 to the implementation-defined maximum
+   * number of uniform locations.
+   */
+  if (qual-location  0) {
+ _mesa_glsl_error(loc, state,
+  explicit location  0 for uniform %s, var-name);
+ return;
+  }
+
+  if (max_loc = ctx-Const.MaxUserAssignableUniformLocations) {
+ _mesa_glsl_error(loc, state, location qualifier for uniform %s 
+  = MAX_UNIFORM_LOCATIONS (%u),
+  var-name,
+  ctx-Const.MaxUserAssignableUniformLocations);
+ return;
+  }


This error message might be too confusing.

If MAX_UNIFORM_LOCATIONS were 6:

uniform layout(location=3) float x[10];

Error: Location qualifier for uniform x = MAX_UNIFORM_LOCATIONS(6)

But 3 is not = 6! says the confused developer.

Maybe location qualifier or automatically assigned location or something?



+
+  var-data.explicit_location = true;
+  var-data.location = qual-location;
+  return;
+   }
+
 /* Between GL_ARB_explicit_attrib_location an
  * GL_ARB_separate_shader_objects, the inputs and outputs of any shader
  * stage can be assigned explicit locations.  The checking here associates
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 9887583..dacb954 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -2089,6 +2089,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t 
*parser, intmax_t versio
  if (extensions-ARB_explicit_attrib_location)
 add_builtin_define(parser, GL_ARB_explicit_attrib_location, 
1);
  
+	  if (extensions-ARB_explicit_uniform_location)

+add_builtin_define(parser, GL_ARB_explicit_uniform_location, 
1);
+
  if (extensions-ARB_shader_texture_lod)
 add_builtin_define(parser, GL_ARB_shader_texture_lod, 1);
  
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll

index 6c3f9b6..db7b1d1 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -396,6 +396,7 @@ layout  {
  || yyextra-AMD_conservative_depth_enable
  || yyextra-ARB_conservative_depth_enable
  || yyextra-ARB_explicit_attrib_location_enable
+ || yyextra-ARB_explicit_uniform_location_enable
|| yyextra-has_separate_shader_objects()
  || yyextra-ARB_uniform_buffer_object_enable
  || yyextra-ARB_fragment_coord_conventions_enable
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index e26460e..b73f816 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -151,6 +151,21 @@ struct _mesa_glsl_parse_state {
return true;
 }
  
+   bool check_explicit_uniform_location_allowed(YYLTYPE *locp,

+const ir_variable *var)
+   {
+  if (!this-has_explicit_attrib_location() ||
+  !this-ARB_explicit_uniform_location_enable) {
+ _mesa_glsl_error(locp, this,
+  uniform explicit location requires 
+  GL_ARB_explicit_uniform_location and either 
+  GL_ARB_explicit_attrib_location or GLSL 330.);
+ return false;
+  }
+
+  

Re: [Mesa-dev] [PATCH v2] glsl: parser changes for GL_ARB_explicit_uniform_location

2014-06-12 Thread Tapani Pälli
On 06/12/2014 09:44 AM, Petri Latvala wrote:
 On 06/05/2014 08:08 AM, Tapani Pälli wrote:
 Patch adds a preprocessor define for the extension and stores explicit
 location data for uniforms during AST-HIR conversion. It also sets
 layout token to be available when having the extension in place.

 v2: change parser check to require GLSL 330 or enabling
  GL_ARB_explicit_attrib_location (Ian)

 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
   src/glsl/ast_to_hir.cpp   | 36 
   src/glsl/glcpp/glcpp-parse.y  |  3 +++
   src/glsl/glsl_lexer.ll|  1 +
   src/glsl/glsl_parser_extras.h | 15 +++
   4 files changed, 55 insertions(+)

 diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
 index d1c77f1..04452b8 100644
 --- a/src/glsl/ast_to_hir.cpp
 +++ b/src/glsl/ast_to_hir.cpp
 @@ -2182,6 +2182,42 @@ validate_explicit_location(const struct 
 ast_type_qualifier *qual,
   {
  bool fail = false;
   
 +   /* Checks for GL_ARB_explicit_uniform_location. */
 +   if (qual-flags.q.uniform) {
 +  if (!state-check_explicit_uniform_location_allowed(loc, var))
 + return;
 +
 +  const struct gl_context *const ctx = state-ctx;
 +  unsigned max_loc = qual-location + var-type-component_slots() - 1;
 var-type-uniform_locations() ?

yes indeed, will fix


 +
 +  /* ARB_explicit_uniform_location specification states:
 +   *
 +   * The explicitly defined locations and the generated locations
 +   * must be in the range of 0 to MAX_UNIFORM_LOCATIONS minus one.
 +   *
 +   * Valid locations for default-block uniform variable locations
 +   * are in the range of 0 to the implementation-defined maximum
 +   * number of uniform locations.
 +   */
 +  if (qual-location  0) {
 + _mesa_glsl_error(loc, state,
 +  explicit location  0 for uniform %s, 
 var-name);
 + return;
 +  }
 +
 +  if (max_loc = ctx-Const.MaxUserAssignableUniformLocations) {
 + _mesa_glsl_error(loc, state, location qualifier for uniform %s 
 +  = MAX_UNIFORM_LOCATIONS (%u),
 +  var-name,
 +  ctx-Const.MaxUserAssignableUniformLocations);
 + return;
 +  }
 This error message might be too confusing.

 If MAX_UNIFORM_LOCATIONS were 6:

 uniform layout(location=3) float x[10];

 Error: Location qualifier for uniform x = MAX_UNIFORM_LOCATIONS(6)

 But 3 is not = 6! says the confused developer.

 Maybe location qualifier or automatically assigned location or something?


Nice catch and proposal, will change this.

 +
 +  var-data.explicit_location = true;
 +  var-data.location = qual-location;
 +  return;
 +   }
 +
  /* Between GL_ARB_explicit_attrib_location an
   * GL_ARB_separate_shader_objects, the inputs and outputs of any shader
   * stage can be assigned explicit locations.  The checking here 
 associates
 diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
 index 9887583..dacb954 100644
 --- a/src/glsl/glcpp/glcpp-parse.y
 +++ b/src/glsl/glcpp/glcpp-parse.y
 @@ -2089,6 +2089,9 @@ 
 _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t 
 versio
if (extensions-ARB_explicit_attrib_location)
   add_builtin_define(parser, GL_ARB_explicit_attrib_location, 
 1);
   
 +  if (extensions-ARB_explicit_uniform_location)
 + add_builtin_define(parser, GL_ARB_explicit_uniform_location, 
 1);
 +
if (extensions-ARB_shader_texture_lod)
   add_builtin_define(parser, GL_ARB_shader_texture_lod, 1);
   
 diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
 index 6c3f9b6..db7b1d1 100644
 --- a/src/glsl/glsl_lexer.ll
 +++ b/src/glsl/glsl_lexer.ll
 @@ -396,6 +396,7 @@ layout   {
|| yyextra-AMD_conservative_depth_enable
|| yyextra-ARB_conservative_depth_enable
|| yyextra-ARB_explicit_attrib_location_enable
 +  || yyextra-ARB_explicit_uniform_location_enable
 || yyextra-has_separate_shader_objects()
|| yyextra-ARB_uniform_buffer_object_enable
|| yyextra-ARB_fragment_coord_conventions_enable
 diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
 index e26460e..b73f816 100644
 --- a/src/glsl/glsl_parser_extras.h
 +++ b/src/glsl/glsl_parser_extras.h
 @@ -151,6 +151,21 @@ struct _mesa_glsl_parse_state {
 return true;
  }
   
 +   bool check_explicit_uniform_location_allowed(YYLTYPE *locp,
 +const ir_variable *var)
 +   {
 +  if (!this-has_explicit_attrib_location() ||
 +  !this-ARB_explicit_uniform_location_enable) {
 + _mesa_glsl_error(locp, this,
 +  uniform explicit location requires 
 +   

Re: [Mesa-dev] [PATCH v2] Enable GL_ARB_explicit_uniform_location in the drivers.

2014-06-12 Thread Petri Latvala

Reviewed-by: Petri Latvala petri.latv...@intel.com

On 06/09/2014 01:06 PM, Tapani Pälli wrote:

v2: enable also for i915 (Ian)

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
  src/mesa/drivers/dri/i915/intel_extensions.c | 1 +
  src/mesa/drivers/dri/i965/intel_extensions.c | 1 +
  src/mesa/state_tracker/st_extensions.c   | 1 +
  3 files changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i915/intel_extensions.c 
b/src/mesa/drivers/dri/i915/intel_extensions.c
index 76f608e..de716a7 100644
--- a/src/mesa/drivers/dri/i915/intel_extensions.c
+++ b/src/mesa/drivers/dri/i915/intel_extensions.c
@@ -46,6 +46,7 @@ intelInitExtensions(struct gl_context *ctx)
  
 ctx-Extensions.ARB_draw_elements_base_vertex = true;

 ctx-Extensions.ARB_explicit_attrib_location = true;
+   ctx-Extensions.ARB_explicit_uniform_location = true;
 ctx-Extensions.ARB_framebuffer_object = true;
 ctx-Extensions.ARB_internalformat_query = true;
 ctx-Extensions.ARB_map_buffer_range = true;
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c 
b/src/mesa/drivers/dri/i965/intel_extensions.c
index 39d0ab5..9babe64 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -170,6 +170,7 @@ intelInitExtensions(struct gl_context *ctx)
 ctx-Extensions.ARB_draw_instanced = true;
 ctx-Extensions.ARB_ES2_compatibility = true;
 ctx-Extensions.ARB_explicit_attrib_location = true;
+   ctx-Extensions.ARB_explicit_uniform_location = true;
 ctx-Extensions.ARB_fragment_coord_conventions = true;
 ctx-Extensions.ARB_fragment_program = true;
 ctx-Extensions.ARB_fragment_program_shadow = true;
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 12ba82d..e9a74c5 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -543,6 +543,7 @@ void st_init_extensions(struct st_context *st)
 ctx-Extensions.ARB_ES2_compatibility = GL_TRUE;
 ctx-Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
 ctx-Extensions.ARB_explicit_attrib_location = GL_TRUE;
+   ctx-Extensions.ARB_explicit_uniform_location = GL_TRUE;
 ctx-Extensions.ARB_fragment_coord_conventions = GL_TRUE;
 ctx-Extensions.ARB_fragment_program = GL_TRUE;
 ctx-Extensions.ARB_fragment_shader = GL_TRUE;


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


Re: [Mesa-dev] [PATCH 10/10] docs: update ARB_explicit_uniform_location status

2014-06-12 Thread Petri Latvala

Reviewed-by: Petri Latvala petri.latv...@intel.com

On 04/09/2014 12:56 PM, Tapani Pälli wrote:

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
  docs/GL3.txt | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index bf51e3a..245a045 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -148,7 +148,7 @@ GL 4.3:
GL_ARB_compute_shaderstarted (Paul Berry)
GL_ARB_copy_imagenot started
GL_KHR_debug DONE (all drivers)
-  GL_ARB_explicit_uniform_location not started
+  GL_ARB_explicit_uniform_location DONE (all drivers that 
support GLSL)
GL_ARB_fragment_layer_viewport   not started
GL_ARB_framebuffer_no_attachmentsnot started
GL_ARB_internalformat_query2 not started


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


Re: [Mesa-dev] [PATCH 01/18] glsl: Add parsing support for multi-stream output in geometry shaders.

2014-06-12 Thread Samuel Iglesias Gonsálvez
On Thu, 2014-06-12 at 08:32 +0200, Samuel Iglesias Gonsálvez wrote:
 On Wed, 2014-06-11 at 15:29 -0700, Ian Romanick wrote:
  On 06/11/2014 12:49 AM, Iago Toral Quiroga wrote:
   From: Samuel Iglesias Gonsalvez sigles...@igalia.com
   
   This implements parsing requirements for multi-stream support in
   geometry shaders as defined in ARB_gpu_shader5.
   
   Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
   ---
src/glsl/ast.h  |  5 +
src/glsl/ast_to_hir.cpp |  6 ++
src/glsl/ast_type.cpp   | 19 ++-
src/glsl/glsl_parser.yy | 45 
   +
src/glsl/ir.h   |  5 +
5 files changed, 79 insertions(+), 1 deletion(-)
   
   diff --git a/src/glsl/ast.h b/src/glsl/ast.h
   index 56e7bd8..823b1d2 100644
   --- a/src/glsl/ast.h
   +++ b/src/glsl/ast.h
   @@ -509,6 +509,8 @@ struct ast_type_qualifier {
 /** \name Layout qualifiers for GL_ARB_gpu_shader5 */
 /** \{ */
 unsigned invocations:1;
   + unsigned streamId:1; /* Has streamId value assigned  */
   + unsigned explicit_streamId:1; /* streamId value assigned 
   explicitely by shader code */
 /** \} */
  }
  /** \brief Set of flags, accessed by name. */
   @@ -542,6 +544,9 @@ struct ast_type_qualifier {
   /** Maximum output vertices in GLSL 1.50 geometry shaders. */
   int max_vertices;

   +   /** Stream ID in GLSL 1.50 geometry shaders. */
   +   unsigned streamId;
   +
   /** Input or output primitive type in GLSL 1.50 geometry shaders */
   GLenum prim_type;

   diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
   index 140bb74..ab0f50f 100644
   --- a/src/glsl/ast_to_hir.cpp
   +++ b/src/glsl/ast_to_hir.cpp
   @@ -2426,6 +2426,11 @@ apply_type_qualifier_to_variable(const struct 
   ast_type_qualifier *qual,
   if (qual-flags.q.sample)
  var-data.sample = 1;

   +   if (state-stage == MESA_SHADER_GEOMETRY 
   +   qual-flags.q.out  qual-flags.q.streamId) {
   +  var-data.streamId = qual-streamId;
   +   }
   +
   if (qual-flags.q.attribute  state-stage != MESA_SHADER_VERTEX) {
  var-type = glsl_type::error_type;
  _mesa_glsl_error(loc, state,
   @@ -5455,6 +5460,7 @@ ast_interface_block::hir(exec_list *instructions,
 var-data.centroid = fields[i].centroid;
 var-data.sample = fields[i].sample;
 var-init_interface_type(block_type);
   + var-data.streamId = this-layout.streamId;

 if (redeclaring_per_vertex) {
ir_variable *earlier =
   diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
   index 0ee2c49..749f161 100644
   --- a/src/glsl/ast_type.cpp
   +++ b/src/glsl/ast_type.cpp
   @@ -125,9 +125,13 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
   /* Uniform block layout qualifiers get to overwrite each
* other (rightmost having priority), while all other
* qualifiers currently don't allow duplicates.
   +*
   +* Geometry shaders can have several layout qualifiers
   +* assigning different stream ID values.
*/

   -   if ((this-flags.i  q.flags.i  ~(ubo_mat_mask.flags.i |
   +   if ((state-stage != MESA_SHADER_GEOMETRY) 
   +   (this-flags.i  q.flags.i  ~(ubo_mat_mask.flags.i |
   ubo_layout_mask.flags.i |
  ubo_binding_mask.flags.i)) != 0) {
  
  I think this will allow multiply layout(location=) qualifiers on
  geometry shader inputs / outputs.  So...
  
  #version 150
  #extension GL_ARB_separate_shader_objects: require
  
  layout(location=1) layout(location=2) in vec4 v;
  
  should generate an error, but I think this change will disable that error.
  
 
 OK, we will test it and modify the patch accordingly.

The tests show that there is still an error, but a previous one.

With the original code the error messages are:

* Compiling shader 2: shaders/shader.geom
Error: 0:8(1): error: duplicate layout(...) qualifiers
0:8(1): error: duplicate layout qualifiers used

While with the patch applied, the error message is:

* Compiling shader 2: shaders/shader.geom
Error: 0:8(1): error: duplicate layout(...) qualifiers

If you prefer to have the error: duplicate layout qualifiers used
error message enabled, please say that, so I can write a patch for
it :-)

I made more tests just in case: if v is defined two times with
different location values, the error message is:

* Compiling shader 2: shaders/shader.geom
Error: 0:10(1): error: geometry shader inputs must be arrays
0:11(1): error: geometry shader inputs must be arrays
0:11(28): error: `v' redeclared

Which reports the redeclaration of v input.

Thanks,

Sam 


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list

[Mesa-dev] [PATCH v3] glsl: parser changes for GL_ARB_explicit_uniform_location

2014-06-12 Thread Tapani Pälli
Patch adds a preprocessor define for the extension and stores explicit
location data for uniforms during AST-HIR conversion. It also sets
layout token to be available when having the extension in place.

v2: change parser check to require GLSL 330 or enabling
GL_ARB_explicit_attrib_location (Ian)
v3: fix the check and comment in AST-HIR (Petri)

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
 src/glsl/ast_to_hir.cpp   | 35 +++
 src/glsl/glcpp/glcpp-parse.y  |  3 +++
 src/glsl/glsl_lexer.ll|  1 +
 src/glsl/glsl_parser_extras.h | 15 +++
 4 files changed, 54 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 140bb74..9567f9b 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2181,6 +2181,41 @@ validate_explicit_location(const struct 
ast_type_qualifier *qual,
 {
bool fail = false;
 
+   /* Checks for GL_ARB_explicit_uniform_location. */
+   if (qual-flags.q.uniform) {
+  if (!state-check_explicit_uniform_location_allowed(loc, var))
+ return;
+
+  const struct gl_context *const ctx = state-ctx;
+  unsigned max_loc = qual-location + var-type-uniform_locations() - 1;
+
+  /* ARB_explicit_uniform_location specification states:
+   *
+   * The explicitly defined locations and the generated locations
+   * must be in the range of 0 to MAX_UNIFORM_LOCATIONS minus one.
+   *
+   * Valid locations for default-block uniform variable locations
+   * are in the range of 0 to the implementation-defined maximum
+   * number of uniform locations.
+   */
+  if (qual-location  0) {
+ _mesa_glsl_error(loc, state,
+  explicit location  0 for uniform %s, var-name);
+ return;
+  }
+
+  if (max_loc = ctx-Const.MaxUserAssignableUniformLocations) {
+ _mesa_glsl_error(loc, state, location(s) consumed by uniform %s 
+  = MAX_UNIFORM_LOCATIONS (%u), var-name,
+  ctx-Const.MaxUserAssignableUniformLocations);
+ return;
+  }
+
+  var-data.explicit_location = true;
+  var-data.location = qual-location;
+  return;
+   }
+
/* Between GL_ARB_explicit_attrib_location an
 * GL_ARB_separate_shader_objects, the inputs and outputs of any shader
 * stage can be assigned explicit locations.  The checking here associates
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 9887583..dacb954 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -2089,6 +2089,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t 
*parser, intmax_t versio
  if (extensions-ARB_explicit_attrib_location)
 add_builtin_define(parser, GL_ARB_explicit_attrib_location, 
1);
 
+ if (extensions-ARB_explicit_uniform_location)
+add_builtin_define(parser, GL_ARB_explicit_uniform_location, 
1);
+
  if (extensions-ARB_shader_texture_lod)
 add_builtin_define(parser, GL_ARB_shader_texture_lod, 1);
 
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index 6c3f9b6..db7b1d1 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -396,6 +396,7 @@ layout  {
  || yyextra-AMD_conservative_depth_enable
  || yyextra-ARB_conservative_depth_enable
  || yyextra-ARB_explicit_attrib_location_enable
+ || yyextra-ARB_explicit_uniform_location_enable
   || yyextra-has_separate_shader_objects()
  || yyextra-ARB_uniform_buffer_object_enable
  || yyextra-ARB_fragment_coord_conventions_enable
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index e26460e..b73f816 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -151,6 +151,21 @@ struct _mesa_glsl_parse_state {
   return true;
}
 
+   bool check_explicit_uniform_location_allowed(YYLTYPE *locp,
+const ir_variable *var)
+   {
+  if (!this-has_explicit_attrib_location() ||
+  !this-ARB_explicit_uniform_location_enable) {
+ _mesa_glsl_error(locp, this,
+  uniform explicit location requires 
+  GL_ARB_explicit_uniform_location and either 
+  GL_ARB_explicit_attrib_location or GLSL 330.);
+ return false;
+  }
+
+  return true;
+   }
+
bool has_explicit_attrib_location() const
{
   return ARB_explicit_attrib_location_enable || is_version(330, 300);
-- 
1.8.3.1

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


[Mesa-dev] [PATCH] glsl: Relax combinations of layout qualifiers with other qualifiers.

2014-06-12 Thread Chris Forbes
Previously we disallowed any combination of layout with interpolation,
invariant, or precise qualifiers. There is very little spec guidance on
exactly which combinations should be allowed, but with ARB_sso it's
useful to allow these qualifiers with rendezvous-by-location.

Since it's unclear exactly where the layout qualifier should appear when
combined with other qualifiers, we will allow it anywhere before the
auxiliary storage qualifier.

This allows enough flexibility for all examples I've seen, while keeping
the auxiliary-storage-qualifier / storage-qualifier pair together (as
they are a single qualifier in the spec prior to
ARB_shading_language_420pack)

Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 src/glsl/glsl_parser.yy | 36 
 1 file changed, 8 insertions(+), 28 deletions(-)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index eddab05..91492e8 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1558,11 +1558,6 @@ type_qualifier:
   if ($2.flags.q.invariant)
  _mesa_glsl_error(@1, state, duplicate \invariant\ qualifier);
 
-  if ($2.has_layout()) {
- _mesa_glsl_error(@1, state,
-  \invariant\ cannot be used with layout(...));
-  }
-
   if (!state-ARB_shading_language_420pack_enable  $2.flags.q.precise)
  _mesa_glsl_error(@1, state,
   \invariant\ must come after \precise\);
@@ -1585,11 +1580,6 @@ type_qualifier:
   if ($2.has_interpolation())
  _mesa_glsl_error(@1, state, duplicate interpolation qualifier);
 
-  if ($2.has_layout()) {
- _mesa_glsl_error(@1, state, interpolation qualifiers cannot be used 

-  with layout(...));
-  }
-
   if (!state-ARB_shading_language_420pack_enable 
   ($2.flags.q.precise || $2.flags.q.invariant)) {
  _mesa_glsl_error(@1, state, interpolation qualifiers must come 
@@ -1601,28 +1591,18 @@ type_qualifier:
}
| layout_qualifier type_qualifier
{
-  /* The GLSL 1.50 grammar indicates that a layout(...) declaration can be
-   * used standalone or immediately before a storage qualifier.  It cannot
-   * be used with interpolation qualifiers or invariant.  There does not
-   * appear to be any text indicating that it must come before the storage
-   * qualifier, but always seems to in examples.
+  /* In the absence of ARB_shading_language_420pack, layout qualifiers may
+   * appear no later than auxiliary storage qualifiers. There is no
+   * particularly clear spec language mandating this, but in all examples
+   * the layout qualifier precedes the storage qualifier.
+   *
+   * We allow combinations of layout with interpolation, invariant or
+   * precise qualifiers since these are useful in 
ARB_separate_shader_objects.
+   * There is no clear spec guidance on this either.
*/
   if (!state-ARB_shading_language_420pack_enable  $2.has_layout())
  _mesa_glsl_error(@1, state, duplicate layout(...) qualifiers);
 
-  if ($2.flags.q.invariant)
- _mesa_glsl_error(@1, state, layout(...) cannot be used with 
-  the \invariant\ qualifier);
-
-  if ($2.flags.q.precise)
- _mesa_glsl_error(@1, state, layout(...) cannot be used with 
-  the \precise\ qualifier);
-
-  if ($2.has_interpolation()) {
- _mesa_glsl_error(@1, state, layout(...) cannot be used with 
-  interpolation qualifiers);
-  }
-
   $$ = $1;
   $$.merge_qualifier(@1, state, $2);
}
-- 
2.0.0

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


[Mesa-dev] [PATCH] gallium/util: fix p_atomic_dec_zero macros

2014-06-12 Thread Maarten Lankhorst

I'm pretty sure that p_atomic_dec_zero should return 1 if the count drops to 
zero.

Cc: 10.2 10.1 10.0 mesa-sta...@lists.freedesktop.org
Signed-off-by: Maarten Lankhorst maarten.lankho...@canonical.com
---
diff --git a/src/gallium/auxiliary/util/u_atomic.h 
b/src/gallium/auxiliary/util/u_atomic.h
index 2f2b42b..08cadb4 100644
--- a/src/gallium/auxiliary/util/u_atomic.h
+++ b/src/gallium/auxiliary/util/u_atomic.h
@@ -183,7 +183,7 @@ p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
 
 #define p_atomic_set(_v, _i) (*(_v) = (_i))

 #define p_atomic_read(_v) (*(_v))
-#define p_atomic_dec_zero(_v) ((boolean) --(*(_v)))
+#define p_atomic_dec_zero(_v) (!(boolean) --(*(_v)))
 #define p_atomic_inc(_v) ((void) (*(_v))++)
 #define p_atomic_dec(_v) ((void) (*(_v))--)
 #define p_atomic_cmpxchg(_v, old, _new) (*(_v) == old ? *(_v) = (_new) : *(_v))
@@ -324,7 +324,7 @@ p_atomic_dec_zero(int32_t *v)
 {
uint32_t n = atomic_dec_32_nv((uint32_t *) v);
 
-   return n != 0;

+   return n == 0;
 }
 
 #define p_atomic_inc(_v) atomic_inc_32((uint32_t *) _v)


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


Re: [Mesa-dev] [PATCH] glsl: Properly lex extra tokens when handling # directives.

2014-06-12 Thread Kenneth Graunke
On Wednesday, June 11, 2014 11:02:34 PM Matt Turner wrote:
 How did you notice this? (More specifically than semicolons being
 printed in your terminals!)
 
 Reviewed-by: Matt Turner matts...@gmail.com

I wrote a patch that altered the Meta GLSL clear shaders, and ran Piglit.  
Basically all of tests/hiz failed, along with some other random tests.  When I 
looked at the Piglit output, I noticed that stdout was:

;;PIGLIT: {'result': 'pass' }

I then reverted my patch, and discovered the bonus semicolons were gone.  I 
checked my code for printfs - none.  I ran valgrind - nothing.  I used gdb and 
put breakpoints on printf, fprintf, and various other output functions.  
Nothing.  I grepped the Mesa source code for print statements with semicolons 
not followed by whitespace or other text.  Nothing.  I grepped the Piglit 
code.  Nothing.

I finally gave up and started over, retyping my patch from scratch, one line 
at a time, compiling and running the hiz test with each change, looking for 
semicolons.  Eventually, I got around to adding my shader source line:

#extension GL_AMD_vertex_shader_layer : enable;\n

and suddenly the semicolons appeared.  So I knew it was something in the GLSL 
compiler, related to extension handling.  I put breakpoints before and after 
the preprocessor ran, and did:

(gdb) call printf(\n);

to flush out the semicolons.  Nothing.  I tried before and after the main 
lexer/parser.  Semicolons.  I put a breakpoint in 
_mesa_glsl_process_extension.  Semicolons.  I noticed the parser rule 
shouldn't accept ';', but apparently was anyway.  I added it.  Suddenly, no 
semicolon output.  I looked at the lexer...and realized the normal rule for 
. didn't apply, since non-annotated rules only happen in the initial state.

That was the strangest bug I've tracked down in a while.  You always think the 
actual executable code you add will have the bug.  But it wasn't - it was the 
(const char *) string data that tripped up an existing bug.

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


Re: [Mesa-dev] [PATCH v3] glsl: parser changes for GL_ARB_explicit_uniform_location

2014-06-12 Thread Petri Latvala

Reviewed-by: Petri Latvala petri.latv...@intel.com


On 06/12/2014 10:46 AM, Tapani Pälli wrote:

Patch adds a preprocessor define for the extension and stores explicit
location data for uniforms during AST-HIR conversion. It also sets
layout token to be available when having the extension in place.

v2: change parser check to require GLSL 330 or enabling
 GL_ARB_explicit_attrib_location (Ian)
v3: fix the check and comment in AST-HIR (Petri)

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
  src/glsl/ast_to_hir.cpp   | 35 +++
  src/glsl/glcpp/glcpp-parse.y  |  3 +++
  src/glsl/glsl_lexer.ll|  1 +
  src/glsl/glsl_parser_extras.h | 15 +++
  4 files changed, 54 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 140bb74..9567f9b 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2181,6 +2181,41 @@ validate_explicit_location(const struct 
ast_type_qualifier *qual,
  {
 bool fail = false;
  
+   /* Checks for GL_ARB_explicit_uniform_location. */

+   if (qual-flags.q.uniform) {
+  if (!state-check_explicit_uniform_location_allowed(loc, var))
+ return;
+
+  const struct gl_context *const ctx = state-ctx;
+  unsigned max_loc = qual-location + var-type-uniform_locations() - 1;
+
+  /* ARB_explicit_uniform_location specification states:
+   *
+   * The explicitly defined locations and the generated locations
+   * must be in the range of 0 to MAX_UNIFORM_LOCATIONS minus one.
+   *
+   * Valid locations for default-block uniform variable locations
+   * are in the range of 0 to the implementation-defined maximum
+   * number of uniform locations.
+   */
+  if (qual-location  0) {
+ _mesa_glsl_error(loc, state,
+  explicit location  0 for uniform %s, var-name);
+ return;
+  }
+
+  if (max_loc = ctx-Const.MaxUserAssignableUniformLocations) {
+ _mesa_glsl_error(loc, state, location(s) consumed by uniform %s 
+  = MAX_UNIFORM_LOCATIONS (%u), var-name,
+  ctx-Const.MaxUserAssignableUniformLocations);
+ return;
+  }
+
+  var-data.explicit_location = true;
+  var-data.location = qual-location;
+  return;
+   }
+
 /* Between GL_ARB_explicit_attrib_location an
  * GL_ARB_separate_shader_objects, the inputs and outputs of any shader
  * stage can be assigned explicit locations.  The checking here associates
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 9887583..dacb954 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -2089,6 +2089,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t 
*parser, intmax_t versio
  if (extensions-ARB_explicit_attrib_location)
 add_builtin_define(parser, GL_ARB_explicit_attrib_location, 
1);
  
+	  if (extensions-ARB_explicit_uniform_location)

+add_builtin_define(parser, GL_ARB_explicit_uniform_location, 
1);
+
  if (extensions-ARB_shader_texture_lod)
 add_builtin_define(parser, GL_ARB_shader_texture_lod, 1);
  
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll

index 6c3f9b6..db7b1d1 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -396,6 +396,7 @@ layout  {
  || yyextra-AMD_conservative_depth_enable
  || yyextra-ARB_conservative_depth_enable
  || yyextra-ARB_explicit_attrib_location_enable
+ || yyextra-ARB_explicit_uniform_location_enable
|| yyextra-has_separate_shader_objects()
  || yyextra-ARB_uniform_buffer_object_enable
  || yyextra-ARB_fragment_coord_conventions_enable
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index e26460e..b73f816 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -151,6 +151,21 @@ struct _mesa_glsl_parse_state {
return true;
 }
  
+   bool check_explicit_uniform_location_allowed(YYLTYPE *locp,

+const ir_variable *var)
+   {
+  if (!this-has_explicit_attrib_location() ||
+  !this-ARB_explicit_uniform_location_enable) {
+ _mesa_glsl_error(locp, this,
+  uniform explicit location requires 
+  GL_ARB_explicit_uniform_location and either 
+  GL_ARB_explicit_attrib_location or GLSL 330.);
+ return false;
+  }
+
+  return true;
+   }
+
 bool has_explicit_attrib_location() const
 {
return ARB_explicit_attrib_location_enable || is_version(330, 300);


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

[Mesa-dev] [PATCH] glsl: Disallow primitive type layout qualifier on variables.

2014-06-12 Thread Chris Forbes
This only makes any sense on the GS input or output layout declaration,
nowhere else.

Fixes the piglit tests:

  * 
spec/glsl-1.50/compiler/incorrect-in-layout-qualifiers-with-variable-declarations.geom
  * 
spec/glsl-1.50/compiler/incorrect-out-layout-qualifiers-with-variable-declarations.geom
  * spec/glsl-1.50/compiler/layout-fs-no-output.frag
  * spec/glsl-1.50/compiler/layout-vs-no-input.vert
  * spec/glsl-1.50/compiler/layout-vs-no-output.vert

Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 src/glsl/ast_to_hir.cpp | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 140bb74..6c2e1f1 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2434,6 +2434,13 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
_mesa_shader_stage_to_string(state-stage));
}
 
+   /* Disallow layout qualifiers which may only appear on layout declarations. 
*/
+   if (qual-flags.q.prim_type) {
+  _mesa_glsl_error(loc, state,
+   Primitive type may only be specified on GS input or 
output 
+   layout declaration, not on variables.);
+   }
+
/* Section 6.1.1 (Function Calling Conventions) of the GLSL 1.10 spec says:
 *
 * However, the const qualifier cannot be used with out or inout.
-- 
2.0.0

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


[Mesa-dev] [PATCH v2] glsl: type check between switch init-expression and case

2014-06-12 Thread Tapani Pälli
Patch adds a type check between switch init-expression and case label
and performs a implicit signed-unsigned type conversion when possible.

v2: add GLSL spec reference, do implicit conversion if possible (Matt)

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79724
---
 src/glsl/ast_to_hir.cpp | 48 +---
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 140bb74..c06645a 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4622,9 +4622,51 @@ ast_case_label::hir(exec_list *instructions,
   ir_dereference_variable *deref_test_var =
  new(ctx) ir_dereference_variable(state-switch_state.test_var);
 
-  ir_rvalue *const test_cond = new(ctx) ir_expression(ir_binop_all_equal,
-  label_const,
-  deref_test_var);
+  ir_expression *test_cond = new(ctx) ir_expression(ir_binop_all_equal,
+label_const,
+deref_test_var);
+
+  /*
+   * From GLSL 4.40 specification section 6.2 (Selection):
+   *
+   * The type of the init-expression value in a switch statement must
+   * be a scalar int or uint. The type of the constant-expression value
+   * in a case label also must be a scalar int or uint. When any pair
+   * of these values is tested for equal value and the types do not
+   * match, an implicit conversion will be done to convert the int to a
+   * uint (see section 4.1.10 “Implicit Conversions”) before the 
compare
+   * is done.
+   */
+  if (label_const-type != state-switch_state.test_var-type) {
+ YYLTYPE loc = this-test_value-get_location();
+
+ const glsl_type *type_a = label_const-type;
+ const glsl_type *type_b = state-switch_state.test_var-type;
+
+ /* Check if int-uint implicit conversion is supported. */
+ bool integer_conversion_supported =
+
glsl_type::int_type-can_implicitly_convert_to(glsl_type::uint_type,
+   state);
+
+ if ((!type_a-is_integer() || !type_b-is_integer()) ||
+  !integer_conversion_supported) {
+_mesa_glsl_error(loc, state, type mismatch with switch 
+ init-expression and case label (%s != %s),
+ type_a-name, type_b-name);
+ } else {
+/* Conversion of the case label. */
+if (type_a-base_type == GLSL_TYPE_INT) {
+   if (!apply_implicit_conversion(glsl_type::uint_type,
+  test_cond-operands[0], state))
+  _mesa_glsl_error(loc, state, implicit type conversion 
error);
+} else {
+   /* Conversion of the init-expression value. */
+   if (!apply_implicit_conversion(glsl_type::uint_type,
+  test_cond-operands[1], state))
+  _mesa_glsl_error(loc, state, implicit type conversion 
error);
+}
+ }
+  }
 
   ir_assignment *set_fallthru_on_test =
  new(ctx) ir_assignment(deref_fallthru_var, true_val, test_cond);
-- 
1.8.3.1

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


Re: [Mesa-dev] [PATCH] Implement the ARB_clear_texture extension

2014-06-12 Thread Neil Roberts
Thanks for the review.

I'm working on incorporating the changes into a v2 patch series. However
I'm a bit stuck with what to do about enabling the extension assuming
there is no Gallium implementation for now. I couldn't find a convenient
place to enable the extension for all DRI-based drivers without also
enabling it for Gallium. Is there such a place? If not, maybe I should
add one? It seems like it would be a bit silly to expiclitly enable it
in all of the DRI drivers when the function pointers are filled in in
the generic _mesa_init_driver_functions function and the implementation
is entirely driver-independent.

Ilia Mirkin writes:

 You might want to check out the impl I did a few months ago --
 https://github.com/imirkin/mesa/commits/clear_texture . It went a few
 rounds of review, but died at the there are no piglit tests stage.

Ah, sorry, I wasn't aware that you had already started working on this.
I think for the v2 patch series it would make sense to base the patches
on at least the first patch in your series.

 I believe the usual thing is to split this sort of thing up into a few
 patches, roughly how I had it.

Yes, ok, that makes sense.

 I think you're still missing some api-errors and try-all-the-formats
 formats piglit tests. Especially non-renderable formats and MS ones.

I've posted a bunch more tests to the piglit mailing list including
various texture formats and multi-sample and depth-stencil textures. I
guess I still need to add the error checking tests.

 +   if (ctx-Version = 30 || ctx-Extensions.EXT_texture_integer) {
 +  /* both source and dest must be integer-valued, or neither */
 +  if (_mesa_is_format_integer_color(texImage-TexFormat) !=
 +  _mesa_is_enum_format_integer(format)) {

 I had used _mesa_is_enum_format_integer_or_type() here.

I copied this snippet from texsubimage_error_check(). The
_mesa_is_enum_format_or_type_integer function looks strange. For example
it returns TRUE if the type is GL_UNSIGNED_BYTE regardless of the
format. I think the idea is to try and check when the format isn't
normalised. Wouldn't this return the wrong thing for GL_RGBA with
GL_UNSIGNED_BYTE (ie, that format should be normalized)? It doesn't look
like the function is used anywhere else.

 Also, is it possible to have a ctx-Version = 30 
 !EXT_texture_integer?

No, but it is possible to to have EXT_texture_integer with
ctx-Version30 which presumably is what the expression is trying to
catch.

 FWIW I also had explicit checks making sure that various depth/stencil
 stuff weren't mixed together improperly (i.e. passing a
 GL_DEPTH_COMPONENT format for a tex image with a diff base format,
 etc). Perhaps this checking is handled somewhere else in your code and
 I didn't see it though.

My assumption was that _mesa_texstore will take care of catching these
error conditions.

 Wait, you go to all the trouble of computing the zeroData but then
 don't use it?

Yes, because I want to check the error conditions even when NULL data is
passed. It would be nice of the spec for the extension said that if the
data is NULL then the format and type are completely ignored and no
error will be signalled, but sadly it doesn't look like that is the
case.

 +   clearValueSize = _mesa_get_format_bytes(texImage-TexFormat);

 Basically every implementation is going to do this... why not just
 pass it in? Seems safer to explicitly say how many bytes of the
 pointer are legal to read. Could be seen as redundant wrt the
 TexFormat though... up to you.

I suppose it doesn't really matter much either way, but I don't think
it's true that every implementation is going to use the clearValueSize.
The FBO/meta implementation I added doesn't use it and it looks like the
Gallium implementation which you wrote doesn't use it either.

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


Re: [Mesa-dev] [PATCH] Implement the ARB_clear_texture extension

2014-06-12 Thread Ilia Mirkin
On Thu, Jun 12, 2014 at 11:08 AM, Neil Roberts n...@linux.intel.com wrote:
 +   if (ctx-Version = 30 || ctx-Extensions.EXT_texture_integer) {
 +  /* both source and dest must be integer-valued, or neither */
 +  if (_mesa_is_format_integer_color(texImage-TexFormat) !=
 +  _mesa_is_enum_format_integer(format)) {

 Also, is it possible to have a ctx-Version = 30 
 !EXT_texture_integer?

 No, but it is possible to to have EXT_texture_integer with
 ctx-Version30 which presumably is what the expression is trying to
 catch.

The implicit suggestion was that this should just be

if (ctx-Extensions.EXT_texture_integer)

Since that will never be false for GL3+ contexts.

Agree with all your other responses/comments, BTW. Thanks for adding
all the tests; the invalid api usage one is the last one still
missing, I think.

Regarding your question about enabling the extension, perhaps it can
be done from where meta is set up? I'm not entirely sure how it
latches onto a context...

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


[Mesa-dev] [PATCH 2/5] vl: add level interface

2014-06-12 Thread Leo Liu
Signed-off-by: Leo Liu leo@amd.com
---
 src/gallium/include/pipe/p_video_codec.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/include/pipe/p_video_codec.h 
b/src/gallium/include/pipe/p_video_codec.h
index d4cdacb..196d00b 100644
--- a/src/gallium/include/pipe/p_video_codec.h
+++ b/src/gallium/include/pipe/p_video_codec.h
@@ -48,6 +48,7 @@ struct pipe_video_codec
struct pipe_context *context;
 
enum pipe_video_profile profile;
+   unsigned level;
enum pipe_video_entrypoint entrypoint;
enum pipe_video_chroma_format chroma_format;
unsigned width;
-- 
1.9.1

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


[Mesa-dev] [PATCH 1/5] st/st/omx: fix switch-case indentation in vid_enc.c

2014-06-12 Thread Leo Liu
Signed-off-by: Leo Liu leo@amd.com
---
 src/gallium/state_trackers/omx/vid_enc.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/gallium/state_trackers/omx/vid_enc.c 
b/src/gallium/state_trackers/omx/vid_enc.c
index d16fa01..70f63d1 100644
--- a/src/gallium/state_trackers/omx/vid_enc.c
+++ b/src/gallium/state_trackers/omx/vid_enc.c
@@ -626,22 +626,22 @@ static OMX_ERRORTYPE vid_enc_GetConfig(OMX_HANDLETYPE 
handle, OMX_INDEXTYPE idx,
 static enum pipe_video_profile enc_TranslateOMXProfileToPipe(unsigned 
omx_profile)
 {
switch (omx_profile) {
-  case OMX_VIDEO_AVCProfileBaseline:
- return PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE;
-  case OMX_VIDEO_AVCProfileMain:
- return PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN;
-  case OMX_VIDEO_AVCProfileExtended:
- return PIPE_VIDEO_PROFILE_MPEG4_AVC_EXTENDED;
-  case OMX_VIDEO_AVCProfileHigh:
- return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH;
-  case OMX_VIDEO_AVCProfileHigh10:
- return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH10;
-  case OMX_VIDEO_AVCProfileHigh422:
- return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH422;
-  case OMX_VIDEO_AVCProfileHigh444:
- return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH444;
-  default:
- return PIPE_VIDEO_PROFILE_UNKNOWN;
+   case OMX_VIDEO_AVCProfileBaseline:
+  return PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE;
+   case OMX_VIDEO_AVCProfileMain:
+  return PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN;
+   case OMX_VIDEO_AVCProfileExtended:
+  return PIPE_VIDEO_PROFILE_MPEG4_AVC_EXTENDED;
+   case OMX_VIDEO_AVCProfileHigh:
+  return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH;
+   case OMX_VIDEO_AVCProfileHigh10:
+  return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH10;
+   case OMX_VIDEO_AVCProfileHigh422:
+  return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH422;
+   case OMX_VIDEO_AVCProfileHigh444:
+  return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH444;
+   default:
+  return PIPE_VIDEO_PROFILE_UNKNOWN;
}
 }
 
-- 
1.9.1

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


[Mesa-dev] [PATCH 5/5] radeon/vce: set number of cpbs based on level

2014-06-12 Thread Leo Liu
Signed-off-by: Leo Liu leo@amd.com
---
 src/gallium/drivers/radeon/radeon_vce.c | 60 +++--
 src/gallium/drivers/radeon/radeon_vce.h |  3 +-
 2 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vce.c 
b/src/gallium/drivers/radeon/radeon_vce.c
index 81e62d3..353f3b0 100644
--- a/src/gallium/drivers/radeon/radeon_vce.c
+++ b/src/gallium/drivers/radeon/radeon_vce.c
@@ -87,7 +87,7 @@ static void reset_cpb(struct rvce_encoder *enc)
unsigned i;
 
LIST_INITHEAD(enc-cpb_slots);
-   for (i = 0; i  RVCE_NUM_CPB_FRAMES; ++i) {
+   for (i = 0; i  enc-cpb_num; ++i) {
struct rvce_cpb_slot *slot = enc-cpb_array[i];
slot-index = i;
slot-picture_type = PIPE_H264_ENC_PICTURE_TYPE_SKIP;
@@ -131,6 +131,59 @@ static void sort_cpb(struct rvce_encoder *enc)
 }
 
 /**
+ * get number of cpbs based on dpb
+ */
+static unsigned get_cpb_num(struct rvce_encoder *enc)
+{
+   unsigned w = align(enc-base.width, 16) / 16;
+   unsigned h = align(enc-base.height, 16) / 16;
+   unsigned dpb;
+
+   switch (enc-base.level) {
+   case 10:
+   dpb = 396;
+   break;
+   case 11:
+   dpb = 900;
+   break;
+   case 12:
+   case 13:
+   case 20:
+   dpb = 2376;
+   break;
+   case 21:
+   dpb = 4752;
+   break;
+   case 22:
+   case 30:
+   dpb = 8100;
+   break;
+   case 31:
+   dpb = 18000;
+   break;
+   case 32:
+   dpb = 20480;
+   break;
+   case 40:
+   case 41:
+   dpb = 32768;
+   break;
+   default:
+   case 42:
+   dpb = 34816;
+   break;
+   case 50:
+   dpb = 110400;
+   break;
+   case 51:
+   dpb = 184320;
+   break;
+   }
+
+   return MIN2(dpb / (w * h), 16);
+}
+
+/**
  * destroy this video encoder
  */
 static void rvce_destroy(struct pipe_video_codec *encoder)
@@ -327,18 +380,19 @@ struct pipe_video_codec *rvce_create_encoder(struct 
pipe_context *context,
goto error;
}
 
+   enc-cpb_num = get_cpb_num(enc);
get_buffer(((struct vl_video_buffer *)tmp_buf)-resources[0], NULL, 
tmp_surf);
cpb_size = align(tmp_surf-level[0].pitch_bytes, 128);
cpb_size = cpb_size * align(tmp_surf-npix_y, 16);
cpb_size = cpb_size * 3 / 2;
-   cpb_size = cpb_size * RVCE_NUM_CPB_FRAMES;
+   cpb_size = cpb_size * enc-cpb_num;
tmp_buf-destroy(tmp_buf);
if (!rvid_create_buffer(enc-ws, enc-cpb, cpb_size, 
RADEON_DOMAIN_VRAM)) {
RVID_ERR(Can't create CPB buffer.\n);
goto error;
}
 
-   enc-cpb_array = CALLOC(RVCE_NUM_CPB_FRAMES, sizeof(struct 
rvce_cpb_slot));
+   enc-cpb_array = CALLOC(enc-cpb_num, sizeof(struct rvce_cpb_slot));
if (!enc-cpb_array)
goto error;
 
diff --git a/src/gallium/drivers/radeon/radeon_vce.h 
b/src/gallium/drivers/radeon/radeon_vce.h
index 7cc87be..f1dea8a 100644
--- a/src/gallium/drivers/radeon/radeon_vce.h
+++ b/src/gallium/drivers/radeon/radeon_vce.h
@@ -45,8 +45,6 @@
 #define RVCE_READWRITE(buf, domain) RVCE_CS(RVCE_RELOC(buf, 
RADEON_USAGE_READWRITE, domain) * 4)
 #define RVCE_END() *begin = (enc-cs-buf[enc-cs-cdw] - begin) * 4; }
 
-#define RVCE_NUM_CPB_FRAMES 3
-
 struct r600_common_screen;
 
 /* driver dependent callback */
@@ -96,6 +94,7 @@ struct rvce_encoder {
 
struct rvce_cpb_slot*cpb_array;
struct list_headcpb_slots;
+   unsignedcpb_num;
 
struct rvid_buffer  *fb;
struct rvid_buffer  cpb;
-- 
1.9.1

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


[Mesa-dev] [PATCH 4/5] radeon/vce: implement h264 level support

2014-06-12 Thread Leo Liu
Signed-off-by: Leo Liu leo@amd.com
---
 src/gallium/drivers/radeon/radeon_vce_40_2_2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c 
b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
index c67f8f9..ecb4b0d 100644
--- a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
+++ b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
@@ -108,7 +108,7 @@ static void create(struct rvce_encoder *enc)
RVCE_CS(0x); // encUseCircularBuffer
RVCE_CS(profiles[enc-base.profile -
PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE]); // encProfile
-   RVCE_CS(0x002a); // encLevel: 4.2
+   RVCE_CS(enc-base.level); // encLevel
RVCE_CS(0x); // encPicStructRestriction
RVCE_CS(enc-base.width); // encImageWidth
RVCE_CS(enc-base.height); // encImageHeight
-- 
1.9.1

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


[Mesa-dev] [PATCH 3/5] st/omx/enc: implement h264 level support

2014-06-12 Thread Leo Liu
Signed-off-by: Leo Liu leo@amd.com
---
 src/gallium/state_trackers/omx/vid_enc.c | 39 
 1 file changed, 39 insertions(+)

diff --git a/src/gallium/state_trackers/omx/vid_enc.c 
b/src/gallium/state_trackers/omx/vid_enc.c
index 70f63d1..db4fc8f 100644
--- a/src/gallium/state_trackers/omx/vid_enc.c
+++ b/src/gallium/state_trackers/omx/vid_enc.c
@@ -645,6 +645,44 @@ static enum pipe_video_profile 
enc_TranslateOMXProfileToPipe(unsigned omx_profil
}
 }
 
+static unsigned enc_TranslateOMXLevelToPipe(unsigned omx_level)
+{
+   switch (omx_level) {
+   case OMX_VIDEO_AVCLevel1:
+   case OMX_VIDEO_AVCLevel1b:
+  return 10;
+   case OMX_VIDEO_AVCLevel11:
+  return 11;
+   case OMX_VIDEO_AVCLevel12:
+  return 12;
+   case OMX_VIDEO_AVCLevel13:
+  return 13;
+   case OMX_VIDEO_AVCLevel2:
+  return 20;
+   case OMX_VIDEO_AVCLevel21:
+  return 21;
+   case OMX_VIDEO_AVCLevel22:
+  return 22;
+   case OMX_VIDEO_AVCLevel3:
+  return 30;
+   case OMX_VIDEO_AVCLevel31:
+  return 31;
+   case OMX_VIDEO_AVCLevel32:
+  return 32;
+   case OMX_VIDEO_AVCLevel4:
+  return 40;
+   case OMX_VIDEO_AVCLevel41:
+  return 41;
+   default:
+   case OMX_VIDEO_AVCLevel42:
+  return 42;
+   case OMX_VIDEO_AVCLevel5:
+  return 50;
+   case OMX_VIDEO_AVCLevel51:
+  return 51;
+   }
+}
+
 static OMX_ERRORTYPE vid_enc_MessageHandler(OMX_COMPONENTTYPE* comp, 
internalRequestMessageType *msg)
 {
vid_enc_PrivateType* priv = comp-pComponentPrivate;
@@ -658,6 +696,7 @@ static OMX_ERRORTYPE 
vid_enc_MessageHandler(OMX_COMPONENTTYPE* comp, internalReq
  port = (omx_base_video_PortType 
*)priv-ports[OMX_BASE_FILTER_INPUTPORT_INDEX];
 
  templat.profile = 
enc_TranslateOMXProfileToPipe(priv-profile_level.eProfile);
+ templat.level = 
enc_TranslateOMXLevelToPipe(priv-profile_level.eLevel);
  templat.entrypoint = PIPE_VIDEO_ENTRYPOINT_ENCODE;
  templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
  templat.width = priv-scale_buffer[priv-current_scale_buffer] ?
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH 5/5] radeon/vce: set number of cpbs based on level

2014-06-12 Thread Christian König

Am 12.06.2014 18:27, schrieb Leo Liu:

Signed-off-by: Leo Liu leo@amd.com
---
  src/gallium/drivers/radeon/radeon_vce.c | 60 +++--
  src/gallium/drivers/radeon/radeon_vce.h |  3 +-
  2 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vce.c 
b/src/gallium/drivers/radeon/radeon_vce.c
index 81e62d3..353f3b0 100644
--- a/src/gallium/drivers/radeon/radeon_vce.c
+++ b/src/gallium/drivers/radeon/radeon_vce.c
@@ -87,7 +87,7 @@ static void reset_cpb(struct rvce_encoder *enc)
unsigned i;
  
  	LIST_INITHEAD(enc-cpb_slots);

-   for (i = 0; i  RVCE_NUM_CPB_FRAMES; ++i) {
+   for (i = 0; i  enc-cpb_num; ++i) {
struct rvce_cpb_slot *slot = enc-cpb_array[i];
slot-index = i;
slot-picture_type = PIPE_H264_ENC_PICTURE_TYPE_SKIP;
@@ -131,6 +131,59 @@ static void sort_cpb(struct rvce_encoder *enc)
  }
  
  /**

+ * get number of cpbs based on dpb
+ */
+static unsigned get_cpb_num(struct rvce_encoder *enc)
+{
+   unsigned w = align(enc-base.width, 16) / 16;
+   unsigned h = align(enc-base.height, 16) / 16;
+   unsigned dpb;
+
+   switch (enc-base.level) {
+   case 10:
+   dpb = 396;
+   break;
+   case 11:
+   dpb = 900;
+   break;
+   case 12:
+   case 13:
+   case 20:
+   dpb = 2376;
+   break;
+   case 21:
+   dpb = 4752;
+   break;
+   case 22:
+   case 30:
+   dpb = 8100;
+   break;
+   case 31:
+   dpb = 18000;
+   break;
+   case 32:
+   dpb = 20480;
+   break;
+   case 40:
+   case 41:
+   dpb = 32768;
+   break;
+   default:
+   case 42:
+   dpb = 34816;
+   break;
+   case 50:
+   dpb = 110400;
+   break;
+   case 51:
+   dpb = 184320;
+   break;
+   }
+
+   return MIN2(dpb / (w * h), 16);
+}
+
+/**
   * destroy this video encoder
   */
  static void rvce_destroy(struct pipe_video_codec *encoder)
@@ -327,18 +380,19 @@ struct pipe_video_codec *rvce_create_encoder(struct 
pipe_context *context,
goto error;
}
  
+	enc-cpb_num = get_cpb_num(enc);


Please add an error check here that we don't have zero CPBs, that can 
happen if the user specifies an invalid level for the given resolution. 
In this case a goto error should probably be sufficient.


With that fixed the series is Reviewed-by: Christian König 
christian.koe...@amd.com


Leave me a note if your account is already activated or if I should 
commit them,

Christian.


get_buffer(((struct vl_video_buffer *)tmp_buf)-resources[0], NULL, 
tmp_surf);
cpb_size = align(tmp_surf-level[0].pitch_bytes, 128);
cpb_size = cpb_size * align(tmp_surf-npix_y, 16);
cpb_size = cpb_size * 3 / 2;
-   cpb_size = cpb_size * RVCE_NUM_CPB_FRAMES;
+   cpb_size = cpb_size * enc-cpb_num;
tmp_buf-destroy(tmp_buf);
if (!rvid_create_buffer(enc-ws, enc-cpb, cpb_size, 
RADEON_DOMAIN_VRAM)) {
RVID_ERR(Can't create CPB buffer.\n);
goto error;
}
  
-	enc-cpb_array = CALLOC(RVCE_NUM_CPB_FRAMES, sizeof(struct rvce_cpb_slot));

+   enc-cpb_array = CALLOC(enc-cpb_num, sizeof(struct rvce_cpb_slot));
if (!enc-cpb_array)
goto error;
  
diff --git a/src/gallium/drivers/radeon/radeon_vce.h b/src/gallium/drivers/radeon/radeon_vce.h

index 7cc87be..f1dea8a 100644
--- a/src/gallium/drivers/radeon/radeon_vce.h
+++ b/src/gallium/drivers/radeon/radeon_vce.h
@@ -45,8 +45,6 @@
  #define RVCE_READWRITE(buf, domain) RVCE_CS(RVCE_RELOC(buf, 
RADEON_USAGE_READWRITE, domain) * 4)
  #define RVCE_END() *begin = (enc-cs-buf[enc-cs-cdw] - begin) * 4; }
  
-#define RVCE_NUM_CPB_FRAMES 3

-
  struct r600_common_screen;
  
  /* driver dependent callback */

@@ -96,6 +94,7 @@ struct rvce_encoder {
  
  	struct rvce_cpb_slot		*cpb_array;

struct list_headcpb_slots;
+   unsignedcpb_num;
  
  	struct rvid_buffer		*fb;

struct rvid_buffer  cpb;


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


[Mesa-dev] [PATCH] radeon/vce: set number of cpbs based on level

2014-06-12 Thread Leo Liu
v2: add error check for cpb size 0

Signed-off-by: Leo Liu leo@amd.com
---
 src/gallium/drivers/radeon/radeon_vce.c | 63 +++--
 src/gallium/drivers/radeon/radeon_vce.h |  3 +-
 2 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vce.c 
b/src/gallium/drivers/radeon/radeon_vce.c
index 81e62d3..f5395b3 100644
--- a/src/gallium/drivers/radeon/radeon_vce.c
+++ b/src/gallium/drivers/radeon/radeon_vce.c
@@ -87,7 +87,7 @@ static void reset_cpb(struct rvce_encoder *enc)
unsigned i;
 
LIST_INITHEAD(enc-cpb_slots);
-   for (i = 0; i  RVCE_NUM_CPB_FRAMES; ++i) {
+   for (i = 0; i  enc-cpb_num; ++i) {
struct rvce_cpb_slot *slot = enc-cpb_array[i];
slot-index = i;
slot-picture_type = PIPE_H264_ENC_PICTURE_TYPE_SKIP;
@@ -131,6 +131,59 @@ static void sort_cpb(struct rvce_encoder *enc)
 }
 
 /**
+ * get number of cpbs based on dpb
+ */
+static unsigned get_cpb_num(struct rvce_encoder *enc)
+{
+   unsigned w = align(enc-base.width, 16) / 16;
+   unsigned h = align(enc-base.height, 16) / 16;
+   unsigned dpb;
+
+   switch (enc-base.level) {
+   case 10:
+   dpb = 396;
+   break;
+   case 11:
+   dpb = 900;
+   break;
+   case 12:
+   case 13:
+   case 20:
+   dpb = 2376;
+   break;
+   case 21:
+   dpb = 4752;
+   break;
+   case 22:
+   case 30:
+   dpb = 8100;
+   break;
+   case 31:
+   dpb = 18000;
+   break;
+   case 32:
+   dpb = 20480;
+   break;
+   case 40:
+   case 41:
+   dpb = 32768;
+   break;
+   default:
+   case 42:
+   dpb = 34816;
+   break;
+   case 50:
+   dpb = 110400;
+   break;
+   case 51:
+   dpb = 184320;
+   break;
+   }
+
+   return MIN2(dpb / (w * h), 16);
+}
+
+/**
  * destroy this video encoder
  */
 static void rvce_destroy(struct pipe_video_codec *encoder)
@@ -327,18 +380,22 @@ struct pipe_video_codec *rvce_create_encoder(struct 
pipe_context *context,
goto error;
}
 
+   enc-cpb_num = get_cpb_num(enc);
+   if (!enc-cpb_num)
+   goto error;
+
get_buffer(((struct vl_video_buffer *)tmp_buf)-resources[0], NULL, 
tmp_surf);
cpb_size = align(tmp_surf-level[0].pitch_bytes, 128);
cpb_size = cpb_size * align(tmp_surf-npix_y, 16);
cpb_size = cpb_size * 3 / 2;
-   cpb_size = cpb_size * RVCE_NUM_CPB_FRAMES;
+   cpb_size = cpb_size * enc-cpb_num;
tmp_buf-destroy(tmp_buf);
if (!rvid_create_buffer(enc-ws, enc-cpb, cpb_size, 
RADEON_DOMAIN_VRAM)) {
RVID_ERR(Can't create CPB buffer.\n);
goto error;
}
 
-   enc-cpb_array = CALLOC(RVCE_NUM_CPB_FRAMES, sizeof(struct 
rvce_cpb_slot));
+   enc-cpb_array = CALLOC(enc-cpb_num, sizeof(struct rvce_cpb_slot));
if (!enc-cpb_array)
goto error;
 
diff --git a/src/gallium/drivers/radeon/radeon_vce.h 
b/src/gallium/drivers/radeon/radeon_vce.h
index 7cc87be..f1dea8a 100644
--- a/src/gallium/drivers/radeon/radeon_vce.h
+++ b/src/gallium/drivers/radeon/radeon_vce.h
@@ -45,8 +45,6 @@
 #define RVCE_READWRITE(buf, domain) RVCE_CS(RVCE_RELOC(buf, 
RADEON_USAGE_READWRITE, domain) * 4)
 #define RVCE_END() *begin = (enc-cs-buf[enc-cs-cdw] - begin) * 4; }
 
-#define RVCE_NUM_CPB_FRAMES 3
-
 struct r600_common_screen;
 
 /* driver dependent callback */
@@ -96,6 +94,7 @@ struct rvce_encoder {
 
struct rvce_cpb_slot*cpb_array;
struct list_headcpb_slots;
+   unsignedcpb_num;
 
struct rvid_buffer  *fb;
struct rvid_buffer  cpb;
-- 
1.9.1

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


Re: [Mesa-dev] [PATCH 5/5] radeon/vce: set number of cpbs based on level

2014-06-12 Thread Liu, Leo
Fixed. Thanks for the review.
My account is still not activated.

Leo

-Original Message-
From: Christian König [mailto:deathsim...@vodafone.de]
Sent: Thursday, June 12, 2014 12:35 PM
To: Liu, Leo; mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH 5/5] radeon/vce: set number of cpbs based on
level

Am 12.06.2014 18:27, schrieb Leo Liu:
 Signed-off-by: Leo Liu leo@amd.com
 ---
   src/gallium/drivers/radeon/radeon_vce.c | 60
+++--
   src/gallium/drivers/radeon/radeon_vce.h |  3 +-
   2 files changed, 58 insertions(+), 5 deletions(-)

 diff --git a/src/gallium/drivers/radeon/radeon_vce.c
 b/src/gallium/drivers/radeon/radeon_vce.c
 index 81e62d3..353f3b0 100644
 --- a/src/gallium/drivers/radeon/radeon_vce.c
 +++ b/src/gallium/drivers/radeon/radeon_vce.c
 @@ -87,7 +87,7 @@ static void reset_cpb(struct rvce_encoder *enc)
  unsigned i;

  LIST_INITHEAD(enc-cpb_slots);
 -for (i = 0; i  RVCE_NUM_CPB_FRAMES; ++i) {
 +for (i = 0; i  enc-cpb_num; ++i) {
  struct rvce_cpb_slot *slot = enc-cpb_array[i];
  slot-index = i;
  slot-picture_type = PIPE_H264_ENC_PICTURE_TYPE_SKIP; @@
-131,6
 +131,59 @@ static void sort_cpb(struct rvce_encoder *enc)
   }

   /**
 + * get number of cpbs based on dpb
 + */
 +static unsigned get_cpb_num(struct rvce_encoder *enc) {
 +unsigned w = align(enc-base.width, 16) / 16;
 +unsigned h = align(enc-base.height, 16) / 16;
 +unsigned dpb;
 +
 +switch (enc-base.level) {
 +case 10:
 +dpb = 396;
 +break;
 +case 11:
 +dpb = 900;
 +break;
 +case 12:
 +case 13:
 +case 20:
 +dpb = 2376;
 +break;
 +case 21:
 +dpb = 4752;
 +break;
 +case 22:
 +case 30:
 +dpb = 8100;
 +break;
 +case 31:
 +dpb = 18000;
 +break;
 +case 32:
 +dpb = 20480;
 +break;
 +case 40:
 +case 41:
 +dpb = 32768;
 +break;
 +default:
 +case 42:
 +dpb = 34816;
 +break;
 +case 50:
 +dpb = 110400;
 +break;
 +case 51:
 +dpb = 184320;
 +break;
 +}
 +
 +return MIN2(dpb / (w * h), 16);
 +}
 +
 +/**
* destroy this video encoder
*/
   static void rvce_destroy(struct pipe_video_codec *encoder) @@
 -327,18 +380,19 @@ struct pipe_video_codec *rvce_create_encoder(struct
pipe_context *context,
  goto error;
  }

 +enc-cpb_num = get_cpb_num(enc);

Please add an error check here that we don't have zero CPBs, that can happen if
the user specifies an invalid level for the given resolution.
In this case a goto error should probably be sufficient.

With that fixed the series is Reviewed-by: Christian König
christian.koe...@amd.com

Leave me a note if your account is already activated or if I should commit 
them,
Christian.

  get_buffer(((struct vl_video_buffer *)tmp_buf)-resources[0], NULL,
tmp_surf);
  cpb_size = align(tmp_surf-level[0].pitch_bytes, 128);
  cpb_size = cpb_size * align(tmp_surf-npix_y, 16);
  cpb_size = cpb_size * 3 / 2;
 -cpb_size = cpb_size * RVCE_NUM_CPB_FRAMES;
 +cpb_size = cpb_size * enc-cpb_num;
  tmp_buf-destroy(tmp_buf);
  if (!rvid_create_buffer(enc-ws, enc-cpb, cpb_size,
RADEON_DOMAIN_VRAM)) {
  RVID_ERR(Can't create CPB buffer.\n);
  goto error;
  }

 -enc-cpb_array = CALLOC(RVCE_NUM_CPB_FRAMES, sizeof(struct
rvce_cpb_slot));
 +enc-cpb_array = CALLOC(enc-cpb_num, sizeof(struct rvce_cpb_slot));
  if (!enc-cpb_array)
  goto error;

 diff --git a/src/gallium/drivers/radeon/radeon_vce.h
 b/src/gallium/drivers/radeon/radeon_vce.h
 index 7cc87be..f1dea8a 100644
 --- a/src/gallium/drivers/radeon/radeon_vce.h
 +++ b/src/gallium/drivers/radeon/radeon_vce.h
 @@ -45,8 +45,6 @@
   #define RVCE_READWRITE(buf, domain) RVCE_CS(RVCE_RELOC(buf,
RADEON_USAGE_READWRITE, domain) * 4)
   #define RVCE_END() *begin = (enc-cs-buf[enc-cs-cdw] - begin) *
 4; }

 -#define RVCE_NUM_CPB_FRAMES 3
 -
   struct r600_common_screen;

   /* driver dependent callback */
 @@ -96,6 +94,7 @@ struct rvce_encoder {

  struct rvce_cpb_slot*cpb_array;
  struct list_headcpb_slots;
 +unsignedcpb_num;

  struct rvid_buffer  *fb;
  struct rvid_buffer  cpb;

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


[Mesa-dev] [PATCH] Remove _mesa_is_type_integer and _mesa_is_enum_format_or_type_integer

2014-06-12 Thread Neil Roberts
The comment for _mesa_is_type_integer is confusing because it says that it
returns whether the type is an “integer (non-normalized)” format. I don't
think it makes sense to say whether a type is normalized or not because it
depends on what format it is used with. For example, GL_RGBA+GL_UNSIGNED_BYTE
is normalized but GL_RGBA_INTEGER+GL_UNSIGNED_BYTE isn't. If the normalized
comment is just a mistake then it still doesn't make much sense because it is
missing the packed-pixel types such as GL_UNSIGNED_INT_5_6_5. If those were
added then it effectively just returns type != GL_FLOAT.

That function was only used in _mesa_is_enum_format_or_type_integer. This
function effectively checks whether the format is non-normalized or the type
is an integer. I can't think of any situation where that check would make
sense.

As far as I can tell neither of these functions have ever been used anywhere
so we should just remove them to avoid confusion.

These functions were added in 9ad8f431b2a47060bf05517246ab0fa8d249c800.
---
 src/mesa/main/glformats.c | 30 --
 src/mesa/main/glformats.h |  6 --
 2 files changed, 36 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 9bb341c..aee336e 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -458,36 +458,6 @@ _mesa_is_enum_format_integer(GLenum format)
 }
 
 
-/**
- * Test if the given type is an integer (non-normalized) format.
- */
-GLboolean
-_mesa_is_type_integer(GLenum type)
-{
-   switch (type) {
-   case GL_INT:
-   case GL_UNSIGNED_INT:
-   case GL_SHORT:
-   case GL_UNSIGNED_SHORT:
-   case GL_BYTE:
-   case GL_UNSIGNED_BYTE:
-  return GL_TRUE;
-   default:
-  return GL_FALSE;
-   }
-}
-
-
-/**
- * Test if the given format or type is an integer (non-normalized) format.
- */
-extern GLboolean
-_mesa_is_enum_format_or_type_integer(GLenum format, GLenum type)
-{
-   return _mesa_is_enum_format_integer(format) || _mesa_is_type_integer(type);
-}
-
-
 GLboolean
 _mesa_is_type_unsigned(GLenum type)
 {
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index af10899..ccbce2d 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -54,9 +54,6 @@ extern GLint
 _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type);
 
 extern GLboolean
-_mesa_is_type_integer(GLenum type);
-
-extern GLboolean
 _mesa_is_type_unsigned(GLenum type);
 
 extern GLboolean
@@ -69,9 +66,6 @@ extern GLboolean
 _mesa_is_enum_format_signed_int(GLenum format);
 
 extern GLboolean
-_mesa_is_enum_format_or_type_integer(GLenum format, GLenum type);
-
-extern GLboolean
 _mesa_is_color_format(GLenum format);
 
 extern GLboolean
-- 
1.9.3

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


[Mesa-dev] [PATCH] llvmpipe: increase number of queries which can be binned simultaneously to 64

2014-06-12 Thread sroland
From: Roland Scheidegger srol...@vmware.com

Gallium (but not OpenGL) does allow nesting of queries, but there's no
limit specified (d3d10 has no limit neither). Nevertheless, for practical
purposes we need some limit in llvmpipe, otherwise we'd need more complex
handling of queries as we need to keep track of all binned queries (this
only affects queries which gather data past setup). A limit of 16 is too
small though, while 64 would suffice.
---
 src/gallium/drivers/llvmpipe/lp_rast.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h 
b/src/gallium/drivers/llvmpipe/lp_rast.h
index 6bd917d..c209f47 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -66,7 +66,7 @@ struct cmd_bin;
 /* Rasterizer output size going to jit fs, width/height */
 #define LP_RASTER_BLOCK_SIZE 4
 
-#define LP_MAX_ACTIVE_BINNED_QUERIES 16
+#define LP_MAX_ACTIVE_BINNED_QUERIES 64
 
 #define IMUL64(a, b) (((int64_t)(a)) * ((int64_t)(b)))
 
-- 
1.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] egl/gallium: Set defines for supported APIs when using automake

2014-06-12 Thread Emil Velikov
On 11/06/14 22:13, Niels Ole Salscheider wrote:
 This fixes automake builds which are broken since
 b52a530ce2aada1967bc8fefa83ab53e6a737dae.
 
 v2: This patch also adds the FEATURE_* defines back to targets/egl-static for
 Android and Scons that have been removed in the mentioned commit.
 
 Signed-off-by: Niels Ole Salscheider niels_...@salscheider-online.de
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79885
Pushed to master.

Thanks again
Emil
 ---
  src/gallium/state_trackers/egl/Makefile.am | 20 
  src/gallium/targets/egl-static/Android.mk  |  2 ++
  src/gallium/targets/egl-static/SConscript  |  6 ++
  3 files changed, 28 insertions(+)
 
 diff --git a/src/gallium/state_trackers/egl/Makefile.am 
 b/src/gallium/state_trackers/egl/Makefile.am
 index b7dcdab..828bf13 100644
 --- a/src/gallium/state_trackers/egl/Makefile.am
 +++ b/src/gallium/state_trackers/egl/Makefile.am
 @@ -88,3 +88,23 @@ AM_CPPFLAGS += \
   -I$(top_srcdir)/src/gallium/winsys/sw \
   -DHAVE_NULL_BACKEND
  endif
 +
 +if HAVE_OPENGL
 +AM_CPPFLAGS += \
 + -DFEATURE_GL=1
 +endif
 +
 +if HAVE_OPENGL_ES1
 +AM_CPPFLAGS += \
 + -DFEATURE_ES1=1
 +endif
 +
 +if HAVE_OPENGL_ES2
 +AM_CPPFLAGS += \
 + -DFEATURE_ES2=1
 +endif
 +
 +if HAVE_OPENVG
 +AM_CPPFLAGS += \
 + -DFEATURE_VG=1
 +endif
 diff --git a/src/gallium/targets/egl-static/Android.mk 
 b/src/gallium/targets/egl-static/Android.mk
 index 01408a7..37244b5 100644
 --- a/src/gallium/targets/egl-static/Android.mk
 +++ b/src/gallium/targets/egl-static/Android.mk
 @@ -31,6 +31,8 @@ LOCAL_SRC_FILES := \
   egl_st.c
  
  LOCAL_CFLAGS := \
 + -DFEATURE_ES1=1 \
 + -DFEATURE_ES2=1 \
   -D_EGL_MAIN=_eglBuiltInDriverGALLIUM
  
  LOCAL_C_INCLUDES := \
 diff --git a/src/gallium/targets/egl-static/SConscript 
 b/src/gallium/targets/egl-static/SConscript
 index 7d8d4d2..afb5c11 100644
 --- a/src/gallium/targets/egl-static/SConscript
 +++ b/src/gallium/targets/egl-static/SConscript
 @@ -63,6 +63,11 @@ if env['platform'] == 'windows':
  
  # OpenGL ES and OpenGL
  if env['gles']:
 +env.Append(CPPDEFINES = [
 +'FEATURE_GL=1',
 +'FEATURE_ES1=1',
 +'FEATURE_ES2=1'
 +])
  env.Prepend(LIBPATH = [shared_glapi.dir])
  # manually add LIBPREFIX on windows
  glapi_name = 'glapi' if env['platform'] != 'windows' else 'libglapi'
 @@ -70,6 +75,7 @@ if env['gles']:
  
  # OpenVG
  if True:
 +env.Append(CPPDEFINES = ['FEATURE_VG=1'])
  env.Prepend(LIBPATH = [openvg.dir])
  # manually add LIBPREFIX on windows
  openvg_name = 'OpenVG' if env['platform'] != 'windows' else 'libOpenVG'
 

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


[Mesa-dev] [Bug 79885] commit b52a530 (gallium/egl: st_profiles are build time decision, treat them as such) broke egl

2014-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=79885

--- Comment #7 from Emil Velikov emil.l.veli...@gmail.com ---
commit 607bc899701dda25f7c91ebd2ec2136d4dab0448
Author: Niels Ole Salscheider niels_...@salscheider-online.de
Date:   Wed Jun 11 23:13:12 2014 +0200

egl/gallium: Set defines for supported APIs when using automake

This fixes automake builds which are broken since
b52a530ce2aada1967bc8fefa83ab53e6a737dae.

v2: This patch also adds the FEATURE_* defines back to targets/egl-static
for
Android and Scons that have been removed in the mentioned commit.

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


[Mesa-dev] [Bug 79907] Mesa 10.2.1 --enable-vdpau default=auto broken

2014-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=79907

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

   What|Removed |Added

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

--- Comment #2 from Emil Velikov emil.l.veli...@gmail.com ---
Managed to reproduce the problem and confirm that the patch fixes it.
Feel free to reopen if it's failing on your setup.

commit 816d392b586ecd95bd5b2dc24945bb9fc5d73d6e
Author: Emil Velikov emil.l.veli...@gmail.com
Date:   Wed Jun 11 22:15:58 2014 +0100

configure: correctly autodetect xvmc/vdpau/omx

Commit e62b7d38a1d (configure: autodetect video state-trackers
when non swrast driver is present) added a check that caused
the autodetection to be omitted when we have the swrast gallium
driver. Whereas it should have skipped the VL targets when only
swrast was selected.

-- 
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] configure: correctly autodetect xvmc/vdpau/omx

2014-06-12 Thread Emil Velikov
On 12/06/14 07:30, Christian König wrote:
 Am 11.06.2014 23:46, schrieb Emil Velikov:
 Commit e62b7d38a1d (configure: autodetect video state-trackers
 when non swrast driver is present) added a check that caused
 the autodetection to be omitted when we have the swrast gallium
 driver. Whereas it should have skipped the VL targets when only
 swrast was selected.

 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79907
 Cc: 10.2 mesa-sta...@lists.freedesktop.org
 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
 
 I was already wondering what's going wrong there. Thanks for all the work
 maintaining the build system.
 
 Patch is Reviewed-by: Christian König christian.koe...@amd.com
 
I normally have explicit configure options on my build :)

Thanks for the review, confirmed that it fixes the issue and pushed to master.
Emil

 ---
   configure.ac | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/configure.ac b/configure.ac
 index 7b0009d..a19f777 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -1412,7 +1412,7 @@ AM_CONDITIONAL(HAVE_OPENVG, test x$enable_openvg =
 xyes)
   dnl
   dnl Gallium G3DVL configuration
   dnl
 -if test -n $with_gallium_drivers  ! echo $with_gallium_drivers | grep
 -q 'swrast'; then
 +if test -n $with_gallium_drivers -a x$with_gallium_drivers != xswrast;
 then
   if test x$enable_xvmc = xauto; then
   PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no])
   fi
 

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


[Mesa-dev] [Bug 79469] Commit e3cc0d90e14e62a0a787b6c07a6df0f5c84039be breaks unigine heaven

2014-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=79469

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

   What|Removed |Added

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

--- Comment #19 from Emil Velikov emil.l.veli...@gmail.com ---
commit 0d5ec2c615784929be095951f9269773a790a2dd
Author: Marek Olšák marek.ol...@amd.com
Date:   Mon Jun 2 12:51:09 2014 +0200

Revert glx: load dri driver with RTLD_LOCAL so dlclose never fails to
unload

This reverts commit e3cc0d90e14e62a0a787b6c07a6df0f5c84039be.

It breaks too many apps and completely breaks my desktop too.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79469

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


[Mesa-dev] [Bug 79039] [TRACKER] Mesa 10.2 release tracker

2014-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=79039

Bug 79039 depends on bug 79230, which changed state.

Bug 79230 Summary: After upgrade from 10.1.4 to 10.2-rc4 cross-compile fails
https://bugs.freedesktop.org/show_bug.cgi?id=79230

   What|Removed |Added

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

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


[Mesa-dev] [Bug 79230] After upgrade from 10.1.4 to 10.2-rc4 cross-compile fails

2014-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=79230

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

   What|Removed |Added

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

--- Comment #8 from Emil Velikov emil.l.veli...@gmail.com ---
(In reply to comment #7)
 Emil,
 
   PKG_CONFIG_PATH=$(libdir)/pkgconfig \
 Wrong. You should set the path to the location where the cross-build pc are 
 available. I.e. the location where the above libdrm_radeon.pc is stored.
 
 Argh. Silly me. This is typo. Corrected and now I'm able to compile. Patch
 for libdrm includes is still needed however - but this is minor thing.
 
 Thx for Your help!

As mentioned above the patch should not be needed if PKG_CONFIG_PATH is
correctly set and you are installing the files in their recommended
location/there are no hacks like these in your libdrm build.

Feel free to open if the original issue error: no previous prototype for
'gl*' persist. For everything else please file a different bugreport.

Thanks

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


[Mesa-dev] [PATCH] glsl: Fix glcpp to catch garbage after #if 1 ... #else

2014-06-12 Thread Carl Worth
Previously, a line such as:

#else garbage

would flag an error if it followed #if 0, but not if it followed #if 1.

We fix this by setting a new bit of state (lexing_else) that allows the lexer
to defer switching to the SKIP start state until after the NEWLINE following
the #else directive.

A new test case is added for:

#if 1
#else garbage
#endif

which was untested before, (and did not generate the desired error).
---
 src/glsl/glcpp/glcpp-lex.l   | 10 +-
 src/glsl/glcpp/glcpp-parse.y |  6 --
 src/glsl/glcpp/glcpp.h   |  1 +
 src/glsl/glcpp/tests/103-garbage-after-else-0.c  |  3 +++
 src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected |  4 
 src/glsl/glcpp/tests/103-garbage-after-else.c|  3 ---
 src/glsl/glcpp/tests/103-garbage-after-else.c.expected   |  4 
 src/glsl/glcpp/tests/123-garbage-after-else-1.c  |  3 +++
 src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected |  4 
 9 files changed, 28 insertions(+), 10 deletions(-)
 create mode 100644 src/glsl/glcpp/tests/103-garbage-after-else-0.c
 create mode 100644 src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected
 delete mode 100644 src/glsl/glcpp/tests/103-garbage-after-else.c
 delete mode 100644 src/glsl/glcpp/tests/103-garbage-after-else.c.expected
 create mode 100644 src/glsl/glcpp/tests/123-garbage-after-else-1.c
 create mode 100644 src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected

diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 188e454..dea6a6c 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -125,7 +125,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
 * as set by the parser to know whether to change from INITIAL
 * to SKIP or from SKIP back to INITIAL.
 *
-* Three cases cause us to switch out of the SKIP state and
+* Four cases cause us to switch out of the SKIP state and
 * back to the INITIAL state:
 *
 *  1. The top of the skip_stack is of type SKIP_NO_SKIP
@@ -142,9 +142,17 @@ HEXADECIMAL_INTEGER0[xX][0-9a-fA-F]+[uU]?
 * #elif. Even inside an #if 0 we need to lex this
 * expression so the parser can correctly update the
 * skip_stack state.
+*
+*  4. The lexing_else bit is set. This indicates that we
+* are lexing tokens after #else and before the
+* newline. We don't want to skip here just so that we
+* can correctly flag errors if there is any
+* garbage (other than comments) on the same line as the
+* #else.
 */
if (YY_START == INITIAL || YY_START == SKIP) {
if (parser-lexing_if ||
+parser-lexing_else ||
parser-skip_stack == NULL ||
parser-skip_stack-type == SKIP_NO_SKIP)
{
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 650d0d4..57e1ee8 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -364,7 +364,7 @@ control_line:
glcpp_warning( @1, parser, ignoring illegal #elif 
without expression);
}
}
-|  HASH_ELSE {
+|  HASH_ELSE { parser-lexing_else = 1; } NEWLINE {
if (parser-skip_stack 
parser-skip_stack-has_else)
{
@@ -376,7 +376,8 @@ control_line:
if (parser-skip_stack)
parser-skip_stack-has_else = true;
}
-   } NEWLINE
+parser-lexing_else = 0;
+   }
 |  HASH_ENDIF {
_glcpp_parser_skip_stack_pop (parser,  @1);
} NEWLINE
@@ -1212,6 +1213,7 @@ glcpp_parser_create (const struct gl_extensions 
*extensions, gl_api api)
   hash_table_string_compare);
parser-active = NULL;
parser-lexing_if = 0;
+   parser-lexing_else = 0;
parser-space_tokens = 1;
parser-newline_as_space = 0;
parser-in_control_line = 0;
diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h
index 79ccb23..491263f 100644
--- a/src/glsl/glcpp/glcpp.h
+++ b/src/glsl/glcpp/glcpp.h
@@ -169,6 +169,7 @@ struct glcpp_parser {
struct hash_table *defines;
active_list_t *active;
int lexing_if;
+   int lexing_else;
int space_tokens;
int newline_as_space;
int in_control_line;
diff --git a/src/glsl/glcpp/tests/103-garbage-after-else-0.c 
b/src/glsl/glcpp/tests/103-garbage-after-else-0.c
new file mode 100644
index 000..c460fea
--- /dev/null
+++ b/src/glsl/glcpp/tests/103-garbage-after-else-0.c
@@ -0,0 +1,3 @@
+#if 0
+#else garbage
+#endif
diff --git 

Re: [Mesa-dev] [PATCH] llvmpipe: increase number of queries which can be binned simultaneously to 64

2014-06-12 Thread Jose Fonseca


- Original Message -
 From: Roland Scheidegger srol...@vmware.com
 
 Gallium (but not OpenGL) does allow nesting of queries, but there's no
 limit specified (d3d10 has no limit neither). Nevertheless, for practical
 purposes we need some limit in llvmpipe, otherwise we'd need more complex
 handling of queries as we need to keep track of all binned queries (this
 only affects queries which gather data past setup). A limit of 16 is too
 small though, while 64 would suffice.
 ---
  src/gallium/drivers/llvmpipe/lp_rast.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h
 b/src/gallium/drivers/llvmpipe/lp_rast.h
 index 6bd917d..c209f47 100644
 --- a/src/gallium/drivers/llvmpipe/lp_rast.h
 +++ b/src/gallium/drivers/llvmpipe/lp_rast.h
 @@ -66,7 +66,7 @@ struct cmd_bin;
  /* Rasterizer output size going to jit fs, width/height */
  #define LP_RASTER_BLOCK_SIZE 4
  
 -#define LP_MAX_ACTIVE_BINNED_QUERIES 16
 +#define LP_MAX_ACTIVE_BINNED_QUERIES 64
  
  #define IMUL64(a, b) (((int64_t)(a)) * ((int64_t)(b)))
  
 --
 1.9.1
 


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


[Mesa-dev] i965: Uniform loading via samplers with discard

2014-06-12 Thread Cody Northrop
Commit 17c7ead7 exposed a bug in how uniform loading happens in the
presence of discard.  It manifested itself in an application as randomly
incorrect pixels on the borders of conditional areas.

We believe it is due to how discards jump to the end of the shader
incorrectly for some channels.  The current implementation checks each 2x2
subspan to preserve derivatives.  When uniform loading via samplers was
turned on, it uses a full execution mask, as stated in
lower_uniform_pull_constant_loads(), and only populates four channels of
the destination (see generate_uniform_pull_constant_load_gen7()).  We think
that is happening incorrectly when the first subspan has been jumped over.

A possible fix is to only jump to the end of the shader if all relevant
channels are disabled, i.e. all 8 or 16, depending on dispatch.  This
preserves the original speedup noted in commit beafced2.  There are other
more heavyweight fixes (i.e. don't use sampler for uniforms if discard in
use), but this seems like a good fix.  I've appended it below as a patch.
It changes the shader accordingly:

before: 0x00d0: (-f0.1.any4h) halt(8) 17 2
null{ align1 WE_all 1Q };
after(8)  : 0x00d0: (-f0.1.any8h) halt(8) 17 2
null{ align1 WE_all 1Q };
after(16) : 0x0250: (-f0.1.any16h) halt(16) 17 2
null{ align1 WE_all 1H };

I attached a test case to the bugzilla entry below.

Thanks for any review or feedback.  Curious if anyone sees a better fix.

-C


From 871671c4ab8ff00e85b434865e8855fc356efa8f Mon Sep 17 00:00:00 2001
From: Cody Northrop c...@lunarg.com
Date: Thu, 12 Jun 2014 09:07:18 -0600
Subject: [PATCH] i965/fs: Update discard jump to preserve uniform loads via
 sampler.

The series that implemented this optimization was done before
the changes to use samplers for uniform loads.  Uniform sampler
loads use special execution masks and only populate four
channels, so we can't jump over those or corruption ensues.
Use a more conservative jump mask which only jumps to the end
if all relevant channels are disabled.

No change was observed in GLbenchmark 2.7, so the optimization
is preserved.

Signed-off-by: Cody Northrop c...@lunarg.com
Reviewed-by: Mike Stroyan m...@lunarg.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79948
---
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 8858852..fe05715 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1907,7 +1907,15 @@ fs_visitor::visit(ir_discard *ir)
*/
   fs_inst *discard_jump = emit(FS_OPCODE_DISCARD_JUMP);
   discard_jump-flag_subreg = 1;
-  discard_jump-predicate = BRW_PREDICATE_ALIGN1_ANY4H;
+
+  /* Uniforms are now loaded using samplers with a routine that has
+   * its own execution mask, so we can only jump if all relevant
+   * channels are dead.  This is more conservative than the previous
+   * four channel checking, but still preserves speedups.
+   */
+  discard_jump-predicate = (8 == dispatch_width)
+? BRW_PREDICATE_ALIGN1_ANY8H
+: BRW_PREDICATE_ALIGN1_ANY16H;
   discard_jump-predicate_inverse = true;
}
 }
-- 
1.8.3.2
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: Fix glcpp to catch garbage after #if 1 ... #else

2014-06-12 Thread Matt Turner
On Thu, Jun 12, 2014 at 11:26 AM, Carl Worth cwo...@cworth.org wrote:
 Previously, a line such as:

 #else garbage

 would flag an error if it followed #if 0, but not if it followed #if 1.

 We fix this by setting a new bit of state (lexing_else) that allows the lexer
 to defer switching to the SKIP start state until after the NEWLINE following
 the #else directive.

 A new test case is added for:

 #if 1
 #else garbage
 #endif

 which was untested before, (and did not generate the desired error).
 ---
  src/glsl/glcpp/glcpp-lex.l   | 10 +-
  src/glsl/glcpp/glcpp-parse.y |  6 --
  src/glsl/glcpp/glcpp.h   |  1 +
  src/glsl/glcpp/tests/103-garbage-after-else-0.c  |  3 +++
  src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected |  4 
  src/glsl/glcpp/tests/103-garbage-after-else.c|  3 ---
  src/glsl/glcpp/tests/103-garbage-after-else.c.expected   |  4 
  src/glsl/glcpp/tests/123-garbage-after-else-1.c  |  3 +++
  src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected |  4 
  9 files changed, 28 insertions(+), 10 deletions(-)
  create mode 100644 src/glsl/glcpp/tests/103-garbage-after-else-0.c
  create mode 100644 src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected
  delete mode 100644 src/glsl/glcpp/tests/103-garbage-after-else.c
  delete mode 100644 src/glsl/glcpp/tests/103-garbage-after-else.c.expected
  create mode 100644 src/glsl/glcpp/tests/123-garbage-after-else-1.c
  create mode 100644 src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected

 diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
 index 188e454..dea6a6c 100644
 --- a/src/glsl/glcpp/glcpp-lex.l
 +++ b/src/glsl/glcpp/glcpp-lex.l
 @@ -125,7 +125,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
  * as set by the parser to know whether to change from INITIAL
  * to SKIP or from SKIP back to INITIAL.
  *
 -* Three cases cause us to switch out of the SKIP state and
 +* Four cases cause us to switch out of the SKIP state and
  * back to the INITIAL state:
  *
  *  1. The top of the skip_stack is of type SKIP_NO_SKIP
 @@ -142,9 +142,17 @@ HEXADECIMAL_INTEGER0[xX][0-9a-fA-F]+[uU]?
  * #elif. Even inside an #if 0 we need to lex this
  * expression so the parser can correctly update the
  * skip_stack state.
 +*
 +*  4. The lexing_else bit is set. This indicates that we
 +* are lexing tokens after #else and before the
 +* newline. We don't want to skip here just so that we
 +* can correctly flag errors if there is any
 +* garbage (other than comments) on the same line as the
 +* #else.
  */
 if (YY_START == INITIAL || YY_START == SKIP) {
 if (parser-lexing_if ||
 +parser-lexing_else ||

The preprocessor is one of the only bits that uses tabs. I'd rather we
stick with that, or convert the whole thing.

Otherwise, looks good to me.

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


[Mesa-dev] Static/shared pipe-drivers (was megadriver/pipe-loader-to-all)

2014-06-12 Thread Emil Velikov
Hi all,

These patches add support for building (grouping) the various targets per
API, meaning that only one library will be created  for e.g. vdpau
(libvdpau_gallium) with individual ones (libvdpau_r600) being a hardlink
to it.

This allows us to have substantial space savings as the API(state-tracker)
is available only once. Additionally it adds support for shared
pipe-drivers via a _unstable_ interface, which saves us the duplication
across X APIs.

The former method has been used by the egl-static while the latter by
opencl and gbm targets since they were introduced.

By default we build with static pipe-drivers.

Some numbers + extra info [1]

[Static]
dri:(r600|radeonsi|nouveau)_dri.so   - 6.5 MiB
vdpau:  libvdpau_(r600|radeonsi|nouveau).so  - 3.5 MiB

Total: 10MiB

[Shared]
Libraries:
dri:(r600|radeonsi|nouveau)_dri.so   - 3.9 MiB
vdpau:  libvdpau_(r600|radeonsi|nouveau).so  - 633 KiB
gallium-pipe:   pipe_(r600|radeonsi|nouveau).so  - 5.3 MiB

Total: 9.8MiB

[Current]
dri:(r600|radeonsi|nouveau)_dri.so   - 5.0+4.5+5.3 = 14.8 MiB
vdpau:  libvdpau_(r600|radeonsi|nouveau).so  - 1.9+1.2+2.3 = 5.4 MiB

Total: 20.2MiB


The previous series can be found here [2]
Changes since then
 - Convert targets individually.
 - OMX targets now work, and the final library is now libomx-mesa.so
 - Dropped the DRI targets for now
 - A handfull of typos thinkos and bugs fixed.


My plan is to have these pushed in ~4 stages, with two stages per week.
This way I will be able to crack on with the remaining bits and have all
of it tested well before we branch the next release.

Series is availabe at
https://github.com/evelikov/Mesa/tree/static-or-shared-pipe-drivers

As always comments and suggestions are greatly appreciated.

Cheers,
-Emil

[1] http://lists.freedesktop.org/archives/mesa-dev/2014-May/059806.html
[2] http://lists.freedesktop.org/archives/mesa-dev/2014-May/059628.html


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


[Mesa-dev] [PATCH 09/26] automake: introduce helper variable

2014-06-12 Thread Emil Velikov
- gallium_pipe_loader_winsys_libs

Will be used in upcomming commits to reduce duplication
in the build.

v2: Drop the megadriver/static_target variables.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/Automake.inc | 16 
 1 file changed, 16 insertions(+)

diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index 97735ab..d55acc9 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -151,3 +151,19 @@ GALLIUM_XVMC_LIB_DEPS += $(LLVM_LIBS)
 GALLIUM_OMX_LIB_DEPS += $(LLVM_LIBS)
 
 endif
+
+
+GALLIUM_PIPE_LOADER_WINSYS_LIBS = \
+   $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la
+
+if HAVE_DRISW
+GALLIUM_PIPE_LOADER_WINSYS_LIBS += \
+   $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
+endif
+
+if NEED_WINSYS_XLIB
+GALLIUM_PIPE_LOADER_WINSYS_LIBS += \
+   $(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
+   -lX11 -lXext -lXfixes \
+   $(LIBDRM_LIBS)
+endif
-- 
1.9.3

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


[Mesa-dev] [PATCH 06/26] target-helpers: add a note about debug wrappers

2014-06-12 Thread Emil Velikov
If memory serves me right, at least one debug wrapper does
not return the base screen on failure.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/auxiliary/target-helpers/inline_debug_helper.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/auxiliary/target-helpers/inline_debug_helper.h 
b/src/gallium/auxiliary/target-helpers/inline_debug_helper.h
index 77c7cfd..6fe667d 100644
--- a/src/gallium/auxiliary/target-helpers/inline_debug_helper.h
+++ b/src/gallium/auxiliary/target-helpers/inline_debug_helper.h
@@ -26,6 +26,10 @@
 #include noop/noop_public.h
 #endif
 
+/*
+ * TODO: Audit the following *screen_create() - all of
+ * them should return the original screen on failuire.
+ */
 static INLINE struct pipe_screen *
 debug_screen_wrap(struct pipe_screen *screen)
 {
-- 
1.9.3

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


[Mesa-dev] [PATCH 03/26] targets/pipe-loader: link sw-wrapper and softpipe for svga/i915

2014-06-12 Thread Emil Velikov
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/targets/pipe-loader/Makefile.am | 28 +---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/gallium/targets/pipe-loader/Makefile.am 
b/src/gallium/targets/pipe-loader/Makefile.am
index 500dfce..6faac72 100644
--- a/src/gallium/targets/pipe-loader/Makefile.am
+++ b/src/gallium/targets/pipe-loader/Makefile.am
@@ -65,6 +65,8 @@ pipe_LTLIBRARIES += pipe_i915.la
 
 pipe_i915_la_SOURCES = pipe_i915.c
 nodist_EXTRA_pipe_i915_la_SOURCES = dummy.cpp
+
+pipe_i915_la_CPPFLAGS = $(AM_CPPFLAGS)
 pipe_i915_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
@@ -72,6 +74,18 @@ pipe_i915_la_LIBADD = \
$(LIBDRM_LIBS) \
$(INTEL_LIBS)
 
+pipe_i915_la_CPPFLAGS += -DGALLIUM_SOFTPIPE
+pipe_i915_la_LIBADD += \
+   $(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \
+   $(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la
+
+if NEED_GALLIUM_LLVMPIPE_DRIVER
+
+pipe_i915_la_CPPFLAGS += -DGALLIUM_LLVMPIPE
+pipe_i915_la_LIBADD += \
+   $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
+
+endif
 endif
 
 if HAVE_GALLIUM_NOUVEAU
@@ -153,29 +167,37 @@ pipe_LTLIBRARIES += pipe_vmwgfx.la
 pipe_vmwgfx_la_SOURCES = pipe_vmwgfx.c
 nodist_EXTRA_pipe_vmwgfx_la_SOURCES = dummy.cpp
 
+pipe_vmwgfx_la_CPPFLAGS = $(AM_CPPFLAGS)
 pipe_vmwgfx_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/winsys/svga/drm/libsvgadrm.la \
$(top_builddir)/src/gallium/drivers/svga/libsvga.la \
$(LIBDRM_LIBS)
 
+pipe_vmwgfx_la_CPPFLAGS += -DGALLIUM_SOFTPIPE
+pipe_vmwgfx_la_LIBADD += \
+   $(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \
+   $(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la
+
 endif
 
 if HAVE_GALLIUM_SOFTPIPE
-AM_CPPFLAGS += -DGALLIUM_SOFTPIPE
-
 pipe_LTLIBRARIES += pipe_swrast.la
+
 pipe_swrast_la_SOURCES = pipe_swrast.c
 nodist_EXTRA_pipe_swrast_la_SOURCES = dummy.cpp
 
+pipe_swrast_la_CPPFLAGS = $(AM_CPPFLAGS)
+pipe_swrast_la_CPPFLAGS += -DGALLIUM_SOFTPIPE
 pipe_swrast_la_LIBADD = \
$(PIPE_LIBS) \
$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la
 
 if HAVE_GALLIUM_LLVMPIPE
-AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
 
+pipe_swrast_la_CPPFLAGS += -DGALLIUM_LLVMPIPE
 pipe_swrast_la_LIBADD += \
$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
+
 endif
 endif
-- 
1.9.3

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


[Mesa-dev] [PATCH 05/26] targets/pipe-loader: add driver specific drm_configuration

2014-06-12 Thread Emil Velikov
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/targets/pipe-loader/pipe_nouveau.c  | 25 -
 src/gallium/targets/pipe-loader/pipe_r300.c | 25 -
 src/gallium/targets/pipe-loader/pipe_r600.c | 25 -
 src/gallium/targets/pipe-loader/pipe_radeonsi.c | 25 -
 src/gallium/targets/pipe-loader/pipe_vmwgfx.c   | 25 -
 5 files changed, 120 insertions(+), 5 deletions(-)

diff --git a/src/gallium/targets/pipe-loader/pipe_nouveau.c 
b/src/gallium/targets/pipe-loader/pipe_nouveau.c
index 65425e8..825b36f 100644
--- a/src/gallium/targets/pipe-loader/pipe_nouveau.c
+++ b/src/gallium/targets/pipe-loader/pipe_nouveau.c
@@ -17,5 +17,28 @@ create_screen(int fd)
return screen;
 }
 
+static const struct drm_conf_ret throttle_ret = {
+   .type = DRM_CONF_INT,
+   .val.val_int = 2,
+};
+
+static const struct drm_conf_ret share_fd_ret = {
+   .type = DRM_CONF_BOOL,
+   .val.val_int = true,
+};
+
+static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
+{
+   switch (conf) {
+   case DRM_CONF_THROTTLE:
+  return throttle_ret;
+   case DRM_CONF_SHARE_FD:
+  return share_fd_ret;
+   default:
+  break;
+   }
+   return NULL;
+}
+
 PUBLIC
-DRM_DRIVER_DESCRIPTOR(nouveau, nouveau, create_screen, NULL)
+DRM_DRIVER_DESCRIPTOR(nouveau, nouveau, create_screen, drm_configuration)
diff --git a/src/gallium/targets/pipe-loader/pipe_r300.c 
b/src/gallium/targets/pipe-loader/pipe_r300.c
index 6ab7e74..abcade4 100644
--- a/src/gallium/targets/pipe-loader/pipe_r300.c
+++ b/src/gallium/targets/pipe-loader/pipe_r300.c
@@ -13,5 +13,28 @@ create_screen(int fd)
return sws ? debug_screen_wrap(sws-screen) : NULL;
 }
 
+static const struct drm_conf_ret throttle_ret = {
+   .type = DRM_CONF_INT,
+   .val.val_int = 2,
+};
+
+static const struct drm_conf_ret share_fd_ret = {
+   .type = DRM_CONF_BOOL,
+   .val.val_int = true,
+};
+
+static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
+{
+   switch (conf) {
+   case DRM_CONF_THROTTLE:
+  return throttle_ret;
+   case DRM_CONF_SHARE_FD:
+  return share_fd_ret;
+   default:
+  break;
+   }
+   return NULL;
+}
+
 PUBLIC
-DRM_DRIVER_DESCRIPTOR(r300, radeon, create_screen, NULL)
+DRM_DRIVER_DESCRIPTOR(r300, radeon, create_screen, drm_configuration)
diff --git a/src/gallium/targets/pipe-loader/pipe_r600.c 
b/src/gallium/targets/pipe-loader/pipe_r600.c
index 2e6bd42..eb53637 100644
--- a/src/gallium/targets/pipe-loader/pipe_r600.c
+++ b/src/gallium/targets/pipe-loader/pipe_r600.c
@@ -13,5 +13,28 @@ create_screen(int fd)
return rw ? debug_screen_wrap(rw-screen) : NULL;
 }
 
+static const struct drm_conf_ret throttle_ret = {
+   .type = DRM_CONF_INT,
+   .val.val_int = 2,
+};
+
+static const struct drm_conf_ret share_fd_ret = {
+   .type = DRM_CONF_BOOL,
+   .val.val_int = true,
+};
+
+static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
+{
+   switch (conf) {
+   case DRM_CONF_THROTTLE:
+  return throttle_ret;
+   case DRM_CONF_SHARE_FD:
+  return share_fd_ret;
+   default:
+  break;
+   }
+   return NULL;
+}
+
 PUBLIC
-DRM_DRIVER_DESCRIPTOR(r600, radeon, create_screen, NULL)
+DRM_DRIVER_DESCRIPTOR(r600, radeon, create_screen, drm_configuration)
diff --git a/src/gallium/targets/pipe-loader/pipe_radeonsi.c 
b/src/gallium/targets/pipe-loader/pipe_radeonsi.c
index 9a8feae..1dcd781 100644
--- a/src/gallium/targets/pipe-loader/pipe_radeonsi.c
+++ b/src/gallium/targets/pipe-loader/pipe_radeonsi.c
@@ -13,5 +13,28 @@ create_screen(int fd)
return rw ? debug_screen_wrap(rw-screen) : NULL;
 }
 
+static const struct drm_conf_ret throttle_ret = {
+   .type = DRM_CONF_INT,
+   .val.val_int = 2,
+};
+
+static const struct drm_conf_ret share_fd_ret = {
+   .type = DRM_CONF_BOOL,
+   .val.val_int = true,
+};
+
+static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
+{
+   switch (conf) {
+   case DRM_CONF_THROTTLE:
+  return throttle_ret;
+   case DRM_CONF_SHARE_FD:
+  return share_fd_ret;
+   default:
+  break;
+   }
+   return NULL;
+}
+
 PUBLIC
-DRM_DRIVER_DESCRIPTOR(radeonsi, radeon, create_screen, NULL)
+DRM_DRIVER_DESCRIPTOR(radeonsi, radeon, create_screen, drm_configuration)
diff --git a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c 
b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
index 0e6cb3a..d31797f 100644
--- a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
+++ b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
@@ -26,5 +26,28 @@ create_screen(int fd)
return screen;
 }
 
+static const struct drm_conf_ret throttle_ret = {
+   .type = DRM_CONF_INT,
+   .val.val_int = 2,
+};
+
+static const struct drm_conf_ret share_fd_ret = {
+   .type = DRM_CONF_BOOL,
+   .val.val_int = true,
+};
+
+static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
+{
+   switch (conf) {
+   case DRM_CONF_THROTTLE:
+  return throttle_ret;
+   case 

[Mesa-dev] [PATCH 01/26] pipe-loader: note that we leak pipe_loader_drm_device-base-driver_name

2014-06-12 Thread Emil Velikov
The string is malloc'd (strdup) in loader_get_driver_for_fd().

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index a3fc186..2e5b74b 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -256,6 +256,7 @@ pipe_loader_drm_release(struct pipe_loader_device **dev)
   util_dl_close(ddev-lib);
 
close(ddev-fd);
+   /* XXX: Free ddev-base.driver_name - strdup at loader_get_driver_for_fd */
FREE(ddev);
*dev = NULL;
 }
-- 
1.9.3

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


[Mesa-dev] [PATCH 02/26] pipe-loader: add pipe_loader_ops::configuration()

2014-06-12 Thread Emil Velikov
Required for the dri state-tracker. Will be used to retrieve
driver specific configuration parameters:
 - share_fd (dmabuf) capability
 - throttle

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/auxiliary/pipe-loader/pipe_loader.c|  7 +++
 src/gallium/auxiliary/pipe-loader/pipe_loader.h| 11 ++
 .../auxiliary/pipe-loader/pipe_loader_drm.c| 24 ++
 .../auxiliary/pipe-loader/pipe_loader_priv.h   |  3 +++
 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c |  8 
 5 files changed, 53 insertions(+)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c 
b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
index 2639763..8e79f85 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
@@ -61,6 +61,13 @@ pipe_loader_release(struct pipe_loader_device **devs, int 
ndev)
   devs[i]-ops-release(devs[i]);
 }
 
+const struct drm_conf_ret *
+pipe_loader_configuration(struct pipe_loader_device *dev,
+  enum drm_conf conf)
+{
+   return dev-ops-configuration(dev, conf);
+}
+
 struct pipe_screen *
 pipe_loader_create_screen(struct pipe_loader_device *dev,
   const char *library_paths)
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h 
b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index caef6c1..8ff00b1 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -34,6 +34,7 @@
 #define PIPE_LOADER_H
 
 #include pipe/p_compiler.h
+#include state_tracker/drm_driver.h
 
 #ifdef HAVE_PIPE_LOADER_XLIB
 #include X11/Xlib.h
@@ -94,6 +95,16 @@ pipe_loader_create_screen(struct pipe_loader_device *dev,
   const char *library_paths);
 
 /**
+ * Query the configuration parameters for the specified device.
+ *
+ * \param dev Device that will be queried.
+ * \param conf The drm_conf id of the option to be queried.
+ */
+const struct drm_conf_ret *
+pipe_loader_configuration(struct pipe_loader_device *dev,
+  enum drm_conf conf);
+
+/**
  * Release resources allocated for a list of devices.
  *
  * Should be called when the specified devices are no longer in use to
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 2e5b74b..1bbaf19 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -261,6 +261,29 @@ pipe_loader_drm_release(struct pipe_loader_device **dev)
*dev = NULL;
 }
 
+static const struct drm_conf_ret *
+pipe_loader_drm_configuration(struct pipe_loader_device *dev,
+  enum drm_conf conf)
+{
+   struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(dev);
+   const struct drm_driver_descriptor *dd;
+
+   if (!ddev-lib)
+  return NULL;
+
+   dd = (const struct drm_driver_descriptor *)
+  util_dl_get_proc_address(ddev-lib, driver_descriptor);
+
+   /* sanity check on the name */
+   if (!dd || strcmp(dd-name, ddev-base.driver_name) != 0)
+  return NULL;
+
+   if (!dd-configuration)
+  return NULL;
+
+   return dd-configuration(conf);
+}
+
 static struct pipe_screen *
 pipe_loader_drm_create_screen(struct pipe_loader_device *dev,
   const char *library_paths)
@@ -285,5 +308,6 @@ pipe_loader_drm_create_screen(struct pipe_loader_device 
*dev,
 
 static struct pipe_loader_ops pipe_loader_drm_ops = {
.create_screen = pipe_loader_drm_create_screen,
+   .configuration = pipe_loader_drm_configuration,
.release = pipe_loader_drm_release
 };
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h 
b/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
index 476c0ad..d3b0252 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
@@ -34,6 +34,9 @@ struct pipe_loader_ops {
struct pipe_screen *(*create_screen)(struct pipe_loader_device *dev,
 const char *library_paths);
 
+   const struct drm_conf_ret *(*configuration)(struct pipe_loader_device *dev,
+   enum drm_conf conf);
+
void (*release)(struct pipe_loader_device **dev);
 };
 
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c 
b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
index fa317f2..b1b1ca6 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -152,6 +152,13 @@ pipe_loader_sw_release(struct pipe_loader_device **dev)
*dev = NULL;
 }
 
+static const struct drm_conf_ret *
+pipe_loader_sw_configuration(struct pipe_loader_device *dev,
+ enum drm_conf conf)
+{
+   return NULL;
+}
+
 static struct pipe_screen *
 pipe_loader_sw_create_screen(struct 

[Mesa-dev] [PATCH 07/26] target-helpers: add dd_create_screen() helper

2014-06-12 Thread Emil Velikov
Will be used by gallium targets that statically link the
pipe-drivers in the final library. Provides identical
functionality to device_descriptor.create_screan.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 .../auxiliary/target-helpers/inline_drm_helper.h   | 218 +
 src/gallium/include/state_tracker/drm_driver.h |   2 +
 2 files changed, 220 insertions(+)
 create mode 100644 src/gallium/auxiliary/target-helpers/inline_drm_helper.h

diff --git a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h 
b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
new file mode 100644
index 000..33edb42
--- /dev/null
+++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
@@ -0,0 +1,218 @@
+#ifndef INLINE_DRM_HELPER_H
+#define INLINE_DRM_HELPER_H
+
+#include state_tracker/drm_driver.h
+#include target-helpers/inline_debug_helper.h
+#include loader.h
+
+#if GALLIUM_I915
+#include target-helpers/inline_wrapper_sw_helper.h
+#include i915/drm/i915_drm_public.h
+#include i915/i915_public.h
+#endif
+
+#if GALLIUM_ILO
+#include intel/intel_winsys.h
+#include ilo/ilo_public.h
+#endif
+
+#if GALLIUM_NOUVEAU
+#include nouveau/drm/nouveau_drm_public.h
+#endif
+
+#if GALLIUM_R300
+#include radeon/drm/radeon_winsys.h
+#include radeon/drm/radeon_drm_public.h
+#include r300/r300_public.h
+#endif
+
+#if GALLIUM_R600
+#include radeon/drm/radeon_winsys.h
+#include radeon/drm/radeon_drm_public.h
+#include r600/r600_public.h
+#endif
+
+#if GALLIUM_RADEONSI
+#include radeon/drm/radeon_winsys.h
+#include radeon/drm/radeon_drm_public.h
+#include radeonsi/si_public.h
+#endif
+
+#if GALLIUM_VMWGFX
+#include target-helpers/inline_wrapper_sw_helper.h
+#include svga/drm/svga_drm_public.h
+#include svga/svga_public.h
+#endif
+
+#if GALLIUM_FREEDRENO
+#include freedreno/drm/freedreno_drm_public.h
+#endif
+
+static char* driver_name = NULL;
+
+/* XXX: We need to teardown the winsys if *screen_create() fails. */
+
+#if defined(GALLIUM_I915)
+static struct pipe_screen *
+pipe_i915_create_screen(int fd)
+{
+   struct i915_winsys *iws;
+   struct pipe_screen *screen;
+
+   iws = i915_drm_winsys_create(fd);
+   if (!iws)
+  return NULL;
+
+   screen = i915_screen_create(iws);
+   if (screen) {
+  screen = sw_screen_wrap(screen);
+  /* sw_screen_wrap returns original screen on failure */
+  screen = debug_screen_wrap(screen);
+   }
+   return screen;
+}
+#endif
+
+#if defined(GALLIUM_ILO)
+static struct pipe_screen *
+pipe_ilo_create_screen(int fd)
+{
+   struct intel_winsys *iws;
+   struct pipe_screen *screen;
+
+   iws = intel_winsys_create_for_fd(fd);
+   if (!iws)
+  return NULL;
+
+   screen = ilo_screen_create(iws);
+   return screen ? debug_screen_wrap(screen) : NULL;
+}
+#endif
+
+#if defined(GALLIUM_NOUVEAU)
+static struct pipe_screen *
+pipe_nouveau_create_screen(int fd)
+{
+   struct pipe_screen *screen;
+
+   screen = nouveau_drm_screen_create(fd);
+   return screen ? debug_screen_wrap(screen) : NULL;
+}
+#endif
+
+#if defined(GALLIUM_R300)
+static struct pipe_screen *
+pipe_r300_create_screen(int fd)
+{
+   struct radeon_winsys *rw;
+
+   rw = radeon_drm_winsys_create(fd, r300_screen_create);
+   return rw ? debug_screen_wrap(rw-screen) : NULL;
+}
+#endif
+
+#if defined(GALLIUM_R600)
+static struct pipe_screen *
+pipe_r600_create_screen(int fd)
+{
+   struct radeon_winsys *rw;
+
+   rw = radeon_drm_winsys_create(fd, r600_screen_create);
+   return rw ? debug_screen_wrap(rw-screen) : NULL;
+}
+#endif
+
+#if defined(GALLIUM_RADEONSI)
+static struct pipe_screen *
+pipe_radeonsi_create_screen(int fd)
+{
+   struct radeon_winsys *rw;
+
+   rw = radeon_drm_winsys_create(fd, radeonsi_screen_create);
+   return rw ? debug_screen_wrap(rw-screen) : NULL;
+}
+#endif
+
+#if defined(GALLIUM_VMWGFX)
+static struct pipe_screen *
+pipe_vmwgfx_create_screen(int fd)
+{
+   struct svga_winsys_screen *sws;
+   struct pipe_screen *screen;
+
+   sws = svga_drm_winsys_screen_create(fd);
+   if (!sws)
+  return NULL;
+
+   screen = svga_screen_create(sws);
+   if (screen) {
+  screen = sw_screen_wrap(screen);
+  /* sw_screen_wrap returns original screen on failure */
+  screen = debug_screen_wrap(screen);
+   }
+   return screen;
+}
+#endif
+
+#if defined(GALLIUM_FREEDRENO)
+static struct pipe_screen *
+pipe_freedreno_create_screen(int fd)
+{
+   struct pipe_screen *screen;
+
+   screen = fd_drm_screen_create(fd);
+   return screen ? debug_screen_wrap(screen) : NULL;
+}
+#endif
+
+inline struct pipe_screen *
+dd_create_screen(int fd)
+{
+   driver_name = loader_get_driver_for_fd(fd, _LOADER_GALLIUM);
+   if (!driver_name)
+  return NULL;
+
+#if defined(GALLIUM_I915)
+   if (strcmp(driver_name, i915) == 0)
+  return pipe_i915_create_screen(fd);
+   else
+#endif
+#if defined(GALLIUM_ILO)
+   if (strcmp(driver_name, i965) == 0)
+  return pipe_ilo_create_screen(fd);
+   else
+#endif
+#if defined(GALLIUM_NOUVEAU)
+   if (strcmp(driver_name, nouveau) == 0)
+  

[Mesa-dev] [PATCH 04/26] targets/pipe-loader: add sw/wrapper to vmwgfx and i915

2014-06-12 Thread Emil Velikov
To match their original dri-* targets, respectively.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/targets/pipe-loader/pipe_i915.c   | 3 +++
 src/gallium/targets/pipe-loader/pipe_vmwgfx.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/gallium/targets/pipe-loader/pipe_i915.c 
b/src/gallium/targets/pipe-loader/pipe_i915.c
index 85662cb..6869c87 100644
--- a/src/gallium/targets/pipe-loader/pipe_i915.c
+++ b/src/gallium/targets/pipe-loader/pipe_i915.c
@@ -1,4 +1,5 @@
 
+#include target-helpers/inline_wrapper_sw_helper.h
 #include target-helpers/inline_debug_helper.h
 #include state_tracker/drm_driver.h
 #include i915/drm/i915_drm_public.h
@@ -18,6 +19,8 @@ create_screen(int fd)
if (!screen)
   return NULL;
 
+   screen = sw_screen_wrap(screen);
+
screen = debug_screen_wrap(screen);
 
return screen;
diff --git a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c 
b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
index bfe665b..0e6cb3a 100644
--- a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
+++ b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
@@ -1,4 +1,5 @@
 
+#include target-helpers/inline_wrapper_sw_helper.h
 #include target-helpers/inline_debug_helper.h
 #include state_tracker/drm_driver.h
 #include svga/drm/svga_drm_public.h
@@ -18,6 +19,8 @@ create_screen(int fd)
if (!screen)
   return NULL;
 
+   screen = sw_screen_wrap(screen);
+
screen = debug_screen_wrap(screen);
 
return screen;
-- 
1.9.3

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


[Mesa-dev] [PATCH 11/26] configure: add HAVE_GALLIUM_STATIC_TARGETS

2014-06-12 Thread Emil Velikov
Will be used to control the linking mode of pipe-drivers
in gallium targets.

XXX: Do we want to expose this via configure option ?
I'm personally inclined to use pipe-drivers despite the
unstable interface between them and the rest of mesa.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure.ac b/configure.ac
index 390adaa..2b92d57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2063,6 +2063,9 @@ AM_CONDITIONAL(NEED_GALLIUM_LLVMPIPE_DRIVER, test 
x$HAVE_GALLIUM_I915 = xyes -
   x$HAVE_GALLIUM_SOFTPIPE = 
xyes \
test x$MESA_LLVM = x1)
 
+# Enable static gallium targets for now
+AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test xyes = xyes)
+
 # NOTE: anything using xcb or other client side libs ends up in separate
 #   _CLIENT variables.  The pipe loader is built in two variants,
 #   one that is standalone and does not link any x client libs (for
-- 
1.9.3

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


[Mesa-dev] [PATCH 12/26] targets/vdpau-nouveau: convert to static/shared pipe-drivers

2014-06-12 Thread Emil Velikov
Create a single library (for the vdpau api) thus reducing
the overall size of mesa. Current commit converts
vdpau-nouveau, with upcomming commits handling the rest.

The library can be built with the relevant pipe-drivers
statically linked in, or loaded as shared modules.
Currently we default to static.

Add SPLIT_TARGETS to guard the other VL targets.

Note: symlink handling is rather ugly and will need an
update to work with BSD and other non-linux platforms.

v2: Split the conversion into per-target basis.

Cc: Maarten Lankhorst maarten.lankho...@canonical.com
Cc: Ilia Mirkin imir...@alum.mit.edu
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac   |   5 +-
 src/gallium/Automake.inc   |   3 +-
 src/gallium/auxiliary/vl/vl_winsys.h   |   2 +
 src/gallium/auxiliary/vl/vl_winsys_dri.c   |  24 +-
 src/gallium/targets/Makefile.am|   8 +-
 src/gallium/targets/dri-vdpau.dyn  |   4 +
 src/gallium/targets/omx-nouveau/Makefile.am|   2 +
 src/gallium/targets/r600/omx/Makefile.am   |   2 +
 src/gallium/targets/r600/vdpau/Makefile.am |   2 +
 src/gallium/targets/r600/xvmc/Makefile.am  |   2 +
 src/gallium/targets/radeonsi/omx/Makefile.am   |   2 +
 src/gallium/targets/radeonsi/vdpau/Makefile.am |   2 +
 src/gallium/targets/vdpau-nouveau/Makefile.am  |  46 --
 src/gallium/targets/vdpau-nouveau/target.c |  18 
 src/gallium/targets/vdpau.sym  |   8 --
 src/gallium/targets/vdpau/Makefile.am  | 111 +
 src/gallium/targets/vdpau/target.c |   1 +
 src/gallium/targets/vdpau/vdpau.sym|   8 ++
 src/gallium/targets/xvmc-nouveau/Makefile.am   |   2 +
 19 files changed, 172 insertions(+), 80 deletions(-)
 create mode 100644 src/gallium/targets/dri-vdpau.dyn
 delete mode 100644 src/gallium/targets/vdpau-nouveau/Makefile.am
 delete mode 100644 src/gallium/targets/vdpau-nouveau/target.c
 delete mode 100644 src/gallium/targets/vdpau.sym
 create mode 100644 src/gallium/targets/vdpau/Makefile.am
 create mode 100644 src/gallium/targets/vdpau/target.c
 create mode 100644 src/gallium/targets/vdpau/vdpau.sym

diff --git a/configure.ac b/configure.ac
index 2b92d57..555efb4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1417,6 +1417,7 @@ if test x$enable_vdpau = xyes; then
 PKG_CHECK_MODULES([VDPAU], [vdpau = $VDPAU_REQUIRED x11-xcb xcb-dri2 = 
$XCBDRI2_REQUIRED],
   [VDPAU_LIBS=`$PKG_CONFIG --libs x11-xcb xcb-dri2`])
 GALLIUM_STATE_TRACKERS_DIRS=$GALLIUM_STATE_TRACKERS_DIRS vdpau
+enable_gallium_loader=yes
 fi
 AM_CONDITIONAL(HAVE_ST_VDPAU, test x$enable_vdpau = xyes)
 
@@ -1971,7 +1972,7 @@ if test -n $with_gallium_drivers; then
 PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau = 
$LIBDRM_NOUVEAU_REQUIRED])
 gallium_require_drm_loader
 GALLIUM_DRIVERS_DIRS=$GALLIUM_DRIVERS_DIRS nouveau
-gallium_check_st nouveau/drm dri-nouveau  xvmc-nouveau 
vdpau-nouveau omx-nouveau
+gallium_check_st nouveau/drm dri-nouveau  xvmc-nouveau 
vdpau/nouveau omx-nouveau
 DRICOMMON_NEED_LIBDRM=yes
 ;;
 xfreedreno)
@@ -2230,7 +2231,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/radeonsi/dri/Makefile
src/gallium/targets/radeonsi/omx/Makefile
src/gallium/targets/radeonsi/vdpau/Makefile
-   src/gallium/targets/vdpau-nouveau/Makefile
+   src/gallium/targets/vdpau/Makefile
src/gallium/targets/xa/Makefile
src/gallium/targets/xa/xatracker.pc
src/gallium/targets/xvmc-nouveau/Makefile
diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index d55acc9..f216fc9 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -41,6 +41,7 @@ GALLIUM_DRI_CFLAGS = \
 
 GALLIUM_VIDEO_CFLAGS = \
-I$(top_srcdir)/include \
+   -I$(top_srcdir)/src/loader \
-I$(top_srcdir)/src/gallium/include \
-I$(top_srcdir)/src/gallium/auxiliary \
-I$(top_srcdir)/src/gallium/drivers \
@@ -87,7 +88,7 @@ GALLIUM_DRI_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri.sym
 
 GALLIUM_VDPAU_LINKER_FLAGS += \
-   -Wl,--version-script=$(top_srcdir)/src/gallium/targets/vdpau.sym
+   -Wl,--version-script=$(top_srcdir)/src/gallium/targets/vdpau/vdpau.sym
 
 GALLIUM_XVMC_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/xvmc.sym
diff --git a/src/gallium/auxiliary/vl/vl_winsys.h 
b/src/gallium/auxiliary/vl/vl_winsys.h
index 642f010..f6b47c9 100644
--- a/src/gallium/auxiliary/vl/vl_winsys.h
+++ b/src/gallium/auxiliary/vl/vl_winsys.h
@@ -38,10 +38,12 @@
 
 struct pipe_screen;
 struct pipe_surface;
+struct pipe_loader_device;
 
 struct vl_screen
 {
struct pipe_screen *pscreen;
+   struct pipe_loader_device *dev;
 };
 
 struct 

[Mesa-dev] [PATCH 13/26] targets/r600/vdpau: convert to static/shared pipe-drivers

2014-06-12 Thread Emil Velikov
Similar to previous commit, this allows us to minimise some
of the duplication by compacting all vdpau targets into a
single library.

Cc: Christian König christian.koe...@amd.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac|  3 +-
 src/gallium/targets/Makefile.am |  4 ---
 src/gallium/targets/r600/vdpau/Makefile.am  | 49 -
 src/gallium/targets/r600/vdpau/drm_target.c |  1 -
 src/gallium/targets/vdpau/Makefile.am   | 18 +++
 5 files changed, 19 insertions(+), 56 deletions(-)
 delete mode 100644 src/gallium/targets/r600/vdpau/Makefile.am
 delete mode 12 src/gallium/targets/r600/vdpau/drm_target.c

diff --git a/configure.ac b/configure.ac
index 555efb4..ca70ab4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1954,7 +1954,7 @@ if test -n $with_gallium_drivers; then
 if test x$enable_opencl = xyes; then
 LLVM_COMPONENTS=${LLVM_COMPONENTS} bitreader asmparser
 fi
-gallium_check_st radeon/drm r600/dri  r600/xvmc 
r600/vdpau r600/omx
+gallium_check_st radeon/drm r600/dri  r600/xvmc 
vdpau/r600 r600/omx
 DRICOMMON_NEED_LIBDRM=yes
 ;;
 xradeonsi)
@@ -2226,7 +2226,6 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/r300/dri/Makefile
src/gallium/targets/r600/dri/Makefile
src/gallium/targets/r600/omx/Makefile
-   src/gallium/targets/r600/vdpau/Makefile
src/gallium/targets/r600/xvmc/Makefile
src/gallium/targets/radeonsi/dri/Makefile
src/gallium/targets/radeonsi/omx/Makefile
diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am
index 529087d..a2e8bbd 100644
--- a/src/gallium/targets/Makefile.am
+++ b/src/gallium/targets/Makefile.am
@@ -85,10 +85,6 @@ if HAVE_ST_XVMC
 SUBDIRS += r600/xvmc
 endif
 
-if HAVE_ST_VDPAU
-SUBDIRS += r600/vdpau
-endif
-
 if HAVE_ST_OMX
 SUBDIRS += r600/omx
 endif
diff --git a/src/gallium/targets/r600/vdpau/Makefile.am 
b/src/gallium/targets/r600/vdpau/Makefile.am
deleted file mode 100644
index 1f92c56..000
--- a/src/gallium/targets/r600/vdpau/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright © 2012 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 $(top_srcdir)/src/gallium/Automake.inc
-
-AM_CPPFLAGS = \
-   -DSPLIT_TARGETS=1
-AM_CFLAGS = \
-   $(GALLIUM_VIDEO_CFLAGS)
-
-vdpaudir = $(VDPAU_LIB_INSTALL_DIR)
-vdpau_LTLIBRARIES = libvdpau_r600.la
-
-nodist_EXTRA_libvdpau_r600_la_SOURCES = dummy.cpp
-libvdpau_r600_la_SOURCES = \
-   drm_target.c \
-   $(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c
-
-libvdpau_r600_la_LDFLAGS = \
-   $(GALLIUM_VDPAU_LINKER_FLAGS) \
-   -Wl,--dynamic-list=$(srcdir)/../../r300/dri/radeon.dyn
-
-libvdpau_r600_la_LIBADD = \
-   $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
-   $(top_builddir)/src/gallium/drivers/r600/libr600.la \
-   $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
-   $(GALLIUM_VDPAU_LIB_DEPS) \
-   $(RADEON_LIBS)
-
-include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/r600/vdpau/drm_target.c 
b/src/gallium/targets/r600/vdpau/drm_target.c
deleted file mode 12
index 6955421..000
--- a/src/gallium/targets/r600/vdpau/drm_target.c
+++ /dev/null
@@ -1 +0,0 @@
-../common/drm_target.c
\ No newline at end of file
diff --git a/src/gallium/targets/vdpau/Makefile.am 
b/src/gallium/targets/vdpau/Makefile.am
index 23de1c9..7d4435c 100644
--- a/src/gallium/targets/vdpau/Makefile.am
+++ b/src/gallium/targets/vdpau/Makefile.am
@@ -48,6 +48,24 @@ STATIC_TARGET_LIB_DEPS += \
$(NOUVEAU_LIBS)
 endif
 
+if NEED_RADEON_DRM_WINSYS
+STATIC_TARGET_LIB_DEPS += \
+   $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
+endif

[Mesa-dev] [PATCH 17/26] st/omx: provide constant number of components

2014-06-12 Thread Emil Velikov
The number of components and their names/roles should
be kept constant as all of that information cached.

Cc: Leo Liu leo@amd.com
Cc: Christian König christian.koe...@amd.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/state_trackers/omx/entrypoint.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/omx/entrypoint.c 
b/src/gallium/state_trackers/omx/entrypoint.c
index d6f149e..a765666 100644
--- a/src/gallium/state_trackers/omx/entrypoint.c
+++ b/src/gallium/state_trackers/omx/entrypoint.c
@@ -51,22 +51,21 @@ static unsigned omx_usecount = 0;
 int omx_component_library_Setup(stLoaderComponentType **stComponents)
 {
OMX_ERRORTYPE r;
-   unsigned i = 0;
 
if (stComponents == NULL)
   return 2;
 
/* component 0 - video decoder */
-   r = vid_dec_LoaderComponent(stComponents[i]);
-   if (r == OMX_ErrorNone)
-  ++i;
+   r = vid_dec_LoaderComponent(stComponents[0]);
+   if (r != OMX_ErrorNone)
+  return OMX_ErrorInsufficientResources;
 
/* component 1 - video encoder */
-   r = vid_enc_LoaderComponent(stComponents[i]);
-   if (r == OMX_ErrorNone)
-  ++i;
+   r = vid_enc_LoaderComponent(stComponents[1]);
+   if (r != OMX_ErrorNone)
+  return OMX_ErrorInsufficientResources;
 
-   return i;
+   return 2;
 }
 
 struct vl_screen *omx_get_screen(void)
-- 
1.9.3

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


[Mesa-dev] [PATCH 14/26] targets/radeonsi/vdpau: convert to static/shared pipe-drivers

2014-06-12 Thread Emil Velikov
Similar to previous commits, this allows us to minimise some
of the duplication by compacting all vdpau targets into a
single library.

Cc: Christian König christian.koe...@amd.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac|  3 +-
 install-gallium-links.mk|  3 +-
 src/gallium/Automake.inc| 20 --
 src/gallium/targets/Makefile.am |  4 --
 src/gallium/targets/radeonsi/vdpau/Makefile.am  | 50 -
 src/gallium/targets/radeonsi/vdpau/drm_target.c |  1 -
 src/gallium/targets/vdpau/Makefile.am   |  8 
 7 files changed, 10 insertions(+), 79 deletions(-)
 delete mode 100644 src/gallium/targets/radeonsi/vdpau/Makefile.am
 delete mode 12 src/gallium/targets/radeonsi/vdpau/drm_target.c

diff --git a/configure.ac b/configure.ac
index ca70ab4..7ff14ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1964,7 +1964,7 @@ if test -n $with_gallium_drivers; then
 GALLIUM_DRIVERS_DIRS=$GALLIUM_DRIVERS_DIRS radeonsi
 radeon_llvm_check radeonsi
 require_egl_drm radeonsi
-gallium_check_st radeon/drm radeonsi/dri   
radeonsi/vdpau radeonsi/omx
+gallium_check_st radeon/drm radeonsi/dri   
vdpau/radeonsi radeonsi/omx
 DRICOMMON_NEED_LIBDRM=yes
 ;;
 xnouveau)
@@ -2229,7 +2229,6 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/r600/xvmc/Makefile
src/gallium/targets/radeonsi/dri/Makefile
src/gallium/targets/radeonsi/omx/Makefile
-   src/gallium/targets/radeonsi/vdpau/Makefile
src/gallium/targets/vdpau/Makefile
src/gallium/targets/xa/Makefile
src/gallium/targets/xa/xatracker.pc
diff --git a/install-gallium-links.mk b/install-gallium-links.mk
index 757b288..f45f1b4 100644
--- a/install-gallium-links.mk
+++ b/install-gallium-links.mk
@@ -5,7 +5,7 @@ if BUILD_SHARED
 if HAVE_COMPAT_SYMLINKS
 all-local : .libs/install-gallium-links
 
-.libs/install-gallium-links : $(dri_LTLIBRARIES) $(vdpau_LTLIBRARIES) 
$(egl_LTLIBRARIES) $(lib_LTLIBRARIES)
+.libs/install-gallium-links : $(dri_LTLIBRARIES) $(egl_LTLIBRARIES) 
$(lib_LTLIBRARIES)
$(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR);   \
link_dir=$(top_builddir)/$(LIB_DIR)/gallium;\
if test x$(egl_LTLIBRARIES) != x; then  \
@@ -13,7 +13,6 @@ all-local : .libs/install-gallium-links
fi; \
$(MKDIR_P) $$link_dir;  \
file_list=$(dri_LTLIBRARIES:%.la=.libs/%.so);   \
-   file_list+=$(vdpau_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \
file_list+=$(egl_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \
file_list+=$(lib_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \
for f in $$file_list; do\
diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index f216fc9..21a4a80 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -59,14 +59,6 @@ GALLIUM_DRI_LINKER_FLAGS = \
-avoid-version \
$(GC_SECTIONS)
 
-GALLIUM_VDPAU_LINKER_FLAGS = \
-   -shared \
-   -module \
-   -no-undefined \
-   -version-number $(VDPAU_MAJOR):$(VDPAU_MINOR) \
-   $(GC_SECTIONS) \
-   $(LD_NO_UNDEFINED)
-
 GALLIUM_XVMC_LINKER_FLAGS = \
-shared \
-module \
@@ -87,9 +79,6 @@ if HAVE_LD_VERSION_SCRIPT
 GALLIUM_DRI_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri.sym
 
-GALLIUM_VDPAU_LINKER_FLAGS += \
-   -Wl,--version-script=$(top_srcdir)/src/gallium/targets/vdpau/vdpau.sym
-
 GALLIUM_XVMC_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/xvmc.sym
 
@@ -112,13 +101,6 @@ GALLIUM_DRI_LIB_DEPS = \
$(EXPAT_LIBS) \
$(GALLIUM_COMMON_LIB_DEPS)
 
-GALLIUM_VDPAU_LIB_DEPS = \
-   $(top_builddir)/src/gallium/auxiliary/libgallium.la \
-   $(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \
-   $(VDPAU_LIBS) \
-   $(LIBDRM_LIBS) \
-   $(GALLIUM_COMMON_LIB_DEPS)
-
 GALLIUM_XVMC_LIB_DEPS = \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/gallium/state_trackers/xvmc/libxvmctracker.la \
@@ -142,12 +124,10 @@ GALLIUM_WINSYS_CFLAGS = \
 if HAVE_MESA_LLVM
 
 GALLIUM_DRI_LINKER_FLAGS += $(LLVM_LDFLAGS)
-GALLIUM_VDPAU_LINKER_FLAGS += $(LLVM_LDFLAGS)
 GALLIUM_XVMC_LINKER_FLAGS += $(LLVM_LDFLAGS)
 GALLIUM_OMX_LINKER_FLAGS += $(LLVM_LDFLAGS)
 
 GALLIUM_DRI_LIB_DEPS += $(LLVM_LIBS)
-GALLIUM_VDPAU_LIB_DEPS += $(LLVM_LIBS)
 GALLIUM_XVMC_LIB_DEPS += $(LLVM_LIBS)
 GALLIUM_OMX_LIB_DEPS += $(LLVM_LIBS)
 
diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am
index a2e8bbd..c31a22e 100644
--- a/src/gallium/targets/Makefile.am

[Mesa-dev] [PATCH 18/26] st/omx: avoid using dynamic vid_(enc|dec)_base and avc_(name|role)

2014-06-12 Thread Emil Velikov
Strictly speaking we should not have done this in the
first place, as all of the above should be static across
the system.

Currently this may cause some minor issues, which will be
resolved in the following patches, by providing a single
library for the OMX api.

Cleanup a few unneeded strcpy cases while we're around.

Cc: Leo Liu leo@amd.com
Cc: Christian König christian.koe...@amd.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/state_trackers/omx/vid_dec.c | 69 +---
 src/gallium/state_trackers/omx/vid_dec.h |  6 +--
 src/gallium/state_trackers/omx/vid_enc.c | 33 ++-
 src/gallium/state_trackers/omx/vid_enc.h |  4 +-
 4 files changed, 18 insertions(+), 94 deletions(-)

diff --git a/src/gallium/state_trackers/omx/vid_dec.c 
b/src/gallium/state_trackers/omx/vid_dec.c
index de1c3825..4442c5c 100644
--- a/src/gallium/state_trackers/omx/vid_dec.c
+++ b/src/gallium/state_trackers/omx/vid_dec.c
@@ -64,21 +64,6 @@ static OMX_ERRORTYPE vid_dec_DecodeBuffer(omx_base_PortType 
*port, OMX_BUFFERHEA
 static OMX_ERRORTYPE vid_dec_FreeDecBuffer(omx_base_PortType *port, OMX_U32 
idx, OMX_BUFFERHEADERTYPE *buf);
 static void vid_dec_FrameDecoded(OMX_COMPONENTTYPE *comp, 
OMX_BUFFERHEADERTYPE* input, OMX_BUFFERHEADERTYPE* output);
 
-static void vid_dec_name(char str[OMX_MAX_STRINGNAME_SIZE])
-{
-   snprintf(str, OMX_MAX_STRINGNAME_SIZE, OMX_VID_DEC_BASE_NAME, 
driver_descriptor.name);
-}
-
-static void vid_dec_name_mpeg2(char str[OMX_MAX_STRINGNAME_SIZE])
-{
-   snprintf(str, OMX_MAX_STRINGNAME_SIZE, OMX_VID_DEC_MPEG2_NAME, 
driver_descriptor.name);
-}
-
-static void vid_dec_name_avc(char str[OMX_MAX_STRINGNAME_SIZE])
-{
-   snprintf(str, OMX_MAX_STRINGNAME_SIZE, OMX_VID_DEC_AVC_NAME, 
driver_descriptor.name);
-}
-
 OMX_ERRORTYPE vid_dec_LoaderComponent(stLoaderComponentType *comp)
 {
comp-componentVersion.s.nVersionMajor = 0;
@@ -87,67 +72,35 @@ OMX_ERRORTYPE vid_dec_LoaderComponent(stLoaderComponentType 
*comp)
comp-componentVersion.s.nStep = 1;
comp-name_specific_length = 2;
 
-   comp-name = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
-   if (comp-name == NULL)
-  goto error;
-
comp-name_specific = CALLOC(comp-name_specific_length, sizeof(char *));
if (comp-name_specific == NULL)
   goto error;
 
-   comp-name_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
-   if (comp-name_specific[0] == NULL)
-  goto error;
-
-   comp-name_specific[1] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
-   if (comp-name_specific[1] == NULL)
-  goto error;
-
comp-role_specific = CALLOC(comp-name_specific_length, sizeof(char *));
if (comp-role_specific == NULL)
   goto error;
 
-   comp-role_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
-   if (comp-role_specific[0] == NULL)
-  goto error;
-
-   comp-role_specific[1] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE);
-   if (comp-role_specific[1] == NULL)
-  goto error;
-
-   vid_dec_name(comp-name);
-   vid_dec_name_mpeg2(comp-name_specific[0]);
-   vid_dec_name_avc(comp-name_specific[1]);
+   comp-name = OMX_VID_DEC_BASE_NAME;
+   comp-name_specific[0] = OMX_VID_DEC_MPEG2_NAME;
+   comp-name_specific[1] = OMX_VID_DEC_AVC_NAME;
 
-   strcpy(comp-role_specific[0], OMX_VID_DEC_MPEG2_ROLE);
-   strcpy(comp-role_specific[1], OMX_VID_DEC_AVC_ROLE);
+   comp-role_specific[0] = OMX_VID_DEC_MPEG2_ROLE;
+   comp-role_specific[1] = OMX_VID_DEC_AVC_ROLE;
 
comp-constructor = vid_dec_Constructor;
- 
+
return OMX_ErrorNone;
 
 error:
 
-   FREE(comp-name);
-
-   if (comp-name_specific) {
-  FREE(comp-name_specific[0]);
-  FREE(comp-name_specific[1]);
-  FREE(comp-name_specific);
-   }
-
-   if (comp-role_specific) {
-  FREE(comp-role_specific[0]);
-  FREE(comp-role_specific[1]);
-  FREE(comp-role_specific);
-   }
+   FREE(comp-name_specific);
+   FREE(comp-role_specific);
 
return OMX_ErrorInsufficientResources;
 }
 
 static OMX_ERRORTYPE vid_dec_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING 
name)
 {
-   char tmpstr[OMX_MAX_STRINGNAME_SIZE];
vid_dec_PrivateType *priv;
omx_base_video_PortType *port;
struct pipe_screen *screen;
@@ -166,12 +119,10 @@ static OMX_ERRORTYPE 
vid_dec_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
 
priv-profile = PIPE_VIDEO_PROFILE_UNKNOWN;
 
-   vid_dec_name_mpeg2(tmpstr);
-   if (!strcmp(name, tmpstr))
+   if (!strcmp(name, OMX_VID_DEC_MPEG2_NAME))
   priv-profile = PIPE_VIDEO_PROFILE_MPEG2_MAIN;
 
-   vid_dec_name_avc(tmpstr);
-   if (!strcmp(name, tmpstr))
+   if (!strcmp(name, OMX_VID_DEC_AVC_NAME))
   priv-profile = PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH;
 
priv-BufferMgmtCallback = vid_dec_FrameDecoded;
diff --git a/src/gallium/state_trackers/omx/vid_dec.h 
b/src/gallium/state_trackers/omx/vid_dec.h
index d6c35b5..9acf872 100644
--- a/src/gallium/state_trackers/omx/vid_dec.h
+++ b/src/gallium/state_trackers/omx/vid_dec.h
@@ -50,12 +50,12 @@
 #include os/os_thread.h
 #include util/u_double_list.h
 

[Mesa-dev] [PATCH 23/26] targets/automake.inc: s/GALLIUM_VIDEO_CFLAGS/GALLIUM_TARGET_CFLAGS/

2014-06-12 Thread Emil Velikov
The flags are not specific to the video targets plus
we can reuse them for targets/xa and targets/gbm.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/Automake.inc  | 2 +-
 src/gallium/targets/omx/Makefile.am   | 2 +-
 src/gallium/targets/vdpau/Makefile.am | 2 +-
 src/gallium/targets/xvmc/Makefile.am  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index 3e2071d..4600b9c 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -39,7 +39,7 @@ GALLIUM_DRI_CFLAGS = \
$(LIBDRM_CFLAGS) \
$(VISIBILITY_CFLAGS)
 
-GALLIUM_VIDEO_CFLAGS = \
+GALLIUM_TARGET_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/loader \
-I$(top_srcdir)/src/gallium/include \
diff --git a/src/gallium/targets/omx/Makefile.am 
b/src/gallium/targets/omx/Makefile.am
index 7fbac76..97496ca 100644
--- a/src/gallium/targets/omx/Makefile.am
+++ b/src/gallium/targets/omx/Makefile.am
@@ -1,7 +1,7 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-   $(GALLIUM_VIDEO_CFLAGS)
+   $(GALLIUM_TARGET_CFLAGS)
 
 omxdir = $(OMX_LIB_INSTALL_DIR)
 omx_LTLIBRARIES = libomx_mesa.la
diff --git a/src/gallium/targets/vdpau/Makefile.am 
b/src/gallium/targets/vdpau/Makefile.am
index 0e1d6ba..65f0b35 100644
--- a/src/gallium/targets/vdpau/Makefile.am
+++ b/src/gallium/targets/vdpau/Makefile.am
@@ -1,7 +1,7 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-   $(GALLIUM_VIDEO_CFLAGS)
+   $(GALLIUM_TARGET_CFLAGS)
 
 vdpaudir = $(VDPAU_LIB_INSTALL_DIR)
 vdpau_LTLIBRARIES = libvdpau_gallium.la
diff --git a/src/gallium/targets/xvmc/Makefile.am 
b/src/gallium/targets/xvmc/Makefile.am
index a8b6cc6..571f926 100644
--- a/src/gallium/targets/xvmc/Makefile.am
+++ b/src/gallium/targets/xvmc/Makefile.am
@@ -1,7 +1,7 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-   $(GALLIUM_VIDEO_CFLAGS)
+   $(GALLIUM_TARGET_CFLAGS)
 
 xvmcdir = $(XVMC_LIB_INSTALL_DIR)
 xvmc_LTLIBRARIES = libXvMCgallium.la
-- 
1.9.3

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


[Mesa-dev] [PATCH 25/26] targets/gbm: convert to static/shared pipe-driver

2014-06-12 Thread Emil Velikov
Move the gbm target code to the state-tracker, similar
to other - dri, omx, vdpau... ST.

Cc: Chia-I Wu o...@lunarg.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/state_trackers/gbm/Makefile.am |  10 +-
 src/gallium/state_trackers/gbm/gbm_drm.c   |  65 +--
 .../state_trackers/gbm/gbm_gallium_drmint.h|  11 +-
 src/gallium/targets/gbm/Makefile.am| 127 ++---
 src/gallium/targets/gbm/gbm.c  |  84 --
 src/gallium/targets/gbm/target.c   |   1 +
 6 files changed, 177 insertions(+), 121 deletions(-)
 delete mode 100644 src/gallium/targets/gbm/gbm.c
 create mode 100644 src/gallium/targets/gbm/target.c

diff --git a/src/gallium/state_trackers/gbm/Makefile.am 
b/src/gallium/state_trackers/gbm/Makefile.am
index 0e532fd..4d9f3fe 100644
--- a/src/gallium/state_trackers/gbm/Makefile.am
+++ b/src/gallium/state_trackers/gbm/Makefile.am
@@ -26,9 +26,17 @@ include $(top_srcdir)/src/gallium/Automake.inc
 AM_CFLAGS = \
$(GALLIUM_CFLAGS) \
$(VISIBILITY_CFLAGS)
+
 AM_CPPFLAGS = \
-I$(top_srcdir)/src/gbm/main \
-   -I$(top_srcdir)/include
+   $(GALLIUM_PIPE_LOADER_DEFINES) \
+   -DPIPE_SEARCH_DIR=\$(libdir)/gallium-pipe\
+
+if HAVE_GALLIUM_STATIC_TARGETS
+AM_CPPFLAGS += \
+   -DGALLIUM_STATIC_TARGETS=1
+endif
+
 if HAVE_EGL_PLATFORM_WAYLAND
 AM_CFLAGS += $(WAYLAND_CFLAGS)
 AM_CPPFLAGS += -DHAVE_WAYLAND_PLATFORM
diff --git a/src/gallium/state_trackers/gbm/gbm_drm.c 
b/src/gallium/state_trackers/gbm/gbm_drm.c
index fa84276..bfd48a0 100644
--- a/src/gallium/state_trackers/gbm/gbm_drm.c
+++ b/src/gallium/state_trackers/gbm/gbm_drm.c
@@ -28,6 +28,7 @@
 #include util/u_memory.h
 #include util/u_inlines.h
 
+#include pipe-loader/pipe_loader.h
 #include state_tracker/drm_driver.h
 
 #include unistd.h
@@ -223,17 +224,40 @@ gbm_gallium_drm_destroy(struct gbm_device *gbm)
 {
struct gbm_gallium_drm_device *gdrm = gbm_gallium_drm_device(gbm);
 
-   gallium_screen_destroy(gdrm);
-   FREE(gdrm);
+   free(gdrm-base.driver_name);
+   gdrm-screen-destroy(gdrm-screen);
+#if !GALLIUM_STATIC_TARGETS
+   pipe_loader_release(gdrm-dev, 1);
+#endif
+   free(gdrm);
 }
 
-struct gbm_device *
+#if !GALLIUM_STATIC_TARGETS
+#ifdef HAVE_PIPE_LOADER_DRM
+static const char *
+get_library_search_path(void)
+{
+   const char *search_path = NULL;
+
+   /* don't allow setuid apps to use GBM_BACKENDS_PATH */
+   if (geteuid() == getuid())
+  search_path = getenv(GBM_BACKENDS_PATH);
+   if (search_path == NULL)
+  search_path = PIPE_SEARCH_DIR;
+
+   return search_path;
+}
+#endif
+#endif
+
+static struct gbm_device *
 gbm_gallium_drm_device_create(int fd)
 {
struct gbm_gallium_drm_device *gdrm;
-   int ret;
 
gdrm = calloc(1, sizeof *gdrm);
+   if (!gdrm)
+  return NULL;
 
gdrm-base.base.fd = fd;
gdrm-base.base.bo_create = gbm_gallium_drm_bo_create;
@@ -245,11 +269,34 @@ gbm_gallium_drm_device_create(int fd)
gdrm-base.type = GBM_DRM_DRIVER_TYPE_GALLIUM;
gdrm-base.base.name = drm;
 
-   ret = gallium_screen_create(gdrm);
-   if (ret) {
-  free(gdrm);
-  return NULL;
-   }
+#if GALLIUM_STATIC_TARGETS
+   gdrm-screen = dd_create_screen(gdrm-base.base.fd);
+#else
+#ifdef HAVE_PIPE_LOADER_DRM
+   if (pipe_loader_drm_probe_fd(gdrm-dev, gdrm-base.base.fd, true))
+  gdrm-screen = pipe_loader_create_screen(gdrm-dev,
+   get_library_search_path());
+#endif /* HAVE_PIPE_LOADER_DRM */
+#endif
+
+   if (gdrm-screen == NULL)
+  goto out_no_screen;
 
+   gdrm-base.driver_name = strdup(gdrm-dev-driver_name);
return gdrm-base.base;
+
+out_no_screen:
+   debug_printf(failed to load driver: %s\n, gdrm-dev-driver_name);
+#if !GALLIUM_STATIC_TARGETS
+   if (gdrm-dev)
+  pipe_loader_release(gdrm-dev, 1);
+#endif
+   free(gdrm);
+   return NULL;
 }
+
+
+GBM_EXPORT struct gbm_backend gbm_backend = {
+   .backend_name = gallium_drm,
+   .create_device = gbm_gallium_drm_device_create,
+};
diff --git a/src/gallium/state_trackers/gbm/gbm_gallium_drmint.h 
b/src/gallium/state_trackers/gbm/gbm_gallium_drmint.h
index 4534dd8..8b05ef9 100644
--- a/src/gallium/state_trackers/gbm/gbm_gallium_drmint.h
+++ b/src/gallium/state_trackers/gbm/gbm_gallium_drmint.h
@@ -38,7 +38,7 @@ struct gbm_gallium_drm_device {
struct gbm_drm_device base;
 
struct pipe_screen *screen;
-   void *driver;
+   struct pipe_loader_device *dev;
 
struct pipe_resource *(*lookup_egl_image)(void *data,
  void *egl_image);
@@ -64,13 +64,4 @@ gbm_gallium_drm_bo(struct gbm_bo *bo)
return (struct gbm_gallium_drm_bo *) bo;
 }
 
-struct gbm_device *
-gbm_gallium_drm_device_create(int fd);
-
-int
-gallium_screen_create(struct gbm_gallium_drm_device *gdrm);
-
-void
-gallium_screen_destroy(struct gbm_gallium_drm_device *gdrm);
-
 #endif
diff --git a/src/gallium/targets/gbm/Makefile.am 

[Mesa-dev] [PATCH 21/26] targets/radeonsi/omx: convert to static/shared pipe-drivers

2014-06-12 Thread Emil Velikov
The radeonsi counterpart of previous commit - now libomx-radeonsi is
built into the libomx-mesa library. Providing a single library per API.

Cc: Leo Liu leo@amd.com
Cc: Christian König christian.koe...@amd.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac  |  3 +-
 src/gallium/Automake.inc  | 21 
 src/gallium/targets/omx/Makefile.am   |  7 
 src/gallium/targets/radeonsi/omx/Makefile.am  | 46 ---
 src/gallium/targets/radeonsi/omx/drm_target.c |  1 -
 5 files changed, 8 insertions(+), 70 deletions(-)
 delete mode 100644 src/gallium/targets/radeonsi/omx/Makefile.am
 delete mode 12 src/gallium/targets/radeonsi/omx/drm_target.c

diff --git a/configure.ac b/configure.ac
index 8daeb5f..466752f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1966,7 +1966,7 @@ if test -n $with_gallium_drivers; then
 GALLIUM_DRIVERS_DIRS=$GALLIUM_DRIVERS_DIRS radeonsi
 radeon_llvm_check radeonsi
 require_egl_drm radeonsi
-gallium_check_st radeon/drm radeonsi/dri   
vdpau/radeonsi radeonsi/omx
+gallium_check_st radeon/drm radeonsi/dri   
vdpau/radeonsi omx/radeonsi
 DRICOMMON_NEED_LIBDRM=yes
 ;;
 xnouveau)
@@ -2228,7 +2228,6 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/r300/dri/Makefile
src/gallium/targets/r600/dri/Makefile
src/gallium/targets/radeonsi/dri/Makefile
-   src/gallium/targets/radeonsi/omx/Makefile
src/gallium/targets/vdpau/Makefile
src/gallium/targets/xa/Makefile
src/gallium/targets/xa/xatracker.pc
diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index 0d5830c..3e2071d 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -59,20 +59,10 @@ GALLIUM_DRI_LINKER_FLAGS = \
-avoid-version \
$(GC_SECTIONS)
 
-GALLIUM_OMX_LINKER_FLAGS = \
-   -shared \
-   -module \
-   -no-undefined \
-   -avoid-version \
-   $(GC_SECTIONS) \
-   $(LD_NO_UNDEFINED)
-
 if HAVE_LD_VERSION_SCRIPT
 GALLIUM_DRI_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri.sym
 
-GALLIUM_OMX_LINKER_FLAGS += \
-   -Wl,--version-script=$(top_srcdir)/src/gallium/targets/omx/omx.sym
 endif
 
 
@@ -90,12 +80,6 @@ GALLIUM_DRI_LIB_DEPS = \
$(EXPAT_LIBS) \
$(GALLIUM_COMMON_LIB_DEPS)
 
-GALLIUM_OMX_LIB_DEPS = \
-   $(top_builddir)/src/gallium/auxiliary/libgallium.la \
-   $(top_builddir)/src/gallium/state_trackers/omx/libomxtracker.la \
-   $(OMX_LIBS) \
-   $(GALLIUM_COMMON_LIB_DEPS)
-
 GALLIUM_WINSYS_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/gallium/include \
@@ -104,13 +88,8 @@ GALLIUM_WINSYS_CFLAGS = \
$(VISIBILITY_CFLAGS)
 
 if HAVE_MESA_LLVM
-
 GALLIUM_DRI_LINKER_FLAGS += $(LLVM_LDFLAGS)
-GALLIUM_OMX_LINKER_FLAGS += $(LLVM_LDFLAGS)
-
 GALLIUM_DRI_LIB_DEPS += $(LLVM_LIBS)
-GALLIUM_OMX_LIB_DEPS += $(LLVM_LIBS)
-
 endif
 
 
diff --git a/src/gallium/targets/omx/Makefile.am 
b/src/gallium/targets/omx/Makefile.am
index 98c8fec..7fbac76 100644
--- a/src/gallium/targets/omx/Makefile.am
+++ b/src/gallium/targets/omx/Makefile.am
@@ -60,6 +60,13 @@ STATIC_TARGET_LIB_DEPS += \
$(RADEON_LIBS)
 endif
 
+if HAVE_GALLIUM_RADEONSI
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_RADEONSI
+STATIC_TARGET_LIB_DEPS += \
+   $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
+   $(RADEON_LIBS)
+endif
+
 libomx_mesa_la_SOURCES += target.c
 libomx_mesa_la_CPPFLAGS = $(STATIC_TARGET_CPPFLAGS)
 libomx_mesa_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
diff --git a/src/gallium/targets/radeonsi/omx/Makefile.am 
b/src/gallium/targets/radeonsi/omx/Makefile.am
deleted file mode 100644
index 3c8cf11..000
--- a/src/gallium/targets/radeonsi/omx/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright © 2012 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 

[Mesa-dev] [PATCH 08/26] target-helpers: add dd_configuration(), dd_driver_name()

2014-06-12 Thread Emil Velikov
Add a couple of helpers to be used by the dri targets when
built with static pipe-drivers. Both functions provide
functionality required by the dri state-tracker.

With this patch ilo, nouveau and r300 gain support for
throttle dri configuration.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 .../auxiliary/target-helpers/inline_drm_helper.h   | 78 ++
 src/gallium/include/state_tracker/drm_driver.h |  4 ++
 2 files changed, 82 insertions(+)

diff --git a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h 
b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
index 33edb42..6da071a 100644
--- a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
+++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
@@ -215,4 +215,82 @@ dd_create_screen(int fd)
   return NULL;
 }
 
+inline const char *
+dd_driver_name(void)
+{
+   return driver_name;
+}
+
+static const struct drm_conf_ret throttle_ret = {
+   .type = DRM_CONF_INT,
+   .val.val_int = 2,
+};
+
+static const struct drm_conf_ret share_fd_ret = {
+   .type = DRM_CONF_BOOL,
+   .val.val_int = true,
+};
+
+static const struct drm_conf_ret *
+configuration_query(enum drm_conf conf)
+{
+   switch (conf) {
+   case DRM_CONF_THROTTLE:
+  return throttle_ret;
+   case DRM_CONF_SHARE_FD:
+  return share_fd_ret;
+   default:
+  break;
+   }
+   return NULL;
+}
+
+inline const struct drm_conf_ret *
+dd_configuration(enum drm_conf conf)
+{
+   if (!driver_name)
+  return NULL;
+
+#if defined(GALLIUM_I915)
+   if (strcmp(driver_name, i915) == 0)
+  return NULL;
+   else
+#endif
+#if defined(GALLIUM_ILO)
+   if (strcmp(driver_name, i965) == 0)
+  return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_NOUVEAU)
+   if (strcmp(driver_name, nouveau) == 0)
+  return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_R300)
+   if (strcmp(driver_name, r300) == 0)
+  return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_R600)
+   if (strcmp(driver_name, r600) == 0)
+  return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_RADEONSI)
+   if (strcmp(driver_name, radeonsi) == 0)
+  return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_VMWGFX)
+   if (strcmp(driver_name, vmwgfx) == 0)
+  return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_FREEDRENO)
+   if ((strcmp(driver_name, kgsl) == 0) || (strcmp(driver_name, msm) == 0))
+  return NULL;
+   else
+#endif
+  return NULL;
+}
 #endif /* INLINE_DRM_HELPER_H */
diff --git a/src/gallium/include/state_tracker/drm_driver.h 
b/src/gallium/include/state_tracker/drm_driver.h
index ea07685..740c4bb 100644
--- a/src/gallium/include/state_tracker/drm_driver.h
+++ b/src/gallium/include/state_tracker/drm_driver.h
@@ -119,4 +119,8 @@ struct drm_driver_descriptor driver_descriptor = {  
   \
 
 extern struct pipe_screen *dd_create_screen(int fd);
 
+extern const char *dd_driver_name(void);
+
+extern const struct drm_conf_ret *dd_configuration(enum drm_conf conf);
+
 #endif
-- 
1.9.3

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


[Mesa-dev] [PATCH 26/26] targets/egl-static: use inline_drm_helper and Automake.inc helpers

2014-06-12 Thread Emil Velikov
Update all three build systems, and add freedreno to the android
build. Pending future work on the ST we can convert egl-static
to provide either static or dynamic access to the pipe-drivers.

There is no functional change with this patch.

Cc: Chia-I Wu o...@lunarg.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac   |   1 +
 src/gallium/state_trackers/egl/Makefile.am |   9 +-
 src/gallium/targets/egl-static/Android.mk  |  17 ++-
 src/gallium/targets/egl-static/Makefile.am |  70 ++
 src/gallium/targets/egl-static/SConscript  |   3 +-
 src/gallium/targets/egl-static/egl.c   |  21 +--
 src/gallium/targets/egl-static/egl_pipe.c  | 210 -
 src/gallium/targets/egl-static/egl_pipe.h  |   3 -
 8 files changed, 65 insertions(+), 269 deletions(-)

diff --git a/configure.ac b/configure.ac
index 466752f..f0256ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1317,6 +1317,7 @@ if test x$enable_gallium_egl = xyes; then
 
 GALLIUM_STATE_TRACKERS_DIRS=egl $GALLIUM_STATE_TRACKERS_DIRS
 GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS egl-static
+#enable_gallium_loader=yes
 fi
 AM_CONDITIONAL(HAVE_GALLIUM_EGL, test x$enable_gallium_egl = xyes)
 
diff --git a/src/gallium/state_trackers/egl/Makefile.am 
b/src/gallium/state_trackers/egl/Makefile.am
index 828bf13..0ea218d 100644
--- a/src/gallium/state_trackers/egl/Makefile.am
+++ b/src/gallium/state_trackers/egl/Makefile.am
@@ -25,12 +25,13 @@ AUTOMAKE_OPTIONS = subdir-objects
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CFLAGS = $(GALLIUM_CFLAGS)
+AM_CFLAGS = \
+   $(GALLIUM_CFLAGS) \
+   $(VISIBILITY_CFLAGS)
+
 AM_CPPFLAGS = \
-   $(VISIBILITY_CFLAGS) \
-I$(top_srcdir)/src/egl/main \
-   -I$(top_builddir)/src/egl/wayland/wayland-drm/ \
-   -I$(top_srcdir)/include
+   -I$(top_builddir)/src/egl/wayland/wayland-drm/
 
 noinst_LTLIBRARIES = libegl.la
 libegl_la_SOURCES = $(common_FILES)
diff --git a/src/gallium/targets/egl-static/Android.mk 
b/src/gallium/targets/egl-static/Android.mk
index 37244b5..3059674 100644
--- a/src/gallium/targets/egl-static/Android.mk
+++ b/src/gallium/targets/egl-static/Android.mk
@@ -53,25 +53,28 @@ LOCAL_C_INCLUDES += \
 endif
 
 ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_I915=1
+LOCAL_CFLAGS += -DGALLIUM_I915
 endif
 ifneq ($(filter ilo, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_ILO=1
+LOCAL_CFLAGS += -DGALLIUM_ILO
 endif
 ifneq ($(filter nouveau, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_NOUVEAU=1
+LOCAL_CFLAGS += -DGALLIUM_NOUVEAU
 endif
 ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_R300=1
+LOCAL_CFLAGS += -DGALLIUM_R300
 endif
 ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_R600=1
+LOCAL_CFLAGS += -DGALLIUM_R600
 endif
 ifneq ($(filter radeonsi, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_RADEONSI=1
+LOCAL_CFLAGS += -DGALLIUM_RADEONSI
 endif
 ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_VMWGFX=1
+LOCAL_CFLAGS += -DGALLIUM_VMWGFX
+endif
+ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),)
+LOCAL_CFLAGS += -DGALLIUM_FREEDRENO
 endif
 
 LOCAL_MODULE := libmesa_egl_gallium
diff --git a/src/gallium/targets/egl-static/Makefile.am 
b/src/gallium/targets/egl-static/Makefile.am
index f4990ad..b3194e9 100644
--- a/src/gallium/targets/egl-static/Makefile.am
+++ b/src/gallium/targets/egl-static/Makefile.am
@@ -30,18 +30,14 @@
 #
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CFLAGS = $(PTHREAD_CFLAGS)
+AM_CFLAGS = \
+   $(GALLIUM_TARGET_CFLAGS)
+
 AM_CPPFLAGS = \
-   $(GALLIUM_CFLAGS) \
-   $(VISIBILITY_CFLAGS) \
-   -I$(top_srcdir)/include \
-   -I$(top_srcdir)/src/loader \
-   -I$(top_srcdir)/src/gallium/drivers \
-   -I$(top_srcdir)/src/gallium/winsys \
-   -I$(top_srcdir)/src/gallium/include \
-   -I$(top_srcdir)/src/gallium/auxiliary \
-I$(top_srcdir)/src/gallium/state_trackers/egl \
-I$(top_srcdir)/src/egl/main \
+   -DGALLIUM_TRACE \
+   -DGALLIUM_RBUG \
-D_EGL_MAIN=_eglMain
 
 AM_LDFLAGS = \
@@ -75,10 +71,6 @@ egl_gallium_la_LIBADD = \
$(top_builddir)/src/egl/main/libEGL.la \
$(GALLIUM_COMMON_LIB_DEPS)
 
-if HAVE_MESA_LLVM
-AM_LDFLAGS += $(LLVM_LDFLAGS)
-endif
-
 if HAVE_EGL_PLATFORM_X11
 AM_CPPFLAGS += $(LIBDRM_CFLAGS)
 egl_gallium_la_LIBADD += \
@@ -131,6 +123,7 @@ egl_LTLIBRARIES += st_GL.la
 nodist_EXTRA_st_GL_la_SOURCES = dummy.cpp
 st_GL_la_SOURCES = st_GL.c
 
+st_GL_la_LDFLAGS = $(AM_LDFLAGS)
 # st_GL, built only when shared glapi is not enabled
 st_GL_la_LIBADD = \
$(top_builddir)/src/mesa/libmesagallium.la \
@@ -159,8 +152,18 @@ egl_gallium_la_LIBADD += \
$(top_builddir)/src/mapi/vgapi/libOpenVG.la
 endif
 
+#if HAVE_GALLIUM_STATIC_TARGETS
+
+egl_gallium_la_LDFLAGS = $(AM_LDFLAGS)
+egl_gallium_la_CPPFLAGS = $(AM_CPPFLAGS)
+
+if 

[Mesa-dev] [PATCH 20/26] targets/r600/omx: convert to static/shared pipe-drivers

2014-06-12 Thread Emil Velikov
The r600 counterpart of previous commit - now the libomx-r600 is
built into the libomx-mesa library. Providing a single library per API.

Cc: Leo Liu leo@amd.com
Cc: Christian König christian.koe...@amd.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac  |  3 +-
 src/gallium/targets/Makefile.am   |  4 ---
 src/gallium/targets/omx/Makefile.am   | 17 
 src/gallium/targets/r600/omx/Makefile.am  | 46 ---
 src/gallium/targets/r600/omx/drm_target.c |  1 -
 5 files changed, 18 insertions(+), 53 deletions(-)
 delete mode 100644 src/gallium/targets/r600/omx/Makefile.am
 delete mode 12 src/gallium/targets/r600/omx/drm_target.c

diff --git a/configure.ac b/configure.ac
index a44532b..8daeb5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1956,7 +1956,7 @@ if test -n $with_gallium_drivers; then
 if test x$enable_opencl = xyes; then
 LLVM_COMPONENTS=${LLVM_COMPONENTS} bitreader asmparser
 fi
-gallium_check_st radeon/drm r600/dri  xvmc/r600 
vdpau/r600 r600/omx
+gallium_check_st radeon/drm r600/dri  xvmc/r600 
vdpau/r600 omx/r600
 DRICOMMON_NEED_LIBDRM=yes
 ;;
 xradeonsi)
@@ -2227,7 +2227,6 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/pipe-loader/Makefile
src/gallium/targets/r300/dri/Makefile
src/gallium/targets/r600/dri/Makefile
-   src/gallium/targets/r600/omx/Makefile
src/gallium/targets/radeonsi/dri/Makefile
src/gallium/targets/radeonsi/omx/Makefile
src/gallium/targets/vdpau/Makefile
diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am
index 1af0c44..9612eb2 100644
--- a/src/gallium/targets/Makefile.am
+++ b/src/gallium/targets/Makefile.am
@@ -88,10 +88,6 @@ if HAVE_GALLIUM_R600
 if HAVE_DRI2
 SUBDIRS += r600/dri
 endif
-
-if HAVE_ST_OMX
-SUBDIRS += r600/omx
-endif
 endif
 
 if HAVE_GALLIUM_RADEONSI
diff --git a/src/gallium/targets/omx/Makefile.am 
b/src/gallium/targets/omx/Makefile.am
index cd79a44..98c8fec 100644
--- a/src/gallium/targets/omx/Makefile.am
+++ b/src/gallium/targets/omx/Makefile.am
@@ -43,6 +43,23 @@ STATIC_TARGET_LIB_DEPS += \
$(NOUVEAU_LIBS)
 endif
 
+if NEED_RADEON_DRM_WINSYS
+STATIC_TARGET_LIB_DEPS += \
+   $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
+endif
+
+if HAVE_GALLIUM_RADEON_COMMON
+STATIC_TARGET_LIB_DEPS += \
+   $(top_builddir)/src/gallium/drivers/radeon/libradeon.la
+endif
+
+if HAVE_GALLIUM_R600
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_R600
+STATIC_TARGET_LIB_DEPS += \
+   $(top_builddir)/src/gallium/drivers/r600/libr600.la \
+   $(RADEON_LIBS)
+endif
+
 libomx_mesa_la_SOURCES += target.c
 libomx_mesa_la_CPPFLAGS = $(STATIC_TARGET_CPPFLAGS)
 libomx_mesa_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
diff --git a/src/gallium/targets/r600/omx/Makefile.am 
b/src/gallium/targets/r600/omx/Makefile.am
deleted file mode 100644
index 8d011cc..000
--- a/src/gallium/targets/r600/omx/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright © 2012 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 $(top_srcdir)/src/gallium/Automake.inc
-
-AM_CPPFLAGS = \
-   -DSPLIT_TARGETS=1
-AM_CFLAGS = \
-   $(GALLIUM_VIDEO_CFLAGS)
-
-omxdir = $(OMX_LIB_INSTALL_DIR)
-omx_LTLIBRARIES = libomx_r600.la
-
-nodist_EXTRA_libomx_r600_la_SOURCES = dummy.cpp
-libomx_r600_la_SOURCES = \
-   drm_target.c \
-   $(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c
-
-libomx_r600_la_LDFLAGS = $(GALLIUM_OMX_LINKER_FLAGS)
-
-libomx_r600_la_LIBADD = \
-   $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
-   $(top_builddir)/src/gallium/drivers/r600/libr600.la \
-   $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
-   

[Mesa-dev] [PATCH 16/26] targets/r600/xvmc: convert to static/shared pipe-drivers

2014-06-12 Thread Emil Velikov
The r600 equivalent of previous commit.

Cc: Christian König christian.koe...@amd.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac   |  3 +-
 src/gallium/Automake.inc   | 20 -
 src/gallium/targets/Makefile.am|  4 ---
 src/gallium/targets/r600/xvmc/Makefile.am  | 46 --
 src/gallium/targets/r600/xvmc/drm_target.c |  1 -
 src/gallium/targets/xvmc/Makefile.am   | 18 
 6 files changed, 19 insertions(+), 73 deletions(-)
 delete mode 100644 src/gallium/targets/r600/xvmc/Makefile.am
 delete mode 12 src/gallium/targets/r600/xvmc/drm_target.c

diff --git a/configure.ac b/configure.ac
index 9ba7cab..b3031b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1955,7 +1955,7 @@ if test -n $with_gallium_drivers; then
 if test x$enable_opencl = xyes; then
 LLVM_COMPONENTS=${LLVM_COMPONENTS} bitreader asmparser
 fi
-gallium_check_st radeon/drm r600/dri  r600/xvmc 
vdpau/r600 r600/omx
+gallium_check_st radeon/drm r600/dri  xvmc/r600 
vdpau/r600 r600/omx
 DRICOMMON_NEED_LIBDRM=yes
 ;;
 xradeonsi)
@@ -2227,7 +2227,6 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/r300/dri/Makefile
src/gallium/targets/r600/dri/Makefile
src/gallium/targets/r600/omx/Makefile
-   src/gallium/targets/r600/xvmc/Makefile
src/gallium/targets/radeonsi/dri/Makefile
src/gallium/targets/radeonsi/omx/Makefile
src/gallium/targets/vdpau/Makefile
diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index 89b7658..8bf2a12 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -59,14 +59,6 @@ GALLIUM_DRI_LINKER_FLAGS = \
-avoid-version \
$(GC_SECTIONS)
 
-GALLIUM_XVMC_LINKER_FLAGS = \
-   -shared \
-   -module \
-   -no-undefined \
-   -version-number $(XVMC_MAJOR):$(XVMC_MINOR) \
-   $(GC_SECTIONS) \
-   $(LD_NO_UNDEFINED)
-
 GALLIUM_OMX_LINKER_FLAGS = \
-shared \
-module \
@@ -79,9 +71,6 @@ if HAVE_LD_VERSION_SCRIPT
 GALLIUM_DRI_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri.sym
 
-GALLIUM_XVMC_LINKER_FLAGS += \
-   -Wl,--version-script=$(top_srcdir)/src/gallium/targets/xvmc/xvmc.sym
-
 GALLIUM_OMX_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/omx.sym
 endif
@@ -101,13 +90,6 @@ GALLIUM_DRI_LIB_DEPS = \
$(EXPAT_LIBS) \
$(GALLIUM_COMMON_LIB_DEPS)
 
-GALLIUM_XVMC_LIB_DEPS = \
-   $(top_builddir)/src/gallium/auxiliary/libgallium.la \
-   $(top_builddir)/src/gallium/state_trackers/xvmc/libxvmctracker.la \
-   $(XVMC_LIBS) \
-   $(LIBDRM_LIBS) \
-   $(GALLIUM_COMMON_LIB_DEPS)
-
 GALLIUM_OMX_LIB_DEPS = \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/gallium/state_trackers/omx/libomxtracker.la \
@@ -124,11 +106,9 @@ GALLIUM_WINSYS_CFLAGS = \
 if HAVE_MESA_LLVM
 
 GALLIUM_DRI_LINKER_FLAGS += $(LLVM_LDFLAGS)
-GALLIUM_XVMC_LINKER_FLAGS += $(LLVM_LDFLAGS)
 GALLIUM_OMX_LINKER_FLAGS += $(LLVM_LDFLAGS)
 
 GALLIUM_DRI_LIB_DEPS += $(LLVM_LIBS)
-GALLIUM_XVMC_LIB_DEPS += $(LLVM_LIBS)
 GALLIUM_OMX_LIB_DEPS += $(LLVM_LIBS)
 
 endif
diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am
index 0fbf0d7..e96224e 100644
--- a/src/gallium/targets/Makefile.am
+++ b/src/gallium/targets/Makefile.am
@@ -85,10 +85,6 @@ if HAVE_DRI2
 SUBDIRS += r600/dri
 endif
 
-if HAVE_ST_XVMC
-SUBDIRS += r600/xvmc
-endif
-
 if HAVE_ST_OMX
 SUBDIRS += r600/omx
 endif
diff --git a/src/gallium/targets/r600/xvmc/Makefile.am 
b/src/gallium/targets/r600/xvmc/Makefile.am
deleted file mode 100644
index f2aec1a..000
--- a/src/gallium/targets/r600/xvmc/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright © 2012 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 

[Mesa-dev] [PATCH 15/26] targets/xvmc-nouveau: convert to static/shared pipe-drivers

2014-06-12 Thread Emil Velikov
Similar to vdpau targets, we're going to convert the individual
target libraries into a single one.

The library can be built with the relevant pipe-drivers
statically linked in, or loaded as shared modules.
Currently we default to static.

Cc: Ilia Mirkin imir...@alum.mit.edu
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac |  5 +-
 src/gallium/Automake.inc |  2 +-
 src/gallium/targets/Makefile.am  |  8 +--
 src/gallium/targets/xvmc-nouveau/Makefile.am | 45 --
 src/gallium/targets/xvmc-nouveau/target.c| 18 --
 src/gallium/targets/xvmc.sym | 32 --
 src/gallium/targets/xvmc/Makefile.am | 90 
 src/gallium/targets/xvmc/target.c|  1 +
 src/gallium/targets/xvmc/xvmc.sym| 32 ++
 9 files changed, 131 insertions(+), 102 deletions(-)
 delete mode 100644 src/gallium/targets/xvmc-nouveau/Makefile.am
 delete mode 100644 src/gallium/targets/xvmc-nouveau/target.c
 delete mode 100644 src/gallium/targets/xvmc.sym
 create mode 100644 src/gallium/targets/xvmc/Makefile.am
 create mode 100644 src/gallium/targets/xvmc/target.c
 create mode 100644 src/gallium/targets/xvmc/xvmc.sym

diff --git a/configure.ac b/configure.ac
index 7ff14ad..9ba7cab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1410,6 +1410,7 @@ fi
 if test x$enable_xvmc = xyes; then
 PKG_CHECK_MODULES([XVMC], [xvmc = $XVMC_REQUIRED x11-xcb xcb-dri2 = 
$XCBDRI2_REQUIRED])
 GALLIUM_STATE_TRACKERS_DIRS=$GALLIUM_STATE_TRACKERS_DIRS xvmc
+enable_gallium_loader=yes
 fi
 AM_CONDITIONAL(HAVE_ST_XVMC, test x$enable_xvmc = xyes)
 
@@ -1972,7 +1973,7 @@ if test -n $with_gallium_drivers; then
 PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau = 
$LIBDRM_NOUVEAU_REQUIRED])
 gallium_require_drm_loader
 GALLIUM_DRIVERS_DIRS=$GALLIUM_DRIVERS_DIRS nouveau
-gallium_check_st nouveau/drm dri-nouveau  xvmc-nouveau 
vdpau/nouveau omx-nouveau
+gallium_check_st nouveau/drm dri-nouveau  xvmc/nouveau 
vdpau/nouveau omx-nouveau
 DRICOMMON_NEED_LIBDRM=yes
 ;;
 xfreedreno)
@@ -2232,7 +2233,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/vdpau/Makefile
src/gallium/targets/xa/Makefile
src/gallium/targets/xa/xatracker.pc
-   src/gallium/targets/xvmc-nouveau/Makefile
+   src/gallium/targets/xvmc/Makefile
src/gallium/tests/trivial/Makefile
src/gallium/tests/unit/Makefile
src/gallium/winsys/Makefile
diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index 21a4a80..89b7658 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -80,7 +80,7 @@ GALLIUM_DRI_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri.sym
 
 GALLIUM_XVMC_LINKER_FLAGS += \
-   -Wl,--version-script=$(top_srcdir)/src/gallium/targets/xvmc.sym
+   -Wl,--version-script=$(top_srcdir)/src/gallium/targets/xvmc/xvmc.sym
 
 GALLIUM_OMX_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/omx.sym
diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am
index c31a22e..0fbf0d7 100644
--- a/src/gallium/targets/Makefile.am
+++ b/src/gallium/targets/Makefile.am
@@ -42,6 +42,10 @@ if HAVE_ST_XA
 SUBDIRS += xa
 endif
 
+if HAVE_ST_XVMC
+SUBDIRS += xvmc
+endif
+
 if HAVE_CLOVER
 SUBDIRS += opencl
 endif
@@ -105,10 +109,6 @@ if HAVE_DRI2
 SUBDIRS += dri-nouveau
 endif
 
-if HAVE_ST_XVMC
-SUBDIRS += xvmc-nouveau
-endif
-
 if HAVE_ST_OMX
 SUBDIRS += omx-nouveau
 endif
diff --git a/src/gallium/targets/xvmc-nouveau/Makefile.am 
b/src/gallium/targets/xvmc-nouveau/Makefile.am
deleted file mode 100644
index e1061cd..000
--- a/src/gallium/targets/xvmc-nouveau/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright © 2012 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, 

[Mesa-dev] [PATCH 22/26] auxiliary/vl: Remove no longer used SPLIT_TARGETS

2014-06-12 Thread Emil Velikov
Required for the conversion stage of all VL targets to
a single library per API (static/shared pipe-drivers).

No longer required as per last commit.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/auxiliary/vl/vl_winsys_dri.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c 
b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index d1bbcc2..b5c981b 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -376,16 +376,12 @@ vl_screen_create(Display *display, int screen)
if (authenticate == NULL || !authenticate-authenticated)
   goto free_authenticate;
 
-#if SPLIT_TARGETS
-   scrn-base.pscreen = driver_descriptor.create_screen(fd);
-#else
 #if GALLIUM_STATIC_TARGETS
scrn-base.pscreen = dd_create_screen(fd);
 #else
if (pipe_loader_drm_probe_fd(scrn-base.dev, fd, true))
   scrn-base.pscreen = pipe_loader_create_screen(scrn-base.dev, 
PIPE_SEARCH_DIR);
 #endif // GALLIUM_STATIC_TARGETS
-#endif // SPLIT_TARGETS
 
if (!scrn-base.pscreen)
   goto release_pipe;
@@ -402,12 +398,10 @@ vl_screen_create(Display *display, int screen)
return scrn-base;
 
 release_pipe:
-#if !SPLIT_TARGETS
 #if !GALLIUM_STATIC_TARGETS
if (scrn-base.dev)
   pipe_loader_release(scrn-base.dev, 1);
 #endif // !GALLIUM_STATIC_TARGETS
-#endif // !SPLIT_TARGETS
 free_authenticate:
free(authenticate);
 free_connect:
@@ -435,10 +429,8 @@ void vl_screen_destroy(struct vl_screen *vscreen)
 
vl_dri2_destroy_drawable(scrn);
scrn-base.pscreen-destroy(scrn-base.pscreen);
-#if !SPLIT_TARGETS
 #if !GALLIUM_STATIC_TARGETS
pipe_loader_release(scrn-base.dev, 1);
 #endif // !GALLIUM_STATIC_TARGETS
-#endif // !SPLIT_TARGETS
FREE(scrn);
 }
-- 
1.9.3

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


[Mesa-dev] [PATCH 19/26] targets/omx-nouveau: convert to static/shared pipe-drivers

2014-06-12 Thread Emil Velikov
Similar to the vdpau/xvmc targets, we're going to convert the
multiple target libraries into a single one.

The library can be built with the relevant pipe-drivers
statically linked in, or loaded as shared modules.
Currently we default to static.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 configure.ac|  5 ++-
 src/gallium/Automake.inc|  2 +-
 src/gallium/targets/Makefile.am |  8 ++--
 src/gallium/targets/omx-nouveau/Makefile.am | 45 ---
 src/gallium/targets/omx-nouveau/target.c| 18 
 src/gallium/targets/omx.sym |  6 ---
 src/gallium/targets/omx/Makefile.am | 67 +
 src/gallium/targets/omx/omx.sym |  6 +++
 src/gallium/targets/omx/target.c|  1 +
 9 files changed, 82 insertions(+), 76 deletions(-)
 delete mode 100644 src/gallium/targets/omx-nouveau/Makefile.am
 delete mode 100644 src/gallium/targets/omx-nouveau/target.c
 delete mode 100644 src/gallium/targets/omx.sym
 create mode 100644 src/gallium/targets/omx/Makefile.am
 create mode 100644 src/gallium/targets/omx/omx.sym
 create mode 100644 src/gallium/targets/omx/target.c

diff --git a/configure.ac b/configure.ac
index b3031b3..a44532b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1425,6 +1425,7 @@ AM_CONDITIONAL(HAVE_ST_VDPAU, test x$enable_vdpau = 
xyes)
 if test x$enable_omx = xyes; then
 PKG_CHECK_MODULES([OMX], [libomxil-bellagio = $LIBOMXIL_BELLAGIO_REQUIRED 
x11-xcb xcb-dri2 = $XCBDRI2_REQUIRED])
 GALLIUM_STATE_TRACKERS_DIRS=$GALLIUM_STATE_TRACKERS_DIRS omx
+enable_gallium_loader=yes
 fi
 AM_CONDITIONAL(HAVE_ST_OMX, test x$enable_omx = xyes)
 
@@ -1973,7 +1974,7 @@ if test -n $with_gallium_drivers; then
 PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau = 
$LIBDRM_NOUVEAU_REQUIRED])
 gallium_require_drm_loader
 GALLIUM_DRIVERS_DIRS=$GALLIUM_DRIVERS_DIRS nouveau
-gallium_check_st nouveau/drm dri-nouveau  xvmc/nouveau 
vdpau/nouveau omx-nouveau
+gallium_check_st nouveau/drm dri-nouveau  xvmc/nouveau 
vdpau/nouveau omx/nouveau
 DRICOMMON_NEED_LIBDRM=yes
 ;;
 xfreedreno)
@@ -2219,7 +2220,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/egl-static/Makefile
src/gallium/targets/gbm/Makefile
src/gallium/targets/libgl-xlib/Makefile
-   src/gallium/targets/omx-nouveau/Makefile
+   src/gallium/targets/omx/Makefile
src/gallium/targets/opencl/Makefile
src/gallium/targets/osmesa/Makefile
src/gallium/targets/osmesa/osmesa.pc
diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index 8bf2a12..0d5830c 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -72,7 +72,7 @@ GALLIUM_DRI_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri.sym
 
 GALLIUM_OMX_LINKER_FLAGS += \
-   -Wl,--version-script=$(top_srcdir)/src/gallium/targets/omx.sym
+   -Wl,--version-script=$(top_srcdir)/src/gallium/targets/omx/omx.sym
 endif
 
 
diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am
index e96224e..1af0c44 100644
--- a/src/gallium/targets/Makefile.am
+++ b/src/gallium/targets/Makefile.am
@@ -26,6 +26,10 @@ if HAVE_X11_DRIVER
 SUBDIRS += libgl-xlib
 endif
 
+if HAVE_ST_OMX
+SUBDIRS += omx
+endif
+
 if HAVE_GALLIUM_OSMESA
 SUBDIRS += osmesa
 endif
@@ -104,10 +108,6 @@ if HAVE_GALLIUM_NOUVEAU
 if HAVE_DRI2
 SUBDIRS += dri-nouveau
 endif
-
-if HAVE_ST_OMX
-SUBDIRS += omx-nouveau
-endif
 endif
 
 if HAVE_GALLIUM_SOFTPIPE
diff --git a/src/gallium/targets/omx-nouveau/Makefile.am 
b/src/gallium/targets/omx-nouveau/Makefile.am
deleted file mode 100644
index 3b2a1a5..000
--- a/src/gallium/targets/omx-nouveau/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright © 2012 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 

[Mesa-dev] [PATCH 10/26] targets: use GALLIUM_PIPE_LOADER_WINSYS_LIB_DEPS

2014-06-12 Thread Emil Velikov
Drop ~50 lines of buildsystem mayhem.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/targets/gbm/Makefile.am| 14 +-
 src/gallium/targets/opencl/Makefile.am | 18 --
 src/gallium/targets/xa/Makefile.am | 14 +-
 src/gallium/tests/trivial/Makefile.am  | 17 +++--
 4 files changed, 9 insertions(+), 54 deletions(-)

diff --git a/src/gallium/targets/gbm/Makefile.am 
b/src/gallium/targets/gbm/Makefile.am
index 5efc0e4..00f12c5 100644
--- a/src/gallium/targets/gbm/Makefile.am
+++ b/src/gallium/targets/gbm/Makefile.am
@@ -44,25 +44,13 @@ gbm_gallium_drm_la_SOURCES = gbm.c
 
 gbm_gallium_drm_la_LIBADD = \
$(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
+   $(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \

$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
-   $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
$(top_builddir)/src/gallium/state_trackers/gbm/libgbm.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(LIBDRM_LIBS) \
$(GALLIUM_COMMON_LIB_DEPS)
 
-if HAVE_DRISW
-gbm_gallium_drm_la_LIBADD += \
-   $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
-endif
-
-if NEED_WINSYS_XLIB
-gbm_gallium_drm_la_LIBADD += \
-   $(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
-   -lX11 -lXext -lXfixes \
-   $(LIBDRM_LIBS)
-endif
-
 gbm_gallium_drm_la_LDFLAGS = \
-module \
-no-undefined \
diff --git a/src/gallium/targets/opencl/Makefile.am 
b/src/gallium/targets/opencl/Makefile.am
index 7f2854d..80b7e67 100644
--- a/src/gallium/targets/opencl/Makefile.am
+++ b/src/gallium/targets/opencl/Makefile.am
@@ -1,5 +1,7 @@
 AUTOMAKE_OPTIONS = subdir-objects
 
+include $(top_srcdir)/src/gallium/Automake.inc
+
 lib_LTLIBRARIES = lib@OPENCL_LIBNAME@.la
 
 lib@OPENCL_LIBNAME@_la_LDFLAGS = \
@@ -15,11 +17,11 @@ lib@OPENCL_LIBNAME@_la_LDFLAGS += \
 endif
 
 lib@OPENCL_LIBNAME@_la_LIBADD = \
+   $(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
+   $(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \

$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
-   $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
$(top_builddir)/src/gallium/state_trackers/clover/libclover.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
-   $(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
-ldl \
-lclangCodeGen \
-lclangFrontendTool \
@@ -36,18 +38,6 @@ lib@OPENCL_LIBNAME@_la_LIBADD = \
-lclangBasic \
$(LLVM_LIBS)
 
-if HAVE_DRISW
-lib@OPENCL_LIBNAME@_la_LIBADD += \
-   $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
-endif
-
-if NEED_WINSYS_XLIB
-lib@OPENCL_LIBNAME@_la_LIBADD += \
-   $(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
-   -lX11 -lXext -lXfixes \
-   $(LIBDRM_LIBS)
-endif
-
 nodist_EXTRA_lib@OPENCL_LIBNAME@_la_SOURCES = dummy.cpp
 lib@OPENCL_LIBNAME@_la_SOURCES =
 
diff --git a/src/gallium/targets/xa/Makefile.am 
b/src/gallium/targets/xa/Makefile.am
index cb9fdc4..632b52f 100644
--- a/src/gallium/targets/xa/Makefile.am
+++ b/src/gallium/targets/xa/Makefile.am
@@ -41,25 +41,13 @@ libxatracker_la_SOURCES =
 
 libxatracker_la_LIBADD = \
$(GALLIUM_PIPE_LOADER_LIBS) \
+   $(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \
$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
-   $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
$(top_builddir)/src/gallium/state_trackers/xa/libxatracker.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(LIBDRM_LIBS) \
$(GALLIUM_COMMON_LIB_DEPS)
 
-if HAVE_DRISW
-libxatracker_la_LIBADD += \
-   $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
-endif
-
-if NEED_WINSYS_XLIB
-libxatracker_la_LIBADD += \
-   $(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
-   -lX11 -lXext -lXfixes \
-   $(LIBDRM_LIBS)
-endif
-
 libxatracker_la_LDFLAGS = \
-no-undefined \
-version-number $(XA_MAJOR):$(XA_MINOR):$(XA_TINY) \
diff --git a/src/gallium/tests/trivial/Makefile.am 
b/src/gallium/tests/trivial/Makefile.am
index 8a8fad1..183fe8e 100644
--- a/src/gallium/tests/trivial/Makefile.am
+++ b/src/gallium/tests/trivial/Makefile.am
@@ -11,24 +11,13 @@ AM_CPPFLAGS = \
-DPIPE_SEARCH_DIR=\$(PIPE_SRC_DIR)/.libs\ \
$(GALLIUM_PIPE_LOADER_DEFINES)
 
-LDADD = $(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
+LDADD = \
+   $(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
+   $(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \

$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
-   $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(GALLIUM_COMMON_LIB_DEPS)
 
-if HAVE_DRISW
-LDADD += \
-   $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
-endif
-
-if NEED_WINSYS_XLIB
-LDADD += \
-   

[Mesa-dev] [PATCH 24/26] targets/xa: provide alternative(static) xa target

2014-06-12 Thread Emil Velikov
Now we can build the xa target (libxatracker) with either static
pipe-drivers or shared ones. Currently we default to static.

 - Remove the unused CFLAGS/CPPFLAGS.
 - Use GALLIUM_TARGET_CFLAGS where applicable.

Cc: Jakob Bornecrantz ja...@vmware.com
Cc: Rob Clark robcl...@freedesktop.org
Cc: Thomas Hellstrom thellst...@vmware.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/state_trackers/xa/Makefile.am  |  11 +--
 src/gallium/state_trackers/xa/xa_tracker.c |   8 ++
 src/gallium/targets/xa/Makefile.am | 119 ++---
 src/gallium/targets/xa/target.c|   1 +
 4 files changed, 124 insertions(+), 15 deletions(-)
 create mode 100644 src/gallium/targets/xa/target.c

diff --git a/src/gallium/state_trackers/xa/Makefile.am 
b/src/gallium/state_trackers/xa/Makefile.am
index 72486b9..52d84a9 100644
--- a/src/gallium/state_trackers/xa/Makefile.am
+++ b/src/gallium/state_trackers/xa/Makefile.am
@@ -30,11 +30,12 @@ AM_CFLAGS = \
 
 AM_CPPFLAGS = \
$(GALLIUM_PIPE_LOADER_DEFINES) \
-   -DPIPE_SEARCH_DIR=\$(libdir)/gallium-pipe\ \
-   -I$(top_srcdir)/src/gallium/targets/xa \
-   -I$(top_srcdir)/src/gallium/ \
-   -I$(top_srcdir)/src/gallium/winsys \
-   -I$(top_srcdir)/src/gallium/drivers
+   -DPIPE_SEARCH_DIR=\$(libdir)/gallium-pipe\
+
+if HAVE_GALLIUM_STATIC_TARGETS
+AM_CPPFLAGS += \
+   -DGALLIUM_STATIC_TARGETS=1
+endif
 
 xa_includedir = $(includedir)
 xa_include_HEADERS = \
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c 
b/src/gallium/state_trackers/xa/xa_tracker.c
index 9add584..6e4312e 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -144,8 +144,12 @@ xa_tracker_create(int drm_fd)
 if (!xa)
return NULL;
 
+#if GALLIUM_STATIC_TARGETS
+xa-screen = dd_create_screen(drm_fd);
+#else
 if (pipe_loader_drm_probe_fd(xa-dev, drm_fd, false))
xa-screen = pipe_loader_create_screen(xa-dev, PIPE_SEARCH_DIR);
+#endif
 if (!xa-screen)
goto out_no_screen;
 
@@ -192,8 +196,10 @@ xa_tracker_create(int drm_fd)
  out_no_pipe:
 xa-screen-destroy(xa-screen);
  out_no_screen:
+#if !GALLIUM_STATIC_TARGETS
 if (xa-dev)
pipe_loader_release(xa-dev, 1);
+#endif
 free(xa);
 return NULL;
 }
@@ -204,7 +210,9 @@ xa_tracker_destroy(struct xa_tracker *xa)
 free(xa-supported_formats);
 xa_context_destroy(xa-default_ctx);
 xa-screen-destroy(xa-screen);
+#if !GALLIUM_STATIC_TARGETS
 pipe_loader_release(xa-dev, 1);
+#endif
 free(xa);
 }
 
diff --git a/src/gallium/targets/xa/Makefile.am 
b/src/gallium/targets/xa/Makefile.am
index 632b52f..e816a78 100644
--- a/src/gallium/targets/xa/Makefile.am
+++ b/src/gallium/targets/xa/Makefile.am
@@ -22,14 +22,8 @@
 
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CPPFLAGS = \
-   -I$(top_srcdir)/include \
-   -I$(top_srcdir)/src/gallium/state_trackers/xa \
-   -I$(top_srcdir)/src/gallium/winsys
-
 AM_CFLAGS = \
-   $(GALLIUM_CFLAGS) \
-   $(LIBDRM_CFLAGS)
+   $(GALLIUM_TARGET_CFLAGS)
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = xatracker.pc
@@ -40,9 +34,6 @@ nodist_EXTRA_libxatracker_la_SOURCES = dummy.cpp
 libxatracker_la_SOURCES =
 
 libxatracker_la_LIBADD = \
-   $(GALLIUM_PIPE_LOADER_LIBS) \
-   $(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \
-   $(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
$(top_builddir)/src/gallium/state_trackers/xa/libxatracker.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(LIBDRM_LIBS) \
@@ -59,6 +50,114 @@ libxatracker_la_LDFLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/xa/xa.sym
 endif
 
+if HAVE_GALLIUM_STATIC_TARGETS
+
+STATIC_TARGET_CPPFLAGS =
+STATIC_TARGET_LIB_DEPS = \
+   $(top_builddir)/src/loader/libloader.la
+
+if NEED_WINSYS_WRAPPER
+STATIC_TARGET_LIB_DEPS += \
+   $(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la
+endif
+
+if HAVE_GALLIUM_I915
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_I915
+STATIC_TARGET_LIB_DEPS += \
+   $(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
+   $(top_builddir)/src/gallium/drivers/i915/libi915.la \
+   $(INTEL_LIBS)
+endif
+
+if HAVE_GALLIUM_ILO
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_ILO
+STATIC_TARGET_LIB_DEPS += \
+   $(top_builddir)/src/gallium/winsys/intel/drm/libintelwinsys.la \
+   $(top_builddir)/src/gallium/drivers/ilo/libilo.la \
+   $(INTEL_LIBS)
+endif
+
+if HAVE_GALLIUM_NOUVEAU
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_NOUVEAU
+STATIC_TARGET_LIB_DEPS += \
+   $(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \
+   $(top_builddir)/src/gallium/drivers/nouveau/libnouveau.la \
+   $(NOUVEAU_LIBS)
+endif
+
+if NEED_RADEON_DRM_WINSYS
+STATIC_TARGET_LIB_DEPS += \
+   $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
+endif
+
+if HAVE_GALLIUM_RADEON_COMMON
+STATIC_TARGET_LIB_DEPS += \
+ 

Re: [Mesa-dev] [PATCH] r600g/compute: solve a bug introduced by 2e01b8b440c1402c88a2755d89f40292e1f36ce5

2014-06-12 Thread Tom Stellard
On Wed, Jun 11, 2014 at 05:28:01PM +0200, Bruno Jiménez wrote:
 That commit made possible that the items could be one just
 after the other when their size was a multiple of ITEM_ALIGNMENT.
 But compute_memory_prealloc_chunk still looked to leave a gap
 between items. Resulting in that we got an infinite loop when
 trying to add an item which would left no space between itself and
 the next item.

I just pushed this patch, thanks!

 
 Fixes piglit test: cl-custom-r600-create-release-buffer-bug
 And the test for alignment I have just sent:
 http://lists.freedesktop.org/archives/piglit/2014-June/011135.html
 
 Sorry about this.
 ---
  src/gallium/drivers/r600/compute_memory_pool.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/gallium/drivers/r600/compute_memory_pool.c 
 b/src/gallium/drivers/r600/compute_memory_pool.c
 index 2050f28..ec8c470 100644
 --- a/src/gallium/drivers/r600/compute_memory_pool.c
 +++ b/src/gallium/drivers/r600/compute_memory_pool.c
 @@ -110,7 +110,7 @@ int64_t compute_memory_prealloc_chunk(
  
   for (item = pool-item_list; item; item = item-next) {
   if (item-start_in_dw  -1) {
 - if (item-start_in_dw-last_end  size_in_dw) {
 + if (last_end + size_in_dw = item-start_in_dw) {
   return last_end;
   }
  
 -- 
 2.0.0
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2] glsl: Fix glcpp to catch garbage after #if 1 ... #else

2014-06-12 Thread Carl Worth
Previously, a line such as:

#else garbage

would flag an error if it followed #if 0, but not if it followed #if 1.

We fix this by setting a new bit of state (lexing_else) that allows the lexer
to defer switching to the SKIP start state until after the NEWLINE following
the #else directive.

A new test case is added for:

#if 1
#else garbage
#endif

which was untested before, (and did not generate the desired error).
---

Matt Turner matts...@gmail.com writes:
 The preprocessor is one of the only bits that uses tabs. I'd rather we
 stick with that, or convert the whole thing.

Thanks for the catch. There are a handful of lines indented with spaces that
have managed to sneak in, but I might as well not add more. So I've fixed
that. Also, here in v2, instead of adding a lexing_else bit next to lexing_if,
instead I'm reusing the original bit and renaming it to lexing_directive.

 src/glsl/glcpp/glcpp-lex.l | 25 +++---
 src/glsl/glcpp/glcpp-parse.y   |  6 +++---
 src/glsl/glcpp/glcpp.h |  2 +-
 src/glsl/glcpp/tests/103-garbage-after-else-0.c|  3 +++
 .../tests/103-garbage-after-else-0.c.expected  |  4 
 src/glsl/glcpp/tests/103-garbage-after-else.c  |  3 ---
 .../glcpp/tests/103-garbage-after-else.c.expected  |  4 
 src/glsl/glcpp/tests/123-garbage-after-else-1.c|  3 +++
 .../tests/123-garbage-after-else-1.c.expected  |  4 
 9 files changed, 31 insertions(+), 23 deletions(-)
 create mode 100644 src/glsl/glcpp/tests/103-garbage-after-else-0.c
 create mode 100644 src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected
 delete mode 100644 src/glsl/glcpp/tests/103-garbage-after-else.c
 delete mode 100644 src/glsl/glcpp/tests/103-garbage-after-else.c.expected
 create mode 100644 src/glsl/glcpp/tests/123-garbage-after-else-1.c
 create mode 100644 src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected

diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 188e454..d5fb087 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -137,14 +137,15 @@ HEXADECIMAL_INTEGER   0[xX][0-9a-fA-F]+[uU]?
 *  2. The skip_stack is NULL meaning that we've reached
 * the last #endif.
 *
-*  3. The lexing_if bit is set. This indicates that we
-* are lexing the expression following an #if of
-* #elif. Even inside an #if 0 we need to lex this
-* expression so the parser can correctly update the
-* skip_stack state.
+*  3. The lexing_directive bit is set. This indicates that we are
+* lexing a pre-processor directive, (such as #if, #elif, or
+* #else). For the #if and #elif directives we always need to
+* parse the conditions, (even if otherwise within an #if
+* 0). And for #else, we want to be able to generate an error
+* if any garbage follows #else.
 */
if (YY_START == INITIAL || YY_START == SKIP) {
-   if (parser-lexing_if ||
+   if (parser-lexing_directive ||
parser-skip_stack == NULL ||
parser-skip_stack-type == SKIP_NO_SKIP)
{
@@ -193,25 +194,25 @@ HEXADECIMAL_INTEGER   0[xX][0-9a-fA-F]+[uU]?
 
 SKIP,INITIAL{
 {HASH}ifdef {
-   yyextra-lexing_if = 1;
+   yyextra-lexing_directive = 1;
yyextra-space_tokens = 0;
return HASH_IFDEF;
 }
 
 {HASH}ifndef {
-   yyextra-lexing_if = 1;
+   yyextra-lexing_directive = 1;
yyextra-space_tokens = 0;
return HASH_IFNDEF;
 }
 
 {HASH}if/[^_a-zA-Z0-9] {
-   yyextra-lexing_if = 1;
+   yyextra-lexing_directive = 1;
yyextra-space_tokens = 0;
return HASH_IF;
 }
 
 {HASH}elif/[^_a-zA-Z0-9] {
-   yyextra-lexing_if = 1;
+   yyextra-lexing_directive = 1;
yyextra-space_tokens = 0;
return HASH_ELIF;
 }
@@ -348,7 +349,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
if (parser-commented_newlines) {
BEGIN NEWLINE_CATCHUP;
}
-   yyextra-lexing_if = 0;
+   yyextra-lexing_directive = 0;
yylineno++;
yycolumn = 0;
return NEWLINE;
@@ -357,7 +358,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
/* Handle missing newline at EOF. */
 INITIALEOF {
BEGIN DONE; /* Don't keep matching this rule forever. */
-   yyextra-lexing_if = 0;
+   yyextra-lexing_directive = 0;
return NEWLINE;
 }
 
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 650d0d4..6906e62 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -364,7 +364,7 @@ control_line:
glcpp_warning( @1, parser, ignoring illegal #elif 
without expression);
}
}
-|  HASH_ELSE {
+|  

Re: [Mesa-dev] [PATCH v2] glsl: Fix glcpp to catch garbage after #if 1 ... #else

2014-06-12 Thread Matt Turner
On Thu, Jun 12, 2014 at 12:58 PM, Carl Worth cwo...@cworth.org wrote:
 Previously, a line such as:

 #else garbage

 would flag an error if it followed #if 0, but not if it followed #if 1.

 We fix this by setting a new bit of state (lexing_else) that allows the lexer
 to defer switching to the SKIP start state until after the NEWLINE following
 the #else directive.

 A new test case is added for:

 #if 1
 #else garbage
 #endif

 which was untested before, (and did not generate the desired error).
 ---

 Matt Turner matts...@gmail.com writes:
 The preprocessor is one of the only bits that uses tabs. I'd rather we
 stick with that, or convert the whole thing.

 Thanks for the catch. There are a handful of lines indented with spaces that
 have managed to sneak in, but I might as well not add more. So I've fixed
 that. Also, here in v2, instead of adding a lexing_else bit next to lexing_if,
 instead I'm reusing the original bit and renaming it to lexing_directive.

  src/glsl/glcpp/glcpp-lex.l | 25 
 +++---
  src/glsl/glcpp/glcpp-parse.y   |  6 +++---
  src/glsl/glcpp/glcpp.h |  2 +-
  src/glsl/glcpp/tests/103-garbage-after-else-0.c|  3 +++
  .../tests/103-garbage-after-else-0.c.expected  |  4 
  src/glsl/glcpp/tests/103-garbage-after-else.c  |  3 ---
  .../glcpp/tests/103-garbage-after-else.c.expected  |  4 
  src/glsl/glcpp/tests/123-garbage-after-else-1.c|  3 +++
  .../tests/123-garbage-after-else-1.c.expected  |  4 
  9 files changed, 31 insertions(+), 23 deletions(-)
  create mode 100644 src/glsl/glcpp/tests/103-garbage-after-else-0.c
  create mode 100644 src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected
  delete mode 100644 src/glsl/glcpp/tests/103-garbage-after-else.c
  delete mode 100644 src/glsl/glcpp/tests/103-garbage-after-else.c.expected
  create mode 100644 src/glsl/glcpp/tests/123-garbage-after-else-1.c
  create mode 100644 src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected

 diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
 index 188e454..d5fb087 100644
 --- a/src/glsl/glcpp/glcpp-lex.l
 +++ b/src/glsl/glcpp/glcpp-lex.l
 @@ -137,14 +137,15 @@ HEXADECIMAL_INTEGER   0[xX][0-9a-fA-F]+[uU]?
  *  2. The skip_stack is NULL meaning that we've reached
  * the last #endif.
  *
 -*  3. The lexing_if bit is set. This indicates that we
 -* are lexing the expression following an #if of
 -* #elif. Even inside an #if 0 we need to lex this
 -* expression so the parser can correctly update the
 -* skip_stack state.
 +*  3. The lexing_directive bit is set. This indicates that we are

This regressed from 4 to 3. :)

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


[Mesa-dev] [PATCH] glsl: Fix glcpp to properly lex entire preprocessing numbers

2014-06-12 Thread Carl Worth
The preprocessor defines a notions of a preprocessing number that
starts with either a digit or a decimal point, and continues with zero
or more of digits, decimal points, identifier characters, or the sign
symbols, ('-' and '+').

Prior to this change, preprocessing numbers were lexed as some
combination of OTHER and IDENTIFIER tokens. This had the problem of
causing undesired macro expansion in some cases.

We add tests to ensure that the undesired macro expansion does not
happen in cases such as:

#define e +1
#define xyz -2

int n = 1e;
int p = 1xyz;

In either case these macro definitions have no effect after this
change, so that the numeric literals, (whether valid or not), will be
passed on as-is from the preprocessor to the compiler proper.

This fixes at least the following Khronos GLES3 CTS test:

preprocessor.basic.correct_phases_fragment
---
 src/glsl/glcpp/glcpp-lex.l| 6 ++
 src/glsl/glcpp/tests/124-preprocessing-numbers.c  | 8 
 src/glsl/glcpp/tests/124-preprocessing-numbers.c.expected | 9 +
 3 files changed, 23 insertions(+)
 create mode 100644 src/glsl/glcpp/tests/124-preprocessing-numbers.c
 create mode 100644 src/glsl/glcpp/tests/124-preprocessing-numbers.c.expected

diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index d5fb087..4dbaa9e 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -91,6 +91,7 @@ DIGITS[0-9][0-9]*
 DECIMAL_INTEGER[1-9][0-9]*[uU]?
 OCTAL_INTEGER  0[0-7]*[uU]?
 HEXADECIMAL_INTEGER0[xX][0-9a-fA-F]+[uU]?
+PP_NUMBER  [0-9.][-+._a-zA-Z0-9]*
 
 %%
 
@@ -339,6 +340,11 @@ HEXADECIMAL_INTEGER0[xX][0-9a-fA-F]+[uU]?
return OTHER;
 }
 
+{PP_NUMBER} {
+   yylval-str = ralloc_strdup (yyextra, yytext);
+   return OTHER;
+}
+
 {HSPACE} {
if (yyextra-space_tokens) {
return SPACE;
diff --git a/src/glsl/glcpp/tests/124-preprocessing-numbers.c 
b/src/glsl/glcpp/tests/124-preprocessing-numbers.c
new file mode 100644
index 000..3743c69
--- /dev/null
+++ b/src/glsl/glcpp/tests/124-preprocessing-numbers.c
@@ -0,0 +1,8 @@
+#define e +1
+#define xyz -2
+
+/* The following are preprocessing numbers and should not trigger macro
+ * expansion. */
+int n = 1e;
+int p = 1xyz;
+
diff --git a/src/glsl/glcpp/tests/124-preprocessing-numbers.c.expected 
b/src/glsl/glcpp/tests/124-preprocessing-numbers.c.expected
new file mode 100644
index 000..951581e
--- /dev/null
+++ b/src/glsl/glcpp/tests/124-preprocessing-numbers.c.expected
@@ -0,0 +1,9 @@
+
+
+
+ 
+
+int n = 1e;
+int p = 1xyz;
+
+
-- 
2.0.0

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


Re: [Mesa-dev] [PATCH 0/3] clover: Allow quering for the number of max compute units

2014-06-12 Thread Tom Stellard
On Fri, May 30, 2014 at 05:31:09PM +0200, Bruno Jiménez wrote:
 This series allows clover to answer the query for the number of
 max compute units of the devices.
 
 The data has been extracted from:
 AMD Accelerated Parallel Processing OpenCL Programming Guide (rev 2.7)
 Appendix D: Device Parameters
 
 For the rest of the devices I haven't found data.
 

Hi,

I've pushed patches 1 and 3.  Did you ever send and updated version of
patch 2?

-Tom

 Patch 2 is very big, and has a lot of comments about the data found in
 said reference. For some of the chips, more than one number was listed
 depending on the exact card, and I have chosen to return the lower one.
 
 Thanks!
 Bruno
 
 Bruno Jiménez (3):
   gallium: Add PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS
   radeon/compute: Implement PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS
   clover: query driver for the max number of compute units
 
  src/gallium/docs/source/screen.rst|  2 +
  src/gallium/drivers/radeon/r600_pipe_common.c | 90 
 +++
  src/gallium/include/pipe/p_defines.h  |  3 +-
  src/gallium/state_trackers/clover/api/device.cpp  |  2 +-
  src/gallium/state_trackers/clover/core/device.cpp |  6 ++
  src/gallium/state_trackers/clover/core/device.hpp |  1 +
  6 files changed, 102 insertions(+), 2 deletions(-)
 
 -- 
 1.9.3
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: Fix glcpp to properly lex entire preprocessing numbers

2014-06-12 Thread Anuj Phogat
On Thu, Jun 12, 2014 at 3:13 PM, Carl Worth cwo...@cworth.org wrote:

 The preprocessor defines a notions of a preprocessing number that
 starts with either a digit or a decimal point, and continues with zero
 or more of digits, decimal points, identifier characters, or the sign
 symbols, ('-' and '+').

 Prior to this change, preprocessing numbers were lexed as some
 combination of OTHER and IDENTIFIER tokens. This had the problem of
 causing undesired macro expansion in some cases.

 We add tests to ensure that the undesired macro expansion does not
 happen in cases such as:

 #define e +1
 #define xyz -2

 int n = 1e;
 int p = 1xyz;

 In either case these macro definitions have no effect after this
 change, so that the numeric literals, (whether valid or not), will be
 passed on as-is from the preprocessor to the compiler proper.

 This fixes at least the following Khronos GLES3 CTS test:

 preprocessor.basic.correct_phases_fragment
 ---
  src/glsl/glcpp/glcpp-lex.l| 6 ++
  src/glsl/glcpp/tests/124-preprocessing-numbers.c  | 8 
  src/glsl/glcpp/tests/124-preprocessing-numbers.c.expected | 9 +
  3 files changed, 23 insertions(+)
  create mode 100644 src/glsl/glcpp/tests/124-preprocessing-numbers.c
  create mode 100644 src/glsl/glcpp/tests/124-preprocessing-numbers.c.expected

 diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
 index d5fb087..4dbaa9e 100644
 --- a/src/glsl/glcpp/glcpp-lex.l
 +++ b/src/glsl/glcpp/glcpp-lex.l
 @@ -91,6 +91,7 @@ DIGITS[0-9][0-9]*
  DECIMAL_INTEGER[1-9][0-9]*[uU]?
  OCTAL_INTEGER  0[0-7]*[uU]?
  HEXADECIMAL_INTEGER0[xX][0-9a-fA-F]+[uU]?
 +PP_NUMBER  [0-9.][-+._a-zA-Z0-9]*

  %%

 @@ -339,6 +340,11 @@ HEXADECIMAL_INTEGER0[xX][0-9a-fA-F]+[uU]?
 return OTHER;
  }

 +{PP_NUMBER} {
 +   yylval-str = ralloc_strdup (yyextra, yytext);
 +   return OTHER;
 +}
 +
  {HSPACE} {
 if (yyextra-space_tokens) {
 return SPACE;
 diff --git a/src/glsl/glcpp/tests/124-preprocessing-numbers.c 
 b/src/glsl/glcpp/tests/124-preprocessing-numbers.c
 new file mode 100644
 index 000..3743c69
 --- /dev/null
 +++ b/src/glsl/glcpp/tests/124-preprocessing-numbers.c
 @@ -0,0 +1,8 @@
 +#define e +1
 +#define xyz -2
 +
 +/* The following are preprocessing numbers and should not trigger macro
 + * expansion. */
 +int n = 1e;
 +int p = 1xyz;
 +
 diff --git a/src/glsl/glcpp/tests/124-preprocessing-numbers.c.expected 
 b/src/glsl/glcpp/tests/124-preprocessing-numbers.c.expected
 new file mode 100644
 index 000..951581e
 --- /dev/null
 +++ b/src/glsl/glcpp/tests/124-preprocessing-numbers.c.expected
 @@ -0,0 +1,9 @@
 +
 +
 +
 +
 +
 +int n = 1e;
 +int p = 1xyz;
 +
 +
 --
 2.0.0

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

Reviewed-by: Anuj Phogat anuj.pho...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] glsl: Fix glcpp to catch garbage after #if 1 ... #else

2014-06-12 Thread Anuj Phogat
On Thu, Jun 12, 2014 at 12:58 PM, Carl Worth cwo...@cworth.org wrote:
 Previously, a line such as:

 #else garbage

 would flag an error if it followed #if 0, but not if it followed #if 1.

 We fix this by setting a new bit of state (lexing_else) that allows the lexer
 to defer switching to the SKIP start state until after the NEWLINE following
 the #else directive.

 A new test case is added for:

 #if 1
 #else garbage
 #endif

 which was untested before, (and did not generate the desired error).
 ---

 Matt Turner matts...@gmail.com writes:
 The preprocessor is one of the only bits that uses tabs. I'd rather we
 stick with that, or convert the whole thing.

 Thanks for the catch. There are a handful of lines indented with spaces that
 have managed to sneak in, but I might as well not add more. So I've fixed
 that. Also, here in v2, instead of adding a lexing_else bit next to lexing_if,
 instead I'm reusing the original bit and renaming it to lexing_directive.

  src/glsl/glcpp/glcpp-lex.l | 25 
 +++---
  src/glsl/glcpp/glcpp-parse.y   |  6 +++---
  src/glsl/glcpp/glcpp.h |  2 +-
  src/glsl/glcpp/tests/103-garbage-after-else-0.c|  3 +++
  .../tests/103-garbage-after-else-0.c.expected  |  4 
  src/glsl/glcpp/tests/103-garbage-after-else.c  |  3 ---
  .../glcpp/tests/103-garbage-after-else.c.expected  |  4 
  src/glsl/glcpp/tests/123-garbage-after-else-1.c|  3 +++
  .../tests/123-garbage-after-else-1.c.expected  |  4 
  9 files changed, 31 insertions(+), 23 deletions(-)
  create mode 100644 src/glsl/glcpp/tests/103-garbage-after-else-0.c
  create mode 100644 src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected
  delete mode 100644 src/glsl/glcpp/tests/103-garbage-after-else.c
  delete mode 100644 src/glsl/glcpp/tests/103-garbage-after-else.c.expected
  create mode 100644 src/glsl/glcpp/tests/123-garbage-after-else-1.c
  create mode 100644 src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected

 diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
 index 188e454..d5fb087 100644
 --- a/src/glsl/glcpp/glcpp-lex.l
 +++ b/src/glsl/glcpp/glcpp-lex.l
 @@ -137,14 +137,15 @@ HEXADECIMAL_INTEGER   0[xX][0-9a-fA-F]+[uU]?
  *  2. The skip_stack is NULL meaning that we've reached
  * the last #endif.
  *
 -*  3. The lexing_if bit is set. This indicates that we
 -* are lexing the expression following an #if of
 -* #elif. Even inside an #if 0 we need to lex this
 -* expression so the parser can correctly update the
 -* skip_stack state.
 +*  3. The lexing_directive bit is set. This indicates that we are
 +* lexing a pre-processor directive, (such as #if, #elif, or
 +* #else). For the #if and #elif directives we always need to
 +* parse the conditions, (even if otherwise within an #if
 +* 0). And for #else, we want to be able to generate an error
 +* if any garbage follows #else.
  */
 if (YY_START == INITIAL || YY_START == SKIP) {
 -   if (parser-lexing_if ||
 +   if (parser-lexing_directive ||
 parser-skip_stack == NULL ||
 parser-skip_stack-type == SKIP_NO_SKIP)
 {
 @@ -193,25 +194,25 @@ HEXADECIMAL_INTEGER   0[xX][0-9a-fA-F]+[uU]?

  SKIP,INITIAL{
  {HASH}ifdef {
 -   yyextra-lexing_if = 1;
 +   yyextra-lexing_directive = 1;
 yyextra-space_tokens = 0;
 return HASH_IFDEF;
  }

  {HASH}ifndef {
 -   yyextra-lexing_if = 1;
 +   yyextra-lexing_directive = 1;
 yyextra-space_tokens = 0;
 return HASH_IFNDEF;
  }

  {HASH}if/[^_a-zA-Z0-9] {
 -   yyextra-lexing_if = 1;
 +   yyextra-lexing_directive = 1;
 yyextra-space_tokens = 0;
 return HASH_IF;
  }

  {HASH}elif/[^_a-zA-Z0-9] {
 -   yyextra-lexing_if = 1;
 +   yyextra-lexing_directive = 1;
 yyextra-space_tokens = 0;
 return HASH_ELIF;
  }
 @@ -348,7 +349,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
 if (parser-commented_newlines) {
 BEGIN NEWLINE_CATCHUP;
 }
 -   yyextra-lexing_if = 0;
 +   yyextra-lexing_directive = 0;
 yylineno++;
 yycolumn = 0;
 return NEWLINE;
 @@ -357,7 +358,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
 /* Handle missing newline at EOF. */
  INITIALEOF {
 BEGIN DONE; /* Don't keep matching this rule forever. */
 -   yyextra-lexing_if = 0;
 +   yyextra-lexing_directive = 0;
 return NEWLINE;
  }

 diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
 index 650d0d4..6906e62 100644
 --- a/src/glsl/glcpp/glcpp-parse.y
 +++ b/src/glsl/glcpp/glcpp-parse.y
 @@ -364,7 +364,7 

[Mesa-dev] [PATCH] r600g/radeonsi: Remove default case from PIPE_COMPUTE_CAP_* switch

2014-06-12 Thread Michel Dänzer
From: Michel Dänzer michel.daen...@amd.com

This way, the compiler warns about unhandled caps.

Signed-off-by: Michel Dänzer michel.daen...@amd.com
---
 src/gallium/drivers/radeon/r600_pipe_common.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 4c6cf0e..9813026 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -519,11 +519,10 @@ static int r600_get_compute_param(struct pipe_screen 
*screen,
*max_clock_frequency = rscreen-info.max_sclk;
}
return sizeof(uint32_t);
-
-   default:
-   fprintf(stderr, unknown PIPE_COMPUTE_CAP %d\n, param);
-   return 0;
}
+
+fprintf(stderr, unknown PIPE_COMPUTE_CAP %d\n, param);
+return 0;
 }
 
 static uint64_t r600_get_timestamp(struct pipe_screen *screen)
-- 
2.0.0

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


Re: [Mesa-dev] [PATCH] gallium/util: fix p_atomic_dec_zero macros

2014-06-12 Thread Michel Dänzer
On 12.06.2014 17:00, Maarten Lankhorst wrote:
 I'm pretty sure that p_atomic_dec_zero should return 1 if the count
 drops to zero.
 
 Cc: 10.2 10.1 10.0 mesa-sta...@lists.freedesktop.org

I don't think the stable tag is justified: These bugs have been there
for more than four years. Nothing in Gallium can work properly if the
return value of p_atomic_dec_zero() is inverted, so if there was
significant use of the broken variants, we should have heard about it
long ago.


 Signed-off-by: Maarten Lankhorst maarten.lankho...@canonical.com
 ---
 diff --git a/src/gallium/auxiliary/util/u_atomic.h
 b/src/gallium/auxiliary/util/u_atomic.h
 index 2f2b42b..08cadb4 100644
 --- a/src/gallium/auxiliary/util/u_atomic.h
 +++ b/src/gallium/auxiliary/util/u_atomic.h
 @@ -183,7 +183,7 @@ p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
  
  #define p_atomic_set(_v, _i) (*(_v) = (_i))
  #define p_atomic_read(_v) (*(_v))
 -#define p_atomic_dec_zero(_v) ((boolean) --(*(_v)))
 +#define p_atomic_dec_zero(_v) (!(boolean) --(*(_v)))

Will this compile (with the intended result) without another set of parens?


 @@ -324,7 +324,7 @@ p_atomic_dec_zero(int32_t *v)
  {
 uint32_t n = atomic_dec_32_nv((uint32_t *) v);
  
 -   return n != 0;
 +   return n == 0;
  }

This looks good, but there are more variants which look similarly broken?


-- 
Earthling Michel Dänzer|  http://www.amd.com
Libre software enthusiast  |Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev