platform/upstream/mesa.git
17 months agoagx: Respect component in frag load_input
Alyssa Rosenzweig [Thu, 9 Feb 2023 20:05:40 +0000 (15:05 -0500)]
agx: Respect component in frag load_input

Fixes fails in dEQP-GLES31.functional.separate_shader.random.*.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21266>

17 months agoagx: Remove unused AGX_MAX_VARYINGS
Alyssa Rosenzweig [Thu, 9 Feb 2023 20:01:12 +0000 (15:01 -0500)]
agx: Remove unused AGX_MAX_VARYINGS

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21266>

17 months agozink: also replace hash_entry::key when replacing separable program
Mike Blumenkrantz [Sun, 12 Feb 2023 21:58:19 +0000 (16:58 -0500)]
zink: also replace hash_entry::key when replacing separable program

this otherwise still points to the separable program's shader array
and will access freed memory

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

17 months agozink: calloc separable program zink_gfx_library_key struct
Mike Blumenkrantz [Sun, 12 Feb 2023 21:46:40 +0000 (16:46 -0500)]
zink: calloc separable program zink_gfx_library_key struct

this matches other zink_gfx_library_key allocations

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

17 months agozink: implement a scaling descriptor buffer size
Mike Blumenkrantz [Fri, 10 Feb 2023 21:02:03 +0000 (16:02 -0500)]
zink: implement a scaling descriptor buffer size

previously descriptor buffers were sized to allow for 25,000 descriptors

this is a great number.

but in some scenarios it's overkill, and it's theoretically possible that
it might be underkill in others (citation needed), so add some handling
for both cases to save small amounts of vram on average and not crash
in the distant future when hypercomputers try running drawoverhead

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

17 months agozink: store base descriptor size on the screen
Mike Blumenkrantz [Fri, 10 Feb 2023 21:00:16 +0000 (16:00 -0500)]
zink: store base descriptor size on the screen

useful to have this around for reuse

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

17 months agozink: ensure db is bound before separate shader update
Mike Blumenkrantz [Fri, 10 Feb 2023 20:40:44 +0000 (15:40 -0500)]
zink: ensure db is bound before separate shader update

seems unlikely but who knows

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

17 months agozink: move db_bound to batch descriptor data
Mike Blumenkrantz [Fri, 10 Feb 2023 20:34:45 +0000 (15:34 -0500)]
zink: move db_bound to batch descriptor data

this is where descriptor stuff goes

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

17 months agozink: move zink_batch_state::db_bound reset to zink_batch_descriptor_reset()
Mike Blumenkrantz [Fri, 10 Feb 2023 20:32:46 +0000 (15:32 -0500)]
zink: move zink_batch_state::db_bound reset to zink_batch_descriptor_reset()

descriptor code goes in descriptor file

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

17 months agozink: rename a struct member for clarity
Mike Blumenkrantz [Fri, 10 Feb 2023 20:02:29 +0000 (15:02 -0500)]
zink: rename a struct member for clarity

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

17 months agozink: add an io assignment pass for separate shaders
Mike Blumenkrantz [Fri, 10 Feb 2023 18:31:51 +0000 (13:31 -0500)]
zink: add an io assignment pass for separate shaders

usually this is handled by zink_compiler_assign_io() for full pipelines,
where locations are compacted and variables are eliminated, but separate
shaders still need to have "correct" locations set, which can be achieved
by relying on 'location' instead of the (failed) attempt by the frontend
to set 'driver_location' with nir_assign_io_var_locations()

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

17 months agozink: use a single descriptor buffer for all non-bindless types
Mike Blumenkrantz [Fri, 10 Feb 2023 14:49:58 +0000 (09:49 -0500)]
zink: use a single descriptor buffer for all non-bindless types

the descriptor count (buffer size) calculated for buffers was based
on drawoverhead throughput, which is the fastest descriptors can be changed
at the cpu level. these cases demonstrate the maximum speed that ANY
descriptor can be changed, which means that changing multiple types in
a given cmdbuf will, at best, be the same throughput

thus, instead of allocating a separate buffer for each type, only a single
buffer needs to be allocated, and all descriptors can be bound to this buffer

this should reduce descriptor vram usage by ~80%

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

17 months agozink: rework separate shader descriptor iterating
Mike Blumenkrantz [Fri, 10 Feb 2023 15:29:45 +0000 (10:29 -0500)]
zink: rework separate shader descriptor iterating

