* fix(input): programs built with _FORTIFY_SOURCE read the virtual pads
Fortified builds, Flatpak runtimes among them, call __read_chk, __poll_chk
and __ppoll_chk in place of read, poll and ppoll, and glibc's versions go
straight to the kernel. Such programs opened a pad through the shim but read
its backing ring file instead of events, so they never saw input: Marathon
Recompiled's SDL reads the pad through __read_chk.
The shim now provides all three, with glibc's bounds checks, on the same
paths as read, poll and ppoll.
* fix(input): keep glibc's __read_chk for descriptors that are not pads
Only pad descriptors take the shim's read path; the rest go to the next
__read_chk, so fortified reads keep libc's cancellation point. The test
also polls the empty ring with a zero timeout, which a __poll_chk that
bypasses the shim would report as ready.
---------
Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
* Release zero-copy display buffers at latch; gamescope waits for scanout before reusing an image
* Test that zero-copy releases follow the kernel's fence attach, not the buffer kind
* Pin the gamescope build that waits for scanout before reusing an image
* Probe the fallback output image for scanout so the composite waits on it too
* Pin the gamescope build that probes the fallback output image
## Problem
Zero-copy layer transitions could leave the compositor in an
inconsistent state when allocating an `ASurfaceTransaction` completion
callback failed.
Some failure paths released the current or previous `ASurfaceControl`
even though the transaction had not been applied. This could invalidate
layer state or release resources before the transition completed.
## Fix
- Cancel and delete transactions when completion callback allocation
fails.
- Preserve the current layer and buffer state instead of releasing
resources prematurely.
- Roll back surface swaps when presentation cannot proceed.
- Return an error from failed presentation paths and leave the layer
available for recovery.
- Apply the same failure handling to presentation, layer hiding and
surface retirement.
## Tests
- `git diff --check`: passed.
- Native build: not run locally.
- Device testing:
> Tested on one device and helped with his problem, test build is up for
further testing.
- **Perf:** Optimize DD FrameGen flow image initialization and shader
sampling.
> FrameGen should start faster and be more reliable.
- **Perf:** Skip unused FLOWREG image initialization and remove
redundant final FLOWREG barrier.
- **Perf:** Use initialization barriers for fresh framegen images.
> Helps with reliability and performance.
- **Perf:** Reserve capacity for image initialization barriers and Use
fixed storage for image initialization barriers.
- **Perf:** Batch FrameGen image descriptor updates and some FrameGen
image barriers.
> Less calls to the vulkan API.
- **Perf:** Skip unused global motion reduction sums.
- **Docs:** Add OF3_FLOWREG shader documents and some comments.
> This should be helpful when making future changes in the shader, only
for testing and development.
## Fixes
- Fix: Derive OF3 Flow Length from Array Size.
> Should make future changes easier.
- Fix: DD FrameGen scratch resource leak on resize.
- Fix: Present semaphore synchronization to prevent device loss on some
devices.
> Reported by a user, DDFG never worked on his device, this didn't
actually helped him, but im keeping because it can be useful for other
devices.
> issue reported on discord [Link to bug
report](https://discord.com/channels/1552707793247539220/1575946870151446589)
> This file contains the investigation made, in Portuguese:

## Performance
**OLD DroidDeck FrameGen**
| FPS (reported) | 1% low | Frametime | Game | DDFG | Device | DD
version |
|:--:|:--:|:--:|:--|:--:|:--|:--|
| 39.9 → 118.8 | 16.1 | 25.1 ms | Mass Effect | 3× | RP Nova, 12 GB,
Snapdragon 8 Gen 2 | 0.7.11 Stable |
| 32.5 → 91.4 | 21.9 | ## | NieR:Automata | 3× | S26U, SD 8 EG 5, Adr
840 | Preview b08d8e8 |
| 25.2 → 60.0 | ## | ## | Roadside Research | 4× | Odin2 Portal, Adreno
740 | 0.7.11 Stable |
*Report 1 — coleslaw117*
*Report 2 — twitchlemaxou*
*Report 3 — Dylon*
**NEW DroidDeck FrameGen**
| FPS (reported) | 1% low | Frametime | Game | DDFG | Device | DD
version |
|:--:|:--:|:--:|:--|:--:|:--|:--|
## Testing
- All checkd on Github green
- APK compiles
- All verification passed on my fork
- Working on test build
* perf(effects): half-precision upscalers, AMD CAS and a gather-based NIS from Bannerlator
The screen-effect chain ran every upscaler and CAS in fp32, and NIS read its
36-tap support and coefficient tables per pixel. Ported from Bannerlator
(The412Banner/Bannerlator 16595ed8 + 671feb8c), where the same shaders run in
its Wayland compositor:
- SGSR, SGSR HQ, FSR EASU and RCAS get a half-precision build of the same
source (-DDD_HALF=1, *_half_frag.h). The divide-by-zero guards DroidDeck
added to EASU, RCAS and CAS are kept.
- CAS: AMD's FidelityFX CAS (ffx_cas.h v1.0.2, 5-tap), half precision.
- NIS: a prepass writes the scene with luma in alpha at scene size
(nis_luma.frag); nis3.frag gathers that luma and reads its coefficient banks
from a 4 KB uniform buffer (nis_coef.h, set 1 of its own pipeline layout).
Without the buffer, NIS falls back to nis.frag.
- debug.droiddeck.upscale.shaders=old builds the previous fp32 set, for A/B.
The half SGSR, SGSR HQ, CAS, NIS luma and nis3 SPIR-V is identical to
Bannerlator's (glslang 16.2.0). Notices: AMD CAS added to
THIRD_PARTY_NOTICES.txt; NVIDIA NIS covers the new NIS files.
* fix(effects): NIS prepass address at full precision; fast NIS only where it is safe
From review:
- nis_luma.frag: the half build made gl_FragCoord RelaxedPrecision, so a
16-bit load rounds pixel centres past x = 1024 (1279.5 -> 1280) and
texelFetch reads the wrong or an outside texel. Only colour and luma are
mediump now; the load and the integer address stay full precision
(checked in the SPIR-V).
- Fast NIS keeps luma in alpha, so it runs only on chain formats with at
least 8 alpha bits; the 10-bit HDR composition format (2-bit alpha) uses
nis.frag.
- A driver that rejects nis3_half or nis_luma_half gets nis.frag instead of
a disabled effects chain.
- If the NIS luma target cannot be allocated, that frame uses SGSR from the
scene instead of skipping every effect.
* perf(input): controller readers wake when input lands instead of polling
* fix(input): an idle controller read stays a cancellation point
* Keep the cancellation point out of builds without thread cancellation