Mesa (master): anv: enable sampling from fast-cleared images on SKL

2017-03-26 Thread Samuel Iglesias Gonsálvez
Module: Mesa
Branch: master
Commit: c4c02471f485e6e9a8ffdaaa789861dcd5a3b8e9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c4c02471f485e6e9a8ffdaaa789861dcd5a3b8e9

Author: Samuel Iglesias Gonsálvez 
Date:   Thu Mar 23 12:19:39 2017 +0100

anv: enable sampling from fast-cleared images on SKL

A resolve is not needed on Skylake in this case. We were forcing
a resolve because we set the input_aux_usage to ISL_AUX_USAGE_NONE.

Signed-off-by: Samuel Iglesias Gonsálvez 
Reviewed-by: Nanley Chery 

---

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

diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
b/src/intel/vulkan/genX_cmd_buffer.c
index e2364dbfd5..39856b9af7 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -305,8 +305,8 @@ color_attachment_compute_aux_usage(struct anv_device 
*device,
   * doesn't also support color compression.
   */
  att_state->input_aux_usage = ISL_AUX_USAGE_NONE;
-  } else if (GEN_GEN == 8) {
- /* Broadwell can sample from fast-cleared images */
+  } else if (GEN_GEN >= 8) {
+ /* Broadwell/Skylake can sample from fast-cleared images */
  att_state->input_aux_usage = ISL_AUX_USAGE_CCS_D;
   } else {
  /* Ivy Bridge and Haswell cannot */

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


Mesa (master): glsl, st/shader_cache: check the whole sha1 for zero

2017-03-26 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: b97faea162fed241de679f99ad935a8bce26
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b97faea162fed241de679f99ad935a8bce26

Author: Grazvydas Ignotas 
Date:   Sun Mar 26 19:30:23 2017 +0300

glsl, st/shader_cache: check the whole sha1 for zero

The checks were only looking at the first byte, while the intention
seems to be to check if the whole sha1 is zero. This prevented all
shaders with first byte zero in their sha1 from being saved.

This shaves around a second from Deus Ex load time on a hot cache.

Signed-off-by: Grazvydas Ignotas 
Reviewed-by: Timothy Arceri 
Reviewed-by: Edward O'Callaghan 

---

 src/compiler/glsl/shader_cache.cpp   | 3 ++-
 src/mesa/state_tracker/st_shader_cache.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/shader_cache.cpp 
b/src/compiler/glsl/shader_cache.cpp
index 274bb8c91e..ea1bc01f02 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1221,7 +1221,8 @@ shader_cache_write_program_metadata(struct gl_context 
*ctx,
 * TODO: In future we should use another method to generate a key for ff
 * programs.
 */
-   if (*prog->data->sha1 == 0)
+   static const char zero[sizeof(prog->data->sha1)] = {0};
+   if (memcmp(prog->data->sha1, zero, sizeof(prog->data->sha1)) == 0)
   return;
 
struct blob *metadata = blob_create();
diff --git a/src/mesa/state_tracker/st_shader_cache.c 
b/src/mesa/state_tracker/st_shader_cache.c
index 061b27221b..e8c7289ec6 100644
--- a/src/mesa/state_tracker/st_shader_cache.c
+++ b/src/mesa/state_tracker/st_shader_cache.c
@@ -64,7 +64,8 @@ st_store_tgsi_in_disk_cache(struct st_context *st, struct 
gl_program *prog,
/* Exit early when we are dealing with a ff shader with no source file to
 * generate a source from.
 */
-   if (*prog->sh.data->sha1 == 0)
+   static const char zero[sizeof(prog->sh.data->sha1)] = {0};
+   if (memcmp(prog->sh.data->sha1, zero, sizeof(prog->sh.data->sha1)) == 0)
   return;
 
unsigned char *sha1;

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


Mesa (master): glsl/shader_cache: restore evicted shader keys

2017-03-26 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: f2d4d116113c8eddf7e8f372d466510c31d3dba4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2d4d116113c8eddf7e8f372d466510c31d3dba4

Author: Grazvydas Ignotas 
Date:   Sun Mar 26 19:28:38 2017 +0300

glsl/shader_cache: restore evicted shader keys

Even though the programs themselves stay in cache and are loaded, the
shader keys can be evicted separately. If that happens, unnecessary
compiles are caused that waste time, and no matter how many times the
program is re-run, performance never recovers to the levels of first
hot cache run. To deal with this, we need to refresh the shader keys
of shaders that were recompiled.

An easy way to currently observe this is running Deux Ex, then piglit
and Deux Ex again, or deleting just the cache index. The later is
causing over a minute of lost time on all later Deux Ex runs, with this
patch it returns to normal after 1 run.

Signed-off-by: Grazvydas Ignotas 
Reviewed-by: Timothy Arceri 

---

 src/compiler/glsl/shader_cache.cpp | 17 +
 1 file changed, 17 insertions(+)

diff --git a/src/compiler/glsl/shader_cache.cpp 
b/src/compiler/glsl/shader_cache.cpp
index dd8c6c0b40..274bb8c91e 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1409,6 +1409,23 @@ shader_cache_read_program_metadata(struct gl_context 
*ctx,
/* This is used to flag a shader retrieved from cache */
prog->data->LinkStatus = linking_skipped;
 
+   /* Since the program load was successful, CompileStatus of all shaders at
+* this point should normally be compile_skipped. However because of how
+* the eviction works, it may happen that some of the individual shader keys
+* have been evicted, resulting in unnecessary recompiles on this load, so
+* mark them again to skip such recompiles next time.
+*/
+   char sha1_buf[41];
+   for (unsigned i = 0; i < prog->NumShaders; i++) {
+  if (prog->Shaders[i]->CompileStatus == compile_success) {
+ disk_cache_put_key(cache, prog->Shaders[i]->sha1);
+ if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
+_mesa_sha1_format(sha1_buf, prog->Shaders[i]->sha1);
+fprintf(stderr, "re-marking shader: %s\n", sha1_buf);
+ }
+  }
+   }
+
free (buffer);
 
return true;

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


Mesa (master): st/nine: Resolve deadlock in surface/ volume dtors when using csmt

2017-03-26 Thread Axel Davy
Module: Mesa
Branch: master
Commit: bd85bb51c717a1858157c73adcb689e3986b2134
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd85bb51c717a1858157c73adcb689e3986b2134

Author: Axel Davy 
Date:   Wed Mar 15 22:45:03 2017 +0100

st/nine: Resolve deadlock in surface/volume dtors when using csmt

Surfaces and Volumes can be freed in the worker thread.

Without this patch, pending_uploads_counter could be non-zero
in the Surfaces or Volumes dtor, leading to deadlock.
Instead decrease properly the counter before releasing the
item.

Also avoid another potential deadlock if the item is not
properly unlocked: Do not call UnlockRect which will cause deadlock,
but free directly using the deadlock safe
nine_context_get_pipe_multithread.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99246

CC: "17.0" 
Signed-off-by: Axel Davy 
Tested-by: James Harvey 

---

 src/gallium/state_trackers/nine/nine_csmt_helper.h |  2 +-
 src/gallium/state_trackers/nine/surface9.c | 10 --
 src/gallium/state_trackers/nine/volume9.c  | 10 --
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_csmt_helper.h 
b/src/gallium/state_trackers/nine/nine_csmt_helper.h
index b0bbc054fc..dc46bbd3a2 100644
--- a/src/gallium/state_trackers/nine/nine_csmt_helper.h
+++ b/src/gallium/state_trackers/nine/nine_csmt_helper.h
@@ -233,8 +233,8 @@ name##_rx( struct NineDevice9 *device, struct 
csmt_instruction *instr ) \
 name##_priv( \
 device ARGS_FOR_CALL( __VA_ARGS__ ) \
 ); \
-ARGS_FOR_UNBIND( __VA_ARGS__ ) \
 p_atomic_dec(args->counter); \
+ARGS_FOR_UNBIND( __VA_ARGS__ ) \
 return 0; \
 } \
 \
