Re: [Mesa-dev] [PATCH 1/4] intel/reg: Add helpers for 64-bit integer immediates

2017-11-02 Thread Jason Ekstrand
On Thu, Nov 2, 2017 at 10:12 PM, Michael Schellenberger Costa <
mschellenbergerco...@googlemail.com> wrote:

> Hi Jason,
>
> -Ursprüngliche Nachricht-
> Von: mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] Im Auftrag
> von Jason Ekstrand
> Gesendet: Freitag, 3. November 2017 05:53
> An: mesa-dev@lists.freedesktop.org
> Cc: Jason Ekstrand 
> Betreff: [Mesa-dev] [PATCH 1/4] intel/reg: Add helpers for 64-bit integer
> immediates
>
> ---
>  src/intel/compiler/brw_reg.h | 18 ++
>  1 file changed, 18 insertions(+)
>
> diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h
> index d68d64f..a641869 100644
> --- a/src/intel/compiler/brw_reg.h
> +++ b/src/intel/compiler/brw_reg.h
> @@ -597,6 +597,24 @@ brw_imm_f(float f)
> return imm;
>  }
>
> +/** Construct int64_t immediate register */
> +static inline struct brw_reg
> +brw_imm_q(int64_t q)
> +{
> +   struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_Q);
> +   imm.d64 = q;
> +   return imm;
> +}
> +
> +/** Construct int64_t immediate register */
> This should be uint64_t?
>

Yup.  Fixed locally.


> --Michael
>
> +static inline struct brw_reg
> +brw_imm_uq(uint64_t uq)
> +{
> +   struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UQ);
> +   imm.u64 = uq;
> +   return imm;
> +}
> +
>  /** Construct integer immediate register */
>  static inline struct brw_reg
>  brw_imm_d(int d)
> --
> 2.5.0.400.gff86faf
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/4] intel/reg: Add helpers for 64-bit integer immediates

2017-11-02 Thread Jason Ekstrand
---
 src/intel/compiler/brw_reg.h | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h
index d68d64f..a641869 100644
--- a/src/intel/compiler/brw_reg.h
+++ b/src/intel/compiler/brw_reg.h
@@ -597,6 +597,24 @@ brw_imm_f(float f)
return imm;
 }
 
+/** Construct int64_t immediate register */
+static inline struct brw_reg
+brw_imm_q(int64_t q)
+{
+   struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_Q);
+   imm.d64 = q;
+   return imm;
+}
+
+/** Construct int64_t immediate register */
+static inline struct brw_reg
+brw_imm_uq(uint64_t uq)
+{
+   struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UQ);
+   imm.u64 = uq;
+   return imm;
+}
+
 /** Construct integer immediate register */
 static inline struct brw_reg
 brw_imm_d(int d)
-- 
2.5.0.400.gff86faf

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


[Mesa-dev] [PATCH 3/4] intel/fs/nir: Use Q immediates for load_const on gen8+

2017-11-02 Thread Jason Ekstrand
On gen7, the only 64-bit type we have is DF so we have to use that but
on gen8+, we have Q types so we should use them to avoid any possibility
of floating-point weirdness.  While we're here, retype destinations so
we aren't relying on the destination type.
---
 src/intel/compiler/brw_fs_nir.cpp | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/intel/compiler/brw_fs_nir.cpp 
b/src/intel/compiler/brw_fs_nir.cpp
index b92f158..cbd51a9 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -1411,9 +1411,18 @@ fs_visitor::nir_emit_load_const(const fs_builder &bld,
   break;
 
case 64:
-  for (unsigned i = 0; i < instr->def.num_components; i++)
- bld.MOV(offset(reg, bld, i),
- setup_imm_df(bld, instr->value.f64[i]));
+  assert(devinfo->gen >= 7);
+  if (devinfo->gen == 7) {
+ /* We don't get 64-bit integer types until gen8 */
+ for (unsigned i = 0; i < instr->def.num_components; i++) {
+bld.MOV(retype(offset(reg, bld, i), BRW_REGISTER_TYPE_DF),
+setup_imm_df(bld, instr->value.f64[i]));
+ }
+  } else {
+ for (unsigned i = 0; i < instr->def.num_components; i++)
+bld.MOV(retype(offset(reg, bld, i), BRW_REGISTER_TYPE_Q),
+brw_imm_q(instr->value.i64[i]));
+  }
   break;
 
default:
-- 
2.5.0.400.gff86faf

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


[Mesa-dev] [PATCH 2/4] intel/fs/nir: Setup immediates based on type in i2b and f2b

2017-11-02 Thread Jason Ekstrand
---
 src/intel/compiler/brw_fs_nir.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_fs_nir.cpp 
b/src/intel/compiler/brw_fs_nir.cpp
index bb153ca..b92f158 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -1094,12 +1094,13 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, 
nir_alu_instr *instr)
  if (instr->op == nir_op_f2b) {
 zero = vgrf(glsl_type::double_type);
 tmp = vgrf(glsl_type::double_type);
+bld.MOV(zero, setup_imm_df(bld, 0.0));
  } else {
 zero = vgrf(glsl_type::int64_t_type);
 tmp = vgrf(glsl_type::int64_t_type);
+bld.MOV(zero, brw_imm_q(0));
  }
 
- bld.MOV(zero, setup_imm_df(bld, 0.0));
  /* A SIMD16 execution needs to be split in two instructions, so use
   * a vgrf instead of the flag register as dst so instruction splitting
   * works
-- 
2.5.0.400.gff86faf

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


[Mesa-dev] [PATCH 4/4] intel/fs/nir: Return Q types from brw_reg_type_for_bit_size

2017-11-02 Thread Jason Ekstrand
Now that we're returning a sane type, we can drop the retyping to Q in
nir_emit_load_const.

Cc: Jose Maria Casanova Crespo 
---
 src/intel/compiler/brw_fs_nir.cpp | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/intel/compiler/brw_fs_nir.cpp 
b/src/intel/compiler/brw_fs_nir.cpp
index cbd51a9..0b17e4f 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -264,7 +264,7 @@ brw_reg_type_from_bit_size(const unsigned bit_size,
   case 32:
  return BRW_REGISTER_TYPE_D;
   case 64:
- return BRW_REGISTER_TYPE_DF;
+ return BRW_REGISTER_TYPE_Q;
   default:
  unreachable("Invalid bit size");
   }
@@ -277,7 +277,7 @@ brw_reg_type_from_bit_size(const unsigned bit_size,
   case 32:
  return BRW_REGISTER_TYPE_UD;
   case 64:
- return BRW_REGISTER_TYPE_DF;
+ return BRW_REGISTER_TYPE_UQ;
   default:
  unreachable("Invalid bit size");
   }
@@ -1420,8 +1420,7 @@ fs_visitor::nir_emit_load_const(const fs_builder &bld,
  }
   } else {
  for (unsigned i = 0; i < instr->def.num_components; i++)
-bld.MOV(retype(offset(reg, bld, i), BRW_REGISTER_TYPE_Q),
-brw_imm_q(instr->value.i64[i]));
+bld.MOV(offset(reg, bld, i), brw_imm_q(instr->value.i64[i]));
   }
   break;
 
-- 
2.5.0.400.gff86faf

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


[Mesa-dev] [PATCH] radv: add initial copy descriptor support.

2017-11-02 Thread Dave Airlie
From: Dave Airlie 

It appears the latest dota2 vulkan uses this,
and we get a hang in VR mode without it.

Cc: "17.2 17.3" 
Signed-off-by: Dave Airlie 
---
 src/amd/vulkan/radv_descriptor_set.c | 61 ++--
 1 file changed, 59 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_descriptor_set.c 
b/src/amd/vulkan/radv_descriptor_set.c
index 167944f4e2f..3a14fe480b1 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -739,8 +739,65 @@ void radv_update_descriptor_sets(
}
 
}
-   if (descriptorCopyCount)
-   radv_finishme("copy descriptors");
+
+   for (i = 0; i < descriptorCopyCount; i++) {
+   const VkCopyDescriptorSet *copyset = &pDescriptorCopies[i];
+   RADV_FROM_HANDLE(radv_descriptor_set, src_set,
+copyset->srcSet);
+   RADV_FROM_HANDLE(radv_descriptor_set, dst_set,
+copyset->dstSet);
+   const struct radv_descriptor_set_binding_layout 
*src_binding_layout =
+   src_set->layout->binding + copyset->srcBinding;
+   const struct radv_descriptor_set_binding_layout 
*dst_binding_layout =
+   dst_set->layout->binding + copyset->dstBinding;
+   uint32_t *src_ptr = src_set->mapped_ptr;
+   uint32_t *dst_ptr = dst_set->mapped_ptr;
+   struct radeon_winsys_bo **src_buffer_list = 
src_set->descriptors;
+   struct radeon_winsys_bo **dst_buffer_list = 
dst_set->descriptors;
+
+   src_ptr += src_binding_layout->offset / 4;
+   dst_ptr += dst_binding_layout->offset / 4;
+
+   src_ptr += src_binding_layout->size * copyset->srcArrayElement 
/ 4;
+   dst_ptr += dst_binding_layout->size * copyset->dstArrayElement 
/ 4;
+
+   src_buffer_list += src_binding_layout->buffer_offset;
+   src_buffer_list += copyset->srcArrayElement;
+
+   dst_buffer_list += dst_binding_layout->buffer_offset;
+   dst_buffer_list += copyset->dstArrayElement;
+
+   if (src_binding_layout->type == 
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC ||
+   src_binding_layout->type == 
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC) {
+   radv_finishme("copy descriptor dynamic support");
+   continue;
+   }
+
+   for (j = 0; j < copyset->descriptorCount; ++j) {
+   switch (src_binding_layout->type) {
+   case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
+   case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: {
+   unsigned src_idx = copyset->srcArrayElement + j;
+   unsigned dst_idx = copyset->dstArrayElement + j;
+   struct radv_descriptor_range *src_range, 
*dst_range;
+   src_idx += 
src_binding_layout->dynamic_offset_offset;
+   dst_idx += 
dst_binding_layout->dynamic_offset_offset;
+
+   src_range = src_set->dynamic_descriptors + 
src_idx;
+   dst_range = dst_set->dynamic_descriptors + 
dst_idx;
+   *dst_range = *src_range;
+   break;
+   }
+   default:
+   memcpy(dst_ptr, src_ptr, 
src_binding_layout->size);
+   }
+   src_ptr += src_binding_layout->size / 4;
+   dst_ptr += dst_binding_layout->size / 4;
+   dst_buffer_list[j] = src_buffer_list[j];
+   ++src_buffer_list;
+   ++dst_buffer_list;
+   }
+   }
 }
 
 void radv_UpdateDescriptorSets(
-- 
2.14.2

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


Re: [Mesa-dev] [PATCH] nir/serialize: fix build with gcc 4.4.7

2017-11-02 Thread Jason Ekstrand
*grumble* old compilers... *grumble*

Reviewed-by: Jason Ekstrand 

On Thu, Nov 2, 2017 at 7:59 PM, Dave Airlie  wrote:

> From: Dave Airlie 
>
> I had to build on RHEL6 today, and noticed this.
>
> Signed-off-by: Dave Airlie 
> ---
>  src/compiler/nir/nir_serialize.c |   38 +++---
> 
>  1 files changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_
> serialize.c
> index 7951258..54a00c8 100644
> --- a/src/compiler/nir/nir_serialize.c
> +++ b/src/compiler/nir/nir_serialize.c
> @@ -585,7 +585,7 @@ union packed_tex_data {
>unsigned component:2;
>unsigned has_texture_deref:1;
>unsigned has_sampler_deref:1;
> -   };
> +   } u;
>  };
>
>  static void
> @@ -599,15 +599,15 @@ write_tex(write_ctx *ctx, const nir_tex_instr *tex)
>
> STATIC_ASSERT(sizeof(union packed_tex_data) == sizeof(uint32_t));
> union packed_tex_data packed = {
> -  .sampler_dim = tex->sampler_dim,
> -  .dest_type = tex->dest_type,
> -  .coord_components = tex->coord_components,
> -  .is_array = tex->is_array,
> -  .is_shadow = tex->is_shadow,
> -  .is_new_style_shadow = tex->is_new_style_shadow,
> -  .component = tex->component,
> -  .has_texture_deref = tex->texture != NULL,
> -  .has_sampler_deref = tex->sampler != NULL,
> +  .u.sampler_dim = tex->sampler_dim,
> +  .u.dest_type = tex->dest_type,
> +  .u.coord_components = tex->coord_components,
> +  .u.is_array = tex->is_array,
> +  .u.is_shadow = tex->is_shadow,
> +  .u.is_new_style_shadow = tex->is_new_style_shadow,
> +  .u.component = tex->component,
> +  .u.has_texture_deref = tex->texture != NULL,
> +  .u.has_sampler_deref = tex->sampler != NULL,
> };
> blob_write_uint32(ctx->blob, packed.u32);
>
> @@ -636,13 +636,13 @@ read_tex(read_ctx *ctx)
>
> union packed_tex_data packed;
> packed.u32 = blob_read_uint32(ctx->blob);
> -   tex->sampler_dim = packed.sampler_dim;
> -   tex->dest_type = packed.dest_type;
> -   tex->coord_components = packed.coord_components;
> -   tex->is_array = packed.is_array;
> -   tex->is_shadow = packed.is_shadow;
> -   tex->is_new_style_shadow = packed.is_new_style_shadow;
> -   tex->component = packed.component;
> +   tex->sampler_dim = packed.u.sampler_dim;
> +   tex->dest_type = packed.u.dest_type;
> +   tex->coord_components = packed.u.coord_components;
> +   tex->is_array = packed.u.is_array;
> +   tex->is_shadow = packed.u.is_shadow;
> +   tex->is_new_style_shadow = packed.u.is_new_style_shadow;
> +   tex->component = packed.u.component;
>
> read_dest(ctx, &tex->dest, &tex->instr);
> for (unsigned i = 0; i < tex->num_srcs; i++) {
> @@ -650,9 +650,9 @@ read_tex(read_ctx *ctx)
>read_src(ctx, &tex->src[i].src, &tex->instr);
> }
>
> -   tex->texture = packed.has_texture_deref ?
> +   tex->texture = packed.u.has_texture_deref ?
>read_deref_chain(ctx, &tex->instr) : NULL;
> -   tex->sampler = packed.has_sampler_deref ?
> +   tex->sampler = packed.u.has_sampler_deref ?
>read_deref_chain(ctx, &tex->instr) : NULL;
>
> return tex;
> --
> 1.7.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] nir/serialize: fix build with gcc 4.4.7

2017-11-02 Thread Dave Airlie
From: Dave Airlie 

I had to build on RHEL6 today, and noticed this.

Signed-off-by: Dave Airlie 
---
 src/compiler/nir/nir_serialize.c |   38 +++---
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c
index 7951258..54a00c8 100644
--- a/src/compiler/nir/nir_serialize.c
+++ b/src/compiler/nir/nir_serialize.c
@@ -585,7 +585,7 @@ union packed_tex_data {
   unsigned component:2;
   unsigned has_texture_deref:1;
   unsigned has_sampler_deref:1;
-   };
+   } u;
 };
 
 static void
@@ -599,15 +599,15 @@ write_tex(write_ctx *ctx, const nir_tex_instr *tex)
 
STATIC_ASSERT(sizeof(union packed_tex_data) == sizeof(uint32_t));
union packed_tex_data packed = {
-  .sampler_dim = tex->sampler_dim,
-  .dest_type = tex->dest_type,
-  .coord_components = tex->coord_components,
-  .is_array = tex->is_array,
-  .is_shadow = tex->is_shadow,
-  .is_new_style_shadow = tex->is_new_style_shadow,
-  .component = tex->component,
-  .has_texture_deref = tex->texture != NULL,
-  .has_sampler_deref = tex->sampler != NULL,
+  .u.sampler_dim = tex->sampler_dim,
+  .u.dest_type = tex->dest_type,
+  .u.coord_components = tex->coord_components,
+  .u.is_array = tex->is_array,
+  .u.is_shadow = tex->is_shadow,
+  .u.is_new_style_shadow = tex->is_new_style_shadow,
+  .u.component = tex->component,
+  .u.has_texture_deref = tex->texture != NULL,
+  .u.has_sampler_deref = tex->sampler != NULL,
};
blob_write_uint32(ctx->blob, packed.u32);
 
@@ -636,13 +636,13 @@ read_tex(read_ctx *ctx)
 
union packed_tex_data packed;
packed.u32 = blob_read_uint32(ctx->blob);
-   tex->sampler_dim = packed.sampler_dim;
-   tex->dest_type = packed.dest_type;
-   tex->coord_components = packed.coord_components;
-   tex->is_array = packed.is_array;
-   tex->is_shadow = packed.is_shadow;
-   tex->is_new_style_shadow = packed.is_new_style_shadow;
-   tex->component = packed.component;
+   tex->sampler_dim = packed.u.sampler_dim;
+   tex->dest_type = packed.u.dest_type;
+   tex->coord_components = packed.u.coord_components;
+   tex->is_array = packed.u.is_array;
+   tex->is_shadow = packed.u.is_shadow;
+   tex->is_new_style_shadow = packed.u.is_new_style_shadow;
+   tex->component = packed.u.component;
 
read_dest(ctx, &tex->dest, &tex->instr);
for (unsigned i = 0; i < tex->num_srcs; i++) {
@@ -650,9 +650,9 @@ read_tex(read_ctx *ctx)
   read_src(ctx, &tex->src[i].src, &tex->instr);
}
 
-   tex->texture = packed.has_texture_deref ?
+   tex->texture = packed.u.has_texture_deref ?
   read_deref_chain(ctx, &tex->instr) : NULL;
-   tex->sampler = packed.has_sampler_deref ?
+   tex->sampler = packed.u.has_sampler_deref ?
   read_deref_chain(ctx, &tex->instr) : NULL;
 
return tex;
-- 
1.7.1

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


[Mesa-dev] [Bug 100038] [BDW] gpu hangs ecode 8:0:0x84d77c1c

2017-11-02 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100038

Matt Turner  changed:

   What|Removed |Added

 QA Contact|mesa-dev@lists.freedesktop. |intel-3d-bugs@lists.freedes
   |org |ktop.org
 Status|REOPENED|NEEDINFO
   Assignee|mesa-dev@lists.freedesktop. |intel-3d-bugs@lists.freedes
   |org |ktop.org
  Component|Other   |Drivers/DRI/i965

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


Re: [Mesa-dev] [PATCH v2 4/4] i965/gen10: Implement Wa3DStateMode

2017-11-02 Thread Matt Turner
On Thu, Nov 2, 2017 at 11:26 AM, Nanley Chery  wrote:
> On Wed, Nov 01, 2017 at 03:52:15PM -0700, Anuj Phogat wrote:
>> V2: Remove the bits enabling Float blend optimization. It is
>> enabled through CACHE_MODE_SS register.
>> Update the comment.
>>
>> This workaround doesn't fix any of the piglit hangs we've seen
>> on CNL.
>>
>
> I haven't seen this format in the git logs before..
>
>> Cc: Nanley Chery 
>> Cc: Jason Ekstrand 
>> Signed-off-by: Anuj Phogat 
>> Reviewed-by: Rafael Antognolli 
>> ---
>>  src/mesa/drivers/dri/i965/brw_defines.h  |  2 ++
>>  src/mesa/drivers/dri/i965/brw_state_upload.c | 12 
>>  2 files changed, 14 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
>> b/src/mesa/drivers/dri/i965/brw_defines.h
>> index 3008a1b8a7..1c2f06546e 100644
>> --- a/src/mesa/drivers/dri/i965/brw_defines.h
>> +++ b/src/mesa/drivers/dri/i965/brw_defines.h
>> @@ -1333,6 +1333,8 @@ enum brw_pixel_shader_coverage_mask_mode {
>>  /* DW2: start address */
>>  /* DW3: end address. */
>>
>> +#define _3DSTATE_3D_MODE 0x791e
>> +
>>  #define CMD_MI_FLUSH  0x0200
>>
>>  # define BLT_X_SHIFT 0
>> diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c 
>> b/src/mesa/drivers/dri/i965/brw_state_upload.c
>> index 7df06a6e4d..76c137c90e 100644
>> --- a/src/mesa/drivers/dri/i965/brw_state_upload.c
>> +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
>> @@ -89,6 +89,18 @@ brw_upload_initial_gpu_state(struct brw_context *brw)
>>brw_load_register_imm32(brw, GEN10_CACHE_MODE_SS,
>>
>> REG_MASK(GEN10_FLOAT_BLEND_OPTIMIZATION_ENABLE) |
>>GEN10_FLOAT_BLEND_OPTIMIZATION_ENABLE);
>> +
>> +  /* From gen10 workaround table in h/w specs:
>> +   * "On 3DSTATE_3D_MODE, driver must always program bits 31:16 of DW1
>> +   *  a value of 0x"
>> +   *  This means that we end up setting the entire 3D_MODE state. Bits
>> +   *  in this register control things such as slice hashing and we want
>> +   *  the default values of zero at the moment.
> ^ Extra space for the last 3 lines here.

No, it's not, actually. The correct style is to indent the lines so
that the " is in its own column.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 1/4] i965/gen10: Implement WaSampleOffsetIZ workaround

2017-11-02 Thread Anuj Phogat
There are few other (duplicate) workarounds which have similar recommendations:
WaFlushHangWhenNonPipelineStateAndMarkerStalled
WaCSStallBefore3DSamplePattern
WaPipeControlBefore3DStateSamplePattern

WaPipeControlBefore3DStateSamplePattern has some extra recommendations if
driver is using mid batch context restore. Ignoring it for now because We're
not doing mid-batch context restore in Mesa.

This workaround doesn't fix any of the piglit hangs we've seen
on CNL. But it might be fixing something we haven't tested yet.

V2: Use brw_load_register_imm32() to program CACHE_MODE_0.
Get rid of brw_flush_gpu_caches().

V3: Make the workaround helper functions static.

Signed-off-by: Anuj Phogat 
Reviewed-by: Rafael Antognolli 
Reviewed-by :Nanley Chery 
---
 src/mesa/drivers/dri/i965/brw_defines.h|  1 +
 src/mesa/drivers/dri/i965/gen8_multisample_state.c | 49 ++
 2 files changed, 50 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
b/src/mesa/drivers/dri/i965/brw_defines.h
index 4abb790612..270cdf29db 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -1609,6 +1609,7 @@ enum brw_pixel_shader_coverage_mask_mode {
 #define GEN7_GPGPU_DISPATCHDIMY 0x2504
 #define GEN7_GPGPU_DISPATCHDIMZ 0x2508
 
+#define GEN7_CACHE_MODE_0   0x7000
 #define GEN7_CACHE_MODE_1   0x7004
 # define GEN9_FLOAT_BLEND_OPTIMIZATION_ENABLE (1 << 4)
 # define GEN8_HIZ_NP_PMA_FIX_ENABLE(1 << 11)
diff --git a/src/mesa/drivers/dri/i965/gen8_multisample_state.c 
b/src/mesa/drivers/dri/i965/gen8_multisample_state.c
index 3afa586275..9f849d64bb 100644
--- a/src/mesa/drivers/dri/i965/gen8_multisample_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_multisample_state.c
@@ -28,11 +28,57 @@
 #include "brw_multisample_state.h"
 
 /**
+ * From Gen10 Workarounds page in h/w specs:
+ * WaSampleOffsetIZ:
+ * Prior to the 3DSTATE_SAMPLE_PATTERN driver must ensure there are no
+ * markers in the pipeline by programming a PIPE_CONTROL with stall.
+ */
+static void
+gen10_emit_wa_cs_stall_flush(struct brw_context *brw)
+{
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
+   assert(devinfo->gen == 10);
+   brw_emit_pipe_control_flush(brw,
+   PIPE_CONTROL_CS_STALL |
+   PIPE_CONTROL_STALL_AT_SCOREBOARD);
+}
+
+/**
+ * From Gen10 Workarounds page in h/w specs:
+ * WaSampleOffsetIZ:
+ * When 3DSTATE_SAMPLE_PATTERN is programmed, driver must then issue an
+ * MI_LOAD_REGISTER_IMM command to an offset between 0x7000 and 0x7FFF(SVL)
+ * after the command to ensure the state has been delivered prior to any
+ * command causing a marker in the pipeline.
+ */
+static void
+gen10_emit_wa_lri_to_cache_mode_zero(struct brw_context *brw)
+{
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
+   assert(devinfo->gen == 10);
+
+   /* Before changing the value of CACHE_MODE_0 register, GFX pipeline must
+* be idle; i.e., full flush is required.
+*/
+   brw_emit_pipe_control_flush(brw,
+   PIPE_CONTROL_CACHE_FLUSH_BITS |
+   PIPE_CONTROL_CACHE_INVALIDATE_BITS);
+
+   /* Write to CACHE_MODE_0 (0x7000) */
+   brw_load_register_imm32(brw, GEN7_CACHE_MODE_0, 0);
+}
+
+/**
  * 3DSTATE_SAMPLE_PATTERN
  */
 void
 gen8_emit_3dstate_sample_pattern(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
+
+   if (devinfo->gen == 10)
+  gen10_emit_wa_cs_stall_flush(brw);
+
BEGIN_BATCH(9);
OUT_BATCH(_3DSTATE_SAMPLE_PATTERN << 16 | (9 - 2));
 
@@ -52,4 +98,7 @@ gen8_emit_3dstate_sample_pattern(struct brw_context *brw)
/* 1x and 2x MSAA */
OUT_BATCH(brw_multisample_positions_1x_2x);
ADVANCE_BATCH();
+
+   if (devinfo->gen == 10)
+  gen10_emit_wa_lri_to_cache_mode_zero(brw);
 }
-- 
2.13.5

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


Re: [Mesa-dev] [PATCH v2 1/4] i965/gen10: Implement WaSampleOffsetIZ workaround

2017-11-02 Thread Anuj Phogat
On Thu, Nov 2, 2017 at 10:59 AM, Nanley Chery  wrote:
> On Wed, Nov 01, 2017 at 03:48:25PM -0700, Anuj Phogat wrote:
>> There are few other (duplicate) workarounds which have similar 
>> recommendations:
>> WaFlushHangWhenNonPipelineStateAndMarkerStalled
>> WaCSStallBefore3DSamplePattern
>> WaPipeControlBefore3DStateSamplePattern
>>
>> WaPipeControlBefore3DStateSamplePattern has some extra recommendations if
>> driver is using mid batch context restore. Ignoring it for now because We're
>> not doing mid-batch context restore in Mesa.
>>
>> This workaround doesn't fix any of the piglit hangs we've seen
>> on CNL. But it might be fixing something we haven't tested yet.
>>
>> V2: Use brw_load_register_imm32() to program CACHE_MODE_0.
>> Get rid of brw_flush_gpu_caches().
>>
>> Cc: Nanley Chery 
>> Signed-off-by: Anuj Phogat 
>> Reviewed-by: Rafael Antognolli 
>> ---
>>  src/mesa/drivers/dri/i965/brw_context.h|  2 ++
>>  src/mesa/drivers/dri/i965/brw_defines.h|  1 +
>>  src/mesa/drivers/dri/i965/brw_pipe_control.c   | 41 
>> ++
>>  src/mesa/drivers/dri/i965/gen8_multisample_state.c |  8 +
>>  4 files changed, 52 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
>> b/src/mesa/drivers/dri/i965/brw_context.h
>> index 0102f15424..1030b2b313 100644
>> --- a/src/mesa/drivers/dri/i965/brw_context.h
>> +++ b/src/mesa/drivers/dri/i965/brw_context.h
>> @@ -1656,6 +1656,8 @@ void brw_emit_post_sync_nonzero_flush(struct 
>> brw_context *brw);
>>  void brw_emit_depth_stall_flushes(struct brw_context *brw);
>>  void gen7_emit_vs_workaround_flush(struct brw_context *brw);
>>  void gen7_emit_cs_stall_flush(struct brw_context *brw);
>> +void gen10_emit_wa_cs_stall_flush(struct brw_context *brw);
>> +void gen10_emit_wa_lri_to_cache_mode_zero(struct brw_context *brw);
>
> These functions are only used in one file. What do you think about
> making them static?
>
Agreed. Fixed in v3.
>>
>>  /* brw_queryformat.c */
>>  void brw_query_internal_format(struct gl_context *ctx, GLenum target,
>> diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
>> b/src/mesa/drivers/dri/i965/brw_defines.h
>> index 4abb790612..270cdf29db 100644
>> --- a/src/mesa/drivers/dri/i965/brw_defines.h
>> +++ b/src/mesa/drivers/dri/i965/brw_defines.h
>> @@ -1609,6 +1609,7 @@ enum brw_pixel_shader_coverage_mask_mode {
>>  #define GEN7_GPGPU_DISPATCHDIMY 0x2504
>>  #define GEN7_GPGPU_DISPATCHDIMZ 0x2508
>>
>> +#define GEN7_CACHE_MODE_0   0x7000
>>  #define GEN7_CACHE_MODE_1   0x7004
>>  # define GEN9_FLOAT_BLEND_OPTIMIZATION_ENABLE (1 << 4)
>>  # define GEN8_HIZ_NP_PMA_FIX_ENABLE(1 << 11)
>> diff --git a/src/mesa/drivers/dri/i965/brw_pipe_control.c 
>> b/src/mesa/drivers/dri/i965/brw_pipe_control.c
>> index 460b8f73b6..6ebe1443d5 100644
>> --- a/src/mesa/drivers/dri/i965/brw_pipe_control.c
>> +++ b/src/mesa/drivers/dri/i965/brw_pipe_control.c
>> @@ -279,6 +279,47 @@ gen7_emit_cs_stall_flush(struct brw_context *brw)
>>  }
>>
>>  /**
>> + * From Gen10 Workarounds page in h/w specs:
>> + * WaSampleOffsetIZ:
>> + * Prior to the 3DSTATE_SAMPLE_PATTERN driver must ensure there are no
>> + * markers in the pipeline by programming a PIPE_CONTROL with stall.
>> + */
>> +void
>> +gen10_emit_wa_cs_stall_flush(struct brw_context *brw)
>> +{
>> +   const struct gen_device_info *devinfo = &brw->screen->devinfo;
>
> While build-testing this with a release build, I expected the compiler
> to emit an unused variable warning for the devinfo variables, but for
> some reason it did not.
>
> With or without those minor points addressed, this patch is
> Reviewed-by: Nanley Chery 
>
>> +   assert(devinfo->gen == 10);
>> +   brw_emit_pipe_control_flush(brw,
>> +   PIPE_CONTROL_CS_STALL |
>> +   PIPE_CONTROL_STALL_AT_SCOREBOARD);
>> +}
>> +
>> +/**
>> + * From Gen10 Workarounds page in h/w specs:
>> + * WaSampleOffsetIZ:
>> + * When 3DSTATE_SAMPLE_PATTERN is programmed, driver must then issue an
>> + * MI_LOAD_REGISTER_IMM command to an offset between 0x7000 and 0x7FFF(SVL)
>> + * after the command to ensure the state has been delivered prior to any
>> + * command causing a marker in the pipeline.
>> + */
>> +void
>> +gen10_emit_wa_lri_to_cache_mode_zero(struct brw_context *brw)
>> +{
>> +   const struct gen_device_info *devinfo = &brw->screen->devinfo;
>> +   assert(devinfo->gen == 10);
>> +
>> +   /* Before changing the value of CACHE_MODE_0 register, GFX pipeline must
>> +* be idle; i.e., full flush is required.
>> +*/
>> +   brw_emit_pipe_control_flush(brw,
>> +   PIPE_CONTROL_CACHE_FLUSH_BITS |
>> +   PIPE_CONTROL_CACHE_INVALIDATE_BITS);
>> +
>> +   /* Write to CACHE_MODE_0 (0x7000) */
>> +   brw_load_register_imm32(brw, GEN7_CACHE_MODE_0, 0);
>> +}
>> +
>> +/**
>>   * Emits a PIPE_CONTROL with a non-zero post-sync operation, for
>>   * i

Re: [Mesa-dev] [PATCH v2 2/4] i965/gen10: Implement WaForceRCPFEHangWorkaround

2017-11-02 Thread Anuj Phogat
On Thu, Nov 2, 2017 at 11:18 AM, Nanley Chery  wrote:
> On Wed, Nov 01, 2017 at 03:49:52PM -0700, Anuj Phogat wrote:
>> V2: Add the check for Post Sync Operation.
>> Update the workaround comment.
>>
>
> Did you mean to put the V2 hunk after the messsage?
>
>> This workaround doesn't fix any of the piglit hangs we've seen
>> on CNL. But it might be fixing something we haven't tested yet.
>>
>> Cc: Nanley Chery 
>> Signed-off-by: Anuj Phogat 
>> Reviewed-by: Rafael Antognolli 
>> ---
>>  src/mesa/drivers/dri/i965/brw_pipe_control.c | 21 +
>>  1 file changed, 21 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_pipe_control.c 
>> b/src/mesa/drivers/dri/i965/brw_pipe_control.c
>> index 6ebe1443d5..b1975ce533 100644
>> --- a/src/mesa/drivers/dri/i965/brw_pipe_control.c
>> +++ b/src/mesa/drivers/dri/i965/brw_pipe_control.c
>> @@ -89,6 +89,24 @@ gen7_cs_stall_every_four_pipe_controls(struct brw_context 
>> *brw, uint32_t flags)
>> return 0;
>>  }
>>
>> +/* #1130 from gen10 workarounds page in h/w specs:
>> + * "Enable Depth Stall on every Post Sync Op if Render target Cache Flush is
>> + *  not enabled in same PIPE CONTROL and Enable Pixel score board stall if
>> + *  Render target cache flush is enabled."
>> + *
>> + * Applicable to CNL B0 and C0 steppings only.
>> + */
>> +static void
>> +gen10_add_rcpfe_workaround_bits(uint32_t *flags)
>> +{
>> +   if (*flags & PIPE_CONTROL_RENDER_TARGET_FLUSH)
>> +  *flags = *flags | PIPE_CONTROL_STALL_AT_SCOREBOARD;
>> +   else if ((*flags & PIPE_CONTROL_WRITE_IMMEDIATE) ||
>> +(*flags & PIPE_CONTROL_WRITE_DEPTH_COUNT) ||
>> +(*flags & PIPE_CONTROL_WRITE_TIMESTAMP))
>> +  *flags = *flags | PIPE_CONTROL_DEPTH_STALL;
>
> I think we usually use braces in multi-line if-statements.
>
> How about:
>} else if (*flags & (PIPE_CONTROL_WRITE_IMMEDIATE |
> PIPE_CONTROL_WRITE_DEPTH_COUNT |
> PIPE_CONTROL_WRITE_TIMESTAMP)) {
>
>
>
> With the commit message fixed and braces included, this patch is
> Reviewed-by: Nanley Chery 
>

All suggestions fixed locally.
>> +}
>> +
>>  static void
>>  brw_emit_pipe_control(struct brw_context *brw, uint32_t flags,
>>struct brw_bo *bo, uint32_t offset, uint64_t imm)
>> @@ -109,6 +127,9 @@ brw_emit_pipe_control(struct brw_context *brw, uint32_t 
>> flags,
>>   brw_emit_pipe_control_flush(brw, 0);
>>}
>>
>> +  if (devinfo->gen == 10)
>> + gen10_add_rcpfe_workaround_bits(&flags);
>> +
>>BEGIN_BATCH(6);
>>OUT_BATCH(_3DSTATE_PIPE_CONTROL | (6 - 2));
>>OUT_BATCH(flags);
>> --
>> 2.13.5
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 4/4] i965/gen10: Implement Wa3DStateMode

2017-11-02 Thread Anuj Phogat
On Thu, Nov 2, 2017 at 11:26 AM, Nanley Chery  wrote:
> On Wed, Nov 01, 2017 at 03:52:15PM -0700, Anuj Phogat wrote:
>> V2: Remove the bits enabling Float blend optimization. It is
>> enabled through CACHE_MODE_SS register.
>> Update the comment.
>>
>> This workaround doesn't fix any of the piglit hangs we've seen
>> on CNL.
>>
>
> I haven't seen this format in the git logs before..
>
>> Cc: Nanley Chery 
>> Cc: Jason Ekstrand 
>> Signed-off-by: Anuj Phogat 
>> Reviewed-by: Rafael Antognolli 
>> ---
>>  src/mesa/drivers/dri/i965/brw_defines.h  |  2 ++
>>  src/mesa/drivers/dri/i965/brw_state_upload.c | 12 
>>  2 files changed, 14 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
>> b/src/mesa/drivers/dri/i965/brw_defines.h
>> index 3008a1b8a7..1c2f06546e 100644
>> --- a/src/mesa/drivers/dri/i965/brw_defines.h
>> +++ b/src/mesa/drivers/dri/i965/brw_defines.h
>> @@ -1333,6 +1333,8 @@ enum brw_pixel_shader_coverage_mask_mode {
>>  /* DW2: start address */
>>  /* DW3: end address. */
>>
>> +#define _3DSTATE_3D_MODE 0x791e
>> +
>>  #define CMD_MI_FLUSH  0x0200
>>
>>  # define BLT_X_SHIFT 0
>> diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c 
>> b/src/mesa/drivers/dri/i965/brw_state_upload.c
>> index 7df06a6e4d..76c137c90e 100644
>> --- a/src/mesa/drivers/dri/i965/brw_state_upload.c
>> +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
>> @@ -89,6 +89,18 @@ brw_upload_initial_gpu_state(struct brw_context *brw)
>>brw_load_register_imm32(brw, GEN10_CACHE_MODE_SS,
>>
>> REG_MASK(GEN10_FLOAT_BLEND_OPTIMIZATION_ENABLE) |
>>GEN10_FLOAT_BLEND_OPTIMIZATION_ENABLE);
>> +
>> +  /* From gen10 workaround table in h/w specs:
>> +   * "On 3DSTATE_3D_MODE, driver must always program bits 31:16 of DW1
>> +   *  a value of 0x"
>> +   *  This means that we end up setting the entire 3D_MODE state. Bits
>> +   *  in this register control things such as slice hashing and we want
>> +   *  the default values of zero at the moment.
> ^ Extra space for the last 3 lines here.
>
> To fit in with similar messages in the codebase, maybe format it like this:
>
> /* From gen10 workaround table in h/w specs:
>  *
>  *"On 3DSTATE_3D_MODE, driver must always program bits 31:16 of DW1
>  * a value of 0x"
>  *
>  * This means that we end up setting the entire 3D_MODE state. Bits
>  * in this register control things such as slice hashing and we want
>  * the default values of zero at the moment.
>  */
>
> With the commit message and space fixed, this patch is
> Reviewed-by: Nanley Chery 
>

Fixed locally.
>> +   */
>> +  BEGIN_BATCH(2);
>> +  OUT_BATCH(_3DSTATE_3D_MODE  << 16 | (2 - 2));
>> +  OUT_BATCH(0x << 16);
>> +  ADVANCE_BATCH();
>> }
>>
>> if (devinfo->gen >= 8) {
>> --
>> 2.13.5
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: fix deleting the dummy ATI_fs

2017-11-02 Thread Miklós Máté
The DummyShader is used by GenFragmentShadersATI() as a placeholder to
mark IDs as allocated. Context cleanup wants to delete everything in
ctx->Shared->ATIShaders, and crashes on these placeholders with this
backtrace:
==15060== Invalid free() / delete / delete[] / realloc()
==15060==at 0x482F478: free (vg_replace_malloc.c:530)
==15060==by 0x57694F4: _mesa_delete_ati_fragment_shader (atifragshader.c:68)
==15060==by 0x58B33AB: delete_fragshader_cb (shared.c:208)
==15060==by 0x5838836: _mesa_HashDeleteAll (hash.c:295)
==15060==by 0x58B365F: free_shared_state (shared.c:377)
==15060==by 0x58B3BC2: _mesa_reference_shared_state (shared.c:469)
==15060==by 0x578687F: _mesa_free_context_data (context.c:1366)
==15060==by 0x595E9EC: st_destroy_context (st_context.c:642)
==15060==by 0x5987057: st_context_destroy (st_manager.c:772)
==15060==by 0x5B018B6: dri_destroy_context (dri_context.c:217)
==15060==by 0x5B006D3: driDestroyContext (dri_util.c:511)
==15060==by 0x4A1CBE6: dri3_destroy_context (dri3_glx.c:170)
==15060==  Address 0x7b5dae0 is 0 bytes inside data symbol "DummyShader"

Also, DeleteFragmentShadersATI() should not assert on DummyShader, just
remove the hash entry.

Normally one would define a shader after GenFragmentShadersATI(), and
BindFragmentShaderATI() replaces the placeholder with a real object.
However, the specification doesn't say that one has to define a shader
for each allocated ID.

Signed-off-by: Miklós Máté 
---
 src/mesa/main/atifragshader.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c
index 27d8b86477..49ddb6e5af 100644
--- a/src/mesa/main/atifragshader.c
+++ b/src/mesa/main/atifragshader.c
@@ -60,6 +60,10 @@ void
 _mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct 
ati_fragment_shader *s)
 {
GLuint i;
+
+   if (s == &DummyShader)
+  return;
+
for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
   free(s->Instructions[i]);
   free(s->SetupInst[i]);
@@ -295,7 +299,6 @@ _mesa_DeleteFragmentShaderATI(GLuint id)
   if (prog) {
 prog->RefCount--;
 if (prog->RefCount <= 0) {
-   assert(prog != &DummyShader);
 _mesa_delete_ati_fragment_shader(ctx, prog);
 }
   }
-- 
2.15.0.rc0

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


[Mesa-dev] [PATCH 4/5] meson: add support for xlib glx

2017-11-02 Thread Dylan Baker
There is a bunch of churn in the main meson.build so that we can
correctly set the auto tristate of GLX. In particular, don't build
xlib-based glx when dri and gallium are disabled but vulkan is enabled,
in that case just turn glx off.

Signed-off-by: Dylan Baker 
---
 meson.build  | 85 +++-
 src/mesa/drivers/x11/meson.build | 39 ++
 src/mesa/meson.build |  8 ++--
 3 files changed, 90 insertions(+), 42 deletions(-)
 create mode 100644 src/mesa/drivers/x11/meson.build

diff --git a/meson.build b/meson.build
index d22d49535af..51ff0febde7 100644
--- a/meson.build
+++ b/meson.build
@@ -127,14 +127,6 @@ if _drivers != ''
   with_dri = true
 endif
 
-if not (with_dri or with_gallium)
-  with_gles1 = false
-  with_gles2 = false
-  with_opengl = false
-  with_any_opengl = false
-  with_shared_glapi = false
-endif
-
 if with_dri_swrast and with_gallium_softpipe
   error('Only one swrast provider can be built')
 endif
@@ -167,6 +159,43 @@ if _platforms != ''
   egl_native_platform = _split[0]
 endif
 
+with_intel_vk = false
+with_amd_vk = false
+with_any_vk = false
+_vulkan_drivers = get_option('vulkan-drivers')
+if _vulkan_drivers != ''
+  _split = _vulkan_drivers.split(',')
+  with_intel_vk = _split.contains('intel')
+  with_amd_vk = _split.contains('amd')
+  with_any_vk = with_amd_vk or with_intel_vk
+  if not (with_platform_x11 or with_platform_wayland or with_platform_android)
+error('Vulkan requires at least one platform (x11, wayland, android)')
+  endif
+endif
+
+with_glx = get_option('glx')
+if with_glx == 'auto'
+  if with_dri
+with_glx = 'dri'
+  elif with_gallium
+with_glx = 'gallium-xlib'
+  elif with_platform_x11 and with_any_opengl and not with_any_vk
+# The automatic behavior should not be to turn on xlib based glx when
+# building only vulkan drivers
+with_glx = 'xlib'
+  else
+with_glx = 'disabled'
+  endif
+endif
+
+if not (with_dri or with_gallium or with_glx == 'xlib')
+  with_gles1 = false
+  with_gles2 = false
+  with_opengl = false
+  with_any_opengl = false
+  with_shared_glapi = false
+endif
+
 with_gbm = get_option('gbm')
 if with_gbm == 'auto' and with_dri  # TODO: or gallium
   with_gbm = host_machine.system() == 'linux'
@@ -201,7 +230,6 @@ if with_egl and with_gallium_radeonsi and not 
(with_platform_drm or with_platfor
 endif
 
 pre_args += '-DGLX_USE_TLS'
-with_glx = get_option('glx')
 if with_glx != 'disabled'
   if not (with_platform_x11 and with_any_opengl)
 if with_glx == 'auto'
@@ -215,18 +243,12 @@ if with_glx != 'disabled'
 elif with_dri
   error('gallium-xlib conflicts with any dri driver')
 endif
-  elif with_glx == 'dri' and not with_dri
-error('dri based GLX requires at least one DRI driver')
-  elif with_glx == 'auto'
+  elif with_glx == 'xlib' 
 if with_dri
-  with_glx = 'dri'
-elif with_gallium
-  with_glx = 'gallium-xlib'
-elif with_platform_x11 and with_any_opengl
-  with_glx = 'xlib'
-else
-  with_glx = 'disabled'
+  error('xlib conflicts with any dri driver')
 endif
+  elif with_glx == 'dri' and not with_dri
+error('dri based GLX requires at least one DRI driver')
   endif
 endif
 
@@ -242,20 +264,6 @@ if with_vulkan_icd_dir == ''
   with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
 endif
 
-with_intel_vk = false
-with_amd_vk = false
-with_any_vk = false
-_vulkan_drivers = get_option('vulkan-drivers')
-if _vulkan_drivers != ''
-  _split = _vulkan_drivers.split(',')
-  with_intel_vk = _split.contains('intel')
-  with_amd_vk = _split.contains('amd')
-  with_any_vk = with_amd_vk or with_intel_vk
-  if not (with_platform_x11 or with_platform_wayland or with_platform_android)
-error('Vulkan requires at least one platform (x11, wayland, android)')
-  endif
-endif
-
 with_dri2 = (with_dri or with_any_vk) and with_dri_platform == 'drm'
 with_dri3 = get_option('dri3')
 if with_dri3 == 'auto'
@@ -302,8 +310,7 @@ if with_platform_x11
 pre_args += '-DHAVE_X11_PLATFORM'
   endif
   if with_glx == 'xlib'
-# TODO
-error('TODO')
+pre_args += '-DUSE_XSHM'
   elif with_glx == 'gallium-xlib'
 # TODO
 error('TODO')
@@ -786,7 +793,11 @@ dep_xcb_sync = []
 dep_xcb_xfixes = []
 dep_xshmfence = []
 if with_platform_x11
-  if with_glx == 'dri' and with_dri_platform == 'drm'
+  if with_glx == 'xlib'
+dep_x11 = dependency('x11')
+dep_xext = dependency('xext')
+dep_xcb = dependency('xcb')
+  elif with_glx == 'dri' and with_dri_platform == 'drm'
 dep_x11 = dependency('x11')
 dep_xext = dependency('xext')
 dep_xdamage = dependency('xdamage', version : '>= 1.1')
@@ -807,7 +818,7 @@ if with_platform_x11
   dep_xshmfence = dependency('xshmfence', version : '>= 1.1')
 endif
   endif
-  if with_glx != 'disabled'
+  if with_glx == 'dri'
 dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
 dep_glproto = dependency('glproto', versio

[Mesa-dev] [PATCH 3/5] meson: move gl pkgconfig generation out of glx

2017-11-02 Thread Dylan Baker
Because the same generation logic is required by xlib glx and
gallium-xlib glx, it makes sense to pull it out.

Signed-off-by: Dylan Baker 
---
 src/glx/meson.build | 11 ---
 src/meson.build | 12 
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/glx/meson.build b/src/glx/meson.build
index 573316c9424..98e3ad561b3 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -167,17 +167,6 @@ if with_glx == 'dri'
 version : gl_lib_version,
 install : true,
   )
-
-  pkg.generate(
-name : 'gl',
-filebase : 'gl',
-description : 'Mesa OpenGL Library',
-version : meson.project_version(),
-libraries : libgl,
-libraries_private : gl_priv_libs,
-requires_private : gl_priv_reqs,
-variables : ['glx_tls=yes'],
-  )
 endif
 
 if with_tests
diff --git a/src/meson.build b/src/meson.build
index 186cf92f47e..dd504cf3127 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -43,6 +43,18 @@ sha1_h = custom_target(
   build_always : true, # commit sha1 can change without having touched these 
files
 )
 
+if with_glx != 'disabled'
+  pkg.generate(
+name : 'gl',
+description : 'Mesa OpenGL Library',
+version : meson.project_version(),
+libraries : libgl,
+libraries_private : gl_priv_libs,
+requires_private : gl_priv_reqs,
+variables : ['glx_tls=yes'],
+  )
+endif
+
 subdir('gtest')
 subdir('util')
 subdir('mapi/glapi/gen')
-- 
2.15.0

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


[Mesa-dev] [PATCH 2/5] meson: move wayland-egl into egl folder

2017-11-02 Thread Dylan Baker
This ensure that it's properly guarded, but also makes the code clearer
by grouping related things together..

Signed-off-by: Dylan Baker 
---
 src/egl/meson.build | 4 
 src/meson.build | 3 ---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/egl/meson.build b/src/egl/meson.build
index 67ca8cef921..a84b17baefa 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -182,6 +182,10 @@ pkg.generate(
   extra_cflags : gl_pkgconfig_c_flags,
 )
 
+if with_platform_wayland
+  subdir('wayland/wayland-egl')
+endif
+
 if with_tests
   if with_glvnd
 # TODO: add glvnd symbol check
diff --git a/src/meson.build b/src/meson.build
index cc8f5953c51..186cf92f47e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -59,9 +59,6 @@ subdir('intel')
 subdir('mesa')
 subdir('loader')
 subdir('glx')
-if with_platform_wayland
-  subdir('egl/wayland/wayland-egl')
-endif
 if with_gbm
   subdir('gbm')
 endif
-- 
2.15.0

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


[Mesa-dev] [PATCH 5/5] meson: build gallium-xlib based glx

2017-11-02 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 meson.build | 16 +++---
 src/gallium/meson.build | 11 +++-
 src/gallium/state_trackers/glx/xlib/meson.build | 27 ++
 src/gallium/targets/libgl-xlib/meson.build  | 68 +
 src/gallium/winsys/sw/xlib/meson.build  | 27 ++
 5 files changed, 139 insertions(+), 10 deletions(-)
 create mode 100644 src/gallium/state_trackers/glx/xlib/meson.build
 create mode 100644 src/gallium/targets/libgl-xlib/meson.build
 create mode 100644 src/gallium/winsys/sw/xlib/meson.build

diff --git a/meson.build b/meson.build
index 51ff0febde7..be29a98d469 100644
--- a/meson.build
+++ b/meson.build
@@ -124,7 +124,6 @@ if _drivers != ''
   with_gallium_etnaviv = _split.contains('etnaviv')
   with_gallium_imx = _split.contains('imx')
   with_gallium = true
-  with_dri = true
 endif
 
 if with_dri_swrast and with_gallium_softpipe
@@ -178,7 +177,9 @@ if with_glx == 'auto'
   if with_dri
 with_glx = 'dri'
   elif with_gallium
-with_glx = 'gallium-xlib'
+# Even when building just gallium drivers the user probably wants dri
+with_glx = 'dri'
+with_dri = true
   elif with_platform_x11 and with_any_opengl and not with_any_vk
 # The automatic behavior should not be to turn on xlib based glx when
 # building only vulkan drivers
@@ -188,7 +189,7 @@ if with_glx == 'auto'
   endif
 endif
 
-if not (with_dri or with_gallium or with_glx == 'xlib')
+if not (with_dri or with_gallium or with_glx == 'xlib' or with_glx == 
'gallium-xlib')
   with_gles1 = false
   with_gles2 = false
   with_opengl = false
@@ -240,6 +241,8 @@ if with_glx != 'disabled'
   elif with_glx == 'gallium-xlib' 
 if not with_gallium
   error('Gallium-xlib based GLX requires at least one gallium driver')
+elif not with_gallium_softpipe
+  error('Gallium-xlib based GLX requires softpipe or llvmpipe.')
 elif with_dri
   error('gallium-xlib conflicts with any dri driver')
 endif
@@ -309,11 +312,8 @@ if with_platform_x11
   if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
 pre_args += '-DHAVE_X11_PLATFORM'
   endif
-  if with_glx == 'xlib'
+  if with_glx == 'xlib' or with_glx == 'gallium-xlib'
 pre_args += '-DUSE_XSHM'
-  elif with_glx == 'gallium-xlib'
-# TODO
-error('TODO')
   else
 pre_args += '-DGLX_INDIRECT_RENDERING'
 if with_glx_direct
@@ -793,7 +793,7 @@ dep_xcb_sync = []
 dep_xcb_xfixes = []
 dep_xshmfence = []
 if with_platform_x11
-  if with_glx == 'xlib'
+  if with_glx == 'xlib' or with_glx == 'gallium-xlib'
 dep_x11 = dependency('x11')
 dep_xext = dependency('xext')
 dep_xcb = dependency('xcb')
diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index 6edfe80321d..31884f5b72e 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -65,17 +65,22 @@ endif
 if with_gallium_imx
   subdir('winsys/imx/drm')
 endif
+if with_glx == 'gallium-xlib'
+  subdir('winsys/sw/xlib')
+endif
 subdir('state_trackers/dri')
 if with_osmesa == 'gallium'
   subdir('state_trackers/osmesa')
 endif
+if with_glx == 'gallium-xlib'
+  subdir('state_trackers/glx/xlib')
+endif
 # TODO: i915
 # TODO: SVGA
 # TODO: r300
 # TODO: r600
 # TODO: SWR
 # TODO: virgl
-# TODO: winsys/sw/xlib
 # TODO: clover
 if with_dri and with_gallium
   subdir('targets/dri')
@@ -83,7 +88,9 @@ endif
 if with_osmesa == 'gallium'
   subdir('targets/osmesa')
 endif
-# TODO: xlib-glx
+if with_glx == 'gallium-xlib'
+  subdir('targets/libgl-xlib')
+endif
 # TODO: OMX
 # TODO: VA
 # TODO: vdpau
diff --git a/src/gallium/state_trackers/glx/xlib/meson.build 
b/src/gallium/state_trackers/glx/xlib/meson.build
new file mode 100644
index 000..f4ee75426bc
--- /dev/null
+++ b/src/gallium/state_trackers/glx/xlib/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2017 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 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.
+
+libxlib = static_library(
+  'xli

[Mesa-dev] [PATCH 0/5] meson glx-xlib (classic and gallium)

2017-11-02 Thread Dylan Baker
There's a few cleanups in here, but mostly it's just the logic for building xlib
backed glx.

Dylan Baker (5):
  meson: add nir_builder_opcodes_h to gallium_auxiliary
  meson: move wayland-egl into egl folder
  meson: move gl pkgconfig generation out of glx
  meson: add support for xlib glx
  meson: build gallium-xlib based glx

 meson.build | 95 ++---
 src/egl/meson.build |  4 ++
 src/gallium/auxiliary/meson.build   |  2 +-
 src/gallium/meson.build | 11 ++-
 src/gallium/state_trackers/glx/xlib/meson.build | 27 +++
 src/gallium/targets/libgl-xlib/meson.build  | 68 ++
 src/gallium/winsys/sw/xlib/meson.build  | 27 +++
 src/glx/meson.build | 11 ---
 src/mesa/drivers/x11/meson.build| 39 ++
 src/mesa/meson.build|  8 +--
 src/meson.build | 15 +++-
 11 files changed, 243 insertions(+), 64 deletions(-)
 create mode 100644 src/gallium/state_trackers/glx/xlib/meson.build
 create mode 100644 src/gallium/targets/libgl-xlib/meson.build
 create mode 100644 src/gallium/winsys/sw/xlib/meson.build
 create mode 100644 src/mesa/drivers/x11/meson.build

-- 
2.15.0

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


[Mesa-dev] [PATCH 1/5] meson: add nir_builder_opcodes_h to gallium_auxiliary

2017-11-02 Thread Dylan Baker
This creates a dependency on this header being generated before trying
to compile any of these targets, as well as passing the correct -I to
the compiler to ensure it's included correctly.

Signed-off-by: Dylan Baker 
---
 src/gallium/auxiliary/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/meson.build 
b/src/gallium/auxiliary/meson.build
index eed70647927..eaa28b19f65 100644
--- a/src/gallium/auxiliary/meson.build
+++ b/src/gallium/auxiliary/meson.build
@@ -490,7 +490,7 @@ u_format_table_c = custom_target(
 libgallium = static_library(
   'gallium',
   [files_libgallium, u_indices_gen_c, u_unfilled_gen_c, u_format_table_c,
-   nir_opcodes_h],
+   nir_opcodes_h, nir_builder_opcodes_h],
   include_directories : [
 inc_loader, inc_gallium, inc_src, inc_include, include_directories('util')
   ],
-- 
2.15.0

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


Re: [Mesa-dev] [PATCH mesa 1/2] meson: standardize .so version to major.minor.patch

2017-11-02 Thread Dylan Baker
I'm also not sure that it matters, but I think consistency with autotools is
important,
Reviewed-by: Dylan Baker 

Quoting Eric Engestrom (2017-11-02 16:42:11)
> This `version` field defines the filename for the .so.
> The plan .so as well as .so.$major are always symlinks to this.
> 
> Unless I'm mistaken, only the major is ever used, so this shouldn't, but
> for consistency with autotools (and in case it does matter), let's
> always have all 3 major.minor.patch components.
> 
> (The soname isn't affected, and is always .so.$major)
> 
> Signed-off-by: Eric Engestrom 
> ---
>  src/egl/meson.build| 2 +-
>  src/gallium/targets/osmesa/meson.build | 2 +-
>  src/gbm/meson.build| 2 +-
>  src/glx/meson.build| 2 +-
>  src/mapi/es1api/meson.build| 2 +-
>  src/mapi/es2api/meson.build| 2 +-
>  src/mesa/drivers/osmesa/meson.build| 2 +-
>  7 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/egl/meson.build b/src/egl/meson.build
> index 67ca8cef92..36b1d9e41b 100644
> --- a/src/egl/meson.build
> +++ b/src/egl/meson.build
> @@ -145,7 +145,7 @@ if not with_glvnd
>egl_lib_version = '1.0.0'
>  else
>egl_lib_name = 'EGL_mesa'
> -  egl_lib_version = '0'
> +  egl_lib_version = '0.0.0'
>files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c]
>files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c')
>install_data(
> diff --git a/src/gallium/targets/osmesa/meson.build 
> b/src/gallium/targets/osmesa/meson.build
> index b4b3911ffd..72f77724e4 100644
> --- a/src/gallium/targets/osmesa/meson.build
> +++ b/src/gallium/targets/osmesa/meson.build
> @@ -62,7 +62,7 @@ libosmesa = shared_library(
>  pkg.generate(
>name : 'osmesa',
>description : 'Mesa Off-screen Rendering Library',
> -  version : '8',
> +  version : '8.0.0',
>libraries : libosmesa,
>libraries_private : gl_priv_libs,
>  )
> diff --git a/src/gbm/meson.build b/src/gbm/meson.build
> index 437896ef7f..f25f317202 100644
> --- a/src/gbm/meson.build
> +++ b/src/gbm/meson.build
> @@ -57,7 +57,7 @@ libgbm = shared_library(
>link_args : [ld_args_gc_sections],
>link_with : [links_gbm, libloader, libmesa_util, libxmlconfig],
>dependencies : [deps_gbm, dep_dl],
> -  version : '1.0',
> +  version : '1.0.0',
>install : true,
>  )
>  
> diff --git a/src/glx/meson.build b/src/glx/meson.build
> index 573316c942..01ebc56773 100644
> --- a/src/glx/meson.build
> +++ b/src/glx/meson.build
> @@ -112,7 +112,7 @@ if not with_glvnd
>gl_lib_version = '1.2.0'
>  else
>gl_lib_name = 'GLX_mesa'
> -  gl_lib_version = '0'
> +  gl_lib_version = '0.0.0'
>files_libglx += files(
>  'g_glxglvnddispatchfuncs.c',
>  'g_glxglvnddispatchindices.h',
> diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
> index 84a21cd6b7..8d95aee02f 100644
> --- a/src/mapi/es1api/meson.build
> +++ b/src/mapi/es1api/meson.build
> @@ -36,7 +36,7 @@ libglesv1_cm = shared_library(
>include_directories : [inc_src, inc_include, inc_mapi],
>link_with : libglapi,
>dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl],
> -  version : '1.1',
> +  version : '1.1.0',
>install : true,
>  )
>  
> diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build
> index 3d6888a4b8..7e868d77b3 100644
> --- a/src/mapi/es2api/meson.build
> +++ b/src/mapi/es2api/meson.build
> @@ -36,7 +36,7 @@ libgles2 = shared_library(
>include_directories : [inc_src, inc_include, inc_mapi],
>link_with : libglapi,
>dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl],
> -  version : '2',
> +  version : '2.0.0',
>install : true,
>  )
>  
> diff --git a/src/mesa/drivers/osmesa/meson.build 
> b/src/mesa/drivers/osmesa/meson.build
> index 407cda7e94..a406bb3c21 100644
> --- a/src/mesa/drivers/osmesa/meson.build
> +++ b/src/mesa/drivers/osmesa/meson.build
> @@ -42,7 +42,7 @@ libosmesa = shared_library(
>  pkg.generate(
>name : 'osmesa',
>description : 'Mesa Off-screen Rendering Library',
> -  version : '8',
> +  version : '8.0.0',
>libraries : libosmesa,
>libraries_private : gl_priv_libs,
>  )
> -- 
> Cheers,
>   Eric
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


[Mesa-dev] [PATCH mesa 2/2] meson: drop GLESv1 .so version back to 1.0.0

2017-11-02 Thread Eric Engestrom
autotools generates libGLESv1_CM.so.1.0.0, so let's make sure meson
does the same.

Signed-off-by: Eric Engestrom 
---
 src/mapi/es1api/meson.build   | 2 +-
 src/mapi/shared-glapi/meson.build | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
index 8d95aee02f..e8b9066a5f 100644
--- a/src/mapi/es1api/meson.build
+++ b/src/mapi/es1api/meson.build
@@ -36,7 +36,7 @@ libglesv1_cm = shared_library(
   include_directories : [inc_src, inc_include, inc_mapi],
   link_with : libglapi,
   dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl],
-  version : '1.1.0',
+  version : '1.0.0',
   install : true,
 )
 
diff --git a/src/mapi/shared-glapi/meson.build 
b/src/mapi/shared-glapi/meson.build
index 0d88de0545..05fd53b7a2 100644
--- a/src/mapi/shared-glapi/meson.build
+++ b/src/mapi/shared-glapi/meson.build
@@ -44,6 +44,7 @@ libglapi = shared_library(
   link_args : [ld_args_gc_sections],
   include_directories : [inc_src, inc_include, inc_mapi],
   dependencies : [dep_thread, dep_selinux],
+  version : '0.0.0',
   install : true,
 )
 
-- 
Cheers,
  Eric

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


[Mesa-dev] [PATCH mesa 1/2] meson: standardize .so version to major.minor.patch

2017-11-02 Thread Eric Engestrom
This `version` field defines the filename for the .so.
The plan .so as well as .so.$major are always symlinks to this.

Unless I'm mistaken, only the major is ever used, so this shouldn't, but
for consistency with autotools (and in case it does matter), let's
always have all 3 major.minor.patch components.

(The soname isn't affected, and is always .so.$major)

Signed-off-by: Eric Engestrom 
---
 src/egl/meson.build| 2 +-
 src/gallium/targets/osmesa/meson.build | 2 +-
 src/gbm/meson.build| 2 +-
 src/glx/meson.build| 2 +-
 src/mapi/es1api/meson.build| 2 +-
 src/mapi/es2api/meson.build| 2 +-
 src/mesa/drivers/osmesa/meson.build| 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/egl/meson.build b/src/egl/meson.build
index 67ca8cef92..36b1d9e41b 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -145,7 +145,7 @@ if not with_glvnd
   egl_lib_version = '1.0.0'
 else
   egl_lib_name = 'EGL_mesa'
-  egl_lib_version = '0'
+  egl_lib_version = '0.0.0'
   files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c]
   files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c')
   install_data(
diff --git a/src/gallium/targets/osmesa/meson.build 
b/src/gallium/targets/osmesa/meson.build
index b4b3911ffd..72f77724e4 100644
--- a/src/gallium/targets/osmesa/meson.build
+++ b/src/gallium/targets/osmesa/meson.build
@@ -62,7 +62,7 @@ libosmesa = shared_library(
 pkg.generate(
   name : 'osmesa',
   description : 'Mesa Off-screen Rendering Library',
-  version : '8',
+  version : '8.0.0',
   libraries : libosmesa,
   libraries_private : gl_priv_libs,
 )
diff --git a/src/gbm/meson.build b/src/gbm/meson.build
index 437896ef7f..f25f317202 100644
--- a/src/gbm/meson.build
+++ b/src/gbm/meson.build
@@ -57,7 +57,7 @@ libgbm = shared_library(
   link_args : [ld_args_gc_sections],
   link_with : [links_gbm, libloader, libmesa_util, libxmlconfig],
   dependencies : [deps_gbm, dep_dl],
-  version : '1.0',
+  version : '1.0.0',
   install : true,
 )
 
diff --git a/src/glx/meson.build b/src/glx/meson.build
index 573316c942..01ebc56773 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -112,7 +112,7 @@ if not with_glvnd
   gl_lib_version = '1.2.0'
 else
   gl_lib_name = 'GLX_mesa'
-  gl_lib_version = '0'
+  gl_lib_version = '0.0.0'
   files_libglx += files(
 'g_glxglvnddispatchfuncs.c',
 'g_glxglvnddispatchindices.h',
diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
index 84a21cd6b7..8d95aee02f 100644
--- a/src/mapi/es1api/meson.build
+++ b/src/mapi/es1api/meson.build
@@ -36,7 +36,7 @@ libglesv1_cm = shared_library(
   include_directories : [inc_src, inc_include, inc_mapi],
   link_with : libglapi,
   dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl],
-  version : '1.1',
+  version : '1.1.0',
   install : true,
 )
 
diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build
index 3d6888a4b8..7e868d77b3 100644
--- a/src/mapi/es2api/meson.build
+++ b/src/mapi/es2api/meson.build
@@ -36,7 +36,7 @@ libgles2 = shared_library(
   include_directories : [inc_src, inc_include, inc_mapi],
   link_with : libglapi,
   dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl],
-  version : '2',
+  version : '2.0.0',
   install : true,
 )
 
diff --git a/src/mesa/drivers/osmesa/meson.build 
b/src/mesa/drivers/osmesa/meson.build
index 407cda7e94..a406bb3c21 100644
--- a/src/mesa/drivers/osmesa/meson.build
+++ b/src/mesa/drivers/osmesa/meson.build
@@ -42,7 +42,7 @@ libosmesa = shared_library(
 pkg.generate(
   name : 'osmesa',
   description : 'Mesa Off-screen Rendering Library',
-  version : '8',
+  version : '8.0.0',
   libraries : libosmesa,
   libraries_private : gl_priv_libs,
 )
-- 
Cheers,
  Eric

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


Re: [Mesa-dev] [PATCH] mesa: prevent deleting the dummy ATI_fs

2017-11-02 Thread Miklós Máté

On 02/11/17 17:16, Nicolai Hähnle wrote:

On 01.11.2017 00:34, Miklós Máté wrote:

This fixes a crash upon context destruction when
glGenFragmentShadersATI() was used. Backtrace:
==15060== Invalid free() / delete / delete[] / realloc()
==15060==    at 0x482F478: free (vg_replace_malloc.c:530)
==15060==    by 0x57694F4: _mesa_delete_ati_fragment_shader 
(atifragshader.c:68)

==15060==    by 0x58B33AB: delete_fragshader_cb (shared.c:208)
==15060==    by 0x5838836: _mesa_HashDeleteAll (hash.c:295)
==15060==    by 0x58B365F: free_shared_state (shared.c:377)
==15060==    by 0x58B3BC2: _mesa_reference_shared_state (shared.c:469)
==15060==    by 0x578687F: _mesa_free_context_data (context.c:1366)
==15060==    by 0x595E9EC: st_destroy_context (st_context.c:642)
==15060==    by 0x5987057: st_context_destroy (st_manager.c:772)
==15060==    by 0x5B018B6: dri_destroy_context (dri_context.c:217)
==15060==    by 0x5B006D3: driDestroyContext (dri_util.c:511)
==15060==    by 0x4A1CBE6: dri3_destroy_context (dri3_glx.c:170)
==15060==  Address 0x7b5dae0 is 0 bytes inside data symbol "DummyShader"

This hasn't been an issue yet, because the only thing that calls
glGenFragmentShadersATI() is my WIP piglit test. SWKOTOR and Doom3
use hard-coded shader names.

The patch also fixes this:
name=glGenFragmentShadersATI(1);
glDeleteFragmentShaderATI(name);

Signed-off-by: Miklós Máté 
---
  src/mesa/main/atifragshader.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/atifragshader.c 
b/src/mesa/main/atifragshader.c

index 27d8b86477..fdfaea0528 100644
--- a/src/mesa/main/atifragshader.c
+++ b/src/mesa/main/atifragshader.c
@@ -60,6 +60,9 @@ void
  _mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct 
ati_fragment_shader *s)

  {
 GLuint i;
+
+   if (s == &DummyShader)
+  return;
+
 for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
    free(s->Instructions[i]);
    free(s->SetupInst[i]);
@@ -295,7 +298,6 @@ _mesa_DeleteFragmentShaderATI(GLuint id)
    if (prog) {
   prog->RefCount--;
   if (prog->RefCount <= 0) {
-    assert(prog != &DummyShader);
  _mesa_delete_ati_fragment_shader(ctx, prog);


This looks very much like it should be caught earlier by an error 
check. Usually, the object ID 0 is silently ignored by glDelete* 
commands (and negative values result in INVALID_VALUE).


Cheers,
Nicolai
It's not object ID 0. The DummyShader is used by GenFragmentShadersATI() 
as a placeholder to mark those IDs as allocated. 
DeleteFragmentShadersATI() and context cleanup should be able to remove 
the placeholders without crashing.


I'll resend the patch with better commit message. I don't know why it 
doesn't apply for Marek though, this file hasn't been touched in months.


MM





   }
    }






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


[Mesa-dev] [Bug 103543] meson targets which link libgallium.a have unresolved symbol llvm::RTDyldMemoryManager

2017-11-02 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103543

--- Comment #2 from Dylan Baker  ---
Also, I noticed you're using meson from git, are you building with upstream
master, or do you have additional patches?

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


[Mesa-dev] [Bug 103543] meson targets which link libgallium.a have unresolved symbol llvm::RTDyldMemoryManager

2017-11-02 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103543

Dylan Baker  changed:

   What|Removed |Added

 Status|NEW |NEEDINFO

--- Comment #1 from Dylan Baker  ---
I'm having trouble reproducing your problem. I have gcc 7.2.0 and LLVM 5.0.0
and with the same options:

CFLAGS="-march=native -mtune=native -m64 -pipe -O3" CXXFLAGS="-march=native
-mtune=native -m64 -pipe -O3" meson build -Ddri-drivers=r200
-Dgallium-drivers=swrast -Dvulkan-drivers=amd -Dplatforms=x11,wayland,drm
-Dglx=dri -Dgles1=false -Dgles2=false -Dvalgrind=false -Dlibunwind=false
-Dselinux=false -Dosmesa=gallium

It compiles and links fine for me.

As an aside, since you're passing -O3, you should also pass --buildtype=plain,
so that meson doesn't add -g and -O options.

Two questions for you:
Are you compiling LLVM yourself?
Does the build work with autotools?

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


[Mesa-dev] [PATCH] intel/fs: Use a pure vertical stride for large register strides

2017-11-02 Thread Jason Ekstrand
Register strides higher than 4 are uncommon but they can happen.  For
instance, if you have a 64-bit extract_u8 operation, we turn that into
UB -> UQ MOV with a source stride of 8.  Our previous calculation would
try to generate a stride of <32;8,8>:ub which is invalid because the
maximum horizontal stride is 4.  To solve this problem, we instead use a
stride of <8;1,0>.  As noted in the comment, this does not work as a
destination but that's ok as very few things actually generate that
stride.

Cc: mesa-sta...@lists.freedesktop.org
---
 src/intel/compiler/brw_fs_generator.cpp | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/intel/compiler/brw_fs_generator.cpp 
b/src/intel/compiler/brw_fs_generator.cpp
index 46f9a33..a557f80 100644
--- a/src/intel/compiler/brw_fs_generator.cpp
+++ b/src/intel/compiler/brw_fs_generator.cpp
@@ -90,9 +90,18 @@ brw_reg_from_fs_reg(const struct gen_device_info *devinfo, 
fs_inst *inst,
   *   different execution size when the number of components
   *   written to each destination GRF is not the same.
   */
- const unsigned width = MIN2(reg_width, phys_width);
- brw_reg = brw_vecn_reg(width, brw_file_from_reg(reg), reg->nr, 0);
- brw_reg = stride(brw_reg, width * reg->stride, width, reg->stride);
+ if (reg->stride > 4) {
+/* For registers with an exceptionally large stride, we use a
+ * width of 1 and only use the vertical stride.  This only works
+ * for sources since destinations require hstride == 1.
+ */
+brw_reg = brw_vec1_reg(brw_file_from_reg(reg), reg->nr, 0);
+brw_reg = stride(brw_reg, reg->stride, 1, 0);
+ } else {
+const unsigned width = MIN2(reg_width, phys_width);
+brw_reg = brw_vecn_reg(width, brw_file_from_reg(reg), reg->nr, 0);
+brw_reg = stride(brw_reg, width * reg->stride, width, reg->stride);
+ }
 
  if (devinfo->gen == 7 && !devinfo->is_haswell) {
 /* From the IvyBridge PRM (EU Changes by Processor Generation, 
page 13):
-- 
2.5.0.400.gff86faf

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


Re: [Mesa-dev] [PATCH 05/12] glsl: Combine nop-swizzle optimization with swizzle-swizzle optimization

2017-11-02 Thread Thomas Helland
Changes all look really good, and some performance numbers
I have for a similar patch I've written shows a marginal benefit
in compiler runtime performance (perf-stat -> cycles executed)
For patches 4 and 5.

Reviewed-by: 

2. nov. 2017 21.26 skrev "Ian Romanick" :

From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/compiler/Makefile.sources  |  3 +-
 src/compiler/glsl/glsl_parser_extras.cpp   |  3 +-
 src/compiler/glsl/ir_optimization.h|  3 +-
 src/compiler/glsl/meson.build  |  3 +-
 .../glsl/{opt_noop_swizzle.cpp => opt_swizzle.cpp} | 56 ++---
 src/compiler/glsl/opt_swizzle_swizzle.cpp  | 96
--
 src/compiler/glsl/test_optpass.cpp |  6 +-
 7 files changed, 52 insertions(+), 118 deletions(-)
 rename src/compiler/glsl/{opt_noop_swizzle.cpp => opt_swizzle.cpp} (56%)
 delete mode 100644 src/compiler/glsl/opt_swizzle_swizzle.cpp

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index b80468c..60814e2 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -130,11 +130,10 @@ LIBGLSL_FILES = \
glsl/opt_function_inlining.cpp \
glsl/opt_if_simplification.cpp \
glsl/opt_minmax.cpp \
-   glsl/opt_noop_swizzle.cpp \
glsl/opt_rebalance_tree.cpp \
glsl/opt_redundant_jumps.cpp \
glsl/opt_structure_splitting.cpp \
-   glsl/opt_swizzle_swizzle.cpp \
+   glsl/opt_swizzle.cpp \
glsl/opt_tree_grafting.cpp \
glsl/opt_vectorize.cpp \
glsl/program.h \
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp
b/src/compiler/glsl/glsl_parser_extras.cpp
index 822301a..5982173 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -2226,8 +2226,7 @@ do_common_optimization(exec_list *ir, bool linked,
options->EmitNoCont, options->EmitNoLoops);
OPT(do_vec_index_to_swizzle, ir);
OPT(lower_vector_insert, ir, false);
-   OPT(do_swizzle_swizzle, ir);
-   OPT(do_noop_swizzle, ir);
+   OPT(optimize_swizzles, ir);

OPT(optimize_split_arrays, ir, linked);
OPT(optimize_redundant_jumps, ir);
diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_
optimization.h
index f44ddcb..2b8c195 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -123,9 +123,8 @@ bool lower_if_to_cond_assign(gl_shader_stage stage,
exec_list *instructions,
  unsigned max_depth = 0, unsigned
min_branch_cost = 0);
 bool do_mat_op_to_vec(exec_list *instructions);
 bool do_minmax_prune(exec_list *instructions);
-bool do_noop_swizzle(exec_list *instructions);
 bool do_structure_splitting(exec_list *instructions);
-bool do_swizzle_swizzle(exec_list *instructions);
+bool optimize_swizzles(exec_list *instructions);
 bool do_vectorize(exec_list *instructions);
 bool do_tree_grafting(exec_list *instructions);
 bool do_vec_index_to_cond_assign(exec_list *instructions);
diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build
index 76fcafb..6284d0c 100644
--- a/src/compiler/glsl/meson.build
+++ b/src/compiler/glsl/meson.build
@@ -169,11 +169,10 @@ files_libglsl = files(
   'opt_function_inlining.cpp',
   'opt_if_simplification.cpp',
   'opt_minmax.cpp',
-  'opt_noop_swizzle.cpp',
   'opt_rebalance_tree.cpp',
   'opt_redundant_jumps.cpp',
   'opt_structure_splitting.cpp',
-  'opt_swizzle_swizzle.cpp',
+  'opt_swizzle.cpp',
   'opt_tree_grafting.cpp',
   'opt_vectorize.cpp',
   'program.h',
diff --git a/src/compiler/glsl/opt_noop_swizzle.cpp b/src/compiler/glsl/opt_
swizzle.cpp
similarity index 56%
rename from src/compiler/glsl/opt_noop_swizzle.cpp
rename to src/compiler/glsl/opt_swizzle.cpp
index 41890ab..2fbe362 100644
--- a/src/compiler/glsl/opt_noop_swizzle.cpp
+++ b/src/compiler/glsl/opt_swizzle.cpp
@@ -22,11 +22,14 @@
  */

 /**
- * \file opt_noop_swizzle.cpp
+ * \file opt_swizzle.cpp
+ * Optimize swizzle operations.
  *
- * If a swizzle doesn't change the order or count of components, then
- * remove the swizzle so that other optimization passes see the value
- * behind it.
+ * First, compact a sequence of swizzled swizzles into a single swizzle.
+ *
+ * If the final resulting swizzle doesn't change the order or count of
+ * components, then remove the swizzle so that other optimization passes
see
+ * the value behind it.
  */

 #include "ir.h"
@@ -36,9 +39,9 @@

 namespace {

-class ir_noop_swizzle_visitor : public ir_rvalue_visitor {
+class ir_opt_swizzle_visitor : public ir_rvalue_visitor {
 public:
-   ir_noop_swizzle_visitor()
+   ir_opt_swizzle_visitor()
{
   this->progress = false;
}
@@ -50,13 +53,46 @@ public:
 } /* unnamed namespace */

 void
-ir_noop_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue)
+ir_opt_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue)
 {
if (!*rvalue)
   return;

ir_swizzle *swiz = (*rvalue)->as_s

[Mesa-dev] [PATCH v4 9/9] egl/wayland: add dri2_wl_free_buffers() helper (v3)

2017-11-02 Thread Gwan-gyeong Mun
This deduplicates free routines of color_buffers array.

v2:
 - Add clear_all argument to check clearing all of color_buffers or not.
 - Fixes from Eric's review:
   a) polish check routine of check_lock and color_buffers[i].locked
   b) move 'native_buffer = NULL' to avoid leaking locked buffers
 - Fixes from Emil's review:
   a) drop the unneeded cast
   b) apply dri2_wl_free_buffers to update_buffers() and swrast_update_buffers()

v3: Use a dri2_surface_free_image() helper

Signed-off-by: Mun Gwan-gyeong 
---
 src/egl/drivers/dri2/platform_wayland.c | 85 +
 1 file changed, 33 insertions(+), 52 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index d864355eb4..b77f05ca15 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -252,6 +252,35 @@ dri2_wl_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay 
*disp,
return NULL;
 }
 
+static void
+dri2_wl_free_buffers(struct dri2_egl_surface *dri2_surf, bool check_lock,
+ bool clear_all)
+{
+   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
+  bool clear_buffer = false;
+
+  if (dri2_surf->color_buffers[i].native_buffer &&
+  (!check_lock || !dri2_surf->color_buffers[i].locked)) {
+ wl_buffer_destroy(dri2_surf->color_buffers[i].native_buffer);
+ dri2_surf->color_buffers[i].native_buffer = NULL;
+ dri2_surf->color_buffers[i].locked = false;
+ clear_buffer = true;
+  }
+
+  if (clear_all || clear_buffer) {
+ dri2_surface_free_image(&dri2_surf->base,
+ &dri2_surf->color_buffers[i].dri_image);
+ dri2_surface_free_image(&dri2_surf->base,
+ &dri2_surf->color_buffers[i].linear_copy);
+ if (dri2_surf->color_buffers[i].data)
+munmap(dri2_surf->color_buffers[i].data,
+   dri2_surf->color_buffers[i].data_size);
+
+ dri2_surf->color_buffers[i].data = NULL;
+  }
+   }
+}
+
 /**
  * Called via eglDestroySurface(), drv->API.DestroySurface().
  */
@@ -265,17 +294,7 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay 
*disp, _EGLSurface *surf)
 
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
 
-   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
-  if (dri2_surf->color_buffers[i].native_buffer)
- wl_buffer_destroy(dri2_surf->color_buffers[i].native_buffer);
-  dri2_surface_free_image(&dri2_surf->base,
-  &dri2_surf->color_buffers[i].dri_image);
-  dri2_surface_free_image(&dri2_surf->base,
-  &dri2_surf->color_buffers[i].linear_copy);
-  if (dri2_surf->color_buffers[i].data)
- munmap(dri2_surf->color_buffers[i].data,
-dri2_surf->color_buffers[i].data_size);
-   }
+   dri2_wl_free_buffers(dri2_surf, false, true);
 
if (dri2_dpy->dri2)
   dri2_egl_surface_free_local_buffers(dri2_surf);
@@ -307,22 +326,7 @@ dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf)
struct dri2_egl_display *dri2_dpy =
   dri2_egl_display(dri2_surf->base.Resource.Display);
 
-   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
-  if (dri2_surf->color_buffers[i].native_buffer &&
-  !dri2_surf->color_buffers[i].locked)
- wl_buffer_destroy(dri2_surf->color_buffers[i].native_buffer);
-  dri2_surface_free_image(&dri2_surf->base,
-  &dri2_surf->color_buffers[i].dri_image);
-  dri2_surface_free_image(&dri2_surf->base,
-  &dri2_surf->color_buffers[i].linear_copy);
-  if (dri2_surf->color_buffers[i].data)
- munmap(dri2_surf->color_buffers[i].data,
-dri2_surf->color_buffers[i].data_size);
-
-  dri2_surf->color_buffers[i].native_buffer = NULL;
-  dri2_surf->color_buffers[i].data = NULL;
-  dri2_surf->color_buffers[i].locked = false;
-   }
+   dri2_wl_free_buffers(dri2_surf, true, true);
 
if (dri2_dpy->dri2)
   dri2_egl_surface_free_local_buffers(dri2_surf);
@@ -487,9 +491,6 @@ back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, 
__DRIbuffer *buffer)
 static int
 update_buffers(struct dri2_egl_surface *dri2_surf)
 {
-   struct dri2_egl_display *dri2_dpy =
-  dri2_egl_display(dri2_surf->base.Resource.Display);
-
if (dri2_surf->base.Width != dri2_surf->wl_win->width ||
dri2_surf->base.Height != dri2_surf->wl_win->height) {
 
@@ -509,18 +510,7 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
/* If we have an extra unlocked buffer at this point, we had to do triple
 * buffering for a while, but now can go back to just double buffering.
 * That means we can free any unlocked buffer now. */
-   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
-  if (!dri2_surf->color_buffers[i].locked &&
-  dri2

[Mesa-dev] [PATCH v4 8/9] egl: add dri2_surface_get_front_image() helper (v4)

2017-11-02 Thread Gwan-gyeong Mun
To share common get and create dri_image_front code.

In preparation to adding of new platform which uses this helper.

v2:
 - Remove unneeded ifdef magic
 - Fixes from Eric's review:
   a) Split out series of refactor for helpers to a separate series.
   b) Add the new helper function and use them to replace the old code in the
  same patch.

v3: Fixes from Emil and Gurchetan's review
  - Follow the naming convention which prevents too verbose name of functions.
a) use a dri2_surface_$action_$object naming convention
b) change a first argument type "struct dri2_egl_surface" to "_EGLSurface".

v4:
  - Move dri_image_front to outside of android ifdef block for not to use of
ifdef magic on dri2_surface_get_front_image().

Signed-off-by: Mun Gwan-gyeong 
Reviewed-by: Emil Velikov 
---
 src/egl/drivers/dri2/egl_dri2.c | 33 +++
 src/egl/drivers/dri2/egl_dri2.h |  6 +-
 src/egl/drivers/dri2/platform_android.c | 35 +
 3 files changed, 39 insertions(+), 35 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 13c86f87c2..c1a9392f68 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1153,6 +1153,39 @@ dri2_surface_free_image(_EGLSurface *surf, __DRIimage 
**img)
}
 }
 
+int
+dri2_surface_get_front_image(_EGLSurface *surf, unsigned int format)
+{
+   struct dri2_egl_display *dri2_dpy = 
dri2_egl_display(surf->Resource.Display);
+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
+
+   if (dri2_surf->dri_image_front)
+  return 0;
+
+   if (surf->Type == EGL_WINDOW_BIT) {
+  /* According current EGL spec, front buffer rendering
+   * for window surface is not supported now.
+   * and mesa doesn't have the implementation of this case.
+   * Add warning message, but not treat it as error.
+   */
+  _eglLog(_EGL_DEBUG, "DRI driver requested unsupported front buffer for 
window surface");
+   } else if (surf->Type == EGL_PBUFFER_BIT) {
+  dri2_surf->dri_image_front =
+ dri2_dpy->image->createImage(dri2_dpy->dri_screen,
+  surf->Width,
+  surf->Height,
+  format,
+  0,
+  dri2_surf);
+  if (!dri2_surf->dri_image_front) {
+ _eglLog(_EGL_WARNING, "dri2_image_front allocation failed");
+ return -1;
+  }
+   }
+
+   return 0;
+}
+
 /**
  * Called via eglTerminate(), drv->API.Terminate().
  *
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 9cc04930c8..96c4a213df 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -303,11 +303,12 @@ struct dri2_egl_surface
   int age;
} color_buffers[COLOR_BUFFERS_SIZE], *back, *current;
 
+   __DRIimage *dri_image_front;
+
 #ifdef HAVE_ANDROID_PLATFORM
struct ANativeWindow *window;
struct ANativeWindowBuffer *buffer;
__DRIimage *dri_image_back;
-   __DRIimage *dri_image_front;
 #endif
 
 #if defined(HAVE_SURFACELESS_PLATFORM)
@@ -463,6 +464,9 @@ dri2_surface_update_age(_EGLSurface *surf);
 void
 dri2_surface_free_image(_EGLSurface *surf, __DRIimage **img);
 
+int
+dri2_surface_get_front_image(_EGLSurface *surf, unsigned int format);
+
 EGLBoolean
 dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
 _EGLConfig *conf, const EGLint *attrib_list, EGLBoolean 
enable_out_fence);
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 74b034b18f..707195f03d 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -386,39 +386,6 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
return 0;
 }
 
-static int
-get_front_bo(struct dri2_egl_surface *dri2_surf, unsigned int format)
-{
-   struct dri2_egl_display *dri2_dpy =
-  dri2_egl_display(dri2_surf->base.Resource.Display);
-
-   if (dri2_surf->dri_image_front)
-  return 0;
-
-   if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
-  /* According current EGL spec, front buffer rendering
-   * for window surface is not supported now.
-   * and mesa doesn't have the implementation of this case.
-   * Add warning message, but not treat it as error.
-   */
-  _eglLog(_EGL_DEBUG, "DRI driver requested unsupported front buffer for 
window surface");
-   } else if (dri2_surf->base.Type == EGL_PBUFFER_BIT) {
-  dri2_surf->dri_image_front =
-  dri2_dpy->image->createImage(dri2_dpy->dri_screen,
-  dri2_surf->base.Width,
-  dri2_surf->base.Height,
-  format,
-  0,
-

[Mesa-dev] [PATCH v4 7/9] egl: add dri2_surface_free_image() helper (v4)

2017-11-02 Thread Gwan-gyeong Mun
To share common free DRIimage code.

In preparation to adding of new platform which uses this helper.

v2:
 - Fixes from Eric's review:
   a) Split out series of refactor for helpers to a separate series.
   b) Add the new helper function and use them to replace the old code in the
  same patch.

v3: Fixes from Emil and Gurchetan's review
  - Follow the naming convention which prevents too verbose name of functions.
a) use a dri2_surface_$action_$object naming convention
b) change a first argument type "struct dri2_egl_surface" to "_EGLSurface".

v4: Fixes from Gurchetan's review
  - add dri2_surface_free_image() helper for refactoring of almost identical
functions. [1]

[1] https://lists.freedesktop.org/archives/mesa-dev/2017-October/173219.html

Signed-off-by: Mun Gwan-gyeong 
---
 src/egl/drivers/dri2/egl_dri2.c | 11 +++
 src/egl/drivers/dri2/egl_dri2.h |  3 +++
 src/egl/drivers/dri2/platform_android.c | 18 +++---
 src/egl/drivers/dri2/platform_surfaceless.c | 14 +-
 src/egl/drivers/dri2/platform_wayland.c | 26 --
 5 files changed, 30 insertions(+), 42 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index d381e52e86..13c86f87c2 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1142,6 +1142,17 @@ dri2_surface_update_age(_EGLSurface *surf)
   dri2_surf->back->age = 1;
 }
 
+void
+dri2_surface_free_image(_EGLSurface *surf, __DRIimage **img)
+{
+   struct dri2_egl_display *dri2_dpy = 
dri2_egl_display(surf->Resource.Display);
+
+   if (*img) {
+  dri2_dpy->image->destroyImage(*img);
+  *img = NULL;
+   }
+}
+
 /**
  * Called via eglTerminate(), drv->API.Terminate().
  *
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 58f8082509..9cc04930c8 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -460,6 +460,9 @@ dri2_surface_set_back_buffer(_EGLSurface *surf, void 
*buffer);
 void
 dri2_surface_update_age(_EGLSurface *surf);
 
+void
+dri2_surface_free_image(_EGLSurface *surf, __DRIimage **img);
+
 EGLBoolean
 dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
 _EGLConfig *conf, const EGLint *attrib_list, EGLBoolean 
enable_out_fence);
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 45af871555..74b034b18f 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -228,10 +228,7 @@ droid_window_enqueue_buffer(_EGLDisplay *disp, struct 
dri2_egl_surface *dri2_sur
 
mtx_lock(&disp->Mutex);
 
-   if (dri2_surf->dri_image_back) {
-  dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);
-  dri2_surf->dri_image_back = NULL;
-   }
+   dri2_surface_free_image(&dri2_surf->base, &dri2_surf->dri_image_back);
 
return EGL_TRUE;
 }
@@ -355,17 +352,8 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *surf)
   dri2_surf->window->common.decRef(&dri2_surf->window->common);
}
 
-   if (dri2_surf->dri_image_back) {
-  _eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_back", __func__, 
__LINE__);
-  dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);
-  dri2_surf->dri_image_back = NULL;
-   }
-
-   if (dri2_surf->dri_image_front) {
-  _eglLog(_EGL_DEBUG, "%s : %d : destroy dri_image_front", __func__, 
__LINE__);
-  dri2_dpy->image->destroyImage(dri2_surf->dri_image_front);
-  dri2_surf->dri_image_front = NULL;
-   }
+   dri2_surface_free_image(&dri2_surf->base, &dri2_surf->dri_image_back);
+   dri2_surface_free_image(&dri2_surf->base, &dri2_surf->dri_image_front);
 
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
 
diff --git a/src/egl/drivers/dri2/platform_surfaceless.c 
b/src/egl/drivers/dri2/platform_surfaceless.c
index 977b046016..959d587c88 100644
--- a/src/egl/drivers/dri2/platform_surfaceless.c
+++ b/src/egl/drivers/dri2/platform_surfaceless.c
@@ -50,18 +50,6 @@ surfaceless_alloc_image(struct dri2_egl_display *dri2_dpy,
 NULL);
 }
 
-static void
-surfaceless_free_images(struct dri2_egl_surface *dri2_surf)
-{
-   struct dri2_egl_display *dri2_dpy =
-  dri2_egl_display(dri2_surf->base.Resource.Display);
-
-   if (dri2_surf->front) {
-  dri2_dpy->image->destroyImage(dri2_surf->front);
-  dri2_surf->front = NULL;
-   }
-}
-
 static int
 surfaceless_image_get_buffers(__DRIdrawable *driDrawable,
 unsigned int format,
@@ -161,7 +149,7 @@ surfaceless_destroy_surface(_EGLDriver *drv, _EGLDisplay 
*disp, _EGLSurface *sur
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
 
-   surfaceless_free_images(dri2_surf);
+   dri2_surface_free_image(&dri2_surf->base, &dri2_surf->front);
 
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawabl

[Mesa-dev] [PATCH v4 4/9] egl: add a missed initialization of buffer age.

2017-11-02 Thread Gwan-gyeong Mun
It add an initialization of buffer age on dri2_surface_set_back_buffer().

Fixes from Emil's review
 - Split out separated patch for adding of missed initialization of buffer
   age. [1]

[1] https://lists.freedesktop.org/archives/mesa-dev/2017-October/173129.html

Signed-off-by: Mun Gwan-gyeong 
---
 src/egl/drivers/dri2/egl_dri2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 2063d1ca56..edb692c7e5 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1104,6 +1104,7 @@ dri2_surface_set_back_buffer(_EGLSurface *surf, void 
*buffer)
for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
   if (!dri2_surf->color_buffers[i].native_buffer) {
  dri2_surf->color_buffers[i].native_buffer = buffer;
+ dri2_surf->color_buffers[i].age = 0;
   }
   if (dri2_surf->color_buffers[i].native_buffer == buffer) {
  dri2_surf->back = &dri2_surf->color_buffers[i];
-- 
2.15.0

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


[Mesa-dev] [PATCH v4 5/9] egl: add going out of the loop when color_buffer is set.

2017-11-02 Thread Gwan-gyeong Mun
If color_buffer is set once, we don't need to set a same native buffer to
remained free slot of color_buffers. So we can go out of the loop when
color_buffer is set first.

Fixes from Emil's review
 - Add setting "updated" and bailing out when the color_buffer is set.[1]

[1] https://lists.freedesktop.org/archives/mesa-dev/2017-October/173129.html

Signed-off-by: Mun Gwan-gyeong 
---
 src/egl/drivers/dri2/egl_dri2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index edb692c7e5..a504978fda 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1105,6 +1105,8 @@ dri2_surface_set_back_buffer(_EGLSurface *surf, void 
*buffer)
   if (!dri2_surf->color_buffers[i].native_buffer) {
  dri2_surf->color_buffers[i].native_buffer = buffer;
  dri2_surf->color_buffers[i].age = 0;
+ updated = EGL_TRUE;
+ break;
   }
   if (dri2_surf->color_buffers[i].native_buffer == buffer) {
  dri2_surf->back = &dri2_surf->color_buffers[i];
-- 
2.15.0

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


[Mesa-dev] [PATCH v4 6/9] egl: add dri2_surface_update_age() helper (v3)

2017-11-02 Thread Gwan-gyeong Mun
To share common update buffer age code.
This updates old buffer's age and sets current back buffer's age to 1.

In preparation to adding of new platform which uses this helper.

v2:
 - Fixes from Eric's review:
   a) Split out series of refactor for helpers to a separate series.
   b) Add the new helper function and use them to replace the old code in the
  same patch.
 - Fixes from Rob's review:
   Remove unneeded ifdef block

v3: Fixes from Emil and Gurchetan's review
  - Follow the naming convention which prevents too verbose name of functions.
a) use a dri2_surface_$action_$object naming convention
b) change a first argument type "struct dri2_egl_surface" to "_EGLSurface".

Signed-off-by: Mun Gwan-gyeong 
Reviewed-by: Emil Velikov 
---
 src/egl/drivers/dri2/egl_dri2.c | 16 
 src/egl/drivers/dri2/egl_dri2.h |  3 +++
 src/egl/drivers/dri2/platform_android.c | 11 +--
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a504978fda..d381e52e86 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1126,6 +1126,22 @@ dri2_surface_set_back_buffer(_EGLSurface *surf, void 
*buffer)
}
 }
 
+void
+dri2_surface_update_age(_EGLSurface *surf)
+{
+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
+   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
+  if (dri2_surf->color_buffers[i].age > 0)
+ dri2_surf->color_buffers[i].age++;
+   }
+
+   /* "XXX: we don't use get_back_bo() since it causes regressions in
+* several dEQP tests.
+*/
+   if (dri2_surf->back)
+  dri2_surf->back->age = 1;
+}
+
 /**
  * Called via eglTerminate(), drv->API.Terminate().
  *
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 4c01959324..58f8082509 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -457,6 +457,9 @@ dri2_surface_fixup(_EGLSurface *surf, int width, int 
height);
 void
 dri2_surface_set_back_buffer(_EGLSurface *surf, void *buffer);
 
+void
+dri2_surface_update_age(_EGLSurface *surf);
+
 EGLBoolean
 dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
 _EGLConfig *conf, const EGLint *attrib_list, EGLBoolean 
enable_out_fence);
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 559672ff21..45af871555 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -567,16 +567,7 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *draw)
if (dri2_surf->base.Type != EGL_WINDOW_BIT)
   return EGL_TRUE;
 
-   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
-  if (dri2_surf->color_buffers[i].age > 0)
- dri2_surf->color_buffers[i].age++;
-   }
-
-   /* "XXX: we don't use get_back_bo() since it causes regressions in
-* several dEQP tests.
-*/
-   if (dri2_surf->back)
-  dri2_surf->back->age = 1;
+   dri2_surface_update_age(draw);
 
dri2_flush_drawable_for_swapbuffers(disp, draw);
 
-- 
2.15.0

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


[Mesa-dev] [PATCH v4 2/9] egl: refactor color_buffers structure for deduplicating (v2)

2017-11-02 Thread Gwan-gyeong Mun
From: "Mun, Gwan-gyeong" 

This is added for preventing adding of new color buffers structure and back*
when new platform backend is added.
This refactoring separates out the common and platform specific bits.
This makes odd casting in the platform_foo.c but it prevents adding of new
ifdef magic.
Because of color_buffers array size is different on android and wayland /drm,
it adds COLOR_BUFFERS_SIZE macro.
 - android's color buffers array size is 3.
   drm & wayland's color buffers array size is 4.

Fixes from Rob's review:
 - refactor to separate out the common and platform specific bits.

Fixes from Emil's review:
 - use suggested color buffers structure shape.
   it makes a buffer pointer of each platform to void pointer type.

v2: Fixes from Emil's review
  a) change ifdef macro of "HAVE_WAYLAND_PLATFORM or HAVE_DRM_PLATFORM" to
 "HAVE_ANDROID_PLATFORM" for COLOR_BUFFERS_SIZE.
  b) drop the unneeded indentation of comment.
  c) drop ifdef macro of HAVE_WAYLAND_PLATFORM from color_buffers structure
 for more generic and widespread helpers.
  d) drop unneeded $native_type -> void * cast and viceversa.
  e) create the local native_buffer of $native_type and cast on assignment.

Signed-off-by: Mun Gwan-gyeong 
---
 src/egl/drivers/dri2/egl_dri2.h | 32 --
 src/egl/drivers/dri2/platform_android.c | 10 +++---
 src/egl/drivers/dri2/platform_drm.c | 60 ++---
 src/egl/drivers/dri2/platform_wayland.c | 41 +++---
 4 files changed, 73 insertions(+), 70 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 208a03d73a..6a218b49aa 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -65,6 +65,15 @@ struct zwp_linux_dmabuf_v1;
 
 #endif /* HAVE_ANDROID_PLATFORM */
 
+#ifdef HAVE_ANDROID_PLATFORM
+/* Usually Android uses at most triple buffers in ANativeWindow so hardcode
+ * the number of color_buffers to 3.
+ */
+#define COLOR_BUFFERS_SIZE 3
+#else
+#define COLOR_BUFFERS_SIZE 4
+#endif
+
 #include "eglconfig.h"
 #include "eglcontext.h"
 #include "egldisplay.h"
@@ -279,39 +288,26 @@ struct dri2_egl_surface
/* EGL-owned buffers */
__DRIbuffer   *local_buffers[__DRI_BUFFER_COUNT];
 
-#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM)
+   /* Used to record all the buffers created by each platform's native window
+* and their ages.
+*/
struct {
-#ifdef HAVE_WAYLAND_PLATFORM
-  struct wl_buffer   *wl_buffer;
+  void *native_buffer; // aka wl_buffer/gbm_bo/ANativeWindowBuffer
   __DRIimage *dri_image;
   /* for is_different_gpu case. NULL else */
   __DRIimage *linear_copy;
   /* for swrast */
   void *data;
   int data_size;
-#endif
-#ifdef HAVE_DRM_PLATFORM
-  struct gbm_bo   *bo;
-#endif
   boollocked;
   int age;
-   } color_buffers[4], *back, *current;
-#endif
+   } color_buffers[COLOR_BUFFERS_SIZE], *back, *current;
 
 #ifdef HAVE_ANDROID_PLATFORM
struct ANativeWindow *window;
struct ANativeWindowBuffer *buffer;
__DRIimage *dri_image_back;
__DRIimage *dri_image_front;
-
-   /* Used to record all the buffers created by ANativeWindow and their ages.
-* Usually Android uses at most triple buffers in ANativeWindow
-* so hardcode the number of color_buffers to 3.
-*/
-   struct {
-  struct ANativeWindowBuffer *buffer;
-  int age;
-   } color_buffers[3], *back;
 #endif
 
 #if defined(HAVE_SURFACELESS_PLATFORM)
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index d00aa2..c254173690 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -193,10 +193,10 @@ droid_window_dequeue_buffer(struct dri2_egl_surface 
*dri2_surf)
 */
EGLBoolean updated = EGL_FALSE;
for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
-  if (!dri2_surf->color_buffers[i].buffer) {
- dri2_surf->color_buffers[i].buffer = dri2_surf->buffer;
+  if (!dri2_surf->color_buffers[i].native_buffer) {
+ dri2_surf->color_buffers[i].native_buffer = dri2_surf->buffer;
   }
-  if (dri2_surf->color_buffers[i].buffer == dri2_surf->buffer) {
+  if (dri2_surf->color_buffers[i].native_buffer == dri2_surf->buffer) {
  dri2_surf->back = &dri2_surf->color_buffers[i];
  updated = EGL_TRUE;
  break;
@@ -208,10 +208,10 @@ droid_window_dequeue_buffer(struct dri2_egl_surface 
*dri2_surf)
* the color_buffers
*/
   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
- dri2_surf->color_buffers[i].buffer = NULL;
+ dri2_surf->color_buffers[i].native_buffer = NULL;
  dri2_surf->color_buffers[i].age = 0;
   }
-  dri2_surf->color_buffers[0].buffer = dri2_surf->buffer;
+  dri2_surf->color_buffers[0].native_buffer = dri2

[Mesa-dev] [PATCH v4 3/9] egl: add dri2_surface_set_back_buffer() helper (v3)

2017-11-02 Thread Gwan-gyeong Mun
To share common record buffers and update back buffer code.
This records all the buffers created by each platform's native window and
update back buffer for updating buffer's age in swap_buffers.

In preparation to adding of new platform which uses this helper.

v2:
 - Remove unneeded ifdef magic
 - Fixes from Eric's review:
   a) Split out series of refactor for helpers to a separate series.
   b) Add the new helper function and use them to replace the old code in the
  same patch.

v3:
  - Fixes from Emil and Gurchetan's review:
Follow the naming convention which prevents too verbose name of functions.
a) use a dri2_surface_$action_$object naming convention
b) change a first argument type "struct dri2_egl_surface" to "_EGLSurface".
  - Fixes from Emil's review:
a) fix typo
b) drop the addition of initialization of buffer age.

Signed-off-by: Mun Gwan-gyeong 
Reviewed-by: Emil Velikov 
---
 src/egl/drivers/dri2/egl_dri2.c | 31 +++
 src/egl/drivers/dri2/egl_dri2.h |  3 +++
 src/egl/drivers/dri2/platform_android.c | 24 +---
 3 files changed, 35 insertions(+), 23 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 238e299aed..2063d1ca56 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1092,6 +1092,37 @@ dri2_surface_fixup(_EGLSurface *surf, int width, int 
height)
}
 }
 
+void
+dri2_surface_set_back_buffer(_EGLSurface *surf, void *buffer)
+{
+   /* Record all the buffers created by each platform's native window and
+* update back buffer for updating buffer's age in swap_buffers.
+*/
+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
+   EGLBoolean updated = EGL_FALSE;
+
+   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
+  if (!dri2_surf->color_buffers[i].native_buffer) {
+ dri2_surf->color_buffers[i].native_buffer = buffer;
+  }
+  if (dri2_surf->color_buffers[i].native_buffer == buffer) {
+ dri2_surf->back = &dri2_surf->color_buffers[i];
+ updated = EGL_TRUE;
+ break;
+  }
+   }
+
+   if (!updated) {
+  /* In case of all the buffers were recreated, reset the color_buffers */
+  for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
+ dri2_surf->color_buffers[i].native_buffer = NULL;
+ dri2_surf->color_buffers[i].age = 0;
+  }
+  dri2_surf->color_buffers[0].native_buffer = buffer;
+  dri2_surf->back = &dri2_surf->color_buffers[0];
+   }
+}
+
 /**
  * Called via eglTerminate(), drv->API.Terminate().
  *
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 6a218b49aa..4c01959324 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -454,6 +454,9 @@ dri2_egl_surface_free_local_buffers(struct dri2_egl_surface 
*dri2_surf);
 void
 dri2_surface_fixup(_EGLSurface *surf, int width, int height);
 
+void
+dri2_surface_set_back_buffer(_EGLSurface *surf, void *buffer);
+
 EGLBoolean
 dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
 _EGLConfig *conf, const EGLint *attrib_list, EGLBoolean 
enable_out_fence);
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index c254173690..559672ff21 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -191,29 +191,7 @@ droid_window_dequeue_buffer(struct dri2_egl_surface 
*dri2_surf)
/* Record all the buffers created by ANativeWindow and update back buffer
 * for updating buffer's age in swap_buffers.
 */
-   EGLBoolean updated = EGL_FALSE;
-   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
-  if (!dri2_surf->color_buffers[i].native_buffer) {
- dri2_surf->color_buffers[i].native_buffer = dri2_surf->buffer;
-  }
-  if (dri2_surf->color_buffers[i].native_buffer == dri2_surf->buffer) {
- dri2_surf->back = &dri2_surf->color_buffers[i];
- updated = EGL_TRUE;
- break;
-  }
-   }
-
-   if (!updated) {
-  /* In case of all the buffers were recreated by ANativeWindow, reset
-   * the color_buffers
-   */
-  for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
- dri2_surf->color_buffers[i].native_buffer = NULL;
- dri2_surf->color_buffers[i].age = 0;
-  }
-  dri2_surf->color_buffers[0].native_buffer = dri2_surf->buffer;
-  dri2_surf->back = &dri2_surf->color_buffers[0];
-   }
+   dri2_surface_set_back_buffer(&dri2_surf->base, dri2_surf->buffer);
 
return EGL_TRUE;
 }
-- 
2.15.0

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


[Mesa-dev] [PATCH v4 1/9] egl: add dri2_surface_fixup() helper (v3)

2017-11-02 Thread Gwan-gyeong Mun
From: "Mun, Gwan-gyeong" 

To share common free outdated buffers and update size code.
This compares width and height arguments with current egl surface dimension,
if the compared surface dimension is differ, then it free local buffers and
updates dimension.

In preparation to adding of new platform which uses this helper.

v2: Fixes from Eric's review:
   a) Split out series of refactor for helpers to a separate series.
   b) Add the new helper function and use them to replace the old code in the
  same patch.

v3: Fixes from Emil and Gurchetan's review
  - Follow the naming convention which prevents too verbose name of functions.
a) use a dri2_surface_$action_$object naming convention
b) change a first argument type "struct dri2_egl_surface" to "_EGLSurface".

Signed-off-by: Mun Gwan-gyeong 
Reviewed-by: Emil Velikov 
---
 src/egl/drivers/dri2/egl_dri2.c | 13 +
 src/egl/drivers/dri2/egl_dri2.h |  3 +++
 src/egl/drivers/dri2/platform_android.c |  8 ++--
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 503450542e..238e299aed 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1079,6 +1079,19 @@ dri2_egl_surface_free_local_buffers(struct 
dri2_egl_surface *dri2_surf)
}
 }
 
+void
+dri2_surface_fixup(_EGLSurface *surf, int width, int height)
+{
+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
+
+   /* free outdated buffers and update the surface size */
+   if (surf->Width != width || surf->Height != height) {
+  dri2_egl_surface_free_local_buffers(dri2_surf);
+  surf->Width = width;
+  surf->Height = height;
+   }
+}
+
 /**
  * Called via eglTerminate(), drv->API.Terminate().
  *
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index cd2487ab22..208a03d73a 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -455,6 +455,9 @@ dri2_egl_surface_alloc_local_buffer(struct dri2_egl_surface 
*dri2_surf,
 void
 dri2_egl_surface_free_local_buffers(struct dri2_egl_surface *dri2_surf);
 
+void
+dri2_surface_fixup(_EGLSurface *surf, int width, int height);
+
 EGLBoolean
 dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
 _EGLConfig *conf, const EGLint *attrib_list, EGLBoolean 
enable_out_fence);
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index e390365b8b..d00aa2 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -414,12 +414,8 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
}
 
/* free outdated buffers and update the surface size */
-   if (dri2_surf->base.Width != dri2_surf->buffer->width ||
-   dri2_surf->base.Height != dri2_surf->buffer->height) {
-  dri2_egl_surface_free_local_buffers(dri2_surf);
-  dri2_surf->base.Width = dri2_surf->buffer->width;
-  dri2_surf->base.Height = dri2_surf->buffer->height;
-   }
+   dri2_surface_fixup(&dri2_surf->base, dri2_surf->buffer->width,
+  dri2_surf->buffer->height);
 
return 0;
 }
-- 
2.15.0

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


Re: [Mesa-dev] [PATCH] mesa/shaderapi: Do a dry run of linking an in-use program

2017-11-02 Thread Timothy Arceri
I think I'd rather see this handled by releasing the uniforms only after 
the second link is successful and using a temp/fallback pointer to hold 
it until then. We need to do a similar type of thing with shader source 
and the shader cache e.g [1].


[1] 
https://cgit.freedesktop.org/mesa/mesa/commit/?id=e5bb4a0b0f4743fa0a0567991dca751ef49a7200 



On 03/11/17 05:35, Neil Roberts wrote:

If an in-use program is unsuccessfully linked, the GL spec requires
that the executable and the uniform state of the program should remain
until a new program is bound. Previously this sort of worked in Mesa
except that it would free the uniform state before attempting to link.
At least on i965 this would usually continue to work because it
accesses the uniform values via a dangling pointer. However it was
causing sporadic failures in one of the CTS tests.

To fix it, when an in-use program is about to be linked, it will now
make a copy of the program and first try to link that instead. If it
works it will let the link continue, otherwise it will copy the status
to the new program and abandon the link. That way the link status and
info log is preserved without freeing the uniform state.

This isn’t very efficient but it would probably quite a big overhaul
to fix it properly and it doesn’t seem worth it because I can’t
imagine that any performance-sensitive application would be hitting
this very strange corner case of the API.

Fixes: KHR-GL46.sepshaderobjs.StateInteraction

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102177
---
  src/mesa/main/shaderapi.c | 58 ++-
  1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 7282435..3f7fe02 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1134,6 +1134,58 @@ _mesa_compile_shader(struct gl_context *ctx, struct 
gl_shader *sh)
 }
  }
  
+static bool

+try_link_in_use_program(struct gl_context *ctx,
+struct gl_shader_program *shProg)
+{
+   struct gl_shader_program *shProgCopy = _mesa_new_shader_program(0);
+   bool ret;
+   int i;
+
+   /* If the program is in use then try linking a copy of the program first.
+* If it won’t work then we’ll copy the link status to the old program and
+* abandon the linking. Otherwise we let it relink as normal. This is done
+* because relinking destroys the uniform state of the program but the GL
+* spec actually requires that the state be preserved when the program is
+* in use and the link fails. This isn’t terribly efficent but in practice
+* it is probably not worth optimising because it’s a rather strange corner
+* case of the spec.
+*
+* GLSL 4.6 spec section 7.3:
+*
+* “If a program object that is active for any shader stage is re-linked
+*  unsuccessfully, the link status will be set to FALSE, but any existing
+*  executables and associated state will remain part of the current
+*  rendering state until a subsequent call to UseProgram,
+*  UseProgramStages, or BindProgramPipeline removes them from use.”
+*/
+
+   for (i = 0; i < shProg->NumShaders; i++)
+  attach_shader(ctx, shProgCopy, shProg->Shaders[i]);
+
+   shProgCopy->BinaryRetreivableHint = shProg->BinaryRetreivableHint;
+   shProgCopy->SeparateShader = shProg->SeparateShader;
+
+   _mesa_glsl_link_shader(ctx, shProgCopy);
+
+   if (shProgCopy->data->LinkStatus) {
+  ret = true;
+   } else {
+  shProg->data->LinkStatus = shProgCopy->data->LinkStatus;
+  shProg->data->Validated = shProgCopy->data->Validated;
+  shProg->data->Version = shProgCopy->data->Version;
+  shProg->IsES = shProgCopy->IsES;
+  ralloc_free(shProg->data->InfoLog);
+  shProg->data->InfoLog =
+ ralloc_strdup(shProg->data, shProgCopy->data->InfoLog);
+
+  ret = false;
+   }
+
+   _mesa_reference_shader_program(ctx, &shProgCopy, NULL);
+
+   return ret;
+}
  
  /**

   * Link a program's shaders.
@@ -1159,12 +1211,16 @@ link_program(struct gl_context *ctx, struct 
gl_shader_program *shProg,
 }
  
 unsigned programs_in_use = 0;

-   if (ctx->_Shader)
+   if (ctx->_Shader) {
for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
   if (ctx->_Shader->CurrentProgram[stage] &&
   ctx->_Shader->CurrentProgram[stage]->Id == shProg->Name) {
  programs_in_use |= 1 << stage;
   }
+  }
+
+  if (programs_in_use && !try_link_in_use_program(ctx, shProg))
+ return;
 }
  
 FLUSH_VERTICES(ctx, 0);



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


[Mesa-dev] [PATCH 10/12] glsl: Minor cleanups after previous commit

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

I think it's more clear to only call emit_access once.  The only
difference between the two calls is the value of size_mul used for the
offset parameter... but you really have to look at it to be sure.

The s/is_64bit/is_double/ change is because there are no int64_t or
uint64_t matrix types.

Signed-off-by: Ian Romanick 
---
 src/compiler/glsl/lower_buffer_access.cpp | 29 +++--
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/src/compiler/glsl/lower_buffer_access.cpp 
b/src/compiler/glsl/lower_buffer_access.cpp
index 056fd26..fa6e5f5 100644
--- a/src/compiler/glsl/lower_buffer_access.cpp
+++ b/src/compiler/glsl/lower_buffer_access.cpp
@@ -111,24 +111,17 @@ lower_buffer_access::emit_access(void *mem_ctx,
  ir_dereference *col_deref =
 new(mem_ctx) ir_dereference_array(deref->clone(mem_ctx, NULL), 
col);
 
- if (row_major) {
-/* For a row-major matrix, the next column starts at the next
- * element.
- */
-int size_mul = deref->type->is_64bit() ? 8 : 4;
-emit_access(mem_ctx, is_write, col_deref, base_offset,
-deref_offset + i * size_mul,
-row_major, deref->type, packing,
-writemask_for_size(col_deref->type->vector_elements));
- } else {
-const int size_mul =
-   link_calculate_matrix_stride(deref->type, row_major, packing);
-
-emit_access(mem_ctx, is_write, col_deref, base_offset,
-deref_offset + i * size_mul,
-row_major, deref->type, packing,
-writemask_for_size(col_deref->type->vector_elements));
- }
+ /* For a row-major matrix, the next column starts at the next
+  * element.  Otherwise it is offset by the matrix stride.
+  */
+ const unsigned size_mul = row_major
+? (deref->type->is_double() ? 8 : 4)
+: link_calculate_matrix_stride(deref->type, row_major, packing);
+
+ emit_access(mem_ctx, is_write, col_deref, base_offset,
+ deref_offset + i * size_mul,
+ row_major, deref->type, packing,
+ writemask_for_size(col_deref->type->vector_elements));
   }
   return;
}
-- 
2.9.5

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


[Mesa-dev] [PATCH 04/12] glsl: Make the swizzle-swizzle optimization greedy

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

If there is a long sequence of swizzled swizzles, compact all of them
down to a single swizzle.

Signed-off-by: Ian Romanick 
---
 src/compiler/glsl/opt_swizzle_swizzle.cpp | 59 +++
 1 file changed, 29 insertions(+), 30 deletions(-)

diff --git a/src/compiler/glsl/opt_swizzle_swizzle.cpp 
b/src/compiler/glsl/opt_swizzle_swizzle.cpp
index 7285474..40ce268 100644
--- a/src/compiler/glsl/opt_swizzle_swizzle.cpp
+++ b/src/compiler/glsl/opt_swizzle_swizzle.cpp
@@ -23,8 +23,7 @@
 
 /**
  * \file opt_swizzle_swizzle.cpp
- *
- * Eliminates the second swizzle in a swizzle chain.
+ * Compact a sequence of swizzled swizzles into a single swizzle.
  */
 
 #include "ir.h"
@@ -51,34 +50,34 @@ public:
 ir_visitor_status
 ir_swizzle_swizzle_visitor::visit_enter(ir_swizzle *ir)
 {
-   int mask2[4];
-
-   ir_swizzle *swiz2 = ir->val->as_swizzle();
-   if (!swiz2)
-  return visit_continue;
-
-   memset(&mask2, 0, sizeof(mask2));
-   if (swiz2->mask.num_components >= 1)
-  mask2[0] = swiz2->mask.x;
-   if (swiz2->mask.num_components >= 2)
-  mask2[1] = swiz2->mask.y;
-   if (swiz2->mask.num_components >= 3)
-  mask2[2] = swiz2->mask.z;
-   if (swiz2->mask.num_components >= 4)
-  mask2[3] = swiz2->mask.w;
-
-   if (ir->mask.num_components >= 1)
-  ir->mask.x = mask2[ir->mask.x];
-   if (ir->mask.num_components >= 2)
-  ir->mask.y = mask2[ir->mask.y];
-   if (ir->mask.num_components >= 3)
-  ir->mask.z = mask2[ir->mask.z];
-   if (ir->mask.num_components >= 4)
-  ir->mask.w = mask2[ir->mask.w];
-
-   ir->val = swiz2->val;
-
-   this->progress = true;
+   ir_swizzle *swiz2;
+
+   while ((swiz2 = ir->val->as_swizzle()) != NULL) {
+  int mask2[4];
+
+  memset(&mask2, 0, sizeof(mask2));
+  if (swiz2->mask.num_components >= 1)
+ mask2[0] = swiz2->mask.x;
+  if (swiz2->mask.num_components >= 2)
+ mask2[1] = swiz2->mask.y;
+  if (swiz2->mask.num_components >= 3)
+ mask2[2] = swiz2->mask.z;
+  if (swiz2->mask.num_components >= 4)
+ mask2[3] = swiz2->mask.w;
+
+  if (ir->mask.num_components >= 1)
+ ir->mask.x = mask2[ir->mask.x];
+  if (ir->mask.num_components >= 2)
+ ir->mask.y = mask2[ir->mask.y];
+  if (ir->mask.num_components >= 3)
+ ir->mask.z = mask2[ir->mask.z];
+  if (ir->mask.num_components >= 4)
+ ir->mask.w = mask2[ir->mask.w];
+
+  ir->val = swiz2->val;
+
+  this->progress = true;
+   }
 
return visit_continue;
 }
-- 
2.9.5

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


[Mesa-dev] [PATCH 09/12] glsl: Use more link_calculate_matrix_stride in lower_buffer_access

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

I was going to squash this with the previous commit, but there's a lot
of churn in that commit.

Signed-off-by: Ian Romanick 
---
 src/compiler/glsl/lower_buffer_access.cpp | 22 ++
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/src/compiler/glsl/lower_buffer_access.cpp 
b/src/compiler/glsl/lower_buffer_access.cpp
index 219e03e..056fd26 100644
--- a/src/compiler/glsl/lower_buffer_access.cpp
+++ b/src/compiler/glsl/lower_buffer_access.cpp
@@ -121,26 +121,8 @@ lower_buffer_access::emit_access(void *mem_ctx,
 row_major, deref->type, packing,
 writemask_for_size(col_deref->type->vector_elements));
  } else {
-int size_mul;
-
-/* std430 doesn't round up vec2 size to a vec4 size */
-if (packing == GLSL_INTERFACE_PACKING_STD430 &&
-deref->type->vector_elements == 2 &&
-!deref->type->is_64bit()) {
-   size_mul = 8;
-} else {
-   /* std140 always rounds the stride of arrays (and matrices) to a
-* vec4, so matrices are always 16 between columns/rows. With
-* doubles, they will be 32 apart when there are more than 2 
rows.
-*
-* For both std140 and std430, if the member is a
-* three-'component vector with components consuming N basic
-* machine units, the base alignment is 4N. For vec4, base
-* alignment is 4N.
-*/
-   size_mul = (deref->type->is_64bit() &&
-   deref->type->vector_elements > 2) ? 32 : 16;
-}
+const int size_mul =
+   link_calculate_matrix_stride(deref->type, row_major, packing);
 
 emit_access(mem_ctx, is_write, col_deref, base_offset,
 deref_offset + i * size_mul,
-- 
2.9.5

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


[Mesa-dev] [PATCH 06/12] glsl/linker: Optimize swizzles again after linking

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

Without this, the SPIR-V generator has to deal with a bunch of junk
like:

(swiz z (swiz xxx (swiz x (var_ref packed:binormal.z,light_dir

It seems better to cull that stuff out than to add code to deal with
it.  The problem is the way swizzles to and from scalars have to be
handled in SPIR-V.

Signed-off-by: Ian Romanick 
---
 src/compiler/glsl/linker.cpp | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 0045291..ff5c4c2 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -5027,6 +5027,16 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
if(!link_varyings_and_uniforms(first, last, ctx, prog, mem_ctx))
   goto done;
 
+   /* Linking varyings can cause some extra, useless swizzles to be generated
+* due to packing and unpacking.
+*/
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+  if (prog->_LinkedShaders[i] == NULL)
+ continue;
+
+  optimize_swizzles(prog->_LinkedShaders[i]->ir);
+   }
+
/* OpenGL ES < 3.1 requires that a vertex shader and a fragment shader both
 * be present in a linked program. GL_ARB_ES2_compatibility doesn't say
 * anything about shader linking when one of the shaders (vertex or
-- 
2.9.5

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


[Mesa-dev] [PATCH 12/12] spirv: Import the latest 1.0.12 header and JSON from Khronos

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/compiler/spirv/spirv.core.grammar.json | 266 -
 src/compiler/spirv/spirv.h |  40 +
 2 files changed, 38 insertions(+), 268 deletions(-)

diff --git a/src/compiler/spirv/spirv.core.grammar.json 
b/src/compiler/spirv/spirv.core.grammar.json
index e2950dd..30456fb 100644
--- a/src/compiler/spirv/spirv.core.grammar.json
+++ b/src/compiler/spirv/spirv.core.grammar.json
@@ -26,8 +26,8 @@
   ],
   "magic_number" : "0x07230203",
   "major_version" : 1,
-  "minor_version" : 2,
-  "revision" : 1,
+  "minor_version" : 0,
+  "revision" : 12,
   "instructions" : [
 {
   "opname" : "OpNop",
@@ -2410,7 +2410,7 @@
 { "kind" : "IdResult" },
 { "kind" : "IdScope","name" : "'Execution'" },
 { "kind" : "GroupOperation", "name" : "'Operation'" },
-{ "kind" : "IdRef",  "name" : "X" }
+{ "kind" : "IdRef",  "name" : "'X'" }
   ],
   "capabilities" : [ "Groups" ]
 },
@@ -2434,7 +2434,7 @@
 { "kind" : "IdResult" },
 { "kind" : "IdScope","name" : "'Execution'" },
 { "kind" : "GroupOperation", "name" : "'Operation'" },
-{ "kind" : "IdRef",  "name" : "X" }
+{ "kind" : "IdRef",  "name" : "'X'" }
   ],
   "capabilities" : [ "Groups" ]
 },
@@ -2446,7 +2446,7 @@
 { "kind" : "IdResult" },
 { "kind" : "IdScope","name" : "'Execution'" },
 { "kind" : "GroupOperation", "name" : "'Operation'" },
-{ "kind" : "IdRef",  "name" : "X" }
+{ "kind" : "IdRef",  "name" : "'X'" }
   ],
   "capabilities" : [ "Groups" ]
 },
@@ -2458,7 +2458,7 @@
 { "kind" : "IdResult" },
 { "kind" : "IdScope","name" : "'Execution'" },
 { "kind" : "GroupOperation", "name" : "'Operation'" },
-{ "kind" : "IdRef",  "name" : "X" }
+{ "kind" : "IdRef",  "name" : "'X'" }
   ],
   "capabilities" : [ "Groups" ]
 },
@@ -2470,7 +2470,7 @@
 { "kind" : "IdResult" },
 { "kind" : "IdScope","name" : "'Execution'" },
 { "kind" : "GroupOperation", "name" : "'Operation'" },
-{ "kind" : "IdRef",  "name" : "X" }
+{ "kind" : "IdRef",  "name" : "'X'" }
   ],
   "capabilities" : [ "Groups" ]
 },
@@ -3013,124 +3013,6 @@
   "capabilities" : [ "SparseResidency" ]
 },
 {
-  "opname" : "OpSizeOf",
-  "opcode" : 321,
-  "operands" : [
-{ "kind" : "IdResultType" },
-{ "kind" : "IdResult" },
-{ "kind" : "IdRef","name" : "'Pointer'" }
-  ],
-  "capabilities" : [ "Addresses" ]
-},
-{
-  "opname" : "OpTypePipeStorage",
-  "opcode" : 322,
-  "operands" : [
-{ "kind" : "IdResult" }
-  ],
-  "capabilities" : [ "PipeStorage" ]
-},
-{
-  "opname" : "OpConstantPipeStorage",
-  "opcode" : 323,
-  "operands" : [
-{ "kind" : "IdResultType" },
-{ "kind" : "IdResult" },
-{ "kind" : "LiteralInteger", "name" : "'Packet Size'" },
-{ "kind" : "LiteralInteger", "name" : "'Packet Alignment'" },
-{ "kind" : "LiteralInteger", "name" : "'Capacity'" }
-  ],
-  "capabilities" : [ "PipeStorage" ]
-},
-{
-  "opname" : "OpCreatePipeFromPipeStorage",
-  "opcode" : 324,
-  "operands" : [
-{ "kind" : "IdResultType" },
-{ "kind" : "IdResult" },
-{ "kind" : "IdRef","name" : "'Pipe Storage'" }
-  ],
-  "capabilities" : [ "PipeStorage" ]
-},
-{
-  "opname" : "OpGetKernelLocalSizeForSubgroupCount",
-  "opcode" : 325,
-  "operands" : [
-{ "kind" : "IdResultType" },
-{ "kind" : "IdResult" },
-{ "kind" : "IdRef","name" : "'Subgroup Count'" },
-{ "kind" : "IdRef","name" : "'Invoke'" },
-{ "kind" : "IdRef","name" : "'Param'" },
-{ "kind" : "IdRef","name" : "'Param Size'" },
-{ "kind" : "IdRef","name" : "'Param Align'" }
-  ],
-  "capabilities" : [ "SubgroupDispatch" ]
-},
-{
-  "opname" : "OpGetKernelMaxNumSubgroups",
-  "opcode" : 326,
-  "operands" : [
-{ "kind" : "IdResultType" },
-{ "kind" : "IdResult" },
-{ "kind" : "IdRef","name" : "'Invoke'" },
-{ "kind" : "IdRef","name" : "'Param'" },
-{ "kind" : "IdRef","name" : "'Param Size'" },
-{ "kind" : "IdRef","name" : "'Param Align'" }
-  ],
-  "capabilities" : [ "SubgroupDispatch" ]
-},
-{
-  "opname" : "OpTypeNamedBarrier",
-  "opcode" : 327,
-  "operands" : [
-{ "kind" : "IdResult" }
-  ],
-  "capabilities" : [ "NamedBarrier" ]
-},
-{
-  "opname" : "OpNamedBarrierInitialize",
-  "opcode" : 328,
-  "op

[Mesa-dev] [PATCH 02/12] glsl: Silence unused parameter warning

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

glsl/lower_shared_reference.cpp: In member function ‘virtual void
{anonymous}::lower_shared_reference_visitor::insert_buffer_access(void*,
ir_dereference*, const glsl_type*, ir_rvalue*, unsigned int, int)’:

glsl/lower_shared_reference.cpp:244:58: warning: unused parameter
‘channel’ [-Wunused-parameter]
  int channel)
  ^~~

Signed-off-by: Ian Romanick 
---
 src/compiler/glsl/lower_shared_reference.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/lower_shared_reference.cpp 
b/src/compiler/glsl/lower_shared_reference.cpp
index a1b3f7d..86afc5d 100644
--- a/src/compiler/glsl/lower_shared_reference.cpp
+++ b/src/compiler/glsl/lower_shared_reference.cpp
@@ -241,7 +241,7 @@ lower_shared_reference_visitor::insert_buffer_access(void 
*mem_ctx,
  const glsl_type *type,
  ir_rvalue *offset,
  unsigned mask,
- int channel)
+ int /* channel */)
 {
if (buffer_access_type == shared_store_access) {
   ir_call *store = shared_store(mem_ctx, deref, offset, mask);
-- 
2.9.5

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


[Mesa-dev] [PATCH 07/12] glsl: Refactor matrix stride calculation into a utility function

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/compiler/glsl/link_uniforms.cpp | 57 ++---
 src/compiler/glsl/linker.h  |  4 +++
 2 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/src/compiler/glsl/link_uniforms.cpp 
b/src/compiler/glsl/link_uniforms.cpp
index be39c375..1955f62 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -398,6 +398,48 @@ private:
 
 } /* anonymous namespace */
 
+unsigned
+link_calculate_matrix_stride(const glsl_type *matrix, bool row_major,
+ enum glsl_interface_packing packing)
+{
+   const unsigned N = matrix->is_double() ? 8 : 4;
+   const unsigned items =
+  row_major ? matrix->matrix_columns : matrix->vector_elements;
+
+   assert(items <= 4);
+
+   /* Matrix stride for std430 mat2xY matrices are not rounded up to
+* vec4 size.
+*
+* Section 7.6.2.2 "Standard Uniform Block Layout" of the OpenGL 4.3 spec
+* says:
+*
+*2. If the member is a two- or four-component vector with components
+*   consuming N basic machine units, the base alignment is 2N or 4N,
+*   respectively.
+*...
+*4. If the member is an array of scalars or vectors, the base
+*   alignment and array stride are set to match the base alignment of
+*   a single array element, according to rules (1), (2), and (3), and
+*   rounded up to the base alignment of a vec4.
+*...
+*7. If the member is a row-major matrix with C columns and R rows, the
+*   matrix is stored identically to an array of R row vectors with C
+*   components each, according to rule (4).
+*...
+*
+*When using the std430 storage layout, shader storage blocks will be
+*laid out in buffer storage identically to uniform and shader storage
+*blocks using the std140 layout, except that the base alignment and
+*stride of arrays of scalars and vectors in rule 4 and of structures
+*in rule 9 are not rounded up a multiple of the base alignment of a
+*vec4.
+*/
+   return packing == GLSL_INTERFACE_PACKING_STD430
+  ? (items < 3 ? items * N : glsl_align(items * N, 16))
+  : glsl_align(items * N, 16);
+}
+
 /**
  * Class to help parcel out pieces of backing storage to uniforms
  *
@@ -856,17 +898,10 @@ private:
  }
 
  if (type->without_array()->is_matrix()) {
-const glsl_type *matrix = type->without_array();
-const unsigned N = matrix->is_double() ? 8 : 4;
-const unsigned items =
-   row_major ? matrix->matrix_columns : matrix->vector_elements;
-
-assert(items <= 4);
-if (packing == GLSL_INTERFACE_PACKING_STD430)
-   this->uniforms[id].matrix_stride = items < 3 ? items * N :
-glsl_align(items * N, 16);
-else
-   this->uniforms[id].matrix_stride = glsl_align(items * N, 16);
+this->uniforms[id].matrix_stride =
+   link_calculate_matrix_stride(type->without_array(),
+row_major,
+packing);
 this->uniforms[id].row_major = row_major;
  } else {
 this->uniforms[id].matrix_stride = 0;
diff --git a/src/compiler/glsl/linker.h b/src/compiler/glsl/linker.h
index 03ed9d5..12a48e0 100644
--- a/src/compiler/glsl/linker.h
+++ b/src/compiler/glsl/linker.h
@@ -92,6 +92,10 @@ link_intrastage_shaders(void *mem_ctx,
 unsigned num_shaders,
 bool allow_missing_main);
 
+extern unsigned
+link_calculate_matrix_stride(const glsl_type *matrix, bool row_major,
+ enum glsl_interface_packing packing);
+
 /**
  * Class for processing all of the leaf fields of a variable that corresponds
  * to a program resource.
-- 
2.9.5

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


[Mesa-dev] [PATCH 01/12] i965: Silence "enumeral and non-enumeral type in conditional expression" warnings

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

compiler/brw_inst.h: In function ‘brw_reg_type brw_inst_dst_type(const 
gen_device_info*, const brw_inst*)’:
compiler/brw_inst.h:801:55: warning: enumeral and non-enumeral type in 
conditional expression [-Wextra]
unsigned file = __builtin_strcmp("dst", #reg) == 0 ?   \
~~~^
BRW_GENERAL_REGISTER_FILE :\

brw_inst_##reg##_reg_file(devinfo, inst);  \

compiler/brw_inst.h:808:1: note: in expansion of macro ‘REG_TYPE’
 REG_TYPE(dst)
 ^~~~

Signed-off-by: Ian Romanick 
---
 src/intel/compiler/brw_inst.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_inst.h b/src/intel/compiler/brw_inst.h
index 99e637e..dcd955d 100644
--- a/src/intel/compiler/brw_inst.h
+++ b/src/intel/compiler/brw_inst.h
@@ -799,7 +799,7 @@ brw_inst_##reg##_type(const struct gen_device_info 
*devinfo,  \
   const brw_inst *inst)   \
 { \
unsigned file = __builtin_strcmp("dst", #reg) == 0 ?   \
-   BRW_GENERAL_REGISTER_FILE :\
+   (unsigned) BRW_GENERAL_REGISTER_FILE : \
brw_inst_##reg##_reg_file(devinfo, inst);  \
unsigned hw_type = brw_inst_##reg##_reg_hw_type(devinfo, inst);\
return brw_hw_type_to_reg_type(devinfo, (enum brw_reg_file)file, hw_type); \
-- 
2.9.5

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


[Mesa-dev] [PATCH 03/12] glsl: Remove program_resource_visitor::visit_field(const glsl_struct_field *)

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

I could not find any remaining users.

Signed-off-by: Ian Romanick 
---
 src/compiler/glsl/link_uniforms.cpp |  8 
 src/compiler/glsl/linker.h  | 10 --
 2 files changed, 18 deletions(-)

diff --git a/src/compiler/glsl/link_uniforms.cpp 
b/src/compiler/glsl/link_uniforms.cpp
index 7d14154..be39c375 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -132,9 +132,6 @@ program_resource_visitor::recursion(const glsl_type *t, 
char **name,
  const char *field = t->fields.structure[i].name;
  size_t new_length = name_length;
 
- if (t->fields.structure[i].type->is_record())
-this->visit_field(&t->fields.structure[i]);
-
  if (t->is_interface() && t->fields.structure[i].offset != -1)
 this->set_buffer_offset(t->fields.structure[i].offset);
 
@@ -216,11 +213,6 @@ program_resource_visitor::recursion(const glsl_type *t, 
char **name,
 }
 
 void
-program_resource_visitor::visit_field(const glsl_struct_field *)
-{
-}
-
-void
 program_resource_visitor::enter_record(const glsl_type *, const char *, bool,
const enum glsl_interface_packing)
 {
diff --git a/src/compiler/glsl/linker.h b/src/compiler/glsl/linker.h
index 5cec121..03ed9d5 100644
--- a/src/compiler/glsl/linker.h
+++ b/src/compiler/glsl/linker.h
@@ -159,16 +159,6 @@ protected:
 const enum glsl_interface_packing packing,
 bool last_field) = 0;
 
-   /**
-* Visit a record before visiting its fields
-*
-* For structures-of-structures or interfaces-of-structures, this visits
-* the inner structure before visiting its fields.
-*
-* The default implementation does nothing.
-*/
-   virtual void visit_field(const glsl_struct_field *field);
-
virtual void enter_record(const glsl_type *type, const char *name,
  bool row_major, const enum glsl_interface_packing 
packing);
 
-- 
2.9.5

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


[Mesa-dev] [PATCH 05/12] glsl: Combine nop-swizzle optimization with swizzle-swizzle optimization

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/compiler/Makefile.sources  |  3 +-
 src/compiler/glsl/glsl_parser_extras.cpp   |  3 +-
 src/compiler/glsl/ir_optimization.h|  3 +-
 src/compiler/glsl/meson.build  |  3 +-
 .../glsl/{opt_noop_swizzle.cpp => opt_swizzle.cpp} | 56 ++---
 src/compiler/glsl/opt_swizzle_swizzle.cpp  | 96 --
 src/compiler/glsl/test_optpass.cpp |  6 +-
 7 files changed, 52 insertions(+), 118 deletions(-)
 rename src/compiler/glsl/{opt_noop_swizzle.cpp => opt_swizzle.cpp} (56%)
 delete mode 100644 src/compiler/glsl/opt_swizzle_swizzle.cpp

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index b80468c..60814e2 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -130,11 +130,10 @@ LIBGLSL_FILES = \
glsl/opt_function_inlining.cpp \
glsl/opt_if_simplification.cpp \
glsl/opt_minmax.cpp \
-   glsl/opt_noop_swizzle.cpp \
glsl/opt_rebalance_tree.cpp \
glsl/opt_redundant_jumps.cpp \
glsl/opt_structure_splitting.cpp \
-   glsl/opt_swizzle_swizzle.cpp \
+   glsl/opt_swizzle.cpp \
glsl/opt_tree_grafting.cpp \
glsl/opt_vectorize.cpp \
glsl/program.h \
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp 
b/src/compiler/glsl/glsl_parser_extras.cpp
index 822301a..5982173 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -2226,8 +2226,7 @@ do_common_optimization(exec_list *ir, bool linked,
options->EmitNoCont, options->EmitNoLoops);
OPT(do_vec_index_to_swizzle, ir);
OPT(lower_vector_insert, ir, false);
-   OPT(do_swizzle_swizzle, ir);
-   OPT(do_noop_swizzle, ir);
+   OPT(optimize_swizzles, ir);
 
OPT(optimize_split_arrays, ir, linked);
OPT(optimize_redundant_jumps, ir);
diff --git a/src/compiler/glsl/ir_optimization.h 
b/src/compiler/glsl/ir_optimization.h
index f44ddcb..2b8c195 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -123,9 +123,8 @@ bool lower_if_to_cond_assign(gl_shader_stage stage, 
exec_list *instructions,
  unsigned max_depth = 0, unsigned min_branch_cost 
= 0);
 bool do_mat_op_to_vec(exec_list *instructions);
 bool do_minmax_prune(exec_list *instructions);
-bool do_noop_swizzle(exec_list *instructions);
 bool do_structure_splitting(exec_list *instructions);
-bool do_swizzle_swizzle(exec_list *instructions);
+bool optimize_swizzles(exec_list *instructions);
 bool do_vectorize(exec_list *instructions);
 bool do_tree_grafting(exec_list *instructions);
 bool do_vec_index_to_cond_assign(exec_list *instructions);
diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build
index 76fcafb..6284d0c 100644
--- a/src/compiler/glsl/meson.build
+++ b/src/compiler/glsl/meson.build
@@ -169,11 +169,10 @@ files_libglsl = files(
   'opt_function_inlining.cpp',
   'opt_if_simplification.cpp',
   'opt_minmax.cpp',
-  'opt_noop_swizzle.cpp',
   'opt_rebalance_tree.cpp',
   'opt_redundant_jumps.cpp',
   'opt_structure_splitting.cpp',
-  'opt_swizzle_swizzle.cpp',
+  'opt_swizzle.cpp',
   'opt_tree_grafting.cpp',
   'opt_vectorize.cpp',
   'program.h',
diff --git a/src/compiler/glsl/opt_noop_swizzle.cpp 
b/src/compiler/glsl/opt_swizzle.cpp
similarity index 56%
rename from src/compiler/glsl/opt_noop_swizzle.cpp
rename to src/compiler/glsl/opt_swizzle.cpp
index 41890ab..2fbe362 100644
--- a/src/compiler/glsl/opt_noop_swizzle.cpp
+++ b/src/compiler/glsl/opt_swizzle.cpp
@@ -22,11 +22,14 @@
  */
 
 /**
- * \file opt_noop_swizzle.cpp
+ * \file opt_swizzle.cpp
+ * Optimize swizzle operations.
  *
- * If a swizzle doesn't change the order or count of components, then
- * remove the swizzle so that other optimization passes see the value
- * behind it.
+ * First, compact a sequence of swizzled swizzles into a single swizzle.
+ *
+ * If the final resulting swizzle doesn't change the order or count of
+ * components, then remove the swizzle so that other optimization passes see
+ * the value behind it.
  */
 
 #include "ir.h"
@@ -36,9 +39,9 @@
 
 namespace {
 
-class ir_noop_swizzle_visitor : public ir_rvalue_visitor {
+class ir_opt_swizzle_visitor : public ir_rvalue_visitor {
 public:
-   ir_noop_swizzle_visitor()
+   ir_opt_swizzle_visitor()
{
   this->progress = false;
}
@@ -50,13 +53,46 @@ public:
 } /* unnamed namespace */
 
 void
-ir_noop_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue)
+ir_opt_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue)
 {
if (!*rvalue)
   return;
 
ir_swizzle *swiz = (*rvalue)->as_swizzle();
-   if (!swiz || swiz->type != swiz->val->type)
+
+   if (!swiz)
+  return;
+
+   ir_swizzle *swiz2;
+
+   while ((swiz2 = swiz->val->as_swizzle()) != NULL) {
+  int mask2[4];
+
+  memset(&mask2, 0, sizeof(mask2));
+  if (swiz2->ma

[Mesa-dev] [PATCH 11/12] i965: Don't request GLSL IR lowering of gl_VertexID

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

Let the lowering in NIR handle it instead.

This hurts one shader that occurs twice in shader-db (SynMark GSCloth)
on IVB and HSW.  No other shaders or platforms were affected.

total cycles in shared programs: 253438422 -> 253438426 (0.00%)
cycles in affected programs: 412 -> 416 (0.97%)
helped: 0
HURT: 2

Signed-off-by: Ian Romanick 
---
 src/mesa/drivers/dri/i965/brw_context.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 037e349..0f6b467 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -586,7 +586,6 @@ brw_initialize_context_constants(struct brw_context *brw)
   ctx->Const.QuadsFollowProvokingVertexConvention = false;
 
ctx->Const.NativeIntegers = true;
-   ctx->Const.VertexID_is_zero_based = true;
 
/* Regarding the CMP instruction, the Ivybridge PRM says:
 *
-- 
2.9.5

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


[Mesa-dev] [PATCH 08/12] glsl: Use link_calculate_matrix_stride in lower_buffer_access and friends

2017-11-02 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/compiler/glsl/lower_buffer_access.cpp| 58 +++-
 src/compiler/glsl/lower_buffer_access.h  |  8 ++--
 src/compiler/glsl/lower_shared_reference.cpp | 18 -
 src/compiler/glsl/lower_ubo_reference.cpp| 28 +++---
 4 files changed, 42 insertions(+), 70 deletions(-)

diff --git a/src/compiler/glsl/lower_buffer_access.cpp 
b/src/compiler/glsl/lower_buffer_access.cpp
index caffaf9..219e03e 100644
--- a/src/compiler/glsl/lower_buffer_access.cpp
+++ b/src/compiler/glsl/lower_buffer_access.cpp
@@ -36,6 +36,7 @@
 #include "main/macros.h"
 #include "util/list.h"
 #include "glsl_parser_extras.h"
+#include "linker.h"
 
 using namespace ir_builder;
 
@@ -58,8 +59,8 @@ lower_buffer_access::emit_access(void *mem_ctx,
  ir_variable *base_offset,
  unsigned int deref_offset,
  bool row_major,
- int matrix_columns,
- unsigned int packing,
+ const glsl_type *matrix_type,
+ enum glsl_interface_packing packing,
  unsigned int write_mask)
 {
if (deref->type->is_record()) {
@@ -78,7 +79,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
 
  emit_access(mem_ctx, is_write, field_deref, base_offset,
  deref_offset + field_offset,
- row_major, 1, packing,
+ row_major, NULL, packing,
  writemask_for_size(field_deref->type->vector_elements));
 
  field_offset += field->type->std140_size(row_major);
@@ -98,7 +99,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
   element);
  emit_access(mem_ctx, is_write, element_deref, base_offset,
  deref_offset + i * array_stride,
- row_major, 1, packing,
+ row_major, NULL, packing,
  writemask_for_size(element_deref->type->vector_elements));
   }
   return;
@@ -117,7 +118,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
 int size_mul = deref->type->is_64bit() ? 8 : 4;
 emit_access(mem_ctx, is_write, col_deref, base_offset,
 deref_offset + i * size_mul,
-row_major, deref->type->matrix_columns, packing,
+row_major, deref->type, packing,
 writemask_for_size(col_deref->type->vector_elements));
  } else {
 int size_mul;
@@ -143,7 +144,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
 
 emit_access(mem_ctx, is_write, col_deref, base_offset,
 deref_offset + i * size_mul,
-row_major, deref->type->matrix_columns, packing,
+row_major, deref->type, packing,
 writemask_for_size(col_deref->type->vector_elements));
  }
   }
@@ -159,45 +160,14 @@ lower_buffer_access::emit_access(void *mem_ctx,
  is_write ? write_mask : (1 << deref->type->vector_elements) - 1;
   insert_buffer_access(mem_ctx, deref, deref->type, offset, mask, -1);
} else {
-  unsigned N = deref->type->is_64bit() ? 8 : 4;
-
   /* We're dereffing a column out of a row-major matrix, so we
* gather the vector from each stored row.
-  */
+   */
   assert(deref->type->is_float() || deref->type->is_double());
+  assert(matrix_type != NULL);
 
-  /* Matrices, row_major or not, are stored as if they were
-   * arrays of vectors of the appropriate size in std140.
-   * Arrays have their strides rounded up to a vec4, so the
-   * matrix stride is always 16. However a double matrix may either be 16
-   * or 32 depending on the number of columns.
-   */
-  assert(matrix_columns <= 4);
-  unsigned matrix_stride = 0;
-  /* Matrix stride for std430 mat2xY matrices are not rounded up to
-   * vec4 size. From OpenGL 4.3 spec, section 7.6.2.2 "Standard Uniform
-   * Block Layout":
-   *
-   * "2. If the member is a two- or four-component vector with components
-   * consuming N basic machine units, the base alignment is 2N or 4N,
-   * respectively." [...]
-   * "4. If the member is an array of scalars or vectors, the base 
alignment
-   * and array stride are set to match the base alignment of a single array
-   * element, according to rules (1), (2), and (3), and rounded up to the
-   * base alignment of a vec4." [...]
-   * "7. If the member is a row-major matrix with C columns and R rows, the
-   * matrix is stored identically to an array of R row vectors with C
-   * components each, according to rule (4)." [...]
-   * "When using the std430 storage layout, shader s

Re: [Mesa-dev] [PATCH 2/2] st/glsl_to_nir: delay adding built-in uniforms to Parameters list

2017-11-02 Thread Timothy Arceri



On 03/11/17 03:25, Nicolai Hähnle wrote:

On 01.11.2017 06:20, Timothy Arceri wrote:

Delaying adding built-in uniforms until after we convert to NIR
gives us a better chance to optimise them away. Also NIR allows
us to iterate over the uniforms directly so should be faster.
---
  src/mesa/state_tracker/st_glsl_to_nir.cpp  | 68 
+++---

  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |  2 +-
  2 files changed, 34 insertions(+), 36 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp 
b/src/mesa/state_tracker/st_glsl_to_nir.cpp

index 5b37d2cd63..bbef830a2e 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -235,20 +235,53 @@ st_glsl_to_nir(struct st_context *st, struct 
gl_program *prog,

 options = (const nir_shader_compiler_options *)
    pscreen->get_compiler_options(pscreen, PIPE_SHADER_IR_NIR, 
ptarget);

 assert(options);
 if (prog->nir)
    return prog->nir;
 nir = glsl_to_nir(shader_program, stage, options);
+   /* Make a pass over the IR to add state references for any built-in
+    * uniforms that are used.  This has to be done now (during linking).
+    * Code generation doesn't happen until the first time this shader is
+    * used for rendering.  Waiting until then to generate the 
parameters is
+    * too late.  At that point, the values for the built-in uniforms 
won't

+    * get sent to the shader.
+    */
+   nir_foreach_variable(var, &nir->uniforms) {
+  if (strncmp(var->name, "gl_", 3) == 0) {
+ const nir_state_slot *const slots = var->state_slots;
+ assert(var->state_slots != NULL);
+
+ for (unsigned int i = 0; i < var->num_state_slots; i++) {
+    _mesa_add_state_reference(prog->Parameters,
+  (gl_state_index 
*)slots[i].tokens);

+ }
+  }
+   }
+
+   /* Avoid reallocation of the program parameter list, because the 
uniform

+    * storage is only associated with the original parameter list.
+    * This should be enough for Bitmap and DrawPixels constants.
+    */
+   _mesa_reserve_parameter_storage(prog->Parameters, 8);
+
+   /* This has to be done last.  Any operation the can cause
+    * prog->ParameterValues to get reallocated (e.g., anything that 
adds a

+    * program constant) has to happen before creating this linkage.
+    */
+   _mesa_associate_uniform_storage(st->ctx, shader_program, prog, true);
+
+   st_set_prog_affected_state_flags(prog);
+
 NIR_PASS_V(nir, nir_lower_io_to_temporaries,
   nir_shader_get_entrypoint(nir),
   true, true);
 NIR_PASS_V(nir, nir_lower_global_vars_to_local);
 NIR_PASS_V(nir, nir_split_var_copies);
 NIR_PASS_V(nir, nir_lower_var_copies);
 NIR_PASS_V(nir, st_nir_lower_builtin);
 NIR_PASS_V(nir, nir_lower_atomics, shader_program);
 /* fragment shaders may need : */
@@ -381,67 +414,32 @@ st_nir_get_mesa_program(struct gl_context *ctx,
 prog = shader->Program;
 prog->Parameters = _mesa_new_parameter_list();
 do_set_program_inouts(shader->ir, prog, shader->Stage);
 _mesa_copy_linked_program_data(shader_program, shader);
 _mesa_generate_parameters_list_for_uniforms(ctx, shader_program, 
shader,

 prog->Parameters);
-   /* Make a pass over the IR to add state references for any built-in
-    * uniforms that are used.  This has to be done now (during linking).
-    * Code generation doesn't happen until the first time this shader is
-    * used for rendering.  Waiting until then to generate the 
parameters is
-    * too late.  At that point, the values for the built-in uniforms 
won't

-    * get sent to the shader.
-    */
-   foreach_in_list(ir_instruction, node, shader->ir) {
-  ir_variable *var = node->as_variable();
-
-  if ((var == NULL) || (var->data.mode != ir_var_uniform) ||
-  (strncmp(var->name, "gl_", 3) != 0))
- continue;
-
-  const ir_state_slot *const slots = var->get_state_slots();
-  assert(slots != NULL);
-
-  for (unsigned int i = 0; i < var->get_num_state_slots(); i++) {
- _mesa_add_state_reference(prog->Parameters,
-   (gl_state_index *) slots[i].tokens);
-  }
-   }
-
 if (ctx->_Shader->Flags & GLSL_DUMP) {
    _mesa_log("\n");
    _mesa_log("GLSL IR for linked %s program %d:\n",
   _mesa_shader_stage_to_string(shader->Stage),
   shader_program->Name);
    _mesa_print_ir(_mesa_get_log_file(), shader->ir, NULL);
    _mesa_log("\n\n");
 }
 prog->ExternalSamplersUsed = gl_external_samplers(prog);
 _mesa_update_shader_textures_used(shader_program, prog);
-   /* Avoid reallocation of the program parameter list, because the 
uniform

-    * storage is only associated with the original parameter list.
-    * This should be enough for Bitmap and DrawPixels constants.
-    */
-   _mesa_reserve_para

Re: [Mesa-dev] [PATCH 0/9] Implement {GLX_ARB, EGL_KHR}_context_flush_control

2017-11-02 Thread Emil Velikov
On 2 November 2017 at 19:01, Adam Jackson  wrote:
> Yet another rebase and resend, as I'm getting to the point where I'd
> like to be able to use this in xserver. This only enables it for
> llvmpipe and i965, it's trivial to enable for other drivers but I
> haven't tested any.
>
Sorry about this one Adam - could swear I checked these already.
I'm heading out for today - will go through the rest ASAP.

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


Re: [Mesa-dev] [PATCH 2/9] intel: Don't flush the old context in intelMakeCurrent

2017-11-02 Thread Emil Velikov
[removing Neil's old email as it bounces]

On 2 November 2017 at 19:01, Adam Jackson  wrote:
> From: Neil Roberts 
>
> It shouldn't be necessary to flush the context within the driver
> implementation because the old context is explicitly flushed in
> _mesa_make_current which is called a little further on. It is useful to
> only have a single place that flushes when switching contexts to make it
> easier to later implement the GL_KHR_context_flush_control extension.
>
> The flush in intelMakeCurrent was added in commit 5505865 to implement
> the GLX semantics that the context should be flushed when it is
> released.  When the commit was made there was no flush in
> _mesa_make_current because it was only added later in 93102b4c. I think
> that later commit effectively makes the first commit redundant.
>
From EGL POV we call glFlush even before getting into the driver which
... perhaps we should drop.
Skimming through the GLX codebase - we don't do such a thing.

Patch seems good, but there's a tinkling gut feeling.
Can you please share a branch with Mark/Dylan for them to run through their CI.

Gents, if possible run the lot in an X session. As mentioned above EGL
(aka gbm as used normally) has an extra glFlush which might give [too]
optimistic results.

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


Re: [Mesa-dev] [PATCH 12/13] meson: build gallium va state tracker

2017-11-02 Thread Emil Velikov
On 2 November 2017 at 18:11, Dylan Baker  wrote:
> Quoting Emil Velikov (2017-11-02 05:59:40)
>> On 1 November 2017 at 22:49, Dylan Baker  wrote:
>> > ---
>> >  meson.build   | 35 +-
>> >  meson_options.txt | 13 ++
>> >  src/gallium/meson.build   |  7 ++-
>> >  src/gallium/state_trackers/va/meson.build | 39 
>> >  src/gallium/targets/va/meson.build| 78 
>> > +++
>> >  5 files changed, 170 insertions(+), 2 deletions(-)
>> >  create mode 100644 src/gallium/state_trackers/va/meson.build
>> >  create mode 100644 src/gallium/targets/va/meson.build
>> >
>> > diff --git a/meson.build b/meson.build
>> > index 32b9d96e5be..582ee1d45f1 100644
>> > --- a/meson.build
>> > +++ b/meson.build
>> > @@ -417,6 +417,38 @@ if with_gallium_omx
>> >endif
>> >  endif
>> >
>> > +dep_va = []
>> > +_va = get_option('gallium-va')
>> > +if _va == 'auto'
>> > +  if not ['linux', 'bsd'].contains(host_machine.system())
>> > +with_gallium_va = false
>> > +  elif not with_platform_x11
>> > +with_gallium_va = false
>> > +  elif not (with_gallium_r600 or with_gallium_radeonsi or 
>> > with_gallium_nouveau)
>> > +with_gallium_va = false
>> > +  else
>> > +dep_va = dependency('libva', version : '>= 0.38.0', required : false)
>> > +with_gallium_va = dep_va.found()
>> > +  endif
>> > +elif _va == 'true'
>> > +  if not ['linux', 'bsd'].contains(host_machine.system())
>> > +error('VA state tracker can only be built on unix-like OSes.')
>> > +  elif not (with_platform_x11 or with_platform_drm)
>> > +error('VA state tracker requires X11 or drm or wayland platform 
>> > support.')
>> > +with_gallium_va = false
>> > +  elif not (with_gallium_r600 or with_gallium_radeonsi or 
>> > with_gallium_nouveau)
>> > +error('VA state tracker requires at least one of the following 
>> > gallium drivers: r600, radeonsi, nouveau.')
>> > +  endif
>> > +  dep_va = dependency('libva', version : '>= 0.38.0')
>> > +else
>> > +  with_gallium_va = false
>> > +endif
>> > +
>> > +va_drivers_path = get_option('va-libs-path')
>> > +if va_drivers_path == ''
>> > +  va_drivers_path = join_paths(get_option('libdir'), 'dri')
>> > +endif
>> > +
>> >  gl_pkgconfig_c_flags = []
>> >  if with_platform_x11
>> >if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
>> > @@ -924,7 +956,8 @@ if with_platform_x11
>> >  dep_xxf86vm = dependency('xxf86vm', required : false)
>> >endif
>> >if (with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm') or
>> > -  (with_gallium_vdpau or with_gallium_xvmc or with_gallium_omx))
>> > +  (with_gallium_vdpau or with_gallium_xvmc or with_gallium_omx or
>> > +   with_gallium_xa))
>> >  dep_xcb = dependency('xcb')
>> >  dep_x11_xcb = dependency('x11-xcb')
>> >  dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
>> > diff --git a/meson_options.txt b/meson_options.txt
>> > index f0cb73a89eb..497242cf532 100644
>> > --- a/meson_options.txt
>> > +++ b/meson_options.txt
>> > @@ -88,6 +88,19 @@ option(
>> >value : '',
>> >description : 'path to put omx libraries. defaults to omx-bellagio 
>> > pkg-config pluginsdir.'
>> >  )
>> > +option(
>> > +  'gallium-va',
>> > +  type : 'combo',
>> > +  value : 'auto',
>> > +  choices : ['auto', 'true', 'false'],
>> > +  description : 'enable gallium va state tracker.',
>> > +)
>> > +option(
>> > +  'va-libs-path',
>> > +  type : 'string',
>> > +  value : '',
>> > +  description : 'path to put va libraries. defaults to $libdir/dri.'
>> > +)
>> >  option(
>> >'vulkan-drivers',
>> >type : 'string',
>> > diff --git a/src/gallium/meson.build b/src/gallium/meson.build
>> > index 49e3d72114b..1dc646bf28f 100644
>> > --- a/src/gallium/meson.build
>> > +++ b/src/gallium/meson.build
>> > @@ -104,6 +104,9 @@ endif
>> >  if with_gallium_omx
>> >subdir('state_trackers/omx_bellagio')
>> >  endif
>> > +if with_gallium_va
>> > +  subdir('state_trackers/va')
>> > +endif
>> >  # TODO: SWR
>> >  # TODO: virgl
>> >  # TODO: winsys/sw/xlib
>> > @@ -123,8 +126,10 @@ endif
>> >  if with_gallium_omx
>> >subdir('targets/omx-bellagio')
>> >  endif
>> > +if with_gallium_va
>> > +  subdir('targets/va')
>> > +endif
>> >  # TODO: xlib-glx
>> > -# TODO: VA
>> >  # TODO: xa
>> >  # TODO: nine
>> >  # TODO: tests
>> > diff --git a/src/gallium/state_trackers/va/meson.build 
>> > b/src/gallium/state_trackers/va/meson.build
>> > new file mode 100644
>> > index 000..7770bc48066
>> > --- /dev/null
>> > +++ b/src/gallium/state_trackers/va/meson.build
>> > @@ -0,0 +1,39 @@
>> > +# Copyright © 2017 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 
>> > ri

[Mesa-dev] [PATCH 9/9] i965: Enable flush control

2017-11-02 Thread Adam Jackson
From: Neil Roberts 

Reviewed-by: Adam Jackson 
Signed-off-by: Neil Roberts 
---
 src/mesa/drivers/dri/i965/brw_context.c  | 20 +++-
 src/mesa/drivers/dri/i965/intel_screen.c |  2 ++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 60584e2744..8181cc376d 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -850,7 +850,9 @@ brwCreateContext(gl_api api,
   return false;
}
 
-   if (ctx_config->attribute_mask & ~__DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY) {
+   if (ctx_config->attribute_mask &
+   ~(__DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY |
+ __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR)) {
   *dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
   return false;
}
@@ -859,6 +861,20 @@ brwCreateContext(gl_api api,
   ((ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY) &&
ctx_config->reset_strategy != __DRI_CTX_RESET_NO_NOTIFICATION);
 
+   GLenum release_behavior = GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
+   if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR) {
+  switch (ctx_config->release_behavior) {
+  case __DRI_CTX_RELEASE_BEHAVIOR_NONE:
+ release_behavior = GL_NONE;
+ break;
+  case __DRI_CTX_RELEASE_BEHAVIOR_FLUSH:
+ break;
+  default:
+ *dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+ return false;
+  }
+   }
+
struct brw_context *brw = rzalloc(NULL, struct brw_context);
if (!brw) {
   fprintf(stderr, "%s: failed to alloc context\n", __func__);
@@ -1030,6 +1046,8 @@ brwCreateContext(gl_api api,
   ctx->Const.RobustAccess = GL_TRUE;
}
 
+   ctx->Const.ContextReleaseBehavior = release_behavior;
+
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
   brw_init_shader_time(brw);
 
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index 10064c3236..f628effc5b 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -1431,6 +1431,7 @@ static const __DRIextension *screenExtensions[] = {
 &intelRendererQueryExtension.base,
 &dri2ConfigQueryExtension.base,
 &dri2NoErrorExtension.base,
+&dri2FlushControlExtension.base,
 NULL
 };
 
@@ -1441,6 +1442,7 @@ static const __DRIextension 
*intelRobustScreenExtensions[] = {
 &intelImageExtension.base,
 &intelRendererQueryExtension.base,
 &dri2ConfigQueryExtension.base,
+&dri2FlushControlExtension.base,
 &dri2Robustness.base,
 &dri2NoErrorExtension.base,
 NULL
-- 
2.14.3

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


[Mesa-dev] [PATCH 4/9] dri: Add a flush control extension

2017-11-02 Thread Adam Jackson
From: Neil Roberts 

This advertises that the driver can accept a new context attribute
__DRI_CTX_ATTRIB_RELEASE_BEHAVIOR.

Reviewed-by: Adam Jackson 
Signed-off-by: Neil Roberts 
---
 include/GL/internal/dri_interface.h| 25 +
 src/mesa/drivers/dri/common/dri_util.c | 14 ++
 src/mesa/drivers/dri/common/dri_util.h |  9 +++--
 3 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 98402eae05..b47947380c 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1106,6 +1106,16 @@ struct __DRIdri2LoaderExtensionRec {
 #define __DRI_CTX_PRIORITY_MEDIUM  1
 #define __DRI_CTX_PRIORITY_HIGH2
 
+/**
+ * \name Context release behaviors.
+ */
+/*@{*/
+#define __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR  5
+
+#define __DRI_CTX_RELEASE_BEHAVIOR_NONE 0
+#define __DRI_CTX_RELEASE_BEHAVIOR_FLUSH1
+/*@}*/
+
 /**
  * \name Reasons that __DRIdri2Extension::createContextAttribs might fail
  */
@@ -1715,6 +1725,21 @@ typedef struct __DRInoErrorExtensionRec {
__DRIextension base;
 } __DRInoErrorExtension;
 
+/*
+ * Flush control driver extension.
+ *
+ * Existence of this extension means the driver can accept the
+ * \c __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR attribute in
+ * \c __DRIdri2ExtensionRec::createContextAttribs.
+ */
+#define __DRI2_FLUSH_CONTROL "DRI_FlushControl"
+#define __DRI2_FLUSH_CONTROL_VERSION 1
+
+typedef struct __DRI2flushControlExtensionRec __DRI2flushControlExtension;
+struct __DRI2flushControlExtensionRec {
+   __DRIextension base;
+};
+
 /**
  * DRI config options extension.
  *
diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index dc5260ca5b..d504751c39 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -361,6 +361,16 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
 ctx_config.attribute_mask |= __DRIVER_CONTEXT_ATTRIB_PRIORITY;
ctx_config.priority = attribs[i * 2 + 1];
break;
+case __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR:
+if (attribs[i * 2 + 1] != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
+ctx_config.attribute_mask |=
+__DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR;
+ctx_config.release_behavior = attribs[i * 2 + 1];
+} else {
+ctx_config.attribute_mask &=
+~__DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR;
+}
+break;
default:
/* We can't create a context that satisfies the requirements of an
 * attribute that we don't understand.  Return failure.
@@ -833,6 +843,10 @@ const __DRI2configQueryExtension dri2ConfigQueryExtension 
= {
.configQueryf= dri2ConfigQueryf,
 };
 
+const __DRI2flushControlExtension dri2FlushControlExtension = {
+   .base = { __DRI2_FLUSH_CONTROL, 1 }
+};
+
 void
 dri2InvalidateDrawable(__DRIdrawable *drawable)
 {
diff --git a/src/mesa/drivers/dri/common/dri_util.h 
b/src/mesa/drivers/dri/common/dri_util.h
index 3d9ec9d072..1881e3d0a7 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -67,6 +67,7 @@ extern const __DRIswrastExtension driSWRastExtension;
 extern const __DRIdri2Extension driDRI2Extension;
 extern const __DRI2configQueryExtension dri2ConfigQueryExtension;
 extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
+extern const __DRI2flushControlExtension dri2FlushControlExtension;
 
 /**
  * Description of the attributes used to create a config.
@@ -93,10 +94,14 @@ struct __DriverContextConfig {
 
 /* Only valid if __DRIVER_CONTEXT_PRIORITY is set */
 unsigned priority;
+
+/* Only valid if __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR is set */
+int release_behavior;
 };
 
-#define __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY  (1 << 0)
-#define __DRIVER_CONTEXT_ATTRIB_PRIORITY(1 << 1)
+#define __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY   (1 << 0)
+#define __DRIVER_CONTEXT_ATTRIB_PRIORITY (1 << 1)
+#define __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR (1 << 2)
 
 /**
  * Driver callback functions.
-- 
2.14.3

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


[Mesa-dev] [PATCH 8/9] drisw: Enable flush control for llvmpipe and softpipe

2017-11-02 Thread Adam Jackson
Hilariously this is a fairly big win.  Neil's multi-context-test
improves from ~24 to ~36 fps with llvmpipe on a Core i5-3317U.  softpipe
also improves, from about 2.25 to 3.09 fps (when it's that slow, you're
allowed to be that precise).

I'd have added it to swrast classic, but the testcase wants GL 3.0 and
shaders, and that's not a thing classic has, so I figured making it work
on softpipe was crime enough.

Reviewed-by: Marek Olšák 
Signed-off-by: Adam Jackson 
---
 src/gallium/state_trackers/dri/drisw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/state_trackers/dri/drisw.c 
b/src/gallium/state_trackers/dri/drisw.c
index 9466cfdb20..eb5752386d 100644
--- a/src/gallium/state_trackers/dri/drisw.c
+++ b/src/gallium/state_trackers/dri/drisw.c
@@ -381,6 +381,7 @@ static const __DRIextension *drisw_screen_extensions[] = {
&dri2FenceExtension.base,
&dri2NoErrorExtension.base,
&driSWImageExtension.base,
+   &dri2FlushControlExtension.base,
NULL
 };
 
-- 
2.14.3

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


[Mesa-dev] [PATCH 3/9] dri: Change __DriverApiRec::CreateContext to take a struct for attribs

2017-11-02 Thread Adam Jackson
From: Neil Roberts 

Previously the CreateContext method of __DriverApiRec took a set of
arguments to describe the attribute values from the window system API's
CreateContextAttribs function. As more attributes get added this could
quickly get unworkable and every new attribute needs a modification for
every driver.

To fix that, pass the attribute values in a struct instead.  The struct
has a bitmask to specify which members are used. The first three members
(two for the GL version and one for the flags) are always set. If the
bit is not set in the attribute mask then it can be assumed the
attribute has the default value. Drivers will error if unknown bits in
the mask are set.

Reviewed-by: Adam Jackson 
Signed-off-by: Neil Roberts 
---
 src/gallium/state_trackers/dri/dri_context.c   | 32 +++
 src/gallium/state_trackers/dri/dri_context.h   |  6 +--
 src/mesa/drivers/dri/common/dri_util.c | 57 +++---
 src/mesa/drivers/dri/common/dri_util.h | 39 +++---
 src/mesa/drivers/dri/i915/intel_screen.c   | 20 -
 src/mesa/drivers/dri/i965/brw_context.c| 45 +++-
 src/mesa/drivers/dri/i965/brw_context.h|  6 +--
 src/mesa/drivers/dri/nouveau/nouveau_context.c | 15 +++
 src/mesa/drivers/dri/nouveau/nouveau_context.h |  3 +-
 src/mesa/drivers/dri/r200/r200_context.c   | 12 ++
 src/mesa/drivers/dri/r200/r200_context.h   |  7 +---
 src/mesa/drivers/dri/radeon/radeon_context.c   | 12 ++
 src/mesa/drivers/dri/radeon/radeon_context.h   |  7 +---
 src/mesa/drivers/dri/swrast/swrast.c   | 16 
 14 files changed, 149 insertions(+), 128 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_context.c 
b/src/gallium/state_trackers/dri/dri_context.c
index 8776aacc09..73910e1df3 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -43,11 +43,7 @@
 GLboolean
 dri_create_context(gl_api api, const struct gl_config * visual,
   __DRIcontext * cPriv,
-  unsigned major_version,
-  unsigned minor_version,
-  uint32_t flags,
-   bool notify_reset,
-   unsigned priority,
+   const struct __DriverContextConfig *ctx_config,
   unsigned *error,
   void *sharedContextPrivate)
 {
@@ -61,18 +57,21 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
unsigned allowed_flags = __DRI_CTX_FLAG_DEBUG |
 __DRI_CTX_FLAG_FORWARD_COMPATIBLE |
 __DRI_CTX_FLAG_NO_ERROR;
+   unsigned allowed_attribs = 0;
const __DRIbackgroundCallableExtension *backgroundCallable =
   screen->sPriv->dri2.backgroundCallable;
 
-   if (screen->has_reset_status_query)
+   if (screen->has_reset_status_query) {
   allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS;
+  allowed_attribs |= __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY;
+   }
 
-   if (flags & ~allowed_flags) {
+   if (ctx_config->flags & ~allowed_flags) {
   *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
   goto fail;
}
 
-   if (!screen->has_reset_status_query && notify_reset) {
+   if (ctx_config->attribute_mask & ~allowed_attribs) {
   *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
   goto fail;
}
@@ -89,10 +88,10 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
case API_OPENGL_CORE:
   attribs.profile = api == API_OPENGL_COMPAT ? ST_PROFILE_DEFAULT
  : ST_PROFILE_OPENGL_CORE;
-  attribs.major = major_version;
-  attribs.minor = minor_version;
+  attribs.major = ctx_config->major_version;
+  attribs.minor = ctx_config->minor_version;
 
-  if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
+  if ((ctx_config->flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
 attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE;
   break;
default:
@@ -100,16 +99,17 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
   goto fail;
}
 
-   if ((flags & __DRI_CTX_FLAG_DEBUG) != 0)
+   if ((ctx_config->flags & __DRI_CTX_FLAG_DEBUG) != 0)
   attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
 
-   if (flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)
+   if (ctx_config->flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)
   attribs.flags |= ST_CONTEXT_FLAG_ROBUST_ACCESS;
 
-   if (notify_reset)
-  attribs.flags |= ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED;
+   if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY)
+  if (ctx_config->reset_strategy != __DRI_CTX_RESET_NO_NOTIFICATION)
+ attribs.flags |= ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED;
 
-   if (flags & __DRI_CTX_FLAG_NO_ERROR)
+   if (ctx_config->flags & __DRI_CTX_FLAG_NO_ERROR)
   attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR;
 
if (sharedContextPrivate) {
diff --git a/src/galli

[Mesa-dev] [PATCH 7/9] gallium: Wire up flush control

2017-11-02 Thread Adam Jackson
Reviewed-by: Marek Olšák 
Signed-off-by: Adam Jackson 
---
 src/gallium/include/state_tracker/st_api.h   | 1 +
 src/gallium/state_trackers/dri/dri_context.c | 6 +-
 src/mesa/state_tracker/st_manager.c  | 3 +++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 2232c3efa1..11a9878cf6 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -91,6 +91,7 @@ enum st_api_feature
 #define ST_CONTEXT_FLAG_ROBUST_ACCESS   (1 << 2)
 #define ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED (1 << 3)
 #define ST_CONTEXT_FLAG_NO_ERROR(1 << 4)
+#define ST_CONTEXT_FLAG_RELEASE_NONE   (1 << 5)
 
 /**
  * Reasons that context creation might fail.
diff --git a/src/gallium/state_trackers/dri/dri_context.c 
b/src/gallium/state_trackers/dri/dri_context.c
index 73910e1df3..285ee90a95 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -57,7 +57,7 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
unsigned allowed_flags = __DRI_CTX_FLAG_DEBUG |
 __DRI_CTX_FLAG_FORWARD_COMPATIBLE |
 __DRI_CTX_FLAG_NO_ERROR;
-   unsigned allowed_attribs = 0;
+   unsigned allowed_attribs = __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR;
const __DRIbackgroundCallableExtension *backgroundCallable =
   screen->sPriv->dri2.backgroundCallable;
 
@@ -112,6 +112,10 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
if (ctx_config->flags & __DRI_CTX_FLAG_NO_ERROR)
   attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR;
 
+   if ((ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR)
+   && (ctx_config->release_behavior == __DRI_CTX_RELEASE_BEHAVIOR_NONE))
+  attribs.flags |= ST_CONTEXT_FLAG_RELEASE_NONE;
+
if (sharedContextPrivate) {
   st_share = ((struct dri_context *)sharedContextPrivate)->st;
}
diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index eebde62183..48260df0c3 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -882,6 +882,9 @@ st_api_create_context(struct st_api *stapi, struct 
st_manager *smapi,
   st_install_device_reset_callback(st);
}
 
+   if (attribs->flags & ST_CONTEXT_FLAG_RELEASE_NONE)
+   st->ctx->Const.ContextReleaseBehavior = GL_NONE;
+
/* need to perform version check */
if (attribs->major > 1 || attribs->minor > 0) {
   /* Is the actual version less than the requested version?
-- 
2.14.3

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


[Mesa-dev] [PATCH 6/9] egl: Implement EGL_KHR_context_flush_control

2017-11-02 Thread Adam Jackson
Signed-off-by: Adam Jackson 
---
 src/egl/drivers/dri2/egl_dri2.c | 11 ++-
 src/egl/drivers/dri2/egl_dri2.h |  1 +
 src/egl/main/eglapi.c   |  1 +
 src/egl/main/eglcontext.c   | 10 ++
 src/egl/main/eglcontext.h   |  1 +
 src/egl/main/egldisplay.h   |  1 +
 6 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 57226f60a7..15e6c9bb8b 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -92,7 +92,7 @@
 #define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
 #endif
 
-#define NUM_ATTRIBS 10
+#define NUM_ATTRIBS 12
 
 static void
 dri_set_background_context(void *loaderPrivate)
@@ -457,6 +457,7 @@ static const struct dri2_extension_match 
optional_core_extensions[] = {
{ __DRI2_RENDERER_QUERY, 1, offsetof(struct dri2_egl_display, 
rendererQuery) },
{ __DRI2_INTEROP, 1, offsetof(struct dri2_egl_display, interop) },
{ __DRI_IMAGE, 1, offsetof(struct dri2_egl_display, image) },
+   { __DRI2_FLUSH_CONTROL, 1, offsetof(struct dri2_egl_display, flush_control) 
},
{ NULL, 0, 0 }
 };
 
@@ -766,6 +767,9 @@ dri2_setup_screen(_EGLDisplay *disp)
   }
 #endif
}
+
+   if (dri2_dpy->flush_control)
+  disp->Extensions.KHR_context_flush_control = EGL_TRUE;
 }
 
 void
@@ -1227,6 +1231,11 @@ dri2_fill_context_attribs(struct dri2_egl_context 
*dri2_ctx,
   ctx_attribs[pos++] = val;
}
 
+   if (dri2_ctx->base.ReleaseBehavior == 
EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR) {
+  ctx_attribs[pos++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
+  ctx_attribs[pos++] = __DRI_CTX_RELEASE_BEHAVIOR_NONE;
+   }
+
*num_attribs = pos;
 
return true;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index cd2487ab22..0ec8f44dce 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -164,6 +164,7 @@ struct dri2_egl_display
const __DRIdri2Extension   *dri2;
const __DRIswrastExtension *swrast;
const __DRI2flushExtension *flush;
+   const __DRI2flushControlExtension *flush_control;
const __DRItexBufferExtension  *tex_buffer;
const __DRIimageExtension  *image;
const __DRIrobustnessExtension *robustness;
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 215332f99c..76dabba2eb 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -494,6 +494,7 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
 
_EGL_CHECK_EXTENSION(KHR_cl_event2);
_EGL_CHECK_EXTENSION(KHR_config_attribs);
+   _EGL_CHECK_EXTENSION(KHR_context_flush_control);
_EGL_CHECK_EXTENSION(KHR_create_context);
_EGL_CHECK_EXTENSION(KHR_create_context_no_error);
_EGL_CHECK_EXTENSION(KHR_fence_sync);
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 8c64f9ab82..18c1bc59ac 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -386,6 +386,15 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay 
*dpy,
 break;
  }
 
+  case EGL_CONTEXT_RELEASE_BEHAVIOR_KHR:
+ if (val == EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR ||
+ val == EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR) {
+ctx->ReleaseBehavior = val;
+ } else {
+err = EGL_BAD_ATTRIBUTE;
+ }
+ break;
+
   default:
  err = EGL_BAD_ATTRIBUTE;
  break;
@@ -588,6 +597,7 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, 
_EGLConfig *conf,
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
ctx->ResetNotificationStrategy = EGL_NO_RESET_NOTIFICATION_KHR;
ctx->ContextPriority = EGL_CONTEXT_PRIORITY_MEDIUM_IMG;
+   ctx->ReleaseBehavior = EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR;
 
err = _eglParseContextAttribList(ctx, dpy, attrib_list);
if (err == EGL_SUCCESS && ctx->Config) {
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index a752368313..8d97ef9eab 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -64,6 +64,7 @@ struct _egl_context
EGLint ResetNotificationStrategy;
EGLint ContextPriority;
EGLBoolean NoError;
+   EGLint ReleaseBehavior;
 
/* The real render buffer when a window surface is bound */
EGLint WindowRenderBuffer;
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 952bfe53f0..981cbf4ca0 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -112,6 +112,7 @@ struct _egl_extensions
 
EGLBoolean KHR_cl_event2;
EGLBoolean KHR_config_attribs;
+   EGLBoolean KHR_context_flush_control;
EGLBoolean KHR_create_context;
EGLBoolean KHR_fence_sync;
EGLBoolean KHR_get_all_proc_addresses;
-- 
2.14.3

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


[Mesa-dev] [PATCH 1/9] egl/dri2: Factor out context attribute initialization

2017-11-02 Thread Adam Jackson
Signed-off-by: Adam Jackson 
---
 src/egl/drivers/dri2/egl_dri2.c | 35 +--
 1 file changed, 9 insertions(+), 26 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 503450542e..57226f60a7 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1247,6 +1247,9 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
struct dri2_egl_config *dri2_config = dri2_egl_config(conf);
const __DRIconfig *dri_config;
int api;
+   unsigned error;
+   unsigned num_attribs = NUM_ATTRIBS;
+   uint32_t ctx_attribs[NUM_ATTRIBS];
 
(void) drv;
 
@@ -1339,15 +1342,11 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
else
   dri_config = NULL;
 
+   if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
+ &num_attribs))
+  goto cleanup;
+
if (dri2_dpy->image_driver) {
-  unsigned error;
-  unsigned num_attribs = NUM_ATTRIBS;
-  uint32_t ctx_attribs[NUM_ATTRIBS];
-
-  if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
-&num_attribs))
- goto cleanup;
-
   dri2_ctx->dri_context =
  dri2_dpy->image_driver->createContextAttribs(dri2_dpy->dri_screen,
   api,
@@ -1360,16 +1359,8 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
   dri2_create_context_attribs_error(error);
} else if (dri2_dpy->dri2) {
   if (dri2_dpy->dri2->base.version >= 3) {
- unsigned error;
- unsigned num_attribs = NUM_ATTRIBS;
- uint32_t ctx_attribs[NUM_ATTRIBS];
-
- if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
-&num_attribs))
-goto cleanup;
-
- dri2_ctx->dri_context =
-dri2_dpy->dri2->createContextAttribs(dri2_dpy->dri_screen,
+dri2_ctx->dri_context =
+   dri2_dpy->dri2->createContextAttribs(dri2_dpy->dri_screen,
  api,
  dri_config,
  shared,
@@ -1389,14 +1380,6 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
} else {
   assert(dri2_dpy->swrast);
   if (dri2_dpy->swrast->base.version >= 3) {
- unsigned error;
- unsigned num_attribs = NUM_ATTRIBS;
- uint32_t ctx_attribs[NUM_ATTRIBS];
-
- if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
-&num_attribs))
-goto cleanup;
-
  dri2_ctx->dri_context =
 dri2_dpy->swrast->createContextAttribs(dri2_dpy->dri_screen,
api,
-- 
2.14.3

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


[Mesa-dev] [PATCH 5/9] glx: Implement GLX_ARB_context_flush_control

2017-11-02 Thread Adam Jackson
From: Neil Roberts 

Reviewed-by: Adam Jackson 
Signed-off-by: Neil Roberts 
---
 src/glx/dri2_glx.c  | 18 --
 src/glx/dri3_glx.c  | 14 --
 src/glx/dri_common.c| 16 +++-
 src/glx/dri_common.h|  2 +-
 src/glx/drisw_glx.c | 17 +++--
 src/glx/glxextensions.c |  1 +
 src/glx/glxextensions.h |  3 ++-
 7 files changed, 62 insertions(+), 9 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index ae8cb11ef8..e67a15f9da 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -247,7 +247,8 @@ dri2_create_context_attribs(struct glx_screen *base,
uint32_t flags;
unsigned api;
int reset;
-   uint32_t ctx_attribs[2 * 5];
+   int release;
+   uint32_t ctx_attribs[2 * 6];
unsigned num_ctx_attribs = 0;
 
if (psc->dri2->base.version < 3) {
@@ -259,7 +260,7 @@ dri2_create_context_attribs(struct glx_screen *base,
 */
if (!dri2_convert_glx_attribs(num_attribs, attribs,
  &major_ver, &minor_ver, &renderType, &flags,
- &api, &reset, error))
+ &api, &reset, &release, error))
   goto error_exit;
 
/* Check the renderType value */
@@ -294,6 +295,11 @@ dri2_create_context_attribs(struct glx_screen *base,
   ctx_attribs[num_ctx_attribs++] = reset;
}
 
+   if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
+  ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
+  ctx_attribs[num_ctx_attribs++] = release;
+   }
+
if (flags != 0) {
   ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
 
@@ -1170,6 +1176,14 @@ dri2BindExtensions(struct dri2_screen *psc, struct 
glx_display * priv,
 
   if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)
 psc->interop = (__DRI2interopExtension*)extensions[i];
+
+  /* DRI2 version 3 is also required because
+   * GLX_ARB_control_flush_control requires GLX_ARB_create_context.
+   */
+  if (psc->dri2->base.version >= 3
+  && strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0)
+ __glXEnableDirectExtension(&psc->base,
+"GLX_ARB_context_flush_control");
}
 }
 
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index b79fec7335..d613073994 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -235,7 +235,8 @@ dri3_create_context_attribs(struct glx_screen *base,
uint32_t flags = 0;
unsigned api;
int reset = __DRI_CTX_RESET_NO_NOTIFICATION;
-   uint32_t ctx_attribs[2 * 5];
+   int release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
+   uint32_t ctx_attribs[2 * 6];
unsigned num_ctx_attribs = 0;
uint32_t render_type;
 
@@ -244,7 +245,7 @@ dri3_create_context_attribs(struct glx_screen *base,
if (!dri2_convert_glx_attribs(num_attribs, attribs,
  &major_ver, &minor_ver,
  &render_type, &flags, &api,
- &reset, error))
+ &reset, &release, error))
   goto error_exit;
 
/* Check the renderType value */
@@ -279,6 +280,11 @@ dri3_create_context_attribs(struct glx_screen *base,
   ctx_attribs[num_ctx_attribs++] = reset;
}
 
+   if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
+  ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
+  ctx_attribs[num_ctx_attribs++] = release;
+   }
+
if (flags != 0) {
   ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
 
@@ -755,6 +761,10 @@ dri3_bind_extensions(struct dri3_screen *psc, struct 
glx_display * priv,
 
   if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)
 psc->interop = (__DRI2interopExtension*)extensions[i];
+
+  if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0)
+ __glXEnableDirectExtension(&psc->base,
+"GLX_ARB_context_flush_control");
}
 }
 
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index e2bbd48d3a..3b82309fa2 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -475,7 +475,7 @@ _X_HIDDEN bool
 dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
  unsigned *major_ver, unsigned *minor_ver,
  uint32_t *render_type, uint32_t *flags, unsigned *api,
- int *reset, unsigned *error)
+ int *reset, int *release, unsigned *error)
 {
unsigned i;
bool got_profile = false;
@@ -485,6 +485,7 @@ dri2_convert_glx_attribs(unsigned num_attribs, const 
uint32_t *attribs,
*minor_ver = 0;
*render_type = GLX_RGBA_TYPE;
*reset = __DRI_CTX_RESET_NO_NOTIFICATION;
+   *release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
*flags = 0;
*api = __DRI_API_OPENGL;
 
@@ -530,6 +531,19 @@ dri2_convert_glx_attribs(unsigned num_attribs, const 
uint32_t *attribs,
 return false;
  }
  break;
+   

[Mesa-dev] [PATCH 2/9] intel: Don't flush the old context in intelMakeCurrent

2017-11-02 Thread Adam Jackson
From: Neil Roberts 

It shouldn't be necessary to flush the context within the driver
implementation because the old context is explicitly flushed in
_mesa_make_current which is called a little further on. It is useful to
only have a single place that flushes when switching contexts to make it
easier to later implement the GL_KHR_context_flush_control extension.

The flush in intelMakeCurrent was added in commit 5505865 to implement
the GLX semantics that the context should be flushed when it is
released.  When the commit was made there was no flush in
_mesa_make_current because it was only added later in 93102b4c. I think
that later commit effectively makes the first commit redundant.

Reviewed-by: Adam Jackson 
Signed-off-by: Neil Roberts 
---
 src/mesa/drivers/dri/i915/intel_context.c | 9 -
 src/mesa/drivers/dri/i965/brw_context.c   | 9 -
 2 files changed, 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_context.c 
b/src/mesa/drivers/dri/i915/intel_context.c
index e0766a0e3f..96d09ca947 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -626,21 +626,12 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
  __DRIdrawable * driReadPriv)
 {
struct intel_context *intel;
-   GET_CURRENT_CONTEXT(curCtx);
 
if (driContextPriv)
   intel = (struct intel_context *) driContextPriv->driverPrivate;
else
   intel = NULL;
 
-   /* According to the glXMakeCurrent() man page: "Pending commands to
-* the previous context, if any, are flushed before it is released."
-* But only flush if we're actually changing contexts.
-*/
-   if (intel_context(curCtx) && intel_context(curCtx) != intel) {
-  _mesa_flush(curCtx);
-   }
-
if (driContextPriv) {
   struct gl_context *ctx = &intel->ctx;
   struct gl_framebuffer *fb, *readFb;
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 037e349fdb..fae7631266 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -1171,21 +1171,12 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
  __DRIdrawable * driReadPriv)
 {
struct brw_context *brw;
-   GET_CURRENT_CONTEXT(curCtx);
 
if (driContextPriv)
   brw = (struct brw_context *) driContextPriv->driverPrivate;
else
   brw = NULL;
 
-   /* According to the glXMakeCurrent() man page: "Pending commands to
-* the previous context, if any, are flushed before it is released."
-* But only flush if we're actually changing contexts.
-*/
-   if (brw_context(curCtx) && brw_context(curCtx) != brw) {
-  _mesa_flush(curCtx);
-   }
-
if (driContextPriv) {
   struct gl_context *ctx = &brw->ctx;
   struct gl_framebuffer *fb, *readFb;
-- 
2.14.3

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


[Mesa-dev] [PATCH 0/9] Implement {GLX_ARB, EGL_KHR}_context_flush_control

2017-11-02 Thread Adam Jackson
Yet another rebase and resend, as I'm getting to the point where I'd
like to be able to use this in xserver. This only enables it for
llvmpipe and i965, it's trivial to enable for other drivers but I
haven't tested any.

- ajax

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


Re: [Mesa-dev] Meson's default build type

2017-11-02 Thread Andres Rodriguez



On 2017-11-02 01:52 PM, Eric Engestrom wrote:

On Thursday, 2017-11-02 17:39:53 +, Eric Engestrom wrote:

On Thursday, 2017-11-02 09:46:05 -0700, Chad Versace wrote:

On Wed 01 Nov 2017, Dylan Baker wrote:

Quoting Ilia Mirkin (2017-11-01 16:05:17)

On Wed, Nov 1, 2017 at 7:03 PM, Dylan Baker  wrote:

Quoting Ilia Mirkin (2017-11-01 15:52:56)

On Wed, Nov 1, 2017 at 6:49 PM, Chad Versace  wrote:

On Wed 01 Nov 2017, Dylan Baker wrote:

Quoting Chad Versace (2017-11-01 14:43:28)

Wow. 10 seconds from a clean checkout to an installed Vulkan driver.



Glad that it's working out for you guys!

Can I convince you to wire the anvil and i965 android/arc++ bits? ;)

JFYI, the meson build will (I consider it a bug if it doesn't) turn off all
glapi, egl, and glx if there are no dri or gallium drivers built unless you
force them on.


Thanks for turning that stuff off. Last time I tried to build just
Vulkan without GL (maybe 1.5 years ago), Autotools didn't allow it. It
insisted that i965 was a build dependency for anvil.


It also avoids building the glsl compiler unless there's a driver
that uses it.


I expected the buildtime to be much longer because I expected it to
build the GLSL compiler too. I was surprised and happy to discover that
it builds only the SPIR-V compiler.


And it defaults to debug, which might be surprising, but people
around here thought that default debug is a feature.


Huh... For infrastructure projects like Mesa (as opposed to test
projects like Piglit), I expect the default build to be the release
build. But I can understand why others would want default=debug.


autotools defaults to debug disabled. I think that's how almost every
project does it... debug enabled is definitely a surprise.

   -ilia


Well, for distros they likely want to set the buildtype to plain (meson adds no
compiler flags except ones the project defines), and then add their default
flags via CFLAGS and CXXFLAGS. That is certainly *not* what anyone except a
distro (or some kind of build infrastructure like jenkins or gentoo) would want.
Xorg's default is debugoptimzed, for reference.


--enable-debug enables -DDEBUG in mesa. Are you saying that this is
the default? Or are you just saying that you're not adding extra
-O100073 options?


The meson build keys -DDEBUG on the builtype, debug or debugoptimized you get
-DDEBUG, anything else, you don't. The way mesa is setup if you don't have
-DNDEBUG you have to have -DDEBUG or asserts happen for member of structures
that don't exist.

I'm not dead set on debug as the default buildtype, it's what we have ATM
though. I asked around here and the feeling was that builtype debug by default
was a feature. If the larger community disagrees we can change it.


When making this decision, I think we should also consider the needs of
non-developers who build and install Mesa from source to get the latest
version or bugfix. I strongly suspect those people want
buildtype=debugoptimized or buildtype=release.

I think it's important for Mesa to follow the established convention of
most other Linux projects: if a user downloads the source, builds, and
installs, then the user gets a working installation suitable for normal
usage. Today, Meson doesn't give that because it builds Mesa with -O0.

Some context... I install a lot of packages from source on my work
machine because I often want or need newer versions of some packages
than what's available through the package manager.


How do you ensure it integrates correctly with your system [1], other
than by using the package manager's package and updating the version
number locally?

   [1] by "integrate" I mean things like installing things in the right
   locations, removing stale files from old packages, providing new
   dependencies for other packages, etc.

I also install newer version of stuff on various machines, but if I had
to configure each project manually to integrate with my system, then
I would just give up. That burden does not scale :P

The only way I can make this work is by grabbing the existing package,
bumping the version and recompiling it. Part of the configuration set in
the package is the various optimisation flags, be that through
buildtype=release or buildtype=plain + manual cflags.

(Note that for Meson, Arch provides a wrapper [2] that sets all the
options to the right values for ease of use.)
[2] https://git.archlinux.org/svntogit/packages.git/tree/meson/trunk/arch-meson



I think I wasn't clear, but my point was that IMHO the only time someone
would build something without going through a package is when they're
dev'ing it, in which case buildtype=debug is what they want.

It's not too hard to ask all the devs to manually set it every time though,
especially since we're all used to having to do it with autotools.


I think this is one of the better reasons to go with an optimized build 
type by default.


Additionally, it is very easy for a developer to realize that a build is 
missing debug symbols (y

Re: [Mesa-dev] [PATCH v3] compiler: Mark when input/ouput attribute at VS uses 16-bit (v2)

2017-11-02 Thread Chema Casanova
El 02/11/17 a las 19:25, Jason Ekstrand escribió:
> On Thu, Nov 2, 2017 at 11:17 AM, Chema Casanova  > wrote:
>
>
>
> El 01/11/17 a las 22:07, Jason Ekstrand escribió:
> > On Tue, Oct 17, 2017 at 10:05 AM, Jose Maria Casanova Crespo
> > mailto:jmcasan...@igalia.com>
> >> wrote:
> >
> >     New shader attribute to mark when a location has 16-bit
> >     value. This patch includes support on mesa glsl and nir.
> >
> >     v2: Remove use of is_half_slot as is a duplicate of is_16bit
> >         (Topi Pohjolainen)
> >     ---
> >      src/compiler/glsl_types.h          | 15 +++
> >      src/compiler/nir/nir_gather_info.c | 21 ++---
> >      src/compiler/shader_info.h         |  2 ++
> >      3 files changed, 31 insertions(+), 7 deletions(-)
> >
> >     diff --git a/src/compiler/glsl_types.h
> b/src/compiler/glsl_types.h
> >     index 32399df351..e35e8d8f88 100644
> >     --- a/src/compiler/glsl_types.h
> >     +++ b/src/compiler/glsl_types.h
> >     @@ -93,6 +93,13 @@ static inline bool
> >     glsl_base_type_is_integer(enum glsl_base_type type)
> >                type == GLSL_TYPE_IMAGE;
> >      }
> >
> >     +static inline bool glsl_base_type_is_16bit(enum
> glsl_base_type type)
> >     +{
> >     +   return type == GLSL_TYPE_FLOAT16 ||
> >     +          type == GLSL_TYPE_UINT16 ||
> >     +          type == GLSL_TYPE_INT16;
> >     +}
> >     +
> >      enum glsl_sampler_dim {
> >         GLSL_SAMPLER_DIM_1D = 0,
> >         GLSL_SAMPLER_DIM_2D,
> >     @@ -555,6 +562,14 @@ struct glsl_type {
> >         }
> >
> >         /**
> >     +    * Query whether or not a type is 16-bit
> >     +    */
> >     +   bool is_16bit() const
> >     +   {
> >     +      return glsl_base_type_is_16bit(base_type);
> >     +   }
> >     +
> >     +   /**
> >          * Query whether or not a type is a non-array boolean type
> >          */
> >         bool is_boolean() const
> >     diff --git a/src/compiler/nir/nir_gather_info.c
> >     b/src/compiler/nir/nir_gather_info.c
> >     index ac87bec46c..cce64f9c84 100644
> >     --- a/src/compiler/nir/nir_gather_info.c
> >     +++ b/src/compiler/nir/nir_gather_info.c
> >     @@ -212,14 +212,20 @@ gather_intrinsic_info(nir_intrinsic_instr
> >     *instr, nir_shader *shader)
> >               if (!try_mask_partial_io(shader, instr->variables[0]))
> >                  mark_whole_variable(shader, var);
> >
> >     -         /* We need to track which input_reads bits
> correspond to a
> >     -          * dvec3/dvec4 input attribute */
> >     +         /* We need to track which input_reads bits
> correspond to
> >     +          * dvec3/dvec4 or 16-bit  input attributes */
> >               if (shader->stage == MESA_SHADER_VERTEX &&
> >     -             var->data.mode == nir_var_shader_in &&
> >     -           
>  glsl_type_is_dual_slot(glsl_without_array(var->type))) {
> >     -            for (uint i = 0; i <
> >     glsl_count_attribute_slots(var->type, false); i++) {
> >     -               int idx = var->data.location + i;
> >     -               shader->info.double_inputs_read |=
> >     BITFIELD64_BIT(idx);
> >     +             var->data.mode == nir_var_shader_in) {
> >     +            if
> >     (glsl_type_is_dual_slot(glsl_without_array(var->type))) {
> >     +               for (uint i = 0; i <
> >     glsl_count_attribute_slots(var->type, false); i++) {
> >     +                  int idx = var->data.location + i;
> >     +                  shader->info.double_inputs_read |=
> >     BITFIELD64_BIT(idx);
> >     +               }
> >     +            } else if
> >     (glsl_get_bit_size(glsl_without_array(var->type)) == 16) {
> >     +               for (uint i = 0; i <
> >     glsl_count_attribute_slots(var->type, false); i++) {
> >     +                  int idx = var->data.location + i;
> >     +                  shader->info.half_inputs_read |=
> >     BITFIELD64_BIT(idx);
> >     +               }
> >                  }
> >               }
> >            }
> >     @@ -312,6 +318,7 @@ nir_shader_gather_info(nir_shader *shader,
> >     nir_function_impl *entrypoint)
> >         shader->info.outputs_written = 0;
> >         shader->info.outputs_read = 0;
> >         shader->info.double_inputs_read = 0;
> >     +   shader->info.half_inputs_read = 0;
> >         shader->info.patch_inputs_read = 0;
> >         shader->info.patch_outputs_written = 0;
> >         shader->info.system_values_read = 0;
> >     diff --git a/src/compiler/sh

[Mesa-dev] [PATCH] mesa/shaderapi: Do a dry run of linking an in-use program

2017-11-02 Thread Neil Roberts
If an in-use program is unsuccessfully linked, the GL spec requires
that the executable and the uniform state of the program should remain
until a new program is bound. Previously this sort of worked in Mesa
except that it would free the uniform state before attempting to link.
At least on i965 this would usually continue to work because it
accesses the uniform values via a dangling pointer. However it was
causing sporadic failures in one of the CTS tests.

To fix it, when an in-use program is about to be linked, it will now
make a copy of the program and first try to link that instead. If it
works it will let the link continue, otherwise it will copy the status
to the new program and abandon the link. That way the link status and
info log is preserved without freeing the uniform state.

This isn’t very efficient but it would probably quite a big overhaul
to fix it properly and it doesn’t seem worth it because I can’t
imagine that any performance-sensitive application would be hitting
this very strange corner case of the API.

Fixes: KHR-GL46.sepshaderobjs.StateInteraction

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102177
---
 src/mesa/main/shaderapi.c | 58 ++-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 7282435..3f7fe02 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1134,6 +1134,58 @@ _mesa_compile_shader(struct gl_context *ctx, struct 
gl_shader *sh)
}
 }
 
+static bool
+try_link_in_use_program(struct gl_context *ctx,
+struct gl_shader_program *shProg)
+{
+   struct gl_shader_program *shProgCopy = _mesa_new_shader_program(0);
+   bool ret;
+   int i;
+
+   /* If the program is in use then try linking a copy of the program first.
+* If it won’t work then we’ll copy the link status to the old program and
+* abandon the linking. Otherwise we let it relink as normal. This is done
+* because relinking destroys the uniform state of the program but the GL
+* spec actually requires that the state be preserved when the program is
+* in use and the link fails. This isn’t terribly efficent but in practice
+* it is probably not worth optimising because it’s a rather strange corner
+* case of the spec.
+*
+* GLSL 4.6 spec section 7.3:
+*
+* “If a program object that is active for any shader stage is re-linked
+*  unsuccessfully, the link status will be set to FALSE, but any existing
+*  executables and associated state will remain part of the current
+*  rendering state until a subsequent call to UseProgram,
+*  UseProgramStages, or BindProgramPipeline removes them from use.”
+*/
+
+   for (i = 0; i < shProg->NumShaders; i++)
+  attach_shader(ctx, shProgCopy, shProg->Shaders[i]);
+
+   shProgCopy->BinaryRetreivableHint = shProg->BinaryRetreivableHint;
+   shProgCopy->SeparateShader = shProg->SeparateShader;
+
+   _mesa_glsl_link_shader(ctx, shProgCopy);
+
+   if (shProgCopy->data->LinkStatus) {
+  ret = true;
+   } else {
+  shProg->data->LinkStatus = shProgCopy->data->LinkStatus;
+  shProg->data->Validated = shProgCopy->data->Validated;
+  shProg->data->Version = shProgCopy->data->Version;
+  shProg->IsES = shProgCopy->IsES;
+  ralloc_free(shProg->data->InfoLog);
+  shProg->data->InfoLog =
+ ralloc_strdup(shProg->data, shProgCopy->data->InfoLog);
+
+  ret = false;
+   }
+
+   _mesa_reference_shader_program(ctx, &shProgCopy, NULL);
+
+   return ret;
+}
 
 /**
  * Link a program's shaders.
@@ -1159,12 +1211,16 @@ link_program(struct gl_context *ctx, struct 
gl_shader_program *shProg,
}
 
unsigned programs_in_use = 0;
-   if (ctx->_Shader)
+   if (ctx->_Shader) {
   for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
  if (ctx->_Shader->CurrentProgram[stage] &&
  ctx->_Shader->CurrentProgram[stage]->Id == shProg->Name) {
 programs_in_use |= 1 << stage;
  }
+  }
+
+  if (programs_in_use && !try_link_in_use_program(ctx, shProg))
+ return;
}
 
FLUSH_VERTICES(ctx, 0);
-- 
2.9.5

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


[Mesa-dev] [Bug 103505] RX 480, newest mesa, VULKAN Does not start

2017-11-02 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103505

--- Comment #6 from Bas Nieuwenhuizen  ---
As said in comment #1, can you get a backtrace of the segfault?

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


Re: [Mesa-dev] [PATCH v2 4/4] i965/gen10: Implement Wa3DStateMode

2017-11-02 Thread Nanley Chery
On Wed, Nov 01, 2017 at 03:52:15PM -0700, Anuj Phogat wrote:
> V2: Remove the bits enabling Float blend optimization. It is
> enabled through CACHE_MODE_SS register.
> Update the comment.
> 
> This workaround doesn't fix any of the piglit hangs we've seen
> on CNL.
> 

I haven't seen this format in the git logs before..

> Cc: Nanley Chery 
> Cc: Jason Ekstrand 
> Signed-off-by: Anuj Phogat 
> Reviewed-by: Rafael Antognolli 
> ---
>  src/mesa/drivers/dri/i965/brw_defines.h  |  2 ++
>  src/mesa/drivers/dri/i965/brw_state_upload.c | 12 
>  2 files changed, 14 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
> b/src/mesa/drivers/dri/i965/brw_defines.h
> index 3008a1b8a7..1c2f06546e 100644
> --- a/src/mesa/drivers/dri/i965/brw_defines.h
> +++ b/src/mesa/drivers/dri/i965/brw_defines.h
> @@ -1333,6 +1333,8 @@ enum brw_pixel_shader_coverage_mask_mode {
>  /* DW2: start address */
>  /* DW3: end address. */
>  
> +#define _3DSTATE_3D_MODE 0x791e
> +
>  #define CMD_MI_FLUSH  0x0200
>  
>  # define BLT_X_SHIFT 0
> diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c 
> b/src/mesa/drivers/dri/i965/brw_state_upload.c
> index 7df06a6e4d..76c137c90e 100644
> --- a/src/mesa/drivers/dri/i965/brw_state_upload.c
> +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
> @@ -89,6 +89,18 @@ brw_upload_initial_gpu_state(struct brw_context *brw)
>brw_load_register_imm32(brw, GEN10_CACHE_MODE_SS,
>
> REG_MASK(GEN10_FLOAT_BLEND_OPTIMIZATION_ENABLE) |
>GEN10_FLOAT_BLEND_OPTIMIZATION_ENABLE);
> +
> +  /* From gen10 workaround table in h/w specs:
> +   * "On 3DSTATE_3D_MODE, driver must always program bits 31:16 of DW1
> +   *  a value of 0x"
> +   *  This means that we end up setting the entire 3D_MODE state. Bits
> +   *  in this register control things such as slice hashing and we want
> +   *  the default values of zero at the moment.
^ Extra space for the last 3 lines here.

To fit in with similar messages in the codebase, maybe format it like this:

/* From gen10 workaround table in h/w specs:
 *
 *"On 3DSTATE_3D_MODE, driver must always program bits 31:16 of DW1
 * a value of 0x"
 *
 * This means that we end up setting the entire 3D_MODE state. Bits
 * in this register control things such as slice hashing and we want
 * the default values of zero at the moment.
 */

With the commit message and space fixed, this patch is
Reviewed-by: Nanley Chery 

> +   */
> +  BEGIN_BATCH(2);
> +  OUT_BATCH(_3DSTATE_3D_MODE  << 16 | (2 - 2));
> +  OUT_BATCH(0x << 16);
> +  ADVANCE_BATCH();
> }
>  
> if (devinfo->gen >= 8) {
> -- 
> 2.13.5
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] compiler: Mark when input/ouput attribute at VS uses 16-bit (v2)

2017-11-02 Thread Jason Ekstrand
On Thu, Nov 2, 2017 at 11:17 AM, Chema Casanova 
wrote:

>
>
> El 01/11/17 a las 22:07, Jason Ekstrand escribió:
> > On Tue, Oct 17, 2017 at 10:05 AM, Jose Maria Casanova Crespo
> > mailto:jmcasan...@igalia.com>> wrote:
> >
> > New shader attribute to mark when a location has 16-bit
> > value. This patch includes support on mesa glsl and nir.
> >
> > v2: Remove use of is_half_slot as is a duplicate of is_16bit
> > (Topi Pohjolainen)
> > ---
> >  src/compiler/glsl_types.h  | 15 +++
> >  src/compiler/nir/nir_gather_info.c | 21 ++---
> >  src/compiler/shader_info.h |  2 ++
> >  3 files changed, 31 insertions(+), 7 deletions(-)
> >
> > diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
> > index 32399df351..e35e8d8f88 100644
> > --- a/src/compiler/glsl_types.h
> > +++ b/src/compiler/glsl_types.h
> > @@ -93,6 +93,13 @@ static inline bool
> > glsl_base_type_is_integer(enum glsl_base_type type)
> >type == GLSL_TYPE_IMAGE;
> >  }
> >
> > +static inline bool glsl_base_type_is_16bit(enum glsl_base_type type)
> > +{
> > +   return type == GLSL_TYPE_FLOAT16 ||
> > +  type == GLSL_TYPE_UINT16 ||
> > +  type == GLSL_TYPE_INT16;
> > +}
> > +
> >  enum glsl_sampler_dim {
> > GLSL_SAMPLER_DIM_1D = 0,
> > GLSL_SAMPLER_DIM_2D,
> > @@ -555,6 +562,14 @@ struct glsl_type {
> > }
> >
> > /**
> > +* Query whether or not a type is 16-bit
> > +*/
> > +   bool is_16bit() const
> > +   {
> > +  return glsl_base_type_is_16bit(base_type);
> > +   }
> > +
> > +   /**
> >  * Query whether or not a type is a non-array boolean type
> >  */
> > bool is_boolean() const
> > diff --git a/src/compiler/nir/nir_gather_info.c
> > b/src/compiler/nir/nir_gather_info.c
> > index ac87bec46c..cce64f9c84 100644
> > --- a/src/compiler/nir/nir_gather_info.c
> > +++ b/src/compiler/nir/nir_gather_info.c
> > @@ -212,14 +212,20 @@ gather_intrinsic_info(nir_intrinsic_instr
> > *instr, nir_shader *shader)
> >   if (!try_mask_partial_io(shader, instr->variables[0]))
> >  mark_whole_variable(shader, var);
> >
> > - /* We need to track which input_reads bits correspond to a
> > -  * dvec3/dvec4 input attribute */
> > + /* We need to track which input_reads bits correspond to
> > +  * dvec3/dvec4 or 16-bit  input attributes */
> >   if (shader->stage == MESA_SHADER_VERTEX &&
> > - var->data.mode == nir_var_shader_in &&
> > - glsl_type_is_dual_slot(glsl_without_array(var->type)))
> {
> > -for (uint i = 0; i <
> > glsl_count_attribute_slots(var->type, false); i++) {
> > -   int idx = var->data.location + i;
> > -   shader->info.double_inputs_read |=
> > BITFIELD64_BIT(idx);
> > + var->data.mode == nir_var_shader_in) {
> > +if
> > (glsl_type_is_dual_slot(glsl_without_array(var->type))) {
> > +   for (uint i = 0; i <
> > glsl_count_attribute_slots(var->type, false); i++) {
> > +  int idx = var->data.location + i;
> > +  shader->info.double_inputs_read |=
> > BITFIELD64_BIT(idx);
> > +   }
> > +} else if
> > (glsl_get_bit_size(glsl_without_array(var->type)) == 16) {
> > +   for (uint i = 0; i <
> > glsl_count_attribute_slots(var->type, false); i++) {
> > +  int idx = var->data.location + i;
> > +  shader->info.half_inputs_read |=
> > BITFIELD64_BIT(idx);
> > +   }
> >  }
> >   }
> >}
> > @@ -312,6 +318,7 @@ nir_shader_gather_info(nir_shader *shader,
> > nir_function_impl *entrypoint)
> > shader->info.outputs_written = 0;
> > shader->info.outputs_read = 0;
> > shader->info.double_inputs_read = 0;
> > +   shader->info.half_inputs_read = 0;
> > shader->info.patch_inputs_read = 0;
> > shader->info.patch_outputs_written = 0;
> > shader->info.system_values_read = 0;
> > diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
> > index 38413940d6..98111fa1e0 100644
> > --- a/src/compiler/shader_info.h
> > +++ b/src/compiler/shader_info.h
> > @@ -55,6 +55,8 @@ typedef struct shader_info {
> > uint64_t inputs_read;
> > /* Which inputs are actually read and are double */
> > uint64_t double_inputs_read;
> > +   /* Which inputs are actually read and are half */
> > +   uint64_t half_inputs_read;
> >
> >
> > Given that we're flagging this for 16-bit integers, I don't think
> > "half" is really appropriate.  How about 

Re: [Mesa-dev] [PATCH v2 2/4] i965/gen10: Implement WaForceRCPFEHangWorkaround

2017-11-02 Thread Nanley Chery
On Wed, Nov 01, 2017 at 03:49:52PM -0700, Anuj Phogat wrote:
> V2: Add the check for Post Sync Operation.
> Update the workaround comment.
> 

Did you mean to put the V2 hunk after the messsage?

> This workaround doesn't fix any of the piglit hangs we've seen
> on CNL. But it might be fixing something we haven't tested yet.
> 
> Cc: Nanley Chery 
> Signed-off-by: Anuj Phogat 
> Reviewed-by: Rafael Antognolli 
> ---
>  src/mesa/drivers/dri/i965/brw_pipe_control.c | 21 +
>  1 file changed, 21 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_pipe_control.c 
> b/src/mesa/drivers/dri/i965/brw_pipe_control.c
> index 6ebe1443d5..b1975ce533 100644
> --- a/src/mesa/drivers/dri/i965/brw_pipe_control.c
> +++ b/src/mesa/drivers/dri/i965/brw_pipe_control.c
> @@ -89,6 +89,24 @@ gen7_cs_stall_every_four_pipe_controls(struct brw_context 
> *brw, uint32_t flags)
> return 0;
>  }
>  
> +/* #1130 from gen10 workarounds page in h/w specs:
> + * "Enable Depth Stall on every Post Sync Op if Render target Cache Flush is
> + *  not enabled in same PIPE CONTROL and Enable Pixel score board stall if
> + *  Render target cache flush is enabled."
> + *
> + * Applicable to CNL B0 and C0 steppings only.
> + */
> +static void
> +gen10_add_rcpfe_workaround_bits(uint32_t *flags)
> +{
> +   if (*flags & PIPE_CONTROL_RENDER_TARGET_FLUSH)
> +  *flags = *flags | PIPE_CONTROL_STALL_AT_SCOREBOARD;
> +   else if ((*flags & PIPE_CONTROL_WRITE_IMMEDIATE) ||
> +(*flags & PIPE_CONTROL_WRITE_DEPTH_COUNT) ||
> +(*flags & PIPE_CONTROL_WRITE_TIMESTAMP))
> +  *flags = *flags | PIPE_CONTROL_DEPTH_STALL;

I think we usually use braces in multi-line if-statements.

How about:
   } else if (*flags & (PIPE_CONTROL_WRITE_IMMEDIATE |
PIPE_CONTROL_WRITE_DEPTH_COUNT |
PIPE_CONTROL_WRITE_TIMESTAMP)) {



With the commit message fixed and braces included, this patch is
Reviewed-by: Nanley Chery 

> +}
> +
>  static void
>  brw_emit_pipe_control(struct brw_context *brw, uint32_t flags,
>struct brw_bo *bo, uint32_t offset, uint64_t imm)
> @@ -109,6 +127,9 @@ brw_emit_pipe_control(struct brw_context *brw, uint32_t 
> flags,
>   brw_emit_pipe_control_flush(brw, 0);
>}
>  
> +  if (devinfo->gen == 10)
> + gen10_add_rcpfe_workaround_bits(&flags);
> +
>BEGIN_BATCH(6);
>OUT_BATCH(_3DSTATE_PIPE_CONTROL | (6 - 2));
>OUT_BATCH(flags);
> -- 
> 2.13.5
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] compiler: Mark when input/ouput attribute at VS uses 16-bit (v2)

2017-11-02 Thread Chema Casanova


El 01/11/17 a las 22:07, Jason Ekstrand escribió:
> On Tue, Oct 17, 2017 at 10:05 AM, Jose Maria Casanova Crespo
> mailto:jmcasan...@igalia.com>> wrote:
>
> New shader attribute to mark when a location has 16-bit
> value. This patch includes support on mesa glsl and nir.
>
> v2: Remove use of is_half_slot as is a duplicate of is_16bit
>     (Topi Pohjolainen)
> ---
>  src/compiler/glsl_types.h          | 15 +++
>  src/compiler/nir/nir_gather_info.c | 21 ++---
>  src/compiler/shader_info.h         |  2 ++
>  3 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
> index 32399df351..e35e8d8f88 100644
> --- a/src/compiler/glsl_types.h
> +++ b/src/compiler/glsl_types.h
> @@ -93,6 +93,13 @@ static inline bool
> glsl_base_type_is_integer(enum glsl_base_type type)
>            type == GLSL_TYPE_IMAGE;
>  }
>
> +static inline bool glsl_base_type_is_16bit(enum glsl_base_type type)
> +{
> +   return type == GLSL_TYPE_FLOAT16 ||
> +          type == GLSL_TYPE_UINT16 ||
> +          type == GLSL_TYPE_INT16;
> +}
> +
>  enum glsl_sampler_dim {
>     GLSL_SAMPLER_DIM_1D = 0,
>     GLSL_SAMPLER_DIM_2D,
> @@ -555,6 +562,14 @@ struct glsl_type {
>     }
>
>     /**
> +    * Query whether or not a type is 16-bit
> +    */
> +   bool is_16bit() const
> +   {
> +      return glsl_base_type_is_16bit(base_type);
> +   }
> +
> +   /**
>      * Query whether or not a type is a non-array boolean type
>      */
>     bool is_boolean() const
> diff --git a/src/compiler/nir/nir_gather_info.c
> b/src/compiler/nir/nir_gather_info.c
> index ac87bec46c..cce64f9c84 100644
> --- a/src/compiler/nir/nir_gather_info.c
> +++ b/src/compiler/nir/nir_gather_info.c
> @@ -212,14 +212,20 @@ gather_intrinsic_info(nir_intrinsic_instr
> *instr, nir_shader *shader)
>           if (!try_mask_partial_io(shader, instr->variables[0]))
>              mark_whole_variable(shader, var);
>
> -         /* We need to track which input_reads bits correspond to a
> -          * dvec3/dvec4 input attribute */
> +         /* We need to track which input_reads bits correspond to
> +          * dvec3/dvec4 or 16-bit  input attributes */
>           if (shader->stage == MESA_SHADER_VERTEX &&
> -             var->data.mode == nir_var_shader_in &&
> -             glsl_type_is_dual_slot(glsl_without_array(var->type))) {
> -            for (uint i = 0; i <
> glsl_count_attribute_slots(var->type, false); i++) {
> -               int idx = var->data.location + i;
> -               shader->info.double_inputs_read |=
> BITFIELD64_BIT(idx);
> +             var->data.mode == nir_var_shader_in) {
> +            if
> (glsl_type_is_dual_slot(glsl_without_array(var->type))) {
> +               for (uint i = 0; i <
> glsl_count_attribute_slots(var->type, false); i++) {
> +                  int idx = var->data.location + i;
> +                  shader->info.double_inputs_read |=
> BITFIELD64_BIT(idx);
> +               }
> +            } else if
> (glsl_get_bit_size(glsl_without_array(var->type)) == 16) {
> +               for (uint i = 0; i <
> glsl_count_attribute_slots(var->type, false); i++) {
> +                  int idx = var->data.location + i;
> +                  shader->info.half_inputs_read |=
> BITFIELD64_BIT(idx);
> +               }
>              }
>           }
>        }
> @@ -312,6 +318,7 @@ nir_shader_gather_info(nir_shader *shader,
> nir_function_impl *entrypoint)
>     shader->info.outputs_written = 0;
>     shader->info.outputs_read = 0;
>     shader->info.double_inputs_read = 0;
> +   shader->info.half_inputs_read = 0;
>     shader->info.patch_inputs_read = 0;
>     shader->info.patch_outputs_written = 0;
>     shader->info.system_values_read = 0;
> diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
> index 38413940d6..98111fa1e0 100644
> --- a/src/compiler/shader_info.h
> +++ b/src/compiler/shader_info.h
> @@ -55,6 +55,8 @@ typedef struct shader_info {
>     uint64_t inputs_read;
>     /* Which inputs are actually read and are double */
>     uint64_t double_inputs_read;
> +   /* Which inputs are actually read and are half */
> +   uint64_t half_inputs_read;
>
>
> Given that we're flagging this for 16-bit integers, I don't think
> "half" is really appropriate.  How about just 16bit_inputs_read?

I thought about that, but we can not do that. As the C restriction of
variable names starting with alphabet or underscore. As the logic was
the same as for double I didn't want to go for a inputs_read_16bits. I
didn't come up with a better name. :(

>  
>
>   

Re: [Mesa-dev] [PATCH 2/3] gbm: Don't traverse backwards for includes

2017-11-02 Thread Dylan Baker
Quoting Emil Velikov (2017-11-02 11:04:44)
> On 2 November 2017 at 16:53, Dylan Baker  wrote:
> > Quoting Emil Velikov (2017-11-02 06:21:09)
> >> On 21 October 2017 at 02:00, Dylan Baker  wrote:
> >> > This is just a terrible idea, but it also needs to be fixed for the next
> >> > patch to work, so let's fix it right.
> >> >
> >> Please rework the commit message. Perhaps something alike
> >> 1b1bb6ee103a79de11aa4941ccbcd34f0a158276?
> >>
> >> > Signed-off-by: Dylan Baker 
> >> > ---
> >> >  src/gbm/Makefile.am| 4 +++-
> >> >  src/gbm/backends/dri/gbm_dri.c | 2 +-
> >> >  src/gbm/meson.build| 6 +++---
> >> >  3 files changed, 7 insertions(+), 5 deletions(-)
> >> >
> >> > diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
> >> > index 805208a3ca9..05d861ff999 100644
> >> > --- a/src/gbm/Makefile.am
> >> > +++ b/src/gbm/Makefile.am
> >> > @@ -31,7 +31,9 @@ libgbm_la_LIBADD = \
> >> > $(DLOPEN_LIBS)
> >> >
> >> >  if HAVE_PLATFORM_WAYLAND
> >> > -AM_CFLAGS += $(WAYLAND_SERVER_CFLAGS)
> >> > +AM_CFLAGS += \
> >> > +   $(WAYLAND_SERVER_CFLAGS) \
> >> > +   -I$(top_srcdir)/src/egl/wayland/wayland-drm/
> >> >  libgbm_la_LIBADD += 
> >> > $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la 
> >> > $(WAYLAND_SERVER_LIBS)
> >> This might cause a trivial merge/rebase conflict.
> >>
> >> >  endif
> >> >
> >> > diff --git a/src/gbm/backends/dri/gbm_dri.c 
> >> > b/src/gbm/backends/dri/gbm_dri.c
> >> > index 0a4853bf63d..b2121cbc340 100644
> >> > --- a/src/gbm/backends/dri/gbm_dri.c
> >> > +++ b/src/gbm/backends/dri/gbm_dri.c
> >> > @@ -53,7 +53,7 @@
> >> >
> >> >  /* For importing wl_buffer */
> >> >  #if HAVE_WAYLAND_PLATFORM
> >> > -#include "../../../egl/wayland/wayland-drm/wayland-drm.h"
> >> > +#include "wayland-drm.h"
> >> >  #endif
> >> >
> >> >  #ifndef DRM_FORMAT_MOD_INVALID
> >> > diff --git a/src/gbm/meson.build b/src/gbm/meson.build
> >> > index 1bb3c94c387..2910fa2390c 100644
> >> > --- a/src/gbm/meson.build
> >> > +++ b/src/gbm/meson.build
> >> > @@ -31,6 +31,7 @@ deps_gbm = []
> >> >  args_gbm = []
> >> >  links_gbm = []
> >> >  deps_gbm = []
> >> > +incs_gbm = [include_directories('main'), inc_include, inc_src, 
> >> > inc_loader]
> >> >
> >> >  if with_dri2
> >> >files_gbm += files('backends/dri/gbm_dri.c', 
> >> > 'backends/dri/gbm_driint.h')
> >> > @@ -40,6 +41,7 @@ endif
> >> >  if with_platform_wayland
> >> >deps_gbm += dep_wayland_server
> >> >links_gbm += libwayland_drm
> >> > +  incs_gbm += include_directories('../egl/wayland/wayland-drm')
> >> This looks quite ugly IMHO... Surely meson has the concept of
> >> top_{build,src}dir?
> >> Quick grep shows a few move cases like these. Were those
> >> butchered/inspired by the autotools build?
> >
> > meson specifically does not allow passing absolute paths to 
> > include_directories,
> > since you can assign includes to variables I assume. I can just create an
> > "inc_wayland_drm" instead.
> >
> top_{build,src}dir are not absolute - top_abs{build,src}dir are.
> 
> Normally one would want to consistently use
> $top/relative/path/to/something as opposed to having things relative
> to pwd.
> Regardless, I'm not the best person to listen to about meson best practises 
> :-)
> 
> -Emil

Meson's equivalents (meson.source_dir(), meson.build_dir()) return absolute
paths. Meson upstream also considers their uses a hack, and in general if you
need them it means that meson itself is missing some functionality. In general
the way the meson wants you to do this is assign an include_directories() object
at a lower level, like we do with the include directory (as inc_include).

Dylan


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


Re: [Mesa-dev] [PATCH 12/13] meson: build gallium va state tracker

2017-11-02 Thread Dylan Baker
Quoting Emil Velikov (2017-11-02 05:59:40)
> On 1 November 2017 at 22:49, Dylan Baker  wrote:
> > ---
> >  meson.build   | 35 +-
> >  meson_options.txt | 13 ++
> >  src/gallium/meson.build   |  7 ++-
> >  src/gallium/state_trackers/va/meson.build | 39 
> >  src/gallium/targets/va/meson.build| 78 
> > +++
> >  5 files changed, 170 insertions(+), 2 deletions(-)
> >  create mode 100644 src/gallium/state_trackers/va/meson.build
> >  create mode 100644 src/gallium/targets/va/meson.build
> >
> > diff --git a/meson.build b/meson.build
> > index 32b9d96e5be..582ee1d45f1 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -417,6 +417,38 @@ if with_gallium_omx
> >endif
> >  endif
> >
> > +dep_va = []
> > +_va = get_option('gallium-va')
> > +if _va == 'auto'
> > +  if not ['linux', 'bsd'].contains(host_machine.system())
> > +with_gallium_va = false
> > +  elif not with_platform_x11
> > +with_gallium_va = false
> > +  elif not (with_gallium_r600 or with_gallium_radeonsi or 
> > with_gallium_nouveau)
> > +with_gallium_va = false
> > +  else
> > +dep_va = dependency('libva', version : '>= 0.38.0', required : false)
> > +with_gallium_va = dep_va.found()
> > +  endif
> > +elif _va == 'true'
> > +  if not ['linux', 'bsd'].contains(host_machine.system())
> > +error('VA state tracker can only be built on unix-like OSes.')
> > +  elif not (with_platform_x11 or with_platform_drm)
> > +error('VA state tracker requires X11 or drm or wayland platform 
> > support.')
> > +with_gallium_va = false
> > +  elif not (with_gallium_r600 or with_gallium_radeonsi or 
> > with_gallium_nouveau)
> > +error('VA state tracker requires at least one of the following gallium 
> > drivers: r600, radeonsi, nouveau.')
> > +  endif
> > +  dep_va = dependency('libva', version : '>= 0.38.0')
> > +else
> > +  with_gallium_va = false
> > +endif
> > +
> > +va_drivers_path = get_option('va-libs-path')
> > +if va_drivers_path == ''
> > +  va_drivers_path = join_paths(get_option('libdir'), 'dri')
> > +endif
> > +
> >  gl_pkgconfig_c_flags = []
> >  if with_platform_x11
> >if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
> > @@ -924,7 +956,8 @@ if with_platform_x11
> >  dep_xxf86vm = dependency('xxf86vm', required : false)
> >endif
> >if (with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm') or
> > -  (with_gallium_vdpau or with_gallium_xvmc or with_gallium_omx))
> > +  (with_gallium_vdpau or with_gallium_xvmc or with_gallium_omx or
> > +   with_gallium_xa))
> >  dep_xcb = dependency('xcb')
> >  dep_x11_xcb = dependency('x11-xcb')
> >  dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
> > diff --git a/meson_options.txt b/meson_options.txt
> > index f0cb73a89eb..497242cf532 100644
> > --- a/meson_options.txt
> > +++ b/meson_options.txt
> > @@ -88,6 +88,19 @@ option(
> >value : '',
> >description : 'path to put omx libraries. defaults to omx-bellagio 
> > pkg-config pluginsdir.'
> >  )
> > +option(
> > +  'gallium-va',
> > +  type : 'combo',
> > +  value : 'auto',
> > +  choices : ['auto', 'true', 'false'],
> > +  description : 'enable gallium va state tracker.',
> > +)
> > +option(
> > +  'va-libs-path',
> > +  type : 'string',
> > +  value : '',
> > +  description : 'path to put va libraries. defaults to $libdir/dri.'
> > +)
> >  option(
> >'vulkan-drivers',
> >type : 'string',
> > diff --git a/src/gallium/meson.build b/src/gallium/meson.build
> > index 49e3d72114b..1dc646bf28f 100644
> > --- a/src/gallium/meson.build
> > +++ b/src/gallium/meson.build
> > @@ -104,6 +104,9 @@ endif
> >  if with_gallium_omx
> >subdir('state_trackers/omx_bellagio')
> >  endif
> > +if with_gallium_va
> > +  subdir('state_trackers/va')
> > +endif
> >  # TODO: SWR
> >  # TODO: virgl
> >  # TODO: winsys/sw/xlib
> > @@ -123,8 +126,10 @@ endif
> >  if with_gallium_omx
> >subdir('targets/omx-bellagio')
> >  endif
> > +if with_gallium_va
> > +  subdir('targets/va')
> > +endif
> >  # TODO: xlib-glx
> > -# TODO: VA
> >  # TODO: xa
> >  # TODO: nine
> >  # TODO: tests
> > diff --git a/src/gallium/state_trackers/va/meson.build 
> > b/src/gallium/state_trackers/va/meson.build
> > new file mode 100644
> > index 000..7770bc48066
> > --- /dev/null
> > +++ b/src/gallium/state_trackers/va/meson.build
> > @@ -0,0 +1,39 @@
> > +# Copyright © 2017 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 

Re: [Mesa-dev] Meson's default build type

2017-11-02 Thread Eric Engestrom
On Thursday, 2017-11-02 17:39:53 +, Eric Engestrom wrote:
> On Thursday, 2017-11-02 09:46:05 -0700, Chad Versace wrote:
> > On Wed 01 Nov 2017, Dylan Baker wrote:
> > > Quoting Ilia Mirkin (2017-11-01 16:05:17)
> > > > On Wed, Nov 1, 2017 at 7:03 PM, Dylan Baker  wrote:
> > > > > Quoting Ilia Mirkin (2017-11-01 15:52:56)
> > > > >> On Wed, Nov 1, 2017 at 6:49 PM, Chad Versace 
> > > > >>  wrote:
> > > > >> > On Wed 01 Nov 2017, Dylan Baker wrote:
> > > > >> >> Quoting Chad Versace (2017-11-01 14:43:28)
> > > > >> >> > Wow. 10 seconds from a clean checkout to an installed Vulkan 
> > > > >> >> > driver.
> > > > >> >
> > > > >> >> Glad that it's working out for you guys!
> > > > >> >>
> > > > >> >> Can I convince you to wire the anvil and i965 android/arc++ bits? 
> > > > >> >> ;)
> > > > >> >>
> > > > >> >> JFYI, the meson build will (I consider it a bug if it doesn't) 
> > > > >> >> turn off all
> > > > >> >> glapi, egl, and glx if there are no dri or gallium drivers built 
> > > > >> >> unless you
> > > > >> >> force them on.
> > > > >> >
> > > > >> > Thanks for turning that stuff off. Last time I tried to build just
> > > > >> > Vulkan without GL (maybe 1.5 years ago), Autotools didn't allow 
> > > > >> > it. It
> > > > >> > insisted that i965 was a build dependency for anvil.
> > > > >> >
> > > > >> >> It also avoids building the glsl compiler unless there's a driver
> > > > >> >> that uses it.
> > > > >> >
> > > > >> > I expected the buildtime to be much longer because I expected it to
> > > > >> > build the GLSL compiler too. I was surprised and happy to discover 
> > > > >> > that
> > > > >> > it builds only the SPIR-V compiler.
> > > > >> >
> > > > >> >> And it defaults to debug, which might be surprising, but people
> > > > >> >> around here thought that default debug is a feature.
> > > > >> >
> > > > >> > Huh... For infrastructure projects like Mesa (as opposed to test
> > > > >> > projects like Piglit), I expect the default build to be the release
> > > > >> > build. But I can understand why others would want default=debug.
> > > > >>
> > > > >> autotools defaults to debug disabled. I think that's how almost every
> > > > >> project does it... debug enabled is definitely a surprise.
> > > > >>
> > > > >>   -ilia
> > > > >
> > > > > Well, for distros they likely want to set the buildtype to plain 
> > > > > (meson adds no
> > > > > compiler flags except ones the project defines), and then add their 
> > > > > default
> > > > > flags via CFLAGS and CXXFLAGS. That is certainly *not* what anyone 
> > > > > except a
> > > > > distro (or some kind of build infrastructure like jenkins or gentoo) 
> > > > > would want.
> > > > > Xorg's default is debugoptimzed, for reference.
> > > > 
> > > > --enable-debug enables -DDEBUG in mesa. Are you saying that this is
> > > > the default? Or are you just saying that you're not adding extra
> > > > -O100073 options?
> > > 
> > > The meson build keys -DDEBUG on the builtype, debug or debugoptimized you 
> > > get
> > > -DDEBUG, anything else, you don't. The way mesa is setup if you don't have
> > > -DNDEBUG you have to have -DDEBUG or asserts happen for member of 
> > > structures
> > > that don't exist.
> > > 
> > > I'm not dead set on debug as the default buildtype, it's what we have ATM
> > > though. I asked around here and the feeling was that builtype debug by 
> > > default
> > > was a feature. If the larger community disagrees we can change it.
> > 
> > When making this decision, I think we should also consider the needs of
> > non-developers who build and install Mesa from source to get the latest
> > version or bugfix. I strongly suspect those people want
> > buildtype=debugoptimized or buildtype=release.
> > 
> > I think it's important for Mesa to follow the established convention of
> > most other Linux projects: if a user downloads the source, builds, and
> > installs, then the user gets a working installation suitable for normal
> > usage. Today, Meson doesn't give that because it builds Mesa with -O0.
> > 
> > Some context... I install a lot of packages from source on my work
> > machine because I often want or need newer versions of some packages
> > than what's available through the package manager.
> 
> How do you ensure it integrates correctly with your system [1], other
> than by using the package manager's package and updating the version
> number locally?
> 
>   [1] by "integrate" I mean things like installing things in the right
>   locations, removing stale files from old packages, providing new
>   dependencies for other packages, etc.
> 
> I also install newer version of stuff on various machines, but if I had
> to configure each project manually to integrate with my system, then
> I would just give up. That burden does not scale :P
> 
> The only way I can make this work is by grabbing the existing package,
> bumping the version and recompiling it. Part of the configuration set in
> the package is the various optimisation flags, be tha

Re: [Mesa-dev] [PATCH 2/3] gbm: Don't traverse backwards for includes

2017-11-02 Thread Emil Velikov
On 2 November 2017 at 16:53, Dylan Baker  wrote:
> Quoting Emil Velikov (2017-11-02 06:21:09)
>> On 21 October 2017 at 02:00, Dylan Baker  wrote:
>> > This is just a terrible idea, but it also needs to be fixed for the next
>> > patch to work, so let's fix it right.
>> >
>> Please rework the commit message. Perhaps something alike
>> 1b1bb6ee103a79de11aa4941ccbcd34f0a158276?
>>
>> > Signed-off-by: Dylan Baker 
>> > ---
>> >  src/gbm/Makefile.am| 4 +++-
>> >  src/gbm/backends/dri/gbm_dri.c | 2 +-
>> >  src/gbm/meson.build| 6 +++---
>> >  3 files changed, 7 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
>> > index 805208a3ca9..05d861ff999 100644
>> > --- a/src/gbm/Makefile.am
>> > +++ b/src/gbm/Makefile.am
>> > @@ -31,7 +31,9 @@ libgbm_la_LIBADD = \
>> > $(DLOPEN_LIBS)
>> >
>> >  if HAVE_PLATFORM_WAYLAND
>> > -AM_CFLAGS += $(WAYLAND_SERVER_CFLAGS)
>> > +AM_CFLAGS += \
>> > +   $(WAYLAND_SERVER_CFLAGS) \
>> > +   -I$(top_srcdir)/src/egl/wayland/wayland-drm/
>> >  libgbm_la_LIBADD += 
>> > $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la 
>> > $(WAYLAND_SERVER_LIBS)
>> This might cause a trivial merge/rebase conflict.
>>
>> >  endif
>> >
>> > diff --git a/src/gbm/backends/dri/gbm_dri.c 
>> > b/src/gbm/backends/dri/gbm_dri.c
>> > index 0a4853bf63d..b2121cbc340 100644
>> > --- a/src/gbm/backends/dri/gbm_dri.c
>> > +++ b/src/gbm/backends/dri/gbm_dri.c
>> > @@ -53,7 +53,7 @@
>> >
>> >  /* For importing wl_buffer */
>> >  #if HAVE_WAYLAND_PLATFORM
>> > -#include "../../../egl/wayland/wayland-drm/wayland-drm.h"
>> > +#include "wayland-drm.h"
>> >  #endif
>> >
>> >  #ifndef DRM_FORMAT_MOD_INVALID
>> > diff --git a/src/gbm/meson.build b/src/gbm/meson.build
>> > index 1bb3c94c387..2910fa2390c 100644
>> > --- a/src/gbm/meson.build
>> > +++ b/src/gbm/meson.build
>> > @@ -31,6 +31,7 @@ deps_gbm = []
>> >  args_gbm = []
>> >  links_gbm = []
>> >  deps_gbm = []
>> > +incs_gbm = [include_directories('main'), inc_include, inc_src, inc_loader]
>> >
>> >  if with_dri2
>> >files_gbm += files('backends/dri/gbm_dri.c', 
>> > 'backends/dri/gbm_driint.h')
>> > @@ -40,6 +41,7 @@ endif
>> >  if with_platform_wayland
>> >deps_gbm += dep_wayland_server
>> >links_gbm += libwayland_drm
>> > +  incs_gbm += include_directories('../egl/wayland/wayland-drm')
>> This looks quite ugly IMHO... Surely meson has the concept of
>> top_{build,src}dir?
>> Quick grep shows a few move cases like these. Were those
>> butchered/inspired by the autotools build?
>
> meson specifically does not allow passing absolute paths to 
> include_directories,
> since you can assign includes to variables I assume. I can just create an
> "inc_wayland_drm" instead.
>
top_{build,src}dir are not absolute - top_abs{build,src}dir are.

Normally one would want to consistently use
$top/relative/path/to/something as opposed to having things relative
to pwd.
Regardless, I'm not the best person to listen to about meson best practises :-)

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


Re: [Mesa-dev] [PATCH v2 1/4] i965/gen10: Implement WaSampleOffsetIZ workaround

2017-11-02 Thread Nanley Chery
On Wed, Nov 01, 2017 at 03:48:25PM -0700, Anuj Phogat wrote:
> There are few other (duplicate) workarounds which have similar 
> recommendations:
> WaFlushHangWhenNonPipelineStateAndMarkerStalled
> WaCSStallBefore3DSamplePattern
> WaPipeControlBefore3DStateSamplePattern
> 
> WaPipeControlBefore3DStateSamplePattern has some extra recommendations if
> driver is using mid batch context restore. Ignoring it for now because We're
> not doing mid-batch context restore in Mesa.
> 
> This workaround doesn't fix any of the piglit hangs we've seen
> on CNL. But it might be fixing something we haven't tested yet.
> 
> V2: Use brw_load_register_imm32() to program CACHE_MODE_0.
> Get rid of brw_flush_gpu_caches().
> 
> Cc: Nanley Chery 
> Signed-off-by: Anuj Phogat 
> Reviewed-by: Rafael Antognolli 
> ---
>  src/mesa/drivers/dri/i965/brw_context.h|  2 ++
>  src/mesa/drivers/dri/i965/brw_defines.h|  1 +
>  src/mesa/drivers/dri/i965/brw_pipe_control.c   | 41 
> ++
>  src/mesa/drivers/dri/i965/gen8_multisample_state.c |  8 +
>  4 files changed, 52 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
> b/src/mesa/drivers/dri/i965/brw_context.h
> index 0102f15424..1030b2b313 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -1656,6 +1656,8 @@ void brw_emit_post_sync_nonzero_flush(struct 
> brw_context *brw);
>  void brw_emit_depth_stall_flushes(struct brw_context *brw);
>  void gen7_emit_vs_workaround_flush(struct brw_context *brw);
>  void gen7_emit_cs_stall_flush(struct brw_context *brw);
> +void gen10_emit_wa_cs_stall_flush(struct brw_context *brw);
> +void gen10_emit_wa_lri_to_cache_mode_zero(struct brw_context *brw);

These functions are only used in one file. What do you think about
making them static?

>  
>  /* brw_queryformat.c */
>  void brw_query_internal_format(struct gl_context *ctx, GLenum target,
> diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
> b/src/mesa/drivers/dri/i965/brw_defines.h
> index 4abb790612..270cdf29db 100644
> --- a/src/mesa/drivers/dri/i965/brw_defines.h
> +++ b/src/mesa/drivers/dri/i965/brw_defines.h
> @@ -1609,6 +1609,7 @@ enum brw_pixel_shader_coverage_mask_mode {
>  #define GEN7_GPGPU_DISPATCHDIMY 0x2504
>  #define GEN7_GPGPU_DISPATCHDIMZ 0x2508
>  
> +#define GEN7_CACHE_MODE_0   0x7000
>  #define GEN7_CACHE_MODE_1   0x7004
>  # define GEN9_FLOAT_BLEND_OPTIMIZATION_ENABLE (1 << 4)
>  # define GEN8_HIZ_NP_PMA_FIX_ENABLE(1 << 11)
> diff --git a/src/mesa/drivers/dri/i965/brw_pipe_control.c 
> b/src/mesa/drivers/dri/i965/brw_pipe_control.c
> index 460b8f73b6..6ebe1443d5 100644
> --- a/src/mesa/drivers/dri/i965/brw_pipe_control.c
> +++ b/src/mesa/drivers/dri/i965/brw_pipe_control.c
> @@ -279,6 +279,47 @@ gen7_emit_cs_stall_flush(struct brw_context *brw)
>  }
>  
>  /**
> + * From Gen10 Workarounds page in h/w specs:
> + * WaSampleOffsetIZ:
> + * Prior to the 3DSTATE_SAMPLE_PATTERN driver must ensure there are no
> + * markers in the pipeline by programming a PIPE_CONTROL with stall.
> + */
> +void
> +gen10_emit_wa_cs_stall_flush(struct brw_context *brw)
> +{
> +   const struct gen_device_info *devinfo = &brw->screen->devinfo;

While build-testing this with a release build, I expected the compiler
to emit an unused variable warning for the devinfo variables, but for
some reason it did not.

With or without those minor points addressed, this patch is
Reviewed-by: Nanley Chery 

> +   assert(devinfo->gen == 10);
> +   brw_emit_pipe_control_flush(brw,
> +   PIPE_CONTROL_CS_STALL |
> +   PIPE_CONTROL_STALL_AT_SCOREBOARD);
> +}
> +
> +/**
> + * From Gen10 Workarounds page in h/w specs:
> + * WaSampleOffsetIZ:
> + * When 3DSTATE_SAMPLE_PATTERN is programmed, driver must then issue an
> + * MI_LOAD_REGISTER_IMM command to an offset between 0x7000 and 0x7FFF(SVL)
> + * after the command to ensure the state has been delivered prior to any
> + * command causing a marker in the pipeline.
> + */
> +void
> +gen10_emit_wa_lri_to_cache_mode_zero(struct brw_context *brw)
> +{
> +   const struct gen_device_info *devinfo = &brw->screen->devinfo;
> +   assert(devinfo->gen == 10);
> +
> +   /* Before changing the value of CACHE_MODE_0 register, GFX pipeline must
> +* be idle; i.e., full flush is required.
> +*/
> +   brw_emit_pipe_control_flush(brw,
> +   PIPE_CONTROL_CACHE_FLUSH_BITS |
> +   PIPE_CONTROL_CACHE_INVALIDATE_BITS);
> +
> +   /* Write to CACHE_MODE_0 (0x7000) */
> +   brw_load_register_imm32(brw, GEN7_CACHE_MODE_0, 0);
> +}
> +
> +/**
>   * Emits a PIPE_CONTROL with a non-zero post-sync operation, for
>   * implementing two workarounds on gen6.  From section 1.4.7.1
>   * "PIPE_CONTROL" of the Sandy Bridge PRM volume 2 part 1:
> diff --git a/src/mesa/drivers/dri/i965/gen8_multisample_state.c 
> b/

Re: [Mesa-dev] Meson's default build type

2017-11-02 Thread Eric Engestrom
On Thursday, 2017-11-02 09:46:05 -0700, Chad Versace wrote:
> On Wed 01 Nov 2017, Dylan Baker wrote:
> > Quoting Ilia Mirkin (2017-11-01 16:05:17)
> > > On Wed, Nov 1, 2017 at 7:03 PM, Dylan Baker  wrote:
> > > > Quoting Ilia Mirkin (2017-11-01 15:52:56)
> > > >> On Wed, Nov 1, 2017 at 6:49 PM, Chad Versace 
> > > >>  wrote:
> > > >> > On Wed 01 Nov 2017, Dylan Baker wrote:
> > > >> >> Quoting Chad Versace (2017-11-01 14:43:28)
> > > >> >> > Wow. 10 seconds from a clean checkout to an installed Vulkan 
> > > >> >> > driver.
> > > >> >
> > > >> >> Glad that it's working out for you guys!
> > > >> >>
> > > >> >> Can I convince you to wire the anvil and i965 android/arc++ bits? ;)
> > > >> >>
> > > >> >> JFYI, the meson build will (I consider it a bug if it doesn't) turn 
> > > >> >> off all
> > > >> >> glapi, egl, and glx if there are no dri or gallium drivers built 
> > > >> >> unless you
> > > >> >> force them on.
> > > >> >
> > > >> > Thanks for turning that stuff off. Last time I tried to build just
> > > >> > Vulkan without GL (maybe 1.5 years ago), Autotools didn't allow it. 
> > > >> > It
> > > >> > insisted that i965 was a build dependency for anvil.
> > > >> >
> > > >> >> It also avoids building the glsl compiler unless there's a driver
> > > >> >> that uses it.
> > > >> >
> > > >> > I expected the buildtime to be much longer because I expected it to
> > > >> > build the GLSL compiler too. I was surprised and happy to discover 
> > > >> > that
> > > >> > it builds only the SPIR-V compiler.
> > > >> >
> > > >> >> And it defaults to debug, which might be surprising, but people
> > > >> >> around here thought that default debug is a feature.
> > > >> >
> > > >> > Huh... For infrastructure projects like Mesa (as opposed to test
> > > >> > projects like Piglit), I expect the default build to be the release
> > > >> > build. But I can understand why others would want default=debug.
> > > >>
> > > >> autotools defaults to debug disabled. I think that's how almost every
> > > >> project does it... debug enabled is definitely a surprise.
> > > >>
> > > >>   -ilia
> > > >
> > > > Well, for distros they likely want to set the buildtype to plain (meson 
> > > > adds no
> > > > compiler flags except ones the project defines), and then add their 
> > > > default
> > > > flags via CFLAGS and CXXFLAGS. That is certainly *not* what anyone 
> > > > except a
> > > > distro (or some kind of build infrastructure like jenkins or gentoo) 
> > > > would want.
> > > > Xorg's default is debugoptimzed, for reference.
> > > 
> > > --enable-debug enables -DDEBUG in mesa. Are you saying that this is
> > > the default? Or are you just saying that you're not adding extra
> > > -O100073 options?
> > 
> > The meson build keys -DDEBUG on the builtype, debug or debugoptimized you 
> > get
> > -DDEBUG, anything else, you don't. The way mesa is setup if you don't have
> > -DNDEBUG you have to have -DDEBUG or asserts happen for member of structures
> > that don't exist.
> > 
> > I'm not dead set on debug as the default buildtype, it's what we have ATM
> > though. I asked around here and the feeling was that builtype debug by 
> > default
> > was a feature. If the larger community disagrees we can change it.
> 
> When making this decision, I think we should also consider the needs of
> non-developers who build and install Mesa from source to get the latest
> version or bugfix. I strongly suspect those people want
> buildtype=debugoptimized or buildtype=release.
> 
> I think it's important for Mesa to follow the established convention of
> most other Linux projects: if a user downloads the source, builds, and
> installs, then the user gets a working installation suitable for normal
> usage. Today, Meson doesn't give that because it builds Mesa with -O0.
> 
> Some context... I install a lot of packages from source on my work
> machine because I often want or need newer versions of some packages
> than what's available through the package manager.

How do you ensure it integrates correctly with your system [1], other
than by using the package manager's package and updating the version
number locally?

  [1] by "integrate" I mean things like installing things in the right
  locations, removing stale files from old packages, providing new
  dependencies for other packages, etc.

I also install newer version of stuff on various machines, but if I had
to configure each project manually to integrate with my system, then
I would just give up. That burden does not scale :P

The only way I can make this work is by grabbing the existing package,
bumping the version and recompiling it. Part of the configuration set in
the package is the various optimisation flags, be that through
buildtype=release or buildtype=plain + manual cflags.

(Note that for Meson, Arch provides a wrapper [2] that sets all the
options to the right values for ease of use.)
[2] https://git.archlinux.org/svntogit/packages.git/tree/meson/trunk/arch-meson

> For most of those
> pack

Re: [Mesa-dev] Meson's default build type

2017-11-02 Thread Dylan Baker
Quoting Matt Turner (2017-11-02 10:06:43)
> On Thu, Nov 2, 2017 at 9:51 AM, Michel Dänzer  wrote:
> > FWIW, my vote is for debugoptimized: Assertions are enabled and there's
> > debugging information useful for bug reports, but performance should be
> > decent.
> 
> If debugoptimized turns on DEBUG, then I don't think performance will
> be decent as that enables paths like nir_validate. Maybe we should
> change debugoptimized to not do that. Not sure.
> 
> I think some of the messaging got confused -- autotools does specify
> -g in the default CFLAGS, but that doesn't really mean it's a useful
> debug build. -g -O2 is really a release build, with debugging symbols.

debugoptimized does turn on DEBUG. Last time I tried (which was a while ago),
if asserts are enabled but DEBUG is not mesa couldn't be compiled, as asserts
used members of structs that only exist when DEBUG is set. Maybe that's a
situation that deserves being revisited.


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


[Mesa-dev] [Bug 93866] Tonga: Weston-drm direct scan out corruption

2017-11-02 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93866

Michel Dänzer  changed:

   What|Removed |Added

  Component|DRM/AMDgpu  |Mesa core
   Assignee|dri-devel@lists.freedesktop |mesa-dev@lists.freedesktop.
   |.org|org
 Resolution|--- |FIXED
Product|DRI |Mesa
 Status|NEW |RESOLVED
 QA Contact||mesa-dev@lists.freedesktop.
   ||org
Version|DRI git |17.2

--- Comment #1 from Michel Dänzer  ---
Fixed with
https://cgit.freedesktop.org/mesa/mesa/commit/?h=17.3&id=255573996cc997cb61be9adad3e8fcaa78db5d1f
.

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


[Mesa-dev] [PATCH v2] glsl: add varying resources for arrays of complex types

2017-11-02 Thread Juan A. Suarez Romero
This patch is mostly a patch done by Ilia Mirkin.

It fixes KHR-GL45.enhanced_layouts.varying_structure_locations.

v2: fix locations for TCS/TES/GS inputs and outputs (Ilia)

CC: Ilia Mirkin 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103098
Signed-off-by: Juan A. Suarez Romero 
---
 src/compiler/glsl/linker.cpp | 63 +---
 1 file changed, 59 insertions(+), 4 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 004529157ee..73611797abd 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3802,6 +3802,7 @@ add_shader_variable(const struct gl_context *ctx,
 GLenum programInterface, ir_variable *var,
 const char *name, const glsl_type *type,
 bool use_implicit_location, int location,
+bool inouts_share_location,
 const glsl_type *outermost_struct_type = NULL)
 {
const glsl_type *interface_type = var->get_interface_type();
@@ -3864,7 +3865,7 @@ add_shader_variable(const struct gl_context *ctx,
   stage_mask, programInterface,
   var, field_name, field->type,
   use_implicit_location, field_location,
-  outermost_struct_type))
+  false, outermost_struct_type))
 return false;
 
  field_location += field->type->count_attribute_slots(false);
@@ -3872,6 +3873,43 @@ add_shader_variable(const struct gl_context *ctx,
   return true;
}
 
+   case GLSL_TYPE_ARRAY: {
+  /* The ARB_program_interface_query spec says:
+   *
+   * "For an active variable declared as an array of basic types, a
+   *  single entry will be generated, with its name string formed by
+   *  concatenating the name of the array and the string "[0]"."
+   *
+   * "For an active variable declared as an array of an aggregate data
+   *  type (structures or arrays), a separate entry will be generated
+   *  for each active array element, unless noted immediately below.
+   *  The name of each entry is formed by concatenating the name of
+   *  the array, the "[" character, an integer identifying the element
+   *  number, and the "]" character.  These enumeration rules are
+   *  applied recursively, treating each enumerated array element as a
+   *  separate active variable."
+   */
+  const struct glsl_type *array_type = type->fields.array;
+  if (array_type->base_type == GLSL_TYPE_STRUCT ||
+  array_type->base_type == GLSL_TYPE_ARRAY) {
+ unsigned elem_location = location;
+ unsigned stride = inouts_share_location ? 0 :
+   array_type->count_attribute_slots(false);
+ for (unsigned i = 0; i < type->length; i++) {
+char *elem = ralloc_asprintf(shProg, "%s[%d]", name, i);
+if (!add_shader_variable(ctx, shProg, resource_set,
+ stage_mask, programInterface,
+ var, elem, array_type,
+ use_implicit_location, elem_location,
+ false, outermost_struct_type))
+   return false;
+elem_location += stride;
+ }
+ return true;
+  }
+  /* fallthrough */
+   }
+
default: {
   /* The ARB_program_interface_query spec says:
*
@@ -3892,6 +3930,20 @@ add_shader_variable(const struct gl_context *ctx,
}
 }
 
+static bool
+inout_has_same_location(const ir_variable *var, unsigned stage)
+{
+   if (!var->data.patch &&
+   ((var->data.mode == ir_var_shader_out &&
+ stage == MESA_SHADER_TESS_CTRL) ||
+(var->data.mode == ir_var_shader_in &&
+ (stage == MESA_SHADER_TESS_CTRL || stage == MESA_SHADER_TESS_EVAL ||
+  stage == MESA_SHADER_GEOMETRY
+  return true;
+   else
+  return false;
+}
+
 static bool
 add_interface_variables(const struct gl_context *ctx,
 struct gl_shader_program *shProg,
@@ -3948,7 +4000,8 @@ add_interface_variables(const struct gl_context *ctx,
   if (!add_shader_variable(ctx, shProg, resource_set,
1 << stage, programInterface,
var, var->name, var->type, 
vs_input_or_fs_output,
-   var->data.location - loc_bias))
+   var->data.location - loc_bias,
+   inout_has_same_location(var, stage)))
  return false;
}
return true;
@@ -3986,7 +4039,8 @@ add_packed_varyings(const struct gl_context *ctx,
 if (!add_shader_variable(ctx, shProg, resource_set,
  stage_mask,

Re: [Mesa-dev] [PATCH v3 00/43] anv: SPV_KHR_16bit_storage/VK_KHR_16bit_storage for gen8+

2017-11-02 Thread Chema Casanova
El 02/11/17 a las 01:43, Jason Ekstrand escribió:
> I'm done reading for the day.  As you're working on incorporating
> feedback, I'd  like you to re-arrange things a bit so that we do
> everything required to enable VK_KHR_16bit_storage (including
> advertising the Vulkan extension string) for SSBOs and UBOs first and
> then enable it for push constants and enable it for inputs/outputs
> last.  This way we can land the most important part (UBOs and SSBOs)
> soon and the more annoying parts can get the review time that they need.

I think that is a good approach, I'll reorder the series so we can land
and enable the UBO/SSBOs without the other capabilities.

Chema

>
> On Mon, Oct 30, 2017 at 5:20 PM, Jason Ekstrand  > wrote:
>
> Patches 1-5, 8-11, and 13-18 are
>
> Reviewed-by: Jason Ekstrand  >
>
> On Mon, Oct 16, 2017 at 8:23 AM, Pohjolainen, Topi
> mailto:topi.pohjolai...@gmail.com>>
> wrote:
>
> On Mon, Oct 16, 2017 at 08:03:41AM -0700, Jason Ekstrand wrote:
> > FYI: I'm planning to review this some time this week. 
> Probably not today
> > though.
>
> Great, I was hoping you would. I'm just reading out of
> curiosity and asking
> random questions. Mostly trying to remind myself how compiler
> works :) It has
> been a while since I had anything to do with it.
>
> >
> > On Thu, Oct 12, 2017 at 11:37 AM, Jose Maria Casanova Crespo <
> > jmcasan...@igalia.com > wrote:
> >
> > > Hello,
> > >
> > > this is the V3 series for the implementation of the
> > > SPV_KHR_16bit_storage and VK_KHR_16bit_storage extensions
> on the anv
> > > vulkan driver, in addition to the GLSL and NIR support needed.
> > >
> > > The original series can be found here [1], and the V2 is
> available
> > > here [2].
> > >
> > > In short V3 includes the following:
> > >
> > >  * Updates on several patches after the review of the V2
> series.
> > >    This includes some squashes, and specially changes so
> 16-bit
> > >    types are always packed, not using stride 2 by default.
> > >    This implied a re-implementation of all
> load_input/store_output
> > >    intrinsics for 16-bit. New solution shuffles and unshuffles
> > >    16-bit components in 32-bit URB write and read
> operations. This
> > >    saves space in the URB writes and reduces the register
> pressure
> > >    just using half of the space.
> > >
> > > * 5 patches have been removed from v2 series because now
> we not
> > >    assume the stride 2 for 16-bit registers. We also
> removed the
> > >    patch of reuse_16bit_conversion_register. The problems
> related
> > >    to spilling that motivate that patch were better
> addressed by
> > >    Curro's liveness patch.
> > >
> > >    i965/fs: Set stride 2 when dealing with 16-bit floats/ints
> > >    i965/fs: Retype 16-bit/stride2 movs to UD on nir_op_vecX
> > >    i965/fs: Need to allocate as minimum 32-bit register
> > >    i965/fs: Update assertion on copy propagation
> > >    i965/fs: Add reuse_16bit_conversions_register optimization
> > >
> > > Finally an updated overview of the patches:
> > >
> > > Patches 1-2 add 16-bit float, int and uint types to GLSL.
> This is
> > > needed because NIR uses GLSL types internally. We use the
> enums
> > > already defined at AMD_gpu_shader_half_float and NV_gpu_shader
> > > extensions. Patch 4 updates mesa/st, in order to avoid
> warnings for
> > > types not handled on a switch.
> > >
> > > Patches 3-6 add NIR support for those new GLSL 16-bit types,
> > > conversion opcodes, and rounding modes for float to half-float
> > > conversions.
> > >
> > > Patches 7-9 add the SPIR-V (SPV_KHR_16bit_storage) to NIR
> support.
> > >
> > > Patches 10-13 add general 16-bit support for i965. This
> includes
> > > handling of new types on several general purpose methods,
> > > update/remove some asserts.
> > >
> > > Patches 14-18 add support for 32 to 16-bit conversions for
> i965,
> > > including rounding mode opcodes (needed for float to
> half-float
> > > conversions), and an optimization that removes superfluous
> rounding
> > > mode sets.
> > >
> > > Patch 19 adds 16-bit support for constant location.
> > >
> > > Patches 20-24 add and use two new messages: byte scattered
>

Re: [Mesa-dev] [PATCH] glsl: add varying resources for arrays of complex types

2017-11-02 Thread Juan A. Suarez Romero
On Fri, 2017-10-27 at 11:09 -0400, Ilia Mirkin wrote:
> > > With the latter ones getting bogus locations? What is it supposed to
> > > do in this case?
> > 
> > Why it would get bogus locations?
> 
> Because it'll do elem_location += stride every time, but they each
> should get the same location.

Ah, right. You mean for TCS/TES/GS shaders, as inputs are arrays of the
outputs from the previous shader in the pipeline.


I'll send a new version soon. Thank you!

J.A.

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


Re: [Mesa-dev] [PATCH 12/15] ac: add support for SPV_AMD_shader_ballot

2017-11-02 Thread Connor Abbott
On Thu, Nov 2, 2017 at 12:10 PM, Nicolai Hähnle  wrote:
> On 31.10.2017 16:36, Connor Abbott wrote:
>>
>> On Tue, Oct 31, 2017 at 2:08 AM, Dave Airlie  wrote:

 +LLVMValueRef
 +ac_build_subgroup_inclusive_scan(struct ac_llvm_context *ctx,
 +LLVMValueRef src,
 +ac_reduce_op reduce,
 +LLVMValueRef identity)
 +{
 +   /* See
 http://gpuopen.com/amd-gcn-assembly-cross-lane-operations/
 +*
 +* Note that each dpp/reduce pair is supposed to be compiled
 down to
 +* one instruction by LLVM, at least for 32-bit values.
 +*
 +* TODO: use @llvm.amdgcn.ds.swizzle on SI and CI
 +*/
 +   LLVMValueRef value = src;
 +   value = reduce(ctx, value,
 +  ac_build_dpp(ctx, identity, src,
 +   dpp_row_sr(1), 0xf, 0xf, false));
 +   value = reduce(ctx, value,
 +  ac_build_dpp(ctx, identity, src,
 +   dpp_row_sr(2), 0xf, 0xf, false));
 +   value = reduce(ctx, value,
 +  ac_build_dpp(ctx, identity, src,
 +   dpp_row_sr(3), 0xf, 0xf, false));
 +   value = reduce(ctx, value,
 +  ac_build_dpp(ctx, identity, value,
 +   dpp_row_sr(4), 0xf, 0xe, false));
 +   value = reduce(ctx, value,
 +  ac_build_dpp(ctx, identity, value,
 +   dpp_row_sr(8), 0xf, 0xc, false));
 +   value = reduce(ctx, value,
 +  ac_build_dpp(ctx, identity, value,
 +   dpp_row_bcast15, 0xa, 0xf, false));
 +   value = reduce(ctx, value,
 +  ac_build_dpp(ctx, identity, value,
 +   dpp_row_bcast31, 0xc, 0xf, false));
>>>
>>>
>>> btw I dumped some shaders from doom on pro,
>>>
>>> it looked like it ended up with
>>>
>>> 1, 0xf, 0xf,
>>> 2, 0xf, 0xf,
>>> 4, 0xf, 0xf
>>> 8, 0xf, 0xf
>>> bcast15 0xa, 0xf
>>> bcast31 0xc, 0xf
>>>
>>> It also seems to apply these direct to instructions like
>>> /*2b80*/ s_nop   0x0
>>> /*2b84*/ v_min_u32   v83, v83, v83 row_shr:1 bank_mask:15
>>> row_mask:15
>>> /*2b8c*/ s_nop   0x1
>>> /*2b90*/ v_min_u32   v83, v83, v83 row_shr:2 bank_mask:15
>>> row_mask:15
>>> /*2b98*/ s_nop   0x1
>>> /*2b9c*/ v_min_u32   v83, v83, v83 row_shr:4 bank_mask:15
>>> row_mask:15
>>> /*2ba4*/ s_nop   0x1
>>> /*2ba8*/ v_min_u32   v83, v83, v83 row_shr:8 bank_mask:15
>>> row_mask:15
>>> /*2bb0*/ s_nop   0x1
>>> /*2bb4*/ v_min_u32   v83, v83, v83 row_bcast15
>>> bank_mask:15 row_mask:10
>>> /*2bbc*/ s_nop   0x1
>>> /*2bc0*/ v_min_u32   v83, v83, v83 row_bcast31
>>> bank_mask:15 row_mask:12
>>>
>>> I think the instruction combining is probably an llvm job, but I
>>> wonder if the different row_shr
>>> etc is what we should use as well.
>>
>>
>> Yeah, LLVM should be combining the move and min -- hence the comment
>> here -- but it isn't yet. That shouldn't be too hard to do once we get
>> it working. Also, I've seen that way of doing it before, and IIRC it's
>> one instruction slower than the sequence in the blog post I cited,
>> since even though there's one less instruction, there's an extra
>> two-cycle stall between the first two instructions since v83 is the
>> destination of the first instruction and DPP source of the second
>> (hence the s_nop 0x1). So once we combine instructions this should be
>> better than what -pro does :)
>
>
> Agreed, though even more ideally, LLVM would be able to fill those gaps with
> other instructions ;)

Well, that isn't really possible when the sequence is in WWM and
everything else isn't. We could fill the slot with a scalar
instruction, but I think LLVM is currently overly conservative and
treats instructions writing EXEC as barriers even though it doesn't
need to.

>
> Anyway, the combining of instructions is really the important task.

Agreed. Although I think getting it working first is even more important :)

>
> Cheers,
> Nicolai
>
>
>>
>>>
>>> Dave.
>>> ___
>>> mesa-dev mailing list
>>> mesa-dev@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>
>
> --
> Lerne, wie die Welt wirklich ist,
> Aber vergiss niemals, wie sie sein sollte.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.or

Re: [Mesa-dev] [PATCH 10/10] ac: remove the remaining duplicate llvm types

2017-11-02 Thread Marek Olšák
For the series:

Reviewed-by: Marek Olšák 

Marek

On Thu, Nov 2, 2017 at 3:41 AM, Timothy Arceri  wrote:
> ---
>  src/amd/common/ac_nir_to_llvm.c | 13 +
>  1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index ec51ed7007..38a65b9cd1 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -127,22 +127,20 @@ struct nir_to_llvm_context {
> LLVMValueRef esgs_ring;
> LLVMValueRef gsvs_ring;
> LLVMValueRef hs_ring_tess_offchip;
> LLVMValueRef hs_ring_tess_factor;
>
> LLVMValueRef prim_mask;
> LLVMValueRef sample_pos_offset;
> LLVMValueRef persp_sample, persp_center, persp_centroid;
> LLVMValueRef linear_sample, linear_center, linear_centroid;
>
> -   unsigned uniform_md_kind;
> -   LLVMValueRef empty_md;
> gl_shader_stage stage;
>
> LLVMValueRef inputs[RADEON_LLVM_MAX_INPUTS * 4];
>
> uint64_t input_mask;
> uint64_t output_mask;
> uint8_t num_output_clips;
> uint8_t num_output_culls;
>
> bool is_gs_copy_shader;
> @@ -973,27 +971,20 @@ static void create_function(struct nir_to_llvm_context 
> *ctx,
> set_userdata_location_shader(ctx, 
> AC_UD_PS_SAMPLE_POS_OFFSET, &user_sgpr_idx, 1);
> }
> break;
> default:
> unreachable("Shader stage not implemented");
> }
>
> ctx->shader_info->num_user_sgprs = user_sgpr_idx;
>  }
>
> -static void setup_types(struct nir_to_llvm_context *ctx)
> -{
> -   ctx->uniform_md_kind =
> -   LLVMGetMDKindIDInContext(ctx->context, "amdgpu.uniform", 14);
> -   ctx->empty_md = LLVMMDNodeInContext(ctx->context, NULL, 0);
> -}
> -
>  static int get_llvm_num_components(LLVMValueRef value)
>  {
> LLVMTypeRef type = LLVMTypeOf(value);
> unsigned num_components = LLVMGetTypeKind(type) == LLVMVectorTypeKind
>   ? LLVMGetVectorSize(type)
>   : 1;
> return num_components;
>  }
>
>  static LLVMValueRef llvm_extract_elem(struct ac_llvm_context *ac,
> @@ -2213,21 +2204,21 @@ static LLVMValueRef 
> visit_vulkan_resource_index(struct nir_to_llvm_context *ctx,
> stride = LLVMConstInt(ctx->ac.i32, 16, false);
> } else
> stride = LLVMConstInt(ctx->ac.i32, 
> layout->binding[binding].size, false);
>
> offset = LLVMConstInt(ctx->ac.i32, base_offset, false);
> index = LLVMBuildMul(ctx->builder, index, stride, "");
> offset = LLVMBuildAdd(ctx->builder, offset, index, "");
>
> desc_ptr = ac_build_gep0(&ctx->ac, desc_ptr, offset);
> desc_ptr = cast_ptr(ctx, desc_ptr, ctx->ac.v4i32);
> -   LLVMSetMetadata(desc_ptr, ctx->uniform_md_kind, ctx->empty_md);
> +   LLVMSetMetadata(desc_ptr, ctx->ac.uniform_md_kind, ctx->ac.empty_md);
>
> return LLVMBuildLoad(ctx->builder, desc_ptr, "");
>  }
>
>  static LLVMValueRef visit_load_push_constant(struct nir_to_llvm_context *ctx,
>   nir_intrinsic_instr *instr)
>  {
> LLVMValueRef ptr, addr;
>
> addr = LLVMConstInt(ctx->ac.i32, nir_intrinsic_base(instr), 0);
> @@ -6474,21 +6465,20 @@ LLVMModuleRef 
> ac_translate_nir_to_llvm(LLVMTargetMachineRef tm,
> ac_llvm_context_init(&ctx.ac, ctx.context, options->chip_class);
> ctx.ac.module = ctx.module;
> LLVMSetTarget(ctx.module, options->supports_spill ? 
> "amdgcn-mesa-mesa3d" : "amdgcn--");
>
> LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(tm);
> char *data_layout_str = LLVMCopyStringRepOfTargetData(data_layout);
> LLVMSetDataLayout(ctx.module, data_layout_str);
> LLVMDisposeTargetData(data_layout);
> LLVMDisposeMessage(data_layout_str);
>
> -   setup_types(&ctx);
> ctx.builder = LLVMCreateBuilderInContext(ctx.context);
> ctx.ac.builder = ctx.builder;
>
> memset(shader_info, 0, sizeof(*shader_info));
>
> for(int i = 0; i < shader_count; ++i)
> ac_nir_shader_info_pass(shaders[i], options, 
> &shader_info->info);
>
> for (i = 0; i < AC_UD_MAX_SETS; i++)
> shader_info->user_sgprs_locs.descriptor_sets[i].sgpr_idx = -1;
> @@ -6847,21 +6837,20 @@ void ac_create_gs_copy_shader(LLVMTargetMachineRef tm,
> ctx.context = LLVMContextCreate();
> ctx.module = LLVMModuleCreateWithNameInContext("shader", ctx.context);
> ctx.options = options;
> ctx.shader_info = shader_info;
>
> ac_llvm_context_init(&ctx.ac, ctx.context, options->chip_class);
> ctx.ac.module = ctx.module;
>
> ctx.is_gs_copy_shader = true;
> LLVMSetTarget(ctx.module, "amdgcn--");
> -   setup_types(&ctx);
>
> ctx.builder = LLVMCreateBuilderInConte

Re: [Mesa-dev] [PATCH 6/6] ac: use the ac i64 llvm type

2017-11-02 Thread Marek Olšák
For the series:

Reviewed-by: Marek Olšák 

Marek

On Thu, Nov 2, 2017 at 2:50 AM, Timothy Arceri  wrote:
> ---
>  src/amd/common/ac_nir_to_llvm.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index c3c9d7a859..2437ea05c1 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -127,21 +127,20 @@ struct nir_to_llvm_context {
> LLVMValueRef esgs_ring;
> LLVMValueRef gsvs_ring;
> LLVMValueRef hs_ring_tess_offchip;
> LLVMValueRef hs_ring_tess_factor;
>
> LLVMValueRef prim_mask;
> LLVMValueRef sample_pos_offset;
> LLVMValueRef persp_sample, persp_center, persp_centroid;
> LLVMValueRef linear_sample, linear_center, linear_centroid;
>
> -   LLVMTypeRef i64;
> LLVMTypeRef v2i32;
> LLVMTypeRef v3i32;
> LLVMTypeRef v4i32;
> LLVMTypeRef v8i32;
> LLVMTypeRef f64;
> LLVMTypeRef f32;
> LLVMTypeRef f16;
> LLVMTypeRef v2f32;
> LLVMTypeRef v4f32;
>
> @@ -986,21 +985,20 @@ static void create_function(struct nir_to_llvm_context 
> *ctx,
> break;
> default:
> unreachable("Shader stage not implemented");
> }
>
> ctx->shader_info->num_user_sgprs = user_sgpr_idx;
>  }
>
>  static void setup_types(struct nir_to_llvm_context *ctx)
>  {
> -   ctx->i64 = LLVMIntTypeInContext(ctx->context, 64);
> ctx->v2i32 = LLVMVectorType(ctx->ac.i32, 2);
> ctx->v3i32 = LLVMVectorType(ctx->ac.i32, 3);
> ctx->v4i32 = LLVMVectorType(ctx->ac.i32, 4);
> ctx->v8i32 = LLVMVectorType(ctx->ac.i32, 8);
> ctx->f32 = LLVMFloatTypeInContext(ctx->context);
> ctx->f16 = LLVMHalfTypeInContext(ctx->context);
> ctx->f64 = LLVMDoubleTypeInContext(ctx->context);
> ctx->v2f32 = LLVMVectorType(ctx->f32, 2);
> ctx->v4f32 = LLVMVectorType(ctx->f32, 4);
>
> @@ -5324,21 +5322,21 @@ glsl_base_to_llvm_type(struct nir_to_llvm_context 
> *ctx,
> switch (type) {
> case GLSL_TYPE_INT:
> case GLSL_TYPE_UINT:
> case GLSL_TYPE_BOOL:
> case GLSL_TYPE_SUBROUTINE:
> return ctx->ac.i32;
> case GLSL_TYPE_FLOAT: /* TODO handle mediump */
> return ctx->f32;
> case GLSL_TYPE_INT64:
> case GLSL_TYPE_UINT64:
> -   return ctx->i64;
> +   return ctx->ac.i64;
> case GLSL_TYPE_DOUBLE:
> return ctx->f64;
> default:
> unreachable("unknown GLSL type");
> }
>  }
>
>  static LLVMTypeRef
>  glsl_to_llvm_type(struct nir_to_llvm_context *ctx,
>   const struct glsl_type *type)
> --
> 2.14.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] mesa: enable ARB_texture_buffer_* extensions in the Compatibility profile

2017-11-02 Thread Marek Olšák
One possibility would be to discard each hunk in each patch until you
find the problematic one. It might be a bug in i965 that was just
uncovered and fixing it might be non-trivial. For example,
set_max_gl_versions in i965 doesn't allow creating GL 4.6 contexts
directly, but there might be more.

The bottom line is that the environment variables are not guaranteed
to work in all cases (they are hacks) and I wouldn't like to block the
series because of them.

Marek

On Thu, Nov 2, 2017 at 2:07 AM, Mark Janes  wrote:
> The FC suffix does not help.  We are testing openglcts from
> opengl-cts-4.6.0 branch of gitlab.khronos.org:Tracker/vk-gl-cts.git:
>
> d6144a989   Fix attribute mapping in enhanced layouts tests for input 
> arrays
>
> MESA_GLES_VERSION_OVERRIDE=3.2 MESA_GLSL_VERSION_OVERRIDE=460 
> MESA_GL_VERSION_OVERRIDE=4.6FC ./glcts --deqp-runmode=xml-caselist
> Writing test log into TestResults.qpa
> dEQP Core git-d6144a989937b2829a9fc9813de994c4f514ebae (0xd6144a98) 
> starting..
>   target implementation = 'X11 EGL'
> Writing test cases from 'CTS-Configs' to file 'CTS-Configs-cases.xml'..
> Writing test cases from 'dEQP-EGL' to file 'dEQP-EGL-cases.xml'..
> Writing test cases from 'KHR-GLES2' to file 'KHR-GLES2-cases.xml'..
> Writing test cases from 'dEQP-GLES2' to file 'dEQP-GLES2-cases.xml'..
> Writing test cases from 'KHR-GLES3' to file 'KHR-GLES3-cases.xml'..
> Writing test cases from 'dEQP-GLES3' to file 'dEQP-GLES3-cases.xml'..
> Writing test cases from 'dEQP-GLES31' to file 'dEQP-GLES31-cases.xml'..
> Writing test cases from 'KHR-GLES31' to file 'KHR-GLES31-cases.xml'..
> Writing test cases from 'KHR-GLESEXT' to file 'KHR-GLESEXT-cases.xml'..
> Writing test cases from 'KHR-GLES32' to file 'KHR-GLES32-cases.xml'..
> Writing test cases from 'KHR-NoContext' to file 
> 'KHR-NoContext-cases.xml'..
> Writing test cases from 'KHR-GL30' to file 'KHR-GL30-cases.xml'..
> Writing test cases from 'KHR-GL31' to file 'KHR-GL31-cases.xml'..
> FATAL ERROR: Failed to initialize dEQP: Got EGL_BAD_MATCH: 
> eglCreateContext() at egluGLUtil.cpp:198
> ERROR: command failed
>
> Marek Olšák  writes:
>
>> This should work (I added "FC" at the end):
>>
>> MESA_GLSL_VERSION_OVERRIDE=460 MESA_GL_VERSION_OVERRIDE=4.6FC
>>
>> Marek
>>
>> On Wed, Nov 1, 2017 at 11:16 PM, Mark Janes  wrote:
>>> Mark Janes  writes:
>>>
 Marek Olšák  writes:

> Hi Mark,
>
> Can you try the attached patches instead?

 After talking with Ken and Dylan, I realize that I missed a one-line
 patch from your thread with my last test (Oct 25 patch to
 intel_extensions.c).  With that patch, there are no regressions in CI.

 I'm testing the attached patches as well.
>>>
>>> With the most recent patches, I'm unable to run the GL CTS 4.6:
>>>
>>> MESA_GLSL_VERSION_OVERRIDE=460 MESA_GL_VERSION_OVERRIDE=4.6 ./glcts 
>>> --deqp-runmode=xml-caselist
>>> Writing test log into TestResults.qpa
>>> dEQP Core git-d6144a989937b2829a9fc9813de994c4f514ebae (0xd6144a98) 
>>> starting..
>>>   target implementation = 'X11 EGL'
>>> Writing test cases from 'CTS-Configs' to file 'CTS-Configs-cases.xml'..
>>> Writing test cases from 'dEQP-EGL' to file 'dEQP-EGL-cases.xml'..
>>> Writing test cases from 'KHR-GLES2' to file 'KHR-GLES2-cases.xml'..
>>> Writing test cases from 'dEQP-GLES2' to file 'dEQP-GLES2-cases.xml'..
>>> Writing test cases from 'KHR-GLES3' to file 'KHR-GLES3-cases.xml'..
>>> Writing test cases from 'dEQP-GLES3' to file 'dEQP-GLES3-cases.xml'..
>>> Writing test cases from 'dEQP-GLES31' to file 'dEQP-GLES31-cases.xml'..
>>> Writing test cases from 'KHR-GLES31' to file 'KHR-GLES31-cases.xml'..
>>> Writing test cases from 'KHR-GLESEXT' to file 'KHR-GLESEXT-cases.xml'..
>>> Writing test cases from 'KHR-GLES32' to file 'KHR-GLES32-cases.xml'..
>>> Writing test cases from 'KHR-NoContext' to file 
>>> 'KHR-NoContext-cases.xml'..
>>> Writing test cases from 'KHR-GL30' to file 'KHR-GL30-cases.xml'..
>>> Writing test cases from 'KHR-GL31' to file 'KHR-GL31-cases.xml'..
>>> FATAL ERROR: Failed to initialize dEQP: Got EGL_BAD_MATCH: 
>>> eglCreateContext() at egluGLUtil.cpp:198
>>>
>>> piglit, deqp, and gles-cts encountered no regressions.
>>>
> Thanks,
> Marek
>
> On Wed, Nov 1, 2017 at 9:49 PM, Mark Janes  wrote:
>> Dylan Baker  writes:
>>
>>> I haven't run the CTS tests, but both the deqp and the piglit test pass 
>>> on my
>>> skl with Marek's patches applied.
>>
>> I must have tested with only the patch 2 applied.  Running with all
>> three patches in the series, I see no piglit/deqp regressions.
>>
>> However, GLES CTS fails thousands of ES31-CTS.functional.texture tests,
>> eg:
>>
>> ES31-CTS.functional.texture.format.buffer.rg8i_npot
>> glGetIntegerv() failed: glGetError() returned GL_INVALID_ENUM at

Re: [Mesa-dev] [PATCH 07/13] autotools: set XA versions in configure.ac and configure header file

2017-11-02 Thread Matt Turner
With Emil's suggestions,

Reviewed-by: Matt Turner 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Meson's default build type

2017-11-02 Thread Matt Turner
On Thu, Nov 2, 2017 at 9:51 AM, Michel Dänzer  wrote:
> FWIW, my vote is for debugoptimized: Assertions are enabled and there's
> debugging information useful for bug reports, but performance should be
> decent.

If debugoptimized turns on DEBUG, then I don't think performance will
be decent as that enables paths like nir_validate. Maybe we should
change debugoptimized to not do that. Not sure.

I think some of the messaging got confused -- autotools does specify
-g in the default CFLAGS, but that doesn't really mean it's a useful
debug build. -g -O2 is really a release build, with debugging symbols.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 42.5/48] nir/builder: Add a nir_imm_intN_t helper

2017-11-02 Thread Lionel Landwerlin

Reviewed-by: Lionel Landwerlin 

On 31/10/17 23:54, Jason Ekstrand wrote:

This lets you easily build integer immediates of arbitrary bit size.
---
  src/compiler/nir/nir_builder.h | 12 
  1 file changed, 12 insertions(+)

diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 4bd5628..36e0ae3 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -264,6 +264,18 @@ nir_imm_int64(nir_builder *build, int64_t x)
  }
  
  static inline nir_ssa_def *

+nir_imm_intN_t(nir_builder *build, uint64_t x, unsigned bit_size)
+{
+   nir_const_value v;
+
+   memset(&v, 0, sizeof(v));
+   assert(bit_size <= 64);
+   v.i64[0] = x & (~0ull >> (64 - bit_size));
+
+   return nir_build_imm(build, 1, bit_size, v);
+}
+
+static inline nir_ssa_def *
  nir_imm_ivec4(nir_builder *build, int x, int y, int z, int w)
  {
 nir_const_value v;



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


Re: [Mesa-dev] [PATCH 2/3] gbm: Don't traverse backwards for includes

2017-11-02 Thread Dylan Baker
Quoting Emil Velikov (2017-11-02 06:21:09)
> On 21 October 2017 at 02:00, Dylan Baker  wrote:
> > This is just a terrible idea, but it also needs to be fixed for the next
> > patch to work, so let's fix it right.
> >
> Please rework the commit message. Perhaps something alike
> 1b1bb6ee103a79de11aa4941ccbcd34f0a158276?
> 
> > Signed-off-by: Dylan Baker 
> > ---
> >  src/gbm/Makefile.am| 4 +++-
> >  src/gbm/backends/dri/gbm_dri.c | 2 +-
> >  src/gbm/meson.build| 6 +++---
> >  3 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
> > index 805208a3ca9..05d861ff999 100644
> > --- a/src/gbm/Makefile.am
> > +++ b/src/gbm/Makefile.am
> > @@ -31,7 +31,9 @@ libgbm_la_LIBADD = \
> > $(DLOPEN_LIBS)
> >
> >  if HAVE_PLATFORM_WAYLAND
> > -AM_CFLAGS += $(WAYLAND_SERVER_CFLAGS)
> > +AM_CFLAGS += \
> > +   $(WAYLAND_SERVER_CFLAGS) \
> > +   -I$(top_srcdir)/src/egl/wayland/wayland-drm/
> >  libgbm_la_LIBADD += 
> > $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la 
> > $(WAYLAND_SERVER_LIBS)
> This might cause a trivial merge/rebase conflict.
> 
> >  endif
> >
> > diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
> > index 0a4853bf63d..b2121cbc340 100644
> > --- a/src/gbm/backends/dri/gbm_dri.c
> > +++ b/src/gbm/backends/dri/gbm_dri.c
> > @@ -53,7 +53,7 @@
> >
> >  /* For importing wl_buffer */
> >  #if HAVE_WAYLAND_PLATFORM
> > -#include "../../../egl/wayland/wayland-drm/wayland-drm.h"
> > +#include "wayland-drm.h"
> >  #endif
> >
> >  #ifndef DRM_FORMAT_MOD_INVALID
> > diff --git a/src/gbm/meson.build b/src/gbm/meson.build
> > index 1bb3c94c387..2910fa2390c 100644
> > --- a/src/gbm/meson.build
> > +++ b/src/gbm/meson.build
> > @@ -31,6 +31,7 @@ deps_gbm = []
> >  args_gbm = []
> >  links_gbm = []
> >  deps_gbm = []
> > +incs_gbm = [include_directories('main'), inc_include, inc_src, inc_loader]
> >
> >  if with_dri2
> >files_gbm += files('backends/dri/gbm_dri.c', 'backends/dri/gbm_driint.h')
> > @@ -40,6 +41,7 @@ endif
> >  if with_platform_wayland
> >deps_gbm += dep_wayland_server
> >links_gbm += libwayland_drm
> > +  incs_gbm += include_directories('../egl/wayland/wayland-drm')
> This looks quite ugly IMHO... Surely meson has the concept of
> top_{build,src}dir?
> Quick grep shows a few move cases like these. Were those
> butchered/inspired by the autotools build?

meson specifically does not allow passing absolute paths to include_directories,
since you can assign includes to variables I assume. I can just create an
"inc_wayland_drm" instead.

> 
> For the autotools/C changes
> Reviewed-by: Emil Velikov 
> 
> -Emil


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


Re: [Mesa-dev] Meson's default build type

2017-11-02 Thread Michel Dänzer
On 02/11/17 05:46 PM, Chad Versace wrote:
> On Wed 01 Nov 2017, Dylan Baker wrote:
>> Quoting Ilia Mirkin (2017-11-01 16:05:17)
>>> On Wed, Nov 1, 2017 at 7:03 PM, Dylan Baker  wrote:
 Quoting Ilia Mirkin (2017-11-01 15:52:56)
> On Wed, Nov 1, 2017 at 6:49 PM, Chad Versace  
> wrote:
>> On Wed 01 Nov 2017, Dylan Baker wrote:
>>> Quoting Chad Versace (2017-11-01 14:43:28)
 Wow. 10 seconds from a clean checkout to an installed Vulkan driver.
>>
>>> Glad that it's working out for you guys!
>>>
>>> Can I convince you to wire the anvil and i965 android/arc++ bits? ;)
>>>
>>> JFYI, the meson build will (I consider it a bug if it doesn't) turn off 
>>> all
>>> glapi, egl, and glx if there are no dri or gallium drivers built unless 
>>> you
>>> force them on.
>>
>> Thanks for turning that stuff off. Last time I tried to build just
>> Vulkan without GL (maybe 1.5 years ago), Autotools didn't allow it. It
>> insisted that i965 was a build dependency for anvil.
>>
>>> It also avoids building the glsl compiler unless there's a driver
>>> that uses it.
>>
>> I expected the buildtime to be much longer because I expected it to
>> build the GLSL compiler too. I was surprised and happy to discover that
>> it builds only the SPIR-V compiler.
>>
>>> And it defaults to debug, which might be surprising, but people
>>> around here thought that default debug is a feature.
>>
>> Huh... For infrastructure projects like Mesa (as opposed to test
>> projects like Piglit), I expect the default build to be the release
>> build. But I can understand why others would want default=debug.
>
> autotools defaults to debug disabled. I think that's how almost every
> project does it... debug enabled is definitely a surprise.
>
>   -ilia

 Well, for distros they likely want to set the buildtype to plain (meson 
 adds no
 compiler flags except ones the project defines), and then add their default
 flags via CFLAGS and CXXFLAGS. That is certainly *not* what anyone except a
 distro (or some kind of build infrastructure like jenkins or gentoo) would 
 want.
 Xorg's default is debugoptimzed, for reference.
>>>
>>> --enable-debug enables -DDEBUG in mesa. Are you saying that this is
>>> the default? Or are you just saying that you're not adding extra
>>> -O100073 options?
>>
>> The meson build keys -DDEBUG on the builtype, debug or debugoptimized you get
>> -DDEBUG, anything else, you don't. The way mesa is setup if you don't have
>> -DNDEBUG you have to have -DDEBUG or asserts happen for member of structures
>> that don't exist.
>>
>> I'm not dead set on debug as the default buildtype, it's what we have ATM
>> though. I asked around here and the feeling was that builtype debug by 
>> default
>> was a feature. If the larger community disagrees we can change it.
> 
> When making this decision, I think we should also consider the needs of
> non-developers who build and install Mesa from source to get the latest
> version or bugfix. I strongly suspect those people want
> buildtype=debugoptimized or buildtype=release.

FWIW, my vote is for debugoptimized: Assertions are enabled and there's
debugging information useful for bug reports, but performance should be
decent.


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


[Mesa-dev] Meson's default build type

2017-11-02 Thread Chad Versace
On Wed 01 Nov 2017, Dylan Baker wrote:
> Quoting Ilia Mirkin (2017-11-01 16:05:17)
> > On Wed, Nov 1, 2017 at 7:03 PM, Dylan Baker  wrote:
> > > Quoting Ilia Mirkin (2017-11-01 15:52:56)
> > >> On Wed, Nov 1, 2017 at 6:49 PM, Chad Versace  
> > >> wrote:
> > >> > On Wed 01 Nov 2017, Dylan Baker wrote:
> > >> >> Quoting Chad Versace (2017-11-01 14:43:28)
> > >> >> > Wow. 10 seconds from a clean checkout to an installed Vulkan driver.
> > >> >
> > >> >> Glad that it's working out for you guys!
> > >> >>
> > >> >> Can I convince you to wire the anvil and i965 android/arc++ bits? ;)
> > >> >>
> > >> >> JFYI, the meson build will (I consider it a bug if it doesn't) turn 
> > >> >> off all
> > >> >> glapi, egl, and glx if there are no dri or gallium drivers built 
> > >> >> unless you
> > >> >> force them on.
> > >> >
> > >> > Thanks for turning that stuff off. Last time I tried to build just
> > >> > Vulkan without GL (maybe 1.5 years ago), Autotools didn't allow it. It
> > >> > insisted that i965 was a build dependency for anvil.
> > >> >
> > >> >> It also avoids building the glsl compiler unless there's a driver
> > >> >> that uses it.
> > >> >
> > >> > I expected the buildtime to be much longer because I expected it to
> > >> > build the GLSL compiler too. I was surprised and happy to discover that
> > >> > it builds only the SPIR-V compiler.
> > >> >
> > >> >> And it defaults to debug, which might be surprising, but people
> > >> >> around here thought that default debug is a feature.
> > >> >
> > >> > Huh... For infrastructure projects like Mesa (as opposed to test
> > >> > projects like Piglit), I expect the default build to be the release
> > >> > build. But I can understand why others would want default=debug.
> > >>
> > >> autotools defaults to debug disabled. I think that's how almost every
> > >> project does it... debug enabled is definitely a surprise.
> > >>
> > >>   -ilia
> > >
> > > Well, for distros they likely want to set the buildtype to plain (meson 
> > > adds no
> > > compiler flags except ones the project defines), and then add their 
> > > default
> > > flags via CFLAGS and CXXFLAGS. That is certainly *not* what anyone except 
> > > a
> > > distro (or some kind of build infrastructure like jenkins or gentoo) 
> > > would want.
> > > Xorg's default is debugoptimzed, for reference.
> > 
> > --enable-debug enables -DDEBUG in mesa. Are you saying that this is
> > the default? Or are you just saying that you're not adding extra
> > -O100073 options?
> 
> The meson build keys -DDEBUG on the builtype, debug or debugoptimized you get
> -DDEBUG, anything else, you don't. The way mesa is setup if you don't have
> -DNDEBUG you have to have -DDEBUG or asserts happen for member of structures
> that don't exist.
> 
> I'm not dead set on debug as the default buildtype, it's what we have ATM
> though. I asked around here and the feeling was that builtype debug by default
> was a feature. If the larger community disagrees we can change it.

When making this decision, I think we should also consider the needs of
non-developers who build and install Mesa from source to get the latest
version or bugfix. I strongly suspect those people want
buildtype=debugoptimized or buildtype=release.

I think it's important for Mesa to follow the established convention of
most other Linux projects: if a user downloads the source, builds, and
installs, then the user gets a working installation suitable for normal
usage. Today, Meson doesn't give that because it builds Mesa with -O0.

Some context... I install a lot of packages from source on my work
machine because I often want or need newer versions of some packages
than what's available through the package manager. For most of those
packages, I expect the project's default build configuration to install
what I want. For example, I want the below commands to do the right
thing:

./configure
make
make install

OR

cmake -GNinja .
ninja
ninja install

I'm not developing nor debugging these packages. I just want to install
and use them.

If I had to read each individual project's detailed build instructions
in order to a working, optimized build on my system, then I would just
give up. That burden does not scale.

If projects begin deviating from that convention, then I believe that
negatively impacts the ecosystem.

Just my two cents
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: prevent deleting the dummy ATI_fs

2017-11-02 Thread Marek Olšák
Can you rebase and resend the patch? It doesn't apply with "git am".

Thanks,
Marek

On Wed, Nov 1, 2017 at 12:34 AM, Miklós Máté  wrote:
> This fixes a crash upon context destruction when
> glGenFragmentShadersATI() was used. Backtrace:
> ==15060== Invalid free() / delete / delete[] / realloc()
> ==15060==at 0x482F478: free (vg_replace_malloc.c:530)
> ==15060==by 0x57694F4: _mesa_delete_ati_fragment_shader 
> (atifragshader.c:68)
> ==15060==by 0x58B33AB: delete_fragshader_cb (shared.c:208)
> ==15060==by 0x5838836: _mesa_HashDeleteAll (hash.c:295)
> ==15060==by 0x58B365F: free_shared_state (shared.c:377)
> ==15060==by 0x58B3BC2: _mesa_reference_shared_state (shared.c:469)
> ==15060==by 0x578687F: _mesa_free_context_data (context.c:1366)
> ==15060==by 0x595E9EC: st_destroy_context (st_context.c:642)
> ==15060==by 0x5987057: st_context_destroy (st_manager.c:772)
> ==15060==by 0x5B018B6: dri_destroy_context (dri_context.c:217)
> ==15060==by 0x5B006D3: driDestroyContext (dri_util.c:511)
> ==15060==by 0x4A1CBE6: dri3_destroy_context (dri3_glx.c:170)
> ==15060==  Address 0x7b5dae0 is 0 bytes inside data symbol "DummyShader"
>
> This hasn't been an issue yet, because the only thing that calls
> glGenFragmentShadersATI() is my WIP piglit test. SWKOTOR and Doom3
> use hard-coded shader names.
>
> The patch also fixes this:
> name=glGenFragmentShadersATI(1);
> glDeleteFragmentShaderATI(name);
>
> Signed-off-by: Miklós Máté 
> ---
>  src/mesa/main/atifragshader.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c
> index 27d8b86477..fdfaea0528 100644
> --- a/src/mesa/main/atifragshader.c
> +++ b/src/mesa/main/atifragshader.c
> @@ -60,6 +60,9 @@ void
>  _mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct 
> ati_fragment_shader *s)
>  {
> GLuint i;
> +
> +   if (s == &DummyShader)
> +  return;
> +
> for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
>free(s->Instructions[i]);
>free(s->SetupInst[i]);
> @@ -295,7 +298,6 @@ _mesa_DeleteFragmentShaderATI(GLuint id)
>if (prog) {
>  prog->RefCount--;
>  if (prog->RefCount <= 0) {
> -   assert(prog != &DummyShader);
>  _mesa_delete_ati_fragment_shader(ctx, prog);
>  }
>}
> --
> 2.15.0.rc0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] st/glsl_to_nir: use nir_shader_gather_info()

2017-11-02 Thread Nicolai Hähnle

Both patches:

Reviewed-by: Nicolai Hähnle 

On 01.11.2017 12:01, Timothy Arceri wrote:

Use the NIR helper rather than the GLSL IR helper to get in/out
masks. This allows us to ignore varyings removed by NIR
optimisations.
---
  src/mesa/state_tracker/st_glsl_to_nir.cpp | 18 ++
  1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp 
b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index d59e472584..7f4651a3cc 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -266,30 +266,26 @@ st_glsl_to_nir(struct st_context *st, struct gl_program 
*prog,
  * This should be enough for Bitmap and DrawPixels constants.
  */
 _mesa_reserve_parameter_storage(prog->Parameters, 8);
  
 /* This has to be done last.  Any operation the can cause

  * prog->ParameterValues to get reallocated (e.g., anything that adds a
  * program constant) has to happen before creating this linkage.
  */
 _mesa_associate_uniform_storage(st->ctx, shader_program, prog, true);
  
-   st_set_prog_affected_state_flags(prog);

-
 NIR_PASS_V(nir, nir_lower_io_to_temporaries,
   nir_shader_get_entrypoint(nir),
   true, true);
 NIR_PASS_V(nir, nir_lower_global_vars_to_local);
 NIR_PASS_V(nir, nir_split_var_copies);
 NIR_PASS_V(nir, nir_lower_var_copies);
-   NIR_PASS_V(nir, st_nir_lower_builtin);
-   NIR_PASS_V(nir, nir_lower_atomics, shader_program);
  
 /* fragment shaders may need : */

 if (stage == MESA_SHADER_FRAGMENT) {
static const gl_state_index wposTransformState[STATE_LENGTH] = {
   STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM
};
nir_lower_wpos_ytransform_options wpos_options = { { 0 } };
struct pipe_screen *pscreen = st->pipe->screen;
  
memcpy(wpos_options.state_tokens, wposTransformState,

@@ -302,20 +298,30 @@ st_glsl_to_nir(struct st_context *st, struct gl_program 
*prog,
   pscreen->get_param(pscreen, 
PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER);
wpos_options.fs_coord_pixel_center_half_integer =
   pscreen->get_param(pscreen, 
PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER);
  
if (nir_lower_wpos_ytransform(nir, &wpos_options)) {

   nir_validate_shader(nir);
   _mesa_add_state_reference(prog->Parameters, wposTransformState);
}
 }
  
+   NIR_PASS_V(nir, nir_lower_system_values);

+
+   nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
+   prog->info = nir->info;
+
+   st_set_prog_affected_state_flags(prog);
+
+   NIR_PASS_V(nir, st_nir_lower_builtin);
+   NIR_PASS_V(nir, nir_lower_atomics, shader_program);
+
 if (st->ctx->_Shader->Flags & GLSL_DUMP) {
_mesa_log("\n");
_mesa_log("NIR IR for linked %s program %d:\n",
   _mesa_shader_stage_to_string(stage),
   shader_program->Name);
nir_print_shader(nir, _mesa_get_log_file());
_mesa_log("\n\n");
 }
  
 prog->nir = nir;

@@ -387,44 +393,40 @@ st_finalize_nir(struct st_context *st, struct gl_program 
*prog,
 } else {
unreachable("invalid shader type for tgsi bypass\n");
 }
  
 NIR_PASS_V(nir, nir_lower_atomics_to_ssbo,

   st->ctx->Const.Program[nir->info.stage].MaxAtomicBuffers);
  
 st_nir_assign_uniform_locations(prog, shader_program,

 &nir->uniforms, &nir->num_uniforms);
  
-   NIR_PASS_V(nir, nir_lower_system_values);

-
 if (screen->get_param(screen, PIPE_CAP_NIR_SAMPLERS_AS_DEREF))
NIR_PASS_V(nir, nir_lower_samplers_as_deref, shader_program);
 else
NIR_PASS_V(nir, nir_lower_samplers, shader_program);
  }
  
  struct gl_program *

  st_nir_get_mesa_program(struct gl_context *ctx,
  struct gl_shader_program *shader_program,
  struct gl_linked_shader *shader)
  {
 struct st_context *st = st_context(ctx);
 struct gl_program *prog;
  
 validate_ir_tree(shader->ir);
  
 prog = shader->Program;
  
 prog->Parameters = _mesa_new_parameter_list();
  
-   do_set_program_inouts(shader->ir, prog, shader->Stage);

-
 _mesa_copy_linked_program_data(shader_program, shader);
 _mesa_generate_parameters_list_for_uniforms(ctx, shader_program, shader,
 prog->Parameters);
  
 if (ctx->_Shader->Flags & GLSL_DUMP) {

_mesa_log("\n");
_mesa_log("GLSL IR for linked %s program %d:\n",
   _mesa_shader_stage_to_string(shader->Stage),
   shader_program->Name);
_mesa_print_ir(_mesa_get_log_file(), shader->ir, NULL);




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] st/glsl_to_nir: delay adding built-in uniforms to Parameters list

2017-11-02 Thread Nicolai Hähnle

On 01.11.2017 06:20, Timothy Arceri wrote:

Delaying adding built-in uniforms until after we convert to NIR
gives us a better chance to optimise them away. Also NIR allows
us to iterate over the uniforms directly so should be faster.
---
  src/mesa/state_tracker/st_glsl_to_nir.cpp  | 68 +++---
  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |  2 +-
  2 files changed, 34 insertions(+), 36 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp 
b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 5b37d2cd63..bbef830a2e 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -235,20 +235,53 @@ st_glsl_to_nir(struct st_context *st, struct gl_program 
*prog,
  
 options = (const nir_shader_compiler_options *)

pscreen->get_compiler_options(pscreen, PIPE_SHADER_IR_NIR, ptarget);
 assert(options);
  
 if (prog->nir)

return prog->nir;
  
 nir = glsl_to_nir(shader_program, stage, options);
  
+   /* Make a pass over the IR to add state references for any built-in

+* uniforms that are used.  This has to be done now (during linking).
+* Code generation doesn't happen until the first time this shader is
+* used for rendering.  Waiting until then to generate the parameters is
+* too late.  At that point, the values for the built-in uniforms won't
+* get sent to the shader.
+*/
+   nir_foreach_variable(var, &nir->uniforms) {
+  if (strncmp(var->name, "gl_", 3) == 0) {
+ const nir_state_slot *const slots = var->state_slots;
+ assert(var->state_slots != NULL);
+
+ for (unsigned int i = 0; i < var->num_state_slots; i++) {
+_mesa_add_state_reference(prog->Parameters,
+  (gl_state_index *)slots[i].tokens);
+ }
+  }
+   }
+
+   /* Avoid reallocation of the program parameter list, because the uniform
+* storage is only associated with the original parameter list.
+* This should be enough for Bitmap and DrawPixels constants.
+*/
+   _mesa_reserve_parameter_storage(prog->Parameters, 8);
+
+   /* This has to be done last.  Any operation the can cause
+* prog->ParameterValues to get reallocated (e.g., anything that adds a
+* program constant) has to happen before creating this linkage.
+*/
+   _mesa_associate_uniform_storage(st->ctx, shader_program, prog, true);
+
+   st_set_prog_affected_state_flags(prog);
+
 NIR_PASS_V(nir, nir_lower_io_to_temporaries,
   nir_shader_get_entrypoint(nir),
   true, true);
 NIR_PASS_V(nir, nir_lower_global_vars_to_local);
 NIR_PASS_V(nir, nir_split_var_copies);
 NIR_PASS_V(nir, nir_lower_var_copies);
 NIR_PASS_V(nir, st_nir_lower_builtin);
 NIR_PASS_V(nir, nir_lower_atomics, shader_program);
  
 /* fragment shaders may need : */

@@ -381,67 +414,32 @@ st_nir_get_mesa_program(struct gl_context *ctx,
 prog = shader->Program;
  
 prog->Parameters = _mesa_new_parameter_list();
  
 do_set_program_inouts(shader->ir, prog, shader->Stage);
  
 _mesa_copy_linked_program_data(shader_program, shader);

 _mesa_generate_parameters_list_for_uniforms(ctx, shader_program, shader,
 prog->Parameters);
  
-   /* Make a pass over the IR to add state references for any built-in

-* uniforms that are used.  This has to be done now (during linking).
-* Code generation doesn't happen until the first time this shader is
-* used for rendering.  Waiting until then to generate the parameters is
-* too late.  At that point, the values for the built-in uniforms won't
-* get sent to the shader.
-*/
-   foreach_in_list(ir_instruction, node, shader->ir) {
-  ir_variable *var = node->as_variable();
-
-  if ((var == NULL) || (var->data.mode != ir_var_uniform) ||
-  (strncmp(var->name, "gl_", 3) != 0))
- continue;
-
-  const ir_state_slot *const slots = var->get_state_slots();
-  assert(slots != NULL);
-
-  for (unsigned int i = 0; i < var->get_num_state_slots(); i++) {
- _mesa_add_state_reference(prog->Parameters,
-   (gl_state_index *) slots[i].tokens);
-  }
-   }
-
 if (ctx->_Shader->Flags & GLSL_DUMP) {
_mesa_log("\n");
_mesa_log("GLSL IR for linked %s program %d:\n",
   _mesa_shader_stage_to_string(shader->Stage),
   shader_program->Name);
_mesa_print_ir(_mesa_get_log_file(), shader->ir, NULL);
_mesa_log("\n\n");
 }
  
 prog->ExternalSamplersUsed = gl_external_samplers(prog);

 _mesa_update_shader_textures_used(shader_program, prog);
  
-   /* Avoid reallocation of the program parameter list, because the uniform

-* storage is only associated with the original parameter list.
-* This should be enough for Bitmap and DrawPixels constants.
-*/
-   _mesa_reserve_parameter_storage(prog->Param

Re: [Mesa-dev] [PATCH 1/2] st/glsl_to_nir: pass gl_shader_program to st_finalize_nir()

2017-11-02 Thread Nicolai Hähnle

This patch:

Reviewed-by: Nicolai Hähnle 

On 01.11.2017 06:20, Timothy Arceri wrote:

---
  src/mesa/state_tracker/st_glsl_to_nir.cpp | 24 ++--
  src/mesa/state_tracker/st_nir.h   |  4 +++-
  src/mesa/state_tracker/st_program.c   | 10 ++
  3 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp 
b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index e9a8d6414e..5b37d2cd63 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -313,21 +313,22 @@ sort_varyings(struct exec_list *var_list)
exec_node_remove(&var->node);
insert_sorted(&new_list, var);
 }
 exec_list_move_nodes_to(&new_list, var_list);
  }
  
  /* Second half of preparing nir from glsl, which happens after shader

   * variant lowering.
   */
  void
-st_finalize_nir(struct st_context *st, struct gl_program *prog, nir_shader 
*nir)
+st_finalize_nir(struct st_context *st, struct gl_program *prog,
+struct gl_shader_program *shader_program, nir_shader *nir)
  {
 struct pipe_screen *screen = st->pipe->screen;
  
 NIR_PASS_V(nir, nir_split_var_copies);

 NIR_PASS_V(nir, nir_lower_var_copies);
 NIR_PASS_V(nir, nir_lower_io_types);
  
 if (nir->info.stage == MESA_SHADER_VERTEX) {

/* Needs special handling so drvloc matches the vbo state: */
st_nir_assign_vs_in_locations(prog, nir);
@@ -347,41 +348,20 @@ st_finalize_nir(struct st_context *st, struct gl_program 
*prog, nir_shader *nir)
st_nir_fixup_varying_slots(st, &nir->inputs);
nir_assign_var_locations(&nir->outputs,
 &nir->num_outputs,
 type_size);
 } else if (nir->info.stage == MESA_SHADER_COMPUTE) {
 /* TODO? */
 } else {
unreachable("invalid shader type for tgsi bypass\n");
 }
  
-   struct gl_shader_program *shader_program;

-   switch (nir->info.stage) {
-   case MESA_SHADER_VERTEX:
-  shader_program = ((struct st_vertex_program *)prog)->shader_program;
-  break;
-   case MESA_SHADER_GEOMETRY:
-   case MESA_SHADER_TESS_CTRL:
-   case MESA_SHADER_TESS_EVAL:
-  shader_program = ((struct st_common_program *)prog)->shader_program;
-  break;
-   case MESA_SHADER_FRAGMENT:
-  shader_program = ((struct st_fragment_program *)prog)->shader_program;
-  break;
-   case MESA_SHADER_COMPUTE:
-  shader_program = ((struct st_compute_program *)prog)->shader_program;
-  break;
-   default:
-  assert(!"should not be reached");
-  return;
-   }
-
 NIR_PASS_V(nir, nir_lower_atomics_to_ssbo,
   st->ctx->Const.Program[nir->info.stage].MaxAtomicBuffers);
  
 st_nir_assign_uniform_locations(prog, shader_program,

 &nir->uniforms, &nir->num_uniforms);
  
 NIR_PASS_V(nir, nir_lower_system_values);
  
 if (screen->get_param(screen, PIPE_CAP_NIR_SAMPLERS_AS_DEREF))

NIR_PASS_V(nir, nir_lower_samplers_as_deref, shader_program);
diff --git a/src/mesa/state_tracker/st_nir.h b/src/mesa/state_tracker/st_nir.h
index 28d375c6fd..9302a7c786 100644
--- a/src/mesa/state_tracker/st_nir.h
+++ b/src/mesa/state_tracker/st_nir.h
@@ -34,21 +34,23 @@ extern "C" {
  struct nir_shader;
  
  void st_nir_lower_builtin(struct nir_shader *shader);

  void st_nir_lower_tex_src_plane(struct nir_shader *shader, unsigned 
free_slots,
  unsigned lower_2plane, unsigned lower_3plane);
  
  struct nir_shader * st_glsl_to_nir(struct st_context *st, struct gl_program *prog,

 struct gl_shader_program *shader_program,
 gl_shader_stage stage);
  
-void st_finalize_nir(struct st_context *st, struct gl_program *prog, struct nir_shader *nir);

+void st_finalize_nir(struct st_context *st, struct gl_program *prog,
+ struct gl_shader_program *shader_program,
+ struct nir_shader *nir);
  
  struct gl_program *

  st_nir_get_mesa_program(struct gl_context *ctx,
  struct gl_shader_program *shader_program,
  struct gl_linked_shader *shader);
  
  #ifdef __cplusplus

  }
  #endif
  
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c

index 335d45ba28..25a849bb18 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -555,21 +555,22 @@ st_create_vp_variant(struct st_context *st,
 if (stvp->tgsi.type == PIPE_SHADER_IR_NIR) {
vpv->tgsi.type = PIPE_SHADER_IR_NIR;
vpv->tgsi.ir.nir = nir_shader_clone(NULL, stvp->tgsi.ir.nir);
if (key->clamp_color)
   NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_clamp_color_outputs);
if (key->passthrough_edgeflags) {
   NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_passthrough_edgeflags);
   vpv->num_inputs++;
  

Re: [Mesa-dev] [PATCH 2/2] ac/radeonsi: add support for tex instr without a derefence

2017-11-02 Thread Nicolai Hähnle

Both patches:

Reviewed-by: Nicolai Hähnle 


On 01.11.2017 02:43, Timothy Arceri wrote:

These are produced by nir_lower_bitmap(), adding the missing derefence
would cause other issues that need to be hacked around such as
skipping sampler lowering and uniform location assignment, so this
change seems the correct way to go.

Fixes 194 piglit crashes on radeonsi using NIR.
---
  src/amd/common/ac_nir_to_llvm.c  | 80 
  src/gallium/drivers/radeonsi/si_shader_nir.c |  5 ++
  2 files changed, 51 insertions(+), 34 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index a736d34d12..2ec30517e0 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -173,20 +173,21 @@ struct nir_to_llvm_context {
  static inline struct nir_to_llvm_context *
  nir_to_llvm_context_from_abi(struct ac_shader_abi *abi)
  {
struct nir_to_llvm_context *ctx = NULL;
return container_of(abi, ctx, abi);
  }
  
  static LLVMValueRef get_sampler_desc(struct ac_nir_context *ctx,

 const nir_deref_var *deref,
 enum ac_descriptor_type desc_type,
+const nir_tex_instr *instr,
 bool image, bool write);
  
  static unsigned radeon_llvm_reg_index_soa(unsigned index, unsigned chan)

  {
return (index * 4) + chan;
  }
  
  static unsigned shader_io_get_unique_index(gl_varying_slot slot)

  {
/* handle patch indices separate */
@@ -3385,21 +3386,21 @@ static LLVMValueRef get_image_coords(struct 
ac_nir_context *ctx,
LLVMBuildAdd(ctx->ac.builder, 
fmask_load_address[chan],
LLVMBuildFPToUI(ctx->ac.builder, 
ctx->abi->frag_pos[chan],
ctx->ac.i32, ""), 
"");
fmask_load_address[2] = ac_to_integer(&ctx->ac, 
ctx->abi->inputs[radeon_llvm_reg_index_soa(VARYING_SLOT_LAYER, 0)]);
}
sample_index = adjust_sample_index_using_fmask(&ctx->ac,
   
fmask_load_address[0],
   
fmask_load_address[1],
   
fmask_load_address[2],
   sample_index,
-  
get_sampler_desc(ctx, instr->variables[0], AC_DESC_FMASK, true, false));
+  
get_sampler_desc(ctx, instr->variables[0], AC_DESC_FMASK, NULL, true, false));
}
if (count == 1 && !gfx9_1d) {
if (instr->src[0].ssa->num_components)
res = LLVMBuildExtractElement(ctx->ac.builder, src0, masks[0], 
"");
else
res = src0;
} else {
int chan;
if (is_ms)
count--;
@@ -3444,42 +3445,42 @@ static LLVMValueRef visit_image_load(struct 
ac_nir_context *ctx,
LLVMValueRef res;
char intrinsic_name[64];
const nir_variable *var = instr->variables[0]->var;
const struct glsl_type *type = var->type;
  
  	if(instr->variables[0]->deref.child)

type = instr->variables[0]->deref.child->type;
  
  	type = glsl_without_array(type);

if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_BUF) {
-   params[0] = get_sampler_desc(ctx, instr->variables[0], 
AC_DESC_BUFFER, true, false);
+   params[0] = get_sampler_desc(ctx, instr->variables[0], 
AC_DESC_BUFFER, NULL, true, false);
params[1] = LLVMBuildExtractElement(ctx->ac.builder, get_src(ctx, 
instr->src[0]),
ctx->ac.i32_0, ""); /* 
vindex */
params[2] = ctx->ac.i32_0; /* voffset */
params[3] = ctx->ac.i1false;  /* glc */
params[4] = ctx->ac.i1false;  /* slc */
res = ac_build_intrinsic(&ctx->ac, 
"llvm.amdgcn.buffer.load.format.v4f32", ctx->ac.v4f32,
 params, 5, 0);
  
  		res = trim_vector(&ctx->ac, res, instr->dest.ssa.num_components);

res = ac_to_integer(&ctx->ac, res);
} else {
bool is_da = glsl_sampler_type_is_array(type) ||
 glsl_get_sampler_dim(type) == 
GLSL_SAMPLER_DIM_CUBE ||
 glsl_get_sampler_dim(type) == 
GLSL_SAMPLER_DIM_SUBPASS ||
 glsl_get_sampler_dim(type) == 
GLSL_SAMPLER_DIM_SUBPASS_MS;
LLVMValueRef da = is_da ? ctx->ac.i1true : ctx->ac.i1false;
LLVMValueRef glc = ctx->ac.i1false;
LLVM

Re: [Mesa-dev] [PATCH 2/2] mesa/st: implement max combined output resources limiting.

2017-11-02 Thread Nicolai Hähnle
Could you already add the change to return a non-zero value from r600 so 
that *something* is using this cap?


Apart from that, both patches are

Reviewed-by: Nicolai Hähnle 


On 01.11.2017 00:58, Dave Airlie wrote:

From: Dave Airlie 

if the driver sets the cap, then use the value it gives us.

Signed-off-by: Dave Airlie 
---
  src/mesa/state_tracker/st_extensions.c | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 3dec5a8..fa2d002 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -78,6 +78,7 @@ void st_init_limits(struct pipe_screen *screen,
 int supported_irs;
 unsigned sh;
 boolean can_ubo = TRUE;
+   int temp;
  
 c->MaxTextureLevels

= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
@@ -469,6 +470,11 @@ void st_init_limits(struct pipe_screen *screen,
  
 c->UseSTD430AsDefaultPacking =

screen->get_param(screen, PIPE_CAP_LOAD_CONSTBUF);
+
+   /* limit the max combined shader output resources to a driver limit */
+   temp = screen->get_param(screen, 
PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES);
+   if (temp > 0 && c->MaxCombinedShaderOutputResources > temp)
+  c->MaxCombinedShaderOutputResources = temp;
  }
  
  




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


  1   2   >