Re: [Mesa-dev] [PATCH] i965/vec4: Delete the system value infastructure

2017-05-05 Thread Kenneth Graunke
On Friday, May 5, 2017 3:03:52 PM PDT Jason Ekstrand wrote:
> The only thing still using it is INVOCATION_ID for geometry shaders.
> That's easily enough inlined into the nir_intrinsic_load_invocation_id
> handling code.

And good riddance :)  Much simpler now.

Reviewed-by: Kenneth Graunke 


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


Re: [Mesa-dev] [PATCH] st/dri: Add fence extension to SW path

2017-05-05 Thread Emil Velikov
Hi Gurchetan,

On 5 May 2017 at 20:56, Gurchetan Singh  wrote:
> From: Gurchetan Singh 
>
> Use the same fence implementation for drisw.c as dri2.c by
> making dri2FenceExtension an external variable. This is desirable
> for synchronization in virtual machines.

Out of curiosity: can you share what virtual machines are you thinking of?

I cannot spot anything in the dri2_fence code that would require an
actual non-SW driver.
On that grounds we're fine, but drisw.c simply cannot depend on dri2.c
- please flesh the relevant code to another file.

I'm leaning towards dri_flush.{c,h} although other suggestions are welcome.

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


Re: [Mesa-dev] [PATCH 2/3] i965: Port 3DSTATE_VF to genxml and simplify the implementation.

2017-05-05 Thread Kenneth Graunke
On Friday, May 5, 2017 4:06:01 AM PDT Emil Velikov wrote:
> On 4 May 2017 at 18:51, Kenneth Graunke  wrote:
> > On Thursday, May 4, 2017 8:51:43 AM PDT Emil Velikov wrote:
> >> Hi Ken,
> >>
> >> On 4 May 2017 at 16:13, Kenneth Graunke  wrote:
> >>
> >> > +#if GEN_IS_HASWELL || GEN_GEN >= 8
> >> > +static void
> >> > +genX(upload_cut_index)(struct brw_context *brw)
> >> > +{
> >> > +   const struct gl_context *ctx = >ctx;
> >> > +
> >> > +   brw_batch_emit(brw, GENX(3DSTATE_VF), vf) {
> >> > +  if (ctx->Array._PrimitiveRestart && brw->ib.ib) {
> >> > + vf.IndexedDrawCutIndexEnable = true;
> >> Original code explicitly disables the cut index, which is no longer done 
> >> here.
> >> I take it that is was not required to begin with?
> >>
> >> -Emil
> >> P.S. Pardon if my question comes a bit silly.
> >
> > No, it's a good question.  There is a change in behavior, but I think
> > it should be equivalent in the case that matters.
> >
> > In the new code, we enable cutting for indexed draws and program a
> > meaningful cut index value draws when (a) there is an index buffer
> > and (b) primitive restart is enabled.  Otherwise, both fields are
> > zero filled, meaning cutting is disabled and the cut index is 0
> > (but unused, so it doesn't matter).
> >
> Sounds like I should have read the brw_batch_emit macro more
> carefully. I missed the zero fill part.

Cool, glad it makes sense now.  The macros used to take a C99-style
initializer list, in the old days, so it was more obvious that things
would be zero-initialized.  They still are, but it's not as clear.
On the plus side, it's more flexible...

--Ken


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


Re: [Mesa-dev] [PATCH] radeon: automake: remove unneeded elf Cflags/Libs

2017-05-05 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Thu, May 4, 2017 at 5:19 PM, Emil Velikov  wrote:
> From: Emil Velikov 
>
> No longer required as of commit d90bf4ef3e1 ("radeon: remove unused
> radeon_elf_util.{c,h}")
>
> Fixes: d90bf4ef3e1 ("radeon: remove unused  radeon_elf_util.{c,h}")
> Cc: Timothy Arceri 
> Signed-off-by: Emil Velikov 
> ---
>  src/gallium/drivers/radeon/Makefile.am | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/Makefile.am 
> b/src/gallium/drivers/radeon/Makefile.am
> index 57e31f751b3..2be6af4b155 100644
> --- a/src/gallium/drivers/radeon/Makefile.am
> +++ b/src/gallium/drivers/radeon/Makefile.am
> @@ -16,13 +16,11 @@ libradeon_la_SOURCES = \
>  if HAVE_GALLIUM_LLVM
>
>  AM_CFLAGS += \
> -   $(LLVM_CFLAGS) \
> -   $(LIBELF_CFLAGS)
> +   $(LLVM_CFLAGS)
>
>  libradeon_la_LIBADD = \
> $(CLOCK_LIB) \
> -   $(LLVM_LIBS) \
> -   $(LIBELF_LIBS)
> +   $(LLVM_LIBS)
>
>  libradeon_la_LDFLAGS = \
> $(LLVM_LDFLAGS)
> --
> 2.12.2
>
> ___
> 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 9/9] i965/vec4: Use NIR to do GS input remapping

2017-05-05 Thread Kenneth Graunke
On Thursday, May 4, 2017 7:11:47 PM PDT Jason Ekstrand wrote:
[snip]
> diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp
> index b387321..ad92951 100644
> --- a/src/intel/compiler/brw_vec4.cpp
> +++ b/src/intel/compiler/brw_vec4.cpp
> @@ -1693,50 +1693,6 @@ attribute_to_hw_reg(int attr, brw_reg_type type, bool 
> interleaved)
> return reg;
>  }

The copy of attribute_to_hw_reg in brw_vec4.cpp looks dead - apparently
you copied it to brw_vec4_gs_visitor.cpp and didn't delete the old one.

>  
> -
> -/**
> - * Replace each register of type ATTR in this->instructions with a reference
> - * to a fixed HW register.
> - *
> - * If interleaved is true, then each attribute takes up half a register, with
> - * register N containing attribute 2*N in its first half and attribute 2*N+1
> - * in its second half (this corresponds to the payload setup used by geometry
> - * shaders in "single" or "dual instanced" dispatch mode).  If interleaved is
> - * false, then each attribute takes up a whole register, with register N
> - * containing attribute N (this corresponds to the payload setup used by
> - * vertex shaders, and by geometry shaders in "dual object" dispatch mode).
> - */
> -void
> -vec4_visitor::lower_attributes_to_hw_regs(const int *attribute_map,
> -  bool interleaved)
> -{
> -   foreach_block_and_inst(block, vec4_instruction, inst, cfg) {
> -  for (int i = 0; i < 3; i++) {
> - if (inst->src[i].file != ATTR)
> -continue;
> -
> - int grf = attribute_map[inst->src[i].nr +
> - inst->src[i].offset / REG_SIZE];
> - assert(inst->src[i].offset % REG_SIZE == 0);
> -
> - /* All attributes used in the shader need to have been assigned a
> -  * hardware register by the caller
> -  */
> - assert(grf != 0);
> -
> - struct brw_reg reg =
> -attribute_to_hw_reg(grf, inst->src[i].type, interleaved);
> - reg.swizzle = inst->src[i].swizzle;
> - if (inst->src[i].abs)
> -reg = brw_abs(reg);
> - if (inst->src[i].negate)
> -reg = negate(reg);
> -
> - inst->src[i] = reg;
> -  }
> -   }
> -}
> -
>  int
>  vec4_vs_visitor::setup_attributes(int payload_reg)
>  {
> diff --git a/src/intel/compiler/brw_vec4_gs_visitor.cpp 
> b/src/intel/compiler/brw_vec4_gs_visitor.cpp
> index 4a8b5be..516ab0b 100644
> --- a/src/intel/compiler/brw_vec4_gs_visitor.cpp
> +++ b/src/intel/compiler/brw_vec4_gs_visitor.cpp
> @@ -29,6 +29,7 @@
>  
>  #include "brw_vec4_gs_visitor.h"
>  #include "gen6_gs_visitor.h"
> +#include "brw_cfg.h"
>  #include "brw_fs.h"
>  #include "brw_nir.h"
>  #include "common/gen_debug.h"
> @@ -72,9 +73,36 @@ vec4_gs_visitor::make_reg_for_system_value(int location)
> return reg;
>  }
>  
> +static inline struct brw_reg
> +attribute_to_hw_reg(int attr, brw_reg_type type, bool interleaved)
> +{
> +   struct brw_reg reg;
>  
> +   unsigned width = REG_SIZE / 2 / MAX2(4, type_sz(type));
> +   if (interleaved) {
> +  reg = stride(brw_vecn_grf(width, attr / 2, (attr % 2) * 4), 0, width, 
> 1);
> +   } else {
> +  reg = brw_vecn_grf(width, attr, 0);
> +   }
> +
> +   reg.type = type;
> +   return reg;
> +}

I see this is just the existing code moved over.

> +
> +/**
> + * Replace each register of type ATTR in this->instructions with a reference
> + * to a fixed HW register.
> + *
> + * If interleaved is true, then each attribute takes up half a register, with
> + * register N containing attribute 2*N in its first half and attribute 2*N+1
> + * in its second half (this corresponds to the payload setup used by geometry
> + * shaders in "single" or "dual instanced" dispatch mode).  If interleaved is
> + * false, then each attribute takes up a whole register, with register N
> + * containing attribute N (this corresponds to the payload setup used by
> + * vertex shaders, and by geometry shaders in "dual object" dispatch mode).
> + */
>  int
> -vec4_gs_visitor::setup_varying_inputs(int payload_reg, int *attribute_map,
> +vec4_gs_visitor::setup_varying_inputs(int payload_reg,
>int attributes_per_reg)
>  {
> /* For geometry shaders there are N copies of the input attributes, where 
> N
> @@ -89,12 +117,24 @@ vec4_gs_visitor::setup_varying_inputs(int payload_reg, 
> int *attribute_map,
> assert(num_input_vertices <= MAX_GS_INPUT_VERTICES);
> unsigned input_array_stride = prog_data->urb_read_length * 2;
>  
> -   for (int slot = 0; slot < c->input_vue_map.num_slots; slot++) {
> -  int varying = c->input_vue_map.slot_to_varying[slot];
> -  for (unsigned vertex = 0; vertex < num_input_vertices; vertex++) {
> - attribute_map[BRW_VARYING_SLOT_COUNT * vertex + varying] =
> -attributes_per_reg * payload_reg + input_array_stride * vertex +
> -slot;
> +   foreach_block_and_inst(block, vec4_instruction, 

Re: [Mesa-dev] [PATCH 6/9] i965/vec4: Use NIR remapping for VS attributes

2017-05-05 Thread Kenneth Graunke
On Friday, May 5, 2017 12:31:40 PM PDT Jason Ekstrand wrote:
> On Fri, May 5, 2017 at 12:38 AM, Alejandro Piñeiro 
> wrote:
> 
> > On 05/05/17 04:11, Jason Ekstrand wrote:
> > > We have to pass inputs_read through from prog_data because we may add an
> > > edge flag on old platforms.
> >
> > Well, the previous code was using nir->info->inputs_read. So perhaps
> > this explanation should explicitly point that prog_data->inputs_read and
> > nir->info->inputs_read they are not the same at that point (perhaps2,
> > and why?)
> >
> 
> Sure.  How about:
> 
> We also change nir_lower_vs_inputs to take an explicit inputs_read bitmask
> and pass in the inputs_read from prog_data instead from pulling it out of
> NIR.  This is because the version in prog_data may get EDGEFLAG added to it
> on some old platforms.

Why don't you just make them the same?  We're operating on a clone of
the nir_shader anyway, so we can whack nir->info.inputs_read however we
want.  Then we can just copy it to the prog_data structure, and you
won't accidentally read the wrong one and screw up.

> > Another nitpick and one question below.
> >
> > > ---
> > >  src/intel/compiler/brw_nir.c   | 12 +++
> > >  src/intel/compiler/brw_nir.h   |  2 +-
> > >  src/intel/compiler/brw_vec4.cpp| 54
> > +++---
> > >  src/intel/compiler/brw_vec4_nir.cpp| 49
> > ++-
> > >  src/intel/compiler/brw_vec4_visitor.cpp|  7 ++--
> > >  src/intel/compiler/brw_vec4_vs_visitor.cpp | 31 ++---
> > >  6 files changed, 33 insertions(+), 122 deletions(-)
> > >
> > > diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> > > index 556782e..5ca532f 100644
> > > --- a/src/intel/compiler/brw_nir.c
> > > +++ b/src/intel/compiler/brw_nir.c
> > > @@ -230,7 +230,7 @@ remap_patch_urb_offsets(nir_block *block,
> > nir_builder *b,
> > >
> > >  void
> > >  brw_nir_lower_vs_inputs(nir_shader *nir,
> > > -bool is_scalar,
> > > +uint64_t inputs_read,
> > >  bool use_legacy_snorm_formula,
> > >  const uint8_t *vs_attrib_wa_flags)
> > >  {
> > > @@ -253,11 +253,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
> > > brw_nir_apply_attribute_workarounds(nir, use_legacy_snorm_formula,
> > > vs_attrib_wa_flags);
> > >
> > > -   /* The last step is to remap VERT_ATTRIB_* to actual registers and
> > we only
> > > -* do that for scalar shaders at the moment.
> > > -*/
> > > -   if (!is_scalar)
> > > -  return;
> > > +   /* The last step is to remap VERT_ATTRIB_* to actual registers */
> > >
> > > const bool has_svgs =
> > >nir->info->system_values_read &
> > > @@ -266,7 +262,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
> > > BITFIELD64_BIT(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) |
> > > BITFIELD64_BIT(SYSTEM_VALUE_INSTANCE_ID));
> > >
> > > -   const unsigned num_inputs = _mesa_bitcount_64(nir->info->
> > inputs_read);
> > > +   const unsigned num_inputs = _mesa_bitcount_64(inputs_read);
> > >
> > > nir_foreach_function(function, nir) {
> > >if (!function->impl)
> > > @@ -340,7 +336,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
> > >  * before it and counting the bits.
> > >  */
> > > int attr = nir_intrinsic_base(intrin);
> > > -   int slot = _mesa_bitcount_64(nir->info->inputs_read &
> > > +   int slot = _mesa_bitcount_64(inputs_read &
> > >  BITFIELD64_MASK(attr));
> > > nir_intrinsic_set_base(intrin, slot);
> > > break;
> > > diff --git a/src/intel/compiler/brw_nir.h b/src/intel/compiler/brw_nir.h
> > > index b96072c..3bba68d 100644
> > > --- a/src/intel/compiler/brw_nir.h
> > > +++ b/src/intel/compiler/brw_nir.h
> > > @@ -98,7 +98,7 @@ nir_shader *brw_preprocess_nir(const struct
> > brw_compiler *compiler,
> > >  bool brw_nir_lower_intrinsics(nir_shader *nir,
> > >struct brw_stage_prog_data *prog_data);
> > >  void brw_nir_lower_vs_inputs(nir_shader *nir,
> > > - bool is_scalar,
> > > + uint64_t inputs_read,
> > >   bool use_legacy_snorm_formula,
> > >   const uint8_t *vs_attrib_wa_flags);
> > >  void brw_nir_lower_vue_inputs(nir_shader *nir, bool is_scalar,

With that suggestion, you can drop all of the above changes.


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


Re: [Mesa-dev] [PATCH 4/9] i965/fs: Lower gl_VertexID and friends to inputs at the NIR level

2017-05-05 Thread Kenneth Graunke
On Thursday, May 4, 2017 7:11:42 PM PDT Jason Ekstrand wrote:
> NIR calls these system values but they come in from the VF unit as
> vertex data.  It's terribly convenient to just be able to treat them as
> such in the back-end.
> ---
>  src/intel/compiler/brw_fs.h   |  1 -
>  src/intel/compiler/brw_fs_nir.cpp | 30 +--
>  src/intel/compiler/brw_fs_visitor.cpp | 38 --
>  src/intel/compiler/brw_nir.c  | 72 
> ++-
>  4 files changed, 71 insertions(+), 70 deletions(-)
> 
> diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h
> index e230b5e..6c8c027 100644
> --- a/src/intel/compiler/brw_fs.h
> +++ b/src/intel/compiler/brw_fs.h
> @@ -175,7 +175,6 @@ public:
> fs_reg *emit_samplepos_setup();
> fs_reg *emit_sampleid_setup();
> fs_reg *emit_samplemaskin_setup();
> -   fs_reg *emit_vs_system_value(int location);
> void emit_interpolation_setup_gen4();
> void emit_interpolation_setup_gen6();
> void compute_sample_position(fs_reg dst, fs_reg int_sample_pos);
> diff --git a/src/intel/compiler/brw_fs_nir.cpp 
> b/src/intel/compiler/brw_fs_nir.cpp
> index 3ab41df..d4ce753 100644
> --- a/src/intel/compiler/brw_fs_nir.cpp
> +++ b/src/intel/compiler/brw_fs_nir.cpp
> @@ -89,39 +89,11 @@ emit_system_values_block(nir_block *block, fs_visitor *v)
>   unreachable("should be lowered by lower_vertex_id().");
>  
>case nir_intrinsic_load_vertex_id_zero_base:
> - assert(v->stage == MESA_SHADER_VERTEX);
> - reg = >nir_system_values[SYSTEM_VALUE_VERTEX_ID_ZERO_BASE];
> - if (reg->file == BAD_FILE)
> -*reg = 
> *v->emit_vs_system_value(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE);
> - break;
> -
>case nir_intrinsic_load_base_vertex:
> - assert(v->stage == MESA_SHADER_VERTEX);
> - reg = >nir_system_values[SYSTEM_VALUE_BASE_VERTEX];
> - if (reg->file == BAD_FILE)
> -*reg = *v->emit_vs_system_value(SYSTEM_VALUE_BASE_VERTEX);
> - break;
> -
>case nir_intrinsic_load_instance_id:
> - assert(v->stage == MESA_SHADER_VERTEX);
> - reg = >nir_system_values[SYSTEM_VALUE_INSTANCE_ID];
> - if (reg->file == BAD_FILE)
> -*reg = *v->emit_vs_system_value(SYSTEM_VALUE_INSTANCE_ID);
> - break;
> -
>case nir_intrinsic_load_base_instance:
> - assert(v->stage == MESA_SHADER_VERTEX);
> - reg = >nir_system_values[SYSTEM_VALUE_BASE_INSTANCE];
> - if (reg->file == BAD_FILE)
> -*reg = *v->emit_vs_system_value(SYSTEM_VALUE_BASE_INSTANCE);
> - break;
> -
>case nir_intrinsic_load_draw_id:
> - assert(v->stage == MESA_SHADER_VERTEX);
> - reg = >nir_system_values[SYSTEM_VALUE_DRAW_ID];
> - if (reg->file == BAD_FILE)
> -*reg = *v->emit_vs_system_value(SYSTEM_VALUE_DRAW_ID);
> - break;
> + unreachable("should be lowered by brw_nir_lower_vs_inputs().");
>  
>case nir_intrinsic_load_invocation_id:
>   if (v->stage == MESA_SHADER_TESS_CTRL)
> diff --git a/src/intel/compiler/brw_fs_visitor.cpp 
> b/src/intel/compiler/brw_fs_visitor.cpp
> index 7904434..b6524d2 100644
> --- a/src/intel/compiler/brw_fs_visitor.cpp
> +++ b/src/intel/compiler/brw_fs_visitor.cpp
> @@ -32,44 +32,6 @@
>  
>  using namespace brw;
>  
> -fs_reg *
> -fs_visitor::emit_vs_system_value(int location)
> -{
> -   fs_reg *reg = new(this->mem_ctx)
> -  fs_reg(ATTR, 4 * _mesa_bitcount_64(nir->info->inputs_read),
> - BRW_REGISTER_TYPE_D);
> -
> -   switch (location) {
> -   case SYSTEM_VALUE_BASE_VERTEX:
> -  reg->offset = 0;
> -  break;
> -   case SYSTEM_VALUE_BASE_INSTANCE:
> -  reg->offset = REG_SIZE;
> -  break;
> -   case SYSTEM_VALUE_VERTEX_ID:
> -  unreachable("should have been lowered");
> -   case SYSTEM_VALUE_VERTEX_ID_ZERO_BASE:
> -  reg->offset = 2 * REG_SIZE;
> -  break;
> -   case SYSTEM_VALUE_INSTANCE_ID:
> -  reg->offset = 3 * REG_SIZE;
> -  break;
> -   case SYSTEM_VALUE_DRAW_ID:
> -  if (nir->info->system_values_read &
> -  (BITFIELD64_BIT(SYSTEM_VALUE_BASE_VERTEX) |
> -   BITFIELD64_BIT(SYSTEM_VALUE_BASE_INSTANCE) |
> -   BITFIELD64_BIT(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) |
> -   BITFIELD64_BIT(SYSTEM_VALUE_INSTANCE_ID)))
> - reg->nr += 4;
> -  reg->offset = 0;
> -  break;
> -   default:
> -  unreachable("not reached");
> -   }
> -
> -   return reg;
> -}
> -
>  /* Sample from the MCS surface attached to this multisample texture. */
>  fs_reg
>  fs_visitor::emit_mcs_fetch(const fs_reg , unsigned components,
> diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> index 7248594..556782e 100644
> --- a/src/intel/compiler/brw_nir.c
> +++ b/src/intel/compiler/brw_nir.c
> @@ -259,18 +259,81 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
> if (!is_scalar)
>return;
>  
> 

Re: [Mesa-dev] [PATCH] configure.ac: Also match -androideabi tuple

2017-05-05 Thread Chad Versace
On Fri 05 May 2017, Nicolas Boichat wrote:
> From: Nicolas Boichat 
> 
> On ARM Android platforms, the host_os tuple should be linux-androideabi,
> so let's match both -android and -androideabi (or any other
> -android* tuple) to determine if we should do an Android build.
> ---
>  configure.ac | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index a614458ab7c..df3eb6b29ac 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -269,7 +269,7 @@ DEFINES="-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS 
> -D__STDC_LIMIT_MACROS"
>  AC_SUBST([DEFINES])
>  android=no
>  case "$host_os" in
> -*-android)
> +*-android*)
>  android=yes
>  ;;
>  linux*|*-gnu*|gnu*|cygwin*)

Reviewed-by: Chad Versace 
And pushed.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] radv: always free nir shaders from modules on stack

2017-05-05 Thread Bas Nieuwenhuizen
Reviewed-by: Bas Nieuwenhuizen 

On Tue, May 2, 2017 at 10:05 PM, Grazvydas Ignotas  wrote:
> valgrind reports them as leaked, and I could not find anything making a
> copy of the nir pointer. Also, radv_device_init_meta_blit_color() is
> already freeing them unconditionally like this.
>
> Signed-off-by: Grazvydas Ignotas 
> ---
>  src/amd/vulkan/radv_meta_blit.c | 6 ++
>  src/amd/vulkan/radv_query.c | 6 ++
>  2 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_meta_blit.c b/src/amd/vulkan/radv_meta_blit.c
> index cc8ca32..ee3e286 100644
> --- a/src/amd/vulkan/radv_meta_blit.c
> +++ b/src/amd/vulkan/radv_meta_blit.c
> @@ -1292,14 +1292,12 @@ radv_device_init_meta_blit_state(struct radv_device 
> *device)
> result = radv_device_init_meta_blit_depth(device, );
> if (result != VK_SUCCESS)
> goto fail;
>
> result = radv_device_init_meta_blit_stencil(device, );
> -   if (result != VK_SUCCESS)
> -   goto fail;
> -   return VK_SUCCESS;
>
>  fail:
> ralloc_free(vs.nir);
> -   radv_device_finish_meta_blit_state(device);
> +   if (result != VK_SUCCESS)
> +   radv_device_finish_meta_blit_state(device);
> return result;
>  }
> diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
> index 6d2325d..a0241ca 100644
> --- a/src/amd/vulkan/radv_query.c
> +++ b/src/amd/vulkan/radv_query.c
> @@ -610,16 +610,14 @@ VkResult radv_device_init_meta_query_state(struct 
> radv_device *device)
>
> result = radv_CreateComputePipelines(radv_device_to_handle(device),
>  
> radv_pipeline_cache_to_handle(>meta_state.cache),
>  1, 
> _statistics_vk_pipeline_info, NULL,
>  
> >meta_state.query.pipeline_statistics_query_pipeline);
> -   if (result != VK_SUCCESS)
> -   goto fail;
>
> -   return VK_SUCCESS;
>  fail:
> -   radv_device_finish_meta_query_state(device);
> +   if (result != VK_SUCCESS)
> +   radv_device_finish_meta_query_state(device);
> ralloc_free(occlusion_cs.nir);
> ralloc_free(pipeline_statistics_cs.nir);
> return result;
>  }
>
> --
> 2.7.4
>
> ___
> 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 7/7] egl: use designated initializers

2017-05-05 Thread Chad Versace
I was going to write a similar patch series today, until I found
yours :) Thanks for cleaning this up.

By the way, I have some i965 Android logging fixups I need to send to
the list.

With the for-loop conditional fixed, the series is
Reviewed-by: Chad Versace 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965/vec4: Delete the system value infastructure

2017-05-05 Thread Jason Ekstrand
The only thing still using it is INVOCATION_ID for geometry shaders.
That's easily enough inlined into the nir_intrinsic_load_invocation_id
handling code.
---
 src/intel/compiler/brw_vec4.h  |  5 
 src/intel/compiler/brw_vec4_gs_nir.cpp | 32 -
 src/intel/compiler/brw_vec4_gs_visitor.cpp | 20 
 src/intel/compiler/brw_vec4_gs_visitor.h   |  2 --
 src/intel/compiler/brw_vec4_nir.cpp| 38 --
 src/intel/compiler/brw_vec4_tcs.cpp| 12 --
 src/intel/compiler/brw_vec4_tcs.h  |  2 --
 src/intel/compiler/brw_vec4_tes.cpp| 20 
 src/intel/compiler/brw_vec4_tes.h  |  2 --
 src/intel/compiler/brw_vec4_vs.h   |  1 -
 src/intel/compiler/brw_vec4_vs_visitor.cpp |  8 ---
 11 files changed, 5 insertions(+), 137 deletions(-)

diff --git a/src/intel/compiler/brw_vec4.h b/src/intel/compiler/brw_vec4.h
index 0f92f34..d828da0 100644
--- a/src/intel/compiler/brw_vec4.h
+++ b/src/intel/compiler/brw_vec4.h
@@ -332,8 +332,6 @@ public:
 
virtual void emit_nir_code();
virtual void nir_setup_uniforms();
-   virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
-   virtual void nir_setup_system_values();
virtual void nir_emit_impl(nir_function_impl *impl);
virtual void nir_emit_cf_list(exec_list *list);
virtual void nir_emit_if(nir_if *if_stmt);
@@ -359,11 +357,8 @@ public:
unsigned num_components = 4);
src_reg get_indirect_offset(nir_intrinsic_instr *instr);
 
-   virtual dst_reg *make_reg_for_system_value(int location) = 0;
-
dst_reg *nir_locals;
dst_reg *nir_ssa_values;
-   dst_reg *nir_system_values;
 
 protected:
void emit_vertex();
diff --git a/src/intel/compiler/brw_vec4_gs_nir.cpp 
b/src/intel/compiler/brw_vec4_gs_nir.cpp
index 577f587..77b753a 100644
--- a/src/intel/compiler/brw_vec4_gs_nir.cpp
+++ b/src/intel/compiler/brw_vec4_gs_nir.cpp
@@ -31,28 +31,6 @@ vec4_gs_visitor::nir_setup_inputs()
 }
 
 void
-vec4_gs_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
-{
-   dst_reg *reg;
-
-   switch (instr->intrinsic) {
-   case nir_intrinsic_load_primitive_id:
-  /* We'll just read g1 directly; don't create a temporary. */
-  break;
-
-   case nir_intrinsic_load_invocation_id:
-  reg = >nir_system_values[SYSTEM_VALUE_INVOCATION_ID];
-  if (reg->file == BAD_FILE)
- *reg = *this->make_reg_for_system_value(SYSTEM_VALUE_INVOCATION_ID);
-  break;
-
-   default:
-  vec4_visitor::nir_setup_system_value_intrinsic(instr);
-   }
-
-}
-
-void
 vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
 {
dst_reg dest;
@@ -128,11 +106,11 @@ vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr 
*instr)
   break;
 
case nir_intrinsic_load_invocation_id: {
-  src_reg invocation_id =
- src_reg(nir_system_values[SYSTEM_VALUE_INVOCATION_ID]);
-  assert(invocation_id.file != BAD_FILE);
-  dest = get_nir_dest(instr->dest, invocation_id.type);
-  emit(MOV(dest, invocation_id));
+  dest = get_nir_dest(instr->dest, BRW_REGISTER_TYPE_D);
+  if (gs_prog_data->invocations > 1)
+ emit(GS_OPCODE_GET_INSTANCE_ID, dest);
+  else
+ emit(MOV(dest, brw_imm_ud(0)));
   break;
}
 
diff --git a/src/intel/compiler/brw_vec4_gs_visitor.cpp 
b/src/intel/compiler/brw_vec4_gs_visitor.cpp
index 516ab0b..574174a 100644
--- a/src/intel/compiler/brw_vec4_gs_visitor.cpp
+++ b/src/intel/compiler/brw_vec4_gs_visitor.cpp
@@ -53,26 +53,6 @@ vec4_gs_visitor::vec4_gs_visitor(const struct brw_compiler 
*compiler,
 }
 
 
-dst_reg *
-vec4_gs_visitor::make_reg_for_system_value(int location)
-{
-   dst_reg *reg = new(mem_ctx) dst_reg(this, glsl_type::int_type);
-
-   switch (location) {
-   case SYSTEM_VALUE_INVOCATION_ID:
-  this->current_annotation = "initialize gl_InvocationID";
-  if (gs_prog_data->invocations > 1)
- emit(GS_OPCODE_GET_INSTANCE_ID, *reg);
-  else
- emit(MOV(*reg, brw_imm_ud(0)));
-  break;
-   default:
-  unreachable("not reached");
-   }
-
-   return reg;
-}
-
 static inline struct brw_reg
 attribute_to_hw_reg(int attr, brw_reg_type type, bool interleaved)
 {
diff --git a/src/intel/compiler/brw_vec4_gs_visitor.h 
b/src/intel/compiler/brw_vec4_gs_visitor.h
index 6b21a33..6602987 100644
--- a/src/intel/compiler/brw_vec4_gs_visitor.h
+++ b/src/intel/compiler/brw_vec4_gs_visitor.h
@@ -51,10 +51,8 @@ public:
int shader_time_index);
 
virtual void nir_setup_inputs();
-   virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
 
 protected:
-   virtual dst_reg *make_reg_for_system_value(int location);
virtual void setup_payload();
virtual void emit_prolog();
virtual void emit_thread_end();
diff --git a/src/intel/compiler/brw_vec4_nir.cpp 
b/src/intel/compiler/brw_vec4_nir.cpp
index 2a98932..c785534 100644
--- 

[Mesa-dev] [PATCH] i965/vec4: Delete the system value infastructure