using the shader struct members is a bit more natural here and
avoids some confusion when one of the stages has no descriptors

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

17 months agozink: flag gfx programs as removed-from-cache by default
Mike Blumenkrantz [Fri, 10 Feb 2023 15:42:24 +0000 (10:42 -0500)]
zink: flag gfx programs as removed-from-cache by default

this fixes some desync where async programs are destroyed before being
added to the cache

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

17 months agozink: assert that the found program matches the expected one in shader_free
Mike Blumenkrantz [Fri, 10 Feb 2023 15:41:50 +0000 (10:41 -0500)]
zink: assert that the found program matches the expected one in shader_free

avoid bugs

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

17 months agozink: don't fetch/update pipeline cache for separate shader programs
Mike Blumenkrantz [Fri, 10 Feb 2023 15:01:40 +0000 (10:01 -0500)]
zink: don't fetch/update pipeline cache for separate shader programs

this is illegal

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

17 months agozink: fix descriptor pool free iterating
Mike Blumenkrantz [Fri, 10 Feb 2023 14:36:30 +0000 (09:36 -0500)]
zink: fix descriptor pool free iterating

these arrays are sparsely allocated, and using pop() on them will
fail to access some elements

Fixes: cf7c17a7af3 ("zink: rework descriptor pool overflow")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21246>

17 months agozink: sync LTO compiles for GPL pipelines on shader free
Mike Blumenkrantz [Fri, 10 Feb 2023 14:01:48 +0000 (09:01 -0500)]
zink: sync LTO compiles for GPL pipelines on shader free

this avoids invalid access

affects:
KHR-Single-GL46.arrays_of_arrays_gl.InteractionStorageBuffers2

Fixes: 41ffb15de56 ("zink: implement async gfx precompile")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21246>

17 months agozink: allocate all batch command buffers in one call
Mike Blumenkrantz [Fri, 10 Feb 2023 13:32:49 +0000 (08:32 -0500)]
zink: allocate all batch command buffers in one call

just simpler

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

17 months agointel/dev: add a default urb value for intel_stub_gpu on dg2
Lionel Landwerlin [Fri, 10 Feb 2023 20:04:57 +0000 (22:04 +0200)]
intel/dev: add a default urb value for intel_stub_gpu on dg2

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21249>

17 months agoradv simplify compiling graphics shaders with a mask of active NIR stages
Samuel Pitoiset [Fri, 10 Feb 2023 10:37:31 +0000 (11:37 +0100)]
radv simplify compiling graphics shaders with a mask of active NIR stages

Instead of recomputing the same bitfield everywhere.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21237>

17 months agoradv: only initialize shader arguments for the active stages
Samuel Pitoiset [Fri, 10 Feb 2023 10:21:28 +0000 (11:21 +0100)]
radv: only initialize shader arguments for the active stages

Other stages don't need to be initialized.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21237>

17 months agoradv: use last_vgt_api_stage for determining the last stage with XFB
Samuel Pitoiset [Fri, 10 Feb 2023 10:32:07 +0000 (11:32 +0100)]
radv: use last_vgt_api_stage for determining the last stage with XFB

It's shorter and cleaner.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21237>

17 months agozink: add a local is_compute var for set_shader_images
Mike Blumenkrantz [Thu, 9 Feb 2023 22:20:54 +0000 (17:20 -0500)]
zink: add a local is_compute var for set_shader_images

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

17 months agozink: pull out image descriptor updating in set_shader_images
Mike Blumenkrantz [Thu, 9 Feb 2023 22:20:06 +0000 (17:20 -0500)]
zink: pull out image descriptor updating in set_shader_images

no functional changes

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

17 months agozink: rework set_shader_images() hook
Mike Blumenkrantz [Thu, 9 Feb 2023 22:15:50 +0000 (17:15 -0500)]
zink: rework set_shader_images() hook

this makes the code more methodical, readable, and correct, fixing a
number of issues along the way:
* inaccurate write_bind_count incrementing
* inaccurate barrier_access write unsetting
* inefficient partial rebinds
* leaking texel buffers

also add some comments to make this clearer

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

17 months agozink: unref image buffer descriptors on unbind
Mike Blumenkrantz [Thu, 9 Feb 2023 21:10:56 +0000 (16:10 -0500)]
zink: unref image buffer descriptors on unbind

Fixes: 7ab5c5d36d2 ("zink: use EXT_descriptor_buffer with ZINK_DESCRIPTORS=db")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21229>

