mesa.git
6 years agomesa: add DisjointOperation to gl_shared_state
Tapani Pälli [Mon, 20 Nov 2017 06:31:40 +0000 (08:31 +0200)]
mesa: add DisjointOperation to gl_shared_state

This state will be used by EXT_disjoint_timer_query. As first
usage, patch sets DisjointOperation true when gpu reset happens.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agobroadcom/vc5: Fix a typo in memcmp for sig unpack checking.
Eric Anholt [Thu, 14 Dec 2017 17:41:16 +0000 (09:41 -0800)]
broadcom/vc5: Fix a typo in memcmp for sig unpack checking.

This shockingly ended up working out, because only the first byte of *sig
is used and (sizeof(*sig) != 0) == 1.  Fixes a compiler warning.

Link: https://bugs.freedesktop.org/show_bug.cgi?id=104183
6 years agobroadcom/vc5: Enable NIR txd lowering on all txd instructions.
Eric Anholt [Wed, 22 Nov 2017 00:33:29 +0000 (16:33 -0800)]
broadcom/vc5: Enable NIR txd lowering on all txd instructions.

Fixes almost all of piglit's arb_shader_texture_lod grad tests, except for
the base -texgrad/texgradcube ones which fail on what appear to be
precision problems.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: Add a new lowering option to lower all txd to txl.
Eric Anholt [Wed, 22 Nov 2017 00:21:36 +0000 (16:21 -0800)]
nir: Add a new lowering option to lower all txd to txl.

VC5 requires that all txd are lowered in the shader.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: Fix interaction of GL_CLAMP lowering with texture offsets.
Eric Anholt [Tue, 21 Nov 2017 21:42:08 +0000 (13:42 -0800)]
nir: Fix interaction of GL_CLAMP lowering with texture offsets.

We want the clamping of the coordinate to apply after the offset, so we
need to do math to lower the offset out of the instruction.  Fixes texwrap
offset cases for GL_CLAMP with GL_NEAREST on vc5.

Note: I moved the get_texture_size() verbatim, so that it was defined
before use.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agobroadcom/vc5: Fix shader input/outputs for gallium's new NIR linking.
Eric Anholt [Wed, 6 Dec 2017 19:30:02 +0000 (11:30 -0800)]
broadcom/vc5: Fix shader input/outputs for gallium's new NIR linking.

6 years agogallivm: implement accurate corner behavior for textureGather with cube maps
Roland Scheidegger [Wed, 13 Dec 2017 02:33:07 +0000 (03:33 +0100)]
gallivm: implement accurate corner behavior for textureGather with cube maps

The spec says the missing texel (when we wrap around both x and y axis)
should be synthesized as the average of the 3 other texels. For bilinear
filtering however we instead adjusted the filter weights (because, while
the complexity looks similar, there would be 4 times as many color values
to fix up than weights). Obviously this could not work for gather (hence
accurate corner filtering was disabled with gather).
Implement this by just doing it as the spec implies - calculate the 4th
texel as the average of the other 3. With gather of course there's only
one color to worry about, so it's not all that many instructions neither
(albeit surely the whole cube map filtering is hilariously complex).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agogallivm: fix an issue with NaNs with seamless cube filtering
Roland Scheidegger [Wed, 13 Dec 2017 02:33:21 +0000 (03:33 +0100)]
gallivm: fix an issue with NaNs with seamless cube filtering

Cube texture wrapping is a bit special since the values (post face
projection) always are within [0,1], so we took advantage of that and
omitted some clamps.
However, we can still get NaNs (either because the coords already had NaNs,
or the face projection generated them), and in fact we didn't handle them
quite safely. I've seen -INT_MAX + 1 been propagated through as the final int
coord value, albeit I didn't observe a crash. (Not quite a coincidence, since
any stride mul with -INT_MAX or -INT_MAX+1 will turn up as a small positive
number - nevertheless, I'd rather not try my luck, I'm not entirely sure it
can't really turn up negative neither due to seamless coord swapping, plus
ifloor of a NaN is not guaranteed to return -INT_MAX by any standard. And
we kill off NaNs similarly with ordinary texture wrapping too.)
So kill off the NaNs by using the common max against zero method.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agointel/tools: Convert aubinator over to the common framework
Jason Ekstrand [Wed, 13 Dec 2017 19:51:01 +0000 (11:51 -0800)]
intel/tools: Convert aubinator over to the common framework

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/batch-decoder: Decode registers
Jason Ekstrand [Wed, 13 Dec 2017 18:17:40 +0000 (10:17 -0800)]
intel/batch-decoder: Decode registers

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/batch-decoder: Decode dynamic state
Jason Ekstrand [Wed, 13 Dec 2017 18:16:46 +0000 (10:16 -0800)]
intel/batch-decoder: Decode dynamic state

