platform/upstream/mesa.git
2 years agoradeonsi: inline si_need_gfx_cs_space
Marek Olšák [Fri, 13 Aug 2021 13:36:30 +0000 (09:36 -0400)]
radeonsi: inline si_need_gfx_cs_space

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

2 years agowinsys/amdgpu: clean up amdgpu_cs_check_space
Marek Olšák [Wed, 11 Aug 2021 16:22:46 +0000 (12:22 -0400)]
winsys/amdgpu: clean up amdgpu_cs_check_space

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

2 years agoradeonsi: simplify si_need_gfx_cs_space
Marek Olšák [Wed, 11 Aug 2021 16:10:28 +0000 (12:10 -0400)]
radeonsi: simplify si_need_gfx_cs_space

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

2 years agoradeonsi: inline remaining big functions in draw_vbo for better snx perf
Marek Olšák [Wed, 11 Aug 2021 08:42:04 +0000 (04:42 -0400)]
radeonsi: inline remaining big functions in draw_vbo for better snx perf

This makes compilation slower, but the perf improvement is ~4%
with pipe_vertex_state.

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

2 years agoradeonsi: simplify memory usage checking by merging vram and gtt counters
Marek Olšák [Wed, 11 Aug 2021 08:50:53 +0000 (04:50 -0400)]
radeonsi: simplify memory usage checking by merging vram and gtt counters

no change in behavior

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

2 years agoradeonsi: correctly use cs instead of gfx_cs in build pm4 helpers
Marek Olšák [Wed, 11 Aug 2021 06:49:33 +0000 (02:49 -0400)]
radeonsi: correctly use cs instead of gfx_cs in build pm4 helpers

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

2 years agoradeonsi: use memcmp and radeon_emit_array in radeon_opt_set_context_regn
Marek Olšák [Wed, 11 Aug 2021 06:46:25 +0000 (02:46 -0400)]
radeonsi: use memcmp and radeon_emit_array in radeon_opt_set_context_regn

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

2 years agoradeonsi: stop using AC_EXP_PARAM_UNDEFINED because it's not useful
Marek Olšák [Wed, 11 Aug 2021 04:37:12 +0000 (00:37 -0400)]
radeonsi: stop using AC_EXP_PARAM_UNDEFINED because it's not useful

Just use AC_EXP_PARAM_DEFAULT_VAL_0000 to keep things simple.

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

2 years agoradeonsi: inline si_get_alpha_test_func
Marek Olšák [Tue, 10 Aug 2021 05:33:21 +0000 (01:33 -0400)]
radeonsi: inline si_get_alpha_test_func

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

2 years agoradeonsi: move as_ls/es/ngg setting out of si_shader_selector_key
Marek Olšák [Tue, 10 Aug 2021 04:55:52 +0000 (00:55 -0400)]
radeonsi: move as_ls/es/ngg setting out of si_shader_selector_key

Do it when we bind shaders.

The advantages are:
- no need to memset the fields when any shader variant state is changed
  (e.g. culling on/off)
- no need to recompute the fields every time that happens

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

2 years agoradeonsi: move si_vgt_stages_key determination into si_update_vgt_shader_config
Marek Olšák [Tue, 10 Aug 2021 04:15:41 +0000 (00:15 -0400)]
radeonsi: move si_vgt_stages_key determination into si_update_vgt_shader_config

This simplifies si_update_shaders. It also makes it more obvious that
si_update_shaders could become a C++ template one day.

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

2 years agoradeonsi: remove stages_key parameter from si_shader_selector_key
Marek Olšák [Tue, 10 Aug 2021 04:03:40 +0000 (00:03 -0400)]
radeonsi: remove stages_key parameter from si_shader_selector_key

no change in behavior

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

2 years agoradeonsi: remove instancing support from the prim discard compute shader
Marek Olšák [Tue, 10 Aug 2021 08:09:02 +0000 (04:09 -0400)]
radeonsi: remove instancing support from the prim discard compute shader

It's not important for workstation apps on Vega.

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

2 years agoradeonsi: remove unused depth_clamp_any
Marek Olšák [Tue, 10 Aug 2021 07:55:18 +0000 (03:55 -0400)]
radeonsi: remove unused depth_clamp_any

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

2 years agomesa: skip draw calls with unaligned indices
Marek Olšák [Tue, 24 Aug 2021 16:59:14 +0000 (12:59 -0400)]
mesa: skip draw calls with unaligned indices

GL doesn't say which error we should report. dEQP expects no error and
no crash and allows skipping the call. Some drivers can crash.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5227
Cc: mesa-stable@lists.freedesktop.org
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12533>

2 years agomesa: fix gl_DrawID with indirect multi draws using user indirect buffer
Marek Olšák [Tue, 24 Aug 2021 17:03:30 +0000 (13:03 -0400)]
mesa: fix gl_DrawID with indirect multi draws using user indirect buffer

The code lowered the draws to direct ones but disregarded gl_DrawID.
We need to pass the draw ID to the driver manually.

gl_DrawID is the 3rd parameter of DrawGallium here.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5274
Cc: mesa-stable@lists.freedesktop.org
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12533>

2 years agomesa: remove unused indices parameter from validate functions
Marek Olšák [Wed, 25 Aug 2021 00:07:08 +0000 (20:07 -0400)]
mesa: remove unused indices parameter from validate functions

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

2 years agolavapipe: VK_KHR_depth_stencil_resolve support
Dave Airlie [Thu, 24 Dec 2020 04:09:58 +0000 (14:09 +1000)]
lavapipe: VK_KHR_depth_stencil_resolve support

This adds support for depth stencil resolves to lavapipe.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12504>

2 years agou_blitter: add support for sample0 only resolves.
Dave Airlie [Mon, 23 Aug 2021 07:26:29 +0000 (17:26 +1000)]
u_blitter: add support for sample0 only resolves.

