mesa.git
5 years agogallium/swr: Fix multi-context sync fence deadlock.
Bruce Cherniak [Fri, 4 Jan 2019 20:53:59 +0000 (14:53 -0600)]
gallium/swr: Fix multi-context sync fence deadlock.

Various recreation scenarios lead to API thread getting stuck in
swr_fence_finish().  This is a multi-context issue, whereby one context
overwrites the fence read-value with a previous sync's lesser value.
The fence sync value is supposed to be always increasing.

In swr_fence_cb(), only update the "read" value if the new value is
greater.

(This may seem like we're not waiting on the other context to finish, but
had we needed for it to finish there would have been a wait prior to
submitting a new sync.)

cc: mesa-stable@lists.freedesktop.org

5 years agoac/nir: don't trash L1 caches for store operations with writeonly memory
Samuel Pitoiset [Tue, 15 Jan 2019 08:44:20 +0000 (09:44 +0100)]
ac/nir: don't trash L1 caches for store operations with writeonly memory

Ported from RadeonSI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agost/mesa: Optionally override RGB/RGBX dst alpha blend factors
Kenneth Graunke [Sun, 22 Jul 2018 06:40:16 +0000 (23:40 -0700)]
st/mesa: Optionally override RGB/RGBX dst alpha blend factors

Intel's blending hardware does not properly return 1.0 for destination
alpha for RGBX formats; it requires the factors to be overridden to
either zero or one.  Broadcom vc4 and v3d also could use this override.
While overriding these factors is safe in general, Nouveau and Radeon
would prefer not to.  Their blending hardware already returns correct
values for RGB/RGBX formats, and would like to avoid the resulting
per-buffer blending and independent blend factors (rgb != a) since it
can cause additional overhead.

I considered simply handling this in the driver, but it's not as nice.
pipe_blend_state doesn't have any format information, so we'd need the
hardware blend state to depend on both pipe_blend_state and
pipe_framebuffer_state.  Furthermore, Intel GPUs don't have a native
RGBX_SNORM format, so I avoid exposing one, which makes Gallium fall
back to RGBA_SNORM.  The pipe_surfaces we get in the driver have an RGBA
format, making it impossible to tell that there shouldn't be an alpha
channel.  One could argue that st not handling it in that case is a bug.
To work around this, we'd have to expose RGBX pipe formats, mapped to
RGBA hardware formats, and add format swizzling special cases.  All
doable, but it ends up being more code than I'd like.

st_atom_blend already has access to the right information and it's
trivial to accomplish there, so we just add a cap bit and do that.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agowinsys/amdgpu: fix whitespace
Marek Olšák [Thu, 3 Jan 2019 13:33:45 +0000 (08:33 -0500)]
winsys/amdgpu: fix whitespace

5 years agomeson: Fix with_gallium_icd to with_opencl_icd
Pierre Moreau [Wed, 9 Jan 2019 22:03:45 +0000 (23:03 +0100)]
meson: Fix with_gallium_icd to with_opencl_icd

`with_gallium_icd` is never used throughout the different Meson build
files, whereas `with_opencl_icd` tracks whether or not `gallium-opencl`
was set to "icd".

Fixes: 42ea0631f108d82554339530d6c88aa1b448af1e
         ("meson: build clover")
Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agogallium: Add the ability to query a single pipeline statistics counter
Kenneth Graunke [Fri, 28 Sep 2018 09:21:47 +0000 (11:21 +0200)]
gallium: Add the ability to query a single pipeline statistics counter

Gallium historically has treated pipeline statistics queries as a single
query, PIPE_QUERY_PIPELINE_STATISTICS, which returns a block of 11
values.  This was originally patterned after the D3D1x API.  Much later,
Brian introduced an OpenGL extension that exposed these counters - but
it exposes 11 separate queries, each of which returns a single value.

Today, st/mesa simply queries all 11 values, and returns a single value.
While pipeline statistics counters aren't typically performance
critical, this is still not a great fit.  A D3D1x->GL translator might
request all 11 counters by creating 11 separate GL queries...which
Gallium would map to reads of all 11 values each time, resulting in a
total 121 counter reads.  That's not ideal.

This patch adds a new cap, PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE,
and corresponding query type PIPE_QUERY_PIPELINE_STATISTICS_SINGLE.
When calling create_query(), q->index should be set to one of the
PIPE_STAT_QUERY_* enums to select a counter.  Unlike the block query,
this returns the value in pipe_query_result::u64 (as it's a single
value) instead of the pipe_query_data_pipeline_statistics group.

We update st/mesa to expose ARB_pipeline_statistics_query if either
capability is set, preferring the new SINGLE variant when available.

Thanks to Roland, Ilia, and Marek for helping me sort this out.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agost/mesa: Rearrange PIPE_QUERY_PIPELINE_STATISTICS result fetching.
Kenneth Graunke [Fri, 11 Jan 2019 21:22:57 +0000 (13:22 -0800)]
st/mesa: Rearrange PIPE_QUERY_PIPELINE_STATISTICS result fetching.

This just changes the order of the switch statements, so we only
look at target if the query type is PIPE_QUERY_PIPELINE_STATISTICS.

The next commit will introduce a new SINGLE query type which can be
used for the same GL query types, and it won't want this processing.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agost/mesa: Make an enum for pipeline statistics query result indices.
Kenneth Graunke [Sat, 15 Dec 2018 05:09:32 +0000 (21:09 -0800)]
st/mesa: Make an enum for pipeline statistics query result indices.

