Mesa (master): anv/cmd_buffer: Set the L3 atomic disable mask bit in CHICKEN3 on HSW

2016-09-14 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 89a96c8f43370cc84adf92ab32e3de302a1fa1d0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=89a96c8f43370cc84adf92ab32e3de302a1fa1d0

Author: Jason Ekstrand 
Date:   Mon Sep 12 12:58:38 2016 -0700

anv/cmd_buffer: Set the L3 atomic disable mask bit in CHICKEN3 on HSW

Without this bit set, the value in "L3 Atomic Disable" won't get applied by
the hardware so we won't properly get L3 atomic caching.

Fixes dEQP-VK.spirv_assembly.instruction.compute.opatomic.compex and 198 of
the dEQP-VK.image.atomic_operations.* tests on HSW

Signed-off-by: Jason Ekstrand 
Reviewed-by: Francisco Jerez 

---

 src/intel/genxml/gen75.xml | 1 +
 src/intel/vulkan/genX_cmd_buffer.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/intel/genxml/gen75.xml b/src/intel/genxml/gen75.xml
index 27112b6..1debc3a 100644
--- a/src/intel/genxml/gen75.xml
+++ b/src/intel/genxml/gen75.xml
@@ -2951,6 +2951,7 @@
 
   
 
+
   
 
 
diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
b/src/intel/vulkan/genX_cmd_buffer.c
index b6f93e7..6a84383 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -296,6 +296,7 @@ genX(cmd_buffer_config_l3)(struct anv_cmd_buffer 
*cmd_buffer,
   anv_pack_struct(, GENX(SCRATCH1),
   .L3AtomicDisable = !has_dc);
   anv_pack_struct(, GENX(CHICKEN3),
+  .L3AtomicDisableMask = true,
   .L3AtomicDisable = !has_dc);
   emit_lri(_buffer->batch, GENX(SCRATCH1_num), scratch1);
   emit_lri(_buffer->batch, GENX(CHICKEN3_num), chicken3);

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


Mesa (master): anv/cmd_buffer: Set the L3 atomic disable mask bit in CHICKEN3 on HSW

2016-09-14 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: bb011738b7e89f9c6674e263e19000b63d852190
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb011738b7e89f9c6674e263e19000b63d852190

Author: Jason Ekstrand 
Date:   Mon Sep 12 12:58:38 2016 -0700

anv/cmd_buffer: Set the L3 atomic disable mask bit in CHICKEN3 on HSW

Without this bit set, the value in "L3 Atomic Disable" won't get applied by
the hardware so we won't properly get L3 atomic caching.

Fixes dEQP-VK.spirv_assembly.instruction.compute.opatomic.compex on HSW

Signed-off-by: Jason Ekstrand 
Reviewed-by: Francisco Jerez 

---

 src/intel/genxml/gen75.xml | 1 +
 src/intel/vulkan/genX_cmd_buffer.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/intel/genxml/gen75.xml b/src/intel/genxml/gen75.xml
index 27112b6..1debc3a 100644
--- a/src/intel/genxml/gen75.xml
+++ b/src/intel/genxml/gen75.xml
@@ -2951,6 +2951,7 @@
 
   
 
+
   
 
 
diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
b/src/intel/vulkan/genX_cmd_buffer.c
index b6f93e7..6a84383 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -296,6 +296,7 @@ genX(cmd_buffer_config_l3)(struct anv_cmd_buffer 
*cmd_buffer,
   anv_pack_struct(, GENX(SCRATCH1),
   .L3AtomicDisable = !has_dc);
   anv_pack_struct(, GENX(CHICKEN3),
+  .L3AtomicDisableMask = true,
   .L3AtomicDisable = !has_dc);
   emit_lri(_buffer->batch, GENX(SCRATCH1_num), scratch1);
   emit_lri(_buffer->batch, GENX(CHICKEN3_num), chicken3);

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


Mesa (master): intel/blorp: Stop setting 3DSTATE_DRAWING_RECTANGLE

2016-09-14 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: a814e18c96ccc70473103cf08a675265f0d1b3c9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a814e18c96ccc70473103cf08a675265f0d1b3c9

Author: Jason Ekstrand 
Date:   Mon Sep 12 15:50:05 2016 -0700

intel/blorp: Stop setting 3DSTATE_DRAWING_RECTANGLE

The Vulkan driver sets 3DSTATE_DRAWING_RECTANGLE once to MAX_INT x MAX_INT
at the GPU initialization time and never sets it again.  The GL driver sets
it every time the framebuffer changes.  Originally, blorp set it to the
size of the drawing area but meant we had to set it back in the Vulkan
driver.  Instead, we can easily just do that in the GL driver's blorp_exec
implementation and not set it in blorp core.

Signed-off-by: Jason Ekstrand 
Reviewed-by: Anuj Phogat 

---

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

diff --git a/src/intel/blorp/blorp_genX_exec.h 
b/src/intel/blorp/blorp_genX_exec.h
index aff59e1..eb4a5b9 100644
--- a/src/intel/blorp/blorp_genX_exec.h
+++ b/src/intel/blorp/blorp_genX_exec.h
@@ -1216,11 +1216,6 @@ blorp_exec(struct blorp_batch *batch, const struct 
blorp_params *params)
   clear.DepthClearValue = params->depth.clear_color.u32[0];
}
 
-   blorp_emit(batch, GENX(3DSTATE_DRAWING_RECTANGLE), rect) {
-  rect.ClippedDrawingRectangleXMax = MAX2(params->x1, params->x0) - 1;
-  rect.ClippedDrawingRectangleYMax = MAX2(params->y1, params->y0) - 1;
-   }
-
blorp_emit(batch, GENX(3DPRIMITIVE), prim) {
   prim.VertexAccessType = SEQUENTIAL;
   prim.PrimitiveTopologyType = _3DPRIM_RECTLIST;
diff --git a/src/intel/vulkan/genX_blorp_exec.c 
b/src/intel/vulkan/genX_blorp_exec.c
index a3ad97a..5ddbb7d 100644
--- a/src/intel/vulkan/genX_blorp_exec.c
+++ b/src/intel/vulkan/genX_blorp_exec.c
@@ -203,21 +203,6 @@ genX(blorp_exec)(struct blorp_batch *batch,
 
blorp_exec(batch, params);
 
-   /* BLORP sets DRAWING_RECTANGLE but we always want it set to the maximum.
-* Since we set it once at driver init and never again, we have to set it
-* back after invoking blorp.
-*
-* TODO: BLORP should assume a max drawing rectangle
-*/
-   blorp_emit(batch, GENX(3DSTATE_DRAWING_RECTANGLE), rect) {
-  rect.ClippedDrawingRectangleYMin = 0;
-  rect.ClippedDrawingRectangleXMin = 0;
-  rect.ClippedDrawingRectangleYMax = UINT16_MAX;
-  rect.ClippedDrawingRectangleXMax = UINT16_MAX;
-  rect.DrawingRectangleOriginY = 0;
-  rect.DrawingRectangleOriginX = 0;
-   }
-
cmd_buffer->state.vb_dirty = ~0;
cmd_buffer->state.dirty = ~0;
cmd_buffer->state.push_constants_dirty = ~0;
diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.c 
b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
index 8cd5a62..edcd896 100644
--- a/src/mesa/drivers/dri/i965/genX_blorp_exec.c
+++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
@@ -206,6 +206,11 @@ retry:
 
brw_emit_depth_stall_flushes(brw);
 
+   blorp_emit(batch, GENX(3DSTATE_DRAWING_RECTANGLE), rect) {
+  rect.ClippedDrawingRectangleXMax = MAX2(params->x1, params->x0) - 1;
+  rect.ClippedDrawingRectangleYMax = MAX2(params->y1, params->y0) - 1;
+   }
+
blorp_exec(batch, params);
 
/* Make sure we didn't wrap the batch unintentionally, and make sure we

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


Mesa (master): intel/blorp: Emit 3DSTATE_MULTISAMPLE directly

2016-09-14 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: b56f509ee0d6fcf85eb01aecfdcc66fb784fee97
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b56f509ee0d6fcf85eb01aecfdcc66fb784fee97

Author: Jason Ekstrand 
Date:   Mon Sep 12 15:50:04 2016 -0700

intel/blorp: Emit 3DSTATE_MULTISAMPLE directly

Previously, we relied on a driver hook for 3DSTATE_MULTISAMPLE.  However,
now that Vulkan and GL use the same sample positions, we can set up
3DSTATE_MULTISAMPLE directly in blorp and delete the driver hook.

Signed-off-by: Jason Ekstrand 
Reviewed-by: Anuj Phogat 

---

 src/intel/blorp/blorp_genX_exec.h   | 48 +++--
 src/intel/vulkan/genX_blorp_exec.c  | 37 --
 src/mesa/drivers/dri/i965/genX_blorp_exec.c | 13 
 3 files changed, 45 insertions(+), 53 deletions(-)

diff --git a/src/intel/blorp/blorp_genX_exec.h 
b/src/intel/blorp/blorp_genX_exec.h
index 5972cc4..aff59e1 100644
--- a/src/intel/blorp/blorp_genX_exec.h
+++ b/src/intel/blorp/blorp_genX_exec.h
@@ -23,6 +23,7 @@
 
 #include "blorp_priv.h"
 #include "common/gen_device_info.h"
+#include "common/gen_sample_positions.h"
 #include "intel_aub.h"
 
 /**
@@ -68,8 +69,6 @@ blorp_surface_reloc(struct blorp_batch *batch, uint32_t 
ss_offset,
 
 static void
 blorp_emit_urb_config(struct blorp_batch *batch, unsigned vs_entry_size);
-static void
-blorp_emit_3dstate_multisample(struct blorp_batch *batch, unsigned samples);
 
 /* BEGIN blorp_exec implementation **/
 
@@ -1021,6 +1020,49 @@ blorp_emit_sampler_state(struct blorp_batch *batch,
 #endif
 }
 
+static void
+blorp_emit_3dstate_multisample(struct blorp_batch *batch,
+   const struct blorp_params *params)
+{
+   const unsigned samples = params->dst.surf.samples;
+
+   blorp_emit(batch, GENX(3DSTATE_MULTISAMPLE), ms) {
+  ms.NumberofMultisamples   = __builtin_ffs(samples) - 1;
+
+#if GEN_GEN >= 8
+  /* The PRM says that this bit is valid only for DX9:
+   *
+   *SW can choose to set this bit only for DX9 API. DX10/OGL API's
+   *should not have any effect by setting or not setting this bit.
+   */
+  ms.PixelPositionOffsetEnable  = false;
+  ms.PixelLocation  = CENTER;
+#elif GEN_GEN >= 7
+  ms.PixelLocation  = PIXLOC_CENTER;
+
+  switch (samples) {
+  case 1:
+ GEN_SAMPLE_POS_1X(ms.Sample);
+ break;
+  case 2:
+ GEN_SAMPLE_POS_2X(ms.Sample);
+ break;
+  case 4:
+ GEN_SAMPLE_POS_4X(ms.Sample);
+ break;
+  case 8:
+ GEN_SAMPLE_POS_8X(ms.Sample);
+ break;
+  default:
+ break;
+  }
+#else
+  ms.PixelLocation  = PIXLOC_CENTER;
+  GEN_SAMPLE_POS_4X(ms.Sample);
+#endif
+   }
+}
+
 /* 3DSTATE_VIEWPORT_STATE_POINTERS */
 static void
 blorp_emit_viewport_state(struct blorp_batch *batch,
@@ -1118,7 +1160,7 @@ blorp_exec(struct blorp_batch *batch, const struct 
blorp_params *params)
if (params->src.addr.buffer)
   blorp_emit_sampler_state(batch, params);
 
-   blorp_emit_3dstate_multisample(batch, params->dst.surf.samples);
+   blorp_emit_3dstate_multisample(batch, params);
 
blorp_emit(batch, GENX(3DSTATE_SAMPLE_MASK), mask) {
   mask.SampleMask = (1 << params->dst.surf.samples) - 1;
diff --git a/src/intel/vulkan/genX_blorp_exec.c 
b/src/intel/vulkan/genX_blorp_exec.c
index 5a08ed3..a3ad97a 100644
--- a/src/intel/vulkan/genX_blorp_exec.c
+++ b/src/intel/vulkan/genX_blorp_exec.c
@@ -145,43 +145,6 @@ blorp_emit_urb_config(struct blorp_batch *batch, unsigned 
vs_entry_size)
 cmd_buffer->state.current_l3_config);
 }
 
-static void
-blorp_emit_3dstate_multisample(struct blorp_batch *batch, unsigned samples)
-{
-   blorp_emit(batch, GENX(3DSTATE_MULTISAMPLE), ms) {
-  ms.NumberofMultisamples   = __builtin_ffs(samples) - 1;
-
-#if GEN_GEN >= 8
-  /* The PRM says that this bit is valid only for DX9:
-   *
-   *SW can choose to set this bit only for DX9 API. DX10/OGL API's
-   *should not have any effect by setting or not setting this bit.
-   */
-  ms.PixelPositionOffsetEnable  = false;
-  ms.PixelLocation  = CENTER;
-#else
-  ms.PixelLocation  = PIXLOC_CENTER;
-
-  switch (samples) {
-  case 1:
- GEN_SAMPLE_POS_1X(ms.Sample);
- break;
-  case 2:
- GEN_SAMPLE_POS_2X(ms.Sample);
- break;
-  case 4:
- GEN_SAMPLE_POS_4X(ms.Sample);
- break;
-  case 8:
- GEN_SAMPLE_POS_8X(ms.Sample);
- break;
-  default:
- break;
-  }
-#endif
-   }
-}
-
 void genX(blorp_exec)(struct blorp_batch *batch,
   const struct blorp_params *params);
 
diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.c 
b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
index 47d509d..8cd5a62 100644

Mesa (master): intel: Move Vulkan sample positions to common code

2016-09-14 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: c779ad3e6613bf318a1cb006a65c45cf7054ac63
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c779ad3e6613bf318a1cb006a65c45cf7054ac63

Author: Jason Ekstrand 
Date:   Mon Sep 12 15:50:03 2016 -0700

intel: Move Vulkan sample positions to common code

Signed-off-by: Jason Ekstrand 
Reviewed-by: Anuj Phogat 

---

 .../genX_multisample.h => common/gen_sample_positions.h} | 10 +-
 src/intel/vulkan/genX_blorp_exec.c   | 10 +-
 src/intel/vulkan/genX_pipeline_util.h| 10 +-
 src/intel/vulkan/genX_state.c| 12 ++--
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/intel/vulkan/genX_multisample.h 
b/src/intel/common/gen_sample_positions.h
similarity index 94%
rename from src/intel/vulkan/genX_multisample.h
rename to src/intel/common/gen_sample_positions.h
index 0deb48f..0411bf0 100644
--- a/src/intel/vulkan/genX_multisample.h
+++ b/src/intel/common/gen_sample_positions.h
@@ -22,17 +22,17 @@
  */
 #pragma once
 
-#define SAMPLE_POS_1X(prefix) \
+#define GEN_SAMPLE_POS_1X(prefix) \
 prefix##0XOffset   = 0.5; \
 prefix##0YOffset   = 0.5;
 
-#define SAMPLE_POS_2X(prefix) \
+#define GEN_SAMPLE_POS_2X(prefix) \
 prefix##0XOffset   = 0.25; \
 prefix##0YOffset   = 0.25; \
 prefix##1XOffset   = 0.75; \
 prefix##1YOffset   = 0.75;
 
-#define SAMPLE_POS_4X(prefix) \
+#define GEN_SAMPLE_POS_4X(prefix) \
 prefix##0XOffset   = 0.375; \
 prefix##0YOffset   = 0.125; \
 prefix##1XOffset   = 0.875; \
@@ -42,7 +42,7 @@ prefix##2YOffset   = 0.625; \
 prefix##3XOffset   = 0.625; \
 prefix##3YOffset   = 0.875;
 
-#define SAMPLE_POS_8X(prefix) \
+#define GEN_SAMPLE_POS_8X(prefix) \
 prefix##0XOffset   = 0.5625; \
 prefix##0YOffset   = 0.3125; \
 prefix##1XOffset   = 0.4375; \
@@ -60,7 +60,7 @@ prefix##6YOffset   = 0.9375; \
 prefix##7XOffset   = 0.9375; \
 prefix##7YOffset   = 0.0625;
 
-#define SAMPLE_POS_16X(prefix) \
+#define GEN_SAMPLE_POS_16X(prefix) \
 prefix##0XOffset   = 0.5625; \
 prefix##0YOffset   = 0.5625; \
 prefix##1XOffset   = 0.4375; \
diff --git a/src/intel/vulkan/genX_blorp_exec.c 
b/src/intel/vulkan/genX_blorp_exec.c
index 889c423..5a08ed3 100644
--- a/src/intel/vulkan/genX_blorp_exec.c
+++ b/src/intel/vulkan/genX_blorp_exec.c
@@ -24,7 +24,6 @@
 #include 
 
 #include "anv_private.h"
-#include "genX_multisample.h"
 
 /* These are defined in anv_private.h and blorp_genX_exec.h */
 #undef __gen_address_type
@@ -32,6 +31,7 @@
 #undef __gen_combine_address
 
 #include "common/gen_l3_config.h"
+#include "common/gen_sample_positions.h"
 #include "blorp/blorp_genX_exec.h"
 
 static void *
@@ -164,16 +164,16 @@ blorp_emit_3dstate_multisample(struct blorp_batch *batch, 
unsigned samples)
 
   switch (samples) {
   case 1:
- SAMPLE_POS_1X(ms.Sample);
+ GEN_SAMPLE_POS_1X(ms.Sample);
  break;
   case 2:
- SAMPLE_POS_2X(ms.Sample);
+ GEN_SAMPLE_POS_2X(ms.Sample);
  break;
   case 4:
- SAMPLE_POS_4X(ms.Sample);
+ GEN_SAMPLE_POS_4X(ms.Sample);
  break;
   case 8:
- SAMPLE_POS_8X(ms.Sample);
+ GEN_SAMPLE_POS_8X(ms.Sample);
  break;
   default:
  break;
diff --git a/src/intel/vulkan/genX_pipeline_util.h 
b/src/intel/vulkan/genX_pipeline_util.h
index 2c0bf3f..0ff92f1 100644
--- a/src/intel/vulkan/genX_pipeline_util.h
+++ b/src/intel/vulkan/genX_pipeline_util.h
@@ -22,8 +22,8 @@
  */
 
 #include "common/gen_l3_config.h"
+#include "common/gen_sample_positions.h"
 #include "vk_format_info.h"
-#include "genX_multisample.h"
 
 static uint32_t
 vertex_element_comp_control(enum isl_format format, unsigned comp)
@@ -610,16 +610,16 @@ emit_ms_state(struct anv_pipeline *pipeline,
 
   switch (samples) {
   case 1:
- SAMPLE_POS_1X(ms.Sample);
+ GEN_SAMPLE_POS_1X(ms.Sample);
  break;
   case 2:
- SAMPLE_POS_2X(ms.Sample);
+ GEN_SAMPLE_POS_2X(ms.Sample);
  break;
   case 4:
- SAMPLE_POS_4X(ms.Sample);
+ GEN_SAMPLE_POS_4X(ms.Sample);
  break;
   case 8:
- SAMPLE_POS_8X(ms.Sample);
+ GEN_SAMPLE_POS_8X(ms.Sample);
  break;
   default:
  break;
diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index 2849b50..a6d405d 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -28,8 +28,8 @@
 #include 
 
 #include "anv_private.h"
-#include "genX_multisample.h"
 
+#include "common/gen_sample_positions.h"
 #include "genxml/gen_macros.h"
 #include "genxml/genX_pack.h"
 
@@ -77,12 +77,12 @@ genX(init_device_state)(struct anv_device *device)
 * VkPhysicalDeviceFeatures::standardSampleLocations.
 */
anv_batch_emit(, GENX(3DSTATE_SAMPLE_PATTERN), sp) {
-  SAMPLE_POS_1X(sp._1xSample);
-  

Mesa (master): Revert "tgsi/scan: don' t set interp flags for inputs only used by INTERP instructions"

2016-09-14 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: f019255acf4e3dab40f9504390357cd7798dd3e0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f019255acf4e3dab40f9504390357cd7798dd3e0

Author: Marek Olšák 
Date:   Thu Sep 15 00:46:26 2016 +0200

Revert "tgsi/scan: don't set interp flags for inputs only used by INTERP 
instructions"

This reverts commit 524fd55d2d973f50a5d8bc2255684610f5faae32.

Reason: https://bugs.freedesktop.org/show_bug.cgi?id=97808

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 105 +++--
 1 file changed, 48 insertions(+), 57 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 39e4dd9..a3b0d9f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -102,7 +102,6 @@ scan_instruction(struct tgsi_shader_info *info,
 {
unsigned i;
bool is_mem_inst = false;
-   bool is_interp_instruction = false;
 
assert(fullinst->Instruction.Opcode < TGSI_OPCODE_LAST);
info->opcode_count[fullinst->Instruction.Opcode]++;
@@ -128,8 +127,6 @@ scan_instruction(struct tgsi_shader_info *info,
   const struct tgsi_full_src_register *src0 = >Src[0];
   unsigned input;
 
-  is_interp_instruction = true;
-
   if (src0->Register.Indirect && src0->Indirect.ArrayID)
  input = info->input_array_first[src0->Indirect.ArrayID];
   else
@@ -193,16 +190,12 @@ scan_instruction(struct tgsi_shader_info *info,
 info->input_usage_mask[ind] |= usage_mask;
  }
 
- if (info->processor == PIPE_SHADER_FRAGMENT) {
-unsigned name, index, input;
-
-if (src->Register.Indirect && src->Indirect.ArrayID)
-   input = info->input_array_first[src->Indirect.ArrayID];
-else
-   input = src->Register.Index;
-
-name = info->input_semantic_name[input];
-index = info->input_semantic_index[input];
+ if (info->processor == PIPE_SHADER_FRAGMENT &&
+ !src->Register.Indirect) {
+unsigned name =
+   info->input_semantic_name[src->Register.Index];
+unsigned index =
+   info->input_semantic_index[src->Register.Index];
 
 if (name == TGSI_SEMANTIC_POSITION &&
 (src->Register.SwizzleX == TGSI_SWIZZLE_Z ||
@@ -220,50 +213,6 @@ scan_instruction(struct tgsi_shader_info *info,
 
info->colors_read |= mask << (index * 4);
 }
-
-/* Process only interpolated varyings. Don't include POSITION.
- * Don't include integer varyings, because they are not
- * interpolated. Don't process inputs interpolated by INTERP
- * opcodes. Those are tracked separately.
- */
-if ((!is_interp_instruction || i != 0) &&
-(name == TGSI_SEMANTIC_GENERIC ||
- name == TGSI_SEMANTIC_TEXCOORD ||
- name == TGSI_SEMANTIC_COLOR ||
- name == TGSI_SEMANTIC_BCOLOR ||
- name == TGSI_SEMANTIC_FOG ||
- name == TGSI_SEMANTIC_CLIPDIST)) {
-   switch (info->input_interpolate[index]) {
-   case TGSI_INTERPOLATE_COLOR:
-   case TGSI_INTERPOLATE_PERSPECTIVE:
-  switch (info->input_interpolate_loc[index]) {
-  case TGSI_INTERPOLATE_LOC_CENTER:
- info->uses_persp_center = TRUE;
- break;
-  case TGSI_INTERPOLATE_LOC_CENTROID:
- info->uses_persp_centroid = TRUE;
- break;
-  case TGSI_INTERPOLATE_LOC_SAMPLE:
- info->uses_persp_sample = TRUE;
- break;
-  }
-  break;
-   case TGSI_INTERPOLATE_LINEAR:
-  switch (info->input_interpolate_loc[index]) {
-  case TGSI_INTERPOLATE_LOC_CENTER:
- info->uses_linear_center = TRUE;
- break;
-  case TGSI_INTERPOLATE_LOC_CENTROID:
- info->uses_linear_centroid = TRUE;
- break;
-  case TGSI_INTERPOLATE_LOC_SAMPLE:
- info->uses_linear_sample = TRUE;
- break;
-  }
-  break;
-  /* TGSI_INTERPOLATE_CONSTANT doesn't do any interpolation. */
-   }
-}
  }
   }
 
@@ -408,6 +357,48 @@ scan_declaration(struct tgsi_shader_info *info,
 assert(reg < info->num_inputs);
  }
 
+ /* Only interpolated varyings. Don't include POSITION.
+  * Don't include integer varyings, because they are not
+  * interpolated.
+  */
+ if (semName == TGSI_SEMANTIC_GENERIC ||
+ semName == TGSI_SEMANTIC_TEXCOORD ||
+ semName == 

Mesa (master): 57 new commits

2016-09-14 Thread Francisco Jerez
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d861968ca2f3e196ce4bcad4f2b91b5a63ce0f1
Author: Francisco Jerez 
Date:   Thu Sep 1 22:37:57 2016 -0700

i965/vec4: Assert that pull constant load offsets are 16B-aligned.

Non-16B-aligned pull constant loads are unlikely to be particularly
useful given that you can get roughly the same effect by using
swizzles on the result.

Reviewed-by: Iago Toral Quiroga 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ca35c63673dad28854c00ce34ec6f085ba4ec5e
Author: Francisco Jerez 
Date:   Thu Sep 1 22:39:00 2016 -0700

i965/vec4: Assert that ATTR regions are register-aligned.

It might be useful to actually handle this once copy propagation
becomes smarter about register-misaligned offsets.

Reviewed-by: Iago Toral Quiroga 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f33a8f8fcfb6ce3baa8813b32d5eff20506f3df1
Author: Francisco Jerez 
Date:   Thu Sep 1 22:36:15 2016 -0700

i965/vec4: Don't spill non-GRF-aligned register regions.

A better fix would be to do something along the lines of the FS
back-end spilling code and emit a scratch read before any instruction
that overwrites the register to spill partially due to a non-zero
sub-register offset.  In the meantime mark registers used with a
non-zero sub-register offset as no-spill to prevent the spilling code
from miscompiling the program.

Reviewed-by: Iago Toral Quiroga 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8531f943d9aac13489a02e5a5b4bfa381c465a44
Author: Francisco Jerez 
Date:   Thu Sep 1 22:31:43 2016 -0700

i965/vec4: Fix copy propagation for non-register-aligned regions.

This prevents it from trying to propagate a copy through a
register-misaligned region.  MOV instructions with a misaligned
destination shouldn't be treated as a direct GRF copy, because they
only define the destination GRFs partially.  Also fix the interference
check implemented with is_channel_updated() to consider overlapping
regions with different register offset to interfere, since the
writemask check implemented in the function is only valid under the
assumption that the source and destination regions are aligned
component by component.

Reviewed-by: Iago Toral Quiroga 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e657b7b55bc7c83c8eb5258cd9522b0e5e581b7
Author: Francisco Jerez 
Date:   Thu Sep 1 22:26:59 2016 -0700

i965/vec4: Compare full register offsets in cmod propagation.

Cmod propagation would misoptimize the program if the destination
offset of the generating instruction wasn't exactly the same as the
source region offset of the copy instruction.  In preparation for
adding support for sub-GRF offsets to the VEC4 IR.

Reviewed-by: Iago Toral Quiroga 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8bed1adfc144d9ae8d55ccb9b277942da8a78064
Author: Francisco Jerez 
Date:   Thu Sep 1 22:12:04 2016 -0700

i965/vec4: Assign correct destination offset to rewritten instruction in 
register coalesce.

Because the pass already checks that the destination offset of each
'scan_inst' that needs to be rewritten matches 'inst->src[0].offset'
exactly, the final offset of the rewritten instruction is just the
original destination offset of the copy.  This is in preparation for
adding support for sub-GRF offsets to the VEC4 IR.

Reviewed-by: Iago Toral Quiroga 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a74e437fdec02c28749c94bc1bcf21c3c4b48d7
Author: Francisco Jerez 
Date:   Thu Sep 1 22:08:29 2016 -0700

i965/vec4: Don't coalesce registers with overlapping writes not matching 
the MOV source.

In preparation for adding support for sub-GRF offsets to the VEC4 IR.

Reviewed-by: Iago Toral Quiroga 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1bb5074474445ea9f54d0f52383f99ac0fa6128f
Author: Francisco Jerez 
Date:   Thu Sep 1 22:04:02 2016 -0700

i965/vec4: Compare full register offsets in opt_register_coalesce nop move 
check.

In preparation for adding support for sub-GRF offsets to the VEC4 IR.

Reviewed-by: Iago Toral Quiroga 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3be0d6d040753c62b25077fb6b85ad1f0808b258
Author: Francisco Jerez 
Date:   Thu Sep 1 22:02:00 2016 -0700

i965/vec4: Check that the write offsets match when setting dependency 
controls.

For simplicity just assume that two writes to the same GRF 

Mesa (master): glsl: grammar fix

2016-09-14 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 8ad5fb3a8fc5a6559909941447219a85c71e2471
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ad5fb3a8fc5a6559909941447219a85c71e2471

Author: Eero Tamminen 
Date:   Wed Sep 14 15:28:28 2016 +0100

glsl: grammar fix

Signed-off-by: Eero Tamminen 
Reviewed-by: Eric Engestrom 
Reviewed-by: Ian Romanick 

---

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

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 4440c03..f3eece2 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -750,8 +750,8 @@ validate_vertex_shader_executable(struct gl_shader_program 
*prog,
   if (!find.variable_found()) {
 if (prog->IsES) {
   linker_warning(prog,
- "vertex shader does not write to `gl_Position'."
- "It's value is undefined. \n");
+ "vertex shader does not write to `gl_Position'. "
+ "Its value is undefined. \n");
 } else {
   linker_error(prog,
"vertex shader does not write to `gl_Position'. \n");

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


Mesa (master): docs: Mention AEP in release notes

2016-09-14 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: aa70ac172e826785e35481a212a48b05f983a018
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa70ac172e826785e35481a212a48b05f983a018

Author: Kenneth Graunke 
Date:   Wed Sep 14 12:43:16 2016 -0700

docs: Mention AEP in release notes

---

 docs/relnotes/12.1.0.html | 1 +
 1 file changed, 1 insertion(+)

diff --git a/docs/relnotes/12.1.0.html b/docs/relnotes/12.1.0.html
index f68b513..fdf3592 100644
--- a/docs/relnotes/12.1.0.html
+++ b/docs/relnotes/12.1.0.html
@@ -62,6 +62,7 @@ Note: some of the new features are only available with 
certain drivers.
 GL_OES_primitive_bounding_box on i965/gen7+, nvc0, radeonsi
 GL_OES_texture_cube_map_array on i965/gen8+, nvc0, radeonsi
 GL_OES_tessellation_shader on i965/gen7+, nvc0, radeonsi
+GL_ANDROID_extension_pack_es31a on i965/gen9+
 
 
 Bug fixes

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


Mesa (master): i965: Enable ANDROID_extension_pack_es31a on Gen9+.

2016-09-14 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 8c9dddadad31028d5389e227b386d6814e2c897a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c9dddadad31028d5389e227b386d6814e2c897a

Author: Kenneth Graunke 
Date:   Tue Sep 13 17:07:36 2016 -0700

i965: Enable ANDROID_extension_pack_es31a on Gen9+.

AEP requires ASTC, which is currently only enabled on Skylake and later.
(It may be possible to extend this to Cherryview/Braswell in the future,
but earlier hardware doesn't have ASTC support.)

Signed-off-by: Kenneth Graunke 
Reviewed-by: Ilia Mirkin 

---

 src/mesa/drivers/dri/i965/intel_extensions.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c 
b/src/mesa/drivers/dri/i965/intel_extensions.c
index 0f28546..6bb73b8 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -409,6 +409,7 @@ intelInitExtensions(struct gl_context *ctx)
   ctx->Extensions.KHR_texture_compression_astc_ldr = true;
   ctx->Extensions.KHR_texture_compression_astc_sliced_3d = true;
   ctx->Extensions.ARB_shader_stencil_export = true;
+  ctx->Extensions.ANDROID_extension_pack_es31a = true;
   ctx->Extensions.MESA_shader_framebuffer_fetch = true;
}
 

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


Mesa (master): nir: Report progress from nir_lower_phis_to_scalar.

2016-09-14 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 2d8a3fa7ea994ad02a40ff497109f966e3fcbeec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d8a3fa7ea994ad02a40ff497109f966e3fcbeec

Author: Kenneth Graunke 
Date:   Tue Sep 13 15:14:28 2016 -0700

nir: Report progress from nir_lower_phis_to_scalar.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Eric Anholt 

---

 src/compiler/nir/nir.h  |  2 +-
 src/compiler/nir/nir_lower_phis_to_scalar.c | 20 +++-
 src/gallium/drivers/freedreno/ir3/ir3_nir.c |  2 +-
 src/gallium/drivers/vc4/vc4_program.c   |  3 +--
 src/mesa/drivers/dri/i965/brw_nir.c |  2 +-
 5 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 3b3d6ae..94eae6d 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2413,7 +2413,7 @@ bool nir_lower_vec_to_movs(nir_shader *shader);
 bool nir_lower_alu_to_scalar(nir_shader *shader);
 void nir_lower_load_const_to_scalar(nir_shader *shader);
 
-void nir_lower_phis_to_scalar(nir_shader *shader);
+bool nir_lower_phis_to_scalar(nir_shader *shader);
 void nir_lower_io_to_scalar(nir_shader *shader, nir_variable_mode mask);
 
 void nir_lower_samplers(nir_shader *shader,
diff --git a/src/compiler/nir/nir_lower_phis_to_scalar.c 
b/src/compiler/nir/nir_lower_phis_to_scalar.c
index 9fd00cc..b12718f 100644
--- a/src/compiler/nir/nir_lower_phis_to_scalar.c
+++ b/src/compiler/nir/nir_lower_phis_to_scalar.c
@@ -166,6 +166,8 @@ static bool
 lower_phis_to_scalar_block(nir_block *block,
struct lower_phis_to_scalar_state *state)
 {
+   bool progress = false;
+
/* Find the last phi node in the block */
nir_phi_instr *last_phi = NULL;
nir_foreach_instr(instr, block) {
@@ -248,6 +250,8 @@ lower_phis_to_scalar_block(nir_block *block,
   ralloc_steal(state->dead_ctx, phi);
   nir_instr_remove(>instr);
 
+  progress = true;
+
   /* We're using the safe iterator and inserting all the newly
* scalarized phi nodes before their non-scalarized version so that's
* ok.  However, we are also inserting vec operations after all of
@@ -258,13 +262,14 @@ lower_phis_to_scalar_block(nir_block *block,
  break;
}
 
-   return true;
+   return progress;
 }
 
-static void
+static bool
 lower_phis_to_scalar_impl(nir_function_impl *impl)
 {
struct lower_phis_to_scalar_state state;
+   bool progress = false;
 
state.mem_ctx = ralloc_parent(impl);
state.dead_ctx = ralloc_context(NULL);
@@ -272,13 +277,14 @@ lower_phis_to_scalar_impl(nir_function_impl *impl)
  _mesa_key_pointer_equal);
 
nir_foreach_block(block, impl) {
-  lower_phis_to_scalar_block(block, );
+  progress = lower_phis_to_scalar_block(block, ) || progress;
}
 
nir_metadata_preserve(impl, nir_metadata_block_index |
nir_metadata_dominance);
 
ralloc_free(state.dead_ctx);
+   return progress;
 }
 
 /** A pass that lowers vector phi nodes to scalar
@@ -288,11 +294,15 @@ lower_phis_to_scalar_impl(nir_function_impl *impl)
  * instance, if one of the sources is a non-scalarizable vector, then we
  * don't bother lowering because that would generate hard-to-coalesce movs.
  */
-void
+bool
 nir_lower_phis_to_scalar(nir_shader *shader)
 {
+   bool progress = false;
+
nir_foreach_function(function, shader) {
   if (function->impl)
- lower_phis_to_scalar_impl(function->impl);
+ progress = lower_phis_to_scalar_impl(function->impl) || progress;
}
+
+   return progress;
 }
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.c 
b/src/gallium/drivers/freedreno/ir3/ir3_nir.c
index 2526222..2d86a52 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.c
@@ -91,7 +91,7 @@ ir3_optimize_loop(nir_shader *s)
 
OPT_V(s, nir_lower_vars_to_ssa);
progress |= OPT(s, nir_lower_alu_to_scalar);
-   OPT_V(s, nir_lower_phis_to_scalar);
+   progress |= OPT(s, nir_lower_phis_to_scalar);
 
progress |= OPT(s, nir_copy_prop);
progress |= OPT(s, nir_opt_dce);
diff --git a/src/gallium/drivers/vc4/vc4_program.c 
b/src/gallium/drivers/vc4/vc4_program.c
index 24e4699..986a1ff 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -1424,8 +1424,7 @@ vc4_optimize_nir(struct nir_shader *s)
 
 NIR_PASS_V(s, nir_lower_vars_to_ssa);
 NIR_PASS(progress, s, nir_lower_alu_to_scalar);
-NIR_PASS_V(s, nir_lower_phis_to_scalar);
-
+NIR_PASS(progress, s, nir_lower_phis_to_scalar);
 NIR_PASS(progress, s, nir_copy_prop);
 NIR_PASS(progress, s, nir_opt_remove_phis);
 NIR_PASS(progress, s, nir_opt_dce);
diff 

Mesa (master): nir: Call nir_metadata_preserve from nir_lower_alu_to_scalar().

2016-09-14 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: e6eed3533e578f29e1e40c5db10c44df003fc8da
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6eed3533e578f29e1e40c5db10c44df003fc8da

Author: Kenneth Graunke 
Date:   Tue Sep 13 15:17:29 2016 -0700

nir: Call nir_metadata_preserve from nir_lower_alu_to_scalar().

This is mandatory.

Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Kenneth Graunke 
Reviewed-by: Eric Anholt 

---

 src/compiler/nir/nir_lower_alu_to_scalar.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir_lower_alu_to_scalar.c 
b/src/compiler/nir/nir_lower_alu_to_scalar.c
index 4f72cf7..a84fbdf 100644
--- a/src/compiler/nir/nir_lower_alu_to_scalar.c
+++ b/src/compiler/nir/nir_lower_alu_to_scalar.c
@@ -254,6 +254,9 @@ nir_lower_alu_to_scalar_impl(nir_function_impl *impl)
 lower_alu_instr_scalar(nir_instr_as_alu(instr), );
   }
}
+
+   nir_metadata_preserve(impl, nir_metadata_block_index |
+   nir_metadata_dominance);
 }
 
 void

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


Mesa (master): nir: Report progress from nir_lower_alu_to_scalar.

2016-09-14 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 32630e211e60a2b41388d403cfbd4f43344d8590
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=32630e211e60a2b41388d403cfbd4f43344d8590

Author: Kenneth Graunke 
Date:   Tue Sep 13 15:14:28 2016 -0700

nir: Report progress from nir_lower_alu_to_scalar.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Eric Anholt 

---

 src/compiler/nir/nir.h  |  2 +-
 src/compiler/nir/nir_lower_alu_to_scalar.c  | 42 ++---
 src/gallium/drivers/freedreno/ir3/ir3_nir.c |  2 +-
 src/gallium/drivers/vc4/vc4_program.c   |  2 +-
 src/mesa/drivers/dri/i965/brw_nir.c |  2 +-
 5 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 6f85bdb..3b3d6ae 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2410,7 +2410,7 @@ bool nir_remove_dead_variables(nir_shader *shader, 
nir_variable_mode modes);
 
 void nir_move_vec_src_uses_to_dest(nir_shader *shader);
 bool nir_lower_vec_to_movs(nir_shader *shader);
-void nir_lower_alu_to_scalar(nir_shader *shader);
+bool nir_lower_alu_to_scalar(nir_shader *shader);
 void nir_lower_load_const_to_scalar(nir_shader *shader);
 
 void nir_lower_phis_to_scalar(nir_shader *shader);
diff --git a/src/compiler/nir/nir_lower_alu_to_scalar.c 
b/src/compiler/nir/nir_lower_alu_to_scalar.c
index a84fbdf..fa18deb 100644
--- a/src/compiler/nir/nir_lower_alu_to_scalar.c
+++ b/src/compiler/nir/nir_lower_alu_to_scalar.c
@@ -73,7 +73,7 @@ lower_reduction(nir_alu_instr *instr, nir_op chan_op, nir_op 
merge_op,
nir_instr_remove(>instr);
 }
 
-static void
+static bool
 lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
 {
unsigned num_src = nir_op_infos[instr->op].num_inputs;
@@ -90,7 +90,7 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
case name##3: \
case name##4: \
   lower_reduction(instr, chan, merge, b); \
-  return;
+  return true;
 
switch (instr->op) {
case nir_op_vec4:
@@ -99,11 +99,11 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
   /* We don't need to scalarize these ops, they're the ones generated to
* group up outputs into a value that can be SSAed.
*/
-  return;
+  return false;
 
case nir_op_pack_half_2x16:
   if (!b->shader->options->lower_pack_half_2x16)
- return;
+ return false;
 
   nir_ssa_def *val =
  nir_pack_half_2x16_split(b, nir_channel(b, instr->src[0].src.ssa,
@@ -113,7 +113,7 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
 
   nir_ssa_def_rewrite_uses(>dest.dest.ssa, nir_src_for_ssa(val));
   nir_instr_remove(>instr);
-  return;
+  return true;
 
case nir_op_unpack_unorm_4x8:
case nir_op_unpack_snorm_4x8:
@@ -122,11 +122,11 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder 
*b)
   /* There is no scalar version of these ops, unless we were to break it
* down to bitshifts and math (which is definitely not intended).
*/
-  return;
+  return false;
 
case nir_op_unpack_half_2x16: {
   if (!b->shader->options->lower_unpack_half_2x16)
- return;
+ return false;
 
   nir_ssa_def *comps[2];
   comps[0] = nir_unpack_half_2x16_split_x(b, instr->src[0].src.ssa);
@@ -135,7 +135,7 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
 
   nir_ssa_def_rewrite_uses(>dest.dest.ssa, nir_src_for_ssa(vec));
   nir_instr_remove(>instr);
-  return;
+  return true;
}
 
case nir_op_pack_uvec2_to_uint: {
@@ -185,11 +185,11 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder 
*b)
 
   nir_ssa_def_rewrite_uses(>dest.dest.ssa, nir_src_for_ssa(val));
   nir_instr_remove(>instr);
-  return;
+  return true;
}
 
case nir_op_unpack_double_2x32:
-  return;
+  return false;
 
   LOWER_REDUCTION(nir_op_fdot, nir_op_fmul, nir_op_fadd);
   LOWER_REDUCTION(nir_op_ball_fequal, nir_op_feq, nir_op_iand);
@@ -204,7 +204,7 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
}
 
if (instr->dest.dest.ssa.num_components == 1)
-  return;
+  return false;
 
unsigned num_components = instr->dest.dest.ssa.num_components;
nir_ssa_def *comps[] = { NULL, NULL, NULL, NULL };
@@ -240,30 +240,40 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder 
*b)
nir_ssa_def_rewrite_uses(>dest.dest.ssa, nir_src_for_ssa(vec));
 
nir_instr_remove(>instr);
+   return true;
 }
 
-static void
+static bool
 nir_lower_alu_to_scalar_impl(nir_function_impl *impl)
 {
nir_builder builder;
nir_builder_init(, impl);
+   bool progress = false;
 
nir_foreach_block(block, impl) {
   nir_foreach_instr_safe(instr, block) {
- if (instr->type == nir_instr_type_alu)
-lower_alu_instr_scalar(nir_instr_as_alu(instr), );
+ if 

Mesa (master): nir/lower_tex: fix typo with sample_dim

2016-09-14 Thread Rob Clark
Module: Mesa
Branch: master
Commit: bff90aedf1d06c7e746b2d56319b19a624594feb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bff90aedf1d06c7e746b2d56319b19a624594feb

Author: Rob Clark 
Date:   Thu Sep  8 15:49:49 2016 -0400

nir/lower_tex: fix typo with sample_dim

Numeric 2 is actually GLSL_SAMPLER_DIM_3D, which I don't think is what
was intended.

Signed-off-by: Rob Clark 
Reviewed-by: Jason Ekstrand 

---

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

diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index a405758..0efd443 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -211,7 +211,7 @@ sample_plane(nir_builder *b, nir_tex_instr *tex, int plane)
plane_tex->src[1].src = nir_src_for_ssa(nir_imm_int(b, plane));
plane_tex->src[1].src_type = nir_tex_src_plane;
plane_tex->op = nir_texop_tex;
-   plane_tex->sampler_dim = 2;
+   plane_tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
plane_tex->dest_type = nir_type_float;
plane_tex->coord_components = 2;
 

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


Mesa (master): nir/lower_tex: remove tex_instr_find_src()

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

Author: Rob Clark 
Date:   Thu Sep  8 14:05:39 2016 -0400

nir/lower_tex: remove tex_instr_find_src()

Turns out it already exists.. so don't duplicate it.

Signed-off-by: Rob Clark 
Reviewed-by: Jason Ekstrand 

---

 src/compiler/nir/nir_lower_tex.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 93637a3..b570598 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -38,17 +38,6 @@
 #include "nir.h"
 #include "nir_builder.h"
 
-static int
-tex_instr_find_src(nir_tex_instr *tex, nir_tex_src_type src_type)
-{
-   for (unsigned i = 0; i < tex->num_srcs; i++) {
-  if (tex->src[i].src_type == src_type)
- return i;
-   }
-
-   return -1;
-}
-
 static void
 tex_instr_remove_src(nir_tex_instr *tex, unsigned src_idx)
 {
@@ -69,7 +58,7 @@ static void
 project_src(nir_builder *b, nir_tex_instr *tex)
 {
/* Find the projector in the srcs list, if present. */
-   int proj_index = tex_instr_find_src(tex, nir_tex_src_projector);
+   int proj_index = nir_tex_instr_src_index(tex, nir_tex_src_projector);
if (proj_index < 0)
   return;
 
@@ -131,11 +120,11 @@ project_src(nir_builder *b, nir_tex_instr *tex)
 static bool
 lower_offset(nir_builder *b, nir_tex_instr *tex)
 {
-   int offset_index = tex_instr_find_src(tex, nir_tex_src_offset);
+   int offset_index = nir_tex_instr_src_index(tex, nir_tex_src_offset);
if (offset_index < 0)
   return false;
 
-   int coord_index = tex_instr_find_src(tex, nir_tex_src_coord);
+   int coord_index = nir_tex_instr_src_index(tex, nir_tex_src_coord);
assert(coord_index >= 0);
 
assert(tex->src[offset_index].src.is_ssa);

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


Mesa (master): nir: move tex_instr_remove_src

2016-09-14 Thread Rob Clark
Module: Mesa
Branch: master
Commit: 1a8424cebaeaf46a01000624a46764f3e84dad85
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a8424cebaeaf46a01000624a46764f3e84dad85

Author: Rob Clark 
Date:   Thu Sep  8 14:07:06 2016 -0400

nir: move tex_instr_remove_src

I want to re-use this in a different pass, so move to nir.h

Signed-off-by: Rob Clark 
Reviewed-by: Jason Ekstrand 

---

 src/compiler/nir/nir.c   | 16 
 src/compiler/nir/nir.h   |  2 ++
 src/compiler/nir/nir_lower_tex.c | 20 ++--
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 6bebb73..13ba989 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -536,6 +536,22 @@ nir_tex_instr_create(nir_shader *shader, unsigned num_srcs)
return instr;
 }
 
+void
+nir_tex_instr_remove_src(nir_tex_instr *tex, unsigned src_idx)
+{
+   assert(src_idx < tex->num_srcs);
+
+   /* First rewrite the source to NIR_SRC_INIT */
+   nir_instr_rewrite_src(>instr, >src[src_idx].src, NIR_SRC_INIT);
+
+   /* Now, move all of the other sources down */
+   for (unsigned i = src_idx + 1; i < tex->num_srcs; i++) {
+  tex->src[i-1].src_type = tex->src[i].src_type;
+  nir_instr_move_src(>instr, >src[i-1].src, >src[i].src);
+   }
+   tex->num_srcs--;
+}
+
 nir_phi_instr *
 nir_phi_instr_create(nir_shader *shader)
 {
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index ff7c422..6f85bdb 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1329,6 +1329,8 @@ nir_tex_instr_src_index(nir_tex_instr *instr, 
nir_tex_src_type type)
return -1;
 }
 
+void nir_tex_instr_remove_src(nir_tex_instr *tex, unsigned src_idx);
+
 typedef union {
float f32[4];
double f64[4];
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index b570598..a405758 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -39,22 +39,6 @@
 #include "nir_builder.h"
 
 static void
-tex_instr_remove_src(nir_tex_instr *tex, unsigned src_idx)
-{
-   assert(src_idx < tex->num_srcs);
-
-   /* First rewrite the source to NIR_SRC_INIT */
-   nir_instr_rewrite_src(>instr, >src[src_idx].src, NIR_SRC_INIT);
-
-   /* Now, move all of the other sources down */
-   for (unsigned i = src_idx + 1; i < tex->num_srcs; i++) {
-  tex->src[i-1].src_type = tex->src[i].src_type;
-  nir_instr_move_src(>instr, >src[i-1].src, >src[i].src);
-   }
-   tex->num_srcs--;
-}
-
-static void
 project_src(nir_builder *b, nir_tex_instr *tex)
 {
/* Find the projector in the srcs list, if present. */
@@ -114,7 +98,7 @@ project_src(nir_builder *b, nir_tex_instr *tex)
 nir_src_for_ssa(projected));
}
 
-   tex_instr_remove_src(tex, proj_index);
+   nir_tex_instr_remove_src(tex, proj_index);
 }
 
 static bool
@@ -159,7 +143,7 @@ lower_offset(nir_builder *b, nir_tex_instr *tex)
nir_instr_rewrite_src(>instr, >src[coord_index].src,
  nir_src_for_ssa(offset_coord));
 
-   tex_instr_remove_src(tex, offset_index);
+   nir_tex_instr_remove_src(tex, offset_index);
 
return true;
 }

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


Mesa (master): egl: Factor out _eglGetSyncAttribCommon

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: 1d535c1e83ae45b67a141420298c5d08082e0ed8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d535c1e83ae45b67a141420298c5d08082e0ed8

Author: Kyle Brenneman 
Date:   Mon Sep 12 17:46:04 2016 -0400

egl: Factor out _eglGetSyncAttribCommon

Reviewed-by: Adam Jackson 
Reviewed-by: Emil Velikov 

---

 src/egl/main/eglapi.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index dd4fd2c..1c62a80 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1570,11 +1570,9 @@ eglSignalSyncKHR(EGLDisplay dpy, EGLSync sync, EGLenum 
mode)
 }
 
 
-EGLBoolean EGLAPIENTRY
-eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib 
*value)
+static EGLBoolean
+_eglGetSyncAttribCommon(_EGLDisplay *disp, _EGLSync *s, EGLint attribute, 
EGLAttrib *value)
 {
-   _EGLDisplay *disp = _eglLockDisplay(dpy);
-   _EGLSync *s = _eglLookupSync(sync, disp);
_EGLDriver *drv;
EGLBoolean ret;
 
@@ -1586,10 +1584,20 @@ eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint 
attribute, EGLAttrib *valu
RETURN_EGL_EVAL(disp, ret);
 }
 
+EGLBoolean EGLAPIENTRY
+eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib 
*value)
+{
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   _EGLSync *s = _eglLookupSync(sync, disp);
+   return _eglGetSyncAttribCommon(disp, s, attribute, value);
+}
+
 
 static EGLBoolean EGLAPIENTRY
 eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint 
*value)
 {
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   _EGLSync *s = _eglLookupSync(sync, disp);
EGLAttrib attrib;
EGLBoolean result;
 
@@ -1597,7 +1605,7 @@ eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint 
attribute, EGLint *valu
   RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, EGL_FALSE);
 
attrib = *value;
-   result = eglGetSyncAttrib(dpy, sync, attribute, );
+   result = _eglGetSyncAttribCommon(disp, s, attribute, );
 
/* The EGL_KHR_fence_sync spec says this about eglGetSyncAttribKHR:
 *

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


Mesa (master): egl: Use _eglCreatePixmapSurfaceCommon consistently

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: 8cc3d9855f94cd0f2274a1831bc6fa8912ddea9c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8cc3d9855f94cd0f2274a1831bc6fa8912ddea9c

Author: Kyle Brenneman 
Date:   Mon Sep 12 17:25:56 2016 -0400

egl: Use _eglCreatePixmapSurfaceCommon consistently

This moves the native pixmap fixup to a helper function so we don't
repeat ourselves.

Reviewed-by: Adam Jackson 
Reviewed-by: Emil Velikov 

---

 src/egl/main/eglapi.c | 36 +---
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index dd2b4cc..fac2d18 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -813,6 +813,22 @@ eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig 
config,
return surface;
 }
 
+static void *
+fixupNativePixmap(_EGLDisplay *disp, void *native_pixmap)
+{
+#ifdef HAVE_X11_PLATFORM
+  /* The `native_pixmap` parameter for the X11 platform differs between
+   * eglCreatePixmapSurface() and eglCreatePlatformPixmapSurfaceEXT(). In
+   * eglCreatePixmapSurface(), the type of `native_pixmap` is an Xlib
+   * `Pixmap`. In eglCreatePlatformPixmapSurfaceEXT(), the type is
+   * `Pixmap*`.  Convert `Pixmap*` to `Pixmap` because that's what
+   * dri2_x11_create_pixmap_surface() expects.
+   */
+   if (disp->Platform == _EGL_PLATFORM_X11 && native_pixmap != NULL)
+  return (void *)(* (Pixmap*) native_pixmap);
+#endif
+   return native_pixmap;
+}
 
 static EGLSurface
 _eglCreatePixmapSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
@@ -849,19 +865,7 @@ eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, 
EGLConfig config,
 {
_EGLDisplay *disp = _eglLockDisplay(dpy);
 
-#ifdef HAVE_X11_PLATFORM
-  /* The `native_pixmap` parameter for the X11 platform differs between
-   * eglCreatePixmapSurface() and eglCreatePlatformPixmapSurfaceEXT(). In
-   * eglCreatePixmapSurface(), the type of `native_pixmap` is an Xlib
-   * `Pixmap`. In eglCreatePlatformPixmapSurfaceEXT(), the type is
-   * `Pixmap*`.  Convert `Pixmap*` to `Pixmap` because that's what
-   * dri2_x11_create_pixmap_surface() expects.
-   */
-   if (disp->Platform == _EGL_PLATFORM_X11 && native_pixmap != NULL) {
-  native_pixmap = (void*) (* (Pixmap*) native_pixmap);
-   }
-#endif
-
+   native_pixmap = fixupNativePixmap(disp, native_pixmap);
return _eglCreatePixmapSurfaceCommon(disp, config, native_pixmap,
 attrib_list);
 }
@@ -872,14 +876,16 @@ eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig 
config,
void *native_pixmap,
const EGLAttrib *attrib_list)
 {
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
EGLSurface surface;
EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list);
 
if (attrib_list && !int_attribs)
   RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_SURFACE);
 
-   surface = eglCreatePlatformPixmapSurfaceEXT(dpy, config, native_pixmap,
-   int_attribs);
+   native_pixmap = fixupNativePixmap(disp, native_pixmap);
+   surface = _eglCreatePixmapSurfaceCommon(disp, config, native_pixmap,
+   int_attribs);
free(int_attribs);
return surface;
 }

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


Mesa (master): egl: Factor out _eglWaitSyncCommon

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: 5b0b844ac9818672bc3ddcdbbb74cb892b3485f4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b0b844ac9818672bc3ddcdbbb74cb892b3485f4

Author: Kyle Brenneman 
Date:   Mon Sep 12 17:44:36 2016 -0400

egl: Factor out _eglWaitSyncCommon

Reviewed-by: Adam Jackson 
Reviewed-by: Emil Velikov 

---

 src/egl/main/eglapi.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 58d18f1..dd4fd2c 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1509,11 +1509,9 @@ eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint 
flags, EGLTime timeout)
 }
 
 
-static EGLint EGLAPIENTRY
-eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags)
+static EGLint
+_eglWaitSyncCommon(_EGLDisplay *disp, _EGLSync *s, EGLint flags)
 {
-   _EGLDisplay *disp = _eglLockDisplay(dpy);
-   _EGLSync *s = _eglLookupSync(sync, disp);
_EGLContext *ctx = _eglGetCurrentContext();
_EGLDriver *drv;
EGLint ret;
@@ -1534,6 +1532,14 @@ eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint 
flags)
RETURN_EGL_EVAL(disp, ret);
 }
 
+static EGLint EGLAPIENTRY
+eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags)
+{
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   _EGLSync *s = _eglLookupSync(sync, disp);
+   return _eglWaitSyncCommon(disp, s, flags);
+}
+
 
 EGLBoolean EGLAPIENTRY
 eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
@@ -1542,7 +1548,9 @@ eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
 * EGLBoolean. In both cases, the return values can only be EGL_FALSE and
 * EGL_TRUE.
 */
-   return eglWaitSyncKHR(dpy, sync, flags);
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   _EGLSync *s = _eglLookupSync(sync, disp);
+   return _eglWaitSyncCommon(disp, s, flags);
 }
 
 

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


Mesa (master): egl: Lock the display in _eglCreateSync's callers

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: 9a992038e722b6ea8362db1dfcf2dd5a7391
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a992038e722b6ea8362db1dfcf2dd5a7391

Author: Kyle Brenneman 
Date:   Mon Sep 12 17:40:29 2016 -0400

egl: Lock the display in _eglCreateSync's callers

Reviewed-by: Adam Jackson 
Reviewed-by: Emil Velikov 

---

 src/egl/main/eglapi.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index ba4826a..58d18f1 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1384,11 +1384,10 @@ eglDestroyImage(EGLDisplay dpy, EGLImage image)
 
 
 static EGLSync
-_eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list,
+_eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLint *attrib_list,
const EGLAttrib *attrib_list64, EGLBoolean is64,
EGLenum invalid_type_error)
 {
-   _EGLDisplay *disp = _eglLockDisplay(dpy);
_EGLContext *ctx = _eglGetCurrentContext();
_EGLDriver *drv;
_EGLSync *sync;
@@ -1400,7 +1399,7 @@ _eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLint 
*attrib_list,
   RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR);
 
/* return an error if the client API doesn't support GL_OES_EGL_sync */
-   if (!ctx || ctx->Resource.Display != dpy ||
+   if (!ctx || ctx->Resource.Display != disp ||
ctx->ClientAPI != EGL_OPENGL_ES_API)
   RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SYNC_KHR);
 
@@ -1431,7 +1430,8 @@ _eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLint 
*attrib_list,
 static EGLSync EGLAPIENTRY
 eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
 {
-   return _eglCreateSync(dpy, type, attrib_list, NULL, EGL_FALSE,
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   return _eglCreateSync(disp, type, attrib_list, NULL, EGL_FALSE,
  EGL_BAD_ATTRIBUTE);
 }
 
@@ -1439,7 +1439,8 @@ eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const 
EGLint *attrib_list)
 static EGLSync EGLAPIENTRY
 eglCreateSync64KHR(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
 {
-   return _eglCreateSync(dpy, type, NULL, attrib_list, EGL_TRUE,
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   return _eglCreateSync(disp, type, NULL, attrib_list, EGL_TRUE,
  EGL_BAD_ATTRIBUTE);
 }
 
@@ -1447,7 +1448,8 @@ eglCreateSync64KHR(EGLDisplay dpy, EGLenum type, const 
EGLAttrib *attrib_list)
 EGLSync EGLAPIENTRY
 eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
 {
-   return _eglCreateSync(dpy, type, NULL, attrib_list, EGL_TRUE,
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   return _eglCreateSync(disp, type, NULL, attrib_list, EGL_TRUE,
  EGL_BAD_PARAMETER);
 }
 

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


Mesa (master): egl: Use _eglCreateWindowSurfaceCommon consistently

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: 7d7ae5e1c3451174a3c8dec2d50763a40069fe5b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d7ae5e1c3451174a3c8dec2d50763a40069fe5b

Author: Kyle Brenneman 
Date:   Mon Sep 12 17:04:38 2016 -0400

egl: Use _eglCreateWindowSurfaceCommon consistently

This moves the native window fixup to a helper function so we don't
repeat ourselves.

Reviewed-by: Adam Jackson 
Reviewed-by: Emil Velikov 

---

 src/egl/main/eglapi.c | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index df355a5..dd2b4cc 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -762,14 +762,9 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
 attrib_list);
 }
 
-
-static EGLSurface EGLAPIENTRY
-eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config,
-  void *native_window,
-  const EGLint *attrib_list)
+static void *
+fixupNativeWindow(_EGLDisplay *disp, void *native_window)
 {
-   _EGLDisplay *disp = _eglLockDisplay(dpy);
-
 #ifdef HAVE_X11_PLATFORM
if (disp->Platform == _EGL_PLATFORM_X11 && native_window != NULL) {
   /* The `native_window` parameter for the X11 platform differs between
@@ -779,9 +774,20 @@ eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, 
EGLConfig config,
* `Window*`.  Convert `Window*` to `Window` because that's what
* dri2_x11_create_window_surface() expects.
*/
-  native_window = (void*) (* (Window*) native_window);
+  return (void *)(* (Window*) native_window);
}
 #endif
+   return native_window;
+}
+
+static EGLSurface EGLAPIENTRY
+eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config,
+  void *native_window,
+  const EGLint *attrib_list)
+{
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+
+   native_window = fixupNativeWindow(disp, native_window);
 
return _eglCreateWindowSurfaceCommon(disp, config, native_window,
 attrib_list);
@@ -793,14 +799,16 @@ eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig 
config,
void *native_window,
const EGLAttrib *attrib_list)
 {
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
EGLSurface surface;
EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list);
 
if (attrib_list && !int_attribs)
   RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_SURFACE);
 
