platform/upstream/mesa.git
18 months agoradv: Fix depth-only-with-discard when epilogs are used.
Tatsuyuki Ishi [Sat, 14 Jan 2023 09:30:32 +0000 (18:30 +0900)]
radv: Fix depth-only-with-discard when epilogs are used.

For a depth-only-with-discard pipeline, spi_shader_col_format needs to be
fixed up to a single channel export, or otherwise discard will not work.

Since col_format can change depending on the dynamic state, precompute the
need for this workaround on pipeline creation and apply it when emitting
prolog states.

Fixes: eb07a11b8f4 ("radv: add support for compiling PS epilogs on-demand")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20704>

18 months agomeson: use sections in summary()
Thomas H.P. Andersen [Wed, 18 Jan 2023 21:56:39 +0000 (22:56 +0100)]
meson: use sections in summary()

Makes the list easier to read

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12161>

18 months agomeson: use summary()
Thomas H.P. Andersen [Mon, 2 Aug 2021 00:10:11 +0000 (02:10 +0200)]
meson: use summary()

Make use of mesons summary() to create and align the configuration
summary.

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12161>

18 months agodzn: Rework meta blit VS
Jesse Natalie [Thu, 19 Jan 2023 00:31:02 +0000 (16:31 -0800)]
dzn: Rework meta blit VS

Some D3D12 drivers, like my PC's AMD driver, don't like using a
dynamic index to load from a constant buffer that's bound via
root constants. Instead, just go ahead and load the full set of
vertex data and just bcsel which one to use.

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

18 months agodzn: Delete an unnecessary assert
Jesse Natalie [Thu, 19 Jan 2023 00:30:23 +0000 (16:30 -0800)]
dzn: Delete an unnecessary assert

As far as I can tell, having multiple levels in the view for a
color target just means to target the first one.

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

18 months agodzn: Enable independent blending
Jesse Natalie [Thu, 19 Jan 2023 00:29:52 +0000 (16:29 -0800)]
dzn: Enable independent blending

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

18 months agoci: bump ci-fairy with session support (robust downloads)
David Heidelberg [Thu, 19 Jan 2023 15:09:13 +0000 (16:09 +0100)]
ci: bump ci-fairy with session support (robust downloads)

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20788>

18 months agoci/piglit: 2023-01-19 uprev
David Heidelberg [Thu, 19 Jan 2023 14:10:23 +0000 (15:10 +0100)]
ci/piglit: 2023-01-19 uprev

Emergency uprev to get robustness against http 50x errors for traces.

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20788>

18 months agoci: migrate from wget to curl
David Heidelberg [Wed, 18 Jan 2023 23:26:03 +0000 (00:26 +0100)]
ci: migrate from wget to curl

Better error handling is more reliable.

Options:
 -L, follow location
 --retry, number of retries
 --retry-all-errors, does not fail on ALL errors, that's why there is -f
 -f, fail fast with no output at all on server errors
 --retry-delay, make curl sleep this amount of time before each retry

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20788>

18 months agoci/piglit: explicitely define we want GLX tests
David Heidelberg [Thu, 19 Jan 2023 16:37:14 +0000 (17:37 +0100)]
ci/piglit: explicitely define we want GLX tests

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20788>

18 months agomeson: use the same workaround for setting 'lib' on windows
Dylan Baker [Tue, 17 Jan 2023 18:11:13 +0000 (10:11 -0800)]
meson: use the same workaround for setting 'lib' on windows

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

18 months agomeson: use [] instead of 'lib for !windows name_prefix
Dylan Baker [Tue, 17 Jan 2023 18:09:18 +0000 (10:09 -0800)]
meson: use [] instead of 'lib for !windows name_prefix

This is a poorly documented value that uses the default value, but
doesn't emit a warning. In the future Meson will fix this.

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

18 months agomeson: use builtin support for reading version from a file
Dylan Baker [Tue, 17 Jan 2023 17:50:26 +0000 (09:50 -0800)]
meson: use builtin support for reading version from a file

In meson 0.57 support was added for reading a version from a file to
meson natively, so we don't need this workaround anymore.

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

18 months agomeson: remove version checks for < 0.59
Dylan Baker [Tue, 17 Jan 2023 17:46:41 +0000 (09:46 -0800)]
meson: remove version checks for < 0.59

Which is now required, so these are useless

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

18 months agodzn: Enable multiview
Jesse Natalie [Wed, 11 Jan 2023 21:09:49 +0000 (13:09 -0800)]
dzn: Enable multiview

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

18 months agodzn: Implement multiview queries
Jesse Natalie [Wed, 11 Jan 2023 19:03:20 +0000 (11:03 -0800)]
dzn: Implement multiview queries