This adds support for sample0 only resolves to support lavapipe

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12504>

2 years agogallium: add a sample0 only option to blitter.
Dave Airlie [Mon, 23 Aug 2021 07:25:13 +0000 (17:25 +1000)]
gallium: add a sample0 only option to blitter.

Vulkan depth/stencil resolves can ask for just sample 0 instead
of averaging. Just add a flag to the state to allow it.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12504>

2 years agollvmpipe: adjust scissor planes for multisample.
Dave Airlie [Mon, 30 Aug 2021 04:44:47 +0000 (14:44 +1000)]
llvmpipe: adjust scissor planes for multisample.

For the inclusive x0/y0 planes, add a half pixel adjustment

For the exclusive x1/y1 planes, remove a half pixel adjustment

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12504>

2 years agollvmpipe/scissor: rewrite scissor planes interaction.
Dave Airlie [Mon, 30 Aug 2021 03:56:03 +0000 (13:56 +1000)]
llvmpipe/scissor: rewrite scissor planes interaction.

This just changes the calcs to be cleaner and easier to interpret.

Adjust the inclusive (x0/y0) by -1 like before, and then flip the
sign for the correct direction.

Add full pixel to the exclusive side after scaling, this is do
show that this value is incorrect and the next patch fixes that
taking multisample into account

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12504>

2 years agollvmpipe: consolidate scissor plane code between line/tri
Dave Airlie [Mon, 30 Aug 2021 03:52:29 +0000 (13:52 +1000)]
llvmpipe: consolidate scissor plane code between line/tri

This code is pretty much the same in both, consolidate it.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12504>

2 years agollvmpipe/fs: fix multisample depth/stencil fs writes.
Dave Airlie [Mon, 23 Aug 2021 07:15:17 +0000 (17:15 +1000)]
llvmpipe/fs: fix multisample depth/stencil fs writes.

The state wasn't storing the shader depth/stencil outputs
per-sample, so only the last sample emitted was being used
for the late depth test and stencil ref.

Noticed while trying to fix some vulkan depth stencil resolve
issues

Fixes: a0195240c44f ("llvmpipe: handle multisample early depth test/late depth write")

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12504>

2 years agovbo: check more GL errors when drawing via glCallList
Marek Olšák [Sun, 8 Aug 2021 06:18:35 +0000 (02:18 -0400)]
vbo: check more GL errors when drawing via glCallList

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

2 years agovbo: merge draws with GL_LINES regardless of line stippling
Marek Olšák [Thu, 17 Jun 2021 00:07:48 +0000 (20:07 -0400)]
vbo: merge draws with GL_LINES regardless of line stippling

see the code comment

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

2 years agoutil/cpu_detect: add/guess support for next Zen CPUs
Marek Olšák [Tue, 10 Aug 2021 16:09:57 +0000 (12:09 -0400)]
util/cpu_detect: add/guess support for next Zen CPUs

so that we don't have to update this anymore

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

2 years agoutil/cpu_detect: print num_L3_caches and num_cpu_mask_bits
Marek Olšák [Mon, 14 Jun 2021 20:33:01 +0000 (16:33 -0400)]
util/cpu_detect: print num_L3_caches and num_cpu_mask_bits

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

2 years agomain: allow all external textures for BindImageTexture
Quantum [Sun, 15 Aug 2021 21:44:04 +0000 (17:44 -0400)]
main: allow all external textures for BindImageTexture

According to OES_EGL_image_external_essl3:

  On p. 196 in the errors section for BindImageTexture, replace the
  last error with the following:

    "An INVALID_OPERATION error is generated if <texture> is neither the
     name of an immutable texture object, nor the name of an external
     texture object."

According to OES_EGL_image_external:

  The command

    void EGLImageTargetTexture2DOES(enum target, eglImageOES image);

  with <target> set to TEXTURE_EXTERNAL_OES defines the currently bound
  external texture object to be a target sibling of <image>.

  ...

  If <target> is not TEXTURE_EXTERNAL_OES, the error INVALID_ENUM is
  generated.  (Note: if GL_OES_EGL_image is supported then <target> may
  also be TEXTURE_2D).

Currently, mesa only allows GL_TEXTURE_EXTERNAL_OES textures to be bound
by glBindImageTexture. However, the language of the specification does not
appear to use "external" to refer to GL_TEXTURE_EXTERNAL_OES specifically,
since OES_EGL_image_external allows external eglImageOES to be attached
to GL_TEXTURE_2D in the presence of GL_OES_EGL_image. Thus, it should be
interpreted to refer to all types of external textures, including 2D
textures attached via glEGLImageTargetTexture2DOES.

Fixes: ed43dd62acc ("main: allow external textures for BindImageTexture")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12383>

2 years agovenus: set maxMipLevels to 1 for ahb images
Yiwei Zhang [Tue, 31 Aug 2021 20:04:41 +0000 (20:04 +0000)]
venus: set maxMipLevels to 1 for ahb images

Fixes: dEQP-VK.api.external.memory.android_hardware_buffer.image_formats.*

Cc: 21.2.2 mesa-stable
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12639>

2 years agoiris: Map scanout buffers WC instead of WB [v2]
Keith Packard [Fri, 6 Aug 2021 23:11:18 +0000 (16:11 -0700)]
iris: Map scanout buffers WC instead of WB [v2]

The scanout engine is not coherent with rendering, so make sure
scanout buffers are mapped WC. This ensures that CPU rendering as done
by the Xserver gets flushed to the frame buffer immediately instead of
waiting for some future time.

v2:
    Also mark shared buffers to be allocated for scanout
    in case they are being used for scanout elsewhere.

Signed-off-by: Keith Packard <keithp@keithp.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5231
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12259>

