Mesa (master): radv: Use different intrinsic for ubo loads.

2016-11-28 Thread Bas Nieuwenhuizen
Module: Mesa
Branch: master
Commit: 05533ce418851b12fd0a1e940a633f9280203aab
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=05533ce418851b12fd0a1e940a633f9280203aab

Author: Bas Nieuwenhuizen 
Date:   Tue Nov 29 00:18:43 2016 +0100

radv: Use different intrinsic for ubo loads.

Not sure about the deprecation path, but this intrinsic
can be lowered to SMEM loads. This results in a significant
Talos performance improvement.

v2: Fix for LLVM attribute changes.

Signed-off-by: Bas Nieuwenhuizen 
Reviewed-by: Dave Airlie 

---

 src/amd/common/ac_nir_to_llvm.c | 30 +-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index f623cc0..c9b0106 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -2035,6 +2035,34 @@ static LLVMValueRef visit_load_buffer(struct 
nir_to_llvm_context *ctx,
get_def_type(ctx, >dest.ssa), "");
 }
 
+static LLVMValueRef visit_load_ubo_buffer(struct nir_to_llvm_context *ctx,
+  nir_intrinsic_instr *instr)
+{
+   const nir_intrinsic_info *info = _intrinsic_infos[instr->intrinsic];
+   const char *load_name;
+   LLVMTypeRef data_type = ctx->f32;
+   LLVMValueRef results[4], ret;
+   LLVMValueRef rsrc = get_src(ctx, instr->src[0]);
+   LLVMValueRef offset = get_src(ctx, instr->src[1]);
+
+   rsrc = LLVMBuildBitCast(ctx->builder, rsrc, LLVMVectorType(ctx->i8, 
16), "");
+
+   for (unsigned i = 0; i < instr->num_components; ++i) {
+   LLVMValueRef params[] = {
+   rsrc,
+   LLVMBuildAdd(ctx->builder, LLVMConstInt(ctx->i32, 4 * 
i, 0),
+offset, "")
+   };
+   results[i] = emit_llvm_intrinsic(ctx, "llvm.SI.load.const", 
ctx->f32,
+params, 2, 
AC_FUNC_ATTR_READNONE);
+   }
+
+
+   ret = build_gather_values(ctx, results, instr->num_components);
+   return LLVMBuildBitCast(ctx->builder, ret,
+   get_def_type(ctx, >dest.ssa), "");
+}
+
 static void
 radv_get_deref_offset(struct nir_to_llvm_context *ctx, nir_deref *tail,
   bool vs_in, unsigned *const_out, LLVMValueRef *indir_out)
@@ -2956,7 +2984,7 @@ static void visit_intrinsic(struct nir_to_llvm_context 
*ctx,
result = visit_atomic_ssbo(ctx, instr);
break;
case nir_intrinsic_load_ubo:
-   result = visit_load_buffer(ctx, instr);
+   result = visit_load_ubo_buffer(ctx, instr);
break;
case nir_intrinsic_get_buffer_size:
result = visit_get_buffer_size(ctx, instr);

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


Mesa (master): mesa: fix active subroutine uniforms properly

2016-11-28 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: 0303201dfb73c16751d5519cca7480fa678d429a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0303201dfb73c16751d5519cca7480fa678d429a

Author: Timothy Arceri 
Date:   Sun Nov 27 10:31:01 2016 +1100

mesa: fix active subroutine uniforms properly

07fe2d565b introduced a big hack in order to return
NumSubroutineUniforms when querying ACTIVE_RESOURCES for
_SUBROUTINE_UNIFORM interfaces. However this is the
wrong fix we are meant to be returning the number of active
resources i.e. the count of subroutine uniforms in the
resource list which is what the code was previously doing,
anything else will cause trouble when trying to retrieve
the resource properties based on the ACTIVE_RESOURCES count.

The real problem is that NumSubroutineUniforms was counting
array elements as separate uniforms but the innermost array
is always considered a single uniform so we fix that count
instead which was counted incorrectly in 7fa0250f9.

Idealy we could probably completely remove
NumSubroutineUniforms and just compute its value when needed
from the resource list but this works for now.

Reviewed-by: Alejandro Piñeiro 
Reviewed-by: Tapani Pälli 
Cc: 13.0 

---

 src/compiler/glsl/link_uniforms.cpp |   2 +
 src/compiler/glsl/linker.cpp|   1 -
 src/mesa/main/program_resource.c| 111 +++-
 3 files changed, 10 insertions(+), 104 deletions(-)

diff --git a/src/compiler/glsl/link_uniforms.cpp 
b/src/compiler/glsl/link_uniforms.cpp
index f271093..66bcbda 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -623,6 +623,8 @@ private:
  uniform->opaque[shader_type].index = this->next_subroutine;
  uniform->opaque[shader_type].active = true;
 
+ prog->_LinkedShaders[shader_type]->NumSubroutineUniforms++;
+
  /* Increment the subroutine index by 1 for non-arrays and by the
   * number of array elements for arrays.
   */
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 1a00a90..6f54f75 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3159,7 +3159,6 @@ link_calculate_subroutine_compat(struct gl_shader_program 
*prog)
  if (!uni)
 continue;
 
- sh->NumSubroutineUniforms++;
  count = 0;
  if (sh->NumSubroutineFunctions == 0) {
 linker_error(prog, "subroutine uniform %s defined but no valid 
functions found\n", uni->type->name);
diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c
index 859bda2..5461c4e 100644
--- a/src/mesa/main/program_resource.c
+++ b/src/mesa/main/program_resource.c
@@ -67,9 +67,7 @@ supported_interface_enum(struct gl_context *ctx, GLenum iface)
 }
 
 static struct gl_shader_program *
-lookup_linked_program(GLuint program,
-  const char *caller,
-  bool raise_link_error)
+lookup_linked_program(GLuint program, const char *caller)
 {
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *prog =
@@ -79,66 +77,13 @@ lookup_linked_program(GLuint program,
   return NULL;
 
if (prog->data->LinkStatus == GL_FALSE) {
-  if (raise_link_error)
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)",
- caller);
+  _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)",
+  caller);
   return NULL;
}
return prog;
 }
 
-static GLenum
-stage_from_program_interface(GLenum programInterface)
-{
-   switch(programInterface) {
-   case GL_VERTEX_SUBROUTINE_UNIFORM:
-  return MESA_SHADER_VERTEX;
-   case GL_TESS_CONTROL_SUBROUTINE_UNIFORM:
-  return MESA_SHADER_TESS_CTRL;
-   case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM:
-  return MESA_SHADER_TESS_EVAL;
-   case GL_GEOMETRY_SUBROUTINE_UNIFORM:
-  return MESA_SHADER_GEOMETRY;
-   case GL_FRAGMENT_SUBROUTINE_UNIFORM:
-  return MESA_SHADER_FRAGMENT;
-   case GL_COMPUTE_SUBROUTINE_UNIFORM:
-  return MESA_SHADER_COMPUTE;
-   default:
-  unreachable("unexpected programInterface value");
-   }
-}
-
-static struct gl_linked_shader *
-lookup_linked_shader(GLuint program,
- GLenum programInterface,
- const char *caller)
-{
-   struct gl_shader_program *shLinkedProg =
-  lookup_linked_program(program, caller, false);
-   gl_shader_stage stage = stage_from_program_interface(programInterface);
-
-   if (!shLinkedProg)
-  return NULL;
-
-   return shLinkedProg->_LinkedShaders[stage];
-}
-
-static bool
-is_subroutine_uniform_program_interface(GLenum programInterface)
-{
-   switch(programInterface) {
-   case GL_VERTEX_SUBROUTINE_UNIFORM:
-   case GL_TESS_CONTROL_SUBROUTINE_UNIFORM:
-   case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM:
-   case GL_GEOMETRY_SUBROUTINE_UNIFORM:
-   case 

Mesa (master): anv/cmd_buffer: Set the correct surface type for depth/ stencil

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: d4ef87c1bb4290293148cbd6cb782764df38f8f4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4ef87c1bb4290293148cbd6cb782764df38f8f4

Author: Jason Ekstrand 
Date:   Mon Nov 28 15:44:13 2016 -0800

anv/cmd_buffer: Set the correct surface type for depth/stencil

Reviewed-by: Nanley Chery 

---

 src/intel/vulkan/genX_cmd_buffer.c | 55 --
 1 file changed, 53 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
b/src/intel/vulkan/genX_cmd_buffer.c
index a965cd6..e9a1ef9 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -2033,6 +2033,51 @@ genX(cmd_buffer_emit_gen7_depth_flush)(struct 
anv_cmd_buffer *cmd_buffer)
}
 }
 
