Repository navigation
WIP: feat(webos): PyroWave decode with true 4K60 on the video plane - #317
Draft
zampierilucas wants to merge 10 commits into
Draft
zampierilucas wants to merge 10 commits into
zampierilucas wants to merge 10 commits into
Conversation
- Vulkan PyroWave decoder via the Mali driver's built-in Vulkan ICD - 1080p and below: decode, upload to GL; streams larger than the display decode at half resolution on the GL path (file pyro-gl forces it) - above 1080p: full-resolution decode, NV12 to the video plane through DILE_VO, videooutputd and compositor punch-through; GL window stays transparent with the stats overlay on top - decode thread keeps up to two frames in flight, newest frame only - colour range follows the stream; autostream launch parameter - overlay: PyroWave decode timings, no GPU estimate Cargo [patch] points at local punktfunk worktrees (webos-console) and a vendored pyrowave-sys; replace with upstream revisions before merging. Signed-off-by: Lucas Zampieri <lcasmz54@gmail.com>
… in the app dir Signed-off-by: Lucas Zampieri <lcasmz54@gmail.com>
…) every 10 s Signed-off-by: Lucas Zampieri <lcasmz54@gmail.com>
- streams above 1080p use CPU dequant on 4 threads (nice -10) and GPU iDWT; 1080p keeps the GPU path - AES-GCM session cipher (aws-lc, ARMv8 AES); no longer advertise ChaCha20 - decode pacing estimate learns only from frames queued behind another - cpu dequant timing line LG C5 live, testsrc2 4K60: 60 fps with 0 loss at 230/260/300 Mbps caps. Signed-off-by: Lucas Zampieri <lcasmz54@gmail.com>
- set LG's VO frame rate to 60 and copy each frame only after LG reports the previous picture latched (lxvo_read_info DISP event), so the HAL's two buffer pairs are never overwritten while on screen; on by default, `lxvo-dg` in the app dir overrides (flags lag timeout, "0" disables) - switch the TV picture mode to "game" for the length of a stream and restore the previous mode on stream end, exit, or next launch after a crash; `no-game-picture` in the app dir disables it Signed-off-by: Lucas Zampieri <lcasmz54@gmail.com>
…cal paths Signed-off-by: Lucas Zampieri <lcasmz54@gmail.com>
Each data shard the core reassembler reports is queued per frame and dequantized on the existing dequant threads while the rest of the frame is still on the wire; a pending frame always decodes first. On by default, an empty no-early-dq file in the app dir turns it off. Adds a 'pyrowave last>decoded' stage line. LG C5, 4K60 300 Mbps: last packet to decoded 23.2 -> 21.0 ms, capture to decoded 42.8 -> 41.2 ms, fps unchanged, client CPU ~145% -> ~170% of one core. Takes the core change from the fork at 19b9360e. Signed-off-by: Lucas Zampieri <lcasmz54@gmail.com>
…process pf_vo_close left lx_k at the old session's frame count, and lx_base is only re-read when lx_k is 0, so after a reconnect the gate compared the new session against the old one: every frame waited out the 25 ms timeout (~33 ms per DisplayPicture, ~30 fps) or never waited (tearing) until the app was relaunched. Reset lx_k on close, start the DISP event thread only once instead of one more per open, and sleep instead of spinning when its descriptor is gone. Signed-off-by: Lucas Zampieri <lcasmz54@gmail.com>
…d copy The client carried its own 154k-line copy of pyrowave-sys only for the Mali decoder changes, an armv7 FPU flag and FP16 math. All three now live in the punktfunk fork's pyrowave-sys (fp16-math feature), so the [patch] takes it from there like the other punktfunk crates and the copy goes. Signed-off-by: Lucas Zampieri <lcasmz54@gmail.com>
…s are patches The Mali, hybrid and early dequant changes now sit in pyrowave-sys as patches 0014-0016 on top of upstream PyroWave, the same way punktfunk carries its own. The source tree is unchanged. Also commits the THIRD-PARTY-NOTICES.txt the build regenerated after dropping the vendored copy. Signed-off-by: Lucas Zampieri <lcasmz54@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a draft, it works end to end on my LG C5 but it still needs a bunch of cleanup before it's ready for review. Opening it now so the approach is visible and we can talk about the LG specific bits early.
What it does. Adds a PyroWave sink for webOS. Streams up to 1080p decode on the GPU through the hidden Vulkan driver in libmali and draw through GL. Above 1080p the client splits decoding, NEON on 3 to 4 CPU threads unpacks each frame and the GPU only runs the inverse wavelet, then frames go to LG's video plane through the photo video output (DILE_VO), so the panel gets real 3840x2160 instead of the 1080p graphics plane. Each copy into LG's buffer waits for LG's latch event, which is needed because of the tearing. On top of that the TV switches to game picture mode during a stream and puts the previous mode back afterwards, the session uses AES-GCM (this CPU has ARMv8 AES), and there's a flag to skip the start-up bitrate probe.
Why Vulkan
libmali(Mali-G52, r46p0) has a working Vulkan 1.3 driver that only exportsvk_icdGetInstanceProcAddr. The client dlopenslibmali.soand uses that./dev/driand Mali can't export dma-bufs, each decoded frame is copied from Vulkan into a GL texture there. Above 1080p GL isn't involved, frames go to the video plane.Why the photo output (
libdile_photo)DILE_VO_DisplayPicture, the output LG's photo viewer uses, takes raw 4K frames onto the video plane. It only copies chroma for NV12, needs videooutputd routing plus a compositor punch-through, and has two buffer pairs, so each copy waits for liblxv's latch event.Why the split decoder
Numbers on a C5 (Mali-G52, webOS 10.3.1), host on Fedora 44 with an RTX 5080, 4K60 at 300 Mbps holds 60 fps with about 0% loss, about 17 ms GPU and 3 ms CPU per frame, 1080p60 at 60 fps.
The honest part, this leans on undocumented LG libraries (libdile_photo, libhal_photo, liblxv), a compositor punch-through call whose signature differs from LG's header, and a luna name only dev mode apps may register. I'd like your take on whether that's something you want in the client at all, or behind a build flag, before I spend time polishing it.
Still to do before this leaves draft.
Trying it yourself
If you're crazy enough to try this, these are all the pieces still in flight.
[patch]pulls punktfunk from zampierilucas/punktfunkwebos-console, which has the core hooks and the PyroWave patches 0014 to 0016 incrates/codec/pyrowave-sys/patches/.host/send-skip-stale(per stream pacing, 1080p cap, skip to the newest frame when the send queue backs up), with these inhost.env.