2 years agovenus: fix device group enumeration with unsupported devices
Chia-I Wu [Sun, 29 Aug 2021 04:42:32 +0000 (21:42 -0700)]
venus: fix device group enumeration with unsupported devices

instance->physical_devices includes only supported devices, not all
devices.  One example is that it does not include 1.0 devices.  We need
to fix up VkPhysicalDeviceGroupProperties to exclude unsupported
devices.

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

2 years agovenus: pre-initialize device groups
Chia-I Wu [Sun, 29 Aug 2021 03:40:33 +0000 (20:40 -0700)]
venus: pre-initialize device groups

We don't need to worry about how vkEnumeratePhysicalDeviceGroups is
called (props is NULL, props is non-NULL but count is 0, etc.) this way.
It also allows us to fix up VkPhysicalDeviceGroupProperties easily.

v2: let the for-loop increment (Yiwei)

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> (v1)
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12637>

2 years agovenus: minor cleanup to physical device init loop
Chia-I Wu [Sun, 29 Aug 2021 03:28:31 +0000 (20:28 -0700)]
venus: minor cleanup to physical device init loop

v2: let the for-loop increment (Yiwei)

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> (v1)
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12637>

2 years agoir3/ra: Fix type mismatch when comparing intervals
Connor Abbott [Fri, 20 Aug 2021 14:33:55 +0000 (16:33 +0200)]
ir3/ra: Fix type mismatch when comparing intervals

This was once a physreg, back in the very beginning of the new RA, but
now the caller passes an unsigned int.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5163
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12487>

2 years agoir3: Make ir3_register::name 32-bits
Connor Abbott [Fri, 20 Aug 2021 14:33:03 +0000 (16:33 +0200)]
ir3: Make ir3_register::name 32-bits

It was overflowing with
dEQP-VK.spirv_assembly.instruction.compute.spirv_ids_abuse.lots_ids.

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

2 years agoir3: Make instruction IP 32 bits
Connor Abbott [Fri, 20 Aug 2021 14:30:30 +0000 (16:30 +0200)]
ir3: Make instruction IP 32 bits

a6xx supports shaders with more than 64k dwords, or at least the shader
size register has increased in size, and the matching name is gone so
there's no reason to be clever here. This doesn't fix anything at the
moment.

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

2 years agoir3: Remove ir3_instr::name
Connor Abbott [Fri, 20 Aug 2021 14:28:19 +0000 (16:28 +0200)]
ir3: Remove ir3_instr::name

Unused since the switch to new RA.

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

2 years agonir_to_tgsi: Use explicit sizes of NIR variables for UBO declarations.
Emma Anholt [Mon, 2 Aug 2021 17:43:02 +0000 (10:43 -0700)]
nir_to_tgsi: Use explicit sizes of NIR variables for UBO declarations.

This fixes duplicate CB0 declarations, missing interface array
declarations, and too-low sizes of UBOs containing multiple nir_variables.

Closes: #4810
Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12175>

2 years agonir/nir_lower_uniforms_to_ubo: Set the explicit stride of the UBO 0 uniform.
Emma Anholt [Mon, 2 Aug 2021 17:47:54 +0000 (10:47 -0700)]
nir/nir_lower_uniforms_to_ubo: Set the explicit stride of the UBO 0 uniform.

Normal UBOs have explicit strides on them, make our lowered one behave the
same.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12175>

2 years agonir: Set .driver_location for GLSL UBO/SSBOs when we lower to block indices.
Emma Anholt [Mon, 2 Aug 2021 19:49:56 +0000 (12:49 -0700)]
nir: Set .driver_location for GLSL UBO/SSBOs when we lower to block indices.

Without this, there's no way to match the UBO nir_variable declarations to
the load_ubo intrinsics referencing their data.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12175>

2 years agoanv: Enable KHR_shader_integer_dot_product
Ian Romanick [Tue, 15 Jun 2021 02:49:32 +0000 (19:49 -0700)]
anv: Enable KHR_shader_integer_dot_product

For now, only mark the 4x8BitPacked variants as accelerated.

Applications are unlikely to use the "add with saturate" opcodes from
VK_INTEL_shader_integer_functions2, so, technically, all of the
AccumulatingSaturating variants "[provide] a performance advantage over
user-provided code composed from elementary instructions..." on all
Intel platforms.  If we encounter an application that cares, we can do
things differently then.  Ditto for the non-packed 8Bit, 4-element
vector variants.

v2: Don't memset props as this also zeros sType and pNext.  Noticed by
Georg Lehmann in !12617.

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

2 years agozink: ci updates
Mike Blumenkrantz [Tue, 31 Aug 2021 18:24:32 +0000 (14:24 -0400)]
zink: ci updates

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

2 years agodocs: mark off ES 3.2 for zink
Mike Blumenkrantz [Tue, 31 Aug 2021 15:44:28 +0000 (11:44 -0400)]
docs: mark off ES 3.2 for zink

blammo

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

2 years agozink: enable fbfetch pipe cap
Mike Blumenkrantz [Tue, 27 Jul 2021 18:04:35 +0000 (14:04 -0400)]
zink: enable fbfetch pipe cap

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

2 years agozink: add a renderpass flag for input attachment layout handling
Mike Blumenkrantz [Tue, 27 Jul 2021 18:04:14 +0000 (14:04 -0400)]
zink: add a renderpass flag for input attachment layout handling

this has special requirements

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

2 years agozink: update push descriptor set anytime fbfetch changes
Mike Blumenkrantz [Tue, 27 Jul 2021 18:03:50 +0000 (14:03 -0400)]
zink: update push descriptor set anytime fbfetch changes

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

2 years agozink: add an input attachment to the gfx push set layout to handle fbfetch
Mike Blumenkrantz [Tue, 27 Jul 2021 18:03:23 +0000 (14:03 -0400)]
zink: add an input attachment to the gfx push set layout to handle fbfetch

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