diff --git a/src/gallium/state_trackers/nine/surface9.c 
b/src/gallium/state_trackers/nine/surface9.c
index 836369cafd..d917fa1f86 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -204,9 +204,15 @@ NineSurface9_dtor( struct NineSurface9 *This )
 {
 DBG("This=%p\n", This);
 
-if (This->transfer)
-NineSurface9_UnlockRect(This);
+if (This->transfer) {
+struct pipe_context *pipe = 
nine_context_get_pipe_multithread(This->base.base.device);
+pipe->transfer_unmap(pipe, This->transfer);
+This->transfer = NULL;
+}
 
+/* Note: Following condition cannot happen currently, since we
+ * refcount the surface in the functions increasing
+ * pending_uploads_counter. */
 if (p_atomic_read(>pending_uploads_counter))
 nine_csmt_process(This->base.base.device);
 
diff --git a/src/gallium/state_trackers/nine/volume9.c 
b/src/gallium/state_trackers/nine/volume9.c
index 11236a02e7..62af3e6225 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -142,9 +142,15 @@ NineVolume9_dtor( struct NineVolume9 *This )
 {
 DBG("This=%p\n", This);
 
-if (This->transfer)
-NineVolume9_UnlockBox(This);
+if (This->transfer) {
+struct pipe_context *pipe = 
nine_context_get_pipe_multithread(This->base.device);
+pipe->transfer_unmap(pipe, This->transfer);
+This->transfer = NULL;
+}
 
+/* Note: Following condition cannot happen currently, since we
+ * refcount the volume in the functions increasing
+ * pending_uploads_counter. */
 if (p_atomic_read(>pending_uploads_counter))
 nine_csmt_process(This->base.device);
 

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


Mesa (master): st/nine: Use atomics for available_texture_mem

2017-03-26 Thread Axel Davy
Module: Mesa
Branch: master
Commit: bdf035ea6f784b90a6cbfd4ce16f3188ab15b2d3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bdf035ea6f784b90a6cbfd4ce16f3188ab15b2d3

Author: Axel Davy 
Date:   Wed Mar 15 22:53:36 2017 +0100

st/nine: Use atomics for available_texture_mem

Resource dtor can be executed in the worker thread.
Use atomic to avoid threading safety issues.

CC: "17.0" 
Signed-off-by: Axel Davy 
Tested-by: James Harvey 

---

 src/gallium/state_trackers/nine/resource9.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/resource9.c 
b/src/gallium/state_trackers/nine/resource9.c
index c583724174..852801624a 100644
--- a/src/gallium/state_trackers/nine/resource9.c
+++ b/src/gallium/state_trackers/nine/resource9.c
@@ -79,7 +79,7 @@ NineResource9_ctor( struct NineResource9 *This,
 if (This->info.target != PIPE_BUFFER) {
 This->size = util_resource_size(>info);
 
-This->base.device->available_texture_mem -= This->size;
+p_atomic_add(>base.device->available_texture_mem, 
-This->size);
 if (This->base.device->available_texture_mem <=
 This->base.device->available_texture_limit) {
 return D3DERR_OUTOFVIDEOMEMORY;
@@ -111,7 +111,7 @@ NineResource9_dtor( struct NineResource9 *This )
 
 /* NOTE: size is 0, unless something has actually been allocated */
 if (This->base.device)
-This->base.device->available_texture_mem += This->size;
+p_atomic_add(>base.device->available_texture_mem, This->size);
 
 NineUnknown_dtor(>base);
 }

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


Mesa (master): st/nine: Fix user vertex data uploader with csmt

2017-03-26 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 31f8b3babb5a2d685d6e8b8ed0a2120c7966e9b1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=31f8b3babb5a2d685d6e8b8ed0a2120c7966e9b1

Author: Axel Davy 
Date:   Wed Mar 15 22:29:12 2017 +0100

st/nine: Fix user vertex data uploader with csmt

Fix regression caused by
abb1c645c476b5dd289ce3efae0594f8796f9cf8

The patch made csmt use context.pipe instead of
secondary_pipe, leading to thread safety issues.

Signed-off-by: Axel Davy 

---

 src/gallium/state_trackers/nine/device9.c | 15 +++
 src/gallium/state_trackers/nine/device9.h |  1 +
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 843716207d..4943658934 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -476,6 +476,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
 This->driver_caps.user_cbufs = GET_PCAP(USER_CONSTANT_BUFFERS);
 This->driver_caps.user_sw_vbufs = 
This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_VERTEX_BUFFERS);
 This->driver_caps.user_sw_cbufs = 
This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_CONSTANT_BUFFERS);
+This->vertex_uploader = This->csmt_active ? 
This->pipe_secondary->stream_uploader : This->context.pipe->stream_uploader;
 if (!This->driver_caps.user_cbufs)
 This->constbuf_alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT);
 This->driver_caps.window_space_position_support = 
GET_PCAP(TGSI_VS_WINDOW_SPACE_POSITION);
@@ -2817,17 +2818,15 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
 vtxbuf.buffer = NULL;
 vtxbuf.user_buffer = pVertexStreamZeroData;
 
-/* csmt is unactive when user vertex or index buffers are used, thus no
- * need to call NineDevice9_GetPipe. */
 if (!This->driver_caps.user_vbufs) {
-u_upload_data(This->context.pipe->stream_uploader,
+u_upload_data(This->vertex_uploader,
   0,
   (prim_count_to_vertex_count(PrimitiveType, 
PrimitiveCount)) * VertexStreamZeroStride, /* XXX */
   4,
   vtxbuf.user_buffer,
   _offset,
   );
-u_upload_unmap(This->context.pipe->stream_uploader);
+u_upload_unmap(This->vertex_uploader);
 vtxbuf.user_buffer = NULL;
 }
 
@@ -2883,27 +2882,27 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 
*This,
 
 if (!This->driver_caps.user_vbufs) {
 const unsigned base = MinVertexIndex * VertexStreamZeroStride;
-u_upload_data(This->context.pipe->stream_uploader,
+u_upload_data(This->vertex_uploader,
   base,
   NumVertices * VertexStreamZeroStride, /* XXX */
   4,
   (const uint8_t *)vbuf.user_buffer + base,
   _offset,
   );
-u_upload_unmap(This->context.pipe->stream_uploader);
+u_upload_unmap(This->vertex_uploader);
 /* Won't be used: */
 vbuf.buffer_offset -= base;
 vbuf.user_buffer = NULL;
 }
 if (This->csmt_active) {
-u_upload_data(This->context.pipe->stream_uploader,
+u_upload_data(This->pipe_secondary->stream_uploader,
   0,
   (prim_count_to_vertex_count(PrimitiveType, 
PrimitiveCount)) * ibuf.index_size,
   4,
   ibuf.user_buffer,
   ,
   );
-u_upload_unmap(This->context.pipe->stream_uploader);
+u_upload_unmap(This->pipe_secondary->stream_uploader);
 ibuf.user_buffer = NULL;
 }
 
diff --git a/src/gallium/state_trackers/nine/device9.h 
b/src/gallium/state_trackers/nine/device9.h
index 4b1630c40f..c5fd8f76c6 100644
--- a/src/gallium/state_trackers/nine/device9.h
+++ b/src/gallium/state_trackers/nine/device9.h
@@ -140,6 +140,7 @@ struct NineDevice9
 boolean buggy_barycentrics;
 } driver_bugs;
 
+struct u_upload_mgr *vertex_uploader;
 unsigned constbuf_alignment;
 
 struct nine_range_pool range_pool;

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


Mesa (master): scons: Fix dependencies of marshal_generated.[ch].

2017-03-26 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 2ba991cbcd809bfdebf42f2df3b94f27439412d4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ba991cbcd809bfdebf42f2df3b94f27439412d4

Author: Jose Fonseca 
Date:   Sun Mar 26 21:28:29 2017 +0100

scons: Fix dependencies of marshal_generated.[ch].

These generated source files depend not only upon gl_and_es_API.xml, but
all other XML files that are included by it.

This change updates the generation rules to depend on all gen/*.xml
files, like done for other SCons generation rules, and should fix
incremental broken SCons builds due to missing dependencies.

Trivial.

---

 src/mesa/SConscript | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 9398ddb13b..fa4efe101b 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -122,7 +122,7 @@ if env['platform'] not in ('cygwin', 'darwin', 'windows', 
'haiku'):
 env.CodeGenerate(
 target = 'main/marshal_generated.c',
 script = GLAPI + 'gen/gl_marshal.py',
-source = GLAPI + 'gen/gl_and_es_API.xml',
+source = [GLAPI + 'gen/gl_and_es_API.xml'] + env.Glob(GLAPI + 'gen/*.xml'),
 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
 )
 
@@ -130,7 +130,7 @@ env.CodeGenerate(
 env.CodeGenerate(
 target = 'main/marshal_generated.h',
 script = GLAPI + 'gen/gl_marshal_h.py',
-source = GLAPI + 'gen/gl_and_es_API.xml',
+source = [GLAPI + 'gen/gl_and_es_API.xml'] + env.Glob(GLAPI + 'gen/*.xml'),
 command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
 )
 

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