Mesa (master): st/mesa: disable depth/stencil/alpha tests in PBO upload

2016-02-18 Thread Nicolai Hähnle
Module: Mesa
Branch: master
Commit: d7c4ffd1ee08fa93a138926187f354aded6edde4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7c4ffd1ee08fa93a138926187f354aded6edde4

Author: Nicolai Hähnle 
Date:   Thu Feb 18 14:31:38 2016 -0500

st/mesa: disable depth/stencil/alpha tests in PBO upload

Noticed by Brian Paul.

Reviewed-by: Marek Olšák 

---

 src/mesa/state_tracker/st_cb_texture.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index d09c360..8ee95d2 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1340,6 +1340,7 @@ try_pbo_upload_common(struct gl_context *ctx,
 CSO_BIT_FRAMEBUFFER |
 CSO_BIT_VIEWPORT |
 CSO_BIT_BLEND |
+CSO_BIT_DEPTH_STENCIL_ALPHA |
 CSO_BIT_RASTERIZER |
 CSO_BIT_STREAM_OUTPUTS |
 CSO_BITS_ALL_SHADERS));
@@ -1479,6 +1480,13 @@ try_pbo_upload_common(struct gl_context *ctx,
/* Blend state */
cso_set_blend(cso, >pbo_upload.blend);
 
+   /* Depth/stencil/alpha state */
+   {
+  struct pipe_depth_stencil_alpha_state dsa;
+  memset(, 0, sizeof(dsa));
+  cso_set_depth_stencil_alpha(cso, );
+   }
+
/* Rasterizer state */
cso_set_rasterizer(cso, >pbo_upload.raster);
 

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


Mesa (origin/vulkan/wip/txc): anv/meta_blit: Handle compressed textures in anv_CmdCopyImage

2016-02-18 Thread Nanley Chery
Module: Mesa
Branch: origin/vulkan/wip/txc
Commit: 2f28f3ad51b21ed548c88d31ea04dfc19eb20923
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f28f3ad51b21ed548c88d31ea04dfc19eb20923

Author: Nanley Chery 
Date:   Thu Feb 18 14:05:31 2016 -0800

anv/meta_blit: Handle compressed textures in anv_CmdCopyImage

As with anv_CmdCopyBufferToImage, compressed textures require special
handling during copies.

---

 src/intel/vulkan/anv_meta_blit.c | 62 
 1 file changed, 37 insertions(+), 25 deletions(-)

diff --git a/src/intel/vulkan/anv_meta_blit.c b/src/intel/vulkan/anv_meta_blit.c
index 07ebcbc..06f13ec 100644
--- a/src/intel/vulkan/anv_meta_blit.c
+++ b/src/intel/vulkan/anv_meta_blit.c
@@ -696,31 +696,34 @@ void anv_CmdCopyImage(
  },
  cmd_buffer, 0);
 
-  const VkOffset3D dest_offset = {
- .x = pRegions[r].dstOffset.x,
- .y = pRegions[r].dstOffset.y,
- .z = 0,
-  };
-
-  unsigned num_slices;
-  if (src_image->type == VK_IMAGE_TYPE_3D) {
- assert(pRegions[r].srcSubresource.layerCount == 1 &&
-pRegions[r].dstSubresource.layerCount == 1);
- num_slices = pRegions[r].extent.depth;
-  } else {
- assert(pRegions[r].srcSubresource.layerCount ==
-pRegions[r].dstSubresource.layerCount);
- assert(pRegions[r].extent.depth == 1);
- num_slices = pRegions[r].dstSubresource.layerCount;
-  }
-
   const uint32_t dest_base_array_slice =
  anv_meta_get_iview_layer(dest_image, [r].dstSubresource,
   [r].dstOffset);
 
-  for (unsigned slice = 0; slice < num_slices; slice++) {
+
+  unsigned num_slices_3d = pRegions[r].extent.depth;
+  unsigned num_slices_array = pRegions[r].dstSubresource.layerCount;
+  unsigned slice_3d = 0;
+  unsigned slice_array = 0;
+  while (slice_3d < num_slices_3d && slice_array < num_slices_array) {
  VkOffset3D src_offset = pRegions[r].srcOffset;
- src_offset.z += slice;
+ src_offset.z += slice_3d + slice_array;
+
+ uint32_t img_x = 0;
+ uint32_t img_y = 0;
+ uint32_t img_o = 0;
+ if (isl_format_is_compressed(dest_image->format->isl_format))
+
isl_surf_get_image_intratile_offset_el(_buffer->device->isl_dev,
+   
_image->color_surface.isl,
+   
pRegions[r].dstSubresource.mipLevel,
+   
pRegions[r].dstSubresource.baseArrayLayer + slice_array,
+   pRegions[r].dstOffset.z + 
slice_3d,
+   _o, _x, _y);
+
+ VkOffset3D dest_offset_el = meta_region_offset_el(dest_image, 
[r].dstOffset);
+ dest_offset_el.x += img_x;
+ dest_offset_el.y += img_y;
+ dest_offset_el.z = 0;
 
  struct anv_image_view dest_iview;
  anv_image_view_init(_iview, cmd_buffer->device,
@@ -733,20 +736,29 @@ void anv_CmdCopyImage(
   .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
   .baseMipLevel = pRegions[r].dstSubresource.mipLevel,
   .levelCount = 1,
-  .baseArrayLayer = dest_base_array_slice + slice,
+  .baseArrayLayer = dest_base_array_slice +
+slice_array + slice_3d,
   .layerCount = 1
},
 },
-cmd_buffer, 0);
+cmd_buffer, img_o);
+
+ const VkExtent3D img_extent_el = 
meta_region_extent_el(dest_image->vk_format,
+
[r].extent);
 
  meta_emit_blit(cmd_buffer,
 src_image, _iview,
 src_offset,
-pRegions[r].extent,
+img_extent_el,
 dest_image, _iview,
-dest_offset,
-pRegions[r].extent,
+dest_offset_el,
+img_extent_el,
 VK_FILTER_NEAREST);
+
+ if (dest_image->type == VK_IMAGE_TYPE_3D)
+slice_3d++;
+ else
+slice_array++;
   }
}
 

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


Mesa (master): svga: allow non-contiguous VS input declarations

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

Author: Brian Paul 
Date:   Thu Feb 18 08:41:16 2016 -0700

svga: allow non-contiguous VS input declarations

This fixes a glDrawPixels regression since b63fe0552b5f.  The new
quad-drawing utility code uses 3 vertex attributes (xyz, rgba, st).
For glDrawPixels path we don't use the rgba attribute so there's a
gap in the TGSI VS input declarations (INPUT[0] = pos, INPUT[2] =
texcoord).  The TGSI->VGPU10 translations code did not handle this
correctly.  I missed this because my VM was configured for HWv11
while testing.

Another way to fix this would be to change the tgsi_scan.c code so
that the tgsi_shader_info::num_inputs (and num_outputs) included
the unused inputs/outputs.  These counts would then actually be
"max input register index + 1" rather than "number of used inputs".
But that change could impact all drivers so put it off for now.

No regressions found with piglit or typical GL apps.

v2: also update alloc_system_value_index() to use info.file_max[]

Reviewed-by: Charmaine Lee 