This is a weird way to do queries, but in multiview, each query
takes up N slots, where N is the number of views. D3D doesn't do
it that way, and only has one result, which fortunately is a valid
way to do Vulkan queries. We just need to take care to zero out
the other view results, and make sure they get "signaled" when
the cmdbuf is submitted.

Note that it is invalid in D3D to use ResolveQueryData on query
slots that have never actually been begun/ended, so we zero out
the data by copying zeroes into the buffer. This probably could
be optimized but oh well.

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

18 months agodzn: Handle draws and clears for multiview rendering
Jesse Natalie [Wed, 11 Jan 2023 19:00:46 +0000 (11:00 -0800)]
dzn: Handle draws and clears for multiview rendering

For draws, when we're emulating multiview, we need to loop them
and set up the right sysval. For clears, we always need to loop.
When not emulating, we also need to set up the right view instance
mask.

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

18 months agodzn: Handle multiview pipeline creation
Jesse Natalie [Wed, 11 Jan 2023 18:57:39 +0000 (10:57 -0800)]
dzn: Handle multiview pipeline creation

This handles both native and emulated pipeline creation

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

18 months agodzn: Put nir compilation options in a struct
Jesse Natalie [Wed, 11 Jan 2023 18:56:10 +0000 (10:56 -0800)]
dzn: Put nir compilation options in a struct

The function signatures are getting unwieldly...

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

18 months agospirv2dxil: Claim multiview support
Jesse Natalie [Wed, 11 Jan 2023 18:53:55 +0000 (10:53 -0800)]
spirv2dxil: Claim multiview support

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

18 months agospirv2dxil: Implement lowering for multiview
Jesse Natalie [Wed, 11 Jan 2023 18:53:45 +0000 (10:53 -0800)]
spirv2dxil: Implement lowering for multiview

D3D's view instancing is an optional feature, and even when it's
supported, it only goes up to 4 views, where Vulkan requires a
minimum of 6 supported views. So, we need to have a path for handling
the cases where we can't use the native feature.

In this mode, pass the view ID as a runtime var. The caller is then
responsible for looping the draw calls and filling out the constant
buffer value correctly for each draw. When we get to the last pre-rast
stage, we'll additionally want to write out gl_Layer to select the
right RTV array slice. Lastly, for the fragment shader, if there's
any input attachments, those get loaded using the RTV slice instead
of the view ID. RTV slice input into the PS is done with a signature
entry (which must be output from the previous stage) rather than a
system value.

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

18 months agospirv2dxil: Pass runtime conf struct to lower_shader_system_values
Jesse Natalie [Wed, 11 Jan 2023 18:48:16 +0000 (10:48 -0800)]
spirv2dxil: Pass runtime conf struct to lower_shader_system_values

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

18 months agomicrosoft/compiler: Support view instancing
Jesse Natalie [Wed, 11 Jan 2023 18:46:51 +0000 (10:46 -0800)]
microsoft/compiler: Support view instancing

This adds support for D3D12-native view instancing to the compiler.
Essentially, it's just the ability to load SV_ViewID (dx.op.viewID),
set the right capability, and fill out some more PSV data. Note that
the PSV data is currently garbage. Ideally, we'd fill out a proper
input -> output and viewID -> output dependency table, but AFAIK
this is only used to enforce D3D API validation, and drivers ignore
it, so it's less critical to get it right.

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

18 months agomicrosoft/compiler: Delete stale TODO comment
Jesse Natalie [Wed, 11 Jan 2023 18:44:51 +0000 (10:44 -0800)]
microsoft/compiler: Delete stale TODO comment

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

18 months agomicrosoft/compiler: Subpass textures are supposed to be arrays
Jesse Natalie [Wed, 11 Jan 2023 18:44:26 +0000 (10:44 -0800)]
microsoft/compiler: Subpass textures are supposed to be arrays

When doing multiview subpass rendering, they get loaded with the
view/layer index.

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

18 months agomicrosoft/compiler: Delete incorrect implementation for load_layer_id
Jesse Natalie [Wed, 11 Jan 2023 18:43:44 +0000 (10:43 -0800)]
microsoft/compiler: Delete incorrect implementation for load_layer_id

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

18 months agozink: simplify some dynarray concat descriptor code
Mike Blumenkrantz [Thu, 12 Jan 2023 19:27:19 +0000 (14:27 -0500)]
zink: simplify some dynarray concat descriptor code

TIL this exists

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

18 months agozink: consolidate semaphore creation where possible
Mike Blumenkrantz [Thu, 12 Jan 2023 19:49:26 +0000 (14:49 -0500)]
zink: consolidate semaphore creation where possible

all cacheable semaphores should now be using the cache

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

18 months agozink: move semaphore caching to zink_reset_batch_state()
Mike Blumenkrantz [Thu, 12 Jan 2023 19:25:25 +0000 (14:25 -0500)]
zink: move semaphore caching to zink_reset_batch_state()

