platform/upstream/mesa.git
2 years agonir/lower_clip: increment num_inputs/outputs by appropriate amount
Ilia Mirkin [Mon, 22 Nov 2021 22:54:50 +0000 (17:54 -0500)]
nir/lower_clip: increment num_inputs/outputs by appropriate amount

The inputs/outputs are meant to be in vec4 units.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

2 years agonir/lower_clip: location offset goes into offset, not base
Ilia Mirkin [Mon, 22 Nov 2021 22:54:09 +0000 (17:54 -0500)]
nir/lower_clip: location offset goes into offset, not base

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

2 years agonir/lower_clip: replace bogus comment about gl_ClipDistance reading in GL
Ilia Mirkin [Sun, 21 Nov 2021 08:18:25 +0000 (03:18 -0500)]
nir/lower_clip: replace bogus comment about gl_ClipDistance reading in GL

gl_ClipDistance most definitely can be read in fragment shaders since
GLSL 1.30. This is also accessible in ES with EXT_clip_cull_distance.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

2 years agoegl/wayland: use surface dma-buf feedback to allocate surface buffers
Leandro Ribeiro [Mon, 26 Jul 2021 20:53:24 +0000 (17:53 -0300)]
egl/wayland: use surface dma-buf feedback to allocate surface buffers

As explained in "egl/wayland: add initial dma-buf feedback support", we
still don't use the per-surface dma-buf feedback. In this patch we start
to use it.

If per-surface dma-buf feedback is advertised, use it to allocate
surface buffers. Also, the dma-buf protocol states that the feedback is
resent only when the client is using a suboptimal format/modifier pair.
So listen for new per-surface feedback events and reallocate the surface
buffers based on them. We can't change the format of a buffer, but we
can pick a new modifier.

This patch is based on previous work of Scott Anderson (@ascent).

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: move loader_dri_create_image() calls to separate functions
Leandro Ribeiro [Tue, 8 Jun 2021 18:13:40 +0000 (15:13 -0300)]
egl/wayland: move loader_dri_create_image() calls to separate functions

In get_back_bo() we have two calls to loader_dri_create_image() and some
overhead. As in the next commit we add another call to this same
function and more overhead to get_back_bo(), it starts to lose
legibility.

So move loader_dri_create_image() calls to separate functions, allowing
us to have an easier to read get_back_bo(). It also adds some minor
style changes.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: add initial dma-buf feedback support
Leandro Ribeiro [Mon, 15 Nov 2021 16:51:12 +0000 (13:51 -0300)]
egl/wayland: add initial dma-buf feedback support

This bumps the supported dma-buf version up to 4 and adds the initial
dma-buf feedback implementation. It follows the changes in the dma-buf
protocol extension [1] to include the dma-buf feedback interface, which
should be incorporated by most Wayland compositors in the future.

From version 4 onwards, the dma-buf modifier events are not sent by the
compositor anymore, so we use the default feedback to pick the set of
formats/modifiers supported by the compositor. Also, we try to avoid the
wl_drm device event and instead use the dma-buf feedback main device. We
only fallback to wl_drm when the compositor advertises a device that
does not have a render node associated.

In this initial dma-buf feedback implementation we still don't do
anything with the per-surface dma-buf feedback, but in the next commits
we add proper support.

It's important to mention that this also bumps the minimal supported
version of wayland-protocols to 1.24, in order to include [1].

[1] https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/8

This patch is based on previous work of Scott Anderson (@ascent).

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoloader: add function to get render node from dev_t
Leandro Ribeiro [Mon, 15 Nov 2021 16:50:50 +0000 (13:50 -0300)]
loader: add function to get render node from dev_t

Add function loader_get_render_node() to help us to get a render node
from dev_t. If the device does not expose a render node, this new
function returns NULL.

As this function uses drmGetDeviceFromDevId(), we bump libdrm minimal
version to 2.4.109.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: remove unused constant EGL_DRI2_NUM_FORMATS
Leandro Ribeiro [Tue, 29 Jun 2021 00:18:31 +0000 (21:18 -0300)]
egl/wayland: remove unused constant EGL_DRI2_NUM_FORMATS

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: move formats and modifiers to a separate struct
Leandro Ribeiro [Mon, 28 Jun 2021 23:42:11 +0000 (20:42 -0300)]
egl/wayland: move formats and modifiers to a separate struct

This will allow us to remove EGL_DRI2_NUM_FORMATS (as explained in
"egl/wayland: remove unused constant EGL_DRI2_NUM_FORMATS") and it will
also help to add the dma-buf feedback support. Both changes happen in
the next commits.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: do not try to access memory if allocation failed
Leandro Ribeiro [Tue, 29 Jun 2021 00:06:17 +0000 (21:06 -0300)]
egl/wayland: do not try to access memory if allocation failed

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: deprecate drm_handle_format() and drm_handle_capabilities()
Leandro Ribeiro [Mon, 28 Jun 2021 22:28:35 +0000 (19:28 -0300)]
egl/wayland: deprecate drm_handle_format() and drm_handle_capabilities()

