platform/upstream/mesa.git
3 years agozink: always defer image descriptor barriers
Mike Blumenkrantz [Wed, 7 Apr 2021 14:55:49 +0000 (10:55 -0400)]
zink: always defer image descriptor barriers

this is simpler and guaranteed to be accurate

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11393>

3 years agozink: use fake buffer barriers for descriptors
Mike Blumenkrantz [Wed, 7 Apr 2021 14:49:39 +0000 (10:49 -0400)]
zink: use fake buffer barriers for descriptors

GL requires explicit glMemoryBarrier calls for shader synchronization
and only calls that map/copy buffers get implicit sync, so we don't actually
need barriers for any of these cases, only the state needs to be updated

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11393>

3 years agozink: check actual mem props to determine if resource object is coherent
Mike Blumenkrantz [Thu, 6 May 2021 16:55:07 +0000 (12:55 -0400)]
zink: check actual mem props to determine if resource object is coherent

this was correct for what it has been used for until now, but it will no
longer be correct going forward

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397>

3 years agozink: key alloc cache on heap index, not heap flags
Mike Blumenkrantz [Thu, 6 May 2021 14:59:50 +0000 (10:59 -0400)]
zink: key alloc cache on heap index, not heap flags

this is a bit more sane

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397>

3 years agozink: avoid caching visible vram allocations
Mike Blumenkrantz [Thu, 6 May 2021 13:52:08 +0000 (09:52 -0400)]
zink: avoid caching visible vram allocations

the visible vram heap is potentially going to be limited in size, so avoid
caching these allocations since that locks them to a given allocation size

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397>

3 years agozink: change a bunch of sparse buffer resource checks to host-visible checks
Mike Blumenkrantz [Thu, 6 May 2021 13:51:02 +0000 (09:51 -0400)]
zink: change a bunch of sparse buffer resource checks to host-visible checks

(sparse buffer) is a subset of !host-visible, and !host-visible is actually the
more correct check to be using

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397>

3 years agozink: collapse host_visible and non-coherent alignment alloc cases
Mike Blumenkrantz [Thu, 6 May 2021 13:48:55 +0000 (09:48 -0400)]
zink: collapse host_visible and non-coherent alignment alloc cases

* buffers can use normal mem prop checking to determine host_visible setting
* sparse buffers are never coherent, so this case can be dropped from the conditional

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397>

3 years agocompiler/glsl: Use mutex lock while freeing up mem_ctx
Martin Krastev [Tue, 15 Jun 2021 19:18:31 +0000 (12:18 -0700)]
compiler/glsl: Use mutex lock while freeing up mem_ctx

builtin_builder::~builtin_builder() and builtin_builder::release()
are running into race condition. This leads lightsmark to crash at
the end because both calls ralloc_free which mutates the arguments state

This patch fixes lightsmark2008 crash

Fixes: e4da8b9c331cc3a ("mesa/compiler: rework tear down of builtin/types")

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11385>

3 years agozink: mark some functions inline
Mike Blumenkrantz [Thu, 15 Apr 2021 12:59:16 +0000 (08:59 -0400)]
zink: mark some functions inline

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11429>

3 years agoir3/ra: Fix array parallelcopy confusion
Connor Abbott [Wed, 16 Jun 2021 13:55:30 +0000 (15:55 +0200)]
ir3/ra: Fix array parallelcopy confusion

With array registers, there are two num's we care about:

1. The base num that the whole array starts at (->array.base)
2. The num that the instruction uses, plus possibly an indirect offset
   (->num or ->array.offset)

For parallel copies we always copy the whole array, so (2) is irrelevant
here. For phis and parallel copies inserted for phis, we used
assign_reg() which assigned ->array.base, but we forgot about this when
constructing our own parallel copies for live range splitting, just
setting ->num instead. The parallel copy lowering was also inconsistent
here, using ra_reg_get_num() (which looks at ->array.base for arrays)
for sources but looking at ->num directly for destinations. This makes
everything use ->array.base consistently.

