WIP: fix(video): decode movie pictures on a worker #2912
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2912
Loading…
Reference in a new issue
No description provided.
Delete branch "omgitsgela/Longshot:fix/movie-decode-worker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
A movie's pictures were decoded on the thread that has to hand one to the game every 16.7 ms. A 3.2 to 4.0 ms decode, with a worst picture of 94 to 128 ms, therefore sat directly in the Acquire path. On the Deck LCD the opening movie skipped 532 pictures in its first minute and 593 over all 5,947 pictures.
This changes the movie path in three parts:
host/nn_video.c: each decoder owns a native worker.dec_submitcopies the compressed packet into an owned packet and wakes the worker; the worker decodes into the existing bounded host-picture ring;dec_acquireonly leases a free guest pool, detaches a ready picture, copies, and returns the completed fence.dec_flush,dec_stopanddec_finalizejoin the worker. Acquire no longer decodes or performs the catch-up decode.gpu/vk/vk_draw.cpp: the movie upscale pipeline and one dummy dispatch are made at startup, so the first movie frame no longer pays the driver's first-dispatch compile.gpu/vk/vk_shader.cpp: a program rejected as a network left out on this card is remembered by key incache/longshot_left_out.bin. Later runs skip its translation before doing it again. No program keys are hardcoded.Fixes #73.
Testing
Tested: Steam Deck LCD (AMD Custom GPU 0405, RADV VANGOGH, Vulkan 1.4), base
ec889d9dwith then320-fixpack,HOS_VIDEO_LOG=1, 1280x800, 60 fps cap, test user copy. The opening 5,947-picture movie was measured over its first 60 seconds and over the whole movie. The stock base was staged from the same base without the pack and run through the same harness.The fix log contains
vk: movie upscale pipeline prewarmed: yesandvk: movie upscale dispatch prewarmed: yes. Its first launch paid the renderer-changing preparation (309.6 s); the full measurement was the warm second launch.Still to test:
decode_nextbut its callback thread affinity needs its own review (by hand, on a Windows PC with an AV1 movie).Measurements
Verdict: The worker removes nearly all of the movie's skipped pictures: 532 to 16 in the first minute and 593 to 34 over the whole 5,947-picture movie on the Deck LCD.
Setup: Steam Deck LCD, RADV VANGOGH, Vulkan 1.4, 1280x800, 60 fps cap, same base
ec889d9d, test user, one first-minute run and one full-movie run per arm. The fix's full run was warm (the first launch prepared the changed renderer).ec889d9d[6,7,1,1,2,1,1,1](18)[2,2,1,1,1,2,1,1](9)Risks
MAX_QUEUEof 8 pictures; the worker blocks at the queue limit instead of discarding a picture.dec_flush,dec_stopanddec_finalizenow join the worker. The tests for Flush, EOS and finalize still need to be adapted to the worker; a hang there would be a lifecycle bug, not a picture-timing one.queue_frame, and the worker life-cycle is shared; it needs a Windows run.cache/.longshot_options.ini.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (the video fixtures that model the old Acquire-decodes path still need adapting; this is the remaining test work).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. The runtime A/B is above; the source fixtures are being adapted.gpu/vk/switches.def.tests/that reads changed source is updated, not weakened.MKWVK_API_VERSIONbumped (MkwVkHostorMkwVkRendereringpu/vk/vk_api.hchanged). No API change.mainand here, for a change that shows on screen. The change is timing, not a visual.Assisted-by:/Co-Authored-By:trailers.Assisted-by: Hermes Agent
Tested in game: Steam Deck LCD (RADV VANGOGH, Vulkan 1.4), base
ec889d9d: first-minute skips 532 -> 16; full 5,947-picture movie 593 -> 34; decode 4.0 -> 3.2 ms, worst 128.4 -> 94.3 ms; startup prewarm lines present.Superseded by #2913. This branch was based on
ec889d9dand carried two unrelated BC3 pilot commits; #2913 is the same worker/prewarm/cache change rebased onto current maind193d12dwith only the three movie files.Pull request closed