Commit Graph

206178 Commits

Author SHA1 Message Date
Sviatoslav Peleshko 0e3e5146cf intel/brw: Use correct instruction for value change check when coalescing
When we have partial VGRF MOVs with offsets, we will reach
`channels_remaining == 0` with `inst` that is not writing the whole VGRF.
Currently, even though we check `can_coalesce_vars()` for each offset
separately, it will always check if the dst value is not changed only
for the offset from the instruction that satisfied the
`channels_remaining == 0` condition.

Instead, we should remember and use the correct instruction for each
written offset separately.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10916
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35062>
2025-06-01 17:37:10 +00:00
Mel Henning aae67ab678 nak: Don't swap f2fp sources in legalize
The order of these is important.

Fixes: e19871bd6a ("nak: Use F2FP for nir_op_pack_half_2x16_split on SM86+")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12717
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35267>
2025-05-31 01:04:43 +00:00
Faith Ekstrand 9b94ec30b6 nak/sm50: Use ld.ci for constant loads
This matches what CUDA does.  This makes Unigine Heaven go about 4x
faster on my GTX 750 Ti when run with NVK_DEBUG=no_cbuf (to force all
UBO loads down the global memory path).

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35265>
2025-05-31 00:50:13 +00:00
Faith Ekstrand fb3125c4e3 nak/sm50: Encode cache ops on Maxwell
We just sort of YOLO'd it before, with no real plan.  But it passed all
the tests so it never cared.  It turns out the cache ops on Maxwell are
mostly the same as the ones we already added to Kepler, we just need to
encode them.  The only big difference is that we no longer need to avoid
the L1 cache on Maxwell as it's either coherent or disabled in hardware
for global memory (I don't know which).

The only substantive change this MR makes is that images are now using
.ca by default rather than .cg.  However, this is the same choice we're
currently making for global access and it still passes all the memory
model tests so it should be okay.

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35265>
2025-05-31 00:50:13 +00:00
Faith Ekstrand a3b4401fe6 nak: Handle MemScope::System on Kepler
We never actually create any MemScope::System instructions anymore, but
it's worth handling it now just so we don't forget.

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35265>
2025-05-31 00:50:13 +00:00
Faith Ekstrand 81b6aece17 nak: Print cache ops on suldga and sustga
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35265>
2025-05-31 00:50:13 +00:00
Faith Ekstrand a0391b92bb nak: Plumb the ShaderModel through to Ld/StCacheOp::select()
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35265>
2025-05-31 00:50:13 +00:00
Guilherme Gallo 05c2c748db ci/build: Remove CPP_ARGS var duplication
This variable appeared twice in debian-testing-msan, removing the first
one because it is probably being overridden by the second one.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35251>
2025-05-30 21:05:45 +00:00
Guilherme Gallo 0a63e324a5 ci/panfrost: Reuse file list YAML anchors
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35251>
2025-05-30 21:05:45 +00:00
Mel Henning 295373f29f nak: Implement nir_intrinsic_reduce with REDUX
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34912>
2025-05-30 19:28:01 +00:00
Mel Henning b165c07b38 nak: Add OpRedux
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34912>
2025-05-30 19:28:01 +00:00
Mel Henning 12b903d384 nak: lower_scan_reduce after divergence analysis
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34912>
2025-05-30 19:28:01 +00:00
Mel Henning a3839dbb90 nak: Change divergence analysis pass order
Always convert to lcssa before divergence analysis

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34912>
2025-05-30 19:28:01 +00:00
Mel Henning 666bad5d22 nak: Always run nak_nir_mark_lcssa_invariants
We're about to change the way that lcssa is constructed, and we won't
be able to conclude that there are no lcssa phis based on this pass'
progress.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34912>
2025-05-30 19:28:01 +00:00
Mel Henning 018f4f1c27 nak: Forbid reordering labeled OpNop
Totals:
Static cycle count: 1104322907 -> 1108862573 (+0.41%)

Totals from 111376 (56.68% of 196502) affected shaders:
Static cycle count: 948085895 -> 952625561 (+0.48%)

Fixes: 79d0f8263d ("nak: Add a simple postpass instruction scheduler")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35141>
2025-05-30 18:29:00 +00:00
Faith Ekstrand c39bf7e7f9 nvk: Don't use INVALIDATE_TEXTURE_DATA_CACHE_NO_WFI on Kepler
It exists in the headers but it doesn't seem to work properly.  Even
doing a separate WFI right before it doesn't help.

Acked-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35246>
2025-05-30 17:38:39 +00:00
Faith Ekstrand 9458dd606e nak/sm20: pixld has a predicate destination
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35246>
2025-05-30 17:38:39 +00:00
Jesse Natalie b25e430700 microsoft/compiler: Cast one enum to another instead of to int to resolve warning
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35247>
2025-05-30 17:04:18 +00:00
Jesse Natalie ae3c495de1 formats: Cast enum to int before shifting
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35247>
2025-05-30 17:04:18 +00:00
Jesse Natalie f0dde6ca7f nir_gather_output_deps: Fix incorrect enum in switch
Cc: mesa-stable
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35247>
2025-05-30 17:04:18 +00:00
Brian Paul f29d939824 svga: rework framebuffer state
Create svga_framebuffer_state as a subclass of pipe_framebuffer_state.
This contains pointers to svga_surface objects which correspond to
pipe_framebuffer_state's surfaces.

Replace pipe_surface with svga_surface in many functions.

Stop using deprecated util_framebuffer_init() function.

See https://gitlab.freedesktop.org/mesa/mesa/-/issues/13262

Signed-off-by: Brian Paul <brian.paul@broadcom.com>x
Reviewed-by: Neha Bhende <neha.bhende@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35238>
2025-05-30 16:40:56 +00:00
Brian Paul b7774effbf svga: asst. clean-ups in svga_surface.c
- whitespace fixes
- move var decls
- add const qualifiers

No functional changes.

Signed-off-by: Brian Paul <brian.paul@broadcom.com>
Reviewed-by: Neha Bhende <neha.bhende@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35238>
2025-05-30 16:40:56 +00:00
Brian Paul 24a57350eb svga: whitespace clean-ups in svga_screen_cache.h
Signed-off-by: Brian Paul <brian.paul@broadcom.com>
Reviewed-by: Neha Bhende <neha.bhende@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35238>
2025-05-30 16:40:56 +00:00
Brian Paul ce70baeef3 gallium/util: minor clean-ups in u_framebuffer.c
Replace tabs w/ spaces, move vars.

Signed-off-by: Brian Paul <brian.paul@broadcom.com>
Reviewed-by: Neha Bhende <neha.bhende@broadcom.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35238>
2025-05-30 16:40:56 +00:00
Brian Paul 64da531799 svga: remove unneeded assignments in svga_set_framebuffer_state()
The util_copy_framebuffer_state() function copies the width, height,
nr_cbufs fields.

Also move a loop variable.

Signed-off-by: Brian Paul <brian.paul@broadcom.com>
Reviewed-by: Neha Bhende <neha.bhende@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35238>
2025-05-30 16:40:56 +00:00
Brian Paul dac04694b2 svga: handle NULL surface in svga_surface_needs_propagation()
To avoid null checks at the call sites.

Signed-off-by: Brian Paul <brian.oaul@broadcom.com>
Reviewed-by: Neha Bhende <neha.bhende@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35238>
2025-05-30 16:40:56 +00:00
Brian Paul e6058e5ab0 svga: 80-column wrapping and misc code cleanups
No functional changes.

Signed-off-by: Brian Paul <brian.paul@broadcom.com>
Reviewed-by: Neha Bhende <neha.bhende@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35238>
2025-05-30 16:40:56 +00:00
David Rosca 3bb9905e7f radeonsi/vcn: Use picture fence in JPEG decode
The fence needs to be passed to frontend to make vaSyncSurface work
correctly.

Cc: mesa-stable
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35258>
2025-05-30 16:17:42 +00:00
Guilherme Gallo e942d1e9e4 bin/ci: crnm: Sanitize n_colums value
The number of columns should never be less than 1, otherwise we can
break the script such as:

```
Traceback (most recent call last):
  File "/var/home/guilherme/projects/mesa/bin/ci/ci_run_n_monitor.py", line 734, in <module>
    main()
  File "/var/home/guilherme/projects/mesa/bin/ci/ci_run_n_monitor.py", line 713, in main
    target_job_id, ret, exec_t = monitor_pipeline(
                                 ^^^^^^^^^^^^^^^^^
  File "/var/home/guilherme/projects/mesa/bin/ci/ci_run_n_monitor.py", line 221, in monitor_pipeline
    cancel_jobs(project, to_cancel)
  File "/var/home/guilherme/projects/mesa/bin/ci/ci_run_n_monitor.py", line 400, in cancel_jobs
    print_formatted_list(cancelled_jobs, indentation=8)
  File "/var/home/guilherme/projects/mesa/bin/ci/gitlab_gql.py", line 373, in print_formatted_list
    step = (len(elements) // n_columns) + 1
            ~~~~~~~~~~~~~~^^~~~~~~~~~~
ZeroDivisionError: integer division or modulo by zero
```

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35250>
2025-05-30 13:15:37 +00:00
Yao Zi b1d81a7df1 radeonsi: Fix violation of aliasing rules in radeon_ws_bo_reference
Applications using Mesa built with LLVM 20.1.4 fail to start with
strange segmentfaults/bus errors when radeonsi driver is used. The last
piece of stacktrace looks like

  - pipe_reference_described
  - pipe_reference
  - radeon_bo_reference
  - radeon_ws_bo_reference
  - radeon_lookup_or_add_real_buffer

Coredump shows the pointer dst passed to pipe_reference_described() is
either unaligned or even invalid, which is the reason of crashing. The
crash goes away when Mesa is built without optimization.

Looking through the related functions, it's found that
radeon_ws_bo_reference() contains unsafe type cast from radeon_bo to
pb_buffer_lean: though the former's first field is just the later, this
violates strict aliasing rules as pb_buffer_lean isn't compatible with
radeon_bo. Such violation ultimately results in miscompilation.

Let's take the address of pb_buffer_lean field, avoiding the unsafe
cast. It's still required to cast pb_buffer_lean back to radeon_bo since
radeon_bo_reference may update the pointer, which is safe as radeon_bo
contains a pb_buffer_lean member and C language permits access members
through a pointer in type of the container.

Fixes: 6d913a2bcc ("r300,r600,radeonsi: switch to pb_buffer_lean")
Link: https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Aliasing-Type-Rules.html
Signed-off-by: Yao Zi <ziyao@disroot.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35249>
2025-05-30 12:48:18 +00:00
Juan A. Suarez Romero f340990fcb v3dv: don't use deprecated NIR_PASS_V macro
Check more details at
https://gitlab.freedesktop.org/mesa/mesa/-/issues/10409.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35127>
2025-05-30 14:24:24 +02:00
Juan A. Suarez Romero 5505bb6c6d v3d/compiler: don't use deprecated NIR_PASS_V macro
We still keep it for the case of nir_scheduling, as this pass requires
to be adapted to return the progress as well as update the metadata.

Check more details at
https://gitlab.freedesktop.org/mesa/mesa/-/issues/10409.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35127>
2025-05-30 14:24:24 +02:00
Juan A. Suarez Romero 62ba0d7bf8 vc4: don't use deprecated NIR_PASS_V macro
Check more details at
https://gitlab.freedesktop.org/mesa/mesa/-/issues/10409.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35127>
2025-05-30 14:24:24 +02:00
Juan A. Suarez Romero b5706ef70a vc4: return progress on custom nir lowering
Report if the vc4 specific NIR lowering did any progress.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35127>
2025-05-30 14:24:24 +02:00
David Rosca a9a54632af frontends/va: Fix H264 top/bottom is reference flags
All pics in the ReferenceFrames array should be references,
so there is no need to require the SHORT_TERM_REFERENCE flag
to actually treat them as references.
This fixes decoding with apps that doesn't set this flag,
eg. NoMachine remote desktop viewer (nxplayer).

See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13229
Cc: mesa-stable
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35186>
2025-05-30 08:54:31 +00:00
David Rosca 8f4e251c98 radeonsi/vcn: Support disabling HEVC dependent slice segments
With older FW this needs to be always enabled, but it can now be
disabled when using the new separate header instructions for
dependent_slice_segment_flag and slice_segment_address.

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35072>
2025-05-30 08:29:53 +00:00
David Rosca 09a1429a00 radeonsi/vcn: Remove carrizo workaround
Carrizo has UVD so this can never be true.

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35072>
2025-05-30 08:29:53 +00:00
David Rosca f17ea8e901 radeonsi/vcn: Get rid of not_referenced
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35072>
2025-05-30 08:29:52 +00:00
Jesse Natalie 47f4d3e701 d3d12: Handle a null threaded context
When GALLIUM_THREAD=0, the threaded context doesn't get created and
the following lines would fault.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35248>
2025-05-30 02:19:26 +00:00
Jesse Natalie 0c0f6c6df1 d3d12: Handle sampler view creation on B8G8R8X8
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35142>
2025-05-30 01:24:10 +00:00
Jesse Natalie f5781553f6 winsys/d3d12: Support no-alpha formats through the DXGI swapchain path
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35142>
2025-05-30 01:24:10 +00:00
Eric R. Smith 548f652d10 panfrost, panvk: spread hierarchy mask bits out when max_levels < 8
We create hierarchy masks based on the number of levels available,
creating a bitmask with `max_levels` bits set. Originally these bits
all came together. Modify this to spread the bits out, which improves
performance on chips like the G31 with only 2 levels of hierarchy.

Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34744>
2025-05-29 21:50:54 +00:00
Eric R. Smith 13b35a3c9c panfrost, panvk: fix G31 use of SHADER_MODE_EARLY_ZS_ALWAYS
PRE_POST_FRAME_SHADER_MODE_EARLY_ZS_ALWAYS was introduced in
architecture version 7.2, not 7.0 as we assumed. Using it on
G31 (a 7.0 device) caused some CTS failures.

Cc: mesa-stable
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34744>
2025-05-29 21:50:52 +00:00
Faith Ekstrand 2e85076b1d nak: Set cache ops on surface load/store ops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35217>
2025-05-29 21:02:37 +00:00
Faith Ekstrand ad98b76a14 nak: Set cache ops on global memory access on Kepler
For now we leave shared and local alone on SM32 (there are no such
controls on SM20).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35217>
2025-05-29 21:02:37 +00:00
Faith Ekstrand a7760e4bd8 nak: Set MemOrder::Constant for CAN_REORDER image loads on all hardware
On Turing and Volta, it will safely degrade suld.weak.  On Maxwell and
Pascal, it will degrade to suld.cta.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35217>
2025-05-29 21:02:37 +00:00
Faith Ekstrand d3b9752ee6 nak/sm50: Use MemScope::CTA for constant image loads
Using MemScope::System synchronizes with everything, which is exactly
what we don't want for constant loads.  This is currently a no-op
because we aren't using MemScope::Constant pre-Ampere yet.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35217>
2025-05-29 21:02:37 +00:00
Faith Ekstrand 6ea0e91c99 nak: Handle suld.constant on Turing and Volta in legalization
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35217>
2025-05-29 21:02:37 +00:00
Lionel Landwerlin f0e18c475b intel: remove GRL/intel-clc
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35227>
2025-05-29 20:17:13 +00:00
Mike Blumenkrantz 44bff7eb05 zink: fix queue transition check in check_for_layout_update()
this only applies if the resource has active binds, otherwise it triggers crashes

Fixes: 18d206d67c ("zink: Check queue families when binding image resources")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35234>
2025-05-29 15:25:04 -04:00