From 7f0f5f844925b2c58b85815b5c65423b36d2dfb7 Mon Sep 17 00:00:00 2001 From: Vishwas Shashidhar Date: Tue, 23 Jan 2018 16:38:44 +0530 Subject: [PATCH 1/4] electron-261: add gpu switches for windows environments to ensure screen-sharing doesn't break with multiple monitors, we add flags to disable gpu --- js/main.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 8a93340a..cb5970b2 100644 --- a/js/main.js +++ b/js/main.js @@ -13,7 +13,7 @@ const urlParser = require('url'); // Local Dependencies const {getConfigField, updateUserConfigWin, updateUserConfigMac, readConfigFileSync} = require('./config.js'); const {setCheckboxValues} = require('./menus/menuTemplate.js'); -const { isMac, isDevEnv } = require('./utils/misc.js'); +const { isMac, isDevEnv, isWindowsOS } = require('./utils/misc.js'); const protocolHandler = require('./protocolHandler'); const getCmdLineArg = require('./utils/getCmdLineArg.js'); const log = require('./log.js'); @@ -22,6 +22,15 @@ const { deleteIndexFolder } = require('./search/search.js'); require('electron-dl')(); +// ELECTRON-261: On Windows, due to gpu issues, we need to disable gpu +// to ensure screen sharing works effectively with multiple monitors +// https://github.com/electron/electron/issues/4380 +if (isWindowsOS) { + app.commandLine.appendSwitch("disable-gpu", true); + app.commandLine.appendSwitch("disable-gpu-compositing", true); + app.commandLine.appendSwitch("disable-d3d11", true); +} + //setting the env path child_process issue https://github.com/electron/electron/issues/7688 shellPath() .then((path) => { From d3b95f70e9354e25c24413be2e00c14fbe4a4f34 Mon Sep 17 00:00:00 2001 From: Vishwas Shashidhar Date: Thu, 25 Jan 2018 22:59:25 +0530 Subject: [PATCH 2/4] ELECTRON-261: add logic to get gpu related flags from config file --- config/Symphony.config | 7 +++++-- js/main.js | 43 ++++++++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/config/Symphony.config b/config/Symphony.config index fe86d00c..5c36d2bb 100644 --- a/config/Symphony.config +++ b/config/Symphony.config @@ -16,6 +16,9 @@ }, "customFlags": { "authServerWhitelist": "", - "authNegotiateDelegateWhitelist": "" + "authNegotiateDelegateWhitelist": "", + "disableGpu": false, + "disableGpuCompositing": false, + "disableD3d11": false } -} \ No newline at end of file +} diff --git a/js/main.js b/js/main.js index cb5970b2..b5d05177 100644 --- a/js/main.js +++ b/js/main.js @@ -25,11 +25,6 @@ require('electron-dl')(); // ELECTRON-261: On Windows, due to gpu issues, we need to disable gpu // to ensure screen sharing works effectively with multiple monitors // https://github.com/electron/electron/issues/4380 -if (isWindowsOS) { - app.commandLine.appendSwitch("disable-gpu", true); - app.commandLine.appendSwitch("disable-gpu-compositing", true); - app.commandLine.appendSwitch("disable-d3d11", true); -} //setting the env path child_process issue https://github.com/electron/electron/issues/7688 shellPath() @@ -118,29 +113,45 @@ if (isMac) { * Sets chrome authentication flags in electron */ function setChromeFlags() { - + log.send(logLevels.INFO, 'checking if we need to set custom chrome flags!'); - + // Read the config parameters synchronously let config = readConfigFileSync(); - + // If we cannot find any config, just skip setting any flags if (config && config !== null && config.customFlags) { - + log.send(logLevels.INFO, 'Chrome flags config found!'); - - // If we cannot find the authServerWhitelist config, move on + if (config.customFlags.authServerWhitelist && config.customFlags.authServerWhitelist !== "") { log.send(logLevels.INFO, 'Setting auth server whitelist flag'); app.commandLine.appendSwitch('auth-server-whitelist', config.customFlags.authServerWhitelist); } - - // If we cannot find the authNegotiateDelegateWhitelist config, move on + if (config.customFlags.authNegotiateDelegateWhitelist && config.customFlags.authNegotiateDelegateWhitelist !== "") { log.send(logLevels.INFO, 'Setting auth negotiate delegate whitelist flag'); app.commandLine.appendSwitch('auth-negotiate-delegate-whitelist', config.customFlags.authNegotiateDelegateWhitelist); } - + + // ELECTRON-261: Windows 10 Screensharing issues. We set chrome flags + // to disable gpu which fixes the black screen issue observed on + // multiple monitors + if (config.customFlags.disableGpu) { + log.send(logLevels.INFO, 'Setting disable gpu flag'); + app.commandLine.appendSwitch("disable-gpu", true); + } + + if (config.customFlags.disableGpuCompositing) { + log.send(logLevels.INFO, 'Setting disable gpu compositing flag'); + app.commandLine.appendSwitch("disable-gpu-compositing", true); + } + + if (config.customFlags.disableD3d11) { + log.send(logLevels.INFO, 'Setting disable d3d11 flag'); + app.commandLine.appendSwitch("disable-d3d11", true); + } + } } @@ -221,7 +232,7 @@ function setupThenOpenMainWindow() { let hasInstallFlag = getCmdLineArg(process.argv, '--install', true); let perUserInstall = getCmdLineArg(process.argv, '--peruser', true); let customDataArg = getCmdLineArg(process.argv, '--userDataPath=', false); - + if (customDataArg && customDataArg.split('=').length > 1) { let customDataFolder = customDataArg.split('=')[1]; app.setPath('userData', customDataFolder); @@ -352,4 +363,4 @@ function handleProtocolAction(uri) { // app is already open, so, just trigger the protocol action method protocolHandler.processProtocolAction(uri); } -} \ No newline at end of file +} From bbc2228365b9b6a5430d26ee47a96be319b1fed1 Mon Sep 17 00:00:00 2001 From: Vishwas Shashidhar Date: Sat, 27 Jan 2018 16:26:49 +0530 Subject: [PATCH 3/4] ELECTRON-261: remove unused import --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index b5d05177..69b1754b 100644 --- a/js/main.js +++ b/js/main.js @@ -13,7 +13,7 @@ const urlParser = require('url'); // Local Dependencies const {getConfigField, updateUserConfigWin, updateUserConfigMac, readConfigFileSync} = require('./config.js'); const {setCheckboxValues} = require('./menus/menuTemplate.js'); -const { isMac, isDevEnv, isWindowsOS } = require('./utils/misc.js'); +const { isMac, isDevEnv } = require('./utils/misc.js'); const protocolHandler = require('./protocolHandler'); const getCmdLineArg = require('./utils/getCmdLineArg.js'); const log = require('./log.js'); From 3c4ae0615e1937c2d63e29882e254702759d106f Mon Sep 17 00:00:00 2001 From: Vishwas Shashidhar Date: Tue, 6 Feb 2018 17:35:06 +0530 Subject: [PATCH 4/4] ELECTRON-261: removed extra attributes removed extra attributes in the config file as per PR suggestion. --- config/Symphony.config | 4 +--- js/main.js | 10 +--------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/config/Symphony.config b/config/Symphony.config index 5c36d2bb..ae59b873 100644 --- a/config/Symphony.config +++ b/config/Symphony.config @@ -17,8 +17,6 @@ "customFlags": { "authServerWhitelist": "", "authNegotiateDelegateWhitelist": "", - "disableGpu": false, - "disableGpuCompositing": false, - "disableD3d11": false + "disableGpu": false } } diff --git a/js/main.js b/js/main.js index 69b1754b..a5d9eae5 100644 --- a/js/main.js +++ b/js/main.js @@ -138,17 +138,9 @@ function setChromeFlags() { // to disable gpu which fixes the black screen issue observed on // multiple monitors if (config.customFlags.disableGpu) { - log.send(logLevels.INFO, 'Setting disable gpu flag'); + log.send(logLevels.INFO, 'Setting disable gpu, gpu compositing and d3d11 flags to true'); app.commandLine.appendSwitch("disable-gpu", true); - } - - if (config.customFlags.disableGpuCompositing) { - log.send(logLevels.INFO, 'Setting disable gpu compositing flag'); app.commandLine.appendSwitch("disable-gpu-compositing", true); - } - - if (config.customFlags.disableD3d11) { - log.send(logLevels.INFO, 'Setting disable d3d11 flag'); app.commandLine.appendSwitch("disable-d3d11", true); }