platform/upstream/mesa.git
22 months agoci: Allow disabling the whole of austriancoder's farm
Christian Gmeiner [Fri, 7 Oct 2022 11:31:22 +0000 (13:31 +0200)]
ci: Allow disabling the whole of austriancoder's farm

Add a global-level variable that allows disabling all jobs that would
have gone to my lab, to be used in case of outages.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18997>

22 months agoradv,aco: move radv_ps_epilog_key to the graphics pipeline key
Samuel Pitoiset [Thu, 8 Dec 2022 12:55:34 +0000 (13:55 +0100)]
radv,aco: move radv_ps_epilog_key to the graphics pipeline key

To avoid redundant structs.

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

22 months agoradv: fix PS epilogs with RADV_PERFTEST=pswave32
Samuel Pitoiset [Thu, 8 Dec 2022 12:55:09 +0000 (13:55 +0100)]
radv: fix PS epilogs with RADV_PERFTEST=pswave32

This option is rarely or even never used but it was broken. While we
are at it, remove radv_ps_epilog_key::wave32 because the wave size
can only be changed globally for PS.

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

22 months agoradv,aco: use 8-bit for color_is_int{8,10} everywhere
Samuel Pitoiset [Thu, 8 Dec 2022 12:54:42 +0000 (13:54 +0100)]
radv,aco: use 8-bit for color_is_int{8,10} everywhere

Do not need 32-bits because there is only up to 8 MRTs.

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

22 months agoradv,aco: rename color output related fields for consistency
Samuel Pitoiset [Thu, 8 Dec 2022 12:54:21 +0000 (13:54 +0100)]
radv,aco: rename color output related fields for consistency

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

22 months agopvr: Extract common code from pvr_CmdDispatch{,Indirect}
Matt Coster [Fri, 18 Nov 2022 16:20:18 +0000 (16:20 +0000)]
pvr: Extract common code from pvr_CmdDispatch{,Indirect}

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20159>

22 months agopvr: Track max_shared_regs for compute jobs
Matt Coster [Fri, 18 Nov 2022 16:04:05 +0000 (16:04 +0000)]
pvr: Track max_shared_regs for compute jobs

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20159>

22 months agopvr: Refactor pvr_compute_pipeline and pvr_compute_pipeline_shader
Matt Coster [Fri, 18 Nov 2022 15:57:07 +0000 (15:57 +0000)]
pvr: Refactor pvr_compute_pipeline and pvr_compute_pipeline_shader

This brings the two structs more into line with their graphics
counterparts, and removes the extra member access previously required
to access almost all members of pvr_compute_pipeline.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20159>

22 months agoaco: Migrate RA to use std::optional
Tatsuyuki Ishi [Fri, 2 Dec 2022 08:00:10 +0000 (17:00 +0900)]
aco: Migrate RA to use std::optional

The use of std::optional simplifies expressions and would be useful for some
upcoming RA tweaks.

C++17 has been available since the merge of rusticl and should be safe to use as
far as packaging is concerned.

A few style choices are:
- Testing for emptiness uses implicit bool conversion.
- Constructing an empty value uses {}.
- Constructing a filled value uses the implicit conversion constructor.

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

22 months agoci/valve-infra: use a new version of the mesa trigger
Martin Roukala (né Peres) [Wed, 7 Dec 2022 15:06:57 +0000 (17:06 +0200)]
ci/valve-infra: use a new version of the mesa trigger

This new version of the container will re-try up to 3 times to download
the job bucket, rather than failing directly. If the issue persists,
the job will still succeed, but not all artifacts will be present...

Fixes: #7809
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20203>

22 months agointel/compiler: Set NoMask on cr0 access for float controls mode
Kenneth Graunke [Wed, 7 Dec 2022 20:00:33 +0000 (12:00 -0800)]
intel/compiler: Set NoMask on cr0 access for float controls mode

This is trying to clear a bit in the control register.  However, it's
executing with whatever channel mask happens to be active.  Typically
this is the one at the start of the program, so at least some channels
will be active.  Typically the first channel will be active due to
packed dispatch, but that's not always guaranteed.  Without NoMask,
the float controls writes may randomly not happen.

Recent GPUs also seem to have a hang issue when the first instruction in
the shader doesn't have any active channels.  Having an instruction with
NoMask at the start of the program works around the issue.  See HSD bug
14017989577.  In our case, the float controls preamble was breaking that
restriction every time, causing us to run into this problem frequently.

Thanks to Tapani Pälli for finding this hang issue, and Francisco
Jerez and Lionel Landwerlin for helping pinpoint this issue during
review of a workaround patch in !20194.

Fixes GPU hangs in Elder Scrolls Online, Witcher 3, and likely more.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7639
Fixes: 9da56ffc522 ("i965/fs: add emit_shader_float_controls_execution_mode() and aux functions")
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20214>

22 months agovirgl: lower FMA and MULADD
Gert Wollny [Mon, 14 Nov 2022 12:52:53 +0000 (13:52 +0100)]
virgl: lower FMA and MULADD

On the host we emit this as separate ops anyway, so avoid
wired optimizations in the guest that might introduce
difficult to optimize dependencies.

v2: update trace expectations - some minor accuracy changes
    are to be expected when fma is handled differently

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

