Files
DroidDeck/tools/upscale/layer/fsr411_full_gpu.h
T
The412Banner 74ece6c854 upscale: port Winlator-NeuralScale r5 (non-root parts)
Layer and bridges updated from Winlator-NeuralScale 71c140d9 (michaelisomer-cyber, GPL-3.0):
- full FSR 4.1 on the NPU (S8 graph, U8 fallback), compiled on the device per HTP arch
- ghosting fix: blank far depth when a game sends none, binding 11 bound with 62
- FSR 4.1.2 Lite S8/U8 zero-copy graphs
- Snapdragon GSR 2 on the GPU (new engine sgsr2_gpu)
- D3D11 DLSS through DXVK's interop (nvngx D3D11 entry points)

Left out on purpose: upstream's root-only performance/thermal manager, GPU clock floor and
bypass charging. Kept from DroidDeck: NPU detection by the app (DROIDDECK_UPSCALE_NPU, any HTP
generation incl. the phone's own QNN libraries) instead of upstream's SoC list, DD env names and
log tags, Intel XeSS 3 (runtime still fetched from a0ab6b0f, upstream dropped it in cb3ae04e).

FSR 4.0 on the NPU is gone upstream; the engine id becomes fsr4_1_full_npu and saved
fsr4_0_npu choices map to it. The full-FSR-4-on-Turnip guard is now opt-in
(DROIDDECK_UPSCALE_FULL_OFF_ON_TURNIP=1), since upstream's binding-11 fix targets that black frame.
Data files re-pinned to 71c140d9 (81 core + 8 NPU, sha256 checked).
2026-12-04 18:52:36 -05:00

50 lines
2.5 KiB
C

// Winlator NeuralScale AMD FSR 4.1.1 Full INT8 Pipeline (Hexagon HTP NPU + Optimized Adreno GPU)
//
// Uses genuine AMD FSR 4.1.1 Full INT8 SPIR-V modules (pass-00..pass-27) and 131 KB initializers.bin:
// - NPU Mode (Snapdragon 8 Elite / 8 Elite Gen 5):
// Runs ONLY 2-3 lightweight GPU passes (optional pass-00 SPD, pass-01 prepass, pass-27 postpass)
// while offloading ALL 12 deep neural U-Net blocks (pass-02..pass-26, 109 ops) to Hexagon HTP
// via zero-copy AHardwareBuffer + native symmetric SFIXED_POINT_8 (0 pack/unpack/Convert passes,
// 0 CPU cache flushes, inter-frame micro-sleep, Sync & Async support, honest Sync GPU timer!).
// - GPU Mode (Optimized DP4a):
// Full 28-pass pipeline with Tier 1.1 direct output write (0 CmdBlitImage) and Tier 1.2
// conditional Auto-Exposure SPD skip.
#pragma once
#include <vulkan/vulkan.h>
#include "fsr4_pipeline.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct WlFsr411FullGpu WlFsr411FullGpu;
WlFsr411FullGpu *wl_fsr411_full_gpu_create(const WlVkDispatch *vk, const char *fsr4_dir, const char *power_mode);
void wl_fsr411_full_gpu_destroy(WlFsr411FullGpu *ctx);
void wl_fsr411_full_gpu_reset(WlFsr411FullGpu *ctx);
void wl_fsr411_full_gpu_release_sync_events(WlFsr411FullGpu *ctx);
int wl_fsr411_full_gpu_is_ready(const WlFsr411FullGpu *ctx);
int wl_fsr411_full_gpu_is_npu_ready(const WlFsr411FullGpu *ctx);
const char *wl_fsr411_full_gpu_npu_state(const WlFsr411FullGpu *ctx);
const char *wl_fsr411_full_gpu_fail_reason(const WlFsr411FullGpu *ctx);
int wl_fsr411_full_gpu_dispatch(WlFsr411FullGpu *ctx, VkCommandBuffer cb,
const WlFsr4FrameDesc *frame,
VkImage color_img, VkFormat color_fmt,
VkImage depth_img, VkFormat depth_fmt,
VkImage motion_img, VkFormat motion_fmt,
VkImage exp_img, VkFormat exp_fmt,
VkImage out_img, VkFormat out_fmt, VkImageUsageFlags out_usage,
uint32_t ow, uint32_t oh,
int use_npu, int npu_sync, float sharpness,
int *out_used_npu,
uint32_t *out_gpu_us,
uint32_t *out_htp_us,
uint64_t *out_dispatches,
const char **out_reason);
#ifdef __cplusplus
}
#endif