Unfortunately, in aubinator and aubinator_error_decode we don't always
know how many of a given state we have, so we must guess.  One day,
we'll come up with a way to annotate the batch to solve this problem.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/batch-decoder: Decode constants, binding tables, and samplers
Jason Ekstrand [Wed, 13 Dec 2017 17:58:27 +0000 (09:58 -0800)]
intel/batch-decoder: Decode constants, binding tables, and samplers

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/tools: Switch aubinator_error_decode over to the gen_print_batch
Jason Ekstrand [Wed, 13 Dec 2017 19:03:32 +0000 (11:03 -0800)]
intel/tools: Switch aubinator_error_decode over to the gen_print_batch

The shared framework can now do everything that aubinator_error_decode
ever did and more.  It's time to make the switch.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/batch-decoder: Decode graphics shaders
Jason Ekstrand [Wed, 13 Dec 2017 17:46:39 +0000 (09:46 -0800)]
intel/batch-decoder: Decode graphics shaders

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/batch-decoder: Decode vertex and index buffers
Jason Ekstrand [Wed, 13 Dec 2017 17:19:57 +0000 (09:19 -0800)]
intel/batch-decoder: Decode vertex and index buffers

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/batch-decoder: Decode MEDIA_INTERFACE_DESCRIPTOR_LOAD
Jason Ekstrand [Wed, 13 Dec 2017 16:01:03 +0000 (08:01 -0800)]
intel/batch-decoder: Decode MEDIA_INTERFACE_DESCRIPTOR_LOAD

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/tools: Add the start of a generic batch decoder
Jason Ekstrand [Wed, 13 Dec 2017 08:10:12 +0000 (00:10 -0800)]
intel/tools: Add the start of a generic batch decoder

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/decoder: Expose the raw field value in the iterator
Jason Ekstrand [Wed, 13 Dec 2017 16:23:50 +0000 (08:23 -0800)]
intel/decoder: Expose the raw field value in the iterator

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/disasm: Take a devinfo in gen_disasm_create
Jason Ekstrand [Wed, 13 Dec 2017 07:26:51 +0000 (23:26 -0800)]
intel/disasm: Take a devinfo in gen_disasm_create

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/decoder: Take a bit offset in gen_print_group
Jason Ekstrand [Wed, 13 Dec 2017 01:36:47 +0000 (17:36 -0800)]
intel/decoder: Take a bit offset in gen_print_group

Previously, if a group was nested in another group such that it didn't
start on a dword boundary, we would decode it as if it started at the
start of its first dword.  This changes things to work even more in
terms of bits so that we can properly decode these structs.  This
affects MOCS, attribute swizzles, and several other things.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/decoder: Stop rounding down to the nearest dword
Jason Ekstrand [Wed, 13 Dec 2017 01:05:38 +0000 (17:05 -0800)]
intel/decoder: Stop rounding down to the nearest dword

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/decoder: Convert the iterator to work entirely in bits
Jason Ekstrand [Wed, 13 Dec 2017 00:51:54 +0000 (16:51 -0800)]
intel/decoder: Convert the iterator to work entirely in bits

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agointel/decoder: Drop gen_field_decode helper
Jason Ekstrand [Wed, 13 Dec 2017 00:12:16 +0000 (16:12 -0800)]
intel/decoder: Drop gen_field_decode helper

It's unused

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agoamd/common: add ac_build_waitcnt()
Samuel Pitoiset [Tue, 12 Dec 2017 17:10:23 +0000 (18:10 +0100)]
amd/common: add ac_build_waitcnt()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoamd/common: more use of i32_1
Samuel Pitoiset [Tue, 12 Dec 2017 17:10:22 +0000 (18:10 +0100)]
amd/common: more use of i32_1

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoamd/common: more use of i32_0
Samuel Pitoiset [Tue, 12 Dec 2017 17:10:21 +0000 (18:10 +0100)]
amd/common: more use of i32_0

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradeonsi: make use of ac_build_fdiv()
Samuel Pitoiset [Tue, 12 Dec 2017 17:10:20 +0000 (18:10 +0100)]
radeonsi: make use of ac_build_fdiv()

And move the comment to amd/common.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: export SampleMask from pixel shaders at full rate
Samuel Pitoiset [Thu, 14 Dec 2017 12:51:47 +0000 (13:51 +0100)]
radv: export SampleMask from pixel shaders at full rate

Use 16_ABGR instead of 32_ABGR if Z isn't written.

Ported from RadeonSI.

