Files
DroidDeck/docs/development/npu-upscaler.md
T

3.9 KiB

Neural upscaling on the Hexagon NPU

Reference: Winlator-NeuralScale, a Winlator fork that runs AMD FSR 4 on the Qualcomm Hexagon HTP through QNN, with GPU (DP4a) FSR 4 / XeSS / FSR 3.1 fallbacks. This note records what carries over to DroidDeck, what does not, and what has been built so far.

How the reference works

A Vulkan layer in the game's process intercepts the game's own upscaler calls (FSR 2/3/4, DLSS through an NGX bridge, XeSS) via replacement DLLs. Those calls hand over colour, depth, motion vectors, exposure and jitter. The layer runs the FSR 4 network (INT8, compiled on the device by libQnnHtpPrepare.so) on the NPU, with Vulkan passes before and after it and AHardwareBuffer for the hand-off.

What carries over, what does not

Piece In DroidDeck
Game-side hook (DLL replacement, NGX/FFX bridges) The guest runs Steam under FEX and Proton, so the same Windows-side bridge DLLs could apply, but nothing in the repo loads them yet.
Temporal inputs (depth, motion vectors, jitter) Only exist inside the guest. The Wayland compositor (waylandcomp, where FSR 1 / SGSR / frame generation run) sees a finished colour frame, so FSR 4 cannot run there. A compositor-side network would have to be a spatial-only super-resolution model, a different thing from FSR 4.
QNN runtime and skel libraries Qualcomm's, not redistributable here. They would come from the user's own QAIRT SDK or a runtime download.
FSR 4 weights AMD's. The reference ships them in its APK; DroidDeck should not copy them without a licence check.
DP4a GPU path Independent of the NPU and the most portable part. Needs the same guest-side hook.

Findings on the Retroid Pocket Duo (SM8750, Hexagon v79)

  • /dev/fastrpc-cdsp is crw-rw-r-- system system. The DroidDeck app uid (10120 here) fails access(W_OK), so an unprivileged app cannot open a FastRPC session on the compute DSP on this firmware, whatever it bundles. The reference fork targets devices where the node is world-writable. NpuInfo reports this as "app cannot open it".
  • The AYANEO Pocket FIT Elite (SM8750P, stock, no root) has the same node, same 0664 system:system, and the same DAC result for a non-system uid, so this is the stock 8 Elite layout and not a Retroid quirk. The check was done as the adb shell uid, which has the same "other" bits as an app uid; DroidDeck's own uid has not run it on the FIT Elite because the fast deploy loop needs tools/build_local.sh first.
  • The vendor partition has libcdsprpc.so but no QNN libraries, so the runtime has to be bundled or downloaded.
  • SELinux is permissive on this unit (Magisk), so it says nothing about a stock device. The DAC check is the conclusion that holds.

Built so far

  • gpu/NpuInfo.kt: maps the SoC model or board platform to a Hexagon generation (v68 to v81, with the VTCM size the reference caps vtcmSizeInMB to), checks whether the app's uid can open the FastRPC node, and whether the QNN libraries are bundled. Shown as an "NPU" section in Device info.
  • NpuInfoTest.

Next steps, in order

  1. Decide the hook point. Guest-side (Winlator's approach) is the only one that can run FSR 4; compositor-side limits it to spatial super-resolution.
  2. Resolve the FastRPC access problem: it needs either a device where the node is open, or a privileged helper, before any QNN work on this hardware is worth starting. Both 8 Elite devices tried so far are closed; an 8 Elite Gen 5 handheld is still untested.
  3. GPU-only FSR 4.1 Lite (DP4a) behind the hook, since it needs no NPU access and exercises the same plumbing.
  4. QNN graph compile and run, per-architecture cache directories (v73/, v75/, v79/, v81/), and a fallback to the GPU path whenever NpuInfo.usable is false.
  5. Licence review of AMD weights and Qualcomm binaries before anything is bundled or downloaded.