Mesa (master): i965: Allocate at least some URB space even when max_vertices = 0.

2016-12-05 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: a41f5dcb141a11ca5ca0c765c305027b0f0b609e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a41f5dcb141a11ca5ca0c765c305027b0f0b609e

Author: Kenneth Graunke 
Date:   Fri Oct 14 17:59:36 2016 -0700

i965: Allocate at least some URB space even when max_vertices = 0.

Allocating zero URB space is a really bad idea.  The hardware has to
give threads a handle to their URB space, and threads have to use that
to terminate the thread.  Having it be an empty region just breaks a
lot of assumptions.  Hence, why we asserted that it isn't possible.

Unfortunately, it /is/ possible prior to Gen8, if max_vertices = 0.
In theory a geometry shader could do SSBO/image access and maybe
still accomplish something.  In reality, this is tripped up by
conformance tests.

Gen8+ already avoids this problem by placing the vertex count DWord
in the URB entry header.  This fixes things on earlier generations.

Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Kenneth Graunke 
Reviewed-by: Anuj Phogat 
Tested-by: Ian Romanick 

---

 src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index 900d9d3..3894a63 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -781,7 +781,13 @@ brw_compile_gs(const struct brw_compiler *compiler, void 
*log_data,
if (compiler->devinfo->gen >= 8)
   output_size_bytes += 32;
 
-   assert(output_size_bytes >= 1);
+   /* Shaders can technically set max_vertices = 0, at which point we
+* may have a URB size of 0 bytes.  Nothing good can come from that,
+* so enforce a minimum size.
+*/
+   if (output_size_bytes == 0)
+  output_size_bytes = 1;
+
unsigned max_output_size_bytes = GEN7_MAX_GS_URB_ENTRY_SIZE_BYTES;
if (compiler->devinfo->gen == 6)
   max_output_size_bytes = GEN6_MAX_GS_URB_ENTRY_SIZE_BYTES;

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


Mesa (master): i965: Allocate at least some URB space even when max_vertices = 0.

2016-12-05 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 98b16dd994b7d5f3cab82df6a4a3fb5efa61bc94
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=98b16dd994b7d5f3cab82df6a4a3fb5efa61bc94

Author: Kenneth Graunke 
Date:   Fri Oct 14 17:59:36 2016 -0700

i965: Allocate at least some URB space even when max_vertices = 0.

Allocating zero URB space is a really bad idea.  The hardware has to
give threads a handle to their URB space, and threads have to use that
to terminate the thread.  Having it be an empty region just breaks a
lot of assumptions.  Hence, why we asserted that it isn't possible.

Unfortunately, it /is/ possible prior to Gen8, if max_vertices = 0.
In theory a geometry shader could do SSBO/image access and maybe
still accomplish something.  In reality, this is tripped up by
conformance tests.

Gen8+ already avoids this problem by placing the vertex count DWord
in the URB entry header.  This fixes things on earlier generations.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Anuj Phogat 
Tested-by: Ian Romanick 

---

 src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index 900d9d3..3894a63 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -781,7 +781,13 @@ brw_compile_gs(const struct brw_compiler *compiler, void 
*log_data,
if (compiler->devinfo->gen >= 8)
   output_size_bytes += 32;
 
-   assert(output_size_bytes >= 1);
+   /* Shaders can technically set max_vertices = 0, at which point we
+* may have a URB size of 0 bytes.  Nothing good can come from that,
+* so enforce a minimum size.
+*/
+   if (output_size_bytes == 0)
+  output_size_bytes = 1;
+
unsigned max_output_size_bytes = GEN7_MAX_GS_URB_ENTRY_SIZE_BYTES;
if (compiler->devinfo->gen == 6)
   max_output_size_bytes = GEN6_MAX_GS_URB_ENTRY_SIZE_BYTES;

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


Mesa (master): glsl: fix ldexp lowering if bitfield insert lowering is also requested

2016-12-05 Thread Roland Scheidegger
Module: Mesa
Branch: master
Commit: df33f11b39abf313a0db7b9fefaf739b88133161
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=df33f11b39abf313a0db7b9fefaf739b88133161

Author: Roland Scheidegger 
Date:   Sat Dec  3 17:08:05 2016 +0100

glsl: fix ldexp lowering if bitfield insert lowering is also requested

Trivial, this just resurrects the code which was there once upon a time
(the code can't lower instructions generated in the lowering pass there,
and even if it could it would probably be suboptimal).
This fixes piglit mesa_shader_integer_functions fs-ldexp.shader_test and
vs-ldexp.shader_test with llvmpipe.

Reviewed-by: Matt Turner 

---

 src/compiler/glsl/lower_instructions.cpp | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/lower_instructions.cpp 
b/src/compiler/glsl/lower_instructions.cpp
index 372ded1..3e25e2b 100644
--- a/src/compiler/glsl/lower_instructions.cpp
+++ b/src/compiler/glsl/lower_instructions.cpp
@@ -392,7 +392,6 @@ lower_instructions_visitor::ldexp_to_arith(ir_expression 
*ir)
ir_constant *sign_mask = new(ir) ir_constant(0x8000u, vec_elem);
 
ir_constant *exp_shift = new(ir) ir_constant(23, vec_elem);
-   ir_constant *exp_width = new(ir) ir_constant(8, vec_elem);
 
/* Temporary variables */
ir_variable *x = new(ir) ir_variable(ir->type, "x", ir_var_temporary);
@@ -455,10 +454,22 @@ lower_instructions_visitor::ldexp_to_arith(ir_expression 
*ir)
 */
 
ir_constant *exp_shift_clone = exp_shift->clone(ir, NULL);
-   ir->operation = ir_unop_bitcast_i2f;
-   ir->operands[0] = bitfield_insert(bitcast_f2i(x), resulting_biased_exp,
- exp_shift_clone, exp_width);
-   ir->operands[1] = NULL;
+
+   /* Don't generate new IR that would need to be lowered in an additional
+* pass.
+*/
+   if (!lowering(INSERT_TO_SHIFTS)) {
+  ir_constant *exp_width = new(ir) ir_constant(8u, vec_elem);
+  ir->operation = ir_unop_bitcast_i2f;
+  ir->operands[0] = bitfield_insert(bitcast_f2i(x), resulting_biased_exp,
+exp_shift_clone, exp_width);
+  ir->operands[1] = NULL;
+   } else {
+  ir_constant *sign_mantissa_mask = new(ir) ir_constant(0x807fu, 
vec_elem);
+  ir->operation = ir_unop_bitcast_u2f;
+  ir->operands[0] = bit_or(bit_and(bitcast_f2u(x), sign_mantissa_mask),
+   lshift(i2u(resulting_biased_exp), 
exp_shift_clone));
+   }
 
this->progress = true;
 }

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


Mesa (master): main: allow NEAREST_MIPMAP_NEAREST for stencil texturing

2016-12-05 Thread Roland Scheidegger
Module: Mesa
Branch: master
Commit: cd9bb4b9182eb03de576fc20cf407ef05d3e6a6f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd9bb4b9182eb03de576fc20cf407ef05d3e6a6f

Author: Roland Scheidegger 
Date:   Mon Dec  5 13:39:16 2016 +0100

main: allow NEAREST_MIPMAP_NEAREST for stencil texturing

As per GL 4.5 rules, which fixed a spec mistake in GL_ARB_stencil_texturing.
The extension spec wasn't updated, but just allow it with older GL versions
as well, hoping there aren't any crazy tests which want to see an error
there... (Compile tested only.)

Reported by Józef Kucia 

Acked-by: Józef Kucia 
Reviewed-by: Kenneth Graunke 

---

 src/mesa/main/texobj.h | 23 ---
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
index 378d87a..8776763 100644
--- a/src/mesa/main/texobj.h
+++ b/src/mesa/main/texobj.h
@@ -125,7 +125,14 @@ static inline GLboolean
 _mesa_is_texture_complete(const struct gl_texture_object *texObj,
   const struct gl_sampler_object *sampler)
 {
-   if (texObj->_IsIntegerFormat &&
+   /*
+* According to ARB_stencil_texturing, NEAREST_MIPMAP_NEAREST would
+* be forbidden, however it is allowed per GL 4.5 rules, allow it
+* even without GL 4.5 since it was a spec mistake.
+*/
+   if ((texObj->_IsIntegerFormat ||
+(texObj->StencilSampling &&
+ texObj->Image[0][texObj->BaseLevel]->_BaseFormat == 
GL_DEPTH_STENCIL)) &&
(sampler->MagFilter != GL_NEAREST ||
 (sampler->MinFilter != GL_NEAREST &&
  sampler->MinFilter != GL_NEAREST_MIPMAP_NEAREST))) {
@@ -133,20 +140,6 @@ _mesa_is_texture_complete(const struct gl_texture_object 
*texObj,
   return GL_FALSE;
}
 
-   /* From the ARB_stencil_texturing specification:
-* "Add a new bullet point for the conditions that cause the texture
-*  to not be complete:
-*
-*  * The internal format of the texture is DEPTH_STENCIL, the
-*DEPTH_STENCIL_TEXTURE_MODE for the texture is STENCIL_INDEX and either
-*the magnification filter or the minification filter is not NEAREST."
-*/
-   if (texObj->StencilSampling &&
-   texObj->Image[0][texObj->BaseLevel]->_BaseFormat == GL_DEPTH_STENCIL &&
-   (sampler->MagFilter != GL_NEAREST || sampler->MinFilter != GL_NEAREST)) 
{
-  return GL_FALSE;
-   }
-
if (_mesa_is_mipmap_filter(sampler))
   return texObj->_MipmapComplete;
else

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


Mesa (master): radv: fix resource leak in radv_amdgpu_ctx_create

2016-12-05 Thread Edward O'Callaghan
Module: Mesa
Branch: master
Commit: 3015a23fe0eab17cde163b1de141f75c2f6410e4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3015a23fe0eab17cde163b1de141f75c2f6410e4

Author: Nayan Deshmukh 
Date:   Sun Dec  4 23:33:38 2016 +0530

radv: fix resource leak in radv_amdgpu_ctx_create

CovID: 1396387

V2. Fixup bad whitespace.

Signed-off-by: Nayan Deshmukh 
Reviewed-by: Edward O'Callaghan 

---

 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c 
b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
index b8558fa..4f3ce70 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
@@ -742,6 +742,7 @@ static struct radeon_winsys_ctx 
*radv_amdgpu_ctx_create(struct radeon_winsys *_w
ctx->ws = ws;
return (struct radeon_winsys_ctx *)ctx;
 error_create:
+   FREE(ctx);
return NULL;
 }
 

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


Mesa (master): radeon/vce Handle H.264 level 5.2

2016-12-05 Thread Leo Liu
Module: Mesa
Branch: master
Commit: 2a38a5b2b28aa6e2c5c005bf5a2bfeae11623f22
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a38a5b2b28aa6e2c5c005bf5a2bfeae11623f22

Author: Andy Furniss 
Date:   Tue Dec  6 00:02:21 2016 +

radeon/vce Handle H.264 level 5.2

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91281
v2: explicitly add case 52

Signed-off-by: Andy Furniss 

Reviewed-by: Christian König 

---

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

diff --git a/src/gallium/drivers/radeon/radeon_vce.c 
b/src/gallium/drivers/radeon/radeon_vce.c
index 2f50ef4..aad2ec1 100644
--- a/src/gallium/drivers/radeon/radeon_vce.c
+++ b/src/gallium/drivers/radeon/radeon_vce.c
@@ -178,14 +178,15 @@ static unsigned get_cpb_num(struct rvce_encoder *enc)
case 41:
dpb = 32768;
break;
-   default:
case 42:
dpb = 34816;
break;
case 50:
dpb = 110400;
break;
+   default:
case 51:
+   case 52:
dpb = 184320;
break;
}

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


Mesa (master): st/omx/enc Raise default encode level

2016-12-05 Thread Leo Liu
Module: Mesa
Branch: master
Commit: 5338fb34d6af656adaf0c80d57b5a6168f81d3e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5338fb34d6af656adaf0c80d57b5a6168f81d3e1

Author: Andy Furniss 
Date:   Mon Dec  5 23:53:40 2016 +

st/omx/enc Raise default encode level

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91281

Signed-off-by: Andy Furniss 

Reviewed-by: Christian König 

---

 src/gallium/state_trackers/omx/vid_enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/omx/vid_enc.c 
b/src/gallium/state_trackers/omx/vid_enc.c
index 0d7ab28..07f6799 100644
--- a/src/gallium/state_trackers/omx/vid_enc.c
+++ b/src/gallium/state_trackers/omx/vid_enc.c
@@ -246,7 +246,7 @@ static OMX_ERRORTYPE vid_enc_Constructor(OMX_COMPONENTTYPE 
*comp, OMX_STRING nam
priv->quant.nQpB = OMX_VID_ENC_QUANT_B_FRAMES_DEFAULT;
 
priv->profile_level.eProfile = OMX_VIDEO_AVCProfileBaseline;
-   priv->profile_level.eLevel = OMX_VIDEO_AVCLevel42;
+   priv->profile_level.eLevel = OMX_VIDEO_AVCLevel51;
 
priv->force_pic_type.IntraRefreshVOP = OMX_FALSE;
priv->frame_num = 0;

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


Mesa (master): nir/lower_returns: Stop using constant initializers

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 257aa5a1c4a2284ffd43759daa405fc135a40094
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=257aa5a1c4a2284ffd43759daa405fc135a40094

Author: Jason Ekstrand 
Date:   Wed Jul 20 10:37:43 2016 -0700

nir/lower_returns: Stop using constant initializers

Reviewed-by: Iago Toral Quiroga 

---

 src/compiler/nir/nir_lower_returns.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/compiler/nir/nir_lower_returns.c 
b/src/compiler/nir/nir_lower_returns.c
index 8dbea6e..cf49d5b 100644
--- a/src/compiler/nir/nir_lower_returns.c
+++ b/src/compiler/nir/nir_lower_returns.c
@@ -147,17 +147,18 @@ lower_returns_in_block(nir_block *block, struct 
lower_returns_state *state)
nir_instr_remove(&jump->instr);
 
nir_builder *b = &state->builder;
-   b->cursor = nir_after_block(block);
 
/* Set the return flag */
if (state->return_flag == NULL) {
   state->return_flag =
  nir_local_variable_create(b->impl, glsl_bool_type(), "return");
 
-  /* Set a default value of false */
-  state->return_flag->constant_initializer =
- rzalloc(state->return_flag, nir_constant);
+  /* Initialize the variable to 0 */
+  b->cursor = nir_before_cf_list(&b->impl->body);
+  nir_store_var(b, state->return_flag, nir_imm_int(b, NIR_FALSE), 1);
}
+
+   b->cursor = nir_after_block(block);
nir_store_var(b, state->return_flag, nir_imm_int(b, NIR_TRUE), 1);
 
if (state->loop) {

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


Mesa (master): nir: Remove some unused fields from nir_variable

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 7db009b59ee9df3a106f2f7e440a3ff9223b268f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7db009b59ee9df3a106f2f7e440a3ff9223b268f

Author: Jason Ekstrand 
Date:   Sat Jul 16 08:21:50 2016 -0700

nir: Remove some unused fields from nir_variable

All of these are happily set from glsl_to_nir or spirv_to_nir but their
values are never used for anything.

Reviewed-by: Iago Toral Quiroga 

---

 src/compiler/glsl/glsl_to_nir.cpp  |  5 -
 src/compiler/nir/nir.h | 34 --
 src/compiler/spirv/vtn_variables.c |  4 
 3 files changed, 43 deletions(-)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp 
b/src/compiler/glsl/glsl_to_nir.cpp
index f60139c..4debc37 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -340,10 +340,6 @@ nir_visitor::visit(ir_variable *ir)
var->data.interpolation = ir->data.interpolation;
var->data.origin_upper_left = ir->data.origin_upper_left;
var->data.pixel_center_integer = ir->data.pixel_center_integer;
-   var->data.explicit_location = ir->data.explicit_location;
-   var->data.explicit_index = ir->data.explicit_index;
-   var->data.explicit_binding = ir->data.explicit_binding;
-   var->data.has_initializer = ir->data.has_initializer;
var->data.compact = false;
var->data.location_frac = ir->data.location_frac;
 
@@ -376,7 +372,6 @@ nir_visitor::visit(ir_variable *ir)
var->data.image._volatile = ir->data.image_volatile;
var->data.image.restrict_flag = ir->data.image_restrict;
var->data.image.format = ir->data.image_format;
-   var->data.max_array_access = ir->data.max_array_access;
var->data.fb_fetch_output = ir->data.fb_fetch_output;
 
var->num_state_slots = ir->get_num_state_slots();
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 1ab5737..544d4ba 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -194,32 +194,6 @@ typedef struct nir_variable {
   /*@}*/
 
   /**
-   * Was the location explicitly set in the shader?
-   *
-   * If the location is explicitly set in the shader, it \b cannot be 
changed
-   * by the linker or by the API (e.g., calls to \c glBindAttribLocation 
have
-   * no effect).
-   */
-  unsigned explicit_location:1;
-  unsigned explicit_index:1;
-
-  /**
-   * Was an initial binding explicitly set in the shader?
-   *
-   * If so, constant_initializer contains an integer nir_constant
-   * representing the initial binding point.
-   */
-  unsigned explicit_binding:1;
-
-  /**
-   * Does this variable have an initializer?
-   *
-   * This is used by the linker to cross-validiate initializers of global
-   * variables.
-   */
-  unsigned has_initializer:1;
-
-  /**
* If non-zero, then this variable may be packed along with other 
variables
* into a single varying slot, so this offset should be applied when
* accessing components.  For example, an offset of 1 means that the x
@@ -312,14 +286,6 @@ typedef struct nir_variable {
  /** Image internal format if specified explicitly, otherwise GL_NONE. 
*/
  GLenum format;
   } image;
-
-  /**
-   * Highest element accessed with a constant expression array index
-   *
-   * Not used for non-array variables.
-   */
-  unsigned max_array_access;
-
} data;
 
/**
diff --git a/src/compiler/spirv/vtn_variables.c 
b/src/compiler/spirv/vtn_variables.c
index a38d359..be64dd9 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -931,7 +931,6 @@ apply_var_decoration(struct vtn_builder *b, nir_variable 
*nir_var,
   nir_var->data.location_frac = dec->literals[0];
   break;
case SpvDecorationIndex:
-  nir_var->data.explicit_index = true;
   nir_var->data.index = dec->literals[0];
   break;
case SpvDecorationBuiltIn: {
@@ -952,7 +951,6 @@ apply_var_decoration(struct vtn_builder *b, nir_variable 
*nir_var,
 
   nir_variable_mode mode = nir_var->data.mode;
   vtn_get_builtin_location(b, builtin, &nir_var->data.location, &mode);
-  nir_var->data.explicit_location = true;
   nir_var->data.mode = mode;
 
   if (builtin == SpvBuiltInFragCoord || builtin == 
SpvBuiltInSamplePosition)
@@ -1073,7 +1071,6 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value 
*val, int member,
   if (vtn_var->var) {
  /* This handles the member and lone variable cases */
  vtn_var->var->data.location = location;
- vtn_var->var->data.explicit_location = true;
   } else {
  /* This handles the structure member case */
  assert(vtn_var->members);
@@ -1081,7 +1078,6 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value 
*val, int member,
 glsl_get_length(glsl_without_array(vtn_var->type->type));
  for (unsigned i = 0; i < length; 

Mesa (master): nir: Delete most of the constant_initializer support

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 50e0b0bee3fb97089cf9913af7a0c980dfce6dce
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=50e0b0bee3fb97089cf9913af7a0c980dfce6dce

Author: Jason Ekstrand 
Date:   Fri Jul 15 17:17:40 2016 -0700

nir: Delete most of the constant_initializer support

Constant initializers have been a constant (ha!) pain for quite some time.
While they're useful from a language perspective, people writing passes or
backends really don't want deal with them most of the time.  This commit
removes most of the constant initializer support from NIR.  It is expected
that you call nir_lower_constant_initializers VERY EARLY to ensure that
they're gone before you do anything interesting.

Reviewed-by: Iago Toral Quiroga 

---

 src/compiler/nir/nir.h |  4 ++
 src/compiler/nir/nir_inline_functions.c| 42 +---
 src/compiler/nir/nir_lower_io_to_temporaries.c |  4 +-
 src/compiler/nir/nir_lower_locals_to_regs.c| 91 +-
 src/compiler/nir/nir_lower_vars_to_ssa.c   | 17 +
 5 files changed, 12 insertions(+), 146 deletions(-)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index fd6d48e..1ab5737 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -340,6 +340,10 @@ typedef struct nir_variable {
 
/**
 * Constant expression assigned in the initializer of the variable
+*
+* This field should only be used temporarily by creators of NIR shaders
+* and then lower_constant_initializers can be used to get rid of them.
+* Most of the rest of NIR ignores this field or asserts that it's NULL.
 */
nir_constant *constant_initializer;
 
diff --git a/src/compiler/nir/nir_inline_functions.c 
b/src/compiler/nir/nir_inline_functions.c
index cf31e14..c36748d 100644
--- a/src/compiler/nir/nir_inline_functions.c
+++ b/src/compiler/nir/nir_inline_functions.c
@@ -25,20 +25,6 @@
 #include "nir_builder.h"
 #include "nir_control_flow.h"
 
-static bool
-deref_apply_constant_initializer(nir_deref_var *deref, void *state)
-{
-   struct nir_builder *b = state;
-
-   nir_load_const_instr *initializer =
-  nir_deref_get_const_initializer_load(b->shader, deref);
-   nir_builder_instr_insert(b, &initializer->instr);
-
-   nir_store_deref_var(b, deref, &initializer->def, 0xf);
-
-   return true;
-}
-
 static bool inline_function_impl(nir_function_impl *impl, struct set *inlined);
 
 static void
@@ -188,35 +174,11 @@ inline_functions_block(nir_block *block, nir_builder *b,
   /* Add copies of all in parameters */
   assert(call->num_params == callee_copy->num_params);
 
-  b->cursor = nir_before_instr(&call->instr);
-
-  /* Before we insert the copy of the function, we need to lower away
-   * constant initializers on local variables.  This is because constant
-   * initializers happen (effectively) at the top of the function and,
-   * since these are about to become locals of the calling function,
-   * initialization will happen at the top of the caller rather than at
-   * the top of the callee.  This isn't usually a problem, but if we are
-   * being inlined inside of a loop, it can result in the variable not
-   * getting re-initialized properly for all loop iterations.
-   */
-  nir_foreach_variable(local, &callee_copy->locals) {
- if (!local->constant_initializer)
-continue;
-
- nir_deref_var deref;
- deref.deref.deref_type = nir_deref_type_var,
- deref.deref.child = NULL;
- deref.deref.type = local->type,
- deref.var = local;
-
- nir_deref_foreach_leaf(&deref, deref_apply_constant_initializer, b);
-
- local->constant_initializer = NULL;
-  }
-
   exec_list_append(&b->impl->locals, &callee_copy->locals);
   exec_list_append(&b->impl->registers, &callee_copy->registers);
 
+  b->cursor = nir_before_instr(&call->instr);
+
   /* We now need to tie the two functions together using the
* parameters.  There are two ways we do this: One is to turn the
* parameter into a local variable and do a shadow-copy.  The other
diff --git a/src/compiler/nir/nir_lower_io_to_temporaries.c 
b/src/compiler/nir/nir_lower_io_to_temporaries.c
index 4f615d3..6031bbd 100644
--- a/src/compiler/nir/nir_lower_io_to_temporaries.c
+++ b/src/compiler/nir/nir_lower_io_to_temporaries.c
@@ -133,8 +133,7 @@ create_shadow_temp(struct lower_io_state *state, 
nir_variable *var)
/* Reparent the name to the new variable */
ralloc_steal(nvar, nvar->name);
 
-   /* Reparent the constant initializer (if any) */
-   ralloc_steal(nvar, nvar->constant_initializer);
+   assert(nvar->constant_initializer == NULL);
 
/* Give the original a new name with @-temp appended */
const char *mode = (temp->data.mode == nir_var_shader_in) ? "in" : "out";
@@ -142,7 +141,6 @@ create_shadow_temp(struct lower_io_state *state, 
nir_variable *var)
temp->data.mode = nir_var_

Mesa (master): nir: Simplify nir_lower_gs_intrinsics

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 2f19c19b5de66c4966fc5f5926efe5d435e505db
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f19c19b5de66c4966fc5f5926efe5d435e505db

Author: Jason Ekstrand 
Date:   Fri Jul 15 17:15:21 2016 -0700

nir: Simplify nir_lower_gs_intrinsics

It's only ever called on single-function shaders.  At this point, there are
a lot of helpers that can make it all much simpler.

Reviewed-by: Iago Toral Quiroga 

---

 src/compiler/nir/nir_lower_gs_intrinsics.c | 37 +-
 1 file changed, 16 insertions(+), 21 deletions(-)

diff --git a/src/compiler/nir/nir_lower_gs_intrinsics.c 
b/src/compiler/nir/nir_lower_gs_intrinsics.c
index a955e8b..3acb742 100644
--- a/src/compiler/nir/nir_lower_gs_intrinsics.c
+++ b/src/compiler/nir/nir_lower_gs_intrinsics.c
@@ -189,32 +189,27 @@ nir_lower_gs_intrinsics(nir_shader *shader)
struct state state;
state.progress = false;
 
-   /* Create the counter variable */
-   nir_variable *var = rzalloc(shader, nir_variable);
-   var->data.mode = nir_var_global;
-   var->type = glsl_uint_type();
-   var->name = "vertex_count";
-   var->constant_initializer = rzalloc(shader, nir_constant); /* initialize to 
0 */
+   nir_function_impl *impl = nir_shader_get_entrypoint(shader);
+   assert(impl);
 
-   exec_list_push_tail(&shader->globals, &var->node);
-   state.vertex_count_var = var;
+   nir_builder b;
+   nir_builder_init(&b, impl);
+   state.builder = &b;
 
-   nir_foreach_function(function, shader) {
-  if (function->impl) {
- nir_builder b;
- nir_builder_init(&b, function->impl);
- state.builder = &b;
+   /* Create the counter variable */
+   state.vertex_count_var =
+  nir_local_variable_create(impl, glsl_uint_type(), "vertex_count");
+   /* initialize to 0 */
+   b.cursor = nir_before_cf_list(&impl->body);
+   nir_store_var(&b, state.vertex_count_var, nir_imm_int(&b, 0), 0x1);
 
- nir_foreach_block_safe(block, function->impl) {
-rewrite_intrinsics(block, &state);
- }
+   nir_foreach_block_safe(block, impl)
+  rewrite_intrinsics(block, &state);
 
- /* This only works because we have a single main() function. */
- append_set_vertex_count(function->impl->end_block, &state);
+   /* This only works because we have a single main() function. */
+   append_set_vertex_count(impl->end_block, &state);
 
- nir_metadata_preserve(function->impl, 0);
-  }
-   }
+   nir_metadata_preserve(impl, 0);
 
return state.progress;
 }

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


Mesa (master): anv/pipeline: Call nir_lower_constant_initializers

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: c5d664f9dc2d281c74844cef36ecb9f5862a8f6a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5d664f9dc2d281c74844cef36ecb9f5862a8f6a

Author: Jason Ekstrand 
Date:   Fri Jul 15 16:55:14 2016 -0700

anv/pipeline: Call nir_lower_constant_initializers

Reviewed-by: Iago Toral Quiroga 

---

 src/intel/vulkan/anv_pipeline.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 9b65e35..9104267 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -136,6 +136,13 @@ anv_shader_compile_to_nir(struct anv_device *device,
   nir_validate_shader(nir);
}
 
+   /* We have to lower away local constant initializers right before we
+* inline functions.  That way they get properly initialized at the top
+* of the function and not at the top of its caller.
+*/
+   nir_lower_constant_initializers(nir, nir_var_local);
+   nir_validate_shader(nir);
+
nir_lower_returns(nir);
nir_validate_shader(nir);
 
@@ -155,6 +162,12 @@ anv_shader_compile_to_nir(struct anv_device *device,
nir_remove_dead_variables(nir, nir_var_system_value);
nir_validate_shader(nir);
 
+   /* Now that we've deleted all but the main function, we can go ahead and
+* lower the rest of the constant initializers.
+*/
+   nir_lower_constant_initializers(nir, ~0);
+   nir_validate_shader(nir);
+
nir_propagate_invariant(nir);
nir_validate_shader(nir);
 

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


Mesa (master): nir: Add a pass for lowering away constant initializers

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: f5232db9e5fb00efc094c5dd071da4be88527568
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5232db9e5fb00efc094c5dd071da4be88527568

Author: Jason Ekstrand 
Date:   Fri Jul 15 16:44:53 2016 -0700

nir: Add a pass for lowering away constant initializers

Reviewed-by: Iago Toral Quiroga 

---

 src/compiler/Makefile.sources  |   1 +
 src/compiler/nir/nir.h |   2 +
 src/compiler/nir/nir_lower_constant_initializers.c | 112 +
 3 files changed, 115 insertions(+)

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index 6a7dcd8..17b15de 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -199,6 +199,7 @@ NIR_FILES = \
nir/nir_lower_clamp_color_outputs.c \
nir/nir_lower_clip.c \
nir/nir_lower_clip_cull_distance_arrays.c \
+   nir/nir_lower_constant_initializers.c \
nir/nir_lower_double_ops.c \
nir/nir_lower_double_packing.c \
nir/nir_lower_drawpixels.c \
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 9e8ed2c..fd6d48e 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2340,6 +2340,8 @@ void nir_lower_io_types(nir_shader *shader);
 void nir_lower_vars_to_ssa(nir_shader *shader);
 
 bool nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes);
+bool nir_lower_constant_initializers(nir_shader *shader,
+ nir_variable_mode modes);
 
 void nir_move_vec_src_uses_to_dest(nir_shader *shader);
 bool nir_lower_vec_to_movs(nir_shader *shader);
diff --git a/src/compiler/nir/nir_lower_constant_initializers.c 
b/src/compiler/nir/nir_lower_constant_initializers.c
new file mode 100644
index 000..f4d4d70
--- /dev/null
+++ b/src/compiler/nir/nir_lower_constant_initializers.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "nir.h"
+#include "nir_builder.h"
+
+static bool
+deref_apply_constant_initializer(nir_deref_var *deref, void *state)
+{
+   struct nir_builder *b = state;
+
+   nir_load_const_instr *initializer =
+  nir_deref_get_const_initializer_load(b->shader, deref);
+   nir_builder_instr_insert(b, &initializer->instr);
+
+   nir_store_deref_var(b, deref, &initializer->def, 0xf);
+
+   return true;
+}
+
+static bool
+lower_const_initializer(struct nir_builder *b, struct exec_list *var_list)
+{
+   bool progress = false;
+
+   b->cursor = nir_before_cf_list(&b->impl->body);
+
+   nir_foreach_variable(var, var_list) {
+  if (!var->constant_initializer)
+ continue;
+
+  progress = true;
+
+  nir_deref_var deref;
+  deref.deref.deref_type = nir_deref_type_var,
+  deref.deref.child = NULL;
+  deref.deref.type = var->type,
+  deref.var = var;
+
+  nir_deref_foreach_leaf(&deref, deref_apply_constant_initializer, b);
+
+  var->constant_initializer = NULL;
+   }
+
+   return progress;
+}
+
+bool
+nir_lower_constant_initializers(nir_shader *shader, nir_variable_mode modes)
+{
+   bool progress = false;
+
+   nir_builder builder;
+   if (modes & ~nir_var_local)
+  nir_builder_init(&builder, nir_shader_get_entrypoint(shader));
+
+   if (modes & nir_var_shader_out)
+  progress |= lower_const_initializer(&builder, &shader->outputs);
+
+   if (modes & nir_var_global)
+  progress |= lower_const_initializer(&builder, &shader->globals);
+
+   if (modes & nir_var_system_value)
+  progress |= lower_const_initializer(&builder, &shader->system_values);
+
+   if (progress) {
+  nir_foreach_function(function, shader) {
+ if (function->impl) {
+nir_metadata_preserve(function->impl, nir_metadata_block_index |
+  nir_metadata_dominance |
+

Mesa (master): glsl/nir: Call nir_lower_constant_initializers

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 507626304c047dacb959feaf94ff520a4e9f6c60
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=507626304c047dacb959feaf94ff520a4e9f6c60

Author: Jason Ekstrand 
Date:   Fri Jul 15 16:57:06 2016 -0700

glsl/nir: Call nir_lower_constant_initializers

Reviewed-by: Iago Toral Quiroga 

---

 src/compiler/glsl/glsl_to_nir.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp 
b/src/compiler/glsl/glsl_to_nir.cpp
index 0b74b7e..f60139c 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -144,6 +144,8 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
v2.run(sh->ir);
visit_exec_list(sh->ir, &v1);
 
+   nir_lower_constant_initializers(shader, (nir_variable_mode)~0);
+
shader->info->name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
if (shader_prog->Label)
   shader->info->label = ralloc_strdup(shader, shader_prog->Label);

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


Mesa (master): Revert "i965: use nir_lower_indirect_derefs() for GLSL"

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 0291bf4db2affbfb6a7daeb562c0cf56f6a85829
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0291bf4db2affbfb6a7daeb562c0cf56f6a85829

Author: Jason Ekstrand 
Date:   Mon Dec  5 15:20:52 2016 -0800

Revert "i965: use nir_lower_indirect_derefs() for GLSL"

This reverts commit 9404439a754e5640ccd98df40fa694835c0d8759.  I didn't
intend to push it and it breaks clip and cull distance.

---

 src/intel/vulkan/anv_pipeline.c| 10 ++
 src/mesa/drivers/dri/i965/brw_link.cpp | 13 +
 src/mesa/drivers/dri/i965/brw_nir.c| 10 --
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 6b0a3c9..9b65e35 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -177,6 +177,16 @@ anv_shader_compile_to_nir(struct anv_device *device,
 
nir_shader_gather_info(nir, entry_point->impl);
 
+   nir_variable_mode indirect_mask = 0;
+   if (compiler->glsl_compiler_options[stage].EmitNoIndirectInput)
+  indirect_mask |= nir_var_shader_in;
+   if (compiler->glsl_compiler_options[stage].EmitNoIndirectOutput)
+  indirect_mask |= nir_var_shader_out;
+   if (compiler->glsl_compiler_options[stage].EmitNoIndirectTemp)
+  indirect_mask |= nir_var_local;
+
+   nir_lower_indirect_derefs(nir, indirect_mask);
+
return nir;
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp 
b/src/mesa/drivers/dri/i965/brw_link.cpp
index 19e691e..3f6041b 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -137,6 +137,19 @@ process_glsl_ir(struct brw_context *brw,
 
do_copy_propagation(shader->ir);
 
+   bool lowered_variable_indexing =
+  lower_variable_index_to_cond_assign(shader->Stage, shader->ir,
+  options->EmitNoIndirectInput,
+  options->EmitNoIndirectOutput,
+  options->EmitNoIndirectTemp,
+  options->EmitNoIndirectUniform);
+
+   if (unlikely(brw->perf_debug && lowered_variable_indexing)) {
+  perf_debug("Unsupported form of variable indexing in %s; falling "
+ "back to very inefficient code generation\n",
+ _mesa_shader_stage_to_abbrev(shader->Stage));
+   }
+
bool progress;
do {
   progress = false;
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c 
b/src/mesa/drivers/dri/i965/brw_nir.c
index 8768cee..763e3ec 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -485,16 +485,6 @@ brw_preprocess_nir(const struct brw_compiler *compiler, 
nir_shader *nir)
/* Lower a bunch of stuff */
OPT_V(nir_lower_var_copies);
 
-   nir_variable_mode indirect_mask = 0;
-   if (compiler->glsl_compiler_options[nir->stage].EmitNoIndirectInput)
-  indirect_mask |= nir_var_shader_in;
-   if (compiler->glsl_compiler_options[nir->stage].EmitNoIndirectOutput)
-  indirect_mask |= nir_var_shader_out;
-   if (compiler->glsl_compiler_options[nir->stage].EmitNoIndirectTemp)
-  indirect_mask |= nir_var_local;
-
-   nir_lower_indirect_derefs(nir, indirect_mask);
-
/* Get rid of split copies */
nir = nir_optimize(nir, is_scalar);
 

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


Mesa (master): i965/copy_image: Re-implement the blitter path with emit_miptree_blit

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 06d864921ee6cfd083ac3782d4434d91ec652eea
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=06d864921ee6cfd083ac3782d4434d91ec652eea

Author: Jason Ekstrand 
Date:   Wed Nov 30 19:08:51 2016 -0800

i965/copy_image: Re-implement the blitter path with emit_miptree_blit

By using emit_miptree_blit which does chunking, this fixes the blitter path
for the case where the image is too tall to blit normally.  We also pull it
into intel_blit as intel_miptree_copy.  This matches the naming of the
blorp blit and copy functions brw_blorp_blit and brw_blorp_copy.

Reviewed-by: Anuj Phogat 
Cc: "13.0" 

---

 src/mesa/drivers/dri/i965/intel_blit.c   |  68 ++
 src/mesa/drivers/dri/i965/intel_blit.h   |   9 +++
 src/mesa/drivers/dri/i965/intel_copy_image.c | 100 +--
 3 files changed, 80 insertions(+), 97 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c 
b/src/mesa/drivers/dri/i965/intel_blit.c
index 15e45d4..03a35ee 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -386,6 +386,74 @@ intel_miptree_blit(struct brw_context *brw,
return true;
 }
 
+bool
+intel_miptree_copy(struct brw_context *brw,
+   struct intel_mipmap_tree *src_mt,
+   int src_level, int src_slice,
+   uint32_t src_x, uint32_t src_y,
+   struct intel_mipmap_tree *dst_mt,
+   int dst_level, int dst_slice,
+   uint32_t dst_x, uint32_t dst_y,
+   uint32_t src_width, uint32_t src_height)
+{
+   /* The blitter doesn't understand multisampling at all. */
+   if (src_mt->num_samples > 0 || dst_mt->num_samples > 0)
+  return false;
+
+   if (src_mt->format == MESA_FORMAT_S_UINT8)
+  return false;
+
+   /* The blitter has no idea about HiZ or fast color clears, so we need to
+* resolve the miptrees before we do anything.
+*/
+   intel_miptree_slice_resolve_depth(brw, src_mt, src_level, src_slice);
+   intel_miptree_slice_resolve_depth(brw, dst_mt, dst_level, dst_slice);
+   intel_miptree_resolve_color(brw, src_mt, src_level, src_slice, 1, 0);
+   intel_miptree_resolve_color(brw, dst_mt, dst_level, dst_slice, 1, 0);
+
+   uint32_t src_image_x, src_image_y;
+   intel_miptree_get_image_offset(src_mt, src_level, src_slice,
+  &src_image_x, &src_image_y);
+
+   if (_mesa_is_format_compressed(src_mt->format)) {
+  GLuint bw, bh;
+  _mesa_get_format_block_size(src_mt->format, &bw, &bh);
+
+  assert(src_x % bw == 0);
+  assert(src_y % bh == 0);
+  assert(src_width % bw == 0);
+  assert(src_height % bh == 0);
+
+  src_x /= (int)bw;
+  src_y /= (int)bh;
+  src_width /= (int)bw;
+  src_height /= (int)bh;
+   }
+   src_x += src_image_x;
+   src_y += src_image_y;
+
+   uint32_t dst_image_x, dst_image_y;
+   intel_miptree_get_image_offset(dst_mt, dst_level, dst_slice,
+  &dst_image_x, &dst_image_y);
+
+   if (_mesa_is_format_compressed(dst_mt->format)) {
+  GLuint bw, bh;
+  _mesa_get_format_block_size(dst_mt->format, &bw, &bh);
+
+  assert(dst_x % bw == 0);
+  assert(dst_y % bh == 0);
+
+  dst_x /= (int)bw;
+  dst_y /= (int)bh;
+   }
+   dst_x += dst_image_x;
+   dst_y += dst_image_y;
+
+   return emit_miptree_blit(brw, src_mt, src_x, src_y,
+dst_mt, dst_x, dst_y,
+src_width, src_height, false, GL_COPY);
+}
+
 static bool
 alignment_valid(struct brw_context *brw, unsigned offset, uint32_t tiling)
 {
diff --git a/src/mesa/drivers/dri/i965/intel_blit.h 
b/src/mesa/drivers/dri/i965/intel_blit.h
index f4ed919..6925795 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.h
+++ b/src/mesa/drivers/dri/i965/intel_blit.h
@@ -58,6 +58,15 @@ bool intel_miptree_blit(struct brw_context *brw,
 uint32_t width, uint32_t height,
 GLenum logicop);
 
+bool intel_miptree_copy(struct brw_context *brw,
+struct intel_mipmap_tree *src_mt,
+int src_level, int src_slice,
+uint32_t src_x, uint32_t src_y,
+struct intel_mipmap_tree *dst_mt,
+int dst_level, int dst_slice,
+uint32_t dst_x, uint32_t dst_y,
+uint32_t src_width, uint32_t src_height);
+
 bool
 intelEmitImmediateColorExpandBlit(struct brw_context *brw,
  GLuint cpp,
diff --git a/src/mesa/drivers/dri/i965/intel_copy_image.c 
b/src/mesa/drivers/dri/i965/intel_copy_image.c
index 3b5bf31..56eaed6 100644
--- a/src/mesa/drivers/dri/i965/intel_copy_image.c
+++ b/src/mesa/drivers/dri/i965/intel_copy_image.c
@@ -34,98 +34,6 @@
 #include "main/teximage.h"
 #include "drivers/common/meta.h"
 
-static bool
-copy_image_with_blitter(struct brw_context *brw

Mesa (master): i965/blit: Break the guts of intel_miptree_blit into a helper

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 6c74e7f492b526f16b6ae59b16eb30df14f793c8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c74e7f492b526f16b6ae59b16eb30df14f793c8

Author: Jason Ekstrand 
Date:   Wed Nov 30 18:14:27 2016 -0800

i965/blit: Break the guts of intel_miptree_blit into a helper

Reviewed-by: Anuj Phogat 
Cc: "13.0" 

---

 src/mesa/drivers/dri/i965/intel_blit.c | 151 ++---
 1 file changed, 84 insertions(+), 67 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c 
b/src/mesa/drivers/dri/i965/intel_blit.c
index 4944b8c..15e45d4 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -215,6 +215,86 @@ get_blit_intratile_offset_el(const struct brw_context *brw,
}
 }
 
+static bool
+emit_miptree_blit(struct brw_context *brw,
+  struct intel_mipmap_tree *src_mt,
+  uint32_t src_x, uint32_t src_y,
+  struct intel_mipmap_tree *dst_mt,
+  uint32_t dst_x, uint32_t dst_y,
+  uint32_t width, uint32_t height,
+  bool reverse, GLenum logicop)
+{
+   /* According to the Ivy Bridge PRM, Vol1 Part4, section 1.2.1.2 (Graphics
+* Data Size Limitations):
+*
+*The BLT engine is capable of transferring very large quantities of
+*graphics data. Any graphics data read from and written to the
+*destination is permitted to represent a number of pixels that
+*occupies up to 65,536 scan lines and up to 32,768 bytes per scan line
+*at the destination. The maximum number of pixels that may be
+*represented per scan line’s worth of graphics data depends on the
+*color depth.
+*
+* Furthermore, intelEmitCopyBlit (which is called below) uses a signed
+* 16-bit integer to represent buffer pitch, so it can only handle buffer
+* pitches < 32k. However, the pitch is measured in bytes for linear buffers
+* and dwords for tiled buffers.
+*
+* As a result of these two limitations, we can only use the blitter to do
+* this copy when the miptree's pitch is less than 32k linear or 128k tiled.
+*/
+   if (blt_pitch(src_mt) >= 32768 || blt_pitch(dst_mt) >= 32768) {
+  perf_debug("Falling back due to >= 32k/128k pitch\n");
+  return false;
+   }
+
+   /* We need to split the blit into chunks that each fit within the blitter's
+* restrictions.  We can't use a chunk size of 32768 because we need to
+* ensure that src_tile_x + chunk_size fits.  We choose 16384 because it's
+* a nice round power of two, big enough that performance won't suffer, and
+* small enough to guarantee everything fits.
+*/
+   const uint32_t max_chunk_size = 16384;
+
+   for (uint32_t chunk_x = 0; chunk_x < width; chunk_x += max_chunk_size) {
+  for (uint32_t chunk_y = 0; chunk_y < height; chunk_y += max_chunk_size) {
+ const uint32_t chunk_w = MIN2(max_chunk_size, width - chunk_x);
+ const uint32_t chunk_h = MIN2(max_chunk_size, height - chunk_y);
+
+ uint32_t src_offset, src_tile_x, src_tile_y;
+ get_blit_intratile_offset_el(brw, src_mt,
+  src_x + chunk_x, src_y + chunk_y,
+  &src_offset, &src_tile_x, &src_tile_y);
+
+ uint32_t dst_offset, dst_tile_x, dst_tile_y;
+ get_blit_intratile_offset_el(brw, dst_mt,
+  dst_x + chunk_x, dst_y + chunk_y,
+  &dst_offset, &dst_tile_x, &dst_tile_y);
+
+ if (!intelEmitCopyBlit(brw,
+src_mt->cpp,
+reverse ? -src_mt->pitch : src_mt->pitch,
+src_mt->bo, src_mt->offset + src_offset,
+src_mt->tiling,
+src_mt->tr_mode,
+dst_mt->pitch,
+dst_mt->bo, dst_mt->offset + dst_offset,
+dst_mt->tiling,
+dst_mt->tr_mode,
+src_tile_x, src_tile_y,
+dst_tile_x, dst_tile_y,
+chunk_w, chunk_h,
+logicop)) {
+/* If this is ever going to fail, it will fail on the first chunk 
*/
+assert(chunk_x == 0 && chunk_y == 0);
+return false;
+ }
+  }
+   }
+
+   return true;
+}
+
 /**
  * Implements a rectangular block transfer (blit) of pixels between two
  * miptrees.
@@ -265,30 +345,6 @@ intel_miptree_blit(struct brw_context *brw,
   return false;
}
 
-   /* According to the Ivy Bridge PRM, Vol1 Part4, section 1.2.1.2 (Graphics
-* Data Size Limitations):
-*
-*The BLT engine is capable of transferring very large quantities of
-*graphics data. Any graphics dat

Mesa (master): i965: Delete the meta-base CopyImageSubData implementation

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 5f0e4c7c798827950e835d40912024480ec6d665
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f0e4c7c798827950e835d40912024480ec6d665

Author: Jason Ekstrand 
Date:   Tue Nov 29 12:36:14 2016 -0800

i965: Delete the meta-base CopyImageSubData implementation

When I originally implemented the ARB_copy_image extension, the fast-path
was written in meta using texture views.  This path only worked if both
images were uncompressed color images.  All of the other cases fell back to
the blitter or, in the worst case, mapping and memcpy on the CPU.  Now that
we have the blorp path, it handles all copies ever and the old meta,
blitter, and CPU paths are only used on gen5 and below.  The primary reason
why we needed the meta path (apart from having a slow blitter on later
hardware) was to handle multisampling which gen5 and earlier don't support
anyway.  Since the blitter is reasonably fast on gen5, we can just delete
the meta path and get rid of all that terrible code.

If we decide that we're ok with just disabling ARB_copy_image on gen5 and
earlier (I personally am), then we could get rid of another 300 lines or so
of semi-hairy code.

Reviewed-by: Anuj Phogat 

---

 src/mesa/Makefile.sources|   1 -
 src/mesa/drivers/common/meta.h   |  10 -
 src/mesa/drivers/common/meta_copy_image.c| 307 ---
 src/mesa/drivers/dri/i965/intel_copy_image.c |  10 -
 4 files changed, 328 deletions(-)

diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 410a61a..ee737b0 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -621,7 +621,6 @@ COMMON_DRIVER_FILES =   \
drivers/common/driverfuncs.c\
drivers/common/driverfuncs.h\
drivers/common/meta_blit.c  \
-   drivers/common/meta_copy_image.c\
drivers/common/meta_generate_mipmap.c   \
drivers/common/meta_tex_subimage.c  \
drivers/common/meta.c \
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index a7018f5..0a913e9 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -492,16 +492,6 @@ _mesa_meta_and_swrast_BlitFramebuffer(struct gl_context 
*ctx,
   GLint dstX1, GLint dstY1,
   GLbitfield mask, GLenum filter);
 
-bool
-_mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
- struct gl_texture_image 
*src_tex_image,
- struct gl_renderbuffer 
*src_renderbuffer,
- int src_x, int src_y, int src_z,
- struct gl_texture_image 
*dst_tex_image,
- struct gl_renderbuffer 
*dst_renderbuffer,
- int dst_x, int dst_y, int dst_z,
- int src_width, int src_height);
-
 extern void
 _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers);
 
diff --git a/src/mesa/drivers/common/meta_copy_image.c 
b/src/mesa/drivers/common/meta_copy_image.c
deleted file mode 100644
index e1c90a3..000
--- a/src/mesa/drivers/common/meta_copy_image.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2014 Intel Corporation.  All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "enums.h"
-#include "imports.h"
-#include "macros.h"
-#include "teximage.h"
-#include "texobj.h"
-#include "fbobject.h"
-#include "framebuffer.h"
-#include "buffers.h"
-#include "state.h"
-#include "mtypes.h"
-#include "meta.h"
-
-/**
- * Create a texture image that wraps a renderbuffer.
- */
-static struct gl_texture_image *
-wrap_renderbuffer(struct gl_contex

Mesa (master): i965: use nir_lower_indirect_derefs() for GLSL

2016-12-05 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 9404439a754e5640ccd98df40fa694835c0d8759
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9404439a754e5640ccd98df40fa694835c0d8759

Author: Timothy Arceri 
Date:   Mon Aug 15 10:09:25 2016 +1000

i965: use nir_lower_indirect_derefs() for GLSL

This moves the nir_lower_indirect_derefs() call into
brw_preprocess_nir() so thats is called by both OpenGL and Vulkan
and removes that call to the old GLSL IR pass
lower_variable_index_to_cond_assign()

We want to do this pass in nir to be able to move loop unrolling
to nir.

There is a increase of 1-3 instructions in a small number of shaders,
and 2 Kerbal Space program shaders that increase by 32 instructions.

Shader-db results BDW:

total instructions in shared programs: 8705873 -> 8706194 (0.00%)
instructions in affected programs: 32515 -> 32836 (0.99%)
helped: 3
HURT: 79

total cycles in shared programs: 74618120 -> 74583476 (-0.05%)
cycles in affected programs: 528104 -> 493460 (-6.56%)
helped: 47
HURT: 37

LOST:   2
GAINED: 0

---

 src/intel/vulkan/anv_pipeline.c| 10 --
 src/mesa/drivers/dri/i965/brw_link.cpp | 13 -
 src/mesa/drivers/dri/i965/brw_nir.c| 10 ++
 3 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 9b65e35..6b0a3c9 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -177,16 +177,6 @@ anv_shader_compile_to_nir(struct anv_device *device,
 
nir_shader_gather_info(nir, entry_point->impl);
 
-   nir_variable_mode indirect_mask = 0;
-   if (compiler->glsl_compiler_options[stage].EmitNoIndirectInput)
-  indirect_mask |= nir_var_shader_in;
-   if (compiler->glsl_compiler_options[stage].EmitNoIndirectOutput)
-  indirect_mask |= nir_var_shader_out;
-   if (compiler->glsl_compiler_options[stage].EmitNoIndirectTemp)
-  indirect_mask |= nir_var_local;
-
-   nir_lower_indirect_derefs(nir, indirect_mask);
-
return nir;
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp 
b/src/mesa/drivers/dri/i965/brw_link.cpp
index 3f6041b..19e691e 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -137,19 +137,6 @@ process_glsl_ir(struct brw_context *brw,
 
do_copy_propagation(shader->ir);
 
-   bool lowered_variable_indexing =
-  lower_variable_index_to_cond_assign(shader->Stage, shader->ir,
-  options->EmitNoIndirectInput,
-  options->EmitNoIndirectOutput,
-  options->EmitNoIndirectTemp,
-  options->EmitNoIndirectUniform);
-
-   if (unlikely(brw->perf_debug && lowered_variable_indexing)) {
-  perf_debug("Unsupported form of variable indexing in %s; falling "
- "back to very inefficient code generation\n",
- _mesa_shader_stage_to_abbrev(shader->Stage));
-   }
-
bool progress;
do {
   progress = false;
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c 
b/src/mesa/drivers/dri/i965/brw_nir.c
index 763e3ec..8768cee 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -485,6 +485,16 @@ brw_preprocess_nir(const struct brw_compiler *compiler, 
nir_shader *nir)
/* Lower a bunch of stuff */
OPT_V(nir_lower_var_copies);
 
+   nir_variable_mode indirect_mask = 0;
+   if (compiler->glsl_compiler_options[nir->stage].EmitNoIndirectInput)
+  indirect_mask |= nir_var_shader_in;
+   if (compiler->glsl_compiler_options[nir->stage].EmitNoIndirectOutput)
+  indirect_mask |= nir_var_shader_out;
+   if (compiler->glsl_compiler_options[nir->stage].EmitNoIndirectTemp)
+  indirect_mask |= nir_var_local;
+
+   nir_lower_indirect_derefs(nir, indirect_mask);
+
/* Get rid of split copies */
nir = nir_optimize(nir, is_scalar);
 

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


Mesa (master): swr: include llvm version and vector width in renderer string

2016-12-05 Thread Tim Rowley
Module: Mesa
Branch: master
Commit: efc3ca64ba2292f6e6f0c4214ef41a35543fb285
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=efc3ca64ba2292f6e6f0c4214ef41a35543fb285

Author: Tim Rowley 
Date:   Mon Dec  5 11:32:19 2016 -0600

swr: include llvm version and vector width in renderer string

Uses llvmpipe's string formating.

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/swr_screen.cpp | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/swr_screen.cpp 
b/src/gallium/drivers/swr/swr_screen.cpp
index 75a9d02..539acf1 100644
--- a/src/gallium/drivers/swr/swr_screen.cpp
+++ b/src/gallium/drivers/swr/swr_screen.cpp
@@ -35,6 +35,7 @@
 #include "util/u_inlines.h"
 #include "util/u_cpu_detect.h"
 #include "util/u_format_s3tc.h"
+#include "util/u_string.h"
 
 #include "state_tracker/sw_winsys.h"
 
@@ -67,7 +68,11 @@ extern "C" {
 static const char *
 swr_get_name(struct pipe_screen *screen)
 {
-   return "SWR";
+   static char buf[100];
+   util_snprintf(buf, sizeof(buf), "SWR (LLVM %u.%u, %u bits)",
+ HAVE_LLVM >> 8, HAVE_LLVM & 0xff,
+ lp_native_vector_width );
+   return buf;
 }
 
 static const char *
@@ -940,6 +945,11 @@ swr_create_screen_internal(struct sw_winsys *winsys)
   g_GlobalKnobs.MAX_PRIMS_PER_DRAW.Value(49152);
}
 
+   if (!lp_build_init()) {
+  FREE(screen);
+  return NULL;
+   }
+
screen->winsys = winsys;
screen->base.get_name = swr_get_name;
screen->base.get_vendor = swr_get_vendor;

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


Mesa (master): swr: mark PIPE_CAP_NATIVE_FENCE_FD unsupported

2016-12-05 Thread Tim Rowley
Module: Mesa
Branch: master
Commit: 0c70b26a2d66ab05e0ab551a8206538914aed531
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c70b26a2d66ab05e0ab551a8206538914aed531

Author: Tim Rowley 
Date:   Mon Dec  5 11:35:57 2016 -0600

swr: mark PIPE_CAP_NATIVE_FENCE_FD unsupported

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/swr_screen.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/swr/swr_screen.cpp 
b/src/gallium/drivers/swr/swr_screen.cpp
index 539acf1..b5c2cd3 100644
--- a/src/gallium/drivers/swr/swr_screen.cpp
+++ b/src/gallium/drivers/swr/swr_screen.cpp
@@ -317,6 +317,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap 
param)
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
+   case PIPE_CAP_NATIVE_FENCE_FD:
   return 0;
 
case PIPE_CAP_VENDOR_ID:

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


Mesa (master): gallivm: use getHostCPUFeatures on x86/llvm-4.0+.

2016-12-05 Thread Tim Rowley
Module: Mesa
Branch: master
Commit: b035d9cab5a483f0ceee2d8fad578f64aca1888a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b035d9cab5a483f0ceee2d8fad578f64aca1888a

Author: Tim Rowley 
Date:   Mon Oct 31 10:29:07 2016 -0500

gallivm: use getHostCPUFeatures on x86/llvm-4.0+.

Use llvm provided API based on cpuid rather than our own
manually mantained list of mattr enabling/disabling.

Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index a68428d..21d9e15 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -542,6 +542,20 @@ 
lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
llvm::SmallVector MAttrs;
 
 #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
+#if HAVE_LLVM >= 0x0400
+   /* llvm-3.7+ implements sys::getHostCPUFeatures for x86,
+* which allows us to enable/disable code generation based
+* on the results of cpuid.
+*/
+   llvm::StringMap features;
+   llvm::sys::getHostCPUFeatures(features);
+
+   for (StringMapIterator f = features.begin();
+f != features.end();
+++f) {
+  MAttrs.push_back(((*f).second ? "+" : "-") + (*f).first().str());
+   }
+#else
/*
 * We need to unset attributes because sometimes LLVM mistakenly assumes
 * certain features are present given the processor name.
@@ -596,6 +610,7 @@ 
lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
MAttrs.push_back("-avx512vl");
 #endif
 #endif
+#endif
 
 #if defined(PIPE_ARCH_PPC)
MAttrs.push_back(util_cpu_caps.has_altivec ? "+altivec" : "-altivec");

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


Mesa (master): st/va: automake: cleanup C{PP,}FLAGS

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 510722d1465283582b89de0fe5fe6c4bb69de43d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=510722d1465283582b89de0fe5fe6c4bb69de43d

Author: Emil Velikov 
Date:   Fri Dec  2 16:26:49 2016 +

st/va: automake: cleanup C{PP,}FLAGS

Remove some transitional left overs from the gallium pipe-loader rework
and kill off unneeded AM_CPPFLAGS.

Signed-off-by: Emil Velikov 
Reviewed-by: Christian König 

---

 src/gallium/state_trackers/va/Makefile.am | 12 
 1 file changed, 12 deletions(-)

diff --git a/src/gallium/state_trackers/va/Makefile.am 
b/src/gallium/state_trackers/va/Makefile.am
index 348cfe1..a70eede5 100644
--- a/src/gallium/state_trackers/va/Makefile.am
+++ b/src/gallium/state_trackers/va/Makefile.am
@@ -30,18 +30,6 @@ AM_CFLAGS = \
$(VA_CFLAGS) \
-DVA_DRIVER_INIT_FUNC="__vaDriverInit_$(VA_MAJOR)_$(VA_MINOR)"
 
-AM_CFLAGS += \
-   $(GALLIUM_PIPE_LOADER_DEFINES) \
-   -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
-
-if HAVE_GALLIUM_STATIC_TARGETS
-AM_CFLAGS += \
-   -DGALLIUM_STATIC_TARGETS=1
-endif
-
-AM_CPPFLAGS = \
-   -I$(top_srcdir)/include
-
 noinst_LTLIBRARIES = libvatracker.la
 
 libvatracker_la_SOURCES = $(C_SOURCES)

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


Mesa (master): st/va: declare vlVaBuffer before vlVaContext

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 48416b6f4d3ffa46168b8b4a46a262562cd7473a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=48416b6f4d3ffa46168b8b4a46a262562cd7473a

Author: Juan A. Suarez Romero 
Date:   Fri Dec  2 16:26:51 2016 +

st/va: declare vlVaBuffer before vlVaContext

And declare coded_buf in vlVaContext as "vlVaBuffer *" instead of
"struct vlVaBuffer *".

This fixes several warnings later about assignment from incompatible
pointer type.

Reviewed-by: Emil Velikov 

---

 src/gallium/state_trackers/va/va_private.h | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/gallium/state_trackers/va/va_private.h 
b/src/gallium/state_trackers/va/va_private.h
index 900abbc..8faec10 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -221,6 +221,20 @@ typedef struct {
 } vlVaSubpicture;
 
 typedef struct {
+   VABufferType type;
+   unsigned int size;
+   unsigned int num_elements;
+   void *data;
+   struct {
+  struct pipe_resource *resource;
+  struct pipe_transfer *transfer;
+   } derived_surface;
+   unsigned int export_refcount;
+   VABufferInfo export_state;
+   unsigned int coded_size;
+} vlVaBuffer;
+
+typedef struct {
struct pipe_video_codec templat, *decoder;
struct pipe_video_buffer *target;
union {
@@ -243,7 +257,7 @@ typedef struct {
} mpeg4;
 
struct vl_deint_filter *deint;
-   struct vlVaBuffer *coded_buf;
+   vlVaBuffer *coded_buf;
int target_id;
bool first_single_submitted;
int gop_coeff;
@@ -257,20 +271,6 @@ typedef struct {
 } vlVaConfig;
 
 typedef struct {
-   VABufferType type;
-   unsigned int size;
-   unsigned int num_elements;
-   void *data;
-   struct {
-  struct pipe_resource *resource;
-  struct pipe_transfer *transfer;
-   } derived_surface;
-   unsigned int export_refcount;
-   VABufferInfo export_state;
-   unsigned int coded_size;
-} vlVaBuffer;
-
-typedef struct {
struct pipe_video_buffer templat, *buffer;
struct util_dynarray subpics; /* vlVaSubpicture */
VAContextID ctx;

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


Mesa (master): st/va: remove unused variable pbuff

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

Author: Juan A. Suarez Romero 
Date:   Fri Dec  2 16:26:50 2016 +

st/va: remove unused variable pbuff

Reviewed-by: Emil Velikov 
Reviewed-by: Elie Tournier 

---

 src/gallium/state_trackers/va/surface.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gallium/state_trackers/va/surface.c 
b/src/gallium/state_trackers/va/surface.c
index 38b3151..0e1dbe0 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -94,7 +94,6 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID 
render_target)
vlVaDriver *drv;
vlVaContext *context;
vlVaSurface *surf;
-   void *pbuff;
 
if (!ctx)
   return VA_STATUS_ERROR_INVALID_CONTEXT;

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


Mesa (master): add EGL_TEXTURE_EXTERNAL_WL to WL_bind_wayland_display spec

2016-12-05 Thread Daniel Stone
Module: Mesa
Branch: master
Commit: 8ca14b04e118a92ba0cdd64b81f1cb8407136bce
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ca14b04e118a92ba0cdd64b81f1cb8407136bce

Author: Rob Clark 
Date:   Thu Aug 16 17:28:19 2012 -0500

add EGL_TEXTURE_EXTERNAL_WL to WL_bind_wayland_display spec

Signed-off-by: Rob Clark 
Reviewed-by: Daniel Stone 

---

 docs/specs/WL_bind_wayland_display.spec | 5 +
 include/EGL/eglmesaext.h| 1 +
 2 files changed, 6 insertions(+)

diff --git a/docs/specs/WL_bind_wayland_display.spec 
b/docs/specs/WL_bind_wayland_display.spec
index 4057b4e..7854890 100644
--- a/docs/specs/WL_bind_wayland_display.spec
+++ b/docs/specs/WL_bind_wayland_display.spec
@@ -75,6 +75,7 @@ New Tokens
 EGL_TEXTURE_Y_U_V_WL0x31D7
 EGL_TEXTURE_Y_UV_WL 0x31D8
 EGL_TEXTURE_Y_XUXV_WL   0x31D9
+EGL_TEXTURE_EXTERNAL_WL 0x31DA
 
 Accepted in the  parameter of eglQueryWaylandBufferWL:
 
@@ -148,6 +149,10 @@ Additions to the EGL 1.4 Specification:
 Two planes, samples Y from the first plane to r in
 the shader, U and V from the second plane to g and a.
 
+EGL_TEXTURE_EXTERNAL_WL
+Treated as a single plane texture, but sampled with
+samplerExternalOES according to OES_EGL_image_external
+
 After querying the wl_buffer layout, create EGLImages for the
 planes by calling eglCreateImageKHR with wl_buffer as
 EGLClientBuffer, EGL_WAYLAND_BUFFER_WL as the target, NULL
diff --git a/include/EGL/eglmesaext.h b/include/EGL/eglmesaext.h
index 188452e..405d0e9 100644
--- a/include/EGL/eglmesaext.h
+++ b/include/EGL/eglmesaext.h
@@ -52,6 +52,7 @@ extern "C" {
 #define EGL_TEXTURE_Y_U_V_WL0x31D7
 #define EGL_TEXTURE_Y_UV_WL 0x31D8
 #define EGL_TEXTURE_Y_XUXV_WL   0x31D9
+#define EGL_TEXTURE_EXTERNAL_WL 0x31DA
 
 struct wl_display;
 struct wl_resource;

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


Mesa (master): docs: add release notes for 12.0.5

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: ef0417e8d1f69d1d8f32e64d28be74379acd7be4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef0417e8d1f69d1d8f32e64d28be74379acd7be4

Author: Emil Velikov 
Date:   Mon Dec  5 15:31:47 2016 +

docs: add release notes for 12.0.5

Signed-off-by: Emil Velikov 
(cherry picked from commit 01579a9d007830f2f905646c9d1f9bd0a03caa89)

---

 docs/relnotes/12.0.5.html | 137 ++
 1 file changed, 137 insertions(+)

diff --git a/docs/relnotes/12.0.5.html b/docs/relnotes/12.0.5.html
new file mode 100644
index 000..d69a614
--- /dev/null
+++ b/docs/relnotes/12.0.5.html
@@ -0,0 +1,137 @@
+http://www.w3.org/TR/html4/loose.dtd";>
+
+
+  
+  Mesa Release Notes
+  
+
+
+
+
+  The Mesa 3D Graphics Library
+
+
+
+
+
+Mesa 12.0.5 Release Notes / December 5, 2016
+
+
+Mesa 12.0.5 is a bug fix release which fixes bugs found since the 12.0.5 
release.
+
+
+Mesa 12.0.5 implements the OpenGL 4.3 API, but the version reported by
+glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
+glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 4.3.  OpenGL
+4.3 is only available if requested at context creation
+because compatibility contexts are not supported.
+
+
+
+SHA256 checksums
+
+TBD
+
+
+
+New features
+None
+
+
+Bug fixes
+
+This list is likely incomplete.
+
+
+
+https://bugs.freedesktop.org/show_bug.cgi?id=77662";>Bug 77662 
- Fail to render to different faces of depth-stencil cube map
+
+https://bugs.freedesktop.org/show_bug.cgi?id=97779";>Bug 97779 
- [regression, bisected][BDW, GPU hang] stuck on render ring, always 
reproducible
+
+https://bugs.freedesktop.org/show_bug.cgi?id=98415";>Bug 98415 
- Vulkan Driver JSON file contains incorrect field
+
+
+
+
+Changes
+
+Adam Jackson (2):
+
+  glx/glvnd: Don't modify the dummy slot in the dispatch table
+  glx/glvnd: Fix dispatch function names and indices
+
+
+Anuj Phogat (1):
+
+  i965: Fix GPU hang related to multiple render targets and alpha 
testing
+
+
+Emil Velikov (4):
+
+  docs: add release notes for 12.0.4
+  docs: add sha256 checksums for 12.0.4
+  cherry-ignore: add reverted LLVM_LIBDIR patch
+  Update version to 12.0.5
+
+
+Haixia Shi (1):
+
+  mesa: change state query return value for RGB565
+
+
+Jason Ekstrand (3):
+
+  i965/fs/generator: Don't use the address immediate for MOV_INDIRECT
+  anv/cmd_buffer: Take a command buffer instead of a batch in two 
helpers
+  anv/cmd_buffer: Enable a CS stall workaround for Sky Lake gt4
+
+
+Kenneth Graunke (1):
+
+  intel: Fix pixel shader scratch space allocation on Gen9+ platforms.
+
+
+Marek Olšák (13):
+
+  gallium/radeon: fix behavior of GLSL findLSB(0)
+  gallium/radeon: make sure HTILE address is aligned properly
+  radeonsi: fix an assertion failure in 
si_decompress_sampler_color_textures
+  gallium/radeon: unify viewport emission code
+  gallium/radeon: set VPORT_ZMIN/MAX registers correctly
+  radeonsi: fix gl_PatchVerticesIn for tessellation evaluation shader
+  radeonsi: fix a crash in imageSize for cubemap arrays
+  radeonsi: emit TA_CS_BC_BASE_ADDR on SI only if the kernel allows it
+  gallium/radeon: add support for sharing textures with DCC between 
processes
+  radeonsi: always set all blend registers
+  radeonsi: set CB_BLEND1_CONTROL.ENABLE for dual source blending
+  radeonsi: disable RB+ blend optimizations for dual source blending
+  radeonsi: silence runtime warnings with LLVM 3.9
+
+
+Matt Turner (1):
+
+  anv: Replace "abi_versions" with correct "api_version".
+
+
+Nanley Chery (1):
+
+  mesa/fbobject: Update CubeMapFace when reusing textures
+
+
+Steinar H. Gunderson (1):
+
+  Fix races during _mesa_HashWalk().
+
+
+Tim Rowley (3):
+
+  swr: [rasterizer jitter] cleanup supporting different llvm versions
+  swr: [rasterizer jitter] fix llvm-3.7 compile
+  swr: [rasterizer] add support for llvm-3.9
+
+
+
+
+
+

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


Mesa (master): docs: add news item and link release notes for 12.0.5

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: d09da32cfa52d6d47c300996cbb2efbbcf6c9f46
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d09da32cfa52d6d47c300996cbb2efbbcf6c9f46

Author: Emil Velikov 
Date:   Mon Dec  5 15:42:58 2016 +

docs: add news item and link release notes for 12.0.5

Signed-off-by: Emil Velikov 

---

 docs/index.html| 10 ++
 docs/relnotes.html |  1 +
 2 files changed, 11 insertions(+)

diff --git a/docs/index.html b/docs/index.html
index e2845e5..14f2b14 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -16,6 +16,16 @@
 
 News
 
+December 5, 2016
+
+Mesa 12.0.5 is released.
+This is a bug-fix release.
+
+NOTE: It is anticipated that 12.0.5 will be the final release in the 12.0
+series. Users of 12.0 are encouraged to migrate to the 13.0 series in order
+to obtain future fixes.
+
+
 November 28, 2016
 
 Mesa 13.0.2 is released.
diff --git a/docs/relnotes.html b/docs/relnotes.html
index 93b4bc3..21a6371 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -21,6 +21,7 @@ The release notes summarize what's new or changed in each 
Mesa release.
 
 
 
+12.0.5 release notes
 13.0.2 release notes
 13.0.1 release notes
 12.0.4 release notes

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


Mesa (master): docs: add sha256 checksums for 12.0.5

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: d7747cccaf93f3a5a6d994ec8784de2073d649aa
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7747cccaf93f3a5a6d994ec8784de2073d649aa

Author: Emil Velikov 
Date:   Mon Dec  5 15:38:13 2016 +

docs: add sha256 checksums for 12.0.5

Signed-off-by: Emil Velikov 
(cherry picked from commit 6b1c3c3aa0a2b643dbb9964b7001097eed3c4888)

---

 docs/relnotes/12.0.5.html | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/relnotes/12.0.5.html b/docs/relnotes/12.0.5.html
index d69a614..08fa068 100644
--- a/docs/relnotes/12.0.5.html
+++ b/docs/relnotes/12.0.5.html
@@ -31,7 +31,8 @@ because compatibility contexts are not supported.
 
 SHA256 checksums
 
-TBD
+44d08a27d98bfeacd864381189e434d98afbf451689d01f80380dc1d66450e5b  
mesa-12.0.5.tar.gz
+2b0a972d8282860a11291c09c3ef01ac45171405951eb21a83c45ed2b4321924  
mesa-12.0.5.tar.xz
 
 
 

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


Mesa: tag mesa-12.0.5: mesa-12.0.5

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: refs/tags/mesa-12.0.5
Tag:651c705264476293a2ce318e280b58b3d285ed2b
URL:
http://cgit.freedesktop.org/mesa/mesa/tag/?id=651c705264476293a2ce318e280b58b3d285ed2b

Tagger: Emil Velikov 
Date:   Mon Dec  5 15:36:39 2016 +

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


Mesa (12.0): Update version to 12.0.5

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: 12.0
Commit: cd9a1165586df02e7a34a51addd590284e51d19e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd9a1165586df02e7a34a51addd590284e51d19e

Author: Emil Velikov 
Date:   Mon Dec  5 15:25:21 2016 +

Update version to 12.0.5

Signed-off-by: Emil Velikov 

---

 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index f0ad792..16ec1fb 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-12.0.4
+12.0.5

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


Mesa (12.0): docs: add sha256 checksums for 12.0.5

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: 12.0
Commit: 6b1c3c3aa0a2b643dbb9964b7001097eed3c4888
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b1c3c3aa0a2b643dbb9964b7001097eed3c4888

Author: Emil Velikov 
Date:   Mon Dec  5 15:38:13 2016 +

docs: add sha256 checksums for 12.0.5

Signed-off-by: Emil Velikov 

---

 docs/relnotes/12.0.5.html | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/relnotes/12.0.5.html b/docs/relnotes/12.0.5.html
index d69a614..08fa068 100644
--- a/docs/relnotes/12.0.5.html
+++ b/docs/relnotes/12.0.5.html
@@ -31,7 +31,8 @@ because compatibility contexts are not supported.
 
 SHA256 checksums
 
-TBD
+44d08a27d98bfeacd864381189e434d98afbf451689d01f80380dc1d66450e5b  
mesa-12.0.5.tar.gz
+2b0a972d8282860a11291c09c3ef01ac45171405951eb21a83c45ed2b4321924  
mesa-12.0.5.tar.xz
 
 
 

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


Mesa (12.0): radeonsi: always set all blend registers

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: 12.0
Commit: a9e5a98c192db487cbad0b44f7c570e315529cb2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9e5a98c192db487cbad0b44f7c570e315529cb2

Author: Marek Olšák 
Date:   Sat Nov 26 15:39:06 2016 +0100

radeonsi: always set all blend registers

better safe than sorry

Cc: 13.0 
Reviewed-by: Nicolai Hähnle 
(cherry picked from commit 87b208a54e67b6b01845efa2ec20a96963399920)

Conflicts:
src/gallium/drivers/radeonsi/si_state.c

---

 src/gallium/drivers/radeonsi/si_state.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index f221296..eb84d61 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -461,16 +461,15 @@ static void *si_create_blend_state_mode(struct 
pipe_context *ctx,

S_028760_ALPHA_COMB_FCN(V_028760_OPT_COMB_BLEND_DISABLED);
 
/* Only set dual source blending for MRT0 to avoid a hang. */
-   if (i >= 1 && blend->dual_src_blend)
-   continue;
-
-   if (!state->rt[j].colormask)
+   if (i >= 1 && blend->dual_src_blend) {
+   si_pm4_set_reg(pm4, R_028780_CB_BLEND0_CONTROL + i * 4, 
blend_cntl);
continue;
+   }
 
/* cb_render_state will disable unused ones */
blend->cb_target_mask |= (unsigned)state->rt[j].colormask << (4 
* i);
 
-   if (!state->rt[j].blend_enable) {
+   if (!state->rt[j].colormask || !state->rt[j].blend_enable) {
si_pm4_set_reg(pm4, R_028780_CB_BLEND0_CONTROL + i * 4, 
blend_cntl);
continue;
}

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


Mesa (12.0): mesa/fbobject: Update CubeMapFace when reusing textures

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: 12.0
Commit: c1cb1844880f8fa72975de694ac404171e2e2677
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1cb1844880f8fa72975de694ac404171e2e2677

Author: Nanley Chery 
Date:   Tue Nov 15 16:42:23 2016 -0800

mesa/fbobject: Update CubeMapFace when reusing textures

Framebuffer attachments can be specified through FramebufferTexture*
calls. Upon specifying a depth (or stencil) framebuffer attachment that
internally reuses a texture, the cube map face of the new attachment
would not be updated (defaulting to TEXTURE_CUBE_MAP_POSITIVE_X).
Fix this issue by actually updating the CubeMapFace field.

This bug manifested itself in BindFramebuffer calls performed on
framebuffers whose stencil attachments internally reused a depth
texture.  When binding a framebuffer, we walk through the framebuffer's
attachments and update each one's corresponding gl_renderbuffer. Since
the framebuffer's depth and stencil attachments may share a
gl_renderbuffer and the walk visits the stencil attachment after
the depth attachment, the uninitialized CubeMapFace forced rendering
to TEXTURE_CUBE_MAP_POSITIVE_X.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77662
Signed-off-by: Nanley Chery 
Reviewed-by: Brian Paul 
(cherry picked from commit 63318d34acd4a5edb271d57adf3b01e2e52552f8)

---

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

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 68da639..10c77de 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2848,6 +2848,7 @@ reuse_framebuffer_texture_attachment(struct 
gl_framebuffer *fb,
dst_att->Type = src_att->Type;
dst_att->Complete = src_att->Complete;
dst_att->TextureLevel = src_att->TextureLevel;
+   dst_att->CubeMapFace = src_att->CubeMapFace;
dst_att->Zoffset = src_att->Zoffset;
dst_att->Layered = src_att->Layered;
 }

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


Mesa (12.0): radeonsi: disable RB+ blend optimizations for dual source blending

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: 12.0
Commit: b4c28b17554bb4c1cf77b83f52ed4de7fbb45326
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4c28b17554bb4c1cf77b83f52ed4de7fbb45326

Author: Marek Olšák 
Date:   Sat Nov 26 15:52:05 2016 +0100

radeonsi: disable RB+ blend optimizations for dual source blending

This fixes dual source blending on Stoney. The fix was copied from Vulkan.
The problem was discovered during internal testing.

Cc: 13.0 
Reviewed-by: Nicolai Hähnle 
(cherry picked from commit 5e5573b1bf8565f38e9b770b5357d069e80ff00d)

---

 src/gallium/drivers/radeonsi/si_state.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 48665f8..4e7d412 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -554,6 +554,17 @@ static void *si_create_blend_state_mode(struct 
pipe_context *ctx,
}
 
if (sctx->b.family == CHIP_STONEY) {
+   /* Disable RB+ blend optimizations for dual source blending.
+* Vulkan does this.
+*/
+   if (blend->dual_src_blend) {
+   for (int i = 0; i < 8; i++) {
+   sx_mrt_blend_opt[i] =
+   
S_028760_COLOR_COMB_FCN(V_028760_OPT_COMB_NONE) |
+   
S_028760_ALPHA_COMB_FCN(V_028760_OPT_COMB_NONE);
+   }
+   }
+
for (int i = 0; i < 8; i++)
si_pm4_set_reg(pm4, R_028760_SX_MRT0_BLEND_OPT + i * 4,
   sx_mrt_blend_opt[i]);

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


Mesa (12.0): radeonsi: set CB_BLEND1_CONTROL.ENABLE for dual source blending

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: 12.0
Commit: 4f71f93878f6aca0fee09fe59449cfe453596b10
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f71f93878f6aca0fee09fe59449cfe453596b10

Author: Marek Olšák 
Date:   Sat Nov 26 15:43:39 2016 +0100

radeonsi: set CB_BLEND1_CONTROL.ENABLE for dual source blending

copied from Vulkan

Cc: 13.0 
Reviewed-by: Nicolai Hähnle 
(cherry picked from commit ff50c44a5fb4411715da828af5b8706c8a456d26)

---

 src/gallium/drivers/radeonsi/si_state.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index eb84d61..48665f8 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -462,6 +462,10 @@ static void *si_create_blend_state_mode(struct 
pipe_context *ctx,
 
/* Only set dual source blending for MRT0 to avoid a hang. */
if (i >= 1 && blend->dual_src_blend) {
+   /* Vulkan does this for dual source blending. */
+   if (i == 1)
+   blend_cntl |= S_028780_ENABLE(1);
+
si_pm4_set_reg(pm4, R_028780_CB_BLEND0_CONTROL + i * 4, 
blend_cntl);
continue;
}

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


Mesa (12.0): docs: add release notes for 12.0.5

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: 12.0
Commit: 01579a9d007830f2f905646c9d1f9bd0a03caa89
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=01579a9d007830f2f905646c9d1f9bd0a03caa89

Author: Emil Velikov 
Date:   Mon Dec  5 15:31:47 2016 +

docs: add release notes for 12.0.5

Signed-off-by: Emil Velikov 

---

 docs/relnotes/12.0.5.html | 137 ++
 1 file changed, 137 insertions(+)

diff --git a/docs/relnotes/12.0.5.html b/docs/relnotes/12.0.5.html
new file mode 100644
index 000..d69a614
--- /dev/null
+++ b/docs/relnotes/12.0.5.html
@@ -0,0 +1,137 @@
+http://www.w3.org/TR/html4/loose.dtd";>
+
+
+  
+  Mesa Release Notes
+  
+
+
+
+
+  The Mesa 3D Graphics Library
+
+
+
+
+
+Mesa 12.0.5 Release Notes / December 5, 2016
+
+
+Mesa 12.0.5 is a bug fix release which fixes bugs found since the 12.0.5 
release.
+
+
+Mesa 12.0.5 implements the OpenGL 4.3 API, but the version reported by
+glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
+glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 4.3.  OpenGL
+4.3 is only available if requested at context creation
+because compatibility contexts are not supported.
+
+
+
+SHA256 checksums
+
+TBD
+
+
+
+New features
+None
+
+
+Bug fixes
+
+This list is likely incomplete.
+
+
+
+https://bugs.freedesktop.org/show_bug.cgi?id=77662";>Bug 77662 
- Fail to render to different faces of depth-stencil cube map
+
+https://bugs.freedesktop.org/show_bug.cgi?id=97779";>Bug 97779 
- [regression, bisected][BDW, GPU hang] stuck on render ring, always 
reproducible
+
+https://bugs.freedesktop.org/show_bug.cgi?id=98415";>Bug 98415 
- Vulkan Driver JSON file contains incorrect field
+
+
+
+
+Changes
+
+Adam Jackson (2):
+
+  glx/glvnd: Don't modify the dummy slot in the dispatch table
+  glx/glvnd: Fix dispatch function names and indices
+
+
+Anuj Phogat (1):
+
+  i965: Fix GPU hang related to multiple render targets and alpha 
testing
+
+
+Emil Velikov (4):
+
+  docs: add release notes for 12.0.4
+  docs: add sha256 checksums for 12.0.4
+  cherry-ignore: add reverted LLVM_LIBDIR patch
+  Update version to 12.0.5
+
+
+Haixia Shi (1):
+
+  mesa: change state query return value for RGB565
+
+
+Jason Ekstrand (3):
+
+  i965/fs/generator: Don't use the address immediate for MOV_INDIRECT
+  anv/cmd_buffer: Take a command buffer instead of a batch in two 
helpers
+  anv/cmd_buffer: Enable a CS stall workaround for Sky Lake gt4
+
+
+Kenneth Graunke (1):
+
+  intel: Fix pixel shader scratch space allocation on Gen9+ platforms.
+
+
+Marek Olšák (13):
+
+  gallium/radeon: fix behavior of GLSL findLSB(0)
+  gallium/radeon: make sure HTILE address is aligned properly
+  radeonsi: fix an assertion failure in 
si_decompress_sampler_color_textures
+  gallium/radeon: unify viewport emission code
+  gallium/radeon: set VPORT_ZMIN/MAX registers correctly
+  radeonsi: fix gl_PatchVerticesIn for tessellation evaluation shader
+  radeonsi: fix a crash in imageSize for cubemap arrays
+  radeonsi: emit TA_CS_BC_BASE_ADDR on SI only if the kernel allows it
+  gallium/radeon: add support for sharing textures with DCC between 
processes
+  radeonsi: always set all blend registers
+  radeonsi: set CB_BLEND1_CONTROL.ENABLE for dual source blending
+  radeonsi: disable RB+ blend optimizations for dual source blending
+  radeonsi: silence runtime warnings with LLVM 3.9
+
+
+Matt Turner (1):
+
+  anv: Replace "abi_versions" with correct "api_version".
+
+
+Nanley Chery (1):
+
+  mesa/fbobject: Update CubeMapFace when reusing textures
+
+
+Steinar H. Gunderson (1):
+
+  Fix races during _mesa_HashWalk().
+
+
+Tim Rowley (3):
+
+  swr: [rasterizer jitter] cleanup supporting different llvm versions
+  swr: [rasterizer jitter] fix llvm-3.7 compile
+  swr: [rasterizer] add support for llvm-3.9
+
+
+
+
+
+

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


Mesa (12.0): radeonsi: silence runtime warnings with LLVM 3.9

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: 12.0
Commit: 4a5cce8bd5b1dcf6b95b64c26ea361148964a152
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a5cce8bd5b1dcf6b95b64c26ea361148964a152

Author: Marek Olšák 
Date:   Fri Dec  2 22:19:06 2016 +0100

radeonsi: silence runtime warnings with LLVM 3.9

Such as:
Warning: LLVM emitted unknown config register: 0x4

This is a non-intrusive back port of commit 0f7a6ea5e7b.

---

 src/gallium/drivers/radeonsi/si_shader.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 091f7e3..95cf1a1 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5865,6 +5865,9 @@ void si_shader_binary_read_config(struct 
radeon_shader_binary *binary,
conf->scratch_bytes_per_wave =
G_00B860_WAVESIZE(value) * 256 * 4 * 1;
break;
+   case 0x4:
+   case 0x8:
+   break; /* just spilling stats, not important */
default:
{
static bool printed;

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


Mesa (master): configure.ac: Use short names for r600 und r300

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 44a672ef0ef69afb3b9511fdca1331a360cf281e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=44a672ef0ef69afb3b9511fdca1331a360cf281e

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:01 2016 +0100

configure.ac: Use short names for r600 und r300

There are no non gallium r300 and r600 drivers anymore.
No need to explicilty mention gallium here.
Just cosmetics, no functional change.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index ea0354a..7557733 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2451,15 +2451,15 @@ if test -n "$with_gallium_drivers"; then
 xr300)
 HAVE_GALLIUM_R300=yes
 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= 
$LIBDRM_RADEON_REQUIRED])
-require_libdrm "Gallium R300"
-gallium_require_llvm "Gallium R300"
+require_libdrm "r300"
+gallium_require_llvm "r300"
 ;;
 xr600)
 HAVE_GALLIUM_R600=yes
 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= 
$LIBDRM_RADEON_REQUIRED])
-require_libdrm "Gallium R600"
+require_libdrm "r600"
 if test "x$enable_opencl" = xyes; then
-radeon_gallium_llvm_check "r600g" "3" "6" "0"
+radeon_gallium_llvm_check "r600" "3" "6" "0"
 
 llvm_add_component "asmparser" "r600"
 llvm_add_component "bitreader" "r600"

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


Mesa (master): configure.ac: Reorder arguments in radeon_llvm_check

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: a8ae340f7e198f9a4b8b125a5e0e28c3be0f1237
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8ae340f7e198f9a4b8b125a5e0e28c3be0f1237

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:08 2016 +0100

configure.ac: Reorder arguments in radeon_llvm_check

Use the same order as llvm_check_version_for.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 07326e2..cd42bdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1005,12 +1005,12 @@ radeon_llvm_check() {
 amdgpu_llvm_target_name='amdgpu'
 fi
 
-llvm_check_version_for $2 $3 $4 $1
+llvm_check_version_for $*
 
-llvm_add_target $amdgpu_llvm_target_name $1
+llvm_add_target $amdgpu_llvm_target_name $4
 
-llvm_add_component "bitreader" $1
-llvm_add_component "ipo" $1
+llvm_add_component "bitreader" $4
+llvm_add_component "ipo" $4
 
 NEED_RADEON_LLVM=yes
 if test "x$have_libelf" != xyes; then
@@ -1858,7 +1858,7 @@ if test -n "$with_vulkan_drivers"; then
 ;;
 xradeon)
 PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= 
$LIBDRM_AMDGPU_REQUIRED])
-radeon_llvm_check "radv" "3" "9" "0"
+radeon_llvm_check "3" "9" "0" "radv"
 HAVE_RADEON_VULKAN=yes;
 if test "x$with_sha1" == "x"; then
 AC_MSG_ERROR([radv vulkan driver requires SHA1])
@@ -2361,7 +2361,7 @@ require_basic_egl() {
 
 radeon_gallium_llvm_check() {
 if test "x$enable_gallium_llvm" != "xyes"; then
-AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+AC_MSG_ERROR([--enable-gallium-llvm is required when building $4])
 fi
 radeon_llvm_check $*
 }
@@ -2435,7 +2435,7 @@ if test -n "$with_gallium_drivers"; then
 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= 
$LIBDRM_RADEON_REQUIRED])
 require_libdrm "r600"
 if test "x$enable_opencl" = xyes; then
-radeon_gallium_llvm_check "r600" "3" "6" "0"
+radeon_gallium_llvm_check "3" "6" "0" "r600"
 
 llvm_add_component "asmparser" "r600"
 llvm_add_component "bitreader" "r600"
@@ -2446,7 +2446,7 @@ if test -n "$with_gallium_drivers"; then
 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= 
$LIBDRM_RADEON_REQUIRED])
 PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= 
$LIBDRM_AMDGPU_REQUIRED])
 require_libdrm "radeonsi"
-radeon_gallium_llvm_check "radeonsi" "3" "6" "0"
+radeon_gallium_llvm_check "3" "6" "0" "radeonsi"
 require_basic_egl "radeonsi"
 ;;
 xnouveau)

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


Mesa (master): configure.ac: Move llvm_set_environment_variables higher.

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 9d14a25bee0f1457a82f3e42b3baf3db1806faea
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d14a25bee0f1457a82f3e42b3baf3db1806faea

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:04 2016 +0100

configure.ac: Move llvm_set_environment_variables higher.

This moves the function to get the LLVM environment variables higher
in the file. It still needs to be below the "--enable-opencl" because
it uses $enable_opencl.
It can be called without condition now as it only throws errors if
openCL is enabled.

v5:
HAVE_MESA_LLVM is only used for gallium. Rename it to HAVE_GALLIUM_LLVM.
In order to only link LLVM when it is needed, HAVE_GALLIUM_LLVM is only
set if "$enable-gallium-llvm" is yes.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac| 11 ---
 src/gallium/auxiliary/Makefile.am   |  2 +-
 src/gallium/targets/d3dadapter9/Makefile.am |  2 +-
 src/gallium/targets/dri/Makefile.am |  2 +-
 src/gallium/targets/libgl-xlib/Makefile.am  |  2 +-
 src/gallium/targets/omx/Makefile.am |  2 +-
 src/gallium/targets/osmesa/Makefile.am  |  2 +-
 src/gallium/targets/pipe-loader/Makefile.am |  2 +-
 src/gallium/targets/va/Makefile.am  |  2 +-
 src/gallium/targets/vdpau/Makefile.am   |  2 +-
 src/gallium/targets/xa/Makefile.am  |  2 +-
 src/gallium/targets/xvmc/Makefile.am|  2 +-
 12 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1de6b7e..3e9972c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1189,6 +1189,8 @@ AC_ARG_ENABLE([gallium-tests],
 [enable_gallium_tests="$enableval"],
 [enable_gallium_tests=no])
 
+llvm_set_environment_variables
+
 # Option for Gallium drivers
 
 # Keep this in sync with the --with-gallium-drivers help string default value
@@ -2285,12 +2287,6 @@ if test "x$enable_gallium_llvm" = xauto; then
 i*86|x86_64|amd64) enable_gallium_llvm=yes;;
 esac
 fi
-if test "x$enable_gallium_llvm" = xyes || test "x$HAVE_RADEON_VULKAN" = xyes; 
then
-llvm_set_environment_variables
-else
-MESA_LLVM=0
-LLVM_VERSION_INT=0
-fi
 
 dnl Directory for XVMC libs
 AC_ARG_WITH([xvmc-libdir],
@@ -2626,7 +2622,8 @@ AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test 
"x$HAVE_GALLIUM_R300" = xyes -o \
 AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$enable_glx" = xgallium-xlib)
 AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
-AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
+AM_CONDITIONAL(HAVE_GALLIUM_LLVM, test "x$MESA_LLVM" = x1 -a \
+   "x$enable_gallium_llvm" = xyes)
 AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes)
 if test "x$USE_VC4_SIMULATOR" = xyes -a "x$HAVE_GALLIUM_ILO" = xyes; then
 AC_MSG_ERROR([VC4 simulator on x86 replaces i965 driver build, so ilo must 
be disabled.])
diff --git a/src/gallium/auxiliary/Makefile.am 
b/src/gallium/auxiliary/Makefile.am
index 4a4a4fb..0d1aee6 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -20,7 +20,7 @@ libgallium_la_SOURCES = \
$(NIR_SOURCES) \
$(GENERATED_SOURCES)
 
-if HAVE_MESA_LLVM
+if HAVE_GALLIUM_LLVM
 
 AM_CFLAGS += \
$(LLVM_CFLAGS)
diff --git a/src/gallium/targets/d3dadapter9/Makefile.am 
b/src/gallium/targets/d3dadapter9/Makefile.am
index c37da98..a3d2416 100644
--- a/src/gallium/targets/d3dadapter9/Makefile.am
+++ b/src/gallium/targets/d3dadapter9/Makefile.am
@@ -114,7 +114,7 @@ d3dadapter9_la_LIBADD += \
 
 endif # HAVE_GALLIUM_STATIC_TARGETS
 
-if HAVE_MESA_LLVM
+if HAVE_GALLIUM_LLVM
 nodist_EXTRA_d3dadapter9_la_SOURCES = dummy.cpp
 d3dadapter9_la_LDFLAGS += $(LLVM_LDFLAGS)
 d3dadapter9_la_LIBADD += $(LLVM_LIBS)
diff --git a/src/gallium/targets/dri/Makefile.am 
b/src/gallium/targets/dri/Makefile.am
index 06ade45..0527e9f2 100644
--- a/src/gallium/targets/dri/Makefile.am
+++ b/src/gallium/targets/dri/Makefile.am
@@ -112,7 +112,7 @@ gallium_dri_la_LIBADD += \
 
 endif # HAVE_GALLIUM_STATIC_TARGETS
 
-if HAVE_MESA_LLVM
+if HAVE_GALLIUM_LLVM
 gallium_dri_la_LIBADD += $(LLVM_LIBS)
 gallium_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
 endif
diff --git a/src/gallium/targets/libgl-xlib/Makefile.am 
b/src/gallium/targets/libgl-xlib/Makefile.am
index 3f1382e..6f966c3 100644
--- a/src/gallium/targets/libgl-xlib/Makefile.am
+++ b/src/gallium/targets/libgl-xlib/Makefile.am
@@ -75,7 +75,7 @@ lib@GL_LIB@_la_LIBADD = \
$(GL_LIB_DEPS) \
$(CLOCK_LIB)
 
-if HAVE_MESA_LLVM
+if HAVE_GALLIUM_LLVM
 lib@GL_LIB@_la_LIBADD += 
$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
 lib@GL_LIB@_la_LDFLAGS += $(LLVM_LDFLAGS)
diff --git a/src/gallium/targets/omx/Makefile.am 
b/src/gallium/targets/omx/Makefile.am
index 3bdb9eb..29ba242 100644
--- a/src/gallium/targets/omx/Makefile.am
+++ b/src/gallium/targets/

Mesa (master): configure.ac: Move radv check to the Vulkan section

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 3f42859367cdd66b460bc8af4eab6cf9d0adc086
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f42859367cdd66b460bc8af4eab6cf9d0adc086

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:07 2016 +0100

configure.ac: Move radv check to the Vulkan section

This moves the LLVM check for radv to the corresponding driver section.
No functional change.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 22fcc21..07326e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1858,6 +1858,7 @@ if test -n "$with_vulkan_drivers"; then
 ;;
 xradeon)
 PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= 
$LIBDRM_AMDGPU_REQUIRED])
+radeon_llvm_check "radv" "3" "9" "0"
 HAVE_RADEON_VULKAN=yes;
 if test "x$with_sha1" == "x"; then
 AC_MSG_ERROR([radv vulkan driver requires SHA1])
@@ -2507,10 +2508,6 @@ if test -n "$with_gallium_drivers"; then
 done
 fi
 
-if test "x$HAVE_RADEON_VULKAN" = "xyes"; then
-radeon_llvm_check "radv" "3" "9" "0"
-fi
-
 dnl Set LLVM_LIBS - This is done after the driver configuration so
 dnl that drivers can add additional components to LLVM_COMPONENTS.
 dnl Previously, gallium drivers were updating LLVM_LIBS directly

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


Mesa (master): configure.ac: Only add default LLVM components if needed

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 45c8a4ea0a19f092c69ed9cd0f0a2cab81716d02
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=45c8a4ea0a19f092c69ed9cd0f0a2cab81716d02

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:09 2016 +0100

configure.ac: Only add default LLVM components if needed

LLVM components are only added when LLVM is needed.
This means gallium adds this as soon as "--enable-gallium-llvm"
is "yes" and radv + opencl add it explicitly.

v5:
Removed hunk that disabled LLVM for gallium if it was not found.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index cd42bdd..3acaa44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -899,7 +899,11 @@ llvm_add_component() {
 new_llvm_component=$1
 driver_name=$2
 
-LLVM_COMPONENTS="$LLVM_COMPONENTS $new_llvm_component"
+if $LLVM_CONFIG --components | grep -iqw $new_llvm_component ; then
+LLVM_COMPONENTS="${LLVM_COMPONENTS} ${new_llvm_component}"
+else
+AC_MSG_ERROR([LLVM component '$new_llvm_component' not enabled in your 
LLVM build. Required by $driver_name.])
+fi
 }
 
 llvm_add_default_components() {
@@ -982,8 +986,6 @@ llvm_set_environment_variables() {
 LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 
's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
 fi
 
-llvm_add_default_components "gallium"
-
 DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
 MESA_LLVM=1
 else
@@ -1009,6 +1011,7 @@ radeon_llvm_check() {
 
 llvm_add_target $amdgpu_llvm_target_name $4
 
+llvm_add_default_components $4
 llvm_add_component "bitreader" $4
 llvm_add_component "ipo" $4
 
@@ -2134,6 +2137,7 @@ if test "x$enable_opencl" = xyes; then
 
 llvm_check_version_for "3" "6" "0" "opencl"
 
+llvm_add_default_components "opencl"
 llvm_add_component "all-targets" "opencl"
 llvm_add_component "linker" "opencl"
 llvm_add_component "instrumentation" "opencl"
@@ -2508,6 +2512,11 @@ if test -n "$with_gallium_drivers"; then
 done
 fi
 
+if test "x$enable_gallium_llvm" == "xyes"; then
+llvm_check_version_for "3" "3" "0" "gallium"
+llvm_add_default_components "gallium"
+fi
+
 dnl Set LLVM_LIBS - This is done after the driver configuration so
 dnl that drivers can add additional components to LLVM_COMPONENTS.
 dnl Previously, gallium drivers were updating LLVM_LIBS directly

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


Mesa (master): configure.ac: Move LLVM functions to the top

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 0cc4ffd67b7a9fa8d9f22aab0834f9eb004b659f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0cc4ffd67b7a9fa8d9f22aab0834f9eb004b659f

Author: Tobias Droste 
Date:   Sat Nov 19 02:38:58 2016 +0100

configure.ac: Move LLVM functions to the top

This just moves code around so that all LLVM related stuff is at the
top of the file in the correct order.
No functional change.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 151 +--
 1 file changed, 74 insertions(+), 77 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4b36726..4add91e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -866,6 +866,27 @@ AC_SUBST([SELINUX_LIBS])
 dnl
 dnl LLVM
 dnl
+AC_ARG_ENABLE([llvm-shared-libs],
+[AS_HELP_STRING([--enable-llvm-shared-libs],
+[link with LLVM shared libraries @<:@default=enabled@:>@])],
+[enable_llvm_shared_libs="$enableval"],
+[enable_llvm_shared_libs=yes])
+
+AC_ARG_WITH([llvm-prefix],
+[AS_HELP_STRING([--with-llvm-prefix],
+[Prefix for LLVM installations in non-standard locations])],
+[llvm_prefix="$withval"],
+[llvm_prefix=''])
+
+PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
+if test "x$have_libelf" = xno; then
+   LIBELF_LIBS=''
+   LIBELF_CFLAGS=''
+   AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;LIBELF_LIBS=-lelf], 
[have_libelf=no])
+   AC_SUBST([LIBELF_LIBS])
+   AC_SUBST([LIBELF_CFLAGS])
+fi
+
 llvm_add_component() {
 new_llvm_component=$1
 driver_name=$2
@@ -899,6 +920,33 @@ llvm_add_target() {
 fi
 }
 
+# Call this inside ` ` to get the return value.
+# $1 is the llvm-config command with arguments.
+strip_unwanted_llvm_flags() {
+# Use \> (marks the end of the word)
+echo `$1` | sed \
+-e 's/-march=\S*//g' \
+-e 's/-mtune=\S*//g' \
+-e 's/-mcpu=\S*//g' \
+-e 's/-DNDEBUG\>//g' \
+-e 's/-D_GNU_SOURCE\>//g' \
+-e 's/-pedantic\>//g' \
+-e 's/-Wcovered-switch-default\>//g' \
+-e 's/-O.\>//g' \
+-e 's/-g\>//g' \
+-e 's/-Wall\>//g' \
+-e 's/-Wcast-qual\>//g' \
+-e 's/-Woverloaded-virtual\>//g' \
+-e 's/-fcolor-diagnostics\>//g' \
+-e 's/-fdata-sections\>//g' \
+-e 's/-ffunction-sections\>//g' \
+-e 's/-fno-exceptions\>//g' \
+-e 's/-fomit-frame-pointer\>//g' \
+-e 's/-fvisibility-inlines-hidden\>//g' \
+-e 's/-fPIC\>//g' \
+-e 's/-fstack-protector-strong\>//g'
+}
+
 llvm_set_environment_variables() {
 if test -z "$LLVM_CONFIG"; then
 if test -n "$llvm_prefix"; then
@@ -972,6 +1020,32 @@ llvm_set_environment_variables() {
 fi
 }
 
+llvm_check_version_for() {
+if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; 
then
+AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
+fi
+}
+
+radeon_llvm_check() {
+if test ${LLVM_VERSION_INT} -lt 307; then
+amdgpu_llvm_target_name='r600'
+else
+amdgpu_llvm_target_name='amdgpu'
+fi
+
+llvm_check_version_for $2 $3 $4 $1
+
+llvm_add_target $amdgpu_llvm_target_name $1
+
+llvm_add_component "bitreader" $1
+llvm_add_component "ipo" $1
+
+NEED_RADEON_LLVM=yes
+if test "x$have_libelf" != xyes; then
+   AC_MSG_ERROR([$1 requires libelf when using llvm])
+fi
+}
+
 dnl Options for APIs
 AC_ARG_ENABLE([opengl],
 [AS_HELP_STRING([--disable-opengl],
@@ -2040,15 +2114,6 @@ AC_ARG_WITH([clang-libdir],
[CLANG_LIBDIR=''])
 
 PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
-PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
-
-if test "x$have_libelf" = xno; then
-   LIBELF_LIBS=''
-   LIBELF_CFLAGS=''
-   AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;LIBELF_LIBS=-lelf], 
[have_libelf=no])
-   AC_SUBST([LIBELF_LIBS])
-   AC_SUBST([LIBELF_CFLAGS])
-fi
 
 if test "x$enable_opencl" = xyes; then
 if test -z "$with_gallium_drivers"; then
@@ -2218,54 +2283,6 @@ AC_ARG_ENABLE([gallium-llvm],
 [enable_gallium_llvm="$enableval"],
 [enable_gallium_llvm=auto])
 
-AC_ARG_ENABLE([llvm-shared-libs],
-[AS_HELP_STRING([--enable-llvm-shared-libs],
-[link with LLVM shared libraries @<:@default=enabled@:>@])],
-[enable_llvm_shared_libs="$enableval"],
-[enable_llvm_shared_libs=yes])
-
-AC_ARG_WITH([llvm-prefix],
-[AS_HELP_STRING([--with-llvm-prefix],
-[Prefix for LLVM installations in non-standard locations])],
-[llvm_prefix="$withval"],
-[llvm_prefix=''])
-
-
-# Call this inside ` ` to get the return value.
-# $1 is the llvm-config command with arguments.
-strip_unwanted_llvm_flags() {
-# Use \> (marks the end of the word)
-echo `$1` | sed \
-   -e 's/-march=\S*//g' \
-   -e 's/-mtune=\S*//g' \
-   -e 's/-mcpu=\S*//g' \
-   -e 's/-DNDEBUG\>//g' \
-   -e 's/-D_GNU_SOURCE\>//g' \
-

Mesa (master): configure.ac: Don't search llvm-config if it's known

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 2350387d24d6f2470450ee9e78792a9ee957034b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2350387d24d6f2470450ee9e78792a9ee957034b

Author: Tobias Droste 
Date:   Sat Nov 19 02:38:53 2016 +0100

configure.ac: Don't search llvm-config if it's known

This way LLVM_CONFIG can bet set from an env variable if it's outside
the $llvm_prefix.

This is not a must, but it helps testing.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index f62bc61..fbe6fda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2166,10 +2166,12 @@ if test "x$enable_gallium_llvm" = xauto; then
 esac
 fi
 if test "x$enable_gallium_llvm" = xyes || test "x$HAVE_RADEON_VULKAN" = xyes; 
then
-if test -n "$llvm_prefix"; then
-AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
-else
-AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
+if test -z "$LLVM_CONFIG"; then
+if test -n "$llvm_prefix"; then
+AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], 
["$llvm_prefix/bin"])
+else
+AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
+fi
 fi
 
 if test "x$LLVM_CONFIG" != xno; then

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


Mesa (master): configure.ac: Use new llvm_add_default_components

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: d434633b76108f0e1e456fc91e8eed8df51553e8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d434633b76108f0e1e456fc91e8eed8df51553e8

Author: Tobias Droste 
Date:   Sat Nov 19 02:38:55 2016 +0100

configure.ac: Use new llvm_add_default_components

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 08f511c..82b9e5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2242,11 +2242,7 @@ if test "x$enable_gallium_llvm" = xyes || test 
"x$HAVE_RADEON_VULKAN" = xyes; th
 AC_MSG_ERROR([LLVM 
$LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
 fi
 
-LLVM_COMPONENTS="engine bitwriter mcjit mcdisassembler"
-
-if $LLVM_CONFIG --components | grep -q inteljitevents ; then
-LLVM_COMPONENTS="${LLVM_COMPONENTS} inteljitevents"
-fi
+llvm_add_default_components "gallium"
 
 if test "x$enable_opencl" = xyes; then
 llvm_check_version_for "3" "6" "0" "opencl"

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


Mesa (master): configure.ac: Create correct LLVM_VERSION_INT with minor >= 10

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 0e9a5be7e74fa2a9bd2a634ef60822bd6600ca1d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e9a5be7e74fa2a9bd2a634ef60822bd6600ca1d

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:12 2016 +0100

configure.ac: Create correct LLVM_VERSION_INT with minor >= 10

This makes sure that we handle LLVM minor version >= 10 correctly.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index e731cf9..adca49d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -990,7 +990,11 @@ llvm_set_environment_variables() {
 LLVM_VERSION_PATCH=0
 fi
 
-LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
+if test "$LLVM_VERSION_MINOR" -lt 10; then
+LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
+else
+LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}"
+fi
 
 DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
 MESA_LLVM=1

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


Mesa (master): configure.ac: Add required LLVM versions to the top

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

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:10 2016 +0100

configure.ac: Add required LLVM versions to the top

Consolidate the required LLVM versions at the top where the other
versions for dependencies are listed.

v5:
Splitted out separate changes (see patch 19 and 20)

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 68 +++-
 1 file changed, 54 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3acaa44..b54eef3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,6 +92,14 @@ XVMC_REQUIRED=1.0.6
 PYTHON_MAKO_REQUIRED=0.8.0
 LIBSENSORS_REQUIRED=4.0.0
 
+dnl LLVM versions
+LLVM_REQUIRED_GALLIUM=3.3.0
+LLVM_REQUIRED_OPENCL=3.6.0
+LLVM_REQUIRED_R600=3.6.0
+LLVM_REQUIRED_RADEONSI=3.6.0
+LLVM_REQUIRED_RADV=3.9.0
+LLVM_REQUIRED_SWR=3.6.0
+
 dnl Check for progs
 AC_PROG_CPP
 AC_PROG_CC
@@ -995,9 +1003,41 @@ llvm_set_environment_variables() {
 }
 
 llvm_check_version_for() {
-if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; 
then
-AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
+if test "x$MESA_LLVM" = x0; then
+AC_MSG_ERROR([LLVM $1 or newer is required for $2])
+return
+fi
+
+llvm_target_version_major=`echo $1 | cut -d. -f1 | egrep -o '^[[0-9]]+'`
+llvm_target_version_minor=`echo $1 | cut -d. -f2 | egrep -o '^[[0-9]]+'`
+llvm_target_version_patch=`echo $1 | cut -d. -f3 | egrep -o '^[[0-9]]+'`
+
+if test "$LLVM_VERSION_MAJOR" -gt "$llvm_target_version_major"; then
+# major > required major
+#  --> OK
+return
 fi
+
+if test "$LLVM_VERSION_MAJOR" -eq "$llvm_target_version_major"; then
+if test "$LLVM_VERSION_MINOR" -gt "$llvm_target_version_minor"; then
+# major = required major and
+# minor > required minor
+#  --> OK
+return
+else
+if test "$LLVM_VERSION_MINOR" -eq "$llvm_target_version_minor"; 
then
+if test "$LLVM_VERSION_PATCH" -ge 
"$llvm_target_version_patch"; then
+# major = required major and
+# minor = required minor and
+# patch >= required patch
+#  --> OK
+return
+fi
+fi
+fi
+fi
+
+AC_MSG_ERROR([LLVM $1 or newer is required for $2])
 }
 
 radeon_llvm_check() {
@@ -1009,11 +1049,11 @@ radeon_llvm_check() {
 
 llvm_check_version_for $*
 
-llvm_add_target $amdgpu_llvm_target_name $4
+llvm_add_target $amdgpu_llvm_target_name $2
 
-llvm_add_default_components $4
-llvm_add_component "bitreader" $4
-llvm_add_component "ipo" $4
+llvm_add_default_components $2
+llvm_add_component "bitreader" $2
+llvm_add_component "ipo" $2
 
 NEED_RADEON_LLVM=yes
 if test "x$have_libelf" != xyes; then
@@ -1861,7 +1901,7 @@ if test -n "$with_vulkan_drivers"; then
 ;;
 xradeon)
 PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= 
$LIBDRM_AMDGPU_REQUIRED])
-radeon_llvm_check "3" "9" "0" "radv"
+radeon_llvm_check $LLVM_REQUIRED_RADV "radv"
 HAVE_RADEON_VULKAN=yes;
 if test "x$with_sha1" == "x"; then
 AC_MSG_ERROR([radv vulkan driver requires SHA1])
@@ -2135,7 +2175,7 @@ if test "x$enable_opencl" = xyes; then
AC_MSG_ERROR([Clover requires libelf])
 fi
 
-llvm_check_version_for "3" "6" "0" "opencl"
+llvm_check_version_for $LLVM_REQUIRED_OPENCL "opencl"
 
 llvm_add_default_components "opencl"
 llvm_add_component "all-targets" "opencl"
@@ -2340,7 +2380,7 @@ dnl Gallium helper functions
 dnl
 gallium_require_llvm() {
 if test "x$enable_gallium_llvm" == "xyes"; then
-llvm_check_version_for "3" "3" "0" "gallium"
+llvm_check_version_for $LLVM_REQUIRED_GALLIUM "gallium"
 else
 AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
 fi
@@ -2365,7 +2405,7 @@ require_basic_egl() {
 
 radeon_gallium_llvm_check() {
 if test "x$enable_gallium_llvm" != "xyes"; then
-AC_MSG_ERROR([--enable-gallium-llvm is required when building $4])
+AC_MSG_ERROR([--enable-gallium-llvm is required when building $2])
 fi
 radeon_llvm_check $*
 }
@@ -2439,7 +2479,7 @@ if test -n "$with_gallium_drivers"; then
 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= 
$LIBDRM_RADEON_REQUIRED])
 require_libdrm "r600"
 if test "x$enable_opencl" = xyes; then
-radeon_gallium_llvm_check "3" "6" "0" "r600"
+radeon_gallium_llvm_check $LLVM_REQUIRED_R600 "r600"
 
 llvm_add_component "asmparser" "r600"
 llvm_add_compone

Mesa (master): configure.ac: Add helper function for targets/components

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 352831c5d9fcef43804ed2153d509b2d43cf44e9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=352831c5d9fcef43804ed2153d509b2d43cf44e9

Author: Tobias Droste 
Date:   Sat Nov 19 02:38:54 2016 +0100

configure.ac: Add helper function for targets/components

Add functions to add and check targets/components.
Not used in this patch.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 36 
 1 file changed, 36 insertions(+)

diff --git a/configure.ac b/configure.ac
index fbe6fda..08f511c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -863,6 +863,42 @@ fi
 AC_SUBST([SELINUX_CFLAGS])
 AC_SUBST([SELINUX_LIBS])
 
+dnl
+dnl LLVM
+dnl
+llvm_add_component() {
+new_llvm_component=$1
+driver_name=$2
+
+LLVM_COMPONENTS="$LLVM_COMPONENTS $new_llvm_component"
+}
+
+llvm_add_default_components() {
+driver_name=$1
+
+# Required default components
+llvm_add_component "bitwriter" $driver_name
+llvm_add_component "engine" $driver_name
+llvm_add_component "mcdisassembler" $driver_name
+llvm_add_component "mcjit" $driver_name
+
+# Optional default components
+if $LLVM_CONFIG --components | grep -iqw inteljitevents ; then
+LLVM_COMPONENTS="$LLVM_COMPONENTS inteljitevents"
+fi
+}
+
+llvm_add_target() {
+new_llvm_target=$1
+driver_name=$2
+
+if $LLVM_CONFIG --targets-built | grep -iqw $new_llvm_target ; then
+llvm_add_component $new_llvm_target $driver_name
+else
+AC_MSG_ERROR([LLVM target '$new_llvm_target' not enabled in your LLVM 
build. Required by $driver_name.])
+fi
+}
+
 dnl Options for APIs
 AC_ARG_ENABLE([opengl],
 [AS_HELP_STRING([--disable-opengl],

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


Mesa (master): configure.ac: Move LLVM ac_subst closer to usage

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: c702369bf514cf08ec5699e5be15badb069d6e96
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c702369bf514cf08ec5699e5be15badb069d6e96

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:06 2016 +0100

configure.ac: Move LLVM ac_subst closer to usage

This moves llvm_set_environment_variables to its final destination
and moves all the LLVM AC_SUBST() below the function call.
No functional change.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 29 ++---
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0a82dda..22fcc21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1018,6 +1018,19 @@ radeon_llvm_check() {
 fi
 }
 
+llvm_set_environment_variables
+
+AC_SUBST([MESA_LLVM])
+AC_SUBST([LLVM_BINDIR])
+AC_SUBST([LLVM_CFLAGS])
+AC_SUBST([LLVM_CPPFLAGS])
+AC_SUBST([LLVM_CXXFLAGS])
+AC_SUBST([LLVM_LIBDIR])
+AC_SUBST([LLVM_LIBS])
+AC_SUBST([LLVM_LDFLAGS])
+AC_SUBST([LLVM_INCLUDEDIR])
+AC_SUBST([LLVM_VERSION])
+
 dnl Options for APIs
 AC_ARG_ENABLE([opengl],
 [AS_HELP_STRING([--disable-opengl],
@@ -1167,8 +1180,6 @@ AC_ARG_ENABLE([gallium-tests],
 [enable_gallium_tests="$enableval"],
 [enable_gallium_tests=no])
 
-llvm_set_environment_variables
-
 # Option for Gallium drivers
 
 # Keep this in sync with the --with-gallium-drivers help string default value
@@ -1375,8 +1386,6 @@ if test "x$enable_gallium_osmesa" = xyes; then
 fi
 fi
 
-AC_SUBST([MESA_LLVM])
-
 # SHA1 hashing
 AC_ARG_WITH([sha1],
 
[AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
@@ -2144,23 +2153,13 @@ fi
 AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
 AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
 AC_SUBST([OPENCL_LIBNAME])
+AC_SUBST([CLANG_RESOURCE_DIR])
 
 dnl
 dnl Gallium configuration
 dnl
 AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
 
-AC_SUBST([LLVM_BINDIR])
-AC_SUBST([LLVM_CFLAGS])
-AC_SUBST([LLVM_CPPFLAGS])
-AC_SUBST([LLVM_CXXFLAGS])
-AC_SUBST([LLVM_LIBDIR])
-AC_SUBST([LLVM_LIBS])
-AC_SUBST([LLVM_LDFLAGS])
-AC_SUBST([LLVM_INCLUDEDIR])
-AC_SUBST([LLVM_VERSION])
-AC_SUBST([CLANG_RESOURCE_DIR])
-
 case "x$enable_opengl$enable_gles1$enable_gles2" in
 x*yes*)
 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'

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


Mesa (master): configure.ac: Move oCL LLVM checks to the oCL section

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 62f4e6f2726c34357e274fcc1ef934f96c498ba2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=62f4e6f2726c34357e274fcc1ef934f96c498ba2

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:05 2016 +0100

configure.ac: Move oCL LLVM checks to the oCL section

The LLVM checks can be anywhere below line 1161 now.
Move the openCL LLVM checks to the section with the other openCL checks.
No functional change.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 
[Emil Velikov: s/ipos/ipo/, drop "yes" argument from llvm_add_component]
Signed-off-by: Emil Velikov 

---

 configure.ac | 41 +++--
 1 file changed, 19 insertions(+), 22 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3e9972c..0a82dda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -984,30 +984,8 @@ llvm_set_environment_variables() {
 
 llvm_add_default_components "gallium"
 
-if test "x$enable_opencl" = xyes; then
-llvm_check_version_for "3" "6" "0" "opencl"
-
-llvm_add_component "all-targets" "opencl"
-llvm_add_component "ipo" "opencl"
-llvm_add_component "linker" "opencl"
-llvm_add_component "instrumentation" "opencl"
-llvm_add_component "irreader" "opencl"
-llvm_add_component "option" "opencl"
-llvm_add_component "objcarcopts" "opencl"
-llvm_add_component "profiledata" "opencl"
-fi
 DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
 MESA_LLVM=1
-
-dnl Check for Clang internal headers
-if test "x$enable_opencl" = xyes; then
-if test -z "$CLANG_LIBDIR"; then
-CLANG_LIBDIR=${LLVM_LIBDIR}
-fi
-CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
-AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
-[AC_MSG_ERROR([Could not find clang internal header stddef.h 
in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to 
the clang libraries.])])
-fi
 else
 MESA_LLVM=0
 LLVM_VERSION_INT=0
@@ -2143,6 +2121,25 @@ if test "x$enable_opencl" = xyes; then
 if test "x$have_libelf" != xyes; then
AC_MSG_ERROR([Clover requires libelf])
 fi
+
+llvm_check_version_for "3" "6" "0" "opencl"
+
+llvm_add_component "all-targets" "opencl"
+llvm_add_component "linker" "opencl"
+llvm_add_component "instrumentation" "opencl"
+llvm_add_component "ipo" "opencl"
+llvm_add_component "irreader" "opencl"
+llvm_add_component "option" "opencl"
+llvm_add_component "objcarcopts" "opencl"
+llvm_add_component "profiledata" "opencl"
+
+dnl Check for Clang internal headers
+if test -z "$CLANG_LIBDIR"; then
+CLANG_LIBDIR=${LLVM_LIBDIR}
+fi
+CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
+[AC_MSG_ERROR([Could not find clang internal header stddef.h in 
$CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the 
clang libraries.])])
 fi
 AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
 AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)

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


Mesa (master): configure.ac: Remove swr_llvm_check()

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 19ff3975de6947bb8c6bfddff8e599c737f9185f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=19ff3975de6947bb8c6bfddff8e599c737f9185f

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:03 2016 +0100

configure.ac: Remove swr_llvm_check()

No need for an additional function here.
Use the same style for LLVM checks as the other drivers
(e.g. r300, llvmpipe) that don't need a load of other checks.
Instead of open conding the LLVM version check, use the
function used by other drivers.

"enable_gallium_llvm" is checked by gallium_require_llvm().

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index b52dc71..1de6b7e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2373,16 +2373,6 @@ radeon_gallium_llvm_check() {
 radeon_llvm_check $*
 }
 
-swr_llvm_check() {
-gallium_require_llvm $1
-if test ${LLVM_VERSION_INT} -lt 306; then
-AC_MSG_ERROR([LLVM version 3.6 or later required when building $1])
-fi
-if test "x$enable_gallium_llvm" != "xyes"; then
-AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
-fi
-}
-
 swr_require_cxx_feature_flags() {
 feature_name="$1"
 preprocessor_test="$2"
@@ -2483,7 +2473,8 @@ if test -n "$with_gallium_drivers"; then
 fi
 ;;
 xswr)
-swr_llvm_check "swr"
+llvm_check_version_for "3" "6" "0" "swr"
+gallium_require_llvm "swr"
 
 swr_require_cxx_feature_flags "C++11" "__cplusplus >= 201103L" \
 ",-std=c++11" \

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


Mesa (master): configure.ac: Get complete LLVM version from header

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: a66cd76b16cf561c102314a6ee021727c03e52f7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a66cd76b16cf561c102314a6ee021727c03e52f7

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:11 2016 +0100

configure.ac: Get complete LLVM version from header

Major and minor version are included in the header file since LLVM
version 3.1.0. Since the minimal required version is 3.3.0 we can
remove the workaround if no values for major/minor were found in the
header.

Since LLVM 3.6.0 the patch version is inside the header file of LLVM.
Only radeon drivers need the patch version and they depend on
LLVM >= 3.6.0, so this is safe too.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index b54eef3..e731cf9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -982,17 +982,15 @@ llvm_set_environment_variables() {
 [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
 AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
 [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
+AC_COMPUTE_INT([LLVM_VERSION_PATCH], [LLVM_VERSION_PATCH],
+[#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
 
-LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o 
'^[[0-9]]+'`
+# Only needed for LLVM < 3.6.0
 if test -z "$LLVM_VERSION_PATCH"; then
 LLVM_VERSION_PATCH=0
 fi
 
-if test -n "${LLVM_VERSION_MAJOR}"; then
-LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
-else
-LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 
's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
-fi
+LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
 
 DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
 MESA_LLVM=1

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


Mesa (master): configure.ac: Move LLVM version check to the top

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: bf4b0fc33b1ddec47041bbc826485dbff0536318
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf4b0fc33b1ddec47041bbc826485dbff0536318

Author: Tobias Droste 
Date:   Sat Nov 19 02:38:57 2016 +0100

configure.ac: Move LLVM version check to the top

A function with the LLVM version checked is moved to the top.
The function is called where the old code was.
No functional change.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 
[Emil Velikov: s/ipos/ipo/, drop "yes" argument from llvm_add_component]
Signed-off-by: Emil Velikov 

---

 configure.ac | 144 ++-
 1 file changed, 74 insertions(+), 70 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4780f7d..4b36726 100644
--- a/configure.ac
+++ b/configure.ac
@@ -899,6 +899,79 @@ llvm_add_target() {
 fi
 }
 
+llvm_set_environment_variables() {
+if test -z "$LLVM_CONFIG"; then
+if test -n "$llvm_prefix"; then
+AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], 
["$llvm_prefix/bin"])
+else
+AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
+fi
+fi
+
+if test "x$LLVM_CONFIG" != xno; then
+LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
+LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
+LLVM_BINDIR=`$LLVM_CONFIG --bindir`
+LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
+LLVM_CFLAGS=$LLVM_CPPFLAGS   # CPPFLAGS seem to be sufficient
+LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
+LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
+LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
+
+AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
+[#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
+AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
+[#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
+
+LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o 
'^[[0-9]]+'`
+if test -z "$LLVM_VERSION_PATCH"; then
+LLVM_VERSION_PATCH=0
+fi
+
+if test -n "${LLVM_VERSION_MAJOR}"; then
+LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
+else
+LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 
's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
+fi
+
+LLVM_REQUIRED_VERSION_MAJOR="3"
+LLVM_REQUIRED_VERSION_MINOR="3"
+if test "$LLVM_VERSION_INT" -lt 
"${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
+AC_MSG_ERROR([LLVM 
$LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
+fi
+
+llvm_add_default_components "gallium"
+
+if test "x$enable_opencl" = xyes; then
+llvm_check_version_for "3" "6" "0" "opencl"
+
+llvm_add_component "all-targets" "opencl"
+llvm_add_component "ipo" "opencl"
+llvm_add_component "linker" "opencl"
+llvm_add_component "instrumentation" "opencl"
+llvm_add_component "irreader" "opencl"
+llvm_add_component "option" "opencl"
+llvm_add_component "objcarcopts" "opencl"
+llvm_add_component "profiledata" "opencl"
+fi
+DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
+MESA_LLVM=1
+
+dnl Check for Clang internal headers
+if test "x$enable_opencl" = xyes; then
+if test -z "$CLANG_LIBDIR"; then
+CLANG_LIBDIR=${LLVM_LIBDIR}
+fi
+CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
+[AC_MSG_ERROR([Could not find clang internal header stddef.h 
in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to 
the clang libraries.])])
+fi
+else
+MESA_LLVM=0
+LLVM_VERSION_INT=0
+fi
+}
+
 dnl Options for APIs
 AC_ARG_ENABLE([opengl],
 [AS_HELP_STRING([--disable-opengl],
@@ -2202,76 +2275,7 @@ if test "x$enable_gallium_llvm" = xauto; then
 esac
 fi
 if test "x$enable_gallium_llvm" = xyes || test "x$HAVE_RADEON_VULKAN" = xyes; 
then
-if test -z "$LLVM_CONFIG"; then
-if test -n "$llvm_prefix"; then
-AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], 
["$llvm_prefix/bin"])
-else
-AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
-fi
-fi
-
-if test "x$LLVM_CONFIG" != xno; then
-LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
-LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
-LLVM_BINDIR=`$LLVM_CONFIG --bindir`
-LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
-LLVM_CFLAGS=$LLVM_CPPFLAGS   # CPPFLAGS seem to be sufficient
-LLVM_CXXFLAGS=`strip_unwanted_llvm_flags 

Mesa (master): configure.ac: Remove useless oCL LLVM check

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

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:00 2016 +0100

configure.ac: Remove useless oCL LLVM check

This is handled by "llvm_check_version_for" for openCL.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 4 
 1 file changed, 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 78eb8cb..ea0354a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2296,10 +2296,6 @@ if test "x$enable_gallium_llvm" = xyes || test 
"x$HAVE_RADEON_VULKAN" = xyes; th
 else
 MESA_LLVM=0
 LLVM_VERSION_INT=0
-
-if test "x$enable_opencl" = xyes; then
-AC_MSG_ERROR([cannot enable OpenCL without LLVM])
-fi
 fi
 
 dnl Directory for XVMC libs

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


Mesa (master): configure.ac: Check gallium LLVM version in gallium_require_llvm

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: b3119a3360824a93e193b326a57f71cda15bc96f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3119a3360824a93e193b326a57f71cda15bc96f

Author: Tobias Droste 
Date:   Sat Nov 19 02:39:02 2016 +0100

configure.ac: Check gallium LLVM version in gallium_require_llvm

This moves the LLVM version check to the helper function
gallium_require_llvm() and uses the llvm_check_version_for() helper
instead of open conding the LLVM version check.

gallium_require_llvm is functionally the same as before, because
"enable_gallium_llvm" is only set to "yes" if the host cpu is x86:

if test "x$enable_gallium_llvm" = xauto; then
case "$host_cpu" in
i*86|x86_64|amd64) enable_gallium_llvm=yes;;
esac
fi

This function is also only called now when needed.
Before this patch llvmpipe would call this as soon as LLVM is
installed. Now it only gets called by llvmpipe if gallium
LLVM is actually enabled (i.e. only on x86).

Both reasons mentioned above remove the need to check host cpu
in the gallium_require_llvm function.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 17 +
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7557733..b52dc71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -982,12 +982,6 @@ llvm_set_environment_variables() {
 LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 
's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
 fi
 
-LLVM_REQUIRED_VERSION_MAJOR="3"
-LLVM_REQUIRED_VERSION_MINOR="3"
-if test "$LLVM_VERSION_INT" -lt 
"${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
-AC_MSG_ERROR([LLVM 
$LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
-fi
-
 llvm_add_default_components "gallium"
 
 if test "x$enable_opencl" = xyes; then
@@ -2348,11 +2342,10 @@ dnl
 dnl Gallium helper functions
 dnl
 gallium_require_llvm() {
-if test "x$MESA_LLVM" = x0; then
-case "$host" in *gnux32) return;; esac
-case "$host_cpu" in
-i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on x86 
and x86_64]);;
-esac
+if test "x$enable_gallium_llvm" == "xyes"; then
+llvm_check_version_for "3" "3" "0" "gallium"
+else
+AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
 fi
 }
 
@@ -2485,7 +2478,7 @@ if test -n "$with_gallium_drivers"; then
 ;;
 xswrast)
 HAVE_GALLIUM_SOFTPIPE=yes
-if test "x$MESA_LLVM" = x1; then
+if test "x$MESA_LLVM" = x1 && test "x$enable_gallium_llvm" == 
"xyes";  then
 HAVE_GALLIUM_LLVMPIPE=yes
 fi
 ;;

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


Mesa (master): configure.ac: Move llvm-config searching outside the function

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 8c98e27074240a97daadddb0ba3a7e40cc7a646d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c98e27074240a97daadddb0ba3a7e40cc7a646d

Author: Tobias Droste 
Date:   Sat Nov 19 02:38:59 2016 +0100

configure.ac: Move llvm-config searching outside the function

There's no harm in always searching llvm-config.
This way it's available as soon as possible for all functions.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 

---

 configure.ac | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4add91e..78eb8cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -887,6 +887,14 @@ if test "x$have_libelf" = xno; then
AC_SUBST([LIBELF_CFLAGS])
 fi
 
+if test -z "$LLVM_CONFIG"; then
+if test -n "$llvm_prefix"; then
+AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
+else
+AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
+fi
+fi
+
 llvm_add_component() {
 new_llvm_component=$1
 driver_name=$2
@@ -948,14 +956,6 @@ strip_unwanted_llvm_flags() {
 }
 
 llvm_set_environment_variables() {
-if test -z "$LLVM_CONFIG"; then
-if test -n "$llvm_prefix"; then
-AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], 
["$llvm_prefix/bin"])
-else
-AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
-fi
-fi
-
 if test "x$LLVM_CONFIG" != xno; then
 LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`

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


Mesa (master): configure.ac: Use new helper function for LLVM

2016-12-05 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 9a3bccc75e82397f3331e0923b8530af2309d1cd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a3bccc75e82397f3331e0923b8530af2309d1cd

Author: Tobias Droste 
Date:   Sat Nov 19 02:38:56 2016 +0100

configure.ac: Use new helper function for LLVM

Use the new helper function to add LLVM targets and components.
The components are added one by one to later find out which component
is missing in case there is one.

Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov 
[Emil Velikov: s/ipos/ipo/, drop "yes" argument from llvm_add_component]
Signed-off-by: Emil Velikov 

---

 configure.ac | 25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 82b9e5f..4780f7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2247,8 +2247,14 @@ if test "x$enable_gallium_llvm" = xyes || test 
"x$HAVE_RADEON_VULKAN" = xyes; th
 if test "x$enable_opencl" = xyes; then
 llvm_check_version_for "3" "6" "0" "opencl"
 
-LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker 
instrumentation"
-LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts 
profiledata"
+llvm_add_component "all-targets" "opencl"
+llvm_add_component "ipo" "opencl"
+llvm_add_component "linker" "opencl"
+llvm_add_component "instrumentation" "opencl"
+llvm_add_component "irreader" "opencl"
+llvm_add_component "option" "opencl"
+llvm_add_component "objcarcopts" "opencl"
+llvm_add_component "profiledata" "opencl"
 fi
 DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
 MESA_LLVM=1
@@ -2356,11 +2362,14 @@ radeon_llvm_check() {
 else
 amdgpu_llvm_target_name='amdgpu'
 fi
+
 llvm_check_version_for $2 $3 $4 $1
-if test true && $LLVM_CONFIG --targets-built | grep -iqvw 
$amdgpu_llvm_target_name ; then
-AC_MSG_ERROR([LLVM $amdgpu_llvm_target_name not enabled in your LLVM 
build.])
-fi
-LLVM_COMPONENTS="${LLVM_COMPONENTS} $amdgpu_llvm_target_name bitreader ipo"
+
+llvm_add_target $amdgpu_llvm_target_name $1
+
+llvm_add_component "bitreader" $1
+llvm_add_component "ipo" $1
+
 NEED_RADEON_LLVM=yes
 if test "x$have_libelf" != xyes; then
AC_MSG_ERROR([$1 requires libelf when using llvm])
@@ -2454,7 +2463,9 @@ if test -n "$with_gallium_drivers"; then
 require_libdrm "Gallium R600"
 if test "x$enable_opencl" = xyes; then
 radeon_gallium_llvm_check "r600g" "3" "6" "0"
-LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
+
+llvm_add_component "asmparser" "r600"
+llvm_add_component "bitreader" "r600"
 fi
 ;;
 xradeonsi)

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


Mesa (master): st/va: fix gop size for rate control

2016-12-05 Thread Leo Liu
Module: Mesa
Branch: master
Commit: 3949d7c6ead25e6191c6529a1805ba7ada6892cc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3949d7c6ead25e6191c6529a1805ba7ada6892cc

Author: Boyuan Zhang 
Date:   Fri Nov 18 15:29:56 2016 -0500

st/va: fix gop size for rate control

The gop_size in rate control is the budget window for internal rate
control calculation, and shouldn't always equal to idr period. Define
a coefficient to let budget window contains a number of idr period for
proper rate control calculation. Adjust the number of i/p frame remaining
accordingly.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98005

Signed-off-by: Boyuan Zhang 
Acked-by: Christian König 

---

 src/gallium/state_trackers/va/picture.c| 18 --
 src/gallium/state_trackers/va/va_private.h |  2 ++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/va/picture.c 
b/src/gallium/state_trackers/va/picture.c
index 592cdef..b5b9a83 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -351,7 +351,11 @@ handleVAEncSequenceParameterBufferType(vlVaDriver *drv, 
vlVaContext *context, vl
   if (!context->decoder)
  return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
-   context->desc.h264enc.gop_size = h264->intra_idr_period;
+
+   context->gop_coeff = ((1024 + h264->intra_idr_period - 1) / 
h264->intra_idr_period + 1) / 2 * 2;
+   if (context->gop_coeff > VL_VA_ENC_GOP_COEFF)
+  context->gop_coeff = VL_VA_ENC_GOP_COEFF;
+   context->desc.h264enc.gop_size = h264->intra_idr_period * 
context->gop_coeff;
context->desc.h264enc.rate_ctrl.frame_rate_num = h264->time_scale / 2;
context->desc.h264enc.rate_ctrl.frame_rate_den = 1;
return VA_STATUS_SUCCESS;
@@ -391,10 +395,10 @@ handleVAEncPictureParameterBufferType(vlVaDriver *drv, 
vlVaContext *context, vlV
context->desc.h264enc.not_referenced = false;
context->desc.h264enc.is_idr = (h264->pic_fields.bits.idr_pic_flag == 1);
context->desc.h264enc.pic_order_cnt = h264->CurrPic.TopFieldOrderCnt;
-   if (context->desc.h264enc.is_idr)
-  context->desc.h264enc.i_remain = 1;
-   else
-  context->desc.h264enc.i_remain = 0;
+   if (context->desc.h264enc.gop_cnt == 0)
+  context->desc.h264enc.i_remain = context->gop_coeff;
+   else if (context->desc.h264enc.frame_num == 1)
+  context->desc.h264enc.i_remain--;
 
context->desc.h264enc.p_remain = context->desc.h264enc.gop_size - 
context->desc.h264enc.gop_cnt - context->desc.h264enc.i_remain;
 
@@ -578,6 +582,8 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
 
context->decoder->end_frame(context->decoder, context->target, 
&context->desc.base);
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
+  int idr_period = context->desc.h264enc.gop_size / context->gop_coeff;
+  int p_remain_in_idr = idr_period - context->desc.h264enc.frame_num;
   surf->frame_num_cnt = context->desc.h264enc.frame_num_cnt;
   surf->force_flushed = false;
   if (context->first_single_submitted) {
@@ -585,7 +591,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
  context->first_single_submitted = false;
  surf->force_flushed = true;
   }
-  if (context->desc.h264enc.p_remain == 1) {
+  if (p_remain_in_idr == 1) {
  if ((context->desc.h264enc.frame_num_cnt % 2) != 0) {
 context->decoder->flush(context->decoder);
 context->first_single_submitted = true;
diff --git a/src/gallium/state_trackers/va/va_private.h 
b/src/gallium/state_trackers/va/va_private.h
index 9e3ba03..900abbc 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -50,6 +50,7 @@
 #define VL_VA_PSCREEN(ctx) (VL_VA_DRIVER(ctx)->vscreen->pscreen)
 
 #define VL_VA_MAX_IMAGE_FORMATS 9
+#define VL_VA_ENC_GOP_COEFF 16
 
 static inline enum pipe_video_chroma_format
 ChromaToPipe(int format)
@@ -245,6 +246,7 @@ typedef struct {
struct vlVaBuffer *coded_buf;
int target_id;
bool first_single_submitted;
+   int gop_coeff;
 } vlVaContext;
 
 typedef struct {

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


Mesa (master): st/va: force to submit two consecutive single jobs

2016-12-05 Thread Leo Liu
Module: Mesa
Branch: master
Commit: 8206882392c9cc070e21d6fbc90368c94235d8cd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8206882392c9cc070e21d6fbc90368c94235d8cd

Author: Boyuan Zhang 
Date:   Tue Nov 29 13:27:10 2016 -0500

st/va: force to submit two consecutive single jobs

The gop_size in rate control is the budget window for internal rate
control calculation, and shouldn't always equal to idr period. Define
a coefficient to let budget window contains a number of idr period for
proper rate control calculation. Adjust the number of i/p frame remaining
accordingly.

v2: fixed regression issues introduced by previous version

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98005

Signed-off-by: Boyuan Zhang 
Acked-by: Christian König 

---

 src/gallium/state_trackers/va/picture.c| 24 +++-
 src/gallium/state_trackers/va/surface.c|  8 ++--
 src/gallium/state_trackers/va/va_private.h |  2 ++
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/va/picture.c 
b/src/gallium/state_trackers/va/picture.c
index a8102a4..592cdef 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -413,7 +413,6 @@ handleVAEncPictureParameterBufferType(vlVaDriver *drv, 
vlVaContext *context, vlV
context->desc.h264enc.quant_i_frames = h264->pic_init_qp;
context->desc.h264enc.quant_b_frames = h264->pic_init_qp;
context->desc.h264enc.quant_p_frames = h264->pic_init_qp;
-   context->desc.h264enc.frame_num_cnt++;
context->desc.h264enc.gop_cnt++;
if (context->desc.h264enc.gop_cnt == context->desc.h264enc.gop_size)
   context->desc.h264enc.gop_cnt = 0;
@@ -569,18 +568,33 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID 
context_id)
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
   coded_buf = context->coded_buf;
   getEncParamPreset(context);
+  context->desc.h264enc.frame_num_cnt++;
   context->decoder->begin_frame(context->decoder, context->target, 
&context->desc.base);
   context->decoder->encode_bitstream(context->decoder, context->target,
  coded_buf->derived_surface.resource, 
&feedback);
-  surf->frame_num_cnt = context->desc.h264enc.frame_num_cnt;
   surf->feedback = feedback;
   surf->coded_buf = coded_buf;
}
 
context->decoder->end_frame(context->decoder, context->target, 
&context->desc.base);
-   if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE &&
-   context->desc.h264enc.p_remain == 1)
-  context->decoder->flush(context->decoder);
+   if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
+  surf->frame_num_cnt = context->desc.h264enc.frame_num_cnt;
+  surf->force_flushed = false;
+  if (context->first_single_submitted) {
+ context->decoder->flush(context->decoder);
+ context->first_single_submitted = false;
+ surf->force_flushed = true;
+  }
+  if (context->desc.h264enc.p_remain == 1) {
+ if ((context->desc.h264enc.frame_num_cnt % 2) != 0) {
+context->decoder->flush(context->decoder);
+context->first_single_submitted = true;
+ }
+ else
+context->first_single_submitted = false;
+ surf->force_flushed = true;
+  }
+   }
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_SUCCESS;
 }
diff --git a/src/gallium/state_trackers/va/surface.c 
b/src/gallium/state_trackers/va/surface.c
index f8513d9..38b3151 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -125,12 +125,16 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID 
render_target)
 
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
   int frame_diff;
-  if (context->desc.h264enc.frame_num_cnt > surf->frame_num_cnt)
+  if (context->desc.h264enc.frame_num_cnt >= surf->frame_num_cnt)
  frame_diff = context->desc.h264enc.frame_num_cnt - 
surf->frame_num_cnt;
   else
  frame_diff = 0x - surf->frame_num_cnt + 1 + 
context->desc.h264enc.frame_num_cnt;
-  if (frame_diff < 2)
+  if ((frame_diff == 0) &&
+  (surf->force_flushed == false) &&
+  (context->desc.h264enc.frame_num_cnt % 2 != 0)) {
  context->decoder->flush(context->decoder);
+ context->first_single_submitted = true;
+  }
   context->decoder->get_feedback(context->decoder, surf->feedback, 
&(surf->coded_buf->coded_size));
   surf->feedback = NULL;
}
diff --git a/src/gallium/state_trackers/va/va_private.h 
b/src/gallium/state_trackers/va/va_private.h
index c9a6a41..9e3ba03 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -244,6 +244,7 @@ typedef struct {
struct vl_deint_filter *deint;
struct vlVaBuffer *coded_buf;
int target_id;
+   bool first_single_submitted;
 } vlVaCon

Mesa (master): st/vdpau: fix compiler warning in vlVdpVideoMixerRender

2016-12-05 Thread Christian König
Module: Mesa
Branch: master
Commit: 7b811c362a0b0cfb9a8c503cacf9be57d1ed2c7a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b811c362a0b0cfb9a8c503cacf9be57d1ed2c7a

Author: Nayan Deshmukh 
Date:   Mon Dec  5 11:13:17 2016 +0530

st/vdpau: fix compiler warning in vlVdpVideoMixerRender

Signed-off-by: Nayan Deshmukh 
Reviewed-by: Christian König 

---

 src/gallium/state_trackers/vdpau/mixer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/vdpau/mixer.c 
b/src/gallium/state_trackers/vdpau/mixer.c
index c205427..aca43c1 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -242,7 +242,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
struct pipe_video_buffer *video_buffer;
struct pipe_sampler_view *sampler_view, sv_templ;
struct pipe_surface *surface, surf_templ;
-   struct pipe_context *pipe;
+   struct pipe_context *pipe = NULL;
struct pipe_resource res_tmpl, *res;
 
vlVdpVideoMixer *vmixer;

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