this makes semaphores available for reuse more rapidly

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

18 months agozink: add a binary semaphore cache
Mike Blumenkrantz [Thu, 12 Jan 2023 19:21:20 +0000 (14:21 -0500)]
zink: add a binary semaphore cache

after being waited upon, a binary semaphore can be reused, which saves
tons of present-related ioctls when fps is high

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

18 months agozink: add a util function for creating semaphores
Mike Blumenkrantz [Mon, 19 Sep 2022 20:12:57 +0000 (16:12 -0400)]
zink: add a util function for creating semaphores

annoying to keep copy/pasting this around

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

18 months agozink: preserve present resources during async presentation
Mike Blumenkrantz [Thu, 19 Jan 2023 18:33:04 +0000 (13:33 -0500)]
zink: preserve present resources during async presentation

ensure that these have a lifetime great enough to be presented

fixes #7781

cc: mesa-stable

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

18 months agoci/bare-metal: add more timestamps to help debugging issues
Eric Engestrom [Thu, 19 Jan 2023 18:15:23 +0000 (18:15 +0000)]
ci/bare-metal: add more timestamps to help debugging issues

Acked-by: Emma Anholt <emma@anholt.net>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Signed-off-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20792>

18 months agozink: NV_compute_shader_derivatives
Mike Blumenkrantz [Wed, 26 May 2021 15:25:21 +0000 (11:25 -0400)]
zink: NV_compute_shader_derivatives

nothing complicated here

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

18 months agozink: correct sparse bo mem_type_idx placement
Julia Tatz [Mon, 16 Jan 2023 20:34:47 +0000 (15:34 -0500)]
zink: correct sparse bo mem_type_idx placement

VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x01 has been incidently the
correct memory type index, but isn't guaranteed to be, which is why it
hasn't caused issues yet

Fixes: f9515d93 ("zink: allocate/place memory using memoryTypeIndex directly")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20264>

18 months agozink: trival renames heap_idx -> memoryTypeIndex
Julia Tatz [Mon, 16 Jan 2023 18:18:40 +0000 (13:18 -0500)]
zink: trival renames heap_idx -> memoryTypeIndex

Trival renames to correctly identify vulkan memory type indices aren't
the same as zink heaps

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

18 months agozink: zink_heap isn't 1-to-1 with memoryTypeIndex
Julia Tatz [Mon, 16 Jan 2023 18:09:02 +0000 (13:09 -0500)]
zink: zink_heap isn't 1-to-1 with memoryTypeIndex

Clarify the relationship between zink heaps and vulkan memory type
indices, and resolve the issues from mixing the two up.

Closes: #7588, #7813
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20264>

18 months agomeson: Use feature option methods for xmlconfig
Dylan Baker [Wed, 21 Dec 2022 19:44:55 +0000 (11:44 -0800)]
meson: Use feature option methods for xmlconfig

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for shared-llvm
Dylan Baker [Wed, 21 Dec 2022 17:26:25 +0000 (09:26 -0800)]
meson: use a feature option for shared-llvm

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for egl
Dylan Baker [Wed, 21 Dec 2022 01:48:04 +0000 (17:48 -0800)]
meson: use a feature option for egl

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for zstd
Dylan Baker [Wed, 21 Dec 2022 00:37:35 +0000 (16:37 -0800)]
meson: use a feature option for zstd

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for xlib-lease
Dylan Baker [Wed, 21 Dec 2022 00:36:46 +0000 (16:36 -0800)]
meson: use a feature option for xlib-lease

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for power8
Dylan Baker [Wed, 21 Dec 2022 00:06:10 +0000 (16:06 -0800)]
meson: use a feature option for power8

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for lmsensors
Dylan Baker [Tue, 20 Dec 2022 23:43:55 +0000 (15:43 -0800)]
meson: use a feature option for lmsensors

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for libunwind
Dylan Baker [Tue, 20 Dec 2022 23:41:44 +0000 (15:41 -0800)]
meson: use a feature option for libunwind

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for valgrind
Dylan Baker [Tue, 20 Dec 2022 23:38:10 +0000 (15:38 -0800)]
meson: use a feature option for valgrind

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for llvm
Dylan Baker [Tue, 20 Dec 2022 23:36:13 +0000 (15:36 -0800)]
meson: use a feature option for llvm

