Mesa (master): anv: avoid segmentation fault due to vk_error()

2018-01-19 Thread Samuel Iglesias Gonsálvez
Module: Mesa
Branch: master
Commit: 7109a1fe132e5f79a25bb34f0f28a21cce3076db
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7109a1fe132e5f79a25bb34f0f28a21cce3076db

Author: Samuel Iglesias Gonsálvez 
Date:   Fri Jan 19 08:45:10 2018 +0100

anv: avoid segmentation fault due to vk_error()

vk_error() is a macro that calls __vk_errorf() with instance == NULL.

Then, __vk_errorf() passes a pointer to instance->debug_report_callbacks
to vk_debug_error(), which segfaults as this pointer is invalid but not
NULL.

Fixes: e5b1bd6ab8 "vulkan: move anv VK_EXT_debug_report implementation to 
common code."

Signed-off-by: Samuel Iglesias Gonsálvez 
Reviewed-by: Tapani Pälli 

---

 src/intel/vulkan/anv_util.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/intel/vulkan/anv_util.c b/src/intel/vulkan/anv_util.c
index 6b31224d7f..3c1803aa05 100644
--- a/src/intel/vulkan/anv_util.c
+++ b/src/intel/vulkan/anv_util.c
@@ -99,14 +99,16 @@ __vk_errorf(struct anv_instance *instance, const void 
*object,
   snprintf(report, sizeof(report), "%s:%d: %s", file, line, error_str);
}
 
-   vk_debug_report(&instance->debug_report_callbacks,
-   VK_DEBUG_REPORT_ERROR_BIT_EXT,
-   type,
-   (uint64_t) (uintptr_t) object,
-   line,
-   0,
-   "anv",
-   report);
+   if (instance) {
+  vk_debug_report(&instance->debug_report_callbacks,
+  VK_DEBUG_REPORT_ERROR_BIT_EXT,
+  type,
+  (uint64_t) (uintptr_t) object,
+  line,
+  0,
+  "anv",
+  report);
+   }
 
intel_loge("%s", report);
 

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


Mesa (master): docs: add sha256 checksums for 17.3.3

2018-01-19 Thread Juan Antonio Suárez Romero
Module: Mesa
Branch: master
Commit: 059db12097b3071911440556d48118e9dc4b9b28
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=059db12097b3071911440556d48118e9dc4b9b28

Author: Juan A. Suarez Romero 
Date:   Thu Jan 18 22:34:34 2018 +0100

docs: add sha256 checksums for 17.3.3

Signed-off-by: Juan A. Suarez Romero 
(cherry picked from commit bc1503b13fcf8190262757ea7f86613e14e25981)

---

 docs/relnotes/17.3.3.html | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/relnotes/17.3.3.html b/docs/relnotes/17.3.3.html
index 7f81cb82e4..350701a53a 100644
--- a/docs/relnotes/17.3.3.html
+++ b/docs/relnotes/17.3.3.html
@@ -31,7 +31,8 @@ because compatibility contexts are not supported.
 
 SHA256 checksums
 
-TBD
+c733d37a161501cd81dc9b309ccb613753b98eafc6d35e0847548a6642749772  
mesa-17.3.3.tar.gz
+41bac5de0ef6adc1f41a1ec0f80c19e361298ce02fa81b5f9ba4fdca33a9379b  
mesa-17.3.3.tar.xz
 
 
 

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


Mesa (master): docs: update calendar, add news and link release notes to 17.3.3

2018-01-19 Thread Juan Antonio Suárez Romero
Module: Mesa
Branch: master
Commit: 302ff82434e03f3acd87af3df201bc4f7836a0fc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=302ff82434e03f3acd87af3df201bc4f7836a0fc

Author: Juan A. Suarez Romero 
Date:   Thu Jan 18 22:38:59 2018 +0100

docs: update calendar, add news and link release notes to 17.3.3

Signed-off-by: Juan A. Suarez Romero 

---

 docs/index.html| 6 ++
 docs/release-calendar.html | 8 +---
 docs/relnotes.html | 1 +
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/docs/index.html b/docs/index.html
index 75a39d797d..d45ae37064 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -16,6 +16,12 @@
 
 News
 
+January 18, 2018
+
+Mesa 17.3.3 is released.
+This is a bug-fix release.
+
+
 January 8, 2018
 
 Mesa 17.3.2 is released.
diff --git a/docs/release-calendar.html b/docs/release-calendar.html
index 626a47c0db..f30018e655 100644
--- a/docs/release-calendar.html
+++ b/docs/release-calendar.html
@@ -39,13 +39,7 @@ if you'd like to nominate a patch in the next stable release.
 Notes
 
 
-17.3
-2018-01-12
-17.3.3
-Juan A. Suarez Romero
-
-
-
+17.3
 2018-01-26
 17.3.4
 Emil Velikov
diff --git a/docs/relnotes.html b/docs/relnotes.html
index d67b0220bc..94ed6146e5 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -21,6 +21,7 @@ The release notes summarize what's new or changed in each 
Mesa release.
 
 
 
+17.3.3 release notes
 17.3.2 release notes
 17.2.8 release notes
 17.3.1 release notes

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


Mesa (master): docs: add release notes for 17.3.3

2018-01-19 Thread Juan Antonio Suárez Romero
Module: Mesa
Branch: master
Commit: 3205a45fc3375415c8aff485459c3998097f6fbb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3205a45fc3375415c8aff485459c3998097f6fbb

Author: Juan A. Suarez Romero 
Date:   Thu Jan 18 20:02:46 2018 +

docs: add release notes for 17.3.3

Signed-off-by: Juan A. Suarez Romero 
(cherry picked from commit 80f5f279b3f9fc752ba35b1cb2878a936f8ace90)

---

 docs/relnotes/17.3.3.html | 150 ++
 1 file changed, 150 insertions(+)

diff --git a/docs/relnotes/17.3.3.html b/docs/relnotes/17.3.3.html
new file mode 100644
index 00..7f81cb82e4
--- /dev/null
+++ b/docs/relnotes/17.3.3.html
@@ -0,0 +1,150 @@
+http://www.w3.org/TR/html4/loose.dtd";>
+
+
+  
+  Mesa Release Notes
+  
+
+
+
+
+  The Mesa 3D Graphics Library
+
+
+
+
+
+Mesa 17.3.3 Release Notes / January 18, 2018
+
+
+Mesa 17.3.3 is a bug fix release which fixes bugs found since the 17.3.2 
release.
+
+
+Mesa 17.3.3 implements the OpenGL 4.5 API, but the version reported by
+glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
+glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 4.5.  OpenGL
+4.5 is only available if requested at context creation
+because compatibility contexts are not supported.
+
+
+
+SHA256 checksums
+
+TBD
+
+
+
+New features
+None
+
+
+Bug fixes
+
+
+
+https://bugs.freedesktop.org/show_bug.cgi?id=104214";>Bug 
104214 - Dota crashes when switching from game to desktop
+
+https://bugs.freedesktop.org/show_bug.cgi?id=104492";>Bug 
104492 - Compute Shader: Wrong alignment when assigning struct value to 
structured SSBO
+
+https://bugs.freedesktop.org/show_bug.cgi?id=104551";>Bug 
104551 - Check if Mako templates for Python are installed
+
+
+
+
+Changes
+
+Alex Smith (3):
+
+  anv: Add missing unlock in anv_scratch_pool_alloc
+  anv: Take write mask into account in has_color_buffer_write_enabled
+  anv: Make sure state on primary is correct after CmdExecuteCommands
+
+
+Andres Gomez (1):
+
+  anv: Import mako templates only during execution of anv_extensions
+
+
+Bas Nieuwenhuizen (11):
+
+  radv: Invert condition for all samples identical during resolve.
+  radv: Flush caches before subpass resolve.
+  radv: Fix fragment resolve destination offset.
+  radv: Use correct framebuffer size for partial FS resolves.
+  radv: Always use fragment resolve if dest uses DCC.
+  Revert "radv/gfx9: fix block compression texture views."
+  radv: Use correct HTILE expanded words.
+  radv: Allow writing 0 scissors.
+  ac/nir: Handle loading data from compact arrays.
+  radv: Invalidate L1 for VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT.
+  ac/nir: Sanitize location_frac for local variables.
+
+
+Dave Airlie (8):
+
+  radv: fix events on compute queues.
+  radv: fix pipeline statistics end query on compute queue
+  radv/gfx9: fix 3d image to image transfers on compute queues.
+  radv/gfx9: fix 3d image clears on compute queues
+  radv/gfx9: fix buffer to image for 3d images on compute queues
+  radv/gfx9: fix block compression texture views.
+  radv/gfx9: use a bigger hammer to flush cb/db caches.
+  radv/gfx9: use correct swizzle parameter to work out border swizzle.
+
+
+Emil Velikov (1):
+
+  docs: add sha256 checksums for 17.3.2
+
+
+Florian Will (1):
+
+  glsl: Respect std430 layout in lower_buffer_access
+
+
+Juan A. Suarez Romero (6):
+
+  cherry-ignore: intel/fs: Use the original destination region for int MUL 
lowering
+  cherry-ignore: i965/fs: Use UW types when using V immediates
+  cherry-ignore: main: Clear shader program data whenever ProgramBinary is 
called
+  cherry-ignore: egl: pass the dri2_dpy to the $plat_teardown 
functions
+  cherry-ignore: vulkan/wsi: free cmd pools
+  Update version to 17.3.3
+
+
+Józef Kucia (1):
+
+  radeonsi: fix alpha-to-coverage if color writes are disabled
+
+
+Kenneth Graunke (2):
+
+  i965: Require space for MI_BATCHBUFFER_END.
+  i965: Torch public intel_batchbuffer_emit_dword/float helpers.
+
+
+Lucas Stach (1):
+
+  etnaviv: disable in-place resolve for non-supertiled surfaces
+
+
+Samuel Iglesias Gonsálvez (1):
+
+  anv: VkDescriptorSetLayoutBinding can have descriptorCount == 0
+
+
+Thomas Hellstrom (1):
+
+  loader/dri3: Avoid freeing renderbuffers in use
+
+
+Tim Rowley (1):
+
+  swr/rast: fix invalid sign masks in avx512 simdlib code
+
+
+
+
+
+

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


Mesa (master): st/vdpau: release held lock in error path

2018-01-19 Thread Grazvydas Ignotas
Module: Mesa
Branch: master
Commit: e6abc613e2a78c01d1e79e4cd3be79e58d52eac2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6abc613e2a78c01d1e79e4cd3be79e58d52eac2

Author: Grazvydas Ignotas 
Date:   Tue Jan 16 00:00:33 2018 +0200

st/vdpau: release held lock in error path

Signed-off-by: Grazvydas Ignotas 
Reviewed-by: Christian König 
Cc: mesa-sta...@lists.freedesktop.org

---

 src/gallium/state_trackers/vdpau/surface.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/vdpau/surface.c 
b/src/gallium/state_trackers/vdpau/surface.c
index c678eb7037..012d303641 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -369,8 +369,10 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface,
   if (pformat == PIPE_FORMAT_YV12 &&
   p_surf->video_buffer->buffer_format == PIPE_FORMAT_NV12)
  conversion = CONVERSION_YV12_TO_NV12;
-  else
+  else {
+ mtx_unlock(&p_surf->device->mutex);
  return VDP_STATUS_NO_IMPLEMENTATION;
+  }
}
 
sampler_views = 
p_surf->video_buffer->get_sampler_view_planes(p_surf->video_buffer);

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


Mesa (master): docs: move untar line in basic testing instructions for coherence

2018-01-19 Thread Andres Gomez
Module: Mesa
Branch: master
Commit: 7760566ab7e98b3947a4e046a93dcc73ae97bb86
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7760566ab7e98b3947a4e046a93dcc73ae97bb86

Author: Andres Gomez 
Date:   Fri Jan 19 00:29:09 2018 +0200

docs: move untar line in basic testing instructions for coherence

For scons, windows/mingw dealing with LLVM_CONFIG is done before
untarring. This is also more convenient for copy and paste.

Cc: Emil Velikov 
Cc: Juan A. Suarez Romero 
Signed-off-by: Andres Gomez 
Reviewed-by: Eric Engestrom 
Reviewed-by: Juan A. Suarez 
Reviewed-by: Emil Velikov 

---

 docs/releasing.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/releasing.html b/docs/releasing.html
index f65d6d4173..d105bc96f6 100644
--- a/docs/releasing.html
+++ b/docs/releasing.html
@@ -474,9 +474,9 @@ Here is one solution that I've been using.
cd .. && rm -rf mesa-$__version
 
# Test the automake binaries
-   tar -xaf mesa-$__version.tar.xz && cd mesa-$__version
# Restore LLVM_CONFIG, if applicable:
# export LLVM_CONFIG=`echo $save_LLVM_CONFIG`; unset save_LLVM_CONFIG
+   tar -xaf mesa-$__version.tar.xz && cd mesa-$__version
./configure \
--with-dri-drivers=i965,swrast \
--with-gallium-drivers=swrast \

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


Mesa (master): docs: add a notice whenever a release is the final in a series

2018-01-19 Thread Andres Gomez
Module: Mesa
Branch: master
Commit: bd8537fa71a8f1d7e6300f60da07bf458b3ac9ac
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd8537fa71a8f1d7e6300f60da07bf458b3ac9ac

Author: Andres Gomez 
Date:   Fri Jan 19 00:29:08 2018 +0200

docs: add a notice whenever a release is the final in a series

Cc: Emil Velikov 
Cc: Juan A. Suarez Romero 
Signed-off-by: Andres Gomez 
Reviewed-by: Eric Engestrom 
Reviewed-by: Juan A. Suarez 
Reviewed-by: Emil Velikov 

---

 docs/releasing.html | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/docs/releasing.html b/docs/releasing.html
index c7f5dfe5d2..f65d6d4173 100644
--- a/docs/releasing.html
+++ b/docs/releasing.html
@@ -272,6 +272,11 @@ It is followed by a brief period (normally 24 or 48 hours) 
before the actual
 release is made.
 
 
+
+Be aware to add a note to warn about a final release in a series, if
+that is the case.
+
+
 Terminology used
 
 Nominated
@@ -311,6 +316,10 @@ The candidate for the Mesa X.Y.Z is now available. 
Currently we have:
  - NUMBER nominated (outstanding)
  - and NUMBER rejected patches
 
+[If applicable:
+Note: this is the final anticipated release in the SERIES series. Users are
+encouraged to migrate to the NEXT_SERIES series in order to obtain future 
fixes.]
+
 BRIEF SUMMARY OF CHANGES
 
 Take a look at section "Mesa stable queue" for more information.
@@ -594,7 +603,8 @@ Something like the following steps will do the trick:
 
 
 Also, edit docs/relnotes.html to add a link to the new release notes,
-edit docs/index.html to add a news entry, and remove the version from
+edit docs/index.html to add a news entry and a note in case of the
+last release in a series, and remove the version from
 docs/release-calendar.html. Then commit and push:
 
 
@@ -610,6 +620,11 @@ docs/release-calendar.html. Then commit and push:
 Use the generated template during the releasing process.
 
 
+
+Again, pay attention to add a note to warn about a final release in a
+series, if that is the case.
+
+
 
 Update the mesa3d.org website
 

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


Mesa (master): docs: add final release note for 17.2.8

2018-01-19 Thread Andres Gomez
Module: Mesa
Branch: master
Commit: b910eec4891339b4814b94773b4f085d47b0c366
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b910eec4891339b4814b94773b4f085d47b0c366

Author: Andres Gomez 
Date:   Fri Jan 19 00:29:07 2018 +0200

docs: add final release note for 17.2.8

Cc: Emil Velikov 
Cc: Juan A. Suarez Romero 
Signed-off-by: Andres Gomez 
Reviewed-by: Eric Engestrom 
Reviewed-by: Juan A. Suarez 
Reviewed-by: Emil Velikov 

---

 docs/index.html | 4 
 1 file changed, 4 insertions(+)

diff --git a/docs/index.html b/docs/index.html
index 39f4de6695..33fc5cf5bd 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -32,6 +32,10 @@ This is a bug-fix release.
 
 Mesa 17.2.8 is released.
 This is a bug-fix release.
+
+NOTE: It is anticipated that 17.2.8 will be the final release in the
+17.2 series. Users of 17.2 are encouraged to migrate to the 17.3
+series in order to obtain future fixes.
 
 
 December 21, 2017

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