22 months agoglsl: dont create temps for builtin function inputs
Timothy Arceri [Thu, 3 Nov 2022 01:59:20 +0000 (12:59 +1100)]
glsl: dont create temps for builtin function inputs

It's not valid to be copying input variables to temps when
inlining atomic memory, interpolateAt functions, etc. We got away
with this previously because tree grafting would clean up the
mess but we shouldn't depend on an optimisation to clean up
invalid IR. Also I hope to remove tree grafting in a follow up
merge request.

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

22 months agoglsl: use ir_rvalue_visitor for function inlining
Timothy Arceri [Mon, 7 Nov 2022 01:00:02 +0000 (12:00 +1100)]
glsl: use ir_rvalue_visitor for function inlining

This allows us to drop some duplicate code that is already in the
ir_rvalue_visitor. It also allows us to better replace rvalues
and handle swizzle in the following patch without having to add
even more duplicate code.

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

22 months agovenus: scrub ignored fields for descriptor writes for push descriptor
Yiwei Zhang [Tue, 6 Dec 2022 22:03:02 +0000 (14:03 -0800)]
venus: scrub ignored fields for descriptor writes for push descriptor

Fixes: 933ca11f1a4 ("venus: implement vkCmdPushDescriptorSetWithTemplateKHR")

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20191>

22 months agovulkan: VkPolygonMode has a bit more than two values
Iván Briano [Wed, 7 Dec 2022 20:30:36 +0000 (12:30 -0800)]
vulkan: VkPolygonMode has a bit more than two values

Fixes: 9d0ed9cbcc0 ("vulkan: Add more dynamic rasterizer state")

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20212>

22 months agohasvk: Report correct multisampling limits on gfx7
Väinö Mäkelä [Sat, 29 Oct 2022 07:59:56 +0000 (10:59 +0300)]
hasvk: Report correct multisampling limits on gfx7

Some limits reported by hasvk were too high, which caused CTS tests to
fail.

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

22 months agoaco: Add s_delay_alu support for GFX11+
Bas Nieuwenhuizen [Sun, 13 Nov 2022 18:15:28 +0000 (18:15 +0000)]
aco: Add s_delay_alu support for GFX11+

Roughly copied from LLVM. This facilitates better ALU usage by
switching between waves when there is an ALU stall, which isn't
automatic anymore on GFX11.

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

22 months agoaco: Add helper to get cycle info for an instruction.
Bas Nieuwenhuizen [Mon, 14 Nov 2022 18:58:32 +0000 (18:58 +0000)]
aco: Add helper to get cycle info for an instruction.

For use in s_delay_alu tracking

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

22 months agoaco: Add isTrans helper.
Bas Nieuwenhuizen [Mon, 14 Nov 2022 18:57:08 +0000 (18:57 +0000)]
aco: Add isTrans helper.

For the s_delay_alu tracking.

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

22 months agoradv: mark extendedDynamicState3SampleLocationsEnable as not required by Zink
Samuel Pitoiset [Tue, 22 Nov 2022 09:12:06 +0000 (10:12 +0100)]
radv: mark extendedDynamicState3SampleLocationsEnable as not required by Zink

Only dynamic blend equation support is still required.

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

22 months agoradv: advertise extendedDynamicState3LineRasterizationMode
Samuel Pitoiset [Tue, 22 Nov 2022 07:56:09 +0000 (08:56 +0100)]
radv: advertise extendedDynamicState3LineRasterizationMode

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

22 months agoradv: add support for dynamic line rasterization mode
Samuel Pitoiset [Tue, 22 Nov 2022 08:07:25 +0000 (09:07 +0100)]
radv: add support for dynamic line rasterization mode

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

22 months agoradv: advertise extendedDynamicState3RasterizationSamples
Samuel Pitoiset [Mon, 7 Nov 2022 22:36:20 +0000 (23:36 +0100)]
radv: advertise extendedDynamicState3RasterizationSamples

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

22 months agoradv: add support for dynamic rasterization samples
Samuel Pitoiset [Mon, 21 Nov 2022 07:23:28 +0000 (08:23 +0100)]
radv: add support for dynamic rasterization samples

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

22 months agoradv: store the number of color/ds samples to the rendering state
Samuel Pitoiset [Mon, 21 Nov 2022 16:37:54 +0000 (17:37 +0100)]
radv: store the number of color/ds samples to the rendering state

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

22 months agonir: fix digit order in print_bitset()
Mihai Preda [Mon, 5 Dec 2022 14:44:04 +0000 (16:44 +0200)]
nir: fix digit order in print_bitset()

Also fix the leading curly for the new function definitions.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19570>

22 months agonir: print shader_info bools with the value
Mihai Preda [Wed, 30 Nov 2022 09:45:07 +0000 (11:45 +0200)]
nir: print shader_info bools with the value

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19570>

22 months agonir: print shader_info inputs/outputs as bit ranges
Mihai Preda [Wed, 23 Nov 2022 20:12:24 +0000 (22:12 +0200)]
nir: print shader_info inputs/outputs as bit ranges

e.g.
inputs_read: 15-17
outputs_written: 0,32

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19570>