Still not as awesome as it should be, but an improvement over what we had
before.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for gbm
Dylan Baker [Tue, 20 Dec 2022 23:21:11 +0000 (15:21 -0800)]
meson: use a feature option for gbm

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for gles2
Dylan Baker [Tue, 20 Dec 2022 23:19:00 +0000 (15:19 -0800)]
meson: use a feature option for gles2

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for gles1
Dylan Baker [Tue, 20 Dec 2022 23:17:13 +0000 (15:17 -0800)]
meson: use a feature option for gles1

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for shared-glapi
Dylan Baker [Tue, 20 Dec 2022 23:12:47 +0000 (15:12 -0800)]
meson: use a feature option for shared-glapi

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for shader_cache
Dylan Baker [Tue, 20 Dec 2022 23:09:41 +0000 (15:09 -0800)]
meson: use a feature option for shader_cache

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for gallium-xa
Dylan Baker [Tue, 20 Dec 2022 23:07:14 +0000 (15:07 -0800)]
meson: use a feature option for gallium-xa

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for gallium-va
Dylan Baker [Tue, 20 Dec 2022 23:05:26 +0000 (15:05 -0800)]
meson: use a feature option for gallium-va

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for gallium-vdpau
Dylan Baker [Tue, 20 Dec 2022 22:59:48 +0000 (14:59 -0800)]
meson: use a feature option for gallium-vdpau

Which we can use with the require method, and use the feature itself
as the require argument to dependency call. All of this results in less
code

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: use a feature option for dri3
Dylan Baker [Tue, 20 Dec 2022 22:52:18 +0000 (14:52 -0800)]
meson: use a feature option for dri3

This removes the deprecated 'true' and 'false' options, and uses a meson
feature, requiring significantly less code.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: drop meson < 0.54 workaround
Dylan Baker [Tue, 20 Dec 2022 23:31:28 +0000 (15:31 -0800)]
meson: drop meson < 0.54 workaround

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: replace uses of ExternalProgram.path with .full_path
Dylan Baker [Wed, 21 Dec 2022 17:31:30 +0000 (09:31 -0800)]
meson: replace uses of ExternalProgram.path with .full_path

The former is deprecated

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: replace has_exe_wrapper with can_run_host_binaries
Dylan Baker [Wed, 21 Dec 2022 17:30:44 +0000 (09:30 -0800)]
meson: replace has_exe_wrapper with can_run_host_binaries

The former is a deprecated alias for the latter, which more accurately
describes what the function does.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agomeson: bump minimum required version to meson 0.59
Dylan Baker [Tue, 20 Dec 2022 22:46:17 +0000 (14:46 -0800)]
meson: bump minimum required version to meson 0.59

This gives us some utility methods for feature options, allowing even
simpler code. We can replace something like:
```meson
_opt = get_option('opt')
if _opt.auto()
  opt = host_machine.system() != 'windows'
else
  opt = opt.enabled()
endif
```
with
```meson
opt = get_option('opt') \
    .disable_auto_if(host_machine.system() != 'windows') \
    .allowed()
```

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>

18 months agozink: handle modifier nplanes queries correctly for planar formats
Mike Blumenkrantz [Tue, 17 Jan 2023 19:45:48 +0000 (14:45 -0500)]
zink: handle modifier nplanes queries correctly for planar formats

this just returns the number of planes in the base format as a default, which
matches the behavior of other drivers

cc: mesa-stable

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

18 months agozink: store drm format as internal_format for imported resources
Mike Blumenkrantz [Tue, 17 Jan 2023 19:43:51 +0000 (14:43 -0500)]
zink: store drm format as internal_format for imported resources

internal_format is the "real" format of a resource, and the "real" format
of imported resources is the external-facing format, not the pipe format

this ensures the correct format is available for internal ops, such as nplanes queries

Fixes: 2e2775c11b0 ("zink: fix PIPE_RESOURCE_PARAM_NPLANES with format modifier")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20753>

18 months agoradv: rename ac_surf_nbc_view::max_mip to num_levels
Samuel Pitoiset [Thu, 19 Jan 2023 07:45:27 +0000 (08:45 +0100)]
radv: rename ac_surf_nbc_view::max_mip to num_levels

For readability.

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

18 months agoradv: fix creating BC image views when the base layer is > 0
Samuel Pitoiset [Tue, 17 Jan 2023 15:18:24 +0000 (16:18 +0100)]
radv: fix creating BC image views when the base layer is > 0

When the base array layer of the image view is > 0, addrlib computes
the offset (in HwlComputeSubResourceOffsetForSwizzlePattern) which is
then added to the base VA in RADV. But if the driver doesn't reset
the base array layer, the hw will compute incorrect addressing
(ie. base array will be added twice). This also matches AMDVLK.

This fixes a VM fault followed by a GPU hang on RDNA2 when trying
to join a multiplayer game with medium settings in Halo Infinite.

Fixes: 98ba1e0d817 ("radv: Fix mipmap views on GFX10+")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20761>

18 months agoradv: fix buffer to image copies with BC views on the graphics queue
Samuel Pitoiset [Tue, 17 Jan 2023 16:53:13 +0000 (17:53 +0100)]
radv: fix buffer to image copies with BC views on the graphics queue

The color surface descriptor needs to be adjusted, otherwise addressing
is wrong.