2017-05-05 Thread Jason Ekstrand
---
 src/intel/compiler/brw_vec4.h  |  5 
 src/intel/compiler/brw_vec4_gs_nir.cpp | 32 -
 src/intel/compiler/brw_vec4_gs_visitor.cpp | 20 
 src/intel/compiler/brw_vec4_gs_visitor.h   |  2 --
 src/intel/compiler/brw_vec4_nir.cpp| 38 --
 src/intel/compiler/brw_vec4_tcs.cpp| 12 --
 src/intel/compiler/brw_vec4_tcs.h  |  2 --
 src/intel/compiler/brw_vec4_tes.cpp| 20 
 src/intel/compiler/brw_vec4_tes.h  |  2 --
 src/intel/compiler/brw_vec4_vs.h   |  1 -
 src/intel/compiler/brw_vec4_vs_visitor.cpp |  8 ---
 11 files changed, 5 insertions(+), 137 deletions(-)

diff --git a/src/intel/compiler/brw_vec4.h b/src/intel/compiler/brw_vec4.h
index 0f92f34..d828da0 100644
--- a/src/intel/compiler/brw_vec4.h
+++ b/src/intel/compiler/brw_vec4.h
@@ -332,8 +332,6 @@ public:
 
virtual void emit_nir_code();
virtual void nir_setup_uniforms();
-   virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
-   virtual void nir_setup_system_values();
virtual void nir_emit_impl(nir_function_impl *impl);
virtual void nir_emit_cf_list(exec_list *list);
virtual void nir_emit_if(nir_if *if_stmt);
@@ -359,11 +357,8 @@ public:
unsigned num_components = 4);
src_reg get_indirect_offset(nir_intrinsic_instr *instr);
 
-   virtual dst_reg *make_reg_for_system_value(int location) = 0;
-
dst_reg *nir_locals;
dst_reg *nir_ssa_values;
-   dst_reg *nir_system_values;
 
 protected:
void emit_vertex();
diff --git a/src/intel/compiler/brw_vec4_gs_nir.cpp 
b/src/intel/compiler/brw_vec4_gs_nir.cpp
index 577f587..77b753a 100644
--- a/src/intel/compiler/brw_vec4_gs_nir.cpp
+++ b/src/intel/compiler/brw_vec4_gs_nir.cpp
@@ -31,28 +31,6 @@ vec4_gs_visitor::nir_setup_inputs()
 }
 
 void
-vec4_gs_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
-{
-   dst_reg *reg;
-
-   switch (instr->intrinsic) {
-   case nir_intrinsic_load_primitive_id:
-  /* We'll just read g1 directly; don't create a temporary. */
-  break;
-
-   case nir_intrinsic_load_invocation_id:
-  reg = >nir_system_values[SYSTEM_VALUE_INVOCATION_ID];
-  if (reg->file == BAD_FILE)
- *reg = *this->make_reg_for_system_value(SYSTEM_VALUE_INVOCATION_ID);
-  break;
-
-   default:
-  vec4_visitor::nir_setup_system_value_intrinsic(instr);
-   }
-
-}
-
-void
 vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
 {
dst_reg dest;
@@ -128,11 +106,11 @@ vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr 
*instr)
   break;
 
case nir_intrinsic_load_invocation_id: {
-  src_reg invocation_id =
- src_reg(nir_system_values[SYSTEM_VALUE_INVOCATION_ID]);
-  assert(invocation_id.file != BAD_FILE);
-  dest = get_nir_dest(instr->dest, invocation_id.type);
-  emit(MOV(dest, invocation_id));
+  dest = get_nir_dest(instr->dest, BRW_REGISTER_TYPE_D);
+  if (gs_prog_data->invocations > 1)
+ emit(GS_OPCODE_GET_INSTANCE_ID, dest);
+  else
+ emit(MOV(dest, brw_imm_ud(0)));
   break;
}
 
diff --git a/src/intel/compiler/brw_vec4_gs_visitor.cpp 
b/src/intel/compiler/brw_vec4_gs_visitor.cpp
index 516ab0b..574174a 100644
--- a/src/intel/compiler/brw_vec4_gs_visitor.cpp
+++ b/src/intel/compiler/brw_vec4_gs_visitor.cpp
@@ -53,26 +53,6 @@ vec4_gs_visitor::vec4_gs_visitor(const struct brw_compiler 
*compiler,
 }
 
 
-dst_reg *
-vec4_gs_visitor::make_reg_for_system_value(int location)
-{
-   dst_reg *reg = new(mem_ctx) dst_reg(this, glsl_type::int_type);
-
-   switch (location) {
-   case SYSTEM_VALUE_INVOCATION_ID:
-  this->current_annotation = "initialize gl_InvocationID";
-  if (gs_prog_data->invocations > 1)
- emit(GS_OPCODE_GET_INSTANCE_ID, *reg);
-  else
- emit(MOV(*reg, brw_imm_ud(0)));
-  break;
-   default:
-  unreachable("not reached");
-   }
-
-   return reg;
-}
-
 static inline struct brw_reg
 attribute_to_hw_reg(int attr, brw_reg_type type, bool interleaved)
 {
diff --git a/src/intel/compiler/brw_vec4_gs_visitor.h 
b/src/intel/compiler/brw_vec4_gs_visitor.h
index 6b21a33..6602987 100644
--- a/src/intel/compiler/brw_vec4_gs_visitor.h
+++ b/src/intel/compiler/brw_vec4_gs_visitor.h
@@ -51,10 +51,8 @@ public:
int shader_time_index);
 
virtual void nir_setup_inputs();
-   virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
 
 protected:
-   virtual dst_reg *make_reg_for_system_value(int location);
virtual void setup_payload();
virtual void emit_prolog();
virtual void emit_thread_end();
diff --git a/src/intel/compiler/brw_vec4_nir.cpp 
b/src/intel/compiler/brw_vec4_nir.cpp
index 2a98932..c785534 100644
--- a/src/intel/compiler/brw_vec4_nir.cpp
+++ b/src/intel/compiler/brw_vec4_nir.cpp
@@ -37,8 +37,6 @@ vec4_visitor::emit_nir_code()
if (nir->num_uniforms > 0)

[Mesa-dev] [Bug 100951] vkcube fails with vkMapMemory failed

2017-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100951

Bug ID: 100951
   Summary: vkcube fails with vkMapMemory failed
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Vulkan/radeon
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: dark.shad...@web.de
QA Contact: mesa-dev@lists.freedesktop.org

When running the Vulkan demo program vkcube, it fails on vkMapMemory. When
skipping the check, it segfaults.
Note that this is a regression, it used to work with the same program.


System it was tested with:
- Arch Linux 64bit
- Linux 4.10.13, AMDGPU driver
- Mesa 17.2.0-devel (git-a5f82db380) / Mesa 17.0.5
- Radeon R9 285

Demo program: https://github.com/krh/vkcube

-- 
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] [Bug 100948] Please add an ssh account, fdo username: rantogno

2017-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100948

--- Comment #2 from Kenneth Graunke  ---
FWIW, Rafael works at Intel on the i965 team and has 46 Mesa patches upstream. 
I suggested he apply for a freedesktop account and Mesa commit access.

-- 
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] st/dri: Add fence extension to SW path

2017-05-05 Thread Gurchetan Singh
From: Gurchetan Singh 

Use the same fence implementation for drisw.c as dri2.c by
making dri2FenceExtension an external variable. This is desirable
for synchronization in virtual machines.
---
 src/gallium/state_trackers/dri/dri2.c | 2 +-
 src/gallium/state_trackers/dri/dri_drawable.h | 1 +
 src/gallium/state_trackers/dri/drisw.c| 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/dri/dri2.c 
b/src/gallium/state_trackers/dri/dri2.c
index ed6004f836..2556777b67 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1604,7 +1604,7 @@ dri2_server_wait_sync(__DRIcontext *_ctx, void *_fence, 
unsigned flags)
   ctx->fence_server_sync(ctx, fence->pipe_fence);
 }
 
