Remove per-app HDR support check

It doesn't seem to make a difference anymore whether it's supported or not.
GFE seems happy to enter HDR mode anyway.
This commit is contained in:
Cameron Gutman 2022-02-07 20:23:11 -06:00
parent 079eca7b4d
commit 8b692269c1

View File

@ -275,7 +275,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
String uniqueId = Game.this.getIntent().getStringExtra(EXTRA_UNIQUEID); String uniqueId = Game.this.getIntent().getStringExtra(EXTRA_UNIQUEID);
String uuid = Game.this.getIntent().getStringExtra(EXTRA_PC_UUID); String uuid = Game.this.getIntent().getStringExtra(EXTRA_PC_UUID);
String pcName = Game.this.getIntent().getStringExtra(EXTRA_PC_NAME); String pcName = Game.this.getIntent().getStringExtra(EXTRA_PC_NAME);
boolean willStreamHdr = Game.this.getIntent().getBooleanExtra(EXTRA_APP_HDR, false); boolean appSupportsHdr = Game.this.getIntent().getBooleanExtra(EXTRA_APP_HDR, false);
byte[] derCertData = Game.this.getIntent().getByteArrayExtra(EXTRA_SERVER_CERT); byte[] derCertData = Game.this.getIntent().getByteArrayExtra(EXTRA_SERVER_CERT);
X509Certificate serverCert = null; X509Certificate serverCert = null;
@ -301,7 +301,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
shortcutHelper.reportComputerShortcutUsed(computer); shortcutHelper.reportComputerShortcutUsed(computer);
if (appName != null) { if (appName != null) {
// This may be null if launched from the "Resume Session" PC context menu item // This may be null if launched from the "Resume Session" PC context menu item
shortcutHelper.reportGameLaunched(computer, new NvApp(appName, appId, willStreamHdr)); shortcutHelper.reportGameLaunched(computer, new NvApp(appName, appId, appSupportsHdr));
} }
// Initialize the MediaCodec helper before creating the decoder // Initialize the MediaCodec helper before creating the decoder
@ -309,42 +309,33 @@ public class Game extends Activity implements SurfaceHolder.Callback,
MediaCodecHelper.initialize(this, glPrefs.glRenderer); MediaCodecHelper.initialize(this, glPrefs.glRenderer);
// Check if the user has enabled HDR // Check if the user has enabled HDR
boolean willStreamHdr = false;
if (prefConfig.enableHdr) { if (prefConfig.enableHdr) {
// Check if the app supports it // Start our HDR checklist
if (!willStreamHdr) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Toast.makeText(this, "This game does not support HDR10", Toast.LENGTH_SHORT).show();
}
// It does, so start our HDR checklist
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// We already know the app supports HDR if willStreamHdr is set.
Display display = getWindowManager().getDefaultDisplay(); Display display = getWindowManager().getDefaultDisplay();
Display.HdrCapabilities hdrCaps = display.getHdrCapabilities(); Display.HdrCapabilities hdrCaps = display.getHdrCapabilities();
// We must now ensure our display is compatible with HDR10 // We must now ensure our display is compatible with HDR10
boolean foundHdr10 = false;
if (hdrCaps != null) { if (hdrCaps != null) {
// getHdrCapabilities() returns null on Lenovo Lenovo Mirage Solo (vega), Android 8.0 // getHdrCapabilities() returns null on Lenovo Lenovo Mirage Solo (vega), Android 8.0
for (int hdrType : hdrCaps.getSupportedHdrTypes()) { for (int hdrType : hdrCaps.getSupportedHdrTypes()) {
if (hdrType == Display.HdrCapabilities.HDR_TYPE_HDR10) { if (hdrType == Display.HdrCapabilities.HDR_TYPE_HDR10) {
foundHdr10 = true; willStreamHdr = true;
break;
} }
} }
} }
if (!foundHdr10) { if (!willStreamHdr) {
// Nope, no HDR for us :( // Nope, no HDR for us :(
willStreamHdr = false;
Toast.makeText(this, "Display does not support HDR10", Toast.LENGTH_LONG).show(); Toast.makeText(this, "Display does not support HDR10", Toast.LENGTH_LONG).show();
} }
} }
else { else {
Toast.makeText(this, "HDR requires Android 7.0 or later", Toast.LENGTH_LONG).show(); Toast.makeText(this, "HDR requires Android 7.0 or later", Toast.LENGTH_LONG).show();
willStreamHdr = false;
} }
} }
else {
willStreamHdr = false;
}
// Check if the user has enabled performance stats overlay // Check if the user has enabled performance stats overlay
if (prefConfig.enablePerfOverlay) { if (prefConfig.enablePerfOverlay) {
@ -459,7 +450,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
.setResolution(prefConfig.width, prefConfig.height) .setResolution(prefConfig.width, prefConfig.height)
.setLaunchRefreshRate(prefConfig.fps) .setLaunchRefreshRate(prefConfig.fps)
.setRefreshRate(chosenFrameRate) .setRefreshRate(chosenFrameRate)
.setApp(new NvApp(appName != null ? appName : "app", appId, willStreamHdr)) .setApp(new NvApp(appName != null ? appName : "app", appId, appSupportsHdr))
.setBitrate(prefConfig.bitrate) .setBitrate(prefConfig.bitrate)
.setEnableSops(prefConfig.enableSops) .setEnableSops(prefConfig.enableSops)
.enableLocalAudioPlayback(prefConfig.playHostAudio) .enableLocalAudioPlayback(prefConfig.playHostAudio)