22 months agoradeonsi: add AMD_DEBUG=elements for printing vertex elements
Mihai Preda [Wed, 23 Nov 2022 12:47:23 +0000 (14:47 +0200)]
radeonsi: add AMD_DEBUG=elements for printing vertex elements

in si_create_vertex_elements()

This information is useful in debugging shader inputs/outputs

Sample output:
AMD_DEBUG=elements ./bin/arb_vertex_attrib_64bit-overlapping-locations shader -auto
elements[0]: offset  0, buffer_index 0, dual_slot 0, format  16, divisor 0
elements[1]: offset 16, buffer_index 0, dual_slot 0, format  16, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 104, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 105, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 106, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 107, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format  16, divisor 0
elements[1]: offset 16, buffer_index 0, dual_slot 0, format  16, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 104, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 105, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 106, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 107, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 107, divisor 0
elements[1]: offset 16, buffer_index 0, dual_slot 1, format 107, divisor 0
elements[2]: offset 32, buffer_index 0, dual_slot 1, format 105, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 107, divisor 0
elements[1]: offset 40, buffer_index 0, dual_slot 1, format 107, divisor 0
elements[2]: offset 56, buffer_index 0, dual_slot 1, format 105, divisor 0
elements[0]: offset  0, buffer_index 0, dual_slot 0, format 107, divisor 0
elements[1]: offset 64, buffer_index 0, dual_slot 1, format 107, divisor 0
elements[2]: offset 80, buffer_index 0, dual_slot 1, format 105, divisor 0

PIGLIT: {"result": "pass" }
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19570>

22 months agoutil: minor refactor _mesa_sha1_print()
Mihai Preda [Mon, 14 Nov 2022 17:58:13 +0000 (19:58 +0200)]
util: minor refactor _mesa_sha1_print()

should not change the output; avoids an additional printf()
for the separator.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19570>

22 months agonir: print_shader_info(): brief output
Mihai Preda [Mon, 14 Nov 2022 17:52:37 +0000 (19:52 +0200)]
nir: print_shader_info(): brief output

Make the shader_info printing less verbose by skipping the fields that
are likely not used (being zero).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19570>

22 months agonir: print_shader_info: print stage-specific shader info
Mihai Preda [Mon, 7 Nov 2022 11:30:39 +0000 (13:30 +0200)]
nir: print_shader_info: print stage-specific shader info

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19570>

22 months agonir: print_shader_info() print bitsets
Mihai Preda [Wed, 2 Nov 2022 11:49:38 +0000 (13:49 +0200)]
nir: print_shader_info() print bitsets

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19570>

22 months agonir: print more in print_shader_info()
Mihai Preda [Wed, 2 Nov 2022 11:30:16 +0000 (13:30 +0200)]
nir: print more in print_shader_info()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19570>

22 months agonir: extract print_shader_info() from nir_print_shader_annotated()
Mihai Preda [Wed, 2 Nov 2022 10:07:36 +0000 (12:07 +0200)]
nir: extract print_shader_info() from nir_print_shader_annotated()

This is a refactoring, it is not supposed to change the printed output.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19570>

22 months agoanv/hasvk: Clamping Scissor Rect values in a valid range
Otavio Pontes [Wed, 19 Oct 2022 21:39:24 +0000 (14:39 -0700)]
anv/hasvk: Clamping Scissor Rect values in a valid range

On cmd_buffer_emit_scissor(), if VkViewport height or width are set to
a value lower than 1.0, y_max or x_max can be attributed negative values,
causing an overflow. That leads to ScissorRectangleYMax or
ScissorRectangleXMax to be set to values on an unsupported range.

Clamping x_max and y_max in the valid range solves the problem.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7471
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20200>

22 months agotu: allow using resolve engine for SRGB MSAA resolves
Jonathan Marek [Fri, 17 Sep 2021 15:32:48 +0000 (11:32 -0400)]
tu: allow using resolve engine for SRGB MSAA resolves

CTS accepts this behavior since a1be5ce2c893f525da82bc28c6e81b17cacc5d14

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

22 months agomeson: Do not enable drm for KGSL Turnip build
Danylo Piliaiev [Mon, 5 Dec 2022 16:58:05 +0000 (17:58 +0100)]
meson: Do not enable drm for KGSL Turnip build

Android may use either DRM or some downstream solution, KGSL is a
downstream kernel driver for Adreno. Don't enable DRM when we want
Turnip to use KGSL instead of DRM.

Fixes: 09ac29cca9bf7978911f81bcfce12ce71c260a97
("meson: Enable system_has_kms_drm for android")

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20168>

22 months agost/mesa: stop using redundant st_context::vp,tcp,tep,gp,fp,cp
Marek Olšák [Fri, 18 Nov 2022 13:08:30 +0000 (08:08 -0500)]
st/mesa: stop using redundant st_context::vp,tcp,tep,gp,fp,cp

Use ctx->XXProgram._Current instead of the st_context variables.

v2: split from a bigger commit

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

22 months agost/mesa: fix the glBitmap cache wrt FS, scissor, and clamp color changes
Marek Olšák [Fri, 18 Nov 2022 15:20:17 +0000 (10:20 -0500)]
st/mesa: fix the glBitmap cache wrt FS, scissor, and clamp color changes

We need to track those states in the cache and flush the cache
if the next glBitmap call uses different states.

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