Most Wayland compositors have already implemented the dma-buf protocol
extension. So we can stop relying on the wl_drm events and start to
depend only on the dma-buf interface to receive format/modifier pairs
and create wl_buffer's. So we can deprecate drm_handle_format() and
drm_handle_capabilities().

Note that we still use the wl_drm interface to find out the DRM device
that the compositor is using, so we can't deprecate it fully for now. In
the future (when the dma-buf feedback interface is added to the dma-buf
protocol extension [1] and most compositors incorporate it) we may be
able to fully deprecate wl_drm.

[1] https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/8

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: replace EGL_DRI2_MAX_FORMATS by EGL_DRI2_NUM_FORMATS
Leandro Ribeiro [Mon, 28 Jun 2021 16:57:19 +0000 (13:57 -0300)]
egl/wayland: replace EGL_DRI2_MAX_FORMATS by EGL_DRI2_NUM_FORMATS

Currently we have a weird design. We have a hardcoded array (named
dri2_wl_visuals) with all the formats that we support, which are 9.

And we also have EGL_DRI2_MAX_FORMATS, which is a constant set to 10. In
patches in which people added new formats to dri2_wl_visuals, this
constant had its value increased. This is confusing, as its name gives
the idea that we can't support more formats.

This constant is only used to define the bitset size of
dri2_egl_display::formats. And it should work just fine if we created
this bitset with the number of formats supported.

To make things clearer, replace EGL_DRI2_MAX_FORMATS by
EGL_DRI2_NUM_FORMATS, which must be equal to ARRAY_SIZE(dri2_wl_visuals)
(i.e. the number of supported formats).

In the next commits we get rid of this constant completely, as it is
prone to errors.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl/wayland: Remove unused wayland enum
Scott Anderson [Fri, 15 May 2020 08:42:45 +0000 (20:42 +1200)]
egl/wayland: Remove unused wayland enum

Signed-off-by: Scott Anderson <scott@anderso.nz>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoegl: remove unnecessary spaces after types
Leandro Ribeiro [Mon, 28 Jun 2021 20:36:33 +0000 (17:36 -0300)]
egl: remove unnecessary spaces after types

If we want to add a variable with a type name that is too long, we have
to realign all the variables within these structs. The other option is
to ignore and don't realign, and then we end up with a very ugly code.

So get rid of these unnecessary spaces, as they don't bring anything
useful. Instead, they are annoying.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoci: Upgrade to libdrm 2.4.109
Daniel Stone [Thu, 25 Nov 2021 22:16:26 +0000 (23:16 +0100)]
ci: Upgrade to libdrm 2.4.109

Required for being able to use drmGetDeviceFromDevId in the loader.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoci: Consistently build Wayland and protocols
Daniel Stone [Thu, 25 Nov 2021 15:59:44 +0000 (16:59 +0100)]
ci: Consistently build Wayland and protocols

Rather than relying on distro packages, build libwayland and
wayland-protocols from known versions everywhere we need it.

The only place we do not do so but rely on distro packages is the LAVA
rootfs, for which it does not matter right now since the version is
sufficiently new, but this could/should be cleaned up later.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoci: Use common build script for libwayland
Daniel Stone [Thu, 25 Nov 2021 15:49:03 +0000 (16:49 +0100)]
ci: Use common build script for libwayland

Rather than open-coding libwayland install for each container, create a
common build script like the rest, using both git and meson like the
rest.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>

2 years agoradv: advertise VK_KHR_synchronization2
Samuel Pitoiset [Tue, 12 Oct 2021 11:35:10 +0000 (13:35 +0200)]
radv: advertise VK_KHR_synchronization2

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: switch the remaining stages/access to VK_PIPELINE_STAGE_2/VK_ACCESS_2
Samuel Pitoiset [Tue, 12 Oct 2021 16:41:55 +0000 (18:41 +0200)]
radv: switch the remaining stages/access to VK_PIPELINE_STAGE_2/VK_ACCESS_2

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: add support for VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR
Samuel Pitoiset [Thu, 14 Oct 2021 09:10:09 +0000 (11:10 +0200)]
radv: add support for VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: add support for new pipeline stages and access masks
Samuel Pitoiset [Thu, 14 Oct 2021 08:52:20 +0000 (10:52 +0200)]
radv: add support for new pipeline stages and access masks

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: add support for creating device-only events
Samuel Pitoiset [Wed, 13 Oct 2021 12:40:59 +0000 (14:40 +0200)]
radv: add support for creating device-only events

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: add support for VkMemoryBarrier2KHR
Samuel Pitoiset [Tue, 12 Oct 2021 15:54:41 +0000 (17:54 +0200)]
radv: add support for VkMemoryBarrier2KHR

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: implement vkQueueSubmit2KHR()
Samuel Pitoiset [Thu, 14 Oct 2021 07:55:16 +0000 (09:55 +0200)]
radv: implement vkQueueSubmit2KHR()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: implement vkCmdWaitEvents2KHR()/vkCmdPipelineBarrier2KHR()
Samuel Pitoiset [Tue, 12 Oct 2021 16:41:34 +0000 (18:41 +0200)]
radv: implement vkCmdWaitEvents2KHR()/vkCmdPipelineBarrier2KHR()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: implement vkCmdWriteBufferMarker2AMD()
Samuel Pitoiset [Tue, 12 Oct 2021 16:32:21 +0000 (18:32 +0200)]
radv: implement vkCmdWriteBufferMarker2AMD()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: implement vkCmd{Reset,Set}Event2KHR()
Samuel Pitoiset [Tue, 12 Oct 2021 16:32:08 +0000 (18:32 +0200)]
radv: implement vkCmd{Reset,Set}Event2KHR()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradv: implement vkCmdWriteTimestamp2KHR()
Samuel Pitoiset [Tue, 12 Oct 2021 16:31:42 +0000 (18:31 +0200)]
radv: implement vkCmdWriteTimestamp2KHR()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13549>