No CTS regressions on Polaris.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradeonsi: make use of ac_get_spi_shader_z_format()
Samuel Pitoiset [Thu, 14 Dec 2017 12:51:46 +0000 (13:51 +0100)]
radeonsi: make use of ac_get_spi_shader_z_format()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoamd/common: add ac_get_spi_shader_z_format()
Samuel Pitoiset [Thu, 14 Dec 2017 12:51:45 +0000 (13:51 +0100)]
amd/common: add ac_get_spi_shader_z_format()

ac_shader_util.c will contain shader helpers for RadeonSI
and RADV.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: do not load the local invocation index when it's unused
Samuel Pitoiset [Thu, 14 Dec 2017 16:32:41 +0000 (17:32 +0100)]
radv: do not load the local invocation index when it's unused

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: do not load unused gl_LocalInvocationID/gl_WorkGroupID components
Samuel Pitoiset [Thu, 14 Dec 2017 15:48:03 +0000 (16:48 +0100)]
radv: do not load unused gl_LocalInvocationID/gl_WorkGroupID components

We should also not load the input SGPRs and VGPRS, but
let's start with this for now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoamd/common: scan which components of gl_LocalInvocationID are used
Samuel Pitoiset [Thu, 14 Dec 2017 15:48:02 +0000 (16:48 +0100)]
amd/common: scan which components of gl_LocalInvocationID are used

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoamd/common: scan which components of gl_WorkGroupID are used
Samuel Pitoiset [Thu, 14 Dec 2017 15:48:01 +0000 (16:48 +0100)]
amd/common: scan which components of gl_WorkGroupID are used

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: set FORCE_SIMD_DIST(1) for compute when profitable
Samuel Pitoiset [Thu, 14 Dec 2017 14:51:20 +0000 (15:51 +0100)]
radv: set FORCE_SIMD_DIST(1) for compute when profitable

Ported from RadeonSI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: calculate best compute resource limits
Samuel Pitoiset [Thu, 14 Dec 2017 14:51:19 +0000 (15:51 +0100)]
radv: calculate best compute resource limits

Ported from RadeonSI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: store the dispatch initiator into the device
Samuel Pitoiset [Thu, 14 Dec 2017 14:51:18 +0000 (15:51 +0100)]
radv: store the dispatch initiator into the device

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: replace grid_components_used by uses_grid_size
Samuel Pitoiset [Thu, 14 Dec 2017 11:51:07 +0000 (12:51 +0100)]
radv: replace grid_components_used by uses_grid_size

Use a boolean instead because the number of needed SGPRs
is always 3.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: always emit all compute block components
Samuel Pitoiset [Thu, 14 Dec 2017 11:51:06 +0000 (12:51 +0100)]
radv: always emit all compute block components

The number of grid components is always 3 when gl_NumWorkGroups
is declared, because it relies on the number of components of
nir_instrinsic_load_num_work_groups.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agodocs: update calendar, add news item and link release notes for 17.2.7
Emil Velikov [Thu, 14 Dec 2017 13:52:11 +0000 (13:52 +0000)]
docs: update calendar, add news item and link release notes for 17.2.7

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agodocs: add sha256 checksums for 17.2.7
Emil Velikov [Thu, 14 Dec 2017 13:49:09 +0000 (13:49 +0000)]
docs: add sha256 checksums for 17.2.7

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agodocs: add release notes for 17.2.7
Emil Velikov [Thu, 14 Dec 2017 13:27:23 +0000 (13:27 +0000)]
docs: add release notes for 17.2.7

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/android: Provide an option for the backend to expose KHR_image
Harish Krupo [Fri, 8 Dec 2017 15:59:39 +0000 (21:29 +0530)]
egl/android: Provide an option for the backend to expose KHR_image

From android cts 8.0_r4, a new test case checks if all the required egl
extensions are exposed. In the current implementation we expose KHR_image
if KHR_image_base and KHR_image_pixmap are supported but KHR_image spec
does not mandate the existence of both the extensions.
This patch preserves the current check and also provides the backend
with an option to expose the KHR_image extension.

Test: run cts -m CtsOpenGLTestCases -t \
android.opengl.cts.OpenGlEsVersionTest#testRequiredEglExtensions

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoradv: Don't advertise VK_EXT_debug_report.
Bas Nieuwenhuizen [Tue, 12 Dec 2017 21:16:55 +0000 (22:16 +0100)]
radv: Don't advertise VK_EXT_debug_report.

We never supported it. Missed during copy and pasting.

Fixes: 17201a2eb0b "radv: port to using updated anv entrypoint/extension generator."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoi965: Don't allocate an MCS for 16x MSAA and width > 8192.
Kenneth Graunke [Wed, 13 Dec 2017 17:45:49 +0000 (09:45 -0800)]
i965: Don't allocate an MCS for 16x MSAA and width > 8192.

The hardware doesn't support this, and isl_surf_get_mcs_surf will fail.

I feel a bit bad replicating this logic, but we want to decide up front.

This fixes the following test when run with --deqp-surface-width=16384:
- GTF-GL46.gtf30.GL3Tests.framebuffer_blit.framebuffer_blit_error_blitframebuffer_multisampled_framebuffers_different_sample_count

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agoAndroid: fix missing generation of vtn_gather_types.c
Rob Herring [Wed, 13 Dec 2017 21:06:08 +0000 (15:06 -0600)]
Android: fix missing generation of vtn_gather_types.c

Commit bb1e6ff161c9 ("spirv: Add a prepass to set types on vtn_values")
added generation of vtn_gather_types.c, but forgot to add it to the
Android build files.

Fixes: bb1e6ff161c9 ("spirv: Add a prepass to set types on vtn_values")
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Rob Herring <robh@kernel.org>
6 years agomesa: Add glSpecializeShaderARB to common_desktop_functions
Dylan Baker [Tue, 12 Dec 2017 19:48:31 +0000 (11:48 -0800)]
mesa: Add glSpecializeShaderARB to common_desktop_functions

CC: Nicolai Hähnle <nicolai.haehnle@amd.com>
CC: Mark Janes <mark.a.janes@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104231
Fixes: 46b21b8f906 ("mesa: add GL_ARB_gl_spirv boilerplate")
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agoegl/android: Partially handle HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED
Tomasz Figa [Mon, 4 Dec 2017 18:22:39 +0000 (19:22 +0100)]
egl/android: Partially handle HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED

There is no API available to properly query the IMPLEMENTATION_DEFINED
format. As a workaround we rely here on gralloc allocating either
an arbitrary YCbCr 4:2:0 or RGBX_8888, with the latter being recognized
by lock_ycbcr failing.

Reviewed-on: https://chromium-review.googlesource.com/566793

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
6 years agoswr: Correct texture allocation and limit max size to 2GB
Bruce Cherniak [Mon, 20 Nov 2017 17:32:55 +0000 (11:32 -0600)]
swr: Correct texture allocation and limit max size to 2GB

This patch fixes piglit tex3d-maxsize by correcting 4 things:

The total_size calculation was using 32-bit math, therefore a >4GB
allocation request overflowed and was not returning false (unsupported).

Changed AlignedMalloc arguments from "unsigned int" to size_t, to handle
>4GB allocations.

Added error checking on texture allocations to fail gracefully.

Finally, temporarily decreased supported max texture size from 4GB to 2GB.
The gallivm texture-sampler needs some additional work to correctly handle
larger than 2GB textures (offsets to LLVMBuildGEP are signed).

I'm working on a follow-on patch to allow up to 4GB textures, as this is
useful in HPC visualization applications.

Fixes piglit tex3d-maxsize.

v2: Updated patch description to clarify ">4GB".

Reviewed-By: George Kyriazis <george.kyriazis@intel.com>
6 years agoswr: Fix KNOB_MAX_WORKER_THREADS thread creation override.
Bruce Cherniak [Tue, 12 Dec 2017 23:18:23 +0000 (17:18 -0600)]
swr: Fix KNOB_MAX_WORKER_THREADS thread creation override.

Environment variable KNOB_MAX_WORKER_THREADS allows the user to override
default thread creation and thread binding.  Previous commit to adjust
linux cpu topology caused setting this KNOB to bind all threads to a single
core.

This patch restores correct functionality of override.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
6 years agomeson: fix glx-test race
Dylan Baker [Tue, 12 Dec 2017 18:23:48 +0000 (10:23 -0800)]
meson: fix glx-test race

This test should rely on dispatch.h being generated, but it doesn't.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agogallium/docs: document behavior of set_sample_mask()
Brian Paul [Wed, 13 Dec 2017 03:32:06 +0000 (20:32 -0700)]
gallium/docs: document behavior of set_sample_mask()

The sample mask is used even if msaa is not explicity enabled when we
have a framebuffer with multisampled surfaces.  That's DX behavior and
what the Radeon drivers do.  Not sure about other drivers at this point.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agoglsl: trivial whitespace fixes in link_varyings.cpp
Brian Paul [Tue, 12 Dec 2017 22:11:21 +0000 (15:11 -0700)]
glsl: trivial whitespace fixes in link_varyings.cpp

6 years agoprogram: Don't reset SamplersValidated when restoring from shader cache
Jordan Justen [Tue, 12 Dec 2017 19:44:01 +0000 (11:44 -0800)]
program: Don't reset SamplersValidated when restoring from shader cache

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103988
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: remove second include of errors.h in src/mesa/main/glspirv.c
Kai Wasserbäch [Tue, 12 Dec 2017 15:20:06 +0000 (16:20 +0100)]
mesa: remove second include of errors.h in src/mesa/main/glspirv.c

Fixes: 5bc03d2508 ("mesa: implement SPIR-V loading in glShaderBinary")
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agoradeonsi: create get_tcs_tes_buffer_address helper
Timothy Arceri [Thu, 23 Nov 2017 01:59:01 +0000 (12:59 +1100)]
radeonsi: create get_tcs_tes_buffer_address helper

This will be shared between the NIR and TGSI backends.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoac: fix nir_op_f2f64
Timothy Arceri [Tue, 12 Dec 2017 05:10:24 +0000 (16:10 +1100)]
ac: fix nir_op_f2f64

Without this we get the error "FPExt only operates on FP" when
converting the following:

   vec1 32 ssa_5 = b2f ssa_4
   vec1 64 ssa_6 = f2f64 ssa_5

Which results in:

   %44 = and i32 %43, 1065353216
   %45 = fpext i32 %44 to double

With this patch we now get:

   %44 = and i32 %43, 1065353216
   %45 = bitcast i32 %44 to float
   %46 = fpext float %45 to double

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agonir: fix shift for uint64_t
Timothy Arceri [Tue, 12 Dec 2017 02:52:50 +0000 (13:52 +1100)]
nir: fix shift for uint64_t

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agost/glsl_to_nir: skip forced array splitting for tcs
Timothy Arceri [Tue, 12 Dec 2017 02:49:41 +0000 (13:49 +1100)]
st/glsl_to_nir: skip forced array splitting for tcs

nir_lower_io_to_temporaries() does not support tcs so we cannot
assume there are no indirects here. Also the radeonsi backend
(the only backend to support tess) has support for tcs indirects
so there is no need to lower them anyway.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agointel/fs/bank_conflicts: Don't touch Gen7 MRF hack registers.
Francisco Jerez [Tue, 12 Dec 2017 04:24:53 +0000 (20:24 -0800)]
intel/fs/bank_conflicts: Don't touch Gen7 MRF hack registers.

Fixes: af2c320190f3c731 "intel/fs: Implement GRF bank conflict mitigation pass."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104199
Reported-by: Darius Spitznagel <d.spitznagel@goodbytez.de>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agoi965: compute scratch space size correctly for Gen9+
Kevin Rogovin [Tue, 12 Dec 2017 12:17:27 +0000 (14:17 +0200)]
i965: compute scratch space size correctly for Gen9+

Fixes: 8ecdbb61360 "i965: Pretend there are 4 subslices for compute shader threads on Gen9+."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104005
Signed-off-by: Kevin Rogovin <kevin.rogovin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Eero Tamminen <eero.t.tamminen@intel.com>
6 years agoi965: Program MEDIA_VFE_STATE in a more readable fashion.
Kevin Rogovin [Tue, 12 Dec 2017 12:17:26 +0000 (14:17 +0200)]
i965: Program MEDIA_VFE_STATE in a more readable fashion.

This patch is purely for readability improvements when programming
the MEDIA_VFE_STATE.

Signed-off-by: Kevin Rogovin <kevin.rogovin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agocso: add point rasterization sanity check assertion
Brian Paul [Fri, 8 Dec 2017 04:11:40 +0000 (21:11 -0700)]
cso: add point rasterization sanity check assertion

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agogallium/u_blitter: replace tabs with spaces
Brian Paul [Thu, 7 Dec 2017 15:52:36 +0000 (08:52 -0700)]
gallium/u_blitter: replace tabs with spaces

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoxlib: call _mesa_warning() instead of fprintf()
Brian Paul [Fri, 8 Dec 2017 16:31:08 +0000 (09:31 -0700)]
xlib: call _mesa_warning() instead of fprintf()

We use _mesa_warning() everywhere else in this code.  Change requested
by Rick Irons of Mathworks.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agogallium/util: don't pass a pipe_resource to util_resource_is_array_texture()
Brian Paul [Thu, 7 Dec 2017 22:00:49 +0000 (15:00 -0700)]
gallium/util: don't pass a pipe_resource to util_resource_is_array_texture()

No need to pass a pipe_resource when we can just pass the target.
This makes the function potentially more usable.  Rename it too.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agogallium/aux: include nr_samples in util_resource_size() computation
Brian Paul [Thu, 7 Dec 2017 21:47:32 +0000 (14:47 -0700)]
gallium/aux: include nr_samples in util_resource_size() computation