17 months agozink: remove stale comment
Mike Blumenkrantz [Thu, 9 Feb 2023 20:59:04 +0000 (15:59 -0500)]
zink: remove stale comment

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

17 months agozink: unset gfx shader read when unbinding shader images
Mike Blumenkrantz [Thu, 9 Feb 2023 20:53:32 +0000 (15:53 -0500)]
zink: unset gfx shader read when unbinding shader images

this otherwise will never be unset

Fixes: 50e764fa50d ("zink: track gfx/compute descriptor barrier info")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21229>

17 months agozink: rename some variables in zink_set_shader_images()
Mike Blumenkrantz [Thu, 9 Feb 2023 20:20:27 +0000 (15:20 -0500)]
zink: rename some variables in zink_set_shader_images()

this is more consistent with set_sampler_views

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

17 months agoradv: fix importing retained NIR shaders when a lib uses the RETAIN bit
Samuel Pitoiset [Fri, 10 Feb 2023 17:08:53 +0000 (18:08 +0100)]
radv: fix importing retained NIR shaders when a lib uses the RETAIN bit

Fixes couple of GPL regressions with VKCTS, I thought this was test
bugs but it's valid behaviour as long as the libary uses
VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21245>

17 months agoradv: Use common Get*OpaqueCaptureDescriptorDataEXT
Alyssa Rosenzweig [Fri, 10 Feb 2023 00:18:43 +0000 (19:18 -0500)]
radv: Use common Get*OpaqueCaptureDescriptorDataEXT

Now stubbed by the Vulkan runtime for you, deduplicate.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by; Samuel Pitoiset <samuel.pitoiset@gmail.com>

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21230>

17 months agotu,vulkan: Add common Get*OpaqueCaptureDescriptorDataEXT
Alyssa Rosenzweig [Fri, 10 Feb 2023 00:16:22 +0000 (19:16 -0500)]
tu,vulkan: Add common Get*OpaqueCaptureDescriptorDataEXT

In both tu and radv, these are all trivial. Move the trivial implementation from
tu to common code to deduplicate the boilerplate.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by; Samuel Pitoiset <samuel.pitoiset@gmail.com>

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21230>

17 months agoiris: handle error in iris_resource_from_handle
Tapani Pälli [Fri, 10 Feb 2023 08:02:29 +0000 (10:02 +0200)]
iris: handle error in iris_resource_from_handle

In similar manner as fdab8fef7aff we might fail creating resource,
let application handle the error. Application may have given wrong
input pitch when importing dmabuf.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8248
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21233>

17 months agofix(FTBFS): clover: fix LLVM #include of Triple.h, moved to TargetParser
Kai Wasserbäch [Sat, 11 Feb 2023 17:12:01 +0000 (18:12 +0100)]
fix(FTBFS): clover: fix LLVM #include of Triple.h, moved to TargetParser

Upstream moved Triple.h from ADT to TargetParser in LLVM 17.

Reference: https://github.com/llvm/llvm-project/commit/62c7f035b4392c1933550eead6ddab35122720bc
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21262>

17 months agofix(FTBFS): gallivm: fix LLVM #include of Triple.h, moved to TargetParser
Kai Wasserbäch [Sat, 11 Feb 2023 17:10:08 +0000 (18:10 +0100)]
fix(FTBFS): gallivm: fix LLVM #include of Triple.h, moved to TargetParser

Upstream moved Triple.h from ADT to TargetParser in LLVM 17.

Reference: https://github.com/llvm/llvm-project/commit/62c7f035b4392c1933550eead6ddab35122720bc
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21262>

17 months agou_pipe_screen_lookup_or_create: avoid re-querying the fd to have a consistent hash key
Eric Engestrom [Thu, 15 Dec 2022 14:54:51 +0000 (14:54 +0000)]
u_pipe_screen_lookup_or_create: avoid re-querying the fd to have a consistent hash key

