[Mesa-dev] [Bug 99638] Mesa opengles Peppa Pig and openggles2 smurfs on Radeon PowerPC and PPC64

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

--- Comment #6 from intermedi...@hotmail.com  ---
Just tested on Ubuntu Mate 16.10 in software resterized mode Mesa 17 rc2 ... 
color issue is present there too.

-- 
You are receiving this mail because:
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 2/2] i965: Get rid of mark_surface_used()

2017-02-07 Thread Iago Toral
On Tue, 2017-02-07 at 15:03 -0800, Jason Ekstrand wrote:
> The mark_surface_used function exists for a micro-optimization that
> shrinks the binding table if some of the entries are
> unused.  However,
> we already create binding tables based on num_textures, num_ubos,
> etc.,
> so the only case where this is actually able to eliminate something
> is
> if the back-end or NIR is able to dead-code something that the GLSL
> compiler couldn't.  Also, it only helps if the thing we were able to
> dead-code happened to be at the end of the list.
> 
> Binding table space is cheap.  On the other hand, this optimization
> costs us over 150 lines of code scattered throughout NIR and all
> layers
> of the back-end compiler that's a pain to maintain.  The tiny
> optimization we get isn't worth the effort.
> 
> Cc: Kenneth Graunke 
> ---
>  src/compiler/nir/nir.c   |  1 -
>  src/compiler/nir/nir.h   |  3 --
>  src/compiler/nir/nir_clone.c |  1 -
>  src/compiler/nir/nir_instr_set.c |  2 -
>  src/compiler/nir/nir_lower_samplers.c|  2 -
>  src/intel/vulkan/anv_nir_apply_pipeline_layout.c |  5 ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp |  4 --
>  src/mesa/drivers/dri/i965/brw_fs_generator.cpp   | 11 --
>  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 47 --
> --
>  src/mesa/drivers/dri/i965/brw_program.h  |  4 --
>  src/mesa/drivers/dri/i965/brw_shader.cpp | 20 +-
>  src/mesa/drivers/dri/i965/brw_vec4_generator.cpp |  9 -
>  src/mesa/drivers/dri/i965/brw_vec4_nir.cpp   | 47 --
> --
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp   |  2 -
>  14 files changed, 2 insertions(+), 156 deletions(-)
> 
> diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
> index 25bfc31..7b3702c 100644
> --- a/src/compiler/nir/nir.c
> +++ b/src/compiler/nir/nir.c
> @@ -532,7 +532,6 @@ nir_tex_instr_create(nir_shader *shader, unsigned
> num_srcs)
>    src_init(>src[i].src);
>  
> instr->texture_index = 0;
> -   instr->texture_array_size = 0;
> instr->texture = NULL;
> instr->sampler_index = 0;
> instr->sampler = NULL;
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index 8bbc41d..2ffa869 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -1161,9 +1161,6 @@ typedef struct {
>  */
> unsigned texture_index;
>  
> -   /** The size of the texture array or 0 if it's not an array */
> -   unsigned texture_array_size;
> -
> /** The texture deref
>  *
>  * If this is null, use texture_index instead.
> diff --git a/src/compiler/nir/nir_clone.c
> b/src/compiler/nir/nir_clone.c
> index a0ba8f7..bcd87f0 100644
> --- a/src/compiler/nir/nir_clone.c
> +++ b/src/compiler/nir/nir_clone.c
> @@ -420,7 +420,6 @@ clone_tex(clone_state *state, const nir_tex_instr
> *tex)
> ntex->texture_index = tex->texture_index;
> if (tex->texture)
>    ntex->texture = clone_deref_var(state, tex->texture, 
> >instr);
> -   ntex->texture_array_size = tex->texture_array_size;
>  
> ntex->sampler_index = tex->sampler_index;
> if (tex->sampler)
> diff --git a/src/compiler/nir/nir_instr_set.c
> b/src/compiler/nir/nir_instr_set.c
> index 9cb9ed4..5f9cd93 100644
> --- a/src/compiler/nir/nir_instr_set.c
> +++ b/src/compiler/nir/nir_instr_set.c
> @@ -158,7 +158,6 @@ hash_tex(uint32_t hash, const nir_tex_instr
> *instr)
> unsigned component = instr->component;
> hash = HASH(hash, component);
> hash = HASH(hash, instr->texture_index);
> -   hash = HASH(hash, instr->texture_array_size);
> hash = HASH(hash, instr->sampler_index);
>  
> assert(!instr->texture && !instr->sampler);
> @@ -312,7 +311,6 @@ nir_instrs_equal(const nir_instr *instr1, const
> nir_instr *instr2)
>    tex1->is_new_style_shadow != tex2->is_new_style_shadow ||
>    tex1->component != tex2->component ||
>   tex1->texture_index != tex2->texture_index ||
> - tex1->texture_array_size != tex2->texture_array_size ||
>   tex1->sampler_index != tex2->sampler_index) {
>   return false;
>    }
> diff --git a/src/compiler/nir/nir_lower_samplers.c
> b/src/compiler/nir/nir_lower_samplers.c
> index 9debfb2..e789ce0 100644
> --- a/src/compiler/nir/nir_lower_samplers.c
> +++ b/src/compiler/nir/nir_lower_samplers.c
> @@ -136,8 +136,6 @@ lower_sampler(nir_tex_instr *instr, const struct
> gl_shader_program *shader_progr
>    nir_instr_rewrite_src(>instr,
>  >src[instr->num_srcs - 1].src,
>  nir_src_for_ssa(indirect));
> -
> -  instr->texture_array_size = array_elements;
> }
>  
> if (location > shader_program->data->NumUniformStorage - 1 ||
> diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
> b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
> index 8846c2e..8aeaad2 100644
> 

[Mesa-dev] [PATCH] android: radeonsi: fix sid_table.h generated header include path

2017-02-07 Thread Mauro Rossi
generated-sources-dir-for macro replaces intermediates-dir-for
and LOCAL_MODULE_CLASS is defined as required by new macro,
in order to avoid the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_debug.c:29:10: fatal error: 
'sid_tables.h' file not found
 ^
1 error generated.
---
 src/gallium/drivers/radeonsi/Android.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/Android.mk 
b/src/gallium/drivers/radeonsi/Android.mk
index d8bc990..d1e323a 100644
--- a/src/gallium/drivers/radeonsi/Android.mk
+++ b/src/gallium/drivers/radeonsi/Android.mk
@@ -32,9 +32,11 @@ LOCAL_SRC_FILES := $(C_SOURCES)
 
 LOCAL_CFLAGS += -DFORCE_BUILD_AMDGPU   # instructs LLVM to declare 
LLVMInitializeAMDGPU* functions
 
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/amd/common \
-   $(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_amd_common)/common
+   $(call 
generated-sources-dir-for,STATIC_LIBRARIES,libmesa_amd_common,,)/common
 
 LOCAL_SHARED_LIBRARIES := libdrm_radeon
 LOCAL_MODULE := libmesa_pipe_radeonsi
-- 
2.9.3

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


Re: [Mesa-dev] [PATCH 1/2] i965: Make assign_common_binding_table_offsets return void

2017-02-07 Thread Iago Toral
This patch is missing to actually change the implementation in
brw_shader.cpp to not return a uint32_t result.

With that fixed, this patch is:
Reviewed-by: Iago Toral Quiroga 

On Tue, 2017-02-07 at 15:03 -0800, Jason Ekstrand wrote:
> It doesn't really matter what order the binding table entries are in
> so
> there's no real utility to returning the final offset from
> assign_common_binding_table_offsets.  The only functional change in
> this
> patch is that framebuffer fetch surfaces are now right after render
> targets rather than at the end.
> ---
>  src/mesa/drivers/dri/i965/brw_shader.h | 2 +-
>  src/mesa/drivers/dri/i965/brw_wm.c | 7 +++
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.h
> b/src/mesa/drivers/dri/i965/brw_shader.h
> index 60f498f..e59e531 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.h
> +++ b/src/mesa/drivers/dri/i965/brw_shader.h
> @@ -270,7 +270,7 @@ struct brw_gs_compile
> unsigned control_data_header_size_bits;
>  };
>  
> -uint32_t
> +void
>  brw_assign_common_binding_table_offsets(const struct gen_device_info
> *devinfo,
>  const struct gl_program
> *prog,
>  struct brw_stage_prog_data
> *stage_prog_data,
> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c
> b/src/mesa/drivers/dri/i965/brw_wm.c
> index a774720..f860fdf 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm.c
> @@ -55,15 +55,14 @@ assign_fs_binding_table_offsets(const struct
> gen_device_info *devinfo,
> prog_data->binding_table.render_target_start =
> next_binding_table_offset;
> next_binding_table_offset += MAX2(key->nr_color_regions, 1);
>  
> -   next_binding_table_offset =
> -  brw_assign_common_binding_table_offsets(devinfo, prog,
> _data->base,
> -  next_binding_table_off
> set);
> -
> if (prog->nir->info->outputs_read && !key->coherent_fb_fetch) {
>    prog_data->binding_table.render_target_read_start =
>   next_binding_table_offset;
>    next_binding_table_offset += key->nr_color_regions;
> }
> +
> +   brw_assign_common_binding_table_offsets(devinfo, prog,
> _data->base,
> +   next_binding_table_offset
> );
>  }
>  
>  static void
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH V2 1/2] mesa: use PRId64/PRIu64 when printing 64-bit ints

2017-02-07 Thread Iago Toral
Both patches are:

Reviewed-by: Iago Toral Quiroga 

On Wed, 2017-02-08 at 12:35 +1100, Timothy Arceri wrote:
> V2: actually use PRIu64
> ---
>  src/mesa/main/uniform_query.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/main/uniform_query.cpp
> b/src/mesa/main/uniform_query.cpp
> index 418cfc9..9da53a7 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -563,10 +563,10 @@ log_uniform(const void *values, enum
> glsl_base_type basicType,
>    printf("%d ", v[i].i);
>    break;
>    case GLSL_TYPE_UINT64:
> - printf("%lu ", *(uint64_t* )[i * 2].u);
> + printf("%" PRIu64 " ", *(uint64_t* )[i * 2].u);
>   break;
>    case GLSL_TYPE_INT64:
> - printf("%ld ", *(int64_t* )[i * 2].u);
> + printf("%" PRId64 " ", *(int64_t* )[i * 2].u);
>   break;
>    case GLSL_TYPE_FLOAT:
>    printf("%g ", v[i].f);
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 97967] glsl/tests/cache-test regression

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

Timothy Arceri  changed:

   What|Removed |Added

 Attachment #129405|0   |1
is obsolete||

--- Comment #18 from Timothy Arceri  ---
Created attachment 129406
  --> https://bugs.freedesktop.org/attachment.cgi?id=129406=edit
Possible fix

Note to self, test patch *then* post.

Please try this one.

-- 
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 97967] glsl/tests/cache-test regression

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

Timothy Arceri  changed:

   What|Removed |Added

 Attachment #129404|0   |1
is obsolete||

--- Comment #17 from Timothy Arceri  ---
Created attachment 129405
  --> https://bugs.freedesktop.org/attachment.cgi?id=129405=edit
Possible fix

Please try this one instead

-- 
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 97967] glsl/tests/cache-test regression

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

--- Comment #16 from Timothy Arceri  ---
Created attachment 129404
  --> https://bugs.freedesktop.org/attachment.cgi?id=129404=edit
Possible fix

Does this patch help?

-- 
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] EGL/Android: Add EGL_EXT_buffer_age extension

2017-02-07 Thread Xiaosong Wei
This patch implements the EGL_EXT_buffer_age extension for Android.
https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_buffer_age.txt
---
 src/egl/drivers/dri2/egl_dri2.h |  9 ++
 src/egl/drivers/dri2/platform_android.c | 51 -
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index f3d09dc..992e5b3 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -295,6 +295,15 @@ struct dri2_egl_surface
 
/* EGL-owned buffers */
__DRIbuffer   *local_buffers[__DRI_BUFFER_COUNT];
+
+   /* Used to record all the buffers created by ANativeWindow and their ages.
+* Usually Android uses at most triple buffers in ANativeWindow
+* so hardcode the number of color_buffers to 3.
+*/
+   struct {
+  struct ANativeWindowBuffer *buffer;
+  int age;
+   } color_buffers[3], *back;
 #endif
 
 #if defined(HAVE_SURFACELESS_PLATFORM)
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 79fe81a..109b419 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -165,6 +165,33 @@ droid_window_dequeue_buffer(struct dri2_egl_surface 
*dri2_surf)
dri2_surf->window->lockBuffer(dri2_surf->window, dri2_surf->buffer);
 #endif
 
+   /* Record all the buffers created by ANativeWindow and update back buffer
+* for updating buffer's age in swap_buffers.
+*/
+   EGLBoolean updated = EGL_FALSE;
+   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
+  if (!dri2_surf->color_buffers[i].buffer) {
+ dri2_surf->color_buffers[i].buffer = dri2_surf->buffer;
+  }
+  if (dri2_surf->color_buffers[i].buffer == dri2_surf->buffer) {
+ dri2_surf->back = _surf->color_buffers[i];
+ updated = EGL_TRUE;
+ break;
+  }
+   }
+
+   if (!updated) {
+  /* In case of all the buffers were recreated by ANativeWindow, reset
+   * the color_buffers
+   */
+  for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
+ dri2_surf->color_buffers[i].buffer = NULL;
+ dri2_surf->color_buffers[i].age = 0;
+  }
+  dri2_surf->color_buffers[0].buffer = dri2_surf->buffer;
+  dri2_surf->back = _surf->color_buffers[0];
+   }
+
return EGL_TRUE;
 }
 
@@ -201,6 +228,7 @@ droid_window_enqueue_buffer(_EGLDisplay *disp, struct 
dri2_egl_surface *dri2_sur
 
dri2_surf->buffer->common.decRef(_surf->buffer->common);
dri2_surf->buffer = NULL;
+   dri2_surf->back = NULL;
 
mtx_lock(>Mutex);
 
@@ -547,6 +575,20 @@ droid_image_get_buffers(__DRIdrawable *driDrawable,
return 1;
 }
 
+static EGLint
+droid_query_buffer_age(_EGLDriver *drv,
+  _EGLDisplay *disp, _EGLSurface *surface)
+{
+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
+
+   if (update_buffers(dri2_surf) < 0) {
+  _eglError(EGL_BAD_ALLOC, "droid_query_buffer_age");
+  return 0;
+   }
+
+   return dri2_surf->back->age;
+}
+
 static EGLBoolean
 droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
 {
@@ -556,6 +598,12 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *draw)
if (dri2_surf->base.Type != EGL_WINDOW_BIT)
   return EGL_TRUE;
 
+   for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
+  if (dri2_surf->color_buffers[i].age > 0)
+ dri2_surf->color_buffers[i].age++;
+   }
+   dri2_surf->back->age = 1;
+
dri2_flush_drawable_for_swapbuffers(disp, draw);
 
