Mesa (master): glsl: fix compat shaders in GLSL 1.40

2018-04-11 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: c7e3d31b0b5f22299a6bd72655502ce8427b40bf
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7e3d31b0b5f22299a6bd72655502ce8427b40bf

Author: Timothy Arceri 
Date:   Thu Apr 12 09:23:02 2018 +1000

glsl: fix compat shaders in GLSL 1.40

The compatibility and core tokens were not added until GLSL 1.50,
for GLSL 1.40 just assume all shaders built with a compat profile
are compat shaders.

Fixes rendering issues in Dawn of War II on radeonsi which has
enabled OpenGL 3.1 compat support.

Fixes: a0c8b49284ef "mesa: enable OpenGL 3.1 with ARB_compatibility"

Reviewed-by: Marek Olšák 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105807

---

 src/compiler/glsl/glsl_parser_extras.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/glsl/glsl_parser_extras.cpp 
b/src/compiler/glsl/glsl_parser_extras.cpp
index 0cc57f5a88..5dd362b3e3 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -429,6 +429,8 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE 
*locp, int version,
   this->language_version = version;
 
this->compat_shader = compat_token_present ||
+ (this->ctx->API == API_OPENGL_COMPAT &&
+  this->language_version == 140) ||
  (!this->es_shader && this->language_version < 140);
 
bool supported = false;

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


Mesa (master): mesa: Silence unused parameter warning in compressedteximage_only_format

2018-04-11 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: fa44941072cb43c14c749cc991a7e4001c57f5ca
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa44941072cb43c14c749cc991a7e4001c57f5ca

Author: Ian Romanick 
Date:   Tue Feb 27 11:24:44 2018 -0800

mesa: Silence unused parameter warning in compressedteximage_only_format

Passing ctx to compressedteximage_only_format was the only use of the
ctx parameter in _mesa_format_no_online_compression, so that parameter
had to go too.

../../SOURCE/master/src/mesa/main/teximage.c: In function 
‘compressedteximage_only_format’:
../../SOURCE/master/src/mesa/main/teximage.c:1355:57: warning: unused parameter 
‘ctx’ [-Wunused-parameter]
 compressedteximage_only_format(const struct gl_context *ctx, GLenum format)
 ^~~

Signed-off-by: Ian Romanick 
Reviewed-by: Jordan Justen 
Reviewed-by: Brian Paul 

---

 src/mesa/main/formatquery.c |  2 +-
 src/mesa/main/teximage.c| 16 
 src/mesa/main/teximage.h|  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 834f8e..3b000fac5c 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -502,7 +502,7 @@ _is_resource_supported(struct gl_context *ctx, GLenum 
target,
   /* additional checks for compressed textures */
   if (_mesa_is_compressed_format(ctx, internalformat) &&
   (!_mesa_target_can_be_compressed(ctx, target, internalformat, NULL) 
||
-   _mesa_format_no_online_compression(ctx, internalformat)))
+   _mesa_format_no_online_compression(internalformat)))
  return false;
 
   break;
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index f560512fb4..bec1274f39 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1353,7 +1353,7 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum 
target,
  * Return true if the format is only valid for glCompressedTexImage.
  */
 static bool