2 years agoradeonsi: print the shader stage for shader-db dumps
Marek Olšák [Wed, 24 Nov 2021 18:56:32 +0000 (13:56 -0500)]
radeonsi: print the shader stage for shader-db dumps

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

2 years agoradeonsi: print source_sha1 as part of shader dumps
Marek Olšák [Thu, 18 Nov 2021 14:36:11 +0000 (09:36 -0500)]
radeonsi: print source_sha1 as part of shader dumps

It's not part of the shader key, but I don't know where else to put it.

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

2 years agonir: add shader_info::source_sha1, its initialization and printing
Marek Olšák [Thu, 18 Nov 2021 14:28:17 +0000 (09:28 -0500)]
nir: add shader_info::source_sha1, its initialization and printing

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

2 years agoutil: add SHA1 printing and comparison functions
Marek Olšák [Thu, 18 Nov 2021 22:19:39 +0000 (17:19 -0500)]
util: add SHA1 printing and comparison functions

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

2 years agomesa: don't compute the same SHA1 twice in glShaderSource
Marek Olšák [Fri, 19 Nov 2021 08:04:11 +0000 (03:04 -0500)]
mesa: don't compute the same SHA1 twice in glShaderSource

We can just use original_sha1.

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

2 years agomesa: add gl_linked_shader::linked_source_sha1
Marek Olšák [Thu, 18 Nov 2021 14:15:27 +0000 (09:15 -0500)]
mesa: add gl_linked_shader::linked_source_sha1

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

2 years agomesa: add shader source SHA1s that are propagated up to glCompileShader
Marek Olšák [Thu, 18 Nov 2021 13:44:29 +0000 (08:44 -0500)]
mesa: add shader source SHA1s that are propagated up to glCompileShader

glCompileShader can use two different sources, so we need 2 different SHA1s
there. Successful compilation sets compiled_source_sha1.

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

2 years agomesa: rename gl_shader::sha1 to disk_cache_sha1
Marek Olšák [Thu, 18 Nov 2021 13:40:29 +0000 (08:40 -0500)]
mesa: rename gl_shader::sha1 to disk_cache_sha1

there will be more sha1s

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

2 years agomesa: remove SourceChecksum from shader structures
Marek Olšák [Thu, 18 Nov 2021 13:37:47 +0000 (08:37 -0500)]
mesa: remove SourceChecksum from shader structures

it will be replaced by sha1.

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

2 years agoradeonsi: rename si_get_shader_wave_size and make it non-inline
Marek Olšák [Wed, 24 Nov 2021 18:21:18 +0000 (13:21 -0500)]
radeonsi: rename si_get_shader_wave_size and make it non-inline

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

2 years agoradeonsi: centralize wave size computation in si_get_shader_wave_size
Marek Olšák [Thu, 18 Nov 2021 23:36:37 +0000 (18:36 -0500)]
radeonsi: centralize wave size computation in si_get_shader_wave_size

The big comment was not really true.

The other debug options are unused right now, but will be used again
in the future.

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

2 years agoradeonsi: don't use compute_wave_size directly
Marek Olšák [Fri, 19 Nov 2021 11:39:04 +0000 (06:39 -0500)]
radeonsi: don't use compute_wave_size directly

It will be removed.

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

2 years agoradeonsi: propagate si_shader::wave_size to VGT_SHADER_STAGES
Marek Olšák [Fri, 19 Nov 2021 09:44:27 +0000 (04:44 -0500)]
radeonsi: propagate si_shader::wave_size to VGT_SHADER_STAGES

instead of hardcoding them

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