22 months agost/mesa: don't flag ST_NEW_RASTERIZER for _NEW_PROGRAM
Marek Olšák [Fri, 18 Nov 2022 12:52:11 +0000 (07:52 -0500)]
st/mesa: don't flag ST_NEW_RASTERIZER for _NEW_PROGRAM

This should have no effect thanks to previous commits.

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

22 months agomesa: flag ST_NEW_RASTERIZER for !needs_texcoord_semantic if changing FS
Marek Olšák [Fri, 18 Nov 2022 12:49:33 +0000 (07:49 -0500)]
mesa: flag ST_NEW_RASTERIZER for !needs_texcoord_semantic if changing FS

This will be required with the next change, which will remove
the rasterizer state dependency on _NEW_PROGRAM.

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

22 months agomesa: remove unused composite _NEW_* flags
Marek Olšák [Fri, 18 Nov 2022 12:38:40 +0000 (07:38 -0500)]
mesa: remove unused composite _NEW_* flags

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

22 months agomesa: don't flag _NEW_PROGRAM for "texture_unit -> sampler" mapping changes
Marek Olšák [Fri, 18 Nov 2022 12:35:00 +0000 (07:35 -0500)]
mesa: don't flag _NEW_PROGRAM for "texture_unit -> sampler" mapping changes

st/mesa just reorders sampler views, so we only need to rebind those.

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

22 months agomesa: set fewer flags for VertexProgram.TwoSideEnabled changes
Marek Olšák [Fri, 18 Nov 2022 12:31:03 +0000 (07:31 -0500)]
mesa: set fewer flags for VertexProgram.TwoSideEnabled changes

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

22 months agomesa: set fewer dirty flags for PointSizeEnabled state changes
Marek Olšák [Fri, 18 Nov 2022 12:20:20 +0000 (07:20 -0500)]
mesa: set fewer dirty flags for PointSizeEnabled state changes

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

22 months agomesa: flag ST_NEW_FS_CONSTANTS instead of _NEW_PROGRAM for ATI_fs constants
Marek Olšák [Fri, 18 Nov 2022 12:07:46 +0000 (07:07 -0500)]
mesa: flag ST_NEW_FS_CONSTANTS instead of _NEW_PROGRAM for ATI_fs constants

We only need to update the constant buffer.

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

22 months agost/mesa: update st_context::active_states in _mesa_update_state
Marek Olšák [Fri, 18 Nov 2022 11:53:48 +0000 (06:53 -0500)]
st/mesa: update st_context::active_states in _mesa_update_state

just a code movement to a better place

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

22 months agost/mesa: move check_program_state code into _mesa_update_state
Marek Olšák [Fri, 18 Nov 2022 11:42:07 +0000 (06:42 -0500)]
st/mesa: move check_program_state code into _mesa_update_state

_mesa_update_state() receives the _NEW_PROGRAM flag, so we can handle
any shader changes there.

There may be some overhead reduction because gfx_shaders_may_be_dirty
is removed.

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

22 months agost/mesa: always unbind constant buffer 0 when unbinding a shader
Marek Olšák [Sat, 26 Nov 2022 17:22:26 +0000 (12:22 -0500)]
st/mesa: always unbind constant buffer 0 when unbinding a shader

softpipe loads from an unbound and destroyed constant buffer for some reason

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

22 months agomesa: clean up hairy code in state.c: update_program
Marek Olšák [Fri, 25 Nov 2022 18:08:48 +0000 (13:08 -0500)]
mesa: clean up hairy code in state.c: update_program

No change in behavior.

Replace:

if (shader)
   bind(shader);
else
   bind(NULL);

With:

bind(shader);

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

22 months agozink: fix rebase-mistake
Erik Faye-Lund [Wed, 7 Dec 2022 08:27:28 +0000 (09:27 +0100)]
zink: fix rebase-mistake

This should not have re-introduced this lowering, effectively reverting
dcf3ae72abf78e8959c5b5a94ef332c0b7396ab2.

Fixes: 16971cd667b ("zink: add driver-workaround for missing gl_point_size")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20195>

22 months agointel/fs: clamp per vertex input accesses to patchControlPoints
Lionel Landwerlin [Thu, 25 Mar 2021 12:53:32 +0000 (14:53 +0200)]
intel/fs: clamp per vertex input accesses to patchControlPoints

In a tesselation control shader where an input array is accessed using
the index gl_InvocationID, we can end up accessing elements beyond the
number of input vertices specified in the shader key.

This happens because of the lowering in nir_lower_indirect_derefs().
This lowering will affect compact variables which happens in this
case :

  in gl_PerVertex {
      vec4  gl_Position;
      float gl_ClipDistance[1];
  } gl_in[gl_MaxPatchVertices];

The lowered code produced by NIR is somewhat ineffecient (implements a
binary seach) :

  if (gl_InvocationID < 16) {
     if (gl_InvocationID < 8) {
        if (gl_InvocationID < 4) {
          vec4 vals = load_at_offset(0);
          value = bcsel(vals, gl_InvocationID);
        } else {
          vec4 vals = load_at_offset(4);
          value = bcsel(vals, gl_InvocationID - 4);
        }
     } else {
        if (gl_InvocationID < 12) {
          vec4 vals = load_at_offset(8);
          value = bcsel(vals, gl_InvocationID - 8);
        } else {
          vec4 vals = load_at_offset(12);
          value = bcsel(vals, gl_InvocationID - 12);
        }
     }
  } else {
     if (gl_InvocationID < 24) {
        ...
     } else {
        ...
     }
  }

