Mesa (master): main: select ES3.2 version when all extensions are available

2016-04-25 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: fa8c0ccfbcc140d8c88a48a8c7c7acc8b8b7e363
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa8c0ccfbcc140d8c88a48a8c7c7acc8b8b7e363

Author: Ilia Mirkin 
Date:   Sun Apr 24 13:24:25 2016 -0400

main: select ES3.2 version when all extensions are available

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 

---

 src/mesa/main/version.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index b9c1bcb..ffb7787 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -529,8 +529,24 @@ compute_version_es2(const struct gl_extensions *extensions,
  extensions->ARB_texture_multisample &&
  extensions->ARB_gpu_shader5 &&
  extensions->EXT_shader_integer_mix);
+   const bool ver_3_2 = (ver_3_1 &&
+ /*extensions->KHR_blend_equation_advanced*/ false &&
+ extensions->KHR_texture_compression_astc_ldr &&
+ extensions->OES_copy_image &&
+ extensions->ARB_draw_buffers_blend &&
+ extensions->ARB_draw_elements_base_vertex &&
+ extensions->OES_geometry_shader &&
+ /*extensions->OES_primitive_bounding_box*/ false &&
+ extensions->OES_sample_variables &&
+ extensions->ARB_tessellation_shader &&
+ extensions->ARB_texture_border_clamp &&
+ extensions->OES_texture_buffer &&
+ extensions->ARB_texture_cube_map_array &&
+ extensions->ARB_texture_stencil8);
 