-   surface = eglCreatePlatformWindowSurfaceEXT(dpy, config, native_window,
-   int_attribs);
+   native_window = fixupNativeWindow(disp, native_window);
+   surface = _eglCreateWindowSurfaceCommon(disp, config, native_window,
+   int_attribs);
free(int_attribs);
return surface;
 }

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


Mesa (master): egl: Factor out _eglWaitClientCommon

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: 82a2e2cb5024c37a1779594320f23f225a83c79d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=82a2e2cb5024c37a1779594320f23f225a83c79d

Author: Kyle Brenneman 
Date:   Mon Sep 12 17:35:22 2016 -0400

egl: Factor out _eglWaitClientCommon

Reviewed-by: Adam Jackson 
Reviewed-by: Emil Velikov 

---

 src/egl/main/eglapi.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index fac2d18..a74e5e4 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1081,8 +1081,8 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, 
EGLNativePixmapType target)
 }
 
 
-EGLBoolean EGLAPIENTRY
-eglWaitClient(void)
+static EGLBoolean
+_eglWaitClientCommon(void)
 {
_EGLContext *ctx = _eglGetCurrentContext();
_EGLDisplay *disp;
@@ -1108,12 +1108,17 @@ eglWaitClient(void)
RETURN_EGL_EVAL(disp, ret);
 }
 