2 years agozink: fix lazy descriptor deinit
Mike Blumenkrantz [Tue, 27 Jul 2021 18:18:46 +0000 (14:18 -0400)]
zink: fix lazy descriptor deinit

this used to be the right conditional, but it's not anymore

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

2 years agozink: add an input attachment to the gfx push set layout to handle fbfetch
Mike Blumenkrantz [Tue, 27 Jul 2021 18:03:23 +0000 (14:03 -0400)]
zink: add an input attachment to the gfx push set layout to handle fbfetch

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

2 years agozink: flag color attachment images as input attachments at creation
Mike Blumenkrantz [Tue, 27 Jul 2021 18:02:32 +0000 (14:02 -0400)]
zink: flag color attachment images as input attachments at creation

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

2 years agozink: track fbfetch info on context, update as needed
Mike Blumenkrantz [Tue, 27 Jul 2021 17:59:39 +0000 (13:59 -0400)]
zink: track fbfetch info on context, update as needed

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

2 years agozink: refactor descriptor layout/template creation a little
Mike Blumenkrantz [Tue, 27 Jul 2021 17:56:07 +0000 (13:56 -0400)]
zink: refactor descriptor layout/template creation a little

make the push sets more flexible

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

2 years agozink: add a compiler pass to translate fbfetch -> input attachments
Mike Blumenkrantz [Tue, 27 Jul 2021 17:49:25 +0000 (13:49 -0400)]
zink: add a compiler pass to translate fbfetch -> input attachments

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

2 years agozink: emit fbfetch variables as ntv input attachments
Mike Blumenkrantz [Tue, 27 Jul 2021 17:44:32 +0000 (13:44 -0400)]
zink: emit fbfetch variables as ntv input attachments

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

2 years agozink: add input attachment thingy for spirv builder
Mike Blumenkrantz [Fri, 9 Jul 2021 12:57:19 +0000 (08:57 -0400)]
zink: add input attachment thingy for spirv builder

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

2 years agozink: move alphaToOne warning to a dynamic warning
Mike Blumenkrantz [Tue, 31 Aug 2021 16:23:10 +0000 (12:23 -0400)]
zink: move alphaToOne warning to a dynamic warning

stop spamming these if they aren't even being used

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

2 years agoci/llvmpipe: Add a fractional ASan run.
Emma Anholt [Fri, 20 Aug 2021 17:32:21 +0000 (10:32 -0700)]
ci/llvmpipe: Add a fractional ASan run.

This reproduces #5254 and seems like a good idea to be checking normally.

I think running some desktop GL would also be useful here, but it turns
out that desktop glcts is pretty leaky/overflowy inside of deqp.

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

2 years agomesa: add environment variable MESA_NO_SHADER_REPLACEMENT
Marek Olšák [Fri, 20 Aug 2021 16:25:34 +0000 (12:25 -0400)]
mesa: add environment variable MESA_NO_SHADER_REPLACEMENT

for performance comparisons

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

2 years agomeson: add missing custom target to generate shader_replacement.h
Marek Olšák [Fri, 20 Aug 2021 20:27:03 +0000 (16:27 -0400)]
meson: add missing custom target to generate shader_replacement.h

for custom shader replacements enabled by -Dcustom-shader-replacement=path.
process_shaders.py should generate shader_replacement.h, which should
contain shaders and their substitutions.

Loosely based on Pierre-Eric's commit.

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

2 years agovirgl/ci: enable some traces that were previously crashing
Italo Nicola [Wed, 18 Aug 2021 00:30:08 +0000 (21:30 -0300)]
virgl/ci: enable some traces that were previously crashing

Most of these are fixed in recent mesa and virglrenderer versions, but
some might still be flaky. We'll keep an eye on them and if they are
flaky we can disable them.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12643>

2 years agovirgl/ci: stop overriding GL version when running traces
Italo Nicola [Tue, 31 Aug 2021 13:48:58 +0000 (10:48 -0300)]
virgl/ci: stop overriding GL version when running traces

These environment variables make some traces that require higher GLSL
versions crash.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12643>

2 years agoci: Ensure the DRM device is open
Tomeu Vizoso [Mon, 30 Aug 2021 09:01:30 +0000 (11:01 +0200)]
ci: Ensure the DRM device is open

... before changing the PM settings.

Otherwise, we hit a kernel warning in Qualcomm devices and the device is
left in a non-functional state.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12644>

2 years agoaco: remove DPP when applying constants/literals/sgprs
Rhys Perry [Mon, 30 Aug 2021 09:30:45 +0000 (10:30 +0100)]
aco: remove DPP when applying constants/literals/sgprs

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12601>

2 years agoaco/tests: test copy propagation with DPP instructions
Rhys Perry [Fri, 27 Aug 2021 16:53:48 +0000 (17:53 +0100)]
aco/tests: test copy propagation with DPP instructions

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12601>

2 years agoaco: don't constant propagate to DPP instructions
Rhys Perry [Fri, 27 Aug 2021 16:50:11 +0000 (17:50 +0100)]
aco: don't constant propagate to DPP instructions

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12601>

2 years agoradeon/vcn: add a handling of error for incorrect reference lists
Leo Liu [Sun, 29 Aug 2021 17:28:51 +0000 (13:28 -0400)]
radeon/vcn: add a handling of error for incorrect reference lists

Use the first dpb buffer instead of the NULL pointer sent to hardware.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12610>

2 years agoradeon/vcn: reuse the dpb buffers when with the same size.
Leo Liu [Sun, 29 Aug 2021 16:24:12 +0000 (12:24 -0400)]
radeon/vcn: reuse the dpb buffers when with the same size.

To avoid allocate/deallocate frequently.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12610>