By default the gl_MaxPatchVertices must be set at 32 items and that's
what the lowering code will use to divide the access into chunks of 4.
But when running with 3 input vertices, this means we'll pull one more
item than what was delivered in the shader payload.

This triggers issues further down the register scheduling where the
g5UD (register for the 4th item) is overwritten by a previous SEND,
leading the URB read to use an invalid handle.

This pass clamps any access load_per_vertex_input intrinsic vertex
indice to (input_vertices - 1).

Fixes issues with tests like :
dEQP-VK.clipping.user_defined.clip_distance.vert_tess.*

Also fixes a hang with zink/anv on :
KHR-GL46.draw_elements_base_vertex_tests.AEP_shader_stages

v2: Don't replace source register

v3: Implement in NIR

v4: Clamp per vertex array sizes in NIR (Jason)

v5: Move the clamping on the intel compiler

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

22 months agonir: Use nir_component_mask_t for nir_alu_dst::write_mask
Jason Ekstrand [Wed, 7 Dec 2022 00:26:25 +0000 (18:26 -0600)]
nir: Use nir_component_mask_t for nir_alu_dst::write_mask

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20193>

22 months agoglx: fix xshm check to init xshm_opcode.
Dave Airlie [Tue, 6 Dec 2022 19:11:47 +0000 (05:11 +1000)]
glx: fix xshm check to init xshm_opcode.

Found and proposed by Ray Strode (halfline)

Fixes: 68e89401140d ("glx/drisw: use xcb instead of X to query connection")
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20188>

22 months agozink: don't use defunct custom-flag
Erik Faye-Lund [Tue, 6 Dec 2022 15:16:08 +0000 (16:16 +0100)]
zink: don't use defunct custom-flag

We're no longer respecting this flag, so there's no need in setting it.

Fixes: 00dc0036bb6 ("zink: flatten out buffer creation usage flags codepath")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20183>

22 months agonir: Add missing includes
Konstantin Seurer [Wed, 2 Feb 2022 15:09:32 +0000 (16:09 +0100)]
nir: Add missing includes

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14831>

22 months agovenus: check against the Vulkan type rather than type index.
Dawn Han [Wed, 30 Nov 2022 19:02:40 +0000 (19:02 +0000)]
venus: check against the Vulkan type rather than type index.

Signed-off-by: Dawn Han <dawnhan@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20064>

22 months agovenus: fix deqp tests failed on iub descriptor type
Dawn Han [Tue, 29 Nov 2022 23:31:34 +0000 (23:31 +0000)]
venus: fix deqp tests failed on iub descriptor type

Fixes: abae9d4831b ("Add the iub binding count tracking")

Signed-off-by: Dawn Han <dawnhan@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20064>

22 months agoradv: fix guardband if the polygon mode is points or lines
Samuel Pitoiset [Wed, 30 Nov 2022 07:05:36 +0000 (08:05 +0100)]
radv: fix guardband if the polygon mode is points or lines

If points or lines are drawn using the polygon mode, the guardband
should be adjusted for large points/lines.

Cc: 22.3 mesa-stable
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/20185>

22 months agotu: Destroy disk_cache during tu_physical_device_finish
Mark Collins [Tue, 6 Dec 2022 09:09:25 +0000 (09:09 +0000)]
tu: Destroy disk_cache during tu_physical_device_finish

While running VK-CTS with valgrind, the application hit the max
thread count of 500. After further investigation, this was due to
multiple instances being created with the disk cache spinning up
worker threads which wouldn't be cleaned as disk_cache_destroy
wasn't being called.

Signed-off-by: Mark Collins <mark@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20178>

22 months agomesa: Add missing dep on generated marshal header in the tests build.
Emma Anholt [Mon, 5 Dec 2022 20:52:51 +0000 (12:52 -0800)]
mesa: Add missing dep on generated marshal header in the tests build.

We lost the race in a recent MR of mine.

Fixes: 381e0b43d617 ("mesa: Add test to prevent windows.h to be included in shared headers")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20170>

22 months agoir3: Disallow `noperspective` texture preloads
Mark Collins [Fri, 18 Nov 2022 07:48:14 +0000 (07:48 +0000)]
ir3: Disallow `noperspective` texture preloads

The `coord_offset` pass is responsible for upgrading any eligible
texture loads into prefetches, but a texture prefetch's capabilities
are limited and cannot handle any interpolation modes aside from
`smooth`.

An exception is carved out for `flat` interpolation modes, but this
doesn't exclude upgrading `noperspective` texture loads and results
in perspective-corrected samples being provided that can severely
break applications depending on this behaviour.

Fixes incorrect lighting projection on Super Mario Odyssey on
Skyline Emulator.

Fixes incorrect dirt texture mapping on Portal 2 trace on Turnip and
Zink on Turnip.

Fixes incorrect lighter shadowing on Half Life 2 trace on Turnip.