+EGLBoolean EGLAPIENTRY
+eglWaitClient(void)
+{
+   return _eglWaitClientCommon();
+}
 
 EGLBoolean EGLAPIENTRY
 eglWaitGL(void)
 {
/* Since we only support OpenGL and GLES, eglWaitGL is equivalent to 
eglWaitClient. */
-   return eglWaitClient();
+   return _eglWaitClientCommon();
 }
 
 

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


Mesa (master): egl: Add storage for EGL_KHR_debug's state to EGL objects

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: 7206b3a5565c0835589f85388ae9c121dfd5b5a5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7206b3a5565c0835589f85388ae9c121dfd5b5a5

Author: Kyle Brenneman 
Date:   Mon Sep 12 16:15:10 2016 -0400

egl: Add storage for EGL_KHR_debug's state to EGL objects

Reviewed-by: Adam Jackson 
Reviewed-by: Emil Velikov 

---

 src/egl/main/eglcurrent.c |  3 +--
 src/egl/main/eglcurrent.h |  8 
 src/egl/main/egldisplay.h |  4 
 src/egl/main/eglglobals.c |  5 -
 src/egl/main/eglglobals.h | 10 ++
 5 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c
index 2a225bc..f093bec 100644
--- a/src/egl/main/eglcurrent.c
+++ b/src/egl/main/eglcurrent.c
@@ -35,10 +35,9 @@
 #include "eglcurrent.h"
 #include "eglglobals.h"
 