-static __DRI2fenceExtension dri2FenceExtension = {
+const __DRI2fenceExtension dri2FenceExtension = {
.base = { __DRI2_FENCE, 2 },
 
.create_fence = dri2_create_fence,
diff --git a/src/gallium/state_trackers/dri/dri_drawable.h 
b/src/gallium/state_trackers/dri/dri_drawable.h
index 1f9842ea54..0c3e19563a 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/dri_drawable.h
@@ -123,6 +123,7 @@ dri_flush(__DRIcontext *cPriv,
 
 extern const __DRItexBufferExtension driTexBufferExtension;
 extern const __DRI2throttleExtension dri2ThrottleExtension;
+extern const __DRI2fenceExtension dri2FenceExtension;
 #endif
 
 /* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/drisw.c 
b/src/gallium/state_trackers/dri/drisw.c
index b85a73c57d..bc5fbae040 100644
--- a/src/gallium/state_trackers/dri/drisw.c
+++ b/src/gallium/state_trackers/dri/drisw.c
@@ -369,6 +369,7 @@ static const __DRIextension *drisw_screen_extensions[] = {
,
,
,
+   ,
NULL
 };
 
-- 
2.12.2

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


[Mesa-dev] [Bug 100708] Trine 2 doesn't start on radeonsi on mesa 17

2017-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100708

--- Comment #8 from Nikita Krupenko  ---
How about revert that commit?

-- 
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] anv/allocator: Fix build if valgrind is not found.

2017-05-05 Thread Rafael Antognolli
There's no >_vg_ptr in that case.

Signed-off-by: Rafael Antognolli 
Cc: Jason Ekstrand 
---
 src/intel/vulkan/anv_allocator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index e2f2dea..6d04b63 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -927,7 +927,9 @@ anv_state_stream_alloc(struct anv_state_stream *stream,
   VG_NOACCESS_WRITE(>block, stream->block);
   VG_NOACCESS_WRITE(>next, stream->block_list);
   stream->block_list = sb;
+#ifdef HAVE_VALGRIND
   VG_NOACCESS_WRITE(>_vg_ptr, NULL);
+#endif
 
   VG(VALGRIND_MAKE_MEM_NOACCESS(stream->block.map, stream->block_size));
 
-- 
2.9.3

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


Re: [Mesa-dev] [PATCH] anv/allocator: Only write to _vg_ptr if we have valgrind

2017-05-05 Thread Chad Versace
On Fri 05 May 2017, Jason Ekstrand wrote:
> This fixes the build when not building against valgrind headers.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100945
> ---
>  src/intel/vulkan/anv_allocator.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Chad Versace 

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


Re: [Mesa-dev] [PATCH] anv: Always set the reloc value to match the presumed_offset

2017-05-05 Thread Jason Ekstrand
On Fri, May 5, 2017 at 5:09 AM, Chris Wilson 
wrote:

> It is a requirement, not just of using the NO_RELOC mode, that all
> relocation values in the execobjects match their reloc.presumed_offset,
> as the kernel will skip performing *any* relocation if the presumed_offset
> matches the target object. As anv is setting unknown relocations to -1
> irrespective of the actual value, if the kernel placed the target at -1
> (i.e. 0xf000 for 48bit GTT), it would happily skip the relocation.
> To prevent this, we need to always do the userspace relocations to ensure
> the values match. To improve further, set the unknown object offset to 0
> (a valid location) on the offchance it is available and the migration
> skipped.
>

Is this a real issue?  I specifically chose -1 because it *wasn't*
page-aligned.  I don't think the kernel whacks off the bottom 12 bits
before doing the comparison to determine whether or not the relocation
needs to happen.

--Jason


> Signed-off-by: Chris Wilson 
> Cc: Jason Ekstrand 
> ---
>  src/intel/vulkan/anv_batch_chain.c | 97 --
> 
>  src/intel/vulkan/anv_private.h |  2 +-
>  2 files changed, 32 insertions(+), 67 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_batch_chain.c
> b/src/intel/vulkan/anv_batch_chain.c
> index 0529f22b84..46c4ce6efb 100644
> --- a/src/intel/vulkan/anv_batch_chain.c
> +++ b/src/intel/vulkan/anv_batch_chain.c
> @@ -1205,28 +1205,10 @@ anv_reloc_list_apply(struct anv_device *device,
>   * probably the fastest mechanism for doing relocations since the kernel
> would
>   * have to make a full copy of all the relocations lists.
>   */
> -static bool
> +static void
>  relocate_cmd_buffer(struct anv_cmd_buffer *cmd_buffer,
>  struct anv_execbuf *exec)
>  {
> -   static int userspace_relocs = -1;
> -   if (userspace_relocs < 0)
> -  userspace_relocs = env_var_as_boolean("ANV_USERSPACE_RELOCS",
> true);
> -   if (!userspace_relocs)
> -  return false;
> -
> -   /* First, we have to check to see whether or not we can even do the
> -* relocation.  New buffers which have never been submitted to the
> kernel
> -* don't have a valid offset so we need to let the kernel do
> relocations so
> -* that we can get offsets for them.  On future execbuf2 calls, those
> -* buffers will have offsets and we will be able to skip relocating.
> -* Invalid offsets are indicated by anv_bo::offset == (uint64_t)-1.
> -*/
> -   for (uint32_t i = 0; i < exec->bo_count; i++) {
> -  if (exec->bos[i]->offset == (uint64_t)-1)
> - return false;
> -   }
> -
> /* Since surface states are shared between command buffers and we don't
>  * know what order they will be submitted to the kernel, we don't know
>  * what address is actually written in the surface state object at any
> @@ -1248,8 +1230,6 @@ relocate_cmd_buffer(struct anv_cmd_buffer
> *cmd_buffer,
>
> for (uint32_t i = 0; i < exec->bo_count; i++)
>exec->objects[i].offset = exec->bos[i]->offset;
> -
> -   return true;
>  }
>
>  static VkResult
> @@ -1334,55 +1314,40 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf
> *execbuf,
>.buffer_count = execbuf->bo_count,
>.batch_start_offset = 0,
>.batch_len = batch->next - batch->start,
> -  .cliprects_ptr = 0,
> -  .num_cliprects = 0,
> -  .DR1 = 0,
> -  .DR4 = 0,
> -  .flags = I915_EXEC_HANDLE_LUT | I915_EXEC_RENDER |
> -   I915_EXEC_CONSTANTS_REL_GENERAL,
> +  .flags =
> + I915_EXEC_RENDER |
> + I915_EXEC_HANDLE_LUT |
> + I915_EXEC_NO_RELOC |
> + I915_EXEC_CONSTANTS_REL_GENERAL,
>.rsvd1 = cmd_buffer->device->context_id,
>.rsvd2 = 0,
> };
>
> -   if (relocate_cmd_buffer(cmd_buffer, execbuf)) {
> -  /* If we were able to successfully relocate everything, tell the
> kernel
> -   * that it can skip doing relocations. The requirement for using
> -   * NO_RELOC is:
> -   *
> -   *  1) The addresses written in the objects must match the
> corresponding
> -   * reloc.presumed_offset which in turn must match the
> corresponding
> -   * execobject.offset.
> -   *
> -   *  2) To avoid stalling, execobject.offset should match the current
> -   * address of that object within the active context.
> -   *
> -   * In order to satisfy all of the invariants that make userspace
> -   * relocations to be safe (see relocate_cmd_buffer()), we need to
> -   * further ensure that the addresses we use match those used by the
> -   * kernel for the most recent execbuf2.
> -   *
> -   * The kernel may still choose to do relocations anyway if
> something has
> -   * moved in the GTT. In this case, the relocation list still needs
> to be
> -   * valid.  All relocations on the batch buffers are already 

Re: [Mesa-dev] [PATCH 6/9] i965/vec4: Use NIR remapping for VS attributes

2017-05-05 Thread Jason Ekstrand
On Fri, May 5, 2017 at 12:38 AM, Alejandro Piñeiro 
wrote:

> On 05/05/17 04:11, Jason Ekstrand wrote:
> > We have to pass inputs_read through from prog_data because we may add an
> > edge flag on old platforms.
>
> Well, the previous code was using nir->info->inputs_read. So perhaps
> this explanation should explicitly point that prog_data->inputs_read and
> nir->info->inputs_read they are not the same at that point (perhaps2,
> and why?)
>

Sure.  How about:

We also change nir_lower_vs_inputs to take an explicit inputs_read bitmask
and pass in the inputs_read from prog_data instead from pulling it out of
NIR.  This is because the version in prog_data may get EDGEFLAG added to it
on some old platforms.


> Another nitpick and one question below.
>
> > ---
> >  src/intel/compiler/brw_nir.c   | 12 +++
> >  src/intel/compiler/brw_nir.h   |  2 +-
> >  src/intel/compiler/brw_vec4.cpp| 54
> +++---
> >  src/intel/compiler/brw_vec4_nir.cpp| 49
> ++-
> >  src/intel/compiler/brw_vec4_visitor.cpp|  7 ++--
> >  src/intel/compiler/brw_vec4_vs_visitor.cpp | 31 ++---
> >  6 files changed, 33 insertions(+), 122 deletions(-)
> >
> > diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> > index 556782e..5ca532f 100644
> > --- a/src/intel/compiler/brw_nir.c
> > +++ b/src/intel/compiler/brw_nir.c
> > @@ -230,7 +230,7 @@ remap_patch_urb_offsets(nir_block *block,
> nir_builder *b,
> >
> >  void
> >  brw_nir_lower_vs_inputs(nir_shader *nir,
> > -bool is_scalar,
> > +uint64_t inputs_read,
> >  bool use_legacy_snorm_formula,
> >  const uint8_t *vs_attrib_wa_flags)
> >  {
> > @@ -253,11 +253,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
> > brw_nir_apply_attribute_workarounds(nir, use_legacy_snorm_formula,
> > vs_attrib_wa_flags);
> >
> > -   /* The last step is to remap VERT_ATTRIB_* to actual registers and
> we only
> > -* do that for scalar shaders at the moment.
> > -*/
> > -   if (!is_scalar)
> > -  return;
> > +   /* The last step is to remap VERT_ATTRIB_* to actual registers */
> >
> > const bool has_svgs =
> >nir->info->system_values_read &
> > @@ -266,7 +262,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
> > BITFIELD64_BIT(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) |
> > BITFIELD64_BIT(SYSTEM_VALUE_INSTANCE_ID));
> >
> > -   const unsigned num_inputs = _mesa_bitcount_64(nir->info->
> inputs_read);
> > +   const unsigned num_inputs = _mesa_bitcount_64(inputs_read);
> >
> > nir_foreach_function(function, nir) {
> >if (!function->impl)
> > @@ -340,7 +336,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
> >  * before it and counting the bits.
> >  */
> > int attr = nir_intrinsic_base(intrin);
> > -   int slot = _mesa_bitcount_64(nir->info->inputs_read &
> > +   int slot = _mesa_bitcount_64(inputs_read &
> >  BITFIELD64_MASK(attr));
> > nir_intrinsic_set_base(intrin, slot);
> > break;
> > diff --git a/src/intel/compiler/brw_nir.h b/src/intel/compiler/brw_nir.h
> > index b96072c..3bba68d 100644
> > --- a/src/intel/compiler/brw_nir.h
> > +++ b/src/intel/compiler/brw_nir.h
> > @@ -98,7 +98,7 @@ nir_shader *brw_preprocess_nir(const struct
> brw_compiler *compiler,
> >  bool brw_nir_lower_intrinsics(nir_shader *nir,
> >struct brw_stage_prog_data *prog_data);
> >  void brw_nir_lower_vs_inputs(nir_shader *nir,
> > - bool is_scalar,
> > + uint64_t inputs_read,
> >   bool use_legacy_snorm_formula,
> >   const uint8_t *vs_attrib_wa_flags);
> >  void brw_nir_lower_vue_inputs(nir_shader *nir, bool is_scalar,
> > diff --git a/src/intel/compiler/brw_vec4.cpp
> b/src/intel/compiler/brw_vec4.cpp
> > index 21f34bc..b387321 100644
> > --- a/src/intel/compiler/brw_vec4.cpp
> > +++ b/src/intel/compiler/brw_vec4.cpp
> > @@ -1740,40 +1740,23 @@ vec4_visitor::lower_attributes_to_hw_regs(const
> int *attribute_map,
> >  int
> >  vec4_vs_visitor::setup_attributes(int payload_reg)
> >  {
> > -   int nr_attributes;
> > -   int attribute_map[VERT_ATTRIB_MAX + 2];
> > -   memset(attribute_map, 0, sizeof(attribute_map));
> > -
> > -   nr_attributes = 0;
> > -   GLbitfield64 vs_inputs = vs_prog_data->inputs_read;
> > -   while (vs_inputs) {
> > -  GLuint first = ffsll(vs_inputs) - 1;
> > -  int needed_slots =
> > - (vs_prog_data->double_inputs_read & BITFIELD64_BIT(first)) ?
> 2 : 1;
> > -  for (int c = 0; c < needed_slots; c++) {
> > - attribute_map[first + c] = payload_reg + nr_attributes;
> > - 

[Mesa-dev] [PATCH] egl: Fix -Wint-to-pointer-cast

2017-05-05 Thread Chad Versace
main/egldisplay.c: In function '_eglParseX11DisplayAttribList':
main/egldisplay.c:491:38: warning: cast to pointer from integer of different 
size [-Wint-to-pointer-cast]
  display->Options.Platform = (void *)value;

The fix: cast to uinptr_t before void*.
  ^
Fixes: ddb99127 egl/x11: Honor the EGL_PLATFORM_X11_SCREEN_EXT attribute
Cc: Adam Jackson 
---
 src/egl/main/egldisplay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index b047a5de42..56f802b1aa 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -488,7 +488,7 @@ _eglParseX11DisplayAttribList(_EGLDisplay *display, const 
EGLint *attrib_list)
* EGL_PLATFORM_X11_SCREEN_EXT, which is optional.
*/
   if (attrib == EGL_PLATFORM_X11_SCREEN_EXT) {
- display->Options.Platform = (void *)value;
+ display->Options.Platform = (void *)(uintptr_t)value;
   } else {
  _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
  return EGL_FALSE;
-- 
2.12.0

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


Re: [Mesa-dev] [RFC PATCH 04/17] include/pipe: Store the byte-size of a SPIR-V binary

2017-05-05 Thread Francisco Jerez
Pierre Moreau  writes:

> Besides parsing all the opcodes until reaching the EOF character, there
> is no way to compute the size of a SPIR-V binary. Therefore, it is
> easier to pass it along the SPIR-V binary in pipe_compute_state.
>

LLVM IR programs use pipe_llvm_program_header in order to provide the
same information.  Not necessarily opposed to doing it this way but I
think it would make sense for the SPIR-V and LLVM paths to use the same
mechanism.

> Signed-off-by: Pierre Moreau 
> ---
>  src/gallium/include/pipe/p_state.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/gallium/include/pipe/p_state.h 
> b/src/gallium/include/pipe/p_state.h
> index ce9ca34d29..1f8fdf530f 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -810,6 +810,7 @@ struct pipe_compute_state
>  {
> enum pipe_shader_ir ir_type; /**< IR type contained in prog. */
> const void *prog; /**< Compute program to be executed. */
> +   unsigned prog_num_bytes; /**< Program size in bytes, used by SPIR-V. */
> unsigned req_local_mem; /**< Required size of the LOCAL resource. */
> unsigned req_private_mem; /**< Required size of the PRIVATE resource. */
> unsigned req_input_mem; /**< Required size of the INPUT resource. */
> -- 
> 2.12.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH 00/18] anv: Rework the allocation data structures

2017-05-05 Thread Jason Ekstrand
Sorry about that.  It only fails if you *don't* build against valgrind
headers.  Since my dev machine and our CI are both set up with valgrind
support, I didn't catch it.  I've sent a patch to the list to fix this.

--Jason

On Fri, May 5, 2017 at 5:36 AM, Mike Lothian  wrote:

> I'm seeing the following failure with GCC 7.1:
>
> /var/tmp/portage/media-libs/mesa-/work/mesa-/src/intel/vulkan/anv_allocator.c:
> In function ‘anv_state_stream_alloc’:
> /var/tmp/portage/media-libs/mesa-/work/mesa-/src/
> intel/vulkan/anv_allocator.c:930:28: error: ‘struct
> anv_state_stream_block’ has no member named ‘_vg_ptr’
>VG_NOACCESS_WRITE(>_vg_ptr, NULL);
> ^
> /var/tmp/portage/media-libs/mesa-/work/mesa-/src/
> intel/vulkan/anv_allocator.c:53:44: note: in definition of macro
> ‘VG_NOACCESS_WRITE’
>  #define VG_NOACCESS_WRITE(__ptr, __val) (*(__ptr) = (__val))
> ^
> At top level:
> /var/tmp/portage/media-libs/mesa-/work/mesa-/src/
> intel/vulkan/anv_allocator.c:1214:1: warning: ‘anv_bo_cache_lookup’
> defined but not used [-Wunused-function]
>  anv_bo_cache_lookup(struct anv_bo_cache *cache, uint32_t gem_handle)
>  ^~~
>
>
> On Thu, 4 May 2017 at 09:09 Juan A. Suarez Romero 
> wrote:
>
>> On Tue, 2017-05-02 at 06:44 -0700, Jason Ekstrand wrote:
>> > Juan,
>> >
>> > Were you planning to review the rest of the series?  Just wondering.
>> >
>>
>> Sorry, it took a bit more to review the remaining patches.
>>
>> Now it is done.
>>
>>
>> J.A.
>>
>> > --Jason
>> >
>> >
>> > On April 26, 2017 7:35:29 AM Jason Ekstrand 
>> wrote:
>> >
>> > > This absurdly long series does something fairly simple:  It pulls the
>> > > block_pool into the state_pool and makes the state pool capable of
>> > > allocating states larger than the block size.  Unfortunately, there
>> was no
>> > > good way to do it in less than 18 patches. :-(
>> > >
>> > > Cc: Juan A. Suarez Romero 
>> > >
>> > > Jason Ekstrand (18):
>> > >   anv/allocator: Add no-valgrind versions of state_pool_alloc/free
>> > >   anv/allocator: Return a null state for zero-size allocations
>> > >   anv/allocator: Convert the state stream to pull from a state pool
>> > >   anv: Get rid of a bunch of uses of size_t
>> > >   anv/allocator: Remove the state_size field from
>> fixed_size_state_pool
>> > >   anv/allocator: Roll fixed_size_state_pool into state_pool
>> > >   anv/allocator: Pull the userptr part of block_pool_grow into a
>> helper
>> > >   anv/allocator: Drop the block_size field from block_pool
>> > >   anv/allocator: Add support for "back" allocations to state_pool
>> > >   anv: Allocate binding table blocks through the state pool
>> > >   anv/allocator: Get rid of the ability to free blocks
>> > >   anv/allocator: Embed the block_pool in the state_pool
>> > >   anv/allocator: Rework a comment
>> > >   anv/allocator: Add the capability to allocate blocks of different
>> > > sizes
>> > >   anv/allocator: Add helpers for dealing with bucket sizes
>> > >   anv/allocator: Support pushing multiple blocks onto a free list at
>> > > once
>> > >   anv/allocator: Allow state pools to allocate large states
>> > >   anv: Drop the instruction pool block size
>> > >
>> > >  src/intel/vulkan/anv_allocator.c   | 589
>> -
>> > >  src/intel/vulkan/anv_batch_chain.c |  84 ++-
>> > >  src/intel/vulkan/anv_blorp.c   |   4 +-
>> > >  src/intel/vulkan/anv_cmd_buffer.c  |   8 +-
>> > >  src/intel/vulkan/anv_descriptor_set.c  |   4 +-
>> > >  src/intel/vulkan/anv_device.c  |  26 +-
>> > >  src/intel/vulkan/anv_gem.c |   2 +-
>> > >  src/intel/vulkan/anv_gem_stubs.c   |   2 +-
>> > >  src/intel/vulkan/anv_private.h |  74 +--
>> > >  src/intel/vulkan/gen8_cmd_buffer.c |   6 +-
>> > >  src/intel/vulkan/genX_blorp_exec.c |   2 +-
>> > >  src/intel/vulkan/genX_cmd_buffer.c |  15 +-
>> > >  src/intel/vulkan/tests/block_pool_no_free.c|   8 +-
>> > >  src/intel/vulkan/tests/state_pool.c|   5 +-
>> > >  src/intel/vulkan/tests/state_pool_free_list_only.c |   5 +-
>> > >  src/intel/vulkan/tests/state_pool_no_free.c|   5 +-
>> > >  16 files changed, 461 insertions(+), 378 deletions(-)
>> > >
>> > > --
>> > > 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


Re: [Mesa-dev] [PATCH 9/9] i965/vec4: Use NIR to do GS input remapping

2017-05-05 Thread Jason Ekstrand
On Fri, May 5, 2017 at 1:04 AM, Alejandro Piñeiro 
wrote:

> On 05/05/17 04:11, Jason Ekstrand wrote:
> > We're already doing this in the FS back-end.  This just does the same
> > thing in the vec4 back-end.
> > ---
> >  src/intel/compiler/brw_nir.c   |  3 --
> >  src/intel/compiler/brw_vec4.cpp| 44 ---
> >  src/intel/compiler/brw_vec4.h  |  2 -
> >  src/intel/compiler/brw_vec4_gs_nir.cpp | 10 ++---
> >  src/intel/compiler/brw_vec4_gs_visitor.cpp | 70
> +-
> >  src/intel/compiler/brw_vec4_gs_visitor.h   |  4 +-
> >  src/intel/compiler/gen6_gs_visitor.cpp |  4 +-
> >  7 files changed, 56 insertions(+), 81 deletions(-)
> >
> > diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> > index d92e8fa..8a9f89f 100644
> > --- a/src/intel/compiler/brw_nir.c
> > +++ b/src/intel/compiler/brw_nir.c
> > @@ -342,9 +342,6 @@ brw_nir_lower_vue_inputs(nir_shader *nir, bool
> is_scalar,
> > /* Inputs are stored in vec4 slots, so use type_size_vec4(). */
> > nir_lower_io(nir, nir_var_shader_in, type_size_vec4, 0);
> >
> > -   if (nir->stage == MESA_SHADER_GEOMETRY && !is_scalar)
> > -  return;
> > -
> > /* This pass needs actual constants */
> > nir_opt_constant_folding(nir);
> >
> > diff --git a/src/intel/compiler/brw_vec4.cpp
> b/src/intel/compiler/brw_vec4.cpp
> > index b387321..ad92951 100644
> > --- a/src/intel/compiler/brw_vec4.cpp
> > +++ b/src/intel/compiler/brw_vec4.cpp
> > @@ -1693,50 +1693,6 @@ attribute_to_hw_reg(int attr, brw_reg_type type,
> bool interleaved)
> > return reg;
> >  }
> >
> > -
> > -/**
> > - * Replace each register of type ATTR in this->instructions with a
> reference
> > - * to a fixed HW register.
> > - *
> > - * If interleaved is true, then each attribute takes up half a
> register, with
> > - * register N containing attribute 2*N in its first half and attribute
> 2*N+1
> > - * in its second half (this corresponds to the payload setup used by
> geometry
> > - * shaders in "single" or "dual instanced" dispatch mode).  If
> interleaved is
> > - * false, then each attribute takes up a whole register, with register N
> > - * containing attribute N (this corresponds to the payload setup used by
> > - * vertex shaders, and by geometry shaders in "dual object" dispatch
> mode).
> > - */
> > -void
> > -vec4_visitor::lower_attributes_to_hw_regs(const int *attribute_map,
> > -  bool interleaved)
> > -{
> > -   foreach_block_and_inst(block, vec4_instruction, inst, cfg) {
> > -  for (int i = 0; i < 3; i++) {
> > - if (inst->src[i].file != ATTR)
> > -continue;
> > -
> > - int grf = attribute_map[inst->src[i].nr +
> > - inst->src[i].offset / REG_SIZE];
> > - assert(inst->src[i].offset % REG_SIZE == 0);
> > -
> > - /* All attributes used in the shader need to have been
> assigned a
> > -  * hardware register by the caller
> > -  */
> > - assert(grf != 0);
> > -
> > - struct brw_reg reg =
> > -attribute_to_hw_reg(grf, inst->src[i].type, interleaved);
> > - reg.swizzle = inst->src[i].swizzle;
> > - if (inst->src[i].abs)
> > -reg = brw_abs(reg);
> > - if (inst->src[i].negate)
> > -reg = negate(reg);
> > -
> > - inst->src[i] = reg;
> > -  }
> > -   }
> > -}
> > -
> >  int
> >  vec4_vs_visitor::setup_attributes(int payload_reg)
> >  {
> > diff --git a/src/intel/compiler/brw_vec4.h
> b/src/intel/compiler/brw_vec4.h
> > index 89adfaa..0f92f34 100644
> > --- a/src/intel/compiler/brw_vec4.h
> > +++ b/src/intel/compiler/brw_vec4.h
> > @@ -367,8 +367,6 @@ public:
> >
> >  protected:
> > void emit_vertex();
> > -   void lower_attributes_to_hw_regs(const int *attribute_map,
> > -bool interleaved);
> > void setup_payload_interference(struct ra_graph *g, int
> first_payload_node,
> > int reg_node_count);
> > virtual void setup_payload() = 0;
> > diff --git a/src/intel/compiler/brw_vec4_gs_nir.cpp
> b/src/intel/compiler/brw_vec4_gs_nir.cpp
> > index ed8c03b..577f587 100644
> > --- a/src/intel/compiler/brw_vec4_gs_nir.cpp
> > +++ b/src/intel/compiler/brw_vec4_gs_nir.cpp
> > @@ -66,8 +66,10 @@ vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr
> *instr)
> >nir_const_value *vertex = nir_src_as_const_value(instr->src[0]);
> >nir_const_value *offset_reg = nir_src_as_const_value(instr->
> src[1]);
> >
> > +  const unsigned input_array_stride = prog_data->urb_read_length *
> 2;
>
> The change of using the input_array_stride instead of
> BRW_VARYING_SLOT_COUNT is not evident (at least to me). There is a
> comment explaining the stride purpose on
> vec4_gs_visitor::setup_varying_inputs, but perhaps a note here would be
> welcomed. You can drop this 

Re: [Mesa-dev] [PATCH 0/2] anv/i965: drop libdrm dependency completely

2017-05-05 Thread Jason Ekstrand
On Fri, May 5, 2017 at 8:32 AM, Emil Velikov 
wrote:

> On 4 May 2017 at 21:56, Jason Ekstrand  wrote:
> > On Thu, May 4, 2017 at 12:21 PM, Kristian Høgsberg 
> > wrote:
> >>
> >> On Thu, May 4, 2017 at 11:43 AM, Lionel Landwerlin
> >>  wrote:
> >> > On 04/05/17 07:52, Emil Velikov wrote:
> >> >>
> >> >> On 4 May 2017 at 14:46, Daniel Vetter  wrote:
> >> >>>
> >> >>> On Thu, Apr 27, 2017 at 10:58:42AM -0700, Lionel Landwerlin wrote:
> >> 
> >>  On 27/04/17 08:20, Eric Anholt wrote:
> >> >
> >> > Emil Velikov  writes:
> >> >
> >> >> On 25 April 2017 at 23:56, Lionel Landwerlin
> >> >>  wrote:
> >> >>>
> >> >>> Hi,
> >> >>>
> >> >>> While working with changes that span from kernel to user space,
> >> >>> I've
> >> >>> been wondering whether we need to depend on libdrm at all for
> the
> >> >>> anv
> >> >>> & i965 drivers. Indeed with Ken's recent changes, we only depend
> >> >>> on
> >> >>> libdrm for its kernel header files which we could just embed
> >> >>> ourselves.
> >> >>>
> >> >>> I've only included the minimal set of header files we need from
> >> >>> the
> >> >>> kernel for anv & i965. Maybe other drivers would be interested
> and
> >> >>> maybe we should put all the kernel drm uapi headers into
> include?
> >> >>>
> >> >> AFAICT the goal behind the libdrm_intel fold was to allow rapid
> and
> >> >> seamless rework of the interface.
> >> >> With a potential goal to make it a shared one, as it gets
> >> >> stabilised.
> >> >>
> >> >> Currently ANV uses more than just the UAPI headers. But if we
> >> >> ignore
> >> >> that, coping them is a bad idea.
> >> 
> >>  What else is anv using from libdrm? (maybe I missed something)
> >> 
> >> >> Lionel, I stand corrected, we have instances in anv, wsi/x11, loader
> >> >> and dri/i965 (the dri/common ones are just comments).
> >> >> In total they seem to be over three dozen instances. Experiment with
> >> >> the following:
> >> >>
> >> >> for i in `nm -CD --defined-only /lib/libdrm.so | cut -c 20-| grep -v
> >> >> "^_" `; do git grep -w --name-only $i -- src ; done
> >> >
> >> >
> >> > Thanks for the code snippet.
> >> >
> >> > For anv :
> >> > drmGetDevices2
> >>
> >> anv was designed to not rely on libdrm or libdrm_intel. I see the
> >> commit that added the libdrm dependency is from you and was not
> >> Reviewed or acked by Jason or any other core anv developer. I suggest
> >> we revert that, I don't see anything in the drmGetDevices2 code that
> >> is better suited for anv than what was there before.
> >
> >
> > I did comment on e-mail that I was begrudgingly ok with it.  In
> retrospect,
> > it looks pretty pointless.  As far as I can tell, drmGetDevices2 gains us
> > exactly two things over the old method of just trial and error:
> >
> >  1. It stats the file to make sure that it's an actual DRM device before
> > opening the file.  Does this actually matter?  If so, it's easy enough to
> > add the dozen or so lines of code to do it in ANV.
> >  2. It walks over all files in /dev/dri rather than just
> /dev/dri/renderD#.
> > That's also very easy to add.
> >
> > I agree with Kristian that the right thing to do is to revert that patch
> and
> > just write the dozen lines of code needed to do it "properly" if it even
> > matters.
> >
> Reverting the patch will lead to
>  - 3s starup delays since the open() will wake up the $other GPU
> Rare, but we've had reports already.
>  - slower porting/adoption of Vulkan on !Linux Unixes
>

I had a chat with Dave Airlie about it on IRC and I'm back to begrudgingly
accepting the dependency.  The "porting to BSD" argument was what finally
won me over.  In any case, if all we rely on is drmGetDevice2, then the
version of libdrm you have basically stops mattering which is nice.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] anv/allocator: Only write to _vg_ptr if we have valgrind

2017-05-05 Thread Jason Ekstrand
This fixes the build when not building against valgrind headers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100945
---
 src/intel/vulkan/anv_allocator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 4d59260..5e5e079 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -929,7 +929,7 @@ anv_state_stream_alloc(struct anv_state_stream *stream,
   VG_NOACCESS_WRITE(>block, stream->block);
   VG_NOACCESS_WRITE(>next, stream->block_list);
   stream->block_list = sb;
-  VG_NOACCESS_WRITE(>_vg_ptr, NULL);
+  VG(VG_NOACCESS_WRITE(>_vg_ptr, NULL));
 
   VG(VALGRIND_MAKE_MEM_NOACCESS(stream->block.map, stream->block_size));
 
-- 
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 8/9] i965/fs: Move remapping of gl_PointSize to the NIR level

2017-05-05 Thread Jason Ekstrand
On Fri, May 5, 2017 at 12:49 AM, Alejandro Piñeiro 
wrote:

> On 05/05/17 04:11, Jason Ekstrand wrote:
> > ---
> >  src/intel/compiler/brw_fs_nir.cpp | 26 +++---
> >  src/intel/compiler/brw_nir.c  | 22 +++---
> >  2 files changed, 22 insertions(+), 26 deletions(-)
> >
> > diff --git a/src/intel/compiler/brw_fs_nir.cpp
> b/src/intel/compiler/brw_fs_nir.cpp
> > index d4ce753..f408d48 100644
> > --- a/src/intel/compiler/brw_fs_nir.cpp
> > +++ b/src/intel/compiler/brw_fs_nir.cpp
> > @@ -1914,27 +1914,15 @@ fs_visitor::emit_gs_input_load(const fs_reg
> ,
> > nir_const_value *offset_const = nir_src_as_const_value(offset_src);
> > const unsigned push_reg_count = gs_prog_data->base.urb_read_length
> * 8;
> >
> > -   /* Offset 0 is the VUE header, which contains VARYING_SLOT_LAYER
> [.y],
> > -* VARYING_SLOT_VIEWPORT [.z], and VARYING_SLOT_PSIZ [.w].  Only
> > -* gl_PointSize is available as a GS input, however, so it must be
> that.
> > -*/
> > -   const bool is_point_size = (base_offset == 0);
> > -
> > /* TODO: figure out push input layout for invocations == 1 */
> > if (gs_prog_data->invocations == 1 &&
> > offset_const != NULL && vertex_const != NULL &&
> > 4 * (base_offset + offset_const->u32[0]) < push_reg_count) {
> >int imm_offset = (base_offset + offset_const->u32[0]) * 4 +
> > vertex_const->u32[0] * push_reg_count;
> > -  /* This input was pushed into registers. */
> > -  if (is_point_size) {
> > - /* gl_PointSize comes in .w */
> > - bld.MOV(dst, fs_reg(ATTR, imm_offset + 3, dst.type));
> > -  } else {
> > - for (unsigned i = 0; i < num_components; i++) {
> > -bld.MOV(offset(dst, bld, i),
> > -fs_reg(ATTR, imm_offset + i + first_component,
> dst.type));
> > - }
> > +  for (unsigned i = 0; i < num_components; i++) {
> > + bld.MOV(offset(dst, bld, i),
> > + fs_reg(ATTR, imm_offset + i + first_component,
> dst.type));
> >}
> >return;
> > }
> > @@ -2104,14 +2092,6 @@ fs_visitor::emit_gs_input_load(const fs_reg ,
> >   }
> >}
> > }
> > -
> > -   if (is_point_size) {
> > -  /* Read the whole VUE header (because of alignment) and read .w.
> */
> > -  fs_reg tmp = bld.vgrf(dst.type, 4);
> > -  inst->dst = tmp;
> > -  inst->size_written = 4 * REG_SIZE;
> > -  bld.MOV(dst, offset(tmp, bld, 3));
> > -   }
> >  }
> >
> >  fs_reg
> > diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> > index 725143f..d92e8fa 100644
> > --- a/src/intel/compiler/brw_nir.c
> > +++ b/src/intel/compiler/brw_nir.c
> > @@ -363,9 +363,25 @@ brw_nir_lower_vue_inputs(nir_shader *nir, bool
> is_scalar,
> >
> >  if (intrin->intrinsic == nir_intrinsic_load_input ||
> >  intrin->intrinsic == nir_intrinsic_load_per_vertex_input)
> {
> > -   int vue_slot = vue_map->varying_to_slot[
> intrin->const_index[0]];
> > -   assert(vue_slot != -1);
> > -   intrin->const_index[0] = vue_slot;
> > +   /* Offset 0 is the VUE header, which contains
> > +* VARYING_SLOT_LAYER [.y], VARYING_SLOT_VIEWPORT [.z],
> and
> > +* VARYING_SLOT_PSIZ [.w].  Only gl_PointSize is
> available as a
> > +* GS input, however, so it must be that.
>
> "must be that" sounds like something that can be asserted. With or
> without that:
>

Actually, I should just drop that part of the comment.  I copy and pasted
the comment from elsewhere and that part no longer makes sense.  I've got a
local patch which adds support for reading LAYER and VIEWPORT by just
adding them to the switch below.


> Reviewed-by: Alejandro Piñeiro 
>

Thanks!


> > +*/
> > +   int varying = nir_intrinsic_base(intrin);
> > +   int vue_slot;
> > +   switch (varying) {
> > +   case VARYING_SLOT_PSIZ:
> > +  nir_intrinsic_set_base(intrin, 0);
> > +  nir_intrinsic_set_component(intrin, 3);
> > +  break;
> > +
> > +   default:
> > +  vue_slot = vue_map->varying_to_slot[varying];
> > +  assert(vue_slot != -1);
> > +  nir_intrinsic_set_base(intrin, vue_slot);
> > +  break;
> > +   }
> >  }
> >   }
> >}
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] i965: Update gen6_depth_stencil_state to use genX macro.

2017-05-05 Thread Rafael Antognolli
While moving depth stencil state to use genxml, this one was left
behind.

Signed-off-by: Rafael Antognolli 
Cc: "Pohjolainen, Topi" 
---
 src/mesa/drivers/dri/i965/genX_state_upload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c 
b/src/mesa/drivers/dri/i965/genX_state_upload.c
index b6aa7c8..b8390ce 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -3872,7 +3872,7 @@ genX(init_atoms)(struct brw_context *brw)
   _urb,
   (blend_state),  /* must do before cc unit */
   (color_calc_state), /* must do before cc unit */
-  _depth_stencil_state,   /* must do before cc unit */
+  (depth_stencil_state),  /* must do before cc unit */
 
   (vs_push_constants), /* Before vs_state */
   (gs_push_constants), /* Before gs_state */
-- 
2.9.3

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


[Mesa-dev] [PATCH 2/2] i965/genxml: Mostly style fixes for emit_vertices code.

2017-05-05 Thread Rafael Antognolli
Several issues were caught on review after the original patch landed.
This commit fixes them.

Signed-off-by: Rafael Antognolli 
Cc: "Pohjolainen, Topi" 
---
 src/mesa/drivers/dri/i965/genX_state_upload.c | 49 +++
 1 file changed, 20 insertions(+), 29 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c 
b/src/mesa/drivers/dri/i965/genX_state_upload.c
index b8390ce..66b3264 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -360,7 +360,7 @@ is_passthru_format(uint32_t format)
 }
 
 UNUSED static int
-genX(uploads_needed)(uint32_t format)
+uploads_needed(uint32_t format)
 {
if (!is_passthru_format(format))
   return 1;
@@ -442,8 +442,8 @@ genX(emit_vertices)(struct brw_context *brw)
 
 #if GEN_GEN >= 8
struct gl_context *ctx = >ctx;
-   bool uses_edge_flag = (ctx->Polygon.FrontMode != GL_FILL ||
-  ctx->Polygon.BackMode != GL_FILL);
+   const bool uses_edge_flag = (ctx->Polygon.FrontMode != GL_FILL ||
+ctx->Polygon.BackMode != GL_FILL);
 
if (vs_prog_data->uses_vertexid || vs_prog_data->uses_instanceid) {
   unsigned vue = brw->vb.nr_enabled;
@@ -512,7 +512,7 @@ genX(emit_vertices)(struct brw_context *brw)
   struct brw_vertex_element *input = brw->vb.enabled[i];
   uint32_t format = brw_get_vertex_surface_type(brw, input->glarray);
 
-  if (genX(uploads_needed(format)) > 1)
+  if (uploads_needed(format) > 1)
  nr_elements++;
}
 #endif
@@ -525,7 +525,8 @@ genX(emit_vertices)(struct brw_context *brw)
 * a VE loads from them.
 */
if (nr_elements == 0) {
-  dw = brw_batch_emitn(brw, GENX(3DSTATE_VERTEX_ELEMENTS), 1 + 
GENX(VERTEX_ELEMENT_STATE_length));
+  dw = brw_batch_emitn(brw, GENX(3DSTATE_VERTEX_ELEMENTS),
+   1 + GENX(VERTEX_ELEMENT_STATE_length));
   struct GENX(VERTEX_ELEMENT_STATE) elem = {
  .Valid = true,
  .SourceElementFormat = ISL_FORMAT_R32G32B32A32_FLOAT,
@@ -546,11 +547,6 @@ genX(emit_vertices)(struct brw_context *brw)
   uses_draw_params + vs_prog_data->uses_drawid;
 
if (nr_buffers) {
-#if GEN_GEN >= 6
-  assert(nr_buffers <= 33);
-#else
-  assert(nr_buffers <= 17);
-#endif
   assert(nr_buffers <= (GEN_GEN >= 6 ? 33 : 17));
 
   dw = brw_batch_emitn(brw, GENX(3DSTATE_VERTEX_BUFFERS),
@@ -563,11 +559,12 @@ genX(emit_vertices)(struct brw_context *brw)
   * half-float and 8 and 16-bit integer formats.  This means that the
   * vertex element may poke over the end of the buffer by 2 bytes.
   */
- unsigned padding =
+ const unsigned padding =
 (GEN_GEN <= 7 && !brw->is_baytrail && !brw->is_haswell) * 2;
+ const unsigned end = buffer->offset + buffer->size + padding;
  dw = genX(emit_vertex_buffer_state)(brw, dw, i, buffer->bo,
  buffer->offset,
- buffer->offset + buffer->size + 
padding,
+ end + padding,
  buffer->stride,
  buffer->step_rate);
   }
@@ -596,22 +593,21 @@ genX(emit_vertices)(struct brw_context *brw)
 */
 #if GEN_GEN >= 6
assert(nr_elements <= 34);
-   struct brw_vertex_element *gen6_edgeflag_input = NULL;
+   const struct brw_vertex_element *gen6_edgeflag_input = NULL;
 #else
assert(nr_elements <= 18);
 #endif
 
dw = brw_batch_emitn(brw, GENX(3DSTATE_VERTEX_ELEMENTS),
 1 + GENX(VERTEX_ELEMENT_STATE_length) * nr_elements);
-   unsigned i;
-   for (i = 0; i < brw->vb.nr_enabled; i++) {
-  struct brw_vertex_element *input = brw->vb.enabled[i];
+   for (unsigned i = 0; i < brw->vb.nr_enabled; i++) {
+  const struct brw_vertex_element *input = brw->vb.enabled[i];
   uint32_t format = brw_get_vertex_surface_type(brw, input->glarray);
   uint32_t comp0 = VFCOMP_STORE_SRC;
   uint32_t comp1 = VFCOMP_STORE_SRC;
   uint32_t comp2 = VFCOMP_STORE_SRC;
   uint32_t comp3 = VFCOMP_STORE_SRC;
-  unsigned num_uploads = 1;
+  const unsigned num_uploads = GEN_GEN < 8 ? uploads_needed(format) : 1;
 
 #if GEN_GEN >= 8
   /* From the BDW PRM, Volume 2d, page 588 (VERTEX_ELEMENT_STATE):
@@ -638,21 +634,16 @@ genX(emit_vertices)(struct brw_context *brw)
   }
 #endif
 
-#if GEN_GEN < 8
-  num_uploads = genX(uploads_needed(format));
-#endif
-
   for (unsigned c = 0; c < num_uploads; c++) {
- uint32_t upload_format = GEN_GEN >= 8 ? format :
+ const uint32_t upload_format = GEN_GEN >= 8 ? format :
 downsize_format_if_needed(format, c);
  /* If we need more that one upload, the offset stride would be 128
   * bits (16 bytes), as for 

[Mesa-dev] [Bug 100948] Please add an ssh account, fdo username: rantogno

2017-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100948

--- Comment #1 from Rafael Antognolli  ---
Created attachment 131231
  --> https://bugs.freedesktop.org/attachment.cgi?id=131231=edit
SSH pub key for rantogno

-- 
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 100948] Please add an ssh account, fdo username: rantogno

2017-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100948

Bug ID: 100948
   Summary: Please add an ssh account, fdo username: rantogno
   Product: Mesa
   Version: unspecified
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Other
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: antogno...@gmail.com
QA Contact: mesa-dev@lists.freedesktop.org

Created attachment 131230
  --> https://bugs.freedesktop.org/attachment.cgi?id=131230=edit
GPG pub key for rantogno

Name: Rafael Antognolli
email: rafael.antogno...@intel.com
username: rantogno

My gpg and ssh pub keys are attached.

-- 
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 2/2] anv/i965: drop libdrm_intel dependency completely

2017-05-05 Thread Emil Velikov
On 5 May 2017 at 15:36, Daniel Vetter  wrote:
> On Thu, May 04, 2017 at 12:19:22PM -0700, Lionel Landwerlin wrote:
>> With Ken's work to drop the library dependency on libdrm_intel, we now
>> only depend on libdrm_intel for the kernel uapi headers it provides.
>> It seems like we're better off just embeddeding those headers
>> ourselves, making the lives of people developing news features tightly
>> integrated with the kernel a tiny bit easier.
>>
>> v2: Just drop libdrm_intel, not libdrm (Lionel)
>>
>> Signed-off-by: Lionel Landwerlin 
>
> Header files need to be generated by the make headers_install target in
> the kernel, and then the resulting stuff imported (it lands in
> kernel-src/usr/include/drm/).
>
> Otherwise you end up with kernel #defines gunk in userspace, which sooner
> or later will clash with glibc and other fun. I also recommend you
> reference the exact kernel sha1 or release you've used to generate these.

In order to avoid repeating oneself it might be worth writing a
section like the following
https://cgit.freedesktop.org/mesa/drm/tree/include/drm/README#n68

Writing a pre-commit hook which checks for the above should also be doable.

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


Re: [Mesa-dev] [PATCH 1/2] radeonsi: split per-patch from per-vertex indices

2017-05-05 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Wed, May 3, 2017 at 3:54 PM, Nicolai Hähnle  wrote:
> From: Nicolai Hähnle 
>
> Make it a bit clearer that the index spaces are logically seperate by
> having them defined in different functions.
> ---
>  src/gallium/drivers/radeonsi/si_shader.c| 56 
> +
>  src/gallium/drivers/radeonsi/si_shader.h|  1 +
>  src/gallium/drivers/radeonsi/si_state_shaders.c |  6 +--
>  3 files changed, 42 insertions(+), 21 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
> b/src/gallium/drivers/radeonsi/si_shader.c
> index 77dd6b1..a48a552 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -98,20 +98,42 @@ static bool is_merged_shader(struct si_shader *shader)
> if (shader->selector->screen->b.chip_class <= VI)
> return false;
>
> return shader->key.as_ls ||
>shader->key.as_es ||
>shader->selector->type == PIPE_SHADER_TESS_CTRL ||
>shader->selector->type == PIPE_SHADER_GEOMETRY;
>  }
>
>  /**
> + * Returns a unique index for a per-patch semantic name and index. The index
> + * must be less than 32, so that a 32-bit bitmask of used inputs or outputs
> + * can be calculated.
> + */
> +unsigned si_shader_io_get_unique_index_patch(unsigned semantic_name, 
> unsigned index)
> +{
> +   switch (semantic_name) {
> +   case TGSI_SEMANTIC_TESSOUTER:
> +   return 0;
> +   case TGSI_SEMANTIC_TESSINNER:
> +   return 1;
> +   case TGSI_SEMANTIC_PATCH:
> +   assert(index < 30);
> +   return 2 + index;
> +
> +   default:
> +   assert(!"invalid semantic name");
> +   return 0;
> +   }
> +}
> +
> +/**
>   * Returns a unique index for a semantic name and index. The index must be
>   * less than 64, so that a 64-bit bitmask of used inputs or outputs can be
>   * calculated.
>   */
>  unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned 
> index)
>  {
> switch (semantic_name) {
> case TGSI_SEMANTIC_POSITION:
> return 0;
> case TGSI_SEMANTIC_PSIZE:
> @@ -119,28 +141,20 @@ unsigned si_shader_io_get_unique_index(unsigned 
> semantic_name, unsigned index)
> case TGSI_SEMANTIC_CLIPDIST:
> assert(index <= 1);
> return 2 + index;
> case TGSI_SEMANTIC_GENERIC:
> if (index <= 63-4)
> return 4 + index;
>
> assert(!"invalid generic index");
> return 0;
>
> -   /* patch indices are completely separate and thus start from 0 */
> -   case TGSI_SEMANTIC_TESSOUTER:
> -   return 0;
> -   case TGSI_SEMANTIC_TESSINNER:
> -   return 1;
> -   case TGSI_SEMANTIC_PATCH:
> -   return 2 + index;
> -
> default:
> assert(!"invalid semantic name");
> return 0;
> }
>  }
>
>  unsigned si_shader_io_get_unique_index2(unsigned name, unsigned index)
>  {
> switch (name) {
> case TGSI_SEMANTIC_FOG:
> @@ -670,24 +684,29 @@ static LLVMValueRef get_dw_address(struct 
> si_shader_context *ctx,
> else
> first = reg.Register.Index;
>
> ind_index = get_indirect_index(ctx, ,
>reg.Register.Index - first);
>
> base_addr = LLVMBuildAdd(gallivm->builder, base_addr,
> LLVMBuildMul(gallivm->builder, ind_index,
>  LLVMConstInt(ctx->i32, 4, 
> 0), ""), "");
>
> -   param = si_shader_io_get_unique_index(name[first], 
> index[first]);
> +   param = reg.Register.Dimension ?
> +   si_shader_io_get_unique_index(name[first], 
> index[first]) :
> +   si_shader_io_get_unique_index_patch(name[first], 
> index[first]);
> } else {
> -   param = 
> si_shader_io_get_unique_index(name[reg.Register.Index],
> - 
> index[reg.Register.Index]);
> +   param = reg.Register.Dimension ?
> +   
> si_shader_io_get_unique_index(name[reg.Register.Index],
> + 
> index[reg.Register.Index]) :
> +   
> si_shader_io_get_unique_index_patch(name[reg.Register.Index],
> +   
> index[reg.Register.Index]);
> }
>
> /* Add the base address of the element. */
> return LLVMBuildAdd(gallivm->builder, base_addr,
> LLVMConstInt(ctx->i32, param * 4, 0), "");
>  }
>
>  /* The offchip buffer layout for TCS->TES is
>   *
>   

Re: [Mesa-dev] [PATCH 2/2] radeonsi: get rid of secondary input/output word

2017-05-05 Thread Marek Olšák
Hi Nicolai,

This might break Nine, because it uses GENERIC indices greater than
31. The idea is that we support 32, but allow indices up to 60 as long
as the number of declared varyings is <= 32.

Axel can probably answer which maximum GENERIC index we can normally expect.

Marek

On Wed, May 3, 2017 at 3:54 PM, Nicolai Hähnle  wrote:
> From: Nicolai Hähnle 
>
> We only advertise a maximum of 32 inputs and outputs in each shader stage,
> so everything fits into 64 bits.
> ---
>  src/gallium/drivers/radeonsi/si_shader.c| 35 +++---
>  src/gallium/drivers/radeonsi/si_shader.h|  6 +---
>  src/gallium/drivers/radeonsi/si_state_shaders.c | 40 
> -
>  3 files changed, 17 insertions(+), 64 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
> b/src/gallium/drivers/radeonsi/si_shader.c
> index a48a552..67d62c3 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -135,48 +135,41 @@ unsigned si_shader_io_get_unique_index(unsigned 
> semantic_name, unsigned index)
>  {
> switch (semantic_name) {
> case TGSI_SEMANTIC_POSITION:
> return 0;
> case TGSI_SEMANTIC_PSIZE:
> return 1;
> case TGSI_SEMANTIC_CLIPDIST:
> assert(index <= 1);
> return 2 + index;
> case TGSI_SEMANTIC_GENERIC:
> -   if (index <= 63-4)
> +   if (index < 32)
> return 4 + index;
>
> assert(!"invalid generic index");
> return 0;
>
> -   default:
> -   assert(!"invalid semantic name");
> -   return 0;
> -   }
> -}
> -
> -unsigned si_shader_io_get_unique_index2(unsigned name, unsigned index)
> -{
> -   switch (name) {
> case TGSI_SEMANTIC_FOG:
> -   return 0;
> +   return 36;
> case TGSI_SEMANTIC_LAYER:
> -   return 1;
> +   return 37;
> case TGSI_SEMANTIC_VIEWPORT_INDEX:
> -   return 2;
> +   return 38;
> case TGSI_SEMANTIC_PRIMID:
> -   return 3;
> +   return 39;
> case TGSI_SEMANTIC_COLOR: /* these alias */
> case TGSI_SEMANTIC_BCOLOR:
> -   return 4 + index;
> +   assert(index < 2);
> +   return 40 + index;
> case TGSI_SEMANTIC_TEXCOORD:
> -   return 6 + index;
> +   assert(index < 8);
> +   return 42 + index;
> default:
> assert(!"invalid semantic name");
> return 0;
> }
>  }
>
>  /**
>   * Get the value of a shader input parameter and extract a bitfield.
>   */
>  static LLVMValueRef unpack_param(struct si_shader_context *ctx,
> @@ -2297,31 +2290,24 @@ static void si_llvm_export_vs(struct 
> lp_build_tgsi_context *bld_base,
> semantic_name = outputs[i].semantic_name;
> semantic_index = outputs[i].semantic_index;
> bool export_param = true;
>
> switch (semantic_name) {
> case TGSI_SEMANTIC_POSITION: /* ignore these */
> case TGSI_SEMANTIC_PSIZE:
> case TGSI_SEMANTIC_CLIPVERTEX:
> case TGSI_SEMANTIC_EDGEFLAG:
> break;
> -   case TGSI_SEMANTIC_GENERIC:
> -   case TGSI_SEMANTIC_CLIPDIST:
> +   default:
> if (shader->key.opt.hw_vs.kill_outputs &
> (1ull << 
> si_shader_io_get_unique_index(semantic_name, semantic_index)))
> export_param = false;
> -   break;
> -   default:
> -   if (shader->key.opt.hw_vs.kill_outputs2 &
> -   (1u << 
> si_shader_io_get_unique_index2(semantic_name, semantic_index)))
> -   export_param = false;
> -   break;
> }
>
> if (outputs[i].vertex_stream[0] != 0 &&
> outputs[i].vertex_stream[1] != 0 &&
> outputs[i].vertex_stream[2] != 0 &&
> outputs[i].vertex_stream[3] != 0)
> export_param = false;
>
>  handle_semantic:
> /* Select the correct target */
> @@ -7154,21 +7140,20 @@ static void si_dump_shader_key(unsigned processor, 
> struct si_shader *shader,
>
> default:
> assert(0);
> }
>
> if ((processor == PIPE_SHADER_GEOMETRY ||
>  processor == PIPE_SHADER_TESS_EVAL ||
>  processor == PIPE_SHADER_VERTEX) &&
> !key->as_es && !key->as_ls) {
> fprintf(f, "  opt.hw_vs.kill_outputs = 0x%"PRIx64"\n", 
> key->opt.hw_vs.kill_outputs);
> -   fprintf(f, "  

Re: [Mesa-dev] [PATCH v3 0/4] Disable glthread if libX11 isn't thread-safe

2017-05-05 Thread gregory hainaut
On Fri, 5 May 2017 18:17:22 +0100
Emil Velikov  wrote:

> On 5 May 2017 at 17:58, gregory hainaut  wrote:
> > On Fri, 5 May 2017 17:45:01 +0200
> > Axel Davy  wrote:
> >  
>  [...]  
> >
> > Hello Axel,
> >
> > Yes it is another possibility. It would requires to track gl calls that end 
> > up in X11.
> > I'm not sure if there is an easy way to list all those gl functions. There 
> > are at least the
> > draw calls and maybe the clear operations. Besides I'm afraid that we will 
> > need to handle
> > various corner cases of the OpenGL API. It is doable but likely more 
> > complicated.
> >
> > There is also the Nvidia way, i.e. forces the driver to XInitThreads X11. I 
> > think it
> > can be implemented with the help of constructor attribute.
> >  
> Did you trace the above behaviour? What would happen in the following 
> scenario:
>  - There is no link against libGL/libEGL
>  - User gets the dpy primitive w/o calling XInitThreads
>  - Then user dlopens libGL/libEGL, which in itself calls XInitThreads
> At that point it's a bit too late isn't it?
> 
> -Emil

Hello,

No I didn't trace it.

You right, it is too late. You can/must use LD_PRELOAD to ensure that 
libGL/libEGL is loaded first.

To be honest, the best solution will be to have a thread safe Xlib. No more 
hack everywhere.

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


Re: [Mesa-dev] [PATCH v3 0/4] Disable glthread if libX11 isn't thread-safe

2017-05-05 Thread Emil Velikov
On 5 May 2017 at 17:58, gregory hainaut  wrote:
> On Fri, 5 May 2017 17:45:01 +0200
> Axel Davy  wrote:
>
>> Hi,
>>
>> There should be very few X11 calls while rendering (basically only at
>> the beginning or end of a frame).
>>
>> Why not just always run these calls in the main thread (and wait for
>> glthread work to finish) ?
>>
>> That's basically what we do for gallium nine.
>>
>> Yours,
>>
>> Axel
>
> Hello Axel,
>
> Yes it is another possibility. It would requires to track gl calls that end 
> up in X11.
> I'm not sure if there is an easy way to list all those gl functions. There 
> are at least the
> draw calls and maybe the clear operations. Besides I'm afraid that we will 
> need to handle
> various corner cases of the OpenGL API. It is doable but likely more 
> complicated.
>
> There is also the Nvidia way, i.e. forces the driver to XInitThreads X11. I 
> think it
> can be implemented with the help of constructor attribute.
>
Did you trace the above behaviour? What would happen in the following scenario:
 - There is no link against libGL/libEGL
 - User gets the dpy primitive w/o calling XInitThreads
 - Then user dlopens libGL/libEGL, which in itself calls XInitThreads
At that point it's a bit too late isn't it?

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


Re: [Mesa-dev] [PATCH 7/8] android: support creating texture from gralloc buffer

2017-05-05 Thread Rob Herring
On Mon, May 1, 2017 at 9:55 AM, Tomasz Figa  wrote:
> On Mon, May 1, 2017 at 11:17 PM, Mauro Rossi  wrote:
>> Hi all,
>>
>> another try to merge android swrast patches in mesa 17.1 or mesa-dev
>> if they are somehow considered useful for android.

I would really like to, but all my attempts at getting swrast to work
so far have failed.

>>
>> Mauro
>>
>>
>> 2017-01-20 20:17 GMT+01:00 Mauro Rossi :
>>>
>>>
>>>
>>> Il lunedì 9 gennaio 2017, Zhen Wu  ha scritto:

 Thanks for your review, Rob. Using kms-dri would mean writing a new
 gralloc to basically the same thing as
 gralloc.default and moving to grm_gralloc seems to be a bigger task meant
 for another day. But I agree we would
 want to avoid introducing dependency. Would extending drisw loader func
 and limit gralloc dependency in egl_android
 ok with you?
>>>
>>>
>>> Just to avoid a stall situation,
>>>
>>> I get that Rob comments are here as here is the gralloc dependency to be
>>> avoided.
>>> Is this assumption correct?
>>>
>>> BTW I can also confirm patches are working as I tested with Android CTS
>>> dEQP test for EGL and GLES2 modules with marshmallow-x86
>>>
>>> Mauro
>>
>>
>> Hi Rob,
>> we are still maintaining these changes to use llvmpipe
>> they are working and they are useful for testing on VMs and for software
>> rendering.
>>
>> May I kindly jask  if the unwanted gralloc dependency was essentially in
>> this patch 07/08
>> "android: support creating texture from gralloc buffer"?
>>
>> And if that is confirmed, which approaches are applicable here?
>>
>> 1. Reuse some kms-dri specific change implemented in CrOS (? Tomasz did you
>> neeed to change something in dri/sw winsys ? )
>
> Did you by any chance mean kms_swrast? If so, we don't need any
> changes other than falling back to kms-dri in
> egl/drivers/dri2/platform_android.c, if hardware driver fails to load.
> See this patch: https://chromium-review.googlesource.com/c/442414/ .
>
> However on ChromeOS we disallow access to DRI control nodes from
> render processes, so we use DRI render nodes and have a local patch
> for the kernel to allow dumb BO ioctls on render nodes. If you can use
> control nodes, you should be okay with the code as is.

I've got this kind of working with the above patch and disabling all
DRM permission checks. While it seems like things boot up normally, I
can't get anything but a black screen both on qemu and db410c. Even if
I memset buffers when mmapping them, just black. But things like
moving the mouse causes hwc updates and I don't see any errors. I've
successfully used SwiftShader for s/w rendering though.

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


Re: [Mesa-dev] [PATCH] i965: make emit_dwords non-static and reuse it in blorp

2017-05-05 Thread Emil Velikov
On 5 May 2017 at 17:20, Rafael Antognolli  wrote:
> On Fri, May 05, 2017 at 11:47:09AM +0100, Emil Velikov wrote:
>> From: Emil Velikov 
>>
>> Signed-off-by: Emil Velikov 
>> ---
>>  src/mesa/drivers/dri/i965/brw_state.h |  1 +
>>  src/mesa/drivers/dri/i965/genX_blorp_exec.c   |  6 +
>>  src/mesa/drivers/dri/i965/genX_state_upload.c | 32 
>> +--
>>  3 files changed, 18 insertions(+), 21 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
>> b/src/mesa/drivers/dri/i965/brw_state.h
>> index d2d3d7c2c0d..06052fc9b02 100644
>> --- a/src/mesa/drivers/dri/i965/brw_state.h
>> +++ b/src/mesa/drivers/dri/i965/brw_state.h
>> @@ -357,6 +357,7 @@ void brw_copy_pipeline_atoms(struct brw_context *brw,
>>   enum brw_pipeline pipeline,
>>   const struct brw_tracked_state **atoms,
>>   int num_atoms);
>> +void *brw_emit_dwords(struct brw_context *brw, unsigned n);
>>  void gen4_init_atoms(struct brw_context *brw);
>>  void gen45_init_atoms(struct brw_context *brw);
>>  void gen5_init_atoms(struct brw_context *brw);
>> diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.c 
>> b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
>> index 7157420328f..0a93c31334a 100644
>> --- a/src/mesa/drivers/dri/i965/genX_blorp_exec.c
>> +++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
>> @@ -40,11 +40,7 @@ blorp_emit_dwords(struct blorp_batch *batch, unsigned n)
>> assert(batch->blorp->driver_ctx == batch->driver_batch);
>> struct brw_context *brw = batch->driver_batch;
>>
>> -   intel_batchbuffer_begin(brw, n, RENDER_RING);
>> -   uint32_t *map = brw->batch.map_next;
>> -   brw->batch.map_next += n;
>> -   intel_batchbuffer_advance(brw);
>> -   return map;
>> +   return brw_emit_dwords(brw, n);
>>  }
>>
>>  static uint64_t
>> diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c 
>> b/src/mesa/drivers/dri/i965/genX_state_upload.c
>> index ceeacfcdef7..4e8cf4f6b06 100644
>> --- a/src/mesa/drivers/dri/i965/genX_state_upload.c
>> +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
>> @@ -55,8 +55,8 @@
>>  #include "main/transformfeedback.h"
>>  #include "main/viewport.h"
>>
>> -UNUSED static void *
>> -emit_dwords(struct brw_context *brw, unsigned n)
>> +void *
>> +brw_emit_dwords(struct brw_context *brw, unsigned n)
>>  {
>
> Hi Emil,
>
> This is going to cause several brw_emit_dwords() symbols to be exposed
> (one for gen4, one for gen45, one for gen5,... one for gen9). And
> consequently, the build fails because of the multiple definitions.
>
> Assuming you want to really expose this function several times, you
> should use genX(emit_dwords)(...), which would generate
> gen4_emit_dwords() and all the others.
>
> That said, imho it would be better to move this function outside of this
> file and have only one version of it.
>
Thanks Rafael - you're spot on. As-is there'll be multiple definitions
and moving the function is the right thing to do.
I'll move it to intel_batchbuffer.c some time next week. Barring any objections.

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


Re: [Mesa-dev] [PATCH 1/3] mesa: Simplify _mesa_primitive_restart_index().

2017-05-05 Thread Marek Olšák
Since the function is so small, perhaps it would make sense to move it
into a header file.

Marek

On Fri, May 5, 2017 at 7:06 PM, Marek Olšák  wrote:
> Reviewed-by: Marek Olšák 
>
> Marek
>
> On Thu, May 4, 2017 at 5:13 PM, Kenneth Graunke  wrote:
>> We can use a simple shift equation rather than a switch statement.
>> ---
>>  src/mesa/main/varray.c | 12 ++--
>>  1 file changed, 2 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
>> index eda86ec6a82..9497090e88a 100644
>> --- a/src/mesa/main/varray.c
>> +++ b/src/mesa/main/varray.c
>> @@ -1959,16 +1959,8 @@ _mesa_primitive_restart_index(const struct gl_context 
>> *ctx,
>>  *  is used."
>>  */
>> if (ctx->Array.PrimitiveRestartFixedIndex) {
>> -  switch (index_size) {
>> -  case 1:
>> - return 0xff;
>> -  case 2:
>> - return 0x;
>> -  case 4:
>> - return 0x;
>> -  default:
>> - assert(!"_mesa_primitive_restart_index: Invalid index size.");
>> -  }
>> +  /* 1 -> 0xff, 2 -> 0x, 4 -> 0x */
>> +  return 0xu >> 8 * (4 - index_size);
>> }
>>
>> return ctx->Array.RestartIndex;
>> --
>> 2.12.2
>>
>> ___
>> 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 1/3] mesa: Simplify _mesa_primitive_restart_index().

2017-05-05 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Thu, May 4, 2017 at 5:13 PM, Kenneth Graunke  wrote:
> We can use a simple shift equation rather than a switch statement.
> ---
>  src/mesa/main/varray.c | 12 ++--
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index eda86ec6a82..9497090e88a 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -1959,16 +1959,8 @@ _mesa_primitive_restart_index(const struct gl_context 
> *ctx,
>  *  is used."
>  */
> if (ctx->Array.PrimitiveRestartFixedIndex) {
> -  switch (index_size) {
> -  case 1:
> - return 0xff;
> -  case 2:
> - return 0x;
> -  case 4:
> - return 0x;
> -  default:
> - assert(!"_mesa_primitive_restart_index: Invalid index size.");
> -  }
> +  /* 1 -> 0xff, 2 -> 0x, 4 -> 0x */
> +  return 0xu >> 8 * (4 - index_size);
> }
>
> return ctx->Array.RestartIndex;
> --
> 2.12.2
>
> ___
> 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 20/27] st/omx: add DRI3 support

2017-05-05 Thread Leo Liu



On 05/05/2017 07:45 AM, Christian König wrote:

Am 04.05.2017 um 18:33 schrieb Emil Velikov:

From: Emil Velikov 

Cc: Christian König 
Signed-off-by: Emil Velikov 
---
UNTESTED.


Looks sane to me, but what bothers me a bit is that it is untested.

Leo do we (or QA) have a system somewhere where we could trow such 
things at and give them a try? 


Yes, it got tested, and works.

For OMX, There is no presentation part to X back buffer, so DRI2/DRI3 is 
no difference on this perspective,
what we only care about is to create a pipe context, that's why we even 
have the render node support for OMX as well.


This patch is:
Reviewed-and-Tested-by: Leo Liu 

Leo


Setting up a box for transcode testing is always quite a hassle.

Christian.


---
  src/gallium/state_trackers/omx/entrypoint.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/omx/entrypoint.c 
b/src/gallium/state_trackers/omx/entrypoint.c

index fa2074ad1b7..251cc7d65d5 100644
--- a/src/gallium/state_trackers/omx/entrypoint.c
+++ b/src/gallium/state_trackers/omx/entrypoint.c
@@ -103,7 +103,9 @@ struct vl_screen *omx_get_screen(void)
   if (!omx_display)
  goto error;
  - omx_screen = vl_dri2_screen_create(omx_display, 0);
+ omx_screen = vl_dri3_screen_create(omx_display, 0);
+ if (!omx_screen)
+omx_screen = vl_dri2_screen_create(omx_display, 0);
   if (!omx_screen) {
  XCloseDisplay(omx_display);
  goto error;





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


Re: [Mesa-dev] [PATCH v3 0/4] Disable glthread if libX11 isn't thread-safe

2017-05-05 Thread gregory hainaut
On Fri, 5 May 2017 17:45:01 +0200
Axel Davy  wrote:

> Hi,
> 
> There should be very few X11 calls while rendering (basically only at 
> the beginning or end of a frame).
> 
> Why not just always run these calls in the main thread (and wait for 
> glthread work to finish) ?
> 
> That's basically what we do for gallium nine.
> 
> Yours,
> 
> Axel

Hello Axel,

Yes it is another possibility. It would requires to track gl calls that end up 
in X11.
I'm not sure if there is an easy way to list all those gl functions. There are 
at least the 
draw calls and maybe the clear operations. Besides I'm afraid that we will need 
to handle
various corner cases of the OpenGL API. It is doable but likely more 
complicated.

There is also the Nvidia way, i.e. forces the driver to XInitThreads X11. I 
think it
can be implemented with the help of constructor attribute.

Cheers,
Gregory

 
> On 05/05/2017 17:37, Gregory Hainaut wrote:
> > Hello Mesa developers,
> >
> > Following the discussion from
> > https://lists.freedesktop.org/archives/mesa-dev/2017-April/153137.html
> >
> > A check was added to ensure that X11 display can be locked. It should be 
> > enough
> > to ensure thread safety between X11 and glthread.
> >
> > I also did the check on DRI3 as I'm not 100% sure that it is really thread 
> > safe.
> >
> > 
> >
> > v2: based on Nicolai/Matt reviews
> > Add a check on DRI extension version
> > Use C comments :)
> >
> > v3: based on Emil reviews
> > Split the initial first patch into 3 sub patches dri extension / glx / egl
> > Improve error message
> > Improve code readability
> > Just include libX11 on EGL protected by ifdef
> >
> > Thanks you for all the review comments.
> >
> > Best regards,
> >
> > Gregory Hainaut (4):
> >dri: Extend __DRIbackgroundCallableExtensionRec to include a callback
> >  that checks for thread safety
> >glx: implement __DRIbackgroundCallableExtension.isThreadSafe
> >egl: implement __DRIbackgroundCallableExtension.isThreadSafe
> >glthread/gallium: require safe_glthread to start glthread
> >
> >   include/GL/internal/dri_interface.h  | 11 +++
> >   src/egl/drivers/dri2/egl_dri2.c  | 28 
> > +++-
> >   src/gallium/state_trackers/dri/dri_context.c | 21 +
> >   src/glx/dri2_glx.c   | 15 ++-
> >   src/glx/dri3_glx.c   | 15 ++-
> >   5 files changed, 83 insertions(+), 7 deletions(-)
> >  
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [AppVeyor] mesa master #4271 failed

2017-05-05 Thread Emil Velikov
On 5 May 2017 at 17:51, Daniel Stone  wrote:
> Hi,
>
> On 5 May 2017 at 17:38, AppVeyor  wrote:
>> Build mesa 4271 failed
>>
>> Commit 8b8af19065 by Daniel Stone on 5/3/2017 8:38 AM:
>> i965: Set modifier for imported and duplicated images [...]
>
> I was worried I'd broken the build, but I'm going to claim this isn't my 
> fault:
> Linking build\windows-x86-debug\gallium\targets\osmesa\osmesa.dll ...
> Linking build\windows-x86-debug\gallium\targets\libgl-gdi\opengl32.dll ...
> Creating library
> build\windows-x86-debug\gallium\targets\osmesa\osmesa.lib and object
> build\windows-x86-debug\gallium\targets\osmesa\osmesa.exp
> Creating library
> build\windows-x86-debug\gallium\targets\libgl-gdi\opengl32.lib and
> object build\windows-x86-debug\gallium\targets\libgl-gdi\opengl32.exp
> nir.lib(nir_lower_atomics_to_ssbo.obj) : error LNK2019: unresolved
> external symbol _snprintf referenced in function
> _nir_lower_atomics_to_ssbo
> build\windows-x86-debug\gallium\targets\osmesa\osmesa.dll : fatal
> error LNK1120: 1 unresolved externals
> scons: *** [build\windows-x86-debug\gallium\targets\osmesa\osmesa.dll]
> Error 1120
> nir.lib(nir_lower_atomics_to_ssbo.obj) : error LNK2019: unresolved
> external symbol _snprintf referenced in function
> _nir_lower_atomics_to_ssbo
> build\windows-x86-debug\gallium\targets\libgl-gdi\opengl32.dll : fatal
> error LNK1120: 1 unresolved externals
> scons: *** [build\windows-x86-debug\gallium\targets\libgl-gdi\opengl32.dll]
> Error 1120
>
> Anyone got any bright ideas?
>
AFAICT it's caused by "nir: add pass to lower atomic counters to SSBO"
and Jose/RobC are checking upon for a solution.
I'd let them to sort it out - there's already some discussion.

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


Re: [Mesa-dev] [AppVeyor] mesa master #4271 failed

2017-05-05 Thread Daniel Stone
Hi,

On 5 May 2017 at 17:38, AppVeyor  wrote:
> Build mesa 4271 failed
>
> Commit 8b8af19065 by Daniel Stone on 5/3/2017 8:38 AM:
> i965: Set modifier for imported and duplicated images [...]

I was worried I'd broken the build, but I'm going to claim this isn't my fault:
Linking build\windows-x86-debug\gallium\targets\osmesa\osmesa.dll ...
Linking build\windows-x86-debug\gallium\targets\libgl-gdi\opengl32.dll ...
Creating library
build\windows-x86-debug\gallium\targets\osmesa\osmesa.lib and object
build\windows-x86-debug\gallium\targets\osmesa\osmesa.exp
Creating library
build\windows-x86-debug\gallium\targets\libgl-gdi\opengl32.lib and
object build\windows-x86-debug\gallium\targets\libgl-gdi\opengl32.exp
nir.lib(nir_lower_atomics_to_ssbo.obj) : error LNK2019: unresolved
external symbol _snprintf referenced in function
_nir_lower_atomics_to_ssbo
build\windows-x86-debug\gallium\targets\osmesa\osmesa.dll : fatal
error LNK1120: 1 unresolved externals
scons: *** [build\windows-x86-debug\gallium\targets\osmesa\osmesa.dll]
Error 1120
nir.lib(nir_lower_atomics_to_ssbo.obj) : error LNK2019: unresolved
external symbol _snprintf referenced in function
_nir_lower_atomics_to_ssbo
build\windows-x86-debug\gallium\targets\libgl-gdi\opengl32.dll : fatal
error LNK1120: 1 unresolved externals
scons: *** [build\windows-x86-debug\gallium\targets\libgl-gdi\opengl32.dll]
Error 1120

Anyone got any bright ideas?

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


[Mesa-dev] [PATCH v2 6/6] egl/wayland: Use per-surface event queues

2017-05-05 Thread Daniel Stone
During display initialisation, we need a separate event queue to handle
the registry events, which is correctly handled. But we also need
separate per-surface event queues to handle swapchain-related events,
such as surface frame events and buffer release events. This avoids two
surfaces from the same EGLDisplay, both current on separate threads,
dispatching each other's events.

Create separate per-surface event queues, create wl_surface and wl_drm
proxy wrapper objects per surface, so we eliminate the race around
sending events to the wrong queue. swrast buffers do not need a
dedicated proxy wrapper, as the wl_shm_pool used to create the
wl_buffers, being transient, can itself be assigned to a queue.

Signed-off-by: Daniel Stone 
Fixes: 36b9976e1f99 ("egl/wayland: Avoid race conditions when on non-main 
thread")
Cc: Jonas Ådahl 
Cc: mesa-sta...@lists.freedesktop.org
---
 src/egl/drivers/dri2/egl_dri2.h |  3 ++
 src/egl/drivers/dri2/platform_wayland.c | 75 +
 2 files changed, 52 insertions(+), 26 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index f16663712d..4d966d9d61 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -257,6 +257,9 @@ struct dri2_egl_surface
struct wl_egl_window  *wl_win;
intdx;
intdy;
+   struct wl_event_queue *wl_queue;
+   struct wl_surface *wl_surface_wrapper;
+   struct wl_drm *wl_drm_wrapper;
struct wl_callback*throttle_callback;
intformat;
 #endif
diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index 561609dbab..145ab8e956 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -146,6 +146,29 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay 
*disp,
}
 
dri2_surf->wl_win = window;
+   dri2_surf->wl_queue = wl_display_create_queue(dri2_dpy->wl_dpy);
+   if (!window) {
+  _eglError(EGL_BAD_ALLOC, "dri2_create_surface");
+  goto cleanup_surf;
+   }
+
+   if (dri2_dpy->wl_drm) {
+  dri2_surf->wl_drm_wrapper = wl_proxy_create_wrapper(dri2_dpy->wl_drm);
+  if (!dri2_surf->wl_drm_wrapper) {
+ _eglError(EGL_BAD_ALLOC, "dri2_create_surface");
+ goto cleanup_queue;
+  }
+  wl_proxy_set_queue((struct wl_proxy *)dri2_surf->wl_drm_wrapper,
+ dri2_surf->wl_queue);
+   }
+
+   dri2_surf->wl_surface_wrapper = wl_proxy_create_wrapper(window->surface);
+   if (!dri2_surf->wl_surface_wrapper) {
+  _eglError(EGL_BAD_ALLOC, "dri2_create_surface");
+  goto cleanup_drm;
+   }
+   wl_proxy_set_queue((struct wl_proxy *)dri2_surf->wl_surface_wrapper,
+  dri2_surf->wl_queue);
 
dri2_surf->wl_win->private = dri2_surf;
dri2_surf->wl_win->destroy_window_callback = destroy_window_callback;
@@ -176,6 +199,11 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay 
*disp,
 
return _surf->base;
 
+ cleanup_drm:
+   if (dri2_surf->wl_drm_wrapper)
+  wl_proxy_wrapper_destroy(dri2_surf->wl_drm_wrapper);
+ cleanup_queue:
+   wl_event_queue_destroy(dri2_surf->wl_queue);
  cleanup_surf:
free(dri2_surf);
 
@@ -309,7 +337,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
}
 
/* There might be a buffer release already queued that wasn't processed */
-   wl_display_dispatch_queue_pending(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
+   wl_display_dispatch_queue_pending(dri2_dpy->wl_dpy, dri2_surf->wl_queue);
 
if (dri2_surf->back == NULL) {
   for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
@@ -610,7 +638,7 @@ create_wl_buffer(struct dri2_egl_surface *dri2_surf)
   dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, );
 
   dri2_surf->current->wl_buffer =
- wl_drm_create_prime_buffer(dri2_dpy->wl_drm,
+ wl_drm_create_prime_buffer(dri2_surf->wl_drm_wrapper,
 fd,
 dri2_surf->base.Width,
 dri2_surf->base.Height,
@@ -624,7 +652,7 @@ create_wl_buffer(struct dri2_egl_surface *dri2_surf)
   dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, );
 
   dri2_surf->current->wl_buffer =
- wl_drm_create_buffer(dri2_dpy->wl_drm,
+ wl_drm_create_buffer(dri2_surf->wl_drm_wrapper,
   name,
   dri2_surf->base.Width,
   dri2_surf->base.Height,
@@ -632,8 +660,6 @@ create_wl_buffer(struct dri2_egl_surface *dri2_surf)
   dri2_surf->format);
}
 
-   wl_proxy_set_queue((struct wl_proxy *) dri2_surf->current->wl_buffer,
-  dri2_dpy->wl_queue);
wl_buffer_add_listener(dri2_surf->current->wl_buffer,
   

[Mesa-dev] [PATCH v2 0/6] Wayland proxy wrapper fixes

2017-05-05 Thread Daniel Stone
Hi,
This series uses proxy wrappers and separate event queues through the
Wayland WSI and EGL implementations. EGL already had a partial fix in
that it had a per-display event queue, but this was not enough to
protect multiple surfaces on a single display being used
simultaneously. WSI had a per-swapchain queue, but lacked a per-display
thread for display setup, and also was missing use of proxy wrappers to
eliminate races.

Fix these races by making both WSI and EGL implementations use both
per-display and per-swapchain/surface event queues, plus some minor
fixes I spotted whilst in the area.

Cheers,
Daniel

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


[Mesa-dev] [PATCH v2 3/6] vulkan/wsi/wayland: Use per-display event queue

2017-05-05 Thread Daniel Stone
Calling random callbacks on the display's event queue is hostile, as
we may call into client code when it least expects it. Create our own
event queue, one per wsi_wl_display, and use that for the registry.

Signed-off-by: Daniel Stone 
Cc: mesa-sta...@lists.freedesktop.org
---
 src/vulkan/wsi/wsi_common_wayland.c | 44 +++--
 1 file changed, 32 insertions(+), 12 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index 014ea13d65..c67ba089f9 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -45,7 +45,11 @@
 struct wsi_wayland;
 
 struct wsi_wl_display {
-   struct wl_display *  display;
+   /* The real wl_display */
+   struct wl_display *  wl_display;
+   /* Actually a proxy wrapper around the event queue */
+   struct wl_display *  wl_display_wrapper;
+   struct wl_event_queue *  queue;
struct wl_drm *  drm;
 
struct wsi_wayland *wsi_wl;
@@ -250,6 +254,10 @@ wsi_wl_display_destroy(struct wsi_wayland *wsi, struct 
wsi_wl_display *display)
u_vector_finish(>formats);
if (display->drm)
   wl_drm_destroy(display->drm);
+   if (display->wl_display_wrapper)
+  wl_proxy_wrapper_destroy(display->wl_display_wrapper);
+   if (display->queue)
+  wl_event_queue_destroy(display->queue);
vk_free(wsi->alloc, display);
 }
 
@@ -264,26 +272,38 @@ wsi_wl_display_create(struct wsi_wayland *wsi, struct 
wl_display *wl_display)
 
memset(display, 0, sizeof(*display));
 
-   display->display = wl_display;
display->wsi_wl = wsi;
+   display->wl_display = wl_display;
 
if (!u_vector_init(>formats, sizeof(VkFormat), 8))
   goto fail;
 
-   struct wl_registry *registry = wl_display_get_registry(wl_display);
+   display->queue = wl_display_create_queue(wl_display);
+   if (!display->queue)
+  goto fail;
+
+   display->wl_display_wrapper = wl_proxy_create_wrapper(wl_display);
+   if (!display->wl_display_wrapper)
+  goto fail;
+
+   wl_proxy_set_queue((struct wl_proxy *) display->wl_display_wrapper,
+  display->queue);
+
+   struct wl_registry *registry =
+  wl_display_get_registry(display->wl_display_wrapper);
if (!registry)
   goto fail;
 
wl_registry_add_listener(registry, _listener, display);
 
-   /* Round-rip to get the wl_drm global */
-   wl_display_roundtrip(wl_display);
+   /* Round-trip to get the wl_drm global */
+   wl_display_roundtrip_queue(display->wl_display, display->queue);
 
if (!display->drm)
   goto fail_registry;
 
-   /* Round-rip to get wl_drm formats and capabilities */
-   wl_display_roundtrip(wl_display);
+   /* Round-trip to get wl_drm formats and capabilities */
+   wl_display_roundtrip_queue(display->wl_display, display->queue);
 
/* We need prime support */
if (!(display->capabilities & WL_DRM_CAPABILITY_PRIME))
@@ -535,7 +555,7 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain 
*wsi_chain,
 {
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
 
-   int ret = wl_display_dispatch_queue_pending(chain->display->display,
+   int ret = wl_display_dispatch_queue_pending(chain->display->wl_display,
chain->queue);
/* XXX: I'm not sure if out-of-date is the right error here.  If
 * wl_display_dispatch_queue_pending fails it most likely means we got
@@ -557,7 +577,7 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain 
*wsi_chain,
   /* This time we do a blocking dispatch because we can't go
* anywhere until we get an event.
*/
-  int ret = wl_display_roundtrip_queue(chain->display->display,
+  int ret = wl_display_roundtrip_queue(chain->display->wl_display,
chain->queue);
   if (ret < 0)
  return VK_ERROR_OUT_OF_DATE_KHR;
@@ -587,7 +607,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain 
*wsi_chain,
 
if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) {
   while (!chain->fifo_ready) {
- int ret = wl_display_dispatch_queue(chain->display->display,
+ int ret = wl_display_dispatch_queue(chain->display->wl_display,
  chain->queue);
  if (ret < 0)
 return VK_ERROR_OUT_OF_DATE_KHR;
@@ -619,7 +639,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain 
*wsi_chain,
 
chain->images[image_index].busy = true;
wl_surface_commit(chain->surface);
-   wl_display_flush(chain->display->display);
+   wl_display_flush(chain->display->wl_display);
 
return VK_SUCCESS;
 }
@@ -765,7 +785,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase 
*icd_surface,
   goto fail;
}
 
-   chain->queue = wl_display_create_queue(chain->display->display);
+   chain->queue = 

[Mesa-dev] [PATCH v2 5/6] egl/wayland: Don't open-code roundtrip

2017-05-05 Thread Daniel Stone
wl_display_roundtrip_queue() exists and can replace roundtrip().

Signed-off-by: Daniel Stone 
Cc: mesa-sta...@lists.freedesktop.lrg
---
 src/egl/drivers/dri2/platform_wayland.c | 26 +-
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index a3380f298d..561609dbab 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -55,34 +55,10 @@ static EGLBoolean
 dri2_wl_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
   EGLint interval);
 
-static void
-sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
-{
-   int *done = data;
-
-   *done = 1;
-   wl_callback_destroy(callback);
-}
-
-static const struct wl_callback_listener sync_listener = {
-   .done = sync_callback
-};
-
 static int
 roundtrip(struct dri2_egl_display *dri2_dpy)
 {
-   struct wl_callback *callback;
-   int done = 0, ret = 0;
-
-   callback = wl_display_sync(dri2_dpy->wl_dpy_wrapper);
-   wl_callback_add_listener(callback, _listener, );
-   while (ret != -1 && !done)
-  ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
-
-   if (!done)
-  wl_callback_destroy(callback);
-
-   return ret;
+   return wl_display_roundtrip_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
 }
 
 static void
-- 
2.12.2

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


[Mesa-dev] [PATCH v2 2/6] vulkan/wsi/wayland: Remove roundtrip when creating image

2017-05-05 Thread Daniel Stone
There's no need to call wl_display_roundtrip() after trying to create a
buffer through wl_drm; if it succeeds then everything is fine, and if it
fails, then we get a fatal protocol error so can't recover anyway.

Additionally, doing a roundtrip on the default / main application queue,
is destructive anyway, so would need to be its own queue.

Signed-off-by: Daniel Stone 
Cc: mesa-sta...@lists.freedesktop.org
---
 src/vulkan/wsi/wsi_common_wayland.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index 9c246b8d5c..014ea13d65 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -672,7 +672,6 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
   offset,
   row_pitch,
   0, 0, 0, 0 /* unused */);
-   wl_display_roundtrip(chain->display->display);
close(fd);
 
if (!image->buffer)
-- 
2.12.2

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


[Mesa-dev] [PATCH v2 1/6] vulkan: Fix Wayland uninitialised registry

2017-05-05 Thread Daniel Stone
Untangle the exit cleanup paths so we don't try to use the registry
variable before it's been initialised.

Signed-off-by: Daniel Stone 
Cc: mesa-sta...@lists.freedesktop.org
---
 src/vulkan/wsi/wsi_common_wayland.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index 5613283d9d..9c246b8d5c 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -272,7 +272,7 @@ wsi_wl_display_create(struct wsi_wayland *wsi, struct 
wl_display *wl_display)
 
struct wl_registry *registry = wl_display_get_registry(wl_display);
if (!registry)
-  return NULL;
+  goto fail;
 
wl_registry_add_listener(registry, _listener, display);
 
@@ -280,24 +280,25 @@ wsi_wl_display_create(struct wsi_wayland *wsi, struct 
wl_display *wl_display)
wl_display_roundtrip(wl_display);
 
if (!display->drm)
-  goto fail;
+  goto fail_registry;
 
/* Round-rip to get wl_drm formats and capabilities */
wl_display_roundtrip(wl_display);
 
/* We need prime support */
if (!(display->capabilities & WL_DRM_CAPABILITY_PRIME))
-  goto fail;
+  goto fail_registry;
 
/* We don't need this anymore */
wl_registry_destroy(registry);
 
return display;
 
-fail:
+fail_registry:
if (registry)
   wl_registry_destroy(registry);
 
+fail:
wsi_wl_display_destroy(wsi, display);
return NULL;
 }
-- 
2.12.2

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


[Mesa-dev] [PATCH v2 4/6] vulkan/wsi/wayland: Use proxy wrappers for swapchain

2017-05-05 Thread Daniel Stone
Though most swapchain operations used a queue, they were racy in that
the object was created with the queue only set later, meaning that its
event could potentially be dispatched from the default queue in between
these two steps.

Use proxy wrappers to avoid this race, also assigning wl_buffers created
for the swapchain to the event queue.

Signed-off-by: Daniel Stone 
Cc: mesa-sta...@lists.freedesktop.org
---
 src/vulkan/wsi/wsi_common_wayland.c | 52 +
 1 file changed, 36 insertions(+), 16 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index c67ba089f9..cb72183efd 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -510,6 +510,7 @@ struct wsi_wl_swapchain {
struct wl_event_queue *  queue;
struct wl_surface *  surface;
uint32_t surface_version;
+   struct wl_drm *  drm_wrapper;
 
VkExtent2D   extent;
VkFormat vk_format;
@@ -632,7 +633,6 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain 
*wsi_chain,
 
if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) {
   struct wl_callback *frame = wl_surface_frame(chain->surface);
-  wl_proxy_set_queue((struct wl_proxy *)frame, chain->queue);
   wl_callback_add_listener(frame, _listener, chain);
   chain->fifo_ready = false;
}
@@ -684,7 +684,7 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
if (result != VK_SUCCESS)
   return result;
 
-   image->buffer = wl_drm_create_prime_buffer(chain->display->drm,
+   image->buffer = wl_drm_create_prime_buffer(chain->drm_wrapper,
   fd, /* name */
   chain->extent.width,
   chain->extent.height,
@@ -697,7 +697,6 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
if (!image->buffer)
   goto fail_image;
 
-   wl_proxy_set_queue((struct wl_proxy *)image->buffer, chain->queue);
wl_buffer_add_listener(image->buffer, _listener, image);
 
return VK_SUCCESS;
@@ -722,6 +721,13 @@ wsi_wl_swapchain_destroy(struct wsi_swapchain *wsi_chain,
chain->images[i].memory);
}
 
+   if (chain->surface)
+  wl_proxy_wrapper_destroy(chain->surface);
+   if (chain->drm_wrapper)
+  wl_proxy_wrapper_destroy(chain->drm_wrapper);
+   if (chain->queue)
+  wl_event_queue_destroy(chain->queue);
+
vk_free(pAllocator, chain);
 
return VK_SUCCESS;
@@ -751,6 +757,15 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase 
*icd_surface,
if (chain == NULL)
   return VK_ERROR_OUT_OF_HOST_MEMORY;
 
+   /* Mark a bunch of stuff as NULL.  This way we can just call
+* destroy_swapchain for cleanup.
+*/
+   for (uint32_t i = 0; i < num_images; i++)
+  chain->images[i].buffer = NULL;
+   chain->queue = NULL;
+   chain->surface = NULL;
+   chain->drm_wrapper = NULL;
+
bool alpha = pCreateInfo->compositeAlpha ==
   VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
 
@@ -763,23 +778,11 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase 
*icd_surface,
chain->base.present_mode = pCreateInfo->presentMode;
chain->base.image_count = num_images;
chain->base.needs_linear_copy = false;
-   chain->surface = surface->surface;
-   chain->surface_version = wl_proxy_get_version((void *)surface->surface);
chain->extent = pCreateInfo->imageExtent;
chain->vk_format = pCreateInfo->imageFormat;
chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, alpha);
 
-   chain->fifo_ready = true;
-
-   /* Mark a bunch of stuff as NULL.  This way we can just call
-* destroy_swapchain for cleanup.
-*/
-   for (uint32_t i = 0; i < chain->base.image_count; i++)
-  chain->images[i].buffer = NULL;
-   chain->queue = NULL;
-
-   chain->display = wsi_wl_get_display(wsi_device,
-   surface->display);
+   chain->display = wsi_wl_get_display(wsi_device, surface->display);
if (!chain->display) {
   result = VK_ERROR_INITIALIZATION_FAILED;
   goto fail;
@@ -791,6 +794,23 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase 
*icd_surface,
   goto fail;
}
 
+   chain->surface = wl_proxy_create_wrapper(surface->surface);
+   if (!chain->surface) {
+  result = VK_ERROR_INITIALIZATION_FAILED;
+  goto fail;
+   }
+   wl_proxy_set_queue((struct wl_proxy *) chain->surface, chain->queue);
+   chain->surface_version = wl_proxy_get_version((void *)surface->surface);
+
+   chain->drm_wrapper = wl_proxy_create_wrapper(chain->display->drm);
+   if (!chain->drm_wrapper) {
+  result = VK_ERROR_INITIALIZATION_FAILED;
+  goto fail;
+   }
+   wl_proxy_set_queue((struct wl_proxy 

[Mesa-dev] [Bug 100690] [Regression, bisected] TotalWar: Warhammer corrupted graphics

2017-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100690

Kenneth Graunke  changed:

   What|Removed |Added

   Assignee|mesa-dev@lists.freedesktop. |kenn...@whitecape.org
   |org |
 Status|NEW |ASSIGNED

--- Comment #13 from Kenneth Graunke  ---
I sent a revert today.

-- 
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 4/4] vulkan/wsi/wayland: Use proxy wrappers for swapchain

2017-05-05 Thread Daniel Stone
Hi Emil,

On 4 May 2017 at 13:21, Emil Velikov  wrote:
>> +   struct wl_drm *  drm_wrapper;
>>
> Based on a quick skim 3/4 aligns with commit
> 36b9976e1f99e8070c67cb8a255793939db77d02.
> At the same time we don't seem to have a drm_wrapper in egl/wayland -
> is that intentional?

Right, and no it's not intentional; the initial EGL support wasn't
quite complete. I'll include a new tag in v2.

> The series looks like important bugfixes - please add a Fixes or Cc:
> mesa-stable tag.

Sure. They fix basically all ANV since the dawn of time, so I guess
it's easier to just add a Cc.

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


Re: [Mesa-dev] [PATCH] radeonsi: apply the tess+GS hang workaround to Polaris12 as well

2017-05-05 Thread Nicolai Hähnle

On 05.05.2017 17:14, Marek Olšák wrote:

From: Marek Olšák 

Cc: 17.1 


Reviewed-by: Nicolai Hähnle 



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

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index e6a9ee0..5f1371a 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -325,21 +325,22 @@ si_get_init_multi_vgt_param(struct si_screen *sscreen,
/* Needed for 028B6C_DISTRIBUTION_MODE != 0 */
if (sscreen->has_distributed_tess) {
if (key->u.uses_gs) {
if (sscreen->b.chip_class <= VI)
partial_es_wave = true;

/* GPU hang workaround. */
if (sscreen->b.family == CHIP_TONGA ||
sscreen->b.family == CHIP_FIJI ||
sscreen->b.family == CHIP_POLARIS10 ||
-   sscreen->b.family == CHIP_POLARIS11)
+   sscreen->b.family == CHIP_POLARIS11 ||
+   sscreen->b.family == CHIP_POLARIS12)
partial_vs_wave = true;
} else {
partial_vs_wave = true;
}
}
}

/* This is a hardware requirement. */
if (key->u.line_stipple_enabled ||
(sscreen->b.debug_flags & DBG_SWITCH_ON_EOP)) {




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


[Mesa-dev] [AppVeyor] mesa master #4271 failed

2017-05-05 Thread AppVeyor



Build mesa 4271 failed


Commit 8b8af19065 by Daniel Stone on 5/3/2017 8:38 AM:

i965: Set modifier for imported and duplicated images\n\nWhen a buffer is being created from FD or GEM flink import, the current\nAPI makes no provision for passing modifier information along with this.\nSet the modifier for such images to DRM_FORMAT_MOD_INVALID.\n\nAlso preserve the modifier when duplicating an image, as will be done by\nGBM when importing from a wl_buffer.\n\nThis doubly tripped up Wayland, as the images would first have been\ncreated (as wl_buffers) with a 0 modifier, and then lost what modifier\nthey would've had when being duplicated into gbm_bos.\n\nFixes: d78a36ea624 ("i965/dri: Handle the linear fb modifier")\nSigned-off-by: Daniel Stone \nReviewed-by: Emil Velikov 


Configure your notification preferences

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


Re: [Mesa-dev] [PATCH v2 1/2] i965: Use helper function for modifier -> tiling

2017-05-05 Thread Daniel Stone
Hi Emil,

On 4 May 2017 at 15:14, Emil Velikov  wrote:
> On 4 May 2017 at 14:43, Daniel Stone  wrote:
>> IOW, there is no change as far as I can see, but perhaps for the
>> meantime, we could use an unreachable() at the bottom of
>> modifier_to_tiling(). Would that help?
>>
> Yes the default statement and return I915_TILING_NONE in
> modifier_to_tiling() seem unreachable.
>
> unreachable or assert - I am leaning slightly towards the latter since
> it will catch fallouts in the future.
> I'll leave the decision to you and the Intel devs.
>
> In either case:
> Reviewed-by: Emil Velikov 

Cool, I've pushed these both now with an assert - thanks!

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


Re: [Mesa-dev] [PATCH v4 21/31] glsl: allow bindless samplers/images to be l-values

2017-05-05 Thread Nicolai Hähnle

On 05.05.2017 09:34, Samuel Pitoiset wrote:

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers can be used as l-values, so can be assigned into and
   used as "out" and "inout" function parameters."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images can be used as l-values, so can be assigned into and
used as "out" and "inout" function parameters."

v4: - invert the logic
v3: - update spec comment formatting
- keep the read_only check

Signed-off-by: Samuel Pitoiset 


Thanks!

Reviewed-by: Nicolai Hähnle 


---
 src/compiler/glsl/ir.cpp | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 22853f0ef3..4ae23e92f1 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1447,6 +1447,20 @@ ir_dereference::is_lvalue(const struct 
_mesa_glsl_parse_state *state) const
if ((var == NULL) || var->data.read_only)
   return false;

+   /* From section 4.1.7 of the ARB_bindless_texture spec:
+*
+* "Samplers can be used as l-values, so can be assigned into and used as
+*  "out" and "inout" function parameters."
+*
+* From section 4.1.X of the ARB_bindless_texture spec:
+*
+* "Images can be used as l-values, so can be assigned into and used as
+*  "out" and "inout" function parameters."
+*/
+   if ((!state || state->has_bindless()) &&
+   (this->type->contains_sampler() || this->type->contains_image()))
+  return true;
+
/* From section 4.1.7 of the GLSL 4.40 spec:
 *
 *   "Opaque variables cannot be treated as l-values; hence cannot




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


[Mesa-dev] [PATCH] Revert "mesa: Require mipmap completeness for glCopyImageSubData(), sometimes."

2017-05-05 Thread Kenneth Graunke
This reverts commit c5bf7cb52942cb7df9f5d73746ffbf3c102d12cc.

This broke rendering in "Total War: WARHAMMER", which uses a single
level RGBA_UINT32 texture and the default filter modes of GL_LINEAR
and GL_NEAREST_MIPMAP_LINEAR.  However, the texture max level is 0,
so it is actually mipmap complete - it's the integer + linear rule
that causes the error.

I'm working with Khronos to find a real solution.  However it turns
out, this patch is not correct and breaks real programs, so let's
revert it for now.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100690
Bugzilla: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=16224
Cc: "17.1" 
---
 src/mesa/main/copyimage.c | 25 ++---
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c
index 877c8ac246d..cf25159e880 100644
--- a/src/mesa/main/copyimage.c
+++ b/src/mesa/main/copyimage.c
@@ -149,30 +149,9 @@ prepare_target(struct gl_context *ctx, GLuint name, GLenum 
target,
  return false;
   }
 
-  /* The ARB_copy_image specification says:
-   *
-   *"INVALID_OPERATION is generated if either object is a texture and
-   * the texture is not complete (as defined in section 3.9.14)"
-   *
-   * The cited section says:
-   *
-   *"Using the preceding definitions, a texture is complete unless any
-   * of the following conditions hold true: [...]
-   *
-   * * The minification filter requires a mipmap (is neither NEAREST
-   *   nor LINEAR), and the texture is not mipmap complete."
-   *
-   * This imposes the bizarre restriction that glCopyImageSubData requires
-   * mipmap completion at times, which dEQP mandates, and other drivers
-   * appear to implement.  We don't have any texture units here, so we
-   * can't look at any bound separate sampler objects...it appears that
-   * you're supposed to use the sampler object which is built-in to the
-   * texture object.
-   *
-   * See https://cvs.khronos.org/bugzilla/show_bug.cgi?id=16224.
-   */
   _mesa_test_texobj_completeness(ctx, texObj);
-  if (!_mesa_is_texture_complete(texObj, >Sampler)) {
+  if (!texObj->_BaseComplete ||
+  (level != 0 && !texObj->_MipmapComplete)) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
  "glCopyImageSubData(%sName incomplete)", dbg_prefix);
  return false;
-- 
2.12.2

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


[Mesa-dev] [Bug 100928] exported opengl function in generated dll was mangled when building with msvc 2015 Update 3

2017-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100928

--- Comment #2 from George Kyriazis  ---
There seems to be multiple issues here.

First of all, swr driver is not buildable with machine=x86 (only compile with
64-bit builds).  I don't understand how you managed to build a 32-bit swr
driver.

Second, on windows, it looks like both swr and llvmpipe advertise 3.0 core
profile.  The smooth_opengl3.c test that was attached, explicitly asks for 3.1,
which, of course, cannot be provided.

It looks like there is a mesa OS dependence on the advertised core profile.  It
looks like Windows advertises 3.0, while linux advertises 3.3, at least for
llvmpipe and swr drivers.

It doesn't look like it's a swr-specific driver bug.

-- 
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] i965: make emit_dwords non-static and reuse it in blorp

2017-05-05 Thread Rafael Antognolli
On Fri, May 05, 2017 at 11:47:09AM +0100, Emil Velikov wrote:
> From: Emil Velikov 
> 
> Signed-off-by: Emil Velikov 
> ---
>  src/mesa/drivers/dri/i965/brw_state.h |  1 +
>  src/mesa/drivers/dri/i965/genX_blorp_exec.c   |  6 +
>  src/mesa/drivers/dri/i965/genX_state_upload.c | 32 
> +--
>  3 files changed, 18 insertions(+), 21 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
> b/src/mesa/drivers/dri/i965/brw_state.h
> index d2d3d7c2c0d..06052fc9b02 100644
> --- a/src/mesa/drivers/dri/i965/brw_state.h
> +++ b/src/mesa/drivers/dri/i965/brw_state.h
> @@ -357,6 +357,7 @@ void brw_copy_pipeline_atoms(struct brw_context *brw,
>   enum brw_pipeline pipeline,
>   const struct brw_tracked_state **atoms,
>   int num_atoms);
> +void *brw_emit_dwords(struct brw_context *brw, unsigned n);
>  void gen4_init_atoms(struct brw_context *brw);
>  void gen45_init_atoms(struct brw_context *brw);
>  void gen5_init_atoms(struct brw_context *brw);
> diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.c 
> b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
> index 7157420328f..0a93c31334a 100644
> --- a/src/mesa/drivers/dri/i965/genX_blorp_exec.c
> +++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
> @@ -40,11 +40,7 @@ blorp_emit_dwords(struct blorp_batch *batch, unsigned n)
> assert(batch->blorp->driver_ctx == batch->driver_batch);
> struct brw_context *brw = batch->driver_batch;
>  
> -   intel_batchbuffer_begin(brw, n, RENDER_RING);
> -   uint32_t *map = brw->batch.map_next;
> -   brw->batch.map_next += n;
> -   intel_batchbuffer_advance(brw);
> -   return map;
> +   return brw_emit_dwords(brw, n);
>  }
>  
>  static uint64_t
> diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c 
> b/src/mesa/drivers/dri/i965/genX_state_upload.c
> index ceeacfcdef7..4e8cf4f6b06 100644
> --- a/src/mesa/drivers/dri/i965/genX_state_upload.c
> +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
> @@ -55,8 +55,8 @@
>  #include "main/transformfeedback.h"
>  #include "main/viewport.h"
>  
> -UNUSED static void *
> -emit_dwords(struct brw_context *brw, unsigned n)
> +void *
> +brw_emit_dwords(struct brw_context *brw, unsigned n)
>  {

Hi Emil,

This is going to cause several brw_emit_dwords() symbols to be exposed
(one for gen4, one for gen45, one for gen5,... one for gen9). And
consequently, the build fails because of the multiple definitions.

Assuming you want to really expose this function several times, you
should use genX(emit_dwords)(...), which would generate
gen4_emit_dwords() and all the others.

That said, imho it would be better to move this function outside of this
file and have only one version of it.

Rafael

> intel_batchbuffer_begin(brw, n, RENDER_RING);
> uint32_t *map = brw->batch.map_next;
> @@ -149,22 +149,22 @@ vertex_bo(struct brw_bo *bo, uint32_t offset)
>  #define _brw_cmd_header(cmd) cmd ## _header
>  #define _brw_cmd_pack(cmd) cmd ## _pack
>  
> -#define brw_batch_emit(brw, cmd, name)  \
> -   for (struct cmd name = { _brw_cmd_header(cmd) }, \
> -*_dst = emit_dwords(brw, _brw_cmd_length(cmd)); \
> -__builtin_expect(_dst != NULL, 1);  \
> -_brw_cmd_pack(cmd)(brw, (void *)_dst, ),   \
> +#define brw_batch_emit(brw, cmd, name)  \
> +   for (struct cmd name = { _brw_cmd_header(cmd) }, \
> +*_dst = brw_emit_dwords(brw, _brw_cmd_length(cmd)); \
> +__builtin_expect(_dst != NULL, 1);  \
> +_brw_cmd_pack(cmd)(brw, (void *)_dst, ),   \
>  _dst = NULL)
>  
> -#define brw_batch_emitn(brw, cmd, n, ...) ({   \
> -  uint32_t *_dw = emit_dwords(brw, n); \
> -  struct cmd template = {  \
> - _brw_cmd_header(cmd), \
> - .DWordLength = n - _brw_cmd_length_bias(cmd), \
> - __VA_ARGS__   \
> -  };   \
> -  _brw_cmd_pack(cmd)(brw, _dw, ); \
> -  _dw + 1; /* Array starts at dw[1] */ \
> +#define brw_batch_emitn(brw, cmd, n, ...) ({\
> +  uint32_t *_dw = brw_emit_dwords(brw, n);  \
> +  struct cmd template = {   \
> + _brw_cmd_header(cmd),  \
> + .DWordLength = n - _brw_cmd_length_bias(cmd),  \
> + __VA_ARGS__\
> +  };\
> +  _brw_cmd_pack(cmd)(brw, _dw, );  \
> +  _dw + 1; /* Array starts at dw[1] */  \
> })
>  
>  #define brw_state_emit(brw, cmd, align, offset, name)  \
> -- 
> 2.12.2
> 
> 

Re: [Mesa-dev] [PATCH v03 35/38] i965: Port gen4+ emit vertices code to genxml.

2017-05-05 Thread Rafael Antognolli
On Fri, May 05, 2017 at 08:38:53AM +0300, Pohjolainen, Topi wrote:
> On Thu, May 04, 2017 at 12:16:53PM -0700, Rafael Antognolli wrote:
> > On Thu, May 04, 2017 at 11:19:24AM +0300, Pohjolainen, Topi wrote:
> > > On Mon, May 01, 2017 at 06:43:23PM -0700, Rafael Antognolli wrote:
> > > > Some code that was placed in brw_draw_upload.c and exported to be used
> > > > by gen8+ was also moved to genX_state_upload, and the respective symbols
> > > > are not exported anymore.
> > > > 
> > > > v2:
> > > >- Remove code from brw_draw_upload too
> > > >- Emit vertices for gen4-5 too.
> > > >- Use helper to setup brw_address (Kristian)
> > > >- Use macros for MOCS values.
> > > >- Do not use #ifndef NDEBUG on code that is actually used (Ken)
> > > > v3:
> > > >- Style and code clenup (Ken)
> > > >- Keep some of the common code inside brw_draw_upload.c (Ken)
> > > > 
> > > > Signed-off-by: Rafael Antognolli 
> > > 
> > > There are some formatting nits further down but comparing to original I
> > > couldn't spot anything really missing. All in all looks cleaner than 
> > > before :)
> > > 
> > > Reviewed-by: Topi Pohjolainen 
> > 
> > Kenneth landed this patch already, but I just prepared a new one to fix
> > almost all these things, except the following one:
> > 
> > [snip]
> > > > +
> > > > +   if (needs_sgvs_element) {
> > > > +  struct GENX(VERTEX_ELEMENT_STATE) elem_state = {
> > > > + .Valid = true,
> > > > + .Component0Control = VFCOMP_STORE_0,
> > > > + .Component1Control = VFCOMP_STORE_0,
> > > > + .Component2Control = VFCOMP_STORE_0,
> > > > + .Component3Control = VFCOMP_STORE_0,
> > > > +#if GEN_GEN < 5
> > > > + .DestinationElementOffset = i * 4,
> > > 
> > > This is how original had it also. I'm just thinking should we use instead:
> > > 
> > > .DestinationElementOffset = brw->vb.nr_buffers * 4,
> > > 
> > > At this point i == brw->vb.nr_buffers always holds, right?
> > 
> > I think it should be brw->vb.nr_enabled, but yeah.
> 
> Right, nr_enabled not nr_buffers, sorry for the confusion.
> 
> > 
> > > > +#endif
> > > > +  };
> > > > +
> > > > +#if GEN_GEN >= 8
> > > > +  if (vs_prog_data->uses_basevertex ||
> > > > +  vs_prog_data->uses_baseinstance) {
> > > > + elem_state.VertexBufferIndex = brw->vb.nr_buffers;
> > > > + elem_state.SourceElementFormat = ISL_FORMAT_R32G32_UINT;
> > > > + elem_state.Component0Control = VFCOMP_STORE_SRC;
> > > > + elem_state.Component1Control = VFCOMP_STORE_SRC;
> > > > +  }
> > > > +#else
> > > > +  elem_state.VertexBufferIndex = brw->vb.nr_buffers;
> > > > +  elem_state.SourceElementFormat = ISL_FORMAT_R32G32_UINT;
> > > > +  if (vs_prog_data->uses_basevertex)
> > > > + elem_state.Component0Control = VFCOMP_STORE_SRC;
> > > > +
> > > > +  if (vs_prog_data->uses_baseinstance)
> > > > + elem_state.Component1Control = VFCOMP_STORE_SRC;
> > > > +
> > > > +  if (vs_prog_data->uses_vertexid)
> > > > + elem_state.Component2Control = VFCOMP_STORE_VID;
> > > > +
> > > > +  if (vs_prog_data->uses_instanceid)
> > > > + elem_state.Component3Control = VFCOMP_STORE_IID;
> > > > +#endif
> > > > +
> > > > +  GENX(VERTEX_ELEMENT_STATE_pack)(brw, dw, _state);
> > > > +  dw += GENX(VERTEX_ELEMENT_STATE_length);
> > > > +   }
> > > > +
> > > > +   if (vs_prog_data->uses_drawid) {
> > > > +  struct GENX(VERTEX_ELEMENT_STATE) elem_state = {
> > > > + .Valid = true,
> > > > + .VertexBufferIndex = brw->vb.nr_buffers + 1,
> > > > + .SourceElementFormat = ISL_FORMAT_R32_UINT,
> > > > + .Component0Control = VFCOMP_STORE_SRC,
> > > > + .Component1Control = VFCOMP_STORE_0,
> > > > + .Component2Control = VFCOMP_STORE_0,
> > > > + .Component3Control = VFCOMP_STORE_0,
> > > > +#if GEN_GEN < 5
> > > > + .DestinationElementOffset = i * 4,
> > > 
> > > Same comment as further up.
> > 
> > So, if I understand this field correctly, it should be
> > brw->vb.nr_enabled + 1, which would mean the old code was wrong?
> 
> Hmm, yeah, it looks odd. On gen < 6 you end up with two elements having
> indices set to "brw->vb.nr_buffers" and "brw->vb.nr_buffers + 1" but both
> having .DestinationElementOffset == i * 4 == brw->vb.nr_buffers * 4.
> 
> And like you said, this is already the case in the original. Ken, can you
> explain this?

FWIW, I tested both with jenkins and it doesn't seem to make any
difference.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] anv/i965: drop libdrm dependency completely

2017-05-05 Thread Emil Velikov
On 4 May 2017 at 19:43, Lionel Landwerlin  wrote:
> On 04/05/17 07:52, Emil Velikov wrote:
>>
>> On 4 May 2017 at 14:46, Daniel Vetter  wrote:
>>>
>>> On Thu, Apr 27, 2017 at 10:58:42AM -0700, Lionel Landwerlin wrote:

 On 27/04/17 08:20, Eric Anholt wrote:
>
> Emil Velikov  writes:
>
>> On 25 April 2017 at 23:56, Lionel Landwerlin
>>  wrote:
>>>
>>> Hi,
>>>
>>> While working with changes that span from kernel to user space, I've
>>> been wondering whether we need to depend on libdrm at all for the anv
>>> & i965 drivers. Indeed with Ken's recent changes, we only depend on
>>> libdrm for its kernel header files which we could just embed
>>> ourselves.
>>>
>>> I've only included the minimal set of header files we need from the
>>> kernel for anv & i965. Maybe other drivers would be interested and
>>> maybe we should put all the kernel drm uapi headers into include?
>>>
>> AFAICT the goal behind the libdrm_intel fold was to allow rapid and
>> seamless rework of the interface.
>> With a potential goal to make it a shared one, as it gets stabilised.
>>
>> Currently ANV uses more than just the UAPI headers. But if we ignore
>> that, coping them is a bad idea.

 What else is anv using from libdrm? (maybe I missed something)

>> Lionel, I stand corrected, we have instances in anv, wsi/x11, loader
>> and dri/i965 (the dri/common ones are just comments).
>> In total they seem to be over three dozen instances. Experiment with
>> the following:
>>
>> for i in `nm -CD --defined-only /lib/libdrm.so | cut -c 20-| grep -v
>> "^_" `; do git grep -w --name-only $i -- src ; done
>
>
> Thanks for the code snippet.
>
> For anv :
> drmGetDevices2
> For i965 :
> drmCommandNone
> drmCommandWriteRead
> drmIoctl
> drmPrimeFDToHandle
> drmPrimeHandleToFD
>
> You're right, I'll update the patch to just drop libdrm_intel.
>
Don't forget to remove the link against libdrm.

>>
>> Why - adds a, yet another, copy and making synchronisation more
>> annoying. First example - you blindly copied the files rather than
>> using `make headers_install' first ;-)
>> Not to mention that it makes the chicken and egg problem* even more
>> confusing and error prone.

 It doesn't feel like that to me. Actually instead of modifying 3
 different
 repos, you end up modifying just 2.
 Sounds less error prone.

>> Lionel, are you saying that we can ignore IGT? Or you're suggesting
>> that IGT should depend on Mesa copy of the headers?
>
>
> If you look closely at IGT, you'll notice quite a few tests actually define
> their own version of the structures/ioctl of the various driver interfaces.
> So it's more or less already happening.
>
> git grep DRM_IO ./tests/ | grep define
> git grep local_drm
>
>
IGT has local defines which get purged every so often. Still
"modifying just 2" is off-by one.


>> Seriously, your argument of "let's import because we can" is iffy. Why
>> stop with the DRM UAPI - let's import headers from glibc ;-)
>
>
> I think you have to look at what we're doing here. i965 & anv are graphics
> drivers tightly coupled with the kernel driver.
> libdrm_intel isn't, it's mostly generic enough code that is shared across
> some of our drivers.
> And since we drop that dependency, why bother with it at all?
>
> We don't really have the same relationship to other components (like glibc).
>
>>
>> If pulling new libdrm is that much of a nuisance to your workflow -
>> just copy the blob we have for the Travis instance.
>> It automatically tracks the libdrm version, builds and installs it as
>> needed.
>
>
> It's not about pulling, it's about maintaining.
>
The libdrm headers will still need to be synced and maintained
regardless of this series.
I wish we could make it disappear but sadly we cannot.

Speaking of maintenance can you comment on this patch [1]?
We have a similar instance in Mesa which we might want to address.

[1] https://patchwork.kernel.org/patch/9626861/

>>
>> Emil
>> *  Which patches land first - kernel or userspace
>
> I don't see how it does that at all.  It simplifies the process: Now
> you
> send out your proposed new userspace to one repo, instead of two.
>
> And, after the first commit, it'll be obvious when you screw up using
> make headers_install because there will be surprising diff.

 Right now we have to update libdrm, then update the mesa to depend on
 the
 right libdrm to actually get the header files we want.
 If you depend on libdrm from more than just uapi headers, it might now
 be
 too much of a burden. But it seems we're clearly moving away from that
 in
 anv/i965.
 As a developer it feels a lot easier to have just the update mesa with
 both
 

Re: [Mesa-dev] [PATCH] radeonsi: fix build with GCC 4.8

2017-05-05 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Fri, May 5, 2017 at 2:15 PM, Samuel Pitoiset
 wrote:
> Fixes: 7088b655e8 ("radeonsi: constify a bunch of the perfcounter structs.")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100937
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/drivers/radeonsi/si_perfcounter.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_perfcounter.c 
> b/src/gallium/drivers/radeonsi/si_perfcounter.c
> index ad7b9b7ae4..fd28d1176e 100644
> --- a/src/gallium/drivers/radeonsi/si_perfcounter.c
> +++ b/src/gallium/drivers/radeonsi/si_perfcounter.c
> @@ -302,7 +302,7 @@ static const struct si_pc_block_base cik_TCP = {
> .layout = SI_PC_MULTI_ALTERNATE,
>  };
>
> -static const struct si_pc_block_base cik_VGT = (const struct 
> si_pc_block_base) {
> +static const struct si_pc_block_base cik_VGT = {
> .name = "VGT",
> .num_counters = 4,
> .flags = R600_PC_BLOCK_SE,
> --
> 2.12.2
>
> ___
> 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] radeonsi: apply the tess+GS hang workaround to Polaris12 as well

2017-05-05 Thread Alex Deucher
On Fri, May 5, 2017 at 11:14 AM, Marek Olšák  wrote:
> From: Marek Olšák 
>
> Cc: 17.1 

Reviewed-by: Alex Deucher 

> ---
>  src/gallium/drivers/radeonsi/si_state_draw.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
> b/src/gallium/drivers/radeonsi/si_state_draw.c
> index e6a9ee0..5f1371a 100644
> --- a/src/gallium/drivers/radeonsi/si_state_draw.c
> +++ b/src/gallium/drivers/radeonsi/si_state_draw.c
> @@ -325,21 +325,22 @@ si_get_init_multi_vgt_param(struct si_screen *sscreen,
> /* Needed for 028B6C_DISTRIBUTION_MODE != 0 */
> if (sscreen->has_distributed_tess) {
> if (key->u.uses_gs) {
> if (sscreen->b.chip_class <= VI)
> partial_es_wave = true;
>
> /* GPU hang workaround. */
> if (sscreen->b.family == CHIP_TONGA ||
> sscreen->b.family == CHIP_FIJI ||
> sscreen->b.family == CHIP_POLARIS10 ||
> -   sscreen->b.family == CHIP_POLARIS11)
> +   sscreen->b.family == CHIP_POLARIS11 ||
> +   sscreen->b.family == CHIP_POLARIS12)
> partial_vs_wave = true;
> } else {
> partial_vs_wave = true;
> }
> }
> }
>
> /* This is a hardware requirement. */
> if (key->u.line_stipple_enabled ||
> (sscreen->b.debug_flags & DBG_SWITCH_ON_EOP)) {
> --
> 2.7.4
>
> ___
> 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 v3 2/4] glx: implement __DRIbackgroundCallableExtension.isThreadSafe

2017-05-05 Thread Gregory Hainaut
v2:
bump version

v3:
Add code comment
s/IsGlThread/IsThread/ (and variation)

Signed-off-by: Gregory Hainaut 
---
 src/glx/dri2_glx.c | 15 ++-
 src/glx/dri3_glx.c | 15 ++-
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 145f44d6e8..4f163688f2 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -946,20 +946,32 @@ dri2GetSwapInterval(__GLXDRIdrawable *pdraw)
   return priv->swap_interval;
 }
 
 static void
 driSetBackgroundContext(void *loaderPrivate)
 {
struct dri2_context *pcp = (struct dri2_context *) loaderPrivate;
__glXSetCurrentContext(>base);
 }
 
+static GLboolean
+driIsThreadSafe(void *loaderPrivate)
+{
+   struct dri2_context *pcp = (struct dri2_context *) loaderPrivate;
+   /* Check Xlib is running in thread safe mode
+*
+* 'lock_fns' is the XLockDisplay function pointer of the X11 display 'dpy'.
+* It wll be NULL if XInitThreads wasn't called.
+*/
+   return pcp->base.psc->dpy->lock_fns != NULL;
+}
+
 static const __DRIdri2LoaderExtension dri2LoaderExtension = {
.base = { __DRI_DRI2_LOADER, 3 },
 
.getBuffers  = dri2GetBuffers,
.flushFrontBuffer= dri2FlushFrontBuffer,
.getBuffersWithFormat= dri2GetBuffersWithFormat,
 };
 
 static const __DRIdri2LoaderExtension dri2LoaderExtension_old = {
.base = { __DRI_DRI2_LOADER, 3 },
@@ -967,23 +979,24 @@ static const __DRIdri2LoaderExtension 
dri2LoaderExtension_old = {
.getBuffers  = dri2GetBuffers,
.flushFrontBuffer= dri2FlushFrontBuffer,
.getBuffersWithFormat= NULL,
 };
 
 static const __DRIuseInvalidateExtension dri2UseInvalidate = {
.base = { __DRI_USE_INVALIDATE, 1 }
 };
 
 static const __DRIbackgroundCallableExtension driBackgroundCallable = {
-   .base = { __DRI_BACKGROUND_CALLABLE, 1 },
+   .base = { __DRI_BACKGROUND_CALLABLE, 2 },
 
.setBackgroundContext= driSetBackgroundContext,
+   .isThreadSafe= driIsThreadSafe,
 };
 
 _X_HIDDEN void
 dri2InvalidateBuffers(Display *dpy, XID drawable)
 {
__GLXDRIdrawable *pdraw =
   dri2GetGlxDrawableFromXDrawableId(dpy, drawable);
struct dri2_screen *psc;
struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw;
 
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index e1dc5aa4a8..3b317fdf1b 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -496,37 +496,50 @@ dri3_flush_front_buffer(__DRIdrawable *driDrawable, void 
*loaderPrivate)
loader_dri3_wait_gl(draw);
 }
 
 static void
 dri_set_background_context(void *loaderPrivate)
 {
struct dri3_context *pcp = (struct dri3_context *)loaderPrivate;
__glXSetCurrentContext(>base);
 }
 
+static GLboolean
+dri_is_thread_safe(void *loaderPrivate)
+{
+   struct dri3_context *pcp = (struct dri3_context *) loaderPrivate;
+   /* Check Xlib is running in thread safe mode
+*
+* 'lock_fns' is the XLockDisplay function pointer of the X11 display 'dpy'.
+* It wll be NULL if XInitThreads wasn't called.
+*/
+   return pcp->base.psc->dpy->lock_fns != NULL;
+}
+
 /* The image loader extension record for DRI3
  */
 static const __DRIimageLoaderExtension imageLoaderExtension = {
.base = { __DRI_IMAGE_LOADER, 1 },
 
.getBuffers  = loader_dri3_get_buffers,
.flushFrontBuffer= dri3_flush_front_buffer,
 };
 
 const __DRIuseInvalidateExtension dri3UseInvalidate = {
.base = { __DRI_USE_INVALIDATE, 1 }
 };
 
 static const __DRIbackgroundCallableExtension driBackgroundCallable = {
-   .base = { __DRI_BACKGROUND_CALLABLE, 1 },
+   .base = { __DRI_BACKGROUND_CALLABLE, 2 },
 
.setBackgroundContext = dri_set_background_context,
+   .isThreadSafe = dri_is_thread_safe,
 };
 
 static const __DRIextension *loader_extensions[] = {
,
,
,
NULL
 };
 
 /** dri3_swap_buffers
-- 
2.11.0

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


[Mesa-dev] [PATCH v3 3/4] egl: implement __DRIbackgroundCallableExtension.isThreadSafe

2017-05-05 Thread Gregory Hainaut
v2:
bump version

v3:
Add code comment
s/IsGlThread/IsThread/ (and variation)
Include X11/Xlibint.h protected by ifdef

Signed-off-by: Gregory Hainaut 
---
 src/egl/drivers/dri2/egl_dri2.c | 28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0be7132ac5..3295d472f4 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -48,20 +48,24 @@
 #include 
 #include "GL/mesa_glinterop.h"
 #include 
 #include 
 
 #ifdef HAVE_WAYLAND_PLATFORM
 #include "wayland-drm.h"
 #include "wayland-drm-client-protocol.h"
 #endif
 
+#ifdef HAVE_X11_PLATFORM
+#include "X11/Xlibint.h"
+#endif
+
 #include "egl_dri2.h"
 #include "loader/loader.h"
 #include "util/u_atomic.h"
 
 /* The kernel header drm_fourcc.h defines the DRM formats below.  We duplicate
  * some of the definitions here so that building Mesa won't bleeding-edge
  * kernel headers.
  */
 #ifndef DRM_FORMAT_R8
 #define DRM_FORMAT_R8fourcc_code('R', '8', ' ', ' ') /* [7:0] R */
@@ -85,24 +89,46 @@
 
 static void
 dri_set_background_context(void *loaderPrivate)
 {
_EGLContext *ctx = _eglGetCurrentContext();
_EGLThreadInfo *t = _eglGetCurrentThread();
 
_eglBindContextToThread(ctx, t);
 }
 
+static GLboolean
+dri_is_thread_safe(void *loaderPrivate)
+{
+#ifdef HAVE_X11_PLATFORM
+   struct dri2_egl_surface *dri2_surf = loaderPrivate;
+   _EGLDisplay *display =  dri2_surf->base.Resource.Display;
+   Display *xdpy = (Display*)display->PlatformDisplay;
+
+   /* Check Xlib is running in thread safe mode when running on EGL/X11-xlib
+* platform
+*
+* 'lock_fns' is the XLockDisplay function pointer of the X11 display 'dpy'.
+* It wll be NULL if XInitThreads wasn't called.
+*/
+   if (display->Platform == _EGL_PLATFORM_X11 && xdpy && !xdpy->lock_fns)
+  return false;
+#endif
+
+   return true;
+}
+
 const __DRIbackgroundCallableExtension background_callable_extension = {
-   .base = { __DRI_BACKGROUND_CALLABLE, 1 },
+   .base = { __DRI_BACKGROUND_CALLABLE, 2 },
 
.setBackgroundContext = dri_set_background_context,
+   .isThreadSafe = dri_is_thread_safe,
 };
 
 const __DRIuseInvalidateExtension use_invalidate = {
.base = { __DRI_USE_INVALIDATE, 1 }
 };
 
 static const EGLint dri2_to_egl_attribute_map[__DRI_ATTRIB_MAX] = {
[__DRI_ATTRIB_BUFFER_SIZE ]  = EGL_BUFFER_SIZE,
[__DRI_ATTRIB_LEVEL] = EGL_LEVEL,
[__DRI_ATTRIB_RED_SIZE]  = EGL_RED_SIZE,
-- 
2.11.0

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


[Mesa-dev] [PATCH v3 0/4] Disable glthread if libX11 isn't thread-safe

2017-05-05 Thread Gregory Hainaut
Hello Mesa developers,

Following the discussion from
https://lists.freedesktop.org/archives/mesa-dev/2017-April/153137.html

A check was added to ensure that X11 display can be locked. It should be enough
to ensure thread safety between X11 and glthread.

I also did the check on DRI3 as I'm not 100% sure that it is really thread safe.



v2: based on Nicolai/Matt reviews
Add a check on DRI extension version
Use C comments :)

v3: based on Emil reviews
Split the initial first patch into 3 sub patches dri extension / glx / egl
Improve error message
Improve code readability
Just include libX11 on EGL protected by ifdef

Thanks you for all the review comments.

Best regards,

Gregory Hainaut (4):
  dri: Extend __DRIbackgroundCallableExtensionRec to include a callback
that checks for thread safety
  glx: implement __DRIbackgroundCallableExtension.isThreadSafe
  egl: implement __DRIbackgroundCallableExtension.isThreadSafe
  glthread/gallium: require safe_glthread to start glthread

 include/GL/internal/dri_interface.h  | 11 +++
 src/egl/drivers/dri2/egl_dri2.c  | 28 +++-
 src/gallium/state_trackers/dri/dri_context.c | 21 +
 src/glx/dri2_glx.c   | 15 ++-
 src/glx/dri3_glx.c   | 15 ++-
 5 files changed, 83 insertions(+), 7 deletions(-)

-- 
2.11.0

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


[Mesa-dev] [PATCH v3 4/4] glthread/gallium: require safe_glthread to start glthread

2017-05-05 Thread Gregory Hainaut
Print an error message for the user if the requirement isn't met, or
we're not thread safe.

v2: based on Nicolai feedbacks
Check the DRI extension version
v3: based on Emil feedbacks
improve commit and error messages.
use backgroundCallable variable to improve readability

Signed-off-by: Gregory Hainaut 
---
 src/gallium/state_trackers/dri/dri_context.c | 21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_context.c 
b/src/gallium/state_trackers/dri/dri_context.c
index 92d79849c4..8cbab5359f 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -51,20 +51,22 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
 {
__DRIscreen *sPriv = cPriv->driScreenPriv;
struct dri_screen *screen = dri_screen(sPriv);
struct st_api *stapi = screen->st_api;
struct dri_context *ctx = NULL;
struct st_context_iface *st_share = NULL;
struct st_context_attribs attribs;
enum st_context_error ctx_err = 0;
unsigned allowed_flags = __DRI_CTX_FLAG_DEBUG |
 __DRI_CTX_FLAG_FORWARD_COMPATIBLE;
+   const __DRIbackgroundCallableExtension *backgroundCallable =
+  screen->sPriv->dri2.backgroundCallable;
 
if (screen->has_reset_status_query)
   allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS;
 
if (flags & ~allowed_flags) {
   *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
   goto fail;
}
 
if (!screen->has_reset_status_query && notify_reset) {
@@ -151,24 +153,35 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
ctx->st->st_manager_private = (void *) ctx;
ctx->stapi = stapi;
 
if (ctx->st->cso_context) {
   ctx->pp = pp_init(ctx->st->pipe, screen->pp_enabled, 
ctx->st->cso_context);
   ctx->hud = hud_create(ctx->st->pipe, ctx->st->cso_context);
}
 
/* Do this last. */
if (ctx->st->start_thread &&
-   /* the driver loader must implement this */
-   screen->sPriv->dri2.backgroundCallable &&
-   driQueryOptionb(>optionCache, "mesa_glthread"))
-  ctx->st->start_thread(ctx->st);
+ driQueryOptionb(>optionCache, "mesa_glthread")) {
+
+  if (backgroundCallable && backgroundCallable->base.version >= 2 &&
+driQueryOptionb(>optionCache, "mesa_glthread")) {
+
+ if (backgroundCallable->isThreadSafe(cPriv->loaderPrivate))
+ctx->st->start_thread(ctx->st);
+ else
+fprintf(stderr, "dri_create_context: glthread isn't thread safe "
+  "- missing call XInitThreads\n");
+  } else {
+ fprintf(stderr, "dri_create_context: requested glthread but driver "
+   "is missing backgroundCallable V2 extension\n");
+  }
+   }
 
*error = __DRI_CTX_ERROR_SUCCESS;
return GL_TRUE;
 
  fail:
if (ctx && ctx->st)
   ctx->st->destroy(ctx->st);
 
free(ctx);
return GL_FALSE;
-- 
2.11.0

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


[Mesa-dev] [PATCH v3 1/4] dri: Extend __DRIbackgroundCallableExtensionRec to include a callback that checks for thread safety

2017-05-05 Thread Gregory Hainaut
DRI-drivers could call Xlib functions, for example to allocate a new back
buffer.

When glthread is enabled, the driver runs mostly on a separate thread.
Therefore we need to guarantee the thread safety between libX11 calls
from the applications (not aware of the extra thread) and the ones from
the driver.

See discussion thread:
   https://lists.freedesktop.org/archives/mesa-dev/2017-April/152547.html

Fortunately, Xlib allows to lock display to ensure thread safety but
XInitThreads must be called first by the application to initialize the lock
function pointer. This patch will allow to check XInitThreads was called
to allow glthread on GLX or EGL platform.

Note: a tentative was done to port libX11 code to XCB but it didn't solve fully
thread safety.
See discussion thread:
   https://lists.freedesktop.org/archives/mesa-dev/2017-April/153137.html

Note: Nvidia forces the driver to call XInitThreads. Quoting their manpage:
"The NVIDIA OpenGL driver will automatically attempt to enable Xlib
thread-safe mode if needed. However, it might not be possible in some
situations, such as when the NVIDIA OpenGL driver library is dynamically
loaded after Xlib has been loaded and initialized. If that is the case,
threaded optimizations will stay disabled unless the application is
modified to call XInitThreads() before initializing Xlib or to link
directly against the NVIDIA OpenGL driver library. Alternatively, using
the LD_PRELOAD environment variable to include the NVIDIA OpenGL driver
library should also achieve the desired result."

v2: based on Nicolai and Matt feedback
Use C style comment
v3: based on Emil feedback
split the patch in 3
s/isGlThreadSafe/isThreadSafe/

Signed-off-by: Gregory Hainaut 
---
 include/GL/internal/dri_interface.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index c83056aa70..8381f704e4 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1714,13 +1714,24 @@ struct __DRIbackgroundCallableExtensionRec {
 * non-background thread (i.e. a thread that has already been bound to a
 * context using __DRIcoreExtensionRec::bindContext()); when this happens,
 * the \c loaderPrivate pointer must be equal to the pointer that was
 * passed to the driver when the currently bound context was created.
 *
 * This call should execute quickly enough that the driver can call it with
 * impunity whenever a background thread starts performing drawing
 * operations (e.g. it should just set a thread-local variable).
 */
void (*setBackgroundContext)(void *loaderPrivate);
+
+   /**
+* Indicate that it is multithread safe to use glthread.  For GLX/EGL
+* platforms using Xlib, that involves calling XInitThreads, before
+* opening an X display.
+*
+* \param loaderPrivate is the value that was passed to to the driver when
+* the context was created.  This can be used by the loader to identify
+* which context any callbacks are associated with.
+*/
+   GLboolean (*isThreadSafe)(void *loaderPrivate);
 };
 
 #endif
-- 
2.11.0

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


Re: [Mesa-dev] [PATCH 0/2] anv/i965: drop libdrm dependency completely

2017-05-05 Thread Emil Velikov
On 4 May 2017 at 21:56, Jason Ekstrand  wrote:
> On Thu, May 4, 2017 at 12:21 PM, Kristian Høgsberg 
> wrote:
>>
>> On Thu, May 4, 2017 at 11:43 AM, Lionel Landwerlin
>>  wrote:
>> > On 04/05/17 07:52, Emil Velikov wrote:
>> >>
>> >> On 4 May 2017 at 14:46, Daniel Vetter  wrote:
>> >>>
>> >>> On Thu, Apr 27, 2017 at 10:58:42AM -0700, Lionel Landwerlin wrote:
>> 
>>  On 27/04/17 08:20, Eric Anholt wrote:
>> >
>> > Emil Velikov  writes:
>> >
>> >> On 25 April 2017 at 23:56, Lionel Landwerlin
>> >>  wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> While working with changes that span from kernel to user space,
>> >>> I've
>> >>> been wondering whether we need to depend on libdrm at all for the
>> >>> anv
>> >>> & i965 drivers. Indeed with Ken's recent changes, we only depend
>> >>> on
>> >>> libdrm for its kernel header files which we could just embed
>> >>> ourselves.
>> >>>
>> >>> I've only included the minimal set of header files we need from
>> >>> the
>> >>> kernel for anv & i965. Maybe other drivers would be interested and
>> >>> maybe we should put all the kernel drm uapi headers into include?
>> >>>
>> >> AFAICT the goal behind the libdrm_intel fold was to allow rapid and
>> >> seamless rework of the interface.
>> >> With a potential goal to make it a shared one, as it gets
>> >> stabilised.
>> >>
>> >> Currently ANV uses more than just the UAPI headers. But if we
>> >> ignore
>> >> that, coping them is a bad idea.
>> 
>>  What else is anv using from libdrm? (maybe I missed something)
>> 
>> >> Lionel, I stand corrected, we have instances in anv, wsi/x11, loader
>> >> and dri/i965 (the dri/common ones are just comments).
>> >> In total they seem to be over three dozen instances. Experiment with
>> >> the following:
>> >>
>> >> for i in `nm -CD --defined-only /lib/libdrm.so | cut -c 20-| grep -v
>> >> "^_" `; do git grep -w --name-only $i -- src ; done
>> >
>> >
>> > Thanks for the code snippet.
>> >
>> > For anv :
>> > drmGetDevices2
>>
>> anv was designed to not rely on libdrm or libdrm_intel. I see the
>> commit that added the libdrm dependency is from you and was not
>> Reviewed or acked by Jason or any other core anv developer. I suggest
>> we revert that, I don't see anything in the drmGetDevices2 code that
>> is better suited for anv than what was there before.
>
>
> I did comment on e-mail that I was begrudgingly ok with it.  In retrospect,
> it looks pretty pointless.  As far as I can tell, drmGetDevices2 gains us
> exactly two things over the old method of just trial and error:
>
>  1. It stats the file to make sure that it's an actual DRM device before
> opening the file.  Does this actually matter?  If so, it's easy enough to
> add the dozen or so lines of code to do it in ANV.
>  2. It walks over all files in /dev/dri rather than just /dev/dri/renderD#.
> That's also very easy to add.
>
> I agree with Kristian that the right thing to do is to revert that patch and
> just write the dozen lines of code needed to do it "properly" if it even
> matters.
>
Reverting the patch will lead to
 - 3s starup delays since the open() will wake up the $other GPU
Rare, but we've had reports already.
 - slower porting/adoption of Vulkan on !Linux Unixes

In either case, not my call.
-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] nir: add pass to lower atomic counters to SSBO

2017-05-05 Thread Jose Fonseca

On 05/05/17 12:07, Rob Clark wrote:

On Fri, May 5, 2017 at 4:22 AM, Andres Gomez  wrote:

Rob, I believe this is causing a linking failure in the Windows scons
build:
https://ci.appveyor.com/project/AndresGomez/mesa/build/321

   Creating library build\windows-x86-debug\gallium\targets\osmesa\osmesa.lib 
and object build\windows-x86-debug\gallium\targets\osmesa\osmesa.exp
nir.lib(nir_lower_atomics_to_ssbo.obj) : error LNK2019: unresolved external 
symbol _snprintf referenced in function _nir_lower_atomics_to_ssbo



hmm, bleh.. is snprintf() not a thing on windows?


I no longer recall the details, but MSVC provides `_foo` instead of 
`foo` for lot's of "unsafe" string manipulation functions.  It provides 
"foo_s" safe alternatives.


Maybe for our puposes plain old snprintf is good enough.  But when one 
is doing manipulation of unsafe string data it requires a lot of typing 
to get old C string functions to do safe things (like ensureing strings 
are zero terminated always ,etc).  So one is really better not using 
snprintf for those things.


> Looks like nir_print.c does:


#if defined(_WIN32) && !defined(snprintf)
#define snprintf _snprintf
#endif

I guess we could just move that into nir.h?

BR,


Sounds good to me.  At some point, it might be better to put this 
definition in a mesa/include/*.h header, but centralizing in nir sounds 
simple enough for now.


Jose


-R


Br.

On Mon, 2017-04-24 at 11:28 -0400, Rob Clark wrote:

This is equivalent to what mesa/st does in glsl_to_tgsi.  For most hw
there isn't a particularly good reason to treat these differently.

Signed-off-by: Rob Clark 
---
v2: do the interface_type thing properly

 src/compiler/Makefile.sources|   1 +
 src/compiler/nir/nir.h   |   1 +
 src/compiler/nir/nir_lower_atomics_to_ssbo.c | 222 +++
 3 files changed, 224 insertions(+)
 create mode 100644 src/compiler/nir/nir_lower_atomics_to_ssbo.c

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index 2455d4e..b2a3a42 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -208,6 +208,7 @@ NIR_FILES = \
  nir/nir_lower_64bit_packing.c \
  nir/nir_lower_alu_to_scalar.c \
  nir/nir_lower_atomics.c \
+ nir/nir_lower_atomics_to_ssbo.c \
  nir/nir_lower_bitmap.c \
  nir/nir_lower_clamp_color_outputs.c \
  nir/nir_lower_clip.c \
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index ce5b434..be35930 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2546,6 +2546,7 @@ void nir_lower_bitmap(nir_shader *shader, const 
nir_lower_bitmap_options *option

 bool nir_lower_atomics(nir_shader *shader,
const struct gl_shader_program *shader_program);
+bool nir_lower_atomics_to_ssbo(nir_shader *shader, unsigned ssbo_offset);
 bool nir_lower_to_source_mods(nir_shader *shader);

 bool nir_lower_gs_intrinsics(nir_shader *shader);
diff --git a/src/compiler/nir/nir_lower_atomics_to_ssbo.c 
b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
new file mode 100644
index 000..2c04485
--- /dev/null
+++ b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
@@ -0,0 +1,222 @@
+/*
+ * Copyright © 2017 Red Hat
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *Rob Clark 
+ */
+
+#include "nir.h"
+#include "nir_builder.h"
+
+/*
+ * Remap atomic counters to SSBOs.  Atomic counters get remapped to
+ * SSBO binding points [0..ssbo_offset) and the original SSBOs are
+ * remapped to [ssbo_offset..n) (mostly to align with what mesa/st
+ * does.
+ */
+
+static bool
+lower_instr(nir_intrinsic_instr *instr, unsigned ssbo_offset, nir_builder *b)
+{
+   nir_intrinsic_op op;
+   switch (instr->intrinsic) {
+   case nir_intrinsic_ssbo_atomic_add:
+   case nir_intrinsic_ssbo_atomic_imin:
+   case 

Re: [Mesa-dev] [PATCH 0/2] anv/i965: drop libdrm dependency completely

2017-05-05 Thread Emil Velikov
On 4 May 2017 at 17:27, Kristian Høgsberg  wrote:
> On Thu, May 4, 2017 at 7:26 AM, Emil Velikov  wrote:
>> On 27 April 2017 at 16:20, Eric Anholt  wrote:
>>> Emil Velikov  writes:
>>>
 On 25 April 2017 at 23:56, Lionel Landwerlin
  wrote:
> Hi,
>
> While working with changes that span from kernel to user space, I've
> been wondering whether we need to depend on libdrm at all for the anv
> & i965 drivers. Indeed with Ken's recent changes, we only depend on
> libdrm for its kernel header files which we could just embed
> ourselves.
>
> I've only included the minimal set of header files we need from the
> kernel for anv & i965. Maybe other drivers would be interested and
> maybe we should put all the kernel drm uapi headers into include?
>
 AFAICT the goal behind the libdrm_intel fold was to allow rapid and
 seamless rework of the interface.
 With a potential goal to make it a shared one, as it gets stabilised.

 Currently ANV uses more than just the UAPI headers. But if we ignore
 that, coping them is a bad idea.

 Why - adds a, yet another, copy and making synchronisation more
 annoying. First example - you blindly copied the files rather than
 using `make headers_install' first ;-)
 Not to mention that it makes the chicken and egg problem* even more
 confusing and error prone.

 Emil
 *  Which patches land first - kernel or userspace
>>>
>>> I don't see how it does that at all.  It simplifies the process: Now you
>>> send out your proposed new userspace to one repo, instead of two.
>>>
>> Funny that you should say that. On my count there's 4 instances of the
>> VC4 headers - one in kernel and 3 in different userspace components.
>> With each one subtly different from the rest.
>
> You're making this seem a lot worse than it is. It's not like these
> header files are actively developed in 4 different projects. There's
> exactly one canonical source for these headers with a well established
> development process: the kernel. The fact that the headers are
> different just means that the various userspace components have copied
> the kernel headers at different times as they implemented new features
> on different schedules. I'm sure you understand this.
>
Yes, I tend to be more of a risk adverse/paranoid than others.
As many of my pessimistic examples became true, it's a bit hard to
become more of a glass full person ;-)

> I think it's pretty simple: requiring i965 or anv to link to libdrm
> just for the ioctl wrapper and the header file which comes from the
> kernel makes little sense.
>
There's more to it than the ioctl wrappers...  seems like you're
spotted in another reply.

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


Re: [Mesa-dev] [PATCH] gallivm: Make sure module has the correct data layout when pass manager runs

2017-05-05 Thread Jose Fonseca

Same here.

Reviewed-by: Jose Fonseca 

On 05/05/17 16:16, Roland Scheidegger wrote:

Makes sense to me.
Reviewed-by: Roland Scheidegger 

Am 05.05.2017 um 03:25 schrieb Tom Stellard:

The datalayout for modules was purposely not being set in order to work around
the fact that the ExecutionEngine requires that the module's datalayout
matches the datalayout of the TargetMachine that the ExecutionEngine is
using.

When the pass manager runs on a module with no datalayout, it uses
the default datalayout which is little-endian.  This causes problems
on big-endian targets, because some optimizations that are legal on
little-endian or illegal on big-endian.

To resolve this, we set the datalayout prior to running the pass
manager, and then clear it before creating the ExectionEngine.

This patch fixes a lot of piglit tests on big-endian ppc64.

Cc: mesa-sta...@lists.freedesktop.org
---
 src/gallium/auxiliary/gallivm/lp_bld_init.c | 34 +++--
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c 
b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index ef2580e..9f1ade6 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -125,19 +125,6 @@ create_pass_manager(struct gallivm_state *gallivm)
LLVMAddTargetData(gallivm->target, gallivm->passmgr);
 #endif

-   /* Setting the module's DataLayout to an empty string will cause the
-* ExecutionEngine to copy to the DataLayout string from its target
-* machine to the module.  As of LLVM 3.8 the module and the execution
-* engine are required to have the same DataLayout.
-*
-* TODO: This is just a temporary work-around.  The correct solution is
-* for gallivm_init_state() to create a TargetMachine and pull the
-* DataLayout from there.  Currently, the TargetMachine used by llvmpipe
-* is being implicitly created by the EngineBuilder in
-* lp_build_create_jit_compiler_for_module()
-*/
-
-#if HAVE_LLVM < 0x0308
{
   char *td_str;
   // New ones from the Module.
@@ -145,9 +132,6 @@ create_pass_manager(struct gallivm_state *gallivm)
   LLVMSetDataLayout(gallivm->module, td_str);
   free(td_str);
}
-#else
-   LLVMSetDataLayout(gallivm->module, "");
-#endif

if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) {
   /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
@@ -628,6 +612,24 @@ gallivm_compile_module(struct gallivm_state *gallivm)
}

if (use_mcjit) {
+  /* Setting the module's DataLayout to an empty string will cause the
+   * ExecutionEngine to copy to the DataLayout string from its target
+   * machine to the module.  As of LLVM 3.8 the module and the execution
+   * engine are required to have the same DataLayout.
+   *
+   * We must make sure we do this after running the optimization passes,
+   * because those passes need a correct datalayout string.  For example,
+   * if those optimization passes see an empty datalayout, they will assume
+   * this is a little endian target and will do optimizations that break 
big
+   * endian machines.
+   *
+   * TODO: This is just a temporary work-around.  The correct solution is
+   * for gallivm_init_state() to create a TargetMachine and pull the
+   * DataLayout from there.  Currently, the TargetMachine used by llvmpipe
+   * is being implicitly created by the EngineBuilder in
+   * lp_build_create_jit_compiler_for_module()
+   */
+  LLVMSetDataLayout(gallivm->module, "");
   assert(!gallivm->engine);
   if (!init_gallivm_engine(gallivm)) {
  assert(0);





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


Re: [Mesa-dev] [PATCH] gallivm: Make sure module has the correct data layout when pass manager runs

2017-05-05 Thread Roland Scheidegger
Makes sense to me.
Reviewed-by: Roland Scheidegger 

Am 05.05.2017 um 03:25 schrieb Tom Stellard:
> The datalayout for modules was purposely not being set in order to work around
> the fact that the ExecutionEngine requires that the module's datalayout
> matches the datalayout of the TargetMachine that the ExecutionEngine is
> using.
> 
> When the pass manager runs on a module with no datalayout, it uses
> the default datalayout which is little-endian.  This causes problems
> on big-endian targets, because some optimizations that are legal on
> little-endian or illegal on big-endian.
> 
> To resolve this, we set the datalayout prior to running the pass
> manager, and then clear it before creating the ExectionEngine.
> 
> This patch fixes a lot of piglit tests on big-endian ppc64.
> 
> Cc: mesa-sta...@lists.freedesktop.org
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_init.c | 34 
> +++--
>  1 file changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c 
> b/src/gallium/auxiliary/gallivm/lp_bld_init.c
> index ef2580e..9f1ade6 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
> @@ -125,19 +125,6 @@ create_pass_manager(struct gallivm_state *gallivm)
> LLVMAddTargetData(gallivm->target, gallivm->passmgr);
>  #endif
>  
> -   /* Setting the module's DataLayout to an empty string will cause the
> -* ExecutionEngine to copy to the DataLayout string from its target
> -* machine to the module.  As of LLVM 3.8 the module and the execution
> -* engine are required to have the same DataLayout.
> -*
> -* TODO: This is just a temporary work-around.  The correct solution is
> -* for gallivm_init_state() to create a TargetMachine and pull the
> -* DataLayout from there.  Currently, the TargetMachine used by llvmpipe
> -* is being implicitly created by the EngineBuilder in
> -* lp_build_create_jit_compiler_for_module()
> -*/
> -
> -#if HAVE_LLVM < 0x0308
> {
>char *td_str;
>// New ones from the Module.
> @@ -145,9 +132,6 @@ create_pass_manager(struct gallivm_state *gallivm)
>LLVMSetDataLayout(gallivm->module, td_str);
>free(td_str);
> }
> -#else
> -   LLVMSetDataLayout(gallivm->module, "");
> -#endif
>  
> if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) {
>/* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
> @@ -628,6 +612,24 @@ gallivm_compile_module(struct gallivm_state *gallivm)
> }
>  
> if (use_mcjit) {
> +  /* Setting the module's DataLayout to an empty string will cause the
> +   * ExecutionEngine to copy to the DataLayout string from its target
> +   * machine to the module.  As of LLVM 3.8 the module and the execution
> +   * engine are required to have the same DataLayout.
> +   *
> +   * We must make sure we do this after running the optimization passes,
> +   * because those passes need a correct datalayout string.  For example,
> +   * if those optimization passes see an empty datalayout, they will 
> assume
> +   * this is a little endian target and will do optimizations that break 
> big
> +   * endian machines.
> +   *
> +   * TODO: This is just a temporary work-around.  The correct solution is
> +   * for gallivm_init_state() to create a TargetMachine and pull the
> +   * DataLayout from there.  Currently, the TargetMachine used by 
> llvmpipe
> +   * is being implicitly created by the EngineBuilder in
> +   * lp_build_create_jit_compiler_for_module()
> +   */
> +  LLVMSetDataLayout(gallivm->module, "");
>assert(!gallivm->engine);
>if (!init_gallivm_engine(gallivm)) {
>   assert(0);
> 

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


[Mesa-dev] [PATCH] radeonsi: apply the tess+GS hang workaround to Polaris12 as well

2017-05-05 Thread Marek Olšák
From: Marek Olšák 

Cc: 17.1 
---
 src/gallium/drivers/radeonsi/si_state_draw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index e6a9ee0..5f1371a 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -325,21 +325,22 @@ si_get_init_multi_vgt_param(struct si_screen *sscreen,
/* Needed for 028B6C_DISTRIBUTION_MODE != 0 */
if (sscreen->has_distributed_tess) {
if (key->u.uses_gs) {
if (sscreen->b.chip_class <= VI)
partial_es_wave = true;
 
/* GPU hang workaround. */
if (sscreen->b.family == CHIP_TONGA ||
sscreen->b.family == CHIP_FIJI ||
sscreen->b.family == CHIP_POLARIS10 ||
-   sscreen->b.family == CHIP_POLARIS11)
+   sscreen->b.family == CHIP_POLARIS11 ||
+   sscreen->b.family == CHIP_POLARIS12)
partial_vs_wave = true;
} else {
partial_vs_wave = true;
}
}
}
 
/* This is a hardware requirement. */
if (key->u.line_stipple_enabled ||
(sscreen->b.debug_flags & DBG_SWITCH_ON_EOP)) {
-- 
2.7.4

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


[Mesa-dev] [PATCH v2 1/2] bin: use tabs for coding style on *.sh files

2017-05-05 Thread Andres Gomez
v2: Instead of changing *.sh, adapt the editorconfig file (Emil).

Signed-off-by: Andres Gomez 
---
 bin/.editorconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bin/.editorconfig b/bin/.editorconfig
index b9a948f405..ef92655823 100644
--- a/bin/.editorconfig
+++ b/bin/.editorconfig
@@ -1,3 +1,2 @@
 [*.sh]
-indent_style = space
-indent_size = 2
+indent_style = tab
-- 
2.11.0

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


Re: [Mesa-dev] [PATCH RFC 3/4] st/dri: Allow gallium drivers to turn off two GLX extensions

2017-05-05 Thread Thomas Hellstrom
On 05/05/2017 04:02 PM, Thomas Hellstrom wrote:
> Allow gallium drivers to turn off GLX_EXT_buffer_age and
> GLX_OML_sync_control if needed, using driconf.
>
> Signed-off-by: Thomas Hellstrom 
> ---
>  include/GL/internal/dri_interface.h | 4 +++-
>  src/gallium/state_trackers/dri/dri_screen.c | 2 ++
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/include/GL/internal/dri_interface.h 
> b/include/GL/internal/dri_interface.h
> index 86efd1b..0711c71 100644
> --- a/include/GL/internal/dri_interface.h
> +++ b/include/GL/internal/dri_interface.h
> @@ -1554,11 +1554,13 @@ struct __DRIrobustnessExtensionRec {
>   * the loader in supporting the driconf application.
>   */
>  #define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions"
> -#define __DRI_CONFIG_OPTIONS_VERSION 1
> +#define __DRI_CONFIG_OPTIONS_VERSION 2
>  
>  typedef struct __DRIconfigOptionsExtensionRec {
> __DRIextension base;
> const char *xml;
> +   int (*appendOptions) (struct __DRIconfigOptionsExtensionRec 
> *configOptions,
> + const char *append_xml);
>  } __DRIconfigOptionsExtension;
>  

Hmm.
The above is a leftover. Not intended for this patch.

/Thomas



>  /**
> diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
> b/src/gallium/state_trackers/dri/dri_screen.c
> index 998e8ef..07a29a7 100644
> --- a/src/gallium/state_trackers/dri/dri_screen.c
> +++ b/src/gallium/state_trackers/dri/dri_screen.c
> @@ -56,6 +56,8 @@ const __DRIconfigOptionsExtension gallium_config_options = {
> DRI_CONF_BEGIN
>DRI_CONF_SECTION_PERFORMANCE
>   DRI_CONF_MESA_GLTHREAD("false")
> + DRI_CONF_DISABLE_EXT_BUFFER_AGE("false")
> + DRI_CONF_DISABLE_OML_SYNC_CONTROL("false")
>DRI_CONF_SECTION_END
>  
>DRI_CONF_SECTION_QUALITY


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


Re: [Mesa-dev] [PATCH] st/glsl_to_tgsi: make sure resource file for samplers is PROGRAM_SAMPLER

2017-05-05 Thread Samuel Pitoiset



On 05/05/2017 04:35 PM, Ilia Mirkin wrote:



On May 5, 2017 9:36 AM, "Samuel Pitoiset" > wrote:


Similar to how image resources are handled. That way we are sure
that inst->resource.file is PROGRAM_SAMPLER for "bound" samplers.

Signed-off-by: Samuel Pitoiset >
---
  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 18 +-
  1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 81c1d00dfb..25050834e3 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4149,7 +4149,6 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
 unsigned opcode = TGSI_OPCODE_NOP;
 const glsl_type *sampler_type = ir->sampler->type;
 unsigned sampler_array_size = 1, sampler_base = 0;
-   uint16_t sampler_index = 0;
 bool is_cube_array = false, is_cube_shadow = false;
 unsigned i;

@@ -4380,10 +4379,16 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
coord_dst.writemask = WRITEMASK_XYZW;
 }

+   st_src_reg sampler(PROGRAM_SAMPLER, 0, GLSL_TYPE_UINT);
+
 get_deref_offsets(ir->sampler, _array_size, _base,
- _index, , true);
-   if (reladdr.file != PROGRAM_UNDEFINED)
+ (uint16_t *), , true);


Why is this cast ok to do?


st_src_reg::index is int16_t while get_deref_offsets() expects uint16_t.



+
+   if (reladdr.file != PROGRAM_UNDEFINED) {
+  sampler.reladdr = ralloc(mem_ctx, st_src_reg);
+  *sampler.reladdr = reladdr;
emit_arl(ir, sampler_reladdr, reladdr);
+   }

 if (opcode == TGSI_OPCODE_TXD)
inst = emit_asm(ir, opcode, result_dst, coord, dx, dy);
@@ -4414,15 +4419,10 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
 if (ir->shadow_comparator)
inst->tex_shadow = GL_TRUE;

-   inst->resource.index = sampler_index;
+   inst->resource = sampler;
 inst->sampler_array_size = sampler_array_size;
 inst->sampler_base = sampler_base;

-   if (reladdr.file != PROGRAM_UNDEFINED) {
-  inst->resource.reladdr = ralloc(mem_ctx, st_src_reg);
-  memcpy(inst->resource.reladdr, , sizeof(reladdr));
-   }
-
 if (ir->offset) {
if (!inst->tex_offsets)
   inst->tex_offsets = rzalloc_array(inst, st_src_reg,
MAX_GLSL_TEXTURE_OFFSET);
--
2.12.2

___
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] st/glsl_to_tgsi: make sure resource file for samplers is PROGRAM_SAMPLER

2017-05-05 Thread Ilia Mirkin
On May 5, 2017 9:36 AM, "Samuel Pitoiset"  wrote:

Similar to how image resources are handled. That way we are sure
that inst->resource.file is PROGRAM_SAMPLER for "bound" samplers.

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 81c1d00dfb..25050834e3 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4149,7 +4149,6 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
unsigned opcode = TGSI_OPCODE_NOP;
const glsl_type *sampler_type = ir->sampler->type;
unsigned sampler_array_size = 1, sampler_base = 0;
-   uint16_t sampler_index = 0;
bool is_cube_array = false, is_cube_shadow = false;
unsigned i;

@@ -4380,10 +4379,16 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
   coord_dst.writemask = WRITEMASK_XYZW;
}

+   st_src_reg sampler(PROGRAM_SAMPLER, 0, GLSL_TYPE_UINT);
+
get_deref_offsets(ir->sampler, _array_size, _base,
- _index, , true);
-   if (reladdr.file != PROGRAM_UNDEFINED)
+ (uint16_t *), , true);


Why is this cast ok to do?

+
+   if (reladdr.file != PROGRAM_UNDEFINED) {
+  sampler.reladdr = ralloc(mem_ctx, st_src_reg);
+  *sampler.reladdr = reladdr;
   emit_arl(ir, sampler_reladdr, reladdr);
+   }

if (opcode == TGSI_OPCODE_TXD)
   inst = emit_asm(ir, opcode, result_dst, coord, dx, dy);
@@ -4414,15 +4419,10 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
if (ir->shadow_comparator)
   inst->tex_shadow = GL_TRUE;

-   inst->resource.index = sampler_index;
+   inst->resource = sampler;
inst->sampler_array_size = sampler_array_size;
inst->sampler_base = sampler_base;

-   if (reladdr.file != PROGRAM_UNDEFINED) {
-  inst->resource.reladdr = ralloc(mem_ctx, st_src_reg);
-  memcpy(inst->resource.reladdr, , sizeof(reladdr));
-   }
-
if (ir->offset) {
   if (!inst->tex_offsets)
  inst->tex_offsets = rzalloc_array(inst, st_src_reg,
MAX_GLSL_TEXTURE_OFFSET);
--
2.12.2

___
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 6/7] egl: drop unneeded sentinel from level_strings[]

2017-05-05 Thread Eric Engestrom


On 4 May 2017 22:26:28 BST, Bartosz Tomczyk  wrote:
>It should be:
>
>i < ARRAY_SIZE(level_strings)
>

Indeed :)

With this, the series is
Reviewed-by: Eric Engestrom 

Cheers,
  Eric

>
>On 04.05.2017 20:47, Emil Velikov wrote:
>> From: Emil Velikov 
>>
>> The array is local so we already know its size.
>>
>> Signed-off-by: Emil Velikov 
>> ---
>>   src/egl/main/egllog.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
>> index 6f0c0cda6c3..c1e61f9b6c9 100644
>> --- a/src/egl/main/egllog.c
>> +++ b/src/egl/main/egllog.c
>> @@ -41,6 +41,7 @@
>>   #include 
>>   #include 
>>   #include "c11/threads.h"
>> +#include "util/macros.h"
>>   
>>   #include "egllog.h"
>>   
>> @@ -82,7 +83,6 @@ static const char *level_strings[] = {
>>  "warning",
>>  "info",
>>  "debug",
>> -   NULL
>>   };
>>   
>>   
>> @@ -129,7 +129,7 @@ _eglInitLogger(void)
>>   
>>  log_env = getenv("EGL_LOG_LEVEL");
>>  if (log_env) {
>> -  for (i = 0; level_strings[i]; i++) {
>> +  for (i = 0; ARRAY_SIZE(level_strings); i++) {
>>if (strcasecmp(log_env, level_strings[i]) == 0) {
>>   level = i;
>>   break;
>
>___
>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 RFC 2/4] dri: Optionally turn off a couple of GLX extensions based on driconf options

2017-05-05 Thread Thomas Hellstrom
With GLX_EXT_buffer_age turned on, gnome-shell will use full-screen damage
with GLX, which severely hurts performance with architectures that emulate
page-flips with copies. Like vmware. We would like to be able to turn off that
extension. Similarly, typically the GLX_OML_sync_control doesn't make much
sense on a virtual architecture since we don't really sync to the host's
vertical retrace. We'd like to be able to turn it off as well.

Signed-off-by: Thomas Hellstrom 
---
 src/glx/dri2_glx.c  |  7 ++-
 src/glx/dri3_glx.c  | 11 +--
 src/mesa/drivers/dri/common/xmlpool/t_options.h | 10 ++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 145f44d..f17de01 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -1298,12 +1298,17 @@ dri2CreateScreen(int screen, struct glx_display * priv)
psp->getBufferAge = NULL;
 
if (pdp->driMinor >= 2) {
+  unsigned char disable;
+
   psp->getDrawableMSC = dri2DrawableGetMSC;
   psp->waitForMSC = dri2WaitForMSC;
   psp->waitForSBC = dri2WaitForSBC;
   psp->setSwapInterval = dri2SetSwapInterval;
   psp->getSwapInterval = dri2GetSwapInterval;
-  __glXEnableDirectExtension(>base, "GLX_OML_sync_control");
+  if (psc->config->configQueryb(psc->driScreen,
+"glx_disable_oml_sync_control",
+) || !disable)
+ __glXEnableDirectExtension(>base, "GLX_OML_sync_control");
}
 
/* DRI2 supports SubBuffer through DRI2CopyRegion, so it's always
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index e1dc5aa..4264fd8 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -780,6 +780,7 @@ dri3_create_screen(int screen, struct glx_display * priv)
struct glx_config *configs = NULL, *visuals = NULL;
char *driverName, *deviceName, *tmp;
int i;
+   unsigned char disable;
 
psc = calloc(1, sizeof *psc);
if (psc == NULL)
@@ -918,13 +919,19 @@ dri3_create_screen(int screen, struct glx_display * priv)
psp->waitForSBC = dri3_wait_for_sbc;
psp->setSwapInterval = dri3_set_swap_interval;
psp->getSwapInterval = dri3_get_swap_interval;
-   __glXEnableDirectExtension(>base, "GLX_OML_sync_control");
+   if (psc->config->configQueryb(psc->driScreen,
+ "glx_disable_oml_sync_control",
+ ) || !disable)
+  __glXEnableDirectExtension(>base, "GLX_OML_sync_control");
 
psp->copySubBuffer = dri3_copy_sub_buffer;
__glXEnableDirectExtension(>base, "GLX_MESA_copy_sub_buffer");
 
psp->getBufferAge = dri3_get_buffer_age;
-   __glXEnableDirectExtension(>base, "GLX_EXT_buffer_age");
+   if (psc->config->configQueryb(psc->driScreen,
+ "glx_disable_ext_buffer_age",
+ ) || !disable)
+  __glXEnableDirectExtension(>base, "GLX_EXT_buffer_age");
 
free(driverName);
free(deviceName);
diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h 
b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index cd4f025..3a8618b 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -323,6 +323,16 @@ DRI_CONF_OPT_BEGIN_B(mesa_glthread, def) \
 DRI_CONF_DESC(en,gettext("Enable offloading GL driver work to a 
separate thread")) \
 DRI_CONF_OPT_END
 
+#define DRI_CONF_DISABLE_EXT_BUFFER_AGE(def) \
+DRI_CONF_OPT_BEGIN_B(glx_disable_ext_buffer_age, def) \
+   DRI_CONF_DESC(en, gettext("Disable the GLX_EXT_buffer_age extension")) \
+DRI_CONF_OPT_END
+
+#define DRI_CONF_DISABLE_OML_SYNC_CONTROL(def) \
+DRI_CONF_OPT_BEGIN_B(glx_disable_oml_sync_control, def) \
+   DRI_CONF_DESC(en, gettext("Disable the GLX_OML_sync_control extension")) \
+DRI_CONF_OPT_END
+
 
 /**
  * \brief Software-fallback options.  To allow using features (like
-- 
2.7.4

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


[Mesa-dev] [PATCH RFC 3/4] st/dri: Allow gallium drivers to turn off two GLX extensions

2017-05-05 Thread Thomas Hellstrom
Allow gallium drivers to turn off GLX_EXT_buffer_age and
GLX_OML_sync_control if needed, using driconf.

Signed-off-by: Thomas Hellstrom 
---
 include/GL/internal/dri_interface.h | 4 +++-
 src/gallium/state_trackers/dri/dri_screen.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 86efd1b..0711c71 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1554,11 +1554,13 @@ struct __DRIrobustnessExtensionRec {
  * the loader in supporting the driconf application.
  */
 #define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions"
-#define __DRI_CONFIG_OPTIONS_VERSION 1
+#define __DRI_CONFIG_OPTIONS_VERSION 2
 
 typedef struct __DRIconfigOptionsExtensionRec {
__DRIextension base;
const char *xml;
+   int (*appendOptions) (struct __DRIconfigOptionsExtensionRec *configOptions,
+ const char *append_xml);
 } __DRIconfigOptionsExtension;
 
 /**
diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
b/src/gallium/state_trackers/dri/dri_screen.c
index 998e8ef..07a29a7 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -56,6 +56,8 @@ const __DRIconfigOptionsExtension gallium_config_options = {
DRI_CONF_BEGIN
   DRI_CONF_SECTION_PERFORMANCE
  DRI_CONF_MESA_GLTHREAD("false")
+ DRI_CONF_DISABLE_EXT_BUFFER_AGE("false")
+ DRI_CONF_DISABLE_OML_SYNC_CONTROL("false")
   DRI_CONF_SECTION_END
 
   DRI_CONF_SECTION_QUALITY
-- 
2.7.4

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


[Mesa-dev] [PATCH RFC 4/4] dri: Turn of a couple of glx extensions for gnome-shell on vmwgfx.

2017-05-05 Thread Thomas Hellstrom
Increases performance on vmwgfx since we're avoiding full buffer damage and
since we can't sync to vertical retrace anyway.

Signed-off-by: Thomas Hellstrom 
---
 src/mesa/drivers/dri/common/drirc | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/drivers/dri/common/drirc 
b/src/mesa/drivers/dri/common/drirc
index 14d7713..a8f2ccf 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -137,4 +137,11 @@ TODO: document the other workarounds.
 
 
 
+
+
+
+
+
+
+
 
-- 
2.7.4

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


[Mesa-dev] [PATCH RFC 0/4] Don't lose speed with dri3 on virtual drivers

2017-05-05 Thread Thomas Hellstrom
With dri3 and certain levels of dri2, the glx-dri layer automatically turn
on some GLX extensions whose functionality is mostly emulated on virtual
drivers. This causes a performance loss and increased latency.
Two such examples are GLX_EXT_buffer_age and GLX_OML_sync_control.
We'd like the ability to turn those off on a per-application and per-driver
basis to avoid the performance loss.

Now, dri-glx only looks for options in the "dri2" driver which firstly plays
badly with driconf, and secondly doesn't allow us to turn the extensions off
on a per-driver basis. So have dri-glx also check the driver options on
gallium drivers, preferring the driver options if there is a clash.

We implement the new options for all gallium drivers with a default
not to disable those GLX extensions.

Finally for the default drirc, turn those extensions off for the
gnome-shell on vmwgfx combination. That might be modified in the future to
also cover other compositors.

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


[Mesa-dev] [PATCH RFC 1/4] st/dri: Allow dri users to query also driver options

2017-05-05 Thread Thomas Hellstrom
There will be situations where we want to control, for example, the
GLX behaviour based on applications and drivers. So allow DRI users access
to the driver options.

Signed-off-by: Thomas Hellstrom 
---
 src/gallium/state_trackers/dri/dri2.c | 65 ++-
 1 file changed, 64 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/dri/dri2.c 
b/src/gallium/state_trackers/dri/dri2.c
index ed6004f..eedcd21 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1880,6 +1880,69 @@ static const __DRI2interopExtension dri2InteropExtension 
= {
.export_object = dri2_interop_export_object
 };
 
+/**
+ * \brief the DRI2ConfigQueryExtension configQueryb method
+ */
+static int
+dri2GalliumConfigQueryb(__DRIscreen *sPriv, const char *var,
+unsigned char *val)
+{
+   struct dri_screen *screen = dri_screen(sPriv);
+
+   if (!driCheckOption(>optionCache, var, DRI_BOOL))
+  return dri2ConfigQueryExtension.configQueryb(sPriv, var, val);
+
+   *val = driQueryOptionb(>optionCache, var);
+
+   return 0;
+}
+
+/**
+ * \brief the DRI2ConfigQueryExtension configQueryi method
+ */
+static int
+dri2GalliumConfigQueryi(__DRIscreen *sPriv, const char *var, int *val)
+{
+   struct dri_screen *screen = dri_screen(sPriv);
+
+   if (!driCheckOption(>optionCache, var, DRI_INT) &&
+   !driCheckOption(>optionCache, var, DRI_ENUM))
+  return dri2ConfigQueryExtension.configQueryi(sPriv, var, val);
+
+*val = driQueryOptioni(>optionCache, var);
+
+return 0;
+}
+
+/**
+ * \brief the DRI2ConfigQueryExtension configQueryf method
+ */
+static int
+dri2GalliumConfigQueryf(__DRIscreen *sPriv, const char *var, float *val)
+{
+   struct dri_screen *screen = dri_screen(sPriv);
+
+   if (!driCheckOption(>optionCache, var, DRI_FLOAT))
+  return dri2ConfigQueryExtension.configQueryf(sPriv, var, val);
+
+*val = driQueryOptionf(>optionCache, var);
+
+return 0;
+}
+
+/**
+ * \brief the DRI2ConfigQueryExtension struct.
+ *
+ * We first query the driver option cache. Then the dri2 option cache.
+ */
+static const __DRI2configQueryExtension dri2GalliumConfigQueryExtension = {
+   .base = { __DRI2_CONFIG_QUERY, 1 },
+
+   .configQueryb= dri2GalliumConfigQueryb,
+   .configQueryi= dri2GalliumConfigQueryi,
+   .configQueryf= dri2GalliumConfigQueryf,
+};
+
 /*
  * Backend function init_screen.
  */
@@ -1889,7 +1952,7 @@ static const __DRIextension *dri_screen_extensions[] = {
,
,
,
-   ,
+   ,
,
,
,
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 1/2] bin/*sh: honor editorconfig formatting

2017-05-05 Thread Emil Velikov
On 5 May 2017 at 14:09, Andres Gomez  wrote:
> Signed-off-by: Andres Gomez 
> ---
>  bin/bugzilla_mesa.sh   | 14 -
>  bin/get-extra-pick-list.sh | 48 ++--
>  bin/get-fixes-pick-list.sh | 78 
> +++---
>  bin/get-pick-list.sh   | 32 +--
>  bin/get-typod-pick-list.sh | 36 ++---
>  bin/shortlog_mesa.sh   | 24 +++---
>  6 files changed, 116 insertions(+), 116 deletions(-)
>
AFAICT the formatting is right and consistent, but the .editorconfig is off.
Can we fix that one please?

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


[Mesa-dev] [PATCH] st/glsl_to_tgsi: make sure resource file for samplers is PROGRAM_SAMPLER

2017-05-05 Thread Samuel Pitoiset
Similar to how image resources are handled. That way we are sure
that inst->resource.file is PROGRAM_SAMPLER for "bound" samplers.

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 81c1d00dfb..25050834e3 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4149,7 +4149,6 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
unsigned opcode = TGSI_OPCODE_NOP;
const glsl_type *sampler_type = ir->sampler->type;
unsigned sampler_array_size = 1, sampler_base = 0;
-   uint16_t sampler_index = 0;
bool is_cube_array = false, is_cube_shadow = false;
unsigned i;
 
@@ -4380,10 +4379,16 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
   coord_dst.writemask = WRITEMASK_XYZW;
}
 
+   st_src_reg sampler(PROGRAM_SAMPLER, 0, GLSL_TYPE_UINT);
+
get_deref_offsets(ir->sampler, _array_size, _base,
- _index, , true);
-   if (reladdr.file != PROGRAM_UNDEFINED)
+ (uint16_t *), , true);
+
+   if (reladdr.file != PROGRAM_UNDEFINED) {
+  sampler.reladdr = ralloc(mem_ctx, st_src_reg);
+  *sampler.reladdr = reladdr;
   emit_arl(ir, sampler_reladdr, reladdr);
+   }
 
if (opcode == TGSI_OPCODE_TXD)
   inst = emit_asm(ir, opcode, result_dst, coord, dx, dy);
@@ -4414,15 +4419,10 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
if (ir->shadow_comparator)
   inst->tex_shadow = GL_TRUE;
 
-   inst->resource.index = sampler_index;
+   inst->resource = sampler;
inst->sampler_array_size = sampler_array_size;
inst->sampler_base = sampler_base;
 
-   if (reladdr.file != PROGRAM_UNDEFINED) {
-  inst->resource.reladdr = ralloc(mem_ctx, st_src_reg);
-  memcpy(inst->resource.reladdr, , sizeof(reladdr));
-   }
-
if (ir->offset) {
   if (!inst->tex_offsets)
  inst->tex_offsets = rzalloc_array(inst, st_src_reg, 
MAX_GLSL_TEXTURE_OFFSET);
-- 
2.12.2

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


[Mesa-dev] [PATCH 2/2] bin/*py: honor editorconfig formatting

2017-05-05 Thread Andres Gomez
Signed-off-by: Andres Gomez 
---
 bin/perf-annotate-jit.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/perf-annotate-jit.py b/bin/perf-annotate-jit.py
index 746434008f..4f05585bd4 100755
--- a/bin/perf-annotate-jit.py
+++ b/bin/perf-annotate-jit.py
@@ -133,7 +133,7 @@ class PerfParser(LineParser):
 
 def __init__(self, infile, symbol):
 LineParser.__init__(self, infile)
-   self.symbol = symbol
+self.symbol = symbol
 
 def readline(self):
 # Override LineParser.readline to ignore comment lines
@@ -155,7 +155,7 @@ class PerfParser(LineParser):
 addresses.sort()
 total_samples = 0
 
-   sys.stdout.write('%s:\n' % self.symbol)
+sys.stdout.write('%s:\n' % self.symbol)
 for address, instr in asm:
 try:
 sample = samples.pop(address)
-- 
2.11.0

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


[Mesa-dev] [PATCH 0/2] bin: honor editorconfig formatting

2017-05-05 Thread Andres Gomez
Just a series to correct the formating under bin/*

Andres Gomez (2):
  bin/*sh: honor editorconfig formatting
  bin/*py: honor editorconfig formatting

 bin/bugzilla_mesa.sh   | 14 -
 bin/get-extra-pick-list.sh | 48 ++--
 bin/get-fixes-pick-list.sh | 78 +++---
 bin/get-pick-list.sh   | 32 +--
 bin/get-typod-pick-list.sh | 36 ++---
 bin/perf-annotate-jit.py   |  4 +--
 bin/shortlog_mesa.sh   | 24 +++---
 7 files changed, 118 insertions(+), 118 deletions(-)

-- 
2.11.0

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


[Mesa-dev] [PATCH 1/2] bin/*sh: honor editorconfig formatting

2017-05-05 Thread Andres Gomez
Signed-off-by: Andres Gomez 
---
 bin/bugzilla_mesa.sh   | 14 -
 bin/get-extra-pick-list.sh | 48 ++--
 bin/get-fixes-pick-list.sh | 78 +++---
 bin/get-pick-list.sh   | 32 +--
 bin/get-typod-pick-list.sh | 36 ++---
 bin/shortlog_mesa.sh   | 24 +++---
 6 files changed, 116 insertions(+), 116 deletions(-)

diff --git a/bin/bugzilla_mesa.sh b/bin/bugzilla_mesa.sh
index a8f5305844..c2579d4586 100755
--- a/bin/bugzilla_mesa.sh
+++ b/bin/bugzilla_mesa.sh
@@ -24,12 +24,12 @@ echo ""
 
 # extract fdo urls from commit log
 git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before | sort 
-n -u | sed -e $use_after |\
-while read url
-do
-   id=$(echo $url | cut -d'=' -f2)
-   summary=$(wget --quiet -O - $url | grep -e '.*' | sed -e 
's/ *[0-9]\+  \(.*\)<\/title>/\1/')
-   echo "Bug $id - $summary"
-   echo ""
-done
+  while read url
+  do
+id=$(echo $url | cut -d'=' -f2)
+summary=$(wget --quiet -O - $url | grep -e '.*' | sed -e 
's/ *[0-9]\+  \(.*\)<\/title>/\1/')
+echo "Bug $id - $summary"
+echo ""
+  done
 
 echo ""
diff --git a/bin/get-extra-pick-list.sh b/bin/get-extra-pick-list.sh
index b42085f2ab..6249852eeb 100755
--- a/bin/get-extra-pick-list.sh
+++ b/bin/get-extra-pick-list.sh
@@ -14,32 +14,32 @@ latest_branchpoint=`git merge-base origin/master HEAD`
 
 # Grep for commits with "cherry picked from commit" in the commit message.
 git log --reverse --grep="cherry picked from commit" $latest_branchpoint..HEAD 
|\
-   grep "cherry picked from commit" |\
-   sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 
's/)//'  > already_picked
+  grep "cherry picked from commit" |\
+  sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//'  
> already_picked
 
 # For each cherry-picked commit...
 cat already_picked | cut -c -8 |\
-while read sha
-do
-   # ... check if it's referenced (fixed by another) patch
-   git log -n1 --pretty=oneline --grep=$sha 
$latest_branchpoint..origin/master |\
-   cut -c -8 |\
-   while read candidate
-   do
-   # And flag up if it hasn't landed in branch yet.
-   if grep -q ^$candidate already_picked ; then
-   continue
-   fi
-   # Or if it isn't in the ignore list.
-   if [ -f bin/.cherry-ignore ] ; then
-   if grep -q ^$candidate bin/.cherry-ignore ; then
-   continue
-   fi
-   fi
-   printf "Commit \"%s\" references %s\n" \
-  "`git log -n1 --pretty=oneline $candidate`" \
-  "$sha"
-   done
-done
+  while read sha
+  do
+# ... check if it's referenced (fixed by another) patch
+git log -n1 --pretty=oneline --grep=$sha 
$latest_branchpoint..origin/master |\
+  cut -c -8 |\
+  while read candidate
+  do
+# And flag up if it hasn't landed in branch yet.
+if grep -q ^$candidate already_picked ; then
+  continue
+fi
+# Or if it isn't in the ignore list.
+if [ -f bin/.cherry-ignore ] ; then
+  if grep -q ^$candidate bin/.cherry-ignore ; then
+continue
+  fi
+fi
+printf "Commit \"%s\" references %s\n" \
+   "`git log -n1 --pretty=oneline $candidate`" \
+   "$sha"
+  done
+  done
 
 rm -f already_picked
diff --git a/bin/get-fixes-pick-list.sh b/bin/get-fixes-pick-list.sh
index f1398f320c..3a5f48d292 100755
--- a/bin/get-fixes-pick-list.sh
+++ b/bin/get-fixes-pick-list.sh
@@ -17,55 +17,55 @@ git log --reverse --pretty=%H $latest_branchpoint > 
already_landed
 
 # ... and the ones cherry-picked.
 git log --reverse --grep="cherry picked from commit" $latest_branchpoint..HEAD 
|\
-   grep "cherry picked from commit" |\
-   sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 
's/)//'  > already_picked
+  grep "cherry picked from commit" |\
+  sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//'  
> already_picked
 
 # Grep for commits with Fixes tag
 git log --reverse --pretty=%H -i --grep="fixes:" 
$latest_branchpoint..origin/master |\
-while read sha
-do
-   # Check to see whether the patch is on the ignore list ...
-   if [ -f bin/.cherry-ignore ] ; then
-   if grep -q ^$sha bin/.cherry-ignore ; then
-   continue
-   fi
-   fi
+  while read sha
+  do
+# Check to see whether the patch is on the ignore list ...
+if [ -f bin/.cherry-ignore ] ; then
+  if grep -q ^$sha bin/.cherry-ignore ; then
+continue
+  fi
+fi
 
-   # For each one try to extract the tag
-   fixes_count=`git show $sha | grep -i "fixes:" | wc -l`
-   if [ "x$fixes_count" != x1 ] ; then

Re: [Mesa-dev] [PATCH 2/7] egl: fold Android logger into main/

2017-05-05 Thread Emil Velikov
On 4 May 2017 at 20:17, Rob Herring  wrote:
> On Thu, May 4, 2017 at 1:46 PM, Emil Velikov  wrote:
>> From: Emil Velikov 
>>
>> Will allow us to greatly simplify a lot of the code in egllog.c
>
> Okay, because on its own, this is not an improvement.
>
>>
>> Signed-off-by: Emil Velikov 
>> ---
>>  src/egl/drivers/dri2/egl_dri2.h |  1 -
>>  src/egl/drivers/dri2/platform_android.c | 34 ---
>>  src/egl/main/egllog.c   | 36 
>> +
>>  3 files changed, 36 insertions(+), 35 deletions(-)
>>
>> diff --git a/src/egl/drivers/dri2/egl_dri2.h 
>> b/src/egl/drivers/dri2/egl_dri2.h
>> index f16663712d3..b1e224248cc 100644
>> --- a/src/egl/drivers/dri2/egl_dri2.h
>> +++ b/src/egl/drivers/dri2/egl_dri2.h
>> @@ -59,7 +59,6 @@
>>  #include 
>>  #include 
>>  #include 
>> -#include 
>>
>>  #endif /* HAVE_ANDROID_PLATFORM */
>>
>> diff --git a/src/egl/drivers/dri2/platform_android.c 
>> b/src/egl/drivers/dri2/platform_android.c
>> index 35f2e5dbe63..e962e8e00dd 100644
>> --- a/src/egl/drivers/dri2/platform_android.c
>> +++ b/src/egl/drivers/dri2/platform_android.c
>> @@ -1030,38 +1030,6 @@ droid_open_device(struct dri2_egl_display *dri2_dpy)
>> return (fd >= 0) ? fcntl(fd, F_DUPFD_CLOEXEC, 3) : -1;
>>  }
>>
>> -/* support versions < JellyBean */
>> -#ifndef ALOGW
>> -#define ALOGW LOGW
>> -#endif
>> -#ifndef ALOGD
>> -#define ALOGD LOGD
>> -#endif
>> -#ifndef ALOGI
>> -#define ALOGI LOGI
>> -#endif
>> -
>> -static void
>> -droid_log(EGLint level, const char *msg)
>> -{
>> -   switch (level) {
>> -   case _EGL_DEBUG:
>> -  ALOGD("%s", msg);
>> -  break;
>> -   case _EGL_INFO:
>> -  ALOGI("%s", msg);
>> -  break;
>> -   case _EGL_WARNING:
>> -  ALOGW("%s", msg);
>> -  break;
>> -   case _EGL_FATAL:
>> -  LOG_FATAL("%s", msg);
>> -  break;
>> -   default:
>> -  break;
>> -   }
>> -}
>> -
>>  static struct dri2_egl_display_vtbl droid_display_vtbl = {
>> .authenticate = NULL,
>> .create_window_surface = droid_create_window_surface,
>> @@ -1118,8 +1086,6 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay 
>> *dpy)
>> const char *err;
>> int ret;
>>
>> -   _eglSetLogProc(droid_log);
>> -
>> loader_set_logger(_eglLog);
>>
>> dri2_dpy = calloc(1, sizeof(*dri2_dpy));
>> diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
>> index c8307482902..9d7e9302341 100644
>> --- a/src/egl/main/egllog.c
>> +++ b/src/egl/main/egllog.c
>> @@ -44,6 +44,23 @@
>>
>>  #include "egllog.h"
>>
>> +#ifdef HAVE_ANDROID_PLATFORM
>> +#define LOG_TAG "EGL-MAIN"
>> +#include 
>> +
>> +/* support versions < JellyBean */
>
> < JellyBean support is long gone, so these can be dropped.
>
We have a couple cases [i915 and i965], which we can drop as well right?

>> +#ifndef ALOGW
>> +#define ALOGW LOGW
>> +#endif
>> +#ifndef ALOGD
>> +#define ALOGD LOGD
>> +#endif
>> +#ifndef ALOGI
>> +#define ALOGI LOGI
>> +#endif
>> +
>> +#endif /* HAVE_ANDROID_PLATFORM */
>> +
>>  #define MAXSTRING 1000
>>  #define FALLBACK_LOG_LEVEL _EGL_WARNING
>>
>> @@ -107,7 +124,26 @@ _eglSetLogProc(_EGLLogProc logger)
>>  static void
>>  _eglDefaultLogger(EGLint level, const char *msg)
>>  {
>> +#ifdef HAVE_ANDROID_PLATFORM
>> +   switch (level) {
>> +   case _EGL_DEBUG:
>> +  ALOGD("%s", msg);
>> +  break;
>> +   case _EGL_INFO:
>> +  ALOGI("%s", msg);
>> +  break;
>> +   case _EGL_WARNING:
>> +  ALOGW("%s", msg);
>> +  break;
>> +   case _EGL_FATAL:
>> +  LOG_FATAL("%s", msg);
>> +  break;
>
> This could all be simplified with a LUT for the level:
>
> const int egl2alog[] = { LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG };
> ALOG(egl2alog[level], LOG_TAG, "%s", msg);
>
> You loose the abort on fatal errors, but you don't have that in the
> !android case. It doesn't really gain you anything aborting.
>
We have a exit(1) in _eglLog, so things should be fine.

Thanks for the suggestions!
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/18] anv: Rework the allocation data structures

2017-05-05 Thread Mike Lothian
I'm seeing the following failure with GCC 7.1:

/var/tmp/portage/media-libs/mesa-/work/mesa-/src/intel/vulkan/anv_allocator.c:
In function ‘anv_state_stream_alloc’:
/var/tmp/portage/media-libs/mesa-/work/mesa-/src/intel/vulkan/anv_allocator.c:930:28:
error: ‘struct anv_state_stream_block’ has no member named ‘_vg_ptr’
   VG_NOACCESS_WRITE(>_vg_ptr, NULL);
^
/var/tmp/portage/media-libs/mesa-/work/mesa-/src/intel/vulkan/anv_allocator.c:53:44:
note: in definition of macro ‘VG_NOACCESS_WRITE’
 #define VG_NOACCESS_WRITE(__ptr, __val) (*(__ptr) = (__val))
^
At top level:
/var/tmp/portage/media-libs/mesa-/work/mesa-/src/intel/vulkan/anv_allocator.c:1214:1:
warning: ‘anv_bo_cache_lookup’ defined but not used [-Wunused-function]
 anv_bo_cache_lookup(struct anv_bo_cache *cache, uint32_t gem_handle)
 ^~~


On Thu, 4 May 2017 at 09:09 Juan A. Suarez Romero 
wrote:

> On Tue, 2017-05-02 at 06:44 -0700, Jason Ekstrand wrote:
> > Juan,
> >
> > Were you planning to review the rest of the series?  Just wondering.
> >
>
> Sorry, it took a bit more to review the remaining patches.
>
> Now it is done.
>
>
> J.A.
>
> > --Jason
> >
> >
> > On April 26, 2017 7:35:29 AM Jason Ekstrand 
> wrote:
> >
> > > This absurdly long series does something fairly simple:  It pulls the
> > > block_pool into the state_pool and makes the state pool capable of
> > > allocating states larger than the block size.  Unfortunately, there
> was no
> > > good way to do it in less than 18 patches. :-(
> > >
> > > Cc: Juan A. Suarez Romero 
> > >
> > > Jason Ekstrand (18):
> > >   anv/allocator: Add no-valgrind versions of state_pool_alloc/free
> > >   anv/allocator: Return a null state for zero-size allocations
> > >   anv/allocator: Convert the state stream to pull from a state pool
> > >   anv: Get rid of a bunch of uses of size_t
> > >   anv/allocator: Remove the state_size field from fixed_size_state_pool
> > >   anv/allocator: Roll fixed_size_state_pool into state_pool
> > >   anv/allocator: Pull the userptr part of block_pool_grow into a helper
> > >   anv/allocator: Drop the block_size field from block_pool
> > >   anv/allocator: Add support for "back" allocations to state_pool
> > >   anv: Allocate binding table blocks through the state pool
> > >   anv/allocator: Get rid of the ability to free blocks
> > >   anv/allocator: Embed the block_pool in the state_pool
> > >   anv/allocator: Rework a comment
> > >   anv/allocator: Add the capability to allocate blocks of different
> > > sizes
> > >   anv/allocator: Add helpers for dealing with bucket sizes
> > >   anv/allocator: Support pushing multiple blocks onto a free list at
> > > once
> > >   anv/allocator: Allow state pools to allocate large states
> > >   anv: Drop the instruction pool block size
> > >
> > >  src/intel/vulkan/anv_allocator.c   | 589
> -
> > >  src/intel/vulkan/anv_batch_chain.c |  84 ++-
> > >  src/intel/vulkan/anv_blorp.c   |   4 +-
> > >  src/intel/vulkan/anv_cmd_buffer.c  |   8 +-
> > >  src/intel/vulkan/anv_descriptor_set.c  |   4 +-
> > >  src/intel/vulkan/anv_device.c  |  26 +-
> > >  src/intel/vulkan/anv_gem.c |   2 +-
> > >  src/intel/vulkan/anv_gem_stubs.c   |   2 +-
> > >  src/intel/vulkan/anv_private.h |  74 +--
> > >  src/intel/vulkan/gen8_cmd_buffer.c |   6 +-
> > >  src/intel/vulkan/genX_blorp_exec.c |   2 +-
> > >  src/intel/vulkan/genX_cmd_buffer.c |  15 +-
> > >  src/intel/vulkan/tests/block_pool_no_free.c|   8 +-
> > >  src/intel/vulkan/tests/state_pool.c|   5 +-
> > >  src/intel/vulkan/tests/state_pool_free_list_only.c |   5 +-
> > >  src/intel/vulkan/tests/state_pool_no_free.c|   5 +-
> > >  16 files changed, 461 insertions(+), 378 deletions(-)
> > >
> > > --
> > > 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


Re: [Mesa-dev] [PATCH v2 12/27] auxiliary/vl: use vl_*_screen_create stubs when building w/o platform

2017-05-05 Thread Christian König

Am 05.05.2017 um 14:11 schrieb Emil Velikov:

On 5 May 2017 at 12:37, Christian König  wrote:

Am 05.05.2017 um 13:23 schrieb Emil Velikov:

On 5 May 2017 at 10:30, Christian König  wrote:

Am 04.05.2017 um 18:33 schrieb Emil Velikov:

From: Emil Velikov 

Provide a dummy stub when the user has opted w/o said platform, thus
we can build the binaries without unnecessarily requiring X11/other
headers.

In order to avoid build and link-time issues, we remove the HAVE_DRI3
guards in the VA and VDPAU state-trackers.

With this change st/va will return VA_STATUS_ERROR_ALLOCATION_FAILED
instead of VA_STATUS_ERROR_UNIMPLEMENTED. That is fine since upstream
users of libva such as vlc and mpv do little error checking, let
alone distinguish between the two.

Cc: Leo Liu 
Cc: "Guttula, Suresh" 
Cc: mesa-sta...@lists.freedesktop.org
Cc: Christian König 
Signed-off-by: Emil Velikov 
---
Christian, others
How do you feel about the ALLOCATION_FAILED vs UNIMPLEMENTED situation?
Doing the latter is doable, albeit it will make the code a bit ugly.


I don't think that matters much, but resulting in UNIMPLEMENTED return
code
when X backends are not compiled in indeed sounds cleaner.

So price question is how much hassle would it be? Apart from that the
changes look good to me.


Hassle is zero, yet any solution that I can think of is quite ugly.


Why do you think it is ugly? I mean returning VA_STATUS_ERROR_UNIMPLEMENTED
for things not implemented sounds like the right thing to do to me.

Having the handling in the auxiliary code on the other hand is a bit ugly if
you ask me, because such stuff is actually the problem of the state tracker.

It just saves us quite a bunch of conditionally compiled code in the state
tracker and so is still preferable from a maintenance perspective.

Maybe change the vl_*_screen_create() interface to return a negative error
code from errno.h and then map that to a proper VA_STATUS return in the VA
state tracker?


Not a huge fan of ifndef twinged with code. If we ignore that for a
moment - the erro+map to VA is also a bit iffy, if we think of the
wayland case.
In there we have a partial implementation (IIRC so does the i965 va
driver) which does not have a matching vl_*_screen_create call.

On second though i965 va does not report VA_STATUS_ERROR_UNIMPLEMENTED
when built w/o $platform, so perhaps we can get this as-is and polish
at a later stage?


Yeah, feel free to go ahead with that. If i965 messes things up we can 
do so as well :)


Christian.



-Emil
___
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 20/27] st/omx: add DRI3 support

2017-05-05 Thread Christian König

Am 04.05.2017 um 18:33 schrieb Emil Velikov:

From: Emil Velikov 

Cc: Christian König 
Signed-off-by: Emil Velikov 
---
UNTESTED.


Looks sane to me, but what bothers me a bit is that it is untested.

Leo do we (or QA) have a system somewhere where we could trow such 
things at and give them a try? Setting up a box for transcode testing is 
always quite a hassle.


Christian.


---
  src/gallium/state_trackers/omx/entrypoint.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/omx/entrypoint.c 
b/src/gallium/state_trackers/omx/entrypoint.c
index fa2074ad1b7..251cc7d65d5 100644
--- a/src/gallium/state_trackers/omx/entrypoint.c
+++ b/src/gallium/state_trackers/omx/entrypoint.c
@@ -103,7 +103,9 @@ struct vl_screen *omx_get_screen(void)
   if (!omx_display)
  goto error;
  
- omx_screen = vl_dri2_screen_create(omx_display, 0);

+ omx_screen = vl_dri3_screen_create(omx_display, 0);
+ if (!omx_screen)
+omx_screen = vl_dri2_screen_create(omx_display, 0);
   if (!omx_screen) {
  XCloseDisplay(omx_display);
  goto error;



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


[Mesa-dev] [PATCH] radeonsi: fix build with GCC 4.8

2017-05-05 Thread Samuel Pitoiset
Fixes: 7088b655e8 ("radeonsi: constify a bunch of the perfcounter structs.")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100937
Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/radeonsi/si_perfcounter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_perfcounter.c 
b/src/gallium/drivers/radeonsi/si_perfcounter.c
index ad7b9b7ae4..fd28d1176e 100644
--- a/src/gallium/drivers/radeonsi/si_perfcounter.c
+++ b/src/gallium/drivers/radeonsi/si_perfcounter.c
@@ -302,7 +302,7 @@ static const struct si_pc_block_base cik_TCP = {
.layout = SI_PC_MULTI_ALTERNATE,
 };
 
-static const struct si_pc_block_base cik_VGT = (const struct si_pc_block_base) 
{
+static const struct si_pc_block_base cik_VGT = {
.name = "VGT",
.num_counters = 4,
.flags = R600_PC_BLOCK_SE,
-- 
2.12.2

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


Re: [Mesa-dev] [PATCH v2 12/27] auxiliary/vl: use vl_*_screen_create stubs when building w/o platform

2017-05-05 Thread Christian König

Am 05.05.2017 um 13:23 schrieb Emil Velikov:

On 5 May 2017 at 10:30, Christian König  wrote:

Am 04.05.2017 um 18:33 schrieb Emil Velikov:

From: Emil Velikov 

Provide a dummy stub when the user has opted w/o said platform, thus
we can build the binaries without unnecessarily requiring X11/other
headers.

In order to avoid build and link-time issues, we remove the HAVE_DRI3
guards in the VA and VDPAU state-trackers.

With this change st/va will return VA_STATUS_ERROR_ALLOCATION_FAILED
instead of VA_STATUS_ERROR_UNIMPLEMENTED. That is fine since upstream
users of libva such as vlc and mpv do little error checking, let
alone distinguish between the two.

Cc: Leo Liu 
Cc: "Guttula, Suresh" 
Cc: mesa-sta...@lists.freedesktop.org
Cc: Christian König 
Signed-off-by: Emil Velikov 
---
Christian, others
How do you feel about the ALLOCATION_FAILED vs UNIMPLEMENTED situation?
Doing the latter is doable, albeit it will make the code a bit ugly.


I don't think that matters much, but resulting in UNIMPLEMENTED return code
when X backends are not compiled in indeed sounds cleaner.

So price question is how much hassle would it be? Apart from that the
changes look good to me.


Hassle is zero, yet any solution that I can think of is quite ugly.


Why do you think it is ugly? I mean returning 
VA_STATUS_ERROR_UNIMPLEMENTED for things not implemented sounds like the 
right thing to do to me.


Having the handling in the auxiliary code on the other hand is a bit 
ugly if you ask me, because such stuff is actually the problem of the 
state tracker.


It just saves us quite a bunch of conditionally compiled code in the 
state tracker and so is still preferable from a maintenance perspective.


Maybe change the vl_*_screen_create() interface to return a negative 
error code from errno.h and then map that to a proper VA_STATUS return 
in the VA state tracker?


Regards,
Christian.


See the example below and feel free to suggest anything else.

-Emil

diff --git a/src/gallium/state_trackers/va/context.c
b/src/gallium/state_trackers/va/context.c
index ae9154a332a..9b7688320cc 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -26,6 +26,7 @@
   *
   **/

+#include 
  #include "pipe/p_screen.h"
  #include "pipe/p_video_codec.h"
  #include "util/u_memory.h"
@@ -103,6 +104,7 @@ PUBLIC VAStatus
  VA_DRIVER_INIT_FUNC(VADriverContextP ctx)
  {
 vlVaDriver *drv;
+   bool implemented = true;

 if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
@@ -113,17 +115,26 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx)

 switch (ctx->display_type) {
 case VA_DISPLAY_ANDROID:
-  FREE(drv);
-  return VA_STATUS_ERROR_UNIMPLEMENTED;
+  implemented = false;
+  break;
 case VA_DISPLAY_GLX:
 case VA_DISPLAY_X11:
+#if !defined(HAVE_X11_PLATFORM)
+  implemented = false;
+#endif
drv->vscreen = vl_dri3_screen_create(ctx->native_dpy, ctx->x11_screen);
if (!drv->vscreen)
   drv->vscreen = vl_dri2_screen_create(ctx->native_dpy,
ctx->x11_screen);
break;
 case VA_DISPLAY_WAYLAND:
+#if !defined(HAVE_WAYLAND_PLATFORM)
+  implemented = false;
+#endif
 case VA_DISPLAY_DRM:
 case VA_DISPLAY_DRM_RENDERNODES: {
+#if !defined(HAVE_DRM_PLATFORM)
+  implemented = false;
+#endif
const struct drm_state *drm_info = (struct drm_state *) ctx->drm_state;

if (!drm_info || drm_info->fd < 0) {
@@ -139,6 +150,11 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx)
return VA_STATUS_ERROR_INVALID_DISPLAY;
 }

+   if (!implemented) {
+  FREE(drv);
+  return VA_STATUS_ERROR_UNIMPLEMENTED;
+   }
+
 if (!drv->vscreen)
goto error_screen;



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


Re: [Mesa-dev] [PATCH v2 12/27] auxiliary/vl: use vl_*_screen_create stubs when building w/o platform

2017-05-05 Thread Emil Velikov
On 5 May 2017 at 12:37, Christian König  wrote:
> Am 05.05.2017 um 13:23 schrieb Emil Velikov:
>>
>> On 5 May 2017 at 10:30, Christian König  wrote:
>>>
>>> Am 04.05.2017 um 18:33 schrieb Emil Velikov:

 From: Emil Velikov 

 Provide a dummy stub when the user has opted w/o said platform, thus
 we can build the binaries without unnecessarily requiring X11/other
 headers.

 In order to avoid build and link-time issues, we remove the HAVE_DRI3
 guards in the VA and VDPAU state-trackers.

 With this change st/va will return VA_STATUS_ERROR_ALLOCATION_FAILED
 instead of VA_STATUS_ERROR_UNIMPLEMENTED. That is fine since upstream
 users of libva such as vlc and mpv do little error checking, let
 alone distinguish between the two.

 Cc: Leo Liu 
 Cc: "Guttula, Suresh" 
 Cc: mesa-sta...@lists.freedesktop.org
 Cc: Christian König 
 Signed-off-by: Emil Velikov 
 ---
 Christian, others
 How do you feel about the ALLOCATION_FAILED vs UNIMPLEMENTED situation?
 Doing the latter is doable, albeit it will make the code a bit ugly.
>>>
>>>
>>> I don't think that matters much, but resulting in UNIMPLEMENTED return
>>> code
>>> when X backends are not compiled in indeed sounds cleaner.
>>>
>>> So price question is how much hassle would it be? Apart from that the
>>> changes look good to me.
>>>
>> Hassle is zero, yet any solution that I can think of is quite ugly.
>
>
> Why do you think it is ugly? I mean returning VA_STATUS_ERROR_UNIMPLEMENTED
> for things not implemented sounds like the right thing to do to me.
>
> Having the handling in the auxiliary code on the other hand is a bit ugly if
> you ask me, because such stuff is actually the problem of the state tracker.
>
> It just saves us quite a bunch of conditionally compiled code in the state
> tracker and so is still preferable from a maintenance perspective.
>
> Maybe change the vl_*_screen_create() interface to return a negative error
> code from errno.h and then map that to a proper VA_STATUS return in the VA
> state tracker?
>
Not a huge fan of ifndef twinged with code. If we ignore that for a
moment - the erro+map to VA is also a bit iffy, if we think of the
wayland case.
In there we have a partial implementation (IIRC so does the i965 va
driver) which does not have a matching vl_*_screen_create call.

On second though i965 va does not report VA_STATUS_ERROR_UNIMPLEMENTED
when built w/o $platform, so perhaps we can get this as-is and polish
at a later stage?

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


[Mesa-dev] [PATCH] anv: Always set the reloc value to match the presumed_offset

2017-05-05 Thread Chris Wilson
It is a requirement, not just of using the NO_RELOC mode, that all
relocation values in the execobjects match their reloc.presumed_offset,
as the kernel will skip performing *any* relocation if the presumed_offset
matches the target object. As anv is setting unknown relocations to -1
irrespective of the actual value, if the kernel placed the target at -1
(i.e. 0xf000 for 48bit GTT), it would happily skip the relocation.
To prevent this, we need to always do the userspace relocations to ensure
the values match. To improve further, set the unknown object offset to 0
(a valid location) on the offchance it is available and the migration
skipped.

Signed-off-by: Chris Wilson 
Cc: Jason Ekstrand 
---
 src/intel/vulkan/anv_batch_chain.c | 97 --
 src/intel/vulkan/anv_private.h |  2 +-
 2 files changed, 32 insertions(+), 67 deletions(-)

diff --git a/src/intel/vulkan/anv_batch_chain.c 
b/src/intel/vulkan/anv_batch_chain.c
index 0529f22b84..46c4ce6efb 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -1205,28 +1205,10 @@ anv_reloc_list_apply(struct anv_device *device,
  * probably the fastest mechanism for doing relocations since the kernel would
  * have to make a full copy of all the relocations lists.
  */
-static bool
+static void
 relocate_cmd_buffer(struct anv_cmd_buffer *cmd_buffer,
 struct anv_execbuf *exec)
 {
-   static int userspace_relocs = -1;
-   if (userspace_relocs < 0)
-  userspace_relocs = env_var_as_boolean("ANV_USERSPACE_RELOCS", true);
-   if (!userspace_relocs)
-  return false;
-
-   /* First, we have to check to see whether or not we can even do the
-* relocation.  New buffers which have never been submitted to the kernel
-* don't have a valid offset so we need to let the kernel do relocations so
-* that we can get offsets for them.  On future execbuf2 calls, those
-* buffers will have offsets and we will be able to skip relocating.
-* Invalid offsets are indicated by anv_bo::offset == (uint64_t)-1.
-*/
-   for (uint32_t i = 0; i < exec->bo_count; i++) {
-  if (exec->bos[i]->offset == (uint64_t)-1)
- return false;
-   }
-
/* Since surface states are shared between command buffers and we don't
 * know what order they will be submitted to the kernel, we don't know
 * what address is actually written in the surface state object at any
@@ -1248,8 +1230,6 @@ relocate_cmd_buffer(struct anv_cmd_buffer *cmd_buffer,
 
for (uint32_t i = 0; i < exec->bo_count; i++)
   exec->objects[i].offset = exec->bos[i]->offset;
-
-   return true;
 }
 
 static VkResult
@@ -1334,55 +1314,40 @@ setup_execbuf_for_cmd_buffer(struct anv_execbuf 
*execbuf,
   .buffer_count = execbuf->bo_count,
   .batch_start_offset = 0,
   .batch_len = batch->next - batch->start,
-  .cliprects_ptr = 0,
-  .num_cliprects = 0,
-  .DR1 = 0,
-  .DR4 = 0,
-  .flags = I915_EXEC_HANDLE_LUT | I915_EXEC_RENDER |
-   I915_EXEC_CONSTANTS_REL_GENERAL,
+  .flags =
+ I915_EXEC_RENDER |
+ I915_EXEC_HANDLE_LUT |
+ I915_EXEC_NO_RELOC |
+ I915_EXEC_CONSTANTS_REL_GENERAL,
   .rsvd1 = cmd_buffer->device->context_id,
   .rsvd2 = 0,
};
 
-   if (relocate_cmd_buffer(cmd_buffer, execbuf)) {
-  /* If we were able to successfully relocate everything, tell the kernel
-   * that it can skip doing relocations. The requirement for using
-   * NO_RELOC is:
-   *
-   *  1) The addresses written in the objects must match the corresponding
-   * reloc.presumed_offset which in turn must match the corresponding
-   * execobject.offset.
-   *
-   *  2) To avoid stalling, execobject.offset should match the current
-   * address of that object within the active context.
-   *
-   * In order to satisfy all of the invariants that make userspace
-   * relocations to be safe (see relocate_cmd_buffer()), we need to
-   * further ensure that the addresses we use match those used by the
-   * kernel for the most recent execbuf2.
-   *
-   * The kernel may still choose to do relocations anyway if something has
-   * moved in the GTT. In this case, the relocation list still needs to be
-   * valid.  All relocations on the batch buffers are already valid and
-   * kept up-to-date.  For surface state relocations, by applying the
-   * relocations in relocate_cmd_buffer, we ensured that the address in
-   * the RENDER_SURFACE_STATE matches presumed_offset, so it should be
-   * safe for the kernel to relocate them as needed.
-   */
-  execbuf->execbuf.flags |= I915_EXEC_NO_RELOC;
-   } else {
-  /* In the case where we fall back to doing kernel relocations, we need
-   * to ensure that the relocation list is valid.  All relocations on the
-

[Mesa-dev] [Bug 99116] Wine program showing only a blackscreen when using mesa

2017-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99116

--- Comment #10 from JL  ---
I tried to replay attachment in first post with mesa 17.0.5 (archlinux) and R9
285 and it shows only black unless I run it with "apitrace replay --sb
wine.trace" which shows animation but in very fast speed.

-- 
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 13/27] st/va: move variable declaration to where its used

2017-05-05 Thread Christian König

Am 04.05.2017 um 18:33 schrieb Emil Velikov:

From: Emil Velikov 

... and make it const, since we shouldn't tinker with it.

Signed-off-by: Emil Velikov 
Reviewed-by: Nayan Deshmukh 


Patches #13 - #17 are Reviewed-by: Christian König 
, but I need to take a closer look at the rest.


BTW: Can you send and commit those minor cleanups separately the next time?

Makes live much easier to have the trivial stuff in master there is 
autohell or other non trivial things involved in a patch set.


Regards,
Christian.


---
  src/gallium/state_trackers/va/context.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/va/context.c 
b/src/gallium/state_trackers/va/context.c
index 5159fceac91..a44634c4428 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -103,7 +103,6 @@ PUBLIC VAStatus
  VA_DRIVER_INIT_FUNC(VADriverContextP ctx)
  {
 vlVaDriver *drv;
-   struct drm_state *drm_info;
  
 if (!ctx)

return VA_STATUS_ERROR_INVALID_CONTEXT;
@@ -127,7 +126,7 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx)
 case VA_DISPLAY_WAYLAND:
 case VA_DISPLAY_DRM:
 case VA_DISPLAY_DRM_RENDERNODES: {
-  drm_info = (struct drm_state *) ctx->drm_state;
+  const struct drm_state *drm_info = (struct drm_state *) ctx->drm_state;
  
if (!drm_info || drm_info->fd < 0) {

   FREE(drv);



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


  1   2   >