Mesa (master): docs: add final release note for 17.1.10

2018-01-19 Thread Andres Gomez
Module: Mesa
Branch: master
Commit: 4b50cfef44c95035834dcd48ba3c55db0142e151
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b50cfef44c95035834dcd48ba3c55db0142e151

Author: Andres Gomez 
Date:   Fri Jan 19 00:29:06 2018 +0200

docs: add final release note for 17.1.10

Cc: Emil Velikov 
Cc: Juan A. Suarez Romero 
Signed-off-by: Andres Gomez 
Reviewed-by: Eric Engestrom 
Reviewed-by: Juan A. Suarez 
Reviewed-by: Emil Velikov 

---

 docs/index.html | 4 
 1 file changed, 4 insertions(+)

diff --git a/docs/index.html b/docs/index.html
index d45ae37064..39f4de6695 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -87,6 +87,10 @@ This is a bug-fix release.
 
 Mesa 17.1.10 is released.
 This is a bug-fix release.
+
+NOTE: It is anticipated that 17.1.10 will be the final release in the
+17.1 series. Users of 17.1 are encouraged to migrate to the 17.2
+series in order to obtain future fixes.
 
 
 September 17, 2017

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


Mesa (master): docs: correct a typo in releasing instructions

2018-01-19 Thread Andres Gomez
Module: Mesa
Branch: master
Commit: 7a2c87177ada941259bf35a982e67bfea0dd1d26
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a2c87177ada941259bf35a982e67bfea0dd1d26

Author: Andres Gomez 
Date:   Fri Jan 19 00:29:10 2018 +0200

docs: correct a typo in releasing instructions

Cc: Emil Velikov 
Cc: Juan A. Suarez Romero 
Signed-off-by: Andres Gomez 
Reviewed-by: Eric Engestrom 
Reviewed-by: Juan A. Suarez 
Reviewed-by: Emil Velikov 

---

 docs/releasing.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/releasing.html b/docs/releasing.html
index d105bc96f6..a022d0c484 100644
--- a/docs/releasing.html
+++ b/docs/releasing.html
@@ -96,7 +96,7 @@ described in the same section.
 
 
 Nomination happens in the mesa-stable@ mailing list. However,
-maintainer is resposible of checking for forgotten candidates in the
+maintainer is responsible of checking for forgotten candidates in the
 master branch. This is achieved by a combination of ad-hoc scripts and
 a casual search for terms such as regression, fix, broken and similar.
 

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


Mesa (master): mesa/program: Fix -Wunused-param warning

2018-01-19 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: ea89843b3d31313f3b3e9ddfd6e8744edb7545d6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea89843b3d31313f3b3e9ddfd6e8744edb7545d6

Author: Gert Wollny 
Date:   Thu Jan 18 09:57:29 2018 +0100

mesa/program: Fix -Wunused-param warning

v2: Don't annotate, but remove the unused ctx parameter

Signed-off-by: Gert Wollny 
Reviewed-by: Emil Velikov 
Reviewed-by: Ian Romanick 

---

 src/mesa/program/arbprogparse.c  | 2 +-
 src/mesa/program/ir_to_mesa.cpp  | 2 +-
 src/mesa/program/prog_optimize.c | 3 +--
 src/mesa/program/prog_optimize.h | 3 +--
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
index 83a501eea6..7cb1beb5bb 100644
--- a/src/mesa/program/arbprogparse.c
+++ b/src/mesa/program/arbprogparse.c
@@ -181,7 +181,7 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, 
GLenum target,
   return;
}
 
-   _mesa_optimize_program(ctx, &prog, program);
+   _mesa_optimize_program(&prog, program);
 
ralloc_free(program->String);
 
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index ad1b701690..321d8870e4 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2966,7 +2966,7 @@ get_mesa_program(struct gl_context *ctx,
   prog->info.fs.depth_layout = shader_program->FragDepthLayout;
}
 
-   _mesa_optimize_program(ctx, prog, prog);
+   _mesa_optimize_program(prog, prog);
 
/* This has to be done last.  Any operation that can cause
 * prog->ParameterValues to get reallocated (e.g., anything that adds a
diff --git a/src/mesa/program/prog_optimize.c b/src/mesa/program/prog_optimize.c
index 6a228ba258..7efdcadc12 100644
--- a/src/mesa/program/prog_optimize.c
+++ b/src/mesa/program/prog_optimize.c
@@ -1312,8 +1312,7 @@ _mesa_simplify_cmp(struct gl_program * program)
  * instructions, temp regs, etc.
  */
 void
-_mesa_optimize_program(struct gl_context *ctx, struct gl_program *program,
-   void *mem_ctx)
+_mesa_optimize_program(struct gl_program *program, void *mem_ctx)
 {
GLboolean any_change;
 
diff --git a/src/mesa/program/prog_optimize.h b/src/mesa/program/prog_optimize.h
index c99ce9ecee..fadfd621c5 100644
--- a/src/mesa/program/prog_optimize.h
+++ b/src/mesa/program/prog_optimize.h
@@ -46,8 +46,7 @@ _mesa_find_temp_intervals(const struct prog_instruction 
*instructions,
   GLint intEnd[MAX_PROGRAM_TEMPS]);
 
 extern void
-_mesa_optimize_program(struct gl_context *ctx, struct gl_program *program,
-   void *mem_ctx);
+_mesa_optimize_program(struct gl_program *program, void *mem_ctx);
 
 extern GLboolean
 _mesa_constant_fold(struct gl_program *prog);

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


Mesa (master): mesa: Make numSamples an unsigned int

2018-01-19 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: fef4b16523dea0be0de748fcab7e6367ed8e9542
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fef4b16523dea0be0de748fcab7e6367ed8e9542

Author: Gert Wollny 
Date:   Thu Jan 18 09:57:27 2018 +0100

mesa: Make numSamples an unsigned int

As a followup to the previous patch propagate the change of numSamples
from int to unsigned to gl_config::samples and consequently fix some
-Wsign-compare warnings.

Signed-off-by: Gert Wollny 
Reviewed-by: Emil Velikov 
Reviewed-by: Ian Romanick 

---

 src/mesa/main/context.c| 4 ++--
 src/mesa/main/context.h| 4 ++--
 src/mesa/main/mtypes.h | 2 +-
 src/mesa/main/multisample.c| 2 +-
 src/mesa/state_tracker/st_cb_fbo.c | 2 +-
 src/mesa/state_tracker/st_cb_fbo.h | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 53261fea51..a52c98112e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -227,7 +227,7 @@ _mesa_create_visual( GLboolean dbFlag,
  GLint accumGreenBits,
  GLint accumBlueBits,
  GLint accumAlphaBits,
- GLint numSamples )
+ GLuint numSamples )
 {
struct gl_config *vis = CALLOC_STRUCT(gl_config);
if (vis) {
@@ -269,7 +269,7 @@ _mesa_initialize_visual( struct gl_config *vis,
  GLint accumGreenBits,
  GLint accumBlueBits,
  GLint accumAlphaBits,
- GLint numSamples )
+ GLuint numSamples )
 {
assert(vis);
 
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 17fb86c323..5d9e2ede47 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -79,7 +79,7 @@ _mesa_create_visual( GLboolean dbFlag,
  GLint accumGreenBits,
  GLint accumBlueBits,
  GLint accumAlphaBits,
- GLint numSamples );
+ GLuint numSamples );
 
 extern GLboolean
 _mesa_initialize_visual( struct gl_config *v,
@@ -95,7 +95,7 @@ _mesa_initialize_visual( struct gl_config *v,
  GLint accumGreenBits,
  GLint accumBlueBits,
  GLint accumAlphaBits,
- GLint numSamples );
+ GLuint numSamples );
 
 extern void
 _mesa_destroy_visual( struct gl_config *vis );
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 1f1792e426..af67d59fef 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -242,7 +242,7 @@ struct gl_config
 
/* ARB_multisample / SGIS_multisample */
GLint sampleBuffers;
-   GLint samples;
+   GLuint samples;
 
/* SGIX_pbuffer / GLX 1.3 */
GLint maxPbufferWidth;
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index 8ede94b745..dfe6a37142 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -87,7 +87,7 @@ _mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat * 
val)
 