---

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

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 1223e44..0c5afeb 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -1782,7 +1782,7 @@ alloc_immediate_int4(struct svga_shader_emitter_v10 *emit,
 static unsigned
 alloc_system_value_index(struct svga_shader_emitter_v10 *emit, unsigned index)
 {
-   const unsigned n = emit->info.num_inputs + index;
+   const unsigned n = emit->info.file_max[TGSI_FILE_INPUT] + 1 + index;
assert(index < Elements(emit->system_value_indexes));
emit->system_value_indexes[index] = n;
return n;
@@ -2446,7 +2446,7 @@ emit_input_declarations(struct svga_shader_emitter_v10 
*emit)
else {
   assert(emit->unit == PIPE_SHADER_VERTEX);
 
-  for (i = 0; i < emit->info.num_inputs; i++) {
+  for (i = 0; i < emit->info.file_max[TGSI_FILE_INPUT] + 1; i++) {
  unsigned usage_mask = emit->info.input_usage_mask[i];
  unsigned index = i;
 

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


Mesa (master): gallivm: Check whether to stop disassemble only for x86

2016-02-18 Thread Oded Gabbay
Module: Mesa
Branch: master
Commit: a3e3c3e621a457866e141a18aba094e6e694bd45
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3e3c3e621a457866e141a18aba094e6e694bd45

Author: Oded Gabbay 
Date:   Thu Feb 18 16:39:06 2016 +0200

gallivm: Check whether to stop disassemble only for x86

Because the if statement that checks whether we have a return
statement is valid only on x86, surround it with X86 or X86-64
arch defines

Signed-off-by: Oded Gabbay 
Reviewed-by: Jose Fonseca 
Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
index 7e98f1a..efaf2fa 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
@@ -200,9 +200,11 @@ disassemble(const void* func, std::stringstream )
* XXX: This currently assumes x86
*/
 
+#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
   if (Size == 1 && bytes[pc] == 0xc3) {
  break;
   }
+#endif
 
   /*
* Advance.

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


Mesa (master): gallivm: use sstream for dissasembling

2016-02-18 Thread Oded Gabbay
Module: Mesa
Branch: master
Commit: b3d42934a1cc4ac47367ea632e7467c2ada46aff
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3d42934a1cc4ac47367ea632e7467c2ada46aff

Author: Oded Gabbay 
Date:   Thu Feb 18 15:53:23 2016 +0200

gallivm: use sstream for dissasembling

Currently, disassemble() directly prints to stdout. This has broke the
profiling support for llvmpipe JIT code.

This patch redirects the output to an sstream object, which is then
either gets printed to stdout (for assembly debugging) or gets written
to a file in /tmp/ (for profiling support).

Signed-off-by: Oded Gabbay 
Reviewed-by: Jose Fonseca 
Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 51 +++---
 1 file changed, 30 insertions(+), 21 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
index 7283e2f..7e98f1a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
@@ -26,6 +26,9 @@
  **/
 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -125,7 +128,7 @@ lp_debug_dump_value(LLVMValueRef value)
  * - http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html
  */
 static size_t
-disassemble(const void* func)
+disassemble(const void* func, std::stringstream )
 {
const uint8_t *bytes = (const uint8_t *)func;
 
@@ -143,8 +146,8 @@ disassemble(const void* func)
char outline[1024];
 
if (!D) {
-  _debug_printf("error: couldn't create disassembler for triple %s\n",
-Triple.c_str());
+  buffer << "error: could not create disassembler for triple "
+ << Triple.c_str() << '\n';
   return 0;
}
 
@@ -158,13 +161,13 @@ disassemble(const void* func)
* so that between runs.
*/
 
-  _debug_printf("%6lu:\t", (unsigned long)pc);
+  buffer << std::setw(6) << (unsigned long)pc << ":\t";
 
   Size = LLVMDisasmInstruction(D, (uint8_t *)bytes + pc, extent - pc, 0, 
outline,
sizeof outline);
 
   if (!Size) {
- _debug_printf("invalid\n");
+ buffer << "invalid\n";
  pc += 1;
  break;
   }
@@ -176,10 +179,11 @@ disassemble(const void* func)
   if (0) {
  unsigned i;
  for (i = 0; i < Size; ++i) {
-_debug_printf("%02x ", bytes[pc + i]);
+buffer << std::hex << std::setfill('0') << std::setw(2)
+   << static_cast (bytes[pc + i]);
  }
  for (; i < 16; ++i) {
-_debug_printf("   ");
+buffer << std::dec << "   ";
  }
   }
 
@@ -187,9 +191,7 @@ disassemble(const void* func)
* Print the instruction.
*/
 
-  _debug_printf("%*s", Size, outline);
-
-  _debug_printf("\n");
+  buffer << std::setw(Size) << outline << '\n';
 
   /*
* Stop disassembling on return statements, if there is no record of a
@@ -209,12 +211,12 @@ disassemble(const void* func)
   pc += Size;
 
   if (pc >= extent) {
- _debug_printf("disassembly larger than %ull bytes, aborting\n", 
extent);
+ buffer << "disassembly larger than " << extent << " bytes, 
aborting\n";
  break;
   }
}
 
-   _debug_printf("\n");
+   buffer << '\n';
 
LLVMDisasmDispose(D);
 
@@ -222,7 +224,8 @@ disassemble(const void* func)
 * Print GDB command, useful to verify output.
 */
if (0) {
-  _debug_printf("disassemble %p %p\n", bytes, bytes + pc);
+  buffer << "disassemble " << static_cast(bytes) << ' '
+ << static_cast(bytes + pc) << '\n';
}
 
return pc;
@@ -231,8 +234,14 @@ disassemble(const void* func)
 
 extern "C" void
 lp_disassemble(LLVMValueRef func, const void *code) {
-   _debug_printf("%s:\n", LLVMGetValueName(func));
-   disassemble(code);
+   std::stringstream buffer;
+   std::string s;
+
+   buffer << LLVMGetValueName(func) << ":\n";
+   disassemble(code, buffer);
+   s = buffer.str();
+   _debug_printf("%s", s.c_str());
+   _debug_printf("\n");
 }
 
 
@@ -248,9 +257,10 @@ extern "C" void
 lp_profile(LLVMValueRef func, const void *code)
 {
 #if defined(__linux__) && defined(PROFILE)
+   std::stringstream buffer;
+   static std::ofstream perf_asm_file;
static boolean first_time = TRUE;
static FILE *perf_map_file = NULL;
-   static int perf_asm_fd = -1;
if (first_time) {
   /*
* We rely on the disassembler for determining a function's size, but
@@ -264,17 +274,16 @@ lp_profile(LLVMValueRef func, const void *code)
  util_snprintf(filename, sizeof filename, "/tmp/perf-%llu.map", 
(unsigned long long)pid);
  perf_map_file = fopen(filename, "wt");
  util_snprintf(filename, sizeof filename, 

Mesa (master): trace: fix new gcc6 warnings

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

Author: Rob Clark 
Date:   Tue Feb 16 13:01:03 2016 -0500

trace: fix new gcc6 warnings

src/gallium/drivers/trace/tr_context.c:1713:39: warning: ‘rbug_blocker_flags’ 
defined but not used [-Wunused-const-variable]
 static const struct debug_named_value rbug_blocker_flags[] = {
   ^~

Note that use of rbug_blocker_flags was removed in:

commit 5494332128da0b2826e85df5eeaa878bb5c30a4e
Author: Jakob Bornecrantz 
Date:   Wed May 12 19:26:19 2010 +0100

trace: Remove rbug from trace

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/trace/tr_context.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/src/gallium/drivers/trace/tr_context.c 
b/src/gallium/drivers/trace/tr_context.c
index 46936c1..0028377 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -1709,13 +1709,6 @@ static void trace_context_launch_grid(struct 
pipe_context *_pipe,
trace_dump_call_end();
 }
 
-
-static const struct debug_named_value rbug_blocker_flags[] = {
-   {"before", 1, NULL},
-   {"after", 2, NULL},
-   DEBUG_NAMED_VALUE_END
-};
-
 struct pipe_context *
 trace_context_create(struct trace_screen *tr_scr,
  struct pipe_context *pipe)

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


Mesa (master): i965: fix new gcc6 warnings

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

Author: Rob Clark 
Date:   Tue Feb 16 13:18:44 2016 -0500

i965: fix new gcc6 warnings

src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp:244:1: warning:
‘void {anonymous}::fs_copy_prop_dataflow::dump_block_data() const’ defined but 
not used [-Wunused-function]
 fs_copy_prop_dataflow::dump_block_data() const
 ^

From looking at git history, it looks like this is intended to be unused
(ie. just for adding on-demand debug prints)

Signed-off-by: Rob Clark 
Reviewed-by: Ian Romanick 

---

 src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index fd25307..9dbe13d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -87,7 +87,7 @@ public:
void setup_initial_values();
void run();
 
-   void dump_block_data() const;
+   void dump_block_data() const UNUSED;
 
void *mem_ctx;
cfg_t *cfg;

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


Mesa (master): mesa: fix new gcc6 warnings

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

Author: Rob Clark 
Date:   Tue Feb 16 13:42:41 2016 -0500

mesa: fix new gcc6 warnings

src/mesa/main/texstore.c:92:22: warning: ‘map_1032’ defined but not used 
[-Wunused-const-variable]
 static const GLubyte map_1032[6] = { 1, 0, 3, 2, ZERO, ONE };
  ^~~~
src/mesa/main/texstore.c:91:22: warning: ‘map_3210’ defined but not used 
[-Wunused-const-variable]
 static const GLubyte map_3210[6] = { 3, 2, 1, 0, ZERO, ONE };
  ^~~~
src/mesa/main/texstore.c:90:22: warning: ‘map_identity’ defined but not used 
[-Wunused-const-variable]
 static const GLubyte map_identity[6] = { 0, 1, 2, 3, ZERO, ONE };
  ^~~~

These appear to be unused since:

commit 8ec6534b266549cdc2798e2523bf6753924f6cde
Author: Iago Toral Quiroga 
AuthorDate: Wed Oct 15 13:42:11 2014 +0200

mesa: Use _mesa_format_convert to implement texstore_rgba.

Signed-off-by: Rob Clark 
Reviewed-by: Ian Romanick 

---

 src/mesa/main/texstore.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index d767173..c33b109 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -87,9 +87,6 @@ enum {
  * Texture image storage function.
  */
 typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS);
-static const GLubyte map_identity[6] = { 0, 1, 2, 3, ZERO, ONE };
-static const GLubyte map_3210[6] = { 3, 2, 1, 0, ZERO, ONE };
-static const GLubyte map_1032[6] = { 1, 0, 3, 2, ZERO, ONE };
 
 
 /**

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


Mesa (master): gallium/auxiliary: fix new gcc6 warnings

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

Author: Rob Clark 
Date:   Tue Feb 16 12:54:03 2016 -0500

gallium/auxiliary: fix new gcc6 warnings

src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c: In function 
‘mm_bufmgr_create_from_buffer’:
src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c:288:4:
warning: statement is indented as if it were guarded by... 
[-Wmisleading-indentation]
if(mm->map)
^~
src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c:286:1: note:
...this ‘if’ clause, but it is not
 if(mm->heap)
 ^~

Signed-off-by: Rob Clark 

---

 src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c 
b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index 14de61b..023a028 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
@@ -283,8 +283,8 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
return SUPER(mm);

 failure:
-if(mm->heap)
-   u_mmDestroy(mm->heap);
+   if(mm->heap)
+  u_mmDestroy(mm->heap);
if(mm->map)
   pb_unmap(mm->buffer);
FREE(mm);

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


Mesa (master): util: fix new gcc6 warnings

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

Author: Rob Clark 
Date:   Tue Feb 16 12:45:04 2016 -0500

util: fix new gcc6 warnings

src/util/hash_table.h:111:23: warning: ‘_mesa_fnv32_1a_offset_bias’ defined but 
not used [-Wunused-const-variable]
 static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
   ^~

Signed-off-by: Rob Clark 
Reviewed-by: Ian Romanick 

---

 src/util/hash_table.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/util/hash_table.h b/src/util/hash_table.h
index 85b013c..c69abfa 100644
--- a/src/util/hash_table.h
+++ b/src/util/hash_table.h
@@ -108,7 +108,9 @@ static inline uint32_t _mesa_hash_pointer(const void 
*pointer)
return _mesa_hash_data(, sizeof(pointer));
 }
 
-static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
+enum {
+   _mesa_fnv32_1a_offset_bias = 2166136261u,
+};
 
 static inline uint32_t
 _mesa_fnv32_1a_accumulate_block(uint32_t hash, const void *data, size_t size)

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


Mesa (master): glsl: fix new gcc6 warnings

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

Author: Rob Clark 
Date:   Tue Feb 16 13:31:27 2016 -0500

glsl: fix new gcc6 warnings

src/compiler/glsl/lower_discard_flow.cpp:79:1: warning: ‘ir_visitor_status 
{anonymous}::lower_discard_flow_visitor::visit_enter(ir_loop_jump*)’ defined 
but not used [-Wunused-function]
 lower_discard_flow_visitor::visit_enter(ir_loop_jump *ir)
 ^~

The base class method that was intended to be overridden was
'visit(ir_loop_jump *ir)', not visit_enter().

Signed-off-by: Rob Clark 
Reviewed-by: Ian Romanick 

---

 src/compiler/glsl/lower_discard_flow.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/lower_discard_flow.cpp 
b/src/compiler/glsl/lower_discard_flow.cpp
index 9d0a56b..9e3a7c0 100644
--- a/src/compiler/glsl/lower_discard_flow.cpp
+++ b/src/compiler/glsl/lower_discard_flow.cpp
@@ -62,8 +62,8 @@ public:
{
}
 
+   ir_visitor_status visit(ir_loop_jump *ir);
ir_visitor_status visit_enter(ir_discard *ir);
-   ir_visitor_status visit_enter(ir_loop_jump *ir);
ir_visitor_status visit_enter(ir_loop *ir);
ir_visitor_status visit_enter(ir_function_signature *ir);
 
@@ -76,7 +76,7 @@ public:
 } /* anonymous namespace */
 
 ir_visitor_status
-lower_discard_flow_visitor::visit_enter(ir_loop_jump *ir)
+lower_discard_flow_visitor::visit(ir_loop_jump *ir)
 {
if (ir->mode != ir_loop_jump::jump_continue)
   return visit_continue;

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


Mesa (master): gallium/hud: fix new gcc6 warnings

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

Author: Rob Clark 
Date:   Tue Feb 16 12:50:27 2016 -0500

gallium/hud: fix new gcc6 warnings

src/gallium/auxiliary/hud/font.c:234:22: warning: ‘Fixed8x13_Character_159’ 
defined but not used [-Wunused-const-variable]
 static const GLubyte Fixed8x13_Character_159[] = {  9,  0,  0,  0,  0, 0,  
0,170,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,130,  0,  0, 0,170,  0,  0,  
0,  0,  0};
  ^~~
 many more..

These are simply unused, just #if 0 them out for now, in case someone
wants to use them in the future.

Signed-off-by: Rob Clark 

---

 src/gallium/auxiliary/hud/font.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/auxiliary/hud/font.c b/src/gallium/auxiliary/hud/font.c
index 60e8ae5..067de9e 100644
--- a/src/gallium/auxiliary/hud/font.c
+++ b/src/gallium/auxiliary/hud/font.c
@@ -199,6 +199,7 @@ static const GLubyte Fixed8x13_Character_123[] = {  8,  0,  
0,  0, 14, 16, 16,
 static const GLubyte Fixed8x13_Character_124[] = {  8,  0,  0,  0, 16, 16, 16, 
16, 16, 16, 16, 16, 16,  0,  0};
 static const GLubyte Fixed8x13_Character_125[] = {  8,  0,  0,  0,112,  8,  8, 
16, 12, 16,  8,  8,112,  0,  0};
 static const GLubyte Fixed8x13_Character_126[] = {  8,  0,  0,  0,  0,  0,  0, 
 0,  0,  0, 72, 84, 36,  0,  0};
+#if 0 /* currently unused */
 static const GLubyte Fixed8x13_Character_127[] = {  9,  0,  0,  0,  0,  0,  
0,170,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,170,  0,  0,  
0,  0,  0};
 static const GLubyte Fixed8x13_Character_128[] = {  9,  0,  0,  0,  0,  0,  
0,170,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,170,  0,  0,  
0,  0,  0};
 static const GLubyte Fixed8x13_Character_129[] = {  9,  0,  0,  0,  0,  0,  
0,170,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,170,  0,  0,  
0,  0,  0};
@@ -232,6 +233,7 @@ static const GLubyte Fixed8x13_Character_156[] = {  9,  0,  
0,  0,  0,  0,  0,17
 static const GLubyte Fixed8x13_Character_157[] = {  9,  0,  0,  0,  0,  0,  
0,170,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,170,  0,  0,  
0,  0,  0};
 static const GLubyte Fixed8x13_Character_158[] = {  9,  0,  0,  0,  0,  0,  
0,170,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,170,  0,  0,  
0,  0,  0};
 static const GLubyte Fixed8x13_Character_159[] = {  9,  0,  0,  0,  0,  0,  
0,170,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,130,  0,  0,  0,170,  0,  0,  
0,  0,  0};
+#endif
 static const GLubyte Fixed8x13_Character_160[] = {  8,  0,  0,  0,  0,  0,  0, 
 0,  0,  0,  0,  0,  0,  0,  0};
 static const GLubyte Fixed8x13_Character_161[] = {  8,  0,  0,  0, 16, 16, 16, 
16, 16, 16, 16,  0, 16,  0,  0};
 static const GLubyte Fixed8x13_Character_162[] = {  8,  0,  0,  0,  0, 16, 56, 
84, 80, 80, 84, 56, 16,  0,  0};

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


Mesa (master): glsl: fix new gcc6 warnings

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

Author: Rob Clark 
Date:   Tue Feb 16 13:35:58 2016 -0500

glsl: fix new gcc6 warnings

src/compiler/glsl/ast_to_hir.cpp: In function ‘unsigned int 
ast_process_struct_or_iface_block_members(exec_list*, _mesa_glsl_parse_state*, 
exec_list*, glsl_struct_field**, bool, glsl_matrix_layout, bool, 
ir_variable_mode, ast_type_qualifier*,
unsigned int, unsigned int)’:
src/compiler/glsl/ast_to_hir.cpp:6339:52: warning: 
‘first_member_has_explicit_location’ may be used uninitialized in this function 
[-Wmaybe-uninitialized]
 if (!layout->flags.q.explicit_location &&
 ~~~^~
 ((first_member_has_explicit_location &&
 ~~~
   !qual->flags.q.explicit_location) ||
   
  (!first_member_has_explicit_location &&
  ~~~
   qual->flags.q.explicit_location))) {
   ~

Signed-off-by: Rob Clark 
Reviewed-by: Ian Romanick 

---

 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 36cdd3c..75abef6 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -6267,7 +6267,7 @@ ast_process_struct_or_iface_block_members(exec_list 
*instructions,
   decl_count);
 
bool first_member = true;
-   bool first_member_has_explicit_location;
+   bool first_member_has_explicit_location = false;
 
unsigned i = 0;
foreach_list_typed (ast_declarator_list, decl_list, link, declarations) {

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


Mesa (vulkan): anv/allocator: Set is_winsys_bo to false for block pool BOs

2016-02-18 Thread Jason Ekstrand
Module: Mesa
Branch: vulkan
Commit: d5bb23156d698675fff74b1e8207ce0217c148db
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d5bb23156d698675fff74b1e8207ce0217c148db

Author: Jason Ekstrand 
Date:   Thu Feb 18 13:37:01 2016 -0800

anv/allocator: Set is_winsys_bo to false for block pool BOs

---

 src/intel/vulkan/anv_allocator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index a7ae975..3b62bda 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -253,6 +253,7 @@ anv_block_pool_init(struct anv_block_pool *pool,
pool->bo.gem_handle = 0;
pool->bo.offset = 0;
pool->bo.size = 0;
+   pool->bo.is_winsys_bo = false;
pool->block_size = block_size;
pool->free_list = ANV_FREE_LIST_EMPTY;
pool->back_free_list = ANV_FREE_LIST_EMPTY;

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


Mesa (vulkan): anv/pipeline: Fix a typo in the pipeline layout code

2016-02-18 Thread Jason Ekstrand
Module: Mesa
Branch: vulkan
Commit: 698ea542830ba0d56e514492fbdf73e3898d4c17
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=698ea542830ba0d56e514492fbdf73e3898d4c17

Author: Jason Ekstrand 
Date:   Thu Feb 18 13:54:15 2016 -0800

anv/pipeline: Fix a typo in the pipeline layout code

---

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

diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c 
b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
index 4be630b..e745bf6 100644
--- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
@@ -194,7 +194,7 @@ lower_tex(nir_tex_instr *tex, struct 
apply_pipeline_layout_state *state)
if (tex->sampler) {
   unsigned set = tex->sampler->var->data.descriptor_set;
   unsigned binding = tex->sampler->var->data.binding;
-  tex->sampler_index = state->set[set].surface_offsets[binding];
+  tex->sampler_index = state->set[set].sampler_offsets[binding];
   lower_tex_deref(tex, tex->sampler, >sampler_index,
   nir_tex_src_sampler_offset, state);
}

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


Mesa (master): glcpp: Disallow "defined" as a macro name.

2016-02-18 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 1c694a6c20da21f31c584fd41d28e2f03522617d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c694a6c20da21f31c584fd41d28e2f03522617d

Author: Kenneth Graunke 
Date:   Wed Feb 17 17:15:23 2016 -0800

glcpp: Disallow "defined" as a macro name.

Both GCC and Clang disallow this, and glslang has recently started
disallowing it as well.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94188
Signed-off-by: Kenneth Graunke 
Reviewed-by: Matt Turner 
Reviewed-by: Ian Romanick 

---

 src/compiler/glsl/glcpp/glcpp-parse.y | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y 
b/src/compiler/glsl/glcpp/glcpp-parse.y
index 43a1aa9..70951a0 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -2096,6 +2096,9 @@ _check_for_reserved_macro_name (glcpp_parser_t *parser, 
YYLTYPE *loc,
if (strncmp(identifier, "GL_", 3) == 0) {
glcpp_error (loc, parser, "Macro names starting with \"GL_\" 
are reserved.\n");
}
+   if (strcmp(identifier, "defined") == 0) {
+   glcpp_error (loc, parser, "\"defined\" cannot be used as a 
macro name");
+   }
 }
 
 static int

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


Mesa (vulkan): vulkan: fix out-of-tree build

2016-02-18 Thread Mark Janes
Module: Mesa
Branch: vulkan
Commit: 1b37276467e47919256c0a171b92004d3cfaaab4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b37276467e47919256c0a171b92004d3cfaaab4

Author: Mark Janes 
Date:   Thu Feb 18 12:30:27 2016 -0800

vulkan: fix out-of-tree build

We need to be able to find the generated gen*pack.h headers.

Acked-by: Jason Ekstrand 

---

 src/intel/vulkan/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 2144e5a..ccd9885 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -65,6 +65,7 @@ AM_CPPFLAGS = \
-I$(top_builddir)/src \
-I$(top_builddir)/src/compiler \
-I$(top_builddir)/src/compiler/nir \
+   -I$(top_builddir)/src/intel \
-I$(top_builddir)/src/vulkan
 
 libvulkan_intel_la_CFLAGS = $(CFLAGS) -Wno-override-init

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


Mesa (vulkan): nir/gather_info: Count textures and images

2016-02-18 Thread Jason Ekstrand
Module: Mesa
Branch: vulkan
Commit: 79c0781f44af2a93473c68cf317bb6844f31cfc8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=79c0781f44af2a93473c68cf317bb6844f31cfc8

Author: Jason Ekstrand 
Date:   Thu Feb 18 11:42:36 2016 -0800

nir/gather_info: Count textures and images

---

 src/compiler/nir/nir_gather_info.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/src/compiler/nir/nir_gather_info.c 
b/src/compiler/nir/nir_gather_info.c
index b84915c..8f0abd3 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -105,5 +105,22 @@ nir_shader_gather_info(nir_shader *shader, 
nir_function_impl *entrypoint)
foreach_list_typed(nir_variable, var, node, >system_values)
   shader->info.system_values_read |= nir_variable_get_io_mask(var, 
shader->stage);
 
+   shader->info.num_textures = 0;
+   shader->info.num_images = 0;
+   nir_foreach_variable(var, >uniforms) {
+  const struct glsl_type *type = var->type;
+  unsigned count = 1;
+  if (glsl_type_is_array(type)) {
+ count = glsl_get_length(type);
+ type = glsl_get_array_element(type);
+  }
+
+  if (glsl_type_is_image(type)) {
+ shader->info.num_images += count;
+  } else if (glsl_type_is_sampler(type)) {
+ shader->info.num_textures += count;
+  }
+   }
+
nir_foreach_block(entrypoint, gather_info_block, shader);
 }

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


Mesa (vulkan): anv/pipeline: Don't leak the binding map

2016-02-18 Thread Jason Ekstrand
Module: Mesa
Branch: vulkan
Commit: e881c73975cb12ce58d4ebc362c6ad18a8e4b3ca
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e881c73975cb12ce58d4ebc362c6ad18a8e4b3ca

Author: Jason Ekstrand 
Date:   Thu Feb 18 11:04:53 2016 -0800

anv/pipeline: Don't leak the binding map

---

 src/intel/vulkan/anv_nir_apply_pipeline_layout.c | 2 ++
 src/intel/vulkan/anv_pipeline.c  | 5 +
 src/intel/vulkan/genX_pipeline.c | 1 +
 3 files changed, 8 insertions(+)

diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c 
b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
index c58a938..4600872 100644
--- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
@@ -391,4 +391,6 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
 
   shader->num_uniforms += map.image_count * BRW_IMAGE_PARAM_SIZE * 4;
}
+
+   ralloc_free(mem_ctx);
 }
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index a7feefb..2f1ce39 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -193,6 +193,11 @@ void anv_DestroyPipeline(
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_pipeline, pipeline, _pipeline);
 
+   for (unsigned s = 0; s < MESA_SHADER_STAGES; s++) {
+  free(pipeline->bindings[s].surface_to_descriptor);
+  free(pipeline->bindings[s].sampler_to_descriptor);
+   }
+
anv_reloc_list_finish(>batch_relocs,
  pAllocator ? pAllocator : >alloc);
if (pipeline->blend_state.map)
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 4c2e0bc..54ec8307 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -72,6 +72,7 @@ genX(compute_pipeline_create)(
 */
memset(pipeline->prog_data, 0, sizeof(pipeline->prog_data));
memset(pipeline->scratch_start, 0, sizeof(pipeline->scratch_start));
+   memset(pipeline->bindings, 0, sizeof(pipeline->bindings));
 
pipeline->vs_simd8 = NO_KERNEL;
pipeline->vs_vec4 = NO_KERNEL;

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


Mesa (vulkan): anv/pipeline: Use nir' s num_images for allocating image_params

2016-02-18 Thread Jason Ekstrand
Module: Mesa
Branch: vulkan
Commit: e0565f40ea7f1653318a3e33cfeb46dcdbfd28ae
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0565f40ea7f1653318a3e33cfeb46dcdbfd28ae

Author: Jason Ekstrand 
Date:   Thu Feb 18 11:44:26 2016 -0800

anv/pipeline: Use nir's num_images for allocating image_params

---

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

diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c 
b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
index 4600872..4be630b 100644
--- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
@@ -280,6 +280,7 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
struct anv_pipeline_bind_map map = {
   .surface_count = 0,
   .sampler_count = 0,
+  .image_count = 0,
};
 
for (uint32_t set = 0; set < layout->num_sets; set++) {
@@ -351,6 +352,7 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
}
 
if (map.image_count > 0) {
+  assert(map.image_count <= MAX_IMAGES);
   nir_foreach_variable(var, >uniforms) {
  if (glsl_type_is_image(var->type) ||
  (glsl_type_is_array(var->type) &&
@@ -369,7 +371,8 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
   }
 
   struct anv_push_constants *null_data = NULL;
-  const gl_constant_value **param = prog_data->param + 
shader->num_uniforms;
+  const gl_constant_value **param =
+ prog_data->param + (shader->num_uniforms / 4);
   const struct brw_image_param *image_param = null_data->images;
   for (uint32_t i = 0; i < map.image_count; i++) {
  setup_vec4_uniform_value(param + BRW_IMAGE_PARAM_SURFACE_IDX_OFFSET,
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 2f1ce39..27872d2 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -341,9 +341,8 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
if (pipeline->layout && pipeline->layout->stage[stage].has_dynamic_offsets)
   prog_data->nr_params += MAX_DYNAMIC_BUFFERS * 2;
 
-   if (pipeline->bindings[stage].image_count > 0)
-  prog_data->nr_params += pipeline->bindings[stage].image_count *
-  BRW_IMAGE_PARAM_SIZE;
+   if (nir->info.num_images > 0)
+  prog_data->nr_params += nir->info.num_images * BRW_IMAGE_PARAM_SIZE;
 
if (prog_data->nr_params > 0) {
   /* XXX: I think we're leaking this */

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


Mesa (master): gallium/cso: only enable compute shaders when TGSI is supported

2016-02-18 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: dfc95ad6d129436a3d2383152583919fb2dde261
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dfc95ad6d129436a3d2383152583919fb2dde261

Author: Samuel Pitoiset 
Date:   Thu Feb 18 00:18:29 2016 +0100

gallium/cso: only enable compute shaders when TGSI is supported

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94186
Signed-off-by: Samuel Pitoiset 
Reviewed-by: Marek Olšák 

---

 src/gallium/auxiliary/cso_cache/cso_context.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c 
b/src/gallium/auxiliary/cso_cache/cso_context.c
index 8cfb674..f0013f7 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -278,7 +278,12 @@ struct cso_context *cso_create_context( struct 
pipe_context *pipe )
}
if (pipe->screen->get_shader_param(pipe->screen, PIPE_SHADER_COMPUTE,
   PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
-  ctx->has_compute_shader = TRUE;
+  int supported_irs =
+ pipe->screen->get_shader_param(pipe->screen, PIPE_SHADER_COMPUTE,
+PIPE_SHADER_CAP_SUPPORTED_IRS);
+  if (supported_irs & (1 << PIPE_SHADER_IR_TGSI)) {
+ ctx->has_compute_shader = TRUE;
+  }
}
if (pipe->screen->get_param(pipe->screen,
PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS) != 0) {

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


Mesa (vulkan): anv/formats: Don' t use a compound literal to initialize a const array

2016-02-18 Thread Jason Ekstrand
Module: Mesa
Branch: vulkan
Commit: 8c23392c26916711b7b02337fd342ee9765b6fd4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c23392c26916711b7b02337fd342ee9765b6fd4

Author: Jason Ekstrand 
Date:   Thu Feb 18 10:44:06 2016 -0800

anv/formats: Don't use a compound literal to initialize a const array

Doing so makes older versions of GCC rather grumpy.  Newere GCC fixes this,
but using a compound literal isn't really gaining us anything anyway.

---

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

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 7798a7b..b4b52aa 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -24,8 +24,8 @@
 #include "anv_private.h"
 #include "brw_surface_formats.h"
 
-#define RGBA ((struct anv_format_swizzle) { 0, 1, 2, 3 })
-#define BGRA ((struct anv_format_swizzle) { 2, 1, 0, 3 })
+#define RGBA { 0, 1, 2, 3 }
+#define BGRA { 2, 1, 0, 3 }
 
 #define swiz_fmt(__vk_fmt, __hw_fmt, __swizzle, ...) \
[__vk_fmt] = { \

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


Mesa (vulkan): vulkan: Move XML and generator into src/intel/genxml

2016-02-18 Thread Jason Ekstrand
Module: Mesa
Branch: vulkan
Commit: f6d95876888c81559d4ba773e4e6c82b184e708e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6d95876888c81559d4ba773e4e6c82b184e708e

Author: Jason Ekstrand 
Date:   Thu Feb 18 10:19:02 2016 -0800

vulkan: Move XML and generator into src/intel/genxml

---

 configure.ac|  2 ++
 src/Makefile.am |  1 +
 src/intel/Makefile.am   | 22 ++
 src/intel/genxml/.gitignore |  1 +
 src/intel/genxml/Makefile.am| 31 +
 src/{vulkan => intel/genxml}/gen7.xml   |  0
 src/{vulkan => intel/genxml}/gen75.xml  |  0
 src/{vulkan => intel/genxml}/gen8.xml   |  0
 src/{vulkan => intel/genxml}/gen9.xml   |  0
 src/{vulkan => intel/genxml}/gen_pack_header.py |  0
 src/vulkan/Makefile.am  | 10 ++--
 src/vulkan/anv_batch_chain.c|  4 ++--
 src/vulkan/anv_device.c |  2 +-
 src/vulkan/anv_formats.c|  2 --
 src/vulkan/gen7_cmd_buffer.c|  4 ++--
 src/vulkan/gen7_pipeline.c  |  4 ++--
 src/vulkan/gen7_state.c |  4 ++--
 src/vulkan/gen8_cmd_buffer.c|  4 ++--
 src/vulkan/gen8_pipeline.c  |  4 ++--
 src/vulkan/gen8_state.c |  4 ++--
 src/vulkan/genX_cmd_buffer.c|  8 +++
 src/vulkan/genX_pipeline.c  |  8 +++
 22 files changed, 82 insertions(+), 33 deletions(-)

diff --git a/configure.ac b/configure.ac
index 71bec62..d6692b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2518,6 +2518,8 @@ AC_CONFIG_FILES([Makefile
src/glx/apple/Makefile
src/glx/tests/Makefile
src/gtest/Makefile
+   src/intel/Makefile
+   src/intel/genxml/Makefile
src/isl/Makefile
src/loader/Makefile
src/mapi/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 272e68c..25b48c6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,6 +57,7 @@ AM_CFLAGS = $(VISIBILITY_CFLAGS)
 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
 
 if HAVE_VULKAN
+SUBDIRS += intel
 SUBDIRS += isl
 SUBDIRS += vulkan
 endif
diff --git a/src/intel/Makefile.am b/src/intel/Makefile.am
new file mode 100644
index 000..0a6f411
--- /dev/null
+++ b/src/intel/Makefile.am
@@ -0,0 +1,22 @@
+# Copyright © 2016 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+SUBDIRS = genxml
diff --git a/src/intel/genxml/.gitignore b/src/intel/genxml/.gitignore
new file mode 100644
index 000..dd11495
--- /dev/null
+++ b/src/intel/genxml/.gitignore
@@ -0,0 +1 @@
+gen*_pack.h
diff --git a/src/intel/genxml/Makefile.am b/src/intel/genxml/Makefile.am
new file mode 100644
index 000..36ba526
--- /dev/null
+++ b/src/intel/genxml/Makefile.am
@@ -0,0 +1,31 @@
+# Copyright © 2016 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND 

Mesa (vulkan): Move the intel vulkan driver to src/intel/vulkan

2016-02-18 Thread Jason Ekstrand
Module: Mesa
Branch: vulkan
Commit: 9851c8285f7bf70a6cb4bede2ee94110c14acc19
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9851c8285f7bf70a6cb4bede2ee94110c14acc19

Author: Jason Ekstrand 
Date:   Thu Feb 18 10:37:59 2016 -0800

Move the intel vulkan driver to src/intel/vulkan

---

 configure.ac | 4 ++--
 src/Makefile.am  | 1 -
 src/intel/Makefile.am| 2 +-
 src/{ => intel}/vulkan/.gitignore| 0
 src/{ => intel}/vulkan/Makefile.am   | 4 ++--
 src/{ => intel}/vulkan/anv_allocator.c   | 0
 src/{ => intel}/vulkan/anv_batch_chain.c | 0
 src/{ => intel}/vulkan/anv_cmd_buffer.c  | 0
 src/{ => intel}/vulkan/anv_descriptor_set.c  | 0
 src/{ => intel}/vulkan/anv_device.c  | 0
 src/{ => intel}/vulkan/anv_dump.c| 0
 src/{ => intel}/vulkan/anv_entrypoints_gen.py| 0
 src/{ => intel}/vulkan/anv_formats.c | 0
 src/{ => intel}/vulkan/anv_gem.c | 0
 src/{ => intel}/vulkan/anv_gem_stubs.c   | 0
 src/{ => intel}/vulkan/anv_gen_macros.h  | 0
 src/{ => intel}/vulkan/anv_image.c   | 0
 src/{ => intel}/vulkan/anv_intel.c   | 0
 src/{ => intel}/vulkan/anv_meta.c| 0
 src/{ => intel}/vulkan/anv_meta.h| 0
 src/{ => intel}/vulkan/anv_meta_blit.c   | 0
 src/{ => intel}/vulkan/anv_meta_clear.c  | 0
 src/{ => intel}/vulkan/anv_meta_resolve.c| 0
 src/{ => intel}/vulkan/anv_nir.h | 0
 src/{ => intel}/vulkan/anv_nir_apply_dynamic_offsets.c   | 0
 src/{ => intel}/vulkan/anv_nir_apply_pipeline_layout.c   | 0
 src/{ => intel}/vulkan/anv_nir_lower_push_constants.c| 0
 src/{ => intel}/vulkan/anv_pass.c| 0
 src/{ => intel}/vulkan/anv_pipeline.c| 0
 src/{ => intel}/vulkan/anv_pipeline_cache.c  | 0
 src/{ => intel}/vulkan/anv_private.h | 0
 src/{ => intel}/vulkan/anv_query.c   | 0
 src/{ => intel}/vulkan/anv_util.c| 0
 src/{ => intel}/vulkan/anv_wsi.c | 0
 src/{ => intel}/vulkan/anv_wsi.h | 0
 src/{ => intel}/vulkan/anv_wsi_wayland.c | 0
 src/{ => intel}/vulkan/anv_wsi_x11.c | 0
 src/{ => intel}/vulkan/dev_icd.json.in   | 0
 src/{ => intel}/vulkan/gen7_cmd_buffer.c | 0
 src/{ => intel}/vulkan/gen7_pipeline.c   | 0
 src/{ => intel}/vulkan/gen7_state.c  | 0
 src/{ => intel}/vulkan/gen8_cmd_buffer.c | 0
 src/{ => intel}/vulkan/gen8_pipeline.c   | 0
 src/{ => intel}/vulkan/gen8_state.c  | 0
 src/{ => intel}/vulkan/genX_cmd_buffer.c | 0
 src/{ => intel}/vulkan/genX_pipeline.c   | 0
 src/{ => intel}/vulkan/genX_pipeline_util.h  | 0
 src/{ => intel}/vulkan/genX_state_util.h | 0
 src/{ => intel}/vulkan/intel_icd.json.in | 0
 src/{ => intel}/vulkan/tests/.gitignore  | 0
 src/{ => intel}/vulkan/tests/Makefile.am | 0
 src/{ => intel}/vulkan/tests/block_pool_no_free.c| 0
 src/{ => intel}/vulkan/tests/state_pool.c| 0
 src/{ => intel}/vulkan/tests/state_pool_free_list_only.c | 0
 src/{ => intel}/vulkan/tests/state_pool_no_free.c| 0
 src/{ => intel}/vulkan/tests/state_pool_test_helper.h| 0
 56 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 604ea37..b4e2539 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2521,6 +2521,8 @@ AC_CONFIG_FILES([Makefile
src/intel/Makefile
src/intel/genxml/Makefile
src/intel/isl/Makefile
+   src/intel/vulkan/Makefile
+   src/intel/vulkan/tests/Makefile
src/loader/Makefile
src/mapi/Makefile
src/mapi/es1api/glesv1_cm.pc
@@ -2542,8 +2544,6 @@ AC_CONFIG_FILES([Makefile
src/mesa/drivers/osmesa/osmesa.pc
src/mesa/drivers/x11/Makefile
src/mesa/main/tests/Makefile
-   src/vulkan/Makefile
-   src/vulkan/tests/Makefile
src/util/Makefile
src/util/tests/hash_table/Makefile])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 02b8371..73686a9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -58,7 +58,6 @@ AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
 
 if HAVE_VULKAN
 SUBDIRS += intel
-SUBDIRS += vulkan
 endif
 
 AM_CPPFLAGS = \
diff --git a/src/intel/Makefile.am 

Mesa (vulkan): Move isl to src/intel

2016-02-18 Thread Jason Ekstrand
Module: Mesa
Branch: vulkan
Commit: 47b8b08612d44a43e43c3f6e95fe509ee3348723
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=47b8b08612d44a43e43c3f6e95fe509ee3348723

Author: Jason Ekstrand 
Date:   Thu Feb 18 10:34:47 2016 -0800

Move isl to src/intel

---

 configure.ac   | 2 +-
 src/Makefile.am| 1 -
 src/intel/Makefile.am  | 2 +-
 src/{ => intel}/isl/.gitignore | 0
 src/{ => intel}/isl/Makefile.am| 0
 src/{ => intel}/isl/README | 0
 src/{ => intel}/isl/isl.c  | 0
 src/{ => intel}/isl/isl.h  | 0
 src/{ => intel}/isl/isl_format.c   | 0
 src/{ => intel}/isl/isl_format_layout.csv  | 0
 src/{ => intel}/isl/isl_format_layout_gen.bash | 0
 src/{ => intel}/isl/isl_gen4.c | 0
 src/{ => intel}/isl/isl_gen4.h | 0
 src/{ => intel}/isl/isl_gen6.c | 0
 src/{ => intel}/isl/isl_gen6.h | 0
 src/{ => intel}/isl/isl_gen7.c | 0
 src/{ => intel}/isl/isl_gen7.h | 0
 src/{ => intel}/isl/isl_gen8.c | 0
 src/{ => intel}/isl/isl_gen8.h | 0
 src/{ => intel}/isl/isl_gen9.c | 0
 src/{ => intel}/isl/isl_gen9.h | 0
 src/{ => intel}/isl/isl_image.c| 0
 src/{ => intel}/isl/isl_priv.h | 0
 src/{ => intel}/isl/tests/.gitignore   | 0
 src/{ => intel}/isl/tests/isl_surf_get_image_offset_test.c | 0
 src/vulkan/Makefile.am | 3 +--
 src/vulkan/anv_private.h   | 2 +-
 27 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index d6692b7..604ea37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2520,7 +2520,7 @@ AC_CONFIG_FILES([Makefile
src/gtest/Makefile
src/intel/Makefile
src/intel/genxml/Makefile
-   src/isl/Makefile
+   src/intel/isl/Makefile
src/loader/Makefile
src/mapi/Makefile
src/mapi/es1api/glesv1_cm.pc
diff --git a/src/Makefile.am b/src/Makefile.am
index 25b48c6..02b8371 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -58,7 +58,6 @@ AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
 
 if HAVE_VULKAN
 SUBDIRS += intel
-SUBDIRS += isl
 SUBDIRS += vulkan
 endif
 
diff --git a/src/intel/Makefile.am b/src/intel/Makefile.am
index 0a6f411..520602d 100644
--- a/src/intel/Makefile.am
+++ b/src/intel/Makefile.am
@@ -19,4 +19,4 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-SUBDIRS = genxml
+SUBDIRS = genxml isl
diff --git a/src/isl/.gitignore b/src/intel/isl/.gitignore
similarity index 100%
rename from src/isl/.gitignore
rename to src/intel/isl/.gitignore
diff --git a/src/isl/Makefile.am b/src/intel/isl/Makefile.am
similarity index 100%
rename from src/isl/Makefile.am
rename to src/intel/isl/Makefile.am
diff --git a/src/isl/README b/src/intel/isl/README
similarity index 100%
rename from src/isl/README
rename to src/intel/isl/README
diff --git a/src/isl/isl.c b/src/intel/isl/isl.c
similarity index 100%
rename from src/isl/isl.c
rename to src/intel/isl/isl.c
diff --git a/src/isl/isl.h b/src/intel/isl/isl.h
similarity index 100%
rename from src/isl/isl.h
rename to src/intel/isl/isl.h
diff --git a/src/isl/isl_format.c b/src/intel/isl/isl_format.c
similarity index 100%
rename from src/isl/isl_format.c
rename to src/intel/isl/isl_format.c
diff --git a/src/isl/isl_format_layout.csv b/src/intel/isl/isl_format_layout.csv
similarity index 100%
rename from src/isl/isl_format_layout.csv
rename to src/intel/isl/isl_format_layout.csv
diff --git a/src/isl/isl_format_layout_gen.bash 
b/src/intel/isl/isl_format_layout_gen.bash
similarity index 100%
rename from src/isl/isl_format_layout_gen.bash
rename to src/intel/isl/isl_format_layout_gen.bash
diff --git a/src/isl/isl_gen4.c b/src/intel/isl/isl_gen4.c
similarity index 100%
rename from src/isl/isl_gen4.c
rename to src/intel/isl/isl_gen4.c
diff --git a/src/isl/isl_gen4.h b/src/intel/isl/isl_gen4.h
similarity index 100%
rename from src/isl/isl_gen4.h
rename to src/intel/isl/isl_gen4.h
diff --git a/src/isl/isl_gen6.c b/src/intel/isl/isl_gen6.c
similarity index 100%
rename from src/isl/isl_gen6.c
rename to src/intel/isl/isl_gen6.c
diff --git a/src/isl/isl_gen6.h b/src/intel/isl/isl_gen6.h
similarity index 100%
rename from src/isl/isl_gen6.h
rename to src/intel/isl/isl_gen6.h
diff --git a/src/isl/isl_gen7.c b/src/intel/isl/isl_gen7.c

Mesa (vulkan): anv/meta: Initialize blend state for the right attachment

2016-02-18 Thread Kristian Høgsberg
Module: Mesa
Branch: vulkan
Commit: 542c38df36613eb1baa4c1c23b971dc7743b8e11
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=542c38df36613eb1baa4c1c23b971dc7743b8e11

Author: Kristian Høgsberg Kristensen 
Date:   Thu Feb 18 10:21:08 2016 -0800

anv/meta: Initialize blend state for the right attachment

We were always initializing only RT 0. We need to initialize the RT
we're creating the clear pipeline for.

---

 src/vulkan/anv_meta_clear.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/vulkan/anv_meta_clear.c b/src/vulkan/anv_meta_clear.c
index 15e24a3..739ae09 100644
--- a/src/vulkan/anv_meta_clear.c
+++ b/src/vulkan/anv_meta_clear.c
@@ -280,19 +280,20 @@ create_color_pipeline(struct anv_device *device,
   .stencilTestEnable = false,
};
 
+   VkPipelineColorBlendAttachmentState blend_attachment_state[MAX_RTS] = { 0 };
+   blend_attachment_state[frag_output] = (VkPipelineColorBlendAttachmentState) 
{
+  .blendEnable = false,
+  .colorWriteMask = VK_COLOR_COMPONENT_A_BIT |
+VK_COLOR_COMPONENT_R_BIT |
+VK_COLOR_COMPONENT_G_BIT |
+VK_COLOR_COMPONENT_B_BIT,
+   };
+
const VkPipelineColorBlendStateCreateInfo cb_state = {
   .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
   .logicOpEnable = false,
-  .attachmentCount = 1,
-  .pAttachments = (VkPipelineColorBlendAttachmentState []) {
- {
-.blendEnable = false,
-.colorWriteMask = VK_COLOR_COMPONENT_A_BIT |
-  VK_COLOR_COMPONENT_R_BIT |
-  VK_COLOR_COMPONENT_G_BIT |
-  VK_COLOR_COMPONENT_B_BIT,
- },
-  },
+  .attachmentCount = MAX_RTS,
+  .pAttachments = blend_attachment_state
};
 
/* Disable repclear because we do not want the compiler to replace the

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


Mesa (vulkan): anv/meta: Don't use the blit ds layout in resolve code

2016-02-18 Thread Kristian Høgsberg
Module: Mesa
Branch: vulkan
Commit: 05f75a30267249fe1781e87389b5dd6c2339fdfb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=05f75a30267249fe1781e87389b5dd6c2339fdfb

Author: Kristian Høgsberg Kristensen 
Date:   Wed Feb 17 17:27:25 2016 -0800

anv/meta: Don't use the blit ds layout in resolve code

---

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

diff --git a/src/vulkan/anv_meta_resolve.c b/src/vulkan/anv_meta_resolve.c
index ae53292..ea5020c 100644
--- a/src/vulkan/anv_meta_resolve.c
+++ b/src/vulkan/anv_meta_resolve.c
@@ -567,7 +567,7 @@ emit_resolve(struct anv_cmd_buffer *cmd_buffer,
  .descriptorPool = dummy_desc_pool_h,
  .descriptorSetCount = 1,
  .pSetLayouts = (VkDescriptorSetLayout[]) {
-device->meta_state.blit.ds_layout,
+device->meta_state.resolve.ds_layout,
  },
   },
   _set_h);

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


Mesa (master): Android: fix build break in libmesa_program

2016-02-18 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 64d2f398f6a7f17f30f5284c812958d54d635eac
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=64d2f398f6a7f17f30f5284c812958d54d635eac

Author: Rob Herring 
Date:   Mon Feb 15 08:24:43 2016 -0600

Android: fix build break in libmesa_program

Commit 5fd848f6c9ee ("program: Use _mesa_geometric_samples to calculate
gl_NumSamples") broken Android builds. Add the missing include path "main"
to framebuffer.h like other includes in prog_statevars.c.

Cc: Neil Roberts 
Cc: Ilia Mirkin 
Signed-off-by: Rob Herring 
Reviewed-by: Neil Roberts 
Reviewed-by: Emil Velikov 

---

 src/mesa/program/prog_statevars.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/program/prog_statevars.c 
b/src/mesa/program/prog_statevars.c
index 489f75f..db53377 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -40,7 +40,7 @@
 #include "prog_statevars.h"
 #include "prog_parameter.h"
 #include "main/samplerobj.h"
-#include "framebuffer.h"
+#include "main/framebuffer.h"
 
 
 #define ONE_DIV_SQRT_LN2 (1.201122408786449815)

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


Mesa (master): Android: disable unused-parameter warning

2016-02-18 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 5c7f97426dee3678beb879c94cd8906c33b8f3dc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5c7f97426dee3678beb879c94cd8906c33b8f3dc

Author: Rob Herring 
Date:   Fri Jan 29 12:52:27 2016 -0600

Android: disable unused-parameter warning

Android builds with -Wunused-parameter enabled which results in spewing
lots of warnings. Disable it so more meaningful warnings are more visible.

Signed-off-by: Rob Herring 
Reviewed-by: Emil Velikov 

---

 Android.common.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Android.common.mk b/Android.common.mk
index 72fa5d9..c4823f7 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -32,6 +32,7 @@ LOCAL_C_INCLUDES += \
 MESA_VERSION := $(shell cat $(MESA_TOP)/VERSION)
 # define ANDROID_VERSION (e.g., 4.0.x => 0x0400)
 LOCAL_CFLAGS += \
+   -Wno-unused-parameter \
-DPACKAGE_VERSION=\"$(MESA_VERSION)\" \

-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\; 
\

-DANDROID_VERSION=0x0$(MESA_ANDROID_MAJOR_VERSION)0$(MESA_ANDROID_MINOR_VERSION)

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


Mesa (master): egl: android: fix visuals declaration

2016-02-18 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: e35c5af337524011c3d4f37ca3dbfca28d33ccad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e35c5af337524011c3d4f37ca3dbfca28d33ccad

Author: Varad Gautam 
Date:   Tue Feb  2 14:23:09 2016 -0600

egl: android: fix visuals declaration

Signed-off-by: Varad Gautam 
Reviewed-by: Emil Velikov 

---

 src/egl/drivers/dri2/platform_android.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 8f3abcb..b622b00 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -532,7 +532,7 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay 
*dpy)
   { HAL_PIXEL_FORMAT_RGB_888,   { 0xff, 0xff00, 0xff, 0x0 } },
   { HAL_PIXEL_FORMAT_RGB_565,   { 0xf800, 0x7e0, 0x1f, 0x0 } },
   { HAL_PIXEL_FORMAT_BGRA_, { 0xff, 0xff00, 0xff, 0xff00 } },
-  { 0, 0, { 0, 0, 0, 0 } }
+  { 0, { 0, 0, 0, 0 } }
};
int count, i, j;
 

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


Mesa (master): Android: enable building on arm64

2016-02-18 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 7efc273df18797e8aff671fe09e926b37d938c38
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7efc273df18797e8aff671fe09e926b37d938c38

Author: Rob Herring 
Date:   Tue Feb  2 14:45:09 2016 -0600

Android: enable building on arm64

Use the LOCAL_CFLAGS_{32/64} instead of arch specific variants to define
the DEFAULT_DRIVER_DIR. This enables building for arm64.

Cc: Chih-Wei Huang 
Signed-off-by: Rob Herring 
Reviewed-by: Emil Velikov 

---

 src/egl/Android.mk | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/egl/Android.mk b/src/egl/Android.mk
index ebd67af..cf71251 100644
--- a/src/egl/Android.mk
+++ b/src/egl/Android.mk
@@ -44,9 +44,8 @@ LOCAL_CFLAGS := \
-DHAVE_ANDROID_PLATFORM
 
 ifeq ($(MESA_LOLLIPOP_BUILD),true)
-LOCAL_CFLAGS_arm := -DDEFAULT_DRIVER_DIR=\"/system/lib/dri\"
-LOCAL_CFLAGS_x86 := -DDEFAULT_DRIVER_DIR=\"/system/lib/dri\"
-LOCAL_CFLAGS_x86_64 := -DDEFAULT_DRIVER_DIR=\"/system/lib64/dri\"
+LOCAL_CFLAGS_32 := -DDEFAULT_DRIVER_DIR=\"/system/lib/dri\"
+LOCAL_CFLAGS_64 := -DDEFAULT_DRIVER_DIR=\"/system/lib64/dri\"
 else
 LOCAL_CFLAGS += -DDEFAULT_DRIVER_DIR=\"/system/lib/dri\"
 endif

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


Mesa (master): egl: android: clean-up config attribute setting

2016-02-18 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: ba06ea1a37fd6f4807a70e12fa2581a027d6358d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba06ea1a37fd6f4807a70e12fa2581a027d6358d

Author: Rob Herring 
Date:   Tue Feb  2 14:23:10 2016 -0600

egl: android: clean-up config attribute setting

Pass the additional config attributes to dri2_add_config to set them
instead of open coding them. This is in preparation to add more attributes.

Signed-off-by: Rob Herring 
Reviewed-by: Emil Velikov 

---

 src/egl/drivers/dri2/platform_android.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index b622b00..7d54665 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -534,12 +534,20 @@ droid_add_configs_for_visuals(_EGLDriver *drv, 
_EGLDisplay *dpy)
   { HAL_PIXEL_FORMAT_BGRA_, { 0xff, 0xff00, 0xff, 0xff00 } },
   { 0, { 0, 0, 0, 0 } }
};
+   EGLint config_attrs[] = {
+ EGL_NATIVE_VISUAL_ID,   0,
+ EGL_NATIVE_VISUAL_TYPE, 0,
+ EGL_NONE
+   };
int count, i, j;
 
count = 0;
for (i = 0; visuals[i].format; i++) {
   int format_count = 0;
 
+  config_attrs[1] = visuals[i].format;
+  config_attrs[3] = visuals[i].format;
+
   for (j = 0; dri2_dpy->driver_configs[j]; j++) {
  const EGLint surface_type = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
  struct dri2_egl_config *dri2_conf;
@@ -553,10 +561,8 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay 
*dpy)
 continue;
 
  dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[j],
-   count + 1, surface_type, NULL, visuals[i].rgba_masks);
+   count + 1, surface_type, config_attrs, visuals[i].rgba_masks);
  if (dri2_conf) {
-dri2_conf->base.NativeVisualID = visuals[i].format;
-dri2_conf->base.NativeVisualType = visuals[i].format;
 count++;
 format_count++;
  }

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


Mesa (master): Android: Fix building secondary arch in mixed 32/ 64-bit builds

2016-02-18 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 1f53a57b2f19116ddde7eab1d922fdd0ab1835e0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f53a57b2f19116ddde7eab1d922fdd0ab1835e0

Author: Rob Herring 
Date:   Tue Feb  2 14:45:08 2016 -0600

Android: Fix building secondary arch in mixed 32/64-bit builds

TARGET_CC is not defined for the secondary arch on combined 32/64-bit
builds. The build system uses 2ND_TARGET_CC instead and it is not meant
to be used in module makefiles. LOCAL_CC was used to provide C only
flags as -std=c99 is not valid for C++ files. Since Android 4.4,
LOCAL_CONLYFLAGS was added to set compiler flags on C files only, so it
can be used now instead of LOCAL_CC.

This will break on pre-4.4 versions of Android, but it unlikely anyone
is using current Mesa with such an old version of Android.

Cc: Chih-Wei Huang 
Signed-off-by: Rob Herring 
Reviewed-by: Emil Velikov 

---

 Android.common.mk | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index 948561c..72fa5d9 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -21,13 +21,8 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-# use c99 compiler by default
-ifeq ($(LOCAL_CC),)
 ifeq ($(LOCAL_IS_HOST_MODULE),true)
-LOCAL_CC := $(HOST_CC) -std=c99 -D_GNU_SOURCE
-else
-LOCAL_CC := $(TARGET_CC) -std=c99
-endif
+LOCAL_CFLAGS += -D_GNU_SOURCE
 endif
 
 LOCAL_C_INCLUDES += \
@@ -60,6 +55,10 @@ LOCAL_CFLAGS += \
-fvisibility=hidden \
-Wno-sign-compare
 
+# mesa requires at least c99 compiler
+LOCAL_CONLYFLAGS += \
+   -std=c99
+
 ifeq ($(strip $(MESA_ENABLE_ASM)),true)
 ifeq ($(TARGET_ARCH),x86)
 LOCAL_CFLAGS += \

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


Mesa (master): mesa: gl_NumSamples should always be at least one

2016-02-18 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 12e3ad2ae98a560e2527f4f28423920a15570590
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=12e3ad2ae98a560e2527f4f28423920a15570590

Author: Ilia Mirkin 
Date:   Tue Feb 16 01:18:30 2016 -0500

mesa: gl_NumSamples should always be at least one

From ARB_sample_shading:

"gl_NumSamples is the total number of samples in the framebuffer,
 or one if rendering to a non-multisample framebuffer"

So make sure to always pass in at least 1.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Edward O`Callaghan 
Reviewed-by: Neil Roberts 

---

 src/mesa/program/prog_statevars.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/program/prog_statevars.c 
b/src/mesa/program/prog_statevars.c
index eed2412..489f75f 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -353,7 +353,7 @@ _mesa_fetch_state(struct gl_context *ctx, const 
gl_state_index state[],
   }
   return;
case STATE_NUM_SAMPLES:
-  ((int *)value)[0] = _mesa_geometric_samples(ctx->DrawBuffer);
+  ((int *)value)[0] = MAX2(1, _mesa_geometric_samples(ctx->DrawBuffer));
   return;
case STATE_DEPTH_RANGE:
   value[0] = ctx->ViewportArray[0].Near;/* near   */

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


Mesa (master): compiler/glsl: Fix uniform location counting.

2016-02-18 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: 65dfb3048e8291675ca33581aeff8921f7ea509d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=65dfb3048e8291675ca33581aeff8921f7ea509d

Author: Plamena Manolova 
Date:   Thu Feb 11 15:00:02 2016 +0200

compiler/glsl: Fix uniform location counting.

This patch moves the calculation of current uniforms to
link_uniforms, which makes use of UniformRemapTable which
stores all the reserved uniform locations.

Location assignment for implicit uniforms now tries to use
any gaps left in the table after the location assignment
for explicit uniforms. This gives us more space to store more
uniforms.

Patch is based on earlier patch with following changes/additions:

   1: Move the counting of explicit locations to
  check_explicit_uniform_locations and then pass
  the number to link_assign_uniform_locations.
   2: Count the number of empty slots in UniformRemapTable
  and store them in a list_head.
   3: Try to find an empty slot for implicit locations from
  the list, if that fails resize UniformRemapTable.

Fixes following CTS tests:
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array

Signed-off-by: Tapani Pälli 
Signed-off-by: Plamena Manolova 
Reviewed-by: Ilia Mirkin 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696

---

 src/compiler/glsl/link_uniforms.cpp | 80 -
 src/compiler/glsl/linker.cpp| 70 +---
 src/compiler/glsl/linker.h  | 17 +++-
 src/mesa/main/mtypes.h  |  8 
 4 files changed, 140 insertions(+), 35 deletions(-)

diff --git a/src/compiler/glsl/link_uniforms.cpp 
b/src/compiler/glsl/link_uniforms.cpp
index d18a2f2..deaba94 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -1038,9 +1038,43 @@ assign_hidden_uniform_slot_id(const char *name, unsigned 
hidden_id,
uniform_size->map->put(hidden_uniform_start + hidden_id, name);
 }
 
+/**
+ * Search through the list of empty blocks to find one that fits the current
+ * uniform.
+ */
+static int
+find_empty_block(struct gl_shader_program *prog,
+ struct gl_uniform_storage *uniform)
+{
+   const unsigned entries = MAX2(1, uniform->array_elements);
+
+   foreach_list_typed(struct empty_uniform_block, block, link,
+  >EmptyUniformLocations) {
+  /* Found a block with enough slots to fit the uniform */
+  if (block->slots == entries) {
+ unsigned start = block->start;
+ exec_node_remove(>link);
+ ralloc_free(block);
+
+ return start;
+  /* Found a block with more slots than needed. It can still be used. */
+  } else if (block->slots > entries) {
+ unsigned start = block->start;
+ block->start += entries;
+ block->slots -= entries;
+
+ return start;
+  }
+   }
+
+   return -1;
+}
+
 void
 link_assign_uniform_locations(struct gl_shader_program *prog,
-  unsigned int boolean_true)
+  unsigned int boolean_true,
+  unsigned int num_explicit_uniform_locs,
+  unsigned int max_uniform_locs)
 {
ralloc_free(prog->UniformStorage);
prog->UniformStorage = NULL;
@@ -1131,6 +1165,9 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog,
 
parcel_out_uniform_storage parcel(prog, prog->UniformHash, uniforms, data);
 
+   unsigned total_entries = num_explicit_uniform_locs;
+   unsigned empty_locs = prog->NumUniformRemapTable - 
num_explicit_uniform_locs;
+
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
   if (prog->_LinkedShaders[i] == NULL)
 continue;
@@ -1194,21 +1231,44 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog,
   /* how many new entries for this uniform? */
   const unsigned entries = MAX2(1, uniforms[i].array_elements);
 
-  /* resize remap table to fit new entries */
-  prog->UniformRemapTable =
- reralloc(prog,
-  prog->UniformRemapTable,
-  gl_uniform_storage *,
-  prog->NumUniformRemapTable + entries);
+  /* Find UniformRemapTable for empty blocks where we can fit this 
uniform. */
+  int chosen_location = -1;
+
+  if (empty_locs)
+ chosen_location = find_empty_block(prog, [i]);
+
+  /* Add new entries to the total amount of entries. */
+  total_entries += entries;
+
+  if (chosen_location != -1) {
+ empty_locs -= entries;
+  } else {
+ chosen_location = prog->NumUniformRemapTable;
+
+ /* resize remap table to fit new entries */
+ prog->UniformRemapTable =
+reralloc(prog,
+ prog->UniformRemapTable,
+ 

Mesa (master): glsl: move uniform calculation + remaptable refactor/fixing

2016-02-18 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: 10cb91b12eff19ef168b2569e1353177bd91d630
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=10cb91b12eff19ef168b2569e1353177bd91d630

Author: Plamena Manolova 
Date:   Thu Feb 11 14:19:48 2016 +0200

glsl: move uniform calculation + remaptable refactor/fixing

This patch moves the calculation of current uniforms to link_uniforms,
which makes use of UniformRemapTable which stores all the reserved
uniform locations.

Location assignment for implicit uniforms now tries to use
any gaps left in the table after the location assignment
for explicit uniforms. This gives us more space to store more
uniforms.

Patch is based on earlier patch with following changes/additions:

   1: Move the counting of explicit locations to
  check_explicit_uniform_locations and then pass
  the number to link_assign_uniform_locations.
   2: Count the number of empty slots in UniformRemapTable
  and store them in a list_head.
   3: Try to find an empty slot for implicit locations from
  the list, if that fails resize UniformRemapTable.

Fixes following CTS tests:
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array

Signed-off-by: Tapani Pälli 
Signed-off-by: Plamena Manolova 
Reviewed-by: Ilia Mirkin 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696

---

 src/compiler/glsl/link_uniforms.cpp | 79 -
 src/compiler/glsl/linker.cpp| 78 +---
 src/compiler/glsl/linker.h  | 17 +++-
 src/mesa/main/mtypes.h  | 78 
 4 files changed, 182 insertions(+), 70 deletions(-)

diff --git a/src/compiler/glsl/link_uniforms.cpp 
b/src/compiler/glsl/link_uniforms.cpp
index d18a2f2..631f226 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -1038,9 +1038,36 @@ assign_hidden_uniform_slot_id(const char *name, unsigned 
hidden_id,
uniform_size->map->put(hidden_uniform_start + hidden_id, name);
 }
 
+/**
+ * Search through the list of empty blocks to find one that fits the current
+ * uniform.
+ */
+static int
+find_empty_block(struct gl_shader_program *prog,
+ struct gl_uniform_storage *uniform)
+{
+   const unsigned entries = MAX2(1, uniform->array_elements);
+
+   list_for_each_entry_safe(struct empty_uniform_block, block,
+>EmptyUniformLocations, link) {
+  /* Found a block with enough slots to fit the uniform */
+  if (block->slots == entries) {
+ unsigned start = block->start;
+ list_del(>link);
+ ralloc_free(block);
+
+ return start;
+  }
+   }
+
+   return -1;
+}
+
 void
 link_assign_uniform_locations(struct gl_shader_program *prog,
-  unsigned int boolean_true)
+  unsigned int boolean_true,
+  unsigned int num_explicit_uniform_locs,
+  unsigned int max_uniform_locs)
 {
ralloc_free(prog->UniformStorage);
prog->UniformStorage = NULL;
@@ -1131,6 +1158,9 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog,
 
parcel_out_uniform_storage parcel(prog, prog->UniformHash, uniforms, data);
 
+   unsigned total_entries = num_explicit_uniform_locs;
+   unsigned empty_locs = prog->NumUniformRemapTable - 
num_explicit_uniform_locs;
+
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
   if (prog->_LinkedShaders[i] == NULL)
 continue;
@@ -1194,21 +1224,43 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog,
   /* how many new entries for this uniform? */
   const unsigned entries = MAX2(1, uniforms[i].array_elements);
 
-  /* resize remap table to fit new entries */
-  prog->UniformRemapTable =
- reralloc(prog,
-  prog->UniformRemapTable,
-  gl_uniform_storage *,
-  prog->NumUniformRemapTable + entries);
+  /* Find UniformRemapTable for empty blocks where we can fit this 
uniform. */
+  int chosen_location = -1;
+
+  if (empty_locs)
+ chosen_location = find_empty_block(prog, [i]);
+
+  if (chosen_location != -1) {
+ empty_locs -= entries;
+  } else {
+ chosen_location = prog->NumUniformRemapTable;
+
+ /* Add new entries to the total amount of entries. */
+ total_entries += entries;
+
+ /* resize remap table to fit new entries */
+ prog->UniformRemapTable =
+reralloc(prog,
+ prog->UniformRemapTable,
+ gl_uniform_storage *,
+ prog->NumUniformRemapTable + entries);
+ prog->NumUniformRemapTable += entries;
+  }
 
   /* set pointers for this 

Mesa (master): glsl: move uniform calculation + remaptable refactor/fixing

2016-02-18 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: 8ad2e0aeaa47fd1a45d63349d5cb781995c0c631
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ad2e0aeaa47fd1a45d63349d5cb781995c0c631

Author: Plamena Manolova 
Date:   Thu Feb 11 14:19:48 2016 +0200

glsl: move uniform calculation + remaptable refactor/fixing

This patch moves the calculation of current uniforms to link_uniforms,
which makes use of UniformRemapTable which stores all the reserved
uniform locations.

Location assignment for implicit uniforms now tries to use
any gaps left in the table after the location assignment
for explicit uniforms. This gives us more space to store more
uniforms.

Patch is based on earlier patch with following changes/additions:

   1: Move the counting of explicit locations to
  check_explicit_uniform_locations and then pass
  the number to link_assign_uniform_locations.
   2: Count the number of empty slots in UniformRemapTable
  and store them in a list_head.
   3: Try to find an empty slot for implicit locations from
  the list, if that fails resize UniformRemapTable.

Fixes following CTS tests:
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array

Signed-off-by: Tapani Pälli 
Signed-off-by: Plamena Manolova 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696

---

 src/compiler/glsl/link_uniforms.cpp | 79 -
 src/compiler/glsl/linker.cpp| 78 +---
 src/compiler/glsl/linker.h  | 17 +++-
 src/mesa/main/mtypes.h  | 78 
 4 files changed, 182 insertions(+), 70 deletions(-)

diff --git a/src/compiler/glsl/link_uniforms.cpp 
b/src/compiler/glsl/link_uniforms.cpp
index d18a2f2..631f226 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -1038,9 +1038,36 @@ assign_hidden_uniform_slot_id(const char *name, unsigned 
hidden_id,
uniform_size->map->put(hidden_uniform_start + hidden_id, name);
 }
 
+/**
+ * Search through the list of empty blocks to find one that fits the current
+ * uniform.
+ */
+static int
+find_empty_block(struct gl_shader_program *prog,
+ struct gl_uniform_storage *uniform)
+{
+   const unsigned entries = MAX2(1, uniform->array_elements);
+
+   list_for_each_entry_safe(struct empty_uniform_block, block,
+>EmptyUniformLocations, link) {
+  /* Found a block with enough slots to fit the uniform */
+  if (block->slots == entries) {
+ unsigned start = block->start;
+ list_del(>link);
+ ralloc_free(block);
+
+ return start;
+  }
+   }
+
+   return -1;
+}
+
 void
 link_assign_uniform_locations(struct gl_shader_program *prog,
-  unsigned int boolean_true)
+  unsigned int boolean_true,
+  unsigned int num_explicit_uniform_locs,
+  unsigned int max_uniform_locs)
 {
ralloc_free(prog->UniformStorage);
prog->UniformStorage = NULL;
@@ -1131,6 +1158,9 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog,
 
parcel_out_uniform_storage parcel(prog, prog->UniformHash, uniforms, data);
 
+   unsigned total_entries = num_explicit_uniform_locs;
+   unsigned empty_locs = prog->NumUniformRemapTable - 
num_explicit_uniform_locs;
+
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
   if (prog->_LinkedShaders[i] == NULL)
 continue;
@@ -1194,21 +1224,43 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog,
   /* how many new entries for this uniform? */
   const unsigned entries = MAX2(1, uniforms[i].array_elements);
 
-  /* resize remap table to fit new entries */
-  prog->UniformRemapTable =
- reralloc(prog,
-  prog->UniformRemapTable,
-  gl_uniform_storage *,
-  prog->NumUniformRemapTable + entries);
+  /* Find UniformRemapTable for empty blocks where we can fit this 
uniform. */
+  int chosen_location = -1;
+
+  if (empty_locs)
+ chosen_location = find_empty_block(prog, [i]);
+
+  if (chosen_location != -1) {
+ empty_locs -= entries;
+  } else {
+ chosen_location = prog->NumUniformRemapTable;
+
+ /* Add new entries to the total amount of entries. */
+ total_entries += entries;
+
+ /* resize remap table to fit new entries */
+ prog->UniformRemapTable =
+reralloc(prog,
+ prog->UniformRemapTable,
+ gl_uniform_storage *,
+ prog->NumUniformRemapTable + entries);
+ prog->NumUniformRemapTable += entries;
+  }
 
   /* set pointers for this uniform */
   for (unsigned j = 0; j < entries; 

Mesa (fdo_master): compiler/glsl: Fix uniform location counting.

2016-02-18 Thread Tapani Pälli
Module: Mesa
Branch: fdo_master
Commit: 1df34c05e8025a13479b399a571acb2aa7aad292
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1df34c05e8025a13479b399a571acb2aa7aad292

Author: Plamena Manolova 
Date:   Thu Feb 11 15:00:02 2016 +0200

compiler/glsl: Fix uniform location counting.

This patch moves the calculation of current uniforms to
link_uniforms, which makes use of UniformRemapTable which
stores all the reserved uniform locations.

Location assignment for implicit uniforms now tries to use
any gaps left in the table after the location assignment
for explicit uniforms. This gives us more space to store more
uniforms.

Patch is based on earlier patch with following changes/additions:

   1: Move the counting of explicit locations to
  check_explicit_uniform_locations and then pass
  the number to link_assign_uniform_locations.
   2: Count the number of empty slots in UniformRemapTable
  and store them in a list_head.
   3: Try to find an empty slot for implicit locations from
  the list, if that fails resize UniformRemapTable.

Fixes following CTS tests:
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array

Signed-off-by: Tapani Pälli 
Signed-off-by: Plamena Manolova 
Reviewed-by: Ilia Mirkin 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696

---

 src/compiler/glsl/link_uniforms.cpp | 80 -
 src/compiler/glsl/linker.cpp| 70 +---
 src/compiler/glsl/linker.h  | 17 +++-
 src/mesa/main/mtypes.h  |  8 
 4 files changed, 140 insertions(+), 35 deletions(-)

diff --git a/src/compiler/glsl/link_uniforms.cpp 
b/src/compiler/glsl/link_uniforms.cpp
index d18a2f2..deaba94 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -1038,9 +1038,43 @@ assign_hidden_uniform_slot_id(const char *name, unsigned 
hidden_id,
uniform_size->map->put(hidden_uniform_start + hidden_id, name);
 }
 
+/**
+ * Search through the list of empty blocks to find one that fits the current
+ * uniform.
+ */
+static int
+find_empty_block(struct gl_shader_program *prog,
+ struct gl_uniform_storage *uniform)
+{
+   const unsigned entries = MAX2(1, uniform->array_elements);
+
+   foreach_list_typed(struct empty_uniform_block, block, link,
+  >EmptyUniformLocations) {
+  /* Found a block with enough slots to fit the uniform */
+  if (block->slots == entries) {
+ unsigned start = block->start;
+ exec_node_remove(>link);
+ ralloc_free(block);
+
+ return start;
+  /* Found a block with more slots than needed. It can still be used. */
+  } else if (block->slots > entries) {
+ unsigned start = block->start;
+ block->start += entries;
+ block->slots -= entries;
+
+ return start;
+  }
+   }
+
+   return -1;
+}
+
 void
 link_assign_uniform_locations(struct gl_shader_program *prog,
-  unsigned int boolean_true)
+  unsigned int boolean_true,
+  unsigned int num_explicit_uniform_locs,
+  unsigned int max_uniform_locs)
 {
ralloc_free(prog->UniformStorage);
prog->UniformStorage = NULL;
@@ -1131,6 +1165,9 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog,
 
parcel_out_uniform_storage parcel(prog, prog->UniformHash, uniforms, data);
 
+   unsigned total_entries = num_explicit_uniform_locs;
+   unsigned empty_locs = prog->NumUniformRemapTable - 
num_explicit_uniform_locs;
+
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
   if (prog->_LinkedShaders[i] == NULL)
 continue;
@@ -1194,21 +1231,44 @@ link_assign_uniform_locations(struct gl_shader_program 
*prog,
   /* how many new entries for this uniform? */
   const unsigned entries = MAX2(1, uniforms[i].array_elements);
 
-  /* resize remap table to fit new entries */
-  prog->UniformRemapTable =
- reralloc(prog,
-  prog->UniformRemapTable,
-  gl_uniform_storage *,
-  prog->NumUniformRemapTable + entries);
+  /* Find UniformRemapTable for empty blocks where we can fit this 
uniform. */
+  int chosen_location = -1;
+
+  if (empty_locs)
+ chosen_location = find_empty_block(prog, [i]);
+
+  /* Add new entries to the total amount of entries. */
+  total_entries += entries;
+
+  if (chosen_location != -1) {
+ empty_locs -= entries;
+  } else {
+ chosen_location = prog->NumUniformRemapTable;
+
+ /* resize remap table to fit new entries */
+ prog->UniformRemapTable =
+reralloc(prog,
+