Fixes tests performed on the graphics queue from
dEQP-VK.api.copy_and_blit.*.image_to_buffer.2d_images.mip_copies_*.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7900
Fixes: 98ba1e0d817 ("radv: Fix mipmap views on GFX10+")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20761>

18 months agoradv: fix setting MAX_MIP for BC views
Samuel Pitoiset [Tue, 17 Jan 2023 16:33:12 +0000 (17:33 +0100)]
radv: fix setting MAX_MIP for BC views

MAX_MIP should always be the number of levels minus one from the hw
perspective.

This doesn't fix anything known.

Fixes: 98ba1e0d817 ("radv: Fix mipmap views on GFX10+")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20761>

18 months agomesa/st: drop unused param
Eric Engestrom [Wed, 18 Jan 2023 17:54:29 +0000 (17:54 +0000)]
mesa/st: drop unused param

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20772>

18 months agoglthread: fix glArrayElement handling
Pierre-Eric Pelloux-Prayer [Tue, 17 Jan 2023 15:06:00 +0000 (16:06 +0100)]
glthread: fix glArrayElement handling

This must be marshalled synchronously or the attrib pointers' content
might change by the time we use them.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8068
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20748>

18 months agovbo: lower VBO_SAVE_BUFFER_SIZE to avoid large VRAM usage
Pierre-Eric Pelloux-Prayer [Tue, 17 Jan 2023 09:14:52 +0000 (10:14 +0100)]
vbo: lower VBO_SAVE_BUFFER_SIZE to avoid large VRAM usage

The ideal case for performance is to have a single buffer for
all display list. The caveat is that large buffers are less
likely to be freed because they're refcounted: it only takes
1 user (diplay list) to keep it in VRAM.

This lowers VRAM usage when replaying the trace attached
of the trace attached to !6140 from 5.5 GB to about 1.8 GB.

Viewperf snx performance isn't affected.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6140
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20748>

18 months agovbo: remove bogus assert
Pierre-Eric Pelloux-Prayer [Tue, 17 Jan 2023 09:13:00 +0000 (10:13 +0100)]
vbo: remove bogus assert

grow_vertex_storage may call wrap_filled_vertex, which will
trigger the assert incorrectly because the new size will be
smaller than 'new_size' but it's correct because
'vertex_store->used' has been reset to 0.

Fixes: a08baaff976 ("vbo/dlist: fix indentation in vbo_save_api.c")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20748>

18 months agonir/lower_io: fix bounds checking for 64bit_bounded_global
Lionel Landwerlin [Tue, 17 Jan 2023 21:42:03 +0000 (23:42 +0200)]
nir/lower_io: fix bounds checking for 64bit_bounded_global

If the offset is negative like it's the case in

dEQP-VK.robustness.robustness2.bind.notemplate.r32i.unroll.volatile.storage_buffer_dynamic.readwrite.no_fmt_qual.len_256.samples_1.1d.comp

we end up passing the bounds checking condition because it's using
signed integers.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Suggested-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20762>

18 months agointel/compiler: Use more symbolic source names in components_read()
Kenneth Graunke [Tue, 10 Jan 2023 23:09:12 +0000 (15:09 -0800)]
intel/compiler: Use more symbolic source names in components_read()

Rather than hardcoding source 1, source 2, etc.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20604>

18 months agointel/compiler: Drop dest checking in atomic code
Kenneth Graunke [Tue, 10 Jan 2023 00:49:43 +0000 (16:49 -0800)]
intel/compiler: Drop dest checking in atomic code

NIR atomic operation intrinsics all have destinations.  This is just
copy and pasted from other generic intrinsic handling where that may
or may not be the case.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20604>

18 months agointel/compiler: Delete all the A64 atomic variants for type sizes
Kenneth Graunke [Tue, 10 Jan 2023 00:44:26 +0000 (16:44 -0800)]
intel/compiler: Delete all the A64 atomic variants for type sizes

These are handled identically in almost all cases.  There is one place
in the legacy surface lowering that was obtaining the bitsize from the
opcode, but the LSC-based lowering uses (type_sz(inst->dst.type) * 8)
for that and works just fine.  If we just do that in the legacy lowering
too, then we don't need this plethora of opcodes.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20604>

18 months agointel/compiler: Combine nir_emit_{ssbo,shared}_atomic into one helper
Kenneth Graunke [Tue, 10 Jan 2023 00:23:08 +0000 (16:23 -0800)]
intel/compiler: Combine nir_emit_{ssbo,shared}_atomic into one helper

These are basically identical save for:
- shared has surface hardcoded to SLM rather than an SSBO index
- shared has to handle adding the 'base' const_index (SSBO have none)
- the NIR source index for data is shifted by one

It's not worth copy and pasting the entire function for this.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20604>