2 years agogallium: fix surface->destroy use-after-free
liuyujun [Tue, 24 Aug 2021 12:34:14 +0000 (20:34 +0800)]
gallium: fix surface->destroy use-after-free

regen surface on every update framebuffer

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: liuyujun <liuyujun@uniontech.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12520>

2 years agointel/fs: fix framebuffer reads
Lionel Landwerlin [Mon, 30 Aug 2021 10:03:26 +0000 (13:03 +0300)]
intel/fs: fix framebuffer reads

We're missing some restrictions on those messages.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5292
Cc: mesa-stable
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12615>

2 years agomeson: add crocus to default group of drivers for x86/x86_64
Filip Gawin [Mon, 30 Aug 2021 22:29:50 +0000 (00:29 +0200)]
meson: add crocus to default group of drivers for x86/x86_64

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

2 years agoradv/llvm: fix invalid IR when converting triangle strips to indices
Samuel Pitoiset [Fri, 27 Aug 2021 14:34:25 +0000 (16:34 +0200)]
radv/llvm: fix invalid IR when converting triangle strips to indices

Operand 0 of LLVMBuildSelect() should be i1.

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/12616>

2 years agoac/llvm: fix huge alignment when loading from shared memory
Samuel Pitoiset [Thu, 22 Apr 2021 08:35:24 +0000 (10:35 +0200)]
ac/llvm: fix huge alignment when loading from shared memory

LLVM doesn't support huge alignments, also it can optimize the shared
loads, so it's unecessary to emit better (but broken) LLVM IR.

Fixes a bunch of crashes with RADV_DEBUG=llvm,checkir.

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/12616>

2 years agoac/llvm: adjust assertion for nir_intrinsic_terminate
Samuel Pitoiset [Thu, 22 Apr 2021 08:25:10 +0000 (10:25 +0200)]
ac/llvm: adjust assertion for nir_intrinsic_terminate

Fixes dEQP-VK.spirv_assembly.instruction.terminate*.

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/12616>

2 years agomeson: fix regression finding shm dep
Dave Airlie [Mon, 30 Aug 2021 21:56:18 +0000 (07:56 +1000)]
meson: fix regression finding shm dep

Just copy the dep into both places.

Fixes: b5c390c113d3 ("vulkan/wsi: add support for detecting mit-shm pixmaps.")
Reviewed-by: Adam Jackson <ajax@redhat.com>
Tested-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12635>

2 years agozink: explicitly end renderpass before running dispatch
Mike Blumenkrantz [Mon, 9 Aug 2021 16:50:27 +0000 (12:50 -0400)]
zink: explicitly end renderpass before running dispatch

it's possible that nothing will end the renderpass otherwise

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

2 years agofreedreno/ci: Bring fd farm back online after move
Rob Clark [Sat, 28 Aug 2021 14:56:05 +0000 (07:56 -0700)]
freedreno/ci: Bring fd farm back online after move

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

2 years agozink: use VK_WHOLE_SIZE for full-sized bufferviews
Mike Blumenkrantz [Thu, 26 Aug 2021 16:05:24 +0000 (12:05 -0400)]
zink: use VK_WHOLE_SIZE for full-sized bufferviews

this works around most cts coverage which violates spec by creating a view
sized using a range that isn't a multiple of the format's blocksize

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

2 years agozink: free local shader nirs on program free
Mike Blumenkrantz [Mon, 30 Aug 2021 15:30:46 +0000 (11:30 -0400)]
zink: free local shader nirs on program free

leak--

Fixes: 61f2667cf5d ("zink: remove gfx program slot mapping")

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

2 years agointel/fs: Remove type-based restriction for cmod propagation to saturated operations
Ian Romanick [Sat, 17 Jul 2021 01:16:59 +0000 (18:16 -0700)]
intel/fs: Remove type-based restriction for cmod propagation to saturated operations

Previously, we misunderstood how conditional modifiers and saturate
interacted.  We thought the condition was evaulated before the saturate
was applied.  For the floating point cases, we went to some heroics to
modify the condition to maintain the same results.  For integer cases,
it was not clear that this could even work.  We had no use-cases and no
tests-cases, so we just disallowed everything.

Now we understand that the condition is evaluated after the saturate.
Earlier commits in this series removed the various floating point
heroics.  It is easier to just delete the code that prevents some cases
that just work.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12045>

2 years agointel/fs: Remove after parameter from test_saturate_prop
Ian Romanick [Tue, 17 Aug 2021 19:11:09 +0000 (12:11 -0700)]
intel/fs: Remove after parameter from test_saturate_prop

Originally this was part of "intel/fs: Remove condition-based
restriction for cmod propagation to saturated operations".  With some
additional changes to that commit, it caused a lot of extra churn in the
unit tests.  I felt that made it harder to see the actual changes in the
unit tests, so I split it out.

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12045>

2 years agointel/fs: Remove condition-based restriction for cmod propagation to saturated operations
Ian Romanick [Sat, 17 Jul 2021 01:15:50 +0000 (18:15 -0700)]
intel/fs: Remove condition-based restriction for cmod propagation to saturated operations

I don't know why the float_saturate_l_mov test was #if'ed out, but it
passes... so this commit enables it.

No shader-db or fossil-db changes.

In a previous iteration of this MR, this commit helped ~200 shaders in
shader-db.  Now all of those same shaders are helped by "intel/fs: cmod
propagate from MOV with any condition".  All of these shaders come from
Mad Max.  After initial translation from NIR to assembly, these shader
contain patterns like:

    mul(8)            g90<1>F       g88<8,8,1>F     0x40400000F  /* 3F */
    ...
    mov.sat(8)        g90<1>F       g90<8,8,1>F
    ...
    cmp.nz.f0(8)      null<1>F      g90<8,8,1>F     0 /* 0F */