-
 /* This should be kept in sync with _eglInitThreadInfo() */
 #define _EGL_THREAD_INFO_INITIALIZER \
-   { EGL_SUCCESS, NULL, 0 }
+   { EGL_SUCCESS, NULL, 0, NULL, NULL, NULL }
 
 /* a fallback thread info to guarantee that every thread always has one */
 static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER;
diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h
index b922435..b2638fd 100644
--- a/src/egl/main/eglcurrent.h
+++ b/src/egl/main/eglcurrent.h
@@ -54,6 +54,14 @@ struct _egl_thread_info
EGLint LastError;
_EGLContext *CurrentContext;
EGLenum CurrentAPI;
+   EGLLabelKHR Label;
+
+   /**
+* The name of the EGL function that's being called at the moment. This is
+* used to report the function name to the EGL_KHR_debug callback.
+*/
+   const char *CurrentFuncName;
+   EGLLabelKHR CurrentObjectLabel;
 };
 
 
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 6f3340e..22fb5c8 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -79,6 +79,8 @@ struct _egl_resource
EGLBoolean IsLinked;
EGLint RefCount;
 
+   EGLLabelKHR Label;
+
/* used to link resources of the same type */
_EGLResource *Next;
 };
@@ -165,6 +167,8 @@ struct _egl_display
 
/* lists of resources */
_EGLResource *ResourceLists[_EGL_NUM_RESOURCES];
+
+   EGLLabelKHR Label;
 };
 
 
diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index 04bb5ba..dca5c21 100644
--- a/src/egl/main/eglglobals.c
+++ b/src/egl/main/eglglobals.c
@@ -56,7 +56,10 @@ struct _egl_global _eglGlobal =
" EGL_EXT_platform_wayland"
" EGL_EXT_platform_x11"
" EGL_KHR_client_get_all_proc_addresses"
-   " EGL_MESA_platform_gbm"
+   " EGL_MESA_platform_gbm",
+
+   NULL, /* debugCallback */
+   _EGL_DEBUG_BIT_CRITICAL | _EGL_DEBUG_BIT_ERROR, /* debugTypesEnabled */
 };
 
 
diff --git a/src/egl/main/eglglobals.h b/src/egl/main/eglglobals.h
index ae1b75b..dfa3577 100644
--- a/src/egl/main/eglglobals.h
+++ b/src/egl/main/eglglobals.h
@@ -36,6 +36,13 @@
 
 #include "egltypedefs.h"
 
+enum
+{
+_EGL_DEBUG_BIT_CRITICAL = 0x1,
+_EGL_DEBUG_BIT_ERROR = 0x2,
+_EGL_DEBUG_BIT_WARN = 0x4,
+_EGL_DEBUG_BIT_INFO = 0x8,
+};
 
 /**
  * Global library data
@@ -51,6 +58,9 @@ struct _egl_global
void (*AtExitCalls[10])(void);
 
const char *ClientExtensionString;
+
+   EGLDEBUGPROCKHR debugCallback;
+   unsigned int debugTypesEnabled;
 };
 
 

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


Mesa (master): egl: Factor out _eglCreateImageCommon (v2)

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: 58338c6b650d85a2484f50c0941cb3e2947fab8e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=58338c6b650d85a2484f50c0941cb3e2947fab8e

Author: Kyle Brenneman 
Date:   Mon Sep 12 17:38:13 2016 -0400

egl: Factor out _eglCreateImageCommon (v2)

v2:
- Pass disp to RETURN_EGL_ERROR so we unlock the display

Reviewed-by: Adam Jackson 
Reviewed-by: Emil Velikov 

---

 src/egl/main/eglapi.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index a74e5e4..ba4826a 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1309,11 +1309,10 @@ eglReleaseThread(void)
 }
 
 
-static EGLImage EGLAPIENTRY
-eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
+static EGLImage
+_eglCreateImageCommon(_EGLDisplay *disp, EGLContext ctx, EGLenum target,
   EGLClientBuffer buffer, const EGLint *attr_list)
 {
-   _EGLDisplay *disp = _eglLockDisplay(dpy);
_EGLContext *context = _eglLookupContext(ctx, disp);
_EGLDriver *drv;
_EGLImage *img;
@@ -1337,18 +1336,27 @@ eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, 
EGLenum target,
RETURN_EGL_EVAL(disp, ret);
 }
 
+static EGLImage EGLAPIENTRY
+eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
+  EGLClientBuffer buffer, const EGLint *attr_list)
+{
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
+   return _eglCreateImageCommon(disp, ctx, target, buffer, attr_list);
+}
+
 
 EGLImage EGLAPIENTRY
 eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target,
EGLClientBuffer buffer, const EGLAttrib *attr_list)
 {
+   _EGLDisplay *disp = _eglLockDisplay(dpy);
EGLImage image;
EGLint *int_attribs = _eglConvertAttribsToInt(attr_list);
 
if (attr_list && !int_attribs)
-  RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_IMAGE);
+  RETURN_EGL_ERROR(disp, EGL_BAD_ALLOC, EGL_NO_IMAGE);
 
-   image = eglCreateImageKHR(dpy, ctx, target, buffer, int_attribs);
+   image = _eglCreateImageCommon(disp, ctx, target, buffer, int_attribs);
free(int_attribs);
return image;
 }

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


Mesa (master): egl: Tear down images and syncs at eglTerminate

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: e2c067d256c86bbeb2e99f8d216da267e76e2d8c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e2c067d256c86bbeb2e99f8d216da267e76e2d8c

Author: Adam Jackson 
Date:   Fri Sep  9 13:45:09 2016 -0400

egl: Tear down images and syncs at eglTerminate

Reviewed-by: Emil Velikov 
Signed-off-by: Adam Jackson 

---

 src/egl/main/egldisplay.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index bbc3063..3d4eb81 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -44,6 +44,8 @@
 #include "egldriver.h"
 #include "eglglobals.h"
 #include "egllog.h"
+#include "eglimage.h"
+#include "eglsync.h"
 
 /* Includes for _eglNativePlatformDetectNativeDisplay */
 #ifdef HAVE_MINCORE
@@ -300,6 +302,26 @@ _eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay 
*display)
   drv->API.DestroySurface(drv, display, surf);
}
assert(!display->ResourceLists[_EGL_RESOURCE_SURFACE]);
+
+   list = display->ResourceLists[_EGL_RESOURCE_IMAGE];
+   while (list) {
+  _EGLImage *image = (_EGLImage *) list;
+  list = list->Next;
+
+  _eglUnlinkImage(image);
+  drv->API.DestroyImageKHR(drv, display, image);
+   }
+   assert(!display->ResourceLists[_EGL_RESOURCE_IMAGE]);
+
+   list = display->ResourceLists[_EGL_RESOURCE_SYNC];
+   while (list) {
+  _EGLSync *sync = (_EGLSync *) list;
+  list = list->Next;
+
+  _eglUnlinkSync(sync);
+  drv->API.DestroySyncKHR(drv, display, sync);
+   }
+   assert(!display->ResourceLists[_EGL_RESOURCE_SYNC]);
 }
 
 

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