2 years agoradeonsi: clean up compute_wave_size use in si_compute_blit.c
Marek Olšák [Fri, 19 Nov 2021 09:31:54 +0000 (04:31 -0500)]
radeonsi: clean up compute_wave_size use in si_compute_blit.c

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

2 years agoradeonsi: don't use si_get_wave_size in si_get_ir_cache_key
Marek Olšák [Thu, 18 Nov 2021 23:44:00 +0000 (18:44 -0500)]
radeonsi: don't use si_get_wave_size in si_get_ir_cache_key

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

2 years agoradeonsi: use si_shader::wave_size
Marek Olšák [Fri, 19 Nov 2021 09:01:34 +0000 (04:01 -0500)]
radeonsi: use si_shader::wave_size

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

2 years agoradeonsi: add si_shader::wave_size because it will vary
Marek Olšák [Fri, 19 Nov 2021 08:46:29 +0000 (03:46 -0500)]
radeonsi: add si_shader::wave_size because it will vary

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

2 years agoradeonsi: add wave32 flag into prolog/epilog keys
Marek Olšák [Thu, 18 Nov 2021 23:19:45 +0000 (18:19 -0500)]
radeonsi: add wave32 flag into prolog/epilog keys

It will vary between shaders.

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

2 years agoradeonsi: don't print uninitialized inlined_uniform_values
Marek Olšák [Thu, 18 Nov 2021 22:36:14 +0000 (17:36 -0500)]
radeonsi: don't print uninitialized inlined_uniform_values

We don't set them and we don't read them if they are disabled, so don't
print them either. This silences valgrind warnings.

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

2 years agodriconf: enable glthread for Basemark GPU
Marek Olšák [Wed, 24 Nov 2021 21:40:01 +0000 (16:40 -0500)]
driconf: enable glthread for Basemark GPU

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

2 years agodriconf: enable glthread for Minecraft
Marek Olšák [Wed, 24 Nov 2021 17:58:48 +0000 (12:58 -0500)]
driconf: enable glthread for Minecraft

+30% performance

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

2 years agodriconf: enable glthread for all Unigine benchmarks
Marek Olšák [Wed, 24 Nov 2021 13:15:10 +0000 (08:15 -0500)]
driconf: enable glthread for all Unigine benchmarks

It helps.

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

2 years agoaco: fix right shift of exponent 32 detected by UBSAN
Samuel Pitoiset [Thu, 25 Nov 2021 06:36:10 +0000 (07:36 +0100)]
aco: fix right shift of exponent 32 detected by UBSAN

src/amd/compiler/aco_optimizer.cpp:1316:17: runtime error: shift
exponent 32 is too large for 32-bit type 'unsigned int'

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

2 years agoradv: fix OOB access for inline push constants detected by UBSAN
Samuel Pitoiset [Thu, 25 Nov 2021 11:33:57 +0000 (12:33 +0100)]
radv: fix OOB access for inline push constants detected by UBSAN

src/amd/vulkan/radv_cmd_buffer.c:3232:75: runtime error: index 252 out
of bounds for type 'uint8_t [128]'

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

2 years agoac/nir: fix left shift of 1 by 31 places detected by UBSAN
Samuel Pitoiset [Wed, 24 Nov 2021 13:18:47 +0000 (14:18 +0100)]
ac/nir: fix left shift of 1 by 31 places detected by UBSAN

src/amd/common/ac_nir_lower_ngg.c:1135:62: runtime error: left shift
of 1 by 31 places cannot be represented in type 'int

src/amd/common/ac_nir_lower_ngg.c:622:20: runtime error: left shift
of 1 by 31 places cannot be represented in type 'int'

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

2 years agoutil/cpu_detect, gallium: use cpu_family CPU_S390X instead of separate flag
Marius Hillenbrand [Thu, 25 Nov 2021 11:48:27 +0000 (12:48 +0100)]
util/cpu_detect, gallium: use cpu_family CPU_S390X instead of separate flag

to also get rid of the additional function that I introduced before.

Fixes: 82b261417e53 ("util/cpu_detect: Add flag for IBM Z (s390x)")

Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13958>

2 years agoir3/cp: Prevent setting an address on subgroup macros
Danylo Piliaiev [Tue, 23 Nov 2021 16:57:17 +0000 (18:57 +0200)]
ir3/cp: Prevent setting an address on subgroup macros

These macros expand to a mov in an if statement which breaks address
assumption that instruction which produces address and consumes it
are in the same block.

Fixes test:
 dEQP-VK.subgroups.ballot_broadcast.framebuffer.subgroupbroadcast_intvertex

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

2 years agomesa: add a more straightforward callback for replacing shaders
Marek Olšák [Wed, 24 Nov 2021 17:49:08 +0000 (12:49 -0500)]
mesa: add a more straightforward callback for replacing shaders

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

2 years agoir3/lower_subgroups: Fix potential infinite loop
Connor Abbott [Tue, 23 Nov 2021 15:21:24 +0000 (16:21 +0100)]
ir3/lower_subgroups: Fix potential infinite loop