if (dri2_surf->buffer)
@@ -989,7 +1037,7 @@ static struct dri2_egl_display_vtbl droid_display_vtbl = {
.swap_buffers_region = dri2_fallback_swap_buffers_region,
.post_sub_buffer = dri2_fallback_post_sub_buffer,
.copy_buffers = dri2_fallback_copy_buffers,
-   .query_buffer_age = dri2_fallback_query_buffer_age,
+   .query_buffer_age = droid_query_buffer_age,
.query_surface = droid_query_surface,
.create_wayland_buffer_from_image = 
dri2_fallback_create_wayland_buffer_from_image,
.get_sync_values = dri2_fallback_get_sync_values,
@@ -1080,6 +1128,7 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
dpy->Extensions.ANDROID_framebuffer_target = EGL_TRUE;
dpy->Extensions.ANDROID_image_native_buffer = EGL_TRUE;
dpy->Extensions.ANDROID_recordable = EGL_TRUE;
+   dpy->Extensions.EXT_buffer_age = EGL_TRUE;
 
/* Fill vtbl last to prevent accidentally calling virtual function during
 * initialization.
-- 
1.9.1

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


[Mesa-dev] [Bug 99010] --disable-gallium-llvm no longer recognized

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

--- Comment #20 from Jonathan Gray  ---
(In reply to Emil Velikov from comment #19)
> Gents do give this series a try
> 
> https://patchwork.freedesktop.org/series/19269/

With the patch series I can build Mesa without setting LLVM_CONFIG=no in the
environment again on OpenBSD/amd64.

To prevent Mesa from using llvm if found I still have to use
--disable-gallium-llvm --disable-llvm-shared-libs

Building with just --disable-gallium-llvm gives

configure: error: Could not find llvm shared libraries:
Please make sure you have built llvm with the --enable-shared option
and that your llvm libraries are installed in /usr/local/lib
If you have installed your llvm libraries to a different directory you
can use the --with-llvm-prefix= configure flag to specify this
directory.
NOTE: Mesa is attempting to use llvm shared libraries by default.
If you do not want to build with llvm shared libraries and instead want
to
use llvm static libraries then add --disable-llvm-shared-libs to your
configure
invocation and rebuild.

running autogen/configure with:

export AUTOMAKE_VERSION=1.12
export AUTOCONF_VERSION=2.69
export ACLOCAL="aclocal -I /usr/X11R6/share/aclocal"
export PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig
export X11BASE=/usr/X11R6
if [[ $(uname -p) == "i386" ]]; then
export USER_CFLAGS="-march=i586"
export USER_CXXFLAGS="-march=i586"
fi
./autogen.sh \
--with-gallium-drivers=r300,r600,swrast \
--with-dri-drivers=i915,i965,r200,radeon,swrast \
--disable-silent-rules \
--disable-gallium-llvm \
--disable-llvm-shared-libs \
--disable-glx-tls \
--enable-gles1 --enable-gles2 \
--enable-shared-glapi \
--enable-osmesa \
--enable-debug \
--enable-gbm \
--enable-texture-float \
--with-egl-platforms="x11,drm" \
--prefix=${X11BASE} \
--with-dri-driverdir=${X11BASE}/lib/modules/dri \
--with-dri-searchpath=${X11BASE}/lib/modules/dri

This is with some additional patches, including patching out the requirement of
llvm for r300 to mimic building on a system with no llvm.

The OpenBSD ports LLVM package installs static libraries for each component,
not a shared library for each or a single shared library for everything which
seems to be the approach taken by linux distributions?

-- 
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 35/40] util/disk_cache: allow drivers to pass a directory structure

2017-02-07 Thread Aaron Watry
On Tue, Feb 7, 2017 at 3:43 PM, Timothy Arceri 
wrote:

> On Wed, 8 Feb 2017 08:29:29 +1100
> Timothy Arceri  wrote:
>
> > On Tue, 7 Feb 2017 11:40:12 -0600
> > Aaron Watry  wrote:
> >
> > > On Mon, Feb 6, 2017 at 9:42 PM, Timothy Arceri
> > >  wrote:
> > >
> > > > In order to avoid costly fallback recompiles when cache items are
> > > > created with an old version of Mesa or for a different gpu on the
> > > > same system we want to create directories that look like this:
> > > >
> > > > ./{MESA_VERSION_STRING}/{GPU_ID}
> > > >
> > > > For llvm based drivers we will probably want an additional
> > > > {LLVM_VERSION} folder although it looks like there is currently
> > > > no support for querying this at runtime.
> > > > ---
> > > >  src/compiler/glsl/tests/cache_test.c | 20 ++--
> > > >  src/util/disk_cache.c| 29
> > > > + src/util/disk_cache.h
> > > > |  4 ++-- 3 files changed, 37 insertions(+), 16 deletions(-)
> > > >
> > > > diff --git a/src/compiler/glsl/tests/cache_test.c
> > > > b/src/compiler/glsl/tests/cache_test.c
> > > > index 8547141..ba56441 100644
> > > > --- a/src/compiler/glsl/tests/cache_test.c
> > > > +++ b/src/compiler/glsl/tests/cache_test.c
> > > > @@ -126,7 +126,7 @@ test_disk_cache_create(void)
> > > >  * MESA_GLSL_CACHE_DISABLE set, that disk_cache_create returns
> > > > NULL. */
> > > > setenv("MESA_GLSL_CACHE_DISABLE", "1", 1);
> > > > -   cache = disk_cache_create();
> > > > +   cache = disk_cache_create("test", "make_check");
> > > > expect_null(cache, "disk_cache_create with
> > > > MESA_GLSL_CACHE_DISABLE set");
> > > >
> > > > unsetenv("MESA_GLSL_CACHE_DISABLE");
> > > > @@ -137,19 +137,19 @@ test_disk_cache_create(void)
> > > > unsetenv("MESA_GLSL_CACHE_DIR");
> > > > unsetenv("XDG_CACHE_HOME");
> > > >
> > > > -   cache = disk_cache_create();
> > > > +   cache = disk_cache_create("test", "make_check");
> > > > expect_non_null(cache, "disk_cache_create with no environment
> > > > variables");
> > > >
> > > > disk_cache_destroy(cache);
> > > >
> > > > /* Test with XDG_CACHE_HOME set */
> > > > setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1);
> > > > -   cache = disk_cache_create();
> > > > +   cache = disk_cache_create("test", "make_check");
> > > > expect_null(cache, "disk_cache_create with XDG_CACHE_HOME set
> > > > with" "a non-existing parent directory");
> > > >
> > > > mkdir(CACHE_TEST_TMP, 0755);
> > > > -   cache = disk_cache_create();
> > > > +   cache = disk_cache_create("test", "make_check");
> > > > expect_non_null(cache, "disk_cache_create with XDG_CACHE_HOME
> > > > set");
> > > >
> > > > disk_cache_destroy(cache);
> > > > @@ -159,12 +159,12 @@ test_disk_cache_create(void)
> > > > expect_equal(err, 0, "Removing " CACHE_TEST_TMP);
> > > >
> > > > setenv("MESA_GLSL_CACHE_DIR", CACHE_TEST_TMP
> > > > "/mesa-glsl-cache-dir", 1);
> > > > -   cache = disk_cache_create();
> > > > +   cache = disk_cache_create("test", "make_check");
> > > > expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR
> > > > set with"
> > > > "a non-existing parent directory");
> > > >
> > > > mkdir(CACHE_TEST_TMP, 0755);
> > > > -   cache = disk_cache_create();
> > > > +   cache = disk_cache_create("test", "make_check");
> > > > expect_non_null(cache, "disk_cache_create with
> > > > MESA_GLSL_CACHE_DIR set");
> > > >
> > > > disk_cache_destroy(cache);
> > > > @@ -203,7 +203,7 @@ test_put_and_get(void)
> > > > uint8_t one_KB_key[20], one_MB_key[20];
> > > > int count;
> > > >
> > > > -   cache = disk_cache_create();
> > > > +   cache = disk_cache_create("test", "make_check");
> > > >
> > > > _mesa_sha1_compute(blob, sizeof(blob), blob_key);
> > > >
> > > > @@ -235,7 +235,7 @@ test_put_and_get(void)
> > > > disk_cache_destroy(cache);
> > > >
> > > > setenv("MESA_GLSL_CACHE_MAX_SIZE", "1K", 1);
> > > > -   cache = disk_cache_create();
> > > > +   cache = disk_cache_create("test", "make_check");
> > > >
> > > > one_KB = calloc(1, 1024);
> > > >
> > > > @@ -287,7 +287,7 @@ test_put_and_get(void)
> > > > disk_cache_destroy(cache);
> > > >
> > > > setenv("MESA_GLSL_CACHE_MAX_SIZE", "1M", 1);
> > > > -   cache = disk_cache_create();
> > > > +   cache = disk_cache_create("test", "make_check");
> > > >
> > > > disk_cache_put(cache, blob_key, blob, sizeof(blob));
> > > > disk_cache_put(cache, string_key, string, sizeof(string));
> > > > @@ -343,7 +343,7 @@ test_put_key_and_get_key(void)
> > > >  { 0,  1, 42, 43, 44, 45, 46, 47, 48, 49,
> > > >   50, 55, 52, 53, 54, 55, 56, 57, 58, 59};
> > > >
> > > > -   cache = disk_cache_create();
> > > > +   cache = disk_cache_create("test", "make_check");
> > > >
> > > > /* First test that disk_cache_has_key 

Re: [Mesa-dev] [PATCH] configure: add blurb about what the LIBDRM_*_REQUIRED stuff means

2017-02-07 Thread Chad Versace
On Tue 07 Feb 2017, Ilia Mirkin wrote:
> Signed-off-by: Ilia Mirkin 
> Reviewed-by: Emil Velikov 
> ---
>  configure.ac | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)

Reviewed-by: Chad Versace 

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


Re: [Mesa-dev] [PATCH] mesa/uniform: fix strict aliasing issues with int64 code.

2017-02-07 Thread Timothy Arceri
On Wed, 2017-02-08 at 11:21 +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> This fixes these like the double version does.
> 
> Signed-off-by: Dave Airlie 
> ---
>  src/mesa/main/uniform_query.cpp | 38 ++-
> ---
>  1 file changed, 26 insertions(+), 12 deletions(-)
> 
> diff --git a/src/mesa/main/uniform_query.cpp
> b/src/mesa/main/uniform_query.cpp
> index 418cfc9..f23da43 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -506,20 +506,28 @@ _mesa_get_uniform(struct gl_context *ctx,
> GLuint program, GLint location,
>  case GLSL_TYPE_INT64:
>  case GLSL_TYPE_UINT64:
> switch (uni->type->base_type) {
> -   case GLSL_TYPE_UINT:
> -  *(int64_t *)[didx].u = (int64_t) src[sidx].u;
> +   case GLSL_TYPE_UINT: {
> +   uint64_t tmp = src[sidx].u;

Please remove the tab here. Otherwise this and the st patch are:

Reviewed-by: Timothy Arceri 

> +  memcpy([didx].u, , sizeof(tmp));
>    break;
> +   }
> case GLSL_TYPE_INT:
> case GLSL_TYPE_SAMPLER:
> -   case GLSL_TYPE_IMAGE:
> -  *(int64_t *)[didx].u = (int64_t) src[sidx].i;
> +   case GLSL_TYPE_IMAGE: {
> +  int64_t tmp = src[sidx].i;
> +  memcpy([didx].u, , sizeof(tmp));
>    break;
> -   case GLSL_TYPE_BOOL:
> -  *(int64_t *)[didx].u = src[sidx].i ? 1.0f :
> 0.0f;
> +   }
> +   case GLSL_TYPE_BOOL: {
> +  int64_t tmp = src[sidx].i ? 1.0f : 0.0f;
> +  memcpy([didx].u, , sizeof(tmp));
>    break;
> -   case GLSL_TYPE_FLOAT:
> -  *(int64_t *)[didx].u = (int64_t) src[sidx].f;
> +   }
> +   case GLSL_TYPE_FLOAT: {
> +  int64_t tmp = src[sidx].f;
> +  memcpy([didx].u, , sizeof(tmp));
>    break;
> +   }
> default:
>    assert(!"Should not get here.");
>    break;
> @@ -562,12 +570,18 @@ log_uniform(const void *values, enum
> glsl_base_type basicType,
>    case GLSL_TYPE_INT:
>    printf("%d ", v[i].i);
>    break;
> -  case GLSL_TYPE_UINT64:
> - printf("%lu ", *(uint64_t* )[i * 2].u);
> +  case GLSL_TYPE_UINT64: {
> + uint64_t tmp;
> + memcpy(, [i * 2].u, sizeof(tmp));
> + printf("%lu ", tmp);
>   break;
> -  case GLSL_TYPE_INT64:
> - printf("%ld ", *(int64_t* )[i * 2].u);
> +  }
> +  case GLSL_TYPE_INT64: {
> + int64_t tmp;
> + memcpy(, [i * 2].u, sizeof(tmp));
> + printf("%ld ", tmp);
>   break;
> +  }
>    case GLSL_TYPE_FLOAT:
>    printf("%g ", v[i].f);
>    break;
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH V2 1/2] mesa: use PRId64/PRIu64 when printing 64-bit ints

2017-02-07 Thread Timothy Arceri
V2: actually use PRIu64
---
 src/mesa/main/uniform_query.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 418cfc9..9da53a7 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -563,10 +563,10 @@ log_uniform(const void *values, enum glsl_base_type 
basicType,
 printf("%d ", v[i].i);
 break;
   case GLSL_TYPE_UINT64:
- printf("%lu ", *(uint64_t* )[i * 2].u);
+ printf("%" PRIu64 " ", *(uint64_t* )[i * 2].u);
  break;
   case GLSL_TYPE_INT64:
- printf("%ld ", *(int64_t* )[i * 2].u);
+ printf("%" PRId64 " ", *(int64_t* )[i * 2].u);
  break;
   case GLSL_TYPE_FLOAT:
 printf("%g ", v[i].f);
-- 
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] mesa: fix some strict-aliasing issues with int64

2017-02-07 Thread Timothy Arceri
---
 src/mesa/main/uniform_query.cpp | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 9da53a7..98711df 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -562,12 +562,18 @@ log_uniform(const void *values, enum glsl_base_type 
basicType,
   case GLSL_TYPE_INT:
 printf("%d ", v[i].i);
 break;
-  case GLSL_TYPE_UINT64:
- printf("%" PRIu64 " ", *(uint64_t* )[i * 2].u);
+  case GLSL_TYPE_UINT64: {
+ uint64_t tmp;
+ memcpy(, [i * 2].u, sizeof(tmp));
+ printf("%" PRIu64 " ", tmp);
  break;
-  case GLSL_TYPE_INT64:
- printf("%" PRId64 " ", *(int64_t* )[i * 2].u);
+  }
+  case GLSL_TYPE_INT64: {
+ int64_t tmp;
+ memcpy(, [i * 2].u, sizeof(tmp));
+ printf("%" PRId64 " ", tmp);
  break;
+  }
   case GLSL_TYPE_FLOAT:
 printf("%g ", v[i].f);
 break;
-- 
2.9.3

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


[Mesa-dev] [PATCH] mesa/st: fix strict aliasing issue in int64 code.

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

This fixes the int64 code same as the double code.

Signed-off-by: Dave Airlie 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 77a51d5..116f30c 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3363,15 +3363,13 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir)
case GLSL_TYPE_INT64:
   gl_type = GL_INT64_ARB;
   for (i = 0; i < ir->type->vector_elements; i++) {
- values[i * 2].i = *(uint32_t *)>value.d[i];
- values[i * 2 + 1].i = *(((uint32_t *)>value.d[i]) + 1);
+ memcpy([i * 2], >value.d[i], sizeof(int64_t));
   }
   break;
case GLSL_TYPE_UINT64:
   gl_type = GL_UNSIGNED_INT64_ARB;
   for (i = 0; i < ir->type->vector_elements; i++) {
- values[i * 2].i = *(uint32_t *)>value.d[i];
- values[i * 2 + 1].i = *(((uint32_t *)>value.d[i]) + 1);
+ memcpy([i * 2], >value.d[i], sizeof(uint64_t));
   }
   break;
case GLSL_TYPE_UINT:
-- 
2.7.4

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


[Mesa-dev] [PATCH] mesa/uniform: fix strict aliasing issues with int64 code.

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

This fixes these like the double version does.

Signed-off-by: Dave Airlie 
---
 src/mesa/main/uniform_query.cpp | 38 ++
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 418cfc9..f23da43 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -506,20 +506,28 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, 
GLint location,
 case GLSL_TYPE_INT64:
 case GLSL_TYPE_UINT64:
switch (uni->type->base_type) {
-   case GLSL_TYPE_UINT:
-  *(int64_t *)[didx].u = (int64_t) src[sidx].u;
+   case GLSL_TYPE_UINT: {
+ uint64_t tmp = src[sidx].u;
+  memcpy([didx].u, , sizeof(tmp));
   break;
+   }
case GLSL_TYPE_INT:
case GLSL_TYPE_SAMPLER:
-   case GLSL_TYPE_IMAGE:
-  *(int64_t *)[didx].u = (int64_t) src[sidx].i;
+   case GLSL_TYPE_IMAGE: {
+  int64_t tmp = src[sidx].i;
+  memcpy([didx].u, , sizeof(tmp));
   break;
-   case GLSL_TYPE_BOOL:
-  *(int64_t *)[didx].u = src[sidx].i ? 1.0f : 0.0f;
+   }
+   case GLSL_TYPE_BOOL: {
+  int64_t tmp = src[sidx].i ? 1.0f : 0.0f;
+  memcpy([didx].u, , sizeof(tmp));
   break;
-   case GLSL_TYPE_FLOAT:
-  *(int64_t *)[didx].u = (int64_t) src[sidx].f;
+   }
+   case GLSL_TYPE_FLOAT: {
+  int64_t tmp = src[sidx].f;
+  memcpy([didx].u, , sizeof(tmp));
   break;
+   }
default:
   assert(!"Should not get here.");
   break;
@@ -562,12 +570,18 @@ log_uniform(const void *values, enum glsl_base_type 
basicType,
   case GLSL_TYPE_INT:
 printf("%d ", v[i].i);
 break;
-  case GLSL_TYPE_UINT64:
- printf("%lu ", *(uint64_t* )[i * 2].u);
+  case GLSL_TYPE_UINT64: {
+ uint64_t tmp;
+ memcpy(, [i * 2].u, sizeof(tmp));
+ printf("%lu ", tmp);
  break;
-  case GLSL_TYPE_INT64:
- printf("%ld ", *(int64_t* )[i * 2].u);
+  }
+  case GLSL_TYPE_INT64: {
+ int64_t tmp;
+ memcpy(, [i * 2].u, sizeof(tmp));
+ printf("%ld ", tmp);
  break;
+  }
   case GLSL_TYPE_FLOAT:
 printf("%g ", v[i].f);
 break;
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 15/17] configure.ac: remove dummy radeon_gallium_llvm_check()

2017-02-07 Thread Tobias Droste
Reviewed-by: Tobias Droste 

Am Dienstag, 7. Februar 2017, 22:44:57 CET schrieb Emil Velikov:
> From: Emil Velikov 
> 
> The extra function brings no added benefit as of earlier commit which
> made llvm_require_version (as called by radeon_llvm_check) require LLVM
> (--enable-gallium-llvm).
> 
> Fixes: 5f966a96af7 "configure.ac: Mandate --enable-gallium-llvm when
> checking LLVM version"
> Cc: Tobias Droste 
> Signed-off-by: Emil Velikov 
> ---
> Strictly speaking it's not a fix, but a cleanup. I'm fine with keeping
> it separate or merging it in - let me know your preference.
> ---
>  configure.ac | 11 ++-
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 22758d9702..d0437a71aa 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2213,13 +2213,6 @@ require_basic_egl() {
>  esac
>  }
> 
> -radeon_gallium_llvm_check() {
> -if test "x$enable_gallium_llvm" != "xyes"; then
> -AC_MSG_ERROR([--enable-gallium-llvm is required when building $2])
> -fi
> -radeon_llvm_check $*
> -}
> -
>  swr_require_cxx_feature_flags() {
>  feature_name="$1"
>  preprocessor_test="$2"
> @@ -2284,7 +2277,7 @@ if test -n "$with_gallium_drivers"; then
>  PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED
> libdrm_radeon >= $LIBDRM_RADEON_REQUIRED]) require_libdrm "r600"
>  if test "x$enable_opencl" = xyes; then
> -radeon_gallium_llvm_check $LLVM_REQUIRED_R600 "r600"
> +radeon_llvm_check $LLVM_REQUIRED_R600 "r600"
> 
>  llvm_add_component "asmparser" "r600"
>  llvm_add_component "bitreader" "r600"
> @@ -2295,7 +2288,7 @@ if test -n "$with_gallium_drivers"; then
>  PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED
> libdrm_radeon >= $LIBDRM_RADEON_REQUIRED]) PKG_CHECK_MODULES([AMDGPU],
> [libdrm >= $LIBDRM_AMDGPU_REQUIRED libdrm_amdgpu >=
> $LIBDRM_AMDGPU_REQUIRED]) require_libdrm "radeonsi"
> -radeon_gallium_llvm_check $LLVM_REQUIRED_RADEONSI "radeonsi"
> +radeon_llvm_check $LLVM_REQUIRED_RADEONSI "radeonsi"
>  require_basic_egl "radeonsi"
>  ;;
>  xnouveau)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 13/17] configure.ac: disable enable_gallium_llvm in the !x86 case

2017-02-07 Thread Tobias Droste
Reviewed-by: Tobias Droste 

Am Dienstag, 7. Februar 2017, 22:44:55 CET schrieb Emil Velikov:
> From: Emil Velikov 
> 
> Already implicitly handled throughout, but keep it clear and disable
> gallium-llvm. This change should be a no-op.
> 
> Cc: Tobias Droste 
> Signed-off-by: Emil Velikov 
> ---
>  configure.ac | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 469a09e286..a781a19a3c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1727,6 +1727,7 @@ AC_ARG_ENABLE([gallium-llvm],
>  if test "x$enable_gallium_llvm" = xauto; then
>  case "$host_cpu" in
>  i*86|x86_64|amd64) enable_gallium_llvm=yes;;
> +*) enable_gallium_llvm=no;;
>  esac
>  fi
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 07/17] configure.ac: Rework MESA_LLVM and LLVM detection

2017-02-07 Thread Tobias Droste
Reviewed-by: Tobias Droste 

Am Dienstag, 7. Februar 2017, 22:44:49 CET schrieb Emil Velikov:
> From: Tobias Droste 
> 
> Set FOUND_LLVM only when LLVM is present (checking for exact version/etc
> is deferred) and use enable-gallium-llvm to indicate the global LLVM
> status.
> 
> Renaming the latter is not appropriate for stable patches, so we'll
> address it with a later commit.
> 
> Loosely based on work by Tobias.
> 
> Cc: Dave Airlie 
> CC: Tobias Droste 
> Cc: "17.0" 
> Reviewed-by: Emil Velikov 
> ---
>  configure.ac | 24 +---
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 88abc716c1..ff6f602527 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -953,9 +953,9 @@ llvm_set_environment_variables() {
>  fi
> 
>  DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT
> -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH" -MESA_LLVM=1
> +FOUND_LLVM=yes
>  else
> -MESA_LLVM=0
> +FOUND_LLVM=no
>  LLVM_VERSION_INT=0
>  fi
>  }
> @@ -967,9 +967,8 @@ require_llvm() {
>  }
> 
>  llvm_require_version() {
> -if test "x$MESA_LLVM" = x0; then
> -AC_MSG_ERROR([LLVM $1 or newer is required for $2])
> -return
> +if test "x$FOUND_LLVM" = xno; then
> +AC_MSG_ERROR([LLVM is required for $2])
>  fi
>  require_llvm $2
> 
> @@ -1728,6 +1727,10 @@ fi
>  dnl
>  dnl Gallium LLVM
>  dnl
> +dnl With follow-up commits we'll rework --enable-gallium-llvm to
> --enable-llvm +dnl Since that is too invasive to stable, do the more
> conservative thing for now +dnl and consider it as a global LLVM toggle.
> +dnl
>  AC_ARG_ENABLE([gallium-llvm],
>  [AS_HELP_STRING([--enable-gallium-llvm],
>  [build gallium LLVM support @<:@default=enabled on
> x86/x86_64@:>@])], @@ -2327,7 +2330,7 @@ if test -n
> "$with_gallium_drivers"; then
>  ;;
>  xswrast)
>  HAVE_GALLIUM_SOFTPIPE=yes
> -if test "x$MESA_LLVM" = x1 && test "x$enable_gallium_llvm" ==
> "xyes";  then +if test "x$enable_gallium_llvm" = xyes; then
>  HAVE_GALLIUM_LLVMPIPE=yes
>  fi
>  ;;
> @@ -2391,7 +2394,7 @@ dnl by calling llvm-config --libs
> ${DRIVER_LLVM_COMPONENTS}, but dnl this was causing the same libraries to
> be appear multiple times dnl in LLVM_LIBS.
> 
> -if test "x$MESA_LLVM" != x0; then
> +if test "x$enable_gallium_llvm" = xyes; then
> 
>  if ! $LLVM_CONFIG --libs ${LLVM_COMPONENTS} >/dev/null; then
> AC_MSG_ERROR([Calling ${LLVM_CONFIG} failed])
> @@ -2492,8 +2495,7 @@ AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test
> "x$HAVE_GALLIUM_R300" = xyes -o \ AM_CONDITIONAL(NEED_WINSYS_XLIB, test
> "x$enable_glx" = xgallium-xlib) AM_CONDITIONAL(NEED_RADEON_LLVM, test
> x$NEED_RADEON_LLVM = xyes)
>  AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
> -AM_CONDITIONAL(HAVE_GALLIUM_LLVM, test "x$MESA_LLVM" = x1 -a \
> -   "x$enable_gallium_llvm" = xyes)
> +AM_CONDITIONAL(HAVE_GALLIUM_LLVM, test "x$enable_gallium_llvm" = xyes)
>  AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes)
> 
>  AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
> @@ -2773,7 +2775,7 @@ else
>  fi
> 
>  echo ""
> -if test "x$MESA_LLVM" = x1; then
> +if test "x$enable_gallium_llvm" = xyes; then
>  echo "llvm:yes"
>  echo "llvm-config: $LLVM_CONFIG"
>  echo "llvm-version:$LLVM_VERSION"
> @@ -2820,7 +2822,7 @@ echo "CFLAGS:  $cflags"
>  echo "CXXFLAGS:$cxxflags"
>  echo "Macros:  $defines"
>  echo ""
> -if test "x$MESA_LLVM" = x1; then
> +if test "x$enable_gallium_llvm" = xyes; then
>  echo "LLVM_CFLAGS: $LLVM_CFLAGS"
>  echo "LLVM_CXXFLAGS:   $LLVM_CXXFLAGS"
>  echo "LLVM_CPPFLAGS:   $LLVM_CPPFLAGS"
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 06/17] configure.ac: Remove artificial --enable-gallium-llvm dependency

2017-02-07 Thread Tobias Droste
Does this cause problems if someone builds just intel classic drivers without 
LLVM installed?

I think without --disable-llvm you would get an error that LLVM is required 
for gallium even though nothing actually requires it in that configuration.

Or am I missing something?

I think you have to change:

if test "x$enable_gallium_llvm" == "xyes"; then
llvm_check_version_for $LLVM_REQUIRED_GALLIUM "gallium"
llvm_add_default_components "gallium"
fi

to

if test "x$enable_gallium_llvm" = "xyes" -a -n "$with_gallium_drivers"; then
llvm_check_version_for $LLVM_REQUIRED_GALLIUM "gallium"
llvm_add_default_components "gallium"
fi

Am Dienstag, 7. Februar 2017, 22:44:48 CET schrieb Emil Velikov:
> From: Emil Velikov 
> 
> ... of non-empty --with-gallium-drivers.
> 
> Since we effectively made --enable-gallium-llvm mean --enable-llvm with
> earlier commits, we need to remove the, now artificial, requirement.
> 
> Otherwise we'll error (as below) when building RADV.
> 
> configure: error: --enable-gallium-llvm is required when building radv
> 
> Cc: Dave Airlie 
> CC: Tobias Droste 
> Cc: "17.0" 
> Signed-off-by: Emil Velikov 
> ---
>  configure.ac | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 4098da7666..88abc716c1 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1734,9 +1734,6 @@ AC_ARG_ENABLE([gallium-llvm],
>  [enable_gallium_llvm="$enableval"],
>  [enable_gallium_llvm=auto])
> 
> -if test -z "$with_gallium_drivers"; then
> -enable_gallium_llvm=no
> -fi
>  if test "x$enable_gallium_llvm" = xauto; then
>  case "$host_cpu" in
>  i*86|x86_64|amd64) enable_gallium_llvm=yes;;
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 05/17] configure.ac: Mandate --enable-gallium-llvm when checking LLVM version

2017-02-07 Thread Tobias Droste
Small comment below. Either way:

Reviewed-by: Tobias Droste 

Am Dienstag, 7. Februar 2017, 22:44:47 CET schrieb Emil Velikov:
> From: Emil Velikov 
> 
> With this change we effectively require --enable-gallium-llvm when
> building RADV. This should be perfectly safe since the gallium radeonsi
> driver already explicitly requires it.
> 
> The "gallium" part in --enable-gallium-llvm is about to be removed soon
> (not in stable) but until then make sure that things can build.
> 
> To reflect the requirement (as opposed to check previously) rename
> llvm_check_version_for to llvm_require_version
> 
> Cc: Dave Airlie 
> CC: Tobias Droste 
> Cc: "17.0" 
> Signed-off-by: Emil Velikov 
> ---
>  configure.ac | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 525c8d2a91..4098da7666 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -966,11 +966,12 @@ require_llvm() {
>  fi
>  }
> 
> -llvm_check_version_for() {
> +llvm_require_version() {
>  if test "x$MESA_LLVM" = x0; then
>  AC_MSG_ERROR([LLVM $1 or newer is required for $2])
>  return
>  fi
> +require_llvm $2

Maybe just 'inline' the function here?

There are two callers left:

- SWR doesn't actually need it anymore, because it calls llvm_require_version 
(which now calls require_llvm)

- R300 could also just call llvm_require_version $LLVM_REQUIRED_GALLIUM

> 
>  llvm_target_version_major=`echo $1 | cut -d. -f1 | egrep -o
> '^[[0-9]]+'` llvm_target_version_minor=`echo $1 | cut -d. -f2 | egrep -o
> '^[[0-9]]+'` @@ -1011,7 +1012,7 @@ radeon_llvm_check() {
>  amdgpu_llvm_target_name='amdgpu'
>  fi
> 
> -llvm_check_version_for $*
> +llvm_require_version $*
> 
>  llvm_add_target $amdgpu_llvm_target_name $2
> 
> @@ -2023,7 +2024,7 @@ if test "x$enable_opencl" = xyes; then
> AC_MSG_ERROR([Clover requires libelf])
>  fi
> 
> -llvm_check_version_for $LLVM_REQUIRED_OPENCL "opencl"
> +llvm_require_version $LLVM_REQUIRED_OPENCL "opencl"
> 
>  llvm_add_default_components "opencl"
>  llvm_add_component "all-targets" "opencl"
> @@ -2334,8 +2335,7 @@ if test -n "$with_gallium_drivers"; then
>  fi
>  ;;
>  xswr)
> -llvm_check_version_for $LLVM_REQUIRED_SWR "swr"
> -require_llvm "swr"
> +llvm_require_version $LLVM_REQUIRED_SWR "swr"
> 
>  swr_require_cxx_feature_flags "C++11" "__cplusplus >= 201103L"
> \ ",-std=c++11" \
> @@ -2377,7 +2377,7 @@ if test -n "$with_gallium_drivers"; then
>  fi
> 
>  if test "x$enable_gallium_llvm" == "xyes"; then
> -llvm_check_version_for $LLVM_REQUIRED_GALLIUM "gallium"
> +llvm_require_version $LLVM_REQUIRED_GALLIUM "gallium"
>  llvm_add_default_components "gallium"
>  fi
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 98263] [radv] The Talos Principle fails to launch with "Fatal error: Cannot set display mode."

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

Michel Dänzer  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |INVALID

--- Comment #9 from Michel Dänzer  ---
(In reply to Rene Lindsay from comment #8)
> The "No DRI3 support" is only relevant when the desktop is running on Intel, 
> [...]

That's actually not true, even ignoring that DRI3 works fine with open source
drivers on non-Intel GPUs. The nvidia Xorg driver could support DRI3 (and the
Present extension), and then the Vulkan drivers for non-nVidia GPUs could at
least theoretically work with it.

Anyway, this report is about the Talos principle failing to start with the radv
driver because DRI3 is disabled, which is a configuration error, so resolving
as invalid again. Rene, please file your own report (or just post to the
mesa-dev mailing list) about the error messages.

-- 
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 77449] Tracker bug for all bugs related to Steam titles

2017-02-07 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=77449
Bug 77449 depends on bug 98263, which changed state.

Bug 98263 Summary: [radv] The Talos Principle fails to launch with "Fatal 
error: Cannot set display mode."
https://bugs.freedesktop.org/show_bug.cgi?id=98263

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |INVALID

-- 
You are receiving this mail because:
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] mesa: use PRId64/PRIu64 when printing 64-bit ints

2017-02-07 Thread Timothy Arceri
---
 src/mesa/main/uniform_query.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 418cfc9..575f1cb 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -563,10 +563,10 @@ log_uniform(const void *values, enum glsl_base_type 
basicType,
 printf("%d ", v[i].i);
 break;
   case GLSL_TYPE_UINT64:
- printf("%lu ", *(uint64_t* )[i * 2].u);
+ printf("%" PRId64 " ", *(uint64_t* )[i * 2].u);
  break;
   case GLSL_TYPE_INT64:
- printf("%ld ", *(int64_t* )[i * 2].u);
+ printf("%" PRId64 " ", *(int64_t* )[i * 2].u);
  break;
   case GLSL_TYPE_FLOAT:
 printf("%g ", v[i].f);
-- 
2.9.3

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


Re: [Mesa-dev] [PATCH 04/17] configure.ac: Rename the gallium_require_llvm helper

2017-02-07 Thread Tobias Droste
Reviewed-by: Tobias Droste 

Am Dienstag, 7. Februar 2017, 22:44:46 CET schrieb Emil Velikov:
> From: Emil Velikov 
> 
> Drop the gallium prefix since we're about it use it throughout the
> configure.
> 
> Note we do want to check for enable_gallium_llvm check since (as
> explicitly requested) the toggle should mean --enable-llvm. We cannot do
> the latter for stable so it will come with later patch.
> 
> Cc: Dave Airlie 
> CC: Tobias Droste 
> Cc: "17.0" 
> Signed-off-by: Emil Velikov 
> ---
>  configure.ac | 19 ---
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 0c15c3f51d..525c8d2a91 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -960,6 +960,12 @@ llvm_set_environment_variables() {
>  fi
>  }
> 
> +require_llvm() {
> +if test "x$enable_gallium_llvm" != "xyes"; then
> +AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
> +fi
> +}
> +
>  llvm_check_version_for() {
>  if test "x$MESA_LLVM" = x0; then
>  AC_MSG_ERROR([LLVM $1 or newer is required for $2])
> @@ -2189,15 +2195,6 @@ AC_ARG_WITH([d3d-libdir],
>  AC_SUBST([D3D_DRIVER_INSTALL_DIR])
> 
>  dnl
> -dnl Gallium helper functions
> -dnl
> -gallium_require_llvm() {
> -if test "x$enable_gallium_llvm" != "xyes"; then
> -AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
> -fi
> -}
> -
> -dnl
>  dnl r300 doesn't strictly require LLVM, but for performance reasons we
>  dnl highly recommend LLVM usage. So require it at least on x86 and x86_64
>  dnl architectures.
> @@ -2205,7 +2202,7 @@ dnl
>  r300_require_llvm() {
>  case "$host" in *gnux32) return;; esac
>  case "$host_cpu" in
> -i*86|x86_64|amd64) gallium_require_llvm $1
> +i*86|x86_64|amd64) require_llvm $1
>  ;;
>  esac
>  }
> @@ -2338,7 +2335,7 @@ if test -n "$with_gallium_drivers"; then
>  ;;
>  xswr)
>  llvm_check_version_for $LLVM_REQUIRED_SWR "swr"
> -gallium_require_llvm "swr"
> +require_llvm "swr"
> 
>  swr_require_cxx_feature_flags "C++11" "__cplusplus >= 201103L"
> \ ",-std=c++11" \
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/5] anv: Disable stencil writes when both write masks are zero

2017-02-07 Thread Jason Ekstrand
On Tue, Feb 7, 2017 at 3:14 PM, Jason Ekstrand  wrote:

> Here's the new commit message:
>
> Vulkan doesn't have a stencilWriteEnable bit like it does for depth.
> Instead, you have a stencil mask.  Since the stencil mask is handled as
> dynamic state, we have to handle it later during command buffer
> construction.  This helps Dota2 by a couple percent because it allows
> the hardware to move the depth and stencil writes to early in more
> cases.
>
> I'm double-checking benchmark results for the whole series.
>

I re-benchmarked the whole series.  I can't see any difference except in
the end where we play with depth and stencil operations to attempt to
disable whenever possible.  (The results are a lot noisier this time so
it's hard to tell.)  I could have sworn this patch made a difference
though  I think both are needed to actually get the perf bump.

--Jason


> --Jason
>
>
> On Tue, Feb 7, 2017 at 2:28 PM, Nanley Chery 
> wrote:
>
>> On Tue, Feb 07, 2017 at 12:25:18PM -0800, Jason Ekstrand wrote:
>> > On Tue, Feb 7, 2017 at 12:13 PM, Nanley Chery 
>> wrote:
>> >
>> > > On Wed, Feb 01, 2017 at 08:07:22PM -0800, Jason Ekstrand wrote:
>> > > > The only mechanism Vulkan provides for disabling stencil writes is
>> to set
>> > >
>> > > This isn't the only mechanism for explicitly disabling stencil writes.
>> > > Stencil writes can also be disabled by disabling stencil testing (as
>> can
>> > > be seen in this patch).
>> > >
>> >
>> > I guess that is technically true.  I meant "it doesn't have a
>> > disableStencilWrites like it does for depth".  Maybe something like:
>> >
>> > Vulkan doesn't have a stencilWriteEnable bit like it does for depth.
>> > Instead, you have a stencil mask.  Since the stencil mask is...
>> >
>> >
>>
>> This is better.
>>
>> > > > the stencil write mask to 0.  Since that is dynamic state, we have
>> to
>> > > move
>> > >
>>^
>> > > extra
>> word?
>> > >
>>
>> Ping?
>>
>> > > Users can actually set the write masks at pipeline creation time. For
>> > > that reason, I think it's clearer to say that it "may be" dynamic
>> state
>> > > instead of saying that it "is" dynamic state.
>> > >
>> >
>> > Maybe?  I guess it depends on whether you take "dynamic state" to mean
>> > "state the client set at runtime vs. set in the pipeline" or if you just
>> > consider it to mean the bucket of states that *may* be set at runtime.
>> >
>>
>> You're right. anv takes the position of "may," whereas the spec takes
>> the position of "is." It isn't necessarily clearer to default to the
>> spec's definitions when writing commit messages for driver code.
>>
>> >
>> > > > handle it late during command buffer builder.  This helps Dota2 by a
>> > > couple
>> > > > percent because it allows the hardware to move the depth and stencil
>> > > writes
>> > > > to early in more cases.
>> > >
>> > > I was only able to reproduce a 0.1% performance improvement with this
>> > > patch. Could show me how you're measuring the performance changes (on
>> or
>> > > offline)?
>> > >
>> >
>> > For one thing, it was on my BDW gt3 desktop.  Maybe SKL is impacted
>> less?
>> >
>>
>> Ah, okay.
>>
>> >
>> > > -Nanley
>> > >
>> > > >
>> > > > v2 (Jason Ekstrand): Always initialize the new pipeline variable
>> > > > ---
>> > > >  src/intel/vulkan/anv_private.h | 1 +
>> > > >  src/intel/vulkan/gen7_cmd_buffer.c | 4 
>> > > >  src/intel/vulkan/gen8_cmd_buffer.c | 8 
>> > > >  src/intel/vulkan/genX_pipeline.c   | 4 +++-
>> > > >  4 files changed, 16 insertions(+), 1 deletion(-)
>> > > >
>> > > > diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_
>> > > private.h
>> > > > index a0cb35c..4fe3ebc 100644
>> > > > --- a/src/intel/vulkan/anv_private.h
>> > > > +++ b/src/intel/vulkan/anv_private.h
>> > > > @@ -1465,6 +1465,7 @@ struct anv_pipeline {
>> > > >
>> > > > uint32_t cs_right_mask;
>> > > >
>> > > > +   bool writes_stencil;
>> > > > bool depth_clamp_enable;
>> > > >
>> > > > struct {
>> > > > diff --git a/src/intel/vulkan/gen7_cmd_buffer.c
>> > > b/src/intel/vulkan/gen7_cmd_buffer.c
>> > > > index 8d68aba..013ed87 100644
>> > > > --- a/src/intel/vulkan/gen7_cmd_buffer.c
>> > > > +++ b/src/intel/vulkan/gen7_cmd_buffer.c
>> > > > @@ -212,6 +212,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct
>> > > anv_cmd_buffer *cmd_buffer)
>> > > >
>> > > >   .BackfaceStencilTestMask = d->stencil_compare_mask.back &
>> 0xff,
>> > > >   .BackfaceStencilWriteMask = d->stencil_write_mask.back &
>> 0xff,
>> > > > +
>> > > > + .StencilBufferWriteEnable =
>> > > > +(d->stencil_write_mask.front ||
>> d->stencil_write_mask.back)
>> > > &&
>> > > > +pipeline->writes_stencil,
>> > > >

Re: [Mesa-dev] [PATCH 02/17] configure.ac: move AC_ARG_ENABLE([gallium-llvm] hunk further up

2017-02-07 Thread Tobias Droste
Reviewed-by: Tobias Droste 

Am Dienstag, 7. Februar 2017, 22:44:44 CET schrieb Emil Velikov:
> From: Emil Velikov 
> 
> With next commits we'll require --enable-gallium-llvm (en route to a
> greater good later on) for RADV. The latter is required to ensure that
> as otherwise we'll fail to build.
> 
> Cc: Dave Airlie 
> CC: Tobias Droste 
> Cc: "17.0" 
> Signed-off-by: Emil Velikov 
> ---
>  configure.ac | 36 ++--
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index d9170770eb..0418421d5a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1718,6 +1718,24 @@ if test -n "$with_dri_drivers"; then
>  fi
> 
> 
> +dnl
> +dnl Gallium LLVM
> +dnl
> +AC_ARG_ENABLE([gallium-llvm],
> +[AS_HELP_STRING([--enable-gallium-llvm],
> +[build gallium LLVM support @<:@default=enabled on
> x86/x86_64@:>@])], +[enable_gallium_llvm="$enableval"],
> +[enable_gallium_llvm=auto])
> +
> +if test -z "$with_gallium_drivers"; then
> +enable_gallium_llvm=no
> +fi
> +if test "x$enable_gallium_llvm" = xauto; then
> +case "$host_cpu" in
> +i*86|x86_64|amd64) enable_gallium_llvm=yes;;
> +esac
> +fi
> +
>  #
>  # Vulkan driver configuration
>  #
> @@ -2124,24 +2142,6 @@ if ! echo "$egl_platforms" | grep -q 'x11'; then
>  GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
>  fi
> 
> -dnl
> -dnl Gallium LLVM
> -dnl
> -AC_ARG_ENABLE([gallium-llvm],
> -[AS_HELP_STRING([--enable-gallium-llvm],
> -[build gallium LLVM support @<:@default=enabled on
> x86/x86_64@:>@])], -[enable_gallium_llvm="$enableval"],
> -[enable_gallium_llvm=auto])
> -
> -if test -z "$with_gallium_drivers"; then
> -enable_gallium_llvm=no
> -fi
> -if test "x$enable_gallium_llvm" = xauto; then
> -case "$host_cpu" in
> -i*86|x86_64|amd64) enable_gallium_llvm=yes;;
> -esac
> -fi
> -
>  dnl Directory for XVMC libs
>  AC_ARG_WITH([xvmc-libdir],
>  [AS_HELP_STRING([--with-xvmc-libdir=DIR],
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/17] configure.ac: remove unused AC_SUBST([MESA_LLVM])

2017-02-07 Thread Tobias Droste
Reviewed-by: Tobias Droste 

Am Dienstag, 7. Februar 2017, 22:44:43 CET schrieb Emil Velikov:
> From: Emil Velikov 
> 
> Signed-off-by: Emil Velikov 
> ---
>  configure.ac | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index a6ceee95a3..d9170770eb 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1021,7 +1021,6 @@ radeon_llvm_check() {
> 
>  llvm_set_environment_variables
> 
> -AC_SUBST([MESA_LLVM])
>  AC_SUBST([LLVM_BINDIR])
>  AC_SUBST([LLVM_CFLAGS])
>  AC_SUBST([LLVM_CPPFLAGS])
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Time to merge threaded GL dispatch? (aka glthread)

2017-02-07 Thread Marek Olšák
On Feb 7, 2017 11:55 PM, "Matt Turner"  wrote:

On Tue, Feb 7, 2017 at 10:56 AM, Marek Olšák  wrote:
> On Tue, Feb 7, 2017 at 2:57 AM, Kenneth Graunke 
wrote:
>> On Monday, February 6, 2017 8:54:40 PM PST Marek Olšák wrote:
>>> On Mon, Feb 6, 2017 at 8:20 PM, Ernst Sjöstrand 
wrote:
>>> > FYI glmark2 segfaults with mesa_glthread=true. Expected that some
programs
>>> > will segfault?
>>>
>>> Yes, even segfaults are expected with mesa_glthread=true.
>>>
>>> Marek
>>
>> Would it make sense to be crash-free or even regression-free on at
>> least Piglit, before merging?  (Or are we there already?)
>
> It's not necessary. glthread is disabled by default. Nobody has tested
> piglit with glthread. That will follow after it's been merged, or
> never if it's never merged.

I don't understand why you're so concerned about merging untested
code. That violates some pretty fundamental development practices of
the project.

It's exactly unfinished projects like this that cause problems and
inevitably have to be deleted later (ilo, openvg, d3d1x, etc). I don't
think it's a burden to develop something out of the master branch
until it's somewhat useful.


I'm not concerned about anything and you missed that it had actually been
tested to the extent that we can enable it for some existing games and at
least one unreleased game already.

I also don't have to be the guy merging it and I mean that. But if I do it,
this is how I'd like to do it.

>From my point of view, we don't strictly have to make piglit work. We only
have to make games that can benefit work. Piglit can only help us get there
more easily.

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


[Mesa-dev] www.mesa3d.org moving to freedesktop.org

2017-02-07 Thread Brian Paul
Just FYI: I'm working with the fd.o admins to move the mesa3d.org website
from SourceForge to freedesktop.org.  You may see "Unable to verify server
identity" warnings in your browser for a bit...

Eventually, the pages on www.mesa3d.org should get automatically updated
from git check-ins to the docs/ directory.

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


Re: [Mesa-dev] [PATCH] intel/blorp: do not return const data by get_px_size_sa()

2017-02-07 Thread Jason Ekstrand
Reviewed-by: Jason Ekstrand 

On Tue, Feb 7, 2017 at 3:24 PM, Emil Velikov 
wrote:

> From: Emil Velikov 
>
> Not much point in the const qualifier since we provide a copy to the
> user. Resolves the following -Wignored-qualifiers warning.
>
> src/intel/blorp/blorp_blit.c:1857:8: warning: 'const' type qualifier on
> return type has no effect [-Wignored-qualifiers]
>
> v2: keep const qualifier of local variable.
>
> Cc: Jason Ekstrand 
> Signed-off-by: Emil Velikov 
> ---
>  src/intel/blorp/blorp_blit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
> index 111f1c13a8..6582c4042a 100644
> --- a/src/intel/blorp/blorp_blit.c
> +++ b/src/intel/blorp/blorp_blit.c
> @@ -1857,7 +1857,7 @@ adjust_split_source_coords(const struct blt_axis
> *orig,
> split_coords->src1 = orig->src1 + (scale >= 0.0 ? delta1 : delta0);
>  }
>
> -static const struct isl_extent2d
> +static struct isl_extent2d
>  get_px_size_sa(const struct isl_surf *surf)
>  {
> static const struct isl_extent2d one_to_one = { .w = 1, .h = 1 };
> --
> 2.11.0
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] GLSL IR & TGSI on-disk shader cache

2017-02-07 Thread Timothy Arceri
On Tue, 2017-02-07 at 23:58 +0100, Matt Turner wrote:
> On Tue, Feb 7, 2017 at 4:42 AM, Timothy Arceri  > wrote:
> > This series adds support for a GLSL IR level and TGSI (OpenGL/st)
> > level caches.
> > 
> > There are a few small bug fixes and a little bit of restructuring
> > to the GLSL IR patches to make things work for Gallium drivers vs
> > just i965 previously, but nothing too major.
> > 
> > The biggest change is patch 35 which changes the mesa cache
> > directory to be more structured allowing us to not fallback to
> > recompiles at draw time if we realise a cache item was created
> > with an old version of Mesa. Patch 36 also cleans up old cache
> > files so we shouldn't get into a possition were we are constantly
> > evicting cache items because its never cleaned out.
> > 
> > Even with the new directory structure I've still left in the
> > code that adds the Mesa version string to cache items because
> > users can do things like override the OpenGL version which will
> > change the output (in future we might want to just add this as
> > part of the sha1 input).
> > 
> > This series does not include the patch that adds cache support
> > to the radeonsi backend, the main reason for this is that llvm
> > currently doesn't allow the version to be queried at runtime
> > (as far as I'm aware) although it seems like other are interested
> > in this feature [1] so I will follow up on that.
> > 
> > The reason we don't just use the build time like radv is that we
> > will want something consistent accross distros to enable
> > distribution of precompiled shaders.
> 
> I think I have a solution for this. I am traveling until next week,
> but I will send it as soon as I can.

Are you able to provide a hint as to what you are suggesting? I've just
pinged the llvm about creating the api to query the version. Would be
interested to know if your idea will make the unnecessary.


> ___
> 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] intel/blorp: do not return const data by get_px_size_sa()

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Not much point in the const qualifier since we provide a copy to the
user. Resolves the following -Wignored-qualifiers warning.

src/intel/blorp/blorp_blit.c:1857:8: warning: 'const' type qualifier on
return type has no effect [-Wignored-qualifiers]

v2: keep const qualifier of local variable.

Cc: Jason Ekstrand 
Signed-off-by: Emil Velikov 
---
 src/intel/blorp/blorp_blit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 111f1c13a8..6582c4042a 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -1857,7 +1857,7 @@ adjust_split_source_coords(const struct blt_axis *orig,
split_coords->src1 = orig->src1 + (scale >= 0.0 ? delta1 : delta0);
 }
 
-static const struct isl_extent2d
+static struct isl_extent2d
 get_px_size_sa(const struct isl_surf *surf)
 {
static const struct isl_extent2d one_to_one = { .w = 1, .h = 1 };
-- 
2.11.0

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


Re: [Mesa-dev] [PATCH] radv: handle dcc in explicit image resolve path. (v2)

2017-02-07 Thread Bas Nieuwenhuizen
Reviewed-by: Bas Nieuwenhuizen 

On Wed, Feb 8, 2017, at 00:20, Dave Airlie wrote:
> From: Dave Airlie 
> 
> We need to initialize dcc like we do in the subpass path.
> 
> v2: fix initial/final layouts
> Signed-off-by: Dave Airlie 
> ---
>  src/amd/vulkan/radv_meta_resolve.c | 11 ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/amd/vulkan/radv_meta_resolve.c
> b/src/amd/vulkan/radv_meta_resolve.c
> index 66f1466..23ca569 100644
> --- a/src/amd/vulkan/radv_meta_resolve.c
> +++ b/src/amd/vulkan/radv_meta_resolve.c
> @@ -95,9 +95,11 @@ create_pass(struct radv_device *device)
>   attachments[i].samples = 1;
>   attachments[i].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
>   attachments[i].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
> -   attachments[i].initialLayout = VK_IMAGE_LAYOUT_GENERAL;
> -   attachments[i].finalLayout = VK_IMAGE_LAYOUT_GENERAL;
>   }
> +   attachments[0].initialLayout = VK_IMAGE_LAYOUT_GENERAL;
> +   attachments[0].finalLayout = VK_IMAGE_LAYOUT_GENERAL;
> +   attachments[1].initialLayout =
> VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
> +   attachments[1].finalLayout =
> VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
>  
>   result = radv_CreateRenderPass(device_h,
>  &(VkRenderPassCreateInfo) {
> @@ -116,7 +118,7 @@ create_pass(struct radv_device *device)
>  },
>  {
>  
> .attachment = 1,
> - 
> .layout = VK_IMAGE_LAYOUT_GENERAL,
> + 
> .layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
>  },
>  },
>  .pResolveAttachments = 
> NULL,
> @@ -428,6 +430,9 @@ void radv_CmdResolveImage(
>   if (src_image->array_size > 1)
>   radv_finishme("vkCmdResolveImage: multisample array images");
>  
> +   if (dest_image->surface.dcc_size) {
> +   radv_initialize_dcc(cmd_buffer, dest_image, 0x);
> +   }
>   for (uint32_t r = 0; r < region_count; ++r) {
>   const VkImageResolve *region = [r];
>  
> -- 
> 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] radv: handle dcc in explicit image resolve path. (v2)

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

We need to initialize dcc like we do in the subpass path.

v2: fix initial/final layouts
Signed-off-by: Dave Airlie 
---
 src/amd/vulkan/radv_meta_resolve.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_meta_resolve.c 
b/src/amd/vulkan/radv_meta_resolve.c
index 66f1466..23ca569 100644
--- a/src/amd/vulkan/radv_meta_resolve.c
+++ b/src/amd/vulkan/radv_meta_resolve.c
@@ -95,9 +95,11 @@ create_pass(struct radv_device *device)
attachments[i].samples = 1;
attachments[i].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
attachments[i].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
-   attachments[i].initialLayout = VK_IMAGE_LAYOUT_GENERAL;
-   attachments[i].finalLayout = VK_IMAGE_LAYOUT_GENERAL;
}
+   attachments[0].initialLayout = VK_IMAGE_LAYOUT_GENERAL;
+   attachments[0].finalLayout = VK_IMAGE_LAYOUT_GENERAL;
+   attachments[1].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
+   attachments[1].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
 
result = radv_CreateRenderPass(device_h,
   &(VkRenderPassCreateInfo) {
@@ -116,7 +118,7 @@ create_pass(struct radv_device *device)
   },
   {
   
.attachment = 1,
-  .layout 
= VK_IMAGE_LAYOUT_GENERAL,
+  .layout 
= VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
   },
   },
   .pResolveAttachments = 
NULL,
@@ -428,6 +430,9 @@ void radv_CmdResolveImage(
if (src_image->array_size > 1)
radv_finishme("vkCmdResolveImage: multisample array images");
 
+   if (dest_image->surface.dcc_size) {
+   radv_initialize_dcc(cmd_buffer, dest_image, 0x);
+   }
for (uint32_t r = 0; r < region_count; ++r) {
const VkImageResolve *region = [r];
 
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH] intel/blorp: do not return const data by get_px_size_sa()

2017-02-07 Thread Jason Ekstrand
On Tue, Feb 7, 2017 at 3:19 PM, Jason Ekstrand  wrote:

> On Tue, Feb 7, 2017 at 1:26 PM, Emil Velikov 
> wrote:
>
>> From: Emil Velikov 
>>
>> Not much point in the const qualifier since we provide a copy to the
>> user. Resolves the following -Wignored-qualifiers warning.
>>
>> src/intel/blorp/blorp_blit.c:1857:8: warning: 'const' type qualifier on
>> return type has no effect [-Wignored-qualifiers]
>>
>> Cc: Jason Ekstrand 
>> Signed-off-by: Emil Velikov 
>> ---
>>  src/intel/blorp/blorp_blit.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
>> index 111f1c13a8..dcfc06540c 100644
>> --- a/src/intel/blorp/blorp_blit.c
>> +++ b/src/intel/blorp/blorp_blit.c
>> @@ -1857,10 +1857,10 @@ adjust_split_source_coords(const struct blt_axis
>> *orig,
>> split_coords->src1 = orig->src1 + (scale >= 0.0 ? delta1 : delta0);
>>  }
>>
>> -static const struct isl_extent2d
>> +static struct isl_extent2d
>>  get_px_size_sa(const struct isl_surf *surf)
>>  {
>> -   static const struct isl_extent2d one_to_one = { .w = 1, .h = 1 };
>> +   static struct isl_extent2d one_to_one = { .w = 1, .h = 1 };
>>
>
> Why are you getting rid of const here?  That significantly changes the
> storage of this variable.
>

Specifically, static but not const is no good.  just const or neither is
fine.  Honestly, I don't think you need any change to this variable.  Just
change the return type

--Jason


>
>
>>
>> if (surf->msaa_layout != ISL_MSAA_LAYOUT_INTERLEAVED)
>>return one_to_one;
>> --
>> 2.11.0
>>
>>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] configure: add blurb about what the LIBDRM_*_REQUIRED stuff means

2017-02-07 Thread Ilia Mirkin
Signed-off-by: Ilia Mirkin 
Reviewed-by: Emil Velikov 
---
 configure.ac | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 7cb2c40..7bf3680 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,7 +66,12 @@ AC_SUBST([OSMESA_VERSION])
 OPENCL_VERSION=1
 AC_SUBST([OPENCL_VERSION])
 
-dnl Versions for external dependencies
+# The idea is that libdrm is distributed as one cohesive package, even
+# though it is composed of multiple libraries. However some drivers
+# may have different version requirements than others. This list
+# codifies which drivers need which version of libdrm. Any libdrm
+# version dependencies in non-driver-specific code should be reflected
+# in the first entry.
 LIBDRM_REQUIRED=2.4.66
 LIBDRM_RADEON_REQUIRED=2.4.56
 LIBDRM_AMDGPU_REQUIRED=2.4.63
@@ -76,6 +81,8 @@ LIBDRM_NOUVEAU_REQUIRED=2.4.66
 LIBDRM_FREEDRENO_REQUIRED=2.4.74
 LIBDRM_VC4_REQUIRED=2.4.69
 LIBDRM_ETNAVIV_REQUIRED=2.4.74
+
+dnl Versions for external dependencies
 DRI2PROTO_REQUIRED=2.6
 DRI3PROTO_REQUIRED=1.0
 PRESENTPROTO_REQUIRED=1.0
-- 
2.10.2

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


Re: [Mesa-dev] [PATCH] intel/blorp: do not return const data by get_px_size_sa()

2017-02-07 Thread Jason Ekstrand
On Tue, Feb 7, 2017 at 1:26 PM, Emil Velikov 
wrote:

> From: Emil Velikov 
>
> Not much point in the const qualifier since we provide a copy to the
> user. Resolves the following -Wignored-qualifiers warning.
>
> src/intel/blorp/blorp_blit.c:1857:8: warning: 'const' type qualifier on
> return type has no effect [-Wignored-qualifiers]
>
> Cc: Jason Ekstrand 
> Signed-off-by: Emil Velikov 
> ---
>  src/intel/blorp/blorp_blit.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
> index 111f1c13a8..dcfc06540c 100644
> --- a/src/intel/blorp/blorp_blit.c
> +++ b/src/intel/blorp/blorp_blit.c
> @@ -1857,10 +1857,10 @@ adjust_split_source_coords(const struct blt_axis
> *orig,
> split_coords->src1 = orig->src1 + (scale >= 0.0 ? delta1 : delta0);
>  }
>
> -static const struct isl_extent2d
> +static struct isl_extent2d
>  get_px_size_sa(const struct isl_surf *surf)
>  {
> -   static const struct isl_extent2d one_to_one = { .w = 1, .h = 1 };
> +   static struct isl_extent2d one_to_one = { .w = 1, .h = 1 };
>

Why are you getting rid of const here?  That significantly changes the
storage of this variable.


>
> if (surf->msaa_layout != ISL_MSAA_LAYOUT_INTERLEAVED)
>return one_to_one;
> --
> 2.11.0
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/5] anv: Disable stencil writes when both write masks are zero

2017-02-07 Thread Jason Ekstrand
Here's the new commit message:

Vulkan doesn't have a stencilWriteEnable bit like it does for depth.
Instead, you have a stencil mask.  Since the stencil mask is handled as
dynamic state, we have to handle it later during command buffer
construction.  This helps Dota2 by a couple percent because it allows
the hardware to move the depth and stencil writes to early in more
cases.

I'm double-checking benchmark results for the whole series.

--Jason

On Tue, Feb 7, 2017 at 2:28 PM, Nanley Chery  wrote:

> On Tue, Feb 07, 2017 at 12:25:18PM -0800, Jason Ekstrand wrote:
> > On Tue, Feb 7, 2017 at 12:13 PM, Nanley Chery 
> wrote:
> >
> > > On Wed, Feb 01, 2017 at 08:07:22PM -0800, Jason Ekstrand wrote:
> > > > The only mechanism Vulkan provides for disabling stencil writes is
> to set
> > >
> > > This isn't the only mechanism for explicitly disabling stencil writes.
> > > Stencil writes can also be disabled by disabling stencil testing (as
> can
> > > be seen in this patch).
> > >
> >
> > I guess that is technically true.  I meant "it doesn't have a
> > disableStencilWrites like it does for depth".  Maybe something like:
> >
> > Vulkan doesn't have a stencilWriteEnable bit like it does for depth.
> > Instead, you have a stencil mask.  Since the stencil mask is...
> >
> >
>
> This is better.
>
> > > > the stencil write mask to 0.  Since that is dynamic state, we have to
> > > move
> > >
>  ^
> > > extra
> word?
> > >
>
> Ping?
>
> > > Users can actually set the write masks at pipeline creation time. For
> > > that reason, I think it's clearer to say that it "may be" dynamic state
> > > instead of saying that it "is" dynamic state.
> > >
> >
> > Maybe?  I guess it depends on whether you take "dynamic state" to mean
> > "state the client set at runtime vs. set in the pipeline" or if you just
> > consider it to mean the bucket of states that *may* be set at runtime.
> >
>
> You're right. anv takes the position of "may," whereas the spec takes
> the position of "is." It isn't necessarily clearer to default to the
> spec's definitions when writing commit messages for driver code.
>
> >
> > > > handle it late during command buffer builder.  This helps Dota2 by a
> > > couple
> > > > percent because it allows the hardware to move the depth and stencil
> > > writes
> > > > to early in more cases.
> > >
> > > I was only able to reproduce a 0.1% performance improvement with this
> > > patch. Could show me how you're measuring the performance changes (on
> or
> > > offline)?
> > >
> >
> > For one thing, it was on my BDW gt3 desktop.  Maybe SKL is impacted less?
> >
>
> Ah, okay.
>
> >
> > > -Nanley
> > >
> > > >
> > > > v2 (Jason Ekstrand): Always initialize the new pipeline variable
> > > > ---
> > > >  src/intel/vulkan/anv_private.h | 1 +
> > > >  src/intel/vulkan/gen7_cmd_buffer.c | 4 
> > > >  src/intel/vulkan/gen8_cmd_buffer.c | 8 
> > > >  src/intel/vulkan/genX_pipeline.c   | 4 +++-
> > > >  4 files changed, 16 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_
> > > private.h
> > > > index a0cb35c..4fe3ebc 100644
> > > > --- a/src/intel/vulkan/anv_private.h
> > > > +++ b/src/intel/vulkan/anv_private.h
> > > > @@ -1465,6 +1465,7 @@ struct anv_pipeline {
> > > >
> > > > uint32_t cs_right_mask;
> > > >
> > > > +   bool writes_stencil;
> > > > bool depth_clamp_enable;
> > > >
> > > > struct {
> > > > diff --git a/src/intel/vulkan/gen7_cmd_buffer.c
> > > b/src/intel/vulkan/gen7_cmd_buffer.c
> > > > index 8d68aba..013ed87 100644
> > > > --- a/src/intel/vulkan/gen7_cmd_buffer.c
> > > > +++ b/src/intel/vulkan/gen7_cmd_buffer.c
> > > > @@ -212,6 +212,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct
> > > anv_cmd_buffer *cmd_buffer)
> > > >
> > > >   .BackfaceStencilTestMask = d->stencil_compare_mask.back &
> 0xff,
> > > >   .BackfaceStencilWriteMask = d->stencil_write_mask.back &
> 0xff,
> > > > +
> > > > + .StencilBufferWriteEnable =
> > > > +(d->stencil_write_mask.front ||
> d->stencil_write_mask.back)
> > > &&
> > > > +pipeline->writes_stencil,
> > > >};
> > > >GENX(DEPTH_STENCIL_STATE_pack)(NULL, depth_stencil_dw,
> > > _stencil);
> > > >
> > > > diff --git a/src/intel/vulkan/gen8_cmd_buffer.c
> > > b/src/intel/vulkan/gen8_cmd_buffer.c
> > > > index ab68872..8c8de62 100644
> > > > --- a/src/intel/vulkan/gen8_cmd_buffer.c
> > > > +++ b/src/intel/vulkan/gen8_cmd_buffer.c
> > > > @@ -224,6 +224,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct
> > > anv_cmd_buffer *cmd_buffer)
> > > >
> > > >   .BackfaceStencilTestMask = d->stencil_compare_mask.back &
> 0xff,
> > > >   .BackfaceStencilWriteMask = 

[Mesa-dev] [PATCH 2/2] i965: Get rid of mark_surface_used()

2017-02-07 Thread Jason Ekstrand
The mark_surface_used function exists for a micro-optimization that
shrinks the binding table if some of the entries are unused.  However,
we already create binding tables based on num_textures, num_ubos, etc.,
so the only case where this is actually able to eliminate something is
if the back-end or NIR is able to dead-code something that the GLSL
compiler couldn't.  Also, it only helps if the thing we were able to
dead-code happened to be at the end of the list.

Binding table space is cheap.  On the other hand, this optimization
costs us over 150 lines of code scattered throughout NIR and all layers
of the back-end compiler that's a pain to maintain.  The tiny
optimization we get isn't worth the effort.

Cc: Kenneth Graunke 
---
 src/compiler/nir/nir.c   |  1 -
 src/compiler/nir/nir.h   |  3 --
 src/compiler/nir/nir_clone.c |  1 -
 src/compiler/nir/nir_instr_set.c |  2 -
 src/compiler/nir/nir_lower_samplers.c|  2 -
 src/intel/vulkan/anv_nir_apply_pipeline_layout.c |  5 ---
 src/mesa/drivers/dri/i965/brw_fs.cpp |  4 --
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp   | 11 --
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 47 
 src/mesa/drivers/dri/i965/brw_program.h  |  4 --
 src/mesa/drivers/dri/i965/brw_shader.cpp | 20 +-
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp |  9 -
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp   | 47 
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp   |  2 -
 14 files changed, 2 insertions(+), 156 deletions(-)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 25bfc31..7b3702c 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -532,7 +532,6 @@ nir_tex_instr_create(nir_shader *shader, unsigned num_srcs)
   src_init(>src[i].src);
 
instr->texture_index = 0;
-   instr->texture_array_size = 0;
instr->texture = NULL;
instr->sampler_index = 0;
instr->sampler = NULL;
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 8bbc41d..2ffa869 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1161,9 +1161,6 @@ typedef struct {
 */
unsigned texture_index;
 
-   /** The size of the texture array or 0 if it's not an array */
-   unsigned texture_array_size;
-
/** The texture deref
 *
 * If this is null, use texture_index instead.
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c
index a0ba8f7..bcd87f0 100644
--- a/src/compiler/nir/nir_clone.c
+++ b/src/compiler/nir/nir_clone.c
@@ -420,7 +420,6 @@ clone_tex(clone_state *state, const nir_tex_instr *tex)
ntex->texture_index = tex->texture_index;
if (tex->texture)
   ntex->texture = clone_deref_var(state, tex->texture, >instr);
-   ntex->texture_array_size = tex->texture_array_size;
 
ntex->sampler_index = tex->sampler_index;
if (tex->sampler)
diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c
index 9cb9ed4..5f9cd93 100644
--- a/src/compiler/nir/nir_instr_set.c
+++ b/src/compiler/nir/nir_instr_set.c
@@ -158,7 +158,6 @@ hash_tex(uint32_t hash, const nir_tex_instr *instr)
unsigned component = instr->component;
hash = HASH(hash, component);
hash = HASH(hash, instr->texture_index);
-   hash = HASH(hash, instr->texture_array_size);
hash = HASH(hash, instr->sampler_index);
 
assert(!instr->texture && !instr->sampler);
@@ -312,7 +311,6 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr 
*instr2)
   tex1->is_new_style_shadow != tex2->is_new_style_shadow ||
   tex1->component != tex2->component ||
  tex1->texture_index != tex2->texture_index ||
- tex1->texture_array_size != tex2->texture_array_size ||
  tex1->sampler_index != tex2->sampler_index) {
  return false;
   }
diff --git a/src/compiler/nir/nir_lower_samplers.c 
b/src/compiler/nir/nir_lower_samplers.c
index 9debfb2..e789ce0 100644
--- a/src/compiler/nir/nir_lower_samplers.c
+++ b/src/compiler/nir/nir_lower_samplers.c
@@ -136,8 +136,6 @@ lower_sampler(nir_tex_instr *instr, const struct 
gl_shader_program *shader_progr
   nir_instr_rewrite_src(>instr,
 >src[instr->num_srcs - 1].src,
 nir_src_for_ssa(indirect));
-
-  instr->texture_array_size = array_elements;
}
 
if (location > shader_program->data->NumUniformStorage - 1 ||
diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c 
b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
index 8846c2e..8aeaad2 100644
--- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
@@ -212,11 +212,6 @@ lower_tex(nir_tex_instr *tex, struct 
apply_pipeline_layout_state *state)
   nir_tex_src_sampler_offset, state);
}
 
-   /* The backend only 

[Mesa-dev] [PATCH 1/2] i965: Make assign_common_binding_table_offsets return void

2017-02-07 Thread Jason Ekstrand
It doesn't really matter what order the binding table entries are in so
there's no real utility to returning the final offset from
assign_common_binding_table_offsets.  The only functional change in this
patch is that framebuffer fetch surfaces are now right after render
targets rather than at the end.
---
 src/mesa/drivers/dri/i965/brw_shader.h | 2 +-
 src/mesa/drivers/dri/i965/brw_wm.c | 7 +++
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_shader.h 
b/src/mesa/drivers/dri/i965/brw_shader.h
index 60f498f..e59e531 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -270,7 +270,7 @@ struct brw_gs_compile
unsigned control_data_header_size_bits;
 };
 
-uint32_t
+void
 brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo,
 const struct gl_program *prog,
 struct brw_stage_prog_data 
*stage_prog_data,
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c 
b/src/mesa/drivers/dri/i965/brw_wm.c
index a774720..f860fdf 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -55,15 +55,14 @@ assign_fs_binding_table_offsets(const struct 
gen_device_info *devinfo,
prog_data->binding_table.render_target_start = next_binding_table_offset;
next_binding_table_offset += MAX2(key->nr_color_regions, 1);
 
-   next_binding_table_offset =
-  brw_assign_common_binding_table_offsets(devinfo, prog, _data->base,
-  next_binding_table_offset);
-
if (prog->nir->info->outputs_read && !key->coherent_fb_fetch) {
   prog_data->binding_table.render_target_read_start =
  next_binding_table_offset;
   next_binding_table_offset += key->nr_color_regions;
}
+
+   brw_assign_common_binding_table_offsets(devinfo, prog, _data->base,
+   next_binding_table_offset);
 }
 
 static void
-- 
2.5.0.400.gff86faf

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


[Mesa-dev] [Bug 98471] [TRACKER] Mesa 13.0 release tracker

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

Matt Turner  changed:

   What|Removed |Added

 Depends on|97967   |


Referenced Bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=97967
[Bug 97967] glsl/tests/cache-test regression
-- 
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 99517] [TRACKER] Mesa 17.0 release tracker

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

Matt Turner  changed:

   What|Removed |Added

 Depends on||97967


Referenced Bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=97967
[Bug 97967] glsl/tests/cache-test regression
-- 
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 97967] glsl/tests/cache-test regression

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

Matt Turner  changed:

   What|Removed |Added

 Blocks|98471   |99517


Referenced Bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=98471
[Bug 98471] [TRACKER] Mesa 13.0 release tracker
https://bugs.freedesktop.org/show_bug.cgi?id=99517
[Bug 99517] [TRACKER] Mesa 17.0 release tracker
-- 
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] GLSL IR & TGSI on-disk shader cache

2017-02-07 Thread Matt Turner
On Tue, Feb 7, 2017 at 4:42 AM, Timothy Arceri  wrote:
> This series adds support for a GLSL IR level and TGSI (OpenGL/st)
> level caches.
>
> There are a few small bug fixes and a little bit of restructuring
> to the GLSL IR patches to make things work for Gallium drivers vs
> just i965 previously, but nothing too major.
>
> The biggest change is patch 35 which changes the mesa cache
> directory to be more structured allowing us to not fallback to
> recompiles at draw time if we realise a cache item was created
> with an old version of Mesa. Patch 36 also cleans up old cache
> files so we shouldn't get into a possition were we are constantly
> evicting cache items because its never cleaned out.
>
> Even with the new directory structure I've still left in the
> code that adds the Mesa version string to cache items because
> users can do things like override the OpenGL version which will
> change the output (in future we might want to just add this as
> part of the sha1 input).
>
> This series does not include the patch that adds cache support
> to the radeonsi backend, the main reason for this is that llvm
> currently doesn't allow the version to be queried at runtime
> (as far as I'm aware) although it seems like other are interested
> in this feature [1] so I will follow up on that.
>
> The reason we don't just use the build time like radv is that we
> will want something consistent accross distros to enable
> distribution of precompiled shaders.

I think I have a solution for this. I am traveling until next week,
but I will send it as soon as I can.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Time to merge threaded GL dispatch? (aka glthread)

2017-02-07 Thread Matt Turner
On Tue, Feb 7, 2017 at 10:56 AM, Marek Olšák  wrote:
> On Tue, Feb 7, 2017 at 2:57 AM, Kenneth Graunke  wrote:
>> On Monday, February 6, 2017 8:54:40 PM PST Marek Olšák wrote:
>>> On Mon, Feb 6, 2017 at 8:20 PM, Ernst Sjöstrand  wrote:
>>> > FYI glmark2 segfaults with mesa_glthread=true. Expected that some programs
>>> > will segfault?
>>>
>>> Yes, even segfaults are expected with mesa_glthread=true.
>>>
>>> Marek
>>
>> Would it make sense to be crash-free or even regression-free on at
>> least Piglit, before merging?  (Or are we there already?)
>
> It's not necessary. glthread is disabled by default. Nobody has tested
> piglit with glthread. That will follow after it's been merged, or
> never if it's never merged.

I don't understand why you're so concerned about merging untested
code. That violates some pretty fundamental development practices of
the project.

It's exactly unfinished projects like this that cause problems and
inevitably have to be deleted later (ilo, openvg, d3d1x, etc). I don't
think it's a burden to develop something out of the master branch
until it's somewhat useful.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 99010] --disable-gallium-llvm no longer recognized

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

--- Comment #19 from Emil Velikov  ---
Gents do give this series a try

https://patchwork.freedesktop.org/series/19269/

-- 
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 14/17] configure.ac: correctly manage llvm auto-detection

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Earlier refactoring commits changed from one, dare I say it, broken
behaviour to another. Namely:

Before, as you explicitly --enable-gallium-llvm your selection was
ignored when llvm-config was not present/detected.
Today, the "auto" heuristics enables gallium llvm regardless if you have
llvm/llvm-config available or not.

Rework the auto-detection to attribute for llvm's presence.

Cc: Tobias Droste 
Cc: Samuel Pitoiset 
Cc: "17.0" 
Reported-by: Samuel Pitoiset 
Signed-off-by: Emil Velikov 
Reviewed-by: Tobias Droste 
---
Samuel can you check thing on your end ?
Configure should now succeed without touching --enable-gallium-llvm if
llvm-config is missing on the system.
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a781a19a3c..22758d9702 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1724,7 +1724,7 @@ AC_ARG_ENABLE([gallium-llvm],
 [enable_gallium_llvm="$enableval"],
 [enable_gallium_llvm=auto])
 
-if test "x$enable_gallium_llvm" = xauto; then
+if test "x$enable_gallium_llvm" = xauto -a "x$FOUND_LLVM" = xyes; then
 case "$host_cpu" in
 i*86|x86_64|amd64) enable_gallium_llvm=yes;;
 *) enable_gallium_llvm=no;;
-- 
2.11.0

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


[Mesa-dev] [PATCH 10/17] configure.ac: don't use == with test

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Although it works, it's not the correct thing to do.

v2: Rebase

Signed-off-by: Emil Velikov 
Reviewed-by: Tobias Droste  (v1)
---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1b28eb3b3b..23e8a34da1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2370,14 +2370,14 @@ if test -n "$with_gallium_drivers"; then
 done
 fi
 
-if test "x$enable_gallium_llvm" == "xyes"; then
+if test "x$enable_gallium_llvm" = "xyes"; then
 llvm_require_version $LLVM_REQUIRED_GALLIUM "gallium"
 llvm_add_default_components "gallium"
 fi
 
 dnl We need to validate some needed dependencies for renderonly drivers.
 
-if test "x$HAVE_GALLIUM_ETNAVIV" != xyes -a "x$HAVE_GALLIUM_IMX" == xyes  ; 
then
+if test "x$HAVE_GALLIUM_ETNAVIV" != xyes -a "x$HAVE_GALLIUM_IMX" = xyes  ; then
 AC_ERROR([Building with imx requires etnaviv])
 fi
 
-- 
2.11.0

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


[Mesa-dev] [PATCH 08/17] configure.ac: Only define HAVE_LLVM if LLVM is used

2017-02-07 Thread Emil Velikov
From: Tobias Droste 

Make sure that HAVE_LLVM compiler define is only set if LLVM is
actually used.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99010
Cc: "17.0" 
Signed-off-by: Tobias Droste 
v2 [Emil] fold within the existing conditional
Reviewed-by: Emil Velikov 
---
 configure.ac | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index ff6f602527..3a1b92d91e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -952,7 +952,6 @@ llvm_set_environment_variables() {
 LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}"
 fi
 
-DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
 FOUND_LLVM=yes
 else
 FOUND_LLVM=no
@@ -2387,14 +2386,18 @@ if test "x$HAVE_GALLIUM_ETNAVIV" != xyes -a 
"x$HAVE_GALLIUM_IMX" == xyes  ; then
 AC_ERROR([Building with imx requires etnaviv])
 fi
 
-dnl Set LLVM_LIBS - This is done after the driver configuration so
-dnl that drivers can add additional components to LLVM_COMPONENTS.
-dnl Previously, gallium drivers were updating LLVM_LIBS directly
-dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
-dnl this was causing the same libraries to be appear multiple times
-dnl in LLVM_LIBS.
-
+dnl
+dnl Set defines and buildtime variables only when using LLVM.
+dnl
 if test "x$enable_gallium_llvm" = xyes; then
+DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
+
+dnl Set LLVM_LIBS - This is done after the driver configuration so
+dnl that drivers can add additional components to LLVM_COMPONENTS.
+dnl Previously, gallium drivers were updating LLVM_LIBS directly
+dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
+dnl this was causing the same libraries to be appear multiple times
+dnl in LLVM_LIBS.
 
 if ! $LLVM_CONFIG --libs ${LLVM_COMPONENTS} >/dev/null; then
AC_MSG_ERROR([Calling ${LLVM_CONFIG} failed])
-- 
2.11.0

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


[Mesa-dev] [PATCH 09/17] configure.ac: remove unused LLVM variables

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

LLVM_BINDIR is completely unused while others such as LLVM_LIBDIR are
used only internally. In the latter case there's no need to AC_SUBST it.

Signed-off-by: Emil Velikov 
Reviewed-by: Tobias Droste 
---
 configure.ac | 5 -
 1 file changed, 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3a1b92d91e..1b28eb3b3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -921,7 +921,6 @@ llvm_set_environment_variables() {
 if test "x$LLVM_CONFIG" != xno; then
 LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
-LLVM_BINDIR=`$LLVM_CONFIG --bindir`
 LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
 LLVM_CFLAGS=$LLVM_CPPFLAGS   # CPPFLAGS seem to be sufficient
 LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
@@ -1026,15 +1025,11 @@ radeon_llvm_check() {
 
 llvm_set_environment_variables
 
-AC_SUBST([LLVM_BINDIR])
 AC_SUBST([LLVM_CFLAGS])
-AC_SUBST([LLVM_CPPFLAGS])
 AC_SUBST([LLVM_CXXFLAGS])
-AC_SUBST([LLVM_LIBDIR])
 AC_SUBST([LLVM_LIBS])
 AC_SUBST([LLVM_LDFLAGS])
 AC_SUBST([LLVM_INCLUDEDIR])
-AC_SUBST([LLVM_VERSION])
 
 dnl Options for APIs
 AC_ARG_ENABLE([opengl],
-- 
2.11.0

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


[Mesa-dev] [PATCH 17/17] st/nine: update configure options in the README

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Cc: Axel Davy 
Signed-off-by: Emil Velikov 
---
Axel, others - can someone skimg through the file and double-check that
those are still valid ?
---
 src/gallium/state_trackers/nine/README | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/README 
b/src/gallium/state_trackers/nine/README
index f10045c0de..34e928d4da 100644
--- a/src/gallium/state_trackers/nine/README
+++ b/src/gallium/state_trackers/nine/README
@@ -3,10 +3,9 @@ Quickstart Guide
 *** Configure and build mesa
 CFLAGS="-m32" CXXFLAGS="-m32" ./autogen.sh --prefix=/usr \
  --with-gallium-drivers=nouveau,r600,swrast --enable-nine \
- --with-gallium-driver-dir="`pwd`/src/gallium/targets/pipe-loader/.libs" \
  --enable-debug --enable-texture-float --with-dri-drivers= --disable-dri \
  --disable-opengl --disable-egl --disable-vdpau --disable-xvmc --disable-gbm \
- --disable-gallium-llvm
+ --disable-llvm
 make
 
 *** Then we create some symlinks to mesa:
-- 
2.11.0

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


[Mesa-dev] [PATCH 13/17] configure.ac: disable enable_gallium_llvm in the !x86 case

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Already implicitly handled throughout, but keep it clear and disable
gallium-llvm. This change should be a no-op.

Cc: Tobias Droste 
Signed-off-by: Emil Velikov 
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 469a09e286..a781a19a3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1727,6 +1727,7 @@ AC_ARG_ENABLE([gallium-llvm],
 if test "x$enable_gallium_llvm" = xauto; then
 case "$host_cpu" in
 i*86|x86_64|amd64) enable_gallium_llvm=yes;;
+*) enable_gallium_llvm=no;;
 esac
 fi
 
-- 
2.11.0

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


[Mesa-dev] [PATCH 16/17] configure.ac: supersede --enable-gallium-llvm over --enable-llvm

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Currently we have extra (somewhat questionable) modularity, such that
one could build some parts with LLVM while others w/o.

That is extremely fragile, error prone and requires quite noticable
amount of code throughout.

Thus lets deprecate the gallium toggle in faviour of the generic one.
The former will throw a warning when set, and it will be overwritten by
the latter. This will allow gradual transition w/o breaking people's
scripts.

Cc: Dave Airlie 
CC: Tobias Droste 
Signed-off-by: Emil Velikov 
---
 Makefile.am |  2 +-
 configure.ac| 43 +++
 docs/releasing.html |  2 +-
 3 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 84c3e1d08f..147a5e7ce8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,7 +27,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \
--enable-egl \
--enable-gallium-tests \
--enable-gallium-osmesa \
-   --enable-gallium-llvm \
+   --enable-llvm \
--enable-gbm \
--enable-gles1 \
--enable-gles2 \
diff --git a/configure.ac b/configure.ac
index d0437a71aa..fb316806ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -952,8 +952,8 @@ llvm_set_environment_variables() {
 }
 
 require_llvm() {
-if test "x$enable_gallium_llvm" != "xyes"; then
-AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+if test "x$enable_llvm" != "xyes"; then
+AC_MSG_ERROR([--enable-llvm is required when building $1])
 fi
 }
 
@@ -1713,21 +1713,32 @@ fi
 
 dnl
 dnl Gallium LLVM
-dnl
-dnl With follow-up commits we'll rework --enable-gallium-llvm to --enable-llvm
-dnl Since that is too invasive to stable, do the more conservative thing for 
now
-dnl and consider it as a global LLVM toggle.
+dnl Deprecated: kept for backwards compatibility
 dnl
 AC_ARG_ENABLE([gallium-llvm],
 [AS_HELP_STRING([--enable-gallium-llvm],
-[build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
+[DEPRECATED: use --enable-llvm instead])],
 [enable_gallium_llvm="$enableval"],
 [enable_gallium_llvm=auto])
 
-if test "x$enable_gallium_llvm" = xauto -a "x$FOUND_LLVM" = xyes; then
+if test "x$enable_gallium_llvm" != xauto; then
+   AC_MSG_WARN([The --enable-gallium-llvm option has been deprecated. Use 
--enable-llvm instead.])
+   enable_llvm=$enable_gallium_llvm
+fi
+
+dnl
+dnl LLVM
+dnl
+AC_ARG_ENABLE([llvm],
+[AS_HELP_STRING([--enable-llvm],
+[build with LLVM support @<:@default=enabled on x86/x86_64@:>@])],
+[enable_llvm="$enableval"],
+[enable_llvm=auto])
+
+if test "x$enable_llvm" = xauto -a "x$FOUND_LLVM" = xyes; then
 case "$host_cpu" in
-i*86|x86_64|amd64) enable_gallium_llvm=yes;;
-*) enable_gallium_llvm=no;;
+i*86|x86_64|amd64) enable_llvm=yes;;
+*) enable_llvm=no;;
 esac
 fi
 
@@ -2311,7 +2322,7 @@ if test -n "$with_gallium_drivers"; then
 ;;
 xswrast)
 HAVE_GALLIUM_SOFTPIPE=yes
-if test "x$enable_gallium_llvm" = xyes; then
+if test "x$enable_llvm" = xyes; then
 HAVE_GALLIUM_LLVMPIPE=yes
 fi
 ;;
@@ -2357,7 +2368,7 @@ if test -n "$with_gallium_drivers"; then
 done
 fi
 
-if test "x$enable_gallium_llvm" = "xyes"; then
+if test "x$enable_llvm" = "xyes"; then
 llvm_require_version $LLVM_REQUIRED_GALLIUM "gallium"
 llvm_add_default_components "gallium"
 fi
@@ -2371,7 +2382,7 @@ fi
 dnl
 dnl Set defines and buildtime variables only when using LLVM.
 dnl
-if test "x$enable_gallium_llvm" = xyes; then
+if test "x$enable_llvm" = xyes; then
 DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
 
 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
@@ -2484,7 +2495,7 @@ AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test 
"x$HAVE_GALLIUM_R300" = xyes -o \
 AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$enable_glx" = xgallium-xlib)
 AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
-AM_CONDITIONAL(HAVE_GALLIUM_LLVM, test "x$enable_gallium_llvm" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_LLVM, test "x$enable_llvm" = xyes)
 AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes)
 
 AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
@@ -2764,7 +2775,7 @@ else
 fi
 
 echo ""
-if test "x$enable_gallium_llvm" = xyes; then
+if test "x$enable_llvm" = xyes; then
 echo "llvm:yes"
 echo "llvm-config: $LLVM_CONFIG"
 echo "llvm-version:$LLVM_VERSION"
@@ -2811,7 +2822,7 @@ echo "CFLAGS:  $cflags"
 echo "CXXFLAGS:$cxxflags"
 echo "Macros:  $defines"
 echo ""
-if test "x$enable_gallium_llvm" = xyes; then
+if test "x$enable_llvm" = xyes; then
 echo "

[Mesa-dev] [PATCH 11/17] Revert "configure.ac: Create correct LLVM_VERSION_INT with minor >= 10"

2017-02-07 Thread Emil Velikov
As stated in [1] by the LLVM devs, the new versioning scheme will not
deploy any minor version (i.e. it will always be zero). As such the
patch should not be needed.

This reverts commit 0e9a5be7e74fa2a9bd2a634ef60822bd6600ca1d.

[1] http://blog.llvm.org/2016/12/llvms-new-versioning-scheme.html
Reviewed-by: Tobias Droste 
---
 configure.ac | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 23e8a34da1..1bdb8a6ed5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -945,11 +945,7 @@ llvm_set_environment_variables() {
 LLVM_VERSION_PATCH=0
 fi
 
-if test "$LLVM_VERSION_MINOR" -lt 10; then
-LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
-else
-LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}"
-fi
+LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
 
 FOUND_LLVM=yes
 else
-- 
2.11.0

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


[Mesa-dev] [PATCH 12/17] configure.ac: set LLVM_{C, CXX, LD}FLAGS only as needed

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Earlier refactoring commits started setting the above regardless if LLVM
is used or not. Move them to the respective section to restore the
original functionality.

Since we require the preprocessor flags (includes in particular) for the
header version parsing keep those as-is. They are not used outside of
configure.ac thus should not cause any side-effects.

As-is adding the C/CXXFLAGS can lead to build issues on when
cross-compiling.

Cc: Ilia Mirkin 
Cc: Tomasz Figa 
Cc: "17.0" 
Reported-by: Ilia Mirkin 
Signed-off-by: Emil Velikov 
Reviewed-by: Tobias Droste 
---
Ilia can you check that it fixes things on your end ?
---
 configure.ac | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1bdb8a6ed5..469a09e286 100644
--- a/configure.ac
+++ b/configure.ac
@@ -920,16 +920,13 @@ strip_unwanted_llvm_flags() {
 llvm_set_environment_variables() {
 if test "x$LLVM_CONFIG" != xno; then
 LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
-LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
 LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
-LLVM_CFLAGS=$LLVM_CPPFLAGS   # CPPFLAGS seem to be sufficient
-LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
 LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
 LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
 
-# We need to respect LLVM_CFLAGS when compiling LLVM headers.
+# We need to respect LLVM_CPPFLAGS when compiling LLVM headers.
 save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $LLVM_CFLAGS"
+CFLAGS="$CFLAGS $LLVM_CPPFLAGS"
 
 AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
 [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
@@ -2383,6 +2380,10 @@ dnl
 if test "x$enable_gallium_llvm" = xyes; then
 DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
 
+LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
+LLVM_CFLAGS=$LLVM_CPPFLAGS   # CPPFLAGS seem to be sufficient
+LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
+
 dnl Set LLVM_LIBS - This is done after the driver configuration so
 dnl that drivers can add additional components to LLVM_COMPONENTS.
 dnl Previously, gallium drivers were updating LLVM_LIBS directly
-- 
2.11.0

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


[Mesa-dev] [PATCH 15/17] configure.ac: remove dummy radeon_gallium_llvm_check()

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

The extra function brings no added benefit as of earlier commit which
made llvm_require_version (as called by radeon_llvm_check) require LLVM
(--enable-gallium-llvm).

Fixes: 5f966a96af7 "configure.ac: Mandate --enable-gallium-llvm when
checking LLVM version"
Cc: Tobias Droste 
Signed-off-by: Emil Velikov 
---
Strictly speaking it's not a fix, but a cleanup. I'm fine with keeping
it separate or merging it in - let me know your preference.
---
 configure.ac | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 22758d9702..d0437a71aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2213,13 +2213,6 @@ require_basic_egl() {
 esac
 }
 
-radeon_gallium_llvm_check() {
-if test "x$enable_gallium_llvm" != "xyes"; then
-AC_MSG_ERROR([--enable-gallium-llvm is required when building $2])
-fi
-radeon_llvm_check $*
-}
-
 swr_require_cxx_feature_flags() {
 feature_name="$1"
 preprocessor_test="$2"
@@ -2284,7 +2277,7 @@ if test -n "$with_gallium_drivers"; then
 PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED 
libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
 require_libdrm "r600"
 if test "x$enable_opencl" = xyes; then
-radeon_gallium_llvm_check $LLVM_REQUIRED_R600 "r600"
+radeon_llvm_check $LLVM_REQUIRED_R600 "r600"
 
 llvm_add_component "asmparser" "r600"
 llvm_add_component "bitreader" "r600"
@@ -2295,7 +2288,7 @@ if test -n "$with_gallium_drivers"; then
 PKG_CHECK_MODULES([RADEON], [libdrm >= $LIBDRM_RADEON_REQUIRED 
libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
 PKG_CHECK_MODULES([AMDGPU], [libdrm >= $LIBDRM_AMDGPU_REQUIRED 
libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
 require_libdrm "radeonsi"
-radeon_gallium_llvm_check $LLVM_REQUIRED_RADEONSI "radeonsi"
+radeon_llvm_check $LLVM_REQUIRED_RADEONSI "radeonsi"
 require_basic_egl "radeonsi"
 ;;
 xnouveau)
-- 
2.11.0

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


[Mesa-dev] [PATCH 07/17] configure.ac: Rework MESA_LLVM and LLVM detection

2017-02-07 Thread Emil Velikov
From: Tobias Droste 

Set FOUND_LLVM only when LLVM is present (checking for exact version/etc
is deferred) and use enable-gallium-llvm to indicate the global LLVM
status.

Renaming the latter is not appropriate for stable patches, so we'll
address it with a later commit.

Loosely based on work by Tobias.

Cc: Dave Airlie 
CC: Tobias Droste 
Cc: "17.0" 
Reviewed-by: Emil Velikov 
---
 configure.ac | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index 88abc716c1..ff6f602527 100644
--- a/configure.ac
+++ b/configure.ac
@@ -953,9 +953,9 @@ llvm_set_environment_variables() {
 fi
 
 DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
-DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
-MESA_LLVM=1
+FOUND_LLVM=yes
 else
-MESA_LLVM=0
+FOUND_LLVM=no
 LLVM_VERSION_INT=0
 fi
 }
@@ -967,9 +967,8 @@ require_llvm() {
 }
 
 llvm_require_version() {
-if test "x$MESA_LLVM" = x0; then
-AC_MSG_ERROR([LLVM $1 or newer is required for $2])
-return
+if test "x$FOUND_LLVM" = xno; then
+AC_MSG_ERROR([LLVM is required for $2])
 fi
 require_llvm $2
 
@@ -1728,6 +1727,10 @@ fi
 dnl
 dnl Gallium LLVM
 dnl
+dnl With follow-up commits we'll rework --enable-gallium-llvm to --enable-llvm
+dnl Since that is too invasive to stable, do the more conservative thing for 
now
+dnl and consider it as a global LLVM toggle.
+dnl
 AC_ARG_ENABLE([gallium-llvm],
 [AS_HELP_STRING([--enable-gallium-llvm],
 [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
@@ -2327,7 +2330,7 @@ if test -n "$with_gallium_drivers"; then
 ;;
 xswrast)
 HAVE_GALLIUM_SOFTPIPE=yes
-if test "x$MESA_LLVM" = x1 && test "x$enable_gallium_llvm" == 
"xyes";  then
+if test "x$enable_gallium_llvm" = xyes; then
 HAVE_GALLIUM_LLVMPIPE=yes
 fi
 ;;
@@ -2391,7 +2394,7 @@ dnl by calling llvm-config --libs 
${DRIVER_LLVM_COMPONENTS}, but
 dnl this was causing the same libraries to be appear multiple times
 dnl in LLVM_LIBS.
 
-if test "x$MESA_LLVM" != x0; then
+if test "x$enable_gallium_llvm" = xyes; then
 
 if ! $LLVM_CONFIG --libs ${LLVM_COMPONENTS} >/dev/null; then
AC_MSG_ERROR([Calling ${LLVM_CONFIG} failed])
@@ -2492,8 +2495,7 @@ AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test 
"x$HAVE_GALLIUM_R300" = xyes -o \
 AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$enable_glx" = xgallium-xlib)
 AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
-AM_CONDITIONAL(HAVE_GALLIUM_LLVM, test "x$MESA_LLVM" = x1 -a \
-   "x$enable_gallium_llvm" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_LLVM, test "x$enable_gallium_llvm" = xyes)
 AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes)
 
 AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
@@ -2773,7 +2775,7 @@ else
 fi
 
 echo ""
-if test "x$MESA_LLVM" = x1; then
+if test "x$enable_gallium_llvm" = xyes; then
 echo "llvm:yes"
 echo "llvm-config: $LLVM_CONFIG"
 echo "llvm-version:$LLVM_VERSION"
@@ -2820,7 +2822,7 @@ echo "CFLAGS:  $cflags"
 echo "CXXFLAGS:$cxxflags"
 echo "Macros:  $defines"
 echo ""
-if test "x$MESA_LLVM" = x1; then
+if test "x$enable_gallium_llvm" = xyes; then
 echo "LLVM_CFLAGS: $LLVM_CFLAGS"
 echo "LLVM_CXXFLAGS:   $LLVM_CXXFLAGS"
 echo "LLVM_CPPFLAGS:   $LLVM_CPPFLAGS"
-- 
2.11.0

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


[Mesa-dev] [PATCH 05/17] configure.ac: Mandate --enable-gallium-llvm when checking LLVM version

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

With this change we effectively require --enable-gallium-llvm when
building RADV. This should be perfectly safe since the gallium radeonsi
driver already explicitly requires it.

The "gallium" part in --enable-gallium-llvm is about to be removed soon
(not in stable) but until then make sure that things can build.

To reflect the requirement (as opposed to check previously) rename
llvm_check_version_for to llvm_require_version

Cc: Dave Airlie 
CC: Tobias Droste 
Cc: "17.0" 
Signed-off-by: Emil Velikov 
---
 configure.ac | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 525c8d2a91..4098da7666 100644
--- a/configure.ac
+++ b/configure.ac
@@ -966,11 +966,12 @@ require_llvm() {
 fi
 }
 
-llvm_check_version_for() {
+llvm_require_version() {
 if test "x$MESA_LLVM" = x0; then
 AC_MSG_ERROR([LLVM $1 or newer is required for $2])
 return
 fi
+require_llvm $2
 
 llvm_target_version_major=`echo $1 | cut -d. -f1 | egrep -o '^[[0-9]]+'`
 llvm_target_version_minor=`echo $1 | cut -d. -f2 | egrep -o '^[[0-9]]+'`
@@ -1011,7 +1012,7 @@ radeon_llvm_check() {
 amdgpu_llvm_target_name='amdgpu'
 fi
 
-llvm_check_version_for $*
+llvm_require_version $*
 
 llvm_add_target $amdgpu_llvm_target_name $2
 
@@ -2023,7 +2024,7 @@ if test "x$enable_opencl" = xyes; then
AC_MSG_ERROR([Clover requires libelf])
 fi
 
-llvm_check_version_for $LLVM_REQUIRED_OPENCL "opencl"
+llvm_require_version $LLVM_REQUIRED_OPENCL "opencl"
 
 llvm_add_default_components "opencl"
 llvm_add_component "all-targets" "opencl"
@@ -2334,8 +2335,7 @@ if test -n "$with_gallium_drivers"; then
 fi
 ;;
 xswr)
-llvm_check_version_for $LLVM_REQUIRED_SWR "swr"
-require_llvm "swr"
+llvm_require_version $LLVM_REQUIRED_SWR "swr"
 
 swr_require_cxx_feature_flags "C++11" "__cplusplus >= 201103L" \
 ",-std=c++11" \
@@ -2377,7 +2377,7 @@ if test -n "$with_gallium_drivers"; then
 fi
 
 if test "x$enable_gallium_llvm" == "xyes"; then
-llvm_check_version_for $LLVM_REQUIRED_GALLIUM "gallium"
+llvm_require_version $LLVM_REQUIRED_GALLIUM "gallium"
 llvm_add_default_components "gallium"
 fi
 
-- 
2.11.0

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


[Mesa-dev] [PATCH 04/17] configure.ac: Rename the gallium_require_llvm helper

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Drop the gallium prefix since we're about it use it throughout the
configure.

Note we do want to check for enable_gallium_llvm check since (as
explicitly requested) the toggle should mean --enable-llvm. We cannot do
the latter for stable so it will come with later patch.

Cc: Dave Airlie 
CC: Tobias Droste 
Cc: "17.0" 
Signed-off-by: Emil Velikov 
---
 configure.ac | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0c15c3f51d..525c8d2a91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -960,6 +960,12 @@ llvm_set_environment_variables() {
 fi
 }
 
+require_llvm() {
+if test "x$enable_gallium_llvm" != "xyes"; then
+AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+fi
+}
+
 llvm_check_version_for() {
 if test "x$MESA_LLVM" = x0; then
 AC_MSG_ERROR([LLVM $1 or newer is required for $2])
@@ -2189,15 +2195,6 @@ AC_ARG_WITH([d3d-libdir],
 AC_SUBST([D3D_DRIVER_INSTALL_DIR])
 
 dnl
-dnl Gallium helper functions
-dnl
-gallium_require_llvm() {
-if test "x$enable_gallium_llvm" != "xyes"; then
-AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
-fi
-}
-
-dnl
 dnl r300 doesn't strictly require LLVM, but for performance reasons we
 dnl highly recommend LLVM usage. So require it at least on x86 and x86_64
 dnl architectures.
@@ -2205,7 +2202,7 @@ dnl
 r300_require_llvm() {
 case "$host" in *gnux32) return;; esac
 case "$host_cpu" in
-i*86|x86_64|amd64) gallium_require_llvm $1
+i*86|x86_64|amd64) require_llvm $1
 ;;
 esac
 }
@@ -2338,7 +2335,7 @@ if test -n "$with_gallium_drivers"; then
 ;;
 xswr)
 llvm_check_version_for $LLVM_REQUIRED_SWR "swr"
-gallium_require_llvm "swr"
+require_llvm "swr"
 
 swr_require_cxx_feature_flags "C++11" "__cplusplus >= 201103L" \
 ",-std=c++11" \
-- 
2.11.0

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


[Mesa-dev] [PATCH 06/17] configure.ac: Remove artificial --enable-gallium-llvm dependency

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

... of non-empty --with-gallium-drivers.

Since we effectively made --enable-gallium-llvm mean --enable-llvm with
earlier commits, we need to remove the, now artificial, requirement.

Otherwise we'll error (as below) when building RADV.

configure: error: --enable-gallium-llvm is required when building radv

Cc: Dave Airlie 
CC: Tobias Droste 
Cc: "17.0" 
Signed-off-by: Emil Velikov 
---
 configure.ac | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4098da7666..88abc716c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1734,9 +1734,6 @@ AC_ARG_ENABLE([gallium-llvm],
 [enable_gallium_llvm="$enableval"],
 [enable_gallium_llvm=auto])
 
-if test -z "$with_gallium_drivers"; then
-enable_gallium_llvm=no
-fi
 if test "x$enable_gallium_llvm" = xauto; then
 case "$host_cpu" in
 i*86|x86_64|amd64) enable_gallium_llvm=yes;;
-- 
2.11.0

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


[Mesa-dev] [PATCH 01/17] configure.ac: remove unused AC_SUBST([MESA_LLVM])

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Signed-off-by: Emil Velikov 
---
 configure.ac | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a6ceee95a3..d9170770eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1021,7 +1021,6 @@ radeon_llvm_check() {
 
 llvm_set_environment_variables
 
-AC_SUBST([MESA_LLVM])
 AC_SUBST([LLVM_BINDIR])
 AC_SUBST([LLVM_CFLAGS])
 AC_SUBST([LLVM_CPPFLAGS])
-- 
2.11.0

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


[Mesa-dev] [PATCH 00/17] LLVM fixes, round 999

2017-02-07 Thread Emil Velikov
Hi all,

Here is hopefully the final round of LLVM build fixes which should 
address both Jose and Dave's concerns to not touch any source code.

In return the configure.ac changes ended up be twice as large, but 
overall fine. Considering that most of those must land in stable.

In gist -> enable-gallium-llvm has been updated to mean enable-llvm [as 
per Dave] meaning that RADV now requires it. Additionally the 
defines/CFLAGS/LIBS are set only when the toggle is set.

The final two patches of the series address the actual deprecation of 
--enable-gallium-llvm in favour of --enable-llvm.

Do give the series a look and test on your end. I've fuzzed things 
quite a few times although I may have missed something.

Thanks
Emil


Emil Velikov (14):
  configure.ac: remove unused AC_SUBST([MESA_LLVM])
  configure.ac: move AC_ARG_ENABLE([gallium-llvm] hunk further up
  configure.ac: Rename the  gallium_require_llvm helper
  configure.ac: Mandate --enable-gallium-llvm when checking LLVM version
  configure.ac: Remove artificial --enable-gallium-llvm dependency
  configure.ac: remove unused LLVM variables
  configure.ac: don't use == with test
  Revert "configure.ac: Create correct LLVM_VERSION_INT with minor >=
10"
  configure.ac: set LLVM_{C, CXX, LD}FLAGS only as needed
  configure.ac: disable enable_gallium_llvm in the !x86 case
  configure.ac: correctly manage llvm auto-detection
  configure.ac: remove dummy radeon_gallium_llvm_check()
  configure.ac: supersede --enable-gallium-llvm over --enable-llvm
  st/nine: update configure options in the README

Tobias Droste (3):
  configure.ac: Don't check LLVM version in require_llvm
  configure.ac: Rework MESA_LLVM and LLVM detection
  configure.ac: Only define HAVE_LLVM if LLVM is used

 Makefile.am|   2 +-
 configure.ac   | 155 -
 docs/releasing.html|   2 +-
 src/gallium/state_trackers/nine/README |   3 +-
 4 files changed, 77 insertions(+), 85 deletions(-)

-- 
2.11.0

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


[Mesa-dev] [PATCH 03/17] configure.ac: Don't check LLVM version in require_llvm

2017-02-07 Thread Emil Velikov
From: Tobias Droste 

This is actually not needed because the version is checked later.

Around line 2380
if test "x$enable_gallium_llvm" == "xyes"; then
llvm_check_version_for $LLVM_REQUIRED_GALLIUM "gallium"
llvm_add_default_components "gallium"
fi

Cc: "17.0" 
Cc: Tobias Droste 
Signed-off-by: Tobias Droste 
Reviewed-by: Emil Velikov  (v1)
v2: [Emil Velikov: rebase/respin series order]
Signed-off-by: Emil Velikov 
---
 configure.ac | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0418421d5a..0c15c3f51d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2192,9 +2192,7 @@ dnl
 dnl Gallium helper functions
 dnl
 gallium_require_llvm() {
-if test "x$enable_gallium_llvm" = "xyes"; then
-llvm_check_version_for $LLVM_REQUIRED_GALLIUM "gallium"
-else
+if test "x$enable_gallium_llvm" != "xyes"; then
 AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
 fi
 }
-- 
2.11.0

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


[Mesa-dev] [PATCH 02/17] configure.ac: move AC_ARG_ENABLE([gallium-llvm] hunk further up

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

With next commits we'll require --enable-gallium-llvm (en route to a
greater good later on) for RADV. The latter is required to ensure that
as otherwise we'll fail to build.

Cc: Dave Airlie 
CC: Tobias Droste 
Cc: "17.0" 
Signed-off-by: Emil Velikov 
---
 configure.ac | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index d9170770eb..0418421d5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1718,6 +1718,24 @@ if test -n "$with_dri_drivers"; then
 fi
 
 
+dnl
+dnl Gallium LLVM
+dnl
+AC_ARG_ENABLE([gallium-llvm],
+[AS_HELP_STRING([--enable-gallium-llvm],
+[build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
+[enable_gallium_llvm="$enableval"],
+[enable_gallium_llvm=auto])
+
+if test -z "$with_gallium_drivers"; then
+enable_gallium_llvm=no
+fi
+if test "x$enable_gallium_llvm" = xauto; then
+case "$host_cpu" in
+i*86|x86_64|amd64) enable_gallium_llvm=yes;;
+esac
+fi
+
 #
 # Vulkan driver configuration
 #
@@ -2124,24 +2142,6 @@ if ! echo "$egl_platforms" | grep -q 'x11'; then
 GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
 fi
 
-dnl
-dnl Gallium LLVM
-dnl
-AC_ARG_ENABLE([gallium-llvm],
-[AS_HELP_STRING([--enable-gallium-llvm],
-[build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
-[enable_gallium_llvm="$enableval"],
-[enable_gallium_llvm=auto])
-
-if test -z "$with_gallium_drivers"; then
-enable_gallium_llvm=no
-fi
-if test "x$enable_gallium_llvm" = xauto; then
-case "$host_cpu" in
-i*86|x86_64|amd64) enable_gallium_llvm=yes;;
-esac
-fi
-
 dnl Directory for XVMC libs
 AC_ARG_WITH([xvmc-libdir],
 [AS_HELP_STRING([--with-xvmc-libdir=DIR],
-- 
2.11.0

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


[Mesa-dev] [PATCH] wayland-drm: update use of struct wl_resource to avoid deprecated struct definition

2017-02-07 Thread Micah Fedke
Signed-off-by: Micah Fedke 
---
 src/egl/wayland/wayland-drm/wayland-drm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c 
b/src/egl/wayland/wayland-drm/wayland-drm.c
index 4fc12521d2..5c2bb0369e 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -55,7 +55,7 @@ struct wl_drm {
 static void
 destroy_buffer(struct wl_resource *resource)
 {
-   struct wl_drm_buffer *buffer = resource->data;
+   struct wl_drm_buffer *buffer = wl_resource_get_user_data(resource);
struct wl_drm *drm = buffer->drm;
 
drm->callbacks->release_buffer(drm->user_data, buffer);
@@ -77,7 +77,7 @@ create_buffer(struct wl_client *client, struct wl_resource 
*resource,
   int32_t offset1, int32_t stride1,
   int32_t offset2, int32_t stride2)
 {
-   struct wl_drm *drm = resource->data;
+   struct wl_drm *drm = wl_resource_get_user_data(resource);
struct wl_drm_buffer *buffer;
 
buffer = calloc(1, sizeof *buffer);
@@ -187,7 +187,7 @@ static void
 drm_authenticate(struct wl_client *client,
 struct wl_resource *resource, uint32_t id)
 {
-   struct wl_drm *drm = resource->data;
+   struct wl_drm *drm = wl_resource_get_user_data(resource);
 
if (drm->callbacks->authenticate(drm->user_data, id) < 0)
wl_resource_post_error(resource,
-- 
2.11.0

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


Re: [Mesa-dev] [PATCH 1/5] anv: Disable stencil writes when both write masks are zero

2017-02-07 Thread Nanley Chery
On Tue, Feb 07, 2017 at 12:25:18PM -0800, Jason Ekstrand wrote:
> On Tue, Feb 7, 2017 at 12:13 PM, Nanley Chery  wrote:
> 
> > On Wed, Feb 01, 2017 at 08:07:22PM -0800, Jason Ekstrand wrote:
> > > The only mechanism Vulkan provides for disabling stencil writes is to set
> >
> > This isn't the only mechanism for explicitly disabling stencil writes.
> > Stencil writes can also be disabled by disabling stencil testing (as can
> > be seen in this patch).
> >
> 
> I guess that is technically true.  I meant "it doesn't have a
> disableStencilWrites like it does for depth".  Maybe something like:
> 
> Vulkan doesn't have a stencilWriteEnable bit like it does for depth.
> Instead, you have a stencil mask.  Since the stencil mask is...
> 
> 

This is better.

> > > the stencil write mask to 0.  Since that is dynamic state, we have to
> > move
> > ^
> > extra word?
> >

Ping?

> > Users can actually set the write masks at pipeline creation time. For
> > that reason, I think it's clearer to say that it "may be" dynamic state
> > instead of saying that it "is" dynamic state.
> >
> 
> Maybe?  I guess it depends on whether you take "dynamic state" to mean
> "state the client set at runtime vs. set in the pipeline" or if you just
> consider it to mean the bucket of states that *may* be set at runtime.
> 

You're right. anv takes the position of "may," whereas the spec takes
the position of "is." It isn't necessarily clearer to default to the
spec's definitions when writing commit messages for driver code.

> 
> > > handle it late during command buffer builder.  This helps Dota2 by a
> > couple
> > > percent because it allows the hardware to move the depth and stencil
> > writes
> > > to early in more cases.
> >
> > I was only able to reproduce a 0.1% performance improvement with this
> > patch. Could show me how you're measuring the performance changes (on or
> > offline)?
> >
> 
> For one thing, it was on my BDW gt3 desktop.  Maybe SKL is impacted less?
> 

Ah, okay.

> 
> > -Nanley
> >
> > >
> > > v2 (Jason Ekstrand): Always initialize the new pipeline variable
> > > ---
> > >  src/intel/vulkan/anv_private.h | 1 +
> > >  src/intel/vulkan/gen7_cmd_buffer.c | 4 
> > >  src/intel/vulkan/gen8_cmd_buffer.c | 8 
> > >  src/intel/vulkan/genX_pipeline.c   | 4 +++-
> > >  4 files changed, 16 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_
> > private.h
> > > index a0cb35c..4fe3ebc 100644
> > > --- a/src/intel/vulkan/anv_private.h
> > > +++ b/src/intel/vulkan/anv_private.h
> > > @@ -1465,6 +1465,7 @@ struct anv_pipeline {
> > >
> > > uint32_t cs_right_mask;
> > >
> > > +   bool writes_stencil;
> > > bool depth_clamp_enable;
> > >
> > > struct {
> > > diff --git a/src/intel/vulkan/gen7_cmd_buffer.c
> > b/src/intel/vulkan/gen7_cmd_buffer.c
> > > index 8d68aba..013ed87 100644
> > > --- a/src/intel/vulkan/gen7_cmd_buffer.c
> > > +++ b/src/intel/vulkan/gen7_cmd_buffer.c
> > > @@ -212,6 +212,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct
> > anv_cmd_buffer *cmd_buffer)
> > >
> > >   .BackfaceStencilTestMask = d->stencil_compare_mask.back & 0xff,
> > >   .BackfaceStencilWriteMask = d->stencil_write_mask.back & 0xff,
> > > +
> > > + .StencilBufferWriteEnable =
> > > +(d->stencil_write_mask.front || d->stencil_write_mask.back)
> > &&
> > > +pipeline->writes_stencil,
> > >};
> > >GENX(DEPTH_STENCIL_STATE_pack)(NULL, depth_stencil_dw,
> > _stencil);
> > >
> > > diff --git a/src/intel/vulkan/gen8_cmd_buffer.c
> > b/src/intel/vulkan/gen8_cmd_buffer.c
> > > index ab68872..8c8de62 100644
> > > --- a/src/intel/vulkan/gen8_cmd_buffer.c
> > > +++ b/src/intel/vulkan/gen8_cmd_buffer.c
> > > @@ -224,6 +224,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct
> > anv_cmd_buffer *cmd_buffer)
> > >
> > >   .BackfaceStencilTestMask = d->stencil_compare_mask.back & 0xff,
> > >   .BackfaceStencilWriteMask = d->stencil_write_mask.back & 0xff,
> > > +
> > > + .StencilBufferWriteEnable =
> > > +(d->stencil_write_mask.front || d->stencil_write_mask.back)
> > &&
> > > +pipeline->writes_stencil,
> > >};
> > >GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, wm_depth_stencil_dw,
> > >_depth_stencil);
> > > @@ -271,6 +275,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct
> > anv_cmd_buffer *cmd_buffer)
> > >
> > >   .StencilReferenceValue = d->stencil_reference.front & 0xff,
> > >   .BackfaceStencilReferenceValue = d->stencil_reference.back &
> > 0xff,
> > > +
> > > + .StencilBufferWriteEnable =
> > > +

Re: [Mesa-dev] Time to merge threaded GL dispatch? (aka glthread)

2017-02-07 Thread Timothy Arceri
On Tue, 2017-02-07 at 10:56 +0100, Marek Olšák wrote:
> On Tue, Feb 7, 2017 at 2:57 AM, Kenneth Graunke  g> wrote:
> > On Monday, February 6, 2017 8:54:40 PM PST Marek Olšák wrote:
> > > On Mon, Feb 6, 2017 at 8:20 PM, Ernst Sjöstrand  > > > wrote:
> > > > FYI glmark2 segfaults with mesa_glthread=true. Expected that
> > > > some programs
> > > > will segfault?
> > > 
> > > Yes, even segfaults are expected with mesa_glthread=true.
> > > 
> > > Marek
> > 
> > Would it make sense to be crash-free or even regression-free on at
> > least Piglit, before merging?  (Or are we there already?)
> 
> It's not necessary. glthread is disabled by default. Nobody has
> tested
> piglit with glthread. That will follow after it's been merged, or
> never if it's never merged.

I've been trying to land shader-cache patches that actually do pass
piglit for over a year with the same reasoning that it will be disable
by default and can only be improved with testing I can't possibly do on
my own.

Although I have no objections to this being merged I'll be extremely
frustrated if this is allowed to be merged known to not even pass
piglit while I've wasted countless hours rebasing shader cache over
many months.


> 
> Marek
> ___
> 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] radv: handle dcc in explicit image resolve path.

2017-02-07 Thread Bas Nieuwenhuizen


On Tue, Feb 7, 2017, at 23:05, Dave Airlie wrote:
> From: Dave Airlie 
> 
> We need to initialize dcc like we do in the subpass path.
> 
> Signed-off-by: Dave Airlie 
> ---
>  src/amd/vulkan/radv_meta_resolve.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/amd/vulkan/radv_meta_resolve.c
> b/src/amd/vulkan/radv_meta_resolve.c
> index 66f1466..e7d47c2b 100644
> --- a/src/amd/vulkan/radv_meta_resolve.c
> +++ b/src/amd/vulkan/radv_meta_resolve.c
> @@ -116,7 +116,7 @@ create_pass(struct radv_device *device)
>  },
>  {
>  
> .attachment = 1,
> - 
> .layout = VK_IMAGE_LAYOUT_GENERAL,
> + 
> .layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,

If you change this, you also need to change the initialLayout and the
finalLayout.
 
>  },
>  },
>  .pResolveAttachments = 
> NULL,
> @@ -428,6 +428,9 @@ void radv_CmdResolveImage(
>   if (src_image->array_size > 1)
>   radv_finishme("vkCmdResolveImage: multisample array images");
>  
> +   if (dest_image->surface.dcc_size) {
> +   radv_initialize_dcc(cmd_buffer, dest_image, 0x);
> +   }

Ok.
>   for (uint32_t r = 0; r < region_count; ++r) {
>   const VkImageResolve *region = [r];
>  
> -- 
> 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] radv: handle dcc in explicit image resolve path.

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

We need to initialize dcc like we do in the subpass path.

Signed-off-by: Dave Airlie 
---
 src/amd/vulkan/radv_meta_resolve.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_meta_resolve.c 
b/src/amd/vulkan/radv_meta_resolve.c
index 66f1466..e7d47c2b 100644
--- a/src/amd/vulkan/radv_meta_resolve.c
+++ b/src/amd/vulkan/radv_meta_resolve.c
@@ -116,7 +116,7 @@ create_pass(struct radv_device *device)
   },
   {
   
.attachment = 1,
-  .layout 
= VK_IMAGE_LAYOUT_GENERAL,
+  .layout 
= VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
   },
   },
   .pResolveAttachments = 
NULL,
@@ -428,6 +428,9 @@ void radv_CmdResolveImage(
if (src_image->array_size > 1)
radv_finishme("vkCmdResolveImage: multisample array images");
 
+   if (dest_image->surface.dcc_size) {
+   radv_initialize_dcc(cmd_buffer, dest_image, 0x);
+   }
for (uint32_t r = 0; r < region_count; ++r) {
const VkImageResolve *region = [r];
 
-- 
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/5] gallium/u_inlines: fix member access within null pointer

2017-02-07 Thread Brian Paul
Yeah, it would never make sense to pass NULL as the first argument to 
any of the _reference() functions.


Would putting an assert(ptr) at the start of pipe_surface_reference(), 
for example, silence the UBSAN warning?


-Brian


On 02/07/2017 02:45 PM, Roland Scheidegger wrote:

I'm not quite sure there's really a bug here?
As far as I can tell, these functions are architected specifically to
look like that - they do not actually dereference potential null
pointers, but only take the address in the end. This change seems to add
some overhead.


Roland


Am 07.02.2017 um 19:34 schrieb Bartosz Tomczyk:

---
  src/gallium/auxiliary/util/u_inlines.h | 65 --
  1 file changed, 39 insertions(+), 26 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_inlines.h 
b/src/gallium/auxiliary/util/u_inlines.h
index b7b8313583..3bb3bcd6e0 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -104,14 +104,17 @@ pipe_reference(struct pipe_reference *ptr, struct 
pipe_reference *reference)
  }

  static inline void
-pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
+pipe_surface_reference(struct pipe_surface **pptr, struct pipe_surface *surf)
  {
-   struct pipe_surface *old_surf = *ptr;
+   struct pipe_surface *ptr = pptr ? *pptr : NULL;
+   struct pipe_surface *old_surf = ptr;

-   if (pipe_reference_described(&(*ptr)->reference, >reference,
+   if (pipe_reference_described(ptr ? >reference : NULL,
+surf ? >reference : NULL,
  
(debug_reference_descriptor)debug_describe_surface))
old_surf->context->surface_destroy(old_surf->context, old_surf);
-   *ptr = surf;
+
+   if (pptr) *pptr = surf;
  }

  /**
@@ -121,37 +124,43 @@ pipe_surface_reference(struct pipe_surface **ptr, struct 
pipe_surface *surf)
   * that's shared by multiple contexts.
   */
  static inline void
-pipe_surface_release(struct pipe_context *pipe, struct pipe_surface **ptr)
+pipe_surface_release(struct pipe_context *pipe, struct pipe_surface **pptr)
  {
-   if (pipe_reference_described(&(*ptr)->reference, NULL,
+   struct pipe_surface *ptr = pptr ? *pptr : NULL;
+   if (pipe_reference_described(ptr ? >reference : NULL, NULL,
  
(debug_reference_descriptor)debug_describe_surface))
-  pipe->surface_destroy(pipe, *ptr);
-   *ptr = NULL;
+  pipe->surface_destroy(pipe, ptr);
+   if (pptr) *pptr = NULL;
  }


  static inline void
-pipe_resource_reference(struct pipe_resource **ptr, struct pipe_resource *tex)
+pipe_resource_reference(struct pipe_resource **pptr, struct pipe_resource *tex)
  {
-   struct pipe_resource *old_tex = *ptr;
+   struct pipe_resource *ptr = pptr ? *pptr : NULL;
+   struct pipe_resource *old_tex = ptr;

-   if (pipe_reference_described(&(*ptr)->reference, >reference,
+   if (pipe_reference_described(ptr ? >reference : NULL,
+tex ? >reference : NULL,
  
(debug_reference_descriptor)debug_describe_resource)) {
pipe_resource_reference(_tex->next, NULL);
old_tex->screen->resource_destroy(old_tex->screen, old_tex);
 }
-   *ptr = tex;
+
+   if (pptr) *pptr = tex;
  }

  static inline void
-pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct 
pipe_sampler_view *view)
+pipe_sampler_view_reference(struct pipe_sampler_view **pptr, struct 
pipe_sampler_view *view)
  {
-   struct pipe_sampler_view *old_view = *ptr;
+   struct pipe_sampler_view *ptr = pptr ? *pptr : NULL;
+   struct pipe_sampler_view *old_view = ptr;

-   if (pipe_reference_described(&(*ptr)->reference, >reference,
+   if (pipe_reference_described(ptr ? >reference : NULL,
+view ? >reference : NULL,
  
(debug_reference_descriptor)debug_describe_sampler_view))
old_view->context->sampler_view_destroy(old_view->context, old_view);
-   *ptr = view;
+   if (pptr) *pptr = view;
  }

  /**
@@ -162,29 +171,33 @@ pipe_sampler_view_reference(struct pipe_sampler_view 
**ptr, struct pipe_sampler_
   */
  static inline void
  pipe_sampler_view_release(struct pipe_context *ctx,
-  struct pipe_sampler_view **ptr)
+  struct pipe_sampler_view **pptr)
  {
-   struct pipe_sampler_view *old_view = *ptr;
-   if (*ptr && (*ptr)->context != ctx) {
+   struct pipe_sampler_view *ptr = pptr ? *pptr : NULL;
+   struct pipe_sampler_view *old_view = ptr;
+
+   if (ptr && ptr->context != ctx) {
debug_printf_once(("context mis-match in 
pipe_sampler_view_release()\n"));
 }
-   if (pipe_reference_described(&(*ptr)->reference, NULL,
+   if (pipe_reference_described(ptr ? >reference : NULL, NULL,
  (debug_reference_descriptor)debug_describe_sampler_view)) 
{
ctx->sampler_view_destroy(ctx, old_view);
 }
-   *ptr = NULL;
+   if(pptr) *pptr = NULL;

Re: [Mesa-dev] [PATCH 1/5] gallium/u_inlines: fix member access within null pointer

2017-02-07 Thread Roland Scheidegger
I'm not quite sure there's really a bug here?
As far as I can tell, these functions are architected specifically to
look like that - they do not actually dereference potential null
pointers, but only take the address in the end. This change seems to add
some overhead.


Roland


Am 07.02.2017 um 19:34 schrieb Bartosz Tomczyk:
> ---
>  src/gallium/auxiliary/util/u_inlines.h | 65 
> --
>  1 file changed, 39 insertions(+), 26 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_inlines.h 
> b/src/gallium/auxiliary/util/u_inlines.h
> index b7b8313583..3bb3bcd6e0 100644
> --- a/src/gallium/auxiliary/util/u_inlines.h
> +++ b/src/gallium/auxiliary/util/u_inlines.h
> @@ -104,14 +104,17 @@ pipe_reference(struct pipe_reference *ptr, struct 
> pipe_reference *reference)
>  }
>  
>  static inline void
> -pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
> +pipe_surface_reference(struct pipe_surface **pptr, struct pipe_surface *surf)
>  {
> -   struct pipe_surface *old_surf = *ptr;
> +   struct pipe_surface *ptr = pptr ? *pptr : NULL;
> +   struct pipe_surface *old_surf = ptr;
>  
> -   if (pipe_reference_described(&(*ptr)->reference, >reference, 
> +   if (pipe_reference_described(ptr ? >reference : NULL,
> +surf ? >reference : NULL,
>  
> (debug_reference_descriptor)debug_describe_surface))
>old_surf->context->surface_destroy(old_surf->context, old_surf);
> -   *ptr = surf;
> +
> +   if (pptr) *pptr = surf;
>  }
>  
>  /**
> @@ -121,37 +124,43 @@ pipe_surface_reference(struct pipe_surface **ptr, 
> struct pipe_surface *surf)
>   * that's shared by multiple contexts.
>   */
>  static inline void
> -pipe_surface_release(struct pipe_context *pipe, struct pipe_surface **ptr)
> +pipe_surface_release(struct pipe_context *pipe, struct pipe_surface **pptr)
>  {
> -   if (pipe_reference_described(&(*ptr)->reference, NULL,
> +   struct pipe_surface *ptr = pptr ? *pptr : NULL;
> +   if (pipe_reference_described(ptr ? >reference : NULL, NULL,
>  
> (debug_reference_descriptor)debug_describe_surface))
> -  pipe->surface_destroy(pipe, *ptr);
> -   *ptr = NULL;
> +  pipe->surface_destroy(pipe, ptr);
> +   if (pptr) *pptr = NULL;
>  }
>  
>  
>  static inline void
> -pipe_resource_reference(struct pipe_resource **ptr, struct pipe_resource 
> *tex)
> +pipe_resource_reference(struct pipe_resource **pptr, struct pipe_resource 
> *tex)
>  {
> -   struct pipe_resource *old_tex = *ptr;
> +   struct pipe_resource *ptr = pptr ? *pptr : NULL;
> +   struct pipe_resource *old_tex = ptr;
>  
> -   if (pipe_reference_described(&(*ptr)->reference, >reference, 
> +   if (pipe_reference_described(ptr ? >reference : NULL,
> +tex ? >reference : NULL, 
>  
> (debug_reference_descriptor)debug_describe_resource)) {
>pipe_resource_reference(_tex->next, NULL);
>old_tex->screen->resource_destroy(old_tex->screen, old_tex);
> }
> -   *ptr = tex;
> +
> +   if (pptr) *pptr = tex;
>  }
>  
>  static inline void
> -pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct 
> pipe_sampler_view *view)
> +pipe_sampler_view_reference(struct pipe_sampler_view **pptr, struct 
> pipe_sampler_view *view)
>  {
> -   struct pipe_sampler_view *old_view = *ptr;
> +   struct pipe_sampler_view *ptr = pptr ? *pptr : NULL;
> +   struct pipe_sampler_view *old_view = ptr;
>  
> -   if (pipe_reference_described(&(*ptr)->reference, >reference,
> +   if (pipe_reference_described(ptr ? >reference : NULL,
> +view ? >reference : NULL,
>  
> (debug_reference_descriptor)debug_describe_sampler_view))
>old_view->context->sampler_view_destroy(old_view->context, old_view);
> -   *ptr = view;
> +   if (pptr) *pptr = view;
>  }
>  
>  /**
> @@ -162,29 +171,33 @@ pipe_sampler_view_reference(struct pipe_sampler_view 
> **ptr, struct pipe_sampler_
>   */
>  static inline void
>  pipe_sampler_view_release(struct pipe_context *ctx,
> -  struct pipe_sampler_view **ptr)
> +  struct pipe_sampler_view **pptr)
>  {
> -   struct pipe_sampler_view *old_view = *ptr;
> -   if (*ptr && (*ptr)->context != ctx) {
> +   struct pipe_sampler_view *ptr = pptr ? *pptr : NULL;
> +   struct pipe_sampler_view *old_view = ptr;
> +
> +   if (ptr && ptr->context != ctx) {
>debug_printf_once(("context mis-match in 
> pipe_sampler_view_release()\n"));
> }
> -   if (pipe_reference_described(&(*ptr)->reference, NULL,
> +   if (pipe_reference_described(ptr ? >reference : NULL, NULL,
>  
> (debug_reference_descriptor)debug_describe_sampler_view)) {
>ctx->sampler_view_destroy(ctx, old_view);
> }
> -   *ptr = NULL;
> +   if(pptr) *pptr = NULL;
>  }
>  
>  static inline void
> 

Re: [Mesa-dev] [PATCH 35/40] util/disk_cache: allow drivers to pass a directory structure

2017-02-07 Thread Timothy Arceri
On Wed, 8 Feb 2017 08:29:29 +1100
Timothy Arceri  wrote:

> On Tue, 7 Feb 2017 11:40:12 -0600
> Aaron Watry  wrote:
> 
> > On Mon, Feb 6, 2017 at 9:42 PM, Timothy Arceri
> >  wrote:
> > 
> > > In order to avoid costly fallback recompiles when cache items are
> > > created with an old version of Mesa or for a different gpu on the
> > > same system we want to create directories that look like this:
> > >
> > > ./{MESA_VERSION_STRING}/{GPU_ID}
> > >
> > > For llvm based drivers we will probably want an additional
> > > {LLVM_VERSION} folder although it looks like there is currently
> > > no support for querying this at runtime.
> > > ---
> > >  src/compiler/glsl/tests/cache_test.c | 20 ++--
> > >  src/util/disk_cache.c| 29
> > > + src/util/disk_cache.h
> > > |  4 ++-- 3 files changed, 37 insertions(+), 16 deletions(-)
> > >
> > > diff --git a/src/compiler/glsl/tests/cache_test.c
> > > b/src/compiler/glsl/tests/cache_test.c
> > > index 8547141..ba56441 100644
> > > --- a/src/compiler/glsl/tests/cache_test.c
> > > +++ b/src/compiler/glsl/tests/cache_test.c
> > > @@ -126,7 +126,7 @@ test_disk_cache_create(void)
> > >  * MESA_GLSL_CACHE_DISABLE set, that disk_cache_create returns
> > > NULL. */
> > > setenv("MESA_GLSL_CACHE_DISABLE", "1", 1);
> > > -   cache = disk_cache_create();
> > > +   cache = disk_cache_create("test", "make_check");
> > > expect_null(cache, "disk_cache_create with
> > > MESA_GLSL_CACHE_DISABLE set");
> > >
> > > unsetenv("MESA_GLSL_CACHE_DISABLE");
> > > @@ -137,19 +137,19 @@ test_disk_cache_create(void)
> > > unsetenv("MESA_GLSL_CACHE_DIR");
> > > unsetenv("XDG_CACHE_HOME");
> > >
> > > -   cache = disk_cache_create();
> > > +   cache = disk_cache_create("test", "make_check");
> > > expect_non_null(cache, "disk_cache_create with no environment
> > > variables");
> > >
> > > disk_cache_destroy(cache);
> > >
> > > /* Test with XDG_CACHE_HOME set */
> > > setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1);
> > > -   cache = disk_cache_create();
> > > +   cache = disk_cache_create("test", "make_check");
> > > expect_null(cache, "disk_cache_create with XDG_CACHE_HOME set
> > > with" "a non-existing parent directory");
> > >
> > > mkdir(CACHE_TEST_TMP, 0755);
> > > -   cache = disk_cache_create();
> > > +   cache = disk_cache_create("test", "make_check");
> > > expect_non_null(cache, "disk_cache_create with XDG_CACHE_HOME
> > > set");
> > >
> > > disk_cache_destroy(cache);
> > > @@ -159,12 +159,12 @@ test_disk_cache_create(void)
> > > expect_equal(err, 0, "Removing " CACHE_TEST_TMP);
> > >
> > > setenv("MESA_GLSL_CACHE_DIR", CACHE_TEST_TMP
> > > "/mesa-glsl-cache-dir", 1);
> > > -   cache = disk_cache_create();
> > > +   cache = disk_cache_create("test", "make_check");
> > > expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR
> > > set with"
> > > "a non-existing parent directory");
> > >
> > > mkdir(CACHE_TEST_TMP, 0755);
> > > -   cache = disk_cache_create();
> > > +   cache = disk_cache_create("test", "make_check");
> > > expect_non_null(cache, "disk_cache_create with
> > > MESA_GLSL_CACHE_DIR set");
> > >
> > > disk_cache_destroy(cache);
> > > @@ -203,7 +203,7 @@ test_put_and_get(void)
> > > uint8_t one_KB_key[20], one_MB_key[20];
> > > int count;
> > >
> > > -   cache = disk_cache_create();
> > > +   cache = disk_cache_create("test", "make_check");
> > >
> > > _mesa_sha1_compute(blob, sizeof(blob), blob_key);
> > >
> > > @@ -235,7 +235,7 @@ test_put_and_get(void)
> > > disk_cache_destroy(cache);
> > >
> > > setenv("MESA_GLSL_CACHE_MAX_SIZE", "1K", 1);
> > > -   cache = disk_cache_create();
> > > +   cache = disk_cache_create("test", "make_check");
> > >
> > > one_KB = calloc(1, 1024);
> > >
> > > @@ -287,7 +287,7 @@ test_put_and_get(void)
> > > disk_cache_destroy(cache);
> > >
> > > setenv("MESA_GLSL_CACHE_MAX_SIZE", "1M", 1);
> > > -   cache = disk_cache_create();
> > > +   cache = disk_cache_create("test", "make_check");
> > >
> > > disk_cache_put(cache, blob_key, blob, sizeof(blob));
> > > disk_cache_put(cache, string_key, string, sizeof(string));
> > > @@ -343,7 +343,7 @@ test_put_key_and_get_key(void)
> > >  { 0,  1, 42, 43, 44, 45, 46, 47, 48, 49,
> > >   50, 55, 52, 53, 54, 55, 56, 57, 58, 59};
> > >
> > > -   cache = disk_cache_create();
> > > +   cache = disk_cache_create("test", "make_check");
> > >
> > > /* First test that disk_cache_has_key returns false before
> > > disk_cache_put_key */
> > > result = disk_cache_has_key(cache, key_a);
> > > diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> > > index 382ac6c..df511e4 100644
> > > --- a/src/util/disk_cache.c
> > > +++ b/src/util/disk_cache.c
> > > @@ -115,7 +115,7 @@ 

[Mesa-dev] [Bug 98263] [radv] The Talos Principle fails to launch with "Fatal error: Cannot set display mode."

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

--- Comment #8 from Rene Lindsay  ---
The "No DRI3 support" is only relevant when the desktop is running on Intel,
but also gets displayed whenever NVidia is used, regardless of whether DRI3 was
enabled or not.  Maybe this message should be muted if more than one GPU is
detected?

As for the "buggy applications can crash" part, it implies that MY Vulkan app
is buggy, which is completely unacceptable!!

This has already lead to people incorrectly filing bugs against other Vulkan
app developers.  ( see: https://github.com/SaschaWillems/Vulkan/issues/226 )

-- 
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] r600g/sb: Fix memory leak by reworking uses list

2017-02-07 Thread Heiko Przybyl
When fixing the stalls on evergreen I introduced leaking of the useinfo
structure(s). Sorry. Instead of allocating a new object to hold 3 values
where only one is actually used, rework the list to just store the node
pointer. Thus no allocating and deallocation is needed. Since use_info
and use_kind aren't used anywhere, drop them and reduce code complexity.
This might also save some small amount of cycles.

Thanks to Bartosz Tomczyk for finding the bug.

Reported-by: Bartosz Tomczyk 
Signed-off-by: Heiko Przybyl 
Supersedes: https://patchwork.freedesktop.org/patch/135852
---
 src/gallium/drivers/r600/sb/sb_def_use.cpp  | 29 +++--
 src/gallium/drivers/r600/sb/sb_gcm.cpp  | 16 
 src/gallium/drivers/r600/sb/sb_ir.h | 23 ++-
 src/gallium/drivers/r600/sb/sb_valtable.cpp | 13 ++---
 4 files changed, 27 insertions(+), 54 deletions(-)

diff --git a/src/gallium/drivers/r600/sb/sb_def_use.cpp 
b/src/gallium/drivers/r600/sb/sb_def_use.cpp
index a512d92086..68ab4ca26c 100644
--- a/src/gallium/drivers/r600/sb/sb_def_use.cpp
+++ b/src/gallium/drivers/r600/sb/sb_def_use.cpp
@@ -106,58 +106,51 @@ void def_use::process_defs(node *n, vvec , bool 
arr_def) {
 }
 
 void def_use::process_uses(node* n) {
-   unsigned k = 0;
-
-   for (vvec::iterator I = n->src.begin(), E = n->src.end(); I != E;
-   ++I, ++k) {
+   for (vvec::iterator I = n->src.begin(), E = n->src.end(); I != E; ++I) {
value *v = *I;
if (!v || v->is_readonly())
continue;
 
if (v->is_rel()) {
if (!v->rel->is_readonly())
-   v->rel->add_use(n, UK_SRC_REL, k);
+   v->rel->add_use(n);
 
-   unsigned k2 = 0;
for (vvec::iterator I = v->muse.begin(), E = 
v->muse.end();
-   I != E; ++I, ++k2) {
+   I != E; ++I) {
value *v = *I;
if (!v)
continue;
 
-   v->add_use(n, UK_MAYUSE, k2);
+   v->add_use(n);
}
} else
-   v->add_use(n, UK_SRC, k);
+   v->add_use(n);
}
 
-   k = 0;
-   for (vvec::iterator I = n->dst.begin(), E = n->dst.end(); I != E;
-   ++I, ++k) {
+   for (vvec::iterator I = n->dst.begin(), E = n->dst.end(); I != E; ++I) {
value *v = *I;
if (!v || !v->is_rel())
continue;
 
if (!v->rel->is_readonly())
-   v->rel->add_use(n, UK_DST_REL, k);
-   unsigned k2 = 0;
+   v->rel->add_use(n);
for (vvec::iterator I = v->muse.begin(), E = v->muse.end();
-   I != E; ++I, ++k2) {
+   I != E; ++I) {
value *v = *I;
if (!v)
continue;
 
-   v->add_use(n, UK_MAYDEF, k2);
+   v->add_use(n);
}
}
 
if (n->pred)
-   n->pred->add_use(n, UK_PRED, 0);
+   n->pred->add_use(n);
 
if (n->type == NT_IF) {
if_node *i = static_cast(n);
if (i->cond)
-   i->cond->add_use(i, UK_COND, 0);
+   i->cond->add_use(i);
}
 }
 
diff --git a/src/gallium/drivers/r600/sb/sb_gcm.cpp 
b/src/gallium/drivers/r600/sb/sb_gcm.cpp
index 9c75389ada..7b43a32818 100644
--- a/src/gallium/drivers/r600/sb/sb_gcm.cpp
+++ b/src/gallium/drivers/r600/sb/sb_gcm.cpp
@@ -200,27 +200,27 @@ void gcm::td_release_val(value *v) {
);
 
for (uselist::iterator I = v->uses.begin(), E = v->uses.end(); I != E; 
++I) {
-   use_info *u = *I;
-   if (u->op->parent != ) {
+   node *op = *I;
+   if (op->parent != ) {
continue;
}
 
GCM_DUMP(
sblog << "tdused in ";
-   dump::dump_op(u->op);
+   dump::dump_op(op);
sblog << "\n";
);
 
-   assert(uses[u->op] > 0);
-   if (--uses[u->op] == 0) {
+   assert(uses[op] > 0);
+   if (--uses[op] == 0) {
GCM_DUMP(
sblog << "tdreleased : ";
-   dump::dump_op(u->op);
+   dump::dump_op(op);
sblog << "\n";
);
 
- 

Re: [Mesa-dev] GLSL IR & TGSI on-disk shader cache

2017-02-07 Thread Timothy Arceri
On Tue, 7 Feb 2017 16:54:31 +0100
Marek Olšák  wrote:

> On Tue, Feb 7, 2017 at 4:42 AM, Timothy Arceri
>  wrote:
> > Without the radeonsi patch min fps still goes up around 4 fps in
> > the Shadow of Mordor benchmark (although the stalls are still
> > very noticeable).  
> 
> I don't fully understand this. Can you elaborate on that?
> 
> There are 4 tests that can be done:
> 1) no shader cache: run the benchmark with mesa/master once
> 2) radeonsi cache: run the benchmark with mesa/master for the second
> time in the same process
> 3) glsl-tgsi cache: run the benchmark with your branch once after the
> disk cache is ready
> 4) both caches: run the benchmark with your branch for the second time
> in the same process

Since this is a series testing on-disk cache all tests are done by
running the benchmark once then closing the game before the next run.

Running the game for the second time where tgsi shaders are loaded from
cache improves the min fps and improves the various stalls where
shaders are compiles during the benchmark but does not eliminate them.
Adding the radoensi cache makes the benchmark run smoothly.

> 
> Marek
> ___
> 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 35/40] util/disk_cache: allow drivers to pass a directory structure

2017-02-07 Thread Timothy Arceri
On Tue, 7 Feb 2017 11:40:12 -0600
Aaron Watry  wrote:

> On Mon, Feb 6, 2017 at 9:42 PM, Timothy Arceri 
> wrote:
> 
> > In order to avoid costly fallback recompiles when cache items are
> > created with an old version of Mesa or for a different gpu on the
> > same system we want to create directories that look like this:
> >
> > ./{MESA_VERSION_STRING}/{GPU_ID}
> >
> > For llvm based drivers we will probably want an additional
> > {LLVM_VERSION} folder although it looks like there is currently
> > no support for querying this at runtime.
> > ---
> >  src/compiler/glsl/tests/cache_test.c | 20 ++--
> >  src/util/disk_cache.c| 29
> > + src/util/disk_cache.h
> > |  4 ++-- 3 files changed, 37 insertions(+), 16 deletions(-)
> >
> > diff --git a/src/compiler/glsl/tests/cache_test.c
> > b/src/compiler/glsl/tests/cache_test.c
> > index 8547141..ba56441 100644
> > --- a/src/compiler/glsl/tests/cache_test.c
> > +++ b/src/compiler/glsl/tests/cache_test.c
> > @@ -126,7 +126,7 @@ test_disk_cache_create(void)
> >  * MESA_GLSL_CACHE_DISABLE set, that disk_cache_create returns
> > NULL. */
> > setenv("MESA_GLSL_CACHE_DISABLE", "1", 1);
> > -   cache = disk_cache_create();
> > +   cache = disk_cache_create("test", "make_check");
> > expect_null(cache, "disk_cache_create with
> > MESA_GLSL_CACHE_DISABLE set");
> >
> > unsetenv("MESA_GLSL_CACHE_DISABLE");
> > @@ -137,19 +137,19 @@ test_disk_cache_create(void)
> > unsetenv("MESA_GLSL_CACHE_DIR");
> > unsetenv("XDG_CACHE_HOME");
> >
> > -   cache = disk_cache_create();
> > +   cache = disk_cache_create("test", "make_check");
> > expect_non_null(cache, "disk_cache_create with no environment
> > variables");
> >
> > disk_cache_destroy(cache);
> >
> > /* Test with XDG_CACHE_HOME set */
> > setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1);
> > -   cache = disk_cache_create();
> > +   cache = disk_cache_create("test", "make_check");
> > expect_null(cache, "disk_cache_create with XDG_CACHE_HOME set
> > with" "a non-existing parent directory");
> >
> > mkdir(CACHE_TEST_TMP, 0755);
> > -   cache = disk_cache_create();
> > +   cache = disk_cache_create("test", "make_check");
> > expect_non_null(cache, "disk_cache_create with XDG_CACHE_HOME
> > set");
> >
> > disk_cache_destroy(cache);
> > @@ -159,12 +159,12 @@ test_disk_cache_create(void)
> > expect_equal(err, 0, "Removing " CACHE_TEST_TMP);
> >
> > setenv("MESA_GLSL_CACHE_DIR", CACHE_TEST_TMP
> > "/mesa-glsl-cache-dir", 1);
> > -   cache = disk_cache_create();
> > +   cache = disk_cache_create("test", "make_check");
> > expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR
> > set with"
> > "a non-existing parent directory");
> >
> > mkdir(CACHE_TEST_TMP, 0755);
> > -   cache = disk_cache_create();
> > +   cache = disk_cache_create("test", "make_check");
> > expect_non_null(cache, "disk_cache_create with
> > MESA_GLSL_CACHE_DIR set");
> >
> > disk_cache_destroy(cache);
> > @@ -203,7 +203,7 @@ test_put_and_get(void)
> > uint8_t one_KB_key[20], one_MB_key[20];
> > int count;
> >
> > -   cache = disk_cache_create();
> > +   cache = disk_cache_create("test", "make_check");
> >
> > _mesa_sha1_compute(blob, sizeof(blob), blob_key);
> >
> > @@ -235,7 +235,7 @@ test_put_and_get(void)
> > disk_cache_destroy(cache);
> >
> > setenv("MESA_GLSL_CACHE_MAX_SIZE", "1K", 1);
> > -   cache = disk_cache_create();
> > +   cache = disk_cache_create("test", "make_check");
> >
> > one_KB = calloc(1, 1024);
> >
> > @@ -287,7 +287,7 @@ test_put_and_get(void)
> > disk_cache_destroy(cache);
> >
> > setenv("MESA_GLSL_CACHE_MAX_SIZE", "1M", 1);
> > -   cache = disk_cache_create();
> > +   cache = disk_cache_create("test", "make_check");
> >
> > disk_cache_put(cache, blob_key, blob, sizeof(blob));
> > disk_cache_put(cache, string_key, string, sizeof(string));
> > @@ -343,7 +343,7 @@ test_put_key_and_get_key(void)
> >  { 0,  1, 42, 43, 44, 45, 46, 47, 48, 49,
> >   50, 55, 52, 53, 54, 55, 56, 57, 58, 59};
> >
> > -   cache = disk_cache_create();
> > +   cache = disk_cache_create("test", "make_check");
> >
> > /* First test that disk_cache_has_key returns false before
> > disk_cache_put_key */
> > result = disk_cache_has_key(cache, key_a);
> > diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> > index 382ac6c..df511e4 100644
> > --- a/src/util/disk_cache.c
> > +++ b/src/util/disk_cache.c
> > @@ -115,7 +115,7 @@ mkdir_if_needed(char *path)
> >   *  / cannot be created as a directory
> >   */
> >  static char *
> > -concatenate_and_mkdir(void *ctx, char *path, char *name)
> > +concatenate_and_mkdir(void *ctx, char *path, const char *name)
> >  {
> > char *new_path;
> > struct stat sb;
> > @@ -131,8 +131,27 @@ concatenate_and_mkdir(void 

[Mesa-dev] [PATCH] intel/blorp: do not return const data by get_px_size_sa()

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Not much point in the const qualifier since we provide a copy to the
user. Resolves the following -Wignored-qualifiers warning.

src/intel/blorp/blorp_blit.c:1857:8: warning: 'const' type qualifier on
return type has no effect [-Wignored-qualifiers]

Cc: Jason Ekstrand 
Signed-off-by: Emil Velikov 
---
 src/intel/blorp/blorp_blit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 111f1c13a8..dcfc06540c 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -1857,10 +1857,10 @@ adjust_split_source_coords(const struct blt_axis *orig,
split_coords->src1 = orig->src1 + (scale >= 0.0 ? delta1 : delta0);
 }
 
-static const struct isl_extent2d
+static struct isl_extent2d
 get_px_size_sa(const struct isl_surf *surf)
 {
-   static const struct isl_extent2d one_to_one = { .w = 1, .h = 1 };
+   static struct isl_extent2d one_to_one = { .w = 1, .h = 1 };
 
if (surf->msaa_layout != ISL_MSAA_LAYOUT_INTERLEAVED)
   return one_to_one;
-- 
2.11.0

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


Re: [Mesa-dev] [PATCH 1/5] anv: Disable stencil writes when both write masks are zero

2017-02-07 Thread Jason Ekstrand
On Tue, Feb 7, 2017 at 12:13 PM, Nanley Chery  wrote:

> On Wed, Feb 01, 2017 at 08:07:22PM -0800, Jason Ekstrand wrote:
> > The only mechanism Vulkan provides for disabling stencil writes is to set
>
> This isn't the only mechanism for explicitly disabling stencil writes.
> Stencil writes can also be disabled by disabling stencil testing (as can
> be seen in this patch).
>

I guess that is technically true.  I meant "it doesn't have a
disableStencilWrites like it does for depth".  Maybe something like:

Vulkan doesn't have a stencilWriteEnable bit like it does for depth.
Instead, you have a stencil mask.  Since the stencil mask is...


> > the stencil write mask to 0.  Since that is dynamic state, we have to
> move
> ^
> extra word?
>
> Users can actually set the write masks at pipeline creation time. For
> that reason, I think it's clearer to say that it "may be" dynamic state
> instead of saying that it "is" dynamic state.
>

Maybe?  I guess it depends on whether you take "dynamic state" to mean
"state the client set at runtime vs. set in the pipeline" or if you just
consider it to mean the bucket of states that *may* be set at runtime.


> > handle it late during command buffer builder.  This helps Dota2 by a
> couple
> > percent because it allows the hardware to move the depth and stencil
> writes
> > to early in more cases.
>
> I was only able to reproduce a 0.1% performance improvement with this
> patch. Could show me how you're measuring the performance changes (on or
> offline)?
>

For one thing, it was on my BDW gt3 desktop.  Maybe SKL is impacted less?


> -Nanley
>
> >
> > v2 (Jason Ekstrand): Always initialize the new pipeline variable
> > ---
> >  src/intel/vulkan/anv_private.h | 1 +
> >  src/intel/vulkan/gen7_cmd_buffer.c | 4 
> >  src/intel/vulkan/gen8_cmd_buffer.c | 8 
> >  src/intel/vulkan/genX_pipeline.c   | 4 +++-
> >  4 files changed, 16 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_
> private.h
> > index a0cb35c..4fe3ebc 100644
> > --- a/src/intel/vulkan/anv_private.h
> > +++ b/src/intel/vulkan/anv_private.h
> > @@ -1465,6 +1465,7 @@ struct anv_pipeline {
> >
> > uint32_t cs_right_mask;
> >
> > +   bool writes_stencil;
> > bool depth_clamp_enable;
> >
> > struct {
> > diff --git a/src/intel/vulkan/gen7_cmd_buffer.c
> b/src/intel/vulkan/gen7_cmd_buffer.c
> > index 8d68aba..013ed87 100644
> > --- a/src/intel/vulkan/gen7_cmd_buffer.c
> > +++ b/src/intel/vulkan/gen7_cmd_buffer.c
> > @@ -212,6 +212,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct
> anv_cmd_buffer *cmd_buffer)
> >
> >   .BackfaceStencilTestMask = d->stencil_compare_mask.back & 0xff,
> >   .BackfaceStencilWriteMask = d->stencil_write_mask.back & 0xff,
> > +
> > + .StencilBufferWriteEnable =
> > +(d->stencil_write_mask.front || d->stencil_write_mask.back)
> &&
> > +pipeline->writes_stencil,
> >};
> >GENX(DEPTH_STENCIL_STATE_pack)(NULL, depth_stencil_dw,
> _stencil);
> >
> > diff --git a/src/intel/vulkan/gen8_cmd_buffer.c
> b/src/intel/vulkan/gen8_cmd_buffer.c
> > index ab68872..8c8de62 100644
> > --- a/src/intel/vulkan/gen8_cmd_buffer.c
> > +++ b/src/intel/vulkan/gen8_cmd_buffer.c
> > @@ -224,6 +224,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct
> anv_cmd_buffer *cmd_buffer)
> >
> >   .BackfaceStencilTestMask = d->stencil_compare_mask.back & 0xff,
> >   .BackfaceStencilWriteMask = d->stencil_write_mask.back & 0xff,
> > +
> > + .StencilBufferWriteEnable =
> > +(d->stencil_write_mask.front || d->stencil_write_mask.back)
> &&
> > +pipeline->writes_stencil,
> >};
> >GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, wm_depth_stencil_dw,
> >_depth_stencil);
> > @@ -271,6 +275,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct
> anv_cmd_buffer *cmd_buffer)
> >
> >   .StencilReferenceValue = d->stencil_reference.front & 0xff,
> >   .BackfaceStencilReferenceValue = d->stencil_reference.back &
> 0xff,
> > +
> > + .StencilBufferWriteEnable =
> > +(d->stencil_write_mask.front || d->stencil_write_mask.back)
> &&
> > +pipeline->writes_stencil,
> >};
> >GEN9_3DSTATE_WM_DEPTH_STENCIL_pack(NULL, dwords,
> _depth_stencil);
> >
> > diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_
> pipeline.c
> > index 9d28466..18fe48c 100644
> > --- a/src/intel/vulkan/genX_pipeline.c
> > +++ b/src/intel/vulkan/genX_pipeline.c
> > @@ -652,12 +652,15 @@ emit_ds_state(struct anv_pipeline *pipeline,
> >/* We're going to OR this together with the dynamic 

Re: [Mesa-dev] [PATCH 1/5] anv: Disable stencil writes when both write masks are zero

2017-02-07 Thread Nanley Chery
On Wed, Feb 01, 2017 at 08:07:22PM -0800, Jason Ekstrand wrote:
> The only mechanism Vulkan provides for disabling stencil writes is to set

This isn't the only mechanism for explicitly disabling stencil writes.
Stencil writes can also be disabled by disabling stencil testing (as can
be seen in this patch).

> the stencil write mask to 0.  Since that is dynamic state, we have to move
^
extra word?

Users can actually set the write masks at pipeline creation time. For
that reason, I think it's clearer to say that it "may be" dynamic state
instead of saying that it "is" dynamic state.

> handle it late during command buffer builder.  This helps Dota2 by a couple
> percent because it allows the hardware to move the depth and stencil writes
> to early in more cases.

I was only able to reproduce a 0.1% performance improvement with this
patch. Could show me how you're measuring the performance changes (on or
offline)?

-Nanley

> 
> v2 (Jason Ekstrand): Always initialize the new pipeline variable
> ---
>  src/intel/vulkan/anv_private.h | 1 +
>  src/intel/vulkan/gen7_cmd_buffer.c | 4 
>  src/intel/vulkan/gen8_cmd_buffer.c | 8 
>  src/intel/vulkan/genX_pipeline.c   | 4 +++-
>  4 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
> index a0cb35c..4fe3ebc 100644
> --- a/src/intel/vulkan/anv_private.h
> +++ b/src/intel/vulkan/anv_private.h
> @@ -1465,6 +1465,7 @@ struct anv_pipeline {
>  
> uint32_t cs_right_mask;
>  
> +   bool writes_stencil;
> bool depth_clamp_enable;
>  
> struct {
> diff --git a/src/intel/vulkan/gen7_cmd_buffer.c 
> b/src/intel/vulkan/gen7_cmd_buffer.c
> index 8d68aba..013ed87 100644
> --- a/src/intel/vulkan/gen7_cmd_buffer.c
> +++ b/src/intel/vulkan/gen7_cmd_buffer.c
> @@ -212,6 +212,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct 
> anv_cmd_buffer *cmd_buffer)
>  
>   .BackfaceStencilTestMask = d->stencil_compare_mask.back & 0xff,
>   .BackfaceStencilWriteMask = d->stencil_write_mask.back & 0xff,
> +
> + .StencilBufferWriteEnable =
> +(d->stencil_write_mask.front || d->stencil_write_mask.back) &&
> +pipeline->writes_stencil,
>};
>GENX(DEPTH_STENCIL_STATE_pack)(NULL, depth_stencil_dw, _stencil);
>  
> diff --git a/src/intel/vulkan/gen8_cmd_buffer.c 
> b/src/intel/vulkan/gen8_cmd_buffer.c
> index ab68872..8c8de62 100644
> --- a/src/intel/vulkan/gen8_cmd_buffer.c
> +++ b/src/intel/vulkan/gen8_cmd_buffer.c
> @@ -224,6 +224,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct 
> anv_cmd_buffer *cmd_buffer)
>  
>   .BackfaceStencilTestMask = d->stencil_compare_mask.back & 0xff,
>   .BackfaceStencilWriteMask = d->stencil_write_mask.back & 0xff,
> +
> + .StencilBufferWriteEnable =
> +(d->stencil_write_mask.front || d->stencil_write_mask.back) &&
> +pipeline->writes_stencil,
>};
>GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, wm_depth_stencil_dw,
>_depth_stencil);
> @@ -271,6 +275,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct 
> anv_cmd_buffer *cmd_buffer)
>  
>   .StencilReferenceValue = d->stencil_reference.front & 0xff,
>   .BackfaceStencilReferenceValue = d->stencil_reference.back & 0xff,
> +
> + .StencilBufferWriteEnable =
> +(d->stencil_write_mask.front || d->stencil_write_mask.back) &&
> +pipeline->writes_stencil,
>};
>GEN9_3DSTATE_WM_DEPTH_STENCIL_pack(NULL, dwords, _depth_stencil);
>  
> diff --git a/src/intel/vulkan/genX_pipeline.c 
> b/src/intel/vulkan/genX_pipeline.c
> index 9d28466..18fe48c 100644
> --- a/src/intel/vulkan/genX_pipeline.c
> +++ b/src/intel/vulkan/genX_pipeline.c
> @@ -652,12 +652,15 @@ emit_ds_state(struct anv_pipeline *pipeline,
>/* We're going to OR this together with the dynamic state.  We need
> * to make sure it's initialized to something useful.
> */
> +  pipeline->writes_stencil = false;
>memset(depth_stencil_dw, 0, sizeof(depth_stencil_dw));
>return;
> }
>  
> /* VkBool32 depthBoundsTestEnable; // optional (depth_bounds_test) */
>  
> +   pipeline->writes_stencil = info->stencilTestEnable;
> +
>  #if GEN_GEN <= 7
> struct GENX(DEPTH_STENCIL_STATE) depth_stencil = {
>  #else
> @@ -669,7 +672,6 @@ emit_ds_state(struct anv_pipeline *pipeline,
>.DoubleSidedStencilEnable = true,
>  
>.StencilTestEnable = info->stencilTestEnable,
> -  .StencilBufferWriteEnable = info->stencilTestEnable,
>.StencilFailOp = vk_to_gen_stencil_op[info->front.failOp],
>.StencilPassDepthPassOp = 

Re: [Mesa-dev] [PATCH] [RFC] radv: enable transfer queues on CIK using SDMA engine.

2017-02-07 Thread Fredrik Höglund
On Tuesday 07 February 2017, Dave Airlie wrote:
> From: Dave Airlie 
> 
> This enables a transfer queue using the SDMA engine on
> CIK/VI/Polaris GPUs.
> 
> TODO:
> decide what to do with HW limitations from radeonsi
> (fail to record?)
> add linear bounds check to the buffer->image copies
> 
> dEQP-VK.synchronization.op.multi_queue.fence.*:
>  Passed:1294/2688 (48.1%)
>  Failed:0/2688 (0.0%)
>  Not supported: 1394/2688 (51.9%)
>  Warnings:  0/2688 (0.0%)
> 
> Signed-off-by: Dave Airlie 
> ---
>  src/amd/vulkan/Makefile.sources   |   1 +
>  src/amd/vulkan/radv_cik_sdma.c| 747 
> ++
>  src/amd/vulkan/radv_cmd_buffer.c  |   7 +
>  src/amd/vulkan/radv_device.c  |  20 +
>  src/amd/vulkan/radv_meta_buffer.c |  42 +-
>  src/amd/vulkan/radv_meta_copy.c   |  19 +
>  src/amd/vulkan/radv_private.h |  38 ++
>  src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c |  12 +-
>  8 files changed, 877 insertions(+), 9 deletions(-)
>  create mode 100644 src/amd/vulkan/radv_cik_sdma.c
> 
> diff --git a/src/amd/vulkan/Makefile.sources b/src/amd/vulkan/Makefile.sources
> index 425a00f..6cd9621 100644
> --- a/src/amd/vulkan/Makefile.sources
> +++ b/src/amd/vulkan/Makefile.sources
> @@ -31,6 +31,7 @@ RADV_WS_AMDGPU_FILES := \
>   winsys/amdgpu/radv_amdgpu_winsys_public.h
>  
>  VULKAN_FILES := \
> + radv_cik_sdma.c \
>   radv_cmd_buffer.c \
>   radv_cs.h \
>   radv_device.c \
> diff --git a/src/amd/vulkan/radv_cik_sdma.c b/src/amd/vulkan/radv_cik_sdma.c
> new file mode 100644
> index 000..1229d9c
> --- /dev/null
> +++ b/src/amd/vulkan/radv_cik_sdma.c
> @@ -0,0 +1,747 @@
> +/*
> + * Copyright © 2016 Red Hat.
> + *
> + * based on cik_sdma.c:
> + * Copyright 2014,2015 Advanced Micro Devices, Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + */
> +#include "radv_private.h"
> +#include "sid.h"
> +#include "vk_format.h"
> +#include "radv_cs.h"
> +
> +static VkFormat get_format_from_aspect_mask(VkImageAspectFlags aspectMask,
> + VkFormat format)
> +{
> + if (aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT)
> + format = vk_format_depth_only(format);
> + else if (aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT)
> + format = vk_format_stencil_only(format);
> + return format;
> +}
> +
> +static unsigned minify_as_blocks(unsigned width, unsigned level, unsigned 
> blk_w)
> +{
> + width = radv_minify(width, level);
> + return DIV_ROUND_UP(width, blk_w);
> +}
> +
> +static const struct radeon_surf_level *get_base_level_info(const struct 
> radv_image *img,
> +VkImageAspectFlags 
> aspectMask, int base_mip_level)
> +{
> + if (aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT)
> + return >surface.stencil_level[base_mip_level];
> + return >surface.level[base_mip_level];
> +}
> +
> +static void get_image_info(struct radv_cmd_buffer *cmd_buffer,
> +const struct radv_image *img,
> +const VkImageSubresourceLayers *subres,
> +uint64_t *va_p, uint32_t *bpp_p, uint32_t *pitch, 
> uint32_t *slice_pitch)
> +{
> + const struct radeon_surf_level *base_level = get_base_level_info(img, 
> subres->aspectMask,
> +  
> subres->mipLevel);
> + VkFormat format = get_format_from_aspect_mask(subres->aspectMask, 
> img->vk_format);
> + uint32_t bpp = vk_format_get_blocksize(format);
> + uint64_t va = cmd_buffer->device->ws->buffer_get_va(img->bo);
> +
> + va += img->offset;
> + *pitch = base_level->nblk_x;
> + *slice_pitch = base_level->slice_size / bpp;
> + if 

Re: [Mesa-dev] [PATCH] isl: annotate isl_get_interleaved_msaa_px_size_sa return value as const

2017-02-07 Thread Jason Ekstrand
On Tue, Feb 7, 2017 at 10:42 AM, Emil Velikov 
wrote:

> On 7 February 2017 at 16:11, Jason Ekstrand  wrote:
> > How does it make any sense to declare const on the return type of a
> function
> > that doesn't return a pointer???  It's not returning by reference, it's
> > returning a copy so const on the return type of the function means
> nothing.
> >
> Seems like you missed a similar nitpick in commit
> edf3113aeddcf66cb24906e53a2d4f41616f8985
> Dropping the const from get_px_size_sa() or adding one here will both
> make the compiler happy.
>
> Let me know what you prefer - I'm fine either way.
>

I'd rather drop both.  I didn't even know returning a const thing was valid
C.


> Thanks
> Emil
> P.S. Can I interest you in using plain text emails ;-)
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] isl: annotate isl_get_interleaved_msaa_px_size_sa return value as const

2017-02-07 Thread Emil Velikov
On 7 February 2017 at 16:11, Jason Ekstrand  wrote:
> How does it make any sense to declare const on the return type of a function
> that doesn't return a pointer???  It's not returning by reference, it's
> returning a copy so const on the return type of the function means nothing.
>
Seems like you missed a similar nitpick in commit
edf3113aeddcf66cb24906e53a2d4f41616f8985
Dropping the const from get_px_size_sa() or adding one here will both
make the compiler happy.

Let me know what you prefer - I'm fine either way.

Thanks
Emil
P.S. Can I interest you in using plain text emails ;-)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/5] st/mesa: fix member access within null pointer

2017-02-07 Thread Bartosz Tomczyk
---
 src/mesa/state_tracker/st_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index c3d8286b5a..ad69ca6eb5 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -488,7 +488,7 @@ static void
 st_framebuffer_reference(struct st_framebuffer **ptr,
  struct st_framebuffer *stfb)
 {
-   struct gl_framebuffer *fb = >Base;
+   struct gl_framebuffer *fb = stfb ? >Base : NULL;
_mesa_reference_framebuffer((struct gl_framebuffer **) ptr, fb);
 }
 
-- 
2.11.1

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


[Mesa-dev] [PATCH 2/5] util/list: fix member access within null pointer

2017-02-07 Thread Bartosz Tomczyk
---
 configure.ac| 3 +++
 src/util/list.h | 9 +
 2 files changed, 12 insertions(+)

diff --git a/configure.ac b/configure.ac
index a6ceee95a3..87f635c1a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -415,6 +415,9 @@ AC_C_BIGENDIAN(
little_endian=no
 )
 
+dnl Chek for typeof support 
+AC_C_TYPEOF()
+
 dnl Check for POWER8 Architecture
 PWR8_CFLAGS="-mpower8-vector"
 have_pwr8_intrinsics=no
diff --git a/src/util/list.h b/src/util/list.h
index 07eb9f3e6a..eaaac43fec 100644
--- a/src/util/list.h
+++ b/src/util/list.h
@@ -171,10 +171,19 @@ static inline void list_validate(struct list_head *list)
  * 'sample' MUST be initialized, or else the result is undefined!
  */
 #ifndef container_of
+#if HAVE_TYPEOF
+#define container_of_typed(ptr, type, member) ({   \
+   const __typeof__( ((type *)0)->member ) *__mptr = (ptr);\
+   (type *)( (char *)__mptr - offsetof(type,member) );})
+
+#define container_of(ptr, sample, member) \
+   container_of_typed(ptr, __typeof__(*sample), member)
+#else
 #define container_of(ptr, sample, member)  \
 (void *)((char *)(ptr) \
 - ((char *)&(sample)->member - (char *)(sample)))
 #endif
+#endif
 
 #define list_first_entry(ptr, type, member) \
 LIST_ENTRY(type, (ptr)->next, member)
-- 
2.11.1

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


[Mesa-dev] [PATCH 1/5] gallium/u_inlines: fix member access within null pointer

2017-02-07 Thread Bartosz Tomczyk
---
 src/gallium/auxiliary/util/u_inlines.h | 65 --
 1 file changed, 39 insertions(+), 26 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_inlines.h 
b/src/gallium/auxiliary/util/u_inlines.h
index b7b8313583..3bb3bcd6e0 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -104,14 +104,17 @@ pipe_reference(struct pipe_reference *ptr, struct 
pipe_reference *reference)
 }
 
 static inline void
-pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
+pipe_surface_reference(struct pipe_surface **pptr, struct pipe_surface *surf)
 {
-   struct pipe_surface *old_surf = *ptr;
+   struct pipe_surface *ptr = pptr ? *pptr : NULL;
+   struct pipe_surface *old_surf = ptr;
 
-   if (pipe_reference_described(&(*ptr)->reference, >reference, 
+   if (pipe_reference_described(ptr ? >reference : NULL,
+surf ? >reference : NULL,
 
(debug_reference_descriptor)debug_describe_surface))
   old_surf->context->surface_destroy(old_surf->context, old_surf);
-   *ptr = surf;
+
+   if (pptr) *pptr = surf;
 }
 
 /**
@@ -121,37 +124,43 @@ pipe_surface_reference(struct pipe_surface **ptr, struct 
pipe_surface *surf)
  * that's shared by multiple contexts.
  */
 static inline void
-pipe_surface_release(struct pipe_context *pipe, struct pipe_surface **ptr)
+pipe_surface_release(struct pipe_context *pipe, struct pipe_surface **pptr)
 {
-   if (pipe_reference_described(&(*ptr)->reference, NULL,
+   struct pipe_surface *ptr = pptr ? *pptr : NULL;
+   if (pipe_reference_described(ptr ? >reference : NULL, NULL,
 
(debug_reference_descriptor)debug_describe_surface))
-  pipe->surface_destroy(pipe, *ptr);
-   *ptr = NULL;
+  pipe->surface_destroy(pipe, ptr);
+   if (pptr) *pptr = NULL;
 }
 
 
 static inline void
-pipe_resource_reference(struct pipe_resource **ptr, struct pipe_resource *tex)
+pipe_resource_reference(struct pipe_resource **pptr, struct pipe_resource *tex)
 {
-   struct pipe_resource *old_tex = *ptr;
+   struct pipe_resource *ptr = pptr ? *pptr : NULL;
+   struct pipe_resource *old_tex = ptr;
 
-   if (pipe_reference_described(&(*ptr)->reference, >reference, 
+   if (pipe_reference_described(ptr ? >reference : NULL,
+tex ? >reference : NULL, 
 
(debug_reference_descriptor)debug_describe_resource)) {
   pipe_resource_reference(_tex->next, NULL);
   old_tex->screen->resource_destroy(old_tex->screen, old_tex);
}
-   *ptr = tex;
+
+   if (pptr) *pptr = tex;
 }
 
 static inline void
-pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct 
pipe_sampler_view *view)
+pipe_sampler_view_reference(struct pipe_sampler_view **pptr, struct 
pipe_sampler_view *view)
 {
-   struct pipe_sampler_view *old_view = *ptr;
+   struct pipe_sampler_view *ptr = pptr ? *pptr : NULL;
+   struct pipe_sampler_view *old_view = ptr;
 
-   if (pipe_reference_described(&(*ptr)->reference, >reference,
+   if (pipe_reference_described(ptr ? >reference : NULL,
+view ? >reference : NULL,
 
(debug_reference_descriptor)debug_describe_sampler_view))
   old_view->context->sampler_view_destroy(old_view->context, old_view);
-   *ptr = view;
+   if (pptr) *pptr = view;
 }
 
 /**
@@ -162,29 +171,33 @@ pipe_sampler_view_reference(struct pipe_sampler_view 
**ptr, struct pipe_sampler_
  */
 static inline void
 pipe_sampler_view_release(struct pipe_context *ctx,
-  struct pipe_sampler_view **ptr)
+  struct pipe_sampler_view **pptr)
 {
-   struct pipe_sampler_view *old_view = *ptr;
-   if (*ptr && (*ptr)->context != ctx) {
+   struct pipe_sampler_view *ptr = pptr ? *pptr : NULL;
+   struct pipe_sampler_view *old_view = ptr;
+
+   if (ptr && ptr->context != ctx) {
   debug_printf_once(("context mis-match in 
pipe_sampler_view_release()\n"));
}
-   if (pipe_reference_described(&(*ptr)->reference, NULL,
+   if (pipe_reference_described(ptr ? >reference : NULL, NULL,
 (debug_reference_descriptor)debug_describe_sampler_view)) {
   ctx->sampler_view_destroy(ctx, old_view);
}
-   *ptr = NULL;
+   if(pptr) *pptr = NULL;
 }
 
 static inline void
-pipe_so_target_reference(struct pipe_stream_output_target **ptr,
+pipe_so_target_reference(struct pipe_stream_output_target **pptr,
  struct pipe_stream_output_target *target)
 {
-   struct pipe_stream_output_target *old = *ptr;
+   struct pipe_stream_output_target *ptr = pptr ? *pptr : NULL;
+   struct pipe_stream_output_target *old = ptr;
 
-   if (pipe_reference_described(&(*ptr)->reference, >reference,
- (debug_reference_descriptor)debug_describe_so_target))
+   if (pipe_reference_described(ptr ? >reference : NULL,
+target ? 

[Mesa-dev] [PATCH 5/5] gallium/radeon: fix member access within null pointer

2017-02-07 Thread Bartosz Tomczyk
---
 src/gallium/drivers/radeon/r600_pipe_common.c | 13 +++--
 src/gallium/drivers/radeon/r600_pipe_common.h |  3 ++-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 95a6a486a3..0ae0cd38a0 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -1093,15 +1093,16 @@ static void r600_fence_reference(struct pipe_screen 
*screen,
 struct pipe_fence_handle *src)
 {
struct radeon_winsys *ws = ((struct r600_common_screen*)screen)->ws;
-   struct r600_multi_fence **rdst = (struct r600_multi_fence **)dst;
+   struct r600_multi_fence *rdst = (struct r600_multi_fence *)(dst ? *dst 
: NULL);
struct r600_multi_fence *rsrc = (struct r600_multi_fence *)src;
 
-   if (pipe_reference(&(*rdst)->reference, >reference)) {
-   ws->fence_reference(&(*rdst)->gfx, NULL);
-   ws->fence_reference(&(*rdst)->sdma, NULL);
-   FREE(*rdst);
+   if (pipe_reference(rdst ? >reference : NULL,
+   rsrc ? >reference : NULL)) {
+   ws->fence_reference(>gfx, NULL);
+   ws->fence_reference(>sdma, NULL);
+   FREE(rdst);
}
-*rdst = rsrc;
+   if (dst) *dst = src;
 }
 
 static boolean r600_fence_finish(struct pipe_screen *screen,
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 6eff9aaf09..e3f9b07c2d 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -887,7 +887,8 @@ r600_resource_reference(struct r600_resource **ptr, struct 
r600_resource *res)
 static inline void
 r600_texture_reference(struct r600_texture **ptr, struct r600_texture *res)
 {
-   pipe_resource_reference((struct pipe_resource **)ptr, 
>resource.b.b);
+   pipe_resource_reference((struct pipe_resource **)ptr, 
+   res ? >resource.b.b : NULL);
 }
 
 static inline void
-- 
2.11.1

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


[Mesa-dev] [PATCH 0/5] Fix member access within null pointer reported by UBSAN

2017-02-07 Thread Bartosz Tomczyk
Series fix various null pointer derefeneces repored by UBSAN.
Found by running piglit tests.

Bartosz Tomczyk (5):
  gallium/u_inlines: fix member access within null pointer
  util/list: fix member access within null pointer
  st/mesa: fix member access within null pointer
  gallium/auxiliary: fix member access within null pointer
  gallium/radeon: fix member access within null pointer

 configure.ac  |  3 ++
 src/gallium/auxiliary/pipebuffer/pb_buffer.h  | 10 +++--
 src/gallium/auxiliary/util/u_inlines.h| 65 ---
 src/gallium/drivers/radeon/r600_pipe_common.c | 13 +++---
 src/gallium/drivers/radeon/r600_pipe_common.h |  3 +-
 src/mesa/state_tracker/st_manager.c   |  2 +-
 src/util/list.h   |  9 
 7 files changed, 67 insertions(+), 38 deletions(-)

-- 
2.11.1

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


[Mesa-dev] [PATCH 4/5] gallium/auxiliary: fix member access within null pointer

2017-02-07 Thread Bartosz Tomczyk
---
 src/gallium/auxiliary/pipebuffer/pb_buffer.h | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h 
b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
index 33c23068c2..12c9ca779a 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
@@ -233,14 +233,16 @@ pb_destroy(struct pb_buffer *buf)
 }
 
 static inline void
-pb_reference(struct pb_buffer **dst,
+pb_reference(struct pb_buffer **pptr,
  struct pb_buffer *src)
 {
-   struct pb_buffer *old = *dst;
+   struct pb_buffer *dst = pptr ? *pptr : NULL;
+   struct pb_buffer *old = dst;
 
-   if (pipe_reference(&(*dst)->reference, >reference))
+   if (pipe_reference(dst ? >reference : NULL,
+  src ? >reference : NULL))
   pb_destroy( old );
-   *dst = src;
+   if (pptr) *pptr = src;
 }
 
 
-- 
2.11.1

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


Re: [Mesa-dev] [PATCH 35/40] util/disk_cache: allow drivers to pass a directory structure

2017-02-07 Thread Aaron Watry
On Mon, Feb 6, 2017 at 9:42 PM, Timothy Arceri 
wrote:

> In order to avoid costly fallback recompiles when cache items are
> created with an old version of Mesa or for a different gpu on the
> same system we want to create directories that look like this:
>
> ./{MESA_VERSION_STRING}/{GPU_ID}
>
> For llvm based drivers we will probably want an additional
> {LLVM_VERSION} folder although it looks like there is currently
> no support for querying this at runtime.
> ---
>  src/compiler/glsl/tests/cache_test.c | 20 ++--
>  src/util/disk_cache.c| 29 +
>  src/util/disk_cache.h|  4 ++--
>  3 files changed, 37 insertions(+), 16 deletions(-)
>
> diff --git a/src/compiler/glsl/tests/cache_test.c
> b/src/compiler/glsl/tests/cache_test.c
> index 8547141..ba56441 100644
> --- a/src/compiler/glsl/tests/cache_test.c
> +++ b/src/compiler/glsl/tests/cache_test.c
> @@ -126,7 +126,7 @@ test_disk_cache_create(void)
>  * MESA_GLSL_CACHE_DISABLE set, that disk_cache_create returns NULL.
>  */
> setenv("MESA_GLSL_CACHE_DISABLE", "1", 1);
> -   cache = disk_cache_create();
> +   cache = disk_cache_create("test", "make_check");
> expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DISABLE
> set");
>
> unsetenv("MESA_GLSL_CACHE_DISABLE");
> @@ -137,19 +137,19 @@ test_disk_cache_create(void)
> unsetenv("MESA_GLSL_CACHE_DIR");
> unsetenv("XDG_CACHE_HOME");
>
> -   cache = disk_cache_create();
> +   cache = disk_cache_create("test", "make_check");
> expect_non_null(cache, "disk_cache_create with no environment
> variables");
>
> disk_cache_destroy(cache);
>
> /* Test with XDG_CACHE_HOME set */
> setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1);
> -   cache = disk_cache_create();
> +   cache = disk_cache_create("test", "make_check");
> expect_null(cache, "disk_cache_create with XDG_CACHE_HOME set with"
> "a non-existing parent directory");
>
> mkdir(CACHE_TEST_TMP, 0755);
> -   cache = disk_cache_create();
> +   cache = disk_cache_create("test", "make_check");
> expect_non_null(cache, "disk_cache_create with XDG_CACHE_HOME set");
>
> disk_cache_destroy(cache);
> @@ -159,12 +159,12 @@ test_disk_cache_create(void)
> expect_equal(err, 0, "Removing " CACHE_TEST_TMP);
>
> setenv("MESA_GLSL_CACHE_DIR", CACHE_TEST_TMP "/mesa-glsl-cache-dir",
> 1);
> -   cache = disk_cache_create();
> +   cache = disk_cache_create("test", "make_check");
> expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR set
> with"
> "a non-existing parent directory");
>
> mkdir(CACHE_TEST_TMP, 0755);
> -   cache = disk_cache_create();
> +   cache = disk_cache_create("test", "make_check");
> expect_non_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR
> set");
>
> disk_cache_destroy(cache);
> @@ -203,7 +203,7 @@ test_put_and_get(void)
> uint8_t one_KB_key[20], one_MB_key[20];
> int count;
>
> -   cache = disk_cache_create();
> +   cache = disk_cache_create("test", "make_check");
>
> _mesa_sha1_compute(blob, sizeof(blob), blob_key);
>
> @@ -235,7 +235,7 @@ test_put_and_get(void)
> disk_cache_destroy(cache);
>
> setenv("MESA_GLSL_CACHE_MAX_SIZE", "1K", 1);
> -   cache = disk_cache_create();
> +   cache = disk_cache_create("test", "make_check");
>
> one_KB = calloc(1, 1024);
>
> @@ -287,7 +287,7 @@ test_put_and_get(void)
> disk_cache_destroy(cache);
>
> setenv("MESA_GLSL_CACHE_MAX_SIZE", "1M", 1);
> -   cache = disk_cache_create();
> +   cache = disk_cache_create("test", "make_check");
>
> disk_cache_put(cache, blob_key, blob, sizeof(blob));
> disk_cache_put(cache, string_key, string, sizeof(string));
> @@ -343,7 +343,7 @@ test_put_key_and_get_key(void)
>  { 0,  1, 42, 43, 44, 45, 46, 47, 48, 49,
>   50, 55, 52, 53, 54, 55, 56, 57, 58, 59};
>
> -   cache = disk_cache_create();
> +   cache = disk_cache_create("test", "make_check");
>
> /* First test that disk_cache_has_key returns false before
> disk_cache_put_key */
> result = disk_cache_has_key(cache, key_a);
> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> index 382ac6c..df511e4 100644
> --- a/src/util/disk_cache.c
> +++ b/src/util/disk_cache.c
> @@ -115,7 +115,7 @@ mkdir_if_needed(char *path)
>   *  / cannot be created as a directory
>   */
>  static char *
> -concatenate_and_mkdir(void *ctx, char *path, char *name)
> +concatenate_and_mkdir(void *ctx, char *path, const char *name)
>  {
> char *new_path;
> struct stat sb;
> @@ -131,8 +131,27 @@ concatenate_and_mkdir(void *ctx, char *path, char
> *name)
>return NULL;
>  }
>
> +static char *
> +create_mesa_cache_dir(void *mem_ctx, char *path, const char *mesa_version,
> +  const char *gpu_name)
> +{
> +   char *new_path = concatenate_and_mkdir(mem_ctx, path, "mesa");
> +   if 

Re: [Mesa-dev] [PATCH 00/10] swr: update rasterizer

2017-02-07 Thread Cherniak, Bruce
Reviewed-by: Bruce Cherniak 


> On Feb 6, 2017, at 6:40 PM, Tim Rowley  wrote:
> 
> Highlights include more avx512 work and fixes for llvm>=3.8.
> 
> Tim Rowley (10):
>  swr: [rasterizer core] Frontend SIMD16 WIP
>  swr: [rasterizer jitter] Adjust jitter header includes
>  swr: [rasterizer jitter] Fix issues with stream-out on llvm>=3.8
>  swr: [rasterizer jitter] Change SimdVector representation to array
>  swr: [rasterizer jitter] Multisample blend jit fix
>  swr: [rasterizer jitter] Add DEBUGTRAP jit builder function
>  swr: [rasterizer core] Frontend SIMD16 WIP
>  swr: [rasterizer jitter] Disable unsafe FP optimizations in the jitter
>  swr: [rasterizer core] Frontend SIMD16 WIP
>  swr: [rasterizer jitter] Pass LLVM-IR size into jitter
> 
> src/gallium/drivers/swr/rasterizer/core/context.h  |   6 +
> .../drivers/swr/rasterizer/core/frontend.cpp   | 331 --
> src/gallium/drivers/swr/rasterizer/core/frontend.h |  12 +-
> src/gallium/drivers/swr/rasterizer/core/knobs.h|   1 +
> src/gallium/drivers/swr/rasterizer/core/pa.h   | 478 +
> src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp | 389 +++--
> .../drivers/swr/rasterizer/jitter/JitManager.cpp   |  20 +-
> .../drivers/swr/rasterizer/jitter/JitManager.h |  10 +-
> .../drivers/swr/rasterizer/jitter/blend_jit.cpp|   6 +-
> .../drivers/swr/rasterizer/jitter/builder.cpp  |   6 +-
> .../drivers/swr/rasterizer/jitter/builder.h|   2 -
> .../drivers/swr/rasterizer/jitter/builder_misc.cpp |   7 +
> .../drivers/swr/rasterizer/jitter/builder_misc.h   |   3 +-
> .../drivers/swr/rasterizer/jitter/fetch_jit.cpp|   2 +-
> .../drivers/swr/rasterizer/jitter/jit_api.h|   1 +
> .../swr/rasterizer/jitter/streamout_jit.cpp|   8 +-
> 16 files changed, 1098 insertions(+), 184 deletions(-)
> 
> -- 
> 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] [Bug 99638] Mesa opengles Peppa Pig and openggles2 smurfs on Radeon PowerPC and PPC64

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

--- Comment #5 from intermedi...@hotmail.com  ---
Created attachment 129396
  --> https://bugs.freedesktop.org/attachment.cgi?id=129396=edit
all blue weston

Weston blue

-- 
You are receiving this mail because:
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] glsl: fix heap-use-after-free in ast_declarator_list::hir()

2017-02-07 Thread Bartosz Tomczyk
Patch is:
Tested-by: Bartosz Tomczyk 

I can confirm it fix use-after-free issue.

On Tue, Feb 7, 2017 at 1:47 PM, Samuel Iglesias Gonsálvez <
sigles...@igalia.com> wrote:

> The get_variable_being_redeclared() function can free 'var' because
> a re-declaration of an unsized array variable can establish the size, so
> we set the array type to the 'earlier' declaration and free 'var' as it is
> not needed anymore.
>
> However, the same 'var' is referenced later in ast_declarator_list::hir().
>
> This patch fixes it by assign the pointer 'var' to the pointer 'earlier'.
>
> This error was detected by Address Sanitizer.
>
> v2:
>
> * Pointer-to-pointer assignment (Bartosz Tomczyk)
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99677
> Signed-off-by: Samuel Iglesias Gonsálvez 
> ---
>
> Another possibility is to use reference-to-pointer but it is a C++
> thing. IIRC, we agreed on avoiding C++-specific features to make it
> easy for C developers, but I have no strong opinion for either option.
>
>  src/compiler/glsl/ast_to_hir.cpp | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_
> hir.cpp
> index b31b61d1ed6..93ba1d510fa 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -3958,10 +3958,12 @@ apply_type_qualifier_to_variable(const struct
> ast_type_qualifier *qual,
>   * is a redeclaration, \c NULL otherwise.
>   */
>  static ir_variable *
> -get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
> +get_variable_being_redeclared(ir_variable **var_pointer, YYLTYPE loc,
>struct _mesa_glsl_parse_state *state,
>bool allow_all_redeclarations)
>  {
> +   ir_variable *var = *var_pointer;
> +
> /* Check if this declaration is actually a re-declaration, either to
>  * resize an array or add qualifiers to an existing variable.
>  *
> @@ -3999,7 +4001,7 @@ get_variable_being_redeclared(ir_variable *var,
> YYLTYPE loc,
>
>earlier->type = var->type;
>delete var;
> -  var = NULL;
> +  *var_pointer = earlier;
> } else if ((state->ARB_fragment_coord_conventions_enable ||
>state->is_version(150, 0))
>&& strcmp(var->name, "gl_FragCoord") == 0
> @@ -5207,7 +5209,7 @@ ast_declarator_list::hir(exec_list *instructions,
>bool var_is_gl_id = is_gl_identifier(var->name);
>
>ir_variable *earlier =
> - get_variable_being_redeclared(var, decl->get_location(), state,
> + get_variable_being_redeclared(, decl->get_location(), state,
> false /* allow_all_redeclarations
> */);
>if (earlier != NULL) {
>   if (var_is_gl_id &&
> @@ -7873,7 +7875,7 @@ ast_interface_block::hir(exec_list *instructions,
>
>   if (redeclaring_per_vertex) {
>  ir_variable *earlier =
> -   get_variable_being_redeclared(var, loc, state,
> +   get_variable_being_redeclared(, loc, state,
>   true /*
> allow_all_redeclarations */);
>  if (!var_is_gl_id || earlier == NULL) {
> _mesa_glsl_error(, state,
> --
> 2.11.0
>
> ___
> 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] isl: annotate isl_get_interleaved_msaa_px_size_sa return value as const

2017-02-07 Thread Jason Ekstrand
How does it make any sense to declare const on the return type of a
function that doesn't return a pointer???  It's not returning by reference,
it's returning a copy so const on the return type of the function means
nothing.

On Tue, Feb 7, 2017 at 4:54 AM, Emil Velikov 
wrote:

> Already used as such and annotated in a number of places.
> Should resolve -Wignored-qualifiers warnings, such as:
>
> src/intel/blorp/blorp_blit.c:1857:8: warning: 'const' type qualifier on
> return type has no effect [-Wignored-qualifiers]
>
> Signed-off-by: Emil Velikov 
> ---
>  src/intel/blorp/blorp_blit.c | 4 ++--
>  src/intel/isl/isl.c  | 4 ++--
>  src/intel/isl/isl.h  | 2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
> index b89a112b8c..1d3b52d80e 100644
> --- a/src/intel/blorp/blorp_blit.c
> +++ b/src/intel/blorp/blorp_blit.c
> @@ -1358,7 +1358,7 @@ surf_get_intratile_offset_px(struct
> brw_blorp_surface_info *info,
>   uint32_t *tile_x_px, uint32_t *tile_y_px)
>  {
> if (info->surf.msaa_layout == ISL_MSAA_LAYOUT_INTERLEAVED) {
> -  struct isl_extent2d px_size_sa =
> +  const struct isl_extent2d px_size_sa =
>   isl_get_interleaved_msaa_px_size_sa(info->surf.samples);
>assert(info->tile_x_sa % px_size_sa.width == 0);
>assert(info->tile_y_sa % px_size_sa.height == 0);
> @@ -1678,7 +1678,7 @@ try_blorp_blit(struct blorp_batch *batch,
> * If it's UMS, then we have no choice but to set up the rendering
> * pipeline as multisampled.
> */
> -  struct isl_extent2d px_size_sa =
> +  const struct isl_extent2d px_size_sa =
>   isl_get_interleaved_msaa_px_size_sa(params->dst.surf.samples);
>params->x0 = ROUND_DOWN_TO(params->x0, 2) * px_size_sa.width;
>params->y0 = ROUND_DOWN_TO(params->y0, 2) * px_size_sa.height;
> diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
> index 82ab68dc65..62aa31cf29 100644
> --- a/src/intel/isl/isl.c
> +++ b/src/intel/isl/isl.c
> @@ -329,7 +329,7 @@ isl_choose_msaa_layout(const struct isl_device *dev,
> }
>  }
>
> -struct isl_extent2d
> +const struct isl_extent2d
>  isl_get_interleaved_msaa_px_size_sa(uint32_t samples)
>  {
> assert(isl_is_pow2(samples));
> @@ -342,7 +342,7 @@ isl_get_interleaved_msaa_px_size_sa(uint32_t samples)
>  *MSFMT_DEPTH_STENCIL, W_L and H_L must be adjusted as follows
> before
>  *proceeding: [...]
>  */
> -   return (struct isl_extent2d) {
> +   return (const struct isl_extent2d) {
>.width = 1 << ((ffs(samples) - 0) / 2),
>.height = 1 << ((ffs(samples) - 1) / 2),
> };
> diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
> index eff7218748..e9074e526d 100644
> --- a/src/intel/isl/isl.h
> +++ b/src/intel/isl/isl.h
> @@ -1172,7 +1172,7 @@ isl_tiling_is_std_y(enum isl_tiling tiling)
> return (1u << tiling) & ISL_TILING_STD_Y_MASK;
>  }
>
> -struct isl_extent2d ATTRIBUTE_CONST
> +const struct isl_extent2d ATTRIBUTE_CONST
>  isl_get_interleaved_msaa_px_size_sa(uint32_t samples);
>
>  static inline bool
> --
> 2.11.0
>
> ___
> 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] Time to merge threaded GL dispatch? (aka glthread)

2017-02-07 Thread James Legg
Hi Gregory,

On Tue, 2017-02-07 at 16:04 +0100, Gregory Hainaut wrote:
> > Hi,
> > 
> > On Mon, 2017-02-06 at 13:43 +0100, Jan Ziak wrote:
> > > Shadow of Mordor benchmark: 30 FPS w/o glthread -> 20 FPS with
> > > glthread
> > > 
> > 
> > For what it is worth, all the Feral games have a dispatch thread that
> > primarily calls GL functions.
> > 
> > James
> > 
> 
> Hello James,
> 
> 
> Did you have the opportunity to compare Feral's dispatcher threading
> implementation versus Nvidia's threading option. If yes, is there any
> performance difference? In other word, did you implement it because
> some (most) drivers miss this optimization or because it can really
> bring some performance improvements (when done carefully).

We can't directly compare to Nvidia's option, as our threaded GL
implementation is a necessity for us. OpenGL contexts must be bound to
a specific thread, unlike D3D devices, and we have games written for
D3D using multiple threads to dispatch graphics work (and sometimes
using multiple D3D devices from the same thread). We make one dispatch
thread for each GL context to avoid having to unbind the context from a
thread. There is some locking so that only one game thread may submit
to a context's dispatch thread at once, but that locking is very
lightweight compared to what would happen if we repeatedly attached and
detached GL contexts on game threads. GL_KHR_context_flush_control was
supposed to help with that, by allowing opting out of flushing the GL
context when unbinding it from a thread, but last time we tried that,
there were some synchronous X requests in SDL2 making it remain slow.

Having said that, we did at one point have a path which used
GLX_MESA_multithreaded_make_current when it was available. We found the
GL dispatch threads was quicker on all the games we were working on at
the time.

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


Re: [Mesa-dev] GLSL IR & TGSI on-disk shader cache

2017-02-07 Thread Marek Olšák
On Tue, Feb 7, 2017 at 4:42 AM, Timothy Arceri  wrote:
> Without the radeonsi patch min fps still goes up around 4 fps in
> the Shadow of Mordor benchmark (although the stalls are still
> very noticeable).

I don't fully understand this. Can you elaborate on that?

There are 4 tests that can be done:
1) no shader cache: run the benchmark with mesa/master once
2) radeonsi cache: run the benchmark with mesa/master for the second
time in the same process
3) glsl-tgsi cache: run the benchmark with your branch once after the
disk cache is ready
4) both caches: run the benchmark with your branch for the second time
in the same process

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


Re: [Mesa-dev] Time to merge threaded GL dispatch? (aka glthread)

2017-02-07 Thread Gregory Hainaut
>
> Hi,
>
> On Mon, 2017-02-06 at 13:43 +0100, Jan Ziak wrote:
> >* Shadow of Mordor benchmark: 30 FPS w/o glthread -> 20 FPS with
> *>* glthread
> *>
> For what it is worth, all the Feral games have a dispatch thread that
> primarily calls GL functions.
>
> James
>
>
Hello James,


Did you have the opportunity to compare Feral's dispatcher threading
implementation versus Nvidia's threading option. If yes, is there any
performance difference? In other word, did you implement it because some
(most) drivers miss this optimization or because it can really bring some
performance improvements (when done carefully).


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


[Mesa-dev] [PATCH] winsys/intel: remove unused winsys - ilo was its only user

2017-02-07 Thread Emil Velikov
From: Emil Velikov 

Cc: Edward O'Callaghan 
Signed-off-by: Emil Velikov 
---
 src/gallium/winsys/intel/drm/Android.mk |  36 --
 src/gallium/winsys/intel/drm/Makefile.am|  34 --
 src/gallium/winsys/intel/drm/Makefile.sources   |   3 -
 src/gallium/winsys/intel/drm/intel_drm_public.h |   8 -
 src/gallium/winsys/intel/drm/intel_drm_winsys.c | 663 
 5 files changed, 744 deletions(-)
 delete mode 100644 src/gallium/winsys/intel/drm/Android.mk
 delete mode 100644 src/gallium/winsys/intel/drm/Makefile.am
 delete mode 100644 src/gallium/winsys/intel/drm/Makefile.sources
 delete mode 100644 src/gallium/winsys/intel/drm/intel_drm_public.h
 delete mode 100644 src/gallium/winsys/intel/drm/intel_drm_winsys.c

diff --git a/src/gallium/winsys/intel/drm/Android.mk 
b/src/gallium/winsys/intel/drm/Android.mk
deleted file mode 100644
index 64752f8032..00
--- a/src/gallium/winsys/intel/drm/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Mesa 3-D graphics library
-#
-# Copyright (C) 2013 LunarG Inc.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-LOCAL_PATH := $(call my-dir)
-
-# get C_SOURCES
-include $(LOCAL_PATH)/Makefile.sources
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(C_SOURCES)
-
-LOCAL_SHARED_LIBRARIES := libdrm_intel
-LOCAL_MODULE := libmesa_winsys_intel
-
-include $(GALLIUM_COMMON_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/winsys/intel/drm/Makefile.am 
b/src/gallium/winsys/intel/drm/Makefile.am
deleted file mode 100644
index fbe1ceaeb1..00
--- a/src/gallium/winsys/intel/drm/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright © 2012 Intel Corporation
-# Copyright (C) 2013 LunarG, Inc.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-include Makefile.sources
-include $(top_srcdir)/src/gallium/Automake.inc
-
-AM_CFLAGS = \
-   -I$(top_srcdir)/src/gallium/drivers \
-   $(GALLIUM_WINSYS_CFLAGS) \
-   $(INTEL_CFLAGS)
-
-noinst_LTLIBRARIES = libintelwinsys.la
-
-libintelwinsys_la_SOURCES = $(C_SOURCES)
diff --git a/src/gallium/winsys/intel/drm/Makefile.sources 
b/src/gallium/winsys/intel/drm/Makefile.sources
deleted file mode 100644
index 0085d5a06b..00
--- a/src/gallium/winsys/intel/drm/Makefile.sources
+++ /dev/null
@@ -1,3 +0,0 @@
-C_SOURCES := \
-   intel_drm_public.h \
-   intel_drm_winsys.c
diff --git a/src/gallium/winsys/intel/drm/intel_drm_public.h 
b/src/gallium/winsys/intel/drm/intel_drm_public.h
deleted file mode 100644
index 0e39dfb6a0..00
--- a/src/gallium/winsys/intel/drm/intel_drm_public.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef INTEL_DRM_PUBLIC_H
-#define INTEL_DRM_PUBLIC_H
-
-struct intel_winsys;
-
-struct intel_winsys *intel_winsys_create_for_fd(int fd);
-
-#endif
diff --git a/src/gallium/winsys/intel/drm/intel_drm_winsys.c 

Re: [Mesa-dev] [PATCH] r600/sb: Fix memory leak

2017-02-07 Thread Bartosz Tomczyk
Hi Nicolai,

Will you push it, if I change it as described in last mail ?

On Mon, Jan 30, 2017 at 3:31 PM, Bartosz Tomczyk <
bartosz.tomczy...@gmail.com> wrote:

> It did not change anything, as we are not dereferencing iterator after
> delete.
>
> I think changing:
> delete *it;
> uses.erase(it);
>
> to:
> use_info *ptr = *it;
> uses.erase(it);
> delete ptr;
>
> don't make it more readable or safer, but I can change it if you want to.
>
> On Mon, Jan 30, 2017 at 3:16 PM, Nicolai Hähnle 
> wrote:
>
>> Nice find!
>>
>> On 29.01.2017 19:10, Bartosz Tomczyk wrote:
>>
>>> ---
>>>  src/gallium/drivers/r600/sb/sb_valtable.cpp | 8 +++-
>>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/gallium/drivers/r600/sb/sb_valtable.cpp
>>> b/src/gallium/drivers/r600/sb/sb_valtable.cpp
>>> index a8b7b49cd4..d31a1b76d5 100644
>>> --- a/src/gallium/drivers/r600/sb/sb_valtable.cpp
>>> +++ b/src/gallium/drivers/r600/sb/sb_valtable.cpp
>>> @@ -241,6 +241,7 @@ void value::remove_use(const node *n) {
>>> {
>>> // TODO assert((*it)->kind == kind) ?
>>> // TODO assert((*it)->arg == arg) ?
>>> +   delete *it;
>>> uses.erase(it);
>>>
>>
>> The delete should really be after the erase.
>>
>> Cheers,
>> Nicolai
>>
>>
>> }
>>>  }
>>> @@ -290,7 +291,12 @@ bool value::is_prealloc() {
>>>  }
>>>
>>>  void value::delete_uses() {
>>> -   uses.erase(uses.begin(), uses.end());
>>> +   for (uselist::iterator it = uses.begin(); it != uses.end(); ++it)
>>> +   {
>>> +   delete *it;
>>> +   }
>>> +
>>> +   uses.clear();
>>>  }
>>>
>>>  void ra_constraint::update_values() {
>>>
>>>
>>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


  1   2   >