Skip to content

[FOR TEST ONLY] Add extra patches from SteamOS - #119

Draft
lfdevs wants to merge 52 commits into
dev/adreno-mainfrom
test/steamos-patches
Draft

lfdevs wants to merge 52 commits into
dev/adreno-mainfrom
test/steamos-patches

Conversation

@lfdevs

@lfdevs lfdevs commented Nov 6, 2026

Copy link
Copy Markdown
Owner

anholt and others added 30 commits November 7, 2026 15:58
If you don't pass in the fence FD, then the swap will depend only on the
implicit sync of the BO being swapped to.  To set up the implicit sync,
WSI attaches an extra semaphore to the pre-present submit, then gets the
FD for it and attaches that to the image's dmabuf as another implicit sync
point before it's handed to the backend.  We can instead just get the FD
for the pre-submit fence and pass it directly to the atomic commit,
avoiding the implicit sync path in the kernel.

This should be a win on radv, where they don't have dma-buf import/export
implicit sync support, so the image_mem->implicit_sync setting made
submits track implicit sync on the winsys BOs.

Based loosely on a change by Jonathan Marek, which I cleaned up and
documented.

Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36591>
This can help running games where the Turnip driver might not be
known, preventing them from running. Some games might also make
adjustments to graphics settings if they detect the SteamDeck.

Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38808>
NIR and backend IR builder helpers often insert IR as their arguments
are evaluated. However, the order of argument evaluation is unspecified
and can differ between compilers and architectures.

Provide MESA_CALL_WITH_LTR_ARGS and MESA_CALL_WITH_LTR_ARRAY_ARGS macro
to enforce the left-to-right evaluation order for the target function's
arguments. Note, this doesn't anything but GCC and Clang, because it
requires the statement expression extension.

Usage:

 #define ir_func(...) MESA_CALL_WITH_LTR_ARGS(_nir_func, __VA_ARGS__)
 ir_def *_ir_func(ir_builder *b, ir_def *x, nir_def *y);

 #define ir_func(build, ...) \
  MESA_CALL_WITH_LTR_ARRAY_ARGS(_ir_func, ir_def *, build, __VA_ARGS__)
 ir_def *_ir_func(ir_builder *b, ir_def *const *arr, unsigned arrsz);

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42132>
A python script that uses Coccinelle to find IR builder functions
that may need to have a defined argument evaluation order and wraps
them with MESA_CALL_WITH_LTR_ARGS macro.

The macro may be applied to functions that don't strictly need it
but it's harmless and better than missing the ones that need it.

Assisted-by: LLM
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42132>
Done automatically by finding functions with more than 1 arguments
of any type from {nir_def, nir_deref_instr, nir_variable}, renaming
and adding a macro for them.

Generated with:

  python3 bin/ir-builder-arg-order.py --profile nir

Then a few build errors were fixed manually.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42132>
Done automatically by finding functions with more than 1 arguments
of any type from {nir_def, nir_deref_instr, vtn_ssa_value}, renaming
and adding a macro for them.

Generated with:

  python3 bin/ir-builder-arg-order.py --profile spirv

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42132>
Generated with:

  python3 bin/ir-builder-arg-order.py --profile tu-nir

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42132>
Done automatically by finding functions with more than 1 arguments
of any type from {ir3_instruction}, renaming and adding a macro for them.

Generated with:

  python3 bin/ir-builder-arg-order.py --profile ir3

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42132>
Here we handle the functions that cannot be automatically processed
like the previous commit did.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42132>
Mimics lint-rustfmt-rules rules.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42132>
The rules are a bit different for NaNs and for float to i/u32
conversions.

Necessary to make shader cache match between x86 and ARM.