Signed-off-by: Mark Collins <mark@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19842>

22 months agoir3: Propagate `coord_offset` result from `alu` src insts
Mark Collins [Mon, 28 Nov 2022 08:35:32 +0000 (08:35 +0000)]
ir3: Propagate `coord_offset` result from `alu` src insts

`coord_offset` is called on the source of `alu` instructions and
it returns -1 for failures, this not explicitly checked for and
as a result the fetch can incorrectly be upgraded to a prefetch
when it isn't appropriate to do so.

Signed-off-by: Mark Collins <mark@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19842>

22 months agoturnip: Initialize *memory on 0-sized alloc early exit.
Emma Anholt [Mon, 5 Dec 2022 22:52:07 +0000 (14:52 -0800)]
turnip: Initialize *memory on 0-sized alloc early exit.

Otherwise, making a CS using the memory will use the uninitialized .map
value (when checking the size of the CS in in begin's tu_cs_is_empty()
check), causing valgrind noise in
dEQP-VK.binding_model.descriptorset_random.sets4.dynindexed.ubolimitlow.sbolimitlow.sampledimghigh.lowimgsingletex.iublimitlow.nouab.vert.noia.0
(thanks to vi_info->vertexBindingDescriptionCount==0).

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

22 months agointel/compiler/mesh: align payload size to the size of vec4
Marcin Ślusarz [Mon, 5 Dec 2022 11:27:38 +0000 (12:27 +0100)]
intel/compiler/mesh: align payload size to the size of vec4

This reduces the number of instructions in task shaders when payload
size is not aligned to vec4 and payload_in_shared WA is enabled,
because nir_lower_task_shader will not need to handle the unaligned
size case.

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

22 months agonir/lower_task_shader: fix task payload corruption when shared memory workaround...
Marcin Ślusarz [Wed, 30 Nov 2022 12:47:19 +0000 (13:47 +0100)]
nir/lower_task_shader: fix task payload corruption when shared memory workaround is enabled

We were not taking into account that when all invocations within workgroup
are active, we'll copy more data than needed, corrupting task payload
of other workgroups.

Fixes: 8aff8d3dd42 ("nir: Add common task shader lowering to make the backend's job easier.")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20080>

22 months agoaco: apply NUW to additions for scratch access
Rhys Perry [Thu, 1 Dec 2022 18:04:49 +0000 (18:04 +0000)]
aco: apply NUW to additions for scratch access

fossil-db (navi21):
Totals from 52 (0.04% of 135636) affected shaders:
Instrs: 79036 -> 78567 (-0.59%)
CodeSize: 431188 -> 427984 (-0.74%)
Latency: 1318142 -> 1313821 (-0.33%)
InvThroughput: 293842 -> 292836 (-0.34%)
VClause: 2555 -> 2361 (-7.59%); split: -8.06%, +0.47%
Copies: 8746 -> 8767 (+0.24%); split: -0.11%, +0.35%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20117>

22 months agoaco: more carefully apply constant offsets into scratch accesses
Rhys Perry [Thu, 1 Dec 2022 15:05:49 +0000 (15:05 +0000)]
aco: more carefully apply constant offsets into scratch accesses

Death stranding does scratch_arr[80-idx]. This doesn't seem to work if we
try to combine the subtraction into the access.

fossil-db (navi21):
Totals from 52 (0.04% of 135636) affected shaders:
Instrs: 78560 -> 79036 (+0.61%)
CodeSize: 427940 -> 431188 (+0.76%)
Latency: 1313809 -> 1318142 (+0.33%)
InvThroughput: 292833 -> 293842 (+0.34%)
VClause: 2361 -> 2555 (+8.22%); split: -0.51%, +8.73%
Copies: 8767 -> 8746 (-0.24%); split: -0.35%, +0.11%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 0e783d687a3 ("aco: use scratch_* for scratch load/store on GFX9+")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7735
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20117>

22 months agoradv/rt: set additions for scratch access as NUW
Rhys Perry [Thu, 1 Dec 2022 20:26:52 +0000 (20:26 +0000)]
radv/rt: set additions for scratch access as NUW

No fossil-db changes.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20117>

22 months agonir/range_analysis: unsigned upper bound analysis for b2i
Rhys Perry [Thu, 1 Dec 2022 20:22:16 +0000 (20:22 +0000)]
nir/range_analysis: unsigned upper bound analysis for b2i

fossil-db (navi21):
Totals from 93 (0.07% of 135636) affected shaders:
Instrs: 133949 -> 133899 (-0.04%); split: -0.05%, +0.01%
CodeSize: 708124 -> 707528 (-0.08%); split: -0.09%, +0.01%
Latency: 2451564 -> 2450158 (-0.06%); split: -0.06%, +0.00%
InvThroughput: 398282 -> 397345 (-0.24%)
SClause: 4441 -> 4437 (-0.09%); split: -0.18%, +0.09%
Copies: 7578 -> 7546 (-0.42%); split: -0.55%, +0.13%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20117>

22 months agoci/freedreno: temporarily disable godot-trive on zink+freedreno
David Heidelberg [Tue, 6 Dec 2022 12:25:43 +0000 (13:25 +0100)]
ci/freedreno: temporarily disable godot-trive on zink+freedreno

