System: Add "Disable Mailbox Presentation" option

Partial backport of https://github.com/PCSX2/pcsx2/pull/11296
This commit is contained in:
Stenzek 2024-05-26 22:30:34 +10:00
parent 83df785558
commit 55d96f86f0
No known key found for this signature in database
7 changed files with 49 additions and 18 deletions

View file

@ -4283,6 +4283,12 @@ void FullscreenUI::DrawDisplaySettingsPage()
break;
}
DrawToggleSetting(
bsi, FSUI_CSTR("Disable Mailbox Presentation"),
FSUI_CSTR("Forces the use of FIFO over Mailbox presentation, i.e. double buffering instead of triple buffering. "
"Usually results in worse frame pacing."),
"Display", "DisableMailboxPresentation", false);
if (renderer != GPURenderer::Software)
{
DrawToggleSetting(
@ -7296,13 +7302,13 @@ TRANSLATE_NOOP("FullscreenUI", "Determines which algorithm is used to convert in
TRANSLATE_NOOP("FullscreenUI", "Device Settings");
TRANSLATE_NOOP("FullscreenUI", "Disable All Enhancements");
TRANSLATE_NOOP("FullscreenUI", "Disable Interlacing");
TRANSLATE_NOOP("FullscreenUI", "Disable Mailbox Presentation");
TRANSLATE_NOOP("FullscreenUI", "Disable Subdirectory Scanning");
TRANSLATE_NOOP("FullscreenUI", "Disabled");
TRANSLATE_NOOP("FullscreenUI", "Disables dithering and uses the full 8 bits per channel of color information.");
TRANSLATE_NOOP("FullscreenUI", "Disables interlaced rendering and display in the GPU. Some games can render in 480p this way, but others will break.");
TRANSLATE_NOOP("FullscreenUI", "Disc {} | {}");
TRANSLATE_NOOP("FullscreenUI", "Discord Server");
TRANSLATE_NOOP("FullscreenUI", "Display FPS Limit");
TRANSLATE_NOOP("FullscreenUI", "Display Settings");
TRANSLATE_NOOP("FullscreenUI", "Displays popup messages on events such as achievement unlocks and leaderboard submissions.");
TRANSLATE_NOOP("FullscreenUI", "Displays popup messages when starting, submitting, or failing a leaderboard challenge.");
@ -7371,6 +7377,7 @@ TRANSLATE_NOOP("FullscreenUI", "Force 4:3 For 24-Bit Display");
TRANSLATE_NOOP("FullscreenUI", "Force NTSC Timings");
TRANSLATE_NOOP("FullscreenUI", "Forces PAL games to run at NTSC timings, i.e. 60hz. Some PAL games will run at their \"normal\" speeds, while others will break.");
TRANSLATE_NOOP("FullscreenUI", "Forces a full rescan of all games previously identified.");
TRANSLATE_NOOP("FullscreenUI", "Forces the use of FIFO over Mailbox presentation, i.e. double buffering instead of triple buffering. Usually results in worse frame pacing.");
TRANSLATE_NOOP("FullscreenUI", "Forcibly mutes both CD-DA and XA audio from the CD-ROM. Can be used to disable background music in some games.");
TRANSLATE_NOOP("FullscreenUI", "Frame Time Buffer");
TRANSLATE_NOOP("FullscreenUI", "From File...");
@ -7429,7 +7436,6 @@ TRANSLATE_NOOP("FullscreenUI", "Launch a game from images scanned from your game
TRANSLATE_NOOP("FullscreenUI", "Leaderboard Notifications");
TRANSLATE_NOOP("FullscreenUI", "Leaderboards");
TRANSLATE_NOOP("FullscreenUI", "Leaderboards are not enabled.");
TRANSLATE_NOOP("FullscreenUI", "Limits how many frames are displayed to the screen. These frames are still rendered.");
TRANSLATE_NOOP("FullscreenUI", "Line Detection");
TRANSLATE_NOOP("FullscreenUI", "List Settings");
TRANSLATE_NOOP("FullscreenUI", "Load Devices From Save States");

View file

@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once

View file

@ -277,6 +277,7 @@ void Settings::Load(SettingsInterface& si)
si.GetFloatValue("Display", "PreFrameSleepBuffer", DEFAULT_DISPLAY_PRE_FRAME_SLEEP_BUFFER);
display_skip_presenting_duplicate_frames = si.GetBoolValue("Display", "SkipPresentingDuplicateFrames", false);
display_vsync = si.GetBoolValue("Display", "VSync", false);
display_disable_mailbox_presentation = si.GetBoolValue("Display", "DisableMailboxPresentation", false);
display_force_4_3_for_24bit = si.GetBoolValue("Display", "Force4_3For24Bit", false);
display_active_start_offset = static_cast<s16>(si.GetIntValue("Display", "ActiveStartOffset", 0));
display_active_end_offset = static_cast<s16>(si.GetIntValue("Display", "ActiveEndOffset", 0));
@ -529,6 +530,7 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const
si.SetBoolValue("Display", "SkipPresentingDuplicateFrames", display_skip_presenting_duplicate_frames);
si.SetFloatValue("Display", "PreFrameSleepBuffer", display_pre_frame_sleep_buffer);
si.SetBoolValue("Display", "VSync", display_vsync);
si.SetBoolValue("Display", "DisableMailboxPresentation", display_disable_mailbox_presentation);
si.SetStringValue("Display", "ExclusiveFullscreenControl",
GetDisplayExclusiveFullscreenControlName(display_exclusive_fullscreen_control));
si.SetStringValue("Display", "ScreenshotMode", GetDisplayScreenshotModeName(display_screenshot_mode));

View file

@ -152,6 +152,7 @@ struct Settings
bool display_pre_frame_sleep : 1 = false;
bool display_skip_presenting_duplicate_frames : 1 = false;
bool display_vsync : 1 = false;
bool display_disable_mailbox_presentation : 1 = true;
bool display_force_4_3_for_24bit : 1 = false;
bool gpu_24bit_chroma_smoothing : 1 = false;
bool display_show_osd_messages : 1 = true;

View file

@ -2962,8 +2962,11 @@ GPUVSyncMode System::GetEffectiveVSyncMode()
// If there's no VM, or we're using vsync for timing, then we always use double-buffered (blocking).
// Try to keep the same present mode whether we're running or not, since it'll avoid flicker.
const bool valid_vm = (s_state != State::Shutdown && s_state != State::Stopping);
if (s_can_sync_to_host || (!valid_vm && g_settings.sync_to_host_refresh_rate))
if (s_can_sync_to_host || (!valid_vm && g_settings.sync_to_host_refresh_rate) ||
g_settings.display_disable_mailbox_presentation)
{
return GPUVSyncMode::FIFO;
}
// For PAL games, we always want to triple buffer, because otherwise we'll be tearing.
// Or for when we aren't using sync-to-host-refresh, to avoid dropping frames.
@ -4054,6 +4057,7 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
g_settings.display_pre_frame_sleep != old_settings.display_pre_frame_sleep ||
g_settings.display_pre_frame_sleep_buffer != old_settings.display_pre_frame_sleep_buffer ||
g_settings.display_vsync != old_settings.display_vsync ||
g_settings.display_disable_mailbox_presentation != old_settings.display_disable_mailbox_presentation ||
g_settings.sync_to_host_refresh_rate != old_settings.sync_to_host_refresh_rate)
{
UpdateSpeedLimiterState();
@ -4073,8 +4077,11 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
{
if (g_gpu_device)
{
if (g_settings.display_vsync != old_settings.display_vsync)
if (g_settings.display_vsync != old_settings.display_vsync ||
g_settings.display_disable_mailbox_presentation != old_settings.display_disable_mailbox_presentation)
{
UpdateDisplayVSync();
}
}
}

View file

@ -124,7 +124,10 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
&Settings::ParseDisplayAlignment, &Settings::GetDisplayAlignmentName,
Settings::DEFAULT_DISPLAY_ALIGNMENT);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.gpuThread, "GPU", "UseThread", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.threadedPresentation, "GPU", "ThreadedPresentation", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.threadedPresentation, "GPU", "ThreadedPresentation",
Settings::DEFAULT_THREADED_PRESENTATION);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.disableMailboxPresentation, "Display",
"DisableMailboxPresentation", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.stretchDisplayVertically, "Display", "StretchVertically",
false);
#ifdef _WIN32
@ -334,6 +337,10 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
dialog->registerWidgetHelp(m_ui.threadedPresentation, tr("Threaded Presentation"), tr("Checked"),
tr("Presents frames on a background thread when fast forwarding or vsync is disabled. "
"This can measurably improve performance in the Vulkan renderer."));
dialog->registerWidgetHelp(
m_ui.disableMailboxPresentation, tr("Disable Mailbox Presentation"), tr("Unchecked"),
tr("Forces the use of FIFO over Mailbox presentation, i.e. double buffering instead of triple buffering. "
"Usually results in worse frame pacing."));
dialog->registerWidgetHelp(
m_ui.stretchDisplayVertically, tr("Stretch Vertically"), tr("Unchecked"),
tr("Prefers stretching the display vertically instead of horizontally, when applying the display aspect ratio."));

View file

@ -417,31 +417,31 @@
</item>
<item row="2" column="0" colspan="2">
<layout class="QGridLayout" name="advancedDisplayOptionsLayout">
<item row="1" column="1">
<widget class="QCheckBox" name="blitSwapChain">
<item row="0" column="1">
<widget class="QCheckBox" name="threadedPresentation">
<property name="text">
<string>Use Blit Swap Chain</string>
<string>Threaded Presentation</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="stretchDisplayVertically">
<item row="0" column="0">
<widget class="QCheckBox" name="blitSwapChain">
<property name="text">
<string>Stretch Vertically</string>
<string>Use Blit Swap Chain</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="threadedPresentation">
<item row="1" column="1">
<widget class="QCheckBox" name="stretchDisplayVertically">
<property name="text">
<string>Threaded Presentation</string>
<string>Stretch Vertically</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="gpuThread">
<item row="1" column="0">
<widget class="QCheckBox" name="disableMailboxPresentation">
<property name="text">
<string>Threaded Rendering</string>
<string>Disable Mailbox Presentation</string>
</property>
</widget>
</item>
@ -482,13 +482,20 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="1" column="1">
<widget class="QCheckBox" name="useSoftwareRendererForReadbacks">
<property name="text">
<string>Software Renderer Readbacks</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="gpuThread">
<property name="text">
<string>Threaded Rendering</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">