This doesn't handle the case of trigonometry functions even
though they may not match between platforms, that would require
add their soft-float implementation and that's an exercise for the future.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42157>
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Assisted-by: OpenAI Codex (GPT-5.5)
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42157>
Vulkan spec says:

 When VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_EXT
 is included in a pipeline, it forms a framebuffer-local memory dependency
 for each fragment generated by draw commands for that pipeline with the
 following scopes:

 - The first synchronization scope includes the
   VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BITpipeline stage executed
   by all previous fragments (as defined by primitive order) in the
   corresponding framebuffer regions including those generated by the
   same draw command.
 - The second synchronization scope includes the
   VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT pipeline stage executed by the
   generated fragment.
 - The first access scope includes all writes to color attachments.
 - The second access scope includes all reads from input attachments.

So, the pipeline that enables rasterization order access should be
able to read current attachment as input attachment without any
additional explicit synchronization. The change of single_prim_mode
didn't trigger any synchronization, so we have to do it manually.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Upstream-MR: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/43272>
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
This is a workaround for an application bug, but it's better to handle
this gracefully than to crash due to assertions further on.

Signed-off-by: Mark Collins <mark@igalia.com>
Similar to Y8_UNORM, it has a special UBWC block size.
this is a hack because this only works with explicit layout images
(and transfer operations won't work, only image view)
The existing way of generating IDs was generating a lot of colliding
IDs that were causing issues, while not handling cases such as thread
exits gracefully by emitting the end events in those cases.

Signed-off-by: Dhruv Mark Collins <mark@igalia.com>
PixelyIon and others added 20 commits November 7, 2026 15:58
Signed-off-by: Dhruv Mark Collins <mark@igalia.com>
Signed-off-by: Dhruv Mark Collins <mark@igalia.com>
Signed-off-by: Dhruv Mark Collins <mark@igalia.com>
We need this just for SteamVR (aarch64 Linux). This makes it so
that we don't need a dbus dep for x86 and Android.
This should make it easier to introspect into what exactly autotune
is doing and why.

Signed-off-by: Dhruv Mark Collins <mark@igalia.com>
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
This tool allows for visualizing the debug data emitted by the
autotuner over the mesa_debug_socket.

Signed-off-by: Dhruv Mark Collins <mark@igalia.com>
`steamvr_adjust_thread_priorities.sh` was using `taskset` to set
the thread affinity. After the rtkit transition this was lost, so
adding it back.
The FDM aspect guard ran before the tile height is re-derived downward from
the bin count, and the height only ever shrinks there, so a candidate
inside 2:1 at the budget height could be well outside it by the time it was
chosen. A 1024x1024 framebuffer under a tight GMEM budget picks 576x512 at
the guard and renders 576x256.

Move the check after the re-derivation, where it sees what the pass will
actually render with. The penalty stays additive rather than a veto, so a
framebuffer with no candidate inside 2:1 still gets the least distorted
one. This changes no tiling on the VR captures used to measure the rest of
this series, where the guard already agreed with the rendered height, and
carries no measured performance effect there.

Signed-off-by: Dhruv Mark Collins <mark@igalia.com>
Assisted-by: Claude Code (Opus 5)
The clone was emitted before the WFI, so the CP copies it expands to ran
inside the window the renderpass tracepoints measure. That inflates every
tile by the cost of instrumenting it, and does so in proportion to the
number of tiles, which biases exactly the comparisons tracing is used for.

Move it after the WFI. Together with the u_trace range fix, tracing
overhead on a bin-heavy renderpass drops from over 100% to a few percent.

Signed-off-by: Dhruv Mark Collins <mark@igalia.com>
Assisted-by: Claude Code (Fable 5)
Temporary measure, to be removed later.

From @mbucchia
@lfdevs
lfdevs force-pushed the test/steamos-patches branch from 559a0d0 to 7ce94ed Compare November 7, 2026 08:01
Add the platform-specific D-Bus development package to every Build Check
job so the Linux/aarch64 RTKit WSI path can satisfy Meson's `dbus-1`
dependency.
Avoid the glibc-private pthreadtypes header and support Alpine's musl libc.
Keep attribute-based affinity setup on glibc, while using
pthread_setaffinity_np after thread creation on other libcs with proper
cleanup on failure.
@lfdevs
lfdevs force-pushed the test/steamos-patches branch from 7ce94ed to b9d81a5 Compare November 7, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants