mesa.git
5 years agoanv/allocator: Enable snooping on block pool and anv_bo_pool BOs.
Rafael Antognolli [Tue, 15 Jan 2019 21:57:00 +0000 (13:57 -0800)]
anv/allocator: Enable snooping on block pool and anv_bo_pool BOs.

We are not going to use userptr for anv block pool BOs anymore. However,
so far we have been relying on the fact that userptr BOs are snooped on
non-llc platforms. Let's make sure that the block pool BOs are still
snooped, and we can also remove the clflush'ing that we do on all state
buffers.

And since we plan to remove the flushes, set the anv_bo_pool BOs to
cached (snooped on non-LLC platforms) too. For LLC platforms, they are
all cached by default, so this becomes a no-op.

v5:
 - Add snooping to anv_bo_pool BOs too (Jason).
 - Remove anv_gem_set_domain.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Add padding information.
Rafael Antognolli [Tue, 4 Dec 2018 23:37:33 +0000 (15:37 -0800)]
anv/allocator: Add padding information.

It's possible that we still have some space left in the block pool, but
we try to allocate a state larger than that state. This means such state
would start somewhere within the range of the old block_pool, and end
after that range, within the range of the new size.

That's fine when we use userptr, since the memory in the block pool is
CPU mapped continuously. However, by the end of this series, we will
have the block_pool split into different BOs, with different CPU
mapping ranges that are not necessarily continuous. So we must avoid
such case of a given state being part of two different BOs in the block
pool.

This commit solves the issue by detecting that we are growing the
block_pool even though we are not at the end of the range. If that
happens, we don't use the space left at the end of the old size, and
consider it as "padding" that can't be used in the allocation. We update
the size requested from the block pool to take the padding into account,
and return the offset after the padding, which happens to be at the
start of the new address range.

Additionally, we return the amount of padding we used, so the caller
knows that this happens and can return that padding back into a list of
free states, that can be reused later. This way we hopefully don't waste
any space, but also avoid having a state split between two different
BOs.

v3:
 - Calculate offset + padding at anv_block_pool_alloc_new (Jason).
v4:
 - Remove extra "leftover".

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Rework chunk return to the state pool.
Rafael Antognolli [Fri, 7 Dec 2018 00:12:40 +0000 (16:12 -0800)]
anv/allocator: Rework chunk return to the state pool.

This commit tries to rework the code that split and returns chunks back
to the state pool, while still keeping the same logic.

The original code would get a chunk larger than we need and split it
into pool->block_size. Then it would return all but the first one, and
would split that first one into alloc_size chunks. Then it would keep
the first one (for the allocation), and return the others back to the
pool.

The new anv_state_pool_return_chunk() function will take a chunk (with
the alloc_size part removed), and a small_size hint. It then splits that
chunk into pool->block_size'd chunks, and if there's some space still
left, split that into small_size chunks. small_size in this case is the
same size as alloc_size.

The idea is to keep the same logic, but make it in a way we can reuse it
to return other chunks to the pool when we are growing the buffer.

v2:
 - Include Jason's suggestions to the algorithm that returns chunks.
 - Update comments.

v3:
 - Disallow returning 0 blocks (Jason).
 - fix min_size in the loop (Jason).
 - remove temporary variables (Jason)
v4:
 - return_chunk() should never return blocks larger than
 pool->block_size.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: Remove some asserts.
Rafael Antognolli [Wed, 21 Nov 2018 19:41:12 +0000 (11:41 -0800)]
anv: Remove some asserts.

They won't be true anymore once we add support for multiple BOs with
non-userptr.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: Validate the list of BOs from the block pool.
Rafael Antognolli [Fri, 2 Nov 2018 23:06:34 +0000 (16:06 -0700)]
anv: Validate the list of BOs from the block pool.

We now have multiple BOs in the block pool, but sometimes we still
reference only the first one in some instructions, and use relative
offsets in others. So we must be sure to add all the BOs from the block
pool to the validation list when submitting commands.

v2:
   - Don't add block pool BOs to the dependency list right before
   execbuf (Jason)
   - Call anv_execbuf_add_bo() to each BO in the block pools (Jason)
   - Use anv_execbuf_add_bo_set() to add surface state dependencies to
   execbuf.

v3:
   - Add comment to the non-softpin case (Jason).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: Split code to add BO dependencies to execbuf.
Rafael Antognolli [Thu, 13 Dec 2018 16:06:48 +0000 (08:06 -0800)]
anv: Split code to add BO dependencies to execbuf.

This part of the anv_execbuf_add_bo() code is totally independent of the
BO being added. Let's split it out, so we can reuse it later.

v3: rename to anv_execbuf_add_bo_set (Jason).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Add support for a list of BOs in block pool.
Rafael Antognolli [Fri, 7 Dec 2018 19:03:38 +0000 (11:03 -0800)]
anv/allocator: Add support for a list of BOs in block pool.

So far we use only one BO (the last one created) in the block pool. When
we switch to not use the userptr API, we will need multiple BOs. So add
code now to store multiple BOs in the block pool.

This has several implications, the main one being that we can't use
pool->map as before. For that reason we update the getter to find which
BO a given offset is part of, and return the respective map.

v3:
 - Simplify anv_block_pool_map (Jason).
 - Use fixed size array for anv_bo's (Jason)
v4:
 - Respect the order (item, container) in anv_block_pool_foreach_bo
 (Jason).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: Update usage of block_pool->bo.
Rafael Antognolli [Wed, 21 Nov 2018 19:36:49 +0000 (11:36 -0800)]
anv: Update usage of block_pool->bo.

Change block_pool->bo to be a pointer, and update its usage everywhere.
This makes it simpler to switch it later to a list of BOs.

v3:
 - Use a static "bos" field in the struct, instead of malloc'ing it.
 This will be later changed to a fixed length array of BOs.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Remove pool->map.
Rafael Antognolli [Wed, 19 Dec 2018 18:26:44 +0000 (10:26 -0800)]
anv/allocator: Remove pool->map.

After switching to using anv_state_table, there are very few places left
still using pool->map directly. We want to avoid that because it won't
be always the right map once we split it into multiple BOs.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Rename anv_free_list2 to anv_free_list.
Rafael Antognolli [Thu, 20 Dec 2018 18:00:41 +0000 (10:00 -0800)]
anv/allocator: Rename anv_free_list2 to anv_free_list.

Now that we removed the original anv_free_list, we can now use its name.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Remove anv_free_list.
Rafael Antognolli [Fri, 30 Nov 2018 19:59:02 +0000 (11:59 -0800)]
anv/allocator: Remove anv_free_list.

The next commit already renames anv_free_list2 -> anv_free_list since
the old one is gone.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Use anv_state_table on back_alloc too.
Rafael Antognolli [Thu, 29 Nov 2018 22:31:15 +0000 (14:31 -0800)]
anv/allocator: Use anv_state_table on back_alloc too.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Use anv_state_table on anv_state_pool_alloc.
Rafael Antognolli [Thu, 29 Nov 2018 18:49:31 +0000 (10:49 -0800)]
anv/allocator: Use anv_state_table on anv_state_pool_alloc.

Use anv_state_pool_return_blocks() to return blocks to the pool, instead
of manually pushing them.

v3:
 - return blocks from the end of the chunk (Jason).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Add helper to push states back to the state table.
Rafael Antognolli [Tue, 11 Dec 2018 23:37:15 +0000 (15:37 -0800)]
anv/allocator: Add helper to push states back to the state table.

The use of anv_state_table_add() combined with anv_state_table_push(),
specially when adding a bunch of states to the table, is very verbose.
So we add this helper that makes things easier to digest.

We also already add the anv_state_table member in this commit, so things
can compile properly, even though it's not used.

v2: assert that the states are always aligned to their size (Jason)
v3: Add "table" member to anv_state_pool in this commit.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Add getter for anv_block_pool.
Rafael Antognolli [Wed, 21 Nov 2018 19:24:59 +0000 (11:24 -0800)]
anv/allocator: Add getter for anv_block_pool.

We will need the anv_block_pool_map to find the map relative to some BO
that is not at the start of the block pool.

v2: just return a pointer instead of a struct (Jason)
v4: Update comment (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/allocator: Add anv_state_table.
Rafael Antognolli [Wed, 28 Nov 2018 19:43:03 +0000 (11:43 -0800)]
anv/allocator: Add anv_state_table.

Add a structure to hold anv_states. This table will initially be used to
recycle anv_states, instead of relying on a linked list implemented in
GPU memory. Later it could be used so that all anv_states just point to
the content of this struct, instead of making copies of anv_states
everywhere.

One has to call anv_state_table_add(), which returns an index for the
state in the table, and then get a pointer to such index, and finally
fill in the rest of the struct.

TODO:
   1) There's a lot of common code between this table backing store
   memory and the anv_block_pool buffer, due to how we grow it. I think
   it's possible to refactory this and reuse code on both places.

   2) Add unit tests.

v3:
 - Rename state table memfd (Jason)
 - Return VK_ERROR_OUT_OF_HOST_MEMORY on more places (Jason)
 - anv_state_table_grow returns VkResult (Jason)
 - Rename variables to be more informative (Jason)
 - Return errors on state table grow.
 - Rename anv_state_table_push/pop to anv_free_list_push2/pop2
   This will be renamed again to remove the trailing "2" later.

v4:
 - Remove exit(-1) from anv_state_table (Jason).
 - Use uint32_t "next" field in anv_free_entry (Jason).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv/tests: Fix block_pool_no_free test.
Rafael Antognolli [Thu, 29 Nov 2018 00:36:41 +0000 (16:36 -0800)]
anv/tests: Fix block_pool_no_free test.

There were 2 problems with this test.

First it was comparing highest, which was -1, with an uint32_t. So the
current value would never be higher than that, and the assert would
always be false. It just never reached this point because of the next
problem.

It was always looking for the highest value of each thread and storing
it in thread_max. So a test case like this wouldn't work:

[Thread]: [Blocks]
   [0]: [0, 32, 64, 96]
   [1]: [128, 160, 192, 224]
   [2]: [256, 288, 320, 352]

Not only that would skip values and iterate only over thread number 2,
instead of walking through all of them, but thread_max was also
initialized to -1. And then compared to unsigned blocks[i][next[i].

We fix that by getting the smallest value of each thread, and checking
if it is lower than thread_min, which is initialized to INT32_MAX. And
then we end up walking through all the blocks of all threads. We also
change "blocks" to be int32_t instead of uint32_t, since in some places
(alloc_blocks) it was already referenced as int32_t, and that fixes the
comparison to -1.

v2:
 - keep highest initialized to -1, and change blocks to be int32_t.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: fix invalid binding table index computation
Lionel Landwerlin [Thu, 17 Jan 2019 18:19:59 +0000 (18:19 +0000)]
anv: fix invalid binding table index computation

The ++ operator strikes again.

Fixes: f92c5bc8f3f517 ("anv/device: fix maximum number of images supported")
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agodocs: explain how to see what meson options exist
Eric Engestrom [Thu, 17 Jan 2019 16:26:26 +0000 (16:26 +0000)]
docs: explain how to see what meson options exist

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agodocs: update calendar, add news item and link release notes for 18.3.2
Emil Velikov [Thu, 17 Jan 2019 11:37:41 +0000 (11:37 +0000)]
docs: update calendar, add news item and link release notes for 18.3.2

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
5 years agodocs: add sha256 checksums for 18.3.2
Emil Velikov [Thu, 17 Jan 2019 11:30:49 +0000 (11:30 +0000)]
docs: add sha256 checksums for 18.3.2

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 8320a07221a342ea56528a1839ce5b33c8226b36)

5 years agodocs: add release notes for 18.3.2
Emil Velikov [Thu, 17 Jan 2019 11:24:36 +0000 (11:24 +0000)]
docs: add release notes for 18.3.2

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 95a3b709c0d4618d900f8b8bed429ee4f786fab2)

5 years agoanv/device: fix maximum number of images supported
Iago Toral Quiroga [Thu, 10 Jan 2019 12:34:07 +0000 (13:34 +0100)]
anv/device: fix maximum number of images supported

We had defined MAX_IMAGES as 8, which we used to size the array for
image push constant data. The comment there stated that this was for
gen8, but anv_nir_apply_pipeline_layout runs for all gens and writes
that array, asserting that we don't exceed that number of images,
which imposes a limit of MAX_IMAGES on all gens.

Furthermore, despite this, we are exposing up to 64 images per shader
stage on all gens, gen8 included.

This patch lowers the number of images we expose in gen8 to 8 and
keeps 64 images for gen9+ while making sure that only pre-SKL gens
use push constant space to handle images.

v2:
 - <= instead of < in the assert (Eric, Lionel)
 - Change the way the assertion is written (Eric)

v3:
 - Revert the way the assertion is written to the form it had in v1,
   the version in v2 was not equivalent and was incorrect. (Lionel)

v4:
 - gen9+ doesn't need push constants for images at all (Jason)

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v3)
5 years agoanv: do not advertise AHW support if extension not enabled
Tapani Pälli [Wed, 16 Jan 2019 12:15:28 +0000 (14:15 +0200)]
anv: do not advertise AHW support if extension not enabled

Fixes following failing vk-gl-cts cases on Linux desktop:

   dEQP-VK.api.external.memory.android_hardware_buffer.suballocated.buffer.info
   dEQP-VK.api.external.memory.android_hardware_buffer.suballocated.image.info
   dEQP-VK.api.external.memory.android_hardware_buffer.dedicated.image.info
   dEQP-VK.api.external.memory.android_hardware_buffer.dedicated.buffer.info

Fixes: 517103abf1c "anv/android: add ahardwarebuffer external memory properties"
Reported-by: Juan A. Suarez <jasuarez@igalia.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
5 years agovc4: Don't leak the GPU fd for renderonly usage.
Eric Anholt [Wed, 16 Jan 2019 00:02:23 +0000 (16:02 -0800)]
vc4: Don't leak the GPU fd for renderonly usage.

Noticed while debugging V3D -- the ro->gpu_fd was freshly opened in ro
setup, and it needs to stay open until screen close (since it may be used
by renderonly) and should be the same one used by the vc4 screen.

Fixes: 7029ec05e2c7 ("gallium: Add renderonly-based support for pl111+vc4.")
5 years agov3d: Don't leak the GPU fd for renderonly usage.
Eric Anholt [Wed, 16 Jan 2019 00:03:44 +0000 (16:03 -0800)]
v3d: Don't leak the GPU fd for renderonly usage.

The CTS was running out of fds, because of the ro->gpu_fd never being
closed.  ro->gpu_fd should match the screen (in case the caller of
v3d_drm_screen_create_renderonly() has a scanout_for_resource() that uses
gpu_fd) and the screen is expected to close its fd at the end, fixing the
resource leak.

Fixes: e113b21cb779 ("v3d: Add renderonly support.")
5 years agov3d: Restructure RO allocations using resource_from_handle.
Eric Anholt [Tue, 15 Jan 2019 05:44:16 +0000 (21:44 -0800)]
v3d: Restructure RO allocations using resource_from_handle.

I had bugs in the old path where I was laying out as tiled (so we'd render
tiled) but then only allocating space in the shared object for linear
rendering.  The resource_from_handle makes it so the same layout choices
are made in both the import and export scanout cases.  Also, fixes a leak
of the fd that was tripping up the CTS.

Now that we're checking PIPE_BIND_SHARED to choose to use RO, the
DRM_FORMAT_MOD_LINEAR check wasn't needed any more.

Fixes visual corruption and MMU faults in X in renderonly mode.

Fixes: bd09bb1629a7 ("v3d: SHARED but not necessarily SCANOUT buffers on RO must be linear.")
5 years agov3d: If the modifier is not known on BO import, default to linear for RO.
Eric Anholt [Tue, 15 Jan 2019 20:47:02 +0000 (12:47 -0800)]
v3d: If the modifier is not known on BO import, default to linear for RO.

Part of fixing DRI3 rendering with RO on X11.

Fixes: e113b21cb779 ("v3d: Add renderonly support.")
5 years agoac/nir_to_llvm: add support for structs to get_sampler_desc()
Timothy Arceri [Wed, 9 Jan 2019 04:07:51 +0000 (15:07 +1100)]
ac/nir_to_llvm: add support for structs to get_sampler_desc()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir_to_llvm: fix regression in bindless support
Timothy Arceri [Wed, 9 Jan 2019 04:03:36 +0000 (15:03 +1100)]
ac/nir_to_llvm: fix regression in bindless support