I was trying to be clever here, skipping ahead to the newly-created
block and processing the remaining instructions after the split in the
same loop. But if the last instruction in a block was lowered, the saved
next instruction would be the head of the block before the split, not
the new block, and we would compare it to the new block so we wouldn't
stop like we were supposed to. Stop being so clever, and just restart
processing with the new block after lowering an instruction.

Because we're wrapping the actual transform in yet another loop, and the
restarting logic is a bit tricky, refactor the actual lowering into a
separate lower_instr function. Otherwise we'd be mixing the two and
indenting the actual logic even more.

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

2 years agodocs/release-calendar: remove additional 21.2 releases
Dylan Baker [Thu, 25 Nov 2021 05:25:02 +0000 (21:25 -0800)]
docs/release-calendar: remove additional 21.2 releases

21.3 is here, and will be releasing the .1 release before any of the
additional 21.2 releases would be made anyway.

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

2 years agodocs: update calendar and link releases notes for 21.2.6
Dylan Baker [Thu, 25 Nov 2021 05:24:37 +0000 (21:24 -0800)]
docs: update calendar and link releases notes for 21.2.6

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

2 years agodocs: add sha256 sums for 21.2.6 relnotes
Dylan Baker [Thu, 25 Nov 2021 05:22:06 +0000 (21:22 -0800)]
docs: add sha256 sums for 21.2.6 relnotes

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

2 years agodocs: add release notes for 21.2.6
Dylan Baker [Wed, 24 Nov 2021 23:47:39 +0000 (15:47 -0800)]
docs: add release notes for 21.2.6

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

2 years agomeson: bump meson requirement to 0.53.0
Alejandro Piñeiro [Sun, 21 Nov 2021 21:45:15 +0000 (22:45 +0100)]
meson: bump meson requirement to 0.53.0

Needed to avoid the following error:
   meson.build:936:0: ERROR: Tried to access unknown option "cpp_rtti"

Fixes: ad8626741236 ("meson: Don't override built-in cpp_rtti option, error if it's invalid")

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13905>

2 years agoradv: Set RB+ registers correctly without framebuffer.
Bas Nieuwenhuizen [Mon, 8 Nov 2021 12:21:30 +0000 (13:21 +0100)]
radv: Set RB+ registers correctly without framebuffer.

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

2 years agoradv: Remove the skipping of framebuffer emission if we don't have a framebuffer.
Bas Nieuwenhuizen [Sun, 7 Nov 2021 19:30:01 +0000 (20:30 +0100)]
radv: Remove the skipping of framebuffer emission if we don't have a framebuffer.

This was plain broken. The solution is to not require any framebuffer
changes. Silently skipping results in broken behavior. e.g:

(secondary cmdbuffer with no framebuffer)
ClearAttachment 2

translated into

bind attachment 2 as attachment 0 (skipped)
clear attachment 0
restore original bindings (skipped)

which results in clearing attachment 0, not what we wanted. It is
a small wonder CTS doesn't find it until VK_KHR_dynamic_rendering.

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

2 years agoradv: Stop using a subpass for color clears.
Bas Nieuwenhuizen [Sun, 7 Nov 2021 19:19:49 +0000 (20:19 +0100)]
radv: Stop using a subpass for color clears.

They might not be available in secondary cmdbuffers with inheritance.

To avoid binding anything we need to create pipelines per attachment
index. I've excluded these from the "compile on device creation" set
because I think almost nobody will need them.

Alternative solution would be to reuse the same shader but muck with
a bunch of registers to shift them for the attachment index. That is
however a lot of complexity and has to execute on every pipeline
change, which is probably more expensive in overhead and definitely
in complexity.

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

2 years agoradv: Avoid using a new subpass for ds clears.
Bas Nieuwenhuizen [Sun, 7 Nov 2021 19:29:56 +0000 (20:29 +0100)]
radv: Avoid using a new subpass for ds clears.

If we have an inherited subpass in a cmdbuffer we can't really
emit any framebuffer data if it isn't provided.

Note we still do it for resolve clears, but we can't have that
in a secondary cmdbuffer with inherited renderpass.

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

2 years agoutil/u_trace: refcount payloads
Lionel Landwerlin [Sat, 20 Nov 2021 23:06:09 +0000 (01:06 +0200)]
util/u_trace: refcount payloads

When cloning a chunk of tracepoints, we cannot just copy the elements
of the traces[] array. We also need the payloads associated with
those.

This change introduces a new u_trace_payloaf_buf object that is
refcounted so that we can easily import traces[] elements and their
payloads from one utrace to another.

v2: use u_vector (Danylo)

v3: Delete outdate comment (Danylo)
    Fix assert (Danylo)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 0565c993f9eff9 ("u_trace: helpers for tracing tiling GPUs and re-usable VK cmdbuffers")
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13899>