18 months agointel/compiler: Delete fs_visitor::nir_emit_{ssbo,shared}_atomic_float()
Kenneth Graunke [Mon, 9 Jan 2023 23:01:20 +0000 (15:01 -0800)]
intel/compiler: Delete fs_visitor::nir_emit_{ssbo,shared}_atomic_float()

These are now basically identical to their non-float counterparts.  The
only thing that differed was the opcode checking to determine which
operands existed.  Now that we have a unified opcode enum and a helper
for the number of data operands, we can just use that.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20604>

18 months agointel/compiler: Drop redundant 32-bit expansion for shared float atomics
Kenneth Graunke [Mon, 9 Jan 2023 23:57:14 +0000 (15:57 -0800)]
intel/compiler: Drop redundant 32-bit expansion for shared float atomics

We already expanded data to 32-bit a few lines earlier, so this is just
redundantly doing it a second time.

Fixes: 43169dbbe5f ("intel/compiler: Support 16 bit float ops")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20604>

18 months agointel/compiler: Eliminate SHADER_OPCODE_UNTYPED_ATOMIC_FLOAT
Kenneth Graunke [Mon, 9 Jan 2023 23:02:44 +0000 (15:02 -0800)]
intel/compiler: Eliminate SHADER_OPCODE_UNTYPED_ATOMIC_FLOAT

The only reason for the separate opcode was because of the overlapping
BRW_AOP_* enums, making it impossible to tell whether a particular AOP
was the integer or float operation.  Now that we use the lsc_opcode
enums, we can just have the legacy lowering inspect the opcode and
select the right descriptor.  No need for a separate opcode.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20604>

18 months agointel/compiler: Add an lsc_op_num_data_values() helper
Kenneth Graunke [Mon, 9 Jan 2023 23:37:30 +0000 (15:37 -0800)]
intel/compiler: Add an lsc_op_num_data_values() helper

There are a number of places that need to know how many operands an LSC
atomic takes (0 for inc/dec, 1 for most things, 2 for cmpxchg).  We can
add a helper for that and eliminate some code (with more to come).

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20604>

18 months agointel/compiler: Use LSC opcode enum rather than legacy BRW_AOPs
Kenneth Graunke [Mon, 9 Jan 2023 22:17:09 +0000 (14:17 -0800)]
intel/compiler: Use LSC opcode enum rather than legacy BRW_AOPs

This gets our logical atomic messages using the lsc_opcode enum rather
than the legacy BRW_AOP_* defines.  We have to translate one way or
another, and using the modern set makes sense going forward.

One advantage is that the lsc_opcode encoding has opcodes for both
integer and floating point atomics in the same enum, whereas the legacy
encoding used overlapping values (BRW_AOP_AND == 1 == BRW_AOP_FMAX),
which made it impossible to handle both sensibly in common code.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20604>

18 months agointel/compiler: Move atomic op translation into emit_*_atomic()
Kenneth Graunke [Sun, 25 Dec 2022 08:40:37 +0000 (00:40 -0800)]
intel/compiler: Move atomic op translation into emit_*_atomic()

There's no need to pass both the intrinsic and an opcode computed from
that same intrinsic.  Just do it in the functions themselves.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20604>

18 months agoanv: fix generated indirect draw shader stats checks
Lionel Landwerlin [Thu, 12 Jan 2023 17:56:43 +0000 (19:56 +0200)]
anv: fix generated indirect draw shader stats checks

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: c950fe97a0 ("anv: implement generated (indexed) indirect draws")
Tested-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20776>

18 months agointel/hasvk: remove some stale comments, wa was removed
Tapani Pälli [Thu, 19 Jan 2023 05:39:58 +0000 (07:39 +0200)]
intel/hasvk: remove some stale comments, wa was removed

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20783>

18 months agointel/fs/gfx12+: Drop redundant handling of SHADER_OPCODE_BROADCAST in exec pipe...
Francisco Jerez [Wed, 4 Jan 2023 20:53:18 +0000 (12:53 -0800)]
intel/fs/gfx12+: Drop redundant handling of SHADER_OPCODE_BROADCAST in exec pipe inference.

Commit c80c0ed9433035c2f4dc6 introduced handling of
SHADER_OPCODE_BROADCAST into inferred_exec_pipe(), but it was already
being handled, drop the redundant handling.  Shouldn't lead to any
functional changes.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20543>

18 months agointel/eu/gfx12+: Implement decoding of 64-bit immediates.
Francisco Jerez [Wed, 4 Jan 2023 20:53:35 +0000 (12:53 -0800)]
intel/eu/gfx12+: Implement decoding of 64-bit immediates.

C.f. a12533f2ce2e5a4aeae0f1fc8d759de73bdb6e2d.  The corresponding
change for the decoding path was never implemented so the disassembler
was printing incorrect immediate values.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20543>