Test if this trace impact surrounding traces causing rendering changes.

Ref: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7732

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

22 months agoac/llvm: set invariant.load on image loads with ACCESS_CAN_REORDER
Marek Olšák [Sun, 4 Dec 2022 11:32:19 +0000 (06:32 -0500)]
ac/llvm: set invariant.load on image loads with ACCESS_CAN_REORDER

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

22 months agoac/llvm: inline ac_get_load_intr_attribs
Marek Olšák [Sun, 4 Dec 2022 11:25:55 +0000 (06:25 -0500)]
ac/llvm: inline ac_get_load_intr_attribs

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

22 months agoac/llvm: rename attribute enums
Marek Olšák [Sun, 4 Dec 2022 11:19:56 +0000 (06:19 -0500)]
ac/llvm: rename attribute enums

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

22 months agoac/llvm: use invariant.load metadata on load intrinsics instead of readnone
Marek Olšák [Sun, 4 Dec 2022 11:14:10 +0000 (06:14 -0500)]
ac/llvm: use invariant.load metadata on load intrinsics instead of readnone

readnone is illegal now and we should be using invariant.load since LLVM 15.
(suggested by Nicolai)

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

22 months agoac/llvm: don't set "readnone" on non-memory intrinsics
Marek Olšák [Sun, 4 Dec 2022 11:00:15 +0000 (06:00 -0500)]
ac/llvm: don't set "readnone" on non-memory intrinsics

It's illegal and LLVM always knows which intrinsics don't read memory.
This started failing IR validation with LLVM 16.

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

22 months agoac/llvm: don't set "convergent" on intrinsics where it's automatic
Marek Olšák [Sun, 4 Dec 2022 10:22:48 +0000 (05:22 -0500)]
ac/llvm: don't set "convergent" on intrinsics where it's automatic

LLVM adds the flag automatically.

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

22 months agoac/llvm: simplify how function attributes are set
Marek Olšák [Sun, 4 Dec 2022 11:07:32 +0000 (06:07 -0500)]
ac/llvm: simplify how function attributes are set

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

22 months agoac/llvm: simplify how call attributes are set
Marek Olšák [Sun, 4 Dec 2022 09:23:00 +0000 (04:23 -0500)]
ac/llvm: simplify how call attributes are set

set them directly in ac_build_intrinsic, the only place that sets them

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

22 months agoac/llvm: remove illegal function attributes READONLY and WRITEONLY
Marek Olšák [Sun, 4 Dec 2022 09:30:16 +0000 (04:30 -0500)]
ac/llvm: remove illegal function attributes READONLY and WRITEONLY

They are only legal on parameters.

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

22 months agogallivm: remove illegal and unused function attributes
Marek Olšák [Sun, 4 Dec 2022 09:13:30 +0000 (04:13 -0500)]
gallivm: remove illegal and unused function attributes

READONLY is illegal on calls. Others were unused.

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

22 months agogallivm: remove unused LP_FUNC_ATTR_LEGACY
Marek Olšák [Sun, 4 Dec 2022 06:37:46 +0000 (01:37 -0500)]
gallivm: remove unused LP_FUNC_ATTR_LEGACY

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

22 months agogallivm: remove unused LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY
Marek Olšák [Sun, 4 Dec 2022 06:36:44 +0000 (01:36 -0500)]
gallivm: remove unused LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY

LLVM 16 removed it anyway.

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

22 months agoac/llvm: remove unused AC_FUNC_ATTR_LEGACY
Marek Olšák [Sun, 4 Dec 2022 06:35:33 +0000 (01:35 -0500)]
ac/llvm: remove unused AC_FUNC_ATTR_LEGACY

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

22 months agoac/llvm: remove AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY because LLVM 16 removed it
Marek Olšák [Sun, 4 Dec 2022 06:33:33 +0000 (01:33 -0500)]
ac/llvm: remove AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY because LLVM 16 removed it

We didn't use it reasonably anyway.

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

22 months agozink: add driver-workaround for missing gl_point_size
Igor Torrente [Tue, 29 Nov 2022 13:50:56 +0000 (10:50 -0300)]
zink: add driver-workaround for missing gl_point_size

Add code to support gl_point lowering.

In this commit the target of this lowering will be only the
imagination proprietary driver.

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

22 months agozink: rename `zink_set_line_stipple_keys`
Igor Torrente [Tue, 29 Nov 2022 14:40:50 +0000 (11:40 -0300)]
zink: rename `zink_set_line_stipple_keys`

This function will be used by another primitive emulation and
a more generic name will be needed.

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

22 months agozink: add gl_point lowering pass
Igor Torrente [Thu, 1 Dec 2022 12:41:48 +0000 (09:41 -0300)]
zink: add gl_point lowering pass

This lowering pass is intended for hardwares/drivers that can't honor
the gl_PointSize when GL_PROGRAM_POINT_SIZE is enabled.

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

22 months agollvmpipe: Faithfully honour pipe_rasterizer_state::rasterizer_discard flag.
Jose Fonseca [Mon, 5 Dec 2022 10:29:28 +0000 (10:29 +0000)]
llvmpipe: Faithfully honour pipe_rasterizer_state::rasterizer_discard flag.