2 years agoanv: fix execbuf syncobjs/syncobj_values array leak
Lionel Landwerlin [Wed, 24 Nov 2021 15:28:24 +0000 (17:28 +0200)]
anv: fix execbuf syncobjs/syncobj_values array leak

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 36ea90a3619f ("anv: Convert to the common sync and submit framework")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13945>

2 years agonir/lower_subgroups: fix left shift of -1
Rhys Perry [Thu, 16 Sep 2021 16:35:25 +0000 (17:35 +0100)]
nir/lower_subgroups: fix left shift of -1

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5365
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12901>

2 years agonir/lower_tex: don't calculate texture_mask for texture_index>=32
Rhys Perry [Thu, 16 Sep 2021 16:24:46 +0000 (17:24 +0100)]
nir/lower_tex: don't calculate texture_mask for texture_index>=32

With Vulkan, texture_index can be 32 or larger, which creates a shift
exponent larger than 31 (undefined behaviour). Since we don't use
texture_mask with Vulkan, just initialize it to 0.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5365
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12901>

2 years agoradv: stop running copy-propagation before nir_opt_deref
Rhys Perry [Tue, 23 Nov 2021 13:36:43 +0000 (13:36 +0000)]
radv: stop running copy-propagation before nir_opt_deref

spirv_to_nir() now does this.

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

2 years agospirv: run nir_copy_prop before nir_rematerialize_derefs_in_use_blocks_impl
Rhys Perry [Tue, 23 Nov 2021 13:27:14 +0000 (13:27 +0000)]
spirv: run nir_copy_prop before nir_rematerialize_derefs_in_use_blocks_impl

spirv_to_nir sometimes wraps derefs in vec2 or mov instructions as part of
its texture handling. These get in the way of
nir_rematerialize_derefs_in_use_blocks_impl. Running copy propagation
should get rid of the extra move instructions and get us back to intact
deref chains for everything except variable pointer use-cases.

fossil-db (Sienna Cichlid):
Totals from 6 (0.00% of 134572) affected shaders:
CodeSize: 92656 -> 93088 (+0.47%)
Instrs: 17060 -> 17138 (+0.46%)
Latency: 224408 -> 227539 (+1.40%)
InvThroughput: 37402 -> 37924 (+1.40%)
VClause: 408 -> 402 (-1.47%)
Copies: 1065 -> 1107 (+3.94%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5668
Fixes: 14a12b771d0 ("spirv: Rework our handling of images and samplers")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13924>

2 years agovulkan: Unlock before return.
Sergii Melikhov [Tue, 23 Nov 2021 08:17:42 +0000 (10:17 +0200)]
vulkan: Unlock before return.

Fix defect reported by Coverity Scan CID-1494382.

Missing unlock (LOCK): Returning without unlocking queue->submit.mutex.

Fixes: 9bffd81f1cb7c ("vulkan: Add common implementations of vkQueueSubmit and vkQueueWaitIdle")

Signed-off-by: Sergii Melikhov <sergii.v.melikhov@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13933>

2 years agoradv: fix max_render_backends for Sienna Cichlid null winsys
Rhys Perry [Tue, 23 Nov 2021 14:27:46 +0000 (14:27 +0000)]
radv: fix max_render_backends for Sienna Cichlid null winsys

This affects NGG culling.

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

2 years agoradv: make RADV_FORCE_FAMILY case-insensitive
Rhys Perry [Tue, 23 Nov 2021 14:26:01 +0000 (14:26 +0000)]
radv: make RADV_FORCE_FAMILY case-insensitive

So I don't have to update my scripts each time I switch between
before/after cfc5c2abfd1.

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

2 years agoac/surface: allow gfx6-8 to enter the gfx9 DCC codepath for SI_FORCE_FAMILY
Marek Olšák [Wed, 15 Sep 2021 19:28:46 +0000 (15:28 -0400)]
ac/surface: allow gfx6-8 to enter the gfx9 DCC codepath for SI_FORCE_FAMILY

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

2 years agoac/gpu_info: don't fail on amdgpu_query_video_caps_info failures
Marek Olšák [Mon, 1 Nov 2021 14:50:04 +0000 (10:50 -0400)]
ac/gpu_info: don't fail on amdgpu_query_video_caps_info failures

When VCN is unsupported, we don't want to break GL or Vulkan.

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

2 years agobroadcom/compiler: make shaderdb debug output compatible with shaderdb's report tool
Alejandro Piñeiro [Mon, 22 Nov 2021 23:46:48 +0000 (00:46 +0100)]
broadcom/compiler: make shaderdb debug output compatible with shaderdb's report tool

Even although the option is called shaderdb, it is not really used by
shaderdb (for V3D shaderdb uses the debug option "precompile"). And in
fact, right now the output format is not compatible with shaderdb.

This commit tries to fix that, and as we are here, also try to make
the option more useful for the Vulkan case, as that debug option also
works with v3dv.

We can't really fully imitate shaderdb use with OpenGL (run with a set
of glsl shader tests), but we can at least assign a unique name (the
pipeline sha1 in text format) so we can compare executions of the same
vulkan application. For that remember to disable the on-disk cache.

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