+static uint32_t
+depth_stencil_surface_type(enum isl_surf_dim dim)
+{
+   switch (dim) {
+   case ISL_SURF_DIM_1D:
+  if (GEN_GEN >= 9) {
+ /* From the Sky Lake PRM, 3DSTATAE_DEPTH_BUFFER::SurfaceType
+  *
+  *Programming Notes:
+  *The Surface Type of the depth buffer must be the same as the
+  *Surface Type of the render target(s) (defined in
+  *SURFACE_STATE), unless either the depth buffer or render
+  *targets are SURFTYPE_NULL (see exception below for SKL).  1D
+  *surface type not allowed for depth surface and stencil surface.
+  *
+  *Workaround:
+  *If depth/stencil is enabled with 1D render target,
+  *depth/stencil surface type needs to be set to 2D surface type
+  *and height set to 1. Depth will use (legacy) TileY and stencil
+  *will use TileW. For this case only, the Surface Type of the
+  *depth buffer can be 2D while the Surface Type of the render
+  *target(s) are 1D, representing an exception to a programming
+  *note above.
+  */
+ return SURFTYPE_2D;
+  } else {
+ return SURFTYPE_1D;
+  }
+   case ISL_SURF_DIM_2D:
+  return SURFTYPE_2D;
+   case ISL_SURF_DIM_3D:
+  if (GEN_GEN >= 9) {
+ /* The Sky Lake docs list the value for 3D as "Reserved".  However,
+  * they have the exact same layout as 2D arrays on gen9+, so we can
+  * just use 2D here.
+  */
+ return SURFTYPE_2D;
+  } else {
+ return SURFTYPE_3D;
+  }
+   default:
+  unreachable("Invalid surface dimension");
+   }
+}
+
 static void
 cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
 {
@@ -2054,7 +2099,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer 
*cmd_buffer)
/* Emit 3DSTATE_DEPTH_BUFFER */
if (has_depth) {
   anv_batch_emit(_buffer->batch, GENX(3DSTATE_DEPTH_BUFFER), db) {
- db.SurfaceType   = SURFTYPE_2D;
+ db.SurfaceType   =
+depth_stencil_surface_type(image->depth_surface.isl.dim);
  db.DepthWriteEnable  = true;
  db.StencilWriteEnable= has_stencil;
 
@@ -2106,7 +2152,12 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer 
*cmd_buffer)
* be combined with a stencil buffer so we use D32_FLOAT instead.
*/
   anv_batch_emit(_buffer->batch, GENX(3DSTATE_DEPTH_BUFFER), db) {
- db.SurfaceType  = SURFTYPE_2D;
+ if (has_stencil) {
+db.SurfaceType   = SURFTYPE_2D;
+   depth_stencil_surface_type(image->stencil_surface.isl.dim);
+ } else {
+db.SurfaceType   = SURFTYPE_2D;
+ }
  db.SurfaceFormat= D32_FLOAT;
  db.Width= fb->width - 1;
  db.Height   = fb->height - 1;

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


Mesa (master): anv/cmd_buffer: Remove the 1-D case from the HiZ QPitch calculation

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: f469235a6e0c239166ba803e121994063b47ddd3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f469235a6e0c239166ba803e121994063b47ddd3

Author: Jason Ekstrand 
Date:   Fri Nov 25 22:09:30 2016 -0800

anv/cmd_buffer: Remove the 1-D case from the HiZ QPitch calculation

The 1-D special case doesn't actually apply to depth or HiZ.  I discovered
this while converting BLORP over to genxml and ISL.  The reason is that the
1-D special case only applies to the new Sky Lake 1-D layout which is only
used for LINEAR 1-D images.  For tiled 1-D images, such as depth buffers,
the old gen4 2-D layout is used and the QPitch should be in rows.

Reviewed-by: Nanley Chery 
Cc: "13.0" 

---

 src/intel/vulkan/genX_cmd_buffer.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
b/src/intel/vulkan/genX_cmd_buffer.c
index e9a1ef9..73f4523 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -2181,11 +2181,14 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer 
*cmd_buffer)
   *- SURFTYPE_1D: distance in pixels between array slices
   *- SURFTYPE_2D/CUBE: distance in rows between array slices
   *- SURFTYPE_3D: distance in rows between R - slices
+  *
+  * Unfortunately, the docs aren't 100% accurate here.  They fail to
+  * mention that the 1-D rule only applies to linear 1-D images.
+  * Since depth and HiZ buffers are always tiled, they are treated as
+  * 2-D images.  Prior to Sky Lake, this field is always in rows.
   */
  hdb.SurfaceQPitch =
-image->aux_surface.isl.dim == ISL_SURF_DIM_1D ?
-   isl_surf_get_array_pitch_el(>aux_surface.isl) >> 2 :
-   isl_surf_get_array_pitch_el_rows(>aux_surface.isl) >> 2;
+isl_surf_get_array_pitch_el_rows(>aux_surface.isl) >> 2;
 #endif
   }
} else {

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


Mesa (master): anv: enable storage image extended formats

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 76b97d544e642b10d049fad1a6ccd122e482c50a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=76b97d544e642b10d049fad1a6ccd122e482c50a

Author: Ilia Mirkin 
Date:   Sun Nov 27 16:37:17 2016 -0500

anv: enable storage image extended formats

These are all regularly available in desktop GL, so the backend fully
supports them.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Jason Ekstrand 

---

 src/intel/vulkan/anv_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 4c51981..fcc27da 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -465,7 +465,7 @@ void anv_GetPhysicalDeviceFeatures(
   .fragmentStoresAndAtomics = true,
   .shaderTessellationAndGeometryPointSize   = true,
   .shaderImageGatherExtended= false,
-  .shaderStorageImageExtendedFormats= false,
+  .shaderStorageImageExtendedFormats= true,
   .shaderStorageImageMultisample= false,
   .shaderUniformBufferArrayDynamicIndexing  = true,
   .shaderSampledImageArrayDynamicIndexing   = true,

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


Mesa (master): anv: bump maxFramebufferLayers to 2048

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: e2c669a56bedc25656600aef12a6174f6cc90315
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e2c669a56bedc25656600aef12a6174f6cc90315

Author: Ilia Mirkin 
Date:   Mon Nov 28 19:49:51 2016 -0500

anv: bump maxFramebufferLayers to 2048

This matches maxImageArrayLayers, as well as the same setting in the GL
frontend.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Jason Ekstrand 
Reviewed-by: Kenneth Graunke 

---

 src/intel/vulkan/anv_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index fcc27da..d9ab1b1 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -589,7 +589,7 @@ void anv_GetPhysicalDeviceProperties(
   .subPixelInterpolationOffsetBits  = 4,
   .maxFramebufferWidth  = (1 << 14),
   .maxFramebufferHeight = (1 << 14),
-  .maxFramebufferLayers = (1 << 10),
+  .maxFramebufferLayers = (1 << 11),
   .framebufferColorSampleCounts = sample_counts,
   .framebufferDepthSampleCounts = sample_counts,
   .framebufferStencilSampleCounts   = sample_counts,

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


Mesa (master): anv: expose depthBiasClamp, it is already set

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: d2280a007a0425726c941e8794004f2f5ba98839
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d2280a007a0425726c941e8794004f2f5ba98839

Author: Ilia Mirkin 
Date:   Tue Nov 22 23:03:12 2016 -0500

anv: expose depthBiasClamp, it is already set

The gen7/8_cmd_buffer logic already sets the clamp, and it's piped
through via the dynamic state.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Kenneth Graunke 

---

 src/intel/vulkan/anv_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index d9ab1b1..08bc247 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -448,7 +448,7 @@ void anv_GetPhysicalDeviceFeatures(
   .multiDrawIndirect= false,
   .drawIndirectFirstInstance= false,
   .depthClamp   = true,
-  .depthBiasClamp   = false,
+  .depthBiasClamp   = true,
   .fillModeNonSolid = true,
   .depthBounds  = false,
   .wideLines= true,

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


Mesa (master): anv: expose imageCubeArray functionality

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: a34f89c5e6cb78cbec940e5d8d186141f19ccfe7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a34f89c5e6cb78cbec940e5d8d186141f19ccfe7

Author: Ilia Mirkin 
Date:   Sun Nov 27 14:41:42 2016 -0500

anv: expose imageCubeArray functionality

This appears to be fully supported already.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Lionel Landwerlin 
Reviewed-by: Jason Ekstrand 

---

 src/intel/vulkan/anv_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 41ace6c..4c51981 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -438,7 +438,7 @@ void anv_GetPhysicalDeviceFeatures(
*pFeatures = (VkPhysicalDeviceFeatures) {
   .robustBufferAccess   = true,
   .fullDrawIndexUint32  = true,
-  .imageCubeArray   = false,
+  .imageCubeArray   = true,
   .independentBlend = true,
   .geometryShader   = true,
   .tessellationShader   = false,

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


Mesa (master): anv: enable drawIndirectFirstInstance

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: e6847f24f032b094b5a40012968ca79a5fdc67b4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6847f24f032b094b5a40012968ca79a5fdc67b4

Author: Ilia Mirkin 
Date:   Tue Nov 22 23:20:11 2016 -0500

anv: enable drawIndirectFirstInstance

This was already piped through in the CmdDraw(Indexed)Indirect handling.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Kenneth Graunke 
Reviewed-by: Jason Ekstrand 

---

 src/intel/vulkan/anv_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 08bc247..b8e00ba 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -446,7 +446,7 @@ void anv_GetPhysicalDeviceFeatures(
   .dualSrcBlend = true,
   .logicOp  = true,
   .multiDrawIndirect= false,
-  .drawIndirectFirstInstance= false,
+  .drawIndirectFirstInstance= true,
   .depthClamp   = true,
   .depthBiasClamp   = true,
   .fillModeNonSolid = true,

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


Mesa (master): anv: set maxFragmentDualSrcAttachments to 1

2016-11-28 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: f9ab60202d48c72afa6a6f2a8c27db1e0777ed16
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9ab60202d48c72afa6a6f2a8c27db1e0777ed16

Author: Dave Airlie 
Date:   Tue Nov 29 11:16:56 2016 +1000

anv: set maxFragmentDualSrcAttachments to 1

Reviewed-by: Kenneth Graunke 
Reviewed-by: Jason Ekstrand 
Reported-by: Ilia Mirkin 
Cc: "13.0" 
Signed-off-by: Dave Airlie 

---

 src/amd/vulkan/radv_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index ce697a9..5a7ed04 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -471,7 +471,7 @@ void radv_GetPhysicalDeviceProperties(
.maxGeometryTotalOutputComponents = 1024,
.maxFragmentInputComponents   = 128,
.maxFragmentOutputAttachments = 8,
-   .maxFragmentDualSrcAttachments= 2,
+   .maxFragmentDualSrcAttachments= 1,
.maxFragmentCombinedOutputResources   = 8,
.maxComputeSharedMemorySize   = 32768,
.maxComputeWorkGroupCount = { 65535, 65535, 
65535 },

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


Mesa (master): radv: set maxFragmentDualSrcAttachments to 1

2016-11-28 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: eaf0768b8f9a9fd76b44a4d60826ef1f42fc6a46
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eaf0768b8f9a9fd76b44a4d60826ef1f42fc6a46

Author: Dave Airlie 
Date:   Tue Nov 29 11:16:56 2016 +1000

radv: set maxFragmentDualSrcAttachments to 1

Reported-by: Ilia Mirkin 
Cc: "13.0" 
Reviewed-by: Kenneth Graunke 
Signed-off-by: Dave Airlie 

---

 src/intel/vulkan/anv_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index e140621..41ace6c 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -555,7 +555,7 @@ void anv_GetPhysicalDeviceProperties(
   .maxGeometryTotalOutputComponents = 1024,
   .maxFragmentInputComponents   = 128,
   .maxFragmentOutputAttachments = 8,
-  .maxFragmentDualSrcAttachments= 2,
+  .maxFragmentDualSrcAttachments= 1,
   .maxFragmentCombinedOutputResources   = 8,
   .maxComputeSharedMemorySize   = 32768,
   .maxComputeWorkGroupCount = { 65535, 65535, 65535 },

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


Mesa (master): swr: [rasterizer memory] hook up stencil clears for ClearTile

2016-11-28 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 2fca08e550ae0c4b036ee8fc34dcf98d45d6bf20
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2fca08e550ae0c4b036ee8fc34dcf98d45d6bf20

Author: Ilia Mirkin 
Date:   Fri Nov 18 10:15:30 2016 -0500

swr: [rasterizer memory] hook up stencil clears for ClearTile

Signed-off-by: Ilia Mirkin 
Reviewed-by: Tim Rowley 

---

 src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp 
b/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
index 8501e21..31a40a3 100644
--- a/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
+++ b/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
@@ -156,16 +156,19 @@ void StoreHotTileClear(
 {
 PFN_STORE_TILES_CLEAR pfnStoreTilesClear = NULL;
 
-SWR_ASSERT(renderTargetIndex != SWR_ATTACHMENT_STENCIL);  ///@todo Not 
supported yet.
-
-if (renderTargetIndex != SWR_ATTACHMENT_DEPTH)
+if (renderTargetIndex == SWR_ATTACHMENT_STENCIL)
 {
-pfnStoreTilesClear = sStoreTilesClearColorTable[pDstSurface->format];
+SWR_ASSERT(pDstSurface->format == R8_UINT);
+pfnStoreTilesClear = StoreMacroTileClear::StoreClear;
 }
-else
+else if (renderTargetIndex == SWR_ATTACHMENT_DEPTH)
 {
 pfnStoreTilesClear = sStoreTilesClearDepthTable[pDstSurface->format];
 }
+else
+{
+pfnStoreTilesClear = sStoreTilesClearColorTable[pDstSurface->format];
+}
 
 SWR_ASSERT(pfnStoreTilesClear != NULL);
 

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


Mesa (master): swr: [rasterizer memory] add support for clearing Z32F_X32 and Z16

2016-11-28 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 5582610ea190e52e49c60aa8fe18bebfe2466cde
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5582610ea190e52e49c60aa8fe18bebfe2466cde

Author: Ilia Mirkin 
Date:   Fri Nov 18 09:52:41 2016 -0500

swr: [rasterizer memory] add support for clearing Z32F_X32 and Z16

Signed-off-by: Ilia Mirkin 
Reviewed-by: Tim Rowley 

---

 src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp 
b/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
index 717d12c..8501e21 100644
--- a/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
+++ b/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
@@ -282,7 +282,9 @@ void StoreHotTileClear(
 memset(sStoreTilesClearDepthTable, 0, sizeof(sStoreTilesClearDepthTable)); 
\
 \
 sStoreTilesClearDepthTable[R32_FLOAT] = StoreMacroTileClear::StoreClear; \
+sStoreTilesClearDepthTable[R32_FLOAT_X8X24_TYPELESS] = 
StoreMacroTileClear::StoreClear; \
 sStoreTilesClearDepthTable[R24_UNORM_X8_TYPELESS] = 
StoreMacroTileClear::StoreClear; \
+sStoreTilesClearDepthTable[R16_UNORM] = StoreMacroTileClear::StoreClear; \
 
 //
 /// @brief Sets up tables for ClearTile

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


Mesa (master): swr: [rasterizer memory] only clear up to the LOD size

2016-11-28 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: e0fc18a43590e120ae716670804fe26b0dd73878
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0fc18a43590e120ae716670804fe26b0dd73878

Author: Ilia Mirkin 
Date:   Fri Nov 18 15:36:40 2016 -0500

swr: [rasterizer memory] only clear up to the LOD size

Signed-off-by: Ilia Mirkin 
Reviewed-by: Tim Rowley 

---

 src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp 
b/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
index 31a40a3..ee13f55 100644
--- a/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
+++ b/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
@@ -60,6 +60,12 @@ struct StoreRasterTileClear
 UINT x, UINT y, // (x, y) pixel coordinate to start of raster tile.
 uint32_t renderTargetArrayIndex)
 {
+// If we're outside of the surface, stop.
+uint32_t lodWidth = std::max(pDstSurface->width >> 
pDstSurface->lod, 1U);
+uint32_t lodHeight = std::max(pDstSurface->height >> 
pDstSurface->lod, 1U);
+if (x >= lodWidth || y >= lodHeight)
+return;
+
 // Compute destination address for raster tile.
 uint8_t* pDstTile = (uint8_t*)ComputeSurfaceAddress(
 x, y, pDstSurface->arrayIndex + renderTargetArrayIndex,
@@ -73,7 +79,7 @@ struct StoreRasterTileClear
 UINT dstBytesPerRow = 0;
 
 // For each raster tile pixel in row 0 (rx, 0)
-for (UINT rx = 0; (rx < KNOB_TILE_X_DIM) && ((x + rx) < 
pDstSurface->width); ++rx)
+for (UINT rx = 0; (rx < KNOB_TILE_X_DIM) && ((x + rx) < lodWidth); 
++rx)
 {
 memcpy(pDst, dstFormattedColor, dstBytesPerPixel);
 
@@ -86,7 +92,7 @@ struct StoreRasterTileClear
 pDst = pDstTile + pDstSurface->pitch;
 
 // For each remaining row in the rest of the raster tile
-for (UINT ry = 1; (ry < KNOB_TILE_Y_DIM) && ((y + ry) < 
pDstSurface->height); ++ry)
+for (UINT ry = 1; (ry < KNOB_TILE_Y_DIM) && ((y + ry) < lodHeight); 
++ry)
 {
 // copy row
 memcpy(pDst, pDstTile, dstBytesPerRow);

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


Mesa (master): intel/aubinator: Pull useful information from the AUB header

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

Author: Jason Ekstrand 
Date:   Wed Nov 23 20:24:00 2016 -0800

intel/aubinator: Pull useful information from the AUB header

This commit does two things.  One is to pull useful and/or interesting
information from the AUB file header and display it as a header above your
decoded batches.  Second, it is now capable of pulling the PCI ID from the
AUB file comment left by intel_aubdump.  This removes the need to use the
--gen flag all the time.

Reviewed-by: Lionel Landwerlin 
Reviewed-by: Jordan Justen 

---

 src/intel/tools/aubinator.c | 34 --
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 60aead8..5e3a684 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -63,7 +63,7 @@ static enum { COLOR_AUTO, COLOR_ALWAYS, COLOR_NEVER } 
option_color;
 /* state */
 
 uint16_t pci_id = 0;
-char *xml_path = NULL;
+char *input_file = NULL, *xml_path = NULL;
 struct gen_spec *spec;
 struct gen_disasm *disasm;
 
@@ -894,6 +894,18 @@ handle_trace_block(uint32_t *p)
 static void
 handle_trace_header(uint32_t *p)
 {
+   /* The intel_aubdump tool from IGT is kind enough to put a PCI-ID= tag in
+* the AUB header comment.  If the user hasn't specified a hardware
+* generation, try to use the one from the AUB file.
+*/
+   uint32_t *end = p + (p[0] & 0x) + 2;
+   int aub_pci_id = 0;
+   if (end > [12] && p[12] > 0)
+  sscanf((char *)[13], "PCI-ID=%i", _pci_id);
+
+   if (pci_id == 0)
+  pci_id = aub_pci_id;
+
struct gen_device_info devinfo;
if (!gen_get_device_info(pci_id, )) {
   fprintf(stderr, "can't find device information: pci_id=0x%x\n", pci_id);
@@ -908,6 +920,25 @@ handle_trace_header(uint32_t *p)
 
if (spec == NULL || disasm == NULL)
   exit(EXIT_FAILURE);
+
+   printf("%sAubinator: Intel AUB file decoder.%-80s%s\n",
+  GREEN_HEADER, "", NORMAL);
+
+   if (input_file)
+  printf("File name:%s\n", input_file);
+
+   if (aub_pci_id)
+  printf("PCI ID:   0x%x\n", aub_pci_id);
+
+   char app_name[33];
+   strncpy(app_name, (char *)[2], 32);
+   app_name[32] = 0;
+   printf("Application name: %s\n", app_name);
+
+   printf("Decoding as:  %s\n", gen_get_device_name(pci_id));
+
+   /* Throw in a new line before the first batch */
+   printf("\n");
 }
 
 struct aub_file {
@@ -1185,7 +1216,6 @@ int main(int argc, char *argv[])
struct aub_file *file;
int c, i;
bool help = false, pager = true;
-   char *input_file = NULL;
const struct {
   const char *name;
   int pci_id;

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


Mesa (master): intel/aubinator: Fix the kernel start pointer for 3DSTATE_HS

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 318cf3ffa430d29b50237e3a9817621d8d8dd0bc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=318cf3ffa430d29b50237e3a9817621d8d8dd0bc

Author: Jason Ekstrand 
Date:   Fri Nov 18 11:33:20 2016 -0800

intel/aubinator: Fix the kernel start pointer for 3DSTATE_HS

Reviewed-by: Kristian H. Kristensen 

---

 src/intel/tools/aubinator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 0da01f4..f5e5167 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -442,9 +442,9 @@ handle_3dstate_hs(struct gen_spec *spec, uint32_t *p)
int hs_enable;
 
if (gen_spec_get_gen(spec) >= gen_make_gen(8, 0)) {
-  start = get_qword([4]);
+  start = get_qword([3]);
} else {
-  start = p[4];
+  start = p[3];
}
 
hs_enable = p[2] & 0x8000;

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


Mesa (master): intel/aubinator: Add a get_offset helper

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 89bb515e915bbdf4f3b7b55f7cc228423131ca25
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=89bb515e915bbdf4f3b7b55f7cc228423131ca25

Author: Jason Ekstrand 
Date:   Fri Nov 18 11:30:50 2016 -0800

intel/aubinator: Add a get_offset helper

The helper automatically handles masking for us so we don't have to worry
about whether or not something is in the bottom bits.

Reviewed-by: Kristian H. Kristensen 

---

 src/intel/tools/aubinator.c | 29 +++--
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index f5e5167..fbd8721 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -233,12 +233,6 @@ handle_3dstate_index_buffer(struct gen_spec *spec, 
uint32_t *p)
 }
 
 static inline uint64_t
-get_qword(uint32_t *p)
-{
-   return ((uint64_t) p[1] << 32) | p[0];
-}
-
-static inline uint64_t
 get_address(struct gen_spec *spec, uint32_t *p)
 {
/* Addresses are always guaranteed to be page-aligned and sometimes
@@ -259,6 +253,21 @@ get_address(struct gen_spec *spec, uint32_t *p)
return addr;
 }
 
+static inline uint64_t
+get_offset(uint32_t *p, uint32_t start, uint32_t end)
+{
+   assert(start <= end);
+   assert(end < 64);
+
+   uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start;
+
+   uint64_t offset = p[0];
+   if (end >= 32)
+  offset |= (uint64_t) p[1] << 32;
+
+   return offset & mask;
+}
+
 static void
 handle_state_base_address(struct gen_spec *spec, uint32_t *p)
 {
@@ -418,10 +427,10 @@ handle_3dstate_vs(struct gen_spec *spec, uint32_t *p)
int vs_enable;
 
if (gen_spec_get_gen(spec) >= gen_make_gen(8, 0)) {
-  start = get_qword([1]);
+  start = get_offset([1], 6, 63);
   vs_enable = p[7] & 1;
} else {
-  start = p[1];
+  start = get_offset([1], 6, 31);
   vs_enable = p[5] & 1;
}
 
@@ -442,9 +451,9 @@ handle_3dstate_hs(struct gen_spec *spec, uint32_t *p)
int hs_enable;
 
if (gen_spec_get_gen(spec) >= gen_make_gen(8, 0)) {
-  start = get_qword([3]);
+  start = get_offset([3], 6, 63);
} else {
-  start = p[3];
+  start = get_offset([3], 6, 31);
}
 
hs_enable = p[2] & 0x8000;

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


Mesa (master): intel/aubinator: Trust the packet size in the header for SUBOPCODE_HEADER

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

Author: Jason Ekstrand 
Date:   Wed Nov 23 19:26:13 2016 -0800

intel/aubinator: Trust the packet size in the header for SUBOPCODE_HEADER

We were reading from the "comment size" dword and incrementing by that
amount.  This never caused a problem because that field was always zero.
However, experimenting with actual aub file comments indicates, the
simulator seems to include the comment size in the packet size provided in
the header.  We should do the same.

Reviewed-by: Lionel Landwerlin 
Reviewed-by: Jordan Justen 

---

 src/intel/tools/aubinator.c | 18 --
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index fbd8721..abade45 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -993,7 +993,7 @@ static int
 aub_file_decode_batch(struct aub_file *file, struct gen_spec *spec)
 {
uint32_t *p, h, device, data_type, *new_cursor;
-   int header_length, payload_size, bias;
+   int header_length, bias;
 
if (file->end - file->cursor < 1)
   return AUB_ITEM_DECODE_NEED_MORE_DATA;
@@ -1016,23 +1016,13 @@ aub_file_decode_batch(struct aub_file *file, struct 
gen_spec *spec)
   return AUB_ITEM_DECODE_FAILED;
}
 
-   payload_size = 0;
-   switch (h & 0x) {
-   case MAKE_HEADER(TYPE_AUB, OPCODE_AUB, SUBOPCODE_HEADER):
-  if (file->end - file->cursor < 12)
- return AUB_ITEM_DECODE_NEED_MORE_DATA;
-  payload_size = p[12];
-  break;
-   case MAKE_HEADER(TYPE_AUB, OPCODE_AUB, SUBOPCODE_BLOCK):
+   new_cursor = p + header_length + bias;
+   if ((h & 0x) == MAKE_HEADER(TYPE_AUB, OPCODE_AUB, SUBOPCODE_BLOCK)) 
{
   if (file->end - file->cursor < 4)
  return AUB_ITEM_DECODE_NEED_MORE_DATA;
-  payload_size = p[4];
-  break;
-   default:
-  break;
+  new_cursor += p[4] / 4;
}
 
-   new_cursor = p + header_length + bias + payload_size / 4;
if (new_cursor > file->end)
   return AUB_ITEM_DECODE_NEED_MORE_DATA;
 

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


Mesa (master): intel/aubinator: Rework handling of the --gen flag

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: e6c01fb17d0b510bc476f2a87ad7dea1aa8a915b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6c01fb17d0b510bc476f2a87ad7dea1aa8a915b

Author: Jason Ekstrand 
Date:   Wed Nov 23 19:38:00 2016 -0800

intel/aubinator: Rework handling of the --gen flag

This makes it just store the pci_id instead of a struct pointer

Reviewed-by: Lionel Landwerlin 
Reviewed-by: Jordan Justen 

---

 src/intel/tools/aubinator.c | 36 
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index abade45..276ea75 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -1164,7 +1164,7 @@ int main(int argc, char *argv[])
int c, i;
bool help = false, pager = true;
char *input_file = NULL, *xml_path = NULL;
-   char gen_val[24] = { 0, };
+   uint16_t pci_id;
const struct {
   const char *name;
   int pci_id;
@@ -1177,7 +1177,7 @@ int main(int argc, char *argv[])
   { "skl", 0x1912 }, /* Intel(R) HD Graphics 530 (Skylake GT2) */
   { "kbl", 0x591D }, /* Intel(R) Kabylake GT2 */
   { "bxt", 0x0A84 }  /* Intel(R) HD Graphics (Broxton) */
-   }, *gen = NULL;
+   };
const struct option aubinator_opts[] = {
   { "help",   no_argument,   (int *) , true },
   { "no-pager",   no_argument,   (int *) ,false 
},
@@ -1194,7 +1194,17 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "", aubinator_opts, )) != -1) {
   switch (c) {
   case 'g':
- snprintf(gen_val, sizeof(gen_val), "%s", optarg);
+ for (i = 0; i < ARRAY_SIZE(gens); i++) {
+if (!strcmp(optarg, gens[i].name)) {
+   pci_id = gens[i].pci_id;
+   break;
+}
+ }
+ if (i == ARRAY_SIZE(gens)) {
+fprintf(stderr, "can't parse gen: '%s', expected ivb, byt, hsw, "
+   "bdw, chv, skl, kbl or bxt\n", optarg);
+exit(EXIT_FAILURE);
+ }
  break;
   case 'c':
  if (optarg == NULL || strcmp(optarg, "always") == 0)
@@ -1224,22 +1234,8 @@ int main(int argc, char *argv[])
if (optind < argc)
   input_file = argv[optind];
 
-   for (i = 0; i < ARRAY_SIZE(gens); i++) {
-  if (!strcmp(gen_val, gens[i].name)) {
- gen = [i];
- break;
-  }
-   }
-
-   if (gen == NULL) {
-  fprintf(stderr, "can't parse gen: '%s', expected ivb, byt, hsw, "
- "bdw, chv, skl, kbl or bxt\n", gen_val);
-  exit(EXIT_FAILURE);
-   }
-
-   if (!gen_get_device_info(gen->pci_id, )) {
-  fprintf(stderr, "can't find device information: pci_id=0x%x name=%s\n",
-  gen->pci_id, gen->name);
+   if (!gen_get_device_info(pci_id, )) {
+  fprintf(stderr, "can't find device information: pci_id=0x%x\n", pci_id);
   exit(EXIT_FAILURE);
}
 
@@ -1255,7 +1251,7 @@ int main(int argc, char *argv[])
   spec = gen_spec_load();
else
   spec = gen_spec_load_from_path(, xml_path);
-   disasm = gen_disasm_create(gen->pci_id);
+   disasm = gen_disasm_create(pci_id);
 
if (spec == NULL || disasm == NULL)
   exit(EXIT_FAILURE);

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


Mesa (master): intel/aubinator: Wait to setup decoders until we parse the aub header

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: da5ebeffdfc0e68fc3c5614116e8cb6935d0f38a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=da5ebeffdfc0e68fc3c5614116e8cb6935d0f38a

Author: Jason Ekstrand 
Date:   Wed Nov 23 19:14:27 2016 -0800

intel/aubinator: Wait to setup decoders until we parse the aub header

This requires that a few more state bits become global.

Reviewed-by: Lionel Landwerlin 
Reviewed-by: Jordan Justen 

---

 src/intel/tools/aubinator.c | 51 +
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 276ea75..60aead8 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -62,6 +62,9 @@ static enum { COLOR_AUTO, COLOR_ALWAYS, COLOR_NEVER } 
option_color;
 
 /* state */
 
+uint16_t pci_id = 0;
+char *xml_path = NULL;
+struct gen_spec *spec;
 struct gen_disasm *disasm;
 
 uint64_t gtt_size, gtt_end;
@@ -843,7 +846,7 @@ parse_commands(struct gen_spec *spec, uint32_t *cmds, int 
size, int engine)
 #define GEN_ENGINE_BLITTER 2
 
 static void
-handle_trace_block(struct gen_spec *spec, uint32_t *p)
+handle_trace_block(uint32_t *p)
 {
int operation = p[1] & AUB_TRACE_OPERATION_MASK;
int type = p[1] & AUB_TRACE_TYPE_MASK;
@@ -888,6 +891,25 @@ handle_trace_block(struct gen_spec *spec, uint32_t *p)
}
 }
 
+static void
+handle_trace_header(uint32_t *p)
+{
+   struct gen_device_info devinfo;
+   if (!gen_get_device_info(pci_id, )) {
+  fprintf(stderr, "can't find device information: pci_id=0x%x\n", pci_id);
+  exit(EXIT_FAILURE);
+   }
+
+   if (xml_path == NULL)
+  spec = gen_spec_load();
+   else
+  spec = gen_spec_load_from_path(, xml_path);
+   disasm = gen_disasm_create(pci_id);
+
+   if (spec == NULL || disasm == NULL)
+  exit(EXIT_FAILURE);
+}
+
 struct aub_file {
FILE *stream;
 
@@ -990,7 +1012,7 @@ enum {
 };
 
 static int
-aub_file_decode_batch(struct aub_file *file, struct gen_spec *spec)
+aub_file_decode_batch(struct aub_file *file)
 {
uint32_t *p, h, device, data_type, *new_cursor;
int header_length, bias;
@@ -1028,9 +1050,10 @@ aub_file_decode_batch(struct aub_file *file, struct 
gen_spec *spec)
 
switch (h & 0x) {
case MAKE_HEADER(TYPE_AUB, OPCODE_AUB, SUBOPCODE_HEADER):
+  handle_trace_header(p);
   break;
case MAKE_HEADER(TYPE_AUB, OPCODE_AUB, SUBOPCODE_BLOCK):
-  handle_trace_block(spec, p);
+  handle_trace_block(p);
   break;
case MAKE_HEADER(TYPE_AUB, OPCODE_AUB, SUBOPCODE_BMP):
   break;
@@ -1159,12 +1182,10 @@ print_help(const char *progname, FILE *file)
 
 int main(int argc, char *argv[])
 {
-   struct gen_spec *spec;
struct aub_file *file;
int c, i;
bool help = false, pager = true;
-   char *input_file = NULL, *xml_path = NULL;
-   uint16_t pci_id;
+   char *input_file = NULL;
const struct {
   const char *name;
   int pci_id;
@@ -1188,7 +1209,6 @@ int main(int argc, char *argv[])
   { "xml",required_argument, NULL,  'x' },
   { NULL, 0, NULL,  0 }
};
-   struct gen_device_info devinfo;
 
i = 0;
while ((c = getopt_long(argc, argv, "", aubinator_opts, )) != -1) {
@@ -1234,12 +1254,6 @@ int main(int argc, char *argv[])
if (optind < argc)
   input_file = argv[optind];
 
-   if (!gen_get_device_info(pci_id, )) {
-  fprintf(stderr, "can't find device information: pci_id=0x%x\n", pci_id);
-  exit(EXIT_FAILURE);
-   }
-
-
/* Do this before we redirect stdout to pager. */
if (option_color == COLOR_AUTO)
   option_color = isatty(1) ? COLOR_ALWAYS : COLOR_NEVER;
@@ -1247,15 +1261,6 @@ int main(int argc, char *argv[])
if (isatty(1) && pager)
   setup_pager();
 
-   if (xml_path == NULL)
-  spec = gen_spec_load();
-   else
-  spec = gen_spec_load_from_path(, xml_path);
-   disasm = gen_disasm_create(pci_id);
-
-   if (spec == NULL || disasm == NULL)
-  exit(EXIT_FAILURE);
-
if (input_file == NULL)
   file = aub_file_stdin();
else
@@ -1271,7 +1276,7 @@ int main(int argc, char *argv[])
}
 
while (aub_file_more_stuff(file)) {
-  switch (aub_file_decode_batch(file, spec)) {
+  switch (aub_file_decode_batch(file)) {
   case AUB_ITEM_DECODE_OK:
  break;
   case AUB_ITEM_DECODE_NEED_MORE_DATA:

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


Mesa (master): intel/aubinator: Properly handle batch buffer chaining

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: d6cef320477354f1c139c0bb7fb9b68731aa15cd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d6cef320477354f1c139c0bb7fb9b68731aa15cd

Author: Jason Ekstrand 
Date:   Thu Sep  8 21:12:11 2016 -0700

intel/aubinator: Properly handle batch buffer chaining

The original aubinator that Kristian wrote had a bug in the handling of
MI_BATCH_BUFFER_START that propagated into the version in upstream mesa.
In particular, it ignored the "2nd level" bit which tells you whether this
MI_BATCH_BUFFER_START is a subroutine call (2nd level) or a goto.  Since
the Vulkan driver uses batch chaining, this can lead to a very confusing
interpretation of the batches.  In some cases, depending on how things are
laid out in the virtual GTT, you can even end up with infinite loops in
batch processing.

Reviewed-by: Kristian H. Kristensen 

---

 src/intel/tools/aubinator.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 0d4b3f9..78682c5 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -790,7 +790,25 @@ parse_commands(struct gen_spec *spec, uint32_t *cmds, int 
size, int engine)
  else
 start = p[1];
 
- parse_commands(spec, gtt + start, 1 << 20, engine);
+ if (p[0] & (1 << 22)) {
+/* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" set acts
+ * like a subroutine call.  Commands that come afterwards get
+ * processed once the 2nd level batch buffer returns with
+ * MI_BATCH_BUFFER_END.
+ */
+parse_commands(spec, gtt + start, gtt_end - start, engine);
+ } else {
+/* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" unset acts
+ * like a goto.  Nothing after it will ever get processed.  In
+ * order to prevent the recursion from growing, we just reset the
+ * loop and continue;
+ */
+p = gtt + start;
+/* We don't know where secondaries end so use the GTT end */
+end = gtt + gtt_end;
+length = 0;
+continue;
+ }
   } else if ((p[0] & 0x) == AUB_MI_BATCH_BUFFER_END) {
  break;
   }

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


Mesa (master): intel/aubinator: Add a get_address helper

2016-11-28 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 294daaa36f86530d30e61eb6228b61a474a3c6ad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=294daaa36f86530d30e61eb6228b61a474a3c6ad

Author: Jason Ekstrand 
Date:   Fri Nov 18 11:14:59 2016 -0800

intel/aubinator: Add a get_address helper

This new helper is automatically handles 32 vs. 48-bit GTT issues.  It also
handles 48-bit canonical addresses on Broadwell and above.

Reviewed-by: Kristian H. Kristensen 

---

 src/intel/tools/aubinator.c | 47 ++---
 1 file changed, 31 insertions(+), 16 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 78682c5..0da01f4 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -238,31 +238,50 @@ get_qword(uint32_t *p)
return ((uint64_t) p[1] << 32) | p[0];
 }
 
+static inline uint64_t
+get_address(struct gen_spec *spec, uint32_t *p)
+{
+   /* Addresses are always guaranteed to be page-aligned and sometimes
+* hardware packets have extra stuff stuffed in the bottom 12 bits.
+*/
+   uint64_t addr = p[0] & ~0xfffu;
+
+   if (gen_spec_get_gen(spec) >= gen_make_gen(8,0)) {
+  /* On Broadwell and above, we have 48-bit addresses which consume two
+   * dwords.  Some packets require that these get stored in a "canonical
+   * form" which means that bit 47 is sign-extended through the upper
+   * bits. In order to correctly handle those aub dumps, we need to mask
+   * off the top 16 bits.
+   */
+  addr |= ((uint64_t)p[1] & 0x) << 32;
+   }
+
+   return addr;
+}
+
 static void
 handle_state_base_address(struct gen_spec *spec, uint32_t *p)
 {
-   uint64_t mask = ~((1 << 12) - 1);
-
if (gen_spec_get_gen(spec) >= gen_make_gen(8,0)) {
   if (p[1] & 1)
- general_state_base = get_qword([1]) & mask;
+ general_state_base = get_address(spec, [1]);
   if (p[4] & 1)
- surface_state_base = get_qword([4]) & mask;
+ surface_state_base = get_address(spec, [4]);
   if (p[6] & 1)
- dynamic_state_base = get_qword([6]) & mask;
+ dynamic_state_base = get_address(spec, [6]);
   if (p[10] & 1)
- instruction_base = get_qword([10]) & mask;
+ instruction_base = get_address(spec, [10]);
   if (p[15] & 1)
- instruction_bound = p[15] & mask;
+ instruction_bound = p[15] & 0xfff;
} else {
   if (p[2] & 1)
- surface_state_base = p[2] & mask;
+ surface_state_base = get_address(spec, [2]);
   if (p[3] & 1)
- dynamic_state_base = p[3] & mask;
+ dynamic_state_base = get_address(spec, [3]);
   if (p[5] & 1)
- instruction_base = p[5] & mask;
+ instruction_base = get_address(spec, [5]);
   if (p[9] & 1)
- instruction_bound = p[9] & mask;
+ instruction_bound = get_address(spec, [9]);
}
 }
 
@@ -784,11 +803,7 @@ parse_commands(struct gen_spec *spec, uint32_t *cmds, int 
size, int engine)
   }
 
   if ((p[0] & 0x) == AUB_MI_BATCH_BUFFER_START) {
- uint64_t start;
- if (gen_spec_get_gen(spec) >= gen_make_gen(8,0))
-start = get_qword([1]);
- else
-start = p[1];
+ uint64_t start = get_address(spec, [1]);
 
  if (p[0] & (1 << 22)) {
 /* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" set acts

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


Mesa (master): swr: [rasterizer core] fix typo in scissor tile-alignment logic

2016-11-28 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 8a70a4d9844f7aa50cc6ef16a5f79ba86bc11eaa
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a70a4d9844f7aa50cc6ef16a5f79ba86bc11eaa

Author: Ilia Mirkin 
Date:   Fri Nov 25 20:29:30 2016 -0500

swr: [rasterizer core] fix typo in scissor tile-alignment logic

Signed-off-by: Ilia Mirkin 
Reviewed-by: Tim Rowley 

---

 src/gallium/drivers/swr/rasterizer/core/api.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp 
b/src/gallium/drivers/swr/rasterizer/core/api.cpp
index 383a7ad..6c0d5dd 100644
--- a/src/gallium/drivers/swr/rasterizer/core/api.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp
@@ -765,7 +765,7 @@ void SetupMacroTileScissors(DRAW_CONTEXT *pDC)
 tileAligned  = (scissorInFixedPoint.xmin % KNOB_TILE_X_DIM) == 0;
 tileAligned &= (scissorInFixedPoint.ymin % KNOB_TILE_Y_DIM) == 0;
 tileAligned &= (scissorInFixedPoint.xmax % KNOB_TILE_X_DIM) == 0;
-tileAligned &= (scissorInFixedPoint.xmax % KNOB_TILE_Y_DIM) == 0;
+tileAligned &= (scissorInFixedPoint.ymax % KNOB_TILE_Y_DIM) == 0;
 
 pState->scissorsTileAligned &= tileAligned;
 

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


Mesa (master): swr: don't clear all dirty bits when changing so targets

2016-11-28 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 0a5e1b02cf6103037b488db5daa3097fbcfcf670
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a5e1b02cf6103037b488db5daa3097fbcfcf670

Author: Ilia Mirkin 
Date:   Fri Nov 25 21:08:16 2016 -0500

swr: don't clear all dirty bits when changing so targets

Among other things, blits would clear existing SO targets which would
cause a bunch of updates from u_blitter to be missed.

Fixes fbo-scissor-blit fbo, probably among many others.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/swr_state.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/swr_state.cpp 
b/src/gallium/drivers/swr/swr_state.cpp
index 4119379..a67cb60 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -1570,7 +1570,7 @@ swr_set_so_targets(struct pipe_context *pipe,
 
swr->num_so_targets = num_targets;
 
-   swr->dirty = SWR_NEW_SO;
+   swr->dirty |= SWR_NEW_SO;
 }
 
 

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


Mesa (master): anv: Fix cache UUID generation.

2016-11-28 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 15d3fc167a6eebc6df50c603275288cc496d6689
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=15d3fc167a6eebc6df50c603275288cc496d6689

Author: Kenneth Graunke 
Date:   Mon Nov 28 13:37:44 2016 -0800

anv: Fix cache UUID generation.

I asked Emil to switch from 0 (success) vs. -1 (fail) to use a boolean
in my review comments.  The "not" went missing.  Easy mistake, but the
result is that nothing runs at all :)

Fix whitespace while we're here too.

Signed-off-by: Kenneth Graunke 

---

 src/intel/vulkan/anv_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 320119f..e140621 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -75,8 +75,8 @@ anv_device_get_cache_uuid(void *uuid)
uint32_t timestamp;
 
memset(uuid, 0, VK_UUID_SIZE);
-   if (anv_get_function_timestamp(anv_device_get_cache_uuid, ))
- return false;
+   if (!anv_get_function_timestamp(anv_device_get_cache_uuid, ))
+  return false;
 
snprintf(uuid, VK_UUID_SIZE, "anv-%d", timestamp);
return true;

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


Mesa (master): vulkan/wsi: Fix resource leak in success path of wsi_queue_init()

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 65ea559465df527d8a2998380c7eb2554780a2ba
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=65ea559465df527d8a2998380c7eb2554780a2ba

Author: Gwan-gyeong Mun 
Date:   Fri Nov 25 23:39:04 2016 +0900

vulkan/wsi: Fix resource leak in success path of wsi_queue_init()

It fixes leakage of pthread_condattr resource on wsi_queue_init()

Cc: "13.0" 
Signed-off-by: Mun Gwan-gyeong 
Reviewed-by: Emil Velikov 
Reviewed-by: Eduardo Lima Mitev 

---

 src/vulkan/wsi/wsi_common_queue.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/vulkan/wsi/wsi_common_queue.h 
b/src/vulkan/wsi/wsi_common_queue.h
index 0e72c8d..6d489cb 100644
--- a/src/vulkan/wsi/wsi_common_queue.h
+++ b/src/vulkan/wsi/wsi_common_queue.h
@@ -65,6 +65,7 @@ wsi_queue_init(struct wsi_queue *queue, int length)
if (ret)
   goto fail_cond;
 
+   pthread_condattr_destroy();
return 0;
 
 fail_cond:

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


Mesa (master): anv: Update the teardown in reverse order of the anv_CreateDevice

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: b178652b41410483dcd82aba495eab6bc892ab15
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b178652b41410483dcd82aba495eab6bc892ab15

Author: Gwan-gyeong Mun 
Date:   Fri Nov 25 23:34:46 2016 +0900

anv: Update the teardown in reverse order of the anv_CreateDevice

This updates releasing of resource in reverse order of the anv_CreateDevice
to anv_DestroyDevice.
And it fixes resource leak in pthread_mutex, pthread_cond, anv_gem_context.

Cc: "13.0" 
Signed-off-by: Mun Gwan-gyeong 
Reviewed-by: Emil Velikov 
Reviewed-by: Jason Ekstrand 

---

 src/intel/vulkan/anv_device.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 0b440fb..320119f 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -993,10 +993,10 @@ void anv_DestroyDevice(
 {
ANV_FROM_HANDLE(anv_device, device, _device);
 
-   anv_queue_finish(>queue);
-
anv_device_finish_blorp(device);
 
+   anv_queue_finish(>queue);
+
 #ifdef HAVE_VALGRIND
/* We only need to free these to prevent valgrind errors.  The backing
 * BO will go away in a couple of lines so we don't actually leak.
@@ -1004,22 +1004,27 @@ void anv_DestroyDevice(
anv_state_pool_free(>dynamic_state_pool, device->border_colors);
 #endif
 
+   anv_scratch_pool_finish(device, >scratch_pool);
+
anv_gem_munmap(device->workaround_bo.map, device->workaround_bo.size);
anv_gem_close(device, device->workaround_bo.gem_handle);
 
-   anv_bo_pool_finish(>batch_bo_pool);
-   anv_state_pool_finish(>dynamic_state_pool);
-   anv_block_pool_finish(>dynamic_state_block_pool);
-   anv_state_pool_finish(>instruction_state_pool);
-   anv_block_pool_finish(>instruction_block_pool);
anv_state_pool_finish(>surface_state_pool);
anv_block_pool_finish(>surface_state_block_pool);
-   anv_scratch_pool_finish(device, >scratch_pool);
+   anv_state_pool_finish(>instruction_state_pool);
+   anv_block_pool_finish(>instruction_block_pool);
+   anv_state_pool_finish(>dynamic_state_pool);
+   anv_block_pool_finish(>dynamic_state_block_pool);
 
-   close(device->fd);
+   anv_bo_pool_finish(>batch_bo_pool);
 
+   pthread_cond_destroy(>queue_submit);
pthread_mutex_destroy(>mutex);
 
+   anv_gem_destroy_context(device, device->context_id);
+
+   close(device->fd);
+
vk_free(>alloc, device);
 }
 

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


Mesa (master): anv: Add missing error-checking to anv_block_pool_init (v2)

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: ecc618b0d88e462270ffedf01502ede4c60fdad9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ecc618b0d88e462270ffedf01502ede4c60fdad9

Author: Gwan-gyeong Mun 
Date:   Fri Nov 25 23:34:42 2016 +0900

anv: Add missing error-checking to anv_block_pool_init (v2)

When the memfd_create() and u_vector_init() fail on anv_block_pool_init(),
this patch makes to return VK_ERROR_INITIALIZATION_FAILED.
All of initialization success on anv_block_pool_init(), it makes to return
VK_SUCCESS.

CID 1394319

v2: Fixes from Emil's review:
  a) Add the return type for propagating the return value to caller.
  b) Changed anv_block_pool_init() to return VK_ERROR_INITIALIZATION_FAILED
 on failure of initialization.

Cc: "13.0" 
Signed-off-by: Mun Gwan-gyeong 
Reviewed-by: Emil Velikov 
Reviewed-by: Jason Ekstrand 

---

 src/intel/vulkan/anv_allocator.c | 27 +--
 src/intel/vulkan/anv_private.h   |  4 ++--
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index f472213..45c663b 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -246,10 +246,12 @@ anv_ptr_free_list_push(void **list, void *elem)
 static uint32_t
 anv_block_pool_grow(struct anv_block_pool *pool, struct anv_block_state 
*state);
 
-void
+VkResult
 anv_block_pool_init(struct anv_block_pool *pool,
 struct anv_device *device, uint32_t block_size)
 {
+   VkResult result;
+
assert(util_is_power_of_two(block_size));
 
pool->device = device;
@@ -260,17 +262,23 @@ anv_block_pool_init(struct anv_block_pool *pool,
 
pool->fd = memfd_create("block pool", MFD_CLOEXEC);
if (pool->fd == -1)
-  return;
+  return vk_error(VK_ERROR_INITIALIZATION_FAILED);
 
/* Just make it 2GB up-front.  The Linux kernel won't actually back it
 * with pages until we either map and fault on one of them or we use
 * userptr and send a chunk of it off to the GPU.
 */
-   if (ftruncate(pool->fd, BLOCK_POOL_MEMFD_SIZE) == -1)
-  return;
+   if (ftruncate(pool->fd, BLOCK_POOL_MEMFD_SIZE) == -1) {
+  result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
+  goto fail_fd;
+   }
 
-   u_vector_init(>mmap_cleanups,
-   round_to_power_of_two(sizeof(struct anv_mmap_cleanup)), 
128);
+   if (!u_vector_init(>mmap_cleanups,
+  round_to_power_of_two(sizeof(struct anv_mmap_cleanup)),
+  128)) {
+  result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
+  goto fail_fd;
+   }
 
pool->state.next = 0;
pool->state.end = 0;
@@ -279,6 +287,13 @@ anv_block_pool_init(struct anv_block_pool *pool,
 
/* Immediately grow the pool so we'll have a backing bo. */
pool->state.end = anv_block_pool_grow(pool, >state);
+
+   return VK_SUCCESS;
+
+ fail_fd:
+   close(pool->fd);
+
+   return result;
 }
 
 void
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 4949a80..1f03b68 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -433,8 +433,8 @@ anv_state_clflush(struct anv_state state)
anv_clflush_range(state.map, state.alloc_size);
 }
 
-void anv_block_pool_init(struct anv_block_pool *pool,
- struct anv_device *device, uint32_t block_size);
+VkResult anv_block_pool_init(struct anv_block_pool *pool,
+ struct anv_device *device, uint32_t block_size);
 void anv_block_pool_finish(struct anv_block_pool *pool);
 int32_t anv_block_pool_alloc(struct anv_block_pool *pool);
 int32_t anv_block_pool_alloc_back(struct anv_block_pool *pool);

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


Mesa (master): anv: drop the return type for anv_queue_init()

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: ca4706960c27e7ff46ce6ffa64cdaccfd2dee28b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca4706960c27e7ff46ce6ffa64cdaccfd2dee28b

Author: Gwan-gyeong Mun 
Date:   Fri Nov 25 23:34:43 2016 +0900

anv: drop the return type for anv_queue_init()

anv_queue_init() always returns VK_SUCCESS, so caller does not need
to check return value of anv_queue_init().

Signed-off-by: Mun Gwan-gyeong 
Reviewed-by: Emil Velikov 
Reviewed-by: Jason Ekstrand 

---

 src/intel/vulkan/anv_device.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 0518aaf..0b440fb 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -737,14 +737,12 @@ PFN_vkVoidFunction anv_GetDeviceProcAddr(
return anv_lookup_entrypoint(>info, pName);
 }
 
-static VkResult
+static void
 anv_queue_init(struct anv_device *device, struct anv_queue *queue)
 {
queue->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
queue->device = device;
queue->pool = >surface_state_pool;
-
-   return VK_SUCCESS;
 }
 
 static void

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


Mesa (master): st/omx/dec/h264: consider POC as signed instead of unsigned

2016-11-28 Thread Leo Liu
Module: Mesa
Branch: master
Commit: 02bf1bbe6e81cebe662dda12167f6d2f9823b39b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=02bf1bbe6e81cebe662dda12167f6d2f9823b39b

Author: Chandu Babu Namburu 
Date:   Wed Nov 23 20:42:34 2016 +0530

st/omx/dec/h264: consider POC as signed instead of unsigned

picture order count can be a negative value

Reviewed-by: Christian König 

---

 src/gallium/state_trackers/omx/vid_dec_h264.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/omx/vid_dec_h264.c 
b/src/gallium/state_trackers/omx/vid_dec_h264.c
index a680844..7ea71c1 100644
--- a/src/gallium/state_trackers/omx/vid_dec_h264.c
+++ b/src/gallium/state_trackers/omx/vid_dec_h264.c
@@ -46,7 +46,7 @@ struct dpb_list {
struct list_head list;
struct pipe_video_buffer *buffer;
OMX_TICKS timestamp;
-   unsigned poc;
+   int poc;
 };
 
 static const uint8_t Default_4x4_Intra[16] = {
@@ -737,8 +737,8 @@ static void slice_header(vid_dec_PrivateType *priv, struct 
vl_rbsp *rbsp,
if (sps->pic_order_cnt_type == 0) {
   unsigned log2_max_pic_order_cnt_lsb = 
sps->log2_max_pic_order_cnt_lsb_minus4 + 4;
   unsigned max_pic_order_cnt_lsb = 1 << log2_max_pic_order_cnt_lsb;
-  unsigned pic_order_cnt_lsb = vl_rbsp_u(rbsp, log2_max_pic_order_cnt_lsb);
-  unsigned pic_order_cnt_msb;
+  int pic_order_cnt_lsb = vl_rbsp_u(rbsp, log2_max_pic_order_cnt_lsb);
+  int pic_order_cnt_msb;
 
   if (pic_order_cnt_lsb != priv->codec_data.h264.pic_order_cnt_lsb)
  vid_dec_h264_EndFrame(priv);

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


Mesa (master): configure.ac: remove no longer used TIMESTAMP_CMD

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 2f1a1f589e5f744b26ec17497097aae8de73672c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f1a1f589e5f744b26ec17497097aae8de73672c

Author: Emil Velikov 
Date:   Thu Nov 24 20:30:41 2016 +

configure.ac: remove no longer used TIMESTAMP_CMD

Good bye, you shall not be missed.

Signed-off-by: Emil Velikov 

---

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

diff --git a/configure.ac b/configure.ac
index 5f30ae8..e7e5628 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2644,8 +2644,6 @@ AC_SUBST([XA_MINOR], $XA_MINOR)
 AC_SUBST([XA_TINY], $XA_TINY)
 AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
 
-AC_SUBST([TIMESTAMP_CMD], '`test $(SOURCE_DATE_EPOCH) && echo 
$(SOURCE_DATE_EPOCH) || date +%s`')
-
 AC_ARG_ENABLE(valgrind,
   [AS_HELP_STRING([--enable-valgrind],
  [Build mesa with valgrind support (default: 
auto)])],

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


Mesa (master): anv: don't leak memory if anv_init_wsi() fails

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: a1cf494f7740c2afb851ffc3248e2cfa54d74ead
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1cf494f7740c2afb851ffc3248e2cfa54d74ead

Author: Emil Velikov 
Date:   Thu Nov 24 20:30:43 2016 +

anv: don't leak memory if anv_init_wsi() fails

brw_compiler_create() rzalloc-ates memory which we forgot to free.

Cc: "13.0" 
Signed-off-by: Emil Velikov 
Reviewed-by: Jason Ekstrand 

---

 src/intel/vulkan/anv_device.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index a410376..0518aaf 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -208,8 +208,10 @@ anv_physical_device_init(struct anv_physical_device 
*device,
device->compiler->shader_perf_log = compiler_perf_log;
 
result = anv_init_wsi(device);
-   if (result != VK_SUCCESS)
-   goto fail;
+   if (result != VK_SUCCESS) {
+  ralloc_free(device->compiler);
+  goto fail;
+   }
 
isl_device_init(>isl_dev, >info, swizzled);
 

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


Mesa (master): radv: don't return VK_SUCCESS if radv_device_get_cache_uuid () fails

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 7c277eae986ae230b36fc09fd2346f10ea8589e4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c277eae986ae230b36fc09fd2346f10ea8589e4

Author: Emil Velikov 
Date:   Thu Nov 24 20:30:45 2016 +

radv: don't return VK_SUCCESS if radv_device_get_cache_uuid() fails

If radv_device_get_cache_uuid() fails result will be VK_SUCCESS as set
by the radv_init_wsi() call above.

Fixes: d943839 (radv: Use library mtime for cache UUID.)
Signed-off-by: Emil Velikov 
Reviewed-by: Bas Nieuwenhuizen 

---

 src/amd/vulkan/radv_device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 0dbb3f8..ce697a9 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -125,6 +125,8 @@ radv_physical_device_init(struct radv_physical_device 
*device,
if (radv_device_get_cache_uuid(device->rad_info.family, device->uuid)) {
radv_finish_wsi(device);
device->ws->destroy(device->ws);
+   result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+  "cannot generate UUID");
goto fail;
}
 

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


Mesa (master): anv: Store UUID in physical device.

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: de138e9cede4b1996fac9256d894c80e7b48a6d7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=de138e9cede4b1996fac9256d894c80e7b48a6d7

Author: Emil Velikov 
Date:   Thu Nov 24 20:30:38 2016 +

anv: Store UUID in physical device.

Port of an equivalent commit for radv.

v2: Move the call just after MMAP_VERSION (Ken).

Signed-off-by: Emil Velikov 
Reviewed-by: Jason Ekstrand 

---

 src/intel/vulkan/anv_device.c | 17 +
 src/intel/vulkan/anv_pipeline_cache.c |  8 
 src/intel/vulkan/anv_private.h|  4 ++--
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 51f0dc4..d5fbb8c 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -53,6 +53,13 @@ compiler_perf_log(void *data, const char *fmt, ...)
va_end(args);
 }
 
+static void
+anv_device_get_cache_uuid(void *uuid)
+{
+   memset(uuid, 0, VK_UUID_SIZE);
+   snprintf(uuid, VK_UUID_SIZE, "anv-%s", ANV_TIMESTAMP);
+}
+
 static VkResult
 anv_physical_device_init(struct anv_physical_device *device,
  struct anv_instance *instance,
@@ -134,6 +141,7 @@ anv_physical_device_init(struct anv_physical_device *device,
   goto fail;
}
 
+   anv_device_get_cache_uuid(device->uuid);
bool swizzled = anv_gem_get_bit6_swizzle(fd, I915_TILING_X);
 
/* GENs prior to 8 do not support EU/Subslice info */
@@ -454,13 +462,6 @@ void anv_GetPhysicalDeviceFeatures(
   pdevice->compiler->scalar_stage[MESA_SHADER_GEOMETRY];
 }
 
-void
-anv_device_get_cache_uuid(void *uuid)
-{
-   memset(uuid, 0, VK_UUID_SIZE);
-   snprintf(uuid, VK_UUID_SIZE, "anv-%s", ANV_TIMESTAMP);
-}
-
 void anv_GetPhysicalDeviceProperties(
 VkPhysicalDevicephysicalDevice,
 VkPhysicalDeviceProperties* pProperties)
@@ -601,7 +602,7 @@ void anv_GetPhysicalDeviceProperties(
};
 
strcpy(pProperties->deviceName, pdevice->name);
-   anv_device_get_cache_uuid(pProperties->pipelineCacheUUID);
+   memcpy(pProperties->pipelineCacheUUID, pdevice->uuid, VK_UUID_SIZE);
 }
 
 void anv_GetPhysicalDeviceQueueFamilyProperties(
diff --git a/src/intel/vulkan/anv_pipeline_cache.c 
b/src/intel/vulkan/anv_pipeline_cache.c
index ddd51db..a8ea80f 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -333,8 +333,8 @@ anv_pipeline_cache_load(struct anv_pipeline_cache *cache,
 const void *data, size_t size)
 {
struct anv_device *device = cache->device;
+   struct anv_physical_device *pdevice = >instance->physicalDevice;
struct cache_header header;
-   uint8_t uuid[VK_UUID_SIZE];
 
if (cache->cache == NULL)
   return;
@@ -350,8 +350,7 @@ anv_pipeline_cache_load(struct anv_pipeline_cache *cache,
   return;
if (header.device_id != device->chipset_id)
   return;
-   anv_device_get_cache_uuid(uuid);
-   if (memcmp(header.uuid, uuid, VK_UUID_SIZE) != 0)
+   if (memcmp(header.uuid, pdevice->uuid, VK_UUID_SIZE) != 0)
   return;
 
const void *end = data + size;
@@ -470,6 +469,7 @@ VkResult anv_GetPipelineCacheData(
 {
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_pipeline_cache, cache, _cache);
+   struct anv_physical_device *pdevice = >instance->physicalDevice;
struct cache_header *header;
 
if (pData == NULL) {
@@ -497,7 +497,7 @@ VkResult anv_GetPipelineCacheData(
header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
header->vendor_id = 0x8086;
header->device_id = device->chipset_id;
-   anv_device_get_cache_uuid(header->uuid);
+   memcpy(header->uuid, pdevice->uuid, VK_UUID_SIZE);
p += align_u32(header->header_size, 8);
 
uint32_t *count = p;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index edc008d..4949a80 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -506,6 +506,8 @@ struct anv_physical_device {
 uint32_teu_total;
 uint32_tsubslice_total;
 
+uint8_t uuid[VK_UUID_SIZE];
+
 struct wsi_device   wsi_device;
 };
 
@@ -597,8 +599,6 @@ struct anv_device {
 pthread_cond_t  queue_submit;
 };
 
-void anv_device_get_cache_uuid(void *uuid);
-
 void anv_device_init_blorp(struct anv_device *device);
 void anv_device_finish_blorp(struct anv_device *device);
 

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


Mesa (master): anv: Use library mtime for cache UUID.

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 83548e12921b5724aa6c78c2b1efc9ff774fd7a2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=83548e12921b5724aa6c78c2b1efc9ff774fd7a2

Author: Emil Velikov 
Date:   Thu Nov 24 20:30:39 2016 +

anv: Use library mtime for cache UUID.

Inspired by a similar commit for radv.

Rather than recomputing the timestamp on each make invocation, just
fetch it at runtime.

Thus we no longer get the constant rebuild of anv_device.c and the
follow-up libvulkan_intel.so link, when nothing has changed.

I.e. using make && make install is a little bit faster.

v2: Use bool return type (Ken).

Signed-off-by: Emil Velikov 
Reviewed-by: Kenneth Graunke 

---

 src/intel/vulkan/anv_device.c | 34 ++
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index d5fbb8c..3050c38 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -21,15 +21,16 @@
  * IN THE SOFTWARE.
  */
 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include "anv_private.h"
-#include "anv_timestamp.h"
 #include "util/strtod.h"
 #include "util/debug.h"
 
@@ -53,11 +54,32 @@ compiler_perf_log(void *data, const char *fmt, ...)
va_end(args);
 }
 
-static void
+static bool
+anv_get_function_timestamp(void *ptr, uint32_t* timestamp)
+{
+   Dl_info info;
+   struct stat st;
+   if (!dladdr(ptr, ) || !info.dli_fname)
+  return false;
+
+   if (stat(info.dli_fname, ))
+  return false;
+
+   *timestamp = st.st_mtim.tv_sec;
+   return true;
+}
+
+static bool
 anv_device_get_cache_uuid(void *uuid)
 {
+   uint32_t timestamp;
+
memset(uuid, 0, VK_UUID_SIZE);
-   snprintf(uuid, VK_UUID_SIZE, "anv-%s", ANV_TIMESTAMP);
+   if (anv_get_function_timestamp(anv_device_get_cache_uuid, ))
+ return false;
+
+   snprintf(uuid, VK_UUID_SIZE, "anv-%d", timestamp);
+   return true;
 }
 
 static VkResult
@@ -141,7 +163,11 @@ anv_physical_device_init(struct anv_physical_device 
*device,
   goto fail;
}
 
-   anv_device_get_cache_uuid(device->uuid);
+   if (!anv_device_get_cache_uuid(device->uuid)) {
+  result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+ "cannot generate UUID");
+  goto fail;
+   }
bool swizzled = anv_gem_get_bit6_swizzle(fd, I915_TILING_X);
 
/* GENs prior to 8 do not support EU/Subslice info */

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


Mesa (master): radv: don't leak the fd if radv_physical_device_init() succeeds

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 78707a15f205f9c2f45dc43ccbb99eb43029dc78
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=78707a15f205f9c2f45dc43ccbb99eb43029dc78

Author: Emil Velikov 
Date:   Thu Nov 24 20:30:44 2016 +

radv: don't leak the fd if radv_physical_device_init() succeeds

radv_amdgpu_winsys_create() does not take ownership of the fd, thus we
end up leaking it as we return with VK_SUCCESS.

Cc: Dave Airlie 
Cc: "13.0" 
Signed-off-by: Emil Velikov 
Reviewed-by: Bas Nieuwenhuizen 

---

 src/amd/vulkan/radv_device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index f89fc9d..0dbb3f8 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -130,6 +130,7 @@ radv_physical_device_init(struct radv_physical_device 
*device,
 
fprintf(stderr, "WARNING: radv is not a conformant vulkan 
implementation, testing use only.\n");
device->name = device->rad_info.name;
+   close(fd);
return VK_SUCCESS;
 
 fail:

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


Mesa (master): anv: automake: don't generate anv_timestamp.h

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 2d42a345664e9f1206d81ce40675688752a8c08c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d42a345664e9f1206d81ce40675688752a8c08c

Author: Emil Velikov 
Date:   Thu Nov 24 20:30:40 2016 +

anv: automake: don't generate anv_timestamp.h

No longer used as of last commit.

Signed-off-by: Emil Velikov 

---

 src/intel/vulkan/Makefile.am  | 6 --
 src/intel/vulkan/Makefile.sources | 3 +--
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 4a7bb18..e803a49 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -140,12 +140,6 @@ anv_entrypoints.c : anv_entrypoints_gen.py 
$(vulkan_include_HEADERS)
$(AM_V_GEN) cat $(vulkan_include_HEADERS) |\
$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py code > $@
 
-.PHONY: anv_timestamp.h
-
-anv_timestamp.h:
-   @echo "Updating anv_timestamp.h"
-   $(AM_V_GEN) echo "#define ANV_TIMESTAMP \"$(TIMESTAMP_CMD)\"" > $@
-
 BUILT_SOURCES = $(VULKAN_GENERATED_FILES)
 CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd.@host_cpu@.json
 EXTRA_DIST = \
diff --git a/src/intel/vulkan/Makefile.sources 
b/src/intel/vulkan/Makefile.sources
index e66df87..bd78805 100644
--- a/src/intel/vulkan/Makefile.sources
+++ b/src/intel/vulkan/Makefile.sources
@@ -59,8 +59,7 @@ VULKAN_GEM_STUB_FILES := \
 
 VULKAN_GENERATED_FILES := \
anv_entrypoints.c \
-   anv_entrypoints.h \
-   anv_timestamp.h
+   anv_entrypoints.h
 
 
 GEN7_FILES := \

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


Mesa (master): anv: don't double-close the same fd

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

Author: Emil Velikov 
Date:   Thu Nov 24 20:30:42 2016 +

anv: don't double-close the same fd

Cc: "13.0" 
Signed-off-by: Emil Velikov 

---

 src/intel/vulkan/anv_device.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 3050c38..a410376 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -197,8 +197,6 @@ anv_physical_device_init(struct anv_physical_device *device,
  device->info.max_cs_threads = max_cs_threads;
}
 
-   close(fd);
-
brw_process_intel_debug_variable();
 
device->compiler = brw_compiler_create(NULL, >info);
@@ -215,6 +213,7 @@ anv_physical_device_init(struct anv_physical_device *device,
 
isl_device_init(>isl_dev, >info, swizzled);
 
+   close(fd);
return VK_SUCCESS;
 
 fail:

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


Mesa (master): isl: Make isl_finishme only warn once per call-site

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

Author: Emil Velikov 
Date:   Thu Nov 24 18:18:15 2016 +

isl: Make isl_finishme only warn once per call-site

Signed-off-by: Emil Velikov 

---

 src/intel/isl/isl_priv.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/intel/isl/isl_priv.h b/src/intel/isl/isl_priv.h
index dc3975d..1867d25 100644
--- a/src/intel/isl/isl_priv.h
+++ b/src/intel/isl/isl_priv.h
@@ -33,7 +33,13 @@
 #include "isl.h"
 
 #define isl_finishme(format, ...) \
-   __isl_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__)
+   do { \
+  static bool reported = false; \
+  if (!reported) { \
+ __isl_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); \
+ reported = true; \
+  } \
+   } while (0)
 
 void PRINTFLIKE(3, 4) UNUSED
 __isl_finishme(const char *file, int line, const char *fmt, ...);

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


Mesa (master): anv: use do { } while (0) in the anv_finishme macro

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 7feac8bdb9d8f76f20e41e3b0314168738dd37fd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7feac8bdb9d8f76f20e41e3b0314168738dd37fd

Author: Emil Velikov 
Date:   Thu Nov 24 18:18:13 2016 +

anv: use do { } while (0) in the anv_finishme macro

Use the generic construct instead of the currect GCC specific one.

Suggested-by: Kenneth Graunke 
Signed-off-by: Emil Velikov 
Reviewed-by: Kenneth Graunke 

---

 src/intel/vulkan/anv_private.h | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 2fc543d..edc008d 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -207,13 +207,14 @@ void anv_loge_v(const char *format, va_list va);
 /**
  * Print a FINISHME message, including its source location.
  */
-#define anv_finishme(format, ...) ({ \
-   static bool reported = false; \
-   if (!reported) { \
-  __anv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); \
-  reported = true; \
-   } \
-})
+#define anv_finishme(format, ...) \
+   do { \
+  static bool reported = false; \
+  if (!reported) { \
+ __anv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); \
+ reported = true; \
+  } \
+   } while (0)
 
 /* A non-fatal assert.  Useful for debugging. */
 #ifdef DEBUG

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


Mesa (master): radv: Make radv_finishme only warn once per call-site

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: f3a1c17b96ad797735214d2012b1436af9cb46d4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f3a1c17b96ad797735214d2012b1436af9cb46d4

Author: Emil Velikov 
Date:   Thu Nov 24 18:18:14 2016 +

radv: Make radv_finishme only warn once per call-site

Signed-off-by: Emil Velikov 
Reviewed-by: Bas Nieuwenhuizen 

---

 src/amd/vulkan/radv_private.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index a5d13a9..def0af2 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -211,7 +211,13 @@ void radv_loge_v(const char *format, va_list va);
  * Print a FINISHME message, including its source location.
  */
 #define radv_finishme(format, ...) \
-   __radv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__);
+   do { \
+   static bool reported = false; \
+   if (!reported) { \
+   __radv_finishme(__FILE__, __LINE__, format, 
##__VA_ARGS__); \
+   reported = true; \
+   } \
+   } while (0)
 
 /* A non-fatal assert.  Useful for debugging. */
 #ifdef DEBUG

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


Mesa (master): docs: add note about r-b/other tags when resending

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: ba28f2136febca32fe567510e88265b99fcb83d2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba28f2136febca32fe567510e88265b99fcb83d2

Author: George Kyriazis 
Date:   Mon Nov 28 17:35:26 2016 +

docs: add note about r-b/other tags when resending

[Emil Velikov: split from the typos fixes]
Signed-off-by: Emil Velikov 

---

 docs/submittingpatches.html | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/docs/submittingpatches.html b/docs/submittingpatches.html
index 3d07c5e..5c832ce 100644
--- a/docs/submittingpatches.html
+++ b/docs/submittingpatches.html
@@ -104,6 +104,9 @@ that should be documented with:
 Reviewed-by: Joe Hacker jhac...@foo.com
 Acked-by: Joe Hacker jhac...@foo.com
 
+If sending later revision of a patch, add all the tags - ack, r-b,
+Cc: mesa-stabe and/or other. This provides reviewers with quick feedback if the
+patch has already been reviewed.
 In order for your patch to reach the prospective reviewer easier/faster,
 use the script scripts/get_reviewer.pl to get a list of individuals and include
 them in the CC list.

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


Mesa (master): docs/releasing: use correct page title

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 028d29b8b391da84d991465fd7baba17b93c05af
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=028d29b8b391da84d991465fd7baba17b93c05af

Author: Emil Velikov 
Date:   Mon Nov 28 17:22:15 2016 +

docs/releasing: use correct page title

Signed-off-by: Emil Velikov 

---

 docs/releasing.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/releasing.html b/docs/releasing.html
index 4287953..946aaa4 100644
--- a/docs/releasing.html
+++ b/docs/releasing.html
@@ -2,7 +2,7 @@
 
 
   
-  Development Notes
+  Releasing process
   
 
 

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


Mesa (master): docs: fix small typos in the submit patches page

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 28158c3e543d364c9d6bb0cced1b251915076214
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=28158c3e543d364c9d6bb0cced1b251915076214

Author: Andres Gomez 
Date:   Mon Nov 28 18:47:42 2016 +0200

docs: fix small typos in the submit patches page

Signed-off-by: Andres Gomez 
Reviewed-by: Emil Velikov 

---

 docs/submittingpatches.html | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/submittingpatches.html b/docs/submittingpatches.html
index 2d18c74..3d07c5e 100644
--- a/docs/submittingpatches.html
+++ b/docs/submittingpatches.html
@@ -41,7 +41,7 @@ components.
 git bisect.)
 Patches should be properly formatted.
 Patches should be sufficiently tested before 
submitting.
-Patches should be submitted to submitted to mesa-dev
+Patches should be submitted to mesa-dev
 for review using git send-email.
 
 
@@ -254,9 +254,9 @@ branches. Everyone else should simply nominate patches 
using the mechanism
 described above.
 
 The stable-release manager will work with the list of nominated patches, and
-for each patch that meets the crtieria below will cherry-pick the patch with:
+for each patch that meets the criteria below will cherry-pick the patch with:
 git cherry-pick -x commit. The -x option is
-important so that the picked patch references the comit ID of the original
+important so that the picked patch references the commit ID of the original
 patch.
 
 The stable-release manager may at times need to force-push changes to the
@@ -328,7 +328,7 @@ be rejected:
   release. The potential problem here is that an OpenGL program that was
   previously working, (even if technically non-compliant with the
   specification), could stop working after this patch. So that would be a
-  regression that is unaacceptable for the stable branch.
+  regression that is unacceptable for the stable branch.
 
 
 Git tips

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


Mesa (master): docs/release: drop references to patchwork

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: a7a416f34780bb6bb2b671c2d9cd0911b238adb0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7a416f34780bb6bb2b671c2d9cd0911b238adb0

Author: Emil Velikov 
Date:   Mon Nov 28 15:35:43 2016 +

docs/release: drop references to patchwork

The changes to release.sh have landed, so all we need is a recent
checkout of xorg-utils.

Signed-off-by: Emil Velikov 

---

 docs/releasing.html | 5 -
 1 file changed, 5 deletions(-)

diff --git a/docs/releasing.html b/docs/releasing.html
index 400cf92..30ac5c8 100644
--- a/docs/releasing.html
+++ b/docs/releasing.html
@@ -408,11 +408,6 @@ Commit these changes and push the branch.
 Use the release.sh script from xorg util-macros
 
 
-If latest checkout [still] does not the mesa integration, fetch the patches
-from https://patchwork.freedesktop.org/series/15176/;>Patchwork.
-
-
-
 Ensure that the mesa git tree is clean via git clean -fXd and
 start the release process.
 

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


Mesa (master): docs/releasing: correctly document touch-testing

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: f9959ca92efbf0dcf032cd335b285c9d61c7af4e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9959ca92efbf0dcf032cd335b285c9d61c7af4e

Author: Emil Velikov 
Date:   Mon Nov 28 17:18:06 2016 +

docs/releasing: correctly document touch-testing

I've used an ancient version of the script which did not cover:
 - version expansion (cd mesa-* does not work)
 - --enable-glx-tls
 - EGL and es2* testing
 - Vulkan and DOTA2

Signed-off-by: Emil Velikov 

---

 docs/releasing.html | 35 +--
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/docs/releasing.html b/docs/releasing.html
index 30ac5c8..4287953 100644
--- a/docs/releasing.html
+++ b/docs/releasing.html
@@ -300,11 +300,6 @@ Reason: ...
 
 Making a new release
 
-* process - manual + xorg tool
-+ ^^ verify
-+ touch test -> glxgears/info dota2vk
-
-
 
 These are the instructions for making a new Mesa release.
 
@@ -335,36 +330,56 @@ Here is one solution that I've been using.
 
git clean -fXd; git clean -nxd
read # quick cross check any outstanding files
+   export __version=`cat VERSION`
export __mesa_root=../
export __build_root=./foo
chmod 755 -fR $__build_root; rm -rf $__build_root
mkdir -p $__build_root  cd $__build_root
 
-$__mesa_root/autogen.sh --enable-llvm-shared-libs  make -j2 
distcheck
+   $__mesa_root/autogen.sh --enable-llvm-shared-libs  make -j2 
distcheck
 
# Build check the tarballs (scons)
-   tar -xaf mesa-*.tar.xz  cd mesa-*  scons  
cd ..
+   tar -xaf mesa-$__version.tar.xz  cd mesa-$__version 
 scons  cd ..
 
# Test the automake binaries
-   tar -xaf mesa-*.tar.xz  cd mesa-*
+   rm -rf cd mesa-$__version
+   tar -xaf mesa-$__version.tar.xz  cd mesa-$__version
./configure \
--with-dri-drivers=i965,swrast \
--with-gallium-drivers=swrast \
+   --with-vulkan-drivers=intel \
--enable-llvm-shared-libs \
-   --enable-gallium-llvm
+   --enable-gallium-llvm \
+   --enable-glx-tls \
+   --enable-gbm \
+   --enable-egl \
+   --with-egl-platforms=x11,drm,wayland
make -j2  DESTDIR=`pwd`/test make -j6 install
export LD_LIBRARY_PATH=`pwd`/test/usr/local/lib/
export LIBGL_DRIVERS_PATH=`pwd`/test/usr/local/lib/dri/
-   xport LIBGL_DEBUG=verbose
+   export LIBGL_DEBUG=verbose
glxinfo | egrep -o "Mesa.*"
glxgears
+   es2_info | egrep "GL_VERSION|GL_RENDERER"
+   es2gears_x11
export LIBGL_ALWAYS_SOFTWARE=1
glxinfo | egrep -o "Mesa.*|Gallium.*"
glxgears
+   es2_info | egrep "GL_VERSION|GL_RENDERER"
+   es2gears_x11
export LIBGL_ALWAYS_SOFTWARE=1
export GALLIUM_DRIVER=softpipe
glxinfo | egrep -o "Mesa.*|Gallium.*"
glxgears
+   es2_info | egrep "GL_VERSION|GL_RENDERER"
+   es2gears_x11
+   # Smoke test DOTA2
+   unset LD_LIBRARY_PATH
+   unset LIBGL_DRIVERS_PATH
+   unset LIBGL_DEBUG
+   unset LIBGL_ALWAYS_SOFTWARE
+   export VK_ICD_FILENAMES=`pwd`/src/intel/vulkan/dev_icd.json
+   steam steam://rungameid/570  -vconsole -vulkan
 
 
 Update version in file VERSION

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


Mesa (master): docs: add git tips how to do commit fixups and squash them

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 6dae5be806d385a6ef628aa8144885c1a218c051
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6dae5be806d385a6ef628aa8144885c1a218c051

Author: Emil Velikov 
Date:   Mon Nov 28 17:40:04 2016 +

docs: add git tips how to do commit fixups and squash them

Signed-off-by: Emil Velikov 

---

 docs/submittingpatches.html | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/docs/submittingpatches.html b/docs/submittingpatches.html
index 5c832ce..74136f2 100644
--- a/docs/submittingpatches.html
+++ b/docs/submittingpatches.html
@@ -337,6 +337,13 @@ be rejected:
 Git tips
 
 
+git rebase -i ... is your friend. Don't be afraid to use it.
+Apply a fixup to commit FOO.
+
+git add ...
+git commit --fixup=FOO
+git rebase -i --autosquash ...
+
 Test for build breakage between patches e.g last 8 commits.
 
 git rebase -i --exec="make -j4" HEAD~8

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

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

Author: Emil Velikov 
Date:   Mon Nov 28 15:30:13 2016 +

docs: add news item and link release notes for 13.0.2

Signed-off-by: Emil Velikov 

---

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

diff --git a/docs/index.html b/docs/index.html
index 4ce12c4..e2845e5 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -16,6 +16,12 @@
 
 News
 
+November 28, 2016
+
+Mesa 13.0.2 is released.
+This is a bug-fix release.
+
+
 November 14, 2016
 
 Mesa 13.0.1 is released.
diff --git a/docs/relnotes.html b/docs/relnotes.html
index f914c68..93b4bc3 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.
 
 
 
+13.0.2 release notes
 13.0.1 release notes
 12.0.4 release notes
 13.0.0 release notes

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


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

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: bc5c299b4f9a20fe0044be040d4959aea71b5d1b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc5c299b4f9a20fe0044be040d4959aea71b5d1b

Author: Emil Velikov 
Date:   Mon Nov 28 15:06:08 2016 +

docs: add release notes for 13.0.2

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

---

 docs/relnotes/13.0.2.html | 188 ++
 1 file changed, 188 insertions(+)

diff --git a/docs/relnotes/13.0.2.html b/docs/relnotes/13.0.2.html
new file mode 100644
index 000..5125b61
--- /dev/null
+++ b/docs/relnotes/13.0.2.html
@@ -0,0 +1,188 @@
+http://www.w3.org/TR/html4/loose.dtd;>
+
+
+  
+  Mesa Release Notes
+  
+
+
+
+
+  The Mesa 3D Graphics Library
+
+
+
+
+
+Mesa 13.0.2 Release Notes / November 28, 2016
+
+
+Mesa 13.0.2 is a bug fix release which fixes bugs found since the 13.0.1 
release.
+
+
+Mesa 13.0.2 implements the OpenGL 4.4 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.4.  OpenGL
+4.4 is only available if requested at context creation
+because compatibility contexts are not supported.
+
+
+
+SHA256 checksums
+
+TBD
+
+
+
+New features
+None
+
+
+Bug fixes
+
+
+
+https://bugs.freedesktop.org/show_bug.cgi?id=97321;>Bug 97321 
- Query INFO_LOG_LENGTH for empty info log should return 0
+
+https://bugs.freedesktop.org/show_bug.cgi?id=97420;>Bug 97420 
- #version 0 crashes glsl_compiler
+
+https://bugs.freedesktop.org/show_bug.cgi?id=98632;>Bug 98632 
- Fix build on Hurd without PATH_MAX
+
+
+
+
+Changes
+
+Ben Widawsky (3):
+
+  i965: Add some APL and KBL SKU strings
+  i965: Reorder PCI ID list to match release order
+  i965/glk: Add basic Geminilake support
+
+
+Dave Airlie (14):
+
+  radv: fix texturesamples to handle single sample case
+  wsi: fix VK_INCOMPLETE for vkGetSwapchainImagesKHR
+  radv: don't crash on null swapchain destroy.
+  ac/nir/llvm: fix channel in texture gather lowering code.
+  radv: make sure to flush input attachments correctly.
+  radv: fix image view creation for depth and stencil only
+  radv: spir-v allows texture size query with and without lod.
+  vulkan/wsi/x11: handle timeouts properly in next image acquire 
(v1.1)
+  vulkan/wsi: store present mode in swapchain base class
+  vulkan/wsi/x11: add support for IMMEDIATE present mode
+  radv: fix texel fetch offset with 2d arrays.
+  radv/si: fix optimal micro tile selection
+  radv/ac/llvm: shadow samplers only return one value.
+  radv: fix 3D clears with baseMiplevel
+
+
+Eduardo Lima Mitev (2):
+
+  vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHR
+  vulkan/wsi/x11: Fix behavior of 
vkGetPhysicalDeviceSurfacePresentModesKHR
+
+
+Emil Velikov (5):
+
+  docs: add sha256 checksums for 13.0.1
+  cherry-ignore: add reverted LLVM_LIBDIR patch
+  anv: fix enumeration of properties
+  radv: honour the number of properties available
+  Update version to 13.0.2
+
+
+Eric Anholt (3):
+
+  vc4: Don't abort when a shader compile fails.
+  vc4: Clamp the shadow comparison value.
+  vc4: Fix register class handling of DDX/DDY arguments.
+
+
+Gwan-gyeong Mun (2):
+
+  util/disk_cache: close a previously opened handle in disk_cache_put 
(v2)
+  anv: Fix unintentional integer overflow in 
anv_CreateDmaBufImageINTEL
+
+
+Iago Toral Quiroga (1):
+
+  anv/format: handle unsupported formats properly
+
+
+Ian Romanick (2):
+
+  glcpp: Handle '#version 0' and other invalid values
+  glsl: Parse 0 as a preprocessor INTCONSTANT
+
+
+Jason Ekstrand (15):
+
+  anv/gen8: Stall when needed in Cmd(Set|Reset)Event
+  anv/wsi: Set the fence to signaled in AcquireNextImageKHR
+  anv: Rework fences
+  vulkan/wsi/wayland: Include pthread.h
+  vulkan/wsi/wayland: Clean up some error handling paths
+  vulkan/wsi: Report the correct min/maxImageCount
+  i965/gs: Allow primitive id to be a system value
+  anv: Handle null in all destructors
+  anv/fence: Handle ANV_FENCE_CREATE_SIGNALED_BIT
+  nir/spirv: Fix handling of gl_PrimitiveId
+  anv/blorp: Ignore clears for attachments first used as resolve 
destinations
+  anv: Implement a depth stall restriction on gen7
+  anv/cmd_buffer: Handle running out of binding tables in compute 
shaders
+  anv/cmd_buffer: Emit a CS stall before setting a CS pipeline
+  vulkan/wsi/x11: Implement FIFO mode.
+
+
+Jordan Justen (2):
+
+  isl: Fix height calculation in isl_msaa_interleaved_scale_px_to_sa
+  i965/hsw: Set integer mode in sampling state for stencil texturing
+
+
+Kenneth Graunke (4):
+
+  intel: Set min_ds_entries on Broxton.
+  i965: Fix compute shader crash.
+  mesa: Drop PATH_MAX usage.
+  i965: Fix GS push inputs with enhanced layouts.
+
+
+Kevin Strasser (1):
+
+  vulkan/wsi: Add a thread-safe queue implementation
+
+

Mesa (13.0): docs: add sha256 checksums for 13.0.2

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 2722144beddac0aa7065b478502c7c3a1f2a5451
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2722144beddac0aa7065b478502c7c3a1f2a5451

Author: Emil Velikov 
Date:   Mon Nov 28 15:28:01 2016 +

docs: add sha256 checksums for 13.0.2

Signed-off-by: Emil Velikov 

---

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

diff --git a/docs/relnotes/13.0.2.html b/docs/relnotes/13.0.2.html
index 5125b61..2f50199 100644
--- a/docs/relnotes/13.0.2.html
+++ b/docs/relnotes/13.0.2.html
@@ -31,7 +31,8 @@ because compatibility contexts are not supported.
 
 SHA256 checksums
 
-TBD
+6014233a5db6032ab8de4881384871bbe029de684502707794ce7b3e6beec308  
mesa-13.0.2.tar.gz
+a6ed622645f4ed61da418bf65adde5bcc4bb79023c36ba7d6b45b389da4416d5  
mesa-13.0.2.tar.xz
 
 
 

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


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

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: ad7879bbb4760fefe4f385ef5b4fb96b28d6baf0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad7879bbb4760fefe4f385ef5b4fb96b28d6baf0

Author: Emil Velikov 
Date:   Mon Nov 28 15:28:01 2016 +

docs: add sha256 checksums for 13.0.2

Signed-off-by: Emil Velikov 
(cherry picked from commit 2722144beddac0aa7065b478502c7c3a1f2a5451)

---

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

diff --git a/docs/relnotes/13.0.2.html b/docs/relnotes/13.0.2.html
index 5125b61..2f50199 100644
--- a/docs/relnotes/13.0.2.html
+++ b/docs/relnotes/13.0.2.html
@@ -31,7 +31,8 @@ because compatibility contexts are not supported.
 
 SHA256 checksums
 
-TBD
+6014233a5db6032ab8de4881384871bbe029de684502707794ce7b3e6beec308  
mesa-13.0.2.tar.gz
+a6ed622645f4ed61da418bf65adde5bcc4bb79023c36ba7d6b45b389da4416d5  
mesa-13.0.2.tar.xz
 
 
 

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


Mesa: tag mesa-13.0.2: mesa-13.0.2

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: refs/tags/mesa-13.0.2
Tag:0d4908d5a890646709a2036ef9ae684a2efd5b1e
URL:
http://cgit.freedesktop.org/mesa/mesa/tag/?id=0d4908d5a890646709a2036ef9ae684a2efd5b1e

Tagger: Emil Velikov 
Date:   Mon Nov 28 15:10:19 2016 +

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


Mesa (13.0): radv: fix texel fetch offset with 2d arrays.

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 960a87fb174290f36ce0434a631b879d01397589
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=960a87fb174290f36ce0434a631b879d01397589

Author: Dave Airlie 
Date:   Thu Nov 24 03:10:52 2016 +

radv: fix texel fetch offset with 2d arrays.

The code didn't limit the offsets to the number supplied, so
if we expected 3 but only got 2 we were accessing undefined memory.

This fixes random failures in:
dEQP-VK.glsl.texture_functions.texelfetchoffset.sampler2darray_*

Reviewed-by: Bas Nieuwenhuizen 
Cc: "13.0" 
Signed-off-by: Dave Airlie 
(cherry picked from commit bb8ac183404541ca8dee31563709d5aca8de0e73)

---

 src/amd/common/ac_nir_to_llvm.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 31d7b6e..799eb34 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3517,12 +3517,13 @@ static void visit_tex(struct nir_to_llvm_context *ctx, 
nir_tex_instr *instr)
if (offsets && instr->op == nir_texop_txf) {
nir_const_value *const_offset =
nir_src_as_const_value(instr->src[const_src].src);
-
+   int num_offsets = instr->src[const_src].src.ssa->num_components;
assert(const_offset);
-   if (instr->coord_components > 2)
+   num_offsets = MIN2(num_offsets, instr->coord_components);
+   if (num_offsets > 2)
address[2] = LLVMBuildAdd(ctx->builder,
  address[2], 
LLVMConstInt(ctx->i32, const_offset->i32[2], false), "");
-   if (instr->coord_components > 1)
+   if (num_offsets > 1)
address[1] = LLVMBuildAdd(ctx->builder,
  address[1], 
LLVMConstInt(ctx->i32, const_offset->i32[1], false), "");
address[0] = LLVMBuildAdd(ctx->builder,

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


Mesa (13.0): radv/ac/llvm: shadow samplers only return one value.

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 87b76f0e058658ffe122b97e8dc7e7dc19d49265
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=87b76f0e058658ffe122b97e8dc7e7dc19d49265

Author: Dave Airlie 
Date:   Tue Oct 25 07:47:13 2016 +1000

radv/ac/llvm: shadow samplers only return one value.

The intrinsic engine asserts in llvm due to this.

Reported-by: Christoph Haag 
Cc: "13.0" 
Signed-off-by: Dave Airlie 
(cherry picked from commit b56b54cbf1d8e70c87a434da5350d11533e5fed8)

Squashed with commit:

radv/ac/llvm: fix regression with shadow samplers fix

This fixes b56b54cbf1d8e70c87a434da5350d11533e5fed8:
radv/ac/llvm: shadow samplers only return one value

It makes sure we only do that for shadow sampling, as
opposed to sizing requests.

Signed-off-by: Dave Airlie 
Cc: "13.0" 
(cherry picked from commit b2e217369e1ca4bf9d7741721559a4506b1f0ce8)

Squashed with commit:

radv: brown-paper bag for a forgotten else.

This fixes the fix:
radv/ac/llvm: fix regression with shadow samplers fix

Signed-off-by: Dave Airlie 
Cc: "13.0" 
(cherry picked from commit 020978af12ef6d598bc5efeae3704c0eb8cdafd2)

---

 src/amd/common/ac_nir_to_llvm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 799eb34..0daef08 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3545,6 +3545,8 @@ static void visit_tex(struct nir_to_llvm_context *ctx, 
nir_tex_instr *instr)
 
if (instr->op == nir_texop_query_levels)
result = LLVMBuildExtractElement(ctx->builder, result, 
LLVMConstInt(ctx->i32, 3, false), "");
+   else if (instr->is_shadow && instr->op != nir_texop_txs && instr->op != 
nir_texop_lod)
+   result = LLVMBuildExtractElement(ctx->builder, result, 
ctx->i32zero, "");
else if (instr->op == nir_texop_txs &&
 instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE &&
 instr->is_array) {

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


Mesa (13.0): vulkan/wsi/x11: Implement FIFO mode.

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: aa939d7d2a16ea3ea2da785859b96bfacf9d62d9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa939d7d2a16ea3ea2da785859b96bfacf9d62d9

Author: Jason Ekstrand 
Date:   Thu Nov  3 16:59:08 2016 -0700

vulkan/wsi/x11: Implement FIFO mode.

This implements VK_PRESENT_MODE_FIFO_KHR for X11.  Unfortunately, due to
the way the present extension works, we have to manage the queue of
presented images in a separate thread.

Signed-off-by: Jason Ekstrand 
Reviewed-by: Eric Engestrom 
Reviewed-by: Dave Airlie 
Cc: "13.0" 
(cherry picked from commit e73d136a02308088cacab842790c7670e5d07b23)

---

 src/vulkan/wsi/wsi_common_x11.c | 174 +---
 1 file changed, 164 insertions(+), 10 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 75eab6c..8e0043f 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -39,6 +39,7 @@
 
 #include "wsi_common.h"
 #include "wsi_common_x11.h"
+#include "wsi_common_queue.h"
 
 #define typed_memcpy(dest, src, count) ({ \
static_assert(sizeof(*src) == sizeof(*dest), ""); \
@@ -145,6 +146,7 @@ static const VkSurfaceFormatKHR formats[] = {
 static const VkPresentModeKHR present_modes[] = {
VK_PRESENT_MODE_IMMEDIATE_KHR,
VK_PRESENT_MODE_MAILBOX_KHR,
+   VK_PRESENT_MODE_FIFO_KHR,
 };
 
 static xcb_screen_t *
@@ -490,8 +492,15 @@ struct x11_swapchain {
xcb_present_event_t  event_id;
xcb_special_event_t *special_event;
uint64_t send_sbc;
+   uint64_t last_present_msc;
uint32_t stamp;
 
+   bool threaded;
+   VkResult status;
+   struct wsi_queue present_queue;
+   struct wsi_queue acquire_queue;
+   pthread_tqueue_manager;
+
struct x11_image images[0];
 };
 
@@ -542,6 +551,8 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
   for (unsigned i = 0; i < chain->image_count; i++) {
  if (chain->images[i].pixmap == idle->pixmap) {
 chain->images[i].busy = false;
+if (chain->threaded)
+   wsi_queue_push(>acquire_queue, i);
 break;
  }
   }
@@ -549,7 +560,13 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
   break;
}
 
-   case XCB_PRESENT_COMPLETE_NOTIFY:
+   case XCB_PRESENT_EVENT_COMPLETE_NOTIFY: {
+  xcb_present_complete_notify_event_t *complete = (void *) event;
+  if (complete->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP)
+ chain->last_present_msc = complete->msc;
+  break;
+   }
+
default:
   break;
}
@@ -578,12 +595,9 @@ static uint64_t wsi_get_absolute_timeout(uint64_t timeout)
 }
 
 static VkResult
-x11_acquire_next_image(struct wsi_swapchain *anv_chain,
-   uint64_t timeout,
-   VkSemaphore semaphore,
-   uint32_t *image_index)
+x11_acquire_next_image_poll_x11(struct x11_swapchain *chain,
+uint32_t *image_index, uint64_t timeout)
 {
-   struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
xcb_generic_event_t *event;
struct pollfd pfds;
uint64_t atimeout;
@@ -641,17 +655,38 @@ x11_acquire_next_image(struct wsi_swapchain *anv_chain,
 }
 
 static VkResult
-x11_queue_present(struct wsi_swapchain *anv_chain,
-  uint32_t image_index)
+x11_acquire_next_image_from_queue(struct x11_swapchain *chain,
+  uint32_t *image_index_out, uint64_t timeout)
+{
+   assert(chain->threaded);
+
+   uint32_t image_index;
+   VkResult result = wsi_queue_pull(>acquire_queue,
+_index, timeout);
+   if (result != VK_SUCCESS) {
+  return result;
+   } else if (chain->status != VK_SUCCESS) {
+  return chain->status;
+   }
+
+   assert(image_index < chain->image_count);
+   xshmfence_await(chain->images[image_index].shm_fence);
+
+   *image_index_out = image_index;
+
+   return VK_SUCCESS;
+}
+
+static VkResult
+x11_present_to_x11(struct x11_swapchain *chain, uint32_t image_index,
+   uint32_t target_msc)
 {
-   struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
struct x11_image *image = >images[image_index];
 
assert(image_index < chain->image_count);
 
uint32_t options = XCB_PRESENT_OPTION_NONE;
 
-   int64_t target_msc = 0;
int64_t divisor = 0;
int64_t remainder = 0;
 
@@ -686,6 +721,82 @@ x11_queue_present(struct wsi_swapchain *anv_chain,
 }
 
 static VkResult

Mesa (13.0): docs: add release notes for 13.0.2

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: c9e993ba1301ac0380b86a3934f5c97ff0827594
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9e993ba1301ac0380b86a3934f5c97ff0827594

Author: Emil Velikov 
Date:   Mon Nov 28 15:06:08 2016 +

docs: add release notes for 13.0.2

Signed-off-by: Emil Velikov 

---

 docs/relnotes/13.0.2.html | 188 ++
 1 file changed, 188 insertions(+)

diff --git a/docs/relnotes/13.0.2.html b/docs/relnotes/13.0.2.html
new file mode 100644
index 000..5125b61
--- /dev/null
+++ b/docs/relnotes/13.0.2.html
@@ -0,0 +1,188 @@
+http://www.w3.org/TR/html4/loose.dtd;>
+
+
+  
+  Mesa Release Notes
+  
+
+
+
+
+  The Mesa 3D Graphics Library
+
+
+
+
+
+Mesa 13.0.2 Release Notes / November 28, 2016
+
+
+Mesa 13.0.2 is a bug fix release which fixes bugs found since the 13.0.1 
release.
+
+
+Mesa 13.0.2 implements the OpenGL 4.4 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.4.  OpenGL
+4.4 is only available if requested at context creation
+because compatibility contexts are not supported.
+
+
+
+SHA256 checksums
+
+TBD
+
+
+
+New features
+None
+
+
+Bug fixes
+
+
+
+https://bugs.freedesktop.org/show_bug.cgi?id=97321;>Bug 97321 
- Query INFO_LOG_LENGTH for empty info log should return 0
+
+https://bugs.freedesktop.org/show_bug.cgi?id=97420;>Bug 97420 
- #version 0 crashes glsl_compiler
+
+https://bugs.freedesktop.org/show_bug.cgi?id=98632;>Bug 98632 
- Fix build on Hurd without PATH_MAX
+
+
+
+
+Changes
+
+Ben Widawsky (3):
+
+  i965: Add some APL and KBL SKU strings
+  i965: Reorder PCI ID list to match release order
+  i965/glk: Add basic Geminilake support
+
+
+Dave Airlie (14):
+
+  radv: fix texturesamples to handle single sample case
+  wsi: fix VK_INCOMPLETE for vkGetSwapchainImagesKHR
+  radv: don't crash on null swapchain destroy.
+  ac/nir/llvm: fix channel in texture gather lowering code.
+  radv: make sure to flush input attachments correctly.
+  radv: fix image view creation for depth and stencil only
+  radv: spir-v allows texture size query with and without lod.
+  vulkan/wsi/x11: handle timeouts properly in next image acquire 
(v1.1)
+  vulkan/wsi: store present mode in swapchain base class
+  vulkan/wsi/x11: add support for IMMEDIATE present mode
+  radv: fix texel fetch offset with 2d arrays.
+  radv/si: fix optimal micro tile selection
+  radv/ac/llvm: shadow samplers only return one value.
+  radv: fix 3D clears with baseMiplevel
+
+
+Eduardo Lima Mitev (2):
+
+  vulkan/wsi/x11: Fix behavior of vkGetPhysicalDeviceSurfaceFormatsKHR
+  vulkan/wsi/x11: Fix behavior of 
vkGetPhysicalDeviceSurfacePresentModesKHR
+
+
+Emil Velikov (5):
+
+  docs: add sha256 checksums for 13.0.1
+  cherry-ignore: add reverted LLVM_LIBDIR patch
+  anv: fix enumeration of properties
+  radv: honour the number of properties available
+  Update version to 13.0.2
+
+
+Eric Anholt (3):
+
+  vc4: Don't abort when a shader compile fails.
+  vc4: Clamp the shadow comparison value.
+  vc4: Fix register class handling of DDX/DDY arguments.
+
+
+Gwan-gyeong Mun (2):
+
+  util/disk_cache: close a previously opened handle in disk_cache_put 
(v2)
+  anv: Fix unintentional integer overflow in 
anv_CreateDmaBufImageINTEL
+
+
+Iago Toral Quiroga (1):
+
+  anv/format: handle unsupported formats properly
+
+
+Ian Romanick (2):
+
+  glcpp: Handle '#version 0' and other invalid values
+  glsl: Parse 0 as a preprocessor INTCONSTANT
+
+
+Jason Ekstrand (15):
+
+  anv/gen8: Stall when needed in Cmd(Set|Reset)Event
+  anv/wsi: Set the fence to signaled in AcquireNextImageKHR
+  anv: Rework fences
+  vulkan/wsi/wayland: Include pthread.h
+  vulkan/wsi/wayland: Clean up some error handling paths
+  vulkan/wsi: Report the correct min/maxImageCount
+  i965/gs: Allow primitive id to be a system value
+  anv: Handle null in all destructors
+  anv/fence: Handle ANV_FENCE_CREATE_SIGNALED_BIT
+  nir/spirv: Fix handling of gl_PrimitiveId
+  anv/blorp: Ignore clears for attachments first used as resolve 
destinations
+  anv: Implement a depth stall restriction on gen7
+  anv/cmd_buffer: Handle running out of binding tables in compute 
shaders
+  anv/cmd_buffer: Emit a CS stall before setting a CS pipeline
+  vulkan/wsi/x11: Implement FIFO mode.
+
+
+Jordan Justen (2):
+
+  isl: Fix height calculation in isl_msaa_interleaved_scale_px_to_sa
+  i965/hsw: Set integer mode in sampling state for stencil texturing
+
+
+Kenneth Graunke (4):
+
+  intel: Set min_ds_entries on Broxton.
+  i965: Fix compute shader crash.
+  mesa: Drop PATH_MAX usage.
+  i965: Fix GS push inputs with enhanced layouts.
+
+
+Kevin Strasser (1):
+
+  vulkan/wsi: Add a thread-safe queue implementation
+
+
+Lionel Landwerlin (1):
+
+  anv: fix multi level clears with 

Mesa (13.0): radv: fix 3D clears with baseMiplevel

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 02fd5a19b7be6fe849b39e36d3b6e5f609927d2f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=02fd5a19b7be6fe849b39e36d3b6e5f609927d2f

Author: Dave Airlie 
Date:   Mon Nov 28 07:03:11 2016 +

radv: fix 3D clears with baseMiplevel

This fixes:
dEQP-VK.api.image_clearing.clear_color_image.3d*

These were hitting an assert as the code wasn't taking the
baseMipLevel into account when minify the image depth.

Reviewed-by: Bas Nieuwenhuizen 
Signed-off-by: Dave Airlie 
Cc: "13.0" 
(cherry picked from commit 09c0c17bc3609a5f5d3ba1df26820406ff5449bf)

---

 src/amd/vulkan/radv_meta_clear.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c
index 7e3e5f4..a347703 100644
--- a/src/amd/vulkan/radv_meta_clear.c
+++ b/src/amd/vulkan/radv_meta_clear.c
@@ -998,7 +998,7 @@ radv_cmd_clear_image(struct radv_cmd_buffer *cmd_buffer,
const VkImageSubresourceRange *range = [r];
for (uint32_t l = 0; l < radv_get_levelCount(image, range); 
++l) {
const uint32_t layer_count = image->type == 
VK_IMAGE_TYPE_3D ?
-   radv_minify(image->extent.depth, l) :
+   radv_minify(image->extent.depth, 
range->baseMipLevel + l) :
radv_get_layerCount(image, range);
for (uint32_t s = 0; s < layer_count; ++s) {
struct radv_image_view iview;

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


Mesa (13.0): vulkan/wsi: store present mode in swapchain base class

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 2e3e5c0e73cf4e3156823367084fd6e2d8286be8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e3e5c0e73cf4e3156823367084fd6e2d8286be8

Author: Dave Airlie 
Date:   Wed Oct 26 12:58:34 2016 +1000

vulkan/wsi: store present mode in swapchain base class

This just moves this up a level as x11 will need it to
implement things properly.

Reviewed-by: Jason Ekstrand 
Signed-off-by: Dave Airlie 
(cherry picked from commit 1cdca1eb16ab33da338dda076794efd4bf859f7b)

---

 src/vulkan/wsi/wsi_common.h | 1 +
 src/vulkan/wsi/wsi_common_wayland.c | 6 +++---
 src/vulkan/wsi/wsi_common_x11.c | 1 +
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index ee67511..a1f5a40 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -53,6 +53,7 @@ struct wsi_swapchain {
VkAllocationCallbacks alloc;
const struct wsi_image_fns *image_fns;
VkFence fences[3];
+   VkPresentModeKHR present_mode;
 
VkResult (*destroy)(struct wsi_swapchain *swapchain,
const VkAllocationCallbacks *pAllocator);
diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index a8130ce..f6c218b 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -576,7 +576,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain 
*wsi_chain,
 {
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
 
-   if (chain->present_mode == VK_PRESENT_MODE_FIFO_KHR) {
+   if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) {
   while (!chain->fifo_ready) {
  int ret = wl_display_dispatch_queue(chain->display->display,
  chain->queue);
@@ -589,7 +589,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain 
*wsi_chain,
wl_surface_attach(chain->surface, chain->images[image_index].buffer, 0, 0);
wl_surface_damage(chain->surface, 0, 0, INT32_MAX, INT32_MAX);
 
-   if (chain->present_mode == VK_PRESENT_MODE_FIFO_KHR) {
+   if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) {
   struct wl_callback *frame = wl_surface_frame(chain->surface);
   wl_proxy_set_queue((struct wl_proxy *)frame, chain->queue);
   wl_callback_add_listener(frame, _listener, chain);
@@ -717,12 +717,12 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase 
*icd_surface,
chain->base.acquire_next_image = wsi_wl_swapchain_acquire_next_image;
chain->base.queue_present = wsi_wl_swapchain_queue_present;
chain->base.image_fns = image_fns;
+   chain->base.present_mode = pCreateInfo->presentMode;
chain->surface = surface->surface;
chain->extent = pCreateInfo->imageExtent;
chain->vk_format = pCreateInfo->imageFormat;
chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, alpha);
 
-   chain->present_mode = pCreateInfo->presentMode;
chain->fifo_ready = true;
 
chain->image_count = num_images;
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index ae2d111..9ce3842 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -825,6 +825,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->base.acquire_next_image = x11_acquire_next_image;
chain->base.queue_present = x11_queue_present;
chain->base.image_fns = image_fns;
+   chain->base.present_mode = pCreateInfo->presentMode;
chain->conn = conn;
chain->window = window;
chain->depth = geometry->depth;

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


Mesa (13.0): vulkan/wsi/x11: add support for IMMEDIATE present mode

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 6eceac3a029c86175c68e2759439ee070972ad79
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6eceac3a029c86175c68e2759439ee070972ad79

Author: Dave Airlie 
Date:   Wed Oct 26 13:05:51 2016 +1000

vulkan/wsi/x11: add support for IMMEDIATE present mode

We shouldn't be using ASYNC here, that would be used
for immediate mode, so let's implement that.

Reviewed-by: Jason Ekstrand 
Signed-off-by: Dave Airlie 
(cherry picked from commit ca035006c86a5055c8e640f49c858f04770681eb)

---

 src/vulkan/wsi/wsi_common_x11.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 9ce3842..75eab6c 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -143,6 +143,7 @@ static const VkSurfaceFormatKHR formats[] = {
 };
 
 static const VkPresentModeKHR present_modes[] = {
+   VK_PRESENT_MODE_IMMEDIATE_KHR,
VK_PRESENT_MODE_MAILBOX_KHR,
 };
 
@@ -654,7 +655,8 @@ x11_queue_present(struct wsi_swapchain *anv_chain,
int64_t divisor = 0;
int64_t remainder = 0;
 
-   options |= XCB_PRESENT_OPTION_ASYNC;
+   if (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR)
+  options |= XCB_PRESENT_OPTION_ASYNC;
 
xshmfence_reset(image->shm_fence);
 

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


Mesa (13.0): vulkan/wsi: Add a thread-safe queue implementation

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 0aa527526c18ec630f532003eb01ae0bcf86aea3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0aa527526c18ec630f532003eb01ae0bcf86aea3

Author: Kevin Strasser 
Date:   Wed Nov  2 18:18:44 2016 -0700

vulkan/wsi: Add a thread-safe queue implementation

In order to support FIFO mode without blocking the application on calls
to vkQueuePresentKHR it is necessary to enqueue the request and defer
calling the server until the next vblank period. The xcb present api
doesn't offer a way to register a callback, so we will have to spawn a
worker thread that will wait for a request to be added to the queue, call
to the server, and then make the image available for reuse.  This commit
introduces the queue data structure needed to implement this.

Signed-off-by: Jason Ekstrand 
Reviewed-by: Eric Engestrom 
Reviewed-by: Dave Airlie 
Cc: "13.0" 
(cherry picked from commit 932bb3f0ddf22a9cbdf6d45089547765027b4397)

---

 src/vulkan/wsi/Makefile.sources   |   3 +-
 src/vulkan/wsi/wsi_common_queue.h | 154 ++
 2 files changed, 156 insertions(+), 1 deletion(-)

diff --git a/src/vulkan/wsi/Makefile.sources b/src/vulkan/wsi/Makefile.sources
index 3139e6d..50660f9 100644
--- a/src/vulkan/wsi/Makefile.sources
+++ b/src/vulkan/wsi/Makefile.sources
@@ -1,6 +1,7 @@
 
 VULKAN_WSI_FILES := \
-   wsi_common.h
+   wsi_common.h \
+   wsi_common_queue.h
 
 VULKAN_WSI_WAYLAND_FILES := \
wsi_common_wayland.c \
diff --git a/src/vulkan/wsi/wsi_common_queue.h 
b/src/vulkan/wsi/wsi_common_queue.h
new file mode 100644
index 000..0e72c8d
--- /dev/null
+++ b/src/vulkan/wsi/wsi_common_queue.h
@@ -0,0 +1,154 @@
+/*
+ * 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.
+ */
+
+#ifndef VULKAN_WSI_COMMON_QUEUE_H
+#define VULKAN_WSI_COMMON_QUEUE_H
+
+#include 
+#include 
+#include "util/u_vector.h"
+
+struct wsi_queue {
+   struct u_vector vector;
+   pthread_mutex_t mutex;
+   pthread_cond_t cond;
+};
+
+static inline int
+wsi_queue_init(struct wsi_queue *queue, int length)
+{
+   int ret;
+
+   uint32_t length_pow2 = 4;
+   while (length_pow2 < length)
+  length_pow2 *= 2;
+
+   ret = u_vector_init(>vector, sizeof(uint32_t),
+   sizeof(uint32_t) * length_pow2);
+   if (!ret)
+  return ENOMEM;
+
+   pthread_condattr_t condattr;
+   ret = pthread_condattr_init();
+   if (ret)
+  goto fail_vector;
+
+   ret = pthread_condattr_setclock(, CLOCK_MONOTONIC);
+   if (ret)
+  goto fail_condattr;
+
+   ret = pthread_cond_init(>cond, );
+   if (ret)
+  goto fail_condattr;
+
+   ret = pthread_mutex_init(>mutex, NULL);
+   if (ret)
+  goto fail_cond;
+
+   return 0;
+
+fail_cond:
+   pthread_cond_destroy(>cond);
+fail_condattr:
+   pthread_condattr_destroy();
+fail_vector:
+   u_vector_finish(>vector);
+
+   return ret;
+}
+
+static inline void
+wsi_queue_destroy(struct wsi_queue *queue)
+{
+   u_vector_finish(>vector);
+   pthread_mutex_destroy(>mutex);
+   pthread_cond_destroy(>cond);
+}
+
+static inline void
+wsi_queue_push(struct wsi_queue *queue, uint32_t index)
+{
+   uint32_t *elem;
+
+   pthread_mutex_lock(>mutex);
+
+   if (u_vector_length(>vector) == 0)
+  pthread_cond_signal(>cond);
+
+   elem = u_vector_add(>vector);
+   *elem = index;
+
+   pthread_mutex_unlock(>mutex);
+}
+
+#define NSEC_PER_SEC 10
+#define INT_TYPE_MAX(type) ((1ull << (sizeof(type) * 8 - 1)) - 1)
+
+static inline VkResult
+wsi_queue_pull(struct wsi_queue *queue, uint32_t *index, uint64_t timeout)
+{
+   VkResult result;
+   int32_t ret;
+
+   pthread_mutex_lock(>mutex);
+
+   struct timespec now;
+   clock_gettime(CLOCK_MONOTONIC, );
+
+   uint32_t abs_nsec = now.tv_nsec + timeout % NSEC_PER_SEC;
+   uint64_t 

Mesa (13.0): radv: honour the number of properties available

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: d653c84a688d65b8b421c08fdbea6b22878a364d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d653c84a688d65b8b421c08fdbea6b22878a364d

Author: Emil Velikov 
Date:   Thu Nov 24 18:14:58 2016 +

radv: honour the number of properties available

Cap up-to the number of properties available while copying the data.
Otherwise we might crash and/or leak data.

Cc: Dave Airlie 
Cc: "13.0" 
Signed-off-by: Emil Velikov 
Reviewed-by: Bas Nieuwenhuizen 
Signed-off-by: Dave Airlie 
(cherry picked from commit a025c5b2c7c9c6862006b13c9b8ab46c3acf8e53)

---

 src/amd/vulkan/radv_device.c | 18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 4a924ea..94a2ef0 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -659,17 +659,15 @@ VkResult radv_EnumerateInstanceExtensionProperties(
uint32_t*   pPropertyCount,
VkExtensionProperties*  pProperties)
 {
-   unsigned i;
if (pProperties == NULL) {
*pPropertyCount = ARRAY_SIZE(global_extensions);
return VK_SUCCESS;
}
 
-   for (i = 0; i < *pPropertyCount; i++)
-   memcpy([i], _extensions[i], 
sizeof(VkExtensionProperties));
+   *pPropertyCount = MIN2(*pPropertyCount, ARRAY_SIZE(global_extensions));
+   typed_memcpy(pProperties, global_extensions, *pPropertyCount);
 
-   *pPropertyCount = i;
-   if (i < ARRAY_SIZE(global_extensions))
+   if (*pPropertyCount < ARRAY_SIZE(global_extensions))
return VK_INCOMPLETE;
 
return VK_SUCCESS;
@@ -681,19 +679,17 @@ VkResult radv_EnumerateDeviceExtensionProperties(
uint32_t*   pPropertyCount,
VkExtensionProperties*  pProperties)
 {
-   unsigned i;
-
if (pProperties == NULL) {
*pPropertyCount = ARRAY_SIZE(device_extensions);
return VK_SUCCESS;
}
 
-   for (i = 0; i < *pPropertyCount; i++)
-   memcpy([i], _extensions[i], 
sizeof(VkExtensionProperties));
+   *pPropertyCount = MIN2(*pPropertyCount, ARRAY_SIZE(device_extensions));
+   typed_memcpy(pProperties, device_extensions, *pPropertyCount);
 
-   *pPropertyCount = i;
-   if (i < ARRAY_SIZE(device_extensions))
+   if (*pPropertyCount < ARRAY_SIZE(device_extensions))
return VK_INCOMPLETE;
+
return VK_SUCCESS;
 }
 

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


Mesa (13.0): Update version to 13.0.2

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: f92c2e3d2bc0bc44e53f42706ebce041a313246c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f92c2e3d2bc0bc44e53f42706ebce041a313246c

Author: Emil Velikov 
Date:   Mon Nov 28 15:02:48 2016 +

Update version to 13.0.2

Signed-off-by: Emil Velikov 

---

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

diff --git a/VERSION b/VERSION
index 5cb7d85..347caf3 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-13.0.1
+13.0.2

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


Mesa (13.0): vulkan/wsi/x11: handle timeouts properly in next image acquire (v1.1)

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: ae6e22e311d417ec0b50edb9b656c1c3de6df28a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae6e22e311d417ec0b50edb9b656c1c3de6df28a

Author: Dave Airlie 
Date:   Wed Oct 26 11:51:27 2016 +1000

vulkan/wsi/x11: handle timeouts properly in next image acquire (v1.1)

For 0 timeout, just poll for an event, and if none, return
For UINT64_MAX timeout, just wait for special event blocked
For other timeouts get the xcb fd and block on it, decreasing
the timeout if we get woken up for non-special events.

v1.1: return VK_TIMEOUT for poll timeouts.
handle timeout going negative.

Reviewed-by: Edward O'Callaghan 
Signed-off-by: Dave Airlie 
(cherry picked from commit 787c172aed0ae88ca6a8c1a193d9dd744fbdc918)

---

 src/vulkan/wsi/wsi_common_x11.c | 62 +
 1 file changed, 57 insertions(+), 5 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 09718eb..ae2d111 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 
+#include 
 #include "util/hash_table.h"
 
 #include "wsi_common.h"
@@ -555,6 +556,26 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
return VK_SUCCESS;
 }
 
+
+static uint64_t wsi_get_current_time(void)
+{
+   uint64_t current_time;
+   struct timespec tv;
+
+   clock_gettime(CLOCK_MONOTONIC, );
+   current_time = tv.tv_nsec + tv.tv_sec*10ull;
+   return current_time;
+}
+
+static uint64_t wsi_get_absolute_timeout(uint64_t timeout)
+{
+   uint64_t current_time = wsi_get_current_time();
+
+   timeout = MIN2(UINT64_MAX - current_time, timeout);
+
+   return current_time + timeout;
+}
+
 static VkResult
 x11_acquire_next_image(struct wsi_swapchain *anv_chain,
uint64_t timeout,
@@ -562,7 +583,9 @@ x11_acquire_next_image(struct wsi_swapchain *anv_chain,
uint32_t *image_index)
 {
struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
-
+   xcb_generic_event_t *event;
+   struct pollfd pfds;
+   uint64_t atimeout;
while (1) {
   for (uint32_t i = 0; i < chain->image_count; i++) {
  if (!chain->images[i].busy) {
@@ -575,10 +598,39 @@ x11_acquire_next_image(struct wsi_swapchain *anv_chain,
   }
 
   xcb_flush(chain->conn);
-  xcb_generic_event_t *event =
- xcb_wait_for_special_event(chain->conn, chain->special_event);
-  if (!event)
- return VK_ERROR_OUT_OF_DATE_KHR;
+
+  if (timeout == UINT64_MAX) {
+ event = xcb_wait_for_special_event(chain->conn, chain->special_event);
+ if (!event)
+return VK_ERROR_OUT_OF_DATE_KHR;
+  } else {
+ event = xcb_poll_for_special_event(chain->conn, chain->special_event);
+ if (!event) {
+int ret;
+if (timeout == 0)
+   return VK_NOT_READY;
+
+atimeout = wsi_get_absolute_timeout(timeout);
+
+pfds.fd = xcb_get_file_descriptor(chain->conn);
+pfds.events = POLLIN;
+ret = poll(, 1, timeout / 1000 / 1000);
+if (ret == 0)
+   return VK_TIMEOUT;
+if (ret == -1)
+   return VK_ERROR_OUT_OF_DATE_KHR;
+
+/* If a non-special event happens, the fd will still
+ * poll. So recalculate the timeout now just in case.
+ */
+uint64_t current_time = wsi_get_current_time();
+if (atimeout > current_time)
+   timeout = atimeout - current_time;
+else
+   timeout = 0;
+continue;
+ }
+  }
 
   VkResult result = x11_handle_dri3_present_event(chain, (void *)event);
   free(event);

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


Mesa (13.0): radv/si: fix optimal micro tile selection

2016-11-28 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 17dee709a9b8ac358374d26c1f4efe5c7b09f5bd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=17dee709a9b8ac358374d26c1f4efe5c7b09f5bd

Author: Dave Airlie 
Date:   Thu Nov 24 10:04:35 2016 +1000

radv/si: fix optimal micro tile selection

The same fix was posted for radeonsi, so port it here.

Reviewed-by: Edward O'Callaghan 
Cc: "13.0" 
Signed-off-by: Dave Airlie 
(cherry picked from commit 9838db8f643354e485f74664b92b902fe0b95c4f)

---

 src/amd/vulkan/radv_image.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 3099d83..9649158 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -831,29 +831,29 @@ void radv_image_set_optimal_micro_tile_mode(struct 
radv_device *device,
switch (micro_tile_mode) {
case 0: /* displayable */
switch (image->surface.bpe) {
-   case 8:
+   case 1:
 image->surface.tiling_index[0] = 10;
 break;
-   case 16:
+   case 2:
 image->surface.tiling_index[0] = 11;
 break;
-   default: /* 32, 64 */
+   default: /* 4, 8 */
 image->surface.tiling_index[0] = 12;
 break;
}
break;
case 1: /* thin */
switch (image->surface.bpe) {
-   case 8:
+   case 1:
 image->surface.tiling_index[0] = 14;
 break;
-   case 16:
+   case 2:
 image->surface.tiling_index[0] = 15;
 break;
-   case 32:
+   case 4:
 image->surface.tiling_index[0] = 16;
 break;
-   default: /* 64, 128 */
+   default: /* 8, 16 */
 image->surface.tiling_index[0] = 17;
 break;
}

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