Gallium handles pipeline statistics queries as a single query
(PIPE_QUERY_PIPELINE_STATISTICS) which returns a struct with 11 values.
Sometimes it's useful to refer to each of those values individually,
rather than as a group.  To avoid hardcoding numbers, we define a new
enum for each value.  Here, the name and enum value correspond to the
index in the struct pipe_query_data_pipeline_statistics result.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agomeson: Add a script to extract the cmd line used for meson
Dylan Baker [Fri, 11 Jan 2019 23:36:05 +0000 (15:36 -0800)]
meson: Add a script to extract the cmd line used for meson

Upstream I'm persuing a more comprehensive solution, but this should
prove a suitable stop-gap measure in the meantime.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109325
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
5 years agoradv: add support for VK_EXT_memory_budget
Samuel Pitoiset [Wed, 9 Jan 2019 13:40:00 +0000 (14:40 +0100)]
radv: add support for VK_EXT_memory_budget

A simple Vulkan extension that allows apps to query size and
usage of all exposed memory heaps.

The different usage values are not really accurate because
they are per drm-fd, but they should be close enough.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: add two small helpers for getting VRAM and visible VRAM sizes
Samuel Pitoiset [Mon, 7 Jan 2019 16:38:08 +0000 (17:38 +0100)]
radv: add two small helpers for getting VRAM and visible VRAM sizes

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: remove unnecessary returns in GetPhysicalDevice*Properties()
Samuel Pitoiset [Wed, 9 Jan 2019 13:40:28 +0000 (14:40 +0100)]
radv: remove unnecessary returns in GetPhysicalDevice*Properties()

These functions return nothing.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: Set partial_vs_wave for pipelines with just GS, not tess.
Bas Nieuwenhuizen [Sat, 12 Jan 2019 19:09:23 +0000 (20:09 +0100)]
radv: Set partial_vs_wave for pipelines with just GS, not tess.

Looking at -pro we need to enable it for pipelines with just a
GS too.

This seems to reduce the hangs from
https://bugs.freedesktop.org/show_bug.cgi?id=109242 on a RX 550 to
the point where I can't reproduce, after the false start with the
wd_switch_on_eop patch due to flakiness.

(but people are reporting it does not fix the issue completely for
 them on polaris 11)

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradeonsi: also apply the GS hang workaround to draws without tessellation
Marek Olšák [Mon, 14 Jan 2019 23:24:08 +0000 (18:24 -0500)]
radeonsi: also apply the GS hang workaround to draws without tessellation

ported from AMDVLK.

Cc: 18.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agov3d: SHARED but not necessarily SCANOUT buffers on RO must be linear.
Eric Anholt [Mon, 14 Jan 2019 18:39:43 +0000 (10:39 -0800)]
v3d: SHARED but not necessarily SCANOUT buffers on RO must be linear.

We don't have a way to talk to RO about modifiers it can do yet, so assume
the minimum.

5 years agov3d: Add support for CS barrier() intrinsics.
Eric Anholt [Mon, 10 Dec 2018 06:03:42 +0000 (22:03 -0800)]
v3d: Add support for CS barrier() intrinsics.

5 years agov3d: Add support for CS shared variable load/store/atomics.
Eric Anholt [Mon, 10 Dec 2018 03:44:33 +0000 (19:44 -0800)]
v3d: Add support for CS shared variable load/store/atomics.

CS shared variables are handled effectively as SSBO access to a temporary
buffer that will be allocated at CS dispatch time.

5 years agov3d: Add support for CS workgroup/invocation id intrinsics.
Eric Anholt [Fri, 7 Dec 2018 23:47:18 +0000 (15:47 -0800)]
v3d: Add support for CS workgroup/invocation id intrinsics.

We get a payload for the ivec3 workgroup and an int local invocation
index, and we use the core lowering to turn into the global invocation id
and the local invocation id ivec3s.

5 years agov3d: Add support for shader_image_load_store.
Eric Anholt [Mon, 11 Dec 2017 20:52:27 +0000 (12:52 -0800)]
v3d: Add support for shader_image_load_store.

This is only exposed on V3D 4.1+, because we didn't have the TMU write
operations for images on 3.3 (To do GLES 3.1 there, you have to lower it
to SSBO load/stores, which is a problem to solve later).

5 years agov3d: Add SSBO/atomic counters support.
Eric Anholt [Mon, 11 Dec 2017 01:11:25 +0000 (17:11 -0800)]
v3d: Add SSBO/atomic counters support.

So far I assume that all the buffers get written.  If they weren't, you'd
probably be using UBOs instead.

5 years agov3d: Drop the GLSL version level.
Eric Anholt [Tue, 8 Jan 2019 18:16:51 +0000 (10:16 -0800)]
v3d: Drop the GLSL version level.

This was an arbitrary "we support lots of stuff" value when I started the
driver.  However, at 400 we expose OES_gpu_shader5, which claims support
for dynamically indexing samplers, which the driver doesn't do yet.

5 years agov3d: Add support for matrix inputs to the FS.
Eric Anholt [Tue, 8 Jan 2019 17:56:52 +0000 (09:56 -0800)]
v3d: Add support for matrix inputs to the FS.

We've been relying on linking splitting up our varying matrices into
separate vectors, but with SSO that doesn't happen.  Supporting matrix
inputs isn't too hard, though.

5 years agov3d: Add an isr to the simulator to catch GMP violations.
Eric Anholt [Fri, 4 Jan 2019 17:17:15 +0000 (09:17 -0800)]
v3d: Add an isr to the simulator to catch GMP violations.