2 years agomesa: add allow_glsl_compat_shaders for shader-db
Marek Olšák [Fri, 19 Nov 2021 04:14:01 +0000 (23:14 -0500)]
mesa: add allow_glsl_compat_shaders for shader-db

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

2 years agomesa: don't add attenuation constants if ffvp doesn't use them
Marek Olšák [Mon, 1 Nov 2021 16:00:06 +0000 (12:00 -0400)]
mesa: don't add attenuation constants if ffvp doesn't use them

This slightly decreases the size of constant buffers.

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

2 years agoradv: implement optimized MSAA copies using FMASK
Samuel Pitoiset [Fri, 20 Aug 2021 14:19:40 +0000 (16:19 +0200)]
radv: implement optimized MSAA copies using FMASK

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12555>

2 years agoradv: make radv_copy_buffer() a non-static function
Samuel Pitoiset [Mon, 23 Aug 2021 12:50:10 +0000 (14:50 +0200)]
radv: make radv_copy_buffer() a non-static function

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12555>

2 years agoradv: make radv_break_on_count() a non-static function
Samuel Pitoiset [Tue, 16 Nov 2021 10:36:31 +0000 (11:36 +0100)]
radv: make radv_break_on_count() a non-static function

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12555>

2 years agoamd/addrlib: Use get_supported_arguments to get compiler args.
Georg Lehmann [Fri, 25 Jun 2021 15:15:08 +0000 (17:15 +0200)]
amd/addrlib: Use get_supported_arguments to get compiler args.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11609>

2 years agomeson: Remove some unnecessary loops.
Georg Lehmann [Fri, 25 Jun 2021 15:07:41 +0000 (17:07 +0200)]
meson: Remove some unnecessary loops.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11609>

2 years agomeson: Use get_supported_arguments more often.
Georg Lehmann [Fri, 25 Jun 2021 15:05:31 +0000 (17:05 +0200)]
meson: Use get_supported_arguments more often.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11609>

2 years agolima/ppir: implement gl_FragDepth support
Vasily Khoruzhick [Wed, 17 Nov 2021 06:43:52 +0000 (22:43 -0800)]
lima/ppir: implement gl_FragDepth support

Mali4x0 supports writing depth and stencil from fragment shader
and we've been using it quite a while for depth/stencil buffer reload.

The missing part was specifying output register for depth/stencil.
To figure it out, I changed reload shader to use register $4 as output
and poked RSW bits (or rather consecutive 4 bit groups) until tests
that rely on reload started to pass again.

It turns out that register number for gl_FragDepth/gl_FragStencil is in
rsw->depth_test and register number for gl_FragColor is in
rsw->multi_sample and it's repeated 4 times for some reason (likely for
MSAA?)

With this knowledge we now can modify ppir compiler to support multiple
store_output intrinsics.

To do that just add destination SSA for store_output to the registers
list for regalloc and mark them explicitly as output. Since it's never
read in shader we have to take care about it in liveness analysis -
basically just mark it alive from the time when it's written to the end
of the block. If it's live only in the last instruction, mark it as
live_internal, so regalloc doesn't clobber it.

Then just let regalloc do its job, and then copy register number to the
shader state and program it in RSW.

The tricky part is gl_FragStencil, since it resides in the same register
as gl_FragDepth and with the current design of the compiler it's hard to
merge them. However gl_FragStencil doesn't seem to be part of GL2
or GLES2, so we can just leave it not implemented.

Also we need to take care of stop bit for instructions - now we can't
just set it in every instruction that stores output, since there may be
several outputs. So if there's any store_output instructions in the
block just mark that block has a stop, and set stop bit in the last
instruction in the block. The only exception is discard - we always need
to set stop bit in discard instruction.

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13830>

2 years agolima/ppir: check if mul node is a source of add node before inserting
Vasily Khoruzhick [Wed, 17 Nov 2021 04:24:25 +0000 (20:24 -0800)]
lima/ppir: check if mul node is a source of add node before inserting

We can't insert mul node into add node instruction if it's a virtual dep
(sequence or write_or_read dep), so use ppir_node_has_single_src_succ
in addition to ppir_node_has_single_succ.

We can't use ppir_node_has_single_src_succ alone, since node may have
a virtual dependency in addition to source dependency, and we can't
insert it either in this case.

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13830>

2 years agosvga: fix bitwise/logical and mixup
Thomas H.P. Andersen [Sun, 1 Aug 2021 10:52:56 +0000 (12:52 +0200)]
svga: fix bitwise/logical and mixup

The function need_temp_reg_initialization looks suspecious.