D3D10 established that rasterization should be discarded when a null PS was
bound, and depth/stencil state was disabled, and llvmpipe followed those
semantics.  Nowadays all APIs have explicit rasterization discard flag,
and so does Gallium, so it's better for llvmpipe to faithfully follow
that flag, and trust the state tracker to follow the right semantics.

Second guessing pipe_rasterizer_state::rasterizer_discard actually
causes problems, specially when no depth-stencil surface is bound, as
D3D10 mandates rasterization should still happen, yet among all the
translation layers it often happens depth-stencil enablement is
optimized away when no depth-stencil is bound, which in turn was causing
llvmpipe to disable rasterization when it shouldn't.

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

22 months agonir: Recognize empty shaders in nir_tgsi_scan_shader().
Jose Fonseca [Mon, 5 Dec 2022 10:28:15 +0000 (10:28 +0000)]
nir: Recognize empty shaders in nir_tgsi_scan_shader().

When a null PS is bound, the
pipe_query_data_pipeline_statistics::ps_invocations counter should not
be incremented.

However llvmpipe can't cope with a null PS bound, requiring the state
tracker to bind an empty pixel shader instead.  llvmpipe infers empty
TGSI pixel shaders by looking tgsi_shader_info::num_instructions, as an
empty shader should have a single END instruction, but this logic wasn't
working for NIR shaders.

I mulled over the possibility of making llvmpipe handle null pixel
shaders.  Spreading null checks everywhere would be invasive and error
prone, but it would be quite simple if llvmpipe simply created a dummy
PS internally, to be used as a replacement whenever a null PS was bound.
That said, I'm not sure if other gallium drivers can cope with a null PS
neither, and if nought, might as well keep using an empty PS in lavapipe
state tracker.  An any rate, this change makes sense on its own.

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

22 months agozink: do not lower gs-intrinscs, take two
Erik Faye-Lund [Tue, 6 Dec 2022 07:52:44 +0000 (08:52 +0100)]
zink: do not lower gs-intrinscs, take two

Whoops, I missed a spot!

Fixes: ad26d29adcc ("zink: do not lower gs-intrinsics")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20177>

22 months agoradv: use LATE_Z for depth/stencil attachments used in feedback loops
Samuel Pitoiset [Mon, 14 Nov 2022 14:33:48 +0000 (15:33 +0100)]
radv: use LATE_Z for depth/stencil attachments used in feedback loops

To make sure shader invocations read the correct values.

Fixes dEQP-VK.rasterization.rasterization_order_attachment_access.*.samples_*.multi_draw_barriers

Cc: 22.3 mesa-stable
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/19728>

22 months agoradv: apply register changes for SQTT on GFX11
Samuel Pitoiset [Thu, 1 Dec 2022 07:51:43 +0000 (08:51 +0100)]
radv: apply register changes for SQTT on GFX11

Based on the register db, most of them moved.

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

22 months agozink: do not lower gs-intrinsics
Erik Faye-Lund [Mon, 5 Dec 2022 14:25:55 +0000 (15:25 +0100)]
zink: do not lower gs-intrinsics

We don't use the counters for anything useful, so let's drop this
lowering pass.

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

23 months agonir: fix nir_link_varying_precision
Chia-I Wu [Thu, 1 Dec 2022 19:17:04 +0000 (11:17 -0800)]
nir: fix nir_link_varying_precision

link_varyings ignores precisions and can assign the same location to
variables with different precisions.  nir_link_varying_precision should
check location_frac as well.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20113>

23 months agoturnip: fix dynamic logicop state
Chia-I Wu [Fri, 2 Dec 2022 02:34:23 +0000 (18:34 -0800)]
turnip: fix dynamic logicop state

When a pipeline has dynamic logicop state or blend state, we defer lrz
write decision to tu6_calculate_lrz_state.  As such,
tu6_calculate_lrz_state should look at both states when either of them
is dynamic.

Fixes dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.21 on
angle, which uses dynamic logicop state and static blend state with
blending enabled.

Fixes: c8c7154c2ec ("tu: Implement extendedDynamicState3ColorBlendEnable")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20136>

23 months agoanv: Don't ambiguate for undefined layouts on TGL+
Nanley Chery [Wed, 30 Nov 2022 23:02:14 +0000 (15:02 -0800)]
anv: Don't ambiguate for undefined layouts on TGL+

For Tiger Lake and onward, we generally don't need to ambiguate the CCS
before accessing it. This is safe for two reasons:

- Tiger Lake and onward treat all CCS values as legal.
- We enable compression on all writable image layouts. The CCS will
  receive all writes and will therefore always be valid.

When dealing with modifiers, we continue to allow ambiguates in some
instances.

Before this patch, I found ~19.5k ambiguates in Wolfenstein:
Youngblood's Riverside benchmark (note that this includes manually
entering the benchmark and exiting the app). With this patch, the number
of ambiguates goes down to zero.

Improves performance of Fallout 4 at 1080p/High settings on Arc A380 by
around 22%.

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20118>

23 months agoanv: Move aux vars up in transition_color_buffer
Nanley Chery [Wed, 30 Nov 2022 23:57:16 +0000 (15:57 -0800)]
anv: Move aux vars up in transition_color_buffer

I'd like to reuse one of them for an assert.

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20118>