Otherwise, the simulator raises the GMP interrupt and waits for it to be
handled, and v3d ends up spinning in v3d_hw_tick().  Aborting right when
violation happens gives us a chance to look at the backtrace of whatever
thread triggered the violation.

5 years agov3d: Fix txf_ms 2D_ARRAY array index.
Eric Anholt [Fri, 28 Dec 2018 07:11:49 +0000 (23:11 -0800)]
v3d: Fix txf_ms 2D_ARRAY array index.

We need to pass the array index through our coordinate transform
unchanged.  Fixes
dEQP-GLES31.functional.texture.multisample.samples_1.*_2d_array

5 years agov3d: Add support for GL_ARB_framebuffer_no_attachments.
Eric Anholt [Fri, 28 Dec 2018 03:57:03 +0000 (19:57 -0800)]
v3d: Add support for GL_ARB_framebuffer_no_attachments.

Fixes
dEQP-GLES31.functional.state_query.integer.max_framebuffer_height_getboolean
when GLES3 is enabled.

5 years agov3d: Add support for the early_fragment_tests flag.
Eric Anholt [Fri, 4 Jan 2019 21:33:35 +0000 (13:33 -0800)]
v3d: Add support for the early_fragment_tests flag.

If this flag hasn't been set by the shader and it has some visible side
effects, then we need to disable EZ.

5 years agov3d: Add support for flushing dirty TMU data at job end.
Eric Anholt [Mon, 3 Dec 2018 23:28:49 +0000 (15:28 -0800)]
v3d: Add support for flushing dirty TMU data at job end.

This will be needed for SSBOs and image_load_store.

5 years agoac: add missing 16-bit types to glsl_base_to_llvm_type()
Samuel Pitoiset [Mon, 14 Jan 2019 16:55:18 +0000 (17:55 +0100)]
ac: add missing 16-bit types to glsl_base_to_llvm_type()

Fix crashes with
dEQP-VK.spirv_assembly.instruction.compute.workgroup_memory.*16

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: Only use 32 KiB per threadgroup on Stoney.
Bas Nieuwenhuizen [Mon, 14 Jan 2019 13:44:15 +0000 (14:44 +0100)]
radv: Only use 32 KiB per threadgroup on Stoney.

Causes hangs on some machines.

What works for dEQP-VK.tessellation.shader_input_output.barrier:

- running num_patches = 6 (which limits LDS to 32 KiB)
- running num_patches = 8, and artificially cutting LDS size at 32 KiB.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agost/dri: fix dri2_format_table for argb1555 and rgb565
Marek Olšák [Fri, 11 Jan 2019 21:19:02 +0000 (16:19 -0500)]
st/dri: fix dri2_format_table for argb1555 and rgb565

The bug caused that rgb565 framebuffers used argb1555.

Fixes: 433ca3127a3b94bfe9a513e7c7ce594e09e1359f
Reviewed-by: Kristian H. Kristensen <hoegsberg@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
5 years agonir: Add a bool to float32 lowering pass
Jason Ekstrand [Mon, 22 Oct 2018 21:44:59 +0000 (16:44 -0500)]
nir: Add a bool to float32 lowering pass

From @jekstrand's nir-1-bit-bool branch, with improved ior/inot lowering.

ior: fmax instead of fadd allows removing the fsat.

inot: seq(x, 0) can be better than fsub(1, x). On a2xx, it works better
with the scalar instruction set.

Reviewed-by: Jonathan Marek <jonathan@marek.ca>
5 years agosrc/intel: use new hash table and set creation helpers
Caio Marcelo de Oliveira Filho [Fri, 11 Jan 2019 20:01:30 +0000 (12:01 -0800)]
src/intel: use new hash table and set creation helpers

Replace calls to create hash tables and sets that use
_mesa_hash_pointer/_mesa_key_pointer_equal with the helpers
_mesa_pointer_hash_table_create() and _mesa_pointer_set_create().

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Eric Engestrom <eric@engestrom.ch>
5 years agosrc/compiler: use new hash table and set creation helpers
Caio Marcelo de Oliveira Filho [Fri, 11 Jan 2019 19:50:53 +0000 (11:50 -0800)]
src/compiler: use new hash table and set creation helpers

Replace calls to create hash tables and sets that use
_mesa_hash_pointer/_mesa_key_pointer_equal with the helpers
_mesa_pointer_hash_table_create() and _mesa_pointer_set_create().

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Eric Engestrom <eric@engestrom.ch>
5 years agoutil: Helper to create sets and hashes with pointer keys
Caio Marcelo de Oliveira Filho [Tue, 11 Sep 2018 23:37:33 +0000 (16:37 -0700)]
util: Helper to create sets and hashes with pointer keys

These combinations are common enough and deserve a shortcut.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Eric Engestrom <eric@engestrom.ch>
5 years agoac/nir: set cache policy when loading/storing buffer images
Samuel Pitoiset [Mon, 29 Oct 2018 15:31:07 +0000 (16:31 +0100)]
ac/nir: set cache policy when loading/storing buffer images

This was missing.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoac/nir: add get_cache_policy() helper and use it
Samuel Pitoiset [Mon, 29 Oct 2018 15:16:46 +0000 (16:16 +0100)]
ac/nir: add get_cache_policy() helper and use it

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoanv: Implement VK_KHR_depth_stencil_resolve
Jason Ekstrand [Tue, 26 Jun 2018 16:08:48 +0000 (09:08 -0700)]
anv: Implement VK_KHR_depth_stencil_resolve