Mesa (master): egl: Fix typo

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: fe6ffa79be7ecf66b7bec73389556a58e8f6432c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe6ffa79be7ecf66b7bec73389556a58e8f6432c

Author: Kyle Brenneman 
Date:   Mon Sep 12 17:12:52 2016 -0400

egl: Fix typo

Reviewed-by: Adam Jackson 
Reviewed-by: Emil Velikov 

---

 src/egl/main/eglglobals.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index 938d953..04bb5ba 100644
--- a/src/egl/main/eglglobals.c
+++ b/src/egl/main/eglglobals.c
@@ -50,7 +50,7 @@ struct _egl_global _eglGlobal =
   _eglFiniDisplay
},
 
-   /* ClientExtensionsString */
+   /* ClientExtensionString */
"EGL_EXT_client_extensions"
" EGL_EXT_platform_base"
" EGL_EXT_platform_wayland"

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


Mesa (master): egl: Update eglext.h (v2)

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: 6e50f12b043436d066c8e9f24984e1ddc32d8ec4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e50f12b043436d066c8e9f24984e1ddc32d8ec4

Author: Kyle Brenneman 
Date:   Wed Jul  6 10:33:42 2016 -0600

egl: Update eglext.h (v2)

Updated eglext.h to revision 33111 from the Khronos repository.

v2:
- Don't (re)move extension includes from eglext.h (Emil Velikov)
- Bump to revision 33111 (Adam Jackson)

Reviewed-by: Emil Velikov 
Reviewed-by: Adam Jackson 

---

 include/EGL/eglext.h | 121 +--
 1 file changed, 118 insertions(+), 3 deletions(-)

diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
index 6043b37..4ccbab8 100644
--- a/include/EGL/eglext.h
+++ b/include/EGL/eglext.h
@@ -6,7 +6,7 @@ extern "C" {
 #endif
 
 /*
-** Copyright (c) 2013-2014 The Khronos Group Inc.
+** Copyright (c) 2013-2016 The Khronos Group Inc.
 **
 ** Permission is hereby granted, free of charge, to any person obtaining a
 ** copy of this software and/or associated documentation files (the
@@ -38,7 +38,7 @@ extern "C" {
 
 #include 
 
-#define EGL_EGLEXT_VERSION 20150508
+#define EGL_EGLEXT_VERSION 20160809
 
 /* Generated C header for:
  * API: egl
@@ -99,6 +99,33 @@ EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay 
dpy, EGLenum type,
 #define EGL_CONTEXT_OPENGL_NO_ERROR_KHR   0x31B3
 #endif /* EGL_KHR_create_context_no_error */
 
+#ifndef EGL_KHR_debug
+#define EGL_KHR_debug 1
+typedef void *EGLLabelKHR;
+typedef void *EGLObjectKHR;
+typedef void (EGLAPIENTRY  *EGLDEBUGPROCKHR)(EGLenum error,const char 
*command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR 
objectLabel,const char* message);
+#define EGL_OBJECT_THREAD_KHR 0x33B0
+#define EGL_OBJECT_DISPLAY_KHR0x33B1
+#define EGL_OBJECT_CONTEXT_KHR0x33B2
+#define EGL_OBJECT_SURFACE_KHR0x33B3
+#define EGL_OBJECT_IMAGE_KHR  0x33B4
+#define EGL_OBJECT_SYNC_KHR   0x33B5
+#define EGL_OBJECT_STREAM_KHR 0x33B6
+#define EGL_DEBUG_MSG_CRITICAL_KHR0x33B9
+#define EGL_DEBUG_MSG_ERROR_KHR   0x33BA
+#define EGL_DEBUG_MSG_WARN_KHR0x33BB
+#define EGL_DEBUG_MSG_INFO_KHR0x33BC
+#define EGL_DEBUG_CALLBACK_KHR0x33B8
+typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) 
(EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, 
EGLAttrib *value);
+typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, 
EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, 
const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib 
*value);
+EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum 
objectType, EGLObjectKHR object, EGLLabelKHR label);
+#endif
+#endif /* EGL_KHR_debug */
+
 #ifndef EGL_KHR_fence_sync
 #define EGL_KHR_fence_sync 1
 typedef khronos_utime_nanoseconds_t EGLTimeKHR;
@@ -223,6 +250,16 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR 
(EGLDisplay dpy, EGLSurface s
 #endif
 #endif /* EGL_KHR_lock_surface3 */
 
+#ifndef EGL_KHR_mutable_render_buffer
+#define EGL_KHR_mutable_render_buffer 1
+#define EGL_MUTABLE_RENDER_BUFFER_BIT_KHR 0x1000
+#endif /* EGL_KHR_mutable_render_buffer */
+
+#ifndef EGL_KHR_no_config_context
+#define EGL_KHR_no_config_context 1
+#define EGL_NO_CONFIG_KHR ((EGLConfig)0)
+#endif /* EGL_KHR_no_config_context */
+
 #ifndef EGL_KHR_partial_update
 #define EGL_KHR_partial_update 1
 #define EGL_BUFFER_AGE_KHR0x313D
@@ -402,11 +439,28 @@ EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID 
(EGLDisplay dpy, EGLSetBlobF
 #endif
 #endif /* EGL_ANDROID_blob_cache */
 
+#ifndef EGL_ANDROID_create_native_client_buffer
+#define EGL_ANDROID_create_native_client_buffer 1
+#define EGL_NATIVE_BUFFER_USAGE_ANDROID   0x3143
+#define EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID 0x0001
+#define EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID 0x0002
+#define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x0004
+typedef EGLClientBuffer (EGLAPIENTRYP 
PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLClientBuffer EGLAPIENTRY eglCreateNativeClientBufferANDROID (const 
EGLint *attrib_list);
+#endif
+#endif /* EGL_ANDROID_create_native_client_buffer */
+
 #ifndef EGL_ANDROID_framebuffer_target
 #define EGL_ANDROID_framebuffer_target 1
 #define EGL_FRAMEBUFFER_TARGET_ANDROID0x3147
 #endif /* EGL_ANDROID_framebuffer_target */
 
+#ifndef EGL_ANDROID_front_buffer_auto_refresh
+#define EGL_ANDROID_front_buffer_auto_refresh 1
+#define EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID 0x314C
+#endif /* 

Mesa (master): egl: Factor out _eglGetPlatformDisplayCommon

2016-09-14 Thread Adam Jackson
Module: Mesa
Branch: master
Commit: 017946b7247ea7c36219b44dfc118ccad4da7d1d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=017946b7247ea7c36219b44dfc118ccad4da7d1d

Author: Kyle Brenneman 
Date:   Mon Sep 12 16:42:56 2016 -0400

egl: Factor out _eglGetPlatformDisplayCommon

Reviewed-by: Adam Jackson 
Reviewed-by: Emil Velikov 

---

 src/egl/main/eglapi.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index ba8305e..df355a5 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -295,9 +295,9 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay)
return _eglGetDisplayHandle(dpy);
 }
 
-static EGLDisplay EGLAPIENTRY
-eglGetPlatformDisplayEXT(EGLenum platform, void *native_display,
- const EGLint *attrib_list)
+static EGLDisplay
+_eglGetPlatformDisplayCommon(EGLenum platform, void *native_display,
+const EGLint *attrib_list)
 {
_EGLDisplay *dpy;
 
@@ -326,17 +326,25 @@ eglGetPlatformDisplayEXT(EGLenum platform, void 
*native_display,
return _eglGetDisplayHandle(dpy);
 }
 
+static EGLDisplay EGLAPIENTRY
+eglGetPlatformDisplayEXT(EGLenum platform, void *native_display,
+ const EGLint *attrib_list)
+{
+   return _eglGetPlatformDisplayCommon(platform, native_display, attrib_list);
+}
+
 EGLDisplay EGLAPIENTRY
 eglGetPlatformDisplay(EGLenum platform, void *native_display,
   const EGLAttrib *attrib_list)
 {
EGLDisplay display;
-   EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list);
+   EGLint *int_attribs;
 
+   int_attribs = _eglConvertAttribsToInt(attrib_list);
if (attrib_list && !int_attribs)
   RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, NULL);
 
-   display = eglGetPlatformDisplayEXT(platform, native_display, int_attribs);
+   display = _eglGetPlatformDisplayCommon(platform, native_display, 
int_attribs);
free(int_attribs);
return display;
 }

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


Mesa (master): gbm: remove left-over array

2016-09-14 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 4bb9efb59290c77ef4acd4abab5729efa9bf4e24
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4bb9efb59290c77ef4acd4abab5729efa9bf4e24

Author: Eric Engestrom 
Date:   Tue Sep 13 17:32:39 2016 +0100

gbm: remove left-over array

e7c8c85785b3a8f29e3f ("gbm: Removed unused function.") forgot to remove
the global array used only by that function.

Signed-off-by: Eric Engestrom 
Reviewed-by: Emil Velikov 

---

 src/gbm/main/gbm.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index 1acbbcd..5a8e8b7 100644
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -45,12 +45,6 @@
 #include "gbmint.h"
 #include "backend.h"
 
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
-
-static struct gbm_device *devices[16];
-
-static int device_num = 0;
-
 /** Returns the file description for the gbm device
  *
  * \return The fd that the struct gbm_device was created with
@@ -127,9 +121,6 @@ gbm_create_device(int fd)
   return NULL;
}
 
-   if (device_num == 0)
-  memset(devices, 0, sizeof devices);
-
gbm = _gbm_create_device(fd);
if (gbm == NULL)
   return NULL;
@@ -138,9 +129,6 @@ gbm_create_device(int fd)
gbm->stat = buf;
gbm->refcount = 1;
 
-   if (device_num < ARRAY_SIZE(devices)-1)
-  devices[device_num++] = gbm;
-
return gbm;
 }
 

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


Mesa (master): configure.ac: fix the name of the Wayland Scanner pc file

2016-09-14 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 95f3e5861c3dec5d029ee2f07b8ebce6e2f73af1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=95f3e5861c3dec5d029ee2f07b8ebce6e2f73af1

Author: Brendan King 
Date:   Tue Sep 13 17:31:05 2016 +0100

configure.ac: fix the name of the Wayland Scanner pc file

The Wayland Scanner pkg-config file is called wayland-scanner.pc.

Fixes: 153539bd9d4445b50411 ("configure: rework wayland_scanner
   handling (fix make distcheck)")

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Eric Engestrom 
Tested-by: Eric Engestrom 
Signed-off-by: Brendan King 
Reviewed-by: Emil Velikov 

---

 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index a413a3a..b81171b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2005,8 +2005,8 @@ if test "x$with_egl_platforms" != "x" -a "x$enable_egl" 
!= xyes; then
 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
 fi
 
-PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland_scanner],
-WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner 
wayland_scanner`,
+PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland-scanner],
+WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner 
wayland-scanner`,
 WAYLAND_SCANNER='')
 if test "x$WAYLAND_SCANNER" = x; then
 AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner])

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


Mesa (master): gallium: fix return value check

2016-09-14 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 2527e18eebe2faf395d1682db7df76043aca6ea3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2527e18eebe2faf395d1682db7df76043aca6ea3

Author: Martina Kollarova 
Date:   Thu Sep  8 15:12:42 2016 +0300

gallium: fix return value check

A possible error (-1) was being lost because it was first converted to an
unsigned int and only then checked.

Reviewed-by: Nicolai Hähnle 
Signed-off-by: Martina Kollarova 
Reviewed-by: Eric Engestrom 

---

 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c 
b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
index 07eca99..22e1c93 100644
--- a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
+++ b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
@@ -252,18 +252,18 @@ kms_sw_displaytarget_add_from_prime(struct kms_sw_winsys 
*kms_sw, int fd,
if (!kms_sw_dt)
   return NULL;
 
+   off_t lseek_ret = lseek(fd, 0, SEEK_END);
+   if (lseek_ret == -1) {
+  FREE(kms_sw_dt);
+  return NULL;
+   }
+   kms_sw_dt->size = lseek_ret;
kms_sw_dt->ref_count = 1;
kms_sw_dt->handle = handle;
-   kms_sw_dt->size = lseek(fd, 0, SEEK_END);
kms_sw_dt->width = width;
kms_sw_dt->height = height;
kms_sw_dt->stride = stride;
 
-   if (kms_sw_dt->size == (off_t)-1) {
-  FREE(kms_sw_dt);
-  return NULL;
-   }
-
lseek(fd, 0, SEEK_SET);
 
list_add(_sw_dt->link, _sw->bo_list);

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


Mesa (12.0): Revert "i965/miptree: Stop multiplying cube depth by 6 in HiZ calculations"

2016-09-14 Thread Emil Velikov
Module: Mesa
Branch: 12.0
Commit: 71b47b9cfe50b32de10a4c0fd6a6ea77f0de3c7f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=71b47b9cfe50b32de10a4c0fd6a6ea77f0de3c7f

Author: Emil Velikov 
Date:   Tue Sep 13 20:06:30 2016 +0100

Revert "i965/miptree: Stop multiplying cube depth by 6 in HiZ calculations"

This reverts commit be0344f63046be7acd56f567f6ff4509f8bd1a8d.

The commit depends on 48e9ecc47f0 ("Revert "i965/miptree: Set
logical_depth0 == 6 for cube maps") which was reverted earlier.

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

---

 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index c234f24..e74a2dc 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1789,8 +1789,14 @@ intel_gen7_hiz_buf_create(struct brw_context *brw,
   hz_height = DIV_ROUND_UP(hz_height, 2);
} else {
   const unsigned hz_qpitch = h0 + h1 + (12 * vertical_align);
-  /* HZ_Height (rows) = Ceiling ( ( Q_pitch * Z_depth/2) /8 ) * 8 */
-  hz_height = DIV_ROUND_UP(hz_qpitch * Z0, 2 * 8) * 8;
+  if (mt->target == GL_TEXTURE_CUBE_MAP_ARRAY ||
+  mt->target == GL_TEXTURE_CUBE_MAP) {
+ /* HZ_Height (rows) = Ceiling ( ( Q_pitch * Z_depth * 6/2) /8 ) * 8 */
+ hz_height = DIV_ROUND_UP(hz_qpitch * Z0 * 6, 2 * 8) * 8;
+  } else {
+ /* HZ_Height (rows) = Ceiling ( ( Q_pitch * Z_depth/2) /8 ) * 8 */
+ hz_height = DIV_ROUND_UP(hz_qpitch * Z0, 2 * 8) * 8;
+  }
}
 