This function is only used in two places:
1. VMware driver, but only for HUD reporting
2. st/nine state tracker, used for texture memory accounting

Fixes: a69efa9482d ("util: add new util_resource_size() function in
u_resource.[ch]")

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agosvga: trivial whitespace/formatting fixes in svga_pipe_rasterizer.c
Brian Paul [Thu, 7 Dec 2017 21:30:29 +0000 (14:30 -0700)]
svga: trivial whitespace/formatting fixes in svga_pipe_rasterizer.c

6 years agost/mesa: trivial whitespace/formatting fixes in st_atom_rasterizer.c
Brian Paul [Thu, 7 Dec 2017 20:33:57 +0000 (13:33 -0700)]
st/mesa: trivial whitespace/formatting fixes in st_atom_rasterizer.c

6 years agospirv: Handle image and sampler function parameters
Jason Ekstrand [Fri, 8 Dec 2017 07:42:16 +0000 (23:42 -0800)]
spirv: Handle image and sampler function parameters

6 years agospirv/cfg: Refactor the function parameter loop a bit
Jason Ekstrand [Fri, 8 Dec 2017 07:42:15 +0000 (23:42 -0800)]
spirv/cfg: Refactor the function parameter loop a bit

6 years agospirv/cfg: Be a bit more precise about function parameters
Jason Ekstrand [Fri, 8 Dec 2017 07:42:14 +0000 (23:42 -0800)]
spirv/cfg: Be a bit more precise about function parameters

Pointers with no storage type are converted to inout variables but SSA
values and pointers with a storage type (which turns into a uint or
uvec2) are just input variables.

6 years agospirv: Make sampled images a real type
Jason Ekstrand [Fri, 8 Dec 2017 07:42:13 +0000 (23:42 -0800)]
spirv: Make sampled images a real type

Previously, we just gave them exactly the same type as the respective
image (which already had a sampler2D or similar type).  Now they have
their own base type and a pointer to the vtn_type for the image.
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoi915: add missing 0 defines
Eric Engestrom [Mon, 4 Dec 2017 14:30:13 +0000 (14:30 +0000)]
i915: add missing 0 defines

Thanks to Emil's -Wundef, t_dd_dmatmp.h now complains that intel_render.c
is missing a couple `#define`s.

Assigning them to 0 keeps the existing behaviour; I'll let someone else
turn them on if this is the behaviour that was intended.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agomesa: refuse to compile SPIR-V shaders or link mixed shaders
Nicolai Hähnle [Sat, 10 Jun 2017 17:57:18 +0000 (19:57 +0200)]
mesa: refuse to compile SPIR-V shaders or link mixed shaders

Note that gl_shader::CompileStatus will also indicate whether a shader
has been successfully specialized.

v2: Use the 'spirv_data' member of gl_shader to know if it is a SPIR-V
   shader, instead of a dedicated flag. (Timothy Arceri)

v3: Use bool instead of GLboolean. (Ian Romanick)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agomesa/shaderapi: add a getter for GL_SPIR_V_BINARY_ARB
Nicolai Hähnle [Sat, 10 Jun 2017 17:46:58 +0000 (19:46 +0200)]
mesa/shaderapi: add a getter for GL_SPIR_V_BINARY_ARB

v2: Use the 'spirv_data' member of gl_shader instead of a
   dedicated flag. (Timothy Arceri)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agomesa: implement SPIR-V loading in glShaderBinary
Nicolai Hähnle [Sat, 10 Jun 2017 18:35:21 +0000 (20:35 +0200)]
mesa: implement SPIR-V loading in glShaderBinary

v2: * Add a gl_shader_spirv_data member to gl_shader, which already
   encapsulates a gl_spirv_module where the binary will be saved.
   (Eduardo Lima)

    * Just use the 'spirv_data' member to know whether a gl_shader has
   the SPIR_V_BINARY_ARB state. (Timothy Arceri)

    * Remove redundant argument checks. Move extension presence check
   to API entry point where the rest of checks are. Retype 'n' and
   'length'arguments to use the correct and more standard types.
   (Ian Romanick)

    * Fix some nitpicks. (Ian Romanick)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agomesa/glspirv: Add struct gl_shader_spirv_data
Eduardo Lima Mitev [Mon, 13 Nov 2017 12:57:46 +0000 (13:57 +0100)]
mesa/glspirv: Add struct gl_shader_spirv_data

This is a per-shader structure holding the SPIR-V data associated with the
shader (binary module, specialization constants and entry-point).

This is needed because both gl_shader and gl_linked_shader need to share this
data. Instead of copying the data, we pass a reference to it upon program
linking. That's why it is reference-counted.

This struct is created and associated with the shader upon calling
glShaderBinary(), then subsequently filled up by the call to
glSpecializeShaderARB().

v2: Readability improvements (Ian Romanick)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agomesa/glspirv: Add struct gl_spirv_module
Nicolai Hähnle [Sat, 10 Jun 2017 18:14:44 +0000 (20:14 +0200)]
mesa/glspirv: Add struct gl_spirv_module

v2: * Make the SPIR-V module struct part of a larger gl_shader_spirv_data
    struct that will be introduced later, and don't reference it directly
    in gl_shader. (Eduardo Lima)
    * Readability improvements (Ian Romanick)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agomesa: add GL_ARB_gl_spirv boilerplate
Nicolai Hähnle [Sat, 10 Jun 2017 17:39:02 +0000 (19:39 +0200)]
mesa: add GL_ARB_gl_spirv boilerplate

v2: * Add meson build bits (Eric Engestrom)
    * Return INVALID_OPERATION error on SpecializeShaderARB (Ian Romanick)

v3: Include boilerplate for the GL 4.6 alias of glSpecializeShaderARB
   (Neil Roberts)

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agospirv: Add support for all bit sizes in OpSwitch
Jason Ekstrand [Wed, 6 Dec 2017 18:01:22 +0000 (10:01 -0800)]
spirv: Add support for all bit sizes in OpSwitch

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101560

6 years agospirv: Restructure the case loop in OpSwitch handling
Jason Ekstrand [Wed, 6 Dec 2017 18:09:28 +0000 (10:09 -0800)]
spirv: Restructure the case loop in OpSwitch handling

Instead of calling vtn_add_case for the default case and then looping,
add an is_default variable and do everything inside the loop.  This will
make the next commit easier.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agospirv: Add better parameter validation for vector and matrix types
Jason Ekstrand [Wed, 6 Dec 2017 17:35:10 +0000 (09:35 -0800)]
spirv: Add better parameter validation for vector and matrix types

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agospirv: Add type validation for OpSelect
Jason Ekstrand [Wed, 6 Dec 2017 17:14:20 +0000 (09:14 -0800)]
spirv: Add type validation for OpSelect

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agospirv: Add basic type validation for OpLoad, OpStore, and OpCopyMemory
Jason Ekstrand [Wed, 6 Dec 2017 06:51:53 +0000 (22:51 -0800)]
spirv: Add basic type validation for OpLoad, OpStore, and OpCopyMemory

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agospirv: Add a prepass to set types on vtn_values
Jason Ekstrand [Wed, 6 Dec 2017 06:31:02 +0000 (22:31 -0800)]
spirv: Add a prepass to set types on vtn_values

This autogenerated pass will automatically find and set the type field
on all vtn_values.  This way we always have the type and can use it for
validation and other checks.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agospirv: Add a vtn_type field to all vtn_values
Jason Ekstrand [Wed, 6 Dec 2017 05:39:51 +0000 (21:39 -0800)]
spirv: Add a vtn_type field to all vtn_values

At the moment, this just lets us drop the const_type for constants and
unify things a bit.  Eventually, we will use this to store the types of
all SPIR-V SSA values.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agoanv: fix bug when using component qualifier in FS outputs
Samuel Iglesias Gonsálvez [Tue, 31 Oct 2017 10:47:57 +0000 (11:47 +0100)]
anv: fix bug when using component qualifier in FS outputs

We can write to the same output but in different components, like
in this example:

layout(location = 0, component = 0) out ivec2 dEQP_FragColor_0;
layout(location = 0, component = 2) out ivec2 dEQP_FragColor_1;

Therefore, they are not two different outputs but only one.

Fixes:

dEQP-VK.glsl.440.linkage.varying.component.frag_out.*

v3:
- Remove FRAG_RESULT_MAX.
- Add const and use sizeof (Ian).
- Do three-pass to set properly the locations of fragment
  outputs when having arrays (Jason).

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agost/mesa: swizzle argument when there's a vector size mismatch
Ilia Mirkin [Sat, 2 Dec 2017 16:20:46 +0000 (11:20 -0500)]
st/mesa: swizzle argument when there's a vector size mismatch

GLSL IR operation arguments can sometimes have an implicit swizzle as a
result of a vector arg and a scalar arg, where the scalar argument is
implicitly expanded to the size of the vector argument.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103955
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agogallivm: fix texture wrapping for texture gather for mirror modes
Roland Scheidegger [Tue, 12 Dec 2017 03:22:28 +0000 (04:22 +0100)]
gallivm: fix texture wrapping for texture gather for mirror modes

Care must be taken that all coords end up correct, the tests are very
sensitive that everything is correctly rounded. This doesn't matter
for bilinear filter (since picking a wrong texel with weight zero is
ok), and we could also switch the per-sample coords mistakenly.
While here, also optimize the coord_mirror helper a bit (we can do the
mirroring directly by exploiting float rounding, no need for fixing up
odd/even manually).
I did not touch the mirror_clamp and mirror_clamp_to_border modes.
In contrast to mirror_clamp_to_edge and mirror_repeat these are legacy
modes. They are specified against old gl rules, which actually does
the mirroring not per sample (so you get swapped order if the coord
is in the mirrored section). I think the idea though is that they should
follow the respecified mirror_clamp_to_edge rules so the order would be
correct.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agospirv: Allow ignoring decorations for workgroup variables
Jason Ekstrand [Mon, 11 Dec 2017 23:31:22 +0000 (15:31 -0800)]
spirv: Allow ignoring decorations for workgroup variables

Since we switched over to lowering SLM access directly in SPIR-V -> NIR,
we no longer have vtn_variables for SLM.  It's all safe as with UBOs and
SSBOs but we need to let it through in the assert.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104213
Fixes: 8761a04d0d9332d9c0c99164faf855fc3c741f7c
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agospirv: Set lengths on scalar and vector types
Jason Ekstrand [Wed, 6 Dec 2017 17:13:29 +0000 (09:13 -0800)]
spirv: Set lengths on scalar and vector types

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agoac/nir: Support vulkan_resource_reindex.
Bas Nieuwenhuizen [Sun, 10 Dec 2017 22:31:45 +0000 (23:31 +0100)]
ac/nir: Support vulkan_resource_reindex.

Fixes: 93b4cb61eb2 "spirv: Allow OpPtrAccessChain for block indices"
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoac/nir: Don't load the descriptor in vulkan_resource_index.
Bas Nieuwenhuizen [Sun, 10 Dec 2017 22:18:32 +0000 (23:18 +0100)]
ac/nir: Don't load the descriptor in vulkan_resource_index.

To support the reindex intrinsic, we need the result to be
something on which we can adjust the index/address.

Since it is all within a basic block, the compiler should be
able to merge any extra loads.

v2: Change visit_get_buffer_size too.
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agowinsys/amdgpu: disable local BOs again due to worse performance
Marek Olšák [Mon, 11 Dec 2017 15:29:40 +0000 (16:29 +0100)]
winsys/amdgpu: disable local BOs again due to worse performance

Cc: 17.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agodrirc: whitelist glthread for Mount and Blade Warband again
Marek Olšák [Wed, 26 Jul 2017 13:21:45 +0000 (15:21 +0200)]
drirc: whitelist glthread for Mount and Blade Warband again

6 years agoradv: Don't use local BOs when allocating with export options.
Bas Nieuwenhuizen [Sun, 10 Dec 2017 14:34:54 +0000 (15:34 +0100)]
radv: Don't use local BOs when allocating with export options.

If the app does not plan to put a buffer or image in it
(why? But it is allowed and CTS does it), they do not need to
allocate it with the deciate allocation struct.

Fixes: a639d40f133 "radv: add support for local bos. (v3)"
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agospirv: Fix loading an entire block at once.
Bas Nieuwenhuizen [Sun, 3 Dec 2017 14:35:39 +0000 (15:35 +0100)]
spirv: Fix loading an entire block at once.

There is no chain, so  checking the length ends with a SEGFAULT.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103579
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv: Enable UBO pushing
Jason Ekstrand [Sat, 2 Dec 2017 00:10:48 +0000 (16:10 -0800)]
anv: Enable UBO pushing

Push constants on Intel hardware are significantly more performant than
pull constants.  Since most Vulkan applications don't actively use push
constants on Vulkan or at least don't use it heavily, we're pulling way
more than we should be.  By enabling pushing chunks of UBOs we can get
rid of a lot of those pulls.

On my SKL GT4e, this improves the performance of Dota 2 and Talos by
around 2.5% and improves Aztec Ruins by around 2%.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoi965/fs: Handle !supports_pull_constants and push UBOs properly
Jason Ekstrand [Sun, 3 Dec 2017 06:34:47 +0000 (22:34 -0800)]
i965/fs: Handle !supports_pull_constants and push UBOs properly

In Vulkan, we don't support classic pull constants and everything the
client asks us to push, we push.  However, for pushed UBOs, we still
want to fall back to conventional pulls if we run out of space.