5 years agoanv: Move resolve_subpass to genX_cmd_buffer.c
Jason Ekstrand [Fri, 31 Aug 2018 19:50:08 +0000 (14:50 -0500)]
anv: Move resolve_subpass to genX_cmd_buffer.c

We may have to do transitions around certain kinds of resolves so it
helps to have it genX code.

5 years agoanv/blorp: Refactor MSAA resolves into an exportable helper function
Jason Ekstrand [Tue, 26 Jun 2018 17:01:00 +0000 (10:01 -0700)]
anv/blorp: Refactor MSAA resolves into an exportable helper function

This function is modeled after the aux_op functions except that it has a
lot more parameters because it deals with two images as well as source
and destination regions.

5 years agoanv: Rename has_resolve to has_color_resolve
Jason Ekstrand [Tue, 26 Jun 2018 16:35:35 +0000 (09:35 -0700)]
anv: Rename has_resolve to has_color_resolve

5 years agointel/blorp: Add two more filter modes
Jason Ekstrand [Tue, 26 Jun 2018 15:22:17 +0000 (08:22 -0700)]
intel/blorp: Add two more filter modes

5 years agobin/get-pick-list.sh: fix redirection in sh
Andres Gomez [Fri, 11 Jan 2019 14:43:27 +0000 (16:43 +0200)]
bin/get-pick-list.sh: fix redirection in sh

"&>" is bash specific.

Fixes: e0dbfc99537 ("bin/get-pick-list.sh: warn when commit lists invalid sha")
Cc: Juan A. Suarez <jasuarez@igalia.com>
Cc: Eric Engestrom <eric.engestrom@intel.com>
Cc: Dylan Baker <dylan@pnwbakers.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
5 years agobin/get-pick-list.sh: fix the oneline printing
Andres Gomez [Fri, 11 Jan 2019 14:42:25 +0000 (16:42 +0200)]
bin/get-pick-list.sh: fix the oneline printing

"--summary" will also print extended header information such as
creations, renames and mode changes.

Let's just use "--no-patch", which suppresses the diff output.

v2: Use "--no-patch" instead of the "-s" abbreviation (Eric).

Fixes: 559c32d2412 ("bin/get-pick-list.sh: simplify git oneline printing")
Cc: Juan A. Suarez <jasuarez@igalia.com>
Cc: Eric Engestrom <eric.engestrom@intel.com>
Cc: Dylan Baker <dylan@pnwbakers.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
5 years agoamd/common: Restore v4i32 suffix for llvm.SI.load.const intrinsic
Michel Dänzer [Mon, 14 Jan 2019 11:52:52 +0000 (12:52 +0100)]
amd/common: Restore v4i32 suffix for llvm.SI.load.const intrinsic

It was accidentally dropped in commit e4803ab7d2b6 "amd/common: use
llvm.amdgcn.s.buffer.load for LLVM 8.0", breaking the universe with LLVM
7.

Trivial.

5 years agoamd/common/vi+: enable SMEM loads with GLC=1
Nicolai Hähnle [Thu, 10 Jan 2019 22:21:46 +0000 (23:21 +0100)]
amd/common/vi+: enable SMEM loads with GLC=1

Only on LLVM 8.0+, which supports the new intrinsic.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoamd/common: use llvm.amdgcn.s.buffer.load for LLVM 8.0
Nicolai Hähnle [Thu, 10 Jan 2019 21:59:58 +0000 (22:59 +0100)]
amd/common: use llvm.amdgcn.s.buffer.load for LLVM 8.0

llvm.SI.load.const is deprecated.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoanv/pipeline_cache: free NIR shader cache
Iago Toral Quiroga [Fri, 11 Jan 2019 11:54:16 +0000 (12:54 +0100)]
anv/pipeline_cache: free NIR shader cache

Fixes: f6aa9f718516 'anv/pipeline_cache: Add support for caching NIR'
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoglsl: Fix copying function's out to temp if dereferenced by array
Danylo Piliaiev [Thu, 10 Jan 2019 16:16:59 +0000 (18:16 +0200)]
glsl: Fix copying function's out to temp if dereferenced by array

Function's out variable could be an array dereferenced by an array:
 func(v[w[i]]);
or something more complicated.

Copy index in any case.

Fixes: 76c27e47b906 ("glsl: Copy function out to temp if we don't directly ref a variable")
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoi965: Drop mark_surface_used mechanism.
Kenneth Graunke [Sat, 29 Dec 2018 01:54:57 +0000 (17:54 -0800)]
i965: Drop mark_surface_used mechanism.

The original idea was that the backend compiler could eliminate
surfaces, so we would have it mark which ones are actually used,
then shrink the binding table accordingly.  Unfortunately, it's a
pretty blunt mechanism - it can only prune things from the end,
not the middle - since we decide the layout before we even start
the backend compiler, and only limit the size.  It also basically
gives up if it sees indirect array access.

Besides, we do the vast majority of our surface elimination in NIR
anyway, not the backend - and I don't see that trend changing any
time soon.  Vulkan abandoned this plan a long time ago, and I don't
use it in Iris, but it's still been kicking around in i965.

I hacked shader-db to print the binding table size in bytes, and
observed no changes with this patch.  So, this code appears to do
nothing useful.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoegl: fix python lib deprecation warning
Eric Engestrom [Wed, 7 Nov 2018 13:07:09 +0000 (13:07 +0000)]
egl: fix python lib deprecation warning

  DeprecationWarning: the imp module is deprecated in favour of importlib