unsigned long pitch;
@@ -1887,6 +1893,15 @@ intel_gen8_hiz_buf_create(struct brw_context *brw,
} else {
   /* HZ_Height (rows) = ceiling( (HZ_QPitch/2)/8) *8 * Z_Depth */
   hz_height = DIV_ROUND_UP(buf->qpitch, 2 * 8) * 8 * Z0;
+  if (mt->target == GL_TEXTURE_CUBE_MAP_ARRAY ||
+  mt->target == GL_TEXTURE_CUBE_MAP) {
+ /* HZ_Height (rows) = ceiling( (HZ_QPitch/2)/8) *8 * 6 * Z_Depth
+  *
+  * We can can just take our hz_height calculation from above, and
+  * multiply by 6 for the cube map and cube map array types.
+  */
+ hz_height *= 6;
+  }
}
 
unsigned long pitch;

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


Mesa (master): radeonsi: cosmetic changes in si_shader.c

2016-09-14 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 5f0a8fbcc87ef6bc1121ecdbcda0c5e82f585295
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f0a8fbcc87ef6bc1121ecdbcda0c5e82f585295

Author: Marek Olšák 
Date:   Tue Sep 13 13:28:09 2016 +0200

radeonsi: cosmetic changes in si_shader.c

Reviewed-by: Nicolai Hähnle 
Reviewed-by: Edward O'Callaghan 

---

 src/gallium/drivers/radeonsi/si_shader.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index d61f4ff..db7eb4e 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -105,8 +105,8 @@ struct si_shader_context
unsigned uniform_md_kind;
LLVMValueRef empty_md;
 
+   /* Preloaded descriptors. */
LLVMValueRef const_buffers[SI_NUM_CONST_BUFFERS];
-   LLVMValueRef lds;
LLVMValueRef shader_buffers[SI_NUM_SHADER_BUFFERS];
LLVMValueRef sampler_views[SI_NUM_SAMPLERS];
LLVMValueRef sampler_states[SI_NUM_SAMPLERS];
@@ -114,6 +114,8 @@ struct si_shader_context
LLVMValueRef images[SI_NUM_IMAGES];
LLVMValueRef esgs_ring;
LLVMValueRef gsvs_ring[4];
+
+   LLVMValueRef lds;
LLVMValueRef gs_next_vertex[4];
LLVMValueRef return_value;
 
@@ -5843,7 +5845,7 @@ static void create_function(struct si_shader_context *ctx)
declare_tess_lds(ctx);
 }
 
