Mesa (master): vc4: Size transfer temporary mappings appropriately for full maps of 3D.

2016-05-18 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: a507dcc1601d436f6b68fc59a8a8393773d6fd8b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a507dcc1601d436f6b68fc59a8a8393773d6fd8b

Author: Eric Anholt 
Date:   Wed May 18 12:29:02 2016 -0700

vc4: Size transfer temporary mappings appropriately for full maps of 3D.

We don't really support reading/writing of 3D textures since the hardware
doesn't do 3D, but we do need to make sure that a pipe_transfer for them
has enough space to store the image.  This was previously not a problem
because the state tracker only mapped a slice at a time until
fb9fe352ea41c7e3633ba2c483c59b73c529845b.  Fixes glean glsl1 tests, which
all have setup of a 3D texture at the start.

---

 src/gallium/drivers/vc4/vc4_resource.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_resource.c 
b/src/gallium/drivers/vc4/vc4_resource.c
index a360e19..20f137a 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -294,9 +294,9 @@ vc4_resource_transfer_map(struct pipe_context *pctx,
 ptrans->box.height = align(ptrans->box.height, utile_h);
 
 ptrans->stride = ptrans->box.width * rsc->cpp;
-ptrans->layer_stride = ptrans->stride;
+ptrans->layer_stride = ptrans->stride * ptrans->box.height;
 
-trans->map = malloc(ptrans->stride * ptrans->box.height);
+trans->map = malloc(ptrans->layer_stride * ptrans->box.depth);
 if (usage & PIPE_TRANSFER_READ ||
 ptrans->box.width != orig_width ||
 ptrans->box.height != orig_height) {

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


Mesa (master): anv/device: Fix viewportBoundsRange

2016-05-18 Thread Nanley Chery
Module: Mesa
Branch: master
Commit: 7ac08adfb4af3157171a565e353f608365c5dde5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ac08adfb4af3157171a565e353f608365c5dde5

Author: Nanley Chery 
Date:   Tue May 17 15:28:01 2016 -0700

anv/device: Fix viewportBoundsRange

Align with the spec requirement that the range must be at least
[−2 × maxViewportDimensions, 2 × maxViewportDimensions − 1]. Our
hardware supports this.

Fixes dEQP-VK.api.info.device.properties

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94896
Signed-off-by: Nanley Chery 
Reviewed-by: Anuj Phogat 

---

 src/intel/vulkan/anv_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 54810d9..5b5b095 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -502,7 +502,7 @@ void anv_GetPhysicalDeviceProperties(
   .maxSamplerAnisotropy = 16,
   .maxViewports = MAX_VIEWPORTS,
   .maxViewportDimensions= { (1 << 14), (1 << 14) },
-  .viewportBoundsRange  = { -16384.0, 16384.0 },
+  .viewportBoundsRange  = { INT16_MIN, INT16_MAX },
   .viewportSubPixelBits = 13, /* We take a float? */
   .minMemoryMapAlignment= 4096, /* A page */
   .minTexelBufferOffsetAlignment= 1,

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


Mesa (master): glsl/linker: attempt to match anonymous structures at link

2016-05-18 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 61b67892522c89800541ed4f266ab88e5f1db620
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=61b67892522c89800541ed4f266ab88e5f1db620

Author: Dave Airlie 
Date:   Tue May 17 10:31:29 2016 +1000

glsl/linker: attempt to match anonymous structures at link

This is my attempt at fixing at least one of the UE4 bugs with GL4.3.

If we are doing intrastage matching and hit anonymous structs, then
we should do a record comparison instead of using the names.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95005
Reviewed-by: Ian Romanick 
Signed-off-by: Dave Airlie 

---

 src/compiler/glsl/link_varyings.cpp | 24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp 
b/src/compiler/glsl/link_varyings.cpp
index 59ce1a2..1782a96 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -226,15 +226,21 @@ cross_validate_types_and_qualifiers(struct 
gl_shader_program *prog,
* fragment language."
*/
   if (!output->type->is_array() || !is_gl_identifier(output->name)) {
- linker_error(prog,
-  "%s shader output `%s' declared as type `%s', "
-  "but %s shader input declared as type `%s'\n",
-  _mesa_shader_stage_to_string(producer_stage),
-  output->name,
-  output->type->name,
-  _mesa_shader_stage_to_string(consumer_stage),
-  input->type->name);
- return;
+ bool anon_matches = output->type->is_anonymous() &&
+type_to_match->is_anonymous() &&
+type_to_match->record_compare(output->type);
+
+ if (!anon_matches) {
+linker_error(prog,
+ "%s shader output `%s' declared as type `%s', "
+ "but %s shader input declared as type `%s'\n",
+ _mesa_shader_stage_to_string(producer_stage),
+ output->name,
+ output->type->name,
+ _mesa_shader_stage_to_string(consumer_stage),
+ input->type->name);
+return;
+ }
   }
}
 

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


Mesa (master): anv/batch_chain: free pointers for error cases

2016-05-18 Thread Mark Janes
Module: Mesa
Branch: master
Commit: 4dfa89e33c810bac02e2678814621d2f3868d58b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4dfa89e33c810bac02e2678814621d2f3868d58b

Author: Mark Janes 
Date:   Wed May 18 14:28:38 2016 -0700

anv/batch_chain: free pointers for error cases

Trivial fix to improperly handled cleanup during
VK_ERROR_OUT_OF_HOST_MEMORY.

Identified by Coverity: CID 1358908 and 1358909
Reviewed-by: Jason Ekstrand 

---

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

diff --git a/src/intel/vulkan/anv_batch_chain.c 
b/src/intel/vulkan/anv_batch_chain.c
index 36c9565..a98a0a9 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -120,7 +120,7 @@ anv_reloc_list_grow(struct anv_reloc_list *list,
struct anv_bo **new_reloc_bos =
   anv_alloc(alloc, new_length * sizeof(*list->reloc_bos), 8,
 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
-   if (new_relocs == NULL) {
+   if (new_reloc_bos == NULL) {
   anv_free(alloc, new_relocs);
   return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
@@ -891,7 +891,7 @@ anv_cmd_buffer_add_bo(struct anv_cmd_buffer *cmd_buffer,
  struct anv_bo **new_bos =
 anv_alloc(_buffer->pool->alloc, new_len * sizeof(*new_bos),
   8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
- if (new_objects == NULL) {
+ if (new_bos == NULL) {
 anv_free(_buffer->pool->alloc, new_objects);
 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
  }

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


Mesa (master): 43 new commits

2016-05-18 Thread Axel Davy
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f21b7d1e5c21b749ae7c19d3dc80dc4e14e4bb77
Author: Wang He 
Date:   Tue May 10 13:40:30 2016 +0800

st/nine: Minor change to support musl libc

A few changes to support musl libc as well.

In particular fpu_control.h is glibc specific.
fenv.h doesn't enable to do exactly what we want either,
so instead use assembly directly.

Signed-off-by: Wang He 
Reviewed-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=de39231134348a5ffb92f7cc2b3098e11384912a
Author: Patrick Rudolph 
Date:   Fri Apr 29 08:50:16 2016 +0200

st/nine: Enable D3DPMISCCAPS_PERSTAGECONSTANT

Nine already supports the feature.
There are no failing WINE tests for per stage constants.
Enabling D3DPMISCCAPS_PERSTAGECONSTANT as it fixes
https://github.com/iXit/Mesa-3D/issues/205

Signed-off-by: Patrick Rudolph 
Reviewed-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=839f41763436cd1a438771f50ffa16fa33c5
Author: Axel Davy 
Date:   Sat May 7 11:33:24 2016 +0200

st/nine: Turn on thread_submit by default when on different device

The last remaining issues with thread_submit have been resolved,
thus turn it when on a different device (the case where is is
beneficial).

Signed-off-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9cae3cdc890b2aa261d635667a5850929a0913f5
Author: Axel Davy 
Date:   Sun Apr 3 13:04:39 2016 +0200

st/nine: Fix usage of rasterizer multisample bit.

pipe_rasterizer multisample bit should be enabled only when really
wanting to do multisampling, thus we should disable when not having
msaa render target.
This fixes some depth calculation precision issues on radeon.
Also disable it when depth and stencil tests are disabled, since in that
case multisampling is same as not multisampled.

Signed-off-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f297e7de0f3fc0bd4fec483d4bf778a9678992c7
Author: Axel Davy 
Date:   Sun Apr 3 10:52:22 2016 +0200

st/nine: ATOC has effect only with ALPHATESTENABLE

ATOC extension does something only when alpha test is enabled.
Use a second bit to encode the difference with ATIATOC.

Signed-off-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=edc5cdced56756bfda898a4ed5bd480cd07c2d7e
Author: Axel Davy 
Date:   Sat May 7 11:20:47 2016 +0200

st/nine: Add debug string for ATOC

We were missing a debug string for this format.

Signed-off-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e89dcf0c4ad543e5404d28b1f949387d63f59ee
Author: Axel Davy 
Date:   Sat Mar 19 19:27:34 2016 +0100

st/nine: Add asserts for output/input packing

Nine doesn't support vs output/ps input packing.
We haven't found any application requiring that,
and implementing it properly is complex.

Add asserts for now.

Signed-off-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aeddda0c3a2294d923ba57604d9bda5cab0d0f70
Author: Axel Davy 
Date:   Mon Mar 14 21:29:53 2016 +0100

st/nine: Use correct PIPE_HANDLE_USAGE flag for frontbuffer copy

When taking screenshots we do a copy from the frontbuffer
to an allocated buffer (which we then copy to a ram buffer).

Signed-off-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca7c78a88ecc828a1b08dc18667d2a70d9d0e09d
Author: Axel Davy 
Date:   Sat Mar 12 12:24:51 2016 +0100

st/nine: Fix output shift calculation

We were getting it wrong for negative values.

Signed-off-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8d95d40872dafbd372c071455d26ab078cdd170
Author: Axel Davy 
Date:   Fri Mar 11 23:30:05 2016 +0100

st/nine: Fix CheckDeviceFormat advertising for surfaces

Signed-off-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ef231c80f7bb8aa08b9402d7cdfc792e8752b39
Author: Axel Davy 
Date:   Fri Mar 11 23:03:56 2016 +0100

st/nine: Improve buffer placement

Signed-off-by: Axel Davy 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7639033973c4f0fece37457ac250dd9df73410e8
Author: Axel Davy 
Date:   Fri Mar 11 22:22:10 2016 +0100

st/nine: Fix buffer bind flags

Signed-off-by: Axel Davy 

URL:

Mesa (master): svga: add another debug_printf() in svga_screen_create()

2016-05-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 243fd02858c1287667d9f8d0555a8e9520289f56
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=243fd02858c1287667d9f8d0555a8e9520289f56

Author: Brian Paul 
Date:   Wed May 18 13:01:03 2016 -0600

svga: add another debug_printf() in svga_screen_create()

Signed-off-by: Brian Paul 

---

 src/gallium/drivers/svga/svga_screen.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/svga/svga_screen.c 
b/src/gallium/drivers/svga/svga_screen.c
index fb03b56..9f4dbb8 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -1068,6 +1068,7 @@ svga_screen_create(struct svga_winsys_screen *sws)
svgascreen->haveLineStipple, svgascreen->haveLineSmooth,
svgascreen->maxLineWidth);
   debug_printf("svga: maxPointSize %g\n", svgascreen->maxPointSize);
+  debug_printf("svga: msaa samples mask: 0x%x\n", svgascreen->ms_samples);
}
 
pipe_mutex_init(svgascreen->tex_mutex);

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


Mesa (master): spirv: add switch case for nir_texop_txf_ms_mcs in vtn_handle_texture()

2016-05-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 96909ef12802fdc8b5a9870bcfde89881ecedf86
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=96909ef12802fdc8b5a9870bcfde89881ecedf86

Author: Brian Paul 
Date:   Tue May 17 19:28:37 2016 -0600

spirv: add switch case for nir_texop_txf_ms_mcs in vtn_handle_texture()

Mark it as unreachable.  Silences a compiler warning:

spirv/spirv_to_nir.c:1397:4: warning: enumeration value
'nir_texop_txf_ms_mcs' not handled in switch [-Wswitch]
switch (instr->op) {
^

Reviewed-by: Jason Ekstrand 

---

 src/compiler/spirv/spirv_to_nir.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/spirv/spirv_to_nir.c 
b/src/compiler/spirv/spirv_to_nir.c
index 56948bf..c92dfca 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1413,6 +1413,8 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
   /* These don't */
   instr->sampler = NULL;
   break;
+   case nir_texop_txf_ms_mcs:
+  unreachable("unexpected nir_texop_txf_ms_mcs");
}
 
nir_ssa_dest_init(>instr, >dest,

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


Mesa (master): Revert "i965/urb: fixes division by zero"

2016-05-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 9c290b1e5468a66bd856ceee372079e3ce43def8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c290b1e5468a66bd856ceee372079e3ce43def8

Author: Matt Turner 
Date:   Wed May 18 12:48:20 2016 -0700

Revert "i965/urb: fixes division by zero"

This reverts commit 2a8aa1e3deb99a1ae16d942318da648c1327ece5.

---

 src/mesa/drivers/dri/i965/gen7_urb.c | 24 +++-
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_urb.c 
b/src/mesa/drivers/dri/i965/gen7_urb.c
index 6d9aa02..a412a42 100644
--- a/src/mesa/drivers/dri/i965/gen7_urb.c
+++ b/src/mesa/drivers/dri/i965/gen7_urb.c
@@ -292,11 +292,25 @@ gen7_upload_urb(struct brw_context *brw)
if (remaining_space > total_wants)
   remaining_space = total_wants;
if (remaining_space > 0) {
-  float ratio = ((float) remaining_space) / total_wants;
-  vs_chunks += lroundf(vs_wants * ratio);
-  hs_chunks += lroundf(hs_wants * ratio);
-  ds_chunks += lroundf(ds_wants * ratio);
-  gs_chunks += lroundf(gs_wants * ratio);
+  unsigned vs_additional = (unsigned)
+ roundf(vs_wants * (((float) remaining_space) / total_wants));
+  vs_chunks += vs_additional;
+  remaining_space -= vs_additional;
+  total_wants -= vs_wants;
+
+  unsigned hs_additional = (unsigned)
+ round(hs_wants * (((double) remaining_space) / total_wants));
+  hs_chunks += hs_additional;
+  remaining_space -= hs_additional;
+  total_wants -= hs_wants;
+
+  unsigned ds_additional = (unsigned)
+ round(ds_wants * (((double) remaining_space) / total_wants));
+  ds_chunks += ds_additional;
+  remaining_space -= ds_additional;
+  total_wants -= ds_wants;
+
+  gs_chunks += remaining_space;
}
 
/* Sanity check that we haven't over-allocated. */

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


Mesa (master): mesa: fclose() filename on error.

2016-05-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: caab3cd5361d8848e8f8957f697aff7bca5fc6b3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=caab3cd5361d8848e8f8957f697aff7bca5fc6b3

Author: Matt Turner 
Date:   Mon May 16 15:31:00 2016 -0700

mesa: fclose() filename on error.

Pretty useless, as it's in debugging code. Found by Coverity (CID
1257016).

---

 src/mesa/main/dlist.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 6dfb84b..b15826c 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -10054,8 +10054,12 @@ print_list(struct gl_context *ctx, GLuint list, const 
char *fname)
}
 
dlist = _mesa_lookup_list(ctx, list);
-   if (!dlist)
+   if (!dlist) {
+  if (fname) {
+ fclose(f);
+  }
   return;
+   }
 
n = dlist->Head;
 

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


Mesa (master): isl: Mark default cases in switch unreachable.

2016-05-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 0a548eb56fba1ec7e32ea116d022327baaae8d21
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a548eb56fba1ec7e32ea116d022327baaae8d21

Author: Matt Turner 
Date:   Mon May 16 11:12:24 2016 -0700

isl: Mark default cases in switch unreachable.

To silence -Wmaybe-uninitialized warnings.

---

 src/intel/isl/isl.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 6e492af..ca2db84 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -151,6 +151,9 @@ isl_tiling_get_info(const struct isl_device *dev,
   height = 1 << (6 - (ffs(bs) / 2) + (2 * is_Ys));
   break;
}
+
+   default:
+  unreachable("not reached");
} /* end switch */
 
*tile_info = (struct isl_tile_info) {
@@ -1387,6 +1390,9 @@ get_image_offset_sa(const struct isl_surf *surf,
   get_image_offset_sa_gen4_3d(surf, level, logical_z_offset_px,
   x_offset_sa, y_offset_sa);
   break;
+
+   default:
+  unreachable("not reached");
}
 }
 

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


Mesa (master): spirv: Properly size the src[] array.

2016-05-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: b1e6d069daeda87cb7e14a45a0e4438cc0b399d0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1e6d069daeda87cb7e14a45a0e4438cc0b399d0

Author: Matt Turner 
Date:   Mon May 16 12:48:00 2016 -0700

spirv: Properly size the src[] array.

Operations like nir_op_bitfield_insert have four arguments, and Coverity
isn't privy to the fact that 4-argument operations aren't possible here,
so it thinks this can lead to memory corruption. Just increase the size
of the array to quell any fears.

---

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

diff --git a/src/compiler/spirv/spirv_to_nir.c 
b/src/compiler/spirv/spirv_to_nir.c
index c65f971..56948bf 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1036,7 +1036,7 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
  unsigned bit_size =
 glsl_get_bit_size(val->const_type);
 
- nir_const_value src[3];
+ nir_const_value src[4];
  assert(count <= 7);
  for (unsigned i = 0; i < count - 4; i++) {
 nir_constant *c =

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


Mesa (master): i965/fs: Assert that nir_op_extract_*'s src1 is a constant.

2016-05-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: cbb0e3a7e8fffa4d5c5af8660d99cd3da8af97ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cbb0e3a7e8fffa4d5c5af8660d99cd3da8af97ec

Author: Matt Turner 
Date:   Mon May 16 15:22:59 2016 -0700

i965/fs: Assert that nir_op_extract_*'s src1 is a constant.

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index ad20dc8..ebcc92a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -1384,6 +1384,7 @@ fs_visitor::nir_emit_alu(const fs_builder , 
nir_alu_instr *instr)
case nir_op_extract_u8:
case nir_op_extract_i8: {
   nir_const_value *byte = nir_src_as_const_value(instr->src[1].src);
+  assert(byte != NULL);
   bld.emit(SHADER_OPCODE_EXTRACT_BYTE,
result, op[0], brw_imm_ud(byte->u32[0]));
   break;
@@ -1392,6 +1393,7 @@ fs_visitor::nir_emit_alu(const fs_builder , 
nir_alu_instr *instr)
case nir_op_extract_u16:
case nir_op_extract_i16: {
   nir_const_value *word = nir_src_as_const_value(instr->src[1].src);
+  assert(word != NULL);
   bld.emit(SHADER_OPCODE_EXTRACT_WORD,
result, op[0], brw_imm_ud(word->u32[0]));
   break;

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


Mesa (master): glsl: Check that layout is non-null before dereferencing.

2016-05-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 6a4ff51f7a28124f27da52fe8d1a04025ddf7a83
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a4ff51f7a28124f27da52fe8d1a04025ddf7a83

Author: Matt Turner 
Date:   Mon May 16 14:49:38 2016 -0700

glsl: Check that layout is non-null before dereferencing.

layout should only be null for structs, but it's checked everywhere else
and confuses Coverity (CID 1358495).

Reviewed-by: Timothy Arceri 

---

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

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 338edc8..b4c6de2 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -6818,7 +6818,7 @@ ast_process_struct_or_iface_block_members(exec_list 
*instructions,
   * the structure may contain a structure that contains ... a matrix
   * that need the proper layout.
   */
- if (is_interface &&
+ if (is_interface && layout &&
  (layout->flags.q.uniform || layout->flags.q.buffer) &&
  (field_type->without_array()->is_matrix()
   || field_type->without_array()->is_record())) {

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


Mesa (master): i965/urb: fixes division by zero

2016-05-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 2a8aa1e3deb99a1ae16d942318da648c1327ece5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a8aa1e3deb99a1ae16d942318da648c1327ece5

Author: Ardinartsev Nikita 
Date:   Tue May 17 02:27:22 2016 +0300

i965/urb: fixes division by zero

Fixes regression introduced by af5ca43f2676bff7499f93277f908b681cb821d0

Reviewed-by: Matt Turner 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95419

---

 src/mesa/drivers/dri/i965/gen7_urb.c | 24 +---
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_urb.c 
b/src/mesa/drivers/dri/i965/gen7_urb.c
index a412a42..6d9aa02 100644
--- a/src/mesa/drivers/dri/i965/gen7_urb.c
+++ b/src/mesa/drivers/dri/i965/gen7_urb.c
@@ -292,25 +292,11 @@ gen7_upload_urb(struct brw_context *brw)
if (remaining_space > total_wants)
   remaining_space = total_wants;
if (remaining_space > 0) {
-  unsigned vs_additional = (unsigned)
- roundf(vs_wants * (((float) remaining_space) / total_wants));
-  vs_chunks += vs_additional;
-  remaining_space -= vs_additional;
-  total_wants -= vs_wants;
-
-  unsigned hs_additional = (unsigned)
- round(hs_wants * (((double) remaining_space) / total_wants));
-  hs_chunks += hs_additional;
-  remaining_space -= hs_additional;
-  total_wants -= hs_wants;
-
-  unsigned ds_additional = (unsigned)
- round(ds_wants * (((double) remaining_space) / total_wants));
-  ds_chunks += ds_additional;
-  remaining_space -= ds_additional;
-  total_wants -= ds_wants;
-
-  gs_chunks += remaining_space;
+  float ratio = ((float) remaining_space) / total_wants;
+  vs_chunks += lroundf(vs_wants * ratio);
+  hs_chunks += lroundf(hs_wants * ratio);
+  ds_chunks += lroundf(ds_wants * ratio);
+  gs_chunks += lroundf(gs_wants * ratio);
}
 
/* Sanity check that we haven't over-allocated. */

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


Mesa (master): egl/dri2: Don't check return result of mtx_unlock().

2016-05-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 53f64a84047b3f2766e490311c925a36afc64807
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=53f64a84047b3f2766e490311c925a36afc64807

Author: Matt Turner 
Date:   Mon May 16 14:43:26 2016 -0700

egl/dri2: Don't check return result of mtx_unlock().

Coverity (CID 1358496) warns that the cleanup code doesn't unlock the
mutex (which is arguably kind of stupid, since the only case that can
happen is when mtx_unlock() failed!). But, mtx_unlock() isn't going to
fail -- the mutex was locked by this thread just a few lines above it.

---

 src/egl/drivers/dri2/egl_dri2.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index d8448f4..65a3a62 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2585,10 +2585,7 @@ dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLSync *sync,
 
  ret = cnd_wait(_sync->cond, _sync->mutex);
 
- if (mtx_unlock(_sync->mutex)) {
-ret = EGL_FALSE;
-goto cleanup;
- }
+ mtx_unlock(_sync->mutex);
 
  if (ret) {
 _eglError(EGL_BAD_PARAMETER, "eglClientWaitSyncKHR");
@@ -2619,10 +2616,7 @@ dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLSync *sync,
 
 ret = cnd_timedwait(_sync->cond, _sync->mutex, );
 
-if (mtx_unlock(_sync->mutex)) {
-   ret = EGL_FALSE;
-   goto cleanup;
-}
+mtx_unlock(_sync->mutex);
 
 if (ret)
if (ret == thrd_busy) {

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


Mesa (master): glsl/linker: Don' t include interface name for built-in blocks

2016-05-18 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 79bbff9defd98167bf14336a44985088e2fd3f37
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=79bbff9defd98167bf14336a44985088e2fd3f37

Author: Ian Romanick 
Date:   Tue May 17 13:30:46 2016 -0700

glsl/linker: Don't include interface name for built-in blocks

Commit 11096ec introduced a regression in some piglit tests (e.g.,
arb_program_interface_query-resource-query).  I did not notice this
regression because other (unrelated) problems caused failed assertions
in those same tests on my system... so they crashed before getting to
the new failure.

v2: Use is_gl_identifier.  Suggested by Tim.

Signed-off-by: Ian Romanick 
Reviewed-by: Timothy Arceri 
Cc: mesa-sta...@lists.freedesktop.org

---

 src/compiler/glsl/linker.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 7f54433..6246944 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3664,7 +3664,8 @@ add_shader_variable(struct gl_shader_program *shProg, 
unsigned stage_mask,
*the name of the interface block (not the instance name) and
*"Member" is the name of the variable."
*/
-  const char *prefixed_name = var->data.from_named_ifc_block
+  const char *prefixed_name = (var->data.from_named_ifc_block &&
+   !is_gl_identifier(var->name))
  ? ralloc_asprintf(shProg, "%s.%s", var->get_interface_type()->name,
name)
  : name;

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


Mesa (master): glsl/linker: Fix trivial typos in comments

2016-05-18 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: cf9220b11f599ca77134528f5b4ad505f1345e1c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf9220b11f599ca77134528f5b4ad505f1345e1c

Author: Ian Romanick 
Date:   Tue May 17 15:01:19 2016 -0700

glsl/linker: Fix trivial typos in comments

Signed-off-by: Ian Romanick 
Reviewed-by: Timothy Arceri 

---

 src/compiler/glsl/link_varyings.cpp | 10 +-
 src/compiler/glsl/linker.cpp|  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp 
b/src/compiler/glsl/link_varyings.cpp
index 69b82d5..59ce1a2 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -1278,8 +1278,8 @@ varying_matches::~varying_matches()
 
 
 /**
- * Packing is always safe on individual arrays, structure and matices. It is
- * also safe if the varying is only used for transform feedback.
+ * Packing is always safe on individual arrays, structures, and matrices. It
+ * is also safe if the varying is only used for transform feedback.
  */
 bool
 varying_matches::is_varying_packing_safe(const glsl_type *type,
@@ -1980,10 +1980,10 @@ assign_varying_locations(struct gl_context *ctx,
 
/* Disable varying packing for GL 4.4+ as there is no guarantee
 * that interpolation qualifiers will match between shaders in these
-* versions. We also disable packing on outerward facing interfaces for
+* versions. We also disable packing on outward facing interfaces for
 * SSO because in ES we need to retain the unpacked varying information
 * for draw time validation. For desktop GL we could allow packing for
-* versions < 4.4 but its just safer not to do packing.
+* versions < 4.4 but it's just safer not to do packing.
 *
 * Packing is still enabled on individual arrays, structs, and matrices as
 * these are required by the transform feedback code and it is still safe
@@ -2080,7 +2080,7 @@ assign_varying_locations(struct gl_context *ctx,
consumer_interface_inputs,
consumer_inputs_with_locations);
 
- /* If a matching input variable was found, add this ouptut (and the
+ /* If a matching input variable was found, add this output (and the
   * input) to the set.  If this is a separable program and there is no
   * consumer stage, add the output.
   *
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 586e2b2..7f54433 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4741,9 +4741,9 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
 
/* If there is no fragment shader we need to set transform feedback.
 *
-* For SSO we need also need to assign output locations, we assign them
-* here because we need to do it for both single stage programs and multi
-* stage programs.
+* For SSO we also need to assign output locations.  We assign them here
+* because we need to do it for both single stage programs and multi stage
+* programs.
 */
if (last < MESA_SHADER_FRAGMENT &&
(num_tfeedback_decls != 0 || prog->SeparateShader)) {

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


Mesa (master): glsl: Assert that inputs have a location assigned

2016-05-18 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 2ef4b5bc932bac100570d377551959c5655e37a3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ef4b5bc932bac100570d377551959c5655e37a3

Author: Ian Romanick 
Date:   Mon May 16 18:01:10 2016 -0700

glsl: Assert that inputs have a location assigned

This catches a problem previously undetected until deep in the backend.

Signed-off-by: Ian Romanick 
Reviewed-by: Timothy Arceri 

---

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

diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp 
b/src/compiler/glsl/ir_set_program_inouts.cpp
index 6768d82..183b13b 100644
--- a/src/compiler/glsl/ir_set_program_inouts.cpp
+++ b/src/compiler/glsl/ir_set_program_inouts.cpp
@@ -94,6 +94,8 @@ mark(struct gl_program *prog, ir_variable *var, int offset, 
int len,
 */
 
for (int i = 0; i < len; i++) {
+  assert(var->data.location != -1);
+
   int idx = var->data.location + var->data.index + offset + i;
   bool is_patch_generic = var->data.patch &&
   idx != VARYING_SLOT_TESS_LEVEL_INNER &&

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


Mesa (master): glsl/linker: Fix some formatting to match current coding conventions

2016-05-18 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: d2579728c96e1386cc2c1894c958a219edc27639
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d2579728c96e1386cc2c1894c958a219edc27639

Author: Ian Romanick 
Date:   Mon May 16 17:58:55 2016 -0700

glsl/linker: Fix some formatting to match current coding conventions

Signed-off-by: Ian Romanick 
Reviewed-by: Timothy Arceri 

---

 src/compiler/glsl/link_varyings.cpp | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp 
b/src/compiler/glsl/link_varyings.cpp
index 1c59456..69b82d5 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -358,7 +358,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program 
*prog,
foreach_in_list(ir_instruction, node, producer->ir) {
   ir_variable *const var = node->as_variable();
 
-  if ((var == NULL) || (var->data.mode != ir_var_shader_out))
+  if (var == NULL || var->data.mode != ir_var_shader_out)
  continue;
 
   if (!var->data.explicit_location
@@ -442,7 +442,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program 
*prog,
foreach_in_list(ir_instruction, node, consumer->ir) {
   ir_variable *const input = node->as_variable();
 
-  if ((input == NULL) || (input->data.mode != ir_var_shader_in))
+  if (input == NULL || input->data.mode != ir_var_shader_in)
  continue;
 
   if (strcmp(input->name, "gl_Color") == 0 && input->data.used) {
@@ -540,7 +540,7 @@ remove_unused_shader_inputs_and_outputs(bool 
is_separate_shader_object,
foreach_in_list(ir_instruction, node, sh->ir) {
   ir_variable *const var = node->as_variable();
 
-  if ((var == NULL) || (var->data.mode != int(mode)))
+  if (var == NULL || var->data.mode != int(mode))
  continue;
 
   /* A shader 'in' or 'out' variable is only really an input or output if
@@ -1756,7 +1756,7 @@ populate_consumer_input_sets(void *mem_ctx, exec_list *ir,
foreach_in_list(ir_instruction, node, ir) {
   ir_variable *const input_var = node->as_variable();
 
-  if ((input_var != NULL) && (input_var->data.mode == ir_var_shader_in)) {
+  if (input_var != NULL && input_var->data.mode == ir_var_shader_in) {
  /* All interface blocks should have been lowered by this point */
  assert(!input_var->type->is_interface());
 
@@ -2062,8 +2062,7 @@ assign_varying_locations(struct gl_context *ctx,
   foreach_in_list(ir_instruction, node, producer->ir) {
  ir_variable *const output_var = node->as_variable();
 
- if ((output_var == NULL) ||
- (output_var->data.mode != ir_var_shader_out))
+ if (output_var == NULL || output_var->data.mode != ir_var_shader_out)
 continue;
 
  /* Only geometry shaders can use non-zero streams */
@@ -2111,8 +2110,7 @@ assign_varying_locations(struct gl_context *ctx,
   foreach_in_list(ir_instruction, node, consumer->ir) {
  ir_variable *const input_var = node->as_variable();
 
- if ((input_var == NULL) ||
- (input_var->data.mode != ir_var_shader_in))
+ if (input_var == NULL || input_var->data.mode != ir_var_shader_in)
 continue;
 
  matches.record(NULL, input_var);

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


Mesa (master): glsl/linker: Ensure the first stage of an SSO pipeline has input locs assigned

2016-05-18 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 7619aed41d6b677a05c1088aed3a6b6a70255496
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7619aed41d6b677a05c1088aed3a6b6a70255496

Author: Ian Romanick 
Date:   Tue May 17 13:49:11 2016 -0700

glsl/linker: Ensure the first stage of an SSO pipeline has input locs assigned

Previously an SSO pipeline containing only a tessellation control shader
and a tessellation evaluation shader would not get locations assigned
for the TCS inputs.  This would lead to assertion failures in some
piglit tests, such as arb_program_interface_query-resource-query.

That piglit test still fails on some tessellation related subtests.
Specifically, these subtests fail:

'GL_PROGRAM_INPUT(tcs) active resources' expected 2 but got 3
'GL_PROGRAM_INPUT(tcs) max length name' expected 12 but got 16
'GL_PROGRAM_INPUT(tcs,tes) active resources' expected 2 but got 3
'GL_PROGRAM_INPUT(tcs,tes) max length name' expected 12 but got 16
'GL_PROGRAM_OUTPUT(tcs) active resources' expected 15 but got 3
'GL_PROGRAM_OUTPUT(tcs) max length name' expected 23 but got 12

Signed-off-by: Ian Romanick 
Reviewed-by: Timothy Arceri 
Cc: mesa-sta...@lists.freedesktop.org

---

 src/compiler/glsl/linker.cpp | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 6246944..de56945 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4790,7 +4790,7 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
   */
  int next = last;
  for (int i = next - 1; i >= 0; i--) {
-if (prog->_LinkedShaders[i] == NULL)
+if (prog->_LinkedShaders[i] == NULL && i != 0)
continue;
 
 gl_shader *const sh_i = prog->_LinkedShaders[i];
@@ -4806,8 +4806,11 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
   tfeedback_decls);
 
 /* This must be done after all dead varyings are eliminated. */
-if (!check_against_output_limit(ctx, prog, sh_i))
-   goto done;
+if (sh_i != NULL) {
+   if (!check_against_output_limit(ctx, prog, sh_i)) {
+  goto done;
+   }
+}
 if (!check_against_input_limit(ctx, prog, sh_next))
goto done;
 

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


Mesa (master): glsl/linker: Silence unused parameter warning

2016-05-18 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 02e4753777deb15f3313b3f23a7a73dededd0a61
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=02e4753777deb15f3313b3f23a7a73dededd0a61

Author: Ian Romanick 
Date:   Mon May 16 12:48:06 2016 -0700

glsl/linker: Silence unused parameter warning

The use of the parameter was removed in d6b92028.

glsl/link_varyings.cpp:1390:39: warning: unused parameter ‘separate_shader’ 
[-Wunused-parameter]
   bool separate_shader)
   ^

Signed-off-by: Ian Romanick 
Reviewed-by: Timothy Arceri 

---

 src/compiler/glsl/link_varyings.cpp | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp 
b/src/compiler/glsl/link_varyings.cpp
index b4a4fb3..1c59456 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -1149,7 +1149,7 @@ public:
~varying_matches();
void record(ir_variable *producer_var, ir_variable *consumer_var);
unsigned assign_locations(struct gl_shader_program *prog,
- uint64_t reserved_slots, bool separate_shader);
+ uint64_t reserved_slots);
void store_locations() const;
 
 private:
@@ -1397,8 +1397,7 @@ varying_matches::record(ir_variable *producer_var, 
ir_variable *consumer_var)
  */
 unsigned
 varying_matches::assign_locations(struct gl_shader_program *prog,
-  uint64_t reserved_slots,
-  bool separate_shader)
+  uint64_t reserved_slots)
 {
/* If packing has been disabled then we cannot safely sort the varyings by
 * class as it may mean we are using a version of OpenGL where
@@ -2144,8 +2143,7 @@ assign_varying_locations(struct gl_context *ctx,
   reserved_varying_slot(producer, ir_var_shader_out) |
   reserved_varying_slot(consumer, ir_var_shader_in);
 
-   const unsigned slots_used = matches.assign_locations(prog, reserved_slots,
-prog->SeparateShader);
+   const unsigned slots_used = matches.assign_locations(prog, reserved_slots);
matches.store_locations();
 
for (unsigned i = 0; i < num_tfeedback_decls; ++i) {

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


Mesa (master): i965: Silence unused parameter warnings

2016-05-18 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: f687b8e1785df0825443f07778e5d0ddf6f9be09
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f687b8e1785df0825443f07778e5d0ddf6f9be09

Author: Ian Romanick 
Date:   Thu May 12 17:44:46 2016 -0700

i965: Silence unused parameter warnings

The only place that actually used the type parameter was the GS visitor,
and it was always passed glsl_type::int.  Just remove the parameter.

brw_vec4_vs_visitor.cpp:38:61: warning: unused parameter ‘type’ 
[-Wunused-parameter]
const glsl_type *type)
 ^

Signed-off-by: Ian Romanick 
Reviewed-by: Timothy Arceri 

---

 src/mesa/drivers/dri/i965/brw_vec4.h  |  3 +--
 src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp |  3 +--
 src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp |  5 ++---
 src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h   |  3 +--
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp| 15 +--
 src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp|  2 +-
 src/mesa/drivers/dri/i965/brw_vec4_tcs.h  |  3 +--
 src/mesa/drivers/dri/i965/brw_vec4_tes.cpp|  2 +-
 src/mesa/drivers/dri/i965/brw_vec4_tes.h  |  3 +--
 src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp |  3 +--
 src/mesa/drivers/dri/i965/brw_vs.h|  3 +--
 src/mesa/drivers/dri/i965/test_vec4_cmod_propagation.cpp  |  3 +--
 src/mesa/drivers/dri/i965/test_vec4_copy_propagation.cpp  |  3 +--
 src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp |  3 +--
 14 files changed, 19 insertions(+), 35 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index 4708b66..bc54eaf 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -337,8 +337,7 @@ public:
unsigned num_components = 4);
src_reg get_indirect_offset(nir_intrinsic_instr *instr);
 
-   virtual dst_reg *make_reg_for_system_value(int location,
-  const glsl_type *type) = 0;
+   virtual dst_reg *make_reg_for_system_value(int location) = 0;
 
dst_reg *nir_locals;
dst_reg *nir_ssa_values;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
index e915aee..9ebfb27 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
@@ -43,8 +43,7 @@ 
vec4_gs_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
case nir_intrinsic_load_invocation_id:
   reg = >nir_system_values[SYSTEM_VALUE_INVOCATION_ID];
   if (reg->file == BAD_FILE)
- *reg = *this->make_reg_for_system_value(SYSTEM_VALUE_INVOCATION_ID,
- glsl_type::int_type);
+ *reg = *this->make_reg_for_system_value(SYSTEM_VALUE_INVOCATION_ID);
   break;
 
default:
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index f591add..76a80a5 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -52,10 +52,9 @@ vec4_gs_visitor::vec4_gs_visitor(const struct brw_compiler 
*compiler,
 
 
 dst_reg *
-vec4_gs_visitor::make_reg_for_system_value(int location,
-   const glsl_type *type)
+vec4_gs_visitor::make_reg_for_system_value(int location)
 {
-   dst_reg *reg = new(mem_ctx) dst_reg(this, type);
+   dst_reg *reg = new(mem_ctx) dst_reg(this, glsl_type::int_type);
 
switch (location) {
case SYSTEM_VALUE_INVOCATION_ID:
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h 
b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
index 6ca83a9..380d6f7 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
@@ -51,8 +51,7 @@ public:
virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
 
 protected:
-   virtual dst_reg *make_reg_for_system_value(int location,
-  const glsl_type *type);
+   virtual dst_reg *make_reg_for_system_value(int location);
virtual void setup_payload();
virtual void emit_prolog();
virtual void emit_thread_end();
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index c7dc23b..29f52fa 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -60,36 +60,31 @@ 
vec4_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
case nir_intrinsic_load_vertex_id_zero_base:
   reg = _system_values[SYSTEM_VALUE_VERTEX_ID_ZERO_BASE];
   if 

Mesa (master): glsl/linker: Silence unused parameter warning

2016-05-18 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 75c9aa6670d60b592f58ed1437549959aeccfd6e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=75c9aa6670d60b592f58ed1437549959aeccfd6e

Author: Ian Romanick 
Date:   Tue May 17 13:54:09 2016 -0700

glsl/linker: Silence unused parameter warning

The parameter appears to have been unused since the function was added
in commit 12ba6cfb.  Remove it.

glsl/linker.cpp:2886:60: warning: unused parameter ‘prog’ [-Wunused-parameter]
 match_explicit_outputs_to_inputs(struct gl_shader_program *prog,
^

Signed-off-by: Ian Romanick 
Reviewed-by: Timothy Arceri 

---

 src/compiler/glsl/linker.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 70c6317..586e2b2 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -2883,8 +2883,7 @@ assign_attribute_or_color_locations(gl_shader_program 
*prog,
  * unmatch flag if found so we don't optimise them away.
  */
 static void
-match_explicit_outputs_to_inputs(struct gl_shader_program *prog,
- gl_shader *producer,
+match_explicit_outputs_to_inputs(gl_shader *producer,
  gl_shader *consumer)
 {
glsl_symbol_table parameters;
@@ -4679,7 +4678,7 @@ link_shaders(struct gl_context *ctx, struct 
gl_shader_program *prog)
   if (prog->_LinkedShaders[i] == NULL)
  continue;
 
-  match_explicit_outputs_to_inputs(prog, prog->_LinkedShaders[prev],
+  match_explicit_outputs_to_inputs(prog->_LinkedShaders[prev],
prog->_LinkedShaders[i]);
   prev = i;
}

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


Mesa (master): mesa: Don't advertise GLES 3.1 without compute support

2016-05-18 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 1d628ea09df4911e897292186dc8242903c7a502
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d628ea09df4911e897292186dc8242903c7a502

Author: Daniel Scharrer 
Date:   Tue Apr 19 16:57:06 2016 +0200

mesa: Don't advertise GLES 3.1 without compute support

The MaxComputeWorkGroupInvocations constant is used in
compute_version_es2() instead of extensions->ARB_compute_shader
as ES has lower requirements than desktop GL.

Both i965 and gallium set this constant before enabling compute support.

Signed-off-by: Daniel Scharrer 
Signed-off-by: Marek Olšák 

---

 src/mesa/main/context.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 6af02d1..f690799 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -708,7 +708,8 @@ _mesa_init_constants(struct gl_constants *consts, gl_api 
api)
consts->MaxComputeWorkGroupSize[0] = 1024;
consts->MaxComputeWorkGroupSize[1] = 1024;
consts->MaxComputeWorkGroupSize[2] = 64;
-   consts->MaxComputeWorkGroupInvocations = 1024;
+   /* Enables compute support for GLES 3.1 if >= 128 */
+   consts->MaxComputeWorkGroupInvocations = 0;
 
/** GL_ARB_gpu_shader5 */
consts->MinFragmentInterpolationOffset = MIN_FRAGMENT_INTERPOLATION_OFFSET;

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


Mesa (master): mesa/st: don't leak name

2016-05-18 Thread Rob Clark
Module: Mesa
Branch: master
Commit: 5827a1dc4b3c2f51d45f4b1d6ccd080515ed2bcc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5827a1dc4b3c2f51d45f4b1d6ccd080515ed2bcc

Author: Rob Clark 
Date:   Wed May 18 09:19:00 2016 -0400

mesa/st: don't leak name

Pointed out by coverity.

Signed-off-by: Rob Clark 

---

 src/mesa/state_tracker/st_nir_lower_builtin.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_nir_lower_builtin.c 
b/src/mesa/state_tracker/st_nir_lower_builtin.c
index b4da901..20b04d1 100644
--- a/src/mesa/state_tracker/st_nir_lower_builtin.c
+++ b/src/mesa/state_tracker/st_nir_lower_builtin.c
@@ -128,9 +128,12 @@ get_variable(lower_builtin_state *state, nir_deref_var 
*deref,
 
char *name = _mesa_program_state_string((gl_state_index *)tokens);
 
-   nir_foreach_variable(var, >uniforms)
-  if (strcmp(var->name, name) == 0)
+   nir_foreach_variable(var, >uniforms) {
+  if (strcmp(var->name, name) == 0) {
+ free(name);
  return var;
+  }
+   }
 
/* variable doesn't exist yet, so create it: */
nir_variable *var =

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