Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

Latency: frames paced to the screen and measured there; hardware decoding probed

Rafael Abud Ferreira06d03f1d3635
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93b5c51..d348866 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -84,6 +84,7 @@ if(XCLOUD_PS5)
src/app/stream_player.cpp
src/display/display.cpp
src/display/gpu.cpp
+ src/media/hw_decoder.cpp
src/input/controller.cpp
)
target_include_directories(xcloud_app PRIVATE "${PS5_RADV}/include")
diff --git a/ROADMAP.md b/ROADMAP.md
index e7e4109..35fb6d9 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -8,27 +8,32 @@ Last update: 2026-10-08, after v0.5.0.
## Now
-### 1. Lower input-to-picture latency — next
-A frame is shown 13-48 ms after it arrives (samples in `xcloud.log`): the
-swapchain holds up to two finished frames (3 images, FIFO) and the video queue
-keeps frames when decoding falls behind. In fast games (Fortnite aiming) that
-delay is what you feel.
+### 1. Lower input-to-picture latency — done (v0.6.0)
+Measured with `VK_KHR_present_wait`, from a frame's network arrival to the
+moment it is on the TV: **~23 ms on average** at 60 Hz (decode ~6 ms, GPU
+~3 ms, waiting for the next vblank ~8 ms on average). The earlier "13-48 ms"
+stopped at `present()`, not at the screen.
-- Present the newest frame as soon as it is drawn: fewer swapchain images or
- mailbox presentation, and drop stale frames instead of queueing them.
-- Done when the median "shown after arrival" falls by ≥ 10 ms with no more
- late or skipped frames than today (log sample every 600 frames, autotest).
+- Each frame is submitted once the one before is on the screen (no queued
+ frames: the wait for a free image fell from 1-3 ms to 0.01 ms), and a frame
+ is skipped when a newer one is already waiting. Skipped frames in a 50 s
+ run: 85 → 35.
+- The game menu shows "On screen after" (that measurement, live).
+- **Next step, 120 Hz output** (halves the vblank wait, ~4 ms): the title
+ declares it with `attribute3 = 0x80040`; on our console the display still
+ offered only 59.94 Hz. To check: the TV's 120 Hz support and the PS5's
+ 120 Hz output setting, then re-registering the app.
-### 2. Hardware video decoding — next (probe first)
-H.264 is decoded by FFmpeg on the CPU (~6 ms a frame at 1080p). The PS5's GPU
-(Navi 21 class) has a video decoder that RADV exposes through Vulkan Video,
-if the PS5 port enables it.
+### 2. Hardware video decoding — works, parked
+RADV has no Vulkan Video on the PS5, but the system's own decoder
+(`libSceVideodec2`, sysmodule 207) works from the app: H.264 1080p decodes to
+NV12 (pitch 2048, coded 1088 rows) in **~6 ms**, the same as FFmpeg on the
+CPU, as BlackBearReloaded's research measured too. So no latency gain at
+1080p; it only frees a CPU core.
-- Probe: does the device report `VK_KHR_video_decode_queue` /
- `VK_KHR_video_decode_h264` and a decode queue family? If not: dropped.
-- If yes: decode into GPU images, feed them straight to the deband / FSR
- passes (no plane copies), CPU decoding kept as the fallback.
-- Done when decoding takes ≤ 2 ms a frame and 1440p would fit the frame budget.
+- Kept in `src/media/hw_decoder.*` (autoplay `hwdecode` runs it alongside and
+ logs it), with the PS5's own structure layouts and memory types.
+- Becomes the way to go if 1440p / 4K or HEVC streams are ever granted.
### 3. Reconnect after a network drop — next
When the connection drops, the stream ends and the app returns home, though
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index ac95f4c..a5df062 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -67,3 +67,12 @@ none are distributed with this project.
`extern/fsr1/ffx_a.h` and `extern/fsr1/ffx_fsr1.h`, compiled into the shaders in
`src/display/shaders/` (EASU upscaling, RCAS sharpening). MIT License,
Copyright (c) 2021 Advanced Micro Devices, Inc.: see `extern/fsr1/LICENSE.txt`.
+
+## References
+
+- `src/media/hw_decoder.cpp` declares libSceVideodec2's structures as the PS5
+ lays them out, and sets the decoder up (sysmodule 207, memory type 12,
+ compute queue 0/0) after BlackBearReloaded's
+ [ProsperoLight](https://github.com/blackbearreloaded/ProsperoLight) and
+ [ps5-hardware-video-decoding-research](https://github.com/blackbearreloaded/ps5-hardware-video-decoding-research)
+ (both GPL-3.0-or-later).
diff --git a/ps5/stubs/libSceVideodec2.c b/ps5/stubs/libSceVideodec2.c
new file mode 100644
index 0000000..b2956c7
--- /dev/null
+++ b/ps5/stubs/libSceVideodec2.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+// Copyright (C) 2026 RafaelNGP
+/* Host-link only: names the module's exports so the native-app converter
+ * records the imports. Never packaged or executed. */
+int sceVideodec2QueryComputeMemoryInfo(void *info) { (void)info; return -1; }
+int sceVideodec2AllocateComputeQueue(const void *cfg, const void *mem, void **queue) { (void)cfg; (void)mem; (void)queue; return -1; }
+int sceVideodec2ReleaseComputeQueue(void *queue) { (void)queue; return -1; }
+int sceVideodec2QueryDecoderMemoryInfo(const void *cfg, void *mem) { (void)cfg; (void)mem; return -1; }
+int sceVideodec2CreateDecoder(const void *cfg, const void *mem, void **decoder) { (void)cfg; (void)mem; (void)decoder; return -1; }
+int sceVideodec2DeleteDecoder(void *decoder) { (void)decoder; return -1; }
+int sceVideodec2Decode(void *decoder, const void *in, void *fb, void *out) { (void)decoder; (void)in; (void)fb; (void)out; return -1; }
+int sceVideodec2Flush(void *decoder, void *fb, void *out) { (void)decoder; (void)fb; (void)out; return -1; }
+int sceVideodec2Reset(void *decoder) { (void)decoder; return -1; }
diff --git a/src/app/cli_main.cpp b/src/app/cli_main.cpp
index 9dcd1c3..e389fd4 100644
--- a/src/app/cli_main.cpp
+++ b/src/app/cli_main.cpp
@@ -609,6 +609,7 @@ int main(int argc, char** argv) {
info.mbps = 12.4;
info.lossPct = 0.2;
info.decodeMs = 4.1;
+ info.onScreenMs = 23.2;
info.width = 1920;
info.height = 1080;
auto save = [&](const std::string& name, const ui::Canvas& over, int ox, int oy, int alpha) {
diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cpp
index 4b9ec00..e121acd 100644
--- a/src/app/ps5_main.cpp
+++ b/src/app/ps5_main.cpp
@@ -159,7 +159,8 @@ bool g_autoplayIdle = false;
bool g_autoplayDetailTest = false; // open a game to buy far down the list, save its page
bool g_autoplayLibraryTest = false; // open "Your games", save it at 4 s and 25 s
bool g_autoplayVkTest = false; // the GPU presenting instead of the CPU display
-bool g_autoplayCpuDisplay = false; // the CPU display even where the GPU comes up
+bool g_autoplayCpuDisplay = false;
+bool g_autoplayHwDecode = false; // hwdecode: the hardware decoder alongside, logged // the CPU display even where the GPU comes up
bool g_autoplayVibeTest = false; // each motor alone, with a notification
bool g_autoplayImeTest = false; // open the system keyboard on the home screen
bool g_autoplayMenuTest = false; // in the game: open the menu, switch to 720p
@@ -191,6 +192,9 @@ void loadAutoplay() {
if (opt == "vibetest") g_autoplayVibeTest = true;
if (opt == "vktest") g_autoplayVkTest = true;
if (opt == "cpudisplay") g_autoplayCpuDisplay = true;
+ if (opt == "hwdecode") g_autoplayHwDecode = true;
+ if (opt.rfind("swap=", 0) == 0) display::gpu::setSwapImages(std::atoi(opt.c_str() + 5));
+ if (opt == "nopace") display::gpu::setPresentWait(false);
if (opt == "detailtest") g_autoplayDetailTest = true;
if (opt == "librarytest") g_autoplayLibraryTest = true;
if (opt == "imetest") g_autoplayImeTest = true;
@@ -259,6 +263,7 @@ std::string stream(xcloud::GssvClient& gssv) {
app::StreamPlayer player(gssv);
if (g_autoplayDump) player.dumpVideo(platform::dataDir() + "/stream.aus", 20);
player.setDecodeThreads(g_decodeThreads);
+ player.setHwDecodeProbe(g_autoplayHwDecode);
std::string err;
if (!player.start(err)) return "ERROR: " + ui::trf(ui::Str::StreamFailed, err);
{
@@ -299,7 +304,7 @@ std::string stream(xcloud::GssvClient& gssv) {
XC_LOGI("stream: %llu frames, %llu decoded, %llu skipped, %llu failed, %llu resets, %llu kf req, "
"%llu queued, %llu audio; rtp %llu pkts, %llu lost, %llu recovered, %llu nacks, "
"%llu frames dropped; %llu kbps (remb %llu); %llu rumble; decode %.1f/%.1f ms, draw %.1f/%.1f ms, %llu late; "
- "rtt %d ms; %dx%d",
+ "rtt %d ms; %dx%d; on screen %.1f/%.1f ms after arrival",
static_cast<unsigned long long>(st.videoFrames), static_cast<unsigned long long>(st.decodedFrames),
static_cast<unsigned long long>(st.droppedFrames), static_cast<unsigned long long>(st.decodeFailures),
static_cast<unsigned long long>(st.queueResets), static_cast<unsigned long long>(st.keyframeRequests),
@@ -309,7 +314,8 @@ std::string stream(xcloud::GssvClient& gssv) {
static_cast<unsigned long long>(st.rtpDroppedFrames), static_cast<unsigned long long>(st.rtpKbps),
static_cast<unsigned long long>(st.rembKbps), static_cast<unsigned long long>(st.vibrations),
st.decodeAvgUs / 1000.0, st.decodeMaxUs / 1000.0, st.drawAvgUs / 1000.0, st.drawMaxUs / 1000.0,
- static_cast<unsigned long long>(st.lateFrames), st.rttMs, st.width, st.height);
+ static_cast<unsigned long long>(st.lateFrames), st.rttMs, st.width, st.height,
+ st.displayAvgUs / 1000.0, st.displayMaxUs / 1000.0);
if (st.rttMs > 0 && (bestRtt < 0 || st.rttMs < bestRtt)) bestRtt = st.rttMs;
{
ui::StreamInfo info;
@@ -320,6 +326,7 @@ std::string stream(xcloud::GssvClient& gssv) {
uint64_t lost = st.rtpLost - last.rtpLost, got = st.rtpPackets - last.rtpPackets;
info.lossPct = got + lost ? 100.0 * lost / (got + lost) : 0;
info.decodeMs = st.decodeAvgUs / 1000.0;
+ info.onScreenMs = st.displayAvgUs / 1000.0;
info.width = st.width;
info.height = st.height;
std::lock_guard<std::mutex> lock(g_infoMutex);
diff --git a/src/app/stream_player.cpp b/src/app/stream_player.cpp
index 05c3d10..6abfdac 100644
--- a/src/app/stream_player.cpp
+++ b/src/app/stream_player.cpp
@@ -6,6 +6,7 @@
#include "input/controller.h"
#include "media/audio_out.h"
#include "media/decoder.h"
+#include "media/hw_decoder.h"
#include "platform/platform.h"
#include "stream/stream_session.h"
#include "ui/strings.h"
@@ -43,6 +44,7 @@ struct StreamPlayer::Impl {
std::vector<uint8_t> data;
uint32_t rtpTimestamp = 0;
double arrivalMs = 0; // StreamSession::clockMs()
+ uint64_t arrivalUs = 0; // platform::nowUs(), for the display latency
};
std::deque<VideoFrame> frames;
std::atomic<bool> running{false};
@@ -59,8 +61,10 @@ struct StreamPlayer::Impl {
std::atomic<uint32_t> pictureSize{0}; // width << 16 | height
std::atomic<uint64_t> vibrations{0}, lateFrames{0};
std::atomic<uint64_t> triggerVibrations{0};
+ std::atomic<uint64_t> displayUs{0}, displayCount{0}, displayMaxUs{0};
std::atomic<uint64_t> decodeUs{0}, decodeCalls{0}, decodeMaxUs{0}, drawUs{0}, drawCalls{0}, drawMaxUs{0};
int decodeThreads = 1;
+ bool hwProbe = false;
static void atomicMax(std::atomic<uint64_t>& a, uint64_t v) {
uint64_t cur = a;
@@ -121,7 +125,15 @@ struct StreamPlayer::Impl {
// Timings of the frames handed to the decoder, by RTP timestamp:
// pictures can come out later than their input.
std::deque<stream::FrameMetadata> inFlight;
+ media::HwDecoder hw;
+ bool hwOk = hwProbe && hw.init(1920, 1088);
+ if (hwProbe) XC_LOGI("hwdec: probe %s", hwOk ? "running" : "failed to start");
+ uint64_t hwUs = 0, hwMaxUs = 0, hwPictures = 0, hwCalls = 0, hwLogAt = platform::nowMs() + 1000;
int fullStreak = 0;
+ int skippedInRow = 0;
+ constexpr uint64_t kShownRing = 8;
+ std::pair<uint64_t, uint64_t> inScreenQueue[kShownRing] = {}; // present id, arrival us
+ uint64_t lastShownId = 0;
while (running) {
size_t backlog;
{
@@ -146,6 +158,22 @@ struct StreamPlayer::Impl {
media::Picture pic;
const bool first = decodedFrames == 0 && !loggedFirstDecode;
if (first) XC_LOGI("first video decode: %zu bytes", au.size());
+ if (hwOk) {
+ media::HwDecoder::Picture hp;
+ uint64_t h0 = platform::nowUs();
+ if (hw.decode(au.data(), au.size(), frame.rtpTimestamp, hp)) ++hwPictures;
+ uint64_t took = platform::nowUs() - h0;
+ hwUs += took;
+ hwMaxUs = std::max(hwMaxUs, took);
+ ++hwCalls;
+ if (platform::nowMs() >= hwLogAt) {
+ hwLogAt += 1000;
+ XC_LOGI("hwdec: %llu calls, %llu pictures, %.2f/%.2f ms", static_cast<unsigned long long>(hwCalls),
+ static_cast<unsigned long long>(hwPictures), hwCalls ? hwUs / 1000.0 / hwCalls : 0.0,
+ hwMaxUs / 1000.0);
+ hwUs = hwMaxUs = hwCalls = hwPictures = 0;
+ }
+ }
stream::FrameMetadata meta;
meta.serverDataKey = frame.rtpTimestamp;
meta.firstPacketArrivalMs = frame.arrivalMs;
@@ -182,10 +210,15 @@ struct StreamPlayer::Impl {
++decodedFrames;
pictureSize = (static_cast<uint32_t>(pic.width) << 16) | static_cast<uint32_t>(pic.height);
bool screenshot = saveSnapshotIfAsked(pic);
- if (backlog > 2) { // behind: skip drawing to catch up
+ // A newer frame already waits: decode this one (the next needs it)
+ // but show the newer one, a frame sooner. At most two in a row, so
+ // the picture keeps moving when decoding runs behind.
+ if (backlog > 0 && skippedInRow < 2) {
+ ++skippedInRow;
++droppedFrames;
continue;
}
+ skippedInRow = 0;
std::lock_guard<std::mutex> lock(display::frameMutex());
if (decodedFrames == 1) XC_LOGI("first draw %dx%d", pic.width, pic.height);
uint64_t t2 = platform::nowUs();
@@ -210,6 +243,22 @@ struct StreamPlayer::Impl {
}
display::present();
uint64_t t3 = platform::nowUs();
+ // Display latency: network arrival to the TV, once the GPU says
+ // the frame is on the screen (a frame or so later).
+ if (uint64_t id = display::lastPresentId()) {
+ inScreenQueue[id % kShownRing] = {id, frame.arrivalUs};
+ uint64_t shownId = 0, shownAt = 0;
+ if (display::lastShown(shownId, shownAt) && shownId != lastShownId) {
+ lastShownId = shownId;
+ const auto& q = inScreenQueue[shownId % kShownRing];
+ if (q.first == shownId && shownAt > q.second) {
+ uint64_t lat = shownAt - q.second;
+ displayUs += lat;
+ ++displayCount;
+ atomicMax(displayMaxUs, lat);
+ }
+ }
+ }
meta.renderedMs = session->clockMs();
if (known) session->reportFrame(meta);
if (decodedFrames % 600 == 1)
@@ -242,7 +291,7 @@ struct StreamPlayer::Impl {
frames.clear();
keyframeWanted = true;
}
- frames.push_back({std::vector<uint8_t>(d, d + n), rtpTimestamp, session->clockMs()});
+ frames.push_back({std::vector<uint8_t>(d, d + n), rtpTimestamp, session->clockMs(), platform::nowUs()});
cv.notify_one();
};
cb.audio = [this](const uint8_t* d, size_t n, uint32_t) {
@@ -473,6 +522,8 @@ void StreamPlayer::requestSnapshot(const std::string& path) {
}
void StreamPlayer::stop() { impl_->stop(); }
+void StreamPlayer::setHwDecodeProbe(bool on) { impl_->hwProbe = on; }
+
void StreamPlayer::setDecodeThreads(int threads) { impl_->decodeThreads = std::max(1, threads); }
StreamPlayer::Stats StreamPlayer::stats() const {
@@ -495,6 +546,9 @@ StreamPlayer::Stats StreamPlayer::stats() const {
st.decodeMaxUs = impl_->decodeMaxUs.exchange(0);
st.drawAvgUs = rc ? ru / rc : 0;
st.drawMaxUs = impl_->drawMaxUs.exchange(0);
+ uint64_t dn = impl_->displayCount.exchange(0), du2 = impl_->displayUs.exchange(0);
+ st.displayAvgUs = dn ? du2 / dn : 0;
+ st.displayMaxUs = impl_->displayMaxUs.exchange(0);
if (impl_->session) { // the caller's thread is the one that stops the player
const auto& v = impl_->session->videoStats();
st.rtpPackets = v.packets;
diff --git a/src/app/stream_player.h b/src/app/stream_player.h
index 152f4da..5c113c3 100644
--- a/src/app/stream_player.h
+++ b/src/app/stream_player.h
@@ -58,10 +58,15 @@ public:
int width = 0, height = 0; // of the last decoded picture
// Since the previous stats() call (so call it from one place only).
uint64_t decodeAvgUs = 0, decodeMaxUs = 0, drawAvgUs = 0, drawMaxUs = 0;
+ // Network arrival to on the screen (GPU path), since the last call.
+ uint64_t displayAvgUs = 0, displayMaxUs = 0;
};
Stats stats() const;
// Before start(): H.264 decoder threads (more than 1 = frame threading).
void setDecodeThreads(int threads);
+ // Before start(): also run every frame through the PS5's hardware
+ // decoder and log how it does (the picture still comes from FFmpeg).
+ void setHwDecodeProbe(bool on);
private:
struct Impl;
diff --git a/src/display/display.cpp b/src/display/display.cpp
index d5780b5..ad46e51 100644
--- a/src/display/display.cpp
+++ b/src/display/display.cpp
@@ -501,6 +501,9 @@ void setSharpness(int amount) {
void setDeband(int level) { gpu::setDeband(level); }
+uint64_t lastPresentId() { return gpu::ready() ? gpu::lastPresentId() : 0; }
+bool lastShown(uint64_t& id, uint64_t& atUs) { return gpu::ready() && gpu::lastShown(id, atUs); }
+
void setOverlay(const uint32_t* pixels, int x, int y, int w, int h, uint8_t opacity) {
if (gpu::ready()) return gpu::setOverlay(pixels, x, y, w, h, opacity);
std::shared_ptr<const Overlay> next;
@@ -529,6 +532,8 @@ void drawRgba(const uint32_t*) {}
void setOverlay(const uint32_t*, int, int, int, int, uint8_t) {}
void setSharpness(int) {}
void setDeband(int) {}
+uint64_t lastPresentId() { return 0; }
+bool lastShown(uint64_t&, uint64_t&) { return false; }
bool readBackRgb(std::vector<uint8_t>&, int&, int&) { return false; }
} // namespace xc::display
diff --git a/src/display/display.h b/src/display/display.h
index 9d5d668..1fc9299 100644
--- a/src/display/display.h
+++ b/src/display/display.h
@@ -41,6 +41,11 @@ void setSharpness(int amount);
// Smoothing of compression blocks in flat areas (GPU only): 0 off, 1 low, 2 high.
void setDeband(int level);
+// GPU only: the id of the last present(), and the last frame known to be on
+// the screen (its id, and platform::nowUs() then). False on the CPU path.
+uint64_t lastPresentId();
+bool lastShown(uint64_t& id, uint64_t& atUs);
+
// The back buffer last drawn, untiled, as 8-bit RGB rows (diagnostics:
// what the TV shows), and its size. False without a display.
bool readBackRgb(std::vector<uint8_t>& rgb, int& width, int& height);
diff --git a/src/display/gpu.cpp b/src/display/gpu.cpp
index c2e7b98..1f5c5d1 100644
--- a/src/display/gpu.cpp
+++ b/src/display/gpu.cpp
@@ -13,6 +13,7 @@
#include <cmath>
#include <cstring>
#include <mutex>
+#include <string>
#include "display/shaders/easu.spv.h"
#include "display/shaders/rcas.spv.h"
@@ -30,8 +31,10 @@ namespace {
#define XC_VK_INSTANCE(X) \
X(EnumeratePhysicalDevices) X(GetPhysicalDeviceProperties) X(GetPhysicalDeviceQueueFamilyProperties) \
X(GetPhysicalDeviceMemoryProperties) X(GetPhysicalDeviceFeatures) X(CreateDevice) X(GetDeviceProcAddr) \
+ X(EnumerateDeviceExtensionProperties) \
X(GetPhysicalDeviceDisplayPropertiesKHR) X(GetDisplayModePropertiesKHR) X(CreateDisplayPlaneSurfaceKHR) \
- X(GetPhysicalDeviceSurfaceSupportKHR) X(GetPhysicalDeviceSurfaceCapabilitiesKHR)
+ X(GetPhysicalDeviceSurfaceSupportKHR) X(GetPhysicalDeviceSurfaceCapabilitiesKHR) \
+ X(GetPhysicalDeviceSurfacePresentModesKHR)
#define XC_VK_DEVICE(X) \
X(GetDeviceQueue) X(DeviceWaitIdle) X(CreateSwapchainKHR) X(GetSwapchainImagesKHR) \
@@ -93,6 +96,8 @@ struct State {
VkSemaphore acquired = VK_NULL_HANDLE, rendered = VK_NULL_HANDLE;
VkFence fence = VK_NULL_HANDLE;
bool fencePending = false;
+ bool presentId = false, presentWait = false;
+ uint64_t presented = 0; // the last present id
VkSampler nearest = VK_NULL_HANDLE, linear = VK_NULL_HANDLE;
Pipeline yuv, easu, rcas;
@@ -120,6 +125,14 @@ bool g_overlayDirty = false, g_overlayShown = false;
std::atomic<int> g_sharpness{0};
std::atomic<int> g_deband{1};
uint32_t g_frame = 0;
+uint32_t g_swapImages = 2;
+bool g_noPresentWait = false;
+PFN_vkWaitForPresentKHR vkWaitForPresentKHR = nullptr;
+// The last frame known on the screen: its present id and when (us).
+std::atomic<uint64_t> g_shownId{0}, g_shownAtUs{0};
+// How long acquiring waited for the display to free an image (FIFO: the
+// frame before went on screen), logged every 600 frames.
+uint64_t g_acquireWaitUs = 0, g_acquireWaitMaxUs = 0, g_acquires = 0;
bool fail(const char* step, VkResult r) {
XC_LOGE("gpu: %s failed (%d)", step, static_cast<int>(r));
@@ -171,6 +184,26 @@ bool createDevice() {
VkQueueFamilyProperties families[8];
n = 8;
vkGetPhysicalDeviceQueueFamilyProperties(g.physical, &n, families);
+ // What the driver offers for hardware video decoding (Vulkan Video).
+ for (uint32_t i = 0; i < n; ++i)
+ XC_LOGI("gpu: queue family %u: flags 0x%x, %u queue(s)%s", i, families[i].queueFlags, families[i].queueCount,
+ (families[i].queueFlags & VK_QUEUE_VIDEO_DECODE_BIT_KHR) ? " (video decode)" : "");
+ {
+ static VkExtensionProperties ext[512];
+ uint32_t count = 512;
+ std::string video;
+ if (vkEnumerateDeviceExtensionProperties(g.physical, nullptr, &count, ext) < VK_SUCCESS) count = 0;
+ for (uint32_t i = 0; i < count; ++i) {
+ const char* name = ext[i].extensionName;
+ if (std::strcmp(name, VK_KHR_PRESENT_WAIT_EXTENSION_NAME) == 0) g.presentWait = true;
+ if (std::strcmp(name, VK_KHR_PRESENT_ID_EXTENSION_NAME) == 0) g.presentId = true;
+ if (std::strstr(name, "video") || std::strstr(name, "present") || std::strstr(name, "swapchain") ||
+ std::strstr(name, "display"))
+ video += std::string(" ") + name;
+ }
+ XC_LOGI("gpu: %u device extensions; video/present/swapchain/display:%s", count,
+ video.empty() ? " none" : video.c_str());
+ }
g.family = UINT32_MAX;
for (uint32_t i = 0; i < n && g.family == UINT32_MAX; ++i)
if ((families[i].queueFlags & (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT)) ==
@@ -195,12 +228,24 @@ bool createDevice() {
v13.synchronization2 = VK_TRUE;
VkPhysicalDeviceFeatures features{};
features.shaderStorageImageWriteWithoutFormat = VK_TRUE;
- const char* const ext[] = {VK_KHR_SWAPCHAIN_EXTENSION_NAME};
+ // Present ids and waiting for them: frames are submitted only once the
+ // one before is on the screen (FIFO would otherwise queue two), and that
+ // moment is the frame's display time.
+ g.presentWait = g.presentWait && g.presentId;
+ VkPhysicalDevicePresentIdFeaturesKHR presentIdFeature{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR};
+ presentIdFeature.presentId = VK_TRUE;
+ VkPhysicalDevicePresentWaitFeaturesKHR presentWaitFeature{
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR};
+ presentWaitFeature.presentWait = VK_TRUE;
+ presentWaitFeature.pNext = &presentIdFeature;
+ if (g.presentWait) v13.pNext = &presentWaitFeature;
+ const char* const ext[] = {VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_PRESENT_ID_EXTENSION_NAME,
+ VK_KHR_PRESENT_WAIT_EXTENSION_NAME};
VkDeviceCreateInfo info{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO};
info.pNext = &v13;
info.queueCreateInfoCount = 1;
info.pQueueCreateInfos = &queue;
- info.enabledExtensionCount = 1;
+ info.enabledExtensionCount = g.presentWait ? 3 : 1;
info.ppEnabledExtensionNames = ext;
info.pEnabledFeatures = &features;
r = vkCreateDevice(g.physical, &info, nullptr, &g.device);
@@ -208,6 +253,12 @@ bool createDevice() {
#define XC_VK_LOAD_DEVICE(name) vk##name = reinterpret_cast<PFN_vk##name>(vkGetDeviceProcAddr(g.device, "vk" #name));
XC_VK_DEVICE(XC_VK_LOAD_DEVICE)
vkGetDeviceQueue(g.device, g.family, 0, &g.queue);
+ if (g.presentWait) {
+ vkWaitForPresentKHR = reinterpret_cast<PFN_vkWaitForPresentKHR>(vkGetDeviceProcAddr(g.device, "vkWaitForPresentKHR"));
+ g.presentWait = vkWaitForPresentKHR != nullptr;
+ }
+ XC_LOGI("gpu: present wait %s%s", g.presentWait ? "on" : "off",
+ g.presentWait && g_noPresentWait ? " (measuring only)" : "");
return true;
}
@@ -235,6 +286,15 @@ bool createSwapchain() {
vkGetPhysicalDeviceSurfaceSupportKHR(g.physical, g.family, g.surface, &supported);
VkSurfaceCapabilitiesKHR caps;
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(g.physical, g.surface, &caps);
+ {
+ VkPresentModeKHR modes[8];
+ uint32_t count = 8;
+ vkGetPhysicalDeviceSurfacePresentModesKHR(g.physical, g.surface, &count, modes);
+ std::string list;
+ for (uint32_t i = 0; i < count; ++i) list += " " + std::to_string(static_cast<int>(modes[i]));
+ XC_LOGI("gpu: present modes:%s (0 immediate, 1 mailbox, 2 fifo, 3 fifo relaxed); %u..%u images",
+ list.c_str(), caps.minImageCount, caps.maxImageCount);
+ }
const VkImageUsageFlags usage =
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
if (!supported || (caps.supportedUsageFlags & usage) != usage) {
@@ -244,7 +304,9 @@ bool createSwapchain() {
VkSwapchainCreateInfoKHR info{VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR};
info.surface = g.surface;
- info.minImageCount = 3;
+ // Two images: one on the screen, one being drawn. With three, FIFO kept
+ // two finished frames queued and the one shown was ~33 ms old.
+ info.minImageCount = std::max(caps.minImageCount, g_swapImages);
info.imageFormat = VK_FORMAT_B8G8R8A8_UNORM;
info.imageColorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
info.imageExtent = g.extent;
@@ -558,9 +620,35 @@ bool beginFrame(bool wait) {
g.fencePending = false;
}
if (g.frameOpen) return true; // drawn twice without a present: draw over it
+ if (g.presentWait && g.presented) {
+ if (!g_noPresentWait) {
+ // The frame before on the screen first (at most 50 ms, then go on).
+ if (vkWaitForPresentKHR(g.device, g.swapchain, g.presented, 50'000'000ull) == VK_SUCCESS) {
+ g_shownAtUs = platform::nowUs();
+ g_shownId = g.presented;
+ }
+ } else {
+ // Not pacing (for comparison): the newest frame already shown.
+ for (uint64_t id = g.presented; id > g_shownId; --id)
+ if (vkWaitForPresentKHR(g.device, g.swapchain, id, 0) == VK_SUCCESS) {
+ g_shownAtUs = platform::nowUs();
+ g_shownId = id;
+ break;
+ }
+ }
+ }
+ uint64_t t0 = platform::nowUs();
VkResult r = vkAcquireNextImageKHR(g.device, g.swapchain, wait ? UINT64_MAX : 0, g.acquired, VK_NULL_HANDLE,
&g.frameIndex);
if (r == VK_NOT_READY || r == VK_TIMEOUT) return false;
+ uint64_t waited = platform::nowUs() - t0;
+ g_acquireWaitUs += waited;
+ g_acquireWaitMaxUs = std::max(g_acquireWaitMaxUs, waited);
+ if (++g_acquires == 600) {
+ XC_LOGI("gpu: %u-image swapchain, last 600 frames waited %.2f ms on average (max %.2f) for a free image",
+ g.imageCount, g_acquireWaitUs / 600000.0, g_acquireWaitMaxUs / 1000.0);
+ g_acquires = g_acquireWaitUs = g_acquireWaitMaxUs = 0;
+ }
if (r != VK_SUCCESS && r != VK_SUBOPTIMAL_KHR) return fail("vkAcquireNextImageKHR", r);
VkCommandBufferBeginInfo begin{VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO};
begin.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
@@ -694,6 +782,11 @@ void present() {
}
g.fencePending = true;
VkPresentInfoKHR present{VK_STRUCTURE_TYPE_PRESENT_INFO_KHR};
+ uint64_t id = g.presented + 1;
+ VkPresentIdKHR presentId{VK_STRUCTURE_TYPE_PRESENT_ID_KHR};
+ presentId.swapchainCount = 1;
+ presentId.pPresentIds = &id;
+ if (g.presentWait) present.pNext = &presentId;
present.waitSemaphoreCount = 1;
present.pWaitSemaphores = &g.rendered;
present.swapchainCount = 1;
@@ -702,6 +795,7 @@ void present() {
r = vkQueuePresentKHR(g.queue, &present);
if (r != VK_SUCCESS && r != VK_SUBOPTIMAL_KHR) fail("vkQueuePresentKHR", r);
g.lastPresented = g.frameIndex;
+ g.presented = id;
}
void setOverlay(const uint32_t* pixels, int x, int y, int w, int h, uint8_t opacity) {
@@ -729,6 +823,18 @@ void setSharpness(int amount) { g_sharpness = std::clamp(amount, 0, 256); }
void setDeband(int level) { g_deband = std::clamp(level, 0, 2); }
+void setPresentWait(bool on) { g_noPresentWait = !on; }
+
+uint64_t lastPresentId() { return g.presented; }
+
+bool lastShown(uint64_t& id, uint64_t& atUs) {
+ id = g_shownId;
+ atUs = g_shownAtUs;
+ return id != 0;
+}
+
+void setSwapImages(int count) { g_swapImages = static_cast<uint32_t>(std::clamp(count, 2, 5)); }
+
bool readBack(std::vector<uint8_t>& rgb, int& width, int& height) {
if (!g.ready || g.lastPresented == UINT32_MAX) return false;
if (g.fencePending) {
diff --git a/src/display/gpu.h b/src/display/gpu.h
index 835aced..52482f8 100644
--- a/src/display/gpu.h
+++ b/src/display/gpu.h
@@ -36,6 +36,16 @@ void setOverlay(const uint32_t* pixels, int x, int y, int w, int h, uint8_t opac
void setSharpness(int amount);
// Smoothing of compression blocks in flat areas: 0 off, 1 low, 2 high.
void setDeband(int level);
+// Before init(): swapchain images (2 = lowest latency, the default).
+void setSwapImages(int count);
+// Before init(): waiting for each frame to reach the screen before the next
+// (VK_KHR_present_wait, on by default). Off, the display time is still
+// measured, by polling.
+void setPresentWait(bool on);
+// The id of the last present() (0 before any), and the last frame known to
+// be on the screen: its id and when it got there (platform::nowUs()).
+uint64_t lastPresentId();
+bool lastShown(uint64_t& id, uint64_t& atUs);
// The image last presented, 8-bit RGB rows; false when there is none.
bool readBack(std::vector<uint8_t>& rgb, int& width, int& height);
diff --git a/src/media/hw_decoder.cpp b/src/media/hw_decoder.cpp
new file mode 100644
index 0000000..7d36410
--- /dev/null
+++ b/src/media/hw_decoder.cpp
@@ -0,0 +1,216 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+// Copyright (C) 2026 RafaelNGP
+#include "media/hw_decoder.h"
+
+#include "util/log.h"
+
+#include <algorithm>
+#include <cstdlib>
+#include <cstring>
+
+extern "C" {
+int sceSysmoduleLoadModule(uint32_t id);
+size_t sceKernelGetDirectMemorySize();
+int sceKernelAllocateDirectMemory(int64_t searchStart, int64_t searchEnd, size_t length, size_t alignment,
+ int memoryType, int64_t* physicalAddress);
+int sceKernelMapDirectMemory(void** address, size_t length, int protection, int flags, int64_t physicalAddress,
+ size_t alignment);
+int sceKernelMapNamedFlexibleMemory(void** address, size_t length, int protection, int flags, const char* name);
+
+// libSceVideodec2 as the PS5 lays it out (not the PS4's: 32-bit flags, no
+// extra-config pointer), after BlackBearReloaded's ProsperoLight (GPL-3.0)
+// and its ps5-hardware-video-decoding-research.
+struct Vdec2DecoderConfig {
+ uint64_t size;
+ uint32_t resourceType, codecType, profile, maxLevel;
+ int32_t maxWidth, maxHeight, maxDpbFrames;
+ uint32_t pipelineDepth;
+ uint64_t computeQueue, cpuAffinity;
+ int32_t cpuPriority;
+ uint32_t optimizeProgressive, checkMemoryType, reserved;
+};
+struct Vdec2DecoderMemory {
+ uint64_t size, cpuSize;
+ void* cpu;
+ uint64_t gpuSize;
+ void* gpu;
+ uint64_t cpuGpuSize;
+ void* cpuGpu;
+ uint64_t maxFrameSize;
+ uint32_t frameAlignment, reserved;
+};
+struct Vdec2ComputeConfig {
+ uint64_t size;
+ uint16_t pipeId, queueId;
+ uint8_t checkMemoryType, reserved0;
+ uint16_t reserved1;
+};
+struct Vdec2ComputeMemory {
+ uint64_t size, cpuGpuSize;
+ void* cpuGpu;
+};
+struct Vdec2Input {
+ uint64_t size;
+ void* au;
+ uint64_t auSize, pts, dts, attached;
+};
+struct Vdec2Frame {
+ uint64_t size;
+ void* buffer;
+ uint64_t bufferSize;
+ uint32_t accepted, reserved;
+};
+struct Vdec2Output {
+ uint64_t size;
+ uint8_t valid, error, pictureCount, padding;
+ uint32_t codec, width, pitch, height, reserved;
+ void* buffer;
+ uint64_t bufferSize;
+ uint32_t frameFormat, pitchBytes;
+};
+
+int sceVideodec2QueryComputeMemoryInfo(Vdec2ComputeMemory* memory);
+int sceVideodec2AllocateComputeQueue(const Vdec2ComputeConfig* config, const Vdec2ComputeMemory* memory,
+ void** queue);
+int sceVideodec2ReleaseComputeQueue(void* queue);
+int sceVideodec2QueryDecoderMemoryInfo(const Vdec2DecoderConfig* config, Vdec2DecoderMemory* memory);
+int sceVideodec2CreateDecoder(const Vdec2DecoderConfig* config, const Vdec2DecoderMemory* memory, void** decoder);
+int sceVideodec2DeleteDecoder(void* decoder);
+int sceVideodec2Decode(void* decoder, Vdec2Input* input, Vdec2Frame* frame, Vdec2Output* output);
+int sceVideodec2Flush(void* decoder, Vdec2Frame* frame, Vdec2Output* output);
+}
+
+namespace xc::media {
+
+namespace {
+
+constexpr uint32_t kVideodecModule = 207;
+constexpr int kDirectType = 12; // the PS5's decoder memory type
+constexpr int kCpuGpuRw = 0x33, kGpuRwCpuWrite = 0x32;
+
+size_t align16k(size_t n) { return (n + 0x3FFF) & ~static_cast<size_t>(0x3FFF); }
+
+void* directMemory(size_t size, int protection) {
+ int64_t start = 0;
+ int rc = sceKernelAllocateDirectMemory(0, static_cast<int64_t>(sceKernelGetDirectMemorySize()), size, 0x4000,
+ kDirectType, &start);
+ void* addr = nullptr;
+ if (rc == 0) rc = sceKernelMapDirectMemory(&addr, size, protection, 0, start, 0x4000);
+ if (rc != 0) {
+ XC_LOGE("hwdec: direct memory %zu: 0x%08x", size, static_cast<unsigned>(rc));
+ return nullptr;
+ }
+ return addr;
+}
+
+} // namespace
+
+HwDecoder::~HwDecoder() {
+ // The memory stays mapped: one decoder for the app's life is the plan.
+ if (decoder_) sceVideodec2DeleteDecoder(decoder_);
+ if (computeQueue_) sceVideodec2ReleaseComputeQueue(computeQueue_);
+}
+
+bool HwDecoder::init(int maxWidth, int maxHeight) {
+ if (decoder_) return true;
+ int rc = sceSysmoduleLoadModule(kVideodecModule);
+ XC_LOGI("hwdec: sysmodule %u -> 0x%08x", kVideodecModule, static_cast<unsigned>(rc));
+ if (rc != 0) return false;
+
+ // A GPU compute queue for the decoder's own work.
+ Vdec2ComputeMemory compute{};
+ compute.size = sizeof compute;
+ rc = sceVideodec2QueryComputeMemoryInfo(&compute);
+ size_t computeSize = align16k(compute.cpuGpuSize);
+ XC_LOGI("hwdec: compute memory 0x%08x: %zu bytes", static_cast<unsigned>(rc), computeSize);
+ if (rc != 0) return false;
+ compute.cpuGpu = directMemory(computeSize, kCpuGpuRw);
+ compute.cpuGpuSize = computeSize;
+ if (!compute.cpuGpu) return false;
+ Vdec2ComputeConfig computeConfig{};
+ computeConfig.size = sizeof computeConfig;
+ rc = sceVideodec2AllocateComputeQueue(&computeConfig, &compute, &computeQueue_);
+ XC_LOGI("hwdec: compute queue 0x%08x", static_cast<unsigned>(rc));
+ if (rc != 0) return false;
+
+ // H.264 High up to level 5.1, coded 1920x1088; depth 1 for latency.
+ Vdec2DecoderConfig config{};
+ config.size = sizeof config;
+ config.resourceType = 1;
+ config.codecType = 1;
+ config.profile = 100;
+ config.maxLevel = 51;
+ config.maxWidth = maxWidth;
+ config.maxHeight = maxHeight;
+ config.maxDpbFrames = 4;
+ config.pipelineDepth = 1;
+ config.computeQueue = reinterpret_cast<uint64_t>(computeQueue_);
+ config.cpuPriority = 700;
+ config.optimizeProgressive = 1;
+ Vdec2DecoderMemory memory{};
+ memory.size = sizeof memory;
+ rc = sceVideodec2QueryDecoderMemoryInfo(&config, &memory);
+ XC_LOGI("hwdec: decoder memory 0x%08x: cpu %llu, gpu %llu, cpu+gpu %llu, frame %llu (align %u)",
+ static_cast<unsigned>(rc), static_cast<unsigned long long>(memory.cpuSize),
+ static_cast<unsigned long long>(memory.gpuSize), static_cast<unsigned long long>(memory.cpuGpuSize),
+ static_cast<unsigned long long>(memory.maxFrameSize), memory.frameAlignment);
+ if (rc != 0) return false;
+ size_t cpuSize = align16k(memory.cpuSize);
+ rc = sceKernelMapNamedFlexibleMemory(&memory.cpu, cpuSize, 0x03, 0, "PSBoxVdecCpu");
+ if (rc != 0) {
+ XC_LOGE("hwdec: flexible memory %zu: 0x%08x", cpuSize, static_cast<unsigned>(rc));
+ return false;
+ }
+ memory.gpuSize = align16k(memory.gpuSize);
+ memory.gpu = directMemory(memory.gpuSize, kGpuRwCpuWrite);
+ if (memory.cpuGpuSize) {
+ memory.cpuGpuSize = align16k(memory.cpuGpuSize);
+ memory.cpuGpu = directMemory(memory.cpuGpuSize, kCpuGpuRw);
+ }
+ // The frame the decoder writes; CPU-readable while the picture is
+ // copied from it.
+ frameBufferSize_ = align16k(memory.maxFrameSize);
+ frameBuffer_ = static_cast<uint8_t*>(directMemory(frameBufferSize_, kCpuGpuRw));
+ if (!memory.gpu || (memory.cpuGpuSize && !memory.cpuGpu) || !frameBuffer_) return false;
+ rc = sceVideodec2CreateDecoder(&config, &memory, &decoder_);
+ XC_LOGI("hwdec: create decoder 0x%08x", static_cast<unsigned>(rc));
+ if (rc != 0) decoder_ = nullptr;
+ return decoder_ != nullptr;
+}
+
+bool HwDecoder::decode(const uint8_t* data, size_t len, uint64_t pts, Picture& out) {
+ if (!decoder_) return false;
+ Vdec2Input in{sizeof(Vdec2Input), const_cast<uint8_t*>(data), len, pts, pts, 0};
+ Vdec2Frame frame{sizeof(Vdec2Frame), frameBuffer_, frameBufferSize_, 0, 0};
+ Vdec2Output info{};
+ info.size = sizeof info;
+ int rc = sceVideodec2Decode(decoder_, &in, &frame, &info);
+ // Depth 1: a picture not out yet is flushed out.
+ if (rc == 0 && !info.valid) {
+ info = Vdec2Output{};
+ info.size = sizeof info;
+ rc = sceVideodec2Flush(decoder_, &frame, &info);
+ }
+ static int logged = 0;
+ if ((rc != 0 || info.valid) && logged < 12) {
+ ++logged;
+ XC_LOGI("hwdec: decode 0x%08x: valid %u error %u pictures %u, %ux%u pitch %u (%u bytes), format %u, "
+ "%llu bytes at %s",
+ static_cast<unsigned>(rc), info.valid, info.error, info.pictureCount, info.width, info.height,
+ info.pitch, info.pitchBytes, info.frameFormat, static_cast<unsigned long long>(info.bufferSize),
+ info.buffer == frameBuffer_ ? "our buffer" : "another address");
+ }
+ if (rc != 0 || !info.valid) return false;
+ out.data = static_cast<const uint8_t*>(info.buffer);
+ out.size = info.bufferSize;
+ out.width = info.width;
+ out.height = info.height;
+ out.pitch = info.pitch;
+ out.pitchBytes = info.pitchBytes;
+ out.format = info.frameFormat;
+ out.error = info.error != 0;
+ out.pts = pts;
+ return true;
+}
+
+} // namespace xc::media
diff --git a/src/media/hw_decoder.h b/src/media/hw_decoder.h
new file mode 100644
index 0000000..0bbf23f
--- /dev/null
+++ b/src/media/hw_decoder.h
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+// Copyright (C) 2026 RafaelNGP
+// H.264 on the PS5's hardware video decoder (libSceVideodec2, the system's
+// own: RADV offers no Vulkan Video on the console). PS5 build only.
+// Setup after BlackBearReloaded's ProsperoLight (GPL-3.0-or-later).
+#pragma once
+
+#include <cstddef>
+#include <cstdint>
+
+namespace xc::media {
+
+class HwDecoder {
+public:
+ // A decoded picture, as the decoder left it in its frame buffer.
+ struct Picture {
+ const uint8_t* data = nullptr;
+ size_t size = 0;
+ uint32_t width = 0, height = 0, pitch = 0, pitchBytes = 0, format = 0;
+ uint64_t pts = 0;
+ bool error = false;
+ };
+
+ ~HwDecoder();
+ // Loads the module and makes a decoder for pictures up to the size.
+ bool init(int maxWidth, int maxHeight);
+ bool ready() const { return decoder_ != nullptr; }
+ // One access unit in; true with `out` when a picture came out.
+ bool decode(const uint8_t* data, size_t len, uint64_t pts, Picture& out);
+
+private:
+ void* decoder_ = nullptr;
+ void* computeQueue_ = nullptr;
+ uint8_t* frameBuffer_ = nullptr;
+ size_t frameBufferSize_ = 0;
+};
+
+} // namespace xc::media
diff --git a/src/ui/stream_menu.cpp b/src/ui/stream_menu.cpp
index 1b3e8e9..02c1fe9 100644
--- a/src/ui/stream_menu.cpp
+++ b/src/ui/stream_menu.cpp
@@ -146,6 +146,7 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
line(Str::StatFrameRate, frames);
line(Str::StatLoss, fmt("%.1f %%", info.lossPct));
line(Str::StatDecode, info.decodeMs > 0 ? fmt("%.1f ms", info.decodeMs) : none);
+ line(Str::StatOnScreen, info.onScreenMs > 0 ? fmt("%.1f ms", info.onScreenMs) : none);
// The controllers: numbered pads, each connected one with its user.
y += 8;
diff --git a/src/ui/stream_menu.h b/src/ui/stream_menu.h
index f75b66e..999a7cf 100644
--- a/src/ui/stream_menu.h
+++ b/src/ui/stream_menu.h
@@ -19,6 +19,7 @@ struct StreamInfo {
std::string region;
int rttMs = -1;
double fps = 0, mbps = 0, lossPct = 0, decodeMs = 0;
+ double onScreenMs = 0; // network arrival to on the TV (GPU path); 0 = unknown
int width = 0, height = 0; // of the decoded picture
};
@@ -26,7 +27,7 @@ enum class MenuAction { None, Close, Leave, Refresh, Resolution, Stats, Sharpnes
class StreamMenu {
public:
- static constexpr int kMenuW = 620, kMenuH = 1010;
+ static constexpr int kMenuW = 620, kMenuH = 1046;
static constexpr int kMenuX = 80, kMenuY = (1080 - kMenuH) / 2;
static constexpr int kStatsX = 32, kStatsY = 28;
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index df41d8e..a3b9ca3 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -146,6 +146,7 @@ constexpr Column kEnglish = {
"Controller %s connected", // PadConnected
"Controller %s disconnected", // PadDisconnected
"Block smoothing", // MenuDeband
+ "On screen after", // StatOnScreen
};
constexpr Column kPortugueseBR = {
@@ -262,6 +263,7 @@ constexpr Column kPortugueseBR = {
"Controle %s conectado",
"Controle %s desconectado",
"Suavização de blocos",
+ "Na tela após",
};
constexpr Column kSpanish = {
@@ -378,6 +380,7 @@ constexpr Column kSpanish = {
"Mando %s conectado",
"Mando %s desconectado",
"Suavizado de bloques",
+ "En pantalla tras",
};
constexpr Column kFrench = {
@@ -494,6 +497,7 @@ constexpr Column kFrench = {
"Manette %s connectée",
"Manette %s déconnectée",
"Lissage des blocs",
+ "À l'écran après",
};
constexpr Column kGerman = {
@@ -610,6 +614,7 @@ constexpr Column kGerman = {
"Controller %s verbunden",
"Controller %s getrennt",
"Blockglättung",
+ "Auf dem Bildschirm nach",
};
constexpr Column kItalian = {
@@ -726,6 +731,7 @@ constexpr Column kItalian = {
"Controller %s connesso",
"Controller %s disconnesso",
"Attenuazione blocchi",
+ "Sullo schermo dopo",
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index 202d7ce..07d59bb 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -123,6 +123,7 @@ enum class Str {
PadConnected, // "%s" = "2 (user name)"
PadDisconnected, // "%s" = "2 (user name)"
MenuDeband, // smoothing of compression blocks (deband)
+ StatOnScreen, // network arrival to on the TV
Count
};