-compressedteximage_only_format(const struct gl_context *ctx, GLenum format)
+compressedteximage_only_format(GLenum format)
 {
switch (format) {
case GL_PALETTE4_RGB8_OES:
@@ -1376,11 +1376,11 @@ compressedteximage_only_format(const struct gl_context 
*ctx, GLenum format)
  * Return true if the format doesn't support online compression.
  */
 bool
-_mesa_format_no_online_compression(const struct gl_context *ctx, GLenum format)
+_mesa_format_no_online_compression(GLenum format)
 {
return _mesa_is_astc_format(format) ||
   _mesa_is_etc2_format(format) ||
-  compressedteximage_only_format(ctx, format);
+  compressedteximage_only_format(format);
 }
 
 /* Writes to an GL error pointer if non-null and returns whether or not the
@@ -1980,7 +1980,7 @@ texture_error_check( struct gl_context *ctx,
  "glTexImage%dD(target can't be compressed)", dimensions);
  return GL_TRUE;
   }
-  if (_mesa_format_no_online_compression(ctx, internalFormat)) {
+  if (_mesa_format_no_online_compression(internalFormat)) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
  "glTexImage%dD(no compression for format)", dimensions);
  return GL_TRUE;
@@ -2253,7 +2253,7 @@ texsubimage_error_check(struct gl_context *ctx, GLuint 
dimensions,
}
 
if (_mesa_is_format_compressed(texImage->TexFormat)) {
-  if (_mesa_format_no_online_compression(ctx, texImage->InternalFormat)) {
+  if (_mesa_format_no_online_compression(texImage->InternalFormat)) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
"%s(no compression for format)", callerName);
  return GL_TRUE;
@@ -2530,7 +2530,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint 
dimensions,
  "glCopyTexImage%dD(target can't be compressed)", 
dimensions);
  return GL_TRUE;
   }
-  if (_mesa_format_no_online_compression(ctx, internalFormat)) {
+  if (_mesa_format_no_online_compression(internalFormat)) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
"glCopyTexImage%dD(no compression for format)", dimensions);
  return GL_TRUE;
@@ -2612,7 +2612,7 @@ copytexsubimage_error_check(struct gl_context *ctx, 
GLuint dimensions,
}
 
if (_mesa_is_format_compressed(texImage->TexFormat)) {
-  if (_mesa_format_no_online_compression(ctx, texImage->InternalFormat)) {
+  if (_mesa_format_no_online_compression(texImage->InternalFormat)) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
"%s(no compression for format)", caller);
  return GL_TRUE;
@@ -4848,7 +4848,7 @@ compressed_subtexture_error_check(struct gl_context *ctx, 
GLint dims,
   return GL_TRUE;
}
 
-   if (compressedteximage_only_format(ctx, format)) {
+   if 

Mesa (master): mesa: Silence remaining unused parameter warnings in teximage.c

2018-04-11 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: f3b14ca2e1cb4655300272a44f63c9474c48689e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f3b14ca2e1cb4655300272a44f63c9474c48689e

Author: Ian Romanick 
Date:   Tue Feb 27 11:34:43 2018 -0800

mesa: Silence remaining unused parameter warnings in teximage.c

src/mesa/main/teximage.c: In function ‘_mesa_test_proxy_teximage’:
src/mesa/main/teximage.c:1301:51: warning: unused parameter ‘level’ 
[-Wunused-parameter]
   GLuint numLevels, GLint level,
   ^
src/mesa/main/teximage.c: In function ‘texsubimage_error_check’:
src/mesa/main/teximage.c:2186:30: warning: unused parameter ‘dsa’ 
[-Wunused-parameter]
 bool dsa, const char *callerName)
  ^~~
src/mesa/main/teximage.c: In function ‘copytexture_error_check’:
src/mesa/main/teximage.c:2297:32: warning: unused parameter ‘width’ 
[-Wunused-parameter]
  GLint width, GLint height, GLint border )
^
src/mesa/main/teximage.c:2297:45: warning: unused parameter ‘height’ 
[-Wunused-parameter]
  GLint width, GLint height, GLint border )
 ^~
src/mesa/main/teximage.c: In function ‘check_rtt_cb’:
src/mesa/main/teximage.c:2679:21: warning: unused parameter ‘key’ 
[-Wunused-parameter]
 check_rtt_cb(GLuint key, void *data, void *userData)
 ^~~
src/mesa/main/teximage.c: In function ‘override_internal_format’:
src/mesa/main/teximage.c:2756:55: warning: unused parameter ‘width’ 
[-Wunused-parameter]
 override_internal_format(GLenum internalFormat, GLint width, GLint height)
   ^
src/mesa/main/teximage.c:2756:68: warning: unused parameter ‘height’ 
[-Wunused-parameter]
 override_internal_format(GLenum internalFormat, GLint width, GLint height)
^~
src/mesa/main/teximage.c: In function ‘texture_sub_image’:
src/mesa/main/teximage.c:3293:24: warning: unused parameter ‘dsa’ 
[-Wunused-parameter]
   bool dsa)
^~~
src/mesa/main/teximage.c: In function ‘can_avoid_reallocation’:
src/mesa/main/teximage.c:3788:53: warning: unused parameter ‘x’ 
[-Wunused-parameter]
mesa_format texFormat, GLint x, GLint y, GLsizei width,
 ^
src/mesa/main/teximage.c:3788:62: warning: unused parameter ‘y’ 
[-Wunused-parameter]
mesa_format texFormat, GLint x, GLint y, GLsizei width,
  ^
src/mesa/main/teximage.c: In function ‘valid_texstorage_ms_parameters’:
src/mesa/main/teximage.c:5987:40: warning: unused parameter ‘samples’ 
[-Wunused-parameter]
GLsizei samples, unsigned dims)
^~~

Signed-off-by: Ian Romanick 
Reviewed-by: Jordan Justen 
Reviewed-by: Brian Paul 

---

 src/mesa/main/teximage.c | 42 +-
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index bec1274f39..8d5f8aa545 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1299,7 +1299,7 @@ error_check_subtexture_dimensions(struct gl_context *ctx, 
GLuint dims,
  */
 GLboolean
 _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target,
-  GLuint numLevels, GLint level,
+  GLuint numLevels, MAYBE_UNUSED GLint level,
   mesa_format format, GLuint numSamples,
   GLint width, GLint height, GLint depth)
 {
@@ -2184,7 +2184,7 @@ texsubimage_error_check(struct gl_context *ctx, GLuint 
dimensions,
 GLint xoffset, GLint yoffset, GLint zoffset,
 GLint width, GLint height, GLint depth,
 GLenum format, GLenum type, const GLvoid *pixels,
-bool dsa, const char *callerName)
+const char *callerName)
 {
struct gl_texture_image *texImage;
GLenum err;
@@ -2295,7 +2295,7 @@ texsubimage_error_check(struct gl_context *ctx, GLuint 
dimensions,
 static GLboolean
 copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
  GLenum target, GLint level, GLint internalFormat,
- GLint width, GLint height, GLint border )
+ GLint border )
 {
GLint baseFormat;
GLint rb_base_format;
@@ -2691,7 +2691,7 @@ struct cb_info
  * Check render to texture callback.  Called from _mesa_HashWalk().
  */
 static void
-check_rtt_cb(GLuint key, void 

Mesa (master): blorp: Silence unused function warnings

2018-04-11 Thread Nanley Chery
Module: Mesa
Branch: master
Commit: 377da9eb785d52904735cd62c0c7b205404c39d2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=377da9eb785d52904735cd62c0c7b205404c39d2

Author: Nanley Chery 
Date:   Tue Apr 10 15:05:31 2018 -0700

blorp: Silence unused function warnings

vulkan/genX_blorp_exec.c:69:1: warning: ‘blorp_get_surface_base_address’ 
defined but not used [-Wunused-function]
 blorp_get_surface_base_address(struct blorp_batch *batch)
 ^~
In file included from vulkan/genX_blorp_exec.c:35:0:
./blorp/blorp_genX_exec.h:1249:1: warning: ‘blorp_emit_memcpy’ defined but not 
used [-Wunused-function]
 blorp_emit_memcpy(struct blorp_batch *batch,
 ^
genX_blorp_exec.c:99:1: warning: ‘blorp_get_surface_base_address’ defined but 
not used [-Wunused-function]
 blorp_get_surface_base_address(struct blorp_batch *batch)
 ^~
In file included from genX_blorp_exec.c:33:0:
../../../../../src/intel/blorp/blorp_genX_exec.h:1249:1: warning: 
‘blorp_emit_memcpy’ defined but not used [-Wunused-function]
 blorp_emit_memcpy(struct blorp_batch *batch,
 ^

Reviewed-by: Lionel Landwerlin 

---

 src/intel/blorp/blorp_genX_exec.h   | 4 ++--
 src/intel/vulkan/genX_blorp_exec.c  | 2 +-
 src/mesa/drivers/dri/i965/genX_blorp_exec.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/intel/blorp/blorp_genX_exec.h 
b/src/intel/blorp/blorp_genX_exec.h
index 7851228d8d..593521b95c 100644
--- a/src/intel/blorp/blorp_genX_exec.h
+++ b/src/intel/blorp/blorp_genX_exec.h
@@ -78,7 +78,7 @@ static void
 blorp_surface_reloc(struct blorp_batch *batch, uint32_t ss_offset,
 struct blorp_address address, uint32_t delta);
 
-#if GEN_GEN >= 7 && GEN_GEN <= 10
+#if GEN_GEN >= 7 && GEN_GEN < 10
 static struct blorp_address
 blorp_get_surface_base_address(struct blorp_batch *batch);
 #endif
@@ -1244,7 +1244,7 @@ blorp_emit_pipeline(struct blorp_batch *batch,
 
 #endif /* GEN_GEN >= 6 */
 
-#if GEN_GEN >= 7 && GEN_GEN <= 10
+#if GEN_GEN >= 7 && GEN_GEN < 10
 static void
 blorp_emit_memcpy(struct blorp_batch *batch,
   struct blorp_address dst,
diff --git a/src/intel/vulkan/genX_blorp_exec.c 
b/src/intel/vulkan/genX_blorp_exec.c
index 1ecec19984..b423046d61 100644
--- a/src/intel/vulkan/genX_blorp_exec.c
+++ b/src/intel/vulkan/genX_blorp_exec.c
@@ -64,7 +64,7 @@ blorp_surface_reloc(struct blorp_batch *batch, uint32_t 
ss_offset,
   anv_batch_set_error(_buffer->batch, result);
 }
 
-#if GEN_GEN >= 7 && GEN_GEN <= 10
+#if GEN_GEN >= 7 && GEN_GEN < 10
 static struct blorp_address
 blorp_get_surface_base_address(struct blorp_batch *batch)
 {
diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.c 
b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
index 3406a6fdec..b72ca9c515 100644
--- a/src/mesa/drivers/dri/i965/genX_blorp_exec.c
+++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
@@ -94,7 +94,7 @@ blorp_surface_reloc(struct blorp_batch *batch, uint32_t 
ss_offset,
 #endif
 }
 
-#if GEN_GEN >= 7 && GEN_GEN <= 10
+#if GEN_GEN >= 7 && GEN_GEN < 10
 static struct blorp_address
 blorp_get_surface_base_address(struct blorp_batch *batch)
 {

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


Mesa (master): nir/vars_to_ssa: Remove an unnecessary deref_arry_type check

2018-04-11 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: fac9dd1b93829a84f634525ce41f18953fe92433
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fac9dd1b93829a84f634525ce41f18953fe92433

Author: Caio Marcelo de Oliveira Filho 
Date:   Tue Apr 10 23:13:39 2018 -0700

nir/vars_to_ssa: Remove an unnecessary deref_arry_type check

Only fully-qualified direct derefs, collected in direct_deref_nodes,
are checked for aliasing, so it is already known up front that they
have only array derefs of type direct.

Reviewed-by: Jason Ekstrand 

---

 src/compiler/nir/nir_lower_vars_to_ssa.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c 
b/src/compiler/nir/nir_lower_vars_to_ssa.c
index f327a14d9b..970eb05307 100644
--- a/src/compiler/nir/nir_lower_vars_to_ssa.c
+++ b/src/compiler/nir/nir_lower_vars_to_ssa.c
@@ -298,15 +298,16 @@ deref_may_be_aliased_node(struct deref_node *node, 
nir_deref *deref,
   switch (deref->child->deref_type) {
   case nir_deref_type_array: {
  nir_deref_array *arr = nir_deref_as_array(deref->child);
- if (arr->deref_array_type == nir_deref_array_type_indirect)
-return true;
+
+ /* This is a child of one of the derefs in direct_deref_nodes,
+  * so we know it is direct.
+  */
+ assert(arr->deref_array_type == nir_deref_array_type_direct);
 
  /* If there is an indirect at this level, we're aliased. */
  if (node->indirect)
 return true;
 
- assert(arr->deref_array_type == nir_deref_array_type_direct);
-
  if (node->children[arr->base_offset] &&
  deref_may_be_aliased_node(node->children[arr->base_offset],
deref->child, state))

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


Mesa (master): nir/vars_to_ssa: Simplify node matching code

2018-04-11 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 89542c9ce6842a162bf75b945f11e2f56b02ddba
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=89542c9ce6842a162bf75b945f11e2f56b02ddba

Author: Caio Marcelo de Oliveira Filho 
Date:   Tue Apr 10 23:13:40 2018 -0700

nir/vars_to_ssa: Simplify node matching code

The matching code doesn't make real use of the return value. The main
function return value is ignored, and while the worker function
propagate its return value, the actual callback never returns false.

v2: Style fixes. (Jason)

Reviewed-by: Jason Ekstrand 

---

 src/compiler/nir/nir_lower_vars_to_ssa.c | 67 +++-
 1 file changed, 31 insertions(+), 36 deletions(-)

diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c 
b/src/compiler/nir/nir_lower_vars_to_ssa.c
index 970eb05307..8bc847fd41 100644
--- a/src/compiler/nir/nir_lower_vars_to_ssa.c
+++ b/src/compiler/nir/nir_lower_vars_to_ssa.c
@@ -217,45 +217,42 @@ get_deref_node(nir_deref_var *deref, struct 
lower_variables_state *state)
 }
 
 /* \sa foreach_deref_node_match */
-static bool
+static void
 foreach_deref_node_worker(struct deref_node *node, nir_deref *deref,
-  bool (* cb)(struct deref_node *node,
+  void (* cb)(struct deref_node *node,
   struct lower_variables_state *state),
   struct lower_variables_state *state)
 {
if (deref->child == NULL) {
-  return cb(node, state);
-   } else {
-  switch (deref->child->deref_type) {
-  case nir_deref_type_array: {
- nir_deref_array *arr = nir_deref_as_array(deref->child);
- assert(arr->deref_array_type == nir_deref_array_type_direct);
- if (node->children[arr->base_offset] &&
- !foreach_deref_node_worker(node->children[arr->base_offset],
-deref->child, cb, state))
-return false;
+  cb(node, state);
+  return;
+   }
 
- if (node->wildcard &&
- !foreach_deref_node_worker(node->wildcard,
-deref->child, cb, state))
-return false;
+   switch (deref->child->deref_type) {
+   case nir_deref_type_array: {
+  nir_deref_array *arr = nir_deref_as_array(deref->child);
+  assert(arr->deref_array_type == nir_deref_array_type_direct);
 
- return true;
+  if (node->children[arr->base_offset]) {
+ foreach_deref_node_worker(node->children[arr->base_offset],
+   deref->child, cb, state);
   }
+  if (node->wildcard)
+ foreach_deref_node_worker(node->wildcard, deref->child, cb, state);
+  break;
+   }
 
-  case nir_deref_type_struct: {
- nir_deref_struct *str = nir_deref_as_struct(deref->child);
- if (node->children[str->index] &&
- !foreach_deref_node_worker(node->children[str->index],
-deref->child, cb, state))
-return false;
-
- return true;
+   case nir_deref_type_struct: {
+  nir_deref_struct *str = nir_deref_as_struct(deref->child);
+  if (node->children[str->index]) {
+ foreach_deref_node_worker(node->children[str->index],
+   deref->child, cb, state);
   }
+  break;
+   }
 
-  default:
- unreachable("Invalid deref child type");
-  }
+   default:
+  unreachable("Invalid deref child type");
}
 }
 
@@ -271,9 +268,9 @@ foreach_deref_node_worker(struct deref_node *node, 
nir_deref *deref,
  * The given deref must be a full-length and fully qualified (no wildcards
  * or indirects) deref chain.
  */
-static bool
+static void
 foreach_deref_node_match(nir_deref_var *deref,
- bool (* cb)(struct deref_node *node,
+ void (* cb)(struct deref_node *node,
  struct lower_variables_state *state),
  struct lower_variables_state *state)
 {
@@ -282,9 +279,9 @@ foreach_deref_node_match(nir_deref_var *deref,
struct deref_node *node = get_deref_node(_deref, state);
 
if (node == NULL)
-  return false;
+  return;
 
-   return foreach_deref_node_worker(node, >deref, cb, state);
+   foreach_deref_node_worker(node, >deref, cb, state);
 }
 
 /* \sa deref_may_be_aliased */
@@ -441,12 +438,12 @@ register_variable_uses(nir_function_impl *impl,
 /* Walks over all of the copy instructions to or from the given deref_node
  * and lowers them to load/store intrinsics.
  */
-static bool
+static void
 lower_copies_to_load_store(struct deref_node *node,
struct lower_variables_state *state)
 {
if (!node->copies)
-  return true;
+  return;
 
struct set_entry *copy_entry;
set_foreach(node->copies, copy_entry) {
@@ -471,8 +468,6 @@ lower_copies_to_load_store(struct deref_node *node,
 

Mesa (master): nir/vars_to_ssa: Rework register_variable_uses()

2018-04-11 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 1c9bccdeb8acf1a531b49bbb6c69ea96879e79de
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c9bccdeb8acf1a531b49bbb6c69ea96879e79de

Author: Caio Marcelo de Oliveira Filho 
Date:   Tue Apr 10 23:13:38 2018 -0700

nir/vars_to_ssa: Rework register_variable_uses()

The return value was needed to make use of the old nir_foreach_block
helper, but not needed anymore with the macro version. Then go one
step further and move the foreach directly into the register variable
uses function.

v2: Move foreach to register_variable_uses(). (Jason)

Reviewed-by: Jason Ekstrand 

---

 src/compiler/nir/nir_lower_vars_to_ssa.c | 51 ++--
 1 file changed, 23 insertions(+), 28 deletions(-)

diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c 
b/src/compiler/nir/nir_lower_vars_to_ssa.c
index 0cc65143e7..f327a14d9b 100644
--- a/src/compiler/nir/nir_lower_vars_to_ssa.c
+++ b/src/compiler/nir/nir_lower_vars_to_ssa.c
@@ -406,36 +406,35 @@ register_copy_instr(nir_intrinsic_instr *copy_instr,
}
 }
 
-/* Registers all variable uses in the given block. */
-static bool
-register_variable_uses_block(nir_block *block,
- struct lower_variables_state *state)
+static void
+register_variable_uses(nir_function_impl *impl,
+   struct lower_variables_state *state)
 {
-   nir_foreach_instr_safe(instr, block) {
-  if (instr->type != nir_instr_type_intrinsic)
- continue;
+   nir_foreach_block(block, impl) {
+  nir_foreach_instr_safe(instr, block) {
+ if (instr->type != nir_instr_type_intrinsic)
+continue;
 
-  nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
+ nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
 
-  switch (intrin->intrinsic) {
-  case nir_intrinsic_load_var:
- register_load_instr(intrin, state);
- break;
+ switch (intrin->intrinsic) {
+ case nir_intrinsic_load_var:
+register_load_instr(intrin, state);
+break;
 
-  case nir_intrinsic_store_var:
- register_store_instr(intrin, state);
- break;
+ case nir_intrinsic_store_var:
+register_store_instr(intrin, state);
+break;
 
-  case nir_intrinsic_copy_var:
- register_copy_instr(intrin, state);
- break;
+ case nir_intrinsic_copy_var:
+register_copy_instr(intrin, state);
+break;
 
-  default:
- continue;
+ default:
+continue;
+ }
   }
}
-
-   return true;
 }
 
 /* Walks over all of the copy instructions to or from the given deref_node
@@ -654,9 +653,7 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
/* Build the initial deref structures and direct_deref_nodes table */
state.add_to_direct_deref_nodes = true;
 
-   nir_foreach_block(block, impl) {
-  register_variable_uses_block(block, );
-   }
+   register_variable_uses(impl, );
 
bool progress = false;
 
@@ -696,9 +693,7 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
 * added load/store instructions are registered.  We need this
 * information for phi node insertion below.
 */
-   nir_foreach_block(block, impl) {
-  register_variable_uses_block(block, );
-   }
+   register_variable_uses(impl, );
 
state.phi_builder = nir_phi_builder_create(state.impl);
 

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


Mesa (master): nir: Use nir_builder in lower_io_to_temporaries

2018-04-11 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: bc2b170d6849d31fc88df4ece635ff789e4ad0c2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc2b170d6849d31fc88df4ece635ff789e4ad0c2

Author: Jason Ekstrand 
Date:   Mon Mar 26 15:38:49 2018 -0700

nir: Use nir_builder in lower_io_to_temporaries

Reviewed-by: Caio Marcelo de Oliveira Filho 

---

 src/compiler/nir/nir_lower_io_to_temporaries.c | 35 --
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/compiler/nir/nir_lower_io_to_temporaries.c 
b/src/compiler/nir/nir_lower_io_to_temporaries.c
index bff04b9768..3dae52220d 100644
--- a/src/compiler/nir/nir_lower_io_to_temporaries.c
+++ b/src/compiler/nir/nir_lower_io_to_temporaries.c
@@ -31,6 +31,7 @@
  */
 
 #include "nir.h"
+#include "nir_builder.h"
 
 struct lower_io_state {
nir_shader *shader;
@@ -40,7 +41,7 @@ struct lower_io_state {
 };
 
 static void
-emit_copies(nir_cursor cursor, nir_shader *shader, struct exec_list *dest_vars,
+emit_copies(nir_builder *b, struct exec_list *dest_vars,
 struct exec_list *src_vars)
 {
assert(exec_list_length(dest_vars) == exec_list_length(src_vars));
@@ -64,18 +65,16 @@ emit_copies(nir_cursor cursor, nir_shader *shader, struct 
exec_list *dest_vars,
   if (dest->data.read_only)
  continue;
 
-  nir_intrinsic_instr *copy =
- nir_intrinsic_instr_create(shader, nir_intrinsic_copy_var);
-  copy->variables[0] = nir_deref_var_create(copy, dest);
-  copy->variables[1] = nir_deref_var_create(copy, src);
-
-  nir_instr_insert(cursor, >instr);
+  nir_copy_var(b, dest, src);
}
 }
 
 static void
 emit_output_copies_impl(struct lower_io_state *state, nir_function_impl *impl)
 {
+   nir_builder b;
+   nir_builder_init(, impl);
+
if (state->shader->info.stage == MESA_SHADER_GEOMETRY) {
   /* For geometry shaders, we have to emit the output copies right
* before each EmitVertex call.
@@ -87,16 +86,14 @@ emit_output_copies_impl(struct lower_io_state *state, 
nir_function_impl *impl)
 
 nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
 if (intrin->intrinsic == nir_intrinsic_emit_vertex) {
-   nir_cursor cursor = nir_before_instr(>instr);
-   emit_copies(cursor, state->shader, >shader->outputs,
-   >old_outputs);
+   b.cursor = nir_before_instr(>instr);
+   emit_copies(, >shader->outputs, >old_outputs);
 }
  }
   }
} else if (impl == state->entrypoint) {
-  nir_cursor cursor = nir_before_block(nir_start_block(impl));
-  emit_copies(cursor, state->shader, >old_outputs,
-  >shader->outputs);
+  b.cursor = nir_before_block(nir_start_block(impl));
+  emit_copies(, >old_outputs, >shader->outputs);
 
   /* For all other shader types, we need to do the copies right before
* the jumps to the end block.
@@ -104,9 +101,8 @@ emit_output_copies_impl(struct lower_io_state *state, 
nir_function_impl *impl)
   struct set_entry *block_entry;
   set_foreach(impl->end_block->predecessors, block_entry) {
  struct nir_block *block = (void *)block_entry->key;
- nir_cursor cursor = nir_after_block_before_jump(block);
- emit_copies(cursor, state->shader, >shader->outputs,
- >old_outputs);
+ b.cursor = nir_after_block_before_jump(block);
+ emit_copies(, >shader->outputs, >old_outputs);
   }
}
 }
@@ -115,9 +111,10 @@ static void
 emit_input_copies_impl(struct lower_io_state *state, nir_function_impl *impl)
 {
if (impl == state->entrypoint) {
-  nir_cursor cursor = nir_before_block(nir_start_block(impl));
-  emit_copies(cursor, state->shader, >old_inputs,
-  >shader->inputs);
+  nir_builder b;
+  nir_builder_init(, impl);
+  b.cursor = nir_before_block(nir_start_block(impl));
+  emit_copies(, >old_inputs, >shader->inputs);
}
 }
 

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


Mesa (master): radv: Enable RB+ on Raven.

2018-04-11 Thread Bas Nieuwenhuizen
Module: Mesa
Branch: master
Commit: bd95397d651f89e1f485716b228e18bacbd7d486
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd95397d651f89e1f485716b228e18bacbd7d486

Author: Bas Nieuwenhuizen 
Date:   Wed Apr 11 01:35:38 2018 +0200

radv: Enable RB+ on Raven.

Reviewed-by: Samuel Pitoiset 

---

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

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 4fc7392e65..22e8f1e7a7 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -293,7 +293,8 @@ radv_physical_device_init(struct radv_physical_device 
*device,
device->rad_info.chip_class >= GFX9) {
device->has_rbplus = true;
device->rbplus_allowed = device->rad_info.family == CHIP_STONEY 
||
-device->rad_info.family == CHIP_VEGA12;
+device->rad_info.family == CHIP_VEGA12 
||
+device->rad_info.family == CHIP_RAVEN;
}
 
/* The mere presense of CLEAR_STATE in the IB causes random GPU hangs

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


Mesa (master): vulkan: fix build issue on android (both anv/radv)

2018-04-11 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: 9f29b1a4c84644cd2b2749352cd6064ea408ce6b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f29b1a4c84644cd2b2749352cd6064ea408ce6b

Author: Tapani Pälli 
Date:   Wed Apr 11 10:23:11 2018 +0300

vulkan: fix build issue on android (both anv/radv)

Fixes linking errors against:

   anv_GetPhysicalDeviceImageFormatProperties2KHR
   radv_GetPhysicalDeviceImageFormatProperties2KHR

Signed-off-by: Tapani Pälli 
Reviewed-by: Bas Nieuwenhuizen 

---

 src/amd/vulkan/radv_android.c  | 6 +++---
 src/intel/vulkan/anv_android.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/amd/vulkan/radv_android.c b/src/amd/vulkan/radv_android.c
index 09da601dac..c06c83b8ab 100644
--- a/src/amd/vulkan/radv_android.c
+++ b/src/amd/vulkan/radv_android.c
@@ -230,11 +230,11 @@ VkResult radv_GetSwapchainGrallocUsageANDROID(
};
 
/* Check that requested format and usage are supported. */
-   result = radv_GetPhysicalDeviceImageFormatProperties2KHR(phys_dev_h,
-
_format_info, _format_props);
+   result = radv_GetPhysicalDeviceImageFormatProperties2(phys_dev_h,
+ 
_format_info, _format_props);
if (result != VK_SUCCESS) {
return vk_errorf(result,
-
"radv_GetPhysicalDeviceImageFormatProperties2KHR failed "
+"radv_GetPhysicalDeviceImageFormatProperties2 
failed "
 "inside %s", __func__);
}
 
diff --git a/src/intel/vulkan/anv_android.c b/src/intel/vulkan/anv_android.c
index b16829..7e07dbaaa4 100644
--- a/src/intel/vulkan/anv_android.c
+++ b/src/intel/vulkan/anv_android.c
@@ -254,11 +254,11 @@ VkResult anv_GetSwapchainGrallocUsageANDROID(
};
 
/* Check that requested format and usage are supported. */
-   result = anv_GetPhysicalDeviceImageFormatProperties2KHR(phys_dev_h,
+   result = anv_GetPhysicalDeviceImageFormatProperties2(phys_dev_h,
_format_info, _format_props);
if (result != VK_SUCCESS) {
   return vk_errorf(device->instance, device, result,
-   "anv_GetPhysicalDeviceImageFormatProperties2KHR failed "
+   "anv_GetPhysicalDeviceImageFormatProperties2 failed "
"inside %s", __func__);
}
 

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


Mesa (master): radeonsi: correctly parse disassembly with labels

2018-04-11 Thread Nicolai Hähnle
Module: Mesa
Branch: master
Commit: 41e6ffee49832c57b3821e4b63e0245db7b115f9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=41e6ffee49832c57b3821e4b63e0245db7b115f9

Author: Nicolai Hähnle 
Date:   Thu Jan 18 16:05:21 2018 +0100

radeonsi: correctly parse disassembly with labels

LLVM now emits labels as part of the disassembly string, which is very
useful but breaks the old parsing approach.

Use the semicolon to detect the boundary of instructions instead of going
by line breaks.

Reviewed-by: Marek Olšák 

---

 src/gallium/drivers/radeonsi/si_debug.c | 63 +
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_debug.c 
b/src/gallium/drivers/radeonsi/si_debug.c
index 69d20c1efe..817a6d5ee9 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -31,6 +31,7 @@
 #include "util/u_dump.h"
 #include "util/u_log.h"
 #include "util/u_memory.h"
+#include "util/u_string.h"
 #include "ac_debug.h"
 
 static void si_dump_bo_list(struct si_context *sctx,
@@ -859,42 +860,40 @@ static void si_dump_compute_descriptors(struct si_context 
*sctx,
 }
 
 struct si_shader_inst {
-   char text[160];  /* one disasm line */
-   unsigned offset; /* instruction offset */
+   const char *text; /* start of disassembly for this instruction */
+   unsigned textlen;
unsigned size;   /* instruction size = 4 or 8 */
+   uint64_t addr; /* instruction address */
 };
 
-/* Split a disassembly string into lines and add them to the array pointed
- * to by "instructions". */
+/**
+ * Split a disassembly string into instructions and add them to the array
+ * pointed to by \p instructions.
+ *
+ * Labels are considered to be part of the following instruction.
+ */
 static void si_add_split_disasm(const char *disasm,
-   uint64_t start_addr,
+   uint64_t *addr,
unsigned *num,
struct si_shader_inst *instructions)
 {
-   struct si_shader_inst *last_inst = *num ? [*num - 1] : 
NULL;
-   char *next;
+   const char *semicolon;
 
-   while ((next = strchr(disasm, '\n'))) {
-   struct si_shader_inst *inst = [*num];
-   unsigned len = next - disasm;
+   while ((semicolon = strchr(disasm, ';'))) {
+   struct si_shader_inst *inst = [(*num)++];
+   const char *end = util_strchrnul(semicolon, '\n');
 
-   assert(len < ARRAY_SIZE(inst->text));
-   memcpy(inst->text, disasm, len);
-   inst->text[len] = 0;
-   inst->offset = last_inst ? last_inst->offset + last_inst->size 
: 0;
+   inst->text = disasm;
+   inst->textlen = end - disasm;
 
-   const char *semicolon = strchr(disasm, ';');
-   assert(semicolon);
+   inst->addr = *addr;
/* More than 16 chars after ";" means the instruction is 8 
bytes long. */
-   inst->size = next - semicolon > 16 ? 8 : 4;
-
-   snprintf(inst->text + len, ARRAY_SIZE(inst->text) - len,
-   " [PC=0x%"PRIx64", off=%u, size=%u]",
-   start_addr + inst->offset, inst->offset, inst->size);
+   inst->size = end - semicolon > 16 ? 8 : 4;
+   *addr += inst->size;
 
-   last_inst = inst;
-   (*num)++;
-   disasm = next + 1;
+   if (!(*end))
+   break;
+   disasm = end + 1;
}
 }
 
@@ -930,26 +929,27 @@ static void si_print_annotated_shader(struct si_shader 
*shader,
 * Buffer size / 4 is the upper bound of the instruction count.
 */
unsigned num_inst = 0;
+   uint64_t inst_addr = start_addr;
struct si_shader_inst *instructions =
calloc(shader->bo->b.b.width0 / 4, sizeof(struct 
si_shader_inst));
 
if (shader->prolog) {
si_add_split_disasm(shader->prolog->binary.disasm_string,
-   start_addr, _inst, instructions);
+   _addr, _inst, instructions);
}
if (shader->previous_stage) {

si_add_split_disasm(shader->previous_stage->binary.disasm_string,
-   start_addr, _inst, instructions);
+   _addr, _inst, instructions);
}
if (shader->prolog2) {
si_add_split_disasm(shader->prolog2->binary.disasm_string,
-   start_addr, _inst, instructions);
+   _addr, _inst, instructions);
}
si_add_split_disasm(shader->binary.disasm_string,
-   start_addr, _inst, instructions);
+   _addr, _inst, 

Mesa (master): radeonsi: pass -O halt_waves to umr for hang debugging

2018-04-11 Thread Nicolai Hähnle
Module: Mesa
Branch: master
Commit: 0630e52c9eba4af9b1e96705248bad03a0cb951e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0630e52c9eba4af9b1e96705248bad03a0cb951e

Author: Nicolai Hähnle 
Date:   Thu Jan 18 16:04:15 2018 +0100

radeonsi: pass -O halt_waves to umr for hang debugging

This will give us meaningful wave information in the case of a hang where
shaders are still running in an infinite loop.

Note that we call umr multiple times for different sections of the ddebug
hang dump, and so the wave information will not necessarily match up
between sections.

Reviewed-by: Marek Olšák 

---

 src/amd/common/ac_debug.c   | 2 +-
 src/gallium/drivers/radeonsi/si_debug.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/amd/common/ac_debug.c b/src/amd/common/ac_debug.c
index 7f43437aa9..3b15398a2a 100644
--- a/src/amd/common/ac_debug.c
+++ b/src/amd/common/ac_debug.c
@@ -761,7 +761,7 @@ unsigned ac_get_wave_info(struct ac_wave_info 
waves[AC_MAX_WAVES_PER_CHIP])
char line[2000];
unsigned num_waves = 0;
 
-   FILE *p = popen("umr -wa", "r");
+   FILE *p = popen("umr -O halt_waves -wa", "r");
if (!p)
return 0;
 
diff --git a/src/gallium/drivers/radeonsi/si_debug.c 
b/src/gallium/drivers/radeonsi/si_debug.c
index 00e0722c82..69d20c1efe 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -1051,8 +1051,8 @@ static void si_dump_debug_state(struct pipe_context *ctx, 
FILE *f,
si_dump_debug_registers(sctx, f);
 
si_dump_annotated_shaders(sctx, f);
-   si_dump_command("Active waves (raw data)", "umr -wa | column 
-t", f);
-   si_dump_command("Wave information", "umr -O bits -wa", f);
+   si_dump_command("Active waves (raw data)", "umr -O halt_waves 
-wa | column -t", f);
+   si_dump_command("Wave information", "umr -O halt_waves,bits 
-wa", f);
}
 }
 

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