switch (pname) {
case GL_SAMPLE_POSITION: {
-  if ((int) index >= ctx->DrawBuffer->Visual.samples) {
+  if (index >= ctx->DrawBuffer->Visual.samples) {
  _mesa_error( ctx, GL_INVALID_VALUE, "glGetMultisamplefv(index)" );
  return;
   }
diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index a982f87b60..3a5c03c335 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -268,7 +268,7 @@ st_new_renderbuffer(struct gl_context *ctx, GLuint name)
  * renderbuffer).  The window system code determines the format.
  */
 struct gl_renderbuffer *
-st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw)
+st_new_renderbuffer_fb(enum pipe_format format, unsigned samples, boolean sw)
 {
struct st_renderbuffer *strb;
 
diff --git a/src/mesa/state_tracker/st_cb_fbo.h 
b/src/mesa/state_tracker/st_cb_fbo.h
index 02dee86576..345c11442c 100644
--- a/src/mesa/state_tracker/st_cb_fbo.h
+++ b/src/mesa/state_tracker/st_cb_fbo.h
@@ -102,7 +102,7 @@ st_ws_framebuffer(struct gl_framebuffer *fb)
 
 
 extern struct gl_renderbuffer *
-st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw);
+st_new_renderbuffer_fb(enum pipe_format format, unsigned samples, boolean sw);
 
 extern void
 st_update_renderbuffer_surface(struct st_context *st,

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


Mesa (master): mesa/program/prog_execute.c: Silence -Wunused-param

2018-01-19 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 81d8a0f4a44f8465e674b880fb8a4fb65320e8cb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=81d8a0f4a44f8465e674b880fb8a4fb65320e8cb

Author: Gert Wollny 
Date:   Thu Jan 18 09:57:28 2018 +0100

mesa/program/prog_execute.c: Silence -Wunused-param

v2: Don't annotate, but remove the unused ctx parameter

Signed-off-by: Gert Wollny 
Reviewed-by: Ian Romanick 
Reviewed-by: Emil Velikov 

---

 src/mesa/program/prog_execute.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c
index 1268476279..2c77538c2a 100644
--- a/src/mesa/program/prog_execute.c
+++ b/src/mesa/program/prog_execute.c
@@ -222,8 +222,7 @@ fetch_vector4(const struct prog_src_register *source,
  * XXX this currently only works for fragment program input attribs.
  */
 static void
-fetch_vector4_deriv(struct gl_context * ctx,
-const struct prog_src_register *source,
+fetch_vector4_deriv(const struct prog_src_register *source,
 const struct gl_program_machine *machine,
 char xOrY, GLfloat result[4])
 {
@@ -507,16 +506,14 @@ _mesa_execute_program(struct gl_context * ctx,
   case OPCODE_DDX: /* Partial derivative with respect to X */
  {
 GLfloat result[4];
-fetch_vector4_deriv(ctx, &inst->SrcReg[0], machine,
-'X', result);
+fetch_vector4_deriv(&inst->SrcReg[0], machine, 'X', result);
 store_vector4(inst, machine, result);
  }
  break;
   case OPCODE_DDY: /* Partial derivative with respect to Y */
  {
 GLfloat result[4];
-fetch_vector4_deriv(ctx, &inst->SrcReg[0], machine,
-'Y', result);
+fetch_vector4_deriv(&inst->SrcReg[0], machine, 'Y', result);
 store_vector4(inst, machine, result);
  }
  break;

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


Mesa (master): gallium: Make (num_)samples an unsigned int

2018-01-19 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: d0e37599ab822b54ca231b7f155f92156854681d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0e37599ab822b54ca231b7f155f92156854681d

Author: Gert Wollny 
Date:   Thu Jan 18 09:57:26 2018 +0100

gallium: Make (num_)samples an unsigned int

According to the ARB_multisample num_samples is a non-negative integer.
Consequently define it as such, fail in glx/choose_visual if a negative
number is given.

v2: split patch into gallium and mesa part

Signed-off-by: Gert Wollny 
Reviewed-by: Emil Velikov 

---

 src/gallium/include/state_tracker/st_api.h| 2 +-
 src/gallium/state_trackers/glx/xlib/glx_api.c | 6 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index f95f65f156..ec6e7844b8 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -202,7 +202,7 @@ struct st_visual
enum pipe_format color_format;
enum pipe_format depth_stencil_format;
enum pipe_format accum_format;
-   int samples;
+   unsigned samples;
 
/**
 * Desired render buffer.
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c 
b/src/gallium/state_trackers/glx/xlib/glx_api.c
index c473a0fe54..1994e6823a 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -181,7 +181,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
  GLint depth_size, GLint stencil_size,
  GLint accumRedSize, GLint accumGreenSize,
  GLint accumBlueSize, GLint accumAlphaSize,
- GLint level, GLint numAuxBuffers, GLint num_samples )
+ GLint level, GLint numAuxBuffers, GLuint num_samples )
 {
GLboolean ximageFlag = GL_TRUE;
XMesaVisual xmvis;
@@ -996,6 +996,10 @@ choose_visual( Display *dpy, int screen, const int *list, 
GLboolean fbConfig )
 
(void) caveat;
 
+   if (num_samples < 0) {
+  _mesa_warning(NULL, "GLX_SAMPLES_ARB: number of samples must not be 
negative");
+  return NULL;
+   }
 
/*
 * Since we're only simulating the GLX extension this function will never

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


Mesa (master): swr: fix clang 5 null cast warning

2018-01-19 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 8ff8c82630ccef75c13c84b5b32b45dda976f4ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ff8c82630ccef75c13c84b5b32b45dda976f4ec

Author: Greg V 
Date:   Sun Dec 31 19:55:27 2017 +0300

swr: fix clang 5 null cast warning

Reviewed-by: Emil Velikov 
Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h 
b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
index 6c801c7ff6..abb0c53ec4 100644
--- a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
+++ b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
@@ -624,7 +624,7 @@ uint32_t TileSwizzle2D(uint32_t xOffsetBytes, uint32_t 
yOffsetRows, const SWR_SU
 case SWR_TILE_MODE_WMAJOR: return 
ComputeTileSwizzle2D >(xOffsetBytes, 
yOffsetRows, pState);
 default: SWR_INVALID("Unsupported tiling mode");
 }
-return (uint32_t) NULL;
+return 0;
 }
 
 //
@@ -644,7 +644,7 @@ uint32_t TileSwizzle3D(uint32_t xOffsetBytes, uint32_t 
yOffsetRows, uint32_t zOf
 case SWR_TILE_MODE_YMAJOR: return 
ComputeTileSwizzle3D >(xOffsetBytes, 
yOffsetRows, zOffsetSlices, pState);
 default: SWR_INVALID("Unsupported tiling mode");
 }
-return (uint32_t) NULL;
+return 0;
 }
 
 template
@@ -677,7 +677,7 @@ uint32_t ComputeSurfaceOffset(uint32_t x, uint32_t y, 
uint32_t z, uint32_t array
 default: SWR_INVALID("Unsupported format");
 }
 
-return (uint32_t) NULL;
+return 0;
 }
 
 typedef void*(*PFN_COMPUTESURFADDR)(uint32_t, uint32_t, uint32_t, uint32_t, 
uint32_t, uint32_t, const SWR_SURFACE_STATE*);

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


Mesa (master): swr: allow a single swr architecture to be builtin

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: a4be2bcee2f344b864ed133ddde3dac7a266cab8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a4be2bcee2f344b864ed133ddde3dac7a266cab8

Author: Chuck Atkins 
Date:   Thu Jan 18 14:57:58 2018 -0500

swr: allow a single swr architecture to be builtin

Part 2 of 2 (part 1 is autoconf changes, part 2 is C++ changes)

When only a single SWR architecture is being used, this allows that
architecture to be builtin rather than as a separate libswrARCH.so that
gets loaded via dlopen.  Since there are now several different code
paths for each detected CPU architecture, the log output is also
adjusted to convey where the backend is getting loaded from.

This allows SWR to be used for static mesa builds which are still
important for large HPC environments where shared libraries can impose
unacceptable application startup times as hundreds of thousands of copies
of the libs are loaded from a shared parallel filesystem.

Based on an initial implementation by Tim Rowley.

v2: Refactor repetitive preprocessor checks to reduce code duplication
v3: Formatting changes per Bruce C. Also delay screen creation until end
to avoid leaks when failure conditions are hit.

Signed-off-by: Chuck Atkins 
Reviewed-by: Bruce Cherniak 
CC: Tim Rowley 
Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/swr_loader.cpp | 84 --
 1 file changed, 49 insertions(+), 35 deletions(-)

diff --git a/src/gallium/drivers/swr/swr_loader.cpp 
b/src/gallium/drivers/swr/swr_loader.cpp
index 9d6f918e34..7f28bdb536 100644
--- a/src/gallium/drivers/swr/swr_loader.cpp
+++ b/src/gallium/drivers/swr/swr_loader.cpp
@@ -28,81 +28,95 @@
 
 #include 
 
+// Helper function to resolve the backend filename based on architecture
+inline void get_swr_arch_filename(const char arch[], char filename[])
+{
+#ifdef HAVE_SWR_BUILTIN
+   strcpy(filename , "builtin");
+#else
+   sprintf(filename, "%sswr%s%s", UTIL_DL_PREFIX, arch, UTIL_DL_EXT);
+#endif
+}
+
 struct pipe_screen *
 swr_create_screen(struct sw_winsys *winsys)
 {
char filename[256] = { 0 };
-   fprintf(stderr, "SWR detected ");
-
-   util_dl_library *pLibrary = nullptr;
+   bool found = false;
+   bool is_knl = false;
+   PFNSwrGetInterface pfnSwrGetInterface = nullptr;
 
util_cpu_detect();
 
-   bool is_knl = false;
-
-   if (!strlen(filename) &&
-   util_cpu_caps.has_avx512f && util_cpu_caps.has_avx512er) {
-#if HAVE_SWR_KNL
-  fprintf(stderr, "KNL ");
-  sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrKNL", UTIL_DL_EXT);
-  is_knl = true;
+   if (!found && util_cpu_caps.has_avx512f && util_cpu_caps.has_avx512er) {
+  fprintf(stderr, "SWR detected KNL instruction support ");
+#ifndef HAVE_SWR_KNL
+  fprintf(stderr, "(skipping not built).\n");
 #else
-  fprintf(stderr, "KNL (not built) ");
+  get_swr_arch_filename("KNL", filename);
+  found = true;
+  is_knl = true;
 #endif
}
 
-   if (!strlen(filename) &&
-   util_cpu_caps.has_avx512f && util_cpu_caps.has_avx512bw) {
-#if HAVE_SWR_SKX
-  fprintf(stderr, "SKX ");
-  sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrSKX", UTIL_DL_EXT);
+   if (!found && util_cpu_caps.has_avx512f && util_cpu_caps.has_avx512bw) {
+  fprintf(stderr, "SWR detected SKX instruction support ");
+#ifndef HAVE_SWR_SKX
+  fprintf(stderr, "(skipping not built).\n");
 #else
-  fprintf(stderr, "SKX (not built) ");
+  get_swr_arch_filename("SKX", filename);
+  found = true;
 #endif
}
 
-   if (!strlen(filename) && util_cpu_caps.has_avx2) {
-#if HAVE_SWR_AVX2
-  fprintf(stderr, "AVX2 ");
-  sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrAVX2", UTIL_DL_EXT);
+   if (!found && util_cpu_caps.has_avx2) {
+  fprintf(stderr, "SWR detected AVX2 instruction support ");
+#ifndef HAVE_SWR_AVX2
+  fprintf(stderr, "(skipping not built).\n");
 #else
-  fprintf(stderr, "AVX2 (not built) ");
+  get_swr_arch_filename("AVX2", filename);
+  found = true;
 #endif
}
 
-   if (!strlen(filename) && util_cpu_caps.has_avx) {
-#if HAVE_SWR_AVX
-  fprintf(stderr, "AVX ");
-  sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrAVX", UTIL_DL_EXT);
+   if (!found && util_cpu_caps.has_avx) {
+  fprintf(stderr, "SWR detected AVX instruction support ");
+#ifndef HAVE_SWR_AVX
+  fprintf(stderr, "(skipping not built).\n");
 #else
-  fprintf(stderr, "AVX (not built) ");
+  get_swr_arch_filename("AVX", filename);
+  found = true;
 #endif
}
 
-   if (!strlen(filename)) {
-  fprintf(stderr, "- no appropriate swr architecture library.  
Aborting!\n");
+   if (!found) {
+  fprintf(stderr, "SWR could not detect a supported CPU architecture.\n");
   exit(-1);
-   } else {
-  fprintf(stderr, "\n");
}
 
-   pLibrary = util_dl_open(filename);
+   fprintf(stderr, "(using %s).\n", filename);
 
+#ifdef HAVE_SWR_BUILTIN
+   pfnSwrGetInterface = SwrGetInterface;
+#else
+   util_dl_library *pLibrary 

Mesa (master): swr: (autoconf) allow a single swr architecture to be builtin

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 2ed8b6f82704081a8992b3c30995ac8873b0c711
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ed8b6f82704081a8992b3c30995ac8873b0c711

Author: Chuck Atkins 
Date:   Thu Jan 18 14:57:57 2018 -0500

swr: (autoconf) allow a single swr architecture to be builtin

Part 1 of 2 (part 1 is autoconf changes, part 2 is C++ changes)

When only a single SWR architecture is being used, this allows that
architecture to be builtin rather than as a separate libswrARCH.so that
gets loaded via dlopen.  Since there are now several different code
paths for each detected CPU architecture, the log output is also
adjusted to convey where the backend is getting loaded from.

This allows SWR to be used for static mesa builds which are still
important for large HPC environments where shared libraries can impose
unacceptable application startup times as hundreds of thousands of copies
of the libs are loaded from a shared parallel filesystem.

Based on an initial implementation by Tim Rowley.

v2: Fix comment placement pointed out by Bruce C.

Signed-off-by: Chuck Atkins 
Reviewed-by: Bruce Cherniak 
CC: Tim Rowley 
Reviewed-by: Bruce Cherniak 

---

 configure.ac| 12 -
 src/gallium/drivers/swr/Makefile.am | 50 +
 2 files changed, 50 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index e236a3c54f..7c1fbe0ed1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2640,6 +2640,11 @@ if test -n "$with_gallium_drivers"; then
AC_MSG_ERROR([swr enabled but no swr architectures selected])
 fi
 
+# test if more than one swr arch configured
+if test `echo $swr_archs | wc -w` -eq 1; then
+HAVE_SWR_BUILTIN=yes
+fi
+
 HAVE_GALLIUM_SWR=yes
 ;;
 xvc4)
@@ -2689,6 +2694,7 @@ AM_CONDITIONAL(HAVE_SWR_AVX, test "x$HAVE_SWR_AVX" = xyes)
 AM_CONDITIONAL(HAVE_SWR_AVX2, test "x$HAVE_SWR_AVX2" = xyes)
 AM_CONDITIONAL(HAVE_SWR_KNL, test "x$HAVE_SWR_KNL" = xyes)
 AM_CONDITIONAL(HAVE_SWR_SKX, test "x$HAVE_SWR_SKX" = xyes)
+AM_CONDITIONAL(HAVE_SWR_BUILTIN, test "x$HAVE_SWR_BUILTIN" = xyes)
 
 dnl We need to validate some needed dependencies for renderonly drivers.
 
@@ -3153,7 +3159,11 @@ fi
 
 echo ""
 if test "x$HAVE_GALLIUM_SWR" != x; then
-echo "SWR archs:   $swr_archs"
+if test "x$HAVE_SWR_BUILTIN" = xyes; then
+echo "SWR archs:   $swr_archs (builtin)"
+else
+echo "SWR archs:   $swr_archs"
+fi
 fi
 
 dnl Libraries
diff --git a/src/gallium/drivers/swr/Makefile.am 
b/src/gallium/drivers/swr/Makefile.am
index c995f1b84a..ace4e1d4e4 100644
--- a/src/gallium/drivers/swr/Makefile.am
+++ b/src/gallium/drivers/swr/Makefile.am
@@ -26,13 +26,9 @@ AM_CXXFLAGS = $(GALLIUM_DRIVER_CFLAGS) $(CXX11_CXXFLAGS)
 
 noinst_LTLIBRARIES = libmesaswr.la
 
-# gen_knobs.* included here to provide driver access to swr configuration
 libmesaswr_la_SOURCES = \
$(CXX_SOURCES) \
-   $(COMMON_CXX_SOURCES) \
$(JITTER_CXX_SOURCES) \
-   rasterizer/codegen/gen_knobs.cpp \
-   rasterizer/codegen/gen_knobs.h \
$(LOADER_SOURCES)
 
 COMMON_CXXFLAGS = \
@@ -243,8 +239,6 @@ COMMON_LDFLAGS = \
 lib_LTLIBRARIES =
 
 if HAVE_SWR_AVX
-lib_LTLIBRARIES += libswrAVX.la
-
 libswrAVX_la_CXXFLAGS = \
$(PTHREAD_CFLAGS) \
$(SWR_AVX_CXXFLAGS) \
@@ -262,7 +256,6 @@ libswrAVX_la_LDFLAGS = \
 endif
 
 if HAVE_SWR_AVX2
-lib_LTLIBRARIES += libswrAVX2.la
 libswrAVX2_la_CXXFLAGS = \
$(PTHREAD_CFLAGS) \
$(SWR_AVX2_CXXFLAGS) \
@@ -280,8 +273,6 @@ libswrAVX2_la_LDFLAGS = \
 endif
 
 if HAVE_SWR_KNL
-lib_LTLIBRARIES += libswrKNL.la
-
 libswrKNL_la_CXXFLAGS = \
$(PTHREAD_CFLAGS) \
$(SWR_KNL_CXXFLAGS) \
@@ -299,8 +290,6 @@ libswrKNL_la_LDFLAGS = \
 endif
 
 if HAVE_SWR_SKX
-lib_LTLIBRARIES += libswrSKX.la
-
 libswrSKX_la_CXXFLAGS = \
$(PTHREAD_CFLAGS) \
$(SWR_SKX_CXXFLAGS) \
@@ -317,6 +306,45 @@ libswrSKX_la_LDFLAGS = \
$(COMMON_LDFLAGS)
 endif
 
+if HAVE_SWR_BUILTIN
+libmesaswr_la_CXXFLAGS += -DHAVE_SWR_BUILTIN
+libmesaswr_la_LIBADD =
+if HAVE_SWR_AVX
+noinst_LTLIBRARIES += libswrAVX.la
+libmesaswr_la_LIBADD += libswrAVX.la
+endif
+if HAVE_SWR_AVX2
+noinst_LTLIBRARIES += libswrAVX2.la
+libmesaswr_la_LIBADD += libswrAVX2.la
+endif
+if HAVE_SWR_KNL
+noinst_LTLIBRARIES += libswrKNL.la
+libmesaswr_la_LIBADD += libswrKNL.la
+endif
+if HAVE_SWR_SKX
+noinst_LTLIBRARIES += libswrSKX.la
+libmesaswr_la_LIBADD += libswrSKX.la
+endif
+else # !HAVE_SWR_BUILTIN
+# gen_knobs.* included here to provide driver access to swr configuration
+libmesaswr_la_SOURCES += \
+   $(COMMON_CXX_SOURCES) \
+   rasterizer/codegen/gen_knobs.cpp \
+   rasterizer/codegen/gen_knobs.h
+if HAVE_SWR_AVX
+lib_LTLIBRARIES += libswrAVX.la
+endif
+if HAVE_SWR_AVX2
+lib_LTLIBRARIES += libswrAVX2.la
+endif
+if HAVE_SWR_KNL
+lib_LTLIBRARIES += 

Mesa (master): i965: Rename 'aux' to 'prog_data' in program cache.

2018-01-19 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 8a5bc304ff1c44a719b24081e16f073101658601
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a5bc304ff1c44a719b24081e16f073101658601

Author: Kenneth Graunke 
Date:   Thu Jan 18 14:01:20 2018 -0800

i965: Rename 'aux' to 'prog_data' in program cache.

'aux' is a very generic name, suggesting it can be a bunch of things.
However, it's always the brw_*_prog_data structure.  So, call it that.

Reviewed-by: Iago Toral Quiroga 

---

 src/mesa/drivers/dri/i965/brw_program_cache.c | 31 ++-
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c 
b/src/mesa/drivers/dri/i965/brw_program_cache.c
index adb0cd5a23..9266273b5d 100644
--- a/src/mesa/drivers/dri/i965/brw_program_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
@@ -69,7 +69,7 @@ struct brw_cache_item {
 
/** for variable-sized keys */
GLuint key_size;
-   GLuint aux_size;
+   GLuint prog_data_size;
const void *key;
 
uint32_t offset;
@@ -182,7 +182,7 @@ bool
 brw_search_cache(struct brw_cache *cache,
  enum brw_cache_id cache_id,
  const void *key, GLuint key_size,
- uint32_t *inout_offset, void *inout_aux)
+ uint32_t *inout_offset, void *inout_prog_data)
 {
struct brw_context *brw = cache->brw;
struct brw_cache_item *item;
@@ -200,12 +200,13 @@ brw_search_cache(struct brw_cache *cache,
if (item == NULL)
   return false;
 
-   void *aux = ((char *) item->key) + item->key_size;
+   void *prog_data = ((char *) item->key) + item->key_size;
 
-   if (item->offset != *inout_offset || aux != *((void **) inout_aux)) {
+   if (item->offset != *inout_offset ||
+   prog_data != *((void **) inout_prog_data)) {
   brw->ctx.NewDriverState |= (1 << cache_id);
   *inout_offset = item->offset;
-  *((void **) inout_aux) = aux;
+  *((void **) inout_prog_data) = prog_data;
}
 
return true;
@@ -320,10 +321,10 @@ brw_upload_cache(struct brw_cache *cache,
  GLuint key_size,
  const void *data,
  GLuint data_size,
- const void *aux,
- GLuint aux_size,
+ const void *prog_data,
+ GLuint prog_data_size,
  uint32_t *out_offset,
- void *out_aux)
+ void *out_prog_data)
 {
struct brw_cache_item *item = CALLOC_STRUCT(brw_cache_item);
const struct brw_cache_item *matching_data =
@@ -335,7 +336,7 @@ brw_upload_cache(struct brw_cache *cache,
item->size = data_size;
item->key = key;
item->key_size = key_size;
-   item->aux_size = aux_size;
+   item->prog_data_size = prog_data_size;
hash = hash_key(item);
item->hash = hash;
 
@@ -354,11 +355,11 @@ brw_upload_cache(struct brw_cache *cache,
   memcpy(cache->map + item->offset, data, data_size);
}
 
-   /* Set up the memory containing the key and aux_data */
-   tmp = malloc(key_size + aux_size);
+   /* Set up the memory containing the key and prog_data */
+   tmp = malloc(key_size + prog_data_size);
 
memcpy(tmp, key, key_size);
-   memcpy(tmp + key_size, aux, aux_size);
+   memcpy(tmp + key_size, prog_data, prog_data_size);
 
item->key = tmp;
 
@@ -371,7 +372,7 @@ brw_upload_cache(struct brw_cache *cache,
cache->n_items++;
 
*out_offset = item->offset;
-   *(void **)out_aux = (void *)((char *)item->key + item->key_size);
+   *(void **)out_prog_data = (void *)((char *)item->key + item->key_size);
cache->brw->ctx.NewDriverState |= 1 << cache_id;
 }
 
@@ -412,8 +413,8 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache 
*cache)
  c->cache_id == BRW_CACHE_GS_PROG ||
  c->cache_id == BRW_CACHE_FS_PROG ||
  c->cache_id == BRW_CACHE_CS_PROG) {
-const void *item_aux = c->key + c->key_size;
-brw_stage_prog_data_free(item_aux);
+const void *item_prog_data = c->key + c->key_size;
+brw_stage_prog_data_free(item_prog_data);
  }
  free((void *)c->key);
  free(c);

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


Mesa (master): i965: Avoid problems from referencing orphaned BOs after growing.

2018-01-19 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: c7dcee58b5fe183e1653c13bff6a212f0d157b29
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7dcee58b5fe183e1653c13bff6a212f0d157b29

Author: Kenneth Graunke 
Date:   Tue Nov 28 08:44:11 2017 -0800

i965: Avoid problems from referencing orphaned BOs after growing.

Growing the batch/state buffer is a lot more dangerous than I thought.

A number of places emit multiple state buffer sections, and then write
data to the returned pointer, or save a pointer to brw->batch.state.bo
and then use it in relocations.  If each call can grow, this can result
in stale map references or stale BO pointers.  Furthermore, fences refer
to the old batch BO, and that reference needs to continue working.

To avoid these woes, we avoid ever swapping the brw->batch.*.bo pointer,
instead exchanging the brw_bo structures in place.  That way, stale BO
references are fine - the GEM handle changes, but the brw_bo pointer
doesn't.  We also defer the memcpy until a quiescent point, so callers
can write to the returned pointer - which may be in either BO - and
we'll sort it out and combine the two properly in the end.

v2/v3:
- Handle stale pointers in the shadow copy case, where realloc may or
  may not move our shadow copy to a new address.
- Track the partial map explicitly, to avoid problems with buffer reuse
  where multiple map modes exist (caught by Chris Wilson).

v4:
- Don't use realloc in the CPU shadow case, it isn't safe.

Fixes: 2dfc119f22f257082ab0 "i965: Grow the batch/state buffers if we need 
space and can't flush."
Reviewed-by: Iago Toral Quiroga  [v3]
Reviewed-by: Chris Wilson 

---

 src/mesa/drivers/dri/i965/brw_context.h   |   3 +
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 126 +-
 2 files changed, 105 insertions(+), 24 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 79e9f49a38..d00fe35108 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -473,6 +473,9 @@ struct brw_reloc_list {
 struct brw_growing_bo {
struct brw_bo *bo;
uint32_t *map;
+   struct brw_bo *partial_bo;
+   uint32_t *partial_bo_map;
+   unsigned partial_bytes;
 };
 
 struct intel_batchbuffer {
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index b4fcd92b6b..02bfd3f333 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -171,6 +171,9 @@ recreate_growing_buffer(struct brw_context *brw,
 
grow->bo = brw_bo_alloc(bufmgr, name, size, 4096);
grow->bo->kflags = can_do_exec_capture(screen) ? EXEC_OBJECT_CAPTURE : 0;
+   grow->partial_bo = NULL;
+   grow->partial_bo_map = NULL;
+   grow->partial_bytes = 0;
 
if (!batch->use_shadow_copy)
   grow->map = brw_bo_map(brw, grow->bo, MAP_READ | MAP_WRITE);
@@ -267,6 +270,26 @@ intel_batchbuffer_free(struct intel_batchbuffer *batch)
   _mesa_hash_table_destroy(batch->state_batch_sizes, NULL);
 }
 
+/**
+ * Finish copying the old batch/state buffer's contents to the new one
+ * after we tried to "grow" the buffer in an earlier operation.
+ */
+static void
+finish_growing_bos(struct brw_growing_bo *grow)
+{
+   struct brw_bo *old_bo = grow->partial_bo;
+   if (!old_bo)
+  return;
+
+   memcpy(grow->map, grow->partial_bo_map, grow->partial_bytes);
+
+   grow->partial_bo = NULL;
+   grow->partial_bo_map = NULL;
+   grow->partial_bytes = 0;
+
+   brw_bo_unreference(old_bo);
+}
+
 static void
 replace_bo_in_reloc_list(struct brw_reloc_list *rlist,
  uint32_t old_handle, uint32_t new_handle)
@@ -296,21 +319,30 @@ grow_buffer(struct brw_context *brw,
struct brw_bufmgr *bufmgr = brw->bufmgr;
struct brw_bo *bo = grow->bo;
 
-   uint32_t *old_map = grow->map;
-   struct brw_bo *old_bo = grow->bo;
+   perf_debug("Growing %s - ran out of space\n", bo->name);
 
-   struct brw_bo *new_bo =
-  brw_bo_alloc(bufmgr, old_bo->name, new_size, old_bo->align);
-   uint32_t *new_map;
+   if (grow->partial_bo) {
+  /* We've already grown once, and now we need to do it again.
+   * Finish our last grow operation so we can start a new one.
+   * This should basically never happen.
+   */
+  perf_debug("Had to grow multiple times");
+  finish_growing_bos(grow);
+   }
 
-   perf_debug("Growing %s - ran out of space\n", old_bo->name);
+   struct brw_bo *new_bo = brw_bo_alloc(bufmgr, bo->name, new_size, bo->align);
 
/* Copy existing data to the new larger buffer */
+   grow->partial_bo_map = grow->map;
+
if (batch->use_shadow_copy) {
-  new_map = realloc(old_map, new_size);
+  /* We can't safely use realloc, as it may move the existing buffer,
+   * breaking existing pointers the caller may still be using.  Just
+   * malloc a new copy and memcpy it like the normal BO path.
+   */
+  grow->map = malloc(new_size);

Mesa (master): radv: emit pa_sc_mode_cntl_0 with multisample state.

2018-01-19 Thread Bas Nieuwenhuizen
Module: Mesa
Branch: master
Commit: dbf1e918cd23780600229ebbd322e40e12ae80bc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbf1e918cd23780600229ebbd322e40e12ae80bc

Author: Bas Nieuwenhuizen 
Date:   Tue Jan 16 22:20:13 2018 +0100

radv: emit pa_sc_mode_cntl_0 with multisample state.

We don't have the meta kludge with 0 viewports anymore,
so we can always enable them.

Reviewed-by: Samuel Pitoiset 

---

 src/amd/vulkan/radv_cmd_buffer.c | 4 ++--
 src/amd/vulkan/radv_pipeline.c   | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 172f95e7c9..7b44f5c5c8 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -612,6 +612,8 @@ radv_update_multisample_state(struct radv_cmd_buffer 
*cmd_buffer,
radeon_emit(cmd_buffer->cs, ms->pa_sc_line_cntl);
radeon_emit(cmd_buffer->cs, ms->pa_sc_aa_config);
 
+   radeon_set_context_reg(cmd_buffer->cs, R_028A48_PA_SC_MODE_CNTL_0, 
ms->pa_sc_mode_cntl_0);
+
radv_cayman_emit_msaa_sample_locs(cmd_buffer->cs, num_samples);
 
/* GFX9: Flush DFSM when the AA mode changes. */
@@ -1143,8 +1145,6 @@ radv_emit_scissor(struct radv_cmd_buffer *cmd_buffer)
  cmd_buffer->state.dynamic.scissor.scissors,
  cmd_buffer->state.dynamic.viewport.viewports,
  
cmd_buffer->state.emitted_pipeline->graphics.can_use_guardband);
-   radeon_set_context_reg(cmd_buffer->cs, R_028A48_PA_SC_MODE_CNTL_0,
-  
cmd_buffer->state.pipeline->graphics.ms.pa_sc_mode_cntl_0 | 
S_028A48_VPORT_SCISSOR_ENABLE(count ? 1 : 0));
 }
 
 static void
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 5f824796fe..a49fe05993 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -833,7 +833,8 @@ radv_pipeline_init_multisample_state(struct radv_pipeline 
*pipeline,
S_028A4C_MULTI_SHADER_ENGINE_PRIM_DISCARD_ENABLE(1) |
S_028A4C_FORCE_EOV_CNTDWN_ENABLE(1) |
S_028A4C_FORCE_EOV_REZ_ENABLE(1);
-   ms->pa_sc_mode_cntl_0 = 
S_028A48_ALTERNATE_RBS_PER_TILE(pipeline->device->physical_device->rad_info.chip_class
 >= GFX9);
+   ms->pa_sc_mode_cntl_0 = 
S_028A48_ALTERNATE_RBS_PER_TILE(pipeline->device->physical_device->rad_info.chip_class
 >= GFX9) |
+   S_028A48_VPORT_SCISSOR_ENABLE(1);
 
if (ms->num_samples > 1) {
unsigned log_samples = util_logbase2(ms->num_samples);

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


Mesa (master): radv: Always re-emit the sample position offset user SGPR.

2018-01-19 Thread Bas Nieuwenhuizen
Module: Mesa
Branch: master
Commit: 61a790409e3625e8a124fe6dfac394e837f31179
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=61a790409e3625e8a124fe6dfac394e837f31179

Author: Bas Nieuwenhuizen 
Date:   Tue Jan 16 02:08:02 2018 +0100

radv: Always re-emit the sample position offset user SGPR.

The user SGPR location can change between pipelines, so we need to
emit it again to the pottentially changed SGPR index.

Reviewed-by: Samuel Pitoiset 

---

 src/amd/vulkan/radv_cmd_buffer.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 7b44f5c5c8..1143aa085f 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -604,23 +604,6 @@ radv_update_multisample_state(struct radv_cmd_buffer 
*cmd_buffer,
radeon_set_context_reg(cmd_buffer->cs, R_028804_DB_EQAA, ms->db_eqaa);
radeon_set_context_reg(cmd_buffer->cs, R_028A4C_PA_SC_MODE_CNTL_1, 
ms->pa_sc_mode_cntl_1);
 
-   if (old_pipeline && num_samples == 
old_pipeline->graphics.ms.num_samples &&
-   
old_pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.needs_sample_positions
 == 
pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.needs_sample_positions)
-   return;
-
-   radeon_set_context_reg_seq(cmd_buffer->cs, R_028BDC_PA_SC_LINE_CNTL, 2);
-   radeon_emit(cmd_buffer->cs, ms->pa_sc_line_cntl);
-   radeon_emit(cmd_buffer->cs, ms->pa_sc_aa_config);
-
-   radeon_set_context_reg(cmd_buffer->cs, R_028A48_PA_SC_MODE_CNTL_0, 
ms->pa_sc_mode_cntl_0);
-
-   radv_cayman_emit_msaa_sample_locs(cmd_buffer->cs, num_samples);
-
-   /* GFX9: Flush DFSM when the AA mode changes. */
-   if (cmd_buffer->device->dfsm_allowed) {
-   radeon_emit(cmd_buffer->cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
-   radeon_emit(cmd_buffer->cs, EVENT_TYPE(V_028A90_FLUSH_DFSM) | 
EVENT_INDEX(0));
-   }
if 
(pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.needs_sample_positions) {
uint32_t offset;
struct ac_userdata_info *loc = radv_lookup_user_sgpr(pipeline, 
MESA_SHADER_FRAGMENT, AC_UD_PS_SAMPLE_POS_OFFSET);
@@ -650,6 +633,23 @@ radv_update_multisample_state(struct radv_cmd_buffer 
*cmd_buffer,
radeon_set_sh_reg(cmd_buffer->cs, base_reg + loc->sgpr_idx * 4, 
offset);
cmd_buffer->sample_positions_needed = true;
}
+
+   if (old_pipeline && num_samples == 
old_pipeline->graphics.ms.num_samples)
+   return;
+
+   radeon_set_context_reg_seq(cmd_buffer->cs, R_028BDC_PA_SC_LINE_CNTL, 2);
+   radeon_emit(cmd_buffer->cs, ms->pa_sc_line_cntl);
+   radeon_emit(cmd_buffer->cs, ms->pa_sc_aa_config);
+
+   radeon_set_context_reg(cmd_buffer->cs, R_028A48_PA_SC_MODE_CNTL_0, 
ms->pa_sc_mode_cntl_0);
+
+   radv_cayman_emit_msaa_sample_locs(cmd_buffer->cs, num_samples);
+
+   /* GFX9: Flush DFSM when the AA mode changes. */
+   if (cmd_buffer->device->dfsm_allowed) {
+   radeon_emit(cmd_buffer->cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
+   radeon_emit(cmd_buffer->cs, EVENT_TYPE(V_028A90_FLUSH_DFSM) | 
EVENT_INDEX(0));
+   }
 }
 
 static void

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


Mesa (master): swr/rast: Added ICLAMP builder function

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: c719f62621dd75c4509032ed0f57a8e353ff5beb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c719f62621dd75c4509032ed0f57a8e353ff5beb

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:10 2018 -0600

swr/rast: Added ICLAMP builder function

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp | 4 ++--
 src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
index f70c8dbad9..142007eb34 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
@@ -1545,13 +1545,13 @@ namespace SwrJit
 return result;
 }
 
-Value *Builder::ICLAMP(Value* src, Value* low, Value* high)
+Value *Builder::ICLAMP(Value* src, Value* low, Value* high, const 
llvm::Twine& name)
 {
 Value *lowCmp = ICMP_SLT(src, low);
 Value *ret = SELECT(lowCmp, low, src);
 
 Value *highCmp = ICMP_SGT(ret, high);
-ret = SELECT(highCmp, high, ret);
+ret = SELECT(highCmp, high, ret, name);
 
 return ret;
 }
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h 
b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
index 609e0b2b56..c7f7f1aea9 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
@@ -174,7 +174,7 @@ Value *VPCMPGTD(Value* a, Value* b)
 return S_EXT(vIndexMask,VectorType::get(mInt32Ty,JM()->mVWidth));
 }
 
-Value *ICLAMP(Value* src, Value* low, Value* high);
+Value *ICLAMP(Value* src, Value* low, Value* high, const llvm::Twine& name = 
"");
 Value *FCLAMP(Value* src, Value* low, Value* high);
 Value *FCLAMP(Value* src, float low, float high);
 

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


Mesa (master): swr/rast: Added missing define for Linux/gcc

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 079ae3c48dda02101f1776e03c0c401df6b21ff7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=079ae3c48dda02101f1776e03c0c401df6b21ff7

Author: George Kyriazis 
Date:   Fri Jan 19 15:46:57 2018 -0600

swr/rast: Added missing define for Linux/gcc

+ ZeroMemory() macro definition for non win32-compilation in common/os.h

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/common/os.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/swr/rasterizer/common/os.h 
b/src/gallium/drivers/swr/rasterizer/common/os.h
index 358cb33b6e..c7e87e2890 100644
--- a/src/gallium/drivers/swr/rasterizer/common/os.h
+++ b/src/gallium/drivers/swr/rasterizer/common/os.h
@@ -244,6 +244,7 @@ void AlignedFree(void* p)
 #define PRAGMA_WARNING_PUSH_DISABLE(...)
 #define PRAGMA_WARNING_POP()
 
+#define ZeroMemory(dst, size) memset(dst, 0, size)
 #else
 
 #error Unsupported OS/system.

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


Mesa (master): swr/rast: silence generated file warnings

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 3c405e32b0e6a248fa1e35a97276473884517eb1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c405e32b0e6a248fa1e35a97276473884517eb1

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:08 2018 -0600

swr/rast: silence generated file warnings

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp 
b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp
index 61c31328a6..9db6c61b98 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp
+++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp
@@ -40,6 +40,7 @@ namespace SwrJit
 INLINE static StructType *Gen_${type['name']}(JitManager* pJitMgr)
 {
 LLVMContext& ctx = pJitMgr->mContext;
+   (void) ctx;
 
 StructType* pRetType = 
pJitMgr->mpCurrentModule->getTypeByName("${type['name']}");
 if (pRetType == nullptr)

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


Mesa (master): swr/rast: Shorten some filenames

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 4cd6e2ebfd0bbfb10edc0d87ea89344de32dde2f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4cd6e2ebfd0bbfb10edc0d87ea89344de32dde2f

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:04 2018 -0600

swr/rast: Shorten some filenames

in shader and fetch dump files

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp | 2 +-
 src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
index cc92622978..a819765855 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
@@ -513,7 +513,7 @@ struct BlendJit : public Builder
 
 Function* Create(const BLEND_COMPILE_STATE& state)
 {
-std::stringstream fnName("BlendShader_", std::ios_base::in | 
std::ios_base::out | std::ios_base::ate);
+std::stringstream fnName("BLND_", std::ios_base::in | 
std::ios_base::out | std::ios_base::ate);
 fnName << ComputeCRC(0, &state, sizeof(state));
 
 // blend function signature
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index 87363d27ef..351ff0bf9c 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -133,7 +133,7 @@ struct FetchJit : public Builder
 
 Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
 {
-std::stringstream fnName("FetchShader_", std::ios_base::in | 
std::ios_base::out | std::ios_base::ate);
+std::stringstream fnName("FCH_", std::ios_base::in | std::ios_base::out | 
std::ios_base::ate);
 fnName << ComputeCRC(0, &fetchState, sizeof(fetchState));
 
 Function*fetch = Function::Create(JM()->mFetchShaderTy, 
GlobalValue::ExternalLinkage, fnName.str(), JM()->mpCurrentModule);

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


Mesa (master): swr/rast: work supporting optimizations in Debug builds.

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 3936044d07605912a684753e39b5c4848209fa9f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3936044d07605912a684753e39b5c4848209fa9f

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:03 2018 -0600

swr/rast: work supporting optimizations in Debug builds.

Reviewed-by: Bruce Cherniak 

---

 .../drivers/swr/rasterizer/jitter/JitManager.cpp| 21 +
 .../drivers/swr/rasterizer/jitter/JitManager.h  | 11 ++-
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index b0f9d2f645..5e5bba6f70 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -96,15 +96,17 @@ JitManager::JitManager(uint32_t simdWidth, const char 
*arch, const char* core)
 mpCurrentModule->setTargetTriple(hostTriple.getTriple());
 #endif // _WIN32
 
+auto optLevel = CodeGenOpt::Aggressive;
+
 mpExec = EngineBuilder(std::move(newModule))
 .setTargetOptions(tOpts)
-.setOptLevel(CodeGenOpt::Aggressive)
+.setOptLevel(optLevel)
 .setMCPU(hostCPUName)
 .create();
 
 if (KNOB_JIT_ENABLE_CACHE)
 {
-mCache.Init(this, hostCPUName);
+mCache.Init(this, hostCPUName, optLevel);
 mpExec->setObjectCache(&mCache);
 }
 
@@ -453,7 +455,7 @@ extern "C"
 //
 struct JitCacheFileHeader
 {
-void Init(uint32_t llCRC, uint32_t objCRC, const std::string& moduleID, 
const std::string& cpu, uint64_t bufferSize)
+void Init(uint32_t llCRC, uint32_t objCRC, const std::string& moduleID, 
const std::string& cpu, uint32_t optLevel, uint64_t bufferSize)
 {
 m_MagicNumber = JC_MAGIC_NUMBER;
 m_BufferSize = bufferSize;
@@ -464,13 +466,15 @@ struct JitCacheFileHeader
 m_ModuleID[JC_STR_MAX_LEN - 1] = 0;
 strncpy(m_Cpu, cpu.c_str(), JC_STR_MAX_LEN - 1);
 m_Cpu[JC_STR_MAX_LEN - 1] = 0;
+m_optLevel = optLevel;
 }
 
-bool IsValid(uint32_t llCRC, const std::string& moduleID, const 
std::string& cpu)
+bool IsValid(uint32_t llCRC, const std::string& moduleID, const 
std::string& cpu, uint32_t optLevel)
 {
 if ((m_MagicNumber != JC_MAGIC_NUMBER) ||
 (m_llCRC != llCRC) ||
-(m_platformKey != JC_PLATFORM_KEY))
+(m_platformKey != JC_PLATFORM_KEY) ||
+(m_optLevel != optLevel))
 {
 return false;
 }
@@ -494,7 +498,7 @@ struct JitCacheFileHeader
 uint64_t GetBufferCRC() const { return m_objCRC; }
 
 private:
-static const uint64_t   JC_MAGIC_NUMBER = 0xfedcba9876543211ULL + 1;
+static const uint64_t   JC_MAGIC_NUMBER = 0xfedcba9876543211ULL + 2;
 static const size_t JC_STR_MAX_LEN = 32;
 static const uint32_t   JC_PLATFORM_KEY =
 (LLVM_VERSION_MAJOR << 24)  |
@@ -507,6 +511,7 @@ private:
 uint32_t m_llCRC;
 uint32_t m_platformKey;
 uint32_t m_objCRC;
+uint32_t m_optLevel;
 char m_ModuleID[JC_STR_MAX_LEN];
 char m_Cpu[JC_STR_MAX_LEN];
 };
@@ -607,7 +612,7 @@ void JitCache::notifyObjectCompiled(const llvm::Module *M, 
llvm::MemoryBufferRef
 uint32_t objcrc = ComputeCRC(0, Obj.getBufferStart(), 
Obj.getBufferSize());
 
 JitCacheFileHeader header;
-header.Init(mCurrentModuleCRC, objcrc, moduleID, mCpu, 
Obj.getBufferSize());
+header.Init(mCurrentModuleCRC, objcrc, moduleID, mCpu, mOptLevel, 
Obj.getBufferSize());
 
 fileObj.write((const char*)&header, sizeof(header));
 fileObj.flush();
@@ -664,7 +669,7 @@ std::unique_ptr 
JitCache::getObject(const llvm::Module* M)
 break;
 }
 
-if (!header.IsValid(mCurrentModuleCRC, moduleID, mCpu))
+if (!header.IsValid(mCurrentModuleCRC, moduleID, mCpu, mOptLevel))
 {
 break;
 }
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
index 50b9d82904..ddd6864051 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
@@ -96,7 +96,15 @@ public:
 JitCache();
 virtual ~JitCache() {}
 
-void Init(JitManager* pJitMgr, const llvm::StringRef& cpu) { mCpu = 
cpu.str(); mpJitMgr = pJitMgr; }
+void Init(
+JitManager* pJitMgr,
+const llvm::StringRef& cpu,
+llvm::CodeGenOpt::Level level)
+{
+mCpu = cpu.str();
+mpJitMgr = pJitMgr;
+mOptLevel = level;
+}
 
 /// notifyObjectCompiled - Provides a pointer to compiled code for Module 
M.
 virtual void notifyObjectCompiled(const llvm::Module *M, 
llvm::MemoryBufferRef Obj);
@@ -111,6 +119,7 @@ private:
 llvm::SmallString mCacheDir;
 uint32_t mCurrent

Mesa (master): swr/rast: Fix one more invalid object format for windows.

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 70f8eac603a75e6639994d5f4a727e94f870f964
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=70f8eac603a75e6639994d5f4a727e94f870f964

Author: George Kyriazis 
Date:   Fri Jan 19 15:46:56 2018 -0600

swr/rast: Fix one more invalid object format for windows.

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index 508bc027dd..40ca644121 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -178,7 +178,7 @@ void JitManager::SetupNewModule()
 #if defined(_WIN32)
 // Needed for MCJIT on windows
 Triple hostTriple(sys::getProcessTriple());
-hostTriple.setObjectFormat(Triple::ELF);
+hostTriple.setObjectFormat(Triple::COFF);
 newModule->setTargetTriple(hostTriple.getTriple());
 #endif // _WIN32
 

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


Mesa (master): swr/rast: Initial work for debugging support.

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 01ab218bbc5c8058a99077a6bc3dc9884e9d218a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=01ab218bbc5c8058a99077a6bc3dc9884e9d218a

Author: George Kyriazis 
Date:   Fri Jan 19 15:46:59 2018 -0600

swr/rast: Initial work for debugging support.

Adds ability to step into jitted llvm IR in Visual Studio.
- Updated llvm type generation script to also generate corresponding debug 
types.
- New module pass inserts debug metadata into the IR for each function

Disabled by default.

Reviewed-by: Bruce Cherniak 

---

 .../swr/rasterizer/codegen/gen_llvm_types.py   |  10 +-
 .../swr/rasterizer/codegen/templates/gen_llvm.hpp  |  12 ++
 .../drivers/swr/rasterizer/jitter/JitManager.cpp   | 157 +++--
 .../drivers/swr/rasterizer/jitter/JitManager.h |  24 
 .../drivers/swr/rasterizer/jitter/builder_misc.cpp |   2 +-
 .../drivers/swr/rasterizer/jitter/jit_pch.hpp  |   2 +-
 6 files changed, 191 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py 
b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py
index ccf2bde1ed..398cde3ed9 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py
@@ -26,7 +26,7 @@ from argparse import FileType
 
 '''
 '''
-def gen_llvm_type(type, name, is_pointer, is_pointer_pointer, is_array, 
is_array_array, array_count, array_count1, is_llvm_struct, is_llvm_enum, 
is_llvm_pfn, output_file):
+def gen_llvm_type(type, name, idx, is_pointer, is_pointer_pointer, is_array, 
is_array_array, array_count, array_count1, is_llvm_struct, is_llvm_enum, 
is_llvm_pfn, output_file):
 
 llvm_type = ''
 
@@ -94,6 +94,7 @@ def gen_llvm_type(type, name, is_pointer, is_pointer_pointer, 
is_array, is_array
 
 return {
 'name'  : name,
+'lineNum' : idx,
 'type'  : llvm_type,
 }
 
@@ -125,6 +126,7 @@ def gen_llvm_types(input_file, output_file):
 
 type_entry = {
 'name'  : struct_name,
+'lineNum'   : idx+1,
 'members'   : [],
 }
 
@@ -290,7 +292,7 @@ def gen_llvm_types(input_file, output_file):
 if type is not None:
 type_entry['members'].append(
 gen_llvm_type(
-type, name, is_pointer, 
is_pointer_pointer, is_array, is_array_array,
+type, name, idx+1, is_pointer, 
is_pointer_pointer, is_array, is_array_array,
 array_count, array_count1, is_llvm_struct, 
is_llvm_enum, is_llvm_pfn, output_file))
 
 # Detect end of structure
@@ -307,7 +309,9 @@ def gen_llvm_types(input_file, output_file):
 output_file,
 cmdline=sys.argv,
 filename=os.path.basename(output_file),
-types=types)
+types=types,
+input_dir=os.path.dirname(input_file.name),
+input_file=os.path.basename(input_file.name))
 
 '''
 Function which is invoked when this script is started from a command line.
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp 
b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp
index 574ee5aaa7..61c31328a6 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp
+++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_llvm.hpp
@@ -53,6 +53,18 @@ namespace SwrJit
 %endfor
 
 pRetType = StructType::create(members, "${type['name']}", false);
+
+// Compute debug metadata
+llvm::DIBuilder builder(*pJitMgr->mpCurrentModule);
+llvm::DIFile* pFile = builder.createFile("${input_file}", 
"${input_dir}");
+
+std::vector> dbgMembers;
+%for member in type['members']:
+dbgMembers.push_back(std::make_pair("${member['name']}", ${ 
member['lineNum'] }));
+%endfor
+
+pJitMgr->CreateDebugStructType(pRetType, "${type['name']}", pFile, 
${type['lineNum']}, dbgMembers);
+
 }
 
 return pRetType;
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index fbca1a74a7..2b993613f5 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -190,6 +190,105 @@ void JitManager::SetupNewModule()
 }
 
 
+DIType* JitManager::CreateDebugStructType(StructType* pType, const 
std::string& name, DIFile* pFile, uint32_t lineNum,
+const std::vector>& members)
+{
+DIBuilder builder(*mpCurrentModule);
+SmallVector ElemTypes;
+DataLayout DL = DataLayout(mpCurrentModule);
+uint32_t size = DL.getTypeAllocSizeInBits(pType);
+uint32_t alignment = DL.getABITypeAlignment(pType);
+   

Mesa (master): swr/rast: Debug Symbols work

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 34bbcb5052c57148a22a6a48a6538f983d62fbae
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=34bbcb5052c57148a22a6a48a6538f983d62fbae

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:00 2018 -0600

swr/rast: Debug Symbols work

Added support for Fetch / Sample / LD functions
Added DLL link to JitCache implementation

Reviewed-by: Bruce Cherniak 

---

 .../drivers/swr/rasterizer/jitter/JitManager.cpp   | 92 ++
 .../drivers/swr/rasterizer/jitter/JitManager.h |  7 +-
 .../drivers/swr/rasterizer/jitter/fetch_jit.cpp|  2 +
 .../drivers/swr/rasterizer/jitter/jit_pch.hpp  |  6 ++
 4 files changed, 88 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index 2b993613f5..a3bda616f9 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -104,7 +104,7 @@ JitManager::JitManager(uint32_t simdWidth, const char 
*arch, const char* core)
 
 if (KNOB_JIT_ENABLE_CACHE)
 {
-mCache.SetCpu(hostCPUName);
+mCache.Init(this, hostCPUName);
 mpExec->setObjectCache(&mCache);
 }
 
@@ -474,7 +474,7 @@ struct JitCacheFileHeader
 uint64_t GetBufferCRC() const { return m_objCRC; }
 
 private:
-static const uint64_t   JC_MAGIC_NUMBER = 0xfedcba9876543211ULL;
+static const uint64_t   JC_MAGIC_NUMBER = 0xfedcba9876543211ULL + 1;
 static const size_t JC_STR_MAX_LEN = 32;
 static const uint32_t   JC_PLATFORM_KEY =
 (LLVM_VERSION_MAJOR << 24)  |
@@ -522,6 +522,45 @@ JitCache::JitCache()
 }
 }
 
+#if defined(_WIN32)
+int ExecUnhookedProcess(const char* pCmdLine)
+{
+static const char *g_pEnv = "RASTY_DISABLE_HOOK=1\0";
+
+STARTUPINFOA StartupInfo{};
+StartupInfo.cb = sizeof(STARTUPINFOA);
+PROCESS_INFORMATION procInfo{};
+
+BOOL ProcessValue = CreateProcessA(
+NULL,
+(LPSTR)pCmdLine,
+NULL,
+NULL,
+TRUE,
+0,
+(LPVOID)g_pEnv,
+NULL,
+&StartupInfo,
+&procInfo);
+
+if (ProcessValue && procInfo.hProcess)
+{
+WaitForSingleObject(procInfo.hProcess, INFINITE);
+DWORD exitVal = 0;
+if (!GetExitCodeProcess(procInfo.hProcess, &exitVal))
+{
+exitVal = 1;
+}
+
+CloseHandle(procInfo.hProcess);
+
+return exitVal;
+}
+
+return -1;
+}
+#endif
+
 /// notifyObjectCompiled - Provides a pointer to compiled code for Module M.
 void JitCache::notifyObjectCompiled(const llvm::Module *M, 
llvm::MemoryBufferRef Obj)
 {
@@ -541,24 +580,28 @@ void JitCache::notifyObjectCompiled(const llvm::Module 
*M, llvm::MemoryBufferRef
 llvm::SmallString filePath = mCacheDir;
 llvm::sys::path::append(filePath, moduleID);
 
-std::error_code err;
-llvm::raw_fd_ostream fileObj(filePath.c_str(), err, llvm::sys::fs::F_None);
+{
+std::error_code err;
+llvm::raw_fd_ostream fileObj(filePath.c_str(), err, 
llvm::sys::fs::F_None);
+
+uint32_t objcrc = ComputeCRC(0, Obj.getBufferStart(), 
Obj.getBufferSize());
 
-uint32_t objcrc = ComputeCRC(0, Obj.getBufferStart(), Obj.getBufferSize());
+JitCacheFileHeader header;
+header.Init(mCurrentModuleCRC, objcrc, moduleID, mCpu, 
Obj.getBufferSize());
 
-JitCacheFileHeader header;
-header.Init(mCurrentModuleCRC, objcrc, moduleID, mCpu, 
Obj.getBufferSize());
+fileObj.write((const char*)&header, sizeof(header));
+fileObj.flush();
+}
 
-fileObj.write((const char*)&header, sizeof(header));
-fileObj << Obj.getBuffer();
-fileObj.flush();
+filePath += JIT_OBJ_EXT;
+
+{
+std::error_code err;
+llvm::raw_fd_ostream fileObj(filePath.c_str(), err, 
llvm::sys::fs::F_None);
+fileObj << Obj.getBuffer();
+fileObj.flush();
+}
 
-llvm::SmallString filePath2 = filePath;
-filePath2 += ".obj";
-
-llvm::raw_fd_ostream fileObj2(filePath2.c_str(), err, 
llvm::sys::fs::F_None);
-fileObj2 << Obj.getBuffer();
-fileObj2.flush();
 }
 
 /// Returns a pointer to a newly allocated MemoryBuffer that contains the
@@ -582,6 +625,10 @@ std::unique_ptr 
JitCache::getObject(const llvm::Module* M)
 llvm::SmallString filePath = mCacheDir;
 llvm::sys::path::append(filePath, moduleID);
 
+llvm::SmallString objFilePath = filePath;
+objFilePath += JIT_OBJ_EXT;
+
+FILE* fpObjIn = nullptr;
 FILE* fpIn = fopen(filePath.c_str(), "rb");
 if (!fpIn)
 {
@@ -602,12 +649,18 @@ std::unique_ptr 
JitCache::getObject(const llvm::Module* M)
 break;
 }
 
+fpObjIn = fopen(objFilePath.c_str(), "rb");
+if (!fpObjIn)
+{
+break;
+}
+
 #if LLVM_VERSION_MAJOR < 6
 pBuf = 
llvm::MemoryBuffer::getNewUninitMemBuffer(size_t(header.GetBu

Mesa (master): swr/rast: jit shader lib debug work

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: fe107e3c1702c23cb8e3cdf01f3aef83b2e5abcb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe107e3c1702c23cb8e3cdf01f3aef83b2e5abcb

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:07 2018 -0600

swr/rast: jit shader lib debug work

Create shader_lib during build, link with shaders at DLL generation time

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp | 5 +
 src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp  | 6 ++
 2 files changed, 11 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index 5e5bba6f70..70f31379a7 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -586,6 +586,11 @@ int ExecUnhookedProcess(const char* pCmdLine)
 }
 #endif
 
+#if defined(_WIN64) && defined(ENABLE_JIT_DEBUG) && defined(JIT_BASE_DIR)
+EXTERN_C IMAGE_DOS_HEADER __ImageBase;
+static __inline HINSTANCE GetModuleHINSTANCE() { return 
(HINSTANCE)&__ImageBase; }
+#endif
+
 /// notifyObjectCompiled - Provides a pointer to compiled code for Module M.
 void JitCache::notifyObjectCompiled(const llvm::Module *M, 
llvm::MemoryBufferRef Obj)
 {
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index 351ff0bf9c..091db2449c 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -2890,6 +2890,10 @@ bool isComponentEnabled(ComponentEnable enableMask, 
uint8_t component)
 }
 }
 
+// Don't want two threads compiling the same fetch shader simultaneously
+// Has problems in the JIT cache implementation
+// This is only a problem for fetch right now.
+static std::mutex gFetchCodegenMutex;
 
 //
 /// @brief JITs from fetch shader IR
@@ -2902,6 +2906,7 @@ PFN_FETCH_FUNC JitFetchFunc(HANDLE hJitMgr, const HANDLE 
hFunc)
 JitManager* pJitMgr = reinterpret_cast(hJitMgr);
 PFN_FETCH_FUNC pfnFetch;
 
+gFetchCodegenMutex.lock();
 pfnFetch = 
(PFN_FETCH_FUNC)(pJitMgr->mpExec->getFunctionAddress(func->getName().str()));
 // MCJIT finalizes modules the first time you JIT code from them. After 
finalized, you cannot add new IR to the module
 pJitMgr->mIsModuleFinalized = true;
@@ -2916,6 +2921,7 @@ PFN_FETCH_FUNC JitFetchFunc(HANDLE hJitMgr, const HANDLE 
hFunc)
 #endif
 
 pJitMgr->DumpAsm(const_cast(func), "final");
+gFetchCodegenMutex.unlock();
 
 
 

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


Mesa (master): swr: Support simd16 vertex shaders

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 8c83d2d3713a6de5830228c40cebc77291277d95
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c83d2d3713a6de5830228c40cebc77291277d95

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:12 2018 -0600

swr: Support simd16 vertex shaders

Supporting simd16 vertex shaders involves packing the output of the
fetch shader appropriately, especially the vertexID buffers that have to
be formatted in one simd16 register, needed by the VS.

As part of this support, we needed to remove the 2nd JitManager, since it
was not accounting for vector width correctly.

USE_SIMD16_SHADERS is also split into two defines.  The additional
one (USE_SIMD16_VS) controls the width of the vertex shader (VS), while
the original one (USE_SIMD16_SHADERS) controls overall front end width.

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/swr_screen.cpp |  6 -
 src/gallium/drivers/swr/swr_screen.h   |  3 ---
 src/gallium/drivers/swr/swr_shader.cpp | 42 --
 3 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/src/gallium/drivers/swr/swr_screen.cpp 
b/src/gallium/drivers/swr/swr_screen.cpp
index 949816aa4b..b67ac25ac8 100644
--- a/src/gallium/drivers/swr/swr_screen.cpp
+++ b/src/gallium/drivers/swr/swr_screen.cpp
@@ -1064,9 +1064,6 @@ swr_destroy_screen(struct pipe_screen *p_screen)
swr_fence_reference(p_screen, &screen->flush_fence, NULL);
 
JitDestroyContext(screen->hJitMgr);
-#if USE_SIMD16_SHADERS
-   JitDestroyContext(screen->hJitMgr16);
-#endif
 
if (winsys->destroy)
   winsys->destroy(winsys);
@@ -1150,9 +1147,6 @@ swr_create_screen_internal(struct sw_winsys *winsys)
 
// Pass in "" for architecture for run-time determination
screen->hJitMgr = JitCreateContext(KNOB_SIMD_WIDTH, "", "swr");
-#if USE_SIMD16_SHADERS
-   screen->hJitMgr16 = JitCreateContext(16, "", "swr");
-#endif
 
swr_fence_init(&screen->base);
 
diff --git a/src/gallium/drivers/swr/swr_screen.h 
b/src/gallium/drivers/swr/swr_screen.h
index 81b1a18b02..89faab182c 100644
--- a/src/gallium/drivers/swr/swr_screen.h
+++ b/src/gallium/drivers/swr/swr_screen.h
@@ -49,9 +49,6 @@ struct swr_screen {
uint32_t client_copy_limit;
 
HANDLE hJitMgr;
-#if USE_SIMD16_SHADERS
-   HANDLE hJitMgr16;
-#endif
 
PFNSwrGetInterface pfnSwrGetInterface;
 
diff --git a/src/gallium/drivers/swr/swr_shader.cpp 
b/src/gallium/drivers/swr/swr_shader.cpp
index 257a6aae30..e5fb679f8b 100644
--- a/src/gallium/drivers/swr/swr_shader.cpp
+++ b/src/gallium/drivers/swr/swr_shader.cpp
@@ -724,7 +724,7 @@ swr_compile_gs(struct swr_context *ctx, swr_jit_gs_key &key)
 void
 BuilderSWR::WriteVS(Value *pVal, Value *pVsContext, Value *pVtxOutput, 
unsigned slot, unsigned channel)
 {
-#if USE_SIMD16_FRONTEND && !USE_SIMD16_SHADERS
+#if USE_SIMD16_FRONTEND && !USE_SIMD16_VS
// interleave the simdvertex components into the dest simd16vertex
//   slot16offset = slot8offset * 2
//   comp16offset = comp8offset * 2 + alternateOffset
@@ -787,7 +787,7 @@ BuilderSWR::CompileVS(struct swr_context *ctx, 
swr_jit_vs_key &key)
const_sizes_ptr->setName("num_vs_constants");
 
Value *vtxInput = LOAD(pVsCtx, {0, SWR_VS_CONTEXT_pVin});
-#if USE_SIMD16_SHADERS
+#if USE_SIMD16_VS
vtxInput = BITCAST(vtxInput, PointerType::get(Gen_simd16vertex(JM()), 0));
 #endif
 
@@ -807,11 +807,22 @@ BuilderSWR::CompileVS(struct swr_context *ctx, 
swr_jit_vs_key &key)
struct lp_bld_tgsi_system_values system_values;
memset(&system_values, 0, sizeof(system_values));
system_values.instance_id = wrap(LOAD(pVsCtx, {0, 
SWR_VS_CONTEXT_InstanceID}));
+
+#if USE_SIMD16_VS
+   system_values.vertex_id = wrap(LOAD(pVsCtx, {0, 
SWR_VS_CONTEXT_VertexID16}));
+#else
system_values.vertex_id = wrap(LOAD(pVsCtx, {0, SWR_VS_CONTEXT_VertexID}));
+#endif
+
+#if USE_SIMD16_VS
+   uint32_t vectorWidth = mVWidth16;
+#else
+   uint32_t vectorWidth = mVWidth;
+#endif
 
lp_build_tgsi_soa(gallivm,
  swr_vs->pipe.tokens,
- lp_type_float_vec(32, 32 * mVWidth),
+ lp_type_float_vec(32, 32 * vectorWidth),
  NULL, // mask
  wrap(consts_ptr),
  wrap(const_sizes_ptr),
@@ -829,7 +840,7 @@ BuilderSWR::CompileVS(struct swr_context *ctx, 
swr_jit_vs_key &key)
IRB()->SetInsertPoint(unwrap(LLVMGetInsertBlock(gallivm->builder)));
 
Value *vtxOutput = LOAD(pVsCtx, {0, SWR_VS_CONTEXT_pVout});
-#if USE_SIMD16_SHADERS
+#if USE_SIMD16_VS
vtxOutput = BITCAST(vtxOutput, PointerType::get(Gen_simd16vertex(JM()), 0));
 #endif
 
@@ -905,10 +916,21 @@ BuilderSWR::CompileVS(struct swr_context *ctx, 
swr_jit_vs_key &key)
  Value *py = LOAD(GEP(hPrivateData, {0, 
swr_draw_context_userClipPlanes, val, 1}));
  Value *pz = LOAD(GEP(hPrivateData, {0, 
swr_draw_context_userClipPlanes, val, 2}));
  Value *pw = LOAD(GEP(hPrivateData, {0, 
swr_draw_context_userClipPlanes, val, 3})

Mesa (master): swr/rast: Jit debug work

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: f1925020010a2e8e8cab073e59cedce7533d4478
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f1925020010a2e8e8cab073e59cedce7533d4478

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:09 2018 -0600

swr/rast: Jit debug work

Properly validate DLL matches OBJ for jitted function

Reviewed-by: Bruce Cherniak 

---

 .../drivers/swr/rasterizer/jitter/JitManager.cpp   | 111 +++--
 1 file changed, 81 insertions(+), 30 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index 70f31379a7..ed4193e4a8 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -455,12 +455,16 @@ extern "C"
 //
 struct JitCacheFileHeader
 {
-void Init(uint32_t llCRC, uint32_t objCRC, const std::string& moduleID, 
const std::string& cpu, uint32_t optLevel, uint64_t bufferSize)
+void Init(
+uint32_t llCRC,
+uint32_t objCRC,
+const std::string& moduleID,
+const std::string& cpu,
+uint32_t optLevel,
+uint64_t objSize)
 {
-m_MagicNumber = JC_MAGIC_NUMBER;
-m_BufferSize = bufferSize;
+m_objSize = objSize;
 m_llCRC = llCRC;
-m_platformKey = JC_PLATFORM_KEY;
 m_objCRC = objCRC;
 strncpy(m_ModuleID, moduleID.c_str(), JC_STR_MAX_LEN - 1);
 m_ModuleID[JC_STR_MAX_LEN - 1] = 0;
@@ -469,6 +473,31 @@ struct JitCacheFileHeader
 m_optLevel = optLevel;
 }
 
+#if defined(ENABLE_JIT_DEBUG)
+void Init(
+uint32_t llCRC,
+uint32_t objCRC,
+const std::string& moduleID,
+const std::string& cpu,
+uint32_t optLevel,
+uint64_t objSize,
+uint32_t modCRC,
+uint64_t modSize)
+{
+Init(llCRC, objCRC, moduleID, cpu, optLevel, objSize);
+m_modCRC = modCRC;
+m_modSize = modSize;
+}
+
+void Init(
+uint32_t modCRC,
+uint64_t modSize)
+{
+m_modCRC = modCRC;
+m_modSize = modSize;
+}
+#endif
+
 bool IsValid(uint32_t llCRC, const std::string& moduleID, const 
std::string& cpu, uint32_t optLevel)
 {
 if ((m_MagicNumber != JC_MAGIC_NUMBER) ||
@@ -494,8 +523,12 @@ struct JitCacheFileHeader
 return true;
 }
 
-uint64_t GetBufferSize() const { return m_BufferSize; }
-uint64_t GetBufferCRC() const { return m_objCRC; }
+uint64_t GetObjectSize() const { return m_objSize; }
+uint64_t GetObjectCRC() const { return m_objCRC; }
+#if defined(ENABLE_JIT_DEBUG)
+uint64_t GetSharedModuleSize() const { return m_modSize; }
+uint64_t GetSharedModuleCRC() const { return m_modCRC; }
+#endif
 
 private:
 static const uint64_t   JC_MAGIC_NUMBER = 0xfedcba9876543211ULL + 2;
@@ -506,14 +539,18 @@ private:
 (LLVM_VERSION_PATCH << 8)   |
 ((sizeof(void*) > sizeof(uint32_t)) ? 1 : 0);
 
-uint64_t m_MagicNumber;
-uint64_t m_BufferSize;
-uint32_t m_llCRC;
-uint32_t m_platformKey;
-uint32_t m_objCRC;
-uint32_t m_optLevel;
-char m_ModuleID[JC_STR_MAX_LEN];
-char m_Cpu[JC_STR_MAX_LEN];
+uint64_t m_MagicNumber = JC_MAGIC_NUMBER;
+uint64_t m_objSize = 0;
+uint32_t m_llCRC = 0;
+uint32_t m_platformKey = JC_PLATFORM_KEY;
+uint32_t m_objCRC = 0;
+uint32_t m_optLevel = 0;
+char m_ModuleID[JC_STR_MAX_LEN] = {};
+char m_Cpu[JC_STR_MAX_LEN] = {};
+#if defined(ENABLE_JIT_DEBUG)
+uint32_t m_modCRC = 0;
+uint64_t m_modSize = 0;
+#endif
 };
 
 static inline uint32_t ComputeModuleCRC(const llvm::Module* M)
@@ -607,31 +644,33 @@ void JitCache::notifyObjectCompiled(const llvm::Module 
*M, llvm::MemoryBufferRef
 return;
 }
 
+JitCacheFileHeader header;
+
 llvm::SmallString filePath = mCacheDir;
 llvm::sys::path::append(filePath, moduleID);
 
+llvm::SmallString objPath = filePath;
+objPath += JIT_OBJ_EXT;
+
 {
 std::error_code err;
-llvm::raw_fd_ostream fileObj(filePath.c_str(), err, 
llvm::sys::fs::F_None);
-
-uint32_t objcrc = ComputeCRC(0, Obj.getBufferStart(), 
Obj.getBufferSize());
-
-JitCacheFileHeader header;
-header.Init(mCurrentModuleCRC, objcrc, moduleID, mCpu, mOptLevel, 
Obj.getBufferSize());
-
-fileObj.write((const char*)&header, sizeof(header));
+llvm::raw_fd_ostream fileObj(objPath.c_str(), err, 
llvm::sys::fs::F_None);
+fileObj << Obj.getBuffer();
 fileObj.flush();
 }
 
-filePath += JIT_OBJ_EXT;
 
 {
 std::error_code err;
 llvm::raw_fd_ostream fileObj(filePath.c_str(), err, 
llvm::sys::fs::F_None);
-fileObj << Obj.getBuffer();
+
+uint32_t objcrc = ComputeCRC(0, Obj.getBufferStart(), 
Obj.getBufferSize());
+
+header.Init(mCurrentModuleCRC, obj

Mesa (master): swr/rast: x86 autogenerated macro work

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 3140e714d290aa29ccdd39b74a7a9658f1dfe05b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3140e714d290aa29ccdd39b74a7a9658f1dfe05b

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:05 2018 -0600

swr/rast: x86 autogenerated macro work

Add name argument to x86 autogenerated macros.
Add useful variable names for DCL_inputVec implementation.

Reviewed-by: Bruce Cherniak 

---

 .../swr/rasterizer/codegen/gen_llvm_ir_macros.py|  2 +-
 .../swr/rasterizer/codegen/templates/gen_builder.hpp|  2 +-
 .../drivers/swr/rasterizer/jitter/builder_misc.cpp  | 17 +
 .../drivers/swr/rasterizer/jitter/builder_misc.h|  8 
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py 
b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
index 9544353eb9..3b19cb4e80 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
@@ -223,7 +223,7 @@ def generate_x86_h(output_dir):
 declargs = 'Value* ' + ', Value* '.join(inst[2])
 
 functions.append({
-'decl'  : 'Value* %s(%s)' % (inst[0], declargs),
+'decl'  : 'Value* %s(%s, const llvm::Twine& name = "")' % 
(inst[0], declargs),
 'args'  : ', '.join(inst[2]),
 'intrin': inst[1],
 })
diff --git 
a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp 
b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp
index 2e957581ac..b6cf03e92f 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp
+++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp
@@ -41,7 +41,7 @@ ${func['decl']}
 {
 %if isX86:
 Function *pFunc = Intrinsic::getDeclaration(JM()->mpCurrentModule, 
Intrinsic::${func['intrin']});
-return CALL(pFunc, std::initializer_list{${func['args']}});
+return CALL(pFunc, std::initializer_list{${func['args']}}, name);
 %else:
 return IRB()->${func['intrin']}(${func['args']});
 %endif
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
index af9c0e5802..f70c8dbad9 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
@@ -267,7 +267,7 @@ namespace SwrJit
 return UndefValue::get(VectorType::get(ty, size));
 }
 
-Value *Builder::VBROADCAST(Value *src)
+Value *Builder::VBROADCAST(Value *src, const llvm::Twine& name)
 {
 // check if src is already a vector
 if (src->getType()->isVectorTy())
@@ -275,7 +275,7 @@ namespace SwrJit
 return src;
 }
 
-return VECTOR_SPLAT(mVWidth, src);
+return VECTOR_SPLAT(mVWidth, src, name);
 }
 
 Value *Builder::VBROADCAST_16(Value *src)
@@ -367,12 +367,12 @@ namespace SwrJit
 return STORE(val, GEPA(basePtr, valIndices));
 }
 
-CallInst *Builder::CALL(Value *Callee, const std::initializer_list 
&argsList)
+CallInst *Builder::CALL(Value *Callee, const std::initializer_list 
&argsList, const llvm::Twine& name)
 {
 std::vector args;
 for (auto arg : argsList)
 args.push_back(arg);
-return CALLA(Callee, args);
+return CALLA(Callee, args, name);
 }
 
 CallInst *Builder::CALL(Value *Callee, Value* arg)
@@ -406,9 +406,9 @@ namespace SwrJit
 return CALL(func);
 }
 
-Value *Builder::VRCP(Value *va)
+Value *Builder::VRCP(Value *va, const llvm::Twine& name)
 {
-return FDIV(VIMMED1(1.0f), va);  // 1 / a
+return FDIV(VIMMED1(1.0f), va, name);  // 1 / a
 }
 
 Value *Builder::VPLANEPS(Value* vA, Value* vB, Value* vC, Value* &vX, 
Value* &vY)
@@ -990,11 +990,11 @@ namespace SwrJit
 /// @brief Generate a VCVTPH2PS operation (float16->float32 conversion)
 /// in LLVM IR.  If not supported on the underlying platform, emulate it
 /// @param a - 128bit SIMD lane(8x16bit) of float16 in int16 format.
-Value *Builder::CVTPH2PS(Value* a)
+Value *Builder::CVTPH2PS(Value* a, const llvm::Twine& name)
 {
 if (JM()->mArch.F16C())
 {
-return VCVTPH2PS(a);
+return VCVTPH2PS(a, name);
 }
 else
 {
@@ -1014,6 +1014,7 @@ namespace SwrJit
 pResult = VINSERT(pResult, pConv, C(i));
 }
 
+pResult->setName(name);
 return pResult;
 }
 }
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h 
b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
index 7eb65f3688..609e0b2b56 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
@@ -81,10 +81,10 @@ Value 

Mesa (master): swr/rast: Add private state parameter in fetcher

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 4660e131527d2aff879d5b5bda7cf3e9635e796b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4660e131527d2aff879d5b5bda7cf3e9635e796b

Author: George Kyriazis 
Date:   Fri Jan 19 15:46:58 2018 -0600

swr/rast: Add private state parameter in fetcher

Reviewed-by: Bruce Cherniak 

---

 .../drivers/swr/rasterizer/core/frontend.cpp   |  8 ++---
 src/gallium/drivers/swr/rasterizer/core/state.h|  4 +--
 .../drivers/swr/rasterizer/jitter/JitManager.cpp   |  3 ++
 .../drivers/swr/rasterizer/jitter/fetch_jit.cpp| 39 +-
 .../drivers/swr/rasterizer/jitter/fetch_jit.h  | 16 -
 5 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp 
b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
index ed8ce151c3..727b7105cd 100644
--- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
@@ -1720,13 +1720,13 @@ void ProcessDraw(
 // 1. Execute FS/VS for a single SIMD.
 AR_BEGIN(FEFetchShader, pDC->drawId);
 #if USE_SIMD16_SHADERS
-state.pfnFetchFunc(fetchInfo_lo, vin);
+state.pfnFetchFunc(GetPrivateState(pDC), fetchInfo_lo, vin);
 #else
-state.pfnFetchFunc(fetchInfo_lo, vin_lo);
+state.pfnFetchFunc(GetPrivateState(pDC), fetchInfo_lo, vin_lo);
 
 if ((i + KNOB_SIMD_WIDTH) < endVertex)  // 1/2 of 
KNOB_SIMD16_WIDTH
 {
-state.pfnFetchFunc(fetchInfo_hi, vin_hi);
+state.pfnFetchFunc(GetPrivateState(pDC), fetchInfo_hi, 
vin_hi);
 }
 #endif
 AR_END(FEFetchShader, 0);
@@ -1968,7 +1968,7 @@ void ProcessDraw(
 
 // 1. Execute FS/VS for a single SIMD.
 AR_BEGIN(FEFetchShader, pDC->drawId);
-state.pfnFetchFunc(fetchInfo, vout);
+state.pfnFetchFunc(GetPrivateState(pDC), fetchInfo, vout);
 AR_END(FEFetchShader, 0);
 
 // forward fetch generated vertex IDs to the vertex shader
diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h 
b/src/gallium/drivers/swr/rasterizer/core/state.h
index d11ffc69b0..c93c37b468 100644
--- a/src/gallium/drivers/swr/rasterizer/core/state.h
+++ b/src/gallium/drivers/swr/rasterizer/core/state.h
@@ -873,9 +873,9 @@ static_assert(sizeof(SWR_BLEND_STATE) == 36, "Invalid 
SWR_BLEND_STATE size");
 /// FUNCTION POINTERS FOR SHADERS
 
 #if USE_SIMD16_SHADERS
-typedef void(__cdecl *PFN_FETCH_FUNC)(SWR_FETCH_CONTEXT& fetchInfo, 
simd16vertex& out);
+typedef void(__cdecl *PFN_FETCH_FUNC)(HANDLE hPrivateData, SWR_FETCH_CONTEXT& 
fetchInfo, simd16vertex& out);
 #else
-typedef void(__cdecl *PFN_FETCH_FUNC)(SWR_FETCH_CONTEXT& fetchInfo, 
simdvertex& out);
+typedef void(__cdecl *PFN_FETCH_FUNC)(HANDLE hPrivateData, SWR_FETCH_CONTEXT& 
fetchInfo, simdvertex& out);
 #endif
 typedef void(__cdecl *PFN_VERTEX_FUNC)(HANDLE hPrivateData, SWR_VS_CONTEXT* 
pVsContext);
 typedef void(__cdecl *PFN_HS_FUNC)(HANDLE hPrivateData, SWR_HS_CONTEXT* 
pHsContext);
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index 40ca644121..fbca1a74a7 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -125,6 +125,9 @@ JitManager::JitManager(uint32_t simdWidth, const char 
*arch, const char* core)
 // typedef void(__cdecl *PFN_FETCH_FUNC)(SWR_FETCH_CONTEXT& fetchInfo, 
simdvertex& out);
 #endif
 std::vector fsArgs;
+
+fsArgs.push_back(PointerType::get(Type::getVoidTy(mContext), 0));
+
 fsArgs.push_back(PointerType::get(Gen_SWR_FETCH_CONTEXT(this), 0));
 #if USE_SIMD16_SHADERS
 fsArgs.push_back(PointerType::get(Gen_simd16vertex(this), 0));
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index ad70cbe95d..d835f2d029 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -127,6 +127,7 @@ struct FetchJit : public Builder
 void CreateGatherOddFormats(SWR_FORMAT format, Value* pMask, Value* pBase, 
Value* offsets, Value* result[4]);
 void ConvertFormat(SWR_FORMAT format, Value *texels[4]);
 
+Value* mpPrivateContext;
 Value* mpFetchInfo;
 };
 
@@ -145,6 +146,9 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& 
fetchState)
 autoargitr = fetch->arg_begin();
 
 // Fetch shader arguments
+mpPrivateContext = &*argitr; ++argitr;
+mpPrivateContext->setName("privateContext");
+
 mpFetchInfo = &*argitr; ++argitr;
 mpFetchInfo->setName("fetchInfo");
 Value*pVtxOut = &*argitr;
@@ -2806,8 +2810,10 @@ Value *FetchJit::GenerateCompCtrlVector16(const 
ComponentControl ctrl)

Mesa (master): swr/rast: Enable simd16 vertex shaders

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: be3cd7add187ef9059baaf7f8c2ba05307c9c7dd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=be3cd7add187ef9059baaf7f8c2ba05307c9c7dd

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:13 2018 -0600

swr/rast: Enable simd16 vertex shaders

Flip the switch(es) to enable simd16 vertex shaders:

USE_SIMD16_SHADERS and USE_SIMD16_VS

Both have to be enabled at the same time.  Currently, just setting
USE_SIMD16_SHADERS does not work correctly.

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/core/knobs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/knobs.h 
b/src/gallium/drivers/swr/rasterizer/core/knobs.h
index b6ab382a56..657c2eed76 100644
--- a/src/gallium/drivers/swr/rasterizer/core/knobs.h
+++ b/src/gallium/drivers/swr/rasterizer/core/knobs.h
@@ -41,8 +41,8 @@
 #define ENABLE_AVX512_SIMD161
 #define USE_8x2_TILE_BACKEND1
 #define USE_SIMD16_FRONTEND 1
-#define USE_SIMD16_SHADERS  0   // requires USE_SIMD16_FRONTEND
-#define USE_SIMD16_VS   0   // requires USE_SIMD16_SHADERS
+#define USE_SIMD16_SHADERS  1   // requires USE_SIMD16_FRONTEND
+#define USE_SIMD16_VS   1   // requires USE_SIMD16_SHADERS
 
 ///
 // Architecture validation

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


Mesa (master): swr/rast: Implement Early Rasterization optimization

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: bacfbe5a32d3a0d0c7131020fb100905a89f84ce
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bacfbe5a32d3a0d0c7131020fb100905a89f84ce

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:14 2018 -0600

swr/rast: Implement Early Rasterization optimization

Early Rasterization is an optimization for small triangles.

Scientific workloads often contain very small triangles that has non-zero
area and cannot be trivially rejected as falling between pixel centers,
but does not cover any pixel center. Those triangles can be initially
rasterized as early as in binner and rejected if they cover no pixels The
optimization can be disabled in compilation using KNOB_ENABLE_EARLY_RAST
option in knobs.h

The Early Rast is disabled by default.

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/core/binner.cpp | 374 +
 src/gallium/drivers/swr/rasterizer/core/knobs.h|  10 +
 .../drivers/swr/rasterizer/core/rdtsc_core.cpp |   2 +
 .../drivers/swr/rasterizer/core/rdtsc_core.h   |   2 +
 4 files changed, 388 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp 
b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
index 9aa9f9e79b..e2f32641f3 100644
--- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
@@ -292,6 +292,341 @@ void TransposeVertices(simd4scalar(&dst)[16], const 
simd16scalar &src0, const si
 vTranspose4x16(reinterpret_cast(dst), src0, src1, 
src2, _simd16_setzero_ps());
 }
 
+
+#if KNOB_ENABLE_EARLY_RAST
+
+#define ER_SIMD_TILE_X_DIM (1 << ER_SIMD_TILE_X_SHIFT)
+#define ER_SIMD_TILE_Y_DIM (1 << ER_SIMD_TILE_Y_SHIFT)
+
+
+template
+struct EarlyRastHelper
+{
+};
+
+template<>
+struct EarlyRastHelper
+{
+static SIMD256::Integer InitShiftCntrl()
+{
+return SIMD256::set_epi32(24, 25, 26, 27, 28, 29, 30, 31);
+}
+};
+
+#if USE_SIMD16_FRONTEND
+template<>
+struct EarlyRastHelper
+{
+static SIMD512::Integer InitShiftCntrl()
+{
+return SIMD512::set_epi32(16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 
27, 28, 29, 30, 31);
+}
+};
+
+#endif
+//
+/// @brief Early Rasterizer (ER); triangles that fit small (e.g. 4x4) tile
+///(ER tile) can be rasterized as early as in binner to check if
+///they cover any  pixels. If not - the triangles can be
+///culled in binner.
+///
+/// @param er_bbox - coordinates of ER tile for each triangle
+/// @param vAi - A coefficients of triangle edges
+/// @param vBi - B coefficients of triangle edges
+/// @param vXi - X coordinates of triangle vertices
+/// @param vYi - Y coordinates of triangle vertices
+/// @param frontWindingTris - mask indicating CCW/CW triangles
+/// @param triMask - mask for valid SIMD lanes (triangles)
+/// @param oneTileMask - defines triangles for ER to work on
+///  (tris that fit into ER tile)
+template 
+uint32_t SIMDCALL EarlyRasterizer(
+SIMDBBOX_T &er_bbox,
+typename SIMD_T::Integer (&vAi)[3],
+typename SIMD_T::Integer (&vBi)[3],
+typename SIMD_T::Integer (&vXi)[3],
+typename SIMD_T::Integer (&vYi)[3],
+uint32_t cwTrisMask,
+uint32_t triMask,
+uint32_t oneTileMask)
+{
+// step to pixel center of top-left pixel of the triangle bbox
+typename SIMD_T::Integer vTopLeftX = SIMD_T::template 
slli_epi32(er_bbox.xmin);
+vTopLeftX = SIMD_T::add_epi32(vTopLeftX, 
SIMD_T::set1_epi32(FIXED_POINT_SCALE / 2));
+
+typename SIMD_T::Integer vTopLeftY = SIMD_T::template 
slli_epi32(er_bbox.ymin);
+vTopLeftY = SIMD_T::add_epi32(vTopLeftY, 
SIMD_T::set1_epi32(FIXED_POINT_SCALE / 2));
+
+// negate A and B for CW tris
+typename SIMD_T::Integer vNegA0 = SIMD_T::mullo_epi32(vAi[0], 
SIMD_T::set1_epi32(-1));
+typename SIMD_T::Integer vNegA1 = SIMD_T::mullo_epi32(vAi[1], 
SIMD_T::set1_epi32(-1));
+typename SIMD_T::Integer vNegA2 = SIMD_T::mullo_epi32(vAi[2], 
SIMD_T::set1_epi32(-1));
+typename SIMD_T::Integer vNegB0 = SIMD_T::mullo_epi32(vBi[0], 
SIMD_T::set1_epi32(-1));
+typename SIMD_T::Integer vNegB1 = SIMD_T::mullo_epi32(vBi[1], 
SIMD_T::set1_epi32(-1));
+typename SIMD_T::Integer vNegB2 = SIMD_T::mullo_epi32(vBi[2], 
SIMD_T::set1_epi32(-1));
+
+RDTSC_EVENT(FEEarlyRastEnter, _mm_popcnt_u32(oneTileMask & triMask), 0);
+
+typename SIMD_T::Integer vShiftCntrl = EarlyRastHelper 
::InitShiftCntrl();
+typename SIMD_T::Integer vCwTris = SIMD_T::set1_epi32(cwTrisMask);
+typename SIMD_T::Integer vMask = SIMD_T::sllv_epi32(vCwTris, vShiftCntrl);
+
+vAi[0] = SIMD_T::castps_si(SIMD_T::blendv_ps(SIMD_T::castsi_ps(vAi[0]), 
SIMD_T::castsi_ps(vNegA0), SIMD_T::castsi_ps(vMask)));
+vAi[1] = SIMD_T::castps_si(SIMD_T::blendv_ps(SIMD_T::castsi_ps(vAi[1]), 
SIMD_T::castsi_ps(vNegA1), SIMD_T::castsi_ps(vMask)));
+vAi[2] = SIMD_T::castps_si(SI

Mesa (master): swr/rast: Add debugging type support for function types.

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: c4a42f5add66f43747f2f86aa06f7b80b6ba1edc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c4a42f5add66f43747f2f86aa06f7b80b6ba1edc

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:02 2018 -0600

swr/rast: Add debugging type support for function types.

Reviewed-by: Bruce Cherniak 

---

 .../drivers/swr/rasterizer/jitter/JitManager.cpp | 20 
 .../drivers/swr/rasterizer/jitter/JitManager.h   |  1 +
 2 files changed, 21 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index a3bda616f9..b0f9d2f645 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -254,11 +254,31 @@ DIType* JitManager::GetDebugType(Type* pTy)
 case Type::ArrayTyID: return GetDebugArrayType(pTy); break;
 case Type::PointerTyID: return 
builder.createPointerType(GetDebugType(pTy->getPointerElementType()), 64, 64); 
break;
 case Type::VectorTyID: return GetDebugVectorType(pTy); break;
+case Type::FunctionTyID: return GetDebugFunctionType(pTy); break;
 default: SWR_ASSERT(false, "Unimplemented llvm type");
 }
 return nullptr;
 }
 
+// Create a DISubroutineType from an llvm FunctionType
+DIType* JitManager::GetDebugFunctionType(Type* pTy)
+{
+SmallVector ElemTypes;
+FunctionType* pFuncTy = cast(pTy);
+DIBuilder builder(*mpCurrentModule);
+
+// Add result type
+ElemTypes.push_back(GetDebugType(pFuncTy->getReturnType()));
+
+// Add arguments
+for (auto& param : pFuncTy->params())
+{
+ElemTypes.push_back(GetDebugType(param));
+}
+
+return 
builder.createSubroutineType(builder.getOrCreateTypeArray(ElemTypes));
+}
+
 DIType* JitManager::GetDebugIntegerType(Type* pTy)
 {
 DIBuilder builder(*mpCurrentModule);
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
index fb20a36625..50b9d82904 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
@@ -175,6 +175,7 @@ struct JitManager
 llvm::DIType* GetDebugIntegerType(llvm::Type* pTy);
 llvm::DIType* GetDebugArrayType(llvm::Type* pTy);
 llvm::DIType* GetDebugVectorType(llvm::Type* pTy);
+llvm::DIType* GetDebugFunctionType(llvm::Type* pTy);
 
 llvm::DIType* GetDebugStructType(llvm::Type* pType)
 {

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


Mesa (master): swr/rast: Enable early rasterization

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: d335b32baf14d6515e4ad204cf5bc9564fecedf5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d335b32baf14d6515e4ad204cf5bc9564fecedf5

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:15 2018 -0600

swr/rast: Enable early rasterization

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/core/knobs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/knobs.h 
b/src/gallium/drivers/swr/rasterizer/core/knobs.h
index 23a2876fb8..d88a3aac97 100644
--- a/src/gallium/drivers/swr/rasterizer/core/knobs.h
+++ b/src/gallium/drivers/swr/rasterizer/core/knobs.h
@@ -167,7 +167,7 @@
 
 // enables early rasterization (useful for small triangles)
 #if !defined(KNOB_ENABLE_EARLY_RAST)
-#define KNOB_ENABLE_EARLY_RAST 0
+#define KNOB_ENABLE_EARLY_RAST 1
 #endif
 
 #if KNOB_ENABLE_EARLY_RAST

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


Mesa (master): swr/rast: AVX-512 changes to enable 16-wide VS

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 0cd9ad98a3364f9be04964069ec602bb0ba3119d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0cd9ad98a3364f9be04964069ec602bb0ba3119d

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:06 2018 -0600

swr/rast: AVX-512 changes to enable 16-wide VS

Add a new define (USE_SIMD16_VS), to denote calling a 16-wide vertex shader.
This is needed because the mesa driver can do 16-wide shaders, but rasty
cannot yet, so we need to distinguish.

Create a new VertexID entry (VertexID16) for the USE_SIMD16_VS case, since
we need to format the vertex id in a way that is digestible by the 16-wide VS

Disabled for now.  To be enabled in a future checkin when driver work
is complete.

Reviewed-by: Bruce Cherniak 

---

 .../swr/rasterizer/codegen/gen_llvm_types.py   |  4 
 .../drivers/swr/rasterizer/core/frontend.cpp   | 28 +++---
 src/gallium/drivers/swr/rasterizer/core/knobs.h|  1 +
 src/gallium/drivers/swr/rasterizer/core/state.h|  4 
 4 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py 
b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py
index 398cde3ed9..a127976fd2 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_types.py
@@ -60,6 +60,10 @@ def gen_llvm_type(type, name, idx, is_pointer, 
is_pointer_pointer, is_array, is_
 llvm_type = 'VectorType::get(Type::getFloatTy(ctx), 
pJitMgr->mVWidth)'
 elif type == 'simdscalari':
 llvm_type = 'VectorType::get(Type::getInt32Ty(ctx), 
pJitMgr->mVWidth)'
+elif type == 'simd16scalar':
+llvm_type = 'VectorType::get(Type::getFloatTy(ctx), 16)'
+elif type == 'simd16scalari':
+llvm_type = 'VectorType::get(Type::getInt32Ty(ctx), 16)'
 elif type == '__m128i':
 llvm_type = 'VectorType::get(Type::getInt32Ty(ctx), 4)'
 elif type == 'SIMD256::Float':
diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp 
b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
index 727b7105cd..9600f7851a 100644
--- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
@@ -485,6 +485,13 @@ static INLINE simdscalari GenerateMask(uint32_t 
numItemsRemaining)
 return _simd_castps_si(_simd_vmask_ps(mask));
 }
 
+static INLINE simd16scalari GenerateMask16(uint32_t numItemsRemaining)
+{
+uint32_t numActive = (numItemsRemaining >= KNOB_SIMD16_WIDTH) ? 
KNOB_SIMD16_WIDTH : numItemsRemaining;
+uint32_t mask = (numActive > 0) ? ((1 << numActive) - 1) : 0;
+return _simd16_castps_si(_simd16_vmask_ps(mask));
+}
+
 //
 /// @brief StreamOut - Streams vertex data out to SO buffers.
 ///Generally, we are only streaming out a SIMDs worth of triangles.
@@ -1733,9 +1740,11 @@ void ProcessDraw(
 
 // forward fetch generated vertex IDs to the vertex shader
 #if USE_SIMD16_SHADERS
-#if 0
-vsContext_lo.VertexID = _simd16_extract(fetchInfo_lo.VertexID, 
0);
-vsContext_hi.VertexID = _simd16_extract(fetchInfo_lo.VertexID, 
1);
+#if USE_SIMD16_VS
+vsContext_lo.VertexID16 = _simd16_insert_si(
+vsContext_lo.VertexID16, fetchInfo_lo.VertexID, 0);
+vsContext_lo.VertexID16 = _simd16_insert_si(
+vsContext_lo.VertexID16, fetchInfo_lo.VertexID2, 1);
 #else
 vsContext_lo.VertexID = fetchInfo_lo.VertexID;
 vsContext_hi.VertexID = fetchInfo_lo.VertexID2;
@@ -1746,20 +1755,19 @@ void ProcessDraw(
 #endif
 
 // Setup active mask for vertex shader.
+#if USE_SIMD16_VS
+vsContext_lo.mask16 = GenerateMask16(endVertex - i);
+#else
 vsContext_lo.mask = GenerateMask(endVertex - i);
 vsContext_hi.mask = GenerateMask(endVertex - (i + 
KNOB_SIMD_WIDTH));
+#endif
 
 // forward cut mask to the PA
 if (IsIndexedT::value)
 {
 #if USE_SIMD16_SHADERS
-#if 0
-*pvCutIndices_lo = 
_simd_movemask_ps(_simd_castsi_ps(_simd16_extract(fetchInfo_lo.CutMask, 0)));
-*pvCutIndices_hi = 
_simd_movemask_ps(_simd_castsi_ps(_simd16_extract(fetchInfo_lo.CutMask, 1)));
-#else
 *pvCutIndices_lo = 
_simd_movemask_ps(_simd_castsi_ps(fetchInfo_lo.CutMask));
 *pvCutIndices_hi = 
_simd_movemask_ps(_simd_castsi_ps(fetchInfo_lo.CutMask2));
-#endif
 #else
 *pvCutIndices_lo = 
_simd_movemask_ps(_simd_castsi_ps(fetchInfo_lo.CutMask));
 *pvCutIndices_hi = 
_simd_movemask_ps(_simd_castsi_ps(fetchInfo_hi.CutMask));
@@ -1773,12 +1781,16 @@ void ProcessDraw(
 #endif
 {
 AR_BEGIN(F

Mesa (master): swr/rast: changed jit debug magic number

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 1874d95a8e820bbae37008c66cdc891ce4922722
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1874d95a8e820bbae37008c66cdc891ce4922722

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:11 2018 -0600

swr/rast: changed jit debug magic number

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index ed4193e4a8..a9a416a7de 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -531,7 +531,7 @@ struct JitCacheFileHeader
 #endif
 
 private:
-static const uint64_t   JC_MAGIC_NUMBER = 0xfedcba9876543211ULL + 2;
+static const uint64_t   JC_MAGIC_NUMBER = 0xfedcba9876543211ULL + 3;
 static const size_t JC_STR_MAX_LEN = 32;
 static const uint32_t   JC_PLATFORM_KEY =
 (LLVM_VERSION_MAJOR << 24)  |

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


Mesa (master): swr/rast: Shader debugging work

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: e9e7f3ce0a757184ff224a94f61a72c71e78d7f9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e9e7f3ce0a757184ff224a94f61a72c71e78d7f9

Author: George Kyriazis 
Date:   Fri Jan 19 15:47:01 2018 -0600

swr/rast: Shader debugging work

- Move debug .ll files to JIT_CACHE_DIR
- Don't link against jitter SRGBLut table, add global data to shader that needs 
it.

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h 
b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
index 16ff693c6e..7eb65f3688 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
@@ -49,6 +49,12 @@ Constant *C(const std::initializer_list &constList)
 return ConstantVector::get(vConsts);
 }
 
+template
+Constant *CA(LLVMContext& ctx, ArrayRef constList)
+{
+return ConstantDataArray::get(ctx, constList);
+}
+
 Constant *PRED(bool pred);
 
 Value *VIMMED1(int i);

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


Mesa (master): swr/rast: Fix llvm5 behavior

2018-01-19 Thread George Kyriazis
Module: Mesa
Branch: master
Commit: 9d80ed0862154dba17fd558dd16b62e6bf43515f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d80ed0862154dba17fd558dd16b62e6bf43515f

Author: George Kyriazis 
Date:   Fri Jan 19 16:46:56 2018 -0600

swr/rast: Fix llvm5 behavior

For some reason llvm5 is picky about accepting a void * type in the
case of building an argument list.

Since we don't care about the type (we ignore the argument for now),
pick another pointer type

Reviewed-by: Bruce Cherniak 

---

 src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp 
b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
index a9a416a7de..93e3240612 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp
@@ -128,7 +128,8 @@ JitManager::JitManager(uint32_t simdWidth, const char 
*arch, const char* core)
 #endif
 std::vector fsArgs;
 
-fsArgs.push_back(PointerType::get(Type::getVoidTy(mContext), 0));
+// llvm5 is picky and does not take a void * type
+fsArgs.push_back(PointerType::get(Gen_SWR_FETCH_CONTEXT(this), 0));
 
 fsArgs.push_back(PointerType::get(Gen_SWR_FETCH_CONTEXT(this), 0));
 #if USE_SIMD16_SHADERS

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


Mesa (master): autotools: include meson build files in tarball

2018-01-19 Thread Dylan Baker
Module: Mesa
Branch: master
Commit: 436ed65d38d4ed8b2a7b40fb2adeb15fb0d3989f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=436ed65d38d4ed8b2a7b40fb2adeb15fb0d3989f

Author: Dylan Baker 
Date:   Wed Jan 17 14:13:11 2018 -0800

autotools: include meson build files in tarball

This adds the meson.build, meson_options.txt, and a few scripts that are
used exclusively by the meson build.

v2: - Remove accidentally included changes needed to test make dist with
  LLVM > 3.9

Signed-off-by: Dylan Baker 
Acked-by: Eric Engestrom 
Reviewed-by: Emil Velikov 

---

 Makefile.am |  7 ++-
 src/Makefile.am |  2 +-
 src/amd/Makefile.am |  9 -
 src/amd/vulkan/Makefile.am  |  3 ++-
 src/broadcom/Makefile.am|  7 ++-
 src/compiler/Makefile.am|  9 -
 src/egl/Makefile.am |  3 ++-
 src/egl/wayland/wayland-drm/Makefile.am |  2 +-
 src/egl/wayland/wayland-egl/Makefile.am |  2 +-
 src/gallium/Makefile.am |  3 ++-
 src/gallium/auxiliary/Makefile.am   |  3 ++-
 src/gallium/auxiliary/pipe-loader/Makefile.am   |  2 +-
 src/gallium/drivers/ddebug/Makefile.am  |  2 ++
 src/gallium/drivers/etnaviv/Makefile.am |  2 ++
 src/gallium/drivers/freedreno/Makefile.am   |  2 ++
 src/gallium/drivers/i915/Makefile.am|  2 +-
 src/gallium/drivers/llvmpipe/Makefile.am|  2 +-
 src/gallium/drivers/noop/Makefile.am|  2 +-
 src/gallium/drivers/nouveau/Makefile.am |  2 +-
 src/gallium/drivers/r300/Makefile.am|  3 ++-
 src/gallium/drivers/r600/Makefile.am|  3 ++-
 src/gallium/drivers/radeon/Makefile.am  |  2 ++
 src/gallium/drivers/radeonsi/Makefile.am|  1 +
 src/gallium/drivers/rbug/Makefile.am|  2 +-
 src/gallium/drivers/softpipe/Makefile.am|  2 +-
 src/gallium/drivers/svga/Makefile.am|  3 ++-
 src/gallium/drivers/swr/Makefile.am |  2 ++
 src/gallium/drivers/trace/Makefile.am   |  3 ++-
 src/gallium/drivers/vc4/Makefile.am |  2 +-
 src/gallium/drivers/vc5/Makefile.am |  2 ++
 src/gallium/drivers/virgl/Makefile.am   |  2 ++
 src/gallium/state_trackers/clover/Makefile.am   |  2 +-
 src/gallium/state_trackers/dri/Makefile.am  |  2 +-
 src/gallium/state_trackers/glx/xlib/Makefile.am |  2 +-
 src/gallium/state_trackers/nine/Makefile.am |  2 +-
 src/gallium/state_trackers/omx_bellagio/Makefile.am |  2 ++
 src/gallium/state_trackers/osmesa/Makefile.am   |  2 +-
 src/gallium/state_trackers/va/Makefile.am   |  2 ++
 src/gallium/state_trackers/vdpau/Makefile.am|  2 ++
 src/gallium/state_trackers/xa/Makefile.am   |  2 +-
 src/gallium/state_trackers/xvmc/Makefile.am |  2 ++
 src/gallium/targets/d3dadapter9/Makefile.am |  2 +-
 src/gallium/targets/dri/Makefile.am |  1 +
 src/gallium/targets/libgl-xlib/Makefile.am  |  2 +-
 src/gallium/targets/omx-bellagio/Makefile.am|  2 +-
 src/gallium/targets/opencl/Makefile.am  |  2 +-
 src/gallium/targets/osmesa/Makefile.am  |  3 ++-
 src/gallium/targets/pipe-loader/Makefile.am |  2 +-
 src/gallium/targets/va/Makefile.am  |  2 +-
 src/gallium/targets/vdpau/Makefile.am   |  3 ++-
 src/gallium/targets/xa/Makefile.am  |  2 +-
 src/gallium/targets/xvmc/Makefile.am|  2 +-
 src/gallium/winsys/amdgpu/drm/Makefile.am   |  2 ++
 src/gallium/winsys/etnaviv/drm/Makefile.am  |  2 ++
 src/gallium/winsys/freedreno/drm/Makefile.am|  2 ++
 src/gallium/winsys/i915/drm/Makefile.am |  2 ++
 src/gallium/winsys/imx/drm/Makefile.am  |  2 ++
 src/gallium/winsys/nouveau/drm/Makefile.am  |  2 ++
 src/gallium/winsys/pl111/drm/Makefile.am|  2 ++
 src/gallium/winsys/radeon/drm/Makefile.am   |  2 ++
 src/gallium/winsys/svga/drm/Makefile.am |  2 +-
 src/gallium/winsys/sw/dri/Makefile.am   |  2 +-
 src/gallium/winsys/sw/kms-dri/Makefile.am   |  2 ++
 src/gallium/winsys/sw/null/Makefile.am  |  2 +-
 src/gallium/winsys/sw/wrapper/Makefile.am   |  2 +-
 src/gallium/winsys/sw/xlib/Makefile.am  |  2 +-
 src/gallium/winsys/vc4/drm/Makefile.am  |  2 ++
 src/gallium/winsys/vc5/drm/Makefile.am  |  2 ++
 src/gallium/winsys/virgl/drm/Makefile.am|  2 ++
 src/gallium/winsys/virgl/vtest/Makefile.am  |  2 ++
 src/gbm/Makefile.am |  2 +-
 src/glx/Makefile.am |  2 +-