It will only ever return true if we get past this if:
if (!(emit->info.indirect_files && (1u << TGSI_FILE_TEMPORARY)) ...

Using the logical && means the intended initialization done
based on the result of this check is not performed.

This code was both introduced and altered in MR 5317.
ccb4ea5a introduces the function.
ba37d408 is a collection of performance improvements and misc
fixes. This altered the if from using bitwise to logical and.

This commit changes it back to bitwise.

Spotted from a compile warning.

Fixes: ba37d408da3 ("svga: Performance fixes")

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12157>

2 years agonine: remove dead code
Thomas H.P. Andersen [Sat, 31 Jul 2021 13:07:59 +0000 (15:07 +0200)]
nine: remove dead code

This line gets the cap but does not store it. The line has existed
unchanged since the original import in fdd96578.

Fixes a compile warning

Acked-by: Axel Davy davyaxel0@gmail.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12155>

2 years agoandroid.mk: Add missing variables to the make target
Roman Stratiienko [Mon, 22 Nov 2021 16:57:01 +0000 (18:57 +0200)]
android.mk: Add missing variables to the make target

Android build system may use different internal variables to specify
cflags/cppflags.
Small change in product confguration may force Android to use diffrent
set of variables, therefore we should keep all of them attached to the
make rule's target.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5549
Fixes: 8621bd8d5e67 ("android: Add scripts to build using meson")
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13914>

2 years agolavapipe: fix unused variable
Michel Zou [Sat, 20 Nov 2021 12:53:13 +0000 (13:53 +0100)]
lavapipe: fix unused variable

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

2 years agovulkan: fix uninitialized variables
Michel Zou [Sat, 20 Nov 2021 12:52:42 +0000 (13:52 +0100)]
vulkan: fix uninitialized variables

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

2 years agoturnip: implement VK_KHR_buffer_device_address
Danylo Piliaiev [Mon, 26 Jul 2021 10:55:39 +0000 (13:55 +0300)]
turnip: implement VK_KHR_buffer_device_address

We don't advertise bufferDeviceAddressCaptureReplay capability and
neither does blob, because at the moment there is no way to allocate
bo with predefined iova.

There is no support of any arithmetic with addresses since shaderInt64
is not enabled. However, we could enable int64 support whenever we want.

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

2 years agofreedreno/ir3: handle global atomics
Danylo Piliaiev [Mon, 26 Jul 2021 10:50:03 +0000 (13:50 +0300)]
freedreno/ir3: handle global atomics

Only for a6xx since we don't know the instructions for global
atomics on previous gens. Per Qualcomm's docs in OpenCL atomics
are only supported since a5xx together with Generic memory space.

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

2 years agofreedreno/ir3: add a6xx global atomics and separate atomic opcodes
Danylo Piliaiev [Fri, 22 Jan 2021 17:51:56 +0000 (19:51 +0200)]
freedreno/ir3: add a6xx global atomics and separate atomic opcodes

Separating atomic opcodes makes possible to express a6xx global
atomics which take iova in SRC1. They would be needed by
VK_KHR_buffer_device_address.
The change also makes easier to distiguish atomics in conditions.

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

2 years agollvmpipe: Use lp_build_round_arch on IBM Z (s390x)
Marius Hillenbrand [Thu, 18 Nov 2021 17:27:35 +0000 (18:27 +0100)]
llvmpipe: Use lp_build_round_arch on IBM Z (s390x)

LLVM has all the required intrinsics available on IBM Z, so use them for
rounding operations (they will be implemented as a single instruction).
This change makes the test case lp_test_arit pass, because it avoids
using the buggy generic code.

v2: update .gitlab-ci/cross-xfail-s390x to reflect passing lp_test_arit

Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13927>

2 years agoutil/cpu_detect: Add flag for IBM Z (s390x)
Marius Hillenbrand [Thu, 18 Nov 2021 17:25:41 +0000 (18:25 +0100)]
util/cpu_detect: Add flag for IBM Z (s390x)

As preparation for changing the behavior of LLVMpipe on IBM Z, add a
flag to detect that platform. As it is always known at compile-time, we
do not add it to the struct for cpu flags to avoid inflating that
struct's size.

Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13927>

2 years agofreedreno/ir3: remove unused actual_in counting
Ilia Mirkin [Sat, 20 Nov 2021 23:48:34 +0000 (18:48 -0500)]
freedreno/ir3: remove unused actual_in counting

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13918>

2 years agovirgl: Link shader program
Antonio Caggiano [Thu, 4 Nov 2021 13:51:19 +0000 (14:51 +0100)]
virgl: Link shader program

Add a new command associated to glLinkProgram. With this we should be
able to compile and link shaders when requested by the user, thus
avoiding that to happen in the middle of a frame.

Together with the command we pass an array of shader handles attached to
the program, where each position of the array corresponds to a pipe
shader type.

Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13674>