-   if (ver_3_1) {
+   if (ver_3_2) {
+  return 32;
+   } else if (ver_3_1) {
   return 31;
} else if (ver_3_0) {
   return 30;

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


Mesa (master): glsl: add ability to use essl 3.20

2016-04-25 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 4965c5bf72d95a73a1a4219843fe36c65b7b10c2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4965c5bf72d95a73a1a4219843fe36c65b7b10c2

Author: Ilia Mirkin 
Date:   Sun Apr 24 13:15:59 2016 -0400

glsl: add ability to use essl 3.20

Signed-off-by: Ilia Mirkin 
Reviewed-by: Dave Airlie 

---

 src/compiler/glsl/glsl_parser_extras.cpp | 7 +++
 src/compiler/glsl/glsl_parser_extras.h   | 2 ++
 src/mesa/main/extensions_table.h | 1 +
 src/mesa/main/mtypes.h   | 1 +
 4 files changed, 11 insertions(+)

diff --git a/src/compiler/glsl/glsl_parser_extras.cpp 
b/src/compiler/glsl/glsl_parser_extras.cpp
index 76321aa..fb64350 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -231,6 +231,12 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct 
gl_context *_ctx,
   this->supported_versions[this->num_supported_versions].es = true;
   this->num_supported_versions++;
}
+   if ((ctx->API == API_OPENGLES2 && ctx->Version >= 32) ||
+   ctx->Extensions.ARB_ES3_2_compatibility) {
+  this->supported_versions[this->num_supported_versions].ver = 320;
+  this->supported_versions[this->num_supported_versions].es = true;
+  this->num_supported_versions++;
+   }
 
/* Create a string for use in error messages to tell the user which GLSL
 * versions are supported.
@@ -566,6 +572,7 @@ static const _mesa_glsl_extension 
_mesa_glsl_supported_extensions[] = {
/* ARB extensions go here, sorted alphabetically.
 */
EXT(ARB_ES3_1_compatibility,  true,  false, 
ARB_ES3_1_compatibility),
+   EXT(ARB_ES3_2_compatibility,  true,  false, 
ARB_ES3_2_compatibility),
EXT(ARB_arrays_of_arrays, true,  false, 
ARB_arrays_of_arrays),
EXT(ARB_compute_shader,   true,  false, ARB_compute_shader),
EXT(ARB_conservative_depth,   true,  false, 
ARB_conservative_depth),
diff --git a/src/compiler/glsl/glsl_parser_extras.h 
b/src/compiler/glsl/glsl_parser_extras.h
index c774fbe..7018347 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -512,6 +512,8 @@ struct _mesa_glsl_parse_state {
 */
bool ARB_ES3_1_compatibility_enable;
bool ARB_ES3_1_compatibility_warn;
+   bool ARB_ES3_2_compatibility_enable;
+   bool ARB_ES3_2_compatibility_warn;
bool ARB_arrays_of_arrays_enable;
bool ARB_arrays_of_arrays_warn;
bool ARB_compute_shader_enable;
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 78899ec..a094ebe 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -28,6 +28,7 @@ EXT(APPLE_vertex_array_object   , dummy_true
 
 EXT(ARB_ES2_compatibility   , ARB_ES2_compatibility
  , GLL, GLC,  x ,  x , 2009)
 EXT(ARB_ES3_1_compatibility , ARB_ES3_1_compatibility  
  ,  x , GLC,  x ,  x , 2014)
+EXT(ARB_ES3_2_compatibility , ARB_ES3_2_compatibility  
  ,  x , GLC,  x ,  x , 2015)
 EXT(ARB_ES3_compatibility   , ARB_ES3_compatibility
  , GLL, GLC,  x ,  x , 2012)
 EXT(ARB_arrays_of_arrays, ARB_arrays_of_arrays 
  , GLL, GLC,  x ,  x , 2012)
 EXT(ARB_base_instance   , ARB_base_instance
  , GLL, GLC,  x ,  x , 2011)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e4a3036..46b1543 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3724,6 +3724,7 @@ struct gl_extensions
GLboolean ARB_ES2_compatibility;
GLboolean ARB_ES3_compatibility;
GLboolean ARB_ES3_1_compatibility;
+   GLboolean ARB_ES3_2_compatibility;
GLboolean ARB_arrays_of_arrays;
GLboolean ARB_base_instance;
GLboolean ARB_blend_func_extended;

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


Mesa (master): tgsi: pass a shader type to the machine create and clean up.

2016-04-25 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: e3e6859381df15fe17a4bd2b93906f69a3657dd4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e3e6859381df15fe17a4bd2b93906f69a3657dd4

Author: Dave Airlie 
Date:   Tue Apr 26 10:45:00 2016 +1000

tgsi: pass a shader type to the machine create and clean up.

There was definitely bugs here mixing up the PIPE_ and TGSI_ defines,
hopefully they didn't cause any problems, since mostly it was special
cases for GEOMETRY.

This clarifies at shader machine create what type of shader this
machine will execute. This is needed also for compute shaders where
we don't want to allocate inputs/outputs.

Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 src/gallium/auxiliary/draw/draw_gs.c  |  2 +-
 src/gallium/auxiliary/draw/draw_vs.c  |  2 +-
 src/gallium/auxiliary/tgsi/tgsi_exec.c| 20 ++--
 src/gallium/auxiliary/tgsi/tgsi_exec.h|  4 ++--
 src/gallium/drivers/softpipe/sp_context.c |  2 +-
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c 
b/src/gallium/auxiliary/draw/draw_gs.c
index ef217fa..ca03238 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -692,7 +692,7 @@ boolean
 draw_gs_init( struct draw_context *draw )
 {
if (!draw->llvm) {
-  draw->gs.tgsi.machine = tgsi_exec_machine_create();
+  draw->gs.tgsi.machine = tgsi_exec_machine_create(PIPE_SHADER_GEOMETRY);
   if (!draw->gs.tgsi.machine)
  return FALSE;
 
diff --git a/src/gallium/auxiliary/draw/draw_vs.c 
b/src/gallium/auxiliary/draw/draw_vs.c
index 438c9a6..5b42b69 100644
--- a/src/gallium/auxiliary/draw/draw_vs.c
+++ b/src/gallium/auxiliary/draw/draw_vs.c
@@ -154,7 +154,7 @@ draw_vs_init( struct draw_context *draw )
draw->dump_vs = debug_get_option_gallium_dump_vs();
 
if (!draw->llvm) {
-  draw->vs.tgsi.machine = tgsi_exec_machine_create();
+  draw->vs.tgsi.machine = tgsi_exec_machine_create(PIPE_SHADER_VERTEX);
   if (!draw->vs.tgsi.machine)
  return FALSE;
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 002aefc..4567a94 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -895,11 +895,10 @@ tgsi_exec_machine_bind_shader(
   return;
}
 
-   mach->Processor = parse.FullHeader.Processor.Processor;
mach->ImmLimit = 0;
mach->NumOutputs = 0;
 
-   if (mach->Processor == PIPE_SHADER_GEOMETRY &&
+   if (mach->ShaderType == PIPE_SHADER_GEOMETRY &&
!mach->UsedGeometryShader) {
   struct tgsi_exec_vector *inputs;
   struct tgsi_exec_vector *outputs;
@@ -1005,7 +1004,7 @@ tgsi_exec_machine_bind_shader(
  break;
 
   case TGSI_TOKEN_TYPE_PROPERTY:
- if (mach->Processor == PIPE_SHADER_GEOMETRY) {
+ if (mach->ShaderType == PIPE_SHADER_GEOMETRY) {
 if (parse.FullToken.FullProperty.Property.PropertyName == 
TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES) {
mach->MaxOutputVertices = 
parse.FullToken.FullProperty.u[0].Data;
 }
@@ -1029,7 +1028,7 @@ tgsi_exec_machine_bind_shader(
 
 
 struct tgsi_exec_machine *
-tgsi_exec_machine_create( void )
+tgsi_exec_machine_create(enum pipe_shader_type shader_type)
 {
struct tgsi_exec_machine *mach;
uint i;
@@ -1040,6 +1039,7 @@ tgsi_exec_machine_create( void )
 
memset(mach, 0, sizeof(*mach));
 
+   mach->ShaderType = shader_type;
mach->Addrs = >Temps[TGSI_EXEC_TEMP_ADDR];
mach->MaxGeometryShaderOutputs = TGSI_MAX_TOTAL_VERTICES;
mach->Predicates = >Temps[TGSI_EXEC_TEMP_P0];
@@ -1260,7 +1260,7 @@ fetch_src_file_channel(const struct tgsi_exec_machine 
*mach,
case TGSI_FILE_INPUT:
   for (i = 0; i < TGSI_QUAD_SIZE; i++) {
  /*
- if (PIPE_SHADER_GEOMETRY == mach->Processor) {
+ if (PIPE_SHADER_GEOMETRY == mach->ShaderType) {
 debug_printf("Fetching Input[%d] (2d=%d, 1d=%d)\n",
  index2D->i[i] * TGSI_EXEC_MAX_INPUT_ATTRIBS + 
index->i[i],
  index2D->i[i], index->i[i]);
@@ -1654,7 +1654,7 @@ store_dest_dstret(struct tgsi_exec_machine *mach,
   debug_printf("NumOutputs = %d, TEMP_O_C/I = %d, redindex = %d\n",
mach->NumOutputs, 
mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0],
reg->Register.Index);
-  if (PIPE_SHADER_GEOMETRY == mach->Processor) {
+  if (PIPE_SHADER_GEOMETRY == mach->ShaderType) {
  debug_printf("STORING OUT[%d] mask(%d), = (", offset + index, 
execmask);
  for (i = 0; i < TGSI_QUAD_SIZE; i++)
 if (execmask & (1 << i))
@@ -1888,7 +1888,7 @@ emit_primitive(struct tgsi_exec_machine *mach)
 static void
 conditional_emit_primitive(struct tgsi_exec_machine *mach)
 {
-   if (PIPE_SHADER_GEOMETRY == mach->Processor) {
+   if (PIPE_SHADER_GEOMETRY == 

Mesa (master): gallium/tgsi: move tgsi_exec.h header out of draw_context.h

2016-04-25 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: a6aae0c24d83675ecaaf0c6d1d8f05ad9175a9fe
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6aae0c24d83675ecaaf0c6d1d8f05ad9175a9fe

Author: Dave Airlie 
Date:   Tue Apr 26 09:42:38 2016 +1000

gallium/tgsi: move tgsi_exec.h header out of draw_context.h

It gets annoying that changing the tgsi exec rebuilds the state
tracker unnecessarily. Putting this include into draw_gs.h which
uses it causes a lot less rebuilds.

Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 src/gallium/auxiliary/draw/draw_context.h | 1 -
 src/gallium/auxiliary/draw/draw_gs.h  | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.h 
b/src/gallium/auxiliary/draw/draw_context.h
index 3e6722f..9167ffd 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -39,7 +39,6 @@
 
 
 #include "pipe/p_state.h"
-#include "tgsi/tgsi_exec.h"
 
 struct pipe_context;
 struct draw_context;
diff --git a/src/gallium/auxiliary/draw/draw_gs.h 
b/src/gallium/auxiliary/draw/draw_gs.h
index 663ba84..d256a05 100644
--- a/src/gallium/auxiliary/draw/draw_gs.h
+++ b/src/gallium/auxiliary/draw/draw_gs.h
@@ -29,6 +29,7 @@
 #define DRAW_GS_H
 
 #include "draw_context.h"
+#include "tgsi/tgsi_exec.h"
 #include "draw_private.h"
 
 #define MAX_TGSI_PRIMITIVES 4

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


Mesa (master): gallivm: make sampling more robust against bogus coordinates

2016-04-25 Thread Roland Scheidegger
Module: Mesa
Branch: master
Commit: bd07e20d208268382a34dca23ff71a8192bb1525
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd07e20d208268382a34dca23ff71a8192bb1525

Author: Roland Scheidegger 
Date:   Tue Apr 26 04:53:01 2016 +0200

gallivm: make sampling more robust against bogus coordinates

Some cases (especially these using fract for coord wrapping) did not handle
NaNs (or Infs) correctly - the following code assumed the fract result
could not be outside [0,1], but if the input is a NaN (or +-Inf) the fract
result was NaN - which then could produce out-of-bound offsets.

(Note that the explicit NaN behavior changes for min/max on x86 sse don't
result in actual changes in the generated jit code, but may on other
architectures. Found by looking through all the wrap functions.)

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=94955

No piglit changes.

(v2: fix min/max typo in coord_mirror, add comment)

Cc: "11.1 11.2" 

Tested-by: Bruce Cherniak 
Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c   |  9 +++---
 src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 13 -
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 34 +--
 3 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c 
b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index beff414..17cf296 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -2069,8 +2069,8 @@ lp_build_fract(struct lp_build_context *bld,
 
 
 /**
- * Prevent returning a fractional part of 1.0 for very small negative values of
- * 'a' by clamping against 0.9(9).
+ * Prevent returning 1.0 for very small negative values of 'a' by clamping
+ * against 0.9(9). (Will also return that value for NaNs.)
  */
 static inline LLVMValueRef
 clamp_fract(struct lp_build_context *bld, LLVMValueRef fract)
@@ -2080,13 +2080,14 @@ clamp_fract(struct lp_build_context *bld, LLVMValueRef 
fract)
/* this is the largest number smaller than 1.0 representable as float */
max = lp_build_const_vec(bld->gallivm, bld->type,
 1.0 - 1.0/(1LL << (lp_mantissa(bld->type) + 1)));
-   return lp_build_min(bld, fract, max);
+   return lp_build_min_ext(bld, fract, max,
+   GALLIVM_NAN_RETURN_OTHER_SECOND_NONNAN);
 }
 
 
 /**
  * Same as lp_build_fract, but guarantees that the result is always smaller
- * than one.
+ * than one. Will also return the smaller-than-one value for infs, NaNs.
  */
 LLVMValueRef
 lp_build_fract_safe(struct lp_build_context *bld,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
index 729c5b8..6bf92c8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
@@ -246,6 +246,12 @@ lp_build_coord_repeat_npot_linear_int(struct 
lp_build_sample_context *bld,
mask = lp_build_compare(int_coord_bld->gallivm, int_coord_bld->type,
PIPE_FUNC_LESS, *coord0_i, int_coord_bld->zero);
*coord0_i = lp_build_select(int_coord_bld, mask, length_minus_one, 
*coord0_i);
+   /*
+* We should never get values too large - except if coord was nan or inf,
+* in which case things go terribly wrong...
+* Alternatively, could use fract_safe above...
+*/
+   *coord0_i = lp_build_min(int_coord_bld, *coord0_i, length_minus_one);
 }
 
 
@@ -490,6 +496,10 @@ lp_build_sample_wrap_linear_float(struct 
lp_build_sample_context *bld,
  *coord1 = lp_build_add(coord_bld, coord, half);
  coord = lp_build_sub(coord_bld, coord, half);
  *weight = lp_build_fract(coord_bld, coord);
+ /*
+  * It is important for this comparison to be unordered
+  * (or need fract_safe above).
+  */
  mask = lp_build_compare(coord_bld->gallivm, coord_bld->type,
  PIPE_FUNC_LESS, coord, coord_bld->zero);
  *coord0 = lp_build_select(coord_bld, mask, length_minus_one, coord);
@@ -514,7 +524,8 @@ lp_build_sample_wrap_linear_float(struct 
lp_build_sample_context *bld,
  coord = lp_build_sub(coord_bld, coord, half);
   }
   /* clamp to [0, length - 1] */
-  coord = lp_build_min(coord_bld, coord, length_minus_one);
+  coord = lp_build_min_ext(coord_bld, coord, length_minus_one,
+   GALLIVM_NAN_RETURN_OTHER_SECOND_NONNAN);
   coord = lp_build_max(coord_bld, coord, coord_bld->zero);
   *coord1 = lp_build_add(coord_bld, coord, coord_bld->one);
   /* convert to int, compute lerp weight */
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 332394e..31cf74f 100644
--- 

Mesa (master): radeonsi: fix missing include for Elements.

2016-04-25 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: d8edc3e97cfc9ff36c5f6009dc98bc78e2f76389
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8edc3e97cfc9ff36c5f6009dc98bc78e2f76389

Author: Dave Airlie 
Date:   Tue Apr 26 09:35:49 2016 +1000

radeonsi: fix missing include for Elements.

Since u_blitter.h no longer defines this.

Signed-off-by: Dave Airlie 

---

 src/gallium/drivers/radeonsi/si_state_draw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index b61c05a..9b52566 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -32,6 +32,7 @@
 #include "util/u_index_modify.h"
 #include "util/u_upload_mgr.h"
 #include "util/u_prim.h"
+#include "util/u_memory.h"
 
 static unsigned si_conv_pipe_prim(unsigned mode)
 {

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


Mesa (master): nvc0: bump the amount of shared memory per MP on Maxwell

2016-04-25 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: d12c3b02ffdcb54fd3c919ab1d13603a793d20ef
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d12c3b02ffdcb54fd3c919ab1d13603a793d20ef

Author: Samuel Pitoiset 
Date:   Tue Apr 26 00:15:25 2016 +0200

nvc0: bump the amount of shared memory per MP on Maxwell

According to the CUDA compute capability version, GM10x can expose
64KB of shared memory while GM20x can use 96KB.

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Ilia Mirkin 

---

 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 3bf98ad..3fe4309 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -444,7 +444,17 @@ nvc0_screen_get_compute_param(struct pipe_screen *pscreen,
case PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE: /* g[] */
   RET((uint64_t []) { 1ULL << 40 });
case PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE: /* s[] */
-  RET((uint64_t []) { 48 << 10 });
+  switch (obj_class) {
+  case GM200_COMPUTE_CLASS:
+ RET((uint64_t []) { 96 << 10 });
+ break;
+  case GM107_COMPUTE_CLASS:
+ RET((uint64_t []) { 64 << 10 });
+ break;
+  default:
+ RET((uint64_t []) { 48 << 10 });
+ break;
+  }
case PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE: /* l[] */
   RET((uint64_t []) { 512 << 10 });
case PIPE_COMPUTE_CAP_MAX_INPUT_SIZE: /* c[], arbitrary limit */

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


Mesa (master): r600: fix missing include for Elements macro

2016-04-25 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 5b6a1aee4674d24d57fbbaac86619e429bd031e5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b6a1aee4674d24d57fbbaac86619e429bd031e5

Author: Dave Airlie 
Date:   Tue Apr 26 07:59:44 2016 +1000

r600: fix missing include for Elements macro

This got removed from u_blitter.h and we were taking it from
there, this should just move to ARRAY_SIZE eventually.

Signed-off-by: Dave Airlie 

---

 src/gallium/drivers/r600/r600_pipe.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/r600/r600_pipe.h 
b/src/gallium/drivers/r600/r600_pipe.h
index 7793859..4d16223 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -33,6 +33,7 @@
 #include "util/u_suballoc.h"
 #include "util/list.h"
 #include "util/u_transfer.h"
+#include "util/u_memory.h"
 
 #include "tgsi/tgsi_scan.h"
 

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


Mesa (master): gm107/ir: s/invalid load/invalid store/

2016-04-25 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: 725431a5dbce37f011f27521053707dce63731ff
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=725431a5dbce37f011f27521053707dce63731ff

Author: Samuel Pitoiset 
Date:   Mon Apr 25 22:45:17 2016 +0200

gm107/ir: s/invalid load/invalid store/

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Ilia Mirkin 

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
index 31ddb11..35930e3 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
@@ -3031,7 +3031,7 @@ CodeEmitterGM107::emitInstruction(Instruction *i)
   case FILE_MEMORY_SHARED: emitSTS(); break;
   case FILE_MEMORY_GLOBAL: emitST(); break;
   default:
- assert(!"invalid load");
+ assert(!"invalid store");
  emitNOP();
  break;
   }

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


Mesa (master): freedreno/ir3: convert over to ralloc

2016-04-25 Thread Rob Clark
Module: Mesa
Branch: master
Commit: 8fe20762433dafc8d6df3a14db7074c1ddf99120
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8fe20762433dafc8d6df3a14db7074c1ddf99120

Author: Rob Clark 
Date:   Sun Apr 24 14:01:58 2016 -0400

freedreno/ir3: convert over to ralloc

The home-grown heap scheme (which is ultra-simple but probably not good
to always allocate and memset such a chunk of memory up front) was a
remnant of fdre (where the ir originally came from).  But since we have
ralloc in mesa, lets just use that instead.

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/freedreno/ir3/ir3.c | 41 +
 src/gallium/drivers/freedreno/ir3/ir3.h |  5 
 2 files changed, 6 insertions(+), 40 deletions(-)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3.c 
b/src/gallium/drivers/freedreno/ir3/ir3.c
index f512142..1406856 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3.c
@@ -30,48 +30,23 @@
 #include 
 #include 
 
+#include "util/ralloc.h"
+
 #include "freedreno_util.h"
 #include "instr-a3xx.h"
 
-#define CHUNK_SZ 1020
-
-struct ir3_heap_chunk {
-   struct ir3_heap_chunk *next;
-   uint32_t heap[CHUNK_SZ];
-};
-
-static void grow_heap(struct ir3 *shader)
-{
-   struct ir3_heap_chunk *chunk = calloc(1, sizeof(*chunk));
-   chunk->next = shader->chunk;
-   shader->chunk = chunk;
-   shader->heap_idx = 0;
-}
-
 /* simple allocator to carve allocations out of an up-front allocated heap,
  * so that we can free everything easily in one shot.
  */
 void * ir3_alloc(struct ir3 *shader, int sz)
 {
-   void *ptr;
-
-   sz = align(sz, 4) / 4;
-
-   if ((shader->heap_idx + sz) > CHUNK_SZ)
-   grow_heap(shader);
-
-   ptr = >chunk->heap[shader->heap_idx];
-   shader->heap_idx += sz;
-
-   return ptr;
+   return ralloc_size(shader, sz);
 }
 
 struct ir3 * ir3_create(struct ir3_compiler *compiler,
unsigned nin, unsigned nout)
 {
-   struct ir3 *shader = calloc(1, sizeof(struct ir3));
-
-   grow_heap(shader);
+   struct ir3 *shader = ralloc(compiler, struct ir3);
 
shader->compiler = compiler;
shader->ninputs = nin;
@@ -88,17 +63,13 @@ struct ir3 * ir3_create(struct ir3_compiler *compiler,
 
 void ir3_destroy(struct ir3 *shader)
 {
-   while (shader->chunk) {
-   struct ir3_heap_chunk *chunk = shader->chunk;
-   shader->chunk = chunk->next;
-   free(chunk);
-   }
+   /* TODO convert the dynamic array to ralloc too: */
free(shader->indirects);
free(shader->predicates);
free(shader->baryfs);
free(shader->keeps);
free(shader->astc_srgb);
-   free(shader);
+   ralloc_free(shader);
 }
 
 #define iassert(cond) do { \
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.h 
b/src/gallium/drivers/freedreno/ir3/ir3.h
index a40d3aa..e58618c 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3.h
@@ -337,8 +337,6 @@ static inline int ir3_neighbor_count(struct ir3_instruction 
*instr)
return num;
 }
 
-struct ir3_heap_chunk;
-
 struct ir3 {
struct ir3_compiler *compiler;
 
@@ -388,9 +386,6 @@ struct ir3 {
 
/* List of ir3_array's: */
struct list_head array_list;
-
-   unsigned heap_idx;
-   struct ir3_heap_chunk *chunk;
 };
 
 typedef struct nir_variable nir_variable;

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


Mesa (master): freedreno/a3xx: remove unused fxn

2016-04-25 Thread Rob Clark
Module: Mesa
Branch: master
Commit: d2fcd0ce389d619ecabd45d1f4bea4a4a33d881d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d2fcd0ce389d619ecabd45d1f4bea4a4a33d881d

Author: Rob Clark 
Date:   Sun Apr 24 16:41:12 2016 -0400

freedreno/a3xx: remove unused fxn

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/freedreno/a3xx/fd3_program.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.h 
b/src/gallium/drivers/freedreno/a3xx/fd3_program.h
index 52c8080..b3fcc0c 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_program.h
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.h
@@ -44,10 +44,4 @@ void fd3_program_emit(struct fd_ringbuffer *ring, struct 
fd3_emit *emit,
 
 void fd3_prog_init(struct pipe_context *pctx);
 
-static inline struct ir3_shader_variant *
-fd3_shader_variant(struct fd3_shader_stateobj *so, struct ir3_shader_key key)
-{
-   return ir3_shader_variant(so->shader, key);
-}
-
 #endif /* FD3_PROGRAM_H_ */

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


Mesa (master): mesa/st: log some additional invalid-fbo cases

2016-04-25 Thread Rob Clark
Module: Mesa
Branch: master
Commit: 27cf3b00527b29da2df6cf2ac9f1779187f203d9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=27cf3b00527b29da2df6cf2ac9f1779187f203d9

Author: Rob Clark 
Date:   Mon Apr 25 13:16:10 2016 -0400

mesa/st: log some additional invalid-fbo cases

Signed-off-by: Rob Clark 
Reviewed-by: Brian Paul 

---

 src/mesa/state_tracker/st_cb_fbo.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index 456ad83..a53b95a 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -644,6 +644,7 @@ st_validate_framebuffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
depth,
   PIPE_BIND_DEPTH_STENCIL)) {
   fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+  st_fbo_invalid("Invalid depth attachment");
   return;
}
if (!st_validate_attachment(ctx,
@@ -651,6 +652,7 @@ st_validate_framebuffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
stencil,
   PIPE_BIND_DEPTH_STENCIL)) {
   fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+  st_fbo_invalid("Invalid stencil attachment");
   return;
}
for (i = 0; i < ctx->Const.MaxColorAttachments; i++) {
@@ -663,6 +665,7 @@ st_validate_framebuffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
  att,
  PIPE_BIND_RENDER_TARGET)) {
 fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+st_fbo_invalid("Invalid color attachment");
 return;
   }
 

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


Mesa (master): freedreno: update generated headers

2016-04-25 Thread Rob Clark
Module: Mesa
Branch: master
Commit: 7add166a5cc6cf080d00ff2334c5ba361d40568b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7add166a5cc6cf080d00ff2334c5ba361d40568b

Author: Rob Clark 
Date:   Mon Apr 25 15:36:55 2016 -0400

freedreno: update generated headers

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/freedreno/a2xx/a2xx.xml.h | 2 +-
 src/gallium/drivers/freedreno/a3xx/a3xx.xml.h | 2 +-
 src/gallium/drivers/freedreno/a4xx/a4xx.xml.h | 5 -
 src/gallium/drivers/freedreno/adreno_common.xml.h | 2 +-
 src/gallium/drivers/freedreno/adreno_pm4.xml.h| 2 +-
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a2xx/a2xx.xml.h 
b/src/gallium/drivers/freedreno/a2xx/a2xx.xml.h
index c4b58b1..16c2bd3 100644
--- a/src/gallium/drivers/freedreno/a2xx/a2xx.xml.h
+++ b/src/gallium/drivers/freedreno/a2xx/a2xx.xml.h
@@ -14,7 +14,7 @@ The rules-ng-ng source files this header was generated from 
are:
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  
11518 bytes, from 2016-02-10 21:03:25)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml(  
16185 bytes, from 2016-03-05 03:08:05)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml  (  
83967 bytes, from 2016-02-10 17:07:21)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml  ( 
110558 bytes, from 2016-04-22 18:36:21)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml  ( 
110685 bytes, from 2016-04-25 17:56:43)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml (   
1773 bytes, from 2015-09-24 17:30:00)
 
 Copyright (C) 2013-2015 by the following authors:
diff --git a/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h 
b/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h
index 3be22fe..dcb6dfb 100644
--- a/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h
+++ b/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h
@@ -14,7 +14,7 @@ The rules-ng-ng source files this header was generated from 
are:
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  
11518 bytes, from 2016-02-10 21:03:25)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml(  
16185 bytes, from 2016-03-05 03:08:05)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml  (  
83967 bytes, from 2016-02-10 17:07:21)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml  ( 
110558 bytes, from 2016-04-22 18:36:21)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml  ( 
110685 bytes, from 2016-04-25 17:56:43)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml (   
1773 bytes, from 2015-09-24 17:30:00)
 
 Copyright (C) 2013-2016 by the following authors:
diff --git a/src/gallium/drivers/freedreno/a4xx/a4xx.xml.h 
b/src/gallium/drivers/freedreno/a4xx/a4xx.xml.h
index e8dd413..d9a7bb5 100644
--- a/src/gallium/drivers/freedreno/a4xx/a4xx.xml.h
+++ b/src/gallium/drivers/freedreno/a4xx/a4xx.xml.h
@@ -14,7 +14,7 @@ The rules-ng-ng source files this header was generated from 
are:
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  
11518 bytes, from 2016-02-10 21:03:25)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml(  
16185 bytes, from 2016-03-05 03:08:05)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml  (  
83967 bytes, from 2016-02-10 17:07:21)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml  ( 
110558 bytes, from 2016-04-22 18:36:21)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml  ( 
110685 bytes, from 2016-04-25 17:56:43)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml (   
1773 bytes, from 2015-09-24 17:30:00)
 
 Copyright (C) 2013-2016 by the following authors:
@@ -46,6 +46,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 enum a4xx_color_fmt {
RB4_A8_UNORM = 1,
RB4_R8_UNORM = 2,
+   RB4_R8_SNORM = 3,
+   RB4_R8_UINT = 4,
+   RB4_R8_SINT = 5,
RB4_R4G4B4A4_UNORM = 8,
RB4_R5G5B5A1_UNORM = 10,
RB4_R5G6B5_UNORM = 14,
diff --git a/src/gallium/drivers/freedreno/adreno_common.xml.h 
b/src/gallium/drivers/freedreno/adreno_common.xml.h
index ef206dc..1f18fc6 100644
--- a/src/gallium/drivers/freedreno/adreno_common.xml.h
+++ b/src/gallium/drivers/freedreno/adreno_common.xml.h
@@ -14,7 +14,7 @@ The rules-ng-ng source files this header was generated from 
are:
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  
11518 bytes, from 2016-02-10 21:03:25)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml(  
16185 bytes, from 2016-03-05 03:08:05)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml  (  
83967 bytes, from 2016-02-10 17:07:21)
-- 

Mesa (master): freedreno: disallow cat4 immed src

2016-04-25 Thread Rob Clark
Module: Mesa
Branch: master
Commit: dfd23abdcce7fb01da842d2fc69d54a04ecdfee2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dfd23abdcce7fb01da842d2fc69d54a04ecdfee2

Author: Rob Clark 
Date:   Mon Apr 25 08:24:43 2016 -0400

freedreno: disallow cat4 immed src

Normally this would never happen (constant-propagation in NIR would
eliminate the instruction), except it does happen for 'undef' which
we turn into immed 0.0 for bookkeeping purposes.

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/freedreno/ir3/ir3_cp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cp.c 
b/src/gallium/drivers/freedreno/ir3/ir3_cp.c
index e8a2f09..cec26fa 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cp.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cp.c
@@ -176,7 +176,7 @@ static bool valid_flags(struct ir3_instruction *instr, 
unsigned n,
case 4:
/* seems like blob compiler avoids const as src.. */
/* TODO double check if this is still the case on a4xx */
-   if (flags & IR3_REG_CONST)
+   if (flags & (IR3_REG_CONST | IR3_REG_IMMED))
return false;
if (flags & (IR3_REG_SABS | IR3_REG_SNEG))
return false;

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


Mesa (master): freedreno/a4xx: add render-target formats

2016-04-25 Thread Rob Clark
Module: Mesa
Branch: master
Commit: 76c6cdd36ae2633688ffa292c1d5cdc38a8f2733
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=76c6cdd36ae2633688ffa292c1d5cdc38a8f2733

Author: Rob Clark 
Date:   Mon Apr 25 15:38:18 2016 -0400

freedreno/a4xx: add render-target formats

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/freedreno/a4xx/fd4_format.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_format.c 
b/src/gallium/drivers/freedreno/a4xx/fd4_format.c
index bd7e285..fa5efc0 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_format.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_format.c
@@ -79,9 +79,9 @@ struct fd4_format {
 static struct fd4_format formats[PIPE_FORMAT_COUNT] = {
/* 8-bit */
VT(R8_UNORM,   8_UNORM, R8_UNORM, WZYX),
-   VT(R8_SNORM,   8_SNORM, NONE, WZYX),
-   VT(R8_UINT,8_UINT,  NONE, WZYX),
-   VT(R8_SINT,8_SINT,  NONE, WZYX),
+   VT(R8_SNORM,   8_SNORM, R8_SNORM, WZYX),
+   VT(R8_UINT,8_UINT,  R8_UINT,  WZYX),
+   VT(R8_SINT,8_SINT,  R8_SINT,  WZYX),
V_(R8_USCALED, 8_UINT,  NONE, WZYX),
V_(R8_SSCALED, 8_UINT,  NONE, WZYX),
 

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


Mesa (master): freedreno/ir3: fix sin/cos

2016-04-25 Thread Rob Clark
Module: Mesa
Branch: master
Commit: 4610e5ef28e4f209617c3cabf5a2dd699e52cc33
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4610e5ef28e4f209617c3cabf5a2dd699e52cc33

Author: Rob Clark 
Date:   Sat Apr 23 09:03:28 2016 -0400

freedreno/ir3: fix sin/cos

We seem to need range reduction to get sane results.  Fixes glmark2
jellyfish bench, and a whole bunch of
dEQP-GLES3.functional.shaders.builtin_functions.precision.{sin,cos,tan}.*

v2: squashed in android build fixes from Rob Herring

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/freedreno/.gitignore  |  1 +
 src/gallium/drivers/freedreno/Android.gen.mk  | 38 +++
 src/gallium/drivers/freedreno/Android.mk  |  1 +
 src/gallium/drivers/freedreno/Makefile.am | 11 ++-
 src/gallium/drivers/freedreno/Makefile.sources|  3 ++
 src/gallium/drivers/freedreno/ir3/ir3_nir.c   |  5 +++
 src/gallium/drivers/freedreno/ir3/ir3_nir.h   |  1 +
 src/gallium/drivers/freedreno/ir3/ir3_nir_trig.py | 33 
 8 files changed, 92 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/.gitignore 
b/src/gallium/drivers/freedreno/.gitignore
index 150f5d1..174165e 100644
--- a/src/gallium/drivers/freedreno/.gitignore
+++ b/src/gallium/drivers/freedreno/.gitignore
@@ -1 +1,2 @@
 ir3_compiler
+ir3_nir_trig.c
diff --git a/src/gallium/drivers/freedreno/Android.gen.mk 
b/src/gallium/drivers/freedreno/Android.gen.mk
new file mode 100644
index 000..072cf99
--- /dev/null
+++ b/src/gallium/drivers/freedreno/Android.gen.mk
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2016 Linaro, Ltd., Rob Herring 
+#
+# 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.
+#
+
+ifeq ($(LOCAL_MODULE_CLASS),)
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+endif
+
+ir3_nir_trig_deps := \
+   $(LOCAL_PATH)/ir3/ir3_nir_trig.py \
+   $(MESA_TOP)/src/compiler/nir/nir_algebraic.py
+
+intermediates := $(call local-generated-sources-dir)
+
+$(intermediates)/ir3/ir3_nir_trig.c: $(ir3_nir_trig_deps)
+   @mkdir -p $(dir $@)
+   $(hide) PYTHONPATH=$(MESA_TOP)/src/compiler/nir $(MESA_PYTHON2) $< > $@
+
+LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
+   $(ir3_GENERATED_FILES))
diff --git a/src/gallium/drivers/freedreno/Android.mk 
b/src/gallium/drivers/freedreno/Android.mk
index d25adb4..f630dc1 100644
--- a/src/gallium/drivers/freedreno/Android.mk
+++ b/src/gallium/drivers/freedreno/Android.mk
@@ -44,5 +44,6 @@ LOCAL_SHARED_LIBRARIES := libdrm libdrm_freedreno
 LOCAL_STATIC_LIBRARIES := libmesa_glsl libmesa_nir
 LOCAL_MODULE := libmesa_pipe_freedreno
 
+include $(LOCAL_PATH)/Android.gen.mk
 include $(GALLIUM_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/drivers/freedreno/Makefile.am 
b/src/gallium/drivers/freedreno/Makefile.am
index 329a420..9c0ccdf 100644
--- a/src/gallium/drivers/freedreno/Makefile.am
+++ b/src/gallium/drivers/freedreno/Makefile.am
@@ -5,9 +5,14 @@ AM_CFLAGS = \
-Wno-packed-bitfield-compat \
-I$(top_srcdir)/src/gallium/drivers/freedreno/ir3 \
-I$(top_builddir)/src/compiler/nir \
+   -I$(top_srcdir)/src/compiler/nir \
$(GALLIUM_DRIVER_CFLAGS) \
$(FREEDRENO_CFLAGS)
 
+ir3/ir3_nir_trig.c: ir3/ir3_nir_trig.py 
$(top_srcdir)/src/compiler/nir/nir_algebraic.py
+   $(MKDIR_GEN)
+   $(AM_V_GEN) PYTHONPATH=$(top_srcdir)/src/compiler/nir $(PYTHON2) 
$(PYTHON_FLAGS) $(srcdir)/ir3/ir3_nir_trig.py > $@ || ($(RM) $@; false)
+
 noinst_LTLIBRARIES = libfreedreno.la
 
 libfreedreno_la_SOURCES = \
@@ -15,7 +20,11 @@ libfreedreno_la_SOURCES = \
$(a2xx_SOURCES) \
$(a3xx_SOURCES) \
$(a4xx_SOURCES) \
-   $(ir3_SOURCES)
+   $(ir3_SOURCES) \
+   $(ir3_GENERATED_FILES)
+
+BUILT_SOURCES := $(ir3_GENERATED_FILES)
+CLEANFILES := $(BUILT_SOURCES)
 
 noinst_PROGRAMS = ir3_compiler
 
diff --git 

Mesa (master): freedreno: reduce line width for deqp further

2016-04-25 Thread Rob Clark
Module: Mesa
Branch: master
Commit: edcc6ce75d0efbc718dd6e6575ab7a4cf47db4f4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=edcc6ce75d0efbc718dd6e6575ab7a4cf47db4f4

Author: Rob Clark 
Date:   Mon Apr 25 14:22:45 2016 -0400

freedreno: reduce line width for deqp further

See a7eb12d0.. but that wasn't restrictive enough.  Fixes
dEQP-GLES3.functional.rasterization.primitives.line_strip_wide, and
similar

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/freedreno/freedreno_screen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c
index 0510018..4ae1389 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -362,7 +362,7 @@ fd_screen_get_paramf(struct pipe_screen *pscreen, enum 
pipe_capf param)
 * See: 
https://code.google.com/p/android/issues/detail?id=206513
 */
if (fd_mesa_debug & FD_DBG_DEQP)
-   return 63.0f;
+   return 48.0f;
return 127.0f;
case PIPE_CAPF_MAX_POINT_WIDTH:
case PIPE_CAPF_MAX_POINT_WIDTH_AA:

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


Mesa (master): freedreno: honor handle->offset

2016-04-25 Thread Rob Clark
Module: Mesa
Branch: master
Commit: 2c8674f5a90f236b9e07b759d49911d79921bc78
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c8674f5a90f236b9e07b759d49911d79921bc78

Author: Rob Clark 
Date:   Mon Apr 25 11:47:21 2016 -0400

freedreno: honor handle->offset

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/freedreno/freedreno_resource.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c 
b/src/gallium/drivers/freedreno/freedreno_resource.c
index 9aded3b..99affc4 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -43,6 +43,8 @@
 
 #include 
 
+/* XXX this should go away, needed for 'struct winsys_handle' */
+#include "state_tracker/drm_driver.h"
 
 static bool
 pending(struct fd_resource *rsc, enum fd_resource_status status)
@@ -637,8 +639,7 @@ fail:
 static struct pipe_resource *
 fd_resource_from_handle(struct pipe_screen *pscreen,
const struct pipe_resource *tmpl,
-   struct winsys_handle *handle,
-unsigned usage)
+   struct winsys_handle *handle, unsigned usage)
 {
struct fd_resource *rsc = CALLOC_STRUCT(fd_resource);
struct fd_resource_slice *slice = >slices[0];
@@ -669,6 +670,7 @@ fd_resource_from_handle(struct pipe_screen *pscreen,
rsc->base.vtbl = _resource_vtbl;
rsc->cpp = util_format_get_blocksize(tmpl->format);
slice->pitch /= rsc->cpp;
+   slice->offset = handle->offset;
 
assert(rsc->cpp);
 

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


Mesa (master): i965: Unroll SIMD16 DDY_FINE on Sandybridge.

2016-04-25 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 21b4bcdd05eabe94feb1a17bbb96f55d26eabe6e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=21b4bcdd05eabe94feb1a17bbb96f55d26eabe6e

Author: Kenneth Graunke 
Date:   Tue Mar 29 01:32:52 2016 -0700

i965: Unroll SIMD16 DDY_FINE on Sandybridge.

This fixes 10 dEQP-GLES3 subtests:
dEQP-GLES3.functional.shaders.derivate.dfdy.texture.float_nicest.*.

Matt noticed that our Piglit tests for this use even numbered registers,
while the failing dEQP tests use odd numbered registers.  We believe
that it works for even numbered registers, but not otherwise.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Matt Turner 

---

 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index fb9f65c..812a75e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1138,12 +1138,16 @@ fs_generator::generate_ddy(enum opcode opcode,
*
* Similar text exists in the g45 PRM.
*
+   * Empirically, compressed align16 instructions using odd register
+   * numbers don't appear to work on Sandybridge either.
+   *
* On these platforms, if we're building a SIMD16 shader, we need to
* manually unroll to a pair of SIMD8 instructions.
*/
   bool unroll_to_simd8 =
  (dispatch_width == 16 &&
-  (devinfo->gen == 4 || (devinfo->gen == 7 && !devinfo->is_haswell)));
+  (devinfo->gen == 4 || devinfo->gen == 6 ||
+   (devinfo->gen == 7 && !devinfo->is_haswell)));
 
   /* produce accurate derivatives */
   struct brw_reg src0 = brw_reg(src.file, src.nr, 0,

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


Mesa (master): docs: update the instructions for getting a git account

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e915903c10fed378ad6bdb4b3850e8fe8515158d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e915903c10fed378ad6bdb4b3850e8fe8515158d

Author: Brian Paul 
Date:   Mon Apr 25 10:13:32 2016 -0600

docs: update the instructions for getting a git account

Reviewed-by: Matt Turner 

---

 docs/repository.html | 34 ++
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/docs/repository.html b/docs/repository.html
index bb0ae00..784ae2c 100644
--- a/docs/repository.html
+++ b/docs/repository.html
@@ -68,21 +68,39 @@ To get the Mesa sources anonymously (read-only):
 Developer git Access
 
 
-Mesa developers need to first have an account on
-http://www.freedesktop.org;>freedesktop.org.
-To get an account, please ask Brian or the other Mesa developers for
-permission.
-Then, if there are no objections, follow this
-http://www.freedesktop.org/wiki/AccountRequests;>
-procedure.
+If you wish to become a Mesa developer with git-write privilege, please
+follow this procedure:
 
+
+Subscribe to the
+http://lists.freedesktop.org/mailman/listinfo/mesa-dev;>mesa-dev
+mailing list.
+Start contributing to the project by posting patches / review requests to
+the mesa-dev list.  Specifically,
+
+Use git send-mail to post your patches to mesa-dev.
+Wait for someone to review the code and give you a Reviewed-by
+statement.
+You'll have to rely on another Mesa developer to push your initial patches
+after they've been reviewed.
+
+After you've demonstrated the ability to write good code and have had
+a dozen or so patches accepted you can apply for an account.
+Occasionally, but rarely, someone may be given a git account sooner, but
+only if they're being supervised by another Mesa developer at the same
+organization and planning to work in a limited area of the code or on a
+separate branch.
+To apply for an account, follow
+http://www.freedesktop.org/wiki/AccountRequests;>these directions.
+It's also appreciated if you briefly describe what you intend to do (work
+on a particular driver, add a new extension, etc.) in the bugzilla record.
+
 
 
 Once your account is established:
 
 
 
-Install the git software on your computer if needed.
 Get an initial, local copy of the repository with:
 
 git clone git+ssh://usern...@git.freedesktop.org/git/mesa/mesa

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


Mesa (master): docs: update link to Intel's graphics website

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: ef3f00edd8433a0031b6392dfa41c3d30bde7279
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef3f00edd8433a0031b6392dfa41c3d30bde7279

Author: Brian Paul 
Date:   Mon Apr 25 13:28:56 2016 -0600

docs: update link to Intel's graphics website

Reviewed-by: Matt Turner 

---

 docs/systems.html | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/docs/systems.html b/docs/systems.html
index f847928..1286387 100644
--- a/docs/systems.html
+++ b/docs/systems.html
@@ -34,8 +34,7 @@ Hardware drivers include:
 
 
   Intel i965, i945, i915.
-See http://intellinuxgraphics.org/index.html;>
-  Intel's website
+See https://01.org/linuxgraphics;>Intel's website
   AMD Radeon series.
   See http://www.x.org/wiki/RadeonFeature;>RadeonFeature
   NVIDIA GPUs.

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


Mesa (master): svga: whitespace and formatting fixes in svga_pipe_depthstencil.c

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 25e0d3659fcd3f842535750a7a4f6440bee850bb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=25e0d3659fcd3f842535750a7a4f6440bee850bb

Author: Brian Paul 
Date:   Fri Apr 15 15:57:55 2016 -0600

svga: whitespace and formatting fixes in svga_pipe_depthstencil.c

---

 src/gallium/drivers/svga/svga_pipe_depthstencil.c | 28 +++
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_depthstencil.c 
b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
index 9ebb5d4..fb7b556 100644
--- a/src/gallium/drivers/svga/svga_pipe_depthstencil.c
+++ b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
@@ -132,7 +132,7 @@ svga_create_depth_stencil_state(struct pipe_context *pipe,
const struct pipe_depth_stencil_alpha_state 
*templ)
 {
struct svga_context *svga = svga_context(pipe);
-   struct svga_depth_stencil_state *ds = CALLOC_STRUCT( 
svga_depth_stencil_state );
+   struct svga_depth_stencil_state *ds = 
CALLOC_STRUCT(svga_depth_stencil_state);
 
if (!ds)
   return NULL;
@@ -147,7 +147,7 @@ svga_create_depth_stencil_state(struct pipe_context *pipe,
   ds->stencil[0].fail  = 
svga_translate_stencil_op(templ->stencil[0].fail_op);
   ds->stencil[0].zfail = 
svga_translate_stencil_op(templ->stencil[0].zfail_op);
   ds->stencil[0].pass  = 
svga_translate_stencil_op(templ->stencil[0].zpass_op);
-  
+
   /* SVGA3D has one ref/mask/writemask triple shared between front &
* back face stencil.  We really need two:
*/
@@ -161,7 +161,6 @@ svga_create_depth_stencil_state(struct pipe_context *pipe,
   ds->stencil[0].pass = SVGA3D_STENCILOP_KEEP;
}
 
-
ds->stencil[1].enabled = templ->stencil[1].enabled;
if (templ->stencil[1].enabled) {
   assert(templ->stencil[0].enabled);
@@ -210,8 +209,9 @@ svga_create_depth_stencil_state(struct pipe_context *pipe,
return ds;
 }
 
-static void svga_bind_depth_stencil_state(struct pipe_context *pipe,
-  void *depth_stencil)
+
+static void
+svga_bind_depth_stencil_state(struct pipe_context *pipe, void *depth_stencil)
 {
struct svga_context *svga = svga_context(pipe);
 
@@ -224,8 +224,9 @@ static void svga_bind_depth_stencil_state(struct 
pipe_context *pipe,
svga->dirty |= SVGA_NEW_DEPTH_STENCIL_ALPHA;
 }
 
-static void svga_delete_depth_stencil_state(struct pipe_context *pipe,
-void *depth_stencil)
+
+static void
+svga_delete_depth_stencil_state(struct pipe_context *pipe, void *depth_stencil)
 {
struct svga_context *svga = svga_context(pipe);
struct svga_depth_stencil_state *ds =
@@ -257,8 +258,9 @@ static void svga_delete_depth_stencil_state(struct 
pipe_context *pipe,
 }
 
 
-static void svga_set_stencil_ref( struct pipe_context *pipe,
-  const struct pipe_stencil_ref *stencil_ref )
+static void
+svga_set_stencil_ref(struct pipe_context *pipe,
+ const struct pipe_stencil_ref *stencil_ref)
 {
struct svga_context *svga = svga_context(pipe);
 
@@ -272,6 +274,7 @@ static void svga_set_stencil_ref( struct pipe_context *pipe,
svga->dirty |= SVGA_NEW_STENCIL_REF;
 }
 
+
 static void
 svga_set_sample_mask(struct pipe_context *pipe,
  unsigned sample_mask)
@@ -284,7 +287,8 @@ svga_set_sample_mask(struct pipe_context *pipe,
 }
 
 
-void svga_init_depth_stencil_functions( struct svga_context *svga )
+void
+svga_init_depth_stencil_functions(struct svga_context *svga)
 {
svga->pipe.create_depth_stencil_alpha_state = 
svga_create_depth_stencil_state;
svga->pipe.bind_depth_stencil_alpha_state = svga_bind_depth_stencil_state;
@@ -293,7 +297,3 @@ void svga_init_depth_stencil_functions( struct svga_context 
*svga )
svga->pipe.set_stencil_ref = svga_set_stencil_ref;
svga->pipe.set_sample_mask = svga_set_sample_mask;
 }
-
-
-
-

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


Mesa (master): mesa/gles: Allow format GL_RED to be used with MESA_FORMAT_R_UNORM

2016-04-25 Thread Jordan Justen
Module: Mesa
Branch: master
Commit: 50b82ecd772ff8f59974618f852fedf98bbe77a6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=50b82ecd772ff8f59974618f852fedf98bbe77a6

Author: Jordan Justen 
Date:   Sun Apr 24 19:38:03 2016 -0700

mesa/gles: Allow format GL_RED to be used with MESA_FORMAT_R_UNORM

If the bound framebuffer has a format of MESA_FORMAT_R_UNORM, then
IMPLEMENTATION_COLOR_READ_FORMAT will return GL_RED. This change
applies to OpenGLES contexts where additional restrictions are placed
on the formats that are allowed to be supported.

Fixes OpenGLES 3.1 CTS tests:
 * ES31-CTS.texture_border_clamp.sampling_texture.Texture2DDC16
 * ES31-CTS.texture_border_clamp.sampling_texture.Texture2DDC16Linear
 * ES31-CTS.texture_border_clamp.sampling_texture.Texture2DDC32F
 * ES31-CTS.texture_border_clamp.sampling_texture.Texture2DDC32FLinear

Signed-off-by: Jordan Justen 
Reviewed-by: Kenneth Graunke 

---

 src/mesa/main/framebuffer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index f69dc6c..38bd680 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -858,6 +858,8 @@ _mesa_get_color_read_format(struct gl_context *ctx)
  return GL_BGRA;
   else if (format == MESA_FORMAT_B5G6R5_UNORM)
  return GL_BGR;
+  else if (format == MESA_FORMAT_R_UNORM8)
+ return GL_RED;
 
   switch (data_type) {
   case GL_UNSIGNED_INT:

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


Mesa (master): svga: whitespace and formatting fixes in svga_pipe_rasterizer.c

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 77e4b41671ecd7bde3a151627d4548106fc5be3c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77e4b41671ecd7bde3a151627d4548106fc5be3c

Author: Brian Paul 
Date:   Fri Apr 15 15:58:05 2016 -0600

svga: whitespace and formatting fixes in svga_pipe_rasterizer.c

---

 src/gallium/drivers/svga/svga_pipe_rasterizer.c | 29 +++--
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c 
b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
index 968770c..b01b04c 100644
--- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c
+++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
@@ -38,8 +38,8 @@
 
 /* Hardware frontwinding is always set up as SVGA3D_FRONTWINDING_CW.
  */
-static SVGA3dFace svga_translate_cullmode( unsigned mode,
-   unsigned front_ccw )
+static SVGA3dFace
+svga_translate_cullmode(unsigned mode, unsigned front_ccw)
 {
const int hw_front_ccw = 0;  /* hardware is always CW */
switch (mode) {
@@ -57,7 +57,8 @@ static SVGA3dFace svga_translate_cullmode( unsigned mode,
}
 }
 
-static SVGA3dShadeMode svga_translate_flatshade( unsigned mode )
+static SVGA3dShadeMode
+svga_translate_flatshade(unsigned mode)
 {
return mode ? SVGA3D_SHADEMODE_FLAT : SVGA3D_SHADEMODE_SMOOTH;
 }
@@ -158,7 +159,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
  const struct pipe_rasterizer_state *templ)
 {
struct svga_context *svga = svga_context(pipe);
-   struct svga_rasterizer_state *rast = CALLOC_STRUCT( svga_rasterizer_state );
+   struct svga_rasterizer_state *rast = CALLOC_STRUCT(svga_rasterizer_state);
struct svga_screen *screen = svga_screen(pipe->screen);
 
if (!rast)
@@ -179,9 +180,8 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
/* line_width - draw module */
/* fill_cw, fill_ccw  - draw module or index translation */
 
-   rast->shademode = svga_translate_flatshade( templ->flatshade );
-   rast->cullmode = svga_translate_cullmode( templ->cull_face, 
- templ->front_ccw );
+   rast->shademode = svga_translate_flatshade(templ->flatshade);
+   rast->cullmode = svga_translate_cullmode(templ->cull_face, 
templ->front_ccw);
rast->scissortestenable = templ->scissor;
rast->multisampleantialias = templ->multisample;
rast->antialiasedlineenable = templ->line_smooth;
@@ -365,8 +365,9 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
return rast;
 }
 
-static void svga_bind_rasterizer_state( struct pipe_context *pipe,
-void *state )
+
+static void
+svga_bind_rasterizer_state(struct pipe_context *pipe, void *state)
 {
struct svga_context *svga = svga_context(pipe);
struct svga_rasterizer_state *raster = (struct svga_rasterizer_state 
*)state;
@@ -383,6 +384,7 @@ static void svga_bind_rasterizer_state( struct pipe_context 
*pipe,
svga->dirty |= SVGA_NEW_RAST;
 }
 
+
 static void
 svga_delete_rasterizer_state(struct pipe_context *pipe, void *state)
 {
@@ -409,15 +411,10 @@ svga_delete_rasterizer_state(struct pipe_context *pipe, 
void *state)
 }
 
 
-void svga_init_rasterizer_functions( struct svga_context *svga )
+void
+svga_init_rasterizer_functions(struct svga_context *svga)
 {
svga->pipe.create_rasterizer_state = svga_create_rasterizer_state;
svga->pipe.bind_rasterizer_state = svga_bind_rasterizer_state;
svga->pipe.delete_rasterizer_state = svga_delete_rasterizer_state;
 }
-
-
-/***
- * Hardware state update
- */
-

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


Mesa (master): svga: whitespace and formatting fixes in svga_pipe_sampler.c

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 595fbc8dee00399db66f7b468b64d6f3b39601ba
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=595fbc8dee00399db66f7b468b64d6f3b39601ba

Author: Brian Paul 
Date:   Fri Apr 15 15:54:15 2016 -0600

svga: whitespace and formatting fixes in svga_pipe_sampler.c

---

 src/gallium/drivers/svga/svga_pipe_sampler.c | 64 ++--
 1 file changed, 33 insertions(+), 31 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c 
b/src/gallium/drivers/svga/svga_pipe_sampler.c
index f1bb82a..52c8a81 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -43,52 +43,55 @@ static inline unsigned
 translate_wrap_mode(unsigned wrap)
 {
switch (wrap) {
-   case PIPE_TEX_WRAP_REPEAT: 
+   case PIPE_TEX_WRAP_REPEAT:
   return SVGA3D_TEX_ADDRESS_WRAP;
-
-   case PIPE_TEX_WRAP_CLAMP: 
+   case PIPE_TEX_WRAP_CLAMP:
   return SVGA3D_TEX_ADDRESS_CLAMP;
-
-   case PIPE_TEX_WRAP_CLAMP_TO_EDGE: 
+   case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
   /* Unfortunately SVGA3D_TEX_ADDRESS_EDGE not respected by
* hardware.
*/
   return SVGA3D_TEX_ADDRESS_CLAMP;
-
-   case PIPE_TEX_WRAP_CLAMP_TO_BORDER: 
+   case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
   return SVGA3D_TEX_ADDRESS_BORDER;
-
-   case PIPE_TEX_WRAP_MIRROR_REPEAT: 
+   case PIPE_TEX_WRAP_MIRROR_REPEAT:
   return SVGA3D_TEX_ADDRESS_MIRROR;
-
-   case PIPE_TEX_WRAP_MIRROR_CLAMP:  
-   case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:   
-   case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: 
+   case PIPE_TEX_WRAP_MIRROR_CLAMP:
+   case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
+   case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
   return SVGA3D_TEX_ADDRESS_MIRRORONCE;
-
default:
   assert(0);
   return SVGA3D_TEX_ADDRESS_WRAP;
}
 }
 
-static inline unsigned translate_img_filter( unsigned filter )
+
+static inline unsigned
+translate_img_filter(unsigned filter)
 {
switch (filter) {
-   case PIPE_TEX_FILTER_NEAREST: return SVGA3D_TEX_FILTER_NEAREST;
-   case PIPE_TEX_FILTER_LINEAR:  return SVGA3D_TEX_FILTER_LINEAR;
+   case PIPE_TEX_FILTER_NEAREST:
+  return SVGA3D_TEX_FILTER_NEAREST;
+   case PIPE_TEX_FILTER_LINEAR:
+  return SVGA3D_TEX_FILTER_LINEAR;
default:
   assert(0);
   return SVGA3D_TEX_FILTER_NEAREST;
}
 }
 
-static inline unsigned translate_mip_filter( unsigned filter )
+
+static inline unsigned
+translate_mip_filter(unsigned filter)
 {
switch (filter) {
-   case PIPE_TEX_MIPFILTER_NONE:return SVGA3D_TEX_FILTER_NONE;
-   case PIPE_TEX_MIPFILTER_NEAREST: return SVGA3D_TEX_FILTER_NEAREST;
-   case PIPE_TEX_MIPFILTER_LINEAR:  return SVGA3D_TEX_FILTER_LINEAR;
+   case PIPE_TEX_MIPFILTER_NONE:
+  return SVGA3D_TEX_FILTER_NONE;
+   case PIPE_TEX_MIPFILTER_NEAREST:
+  return SVGA3D_TEX_FILTER_NEAREST;
+   case PIPE_TEX_MIPFILTER_LINEAR:
+  return SVGA3D_TEX_FILTER_LINEAR;
default:
   assert(0);
   return SVGA3D_TEX_FILTER_NONE;
@@ -221,7 +224,7 @@ svga_create_sampler_state(struct pipe_context *pipe,
 {
struct svga_context *svga = svga_context(pipe);
struct svga_sampler_state *cso = CALLOC_STRUCT( svga_sampler_state );
-   
+
if (!cso)
   return NULL;
 
@@ -229,7 +232,7 @@ svga_create_sampler_state(struct pipe_context *pipe,
cso->magfilter = translate_img_filter( sampler->mag_img_filter );
cso->minfilter = translate_img_filter( sampler->min_img_filter );
cso->aniso_level = MAX2( sampler->max_anisotropy, 1 );
-   if(sampler->max_anisotropy)
+   if (sampler->max_anisotropy)
   cso->magfilter = cso->minfilter = SVGA3D_TEX_FILTER_ANISOTROPIC;
cso->lod_bias = sampler->lod_bias;
cso->addressu = translate_wrap_mode(sampler->wrap_s);
@@ -278,6 +281,7 @@ svga_create_sampler_state(struct pipe_context *pipe,
return cso;
 }
 
+
 static void
 svga_bind_sampler_states(struct pipe_context *pipe,
  unsigned shader,
@@ -318,8 +322,8 @@ svga_bind_sampler_states(struct pipe_context *pipe,
 }
 
 
-static void svga_delete_sampler_state(struct pipe_context *pipe,
-  void *sampler)
+static void
+svga_delete_sampler_state(struct pipe_context *pipe, void *sampler)
 {
struct svga_sampler_state *ss = (struct svga_sampler_state *) sampler;
struct svga_context *svga = svga_context(pipe);
@@ -406,6 +410,7 @@ svga_sampler_view_destroy(struct pipe_context *pipe,
svga->hud.num_samplerview_objects--;
 }
 
+
 static void
 svga_set_sampler_views(struct pipe_context *pipe,
unsigned shader,
@@ -463,8 +468,7 @@ svga_set_sampler_views(struct pipe_context *pipe,
svga->dirty |= SVGA_NEW_TEXTURE_BINDING;
 
if (flag_srgb != svga->curr.tex_flags.flag_srgb ||
-   flag_1d != svga->curr.tex_flags.flag_1d) 
-   {
+   flag_1d != svga->curr.tex_flags.flag_1d) {
   svga->dirty |= SVGA_NEW_TEXTURE_FLAGS;
   svga->curr.tex_flags.flag_1d = flag_1d;
   

Mesa (master): svga: mark the texture dirty for write transfer map only

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 686cd3c606536cff3fe6d80f8ebeeca7afa1b37e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=686cd3c606536cff3fe6d80f8ebeeca7afa1b37e

Author: Charmaine Lee 
Date:   Thu Apr 21 08:28:26 2016 -0700

svga: mark the texture dirty for write transfer map only

Instead of unconditionally mark the texture subresource dirty at transfer map,
we'll set the dirty bit for write transfer only.

Tested with lightsmark2008 and glretrace.

Reviewed-by: Brian Paul 

---

 src/gallium/drivers/svga/svga_resource_texture.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_resource_texture.c 
b/src/gallium/drivers/svga/svga_resource_texture.c
index ae51228..f176647 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -485,8 +485,10 @@ svga_texture_transfer_map(struct pipe_context *pipe,
 }
 }
   }
-  /* mark this texture level as dirty */
-  svga_set_texture_dirty(tex, st->slice, transfer->level);
+  if (transfer->usage & PIPE_TRANSFER_WRITE) {
+ /* mark this texture level as dirty */
+ svga_set_texture_dirty(tex, st->slice, transfer->level);
+  }
}
 
st->use_direct_map = use_direct_map;

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


Mesa (master): util/cache: add comments, fix formatting

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1e990978eefd8d2d146b5acda6c326c580bfd116
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e990978eefd8d2d146b5acda6c326c580bfd116

Author: Brian Paul 
Date:   Thu Apr 14 17:23:30 2016 -0600

util/cache: add comments, fix formatting

---

 src/gallium/auxiliary/util/u_cache.c | 40 +++-
 1 file changed, 35 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_cache.c 
b/src/gallium/auxiliary/util/u_cache.c
index acc82ba..c748cb9 100644
--- a/src/gallium/auxiliary/util/u_cache.c
+++ b/src/gallium/auxiliary/util/u_cache.c
@@ -73,19 +73,29 @@ struct util_cache
/** Destroy a (key, value) pair */
void (*destroy)(void *key, void *value);
 
+   /** Max entries in the cache */
uint32_t size;

+   /** Array [size] of entries */
struct util_cache_entry *entries;

+   /** Number of entries in the cache */
unsigned count;
+
+   /** Head of list, sorted from Least-recently used to Most-recently used */
struct util_cache_entry lru;
 };
 
+
 static void
 ensure_sanity(const struct util_cache *cache);
 
 #define CACHE_DEFAULT_ALPHA 2
 
+/**
+ * Create a new cache with 'size' entries.  Also provide functions for
+ * hashing keys, comparing keys and destroying (key,value) pairs.
+ */
 struct util_cache *
 util_cache_create(uint32_t (*hash)(const void *key),
   int (*compare)(const void *key1, const void *key2),
@@ -108,7 +118,7 @@ util_cache_create(uint32_t (*hash)(const void *key),
cache->size = size;

cache->entries = CALLOC(size, sizeof(struct util_cache_entry));
-   if(!cache->entries) {
+   if (!cache->entries) {
   FREE(cache);
   return NULL;
}
@@ -118,6 +128,9 @@ util_cache_create(uint32_t (*hash)(const void *key),
 }
 
 
+/**
+ * Try to find a cache entry, given the key and hash of the key.
+ */
 static struct util_cache_entry *
 util_cache_entry_get(struct util_cache *cache,
  uint32_t hash,
@@ -169,7 +182,7 @@ util_cache_entry_destroy(struct util_cache *cache,
   remove_from_list(entry);
   cache->count--;
 
-  if(cache->destroy)
+  if (cache->destroy)
  cache->destroy(key, value);
 
   entry->state = DELETED;
@@ -177,6 +190,9 @@ util_cache_entry_destroy(struct util_cache *cache,
 }
 
 
+/**
+ * Insert an entry in the cache, given the key and value.
+ */
 void
 util_cache_set(struct util_cache *cache,
void *key,
@@ -213,6 +229,10 @@ util_cache_set(struct util_cache *cache,
 }
 
 
+/**
+ * Search the cache for an entry with the given key.  Return the corresponding
+ * value or NULL if not found.
+ */
 void *
 util_cache_get(struct util_cache *cache, 
const void *key)
@@ -235,6 +255,10 @@ util_cache_get(struct util_cache *cache,
 }
 
 
+/**
+ * Remove all entries from the cache.  The 'destroy' function will be called
+ * for each entry's (key, value).
+ */
 void 
 util_cache_clear(struct util_cache *cache)
 {
@@ -244,7 +268,7 @@ util_cache_clear(struct util_cache *cache)
if (!cache)
   return;
 
-   for(i = 0; i < cache->size; ++i) {
+   for (i = 0; i < cache->size; ++i) {
   util_cache_entry_destroy(cache, >entries[i]);
   cache->entries[i].state = EMPTY;
}
@@ -255,6 +279,9 @@ util_cache_clear(struct util_cache *cache)
 }
 
 
+/**
+ * Destroy the cache and all entries.
+ */
 void
 util_cache_destroy(struct util_cache *cache)
 {
@@ -263,12 +290,12 @@ util_cache_destroy(struct util_cache *cache)
   return;
 
 #ifdef DEBUG
-   if(cache->count >= 20*cache->size) {
+   if (cache->count >= 20*cache->size) {
   /* Normal approximation of the Poisson distribution */
   double mean = (double)cache->count/(double)cache->size;
   double stddev = sqrt(mean);
   unsigned i;
-  for(i = 0; i < cache->size; ++i) {
+  for (i = 0; i < cache->size; ++i) {
  double z = fabs(cache->entries[i].count - mean)/stddev;
  /* This assert should not fail 99.998027% of the times, unless 
   * the hash function is a poor one */
@@ -284,6 +311,9 @@ util_cache_destroy(struct util_cache *cache)
 }
 
 
+/**
+ * Remove the cache entry which matches the given key.
+ */
 void
 util_cache_remove(struct util_cache *cache,
   const void *key)

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


Mesa (master): glapi: fix _glapi_get_proc_address() for mangled function names

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 23949cdf2c85637448d9df0b0b4be647ac722b3a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=23949cdf2c85637448d9df0b0b4be647ac722b3a

Author: Frederic Devernay 
Date:   Mon Apr 25 10:39:43 2016 -0600

glapi: fix _glapi_get_proc_address() for mangled function names

In the dispatch table, all functions are stored without the "m" prefix.
Modify code so that OSMesaGetProcAddress works both with gl and mgl
prefixes. Similar to
https://lists.freedesktop.org/archives/mesa-dev/2015-September/095251.html

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94994
Cc: "11.1 11.2" 
Reviewed-by: Brian Paul 

---

 src/mapi/glapi/glapi_getproc.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/mapi/glapi/glapi_getproc.c b/src/mapi/glapi/glapi_getproc.c
index 524a771..8f6f0a4 100644
--- a/src/mapi/glapi/glapi_getproc.c
+++ b/src/mapi/glapi/glapi_getproc.c
@@ -62,12 +62,7 @@ get_static_proc( const char * n )
GLuint i;
for (i = 0; static_functions[i].Name_offset >= 0; i++) {
   const char *testName = gl_string_table + static_functions[i].Name_offset;
-#ifdef MANGLE
-  /* skip the prefix on the name */
-  if (strcmp(testName, n + 1) == 0)
-#else
   if (strcmp(testName, n) == 0)
-#endif
   {
 return _functions[i];
   }
@@ -516,15 +511,14 @@ _glapi_get_proc_address(const char *funcName)
 
init_glapi_relocs_once();
 
-#ifdef MANGLE
-   /* skip the prefix on the name */
-   if (funcName[1] != 'g' || funcName[2] != 'l')
-  return NULL;
-#else
-   if (funcName[0] != 'g' || funcName[1] != 'l')
-  return NULL;
+#ifdef USE_MGL_NAMESPACE
+   if (funcName && funcName[0] == 'm')
+  funcName++;
 #endif
 
+  if (!funcName || funcName[0] != 'g' || funcName[1] != 'l')
+  return NULL;
+
/* search extension functions first */
func = get_extension_proc_address(funcName);
if (func)

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


Mesa (master): svga: eliminiate unnecessary constant buffer updates

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c4cb879f00de89c300462e7b2d0f221d920c396f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c4cb879f00de89c300462e7b2d0f221d920c396f

Author: Charmaine Lee 
Date:   Fri Apr 22 16:06:32 2016 -0700

svga: eliminiate unnecessary constant buffer updates

Currently if the texture binding is changed, emit_fs_consts()
is triggered to update texture scaling factor for
rectangle texture or texture buffer size in the constant buffer.
But the update is only relevant if the texture binding includes
a rectangle texture or a texture buffer.

To eliminate the unnecessary constant buffer updates due to other texture
binding changes, a new flag SVGA_NEW_TEXTURE_CONSTS will be used
to trigger fragment shader constant buffer update when a rectangle texture
or a texture buffer is bound.

With this patch, the number of constant buffer updates in Lightsmark2008
reduces from hundreds per frame to about 28 per frame.

Reviewed-by: Brian Paul 

---

 src/gallium/drivers/svga/svga_context.h |  3 +++
 src/gallium/drivers/svga/svga_pipe_sampler.c| 20 +++-
 src/gallium/drivers/svga/svga_state_constants.c |  2 +-
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_context.h 
b/src/gallium/drivers/svga/svga_context.h
index b485485..007d5bc 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -291,6 +291,8 @@ struct svga_state
struct {
   unsigned flag_1d;
   unsigned flag_srgb;
+  unsigned flag_rect;  /* sampler views with rectangular texture target */
+  unsigned flag_buf;   /* sampler views with texture buffer target */
} tex_flags;
 
unsigned sample_mask;
@@ -586,6 +588,7 @@ struct svga_context
 #define SVGA_NEW_GS  0x1000
 #define SVGA_NEW_GS_CONST_BUFFER 0x2000
 #define SVGA_NEW_GS_VARIANT  0x4000
+#define SVGA_NEW_TEXTURE_CONSTS  0x8000
 
 
 
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c 
b/src/gallium/drivers/svga/svga_pipe_sampler.c
index 0780c95..845eebb 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -421,6 +421,8 @@ svga_set_sampler_views(struct pipe_context *pipe,
struct svga_context *svga = svga_context(pipe);
unsigned flag_1d = 0;
unsigned flag_srgb = 0;
+   unsigned flag_rect = 0;
+   unsigned flag_buf = 0;
uint i;
boolean any_change = FALSE;
 
@@ -432,6 +434,8 @@ svga_set_sampler_views(struct pipe_context *pipe,
   return;
 
for (i = 0; i < num; i++) {
+  enum pipe_texture_target target;
+
   if (svga->curr.sampler_views[shader][start + i] != views[i]) {
  /* Note: we're using pipe_sampler_view_release() here to work around
   * a possible crash when the old view belongs to another context that
@@ -449,8 +453,13 @@ svga_set_sampler_views(struct pipe_context *pipe,
   if (util_format_is_srgb(views[i]->format))
  flag_srgb |= 1 << (start + i);
 
-  if (views[i]->texture->target == PIPE_TEXTURE_1D)
+  target = views[i]->texture->target;
+  if (target == PIPE_TEXTURE_1D)
  flag_1d |= 1 << (start + i);
+  else if (target == PIPE_TEXTURE_RECT)
+ flag_rect |= 1 << (start + i);
+  else if (target == PIPE_BUFFER)
+ flag_buf |= 1 << (start + i);
}
 
if (!any_change) {
@@ -474,6 +483,15 @@ svga_set_sampler_views(struct pipe_context *pipe,
   svga->curr.tex_flags.flag_srgb = flag_srgb;
}
 
+   if (flag_rect != svga->curr.tex_flags.flag_rect ||
+   flag_buf != svga->curr.tex_flags.flag_buf)
+   {
+  /* Need to re-emit texture constants */
+  svga->dirty |= SVGA_NEW_TEXTURE_CONSTS;
+  svga->curr.tex_flags.flag_rect = flag_rect;
+  svga->curr.tex_flags.flag_buf = flag_buf;
+   }
+
/* Check if any of the sampler view resources collide with the framebuffer
 * color buffers or depth stencil resource. If so, enable the 
NEW_FRAME_BUFFER
 * dirty bit so that emit_framebuffer can be invoked to create backed view
diff --git a/src/gallium/drivers/svga/svga_state_constants.c 
b/src/gallium/drivers/svga/svga_state_constants.c
index 51f393f..8784f47 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -788,7 +788,7 @@ struct svga_tracked_state svga_hw_fs_constants =
"hw fs params",
(SVGA_NEW_FS_CONST_BUFFER |
 SVGA_NEW_FS_VARIANT |
-SVGA_NEW_TEXTURE_BINDING),
+SVGA_NEW_TEXTURE_CONSTS),
emit_fs_consts
 };
 

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


Mesa (master): svga: fix assert with PIPE_QUERY_OCCLUSION_PREDICATE for non-vgpu10

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 676931640fe6c97f6a5702196c39f8de36b22a64
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=676931640fe6c97f6a5702196c39f8de36b22a64

Author: Charmaine Lee 
Date:   Tue Apr 19 18:12:17 2016 -0700

svga: fix assert with PIPE_QUERY_OCCLUSION_PREDICATE for non-vgpu10

With this patch, when running in hardware version 11, we'll use
SVGA3D_QUERYTYPE_OCCLUSION query type for PIPE_QUERY_OCCLUSION_PREDICATE
and return TRUE if samples-passed count is greater than 0.

Fixes glretrace/solidworks2012_viewport running in hardware version 11.

Reviewed-by: Brian Paul 

---

 src/gallium/drivers/svga/svga_pipe_query.c | 43 ++
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_query.c 
b/src/gallium/drivers/svga/svga_pipe_query.c
index c7eb3f6..c1bd8ec 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -705,9 +705,13 @@ svga_create_query(struct pipe_context *pipe,
   }
   break;
case PIPE_QUERY_OCCLUSION_PREDICATE:
-  assert(svga_have_vgpu10(svga));
-  sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSIONPREDICATE;
-  define_query_vgpu10(svga, sq, 
sizeof(SVGADXOcclusionPredicateQueryResult));
+  if (svga_have_vgpu10(svga)) {
+ sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSIONPREDICATE;
+ define_query_vgpu10(svga, sq, 
sizeof(SVGADXOcclusionPredicateQueryResult));
+  } else {
+ sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSION;
+ define_query_vgpu9(svga, sq);
+  }
   break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
@@ -777,6 +781,7 @@ svga_destroy_query(struct pipe_context *pipe, struct 
pipe_query *q)
 
switch (sq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
+   case PIPE_QUERY_OCCLUSION_PREDICATE:
   if (svga_have_vgpu10(svga)) {
  /* make sure to also destroy any associated predicate query */
  if (sq->predicate)
@@ -787,11 +792,6 @@ svga_destroy_query(struct pipe_context *pipe, struct 
pipe_query *q)
   }
   sws->fence_reference(sws, >fence, NULL);
   break;
-   case PIPE_QUERY_OCCLUSION_PREDICATE:
-  assert(svga_have_vgpu10(svga));
-  destroy_query_vgpu10(svga, sq);
-  sws->fence_reference(sws, >fence, NULL);
-  break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
@@ -854,6 +854,7 @@ svga_begin_query(struct pipe_context *pipe, struct 
pipe_query *q)
 
switch (sq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
+   case PIPE_QUERY_OCCLUSION_PREDICATE:
   if (svga_have_vgpu10(svga)) {
  ret = begin_query_vgpu10(svga, sq);
  /* also need to start the associated occlusion predicate query */
@@ -869,11 +870,6 @@ svga_begin_query(struct pipe_context *pipe, struct 
pipe_query *q)
   assert(ret == PIPE_OK);
   (void) ret;
   break;
-   case PIPE_QUERY_OCCLUSION_PREDICATE:
-  assert(svga_have_vgpu10(svga));
-  ret = begin_query_vgpu10(svga, sq);
-  assert(ret == PIPE_OK);
-  break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
@@ -967,6 +963,7 @@ svga_end_query(struct pipe_context *pipe, struct pipe_query 
*q)
 
switch (sq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
+   case PIPE_QUERY_OCCLUSION_PREDICATE:
   if (svga_have_vgpu10(svga)) {
  ret = end_query_vgpu10(svga, sq);
  /* also need to end the associated occlusion predicate query */
@@ -987,11 +984,6 @@ svga_end_query(struct pipe_context *pipe, struct 
pipe_query *q)
*/
   svga_context_flush(svga, NULL);
   break;
-   case PIPE_QUERY_OCCLUSION_PREDICATE:
-  assert(svga_have_vgpu10(svga));
-  ret = end_query_vgpu10(svga, sq);
-  assert(ret == PIPE_OK);
-  break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
@@ -1090,11 +1082,16 @@ svga_get_query_result(struct pipe_context *pipe,
   }
   break;
case PIPE_QUERY_OCCLUSION_PREDICATE: {
-  SVGADXOcclusionPredicateQueryResult occResult;
-  assert(svga_have_vgpu10(svga));
-  ret = get_query_result_vgpu10(svga, sq, wait,
-(void *), sizeof(occResult));
-  vresult->b = occResult.anySamplesRendered != 0;
+  if (svga_have_vgpu10(svga)) {
+ SVGADXOcclusionPredicateQueryResult occResult;
+ ret = get_query_result_vgpu10(svga, sq, wait,
+   (void *), sizeof(occResult));
+ vresult->b = occResult.anySamplesRendered != 0;
+  } else {
+ uint64_t count;
+ ret = get_query_result_vgpu9(svga, sq, wait, (uint64_t *));
+ vresult->b = count != 0;
+  }
   break;
}
case PIPE_QUERY_SO_STATISTICS: {


Mesa (master): svga: minimize surface flush

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d7a6c1a4769774a0a86cc75090d5d3089f248a7d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7a6c1a4769774a0a86cc75090d5d3089f248a7d

Author: Charmaine Lee 
Date:   Thu Apr 14 17:33:32 2016 -0700

svga: minimize surface flush

Currently, we always do a surface flush when we try to establish
a synchronized write transfer map. But if the subresource has not
been modified, we can skip the surface flush. In other words,
we only need to do a surface flush if the to-be-mapped subresource
has been modified in this command buffer.

With this patch, lightsmark2008 shows about 15% performance improvement.

Reviewed-by: Brian Paul 

---

 src/gallium/drivers/svga/svga_resource_texture.c | 71 +++-
 src/gallium/drivers/svga/svga_resource_texture.h | 29 ++
 2 files changed, 85 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_resource_texture.c 
b/src/gallium/drivers/svga/svga_resource_texture.c
index db73080..ae51228 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -234,6 +234,7 @@ svga_texture_destroy(struct pipe_screen *screen,
 
FREE(tex->defined);
FREE(tex->rendered_to);
+   FREE(tex->dirty);
FREE(tex);
 
assert(ss->hud.num_resources > 0);
@@ -436,6 +437,13 @@ svga_texture_transfer_map(struct pipe_context *pipe,
  return NULL;
   }
 
+  /* If this is the first time mapping to the surface in this
+   * command buffer, clear the dirty masks of this surface.
+   */
+  if (sws->surface_is_flushed(sws, surf)) {
+ svga_clear_texture_dirty(tex);
+  }
+
   if (need_tex_readback(transfer)) {
 enum pipe_error ret;
 
@@ -464,13 +472,21 @@ svga_texture_transfer_map(struct pipe_context *pipe,
   else {
 assert(transfer->usage & PIPE_TRANSFER_WRITE);
 if ((transfer->usage & PIPE_TRANSFER_UNSYNCHRONIZED) == 0) {
-svga_surfaces_flush(svga);
-if (!sws->surface_is_flushed(sws, surf)) {
-   svga->hud.surface_write_flushes++;
-   svga_context_flush(svga, NULL);
+if (svga_is_texture_dirty(tex, st->slice, transfer->level)) {
+   /*
+* do a surface flush if the subresource has been modified
+* in this command buffer.
+*/
+   svga_surfaces_flush(svga);
+   if (!sws->surface_is_flushed(sws, surf)) {
+  svga->hud.surface_write_flushes++;
+  svga_context_flush(svga, NULL);
+   }
 }
 }
   }
+  /* mark this texture level as dirty */
+  svga_set_texture_dirty(tex, st->slice, transfer->level);
}
 
st->use_direct_map = use_direct_map;
@@ -756,9 +772,13 @@ svga_texture_create(struct pipe_screen *screen,
tex->rendered_to = CALLOC(template->depth0 * template->array_size,
  sizeof(tex->rendered_to[0]));
if (!tex->rendered_to) {
-  FREE(tex->defined);
-  FREE(tex);
-  return NULL;
+  goto fail;
+   }
+
+   tex->dirty = CALLOC(template->depth0 * template->array_size,
+ sizeof(tex->dirty[0]));
+   if (!tex->dirty) {
+  goto fail;
}
 
tex->b.b = *template;
@@ -872,10 +892,7 @@ svga_texture_create(struct pipe_screen *screen,
tex->key.format = svga_translate_format(svgascreen, template->format,
bindings);
if (tex->key.format == SVGA3D_FORMAT_INVALID) {
-  FREE(tex->defined);
-  FREE(tex->rendered_to);
-  FREE(tex);
-  return NULL;
+  goto fail;
}
 
/* Use typeless formats for sRGB and depth resources.  Typeless
@@ -900,10 +917,7 @@ svga_texture_create(struct pipe_screen *screen,
tex->handle = svga_screen_surface_create(svgascreen, bindings,
 tex->b.b.usage, >key);
if (!tex->handle) {
-  FREE(tex->defined);
-  FREE(tex->rendered_to);
-  FREE(tex);
-  return NULL;
+  goto fail;
}
 
SVGA_DBG(DEBUG_DMA, "  --> got sid %p (texture)\n", tex->handle);
@@ -916,6 +930,16 @@ svga_texture_create(struct pipe_screen *screen,
svgascreen->hud.num_resources++;
 
return >b.b;
+
+fail:
+   if (tex->dirty)
+  FREE(tex->dirty);
+   if (tex->rendered_to)
+  FREE(tex->rendered_to);
+   if (tex->defined)
+  FREE(tex->defined);
+   FREE(tex);
+   return NULL;
 }
 
 
@@ -993,11 +1017,28 @@ svga_texture_from_handle(struct pipe_screen *screen,
tex->handle = srf;
 
tex->rendered_to = CALLOC(1, sizeof(tex->rendered_to[0]));
+   if (!tex->rendered_to)
+  goto fail;
+
+   tex->dirty = CALLOC(1, sizeof(tex->dirty[0]));
+   if (!tex->dirty)
+  goto fail;
+
tex->imported = TRUE;
 
ss->hud.num_resources++;
 
return >b.b;
+
+fail:
+   if (tex->defined)
+  FREE(tex->defined);
+  

Mesa (master): gallium/util: initialize pipe_framebuffer_state to zeros

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1db8313168531f19b410ac55f7c724ef5d23b2c4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1db8313168531f19b410ac55f7c724ef5d23b2c4

Author: Brian Paul 
Date:   Fri Apr 15 12:14:27 2016 -0600

gallium/util: initialize pipe_framebuffer_state to zeros

To silence a valgrind uninitialized memory warning.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94955
Cc: "11.1 11.2" 
Reviewed-by: Marek Olšák 
Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/util/u_blitter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 56aebde..8d7cc96 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -1525,7 +1525,7 @@ void util_blitter_blit_generic(struct blitter_context 
*blitter,
 {
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
-   struct pipe_framebuffer_state fb_state;
+   struct pipe_framebuffer_state fb_state = {0};
enum pipe_texture_target src_target = src->texture->target;
unsigned src_samples = src->texture->nr_samples;
unsigned dst_samples = dst->texture->nr_samples;

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


Mesa (master): util/blitter: use ARRAY_SIZE macro

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 63df017fda72e0e165f622eac529c6889ae220d9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=63df017fda72e0e165f622eac529c6889ae220d9

Author: Brian Paul 
Date:   Mon Apr 25 09:38:05 2016 -0600

util/blitter: use ARRAY_SIZE macro

And remove local definition of Elements() macro.

Reviewed-by: Marek Olšák 

---

 src/gallium/auxiliary/util/u_blitter.h | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.h 
b/src/gallium/auxiliary/util/u_blitter.h
index ed4a232..32ee884 100644
--- a/src/gallium/auxiliary/util/u_blitter.h
+++ b/src/gallium/auxiliary/util/u_blitter.h
@@ -32,12 +32,6 @@
 
 #include "pipe/p_state.h"
 
-/* u_memory.h conflicts with st/mesa */
-#ifndef Elements
-#define Elements(x) (sizeof(x)/sizeof((x)[0]))
-#endif
-
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -464,7 +458,7 @@ util_blitter_save_fragment_sampler_states(
   unsigned num_sampler_states,
   void **sampler_states)
 {
-   assert(num_sampler_states <= Elements(blitter->saved_sampler_states));
+   assert(num_sampler_states <= ARRAY_SIZE(blitter->saved_sampler_states));
 
blitter->saved_num_sampler_states = num_sampler_states;
memcpy(blitter->saved_sampler_states, sampler_states,
@@ -477,7 +471,7 @@ util_blitter_save_fragment_sampler_views(struct 
blitter_context *blitter,
  struct pipe_sampler_view **views)
 {
unsigned i;
-   assert(num_views <= Elements(blitter->saved_sampler_views));
+   assert(num_views <= ARRAY_SIZE(blitter->saved_sampler_views));
 
blitter->saved_num_sampler_views = num_views;
for (i = 0; i < num_views; i++)
@@ -501,7 +495,7 @@ util_blitter_save_so_targets(struct blitter_context 
*blitter,
  struct pipe_stream_output_target **targets)
 {
unsigned i;
-   assert(num_targets <= Elements(blitter->saved_so_targets));
+   assert(num_targets <= ARRAY_SIZE(blitter->saved_so_targets));
 
blitter->saved_num_so_targets = num_targets;
for (i = 0; i < num_targets; i++)

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


Mesa (master): svga: s/Elements/ARRAY_SIZE/

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: e0184b3995fa308c125ae8e090d2bbdffd495b5f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0184b3995fa308c125ae8e090d2bbdffd495b5f

Author: Brian Paul 
Date:   Mon Apr 25 09:34:40 2016 -0600

svga: s/Elements/ARRAY_SIZE/

Standardize on the later macro rather than a mix of both.

Reviewed-by: Charmaine Lee 

---

 src/gallium/drivers/svga/svga_cmd_vgpu10.c   |  2 +-
 src/gallium/drivers/svga/svga_context.c  |  6 +++---
 src/gallium/drivers/svga/svga_format.c   | 20 ++--
 src/gallium/drivers/svga/svga_link.c |  6 +++---
 src/gallium/drivers/svga/svga_pipe_constants.c   |  2 +-
 src/gallium/drivers/svga/svga_pipe_sampler.c |  2 +-
 src/gallium/drivers/svga/svga_pipe_vs.c  |  2 +-
 src/gallium/drivers/svga/svga_resource_texture.h |  2 +-
 src/gallium/drivers/svga/svga_sampler_view.c |  2 +-
 src/gallium/drivers/svga/svga_screen.c   |  4 ++--
 src/gallium/drivers/svga/svga_shader.c   |  2 +-
 src/gallium/drivers/svga/svga_state_constants.c  |  2 +-
 src/gallium/drivers/svga/svga_state_rss.c|  4 ++--
 src/gallium/drivers/svga/svga_state_sampler.c|  2 +-
 src/gallium/drivers/svga/svga_state_tss.c| 10 +-
 src/gallium/drivers/svga/svga_swtnl_draw.c   |  4 ++--
 src/gallium/drivers/svga/svga_tgsi_decl_sm30.c   |  8 
 src/gallium/drivers/svga/svga_tgsi_insn.c| 10 +-
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c  | 20 ++--
 19 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_cmd_vgpu10.c 
b/src/gallium/drivers/svga/svga_cmd_vgpu10.c
index 99c9add..2729655 100644
--- a/src/gallium/drivers/svga/svga_cmd_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_cmd_vgpu10.c
@@ -1112,7 +1112,7 @@ SVGA3D_vgpu10_DefineStreamOutput(struct 
svga_winsys_context *swc,
cmd->soid = soid;
cmd->numOutputStreamEntries = numOutputStreamEntries;
 
-   for (i = 0; i < Elements(cmd->streamOutputStrideInBytes); i++)
+   for (i = 0; i < ARRAY_SIZE(cmd->streamOutputStrideInBytes); i++)
   cmd->streamOutputStrideInBytes[i] = streamOutputStrideInBytes[i];
 
memcpy(cmd->decl, decl,
diff --git a/src/gallium/drivers/svga/svga_context.c 
b/src/gallium/drivers/svga/svga_context.c
index 896dcdf..32dc209 100644
--- a/src/gallium/drivers/svga/svga_context.c
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -61,7 +61,7 @@ static void svga_destroy( struct pipe_context *pipe )
unsigned shader, i;
 
/* free any alternate rasterizer states used for point sprite */
-   for (i = 0; i < Elements(svga->rasterizer_no_cull); i++) {
+   for (i = 0; i < ARRAY_SIZE(svga->rasterizer_no_cull); i++) {
   if (svga->rasterizer_no_cull[i]) {
  pipe->delete_rasterizer_state(pipe, svga->rasterizer_no_cull[i]);
   }
@@ -78,7 +78,7 @@ static void svga_destroy( struct pipe_context *pipe )
pipe_resource_reference(>polygon_stipple.texture, NULL);
 
/* free HW constant buffers */
-   for (shader = 0; shader < Elements(svga->state.hw_draw.constbuf); shader++) 
{
+   for (shader = 0; shader < ARRAY_SIZE(svga->state.hw_draw.constbuf); 
shader++) {
   pipe_resource_reference(>state.hw_draw.constbuf[shader], NULL);
}
 
@@ -116,7 +116,7 @@ static void svga_destroy( struct pipe_context *pipe )
 
/* free user's constant buffers */
for (shader = 0; shader < PIPE_SHADER_TYPES; ++shader) {
-  for (i = 0; i < Elements(svga->curr.constbufs[shader]); ++i) {
+  for (i = 0; i < ARRAY_SIZE(svga->curr.constbufs[shader]); ++i) {
  pipe_resource_reference(>curr.constbufs[shader][i].buffer, 
NULL);
   }
}
diff --git a/src/gallium/drivers/svga/svga_format.c 
b/src/gallium/drivers/svga/svga_format.c
index 0186736..2fc920a 100644
--- a/src/gallium/drivers/svga/svga_format.c
+++ b/src/gallium/drivers/svga/svga_format.c
@@ -366,8 +366,8 @@ svga_translate_vertex_format_vgpu10(enum pipe_format format,
 SVGA3dSurfaceFormat *svga_format,
 unsigned *vf_flags)
 {
-   assert(format < Elements(format_conversion_table));
-   if (format >= Elements(format_conversion_table)) {
+   assert(format < ARRAY_SIZE(format_conversion_table));
+   if (format >= ARRAY_SIZE(format_conversion_table)) {
   format = PIPE_FORMAT_NONE;
}
*svga_format = format_conversion_table[format].vertex_format;
@@ -1838,13 +1838,13 @@ check_format_tables(void)
if (first_call) {
   unsigned i;
 
-  STATIC_ASSERT(Elements(format_cap_table) == SVGA3D_FORMAT_MAX);
-  for (i = 0; i < Elements(format_cap_table); i++) {
+  STATIC_ASSERT(ARRAY_SIZE(format_cap_table) == SVGA3D_FORMAT_MAX);
+  for (i = 0; i < ARRAY_SIZE(format_cap_table); i++) {
  assert(format_cap_table[i].format == i);
   }
 
-  STATIC_ASSERT(Elements(format_conversion_table) == PIPE_FORMAT_COUNT);
-  

Mesa (master): i965: Make a few tessellation related functions non-static.

2016-04-25 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 501bedffa650c7d340d8f716736f6333c1317b34
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=501bedffa650c7d340d8f716736f6333c1317b34

Author: Kenneth Graunke 
Date:   Sun Apr 10 21:28:37 2016 -0700

i965: Make a few tessellation related functions non-static.

Also, move them to brw_shader.cpp so they're in a location for code
used by both the vec4 and fs worlds.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Eduardo Lima Mitev 

---

 src/mesa/drivers/dri/i965/brw_shader.cpp   | 47 ++
 src/mesa/drivers/dri/i965/brw_shader.h |  4 +++
 src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp | 47 --
 3 files changed, 51 insertions(+), 47 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp 
b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 376cb25..b3aade1 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -582,6 +582,53 @@ brw_abs_immediate(enum brw_reg_type type, struct brw_reg 
*reg)
return false;
 }
 
+unsigned
+tesslevel_outer_components(GLenum tes_primitive_mode)
+{
+   switch (tes_primitive_mode) {
+   case GL_QUADS:
+  return 4;
+   case GL_TRIANGLES:
+  return 3;
+   case GL_ISOLINES:
+  return 2;
+   default:
+  unreachable("Bogus tessellation domain");
+   }
+   return 0;
+}
+
+unsigned
+tesslevel_inner_components(GLenum tes_primitive_mode)
+{
+   switch (tes_primitive_mode) {
+   case GL_QUADS:
+  return 2;
+   case GL_TRIANGLES:
+  return 1;
+   case GL_ISOLINES:
+  return 0;
+   default:
+  unreachable("Bogus tessellation domain");
+   }
+   return 0;
+}
+
+/**
+ * Given a normal .xyzw writemask, convert it to a writemask for a vector
+ * that's stored backwards, i.e. .wzyx.
+ */
+unsigned
+writemask_for_backwards_vector(unsigned mask)
+{
+   unsigned new_mask = 0;
+
+   for (int i = 0; i < 4; i++)
+  new_mask |= ((mask >> i) & 1) << (3 - i);
+
+   return new_mask;
+}
+
 backend_shader::backend_shader(const struct brw_compiler *compiler,
void *log_data,
void *mem_ctx,
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h 
b/src/mesa/drivers/dri/i965/brw_shader.h
index 15bed78..fc228f6 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -292,6 +292,10 @@ int type_size_scalar(const struct glsl_type *type);
 int type_size_vec4(const struct glsl_type *type);
 int type_size_vec4_times_4(const struct glsl_type *type);
 
+unsigned tesslevel_outer_components(GLenum tes_primitive_mode);
+unsigned tesslevel_inner_components(GLenum tes_primitive_mode);
+unsigned writemask_for_backwards_vector(unsigned mask);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp
index 28aaaeb..8e2713a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp
@@ -286,53 +286,6 @@ vec4_tcs_visitor::emit_urb_write(const src_reg ,
inst->base_mrf = -1;
 }
 
-static unsigned
-tesslevel_outer_components(GLenum tes_primitive_mode)
-{
-   switch (tes_primitive_mode) {
-   case GL_QUADS:
-  return 4;
-   case GL_TRIANGLES:
-  return 3;
-   case GL_ISOLINES:
-  return 2;
-   default:
-  unreachable("Bogus tessellation domain");
-   }
-   return 0;
-}
-
-static unsigned
-tesslevel_inner_components(GLenum tes_primitive_mode)
-{
-   switch (tes_primitive_mode) {
-   case GL_QUADS:
-  return 2;
-   case GL_TRIANGLES:
-  return 1;
-   case GL_ISOLINES:
-  return 0;
-   default:
-  unreachable("Bogus tessellation domain");
-   }
-   return 0;
-}
-
-/**
- * Given a normal .xyzw writemask, convert it to a writemask for a vector
- * that's stored backwards, i.e. .wzyx.
- */
-static unsigned
-writemask_for_backwards_vector(unsigned mask)
-{
-   unsigned new_mask = 0;
-
-   for (int i = 0; i < 4; i++)
-  new_mask |= ((mask >> i) & 1) << (3 - i);
-
-   return new_mask;
-}
-
 void
 vec4_tcs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
 {

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


Mesa (master): i965: Mark URB reads as volatile.

2016-04-25 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 4e2d22c5a723f8a52ede916d170f4aa9a4f96fbb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e2d22c5a723f8a52ede916d170f4aa9a4f96fbb

Author: Kenneth Graunke 
Date:   Fri Apr  8 18:49:22 2016 -0700

i965: Mark URB reads as volatile.

They can be affected by URB writes.

In the upcoming scalar TCS backend, this prevents read-modify-write
cycles from being broken by CSE removing reads.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Eduardo Lima Mitev 

---

 src/mesa/drivers/dri/i965/brw_shader.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp 
b/src/mesa/drivers/dri/i965/brw_shader.cpp
index b3aade1..d9e654c 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -961,6 +961,9 @@ backend_instruction::is_volatile() const
case SHADER_OPCODE_UNTYPED_SURFACE_READ_LOGICAL:
case SHADER_OPCODE_TYPED_SURFACE_READ:
case SHADER_OPCODE_TYPED_SURFACE_READ_LOGICAL:
+   case SHADER_OPCODE_URB_READ_SIMD8:
+   case SHADER_OPCODE_URB_READ_SIMD8_PER_SLOT:
+   case VEC4_OPCODE_URB_READ:
   return true;
default:
   return false;

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


Mesa (master): svga: separate HUD counters for state objects

2016-04-25 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 464d6080c60e6f97d286b16f5b09fde94ab37cfc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=464d6080c60e6f97d286b16f5b09fde94ab37cfc

Author: Brian Paul 
Date:   Fri Apr 15 15:30:34 2016 -0600

svga: separate HUD counters for state objects

Count depth/stencil, blend, sampler, etc. state objects separately
but just report the sum for the HUD.  This change lets us use gdb to
see the breakdown of state objects in more detail.

Also, count sampler views too.

Reviewed-by: Charmaine Lee 

---

 src/gallium/drivers/svga/svga_context.h   | 10 +-
 src/gallium/drivers/svga/svga_pipe_blend.c|  4 ++--
 src/gallium/drivers/svga/svga_pipe_depthstencil.c |  4 ++--
 src/gallium/drivers/svga/svga_pipe_query.c|  7 ++-
 src/gallium/drivers/svga/svga_pipe_rasterizer.c   |  4 ++--
 src/gallium/drivers/svga/svga_pipe_sampler.c  |  8 ++--
 src/gallium/drivers/svga/svga_pipe_vertex.c   |  4 ++--
 7 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_context.h 
b/src/gallium/drivers/svga/svga_context.h
index ead47c0..b485485 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -519,7 +519,15 @@ struct svga_context
   uint64_t num_const_buf_updates;   /**< SVGA_QUERY_NUM_CONST_BUF_UPDATES 
*/
   uint64_t num_const_updates;   /**< SVGA_QUERY_NUM_CONST_UPDATES */
   uint64_t num_shaders; /**< SVGA_QUERY_NUM_SHADERS */
-  uint64_t num_state_objects;   /**< SVGA_QUERY_NUM_STATE_OBJECTS */
+
+  /** The following are summed for SVGA_QUERY_NUM_STATE_OBJECTS */
+  uint64_t num_blend_objects;
+  uint64_t num_depthstencil_objects;
+  uint64_t num_rasterizer_objects;
+  uint64_t num_sampler_objects;
+  uint64_t num_samplerview_objects;
+  uint64_t num_vertexelement_objects;
+
   uint64_t num_surface_views;   /**< SVGA_QUERY_NUM_SURFACE_VIEWS */
   uint64_t num_bytes_uploaded;  /**< SVGA_QUERY_NUM_BYTES_UPLOADED */
   uint64_t num_generate_mipmap; /**< SVGA_QUERY_NUM_GENERATE_MIPMAP */
diff --git a/src/gallium/drivers/svga/svga_pipe_blend.c 
b/src/gallium/drivers/svga/svga_pipe_blend.c
index 0ba9313..9a4fcc3 100644
--- a/src/gallium/drivers/svga/svga_pipe_blend.c
+++ b/src/gallium/drivers/svga/svga_pipe_blend.c
@@ -333,7 +333,7 @@ svga_create_blend_state(struct pipe_context *pipe,
   define_blend_state_object(svga, blend);
}
 
-   svga->hud.num_state_objects++;
+   svga->hud.num_blend_objects++;
 
return blend;
 }
@@ -373,7 +373,7 @@ static void svga_delete_blend_state(struct pipe_context 
*pipe,
}
 
FREE(blend);
-   svga->hud.num_state_objects--;
+   svga->hud.num_blend_objects--;
 }
 
 static void svga_set_blend_color( struct pipe_context *pipe,
diff --git a/src/gallium/drivers/svga/svga_pipe_depthstencil.c 
b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
index c5d83c3..9ebb5d4 100644
--- a/src/gallium/drivers/svga/svga_pipe_depthstencil.c
+++ b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
@@ -205,7 +205,7 @@ svga_create_depth_stencil_state(struct pipe_context *pipe,
   define_depth_stencil_state_object(svga, ds);
}
 
-   svga->hud.num_state_objects++;
+   svga->hud.num_depthstencil_objects++;
 
return ds;
 }
@@ -253,7 +253,7 @@ static void svga_delete_depth_stencil_state(struct 
pipe_context *pipe,
}
 
FREE(depth_stencil);
-   svga->hud.num_state_objects--;
+   svga->hud.num_depthstencil_objects--;
 }
 
 
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c 
b/src/gallium/drivers/svga/svga_pipe_query.c
index 05b756a..c7eb3f6 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -1165,7 +1165,12 @@ svga_get_query_result(struct pipe_context *pipe,
   vresult->u64 = svgascreen->hud.num_resources;
   break;
case SVGA_QUERY_NUM_STATE_OBJECTS:
-  vresult->u64 = svga->hud.num_state_objects;
+  vresult->u64 = (svga->hud.num_blend_objects +
+  svga->hud.num_depthstencil_objects +
+  svga->hud.num_rasterizer_objects +
+  svga->hud.num_sampler_objects +
+  svga->hud.num_samplerview_objects +
+  svga->hud.num_vertexelement_objects);
   break;
case SVGA_QUERY_NUM_SURFACE_VIEWS:
   vresult->u64 = svga->hud.num_surface_views;
diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c 
b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
index d397c95..968770c 100644
--- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c
+++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
@@ -360,7 +360,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
  "GL_POLYGON_SMOOTH not supported");
}
 
-   svga->hud.num_state_objects++;
+   svga->hud.num_rasterizer_objects++;
 
return rast;
 }
@@ 

Mesa (master): isl: remove ffs function that conflicts with system headers

2016-04-25 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 3c8f9ed9b7fd4462bae66685bf2389f4802dc84e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c8f9ed9b7fd4462bae66685bf2389f4802dc84e

Author: Jonathan Gray 
Date:   Sat Apr 23 17:27:58 2016 +1000

isl: remove ffs function that conflicts with system headers

Remove a wrapper around __builtin_ffs that conflicts with system
headers on OpenBSD and perhaps elsewhere:

isl_priv.h:44: error: conflicting types for 'ffs'

v2: include strings.h to ensure prototype is found

Signed-off-by: Jonathan Gray 
Reviewed-by: Jason Ekstrand 
Reviewed-by: Emil Velikov 

---

 src/intel/isl/isl_priv.h | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/intel/isl/isl_priv.h b/src/intel/isl/isl_priv.h
index 7b22259..d98e707 100644
--- a/src/intel/isl/isl_priv.h
+++ b/src/intel/isl/isl_priv.h
@@ -24,6 +24,7 @@
 #pragma once
 
 #include 
+#include 
 
 #include "brw_device_info.h"
 #include "util/macros.h"
@@ -39,11 +40,6 @@ __isl_finishme(const char *file, int line, const char *fmt, 
...);
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 
-static inline uint32_t
-ffs(uint32_t n) {
-   return __builtin_ffs(n);
-}
-
 static inline bool
 isl_is_pow2(uintmax_t n)
 {

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


Mesa (master): st/omx: Fix resource leak on OMX_ErrorNone

2016-04-25 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: b87856d25d1be1953dea30814994fc40cac5e573
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b87856d25d1be1953dea30814994fc40cac5e573

Author: Robert Foss 
Date:   Thu Apr 21 17:49:20 2016 -0400

st/omx: Fix resource leak on OMX_ErrorNone

Avoid leaking buffer allocated for task if an error has occured.

Coverity id: 1213929
Signed-off-by: Robert Foss 
Reviewed-by: Emil Velikov 

---

 src/gallium/state_trackers/omx/vid_enc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/state_trackers/omx/vid_enc.c 
b/src/gallium/state_trackers/omx/vid_enc.c
index 4505fe1..de62166 100644
--- a/src/gallium/state_trackers/omx/vid_enc.c
+++ b/src/gallium/state_trackers/omx/vid_enc.c
@@ -1152,6 +1152,7 @@ static OMX_ERRORTYPE 
vid_enc_EncodeFrame(omx_base_PortType *port, OMX_BUFFERHEAD
   /* --- load input image into video buffer  */
   err = enc_LoadImage(port, buf, task->buf);
   if (err != OMX_ErrorNone)
+ FREE(task);
  return err;
}
 

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


Mesa (libglvnd): loader: add missing include

2016-04-25 Thread Emil Velikov
Module: Mesa
Branch: libglvnd
Commit: 07accd07ec31d2fb1f25bc307040ce886e58d426
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=07accd07ec31d2fb1f25bc307040ce886e58d426

Author: Emil Velikov 
Date:   Mon Apr 25 14:50:58 2016 +0100

loader: add missing include 

Required for `struct stat'

Signed-off-by: Emil Velikov 

---

 src/loader/loader.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/loader/loader.c b/src/loader/loader.c
index 666d015..e856fd5 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -64,6 +64,7 @@
  *Rob Clark 
  */
 
+#include 
 #include 
 #include 
 #include 

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


Mesa (master): spirv: fix warning in release build

2016-04-25 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 29d2c0e9e6c545e5182c8da83ef4ca4a27d77388
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=29d2c0e9e6c545e5182c8da83ef4ca4a27d77388

Author: Grazvydas Ignotas 
Date:   Sat Apr 16 04:00:13 2016 +0300

spirv: fix warning in release build

Mark variable MAYBE_UNUSED to avoid unused-but-set-variable warning in
release build.

Signed-off-by: Grazvydas Ignotas 
Reviewed-by: Emil Velikov 

---

 src/compiler/spirv/vtn_cfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index 6a43ef8..d9096f4 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -36,7 +36,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, 
SpvOp opcode,
   list_inithead(>func->body);
   b->func->control = w[3];
 
-  const struct glsl_type *result_type =
+  MAYBE_UNUSED const struct glsl_type *result_type =
  vtn_value(b, w[1], vtn_value_type_type)->type->type;
   struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_function);
   val->func = b->func;

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


Mesa (master): util: add MAYBE_UNUSED for config dependent variables

2016-04-25 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: e4fc06a2f8be2de3a08d4adfa4a26df2ae0b5cae
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4fc06a2f8be2de3a08d4adfa4a26df2ae0b5cae

Author: Grazvydas Ignotas 
Date:   Sat Apr 16 04:00:10 2016 +0300

util: add MAYBE_UNUSED for config dependent variables

This is mostly for variables that are only used in asserts and cause
unused-but-set-variable warnings in release builds. Could just use
UNUSED directly, but MAYBE_UNUSED should be less confusing and is
similar to what the Linux kernel has.

And yes __attribute__((unused)) can be used on variables on both GCC 4.2
(oldest supported by mesa) and clang 3.0 (just some random old version,
not sure what's the minimum for mesa).

Signed-off-by: Grazvydas Ignotas 
Reviewed-by: Francisco Jerez 
Reviewed-by: Chad Versace 
Reviewed-by: Ian Romanick 
Reviewed-by: Emil Velikov 

---

 src/util/macros.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/macros.h b/src/util/macros.h
index 0c8958f..f081bb8 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -204,6 +204,8 @@ do {   \
 #define UNUSED
 #endif
 
+#define MAYBE_UNUSED UNUSED
+
 #ifdef HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT
 #define MUST_CHECK __attribute__((warn_unused_result))
 #else

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


Mesa (master): glsl: fix warning in release build

2016-04-25 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: bbeb9ab2f71409aad47485e7a1b8900f6839a481
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bbeb9ab2f71409aad47485e7a1b8900f6839a481

Author: Grazvydas Ignotas 
Date:   Sat Apr 16 04:00:11 2016 +0300

glsl: fix warning in release build

Mark variable MAYBE_UNUSED to avoid unused-but-set-variable warning in
release build.

Signed-off-by: Grazvydas Ignotas 
Reviewed-by: Ian Romanick 
Reviewed-by: Emil Velikov 

---

 src/compiler/glsl/lower_buffer_access.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/lower_buffer_access.cpp 
b/src/compiler/glsl/lower_buffer_access.cpp
index f85b421..59a2ae8 100644
--- a/src/compiler/glsl/lower_buffer_access.cpp
+++ b/src/compiler/glsl/lower_buffer_access.cpp
@@ -283,7 +283,7 @@ lower_buffer_access::is_dereferenced_thing_row_major(const 
ir_rvalue *deref)
  * layouts at HIR generation time, but we don't do that for shared
  * variables, which are always column-major
  */
-ir_variable *var = deref->variable_referenced();
+MAYBE_UNUSED ir_variable *var = deref->variable_referenced();
 assert((var->is_in_buffer_block() && !matrix) ||
var->data.mode == ir_var_shader_shared);
 return false;

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


Mesa (master): anv: fix warnings in release build

2016-04-25 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: d14778656bf818bfb58b8a0ed2c2037b80d91ccb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d14778656bf818bfb58b8a0ed2c2037b80d91ccb

Author: Grazvydas Ignotas 
Date:   Sat Apr 16 04:00:15 2016 +0300

anv: fix warnings in release build

Mark variables MAYBE_UNUSED to avoid unused-but-set-variable warnings
in release build.

Signed-off-by: Grazvydas Ignotas 
Reviewed-by: Chad Versace 
Reviewed-by: Emil Velikov 

---

 src/intel/vulkan/anv_dump.c| 2 +-
 src/intel/vulkan/anv_image.c   | 2 +-
 src/intel/vulkan/gen7_cmd_buffer.c | 2 +-
 src/intel/vulkan/gen8_cmd_buffer.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_dump.c b/src/intel/vulkan/anv_dump.c
index b7fa28b..63ad2cd 100644
--- a/src/intel/vulkan/anv_dump.c
+++ b/src/intel/vulkan/anv_dump.c
@@ -33,7 +33,7 @@ anv_dump_image_to_ppm(struct anv_device *device,
   unsigned array_layer, const char *filename)
 {
VkDevice vk_device = anv_device_to_handle(device);
-   VkResult result;
+   MAYBE_UNUSED VkResult result;
 
VkExtent2D extent = { image->extent.width, image->extent.height };
for (unsigned i = 0; i < miplevel; i++) {
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 03a8cb8..fb28389 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -343,7 +343,7 @@ anv_validate_CreateImageView(VkDevice _device,
 {
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
const VkImageSubresourceRange *subresource;
-   const struct anv_format *view_format_info;
+   MAYBE_UNUSED const struct anv_format *view_format_info;
 
/* Validate structure type before dereferencing it. */
assert(pCreateInfo);
diff --git a/src/intel/vulkan/gen7_cmd_buffer.c 
b/src/intel/vulkan/gen7_cmd_buffer.c
index 9bc949d..03ce889 100644
--- a/src/intel/vulkan/gen7_cmd_buffer.c
+++ b/src/intel/vulkan/gen7_cmd_buffer.c
@@ -379,7 +379,7 @@ genX(cmd_buffer_flush_compute_state)(struct anv_cmd_buffer 
*cmd_buffer)
 {
struct anv_pipeline *pipeline = cmd_buffer->state.compute_pipeline;
const struct brw_cs_prog_data *cs_prog_data = get_cs_prog_data(pipeline);
-   VkResult result;
+   MAYBE_UNUSED VkResult result;
 
assert(pipeline->active_stages == VK_SHADER_STAGE_COMPUTE_BIT);
 
diff --git a/src/intel/vulkan/gen8_cmd_buffer.c 
b/src/intel/vulkan/gen8_cmd_buffer.c
index 47a9d71..d078dac 100644
--- a/src/intel/vulkan/gen8_cmd_buffer.c
+++ b/src/intel/vulkan/gen8_cmd_buffer.c
@@ -444,7 +444,7 @@ genX(cmd_buffer_flush_compute_state)(struct anv_cmd_buffer 
*cmd_buffer)
 {
struct anv_pipeline *pipeline = cmd_buffer->state.compute_pipeline;
const struct brw_cs_prog_data *cs_prog_data = get_cs_prog_data(pipeline);
-   VkResult result;
+   MAYBE_UNUSED VkResult result;
 
assert(pipeline->active_stages == VK_SHADER_STAGE_COMPUTE_BIT);
 

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


Mesa (master): gallium: fix warnings in release build

2016-04-25 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: cbb0d4ad75e6309932af7995ca80fa5ff5db7c70
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cbb0d4ad75e6309932af7995ca80fa5ff5db7c70

Author: Grazvydas Ignotas 
Date:   Sat Apr 16 04:00:12 2016 +0300

gallium: fix warnings in release build

Mark variables MAYBE_UNUSED to avoid unused-but-set-variable warnings
in release build.

Signed-off-by: Grazvydas Ignotas 
Reviewed-by: Emil Velikov 

---

 src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 2 +-
 src/gallium/auxiliary/util/u_surface.c  | 3 ++-
 src/gallium/drivers/llvmpipe/lp_setup_vbuf.c| 2 +-
 src/gallium/drivers/r600/compute_memory_pool.c  | 2 +-
 src/gallium/drivers/softpipe/sp_state_sampler.c | 2 +-
 src/gallium/drivers/softpipe/sp_tile_cache.c| 3 ++-
 src/gallium/drivers/trace/tr_context.c  | 2 +-
 7 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c 
b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index 64af321..7717d78 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -826,7 +826,7 @@ fenced_buffer_fence(struct pb_buffer *buf,
   assert(fenced_buf->validation_flags);
 
   if (fenced_buf->fence) {
- boolean destroyed = fenced_buffer_remove_locked(fenced_mgr, 
fenced_buf);
+ MAYBE_UNUSED boolean destroyed = 
fenced_buffer_remove_locked(fenced_mgr, fenced_buf);
  assert(!destroyed);
   }
   if (fence) {
diff --git a/src/gallium/auxiliary/util/u_surface.c 
b/src/gallium/auxiliary/util/u_surface.c
index c150d92..4ef81c0 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -254,7 +254,8 @@ util_resource_copy_region(struct pipe_context *pipe,
struct pipe_transfer *src_trans, *dst_trans;
uint8_t *dst_map;
const uint8_t *src_map;
-   enum pipe_format src_format, dst_format;
+   MAYBE_UNUSED enum pipe_format src_format;
+   enum pipe_format dst_format;
struct pipe_box dst_box;
 
assert(src && dst);
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c 
b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
index 534c5f4..d7fa9fd 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
@@ -108,7 +108,7 @@ lp_setup_unmap_vertices(struct vbuf_render *vbr,
ushort min_index,
ushort max_index )
 {
-   struct lp_setup_context *setup = lp_setup_context(vbr);
+   MAYBE_UNUSED struct lp_setup_context *setup = lp_setup_context(vbr);
assert( setup->vertex_buffer_size >= (max_index+1) * setup->vertex_size );
/* do nothing */
 }
diff --git a/src/gallium/drivers/r600/compute_memory_pool.c 
b/src/gallium/drivers/r600/compute_memory_pool.c
index 93e3ffe..bcda155 100644
--- a/src/gallium/drivers/r600/compute_memory_pool.c
+++ b/src/gallium/drivers/r600/compute_memory_pool.c
@@ -489,7 +489,7 @@ void compute_memory_move_item(struct compute_memory_pool 
*pool,
struct r600_context *rctx = (struct r600_context *)pipe;
struct pipe_box box;
 
-   struct compute_memory_item *prev;
+   MAYBE_UNUSED struct compute_memory_item *prev;
 
COMPUTE_DBG(pool->screen, "* compute_memory_move_item()\n"
"  + Moving item %"PRIi64" from %"PRIi64" (%"PRIi64" 
bytes) to %"PRIu64" (%"PRIu64" bytes)\n",
diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c 
b/src/gallium/drivers/softpipe/sp_state_sampler.c
index 23ec4ef..f917147 100644
--- a/src/gallium/drivers/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -199,7 +199,7 @@ prepare_shader_sampling(
 
  if (!sp_tex->dt) {
 /* regular texture - setup array of mipmap level offsets */
-struct pipe_resource *res = view->texture;
+MAYBE_UNUSED struct pipe_resource *res = view->texture;
 int j;
 
 if (view->target != PIPE_BUFFER) {
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c 
b/src/gallium/drivers/softpipe/sp_tile_cache.c
index c623326..0ebe082 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -92,7 +92,8 @@ sp_create_tile_cache( struct pipe_context *pipe )
 {
struct softpipe_tile_cache *tc;
uint pos;
-   int maxLevels, maxTexSize;
+   MAYBE_UNUSED int maxTexSize;
+   int maxLevels;
 
/* sanity checking: max sure MAX_WIDTH/HEIGHT >= largest texture image */
maxLevels = pipe->screen->get_param(pipe->screen, 
PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
diff --git a/src/gallium/drivers/trace/tr_context.c 
b/src/gallium/drivers/trace/tr_context.c
index 7ed4f49..18c5c43 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -1893,6 +1893,6 @@ error1:
 void
 

Mesa (master): gallium: use unreachable instead of asserts

2016-04-25 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: dc732a8ef29dd2308a435cb7827c00be6d37fb5b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc732a8ef29dd2308a435cb7827c00be6d37fb5b

Author: Grazvydas Ignotas 
Date:   Sat Apr 16 04:00:16 2016 +0300

gallium: use unreachable instead of asserts

Avoids warnings in release builds.

Signed-off-by: Grazvydas Ignotas 
Reviewed-by: Emil Velikov 

---

 src/gallium/auxiliary/gallivm/lp_bld_intr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.c 
b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
index e153389..f806503 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_intr.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
@@ -84,7 +84,7 @@ lp_format_intrinsic(char *name,
   width = 64;
   break;
default:
-  assert(0);
+  unreachable("unexpected LLVMTypeKind");
}
 
if (length) {

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


Mesa (master): isl: fix warnings in release build

2016-04-25 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: ff48375a164b8bd07882481c2f6caf3d8f1f5617
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff48375a164b8bd07882481c2f6caf3d8f1f5617

Author: Grazvydas Ignotas 
Date:   Sat Apr 16 04:00:14 2016 +0300

isl: fix warnings in release build

Mark variables MAYBE_UNUSED to avoid unused-but-set-variable warnings
in release build.

Signed-off-by: Grazvydas Ignotas 
Reviewed-by: Chad Versace 
Reviewed-by: Emil Velikov 

---

 src/intel/isl/isl.c  | 2 +-
 src/intel/isl/isl_gen7.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 0eaa808..6e492af 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -695,7 +695,7 @@ isl_calc_phys_slice0_extent_sa_gen9_1d(
   const struct isl_extent4d *phys_level0_sa,
   struct isl_extent2d *phys_slice0_sa)
 {
-   const struct isl_format_layout *fmtl = isl_format_get_layout(info->format);
+   MAYBE_UNUSED const struct isl_format_layout *fmtl = 
isl_format_get_layout(info->format);
 
assert(phys_level0_sa->height == 1);
assert(phys_level0_sa->depth == 1);
diff --git a/src/intel/isl/isl_gen7.c b/src/intel/isl/isl_gen7.c
index 7064e85..542c137 100644
--- a/src/intel/isl/isl_gen7.c
+++ b/src/intel/isl/isl_gen7.c
@@ -313,7 +313,7 @@ gen7_choose_valign_el(const struct isl_device *dev,
   const struct isl_surf_init_info *restrict info,
   enum isl_tiling tiling)
 {
-   bool require_valign2 = false;
+   MAYBE_UNUSED bool require_valign2 = false;
bool require_valign4 = false;
 
if (isl_format_is_compressed(info->format))

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


Mesa (master): nouveau: codegen: combineLd/ St do not combine indirect loads

2016-04-25 Thread Hans de Goede
Module: Mesa
Branch: master
Commit: 787a53988cc6bb7a0f2b43c216837d683336b33f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=787a53988cc6bb7a0f2b43c216837d683336b33f

Author: Hans de Goede 
Date:   Thu Apr 21 15:43:51 2016 +0200

nouveau: codegen: combineLd/St do not combine indirect loads

combineLd/St would combine, i.e. :

st  u32 # g[$r2+0x0] $r2
st  u32 # g[$r2+0x4] $r3

into:

st  u64 # g[$r2+0x0] $r2d

But this is only valid if r2 contains an 8 byte aligned address,
which is not guaranteed for compute shaders

This commit checks for src0 dim 0 not being indirect when combining
loads / stores as combining indirect loads / stores may break alignment
rules.

Signed-off-by: Hans de Goede 
Reviewed-by: Ilia Mirkin 

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index fea3886..e62ac06 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -2203,6 +2203,9 @@ MemoryOpt::combineLd(Record *rec, Instruction *ld)
if (((size == 0x8) && (MIN2(offLd, offRc) & 0x7)) ||
((size == 0xc) && (MIN2(offLd, offRc) & 0xf)))
   return false;
+   // for compute indirect loads are not guaranteed to be aligned
+   if (prog->getType() == Program::TYPE_COMPUTE && rec->rel[0])
+  return false;
 
assert(sizeRc + sizeLd <= 16 && offRc != offLd);
 
@@ -2255,8 +2258,12 @@ MemoryOpt::combineSt(Record *rec, Instruction *st)
if (!prog->getTarget()->
isAccessSupported(st->getSrc(0)->reg.file, typeOfSize(size)))
   return false;
+   // no unaligned stores
if (size == 8 && MIN2(offRc, offSt) & 0x7)
   return false;
+   // for compute indirect stores are not guaranteed to be aligned
+   if (prog->getType() == Program::TYPE_COMPUTE && rec->rel[0])
+  return false;
 
st->takeExtraSources(0, extra); // save predicate and indirect address
 

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