Instead of complicated logic, just import the file directly.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
5 years agospirv: Emit switch conditions on-the-fly
Jason Ekstrand [Sat, 12 Jan 2019 03:36:28 +0000 (21:36 -0600)]
spirv: Emit switch conditions on-the-fly

Instead of emitting all of the conditions for the cases of a switch
statement up-front, emit them on-the-fly as we emit the code for each
case.  The original justification for this was that we were going to
have to build a default case anyway which would need them all.  However,
we can just trust CSE to clean up the mess in that case.  Emitting each
condition right before the if statement that uses it reduces register
pressure and, in one customer benchmark, reduces spilling and improves
performance by about 2x.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agonir/gcm: Support deref instructions
Jason Ekstrand [Sat, 12 Jan 2019 08:04:14 +0000 (02:04 -0600)]
nir/gcm: Support deref instructions

Even though no one's been brave enough to ever use this pass, I like to
keep it functionally working.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agointel/nir: Call nir_opt_deref in brw_nir_optimize
Jason Ekstrand [Fri, 11 Jan 2019 20:33:17 +0000 (14:33 -0600)]
intel/nir: Call nir_opt_deref in brw_nir_optimize

It's an optimization so we should probably be calling it in the
optimization loop.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agospirv: Contain the GLSLang issue #179 workaround to old GLSLang
Jason Ekstrand [Fri, 11 Jan 2019 21:02:39 +0000 (15:02 -0600)]
spirv: Contain the GLSLang issue #179 workaround to old GLSLang

Instead of applying the workaround universally, detect semi-old GLSLang
via the generator ID and only enable the workaround on old GLSLang.
This isn't nearly as precise as one would like it to be because the
first GLSLang generator id version bump was on October 7, 2017 which is
about 1.5 years after the bug was fixed.  However, it at least lets us
disable it for non-GLSLang and for more modern versions.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agospirv: Whack sampler/image pointers to uniform
Jason Ekstrand [Fri, 11 Jan 2019 20:17:24 +0000 (14:17 -0600)]
spirv: Whack sampler/image pointers to uniform

A long time in a galaxy far far away, there was a GLSLang bug with how
it handled samplers passed in as function parameters.  (The bug can be
found here: https://github.com/KhronosGroup/glslang/issues/179.)
Unfortunately, that version was shipped in several apps and has been
causing heartburn for our SPIR-V parser ever since.

Recent changes to NIR uncovered a moderately old bug in how we work
around this issue.  In particular, we ended up with a deref_cast from
uniform to local which is not a no-op cast so nir_opt_deref wasn't
getting rid of the cast.  The only reason why it worked before was
because someone just happened to call nir_fixup_deref_modes which
"fixed" the cast (that shouldn't be happening) and then a later round of
copy-prop would get rid of it.  The fact that the deref_cast survived
that long without causing trouble for other parts of NIR is a bit
surprising.

Just whacking the mode of the pointer seems to fix it fairly
unobtrusively.  Currently, only apps with this bug will have a local
variable containing an image or sampler.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109304
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agost/nir: Lower TES gl_PatchVerticesIn to a constant if linked with a TCS.
Kenneth Graunke [Thu, 19 Jul 2018 01:46:09 +0000 (18:46 -0700)]
st/nir: Lower TES gl_PatchVerticesIn to a constant if linked with a TCS.

If the TCS and TES are linked together, we can simply replace the TES's
gl_PatchVerticesIn system value with a constant, possibly allowing extra
optimization or letting the driver avoid uploading a special value.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agoglsl/nir: keep bool types when native_integers=false
Jonathan Marek [Wed, 19 Dec 2018 04:31:30 +0000 (23:31 -0500)]
glsl/nir: keep bool types when native_integers=false

With the new handling of bool types, the conversion to float in glsl_to_nir
should not apply to bool types anymore.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoglsl/nir: ftrunc for native_integers=false float to int cast
Jonathan Marek [Mon, 12 Nov 2018 22:00:08 +0000 (17:00 -0500)]
glsl/nir: ftrunc for native_integers=false float to int cast

out_type in the default cast case is always GLSL_TYPE_FLOAT, so we get a
mov otherwise.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoglsl/nir: int constants as float for native_integers=false
Jonathan Marek [Mon, 12 Nov 2018 18:08:50 +0000 (13:08 -0500)]
glsl/nir: int constants as float for native_integers=false

All alu instructions emitted with native_integers=false expect float
(or bool in some cases) constants, so this change is necessary.

This will cause changes with some intrinsics which had integer sources,
such as nir_intrinsic_load_uniform. Apparently it might cause issues with
some opt passes, but perhaps those don't apply in OpenGL ES 2.0 cases?

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/peephole_ffma: Fix swizzle propagation
Jason Ekstrand [Wed, 17 Oct 2018 16:34:32 +0000 (11:34 -0500)]
intel/peephole_ffma: Fix swizzle propagation

The num_components value passed into get_mul_for_src is used to only
compose the parts of the swizzle that we know will be used so we don't
compose invalid swizzle components.  However, we had a bug where we
passed the number of components of the add all the way through.  For the
given source, we need the number of components read from that source.
In the case where we have a narrow add, say 2 components, that is
sourced from a chain of wider instructions, we may not compose all the
swizzles.  All we really need to do is pass through the right number of
components at each level.

Fixes: 2231cf0ba3a "nir: Fix output swizzle in get_mul_for_src"
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
5 years agonir: Allow a non-existent sampler deref in nir_lower_samplers_as_deref
Kenneth Graunke [Thu, 10 Jan 2019 19:10:13 +0000 (11:10 -0800)]
nir: Allow a non-existent sampler deref in nir_lower_samplers_as_deref

GL_ARB_gl_spirv does not provide a sampler deref for e.g. texelFetch(),
so we can't assume that both are present and identical.  Simply lower
each if it is present.

Fixes regressions in GL_ARB_gl_spirv tests since I switched everyone to
using this pass.  Thanks to Alejandro Piñeiro for catching these.

Fixes: f003859f97c nir: Make gl_nir_lower_samplers use gl_nir_lower_samplers_as_deref
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agotravis: avoid using unset llvm-config
Eric Engestrom [Wed, 2 Jan 2019 12:28:48 +0000 (12:28 +0000)]
travis: avoid using unset llvm-config

Fixes the following errors:
  usage: which [-as] program ...
  /Users/travis/.travis/job_stages: line 110: --version: command not found

... caused by the use of an undefined $LLVM_CONFIG

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoegl: remove unused include
Eric Engestrom [Wed, 16 May 2018 13:18:02 +0000 (14:18 +0100)]
egl: remove unused include

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoegl: add missing includes
Eric Engestrom [Wed, 16 May 2018 13:17:30 +0000 (14:17 +0100)]
egl: add missing includes

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoanv/pipeline_cache: fix incorrect guards for NIR cache
Iago Toral Quiroga [Fri, 11 Jan 2019 10:41:01 +0000 (11:41 +0100)]
anv/pipeline_cache: fix incorrect guards for NIR cache

Fixes: f6aa9f718516 'anv/pipeline_cache: Add support for caching NIR'
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoblorp: Pass the batch to lookup/upload_shader instead of context
Kenneth Graunke [Wed, 9 Jan 2019 23:15:49 +0000 (15:15 -0800)]
blorp: Pass the batch to lookup/upload_shader instead of context

This will allow drivers to pin shader buffers if necessary.

i965 and anv do not need to do this today, but iris will.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoblorp: Add blorp_get_surface_address to the driver interface.
Kenneth Graunke [Wed, 9 Jan 2019 21:31:18 +0000 (13:31 -0800)]
blorp: Add blorp_get_surface_address to the driver interface.

Currently, BLORP expects drivers to provide two functions for dealing
with buffers: blorp_emit_reloc and blorp_surface_reloc.  Both record a
relocation and combine the BO address and offset into a full 64-bit
address.  Traditionally, blorp_surface_reloc has written that combined
address to an implicitly-known buffer where surface states are stored.
(In contrast, blorp_emit_reloc returns the value.)

The upcoming Iris driver stores surface states in multiple buffers,
which makes it impossible for blorp_surface_reloc to write the combined
address - it only takes an offset, not the actual buffer to write to.

This commit adds a third function, blorp_get_surface_address, which
combines and returns an address, which is then passed to ISL's surface
state fill functions.  Softpin-only drivers can return a real address
here and skip writing it in blorp_surface_reloc.  Relocation-based
drivers are have options.  They can simply return 0 from the new
function, and continue writing the address from blorp_surface_reloc.
Or, they can return a presumed address from blorp_get_surface_address,
and have other relocation processing write the real value later.

For now, i965 and anv simply return 0.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agodocs: fix gallium screen cap docs
Ilia Mirkin [Thu, 27 Dec 2018 01:57:18 +0000 (20:57 -0500)]
docs: fix gallium screen cap docs

Make sure that the next line starts with spaces so that bullets are
maintained throughout, add `` around a few more special tokens, and fix
SAMPLE_COUNT_TEXTURE -> SAMPLE_COUNT.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoglsl: Make invariant outputs in ES fragment shader not to cause error
Danylo Piliaiev [Wed, 5 Sep 2018 12:26:48 +0000 (15:26 +0300)]
glsl: Make invariant outputs in ES fragment shader not to cause error

In all GLSL ES versions output variables in fragment shader are allowed
to be invariant.

 From Section 4.6.1 ("The Invariant Qualifier") GLSL ES 1.00 spec:
 "Only the following variables may be declared as invariant:
   ...
   - Built-in special variables output from the fragment shader."

 From Section 4.6.1 ("The Invariant Qualifier") GLSL ES 3.00 spec:
 "Only variables output from a shader can be candidates for invariance."

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107842

5 years agoanv/pipeline: Cache the pre-lowered NIR
Jason Ekstrand [Fri, 12 Oct 2018 22:54:41 +0000 (17:54 -0500)]
anv/pipeline: Cache the pre-lowered NIR

This adds a second level of caching for the pre-lowered NIR that's only
based off of the shader module, entrypoint and specialization constants.
This is enough for spirv_to_nir as well as our first round of lowering
and optimization.  Caching at this level should allow for faster shader
recompiles due to state changes.

The NIR caching does not get serialized to disk via either the
VkPipelineCache serialization mechanism or the transparent on-disk
cache.  We could but it's usually not that expensive to fall back to
SPIR-V for the odd cache miss especially if it only happens once for
several misses and it simplifies the cache.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv/pipeline_cache: Add support for caching NIR
Jason Ekstrand [Fri, 12 Oct 2018 22:40:21 +0000 (17:40 -0500)]
anv/pipeline_cache: Add support for caching NIR

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv/pipeline: Hash shader modules and spec constants separately
Jason Ekstrand [Fri, 12 Oct 2018 22:01:24 +0000 (17:01 -0500)]
anv/pipeline: Hash shader modules and spec constants separately

The stuff hashed by anv_pipeline_hash_shader is exactly the inputs to
anv_shader_compile_to_nir so it can be used for NIR caching.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agocompiler/types: Serialize/deserialize subpass input types correctly
Jason Ekstrand [Sat, 13 Oct 2018 00:03:30 +0000 (19:03 -0500)]
compiler/types: Serialize/deserialize subpass input types correctly

They have glsl_sampler_dim enum values of 8 and 9 which don't work when
you & them with 0x7.  Fortunately, we have plenty of bits.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv/pipeline: Move wpos and input attachment lowering to lower_nir
Jason Ekstrand [Wed, 29 Aug 2018 21:40:05 +0000 (16:40 -0500)]
anv/pipeline: Move wpos and input attachment lowering to lower_nir

This lets us make anv_pipeline_compile_to_nir take a device instead of a
pipeline.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoi965: Compile fp64 funcs only if we do not have 64-bit hardware support
Matt Turner [Thu, 10 Jan 2019 23:14:35 +0000 (15:14 -0800)]
i965: Compile fp64 funcs only if we do not have 64-bit hardware support

Brown bag fix...

5 years agoanv/pipeline: Constant fold after apply_pipeline_layout
Jason Ekstrand [Thu, 10 Jan 2019 07:47:14 +0000 (01:47 -0600)]
anv/pipeline: Constant fold after apply_pipeline_layout

Thanks to the new NIR load_descriptor intrinsic added by the UBO/SSBO
lowering series, we weren't getting UBO pushing because the UBO range
detection pass couldn't see the constants it needed.  This fixes that
problem with a quick round of constant folding.  Because we're folding
we no longer need to go out of our way to generate constants when we
lower the vulkan_resource_index intrinsic and we can make it a bit
simpler.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agofreedreno/a6xx: fix 3d+tiled layout
Rob Clark [Thu, 3 Jan 2019 15:10:28 +0000 (10:10 -0500)]
freedreno/a6xx: fix 3d+tiled layout

The last round of fixing 3d layer+level layout skipped the tiled case,
since tiled texture support was not in place yet.  This finishes the
job.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/a6xx: move tile_mode to sampler-view CSO
Rob Clark [Thu, 3 Jan 2019 14:27:58 +0000 (09:27 -0500)]
freedreno/a6xx: move tile_mode to sampler-view CSO

This is known when the CSO is created, so no need to patch it in later.

Also, it seems like smaller textures where the first level is small
enough to be linear, it seems like we should set linear tile mode.

See: dEQP-GLES3.functional.texture.format.unsized.rgb_unsigned_byte_3d_pot

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/a6xx: separate stencil restore/resolve fixes
Rob Clark [Thu, 10 Jan 2019 13:32:51 +0000 (08:32 -0500)]
freedreno/a6xx: separate stencil restore/resolve fixes

Previously we'd use format/etc from the primary (z32) buffer for the
stencil (s8), due to confusion about rsc vs psurf.  Rework this to drop
extra arg and push down handling of separate stencil case (and make sure
we take the fmt from the right place).

This doesn't completely fix separate-stencil, but at least it avoids the
GPU scribbling over random other cmdstream buffers and causing a bunch
of bogus fails in dEQP.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno: make cmdstream bo's read-only to GPU
Rob Clark [Wed, 9 Jan 2019 18:03:43 +0000 (13:03 -0500)]
freedreno: make cmdstream bo's read-only to GPU

If nothing else, this will make problems with cmdstream getting blit
over with pixels easier to track down (ie. faults when it first happens
rather than strange failures later from corrupted cmdstream when a
stateobj is later reused).

(NOTE this somewhat depends on the kernel supporting the flag, and the
iommu implementation.  But the worst case is just that the cmdstream
ends up writeable as before.)

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agoetnaviv: fix typo in cflush_all description
Guido Günther [Mon, 7 Jan 2019 14:00:00 +0000 (15:00 +0100)]
etnaviv: fix typo in cflush_all description

Signed-off-by: Guido Günther <guido.gunther@puri.sm>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
5 years agoradv: remove a few more unnecessary KHR suffixes
Eric Engestrom [Wed, 9 Jan 2019 12:11:48 +0000 (12:11 +0000)]
radv: remove a few more unnecessary KHR suffixes

Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v1)
5 years agonir: fix copy-paste error in nir_lower_constant_initializers
Rhys Perry [Thu, 10 Jan 2019 11:23:04 +0000 (11:23 +0000)]
nir: fix copy-paste error in nir_lower_constant_initializers

Fixes: 393b59e0772e7bf0426bdf61c740752c4e09dde1
    ('nir: Rework nir_lower_constant_initializers() to handle functions')
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agodocs: complete the calendar and release schedule documentation
Andres Gomez [Mon, 7 Jan 2019 17:04:34 +0000 (19:04 +0200)]
docs: complete the calendar and release schedule documentation

As suggested by Emil Velikov.

Cc: Dylan Baker <dylan.c.baker@intel.com>
Cc: Juan A. Suarez <jasuarez@igalia.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
5 years agoglsl/linker: specify proper direction in location aliasing error
Andres Gomez [Mon, 7 Jan 2019 14:11:44 +0000 (16:11 +0200)]
glsl/linker: specify proper direction in location aliasing error

The check for location aliasing was always asuming output variables
but this validation is also called for input variables.

Fixes: e2abb75b0e4 ("glsl/linker: validate explicit locations for SSO programs")
Cc: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
5 years agoeditorconfig: Add max_line_length property
Andres Gomez [Mon, 7 Jan 2019 13:49:00 +0000 (15:49 +0200)]
editorconfig: Add max_line_length property

The property is supported by the most of the editors, but not all:
https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#max_line_length

Cc: Eric Engestrom <eric@engestrom.ch>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agointel/isl: move tiled_memcpy static libs from i965 to isl
Tapani Pälli [Mon, 17 Dec 2018 12:17:15 +0000 (14:17 +0200)]
intel/isl: move tiled_memcpy static libs from i965 to isl

Patch moves intel_tiled_memcpy[_sse41] libraries to isl, renames some
functions and types and makes the required build system changes for
meson, automake and Android. No functional changes are introduced.

v2: code cleanups, move isl_get_memcpy_type to i965 (Jason)
v3: move isl_mem_copy_fn to priv header, cleanups (Jason, Dylan)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoi965: Enable 64-bit GLSL extensions
Matt Turner [Thu, 18 Oct 2018 16:51:51 +0000 (09:51 -0700)]
i965: Enable 64-bit GLSL extensions

Now that we have software implementations of ARB_gpu_shader_int64 and
ARB_gpu_shader_fp64 we can unconditionally enable these extensions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoi965: Compile fp64 software routines and lower double-ops
Matt Turner [Mon, 10 Dec 2018 19:06:16 +0000 (11:06 -0800)]
i965: Compile fp64 software routines and lower double-ops

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/compiler: Heap-allocate temporary storage
Matt Turner [Mon, 10 Dec 2018 19:50:55 +0000 (11:50 -0800)]
intel/compiler: Heap-allocate temporary storage

Shaders containing software implementations of double-precision
operations can be very large such that we cannot stack-allocate
an array of grf_count*16.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/compiler: Expand size of the 'nr' field
Matt Turner [Mon, 10 Dec 2018 19:48:54 +0000 (11:48 -0800)]
intel/compiler: Expand size of the 'nr' field

Shaders containing software implementations of double-precision
operations can be very large such that we have more the 2^16 virtual
registers during optimization.

Move the 'nr' field to the union containing the immediate storage and
expand it to 32-bits.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/compiler: Prevent warnings in the following patch
Matt Turner [Mon, 10 Dec 2018 22:49:49 +0000 (14:49 -0800)]
intel/compiler: Prevent warnings in the following patch

The next patch replaces an unsigned bitfield with a plain unsigned,
which triggers gcc to begin warning on signed/unsigned comparisons.

Keeping this patch separate from the actual move allows bisectablity and
generates no additional warnings temporarily.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/compiler: Rearrange code to avoid future problems
Matt Turner [Wed, 12 Dec 2018 06:04:42 +0000 (22:04 -0800)]
intel/compiler: Rearrange code to avoid future problems

A follow on commit will move nr to the same union as the immediate
data, so we should assert these invariants before we overwrite the nr
field.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/compiler: Avoid false positive assertions
Matt Turner [Mon, 10 Dec 2018 19:42:44 +0000 (11:42 -0800)]
intel/compiler: Avoid false positive assertions

A follow on patch will move the 'nr' field to the union containing the
immediate field, so prepare by checking that we're only testing these
assertions if the .file is correct.

The assertions with != ARF were kind of silly to begin with because the
<128 check is specifically only for things in the GRF.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/compiler: Split 64-bit MOV-indirects if needed
Matt Turner [Tue, 27 Nov 2018 19:20:20 +0000 (11:20 -0800)]
intel/compiler: Split 64-bit MOV-indirects if needed

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/compiler: Lower 64-bit MOV/SEL operations
Matt Turner [Thu, 11 Oct 2018 16:55:38 +0000 (09:55 -0700)]
intel/compiler: Lower 64-bit MOV/SEL operations

5 years agonir: Unset metadata debug bit if no progress made
Matt Turner [Mon, 10 Sep 2018 21:31:29 +0000 (14:31 -0700)]
nir: Unset metadata debug bit if no progress made

NIR metadata validation verifies that the debug bit was unset (by a call
to nir_metadata_preserve) if a NIR optimization pass made progress on
the shader. With the expectation that the NIR shader consists of only a
single main function, it has been safe to call nir_metadata_preserve()
iff progress was made.

However, most optimization passes calculate progress per-function and
then return the union of those calculations. In the case that an
optimization pass makes progress only on a subset of the functions in
the shader metadata validation will detect the debug bit is still set on
any unchanged functions resulting in a failed assertion.

This patch offers a quick solution (short of a larger scale refactoring
which I do not wish to undertake as part of this series) that simply
unsets the debug bit on unchanged functions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: Add lowering support for 64-bit operations to software
Matt Turner [Mon, 10 Dec 2018 19:05:02 +0000 (11:05 -0800)]
nir: Add lowering support for 64-bit operations to software

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: Create nir_builder in nir_lower_doubles_impl()
Matt Turner [Mon, 7 Jan 2019 23:35:31 +0000 (15:35 -0800)]
nir: Create nir_builder in nir_lower_doubles_impl()

We're going to use it more in a future patch, and this avoids a lot of
gross code.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: Add and set info::uses_64bit
Matt Turner [Mon, 10 Dec 2018 19:01:39 +0000 (11:01 -0800)]
nir: Add and set info::uses_64bit

Will be used to communicate that a shader uses 64-bit operations to the
concerned lowering passes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>