-static void preload_constants(struct si_shader_context *ctx)
+static void preload_constant_buffers(struct si_shader_context *ctx)
 {
struct lp_build_tgsi_context *bld_base = >radeon_bld.soa.bld_base;
struct gallivm_state *gallivm = bld_base->base.gallivm;
@@ -6777,7 +6779,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
 
create_meta_data();
create_function();
-   preload_constants();
+   preload_constant_buffers();
preload_shader_buffers();
preload_samplers();
preload_images();

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


Mesa (master): radeonsi: load streamout buffer descriptors before use (v2)

2016-09-14 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: afaf27bff3646f63aa9de85c826e1da100afc993
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=afaf27bff3646f63aa9de85c826e1da100afc993

Author: Marek Olšák 
Date:   Tue Sep 13 13:12:33 2016 +0200

radeonsi: load streamout buffer descriptors before use (v2)

v2: inline the code and remove the conditional that's a no-op now

Reviewed-by: Nicolai Hähnle 

---

 src/gallium/drivers/radeonsi/si_shader.c | 47 ++--
 1 file changed, 14 insertions(+), 33 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index be6fae7..d61f4ff 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -112,7 +112,6 @@ struct si_shader_context
LLVMValueRef sampler_states[SI_NUM_SAMPLERS];
LLVMValueRef fmasks[SI_NUM_SAMPLERS];
LLVMValueRef images[SI_NUM_IMAGES];
-   LLVMValueRef so_buffers[4];
LLVMValueRef esgs_ring;
LLVMValueRef gsvs_ring[4];
LLVMValueRef gs_next_vertex[4];
@@ -2271,6 +2270,19 @@ static void si_llvm_emit_streamout(struct 
si_shader_context *ctx,
LLVMBuilderRef builder = gallivm->builder;
int i, j;
struct lp_build_if_state if_ctx;
+   LLVMValueRef so_buffers[4];
+   LLVMValueRef buf_ptr = LLVMGetParam(ctx->radeon_bld.main_fn,
+   SI_PARAM_RW_BUFFERS);
+
+   /* Load the descriptors. */
+   for (i = 0; i < 4; ++i) {
+   if (ctx->shader->selector->so.stride[i]) {
+   LLVMValueRef offset = lp_build_const_int32(gallivm,
+  
SI_VS_STREAMOUT_BUF0 + i);
+
+   so_buffers[i] = build_indexed_load_const(ctx, buf_ptr, 
offset);
+   }
+   }
 
/* Get bits [22:16], i.e. (so_param >> 16) & 127; */
LLVMValueRef so_vtx_count =
@@ -2366,7 +2378,7 @@ static void si_llvm_emit_streamout(struct 
si_shader_context *ctx,
  lp_build_const_int32(gallivm, 
stream), "");
 
lp_build_if(_ctx_stream, gallivm, can_emit_stream);
-   build_tbuffer_store_dwords(ctx, 
ctx->so_buffers[buf_idx],
+   build_tbuffer_store_dwords(ctx, so_buffers[buf_idx],
   vdata, num_comps,
   so_write_offset[buf_idx],
   LLVMConstInt(ctx->i32, 0, 0),
@@ -5924,35 +5936,6 @@ static void preload_images(struct si_shader_context *ctx)
}
 }
 
-static void preload_streamout_buffers(struct si_shader_context *ctx)
-{
-   struct lp_build_tgsi_context *bld_base = >radeon_bld.soa.bld_base;
-   struct gallivm_state *gallivm = bld_base->base.gallivm;
-   unsigned i;
-
-   /* Streamout can only be used if the shader is compiled as VS. */
-   if (!ctx->shader->selector->so.num_outputs ||
-   (ctx->type == PIPE_SHADER_VERTEX &&
-(ctx->shader->key.vs.as_es ||
- ctx->shader->key.vs.as_ls)) ||
-   (ctx->type == PIPE_SHADER_TESS_EVAL &&
-ctx->shader->key.tes.as_es))
-   return;
-
-   LLVMValueRef buf_ptr = LLVMGetParam(ctx->radeon_bld.main_fn,
-   SI_PARAM_RW_BUFFERS);
-
-   /* Load the resources, we rely on the code sinking to do the rest */
-   for (i = 0; i < 4; ++i) {
-   if (ctx->shader->selector->so.stride[i]) {
-   LLVMValueRef offset = lp_build_const_int32(gallivm,
-  
SI_VS_STREAMOUT_BUF0 + i);
-
-   ctx->so_buffers[i] = build_indexed_load_const(ctx, 
buf_ptr, offset);
-   }
-   }
-}
-
 /**
  * Load ESGS and GSVS ring buffer resource descriptors and save the variables
  * for later use.
@@ -6497,7 +6480,6 @@ static int si_generate_gs_copy_shader(struct si_screen 
*sscreen,
 
create_meta_data(ctx);
create_function(ctx);
-   preload_streamout_buffers(ctx);
preload_ring_buffers(ctx);
 
args[0] = ctx->gsvs_ring[0];
@@ -6799,7 +6781,6 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
preload_shader_buffers();
preload_samplers();
preload_images();
-   preload_streamout_buffers();
preload_ring_buffers();
 
if (ctx.is_monolithic && sel->type == PIPE_SHADER_FRAGMENT &&

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


Mesa (master): radeonsi: get rid of img/buf/sampler descriptor preloading (v2)

2016-09-14 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 16be87c904293c2e53d50cc3519789a604a6a33b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=16be87c904293c2e53d50cc3519789a604a6a33b

Author: Marek Olšák 
Date:   Tue Sep 13 14:25:44 2016 +0200

radeonsi: get rid of img/buf/sampler descriptor preloading (v2)

26011 shaders in 14651 tests
Totals:
SGPRS: 1251920 -> 1152636 (-7.93 %)
VGPRS: 728421 -> 728198 (-0.03 %)
Spilled SGPRs: 16644 -> 3776 (-77.31 %)
Spilled VGPRs: 369 -> 369 (0.00 %)
Scratch VGPRs: 1344 -> 1344 (0.00 %) dwords per thread
Code Size: 36001064 -> 35835152 (-0.46 %) bytes
LDS: 767 -> 767 (0.00 %) blocks
Max Waves: 21 -> 222372 (0.07 %)
Wait states: 0 -> 0 (0.00 %)

v2: merge codepaths where possible

Reviewed-by: Nicolai Hähnle 

---

 src/gallium/drivers/radeonsi/si_shader.c | 179 ---
 1 file changed, 47 insertions(+), 132 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 84cbfd7..d223a07 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -107,11 +107,6 @@ struct si_shader_context
 
/* Preloaded descriptors. */
LLVMValueRef const_buffers[SI_NUM_CONST_BUFFERS];
-   LLVMValueRef shader_buffers[SI_NUM_SHADER_BUFFERS];
-   LLVMValueRef sampler_views[SI_NUM_SAMPLERS];
-   LLVMValueRef sampler_states[SI_NUM_SAMPLERS];
-   LLVMValueRef fmasks[SI_NUM_SAMPLERS];
-   LLVMValueRef images[SI_NUM_IMAGES];
LLVMValueRef esgs_ring;
LLVMValueRef gsvs_ring[4];
 
@@ -3406,18 +3401,18 @@ static LLVMValueRef
 shader_buffer_fetch_rsrc(struct si_shader_context *ctx,
 const struct tgsi_full_src_register *reg)
 {
-   LLVMValueRef ind_index;
-   LLVMValueRef rsrc_ptr;
+   LLVMValueRef index;
+   LLVMValueRef rsrc_ptr = LLVMGetParam(ctx->radeon_bld.main_fn,
+SI_PARAM_SHADER_BUFFERS);
 
if (!reg->Register.Indirect)
-   return ctx->shader_buffers[reg->Register.Index];
-
-   ind_index = get_bounded_indirect_index(ctx, >Indirect,
-  reg->Register.Index,
-  SI_NUM_SHADER_BUFFERS);
+   index = LLVMConstInt(ctx->i32, reg->Register.Index, 0);
+   else
+   index = get_bounded_indirect_index(ctx, >Indirect,
+  reg->Register.Index,
+  SI_NUM_SHADER_BUFFERS);
 
-   rsrc_ptr = LLVMGetParam(ctx->radeon_bld.main_fn, 
SI_PARAM_SHADER_BUFFERS);
-   return build_indexed_load_const(ctx, rsrc_ptr, ind_index);
+   return build_indexed_load_const(ctx, rsrc_ptr, index);
 }
 
 static bool tgsi_is_array_sampler(unsigned target)
@@ -3480,18 +3475,21 @@ image_fetch_rsrc(
LLVMValueRef *rsrc)
 {
struct si_shader_context *ctx = si_shader_context(bld_base);
+   LLVMValueRef rsrc_ptr = LLVMGetParam(ctx->radeon_bld.main_fn,
+SI_PARAM_IMAGES);
+   LLVMValueRef index, tmp;
 
assert(image->Register.File == TGSI_FILE_IMAGE);
 
if (!image->Register.Indirect) {
-   /* Fast path: use preloaded resources */
-   *rsrc = ctx->images[image->Register.Index];
-   } else {
-   /* Indexing and manual load */
-   LLVMValueRef ind_index;
-   LLVMValueRef rsrc_ptr;
-   LLVMValueRef tmp;
+   const struct tgsi_shader_info *info = bld_base->info;
+
+   index = LLVMConstInt(ctx->i32, image->Register.Index, 0);
 
+   if (info->images_writemask & (1 << image->Register.Index) &&
+   !(info->images_buffers & (1 << image->Register.Index)))
+   dcc_off = true;
+   } else {
/* From the GL_ARB_shader_image_load_store extension spec:
 *
 *If a shader performs an image load, store, or atomic
@@ -3501,16 +3499,15 @@ image_fetch_rsrc(
 *array, the results of the operation are undefined but may
 *not lead to termination.
 */
-   ind_index = get_bounded_indirect_index(ctx, >Indirect,
-  image->Register.Index,
-  SI_NUM_IMAGES);
-
-   rsrc_ptr = LLVMGetParam(ctx->radeon_bld.main_fn, 
SI_PARAM_IMAGES);
-   tmp = build_indexed_load_const(ctx, rsrc_ptr, ind_index);
-   if (dcc_off)
-   tmp = force_dcc_off(ctx, tmp);
-   *rsrc = tmp;
+   index = get_bounded_indirect_index(ctx, >Indirect,
+  image->Register.Index,
+ 

Mesa (master): radeonsi: rename get_sampler_desc -> load_sampler_desc

2016-09-14 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 22797d7d8328416ef6ded65eac0758b39b22fc04
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=22797d7d8328416ef6ded65eac0758b39b22fc04

Author: Marek Olšák 
Date:   Tue Sep 13 13:37:16 2016 +0200

radeonsi: rename get_sampler_desc -> load_sampler_desc

Reviewed-by: Nicolai Hähnle 
Reviewed-by: Edward O'Callaghan 

---

 src/gallium/drivers/radeonsi/si_shader.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index db7eb4e..84cbfd7 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -4285,9 +4285,9 @@ static LLVMTypeRef const_array(LLVMTypeRef elem_type, int 
num_elements)
 /**
  * Load an image view, fmask view. or sampler state descriptor.
  */
-static LLVMValueRef get_sampler_desc_custom(struct si_shader_context *ctx,
-   LLVMValueRef list, LLVMValueRef 
index,
-   enum desc_type type)
+static LLVMValueRef load_sampler_desc_custom(struct si_shader_context *ctx,
+LLVMValueRef list, LLVMValueRef 
index,
+enum desc_type type)
 {
struct gallivm_state *gallivm = >radeon_bld.gallivm;
LLVMBuilderRef builder = gallivm->builder;
@@ -4314,13 +4314,13 @@ static LLVMValueRef get_sampler_desc_custom(struct 
si_shader_context *ctx,
return build_indexed_load_const(ctx, list, index);
 }
 
-static LLVMValueRef get_sampler_desc(struct si_shader_context *ctx,
+static LLVMValueRef load_sampler_desc(struct si_shader_context *ctx,
 LLVMValueRef index, enum desc_type type)
 {
LLVMValueRef list = LLVMGetParam(ctx->radeon_bld.main_fn,
 SI_PARAM_SAMPLERS);
 
-   return get_sampler_desc_custom(ctx, list, index, type);
+   return load_sampler_desc_custom(ctx, list, index, type);
 }
 
 /* Disable anisotropic filtering if BASE_LEVEL == LAST_LEVEL.
@@ -4375,17 +4375,17 @@ static void tex_fetch_ptrs(
   reg->Register.Index,
   SI_NUM_SAMPLERS);
 
-   *res_ptr = get_sampler_desc(ctx, ind_index, DESC_IMAGE);
+   *res_ptr = load_sampler_desc(ctx, ind_index, DESC_IMAGE);
 
if (target == TGSI_TEXTURE_2D_MSAA ||
target == TGSI_TEXTURE_2D_ARRAY_MSAA) {
if (samp_ptr)
*samp_ptr = NULL;
if (fmask_ptr)
-   *fmask_ptr = get_sampler_desc(ctx, ind_index, 
DESC_FMASK);
+   *fmask_ptr = load_sampler_desc(ctx, ind_index, 
DESC_FMASK);
} else {
if (samp_ptr) {
-   *samp_ptr = get_sampler_desc(ctx, ind_index, 
DESC_SAMPLER);
+   *samp_ptr = load_sampler_desc(ctx, ind_index, 
DESC_SAMPLER);
*samp_ptr = sici_fix_sampler_aniso(ctx, 
*res_ptr, *samp_ptr);
}
if (fmask_ptr)
@@ -5894,15 +5894,15 @@ static void preload_samplers(struct si_shader_context 
*ctx)
/* Resource */
offset = lp_build_const_int32(gallivm, i);
ctx->sampler_views[i] =
-   get_sampler_desc(ctx, offset, DESC_IMAGE);
+   load_sampler_desc(ctx, offset, DESC_IMAGE);
 
/* FMASK resource */
if (info->is_msaa_sampler[i])
ctx->fmasks[i] =
-   get_sampler_desc(ctx, offset, DESC_FMASK);
+   load_sampler_desc(ctx, offset, DESC_FMASK);
else {
ctx->sampler_states[i] =
-   get_sampler_desc(ctx, offset, DESC_SAMPLER);
+   load_sampler_desc(ctx, offset, DESC_SAMPLER);
ctx->sampler_states[i] =
sici_fix_sampler_aniso(ctx, 
ctx->sampler_views[i],
   ctx->sampler_states[i]);

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


Mesa (master): radeonsi: get rid of constant buffer preloading

2016-09-14 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 007b512f9d05875b0dda956230fd3882dfea30af
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=007b512f9d05875b0dda956230fd3882dfea30af

Author: Marek Olšák 
Date:   Tue Sep 13 14:30:50 2016 +0200

radeonsi: get rid of constant buffer preloading

26011 shaders in 14651 tests
Totals:
SGPRS: 1152636 -> 1146340 (-0.55 %)
VGPRS: 728198 -> 727371 (-0.11 %)
Spilled SGPRs: 3776 -> 2218 (-41.26 %)
Spilled VGPRs: 369 -> 369 (0.00 %)
Scratch VGPRs: 1344 -> 1344 (0.00 %) dwords per thread
Code Size: 35835152 -> 35841268 (0.02 %) bytes
LDS: 767 -> 767 (0.00 %) blocks
Max Waves: 222372 -> 222559 (0.08 %)
Wait states: 0 -> 0 (0.00 %)

Reviewed-by: Nicolai Hähnle 
Reviewed-by: Edward O'Callaghan 

---

 src/gallium/drivers/radeonsi/si_shader.c | 38 
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index d223a07..b034837 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -106,7 +106,6 @@ struct si_shader_context
LLVMValueRef empty_md;
 
/* Preloaded descriptors. */
-   LLVMValueRef const_buffers[SI_NUM_CONST_BUFFERS];
LLVMValueRef esgs_ring;
LLVMValueRef gsvs_ring[4];
 
@@ -1849,6 +1848,15 @@ static void declare_compute_memory(struct 
radeon_llvm_context *radeon_bld,
ctx->shared_memory = LLVMBuildBitCast(gallivm->builder, var, i8p, "");
 }
 
+static LLVMValueRef load_const_buffer_desc(struct si_shader_context *ctx, int 
i)
+{
+   LLVMValueRef list_ptr = LLVMGetParam(ctx->radeon_bld.main_fn,
+SI_PARAM_CONST_BUFFERS);
+
+   return build_indexed_load_const(ctx, list_ptr,
+   LLVMConstInt(ctx->i32, i, 0));
+}
+
 static LLVMValueRef fetch_constant(
struct lp_build_tgsi_context *bld_base,
const struct tgsi_full_src_register *reg,
@@ -1876,15 +1884,16 @@ static LLVMValueRef fetch_constant(
idx = reg->Register.Index * 4 + swizzle;
 
if (!reg->Register.Indirect && !reg->Dimension.Indirect) {
-   LLVMValueRef c0, c1;
+   LLVMValueRef c0, c1, desc;
 
-   c0 = buffer_load_const(ctx, ctx->const_buffers[buf],
+   desc = load_const_buffer_desc(ctx, buf);
+   c0 = buffer_load_const(ctx, desc,
   LLVMConstInt(ctx->i32, idx * 4, 0));
 
if (!tgsi_type_is_64bit(type))
return bitcast(bld_base, type, c0);
else {
-   c1 = buffer_load_const(ctx, ctx->const_buffers[buf],
+   c1 = buffer_load_const(ctx, desc,
   LLVMConstInt(ctx->i32,
(idx + 1) * 4, 0));
return radeon_llvm_emit_fetch_64bit(bld_base, type,
@@ -1900,7 +1909,7 @@ static LLVMValueRef fetch_constant(
   SI_NUM_CONST_BUFFERS);
bufp = build_indexed_load_const(ctx, ptr, index);
} else
-   bufp = ctx->const_buffers[buf];
+   bufp = load_const_buffer_desc(ctx, buf);
 
addr = ctx->radeon_bld.soa.addr[ireg->Index][ireg->Swizzle];
addr = LLVMBuildLoad(base->gallivm->builder, addr, "load addr reg");
@@ -5838,24 +5847,6 @@ static void create_function(struct si_shader_context 
*ctx)
declare_tess_lds(ctx);
 }
 
-static void preload_constant_buffers(struct si_shader_context *ctx)
-{
-   struct lp_build_tgsi_context *bld_base = >radeon_bld.soa.bld_base;
-   struct gallivm_state *gallivm = bld_base->base.gallivm;
-   const struct tgsi_shader_info *info = bld_base->info;
-   unsigned buf;
-   LLVMValueRef ptr = LLVMGetParam(ctx->radeon_bld.main_fn, 
SI_PARAM_CONST_BUFFERS);
-
-   for (buf = 0; buf < SI_NUM_CONST_BUFFERS; buf++) {
-   if (info->const_file_max[buf] == -1)
-   continue;
-
-   /* Load the resource descriptor */
-   ctx->const_buffers[buf] =
-   build_indexed_load_const(ctx, ptr, 
lp_build_const_int32(gallivm, buf));
-   }
-}
-
 /**
  * Load ESGS and GSVS ring buffer resource descriptors and save the variables
  * for later use.
@@ -6697,7 +6688,6 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
 
create_meta_data();
create_function();
-   preload_constant_buffers();
preload_ring_buffers();
 
if (ctx.is_monolithic && sel->type == PIPE_SHADER_FRAGMENT &&

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


Mesa (master): radeonsi: reload PS inputs with direct indexing at each use (v2)

2016-09-14 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: ab29788250a705eb0dd517cb3d38f37f944eb8ad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab29788250a705eb0dd517cb3d38f37f944eb8ad

Author: Marek Olšák 
Date:   Tue Sep 13 17:33:23 2016 +0200

radeonsi: reload PS inputs with direct indexing at each use (v2)

The LLVM compiler can CSE interp intrinsics thanks to
LLVMReadNoneAttribute.

26011 shaders in 14651 tests
Totals:
SGPRS: 1146340 -> 1132676 (-1.19 %)
VGPRS: 727371 -> 711730 (-2.15 %)
Spilled SGPRs: 2218 -> 2078 (-6.31 %)
Spilled VGPRs: 369 -> 369 (0.00 %)
Scratch VGPRs: 1344 -> 1344 (0.00 %) dwords per thread
Code Size: 35841268 -> 36009732 (0.47 %) bytes
LDS: 767 -> 767 (0.00 %) blocks
Max Waves: 222559 -> 224779 (1.00 %)
Wait states: 0 -> 0 (0.00 %)

v2: don't call load_input for fragment shaders in emit_declaration

Reviewed-by: Nicolai Hähnle 

---

 src/gallium/drivers/radeon/radeon_llvm.h   |  6 -
 .../drivers/radeon/radeon_setup_tgsi_llvm.c| 30 ++
 src/gallium/drivers/radeonsi/si_shader.c   | 27 ---
 3 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_llvm.h 
b/src/gallium/drivers/radeon/radeon_llvm.h
index da5b7f5..f508d32 100644
--- a/src/gallium/drivers/radeon/radeon_llvm.h
+++ b/src/gallium/drivers/radeon/radeon_llvm.h
@@ -30,7 +30,9 @@
 #include 
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_tgsi.h"
+#include "tgsi/tgsi_parse.h"
 
+#define RADEON_LLVM_MAX_INPUT_SLOTS 32
 #define RADEON_LLVM_MAX_INPUTS 32 * 4
 #define RADEON_LLVM_MAX_OUTPUTS 32 * 4
 
@@ -62,7 +64,8 @@ struct radeon_llvm_context {
  */
void (*load_input)(struct radeon_llvm_context *,
   unsigned input_index,
-  const struct tgsi_full_declaration *decl);
+  const struct tgsi_full_declaration *decl,
+  LLVMValueRef out[4]);
 
void (*load_system_value)(struct radeon_llvm_context *,
  unsigned index,
@@ -75,6 +78,7 @@ struct radeon_llvm_context {
  * values will be in the form of a target intrinsic that will inform 
the
  * backend how to load the actual inputs to the shader. 
  */
+   struct tgsi_full_declaration input_decls[RADEON_LLVM_MAX_INPUT_SLOTS];
LLVMValueRef inputs[RADEON_LLVM_MAX_INPUTS];
LLVMValueRef outputs[RADEON_LLVM_MAX_OUTPUTS][TGSI_NUM_CHANNELS];
 
diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c 
b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 4643e6d..4fa43cd 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -446,14 +446,29 @@ LLVMValueRef radeon_llvm_emit_fetch(struct 
lp_build_tgsi_context *bld_base,
}
}
 
-   case TGSI_FILE_INPUT:
-   result = 
ctx->inputs[radeon_llvm_reg_index_soa(reg->Register.Index, swizzle)];
+   case TGSI_FILE_INPUT: {
+   unsigned index = reg->Register.Index;
+   LLVMValueRef input[4];
+
+   /* I don't think doing this for vertex shaders is beneficial.
+* For those, we want to make sure the VMEM loads are executed
+* only once. Fragment shaders don't care much, because
+* v_interp instructions are much cheaper than VMEM loads.
+*/
+   if (ctx->soa.bld_base.info->processor == PIPE_SHADER_FRAGMENT)
+   ctx->load_input(ctx, index, >input_decls[index], 
input);
+   else
+   memcpy(input, >inputs[index * 4], sizeof(input));
+
+   result = input[swizzle];
+
if (tgsi_type_is_64bit(type)) {
ptr = result;
-   ptr2 = 
ctx->inputs[radeon_llvm_reg_index_soa(reg->Register.Index, swizzle + 1)];
+   ptr2 = input[swizzle + 1];
return radeon_llvm_emit_fetch_64bit(bld_base, type, 
ptr, ptr2);
}
break;
+   }
 
case TGSI_FILE_TEMPORARY:
if (reg->Register.Index >= ctx->temps_count)
@@ -626,8 +641,13 @@ static void emit_declaration(struct lp_build_tgsi_context 
*bld_base,
{
unsigned idx;
for (idx = decl->Range.First; idx <= decl->Range.Last; idx++) {
-   if (ctx->load_input)
-   ctx->load_input(ctx, idx, decl);
+   if (ctx->load_input) {
+   ctx->input_decls[idx] = *decl;
+
+   if (bld_base->info->processor != 
PIPE_SHADER_FRAGMENT)
+   ctx->load_input(ctx, idx, decl,
+   >inputs[idx * 4]);
+   }

Mesa (12.0): appveyor: Update winflexbison download URL.

2016-09-14 Thread Jose Fonseca
Module: Mesa
Branch: 12.0
Commit: bde8f418bd2166849c971e416c3941ce115b2a1c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bde8f418bd2166849c971e416c3941ce115b2a1c

Author: Jose Fonseca 
Date:   Tue Sep 13 17:53:30 2016 +0100

appveyor: Update winflexbison download URL.

This particular version got moved into a `old_versions` subdirectory.

---

 appveyor.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/appveyor.yml b/appveyor.yml
index c2efa7e..6e69cbf 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -55,7 +55,7 @@ install:
 - python -m pip install --egg scons==2.4.1
 - scons --version
 # Install flex/bison
-- if not exist "%WINFLEXBISON_ARCHIVE%" appveyor DownloadFile 
"http://downloads.sourceforge.net/project/winflexbison/%WINFLEXBISON_ARCHIVE%;
+- if not exist "%WINFLEXBISON_ARCHIVE%" appveyor DownloadFile 
"https://downloads.sourceforge.net/project/winflexbison/old_versions/%WINFLEXBISON_ARCHIVE%;
 - 7z x -y -owinflexbison\ "%WINFLEXBISON_ARCHIVE%" > nul
 - set Path=%CD%\winflexbison;%Path%
 - win_flex --version

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