In every current driver, the fd we get back from the screen is the fd we
gave to screen_create() three lines above (or a dup() thereof, which we
consider to be the same since we look inside it for the file description
instead).

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agoasahi: use u_pipe_screen_lookup_or_create() to keep track of and reuse screens
Eric Engestrom [Wed, 14 Dec 2022 22:20:57 +0000 (22:20 +0000)]
asahi: use u_pipe_screen_lookup_or_create() to keep track of and reuse screens

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agopanfrost: use u_pipe_screen_lookup_or_create() to keep track of and reuse screens
Eric Engestrom [Tue, 13 Dec 2022 15:49:57 +0000 (15:49 +0000)]
panfrost: use u_pipe_screen_lookup_or_create() to keep track of and reuse screens

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agovc4: use u_pipe_screen_lookup_or_create() to keep track of and reuse screens
Eric Engestrom [Thu, 8 Dec 2022 17:40:27 +0000 (17:40 +0000)]
vc4: use u_pipe_screen_lookup_or_create() to keep track of and reuse screens

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agov3d: use u_pipe_screen_lookup_or_create() to keep track of and reuse screens
Eric Engestrom [Thu, 1 Dec 2022 13:48:17 +0000 (13:48 +0000)]
v3d: use u_pipe_screen_lookup_or_create() to keep track of and reuse screens

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agolima: replace custom code with u_pipe_screen_lookup_or_create()
Eric Engestrom [Tue, 13 Dec 2022 21:02:22 +0000 (21:02 +0000)]
lima: replace custom code with u_pipe_screen_lookup_or_create()

Signed-off-by: Eric Engestrom <eric@igalia.com>
Acked-by: Vasily Khoruzhick <anarsoul@gmail.com>
Acked-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agofreedreno: replace custom code with u_pipe_screen_lookup_or_create()
Eric Engestrom [Tue, 13 Dec 2022 20:52:22 +0000 (20:52 +0000)]
freedreno: replace custom code with u_pipe_screen_lookup_or_create()

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agogallium: move etnaviv screen_lookup_or_create function to common code
Eric Engestrom [Fri, 9 Dec 2022 20:52:15 +0000 (20:52 +0000)]
gallium: move etnaviv screen_lookup_or_create function to common code

Signed-off-by: Eric Engestrom <eric@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agoetnaviv: use simple_mtx to avoid breaking windows in the next commit
Eric Engestrom [Fri, 9 Dec 2022 20:52:15 +0000 (20:52 +0000)]
etnaviv: use simple_mtx to avoid breaking windows in the next commit

Signed-off-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agoutil: avoid calling kcmp on Android
Eric Engestrom [Wed, 1 Feb 2023 17:58:02 +0000 (17:58 +0000)]
util: avoid calling kcmp on Android

On some combinations of Android version and kernel version, calling kcmp
results in seccomp killing the process.

As there doesn't seem to be a way to query for that in advance, skip
this check altogether on Android.

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agogallium/u_screen.h: add missing stdint.h include
Eric Engestrom [Mon, 12 Dec 2022 21:27:06 +0000 (21:27 +0000)]
gallium/u_screen.h: add missing stdint.h include

For uint64_t.

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

17 months agoradv: Implement VK_ACCESS_2_DESCRIPTOR_BUFFER_READ_BIT_EXT.
Hans-Kristian Arntzen [Sun, 12 Feb 2023 15:20:26 +0000 (16:20 +0100)]
radv: Implement VK_ACCESS_2_DESCRIPTOR_BUFFER_READ_BIT_EXT.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Fixes: 46e0c77 ("radv: implement VK_EXT_descriptor_buffer")
Co-authored-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21271>

17 months agoradv: Fix missing VK_ACCESS_2_SHADER_SAMPLED_READ_BIT.
Hans-Kristian Arntzen [Sun, 12 Feb 2023 15:02:26 +0000 (16:02 +0100)]
radv: Fix missing VK_ACCESS_2_SHADER_SAMPLED_READ_BIT.

Cannot be used for SSBO, so ignore SCACHE invalidation.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Fixes: 8df17163c78 ("radv: implement vkCmdWaitEvents2KHR")
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21271>

17 months agoradv: Fix invalid 64-bit shift.
Hans-Kristian Arntzen [Sun, 12 Feb 2023 14:40:31 +0000 (15:40 +0100)]
radv: Fix invalid 64-bit shift.

For sync2 bits, overflow can happen.
Use BITFIELD64_BIT to align with ANV.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Fixes: 8df17163c78 ("radv: implement vkCmdWaitEvents2KHR")
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21271>

17 months agoglsl/standalone: Do not pass memory allocated with ralloc_size to free
Michel Dänzer [Wed, 8 Feb 2023 16:36:35 +0000 (17:36 +0100)]
glsl/standalone: Do not pass memory allocated with ralloc_size to free

Pointed out by GCC:

In function ‘load_text_file’,
    inlined from ‘standalone_compile_shader’ at ../src/compiler/glsl/standalone.cpp:491:38,
    inlined from ‘main’ at ../src/compiler/glsl/main.cpp:98:45:
../src/compiler/glsl/standalone.cpp:358:17: error: ‘free’ called on pointer ‘block_195’ with nonzero offset 48 [-Werror=free-nonheap-object]
  358 |             free(text);
      |                 ^
In function ‘ralloc_size’,
    inlined from ‘load_text_file’ at ../src/compiler/glsl/standalone.cpp:352:31,
    inlined from ‘standalone_compile_shader’ at ../src/compiler/glsl/standalone.cpp:491:38,
    inlined from ‘main’ at ../src/compiler/glsl/main.cpp:98:45:
../src/util/ralloc.c:117:18: note: returned from ‘malloc’
  117 |    void *block = malloc(align64(size + sizeof(ralloc_header),
      |                  ^

Fixes: a9696e79fb3a ("main: Close memory leak of shader string from load_text_file.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21215>

17 months agoglsl/standalone: Fix up _mesa_reference_shader_program_data signature
Michel Dänzer [Wed, 8 Feb 2023 15:48:43 +0000 (16:48 +0100)]
glsl/standalone: Fix up _mesa_reference_shader_program_data signature

Drop the unused ctx parameter, to match the main Mesa code.

Fixes ODR violation flagged by -Wodr with LTO enabled:

../src/mesa/main/shaderobj.h:74:1: error: ‘_mesa_reference_shader_program_data’ violates the C++ One Definition Rule [-Werror=odr]
   74 | _mesa_reference_shader_program_data(struct gl_shader_program_data **ptr,
      | ^
../src/compiler/glsl/standalone_scaffolding.cpp:76:1: note: type mismatch in parameter 1
   76 | _mesa_reference_shader_program_data(struct gl_context *ctx,
      | ^
../src/compiler/glsl/standalone_scaffolding.cpp:76:1: note: ‘_mesa_reference_shader_program_data’ was previously declared here
../src/compiler/glsl/standalone_scaffolding.cpp:76:1: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used

Fixes: 717a720e9c95 ("mesa: drop unused context parameter to shader program data reference.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21215>

17 months agofreedreno: Avoid screen lock when no rsc tracking needed
Rob Clark [Tue, 7 Feb 2023 17:17:00 +0000 (09:17 -0800)]
freedreno: Avoid screen lock when no rsc tracking needed

In case there is no dirty state that requires resource tracking we
can skip taking the screen lock.  Indirect draw and index buffer are
a special case, but we can inexpensively check if they are already
referenced by the batch.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21202>

17 months agofreedreno: Add FD_DIRTY_QUERY
Rob Clark [Tue, 7 Feb 2023 17:07:28 +0000 (09:07 -0800)]
freedreno: Add FD_DIRTY_QUERY

Replace update_active_queries, which was really just a dirty-bit in
disguise.  This also lets us associate it with FD_DIRTY_RESOURCE so
we can skip the associated resource tracking when it isn't dirty.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21202>

17 months agofreedreno: Remove impossible NULL check
Rob Clark [Tue, 7 Feb 2023 16:48:50 +0000 (08:48 -0800)]
freedreno: Remove impossible NULL check

All gens implement query support now.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21202>

17 months agofreedreno: Move num_vertices calc to backend
Rob Clark [Sun, 5 Feb 2023 19:34:37 +0000 (11:34 -0800)]
freedreno: Move num_vertices calc to backend

Only used by a2xx and a3xx backends, so move it there.

Also make it more clear that fd6_emit::draw is only used in the
driver-params case.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21202>

17 months agofreedreno/a6xx: Move num_driver_params to program state
Rob Clark [Sun, 5 Feb 2023 19:15:14 +0000 (11:15 -0800)]
freedreno/a6xx: Move num_driver_params to program state

No need to re-calculate this at draw time.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21202>

17 months agonir: Apply a maximum stack depth to avoid stack overflows.
Bas Nieuwenhuizen [Tue, 10 Jan 2023 15:12:34 +0000 (16:12 +0100)]
nir: Apply a maximum stack depth to avoid stack overflows.

A stackless (or at least using allocated memory for stack) version
might be nice but for now this works around some games compiling
large shaders and hitting stack overflows.

CC: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21231>

17 months agodzn: Enable 16bit types when supported
Jesse Natalie [Fri, 27 Jan 2023 21:15:46 +0000 (13:15 -0800)]
dzn: Enable 16bit types when supported

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

17 months agodzn: Get options4
Jesse Natalie [Fri, 27 Jan 2023 21:15:11 +0000 (13:15 -0800)]
dzn: Get options4

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

17 months agodzn: Delete unused extensions table
Jesse Natalie [Fri, 27 Jan 2023 21:06:39 +0000 (13:06 -0800)]
dzn: Delete unused extensions table

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

17 months agodzn: Enable get_surface_capabilities2
Jesse Natalie [Fri, 27 Jan 2023 21:05:53 +0000 (13:05 -0800)]
dzn: Enable get_surface_capabilities2

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

17 months agospirv2dxil: Support 16bit types
Jesse Natalie [Mon, 30 Jan 2023 19:12:15 +0000 (11:12 -0800)]
spirv2dxil: Support 16bit types

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

17 months agospirv2dxil: Move shader model into runtime conf struct
Jesse Natalie [Wed, 1 Feb 2023 18:52:57 +0000 (10:52 -0800)]
spirv2dxil: Move shader model into runtime conf struct

We'll want to use it to control the shape of the nir that we generate

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

17 months agospirv2dxil: Lower unaligned loads and stores
Jesse Natalie [Mon, 30 Jan 2023 23:17:16 +0000 (15:17 -0800)]
spirv2dxil: Lower unaligned loads and stores

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

17 months agospirv2dxil: Set min UBO/SSBO alignments
Jesse Natalie [Wed, 1 Feb 2023 19:03:52 +0000 (11:03 -0800)]
spirv2dxil: Set min UBO/SSBO alignments

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

17 months agomicrosoft/compiler: Support lowering SSBO accesses to 16bit vectors
Jesse Natalie [Wed, 1 Feb 2023 18:58:18 +0000 (10:58 -0800)]
microsoft/compiler: Support lowering SSBO accesses to 16bit vectors

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

17 months agomicrosoft/compiler: Support raw buffer load/store intrinsics with 16bit alignment
Jesse Natalie [Wed, 1 Feb 2023 18:57:30 +0000 (10:57 -0800)]
microsoft/compiler: Support raw buffer load/store intrinsics with 16bit alignment

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

17 months agomicrosoft/compiler: Handle 48-bit stores to SSBO/shared
Jesse Natalie [Wed, 1 Feb 2023 17:06:55 +0000 (09:06 -0800)]
microsoft/compiler: Handle 48-bit stores to SSBO/shared

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

17 months agomicrosoft/compiler: Pass an alignment to constant buffer load lowering
Jesse Natalie [Wed, 1 Feb 2023 00:29:06 +0000 (16:29 -0800)]
microsoft/compiler: Pass an alignment to constant buffer load lowering

This means we can stop doing conditionals and shifts if we know the
alignment of a load for a small amount of data.

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

17 months agomicrosoft/compiler: Simplify bitpacking for load/store lowering with nir_extract_bits
Jesse Natalie [Wed, 1 Feb 2023 00:26:58 +0000 (16:26 -0800)]
microsoft/compiler: Simplify bitpacking for load/store lowering with nir_extract_bits

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

17 months agomicrosoft/compiler: Pass deref modes to unaligned pass and handle push const
Jesse Natalie [Wed, 1 Feb 2023 00:40:30 +0000 (16:40 -0800)]
microsoft/compiler: Pass deref modes to unaligned pass and handle push const

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

17 months agomicrosoft/compiler: Move unaligned load/store pass from CL
Jesse Natalie [Mon, 30 Jan 2023 22:08:45 +0000 (14:08 -0800)]
microsoft/compiler: Move unaligned load/store pass from CL

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

17 months agomicrosoft/compiler: Handle undef-rounding f2f16 as rtz
Jesse Natalie [Mon, 30 Jan 2023 19:11:58 +0000 (11:11 -0800)]
microsoft/compiler: Handle undef-rounding f2f16 as rtz

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

17 months agomicrosoft/compiler: Ensure native_low_precision is set for 16-bit bitcasts/stores
Jesse Natalie [Mon, 30 Jan 2023 19:11:39 +0000 (11:11 -0800)]
microsoft/compiler: Ensure native_low_precision is set for 16-bit bitcasts/stores

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

17 months agomicrosoft/compiler: Handle frcp for float16/float64
Jesse Natalie [Mon, 30 Jan 2023 19:11:04 +0000 (11:11 -0800)]
microsoft/compiler: Handle frcp for float16/float64

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

17 months agomicrosoft/compiler: Handle struct consts in DXIL module dumper
Jesse Natalie [Mon, 30 Jan 2023 19:10:34 +0000 (11:10 -0800)]
microsoft/compiler: Handle struct consts in DXIL module dumper

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

17 months agonir_lower_fp16_casts: Allow opting out of lowering certain rounding modes
Jesse Natalie [Mon, 30 Jan 2023 19:10:03 +0000 (11:10 -0800)]
nir_lower_fp16_casts: Allow opting out of lowering certain rounding modes

Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21029>

17 months agonir: Add alignment to load_push_constant
Jesse Natalie [Wed, 1 Feb 2023 00:20:31 +0000 (16:20 -0800)]
nir: Add alignment to load_push_constant

Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21029>

17 months agoci/windows: Update LLVM to 15
Jesse Natalie [Tue, 7 Feb 2023 17:21:07 +0000 (09:21 -0800)]
ci/windows: Update LLVM to 15

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21168>

17 months agomicrosoft/clc: Set features that are used by CL tests
Jesse Natalie [Tue, 7 Feb 2023 19:17:03 +0000 (11:17 -0800)]
microsoft/clc: Set features that are used by CL tests

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21168>

17 months agoclc: Include opencl-c-base.h with LLVM 15 (using builtins)
Jesse Natalie [Tue, 7 Feb 2023 19:16:11 +0000 (11:16 -0800)]
clc: Include opencl-c-base.h with LLVM 15 (using builtins)

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21168>

17 months agoturnip: fix use of align() instead of util_align_npot() with tile_align_w
Jonathan Marek [Fri, 10 Feb 2023 22:08:43 +0000 (17:08 -0500)]
turnip: fix use of align() instead of util_align_npot() with tile_align_w

tile_align_w isn't always a power of two.

Fixes: aae679e22137

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21251>

17 months agorusticl/icd: Make it work in case Rustc shuffles struct around
Karol Herbst [Fri, 10 Feb 2023 16:01:37 +0000 (17:01 +0100)]
rusticl/icd: Make it work in case Rustc shuffles struct around

Nothing guarentees fields are in order or anything like that. So do proper offset math

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21242>

17 months agorusticl/util: extract offset_of macro
Karol Herbst [Fri, 10 Feb 2023 16:00:24 +0000 (17:00 +0100)]
rusticl/util: extract offset_of macro

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21242>

17 months agonir/deref: Preserve alignments in opt_remove_cast_cast()
Faith Ekstrand [Fri, 10 Feb 2023 22:21:19 +0000 (16:21 -0600)]
nir/deref: Preserve alignments in opt_remove_cast_cast()

This also removes the loop so opt_remove_cast_cast() will only optimize
cast(cast(x)) and not cast(cast(cast(x))).  However, since nir_opt_deref
walks instructions top-down, there will almost never be a tripple cast
because the parent cast will have opt_remove_cast_cast() run on it.

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

17 months agoanv: Handle VkAccelerationStructureBuildRangeInfoKHR::transformOffset
Sviatoslav Peleshko [Thu, 9 Feb 2023 15:56:32 +0000 (17:56 +0200)]
anv: Handle VkAccelerationStructureBuildRangeInfoKHR::transformOffset

Previously it was not actually handled. This meant that all geometries
with the same transform buffer were using the same (first) transformation
matrix.

Fixes: f3ddfd81 ("anv: Build BVHs on the GPU with GRL")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7575
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21227>

17 months agointel/compiler/mesh: use U888X packed index format
Marcin Ślusarz [Wed, 25 Jan 2023 14:06:23 +0000 (15:06 +0100)]
intel/compiler/mesh: use U888X packed index format

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20910>

17 months agoturnip: Disable draw states after dyn renderpass in all cases
Danylo Piliaiev [Tue, 7 Feb 2023 15:52:53 +0000 (16:52 +0100)]
turnip: Disable draw states after dyn renderpass in all cases

Draw states were not disabled after a dynamic renderpass which
spans several command buffers, the next renderpass if started in
the same command buffer wouldn't emit the full draw state,
since TU_CMD_DIRTY_DRAW_STATE was not set by previous renderpass.

The issue could be observed when corrupting all regs at cmdbuf start in:
 dEQP-VK.dynamic_rendering.primary_cmd_buff.random.seed7_geometry

Fixes: cb0f414b2aed88f48b2593dad833844be2f5f42b
("tu: Add support for suspending and resuming renderpasses")

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21148>

17 months agoturnip: Ensure that there is no renderpass rotation in binning
Danylo Piliaiev [Mon, 6 Feb 2023 19:38:41 +0000 (20:38 +0100)]
turnip: Ensure that there is no renderpass rotation in binning

It appears that A6XX_GRAS_SC_CNTL::rotation applies to the binning,
so we should ensure there is no unexpected rotations and apply with
A6XX_GRAS_SC_CNTL during the binning pass.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21148>

17 months agofreedreno: Document A6XX_GRAS_SC_CNTL::rotation field
Danylo Piliaiev [Mon, 6 Feb 2023 19:36:48 +0000 (20:36 +0100)]
freedreno: Document A6XX_GRAS_SC_CNTL::rotation field

Likely used for VK_QCOM_render_pass_transform.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21148>

17 months agotu: Prevent using stale value of GRAS_SC_CNTL in sysmem clear
Danylo Piliaiev [Mon, 6 Feb 2023 13:56:35 +0000 (14:56 +0100)]
tu: Prevent using stale value of GRAS_SC_CNTL in sysmem clear

cc: mesa-stable

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21148>

17 months agotu: Prevent using stale value of RB_UNKNOWN_88D0 on BLIT
Danylo Piliaiev [Fri, 3 Feb 2023 16:02:52 +0000 (17:02 +0100)]
tu: Prevent using stale value of RB_UNKNOWN_88D0 on BLIT

Fixes: def56b531c86f529bc32d1834ccb479457717db7
("tu: Support GMEM with layered rendering and multiview")

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21148>

17 months agofreedreno: use blendcoherent to set FLUSH_PER_OVERLAP
Amber [Tue, 7 Feb 2023 10:53:26 +0000 (11:53 +0100)]
freedreno: use blendcoherent to set FLUSH_PER_OVERLAP

FLUSH_PER_OVERLAP is only necessary for gmem if coherent blending is
enabled.

Signed-off-by: Amber Amber <amber@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21161>

17 months agogallium: make BlendCoherent usable from gallium drivers
Amber [Tue, 7 Feb 2023 10:53:01 +0000 (11:53 +0100)]
gallium: make BlendCoherent usable from gallium drivers

Signed-off-by: Amber Amber <amber@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21161>

17 months agofreedreno: use A6XX_GRAS_SC_CNTL_SINGLE_PRIM_MODE with fb readback
Amber [Mon, 6 Feb 2023 13:39:19 +0000 (14:39 +0100)]
freedreno: use A6XX_GRAS_SC_CNTL_SINGLE_PRIM_MODE with fb readback

fixes:
dEQP-GLES31.functional.blend_equation_advanced.msaa.*

Signed-off-by: Amber Amber <amber@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21161>

17 months agozink: add newlines to some debug printfs
Mike Blumenkrantz [Fri, 10 Feb 2023 13:20:01 +0000 (08:20 -0500)]
zink: add newlines to some debug printfs

cc: mesa-stable

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

17 months agohasvk: Tell spirv_to_nir float controls are always supported
Väinö Mäkelä [Thu, 8 Dec 2022 15:59:05 +0000 (17:59 +0200)]
hasvk: Tell spirv_to_nir float controls are always supported

This gets rid of the "Unsupported SPIR-V capability" warnings when
compiling shaders using float controls on gfx7.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20232>

17 months agohasvk: Don't claim shaderDenormPreserveFloat32 on gfx7
Väinö Mäkelä [Thu, 8 Dec 2022 15:53:03 +0000 (17:53 +0200)]
hasvk: Don't claim shaderDenormPreserveFloat32 on gfx7

From the Haswell PRM Vol. 7, "IEEE Floating Point Mode":
     "Single precision (F, Float) denorms are flushed to sign-preserved
      zero on input and output of any floating-point mathematical
      operation."

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20232>

17 months agointel/vec4: Don't optimize multiply by 1.0 away
Väinö Mäkelä [Thu, 8 Dec 2022 15:52:04 +0000 (17:52 +0200)]
intel/vec4: Don't optimize multiply by 1.0 away

The SPIR-V compiler's implementation of tanh generates a multiply by 1.0
to flush denorms to zero.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20232>