18 months agointel/disasm/gfx12+: Fix print out of non-existing condmod field with 64-bit immediate.
Francisco Jerez [Wed, 4 Jan 2023 20:52:45 +0000 (12:52 -0800)]
intel/disasm/gfx12+: Fix print out of non-existing condmod field with 64-bit immediate.

The conditional mode field doesn't exist for instructions with a
64-bit immediate, so this would currently print garbage.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20543>

18 months agointel/disasm/gfx12+: Use helper instead of hardcoded bit access for 64-bit immediates.
Francisco Jerez [Wed, 4 Jan 2023 20:52:21 +0000 (12:52 -0800)]
intel/disasm/gfx12+: Use helper instead of hardcoded bit access for 64-bit immediates.

So we don't have to duplicate code to handle differences in the
encoding of 64-bit immediates across platforms.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20543>

18 months agointel/fs/gfx12: Ensure that prior reads have executed before barrier with acquire...
Francisco Jerez [Mon, 9 Jan 2023 23:31:33 +0000 (15:31 -0800)]
intel/fs/gfx12: Ensure that prior reads have executed before barrier with acquire semantics.

This avoids a violation of the Vulkan memory model that was leading to
intermittent failures of at least 8k test-cases of the Vulkan CTS
(within the group dEQP-VK.memory_model.*) on TGL and DG2 platforms.
In theory the issue may be reproducible on earlier platforms like IVB
and ICL, but the SYNC.ALLWR instruction is not available on those
platforms so a different (likely costlier) fix will be needed.

The issue occurs within the sequence we emit for a NIR memory barrier
with acquire semantics requiring the synchronization of multiple
caches, e.g. in pseudocode for a barrier involving the TGM and UGM
caches on DG2:

 x <- load.ugm // Atomic read sequenced-before the barrier
 y <- fence.ugm
 z <- fence.tgm
 wait(y, z)
 w <- load.tgm // Read sequenced-after the barrier

In the example we must provide the guarantee that the memory load for
x is completed before the one for w, however this ordering can be
reversed with the intervention of a concurrent thread, since the UGM
fence will block on the prior UGM load and potentially take a long
time, while the TGM fence may complete and invalidate the TGM cache
immediately, so a concurrent thread could pollute the TGM cache with
stale contents for the w location *before* the UGM load has completed,
leading to an inversion of the expected memory ordering.

v2: Apply the workaround regardless of whether the NIR barrier
    intrinsic specifies multiple storage classes or a single one,
    since an acquire barrier is required to order subsequent requests
    relative to previous atomic requests of unknown storage class not
    necessarily specified by the memory scope information of the
    intrinsic.

Cc: mesa-stable
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20690>

18 months agonir/lower_blend: No-op nir_color_mask if no mask
Alyssa Rosenzweig [Sun, 18 Dec 2022 04:56:52 +0000 (23:56 -0500)]
nir/lower_blend: No-op nir_color_mask if no mask

In this usual case, do a quick check to avoid generating 5 useless instructions
(mov/vec4 instructions). They'll get copypropped but that creates more work for
the optimizer and nir/lower_blend runs in a hot variant path on both Asahi and
Panfrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>

18 months agonir/lower_blend: Handle undefs in stores
Alyssa Rosenzweig [Tue, 29 Nov 2022 01:26:26 +0000 (20:26 -0500)]
nir/lower_blend: Handle undefs in stores

nir/lower_blend asserts:

   assert(nir_intrinsic_write_mask(store) ==
          nir_component_mask(store->num_components));

For the special blend shaders used in Panfrost, this holds. But for arbitrary
shaders coming out of GLSL-to-NIR (as used with Asahi), this does not hold. In
particular, after nir_opt_undef runs, undefined components can be trimmed.
Concretely, if we have the shader:

    gl_FragColor.xyz = foo;

Then this becomes in NIR

   gl_FragColor = vec4(foo.xyz, undef);

and then opt_undef will give the store_deref a wrmask of xyz but 4 components.
Then lower_blend asserts out.

Found in a gfxbench shader on asahi.

Closes: #6982
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>

18 months agonir/lower_blend: Don't do logic ops on pure float
Alyssa Rosenzweig [Sat, 26 Nov 2022 02:40:42 +0000 (21:40 -0500)]
nir/lower_blend: Don't do logic ops on pure float

Per the spec.

Fixes arb_color_buffer_float-render on both Panfrost and Asahi (before/after
reproduced on Mali-T860 and AGX G13 respectively). Without that patch, that test
fails the assertion:

arb_color_buffer_float-render: ../src/compiler/nir/nir_lower_blend.c:259: nir_blend_logicop: Assertion `util_format_is_pure_integer(format)' failed.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>

18 months agonir/lower_blend: Avoid useless iand with logic ops
Alyssa Rosenzweig [Sat, 26 Nov 2022 02:40:38 +0000 (21:40 -0500)]
nir/lower_blend: Avoid useless iand with logic ops

The upper bits start correctly, there's no need to clear them as long as we keep
them zero'ed by using ixor with a valid bit mask instead of inot.

Makes the code generated for logic op slightly less ridiculous. I'm joking. It's
still ridiculous but I'm not in the mood to fix up the Midgard compiler and it's
just a little ALU for a feature almost nothing uses.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>

18 months agonir/lower_blend: Fix SNORM logic ops
Alyssa Rosenzweig [Sat, 26 Nov 2022 02:40:30 +0000 (21:40 -0500)]
nir/lower_blend: Fix SNORM logic ops

We need to sign extend. Incidentally this means the iand above is useless for
SNORM.

Fixes arb_color_buffer_float-render with GL_RGBA8_SNORM.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>

18 months agonir/lower_blend: Clamp blend factors
Alyssa Rosenzweig [Sat, 26 Nov 2022 02:40:16 +0000 (21:40 -0500)]
nir/lower_blend: Clamp blend factors

Particularly constant colours, but also (more obscurely) SNORM.

Fixes arb_color_buffer_float-render with SNORM framebuffers. Issue affects both
Asahi and Panfrost (the latter after we start advertising EXT_render_snorm).

v2: Check the blend factor to avoid unnecessary clamps. This avoids regressing
blend shader code quality on Panfrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com> [v1]
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>

18 months agonir/lower_blend: Fix alpha=1 for RGBX format
Alyssa Rosenzweig [Sat, 12 Nov 2022 18:50:07 +0000 (13:50 -0500)]
nir/lower_blend: Fix alpha=1 for RGBX format

In this case we have 4 components but the value of the fourth component
is undefined. Apply the fixup we already have.

Fixes
dEQP-GLES3.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.0
on Asahi. That test blend with DST_ALPHA with its RGB565 attachment,
which is fine if RGB565 is preserved, but Asahi is demoting that
format to RGBX8 which means -- after lowering the tilebuffer access --
we blend with an ssa_undef.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20016>

18 months agod3d12: Add support for Xbox GDK.
Caleb Cornett [Wed, 11 Jan 2023 17:28:34 +0000 (12:28 -0500)]
d3d12: Add support for Xbox GDK.

The big items in this patch:
- New screen file, to support the Xbox "windowing" system
- Lots of small macros/changes to support the Xbox D3D12 API without messing with the Win32 path too much
- A few changes to avoid requiring COM interfaces (the big one was QueryInterface which is unsupported)

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Co-authored-by: David Jacewicz <david.jacewicz@protonmail.com>
Co-authored-by: tieuchanlong <tieuchanlong@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19022>

18 months agowgl: Add support for Xbox GDK.
Caleb Cornett [Wed, 11 Jan 2023 15:48:49 +0000 (10:48 -0500)]
wgl: Add support for Xbox GDK.

This patch is comprised of three main changes:
- Add a "shim" for GDI, since Xbox doesn't expose this library
- New framebuffer file, to support the Xbox "windowing" system
- Implement a custom WndProc hook for Xbox, since SetWindowsHookEx isn't supported either

Other than that, it's similar to the previous Xbox commits which mostly disable Win32-specific logic.

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Co-authored-by: David Jacewicz <david.jacewicz@protonmail.com>
Co-authored-by: tieuchanlong <tieuchanlong@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19022>

18 months agodxil_validator: Add support for Xbox GDK.
Caleb Cornett [Wed, 11 Jan 2023 15:48:56 +0000 (10:48 -0500)]
dxil_validator: Add support for Xbox GDK.

In addition to the DLL names being different, we don't have to do the versioning work since we don't have to fuss with known bad versions (for example).

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Co-authored-by: David Jacewicz <david.jacewicz@protonmail.com>
Co-authored-by: tieuchanlong <tieuchanlong@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19022>

18 months agoutil: Add #ifdefs for Xbox GDK support.
Caleb Cornett [Wed, 11 Jan 2023 15:43:59 +0000 (10:43 -0500)]
util: Add #ifdefs for Xbox GDK support.

For the most part this just disables debug/console code, with the minor exception of u_memstream_open.

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Co-authored-by: David Jacewicz <david.jacewicz@protonmail.com>
Co-authored-by: tieuchanlong <tieuchanlong@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19022>

18 months agofutex: Change INT_MAX to INT32_MAX.
Caleb Cornett [Wed, 11 Jan 2023 15:43:25 +0000 (10:43 -0500)]
futex: Change INT_MAX to INT32_MAX.

Some platforms (i.e. Xbox) don't have INT_MAX, so use the stdint constant instead.

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Co-authored-by: David Jacewicz <david.jacewicz@protonmail.com>
Co-authored-by: tieuchanlong <tieuchanlong@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19022>