This wasn't ported over when deref support was implemented.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoradeonsi/nir: get correct type for images inside structs
Timothy Arceri [Wed, 9 Jan 2019 03:53:52 +0000 (14:53 +1100)]
radeonsi/nir: get correct type for images inside structs

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir_to_llvm: fix type handling in image code
Timothy Arceri [Wed, 9 Jan 2019 02:15:05 +0000 (13:15 +1100)]
ac/nir_to_llvm: fix type handling in image code

The current code only strips off arrays and cannot find the type
for images that are struct members.

Instead of trying to get the image type from the variable, we just
get it directly from the deref instruction.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
5 years agoradv: use dithered alpha-to-coverage
Rhys Perry [Wed, 9 Jan 2019 14:40:15 +0000 (14:40 +0000)]
radv: use dithered alpha-to-coverage

This matches the behaviour of AMDVLK and hides banding.
It is also seems to be allowed by the Vulkan spec.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoswr/rast: Store cached files in multiple subdirs
Alok Hota [Thu, 20 Sep 2018 03:23:15 +0000 (22:23 -0500)]
swr/rast: Store cached files in multiple subdirs

This improves cache filesystem performance, especially during CI tests
Also updated jitcache magic number due to codegen parameter changes
Removed 2 `if constexpr` to prevent C++17 requirement

5 years agoswr/rast: New execution engine per JIT
Alok Hota [Thu, 20 Sep 2018 02:15:51 +0000 (21:15 -0500)]
swr/rast: New execution engine per JIT

Fixes relocation errors with LLVM 7.0.0

5 years agoswr/rast: Scope MEM_CLIENT enum for mem usages
Alok Hota [Fri, 7 Sep 2018 00:58:53 +0000 (19:58 -0500)]
swr/rast: Scope MEM_CLIENT enum for mem usages

Avoids confusion with other defaulted integer parameters

- fixed some unspecified usages
- removed unnecessary includes
- removed unecessary protected access specifier in buckets framework

5 years agoswr/rast: Unaligned and translations in gathers
Alok Hota [Thu, 30 Aug 2018 22:45:06 +0000 (17:45 -0500)]
swr/rast: Unaligned and translations in gathers

- added graphics address translation in odd gathers
- added support for unaligned gathers in fetch shader
- changed how 2+ GB offsets are handled to make them compatible with
unaligned offsets

5 years agoswr/rast: partial support for Tiled Resources
Alok Hota [Thu, 23 Aug 2018 23:42:25 +0000 (18:42 -0500)]
swr/rast: partial support for Tiled Resources

- updated sample from TRTT surfaces correctly
- implemented mapped status return for TRTT surfaces
- implemented per-sample instruction minLod clamp
- updated bilinear filter weight calculation to be closer to D3D specs
- implemented "ReducedTexcoordRange" operation from D3D specs to avoid
loss of precision on high-value normalized coordinates

5 years agoswr/rast: Add annotator to interleave isa text
Alok Hota [Tue, 14 Aug 2018 07:42:13 +0000 (02:42 -0500)]
swr/rast: Add annotator to interleave isa text

To make debugging simpler

5 years agoswr/rast: Use gfxptr_t value in JitGatherVertices
Alok Hota [Mon, 9 Jul 2018 21:55:30 +0000 (16:55 -0500)]
swr/rast: Use gfxptr_t value in JitGatherVertices

Use gfxptr_t type value for stream pointer uses in gather and similar
calls

5 years agoautotools: Deprecate the use of autotools
Gert Wollny [Sun, 16 Dec 2018 11:23:52 +0000 (12:23 +0100)]
autotools: Deprecate the use of autotools

Since Meson will eventually be the only build system deprecate autotools
now. It can still be used by invoking configure with the flag
  --enable-autotools

NAKed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
5 years agomeson: allow building dri driver without window system if osmesa is classic
Dylan Baker [Tue, 15 Jan 2019 19:55:36 +0000 (11:55 -0800)]
meson: allow building dri driver without window system if osmesa is classic

This was already enabled for gallium based osmesa with gallium drivers
in 9d10581897ef7cfa0f6c392e2048cc04357281b9, so do the same for classic
driver with classic osmesa.

Fixes: cbbd5bb889a2c271a504c379f36a7cb717a85af4
       ("meson: build classic osmesa")
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
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>