An initial pass of cmod propagation converts this to

    mul(8)            g90<1>F       g88<8,8,1>F     0x40400000F  /* 3F */
    ...
    mov.sat.XX.f0(8)  g90<1>F       g90<8,8,1>F

Without this commit, XX is G.  With this commit, XX is NZ.  Saturate
propagation moves the saturate:

    mul.sat(8)        g90<1>F       g88<8,8,1>F     0x40400000F  /* 3F */
    ...
    mov.XX.f0(8)      g90<1>F       g90<8,8,1>F

Without this commit (but with "intel/fs: cmod propagate from MOV with
any condition"), the G gets propagated:

    mul.sat.g.f0(8)   g90<1>F       g88<8,8,1>F     0x40400000F  /* 3F */

With this commit (with or without "intel/fs: cmod propagate from MOV
with any condition"), the NZ gets propagated:

    mul.sat.nz.f0(8)  g90<1>F       g88<8,8,1>F     0x40400000F  /* 3F */

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12045>

2 years agointel/fs: cmod propagate from MOV with any condition
Ian Romanick [Tue, 17 Aug 2021 23:09:11 +0000 (16:09 -0700)]
intel/fs: cmod propagate from MOV with any condition

There were tests related to propagating conditional modifiers from a MOV
to an instruction with a .SAT modifier for a very long time, but they
were #if'ed out.

There are restrictions later in the function that limit the kinds of MOV
instructions that can propagate.  This avoids the dangers of
type-converting MOVs that may generate flags in different ways.

v2: Update the added comment to look more like the existing comment.
That makes the small differences between the two cases more obvious.
Noticed by Marcin.

All Intel platforms had similar results. (Ice Lake shown)
total instructions in shared programs: 19827127 -> 19826924 (<.01%)
instructions in affected programs: 62024 -> 61821 (-0.33%)
helped: 201
HURT: 0
helped stats (abs) min: 1 max: 2 x̄: 1.01 x̃: 1
helped stats (rel) min: 0.13% max: 0.60% x̄: 0.35% x̃: 0.36%
95% mean confidence interval for instructions value: -1.02 -1.00
95% mean confidence interval for instructions %-change: -0.36% -0.34%
Instructions are helped.

total cycles in shared programs: 954655879 -> 954655356 (<.01%)
cycles in affected programs: 1212877 -> 1212354 (-0.04%)
helped: 155
HURT: 6
helped stats (abs) min: 1 max: 6 x̄: 3.65 x̃: 4
helped stats (rel) min: <.01% max: 0.17% x̄: 0.07% x̃: 0.07%
HURT stats (abs)   min: 2 max: 12 x̄: 7.00 x̃: 8
HURT stats (rel)   min: 0.04% max: 0.23% x̄: 0.14% x̃: 0.15%
95% mean confidence interval for cycles value: -3.60 -2.90
95% mean confidence interval for cycles %-change: -0.07% -0.05%
Cycles are helped.

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12045>

2 years agointel/compiler: Move type_is_unsigned_int to brw_reg_type.h
Ian Romanick [Wed, 18 Aug 2021 21:04:45 +0000 (14:04 -0700)]
intel/compiler: Move type_is_unsigned_int to brw_reg_type.h

...and rename it to brw_reg_type_is_unsigned_integer.  It is now next to
brw_reg_type_is_floating_point and brw_reg_type_is_integer.

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12045>

2 years agointel/fs: Fix a cmod prop bug when the source type of a mov doesn't match the dest...
Ian Romanick [Wed, 18 Aug 2021 00:15:03 +0000 (17:15 -0700)]
intel/fs: Fix a cmod prop bug when the source type of a mov doesn't match the dest type of scan_inst

We were previously operating with the mindset "a MOV is just a compare
with zero."  As a result, we were trying to share as much code between
the MOV path and the CMP path as possible.  However, MOV instructions
can perform type conversions that affect the result of the comparison.
There was some code added to better handle this for cases like

    and(16)         g31<1>UD       g20<8,8,1>UD   g22<8,8,1>UD
    mov.nz.f0(16)   null<1>F       g31<8,8,1>D

The flaw in these changed special cases is that it allowed things like

    or(8)           dest:D  src0:D  src1:D
    mov.nz(8)       null:D  dest:F

Because both destinations were integer types, the propagation was
allowed.  The source type of the MOV and the destination type of the OR
do not match, so type conversion rules have to be accounted for.

My solution was to just split the MOV and non-MOV paths with completely
separate checks.  The "else" path in this commit is basically the old
code with the BRW_OPCODE_MOV special case removed.

The new MOV code further splits into "destination of scan_inst is float"
and "destination of scan_inst is integer" paths.  For each case I
enumerate the rules that I belive apply.  For the integer path, only the
"Z or NZ" rules are listed as only NZ is currently allowed (hence the
conditional_mod assertion in that path).  A later commit relaxes this
and adds the rule.

The new rules slightly relax one of the previous rules.  Previously the
sizes of the MOV destination and the MOV source had to be the same.  In
some cases now the sizes can be different by the following conditions:

  - Floating point to integer conversion are not allowed.

  - If the conversion is integer to floating point, the size of the
    floating point value does not matter as it will not affect the
    comparison result.

  - If the conversion is float to float, the size of the destination
    must be greater than or equal to the size of the source.

  - If the conversion is integer to integer, the size of the destination
    must be greater than or equal to the size of the source.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12045>

2 years agointel/fs: Add many cmod propagation tests involving MOV instructions
Ian Romanick [Tue, 17 Aug 2021 23:04:09 +0000 (16:04 -0700)]
intel/fs: Add many cmod propagation tests involving MOV instructions

Of particular interest are the tests where the MOV performs a type
conversion.  If the restriction on conditional modifier for a MOV is
ever relaxed, some of these cases must still be disallowed.

v2: s/NZ/Z/ in one of the comments.  Notice by Marcin.

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12045>

2 years agointel/fs: Remove redundant inst->opcode checks in cmod prop
Ian Romanick [Wed, 21 Jul 2021 01:31:22 +0000 (18:31 -0700)]
intel/fs: Remove redundant inst->opcode checks in cmod prop

This foreach_inst_in_block_reverse_starting_from loop only applies
CMP, MOV, and AND.  AND instructions break out of the loop before this
point.

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12045>

2 years agointel/fs: Refactor some cmod propagation tests
Ian Romanick [Wed, 21 Jul 2021 20:56:34 +0000 (13:56 -0700)]
intel/fs: Refactor some cmod propagation tests

This will simplify some later changes to these tests.

v2: Combine test_positive_saturate_prop and test_negative_saturate_prop
into a single function.  Suggested by Marcin.

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12045>

2 years agoradv: ignore dynamic line stipple if line stipple isn't enabled
Mike Blumenkrantz [Fri, 27 Aug 2021 18:02:46 +0000 (14:02 -0400)]
radv: ignore dynamic line stipple if line stipple isn't enabled

==244108== Conditional jump or move depends on uninitialised value(s)
==244108==    at 0x48498D5: bcmp (vg_replace_strmem.c:1129)
==244108==    by 0x1C37B7DD: radv_bind_dynamic_state (radv_cmd_buffer.c:237)
==244108==    by 0x1C388027: radv_CmdBindPipeline (radv_cmd_buffer.c:4794)
==244108==    by 0x14E9C01E: bool update_gfx_pipeline<true>(zink_context*, zink_batch_state*, pipe_prim_type) (zink_draw.cpp:406)
==244108==    by 0x14E9AAB9: void zink_draw_vbo<(zink_multidraw)1, (zink_dynamic_state)1, (zink_dynamic_state2)1, (zink_dynamic_vertex_input)1, true>(pipe_cont>
==244108==    by 0x14B017EB: tc_call_draw_single (u_threaded_context.c:3033)
==244108==    by 0x14AF9C0E: tc_batch_execute (u_threaded_context.c:190)
==244108==    by 0x14AFA24F: _tc_sync (u_threaded_context.c:341)
==244108==    by 0x14B006E7: tc_texture_subdata (u_threaded_context.c:2549)
==244108==    by 0x14238F8C: st_TexSubImage (st_cb_texture.c:2134)
==244108==    by 0x14239931: st_TexImage (st_cb_texture.c:2363)
==244108==    by 0x1453698A: teximage (teximage.c:3154)
==244108==    by 0x1453698A: teximage_err (teximage.c:3181)
==244108==    by 0x145388BD: _mesa_TexImage2D (teximage.c:3252)
==244108==    by 0x5E88D4: ??? (in /home/zmike/src/piglit/tesseract/bin_unix/linux_64_client)
==244108==    by 0x5E9527: ??? (in /home/zmike/src/piglit/tesseract/bin_unix/linux_64_client)
==244108==    by 0x5E9B72: ??? (in /home/zmike/src/piglit/tesseract/bin_unix/linux_64_client)
==244108==    by 0x5F1092: ??? (in /home/zmike/src/piglit/tesseract/bin_unix/linux_64_client)
==244108==    by 0x5F10AC: ??? (in /home/zmike/src/piglit/tesseract/bin_unix/linux_64_client)
==244108==    by 0x48CC66: ??? (in /home/zmike/src/piglit/tesseract/bin_unix/linux_64_client)
==244108==    by 0x48DDC7: ??? (in /home/zmike/src/piglit/tesseract/bin_unix/linux_64_client)
==244108==    by 0x40D525: ??? (in /home/zmike/src/piglit/tesseract/bin_unix/linux_64_client)
==244108==    by 0x4FF7B74: (below main) (in /usr/lib64/libc-2.33.so)
==244108==  Uninitialised value was created by a stack allocation
==244108==    at 0x14ECDF55: zink_create_gfx_pipeline (zink_pipeline.c:53)

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

2 years agoradv: use pool stride when copying single query results
Mike Blumenkrantz [Mon, 30 Aug 2021 14:31:15 +0000 (10:31 -0400)]
radv: use pool stride when copying single query results

the specified stride is irrelevant for this case since there's only one
result to write

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

2 years agoradv: advertise VK_EXT_primitive_topology_list_restart
Samuel Pitoiset [Fri, 27 Aug 2021 15:16:55 +0000 (17:16 +0200)]
radv: advertise VK_EXT_primitive_topology_list_restart

Everything should be already supported, except patch list.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12611>

2 years agovulkan: Update the XML and headers to 1.2.190
Samuel Pitoiset [Fri, 27 Aug 2021 15:13:13 +0000 (17:13 +0200)]
vulkan: Update the XML and headers to 1.2.190

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12611>

2 years agosvga/drm: use pb_usage_flags instead of pipe_map_flags in vmw_svga_winsys_buffer_map
Neha Bhende [Fri, 27 Aug 2021 20:04:20 +0000 (13:04 -0700)]
svga/drm: use pb_usage_flags instead of pipe_map_flags in vmw_svga_winsys_buffer_map

This patch basically maps pipe_map_flags to pb_flags. Since we are mapping it,
STATIC_ASSERTS won't be required.

Fixes: 00c30dad78b0 ("gallium: renumber PIPE_MAP_* enums to remove holes")

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12606>

2 years agoradv: add support for clearing multi layers with normal gfx clear path
Samuel Pitoiset [Wed, 25 Aug 2021 10:45:18 +0000 (12:45 +0200)]
radv: add support for clearing multi layers with normal gfx clear path

Allow to clear range of layers with vkCmdClear{Color,DepthStencil}Image().

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/12557>

2 years agoci: Fix a minor issue in prepare-artifacts.sh script
Rohan Garg [Thu, 26 Aug 2021 13:00:40 +0000 (15:00 +0200)]
ci: Fix a minor issue in prepare-artifacts.sh script

bash is whitespace sensitive.
https://github.com/koalaman/shellcheck/wiki/SC1020

This was noticed from the logs of a CI job
https://gitlab.freedesktop.org/mesa/mesa/-/jobs/13158779
There was no fallout from this bug as not having this variable defined
leads to the right behavior, and defining it to 1 leads to a error
which consequently also leads to the right behaviour.

Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12562>

2 years agoaco: include utility in isel
Rhys Perry [Mon, 30 Aug 2021 09:42:34 +0000 (10:42 +0100)]
aco: include utility in isel

For std::exchange().

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Fixes: c1d11bb92c9 ("aco: Add loop creation helpers.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5301
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12614>

2 years agonir: Fix local_invocation_index upper bound for non-compute-like stages.
Timur Kristóf [Thu, 26 Aug 2021 11:32:51 +0000 (13:32 +0200)]
nir: Fix local_invocation_index upper bound for non-compute-like stages.

The lowered LS and NGG stages use local_invocation_index and they
can benefit from the unsigned upper bound because they can emit a
less expensive integer multiplication instruction.
This was working in the past, but accidentally borked by a refactor.

Fossil DB changes on Sienna Cichlid:

Totals from 956 (0.74% of 128647) affected shaders:
CodeSize: 2354172 -> 2344712 (-0.40%)
Instrs: 434359 -> 434327 (-0.01%)
Latency: 1883949 -> 1876814 (-0.38%)
InvThroughput: 762638 -> 757405 (-0.69%)

Fossil DB changes on Sienna Cichlid (with NGGC enabled):

Totals from 57873 (44.99% of 128647) affected shaders:
CodeSize: 155844192 -> 155607064 (-0.15%)
Instrs: 29799184 -> 29799152 (-0.00%)
Latency: 130959764 -> 130814224 (-0.11%); split: -0.11%, +0.00%
InvThroughput: 21100300 -> 20928635 (-0.81%); split: -0.81%, +0.00%

Fixes: 8af6766062044167fb3b61950ddbc7d67e4c3e48
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12558>

2 years agonir: Add unsigned upper bound for extract opcodes.
Timur Kristóf [Thu, 26 Aug 2021 09:18:23 +0000 (11:18 +0200)]
nir: Add unsigned upper bound for extract opcodes.

This helps with some cases of extract, such as:
- Emitting more optimal integer multiplications
- Better address calculation
- Possibly others

Fossil DB results on Sienna Cichlid:

Totals from 4064 (3.16% of 128647) affected shaders:
VGPRs: 262040 -> 262032 (-0.00%)
CodeSize: 28856648 -> 28811892 (-0.16%); split: -0.18%, +0.02%
Instrs: 5370279 -> 5367827 (-0.05%); split: -0.08%, +0.04%
Latency: 74230112 -> 74016671 (-0.29%); split: -0.29%, +0.01%
InvThroughput: 12082532 -> 12036365 (-0.38%); split: -0.39%, +0.01%
VClause: 108506 -> 108721 (+0.20%); split: -0.03%, +0.22%
SClause: 217731 -> 216602 (-0.52%); split: -0.67%, +0.15%
Copies: 265689 -> 270811 (+1.93%); split: -0.26%, +2.19%
PreSGPRs: 201982 -> 204907 (+1.45%); split: -0.01%, +1.46%
PreVGPRs: 236099 -> 236079 (-0.01%)

Fossil DB results on Sienna Cichlid with NGGC enabled:

Totals from 60375 (46.93% of 128647) affected shaders:
VGPRs: 2212576 -> 2212568 (-0.00%)
CodeSize: 180870420 -> 179684816 (-0.66%); split: -0.66%, +0.00%
Instrs: 34386715 -> 34213682 (-0.50%); split: -0.51%, +0.01%
Latency: 199676290 -> 198987998 (-0.34%); split: -0.35%, +0.00%
InvThroughput: 32288299 -> 31736433 (-1.71%); split: -1.71%, +0.00%
VClause: 621521 -> 621743 (+0.04%); split: -0.00%, +0.04%
SClause: 900447 -> 899392 (-0.12%); split: -0.16%, +0.04%
Copies: 3439529 -> 3445305 (+0.17%); split: -0.02%, +0.19%
PreSGPRs: 2216297 -> 2219220 (+0.13%); split: -0.00%, +0.13%
PreVGPRs: 1842887 -> 1842867 (-0.00%)

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12558>

2 years agoaco: Unset 16 and 24-bit flags from operands in apply_extract.
Timur Kristóf [Thu, 26 Aug 2021 08:47:10 +0000 (10:47 +0200)]
aco: Unset 16 and 24-bit flags from operands in apply_extract.

Consider the following sequence in a shader:
b = p_extract a
c = v_mad_u32_u16 b, X, 0

The optimizer applies extract, resulting in:
c = v_mad_u32_u16 a, X, 0 (correct)

Then it mistakenly turns that into:
c = v_mul_u32_u24 a, X, 0 (incorrect)

In this case, the p_extract is applied to v_mad_u32_u16 by
apply_extract. After this, we can no longer be sure that
the operands are still 16 or 24-bit, so we have to remove
this flag.

No Fossil DB changes.

Fixes: 54292e99c7844500314bfd623469c65adef954c5
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12558>

2 years agozink: implement PIPE_RESOURCE_FLAG_DONT_MAP_DIRECTLY when resizable bar not present
Mike Blumenkrantz [Fri, 30 Jul 2021 13:20:10 +0000 (09:20 -0400)]
zink: implement PIPE_RESOURCE_FLAG_DONT_MAP_DIRECTLY when resizable bar not present

this helps in some cases to avoid allocating and mapping large staging resources

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