Merge pull request #11448 from hrydgard/android-tv-disable-hwscale

Disable Android HW scale on TV type devices.
This commit is contained in:
Unknown W. Brackets 2018-10-06 09:05:16 -07:00 committed by GitHub
commit 5f357984d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 8 deletions

View File

@ -510,7 +510,7 @@ static bool DefaultTimerHack() {
static int DefaultAndroidHwScale() { static int DefaultAndroidHwScale() {
#ifdef __ANDROID__ #ifdef __ANDROID__
if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 19) { if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 19 || System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_TV) {
// Arbitrary cutoff at Kitkat - modern devices are usually powerful enough that hw scaling // Arbitrary cutoff at Kitkat - modern devices are usually powerful enough that hw scaling
// doesn't really help very much and mostly causes problems. See #11151 // doesn't really help very much and mostly causes problems. See #11151
return 0; return 0;

View File

@ -330,13 +330,15 @@ void GameSettingsScreen::CreateViews() {
resolutionChoice_->SetEnabledPtr(&resolutionEnable_); resolutionChoice_->SetEnabledPtr(&resolutionEnable_);
#ifdef __ANDROID__ #ifdef __ANDROID__
static const char *deviceResolutions[] = { "Native device resolution", "Auto (same as Rendering)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" }; if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) != DEVICE_TYPE_TV) {
int max_res_temp = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)) / 480 + 2; static const char *deviceResolutions[] = { "Native device resolution", "Auto (same as Rendering)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" };
if (max_res_temp == 3) int max_res_temp = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)) / 480 + 2;
max_res_temp = 4; // At least allow 2x if (max_res_temp == 3)
int max_res = std::min(max_res_temp, (int)ARRAY_SIZE(deviceResolutions)); max_res_temp = 4; // At least allow 2x
UI::PopupMultiChoice *hwscale = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAndroidHwScale, gr->T("Display Resolution (HW scaler)"), deviceResolutions, 0, max_res, gr->GetName(), screenManager())); int max_res = std::min(max_res_temp, (int)ARRAY_SIZE(deviceResolutions));
hwscale->OnChoice.Handle(this, &GameSettingsScreen::OnHwScaleChange); // To refresh the display mode UI::PopupMultiChoice *hwscale = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAndroidHwScale, gr->T("Display Resolution (HW scaler)"), deviceResolutions, 0, max_res, gr->GetName(), screenManager()));
hwscale->OnChoice.Handle(this, &GameSettingsScreen::OnHwScaleChange); // To refresh the display mode
}
#endif #endif
#ifdef _WIN32 #ifdef _WIN32

View File

@ -224,6 +224,10 @@ std::string NativeQueryConfig(std::string query) {
return std::string(g_Config.bImmersiveMode ? "1" : "0"); return std::string(g_Config.bImmersiveMode ? "1" : "0");
} else if (query == "hwScale") { } else if (query == "hwScale") {
int scale = g_Config.iAndroidHwScale; int scale = g_Config.iAndroidHwScale;
// Override hw scale for TV type devices.
if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_TV)
scale = 0;
if (scale == 1) { if (scale == 1) {
// If g_Config.iInternalResolution is also set to Auto (1), we fall back to "Device resolution" (0). It works out. // If g_Config.iInternalResolution is also set to Auto (1), we fall back to "Device resolution" (0). It works out.
scale = g_Config.iInternalResolution; scale = g_Config.iInternalResolution;