Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

120 Hz per game: on only while that game streams, the menus stay at 60 Hz

Rafael Abud Ferreiraf801b92555b1
diff --git a/README.md b/README.md
index c175f0c..b59a0d2 100644
--- a/README.md
+++ b/README.md
@@ -106,13 +106,15 @@ tools/ps5/link.sh build-ps5 # -> build-ps5/eboot.bin
tools/ps5/package.sh build-ps5 # -> build-ps5/pkg/PPSA99810/
```
-**120 Hz output** (Settings, off by default) needs RADV with
-`tools/ps5/patches/mesa-videoout-vrr-120hz.patch`: with the console's VRR on, a
-120 Hz request becomes VRR 119.88 Hz, whose idle vblank (the TV's VRR floor,
-~48 Hz) the unpatched check takes for 60 Hz and undoes. Apply it to PS5_Mesa at
+**120 Hz output** (Settings and each game's settings, off by default; only while a
+game streams, the menus stay at 60 Hz) needs RADV with
+`tools/ps5/patches/mesa-videoout-vrr-120hz.patch` (two commits): with the console's
+VRR on, a 120 Hz request becomes VRR 119.88 Hz, whose idle vblank (the TV's VRR
+floor, ~48 Hz) the unpatched check takes for 60 Hz and undoes; and
+`wsi_videoout_set_high_refresh()` switches the open output at a stream's start and end. Apply it to PS5_Mesa at
PS5_Vulkan's pinned revision on a local branch, then
`PS5_MESA_REVISION=<that commit> tools/build-radv.sh release` in PS5_Vulkan. Without
-it the option simply stays at 59.94 Hz.
+it the option stays at 59.94 Hz (or, turned on in Settings, applies to the whole app from its next start).
A release is built, signed and checked with `tools/release.sh <X.Y.Z>`
(see the script's header); it publishes nothing. The signing key stays with
diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cpp
index 0918234..4161dd9 100644
--- a/src/app/ps5_main.cpp
+++ b/src/app/ps5_main.cpp
@@ -194,12 +194,15 @@ int main(int argc, char** argv) {
// then), and RADV asks for it when the param.json it reads says so. Off
// (the default: OLED TVs may flicker under VRR in the menus), RADV reads
// one that doesn't. Decided once per start, as RADV opens VideoOut once.
- if (!g_settings.highRefresh) {
+ // With the patched RADV the output starts at 60 Hz and each game's stream
+ // turns 120 Hz on (StreamScreen); without it, the setting decides here.
+ if (!g_settings.highRefresh || display::gpu::canSwitchRefresh()) {
std::string path = platform::dataDir() + "/videoout-60hz.json";
platform::writeFileAtomic(path, "{\"attribute3\": 0}\n");
::setenv("PS5_VIDEOOUT_PARAM_JSON", path.c_str(), 1);
}
- XC_LOGI("display: 120 Hz output %s", g_settings.highRefresh ? "on" : "off");
+ XC_LOGI("display: 120 Hz output %s", !g_settings.highRefresh ? "off"
+ : display::gpu::canSwitchRefresh() ? "in games" : "on");
if (g_autoplay.vkTest) {
bool ok = display::gpu::init();
diff --git a/src/app/settings.cpp b/src/app/settings.cpp
index 9463364..cd40698 100644
--- a/src/app/settings.cpp
+++ b/src/app/settings.cpp
@@ -84,6 +84,7 @@ bool Settings::load(const std::string& path) {
p.triggerResistance = static_cast<int>(std::clamp<int64_t>(obj["triggerResistance"].asInt(triggerResistance), 0, 3));
p.triggerPulses = obj["triggerPulses"].asBool(triggerPulses);
p.circleConfirms = obj["circleConfirms"].asBool(circleConfirms);
+ p.highRefresh = obj["highRefresh"].asBool(highRefresh);
perGame[id] = p;
}
return true;
@@ -102,6 +103,7 @@ GameProfile Settings::defaultProfile() const {
p.triggerResistance = triggerResistance;
p.triggerPulses = triggerPulses;
p.circleConfirms = circleConfirms;
+ p.highRefresh = highRefresh;
return p;
}
@@ -177,6 +179,7 @@ bool Settings::save(const std::string& path) const {
obj.set("triggerResistance", p.triggerResistance);
obj.set("triggerPulses", p.triggerPulses);
obj.set("circleConfirms", p.circleConfirms);
+ obj.set("highRefresh", p.highRefresh);
pg.set(id, obj);
}
v.set("perGame", pg);
diff --git a/src/app/settings.h b/src/app/settings.h
index 8350361..9531dc7 100644
--- a/src/app/settings.h
+++ b/src/app/settings.h
@@ -23,6 +23,8 @@ struct GameProfile {
int triggerResistance = 0; // 0 off .. 3 strong
bool triggerPulses = false;
bool circleConfirms = false;
+ // Display
+ bool highRefresh = false; // 120 Hz output (VRR) while streaming
};
// Key to identify a game profile: productId first, else titleId.
@@ -69,7 +71,7 @@ struct Settings {
int gestureHints = 0;
// Voice chat & Audio routing
bool micEnabled = true;
- bool highRefresh = false; // 119.88 Hz output (VRR where the console turns it on); read at start
+ bool highRefresh = false; // 119.88 Hz output (VRR where the console turns it on) while streaming
int micGain = 1; // 0: 50%, 1: 100%, 2: 150%
int audioRoute = 0; // 0: TV/HDMI (Main), 1: DualSense Speaker / Headset (Pad)
// The release the user said "Not now" to: not offered again on start.
diff --git a/src/app/stream_screen.cpp b/src/app/stream_screen.cpp
index 5bea351..efba40b 100644
--- a/src/app/stream_screen.cpp
+++ b/src/app/stream_screen.cpp
@@ -7,6 +7,7 @@
#include "app/ps5_app.h"
#include "app/stream_player.h"
#include "display/display.h"
+#include "display/gpu.h"
#include "media/audio_out.h"
#include "platform/platform.h"
#include "ui/strings.h"
@@ -122,6 +123,9 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
input::setTriggerFeel(prof.triggerStrength, prof.triggerHz, prof.triggerResistance, prof.triggerPulses);
input::setCircleConfirms(prof.circleConfirms);
if (g_ui) g_ui->setCircleConfirms(prof.circleConfirms);
+ // 120 Hz (VRR) for this game's stream only: the menus stay at 60 Hz
+ // (OLED TVs may flicker under VRR when little is drawn).
+ highRefresh_ = prof.highRefresh && display::gpu::setHighRefresh(true);
media::audioSetRoute(static_cast<media::AudioRoute>(g_settings.audioRoute));
if (g_player) {
@@ -189,6 +193,8 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
p.triggerResistance = g_settings.triggerResistance;
p.triggerPulses = g_settings.triggerPulses;
p.circleConfirms = circleConfirms_;
+ auto had = g_settings.perGame.find(gameKey_); // not set from this menu: kept
+ p.highRefresh = had != g_settings.perGame.end() ? had->second.highRefresh : g_settings.highRefresh;
g_settings.perGame[gameKey_] = p;
} else {
g_settings.perGame.erase(gameKey_);
@@ -409,6 +415,8 @@ void StreamScreen::idle() {
input::setTriggerFeel(g_settings.triggerStrength, g_settings.triggerHz, g_settings.triggerResistance, g_settings.triggerPulses);
input::setCircleConfirms(g_settings.circleConfirms);
if (g_ui) g_ui->setCircleConfirms(g_settings.circleConfirms);
+ if (highRefresh_) display::gpu::setHighRefresh(false);
+ highRefresh_ = false;
}
}
diff --git a/src/app/stream_screen.h b/src/app/stream_screen.h
index b794f77..2388bc5 100644
--- a/src/app/stream_screen.h
+++ b/src/app/stream_screen.h
@@ -58,6 +58,7 @@ private:
int triggerStrength_ = 2;
int deadzone_ = 15;
bool circleConfirms_ = false;
+ bool highRefresh_ = false; // 120 Hz turned on for this stream
bool wasStreaming_ = false;
uint64_t lastMenuRedrawMs_ = 0;
};
diff --git a/src/display/gpu.cpp b/src/display/gpu.cpp
index ea37435..0494c1e 100644
--- a/src/display/gpu.cpp
+++ b/src/display/gpu.cpp
@@ -30,6 +30,8 @@
// RADV is linked in whole (no loader): its ICD entry point resolves the rest.
extern "C" VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* name);
+// RADV with tools/ps5/patches (weak: absent from an unpatched RADV).
+extern "C" int wsi_videoout_set_high_refresh(bool on) __attribute__((weak));
namespace xc::display::gpu {
@@ -955,6 +957,16 @@ bool lastShown(uint64_t& id, uint64_t& atUs) {
return id != 0;
}
+bool setHighRefresh(bool on) {
+ if (!wsi_videoout_set_high_refresh) return false;
+ int rc = wsi_videoout_set_high_refresh(on);
+ if (rc == 0) XC_LOGI("gpu: output at %s Hz", on ? "119.88" : "59.94");
+ else XC_LOGW("gpu: %s Hz refused (%d)", on ? "119.88" : "59.94", rc);
+ return rc == 0;
+}
+
+bool canSwitchRefresh() { return wsi_videoout_set_high_refresh != nullptr; }
+
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) {
diff --git a/src/display/gpu.h b/src/display/gpu.h
index 63102f3..8d48191 100644
--- a/src/display/gpu.h
+++ b/src/display/gpu.h
@@ -41,6 +41,12 @@ void setDeband(int level);
void setUpscaler(int mode);
// Anime4K Restore (S) before the upscale: cleans compression artefacts.
void setRestore(bool on);
+// 119.88 Hz output on or back to 59.94 Hz while running (a game's stream
+// only); false when the driver can't (a RADV without the PSBox patch, or the
+// console refused). The swapchain stays as it is.
+bool setHighRefresh(bool on);
+// Whether setHighRefresh() can work at all (the patched RADV).
+bool canSwitchRefresh();
// 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
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index bf567b5..321ed47 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -1146,6 +1146,7 @@ void AppUi::openGameSettings() {
activeGameProfile_.triggerResistance = settings_.triggerResistance;
activeGameProfile_.triggerPulses = settings_.triggerPulses;
activeGameProfile_.circleConfirms = settings_.circleConfirms;
+ activeGameProfile_.highRefresh = settings_.highRefresh;
}
}
@@ -1831,7 +1832,7 @@ void AppUi::handleGameSettings(const NavInput& in, UiEvent& ev) {
handleTester(in);
return;
}
- int rowCount = activeGameHasCustom_ ? 9 : 8;
+ int rowCount = activeGameHasCustom_ ? 10 : 9;
if (in.up) {
gameSettingsRow_ = (gameSettingsRow_ + rowCount - 1) % rowCount;
dirty_ = true;
@@ -1891,6 +1892,11 @@ void AppUi::handleGameSettings(const NavInput& in, UiEvent& ev) {
activeGameHasCustom_ = true;
dirty_ = true;
break;
+ case 8: // 120 Hz output (VRR)
+ activeGameProfile_.highRefresh = !activeGameProfile_.highRefresh;
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
default: break;
}
}
@@ -1953,7 +1959,12 @@ void AppUi::handleGameSettings(const NavInput& in, UiEvent& ev) {
activeGameHasCustom_ = true;
dirty_ = true;
break;
- case 8: // Reset to default
+ case 8:
+ activeGameProfile_.highRefresh = !activeGameProfile_.highRefresh;
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ case 9: // Reset to default
activeGameHasCustom_ = false;
activeGameProfile_.sharpness = settings_.sharpness;
activeGameProfile_.deband = settings_.deband;
@@ -1966,6 +1977,7 @@ void AppUi::handleGameSettings(const NavInput& in, UiEvent& ev) {
activeGameProfile_.triggerResistance = settings_.triggerResistance;
activeGameProfile_.triggerPulses = settings_.triggerPulses;
activeGameProfile_.circleConfirms = settings_.circleConfirms;
+ activeGameProfile_.highRefresh = settings_.highRefresh;
gameSettingsRow_ = 0;
dirty_ = true;
break;
@@ -3610,10 +3622,10 @@ void AppUi::drawGameSettings(Canvas& c) {
title = title + " \xE2\x80\xA2 " + cut + "...";
}
}
- constexpr int kModalW = 1140, kModalH = 740;
+ constexpr int kModalW = 1140, kModalH = 800;
Rect panel = drawModal(c, kModalW, kModalH, title);
- int rowCount = activeGameHasCustom_ ? 9 : 8;
+ int rowCount = activeGameHasCustom_ ? 10 : 9;
constexpr int kRowH = 52, kGap = 8;
int y = panel.y + 110;
@@ -3625,7 +3637,7 @@ void AppUi::drawGameSettings(Canvas& c) {
int ty = fonts_.semibold.centeredY(r.y, r.h, 26);
- if (i == 8) {
+ if (i == 9) {
const char* resetLabel = tr(Str::ResetToDefault);
int tw = fonts_.semibold.measure(resetLabel, 26);
fonts_.semibold.draw(c, resetLabel, r.x + (r.w - tw) / 2, ty, 26, focused ? kWhite : rgba(240, 100, 100));
@@ -3679,6 +3691,10 @@ void AppUi::drawGameSettings(Canvas& c) {
case 7:
label = tr(Str::ConfirmButton);
break;
+ case 8:
+ label = tr(Str::HighRefresh);
+ value = tr(activeGameProfile_.highRefresh ? Str::HighRefreshOn : Str::Deactivated);
+ break;
default: break;
}
diff --git a/src/ui/app_ui.h b/src/ui/app_ui.h
index 60e212c..ce58c65 100644
--- a/src/ui/app_ui.h
+++ b/src/ui/app_ui.h
@@ -113,7 +113,7 @@ struct SettingsChoice {
int sharpness = 0;
int deband = 3;
int upscaler = 2;
- bool highRefresh = false; // 120 Hz output, from the next start
+ bool highRefresh = false; // 120 Hz output while a game streams
};
// The largest stick dead zone Settings offers, in percent of the travel.
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 6ed4a5c..dc0979a 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -263,7 +263,7 @@ constexpr Column kEnglish = {
"Estimated wait: %s s", // QueueSeconds
"Estimated wait: %s min", // QueueMinutes
"120 Hz output (VRR)", // HighRefresh
- "On (after restarting the app)", // HighRefreshOn
+ "On (in games)", // HighRefreshOn
};
constexpr Column kPortugueseBR = {
@@ -497,7 +497,7 @@ constexpr Column kPortugueseBR = {
"Espera estimada: %s s", // QueueSeconds
"Espera estimada: %s min", // QueueMinutes
"Saída 120 Hz (VRR)", // HighRefresh
- "Ativada (ao reabrir o app)", // HighRefreshOn
+ "Ativada (nos jogos)", // HighRefreshOn
};
constexpr Column kSpanish = {
@@ -731,7 +731,7 @@ constexpr Column kSpanish = {
"Espera estimada: %s s", // QueueSeconds
"Espera estimada: %s min", // QueueMinutes
"Salida 120 Hz (VRR)", // HighRefresh
- "Activada (al reabrir la app)", // HighRefreshOn
+ "Activada (en los juegos)", // HighRefreshOn
};
constexpr Column kFrench = {
@@ -965,7 +965,7 @@ constexpr Column kFrench = {
"Attente estimée : %s s", // QueueSeconds
"Attente estimée : %s min", // QueueMinutes
"Sortie 120 Hz (VRR)", // HighRefresh
- "Activée (au redémarrage de l'app)", // HighRefreshOn
+ "Activée (en jeu)", // HighRefreshOn
};
constexpr Column kGerman = {
@@ -1199,7 +1199,7 @@ constexpr Column kGerman = {
"Geschätzte Wartezeit: %s s", // QueueSeconds
"Geschätzte Wartezeit: %s Min.", // QueueMinutes
"120-Hz-Ausgabe (VRR)", // HighRefresh
- "An (nach Neustart der App)", // HighRefreshOn
+ "An (in Spielen)", // HighRefreshOn
};
constexpr Column kItalian = {
@@ -1433,7 +1433,7 @@ constexpr Column kItalian = {
"Attesa stimata: %s s", // QueueSeconds
"Attesa stimata: %s min", // QueueMinutes
"Uscita 120 Hz (VRR)", // HighRefresh
- "Attiva (al riavvio dell'app)", // HighRefreshOn
+ "Attiva (nei giochi)", // HighRefreshOn
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index 4641b24..15ad78f 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -240,7 +240,7 @@ enum class Str {
QueueSeconds, // game page, beside Play: the service's estimated wait (%s: seconds)
QueueMinutes, // ... in minutes (%s)
HighRefresh, // Settings row: 119.88 Hz output
- HighRefreshOn, // ... its "on" choice (applies when the app starts again)
+ HighRefreshOn, // ... its "on" choice (while a game streams; the menus stay at 60 Hz)
Count
};
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 11f17d2..de0020b 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -314,6 +314,7 @@ static void testPerGameSettings() {
CHECK(def.sharpness == 1 && def.deband == 2 && def.upscaler == 0);
CHECK(def.deadzoneLeft == 12 && def.deadzoneRight == 18 && def.triggerStrength == 3);
CHECK(!def.circleConfirms);
+ CHECK(!def.highRefresh); // off unless chosen
// Unknown games return default profile with hasCustom = false.
bool hasCustom = true;
@@ -330,6 +331,7 @@ static void testPerGameSettings() {
p1.deadzoneRight = 8;
p1.triggerStrength = 1;
p1.circleConfirms = true;
+ p1.highRefresh = true;
s.perGame["GAME1"] = p1;
// Now GAME1 returns custom profile, while GAME2 still returns defaults.
@@ -357,6 +359,7 @@ static void testPerGameSettings() {
auto loadedP1 = reloaded.profileForGame("GAME1", "", &hasCustom);
CHECK(hasCustom);
CHECK(loadedP1.sharpness == 3 && loadedP1.upscaler == 3 && loadedP1.circleConfirms);
+ CHECK(loadedP1.highRefresh);
CHECK(loadedP1.deadzoneLeft == 5 && loadedP1.deadzoneRight == 8 && loadedP1.triggerStrength == 1);
// Remove game profile restores default.
diff --git a/tools/ps5/patches/mesa-videoout-vrr-120hz.patch b/tools/ps5/patches/mesa-videoout-vrr-120hz.patch
index 7cf1388..e4ca75b 100644
--- a/tools/ps5/patches/mesa-videoout-vrr-120hz.patch
+++ b/tools/ps5/patches/mesa-videoout-vrr-120hz.patch
@@ -1,8 +1,8 @@
From e1f8e11d8ccc80f91bd5a1f575b64aebe3b9acc3 Mon Sep 17 00:00:00 2001
From: Rafael Abud Ferreira <[email protected]>
Date: Thu, 15 Oct 2026 11:59:25 -0300
-Subject: [PATCH] wsi/videoout: a VRR 119.88 Hz output counts (its idle vblank
- is the VRR floor)
+Subject: [PATCH 1/2] wsi/videoout: a VRR 119.88 Hz output counts (its idle
+ vblank is the VRR floor)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
@@ -41,3 +41,64 @@ index 1f59ac2120e..2d6558e62e3 100644
--
2.55.0
+
+From 993732cba5e66cf375619e74ad6105f8ba0b9d96 Mon Sep 17 00:00:00 2001
+From: Rafael Abud Ferreira <[email protected]>
+Date: Thu, 15 Oct 2026 12:38:29 -0300
+Subject: [PATCH 2/2] wsi/videoout: wsi_videoout_set_high_refresh, 119.88 Hz on
+ and off while the title runs
+
+Co-Authored-By: Claude Opus 5.5 <[email protected]>
+---
+ src/vulkan/wsi/wsi_common_videoout.c | 35 ++++++++++++++++++++++++++++
+ 1 file changed, 35 insertions(+)
+
+diff --git a/src/vulkan/wsi/wsi_common_videoout.c b/src/vulkan/wsi/wsi_common_videoout.c
+index 2d6558e62e3..46b83735269 100644
+--- a/src/vulkan/wsi/wsi_common_videoout.c
++++ b/src/vulkan/wsi/wsi_common_videoout.c
+@@ -441,6 +441,41 @@ wsi_videoout_set_flip_rate(int rate)
+ return result;
+ }
+
++PUBLIC int wsi_videoout_set_high_refresh(bool on);
++
++/* 119.88 Hz on the open output, or back to its default, while the title runs
++ * (a title that turns it on for some screens only). The title's param.json
++ * must declare it for the console to grant the mode. The swapchain stays as
++ * it was made; with the console's VRR on the display follows the flips.
++ * Returns VideoOut's answer: 0 done, -1 before the output is open, else the
++ * refusal (sceVideoOutIsOutputSupported's or ConfigureOutput's). */
++PUBLIC int
++wsi_videoout_set_high_refresh(bool on)
++{
++ call_once(&videoout_once, videoout_output_init_once);
++ mtx_lock(&videoout_output.lock);
++ struct wsi_videoout_output *out = &videoout_output;
++ int result = -1;
++ if (out->handle >= 0) {
++ if (on == out->high_frame_rate) {
++ result = 0;
++ } else if (on) {
++ const int supported =
++ sceVideoOutIsOutputSupported(out->handle, PS5_VIDEO_OUT_MODE_HIGH_FRAME_RATE, NULL, NULL, NULL);
++ result = supported > 0
++ ? sceVideoOutConfigureOutput(out->handle, PS5_VIDEO_OUT_MODE_HIGH_FRAME_RATE, NULL, NULL, NULL)
++ : (supported == 0 ? -2 : supported);
++ out->high_frame_rate = result == 0;
++ } else {
++ result = sceVideoOutConfigureOutput(out->handle, PS5_VIDEO_OUT_MODE_RESTORE, NULL, NULL, NULL);
++ if (result == 0)
++ out->high_frame_rate = false;
++ }
++ }
++ mtx_unlock(&videoout_output.lock);
++ return result;
++}
++
+ static void
+ videoout_settle_modes(void)
+ {
+--
+2.55.0
+