mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
session: the Steam client's display caps at 720p by default (desktop stays 1080); a chosen cap still wins
This commit is contained in:
1 parent
5d8fadec65
commit
d1ced8706f
4 files changed
+20
-12
No files matched your search
@@ -397,9 +397,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
// compositor letterboxes onto a squarer panel.
|
||||
val aspect = if (SessionPrefs.shapeMode(this) == SessionPrefs.SHAPE_WIDE) 16f / 9f
|
||||
else maxOf(panelW / panelH, 16f / 9f)
|
||||
// 1080 tall at most by default: the client's CEF is the heaviest thing in the session, and
|
||||
// above 1080p it costs frames for nothing anyone can see on a handheld panel. The mode's
|
||||
// settings (the cog beside Play / Desktop) can lower the cap or lift it to the panel.
|
||||
// Capped by default - 720 tall for the client, 1080 for the desktop: the client's CEF is the
|
||||
// heaviest thing in the session, and pixels above that cost frames for nothing anyone can
|
||||
// see on a handheld panel. The mode's settings (the cog beside Play / Desktop) can change
|
||||
// the cap or lift it to the panel.
|
||||
val mode = SessionPrefs.prefMode(intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM)
|
||||
val cap = SessionPrefs.resolutionCap(this, mode)
|
||||
val height = (if (cap <= 0) panelH else minOf(panelH, cap.toFloat())).toInt()
|
||||
|
||||
@@ -186,11 +186,16 @@ object SessionPrefs {
|
||||
|
||||
/**
|
||||
* The tallest the session's display may be, in pixels, for MODE_STEAM / MODE_DESKTOP:
|
||||
* 0 = the panel's own height, otherwise a cap. 1080 is the default the app always had - the
|
||||
* client's CEF is the heaviest thing in a session and above 1080p it costs frames for nothing
|
||||
* a handheld panel can show. Read once, when the session's display is sized.
|
||||
* 0 = the panel's own height, otherwise a cap. The Steam client defaults to 720p: its CEF is
|
||||
* the heaviest thing in a session, Big Picture is drawn for a TV at arm's length, and on a
|
||||
* handheld panel 720p is where its menus stay responsive on a regular flagship. The desktop
|
||||
* keeps 1080 (text and file windows want the pixels). Read once, when the session's display
|
||||
* is sized; a cap the user chose wins over either default.
|
||||
*/
|
||||
fun resolutionCap(context: Context, mode: String): Int = prefs(context).getInt("resolutionCap.$mode", 1080)
|
||||
fun resolutionCap(context: Context, mode: String): Int = prefs(context).getInt("resolutionCap.$mode", defaultResolutionCap(mode))
|
||||
|
||||
/** What a mode gets when nothing was chosen: 720 for the client, 1080 for the desktop. */
|
||||
fun defaultResolutionCap(mode: String): Int = if (prefMode(mode) == SessionService.MODE_STEAM) 720 else 1080
|
||||
|
||||
fun setResolutionCap(context: Context, mode: String, cap: Int) {
|
||||
prefs(context).edit().putInt("resolutionCap.$mode", cap).apply()
|
||||
|
||||
@@ -37,6 +37,7 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.steamdeck.launcher.session.SessionPrefs
|
||||
import com.steamdeck.launcher.session.SessionService
|
||||
|
||||
/** One driver as the dialog shows it. [removable] is false for the runtime's own and the bundled builds. */
|
||||
@@ -169,13 +170,14 @@ fun ModeSettingsDialog(s: ModeSettings, a: ModeSettingsActions) {
|
||||
"display" -> {
|
||||
Section("Display", "Takes effect at the next session: gamescope sizes its display once, when it starts.")
|
||||
Text("Resolution", style = MaterialTheme.typography.labelLarge, modifier = Modifier.padding(top = 8.dp))
|
||||
val default = SessionPrefs.defaultResolutionCap(s.mode)
|
||||
listOf(
|
||||
1080 to "Up to 1080p — the default",
|
||||
1080 to "Up to 1080p",
|
||||
900 to "Up to 900p",
|
||||
720 to "Up to 720p — lighter on the GPU",
|
||||
720 to "Up to 720p — lighter on the GPU, menus stay responsive",
|
||||
0 to "The panel's own — above 1080p costs frames for nothing a handheld can show",
|
||||
).forEach { (cap, label) ->
|
||||
Choice(label, s.resolutionCap == cap) { a.onResolution(cap) }
|
||||
Choice(if (cap == default) "$label — the default" else label, s.resolutionCap == cap) { a.onResolution(cap) }
|
||||
}
|
||||
Text("Shape", style = MaterialTheme.typography.labelLarge, modifier = Modifier.padding(top = 10.dp))
|
||||
Choice("The panel's shape (never narrower than 16:9)", s.shapeMode == "auto") { a.onShape("auto") }
|
||||
|
||||
Reference in new issue
Block a user