While we're here, make sure to remove IR3_REG_SSA from liveout copies to
make sure printing works correctly.

Fixes: 0ffcb19 ("ir3: Rewrite register allocation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11422>

3 years agoir3: Improve printing of array parallelcopies/phis
Connor Abbott [Wed, 16 Jun 2021 13:50:56 +0000 (15:50 +0200)]
ir3: Improve printing of array parallelcopies/phis

Normally something with IR3_REG_ARRAY doesn't have a register assigned,
but we keep IR3_REG_ARRAY for parallel copies after RA because we need
to know the appropriate size. We want to see the register assigned for
these when printing the RA result before parallel copies are lowered.
The register is in ->array.base in this case, so initialize it to
INVALID_REG and print ->array.base if it's been assigned to something,
similar to ->num in the normal case.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11422>

3 years agoshader_enums: change VERT_BIT back to the 32-bit shift
Marek Olšák [Tue, 25 May 2021 20:27:30 +0000 (16:27 -0400)]
shader_enums: change VERT_BIT back to the 32-bit shift

This reverts 0e2566a8. The warning is fixed differently.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10993>

3 years agogallium/pb: change alignment to 32 bits
Marek Olšák [Tue, 25 May 2021 20:28:47 +0000 (16:28 -0400)]
gallium/pb: change alignment to 32 bits

This partially reverts 4a3f0444. The warning is fixed differently.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10993>

3 years agoradeonsi: remove -Wstrict-overflow=0 since it doesn't seem to be needed
Marek Olšák [Wed, 16 Jun 2021 17:16:23 +0000 (13:16 -0400)]
radeonsi: remove -Wstrict-overflow=0 since it doesn't seem to be needed

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11384>

3 years agoradeonsi: remove the chip_class dimension from the draw_vbo array
Marek Olšák [Mon, 14 Jun 2021 01:13:39 +0000 (21:13 -0400)]
radeonsi: remove the chip_class dimension from the draw_vbo array

We don't use/initialize draw_vbo callbacks for other generations anymore.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11384>

3 years agoradeonsi: compile si_state_draw.cpp for each gfx generation separately
Marek Olšák [Mon, 14 Jun 2021 01:12:22 +0000 (21:12 -0400)]
radeonsi: compile si_state_draw.cpp for each gfx generation separately

It makes compilating faster.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11384>

3 years agoradeonsi: move a few functions from si_state_draw.cpp into si_gfx_cs.c
Marek Olšák [Mon, 14 Jun 2021 01:04:42 +0000 (21:04 -0400)]
radeonsi: move a few functions from si_state_draw.cpp into si_gfx_cs.c

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11384>

3 years agovenus: remove workarounds for multi-planar format interop
Yiwei Zhang [Wed, 9 Jun 2021 23:05:50 +0000 (23:05 +0000)]
venus: remove workarounds for multi-planar format interop

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11282>

3 years agoanv: fix build errors after commit 8b7ff78
Yiwei Zhang [Tue, 15 Jun 2021 05:39:39 +0000 (05:39 +0000)]
anv: fix build errors after commit 8b7ff78

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11373>

3 years agoradv: fix build errors after commit 8b7ff784
Yiwei Zhang [Tue, 15 Jun 2021 05:34:15 +0000 (05:34 +0000)]
radv: fix build errors after commit 8b7ff784

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11373>

3 years agozink: ci updates
Mike Blumenkrantz [Wed, 16 Jun 2021 17:54:23 +0000 (13:54 -0400)]
zink: ci updates

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11391>

3 years agozink: support more RGBX formats
Mike Blumenkrantz [Fri, 2 Apr 2021 15:59:20 +0000 (11:59 -0400)]
zink: support more RGBX formats

the base formats are supported, so these should fall into place naturally

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11391>

3 years agozink: also nope out of any dst alpha blends for rgbx formats
Mike Blumenkrantz [Tue, 13 Apr 2021 18:56:08 +0000 (14:56 -0400)]
zink: also nope out of any dst alpha blends for rgbx formats

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11391>

3 years agozink: smash dstAlphaBlendFactor to ZERO for RGBX attachments
Mike Blumenkrantz [Wed, 7 Apr 2021 15:00:25 +0000 (11:00 -0400)]
zink: smash dstAlphaBlendFactor to ZERO for RGBX attachments

this is a no-op

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11391>

3 years agozink: add a more direct check for rgbx formats in create_sampler_view hook
Mike Blumenkrantz [Fri, 2 Apr 2021 17:34:26 +0000 (13:34 -0400)]
zink: add a more direct check for rgbx formats in create_sampler_view hook

really the point of this is to clamp void channels for any permutation of rgbx
where all channels are the same (e.g., both rgbx8 and rgbx16), so the previous
helper isn't inclusive enough

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11391>

3 years agoutil/queue: add a global data pointer for the queue object
Mike Blumenkrantz [Wed, 9 Jun 2021 22:14:29 +0000 (18:14 -0400)]
util/queue: add a global data pointer for the queue object

this better enables object-specific (e.g., context) queues where the owner
of the queue will always be needed and various pointers will be passed in
for tasks

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11312>

3 years agoradeonsi: set desc[3] of all buffer descriptors at context creation
Marek Olšák [Sun, 13 Jun 2021 18:11:27 +0000 (14:11 -0400)]
radeonsi: set desc[3] of all buffer descriptors at context creation

instead of at bind time. When we unbind, we shouldn't memset the last
element.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11340>

3 years agoradeonsi: remove no-op unref in si_set_constant_buffer
Marek Olšák [Sun, 13 Jun 2021 17:58:16 +0000 (13:58 -0400)]
radeonsi: remove no-op unref in si_set_constant_buffer

buffer is already NULL here

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11340>

3 years agoradeonsi: restructure si_set_sampler_views for faster unbinding trailing slots
Marek Olšák [Sun, 6 Jun 2021 12:34:56 +0000 (08:34 -0400)]
radeonsi: restructure si_set_sampler_views for faster unbinding trailing slots

si_set_sampler_view updates only one slot. This rewrites it to update
multiple slots.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11340>

3 years agoradeonsi: don't clear register fields in si_set_mutable_tex_desc_fields
Marek Olšák [Sun, 6 Jun 2021 11:35:00 +0000 (07:35 -0400)]
radeonsi: don't clear register fields in si_set_mutable_tex_desc_fields

They are always initialized to 0.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11340>

3 years agoradeonsi: use the restrict keyword to set sampler view descriptors faster
Marek Olšák [Sun, 6 Jun 2021 11:17:53 +0000 (07:17 -0400)]
radeonsi: use the restrict keyword to set sampler view descriptors faster

All places must set restrict for the same pointer.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11340>

3 years agoradeonsi: check is_buffer once instead of 4 times in si_set_sampler_view_desc
Marek Olšák [Sun, 6 Jun 2021 10:45:48 +0000 (06:45 -0400)]
radeonsi: check is_buffer once instead of 4 times in si_set_sampler_view_desc

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11340>

3 years agozink: do not check buffer-format for usage-bits
Erik Faye-Lund [Wed, 16 Jun 2021 09:29:45 +0000 (02:29 -0700)]
zink: do not check buffer-format for usage-bits

Buffers are created without a format in Vulkan, and we always pass in
R8_UNORM for them in Gallium. It's the view-formats we should have
checked, if anything.

But that's orthogonal to this. We shoudn't keep checking R8_UNORM
capabilities for buffers, all it's going to do is trigger asserts.

Fixes: 00dc0036b ("zink: flatten out buffer creation usage flags codepath")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11416>

3 years agozink: drop repeated usage-bit
Erik Faye-Lund [Wed, 16 Jun 2021 08:51:07 +0000 (01:51 -0700)]
zink: drop repeated usage-bit

We already set this bit unconditionally right before, no point in
repeating it.

Fixes: 00dc0036b ("zink: flatten out buffer creation usage flags codepath")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11416>

3 years agozink: remove unused function
Erik Faye-Lund [Wed, 16 Jun 2021 13:13:28 +0000 (15:13 +0200)]
zink: remove unused function

There's no call-sites to this function, so let's drop it.

Fixes: e4e20556d62 ("zink: switch to memory barriers instead of actual buffer barriers")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11421>

3 years agozink: fixup signedness of subtraction
Erik Faye-Lund [Wed, 16 Jun 2021 13:09:09 +0000 (15:09 +0200)]
zink: fixup signedness of subtraction

I'm not even going to pretend that I grok this code, but since we take
the abs value, it's pretty obvious that we meant to use a signed value
here. So let's cast the two operands to int before we subtract.

This was noticed by the following clang warning:

---8<---
../src/gallium/drivers/zink/zink_context.c:3284:14: warning: taking the
absolute value of unsigned type 'unsigned int' has no effect
[-Wabsolute-value]
      last = abs(reads - writes) > UINT32_MAX / 2 ? MIN2(reads, writes) : MAX2(reads, writes);
             ^
---8<---

Fixes: 0c1fe392e8d ("zink: implement a tc is_resource_busy hook")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11421>

3 years agozink: move queue init to screen creation
Mike Blumenkrantz [Thu, 6 May 2021 20:41:36 +0000 (16:41 -0400)]
zink: move queue init to screen creation

this is a race condition

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11398>

3 years agozink: set subdata hook as PIPE_MAP_ONCE
Mike Blumenkrantz [Fri, 7 May 2021 23:08:30 +0000 (19:08 -0400)]
zink: set subdata hook as PIPE_MAP_ONCE

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11401>

3 years agozink: update pipe_screen::num_contexts
Mike Blumenkrantz [Thu, 22 Apr 2021 18:52:58 +0000 (14:52 -0400)]
zink: update pipe_screen::num_contexts

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11394>

3 years agoanv: fix dynamic primitive topology for tess
Mike Blumenkrantz [Fri, 11 Jun 2021 21:47:53 +0000 (17:47 -0400)]
anv: fix dynamic primitive topology for tess

this needs to use the pre-converted topology using tess state patch control points

Fixes: f6fa4a80000 ("anv: add support for dynamic primitive topology change")

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11332>

3 years agozink: correct type of flags to flush
Erik Faye-Lund [Wed, 16 Jun 2021 08:49:25 +0000 (01:49 -0700)]
zink: correct type of flags to flush

This type is unsigned in the prototype, so this produces a warning on
MSVC.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>

3 years agozink: use alloca instead of hard-to-size vlas
Erik Faye-Lund [Wed, 16 Jun 2021 08:15:49 +0000 (01:15 -0700)]
zink: use alloca instead of hard-to-size vlas

These variable-length arrays are hard to size statically, and VLAs
aren't supported by MSVC. So let's use alloca instead.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>

3 years agozink: use max-descriptor define
Erik Faye-Lund [Tue, 15 Jun 2021 15:27:43 +0000 (08:27 -0700)]
zink: use max-descriptor define

This avoids compile errors on MSVC due to VLAs.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>

3 years agozink: introduce a define for max descriptors per type
Erik Faye-Lund [Tue, 15 Jun 2021 15:25:34 +0000 (08:25 -0700)]
zink: introduce a define for max descriptors per type

We know what this max is in the compiler, let's move that out into
zink_descriptors.h, so we can reuse the constant.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>

3 years agozink: fix more initializer styles
Erik Faye-Lund [Tue, 15 Jun 2021 15:31:21 +0000 (08:31 -0700)]
zink: fix more initializer styles

Empty initializer lists are a GCC extension, let's use the syntax that
compilers like MSVC also supports.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>

3 years agozink: drop some more vla usage
Erik Faye-Lund [Tue, 15 Jun 2021 15:15:42 +0000 (08:15 -0700)]
zink: drop some more vla usage

MSVC doesn't like them, so let's get rid of more of them.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>

3 years agozink: add missing compiler-dependency
Erik Faye-Lund [Tue, 15 Jun 2021 15:12:38 +0000 (08:12 -0700)]
zink: add missing compiler-dependency

Without this, we depend on something else previously in the build to
have built these.

Fixes: ed2fb809 ("zink: introduce vk_dispatch_table")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>

3 years agozink: drop paranoid code
Erik Faye-Lund [Wed, 16 Jun 2021 09:36:05 +0000 (02:36 -0700)]
zink: drop paranoid code

If we ever get here, res->dt is non-NULL. No need to assert, and no need
to check twice.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11414>

3 years agozink: do not unmap dt-buffers twice
Erik Faye-Lund [Wed, 16 Jun 2021 09:34:18 +0000 (02:34 -0700)]
zink: do not unmap dt-buffers twice

Seems I missed that we already did an unconditional unmap here, and
forgot to remove it. Whoops.

Fixes: 5159f406d ("zink: use gallium api to copy to display-target")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11414>

3 years agozink: split stencil ref changes to separate dirty flag
Mike Blumenkrantz [Thu, 6 May 2021 20:09:10 +0000 (16:09 -0400)]
zink: split stencil ref changes to separate dirty flag

the values here are for the cmdbuf, not the pipeline, so they should
always be updated regardless of what the current dsa state uses

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11396>

3 years agozink: add update flag for dsa state change
Mike Blumenkrantz [Thu, 6 May 2021 19:59:14 +0000 (15:59 -0400)]
zink: add update flag for dsa state change

reduce overhead by avoiding unnecessary updates

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11396>

3 years agozink: add update flag for rasterizer state change
Mike Blumenkrantz [Thu, 6 May 2021 19:58:37 +0000 (15:58 -0400)]
zink: add update flag for rasterizer state change

this can be used to avoid updating related dynamic states too frequently

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11396>

3 years agozink: handle nir_op_pack_64_2x32
Mike Blumenkrantz [Mon, 5 Apr 2021 16:00:04 +0000 (12:00 -0400)]
zink: handle nir_op_pack_64_2x32

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11392>

3 years agov3dv: remove sRGB blending workaround
Charlie [Mon, 14 Jun 2021 21:54:26 +0000 (22:54 +0100)]
v3dv: remove sRGB blending workaround

This reverts commits 4c15131b1d36874b643aed8407933ccd8675841d and
1cf36797bf9d63b33c405d85ce720dcd5e75a47c.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11377>

3 years agov3dv: clamp srgb render targets
Charlie [Mon, 14 Jun 2021 19:19:40 +0000 (20:19 +0100)]
v3dv: clamp srgb render targets

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11377>

3 years agoRevert "v3dv: allow creating uncompressed views from compressed images and vice versa"
Iago Toral Quiroga [Wed, 16 Jun 2021 09:34:18 +0000 (11:34 +0200)]
Revert "v3dv: allow creating uncompressed views from compressed images and vice versa"

This reverts commit b32a48c7e26bffdc696d3cceef0305e2c4731c96.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11415>

3 years agov3dv: don't support VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT
Iago Toral Quiroga [Wed, 16 Jun 2021 09:23:30 +0000 (11:23 +0200)]
v3dv: don't support VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT

The hardware doesn't support this naturally and we need to do a lot
of nasty stuff in the driver to almost make it work.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11415>

3 years agonv50/ir: fix surface lowering when values get shared accross operations
Karol Herbst [Tue, 16 Jun 2020 18:17:55 +0000 (20:17 +0200)]
nv50/ir: fix surface lowering when values get shared accross operations

With nir I encountered the case where the same value can be written to from
multiple surface operations. This caused some weird messups with the unions
as the def.rewrite operations caused unrelated instructions to get new their
value replaced as well.

In order to replace def.rewrite, we have to create a new temp value, write
to that one instead and move to the original value.

Fixes: 869e32593a9 ("gm107/ir: fix loading z offset for layered 3d image bindings")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11053>

3 years agost/mesa: always report the max samples as supported
Ilia Mirkin [Tue, 15 Jun 2021 04:49:02 +0000 (00:49 -0400)]
st/mesa: always report the max samples as supported

This is required by GL. Doing this even when the backend driver does not
support it leads to creating attachments which are not renderable. This
is not ideal, but does pass tests. This covers scenarios such as missing
MSAA for 128-bit formats on Sandybridge, and missing 8x MSAA on 128-bit
formats on NVIDIA Tesla generation boards.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11372>

3 years agozink: stop sanitizing primitive_restart flag in draw info
Mike Blumenkrantz [Tue, 11 May 2021 17:50:14 +0000 (13:50 -0400)]
zink: stop sanitizing primitive_restart flag in draw info

this is a 1bit struct member, sanitizing is pointless

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11408>

3 years agozink: move batch decl to top of draw_vbo
Mike Blumenkrantz [Tue, 11 May 2021 17:49:42 +0000 (13:49 -0400)]
zink: move batch decl to top of draw_vbo

this may still change during descriptor updating, but having the pointer
earlier is helpful

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11408>

3 years agozink: remove unnecessary draw checks
Mike Blumenkrantz [Tue, 11 May 2021 17:49:10 +0000 (13:49 -0400)]
zink: remove unnecessary draw checks

I don't know how/why these got here but they aren't needed

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11408>

3 years agozink: use u_live_shader_cache
Mike Blumenkrantz [Mon, 10 May 2021 10:50:49 +0000 (06:50 -0400)]
zink: use u_live_shader_cache

let the duplicated shader madness end

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11403>

3 years agozink: unify gfx shader create callbacks
Mike Blumenkrantz [Mon, 10 May 2021 10:30:19 +0000 (06:30 -0400)]
zink: unify gfx shader create callbacks

these are identical

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11403>

3 years agozink: mark bind_stage() as inline
Mike Blumenkrantz [Sat, 23 Jan 2021 16:03:52 +0000 (11:03 -0500)]
zink: mark bind_stage() as inline

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11403>

3 years agozink: simplify zink_program_has_descriptors()
Mike Blumenkrantz [Tue, 11 May 2021 16:58:36 +0000 (12:58 -0400)]
zink: simplify zink_program_has_descriptors()

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11407>

3 years agozink: remove return types from program update functions during draw
Mike Blumenkrantz [Tue, 11 May 2021 16:21:10 +0000 (12:21 -0400)]
zink: remove return types from program update functions during draw

also remove some null checks; these add overhead and the app is going to
explode anyway if they fail

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11406>

3 years agozink: slightly refactor program updating during draw
Mike Blumenkrantz [Tue, 11 May 2021 16:18:19 +0000 (12:18 -0400)]
zink: slightly refactor program updating during draw

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11406>

3 years agozink: destroy lazy descriptor pools during batch reset when unused
Mike Blumenkrantz [Sun, 9 May 2021 18:14:53 +0000 (14:14 -0400)]
zink: destroy lazy descriptor pools during batch reset when unused

this should keep resource usage a bit lower

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11404>

3 years agozink: track active use counts for descriptor layouts
Mike Blumenkrantz [Sun, 9 May 2021 17:59:06 +0000 (13:59 -0400)]
zink: track active use counts for descriptor layouts

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11404>

3 years agozink: cache descriptor update templates along with layout
Mike Blumenkrantz [Sun, 9 May 2021 17:56:45 +0000 (13:56 -0400)]
zink: cache descriptor update templates along with layout

this simplifies a bunch of code and just makes more sense given that the
lifetimes should match

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11404>

3 years agocrocus: disable Z16
Dave Airlie [Wed, 16 Jun 2021 03:39:39 +0000 (13:39 +1000)]
crocus: disable Z16

This is disabled on i965 for all pre-gen8, so do the same here.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11409>

3 years agocrocus: fixup render aux usage function.
Dave Airlie [Wed, 16 Jun 2021 03:35:11 +0000 (13:35 +1000)]
crocus: fixup render aux usage function.

This got misaligned somewhere in development, should fix the
regressions vs i965 in tesseract as seen on phoronix benchmarks.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11409>

3 years agozink: make batch_usage_matches take a batch state param
Mike Blumenkrantz [Fri, 7 May 2021 12:57:12 +0000 (08:57 -0400)]
zink: make batch_usage_matches take a batch state param

no functional changes, just some unwinding in some cases

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>

3 years agozink: make batch_usage_set take a batch state param
Mike Blumenkrantz [Fri, 7 May 2021 12:27:02 +0000 (08:27 -0400)]
zink: make batch_usage_set take a batch state param

no functional changes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>

3 years agozink: remove unnecessary conditionals in resource batch tracking
Mike Blumenkrantz [Fri, 7 May 2021 12:23:04 +0000 (08:23 -0400)]
zink: remove unnecessary conditionals in resource batch tracking

this is no longer an atomic op

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>

3 years agozink: unset program batch usage on state reset
Mike Blumenkrantz [Fri, 7 May 2021 12:21:30 +0000 (08:21 -0400)]
zink: unset program batch usage on state reset

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>

3 years agozink: make batch_usage_unset take a batch state param
Mike Blumenkrantz [Fri, 7 May 2021 12:21:02 +0000 (08:21 -0400)]
zink: make batch_usage_unset take a batch state param

no functional changes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>

3 years agozink: remove atomic from batch usage setting
Mike Blumenkrantz [Fri, 7 May 2021 12:15:43 +0000 (08:15 -0400)]
zink: remove atomic from batch usage setting

this shouldn't be necessary since usage can only be set from the context thread
and only needs to be accessed atomically for the cmpxchg when unsetting

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>

3 years agozink: move batch usage functions to static inlines
Mike Blumenkrantz [Fri, 7 May 2021 12:14:53 +0000 (08:14 -0400)]
zink: move batch usage functions to static inlines

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>

3 years agozink: optimize zink_tc_fence struct packing
Mike Blumenkrantz [Fri, 7 May 2021 13:38:45 +0000 (09:38 -0400)]
zink: optimize zink_tc_fence struct packing

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>

3 years agozink: reorder has_barriers flag in batch state struct
Mike Blumenkrantz [Fri, 7 May 2021 13:37:20 +0000 (09:37 -0400)]
zink: reorder has_barriers flag in batch state struct

better struct packing

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>

3 years agozink: split batch state work_count into separate vars
Mike Blumenkrantz [Fri, 7 May 2021 13:37:04 +0000 (09:37 -0400)]
zink: split batch state work_count into separate vars

this has better struct packing

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>

3 years agozink: remove zink_batch_state::descs_used
Mike Blumenkrantz [Fri, 7 May 2021 13:31:45 +0000 (09:31 -0400)]
zink: remove zink_batch_state::descs_used

this is no longer used or needed

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>

3 years agocrocus: fixed some missing WM dirtys.
Dave Airlie [Wed, 16 Jun 2021 00:34:05 +0000 (10:34 +1000)]
crocus: fixed some missing WM dirtys.

This fixes misrendering in ET: legacy.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11390>

3 years agozink: add ZINK_DESCRIPTORS env var to explicitly set a mode
Mike Blumenkrantz [Mon, 29 Mar 2021 21:22:49 +0000 (17:22 -0400)]
zink: add ZINK_DESCRIPTORS env var to explicitly set a mode

currently this supports 3 modes, with the default being a hybrid between
caching and lazy

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: unblock last_set cached descriptor reuse when safe to do so
Mike Blumenkrantz [Mon, 29 Mar 2021 20:40:52 +0000 (16:40 -0400)]
zink: unblock last_set cached descriptor reuse when safe to do so

if no changes at all have occurred to a given set since the last use,
and if the program hasn't changed, then there is no possiblility for
the set to have been invalidated, and so it can immediately be reused

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: skip hash updates for descriptor types which aren't used
Mike Blumenkrantz [Mon, 29 Mar 2021 19:51:08 +0000 (15:51 -0400)]
zink: skip hash updates for descriptor types which aren't used

this is pointless and hurts drawoverhead perf

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: add oob asserts for descriptor set ref setting
Mike Blumenkrantz [Mon, 29 Mar 2021 19:22:19 +0000 (15:22 -0400)]
zink: add oob asserts for descriptor set ref setting

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: enable templated descriptor updates in cache mode
Mike Blumenkrantz [Sun, 28 Mar 2021 16:31:11 +0000 (12:31 -0400)]
zink: enable templated descriptor updates in cache mode

this leverages the template infrastructure from the lazy manager for the
cached mode, alternatively generating a pseudo-template for updates
if real templates aren't available in order to retain 1.0 compatibility

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: move samplerview descset refs to base objects
Mike Blumenkrantz [Sun, 28 Mar 2021 16:50:05 +0000 (12:50 -0400)]
zink: move samplerview descset refs to base objects

this further extends the lifetimes for sets

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: add funcs for descriptor_surface refs
Mike Blumenkrantz [Sun, 28 Mar 2021 16:42:08 +0000 (12:42 -0400)]
zink: add funcs for descriptor_surface refs

this abstracts more code for the cache backend

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: move shader image descriptor set refs to underlying type
Mike Blumenkrantz [Sun, 28 Mar 2021 15:31:56 +0000 (11:31 -0400)]
zink: move shader image descriptor set refs to underlying type

this was kinda useless since it meant that the set was invalidated any
time the shader image was unbound

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: update null sampler/image descriptor surface with is_buffer during hashing
Mike Blumenkrantz [Mon, 29 Mar 2021 19:24:40 +0000 (15:24 -0400)]
zink: update null sampler/image descriptor surface with is_buffer during hashing

this is the only time it might need to be used, so it can be updated naturally here

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: add is_buffer flag to union zink_descriptor_surface
Mike Blumenkrantz [Sun, 28 Mar 2021 15:31:06 +0000 (11:31 -0400)]
zink: add is_buffer flag to union zink_descriptor_surface

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: run lazy batch descriptor functions in cache mode
Mike Blumenkrantz [Sat, 27 Mar 2021 17:19:27 +0000 (13:19 -0400)]
zink: run lazy batch descriptor functions in cache mode

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: unify cached descriptor update code
Mike Blumenkrantz [Thu, 25 Mar 2021 15:26:43 +0000 (11:26 -0400)]
zink: unify cached descriptor update code

this is all pretty much standardized now, so it can be combined into something
simpler

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: move ubo range assert to update_descriptor_state()
Mike Blumenkrantz [Thu, 25 Mar 2021 13:25:31 +0000 (09:25 -0400)]
zink: move ubo range assert to update_descriptor_state()

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: remove sorting for dynamic ubo offset updating
Mike Blumenkrantz [Thu, 25 Mar 2021 13:19:21 +0000 (09:19 -0400)]
zink: remove sorting for dynamic ubo offset updating

if the offsets are assigned in the right order, they don't need to be
ordered later

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>

3 years agozink: modernize cached image descriptor updating
Mike Blumenkrantz [Thu, 25 Mar 2021 13:08:13 +0000 (09:08 -0400)]
zink: modernize cached image descriptor updating

use the auto-updated descriptor info

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>