Open davidpanderson opened 6 years ago
I am pretty sure that on the Mac, when watching a movie, software simulates periodic user activity to prevent the screensaver or energy saving settings from being triggered. BOINC uses the same tests as the OS uses for the screensaver so it should not be an issue on the Mac.
I would assume the same sort of mechanism prevents screensavers and energy saving from triggering while watching movies on other platforms.
Cheers, --Charlie
On Jan 13, 2018, at 6:21 PM, David Anderson notifications@github.com wrote:
While watching a movie (streaming or DVD) the computer looks idle and BOINC starts using the GPU, which glitches the movie display.
CE's user testing found this to be a common and major issue.
How to tell if we're watching a movie? I'm not sure. I don't see any relevant APIs in Windows. Maybe if we monitor read I/O and it remains above a certain level.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
It definitely happens on Win. I looked at read I/O rate while watching a video on YouTube. One of the browser processes reads about 40 KB/sec. The client could use this as evidence of a movie. However, one of the Firefox process reads about 13 KB/sec ALL the time, which is kind of close to 40.
Maybe like an option we can just detect running fullscreen application (if the not a screensaver of course)? I do not know what mechanism used in movie players to prevent screensavers on Windows
Operating systems have APIs that video players (or any other apps) can use to tell the OS that the system is not idle even if it seems to be so. Web browser based players might not use those APIs. I don't know if the APIs are not made available though browsers or if the players just don't use them. You know the player doesn't use the APIs if the system goes to power saving mode while watching movies.
Which OS are we talking about anyway? I don't think movie player detection works on Linux because the client is not looking at the right places. The information is available from Gnome Session Manager (and maybe KDE) (old way) or systemd (new way) over D-bus but they might be available only from the same session which complicates matters when the client runs as service.
What is the Windows API?
Ok. Looks like on Windows apps can use at least the following methods:
SendInput
SystemParametersInfo
/SPI_SETSCREENSAVEACTIVE
WM_SYSCOMMAND
/SC_SCREENSAVE
/SC_MONITORPOWER
without passing it to DefWindowProc
SetThreadExecutionState
/ES_DISPLAY_REQUIRED
or PowerSetRequest
/PowerRequestDisplayRequired
The first three a pretty hard to catch but for the last one CallNtPowerInformation
/SystemExecutionState
looks promising. Apps can also register for power notifications with RegisterPowerSettingNotification
. Some of the notifications might be useful elsewhere.
powercfg.exe /energy
command can be used to check what app is preventing screensaver or power saving from working. It needs admin privileges so BOINC can't use it but it's useful to find out which apps are well behaved and which aren't.
Various sources: Stack Overflow: Programmatically prevent Windows screensaver from starting MSDN: Handling Screen Savers MSDN: System Sleep Criteria MSDN: SetThreadExecutionState MSDN: PowerSetRequest Super User: Any way to detect what is disabling the screensaver? MSDN: System Power Status MSDN: CallNtPowerInformation MSDN: Registering for Power Events
Good. Perhaps someone can write some code to read these items, and see which of them are a reliable indicator of movie watching.
I think this really depends on the implementation of movie player and web browser. So from my POV the best is to support them all or almost all.
Two more ways to detect fullscreen app: Detecting full screen mode in Windows Detecting Fullscreen App Exit in Windows
The problem with that is that people may run apps other than movies (e.g. web browsers) in a full-screen window.
I would love to have the feature stop computation/gpu if running a program in full screen. This would clarify what this setting would do.
People run a lot of things full-screen other than streaming. The thing is though, most of the time, it's something that they really want to dedicate all the system's resources to (for example, games), so having an option to just detect full-screen stuff and change behavior would be useful.
I ran a small test and this code is working on Windows. It returns whether an app is in full screen mode or not. Probably the screensaver is activate it as well.
bool InFullscreenMode()
{
HWND foregroundWindowHandle = GetForegroundWindow();
if (foregroundWindowHandle == NULL)
return false;
HWND desktopHandle = GetDesktopWindow();
HWND shellHandle = GetShellWindow();
if (foregroundWindowHandle == desktopHandle || foregroundWindowHandle == shellHandle)
return false;
RECT appRect, desktopRect;
GetWindowRect(foregroundWindowHandle, &appRect);
GetWindowRect(desktopHandle, &desktopRect);
return (appRect.left == desktopRect.left &&
appRect.top == desktopRect.top &&
appRect.right == desktopRect.right &&
appRect.bottom == desktopRect.bottom);
}
Full screen isn't the issue. The problem is that we use mouse and keyboard input to decide if the computer is in use. When you're watching a movie (full screen or not) there's no mouse/keyboard input, but the computer is in use.
But when you're watching a movie, probably you use the video player in full screen mode.
You might. But you might also have a browser open full screen, and that doesn't imply the computer is in use.
IMO this option is still better, then no option at all.
What option exactly?
An option like "Suspended the GPU computing when a program is in full screen mode". That way the GPU tasks can be crunched when a computer is in used in general, but don't disturb when somebody watching a movie or playing a game.
but don't disturb when somebody watching a movie or playing a game.
Or when they have their spreadsheet or word processing program full open, or (several) Windows Explorer windows, or Google Earth, or any browser, or any other program that can open full screen and will be used as such. So unless you specify which programs will and won't react, there's a whole Windows world out there that will stop BOINC dead in its tracks just because you specify "full screen".
The "specify which programs will and won't react" option we already have via exclusive_apps
Sure, like most people I run spreadsheets and word processors maximised, but there's a difference between maximised and full screen (borderless). Full screen is more akin to presentation mode, and you probably wouldn't want display jitters while you're giving a lecture, either.
I think that there is another possible solution for this, which may be more reliable. Check CPU usage for non-BOINC processes, and assume that computer is in use if average usage for last 5 secs is above 20% (or any numbers here). This of course should take into account that CPUs have multiple cores nowadays, so single-threaded usage should be preferred here. You can also calculate CPU usage per process, and check if any of it consistently generates CPU load.
@Ageless93 I think you're confusing full screen with windowed but maximized. The two cases are actually rather different in many respects. Yes, some people may actually run lots of things in true full screen mode (no borders, no task-bar, etc), but the request here is for an option to allow for this behavior, not some hard requirement that it be present all the time, so those people could easily disable it if they don't want it. The reality is though that the most common things to run full-screen (games, video players, and presentation software) are all things that pretty much require minimal latency, so having an option for BOINC to detect that they are running without the user having to go through, figure out what executables need to be on the exclusive list, and remember to update it when things change would be a good thing.
@sirzooro BOINC itself already demonstrates that a high CPU load does not correlate with the system being 'in-use' by most people's definitions. Such a mechanism also already exists in BOINC (it's an option in the global preferences, though I forget the exact name).
You forget guys, that this option should stops the GPU tasks only. IMO this option only have advantages, because people can run GPU tasks even tho the PC is in use, and they don't have to manually suspended the GPU computation when they want to game or watch a movie or whatever that requires full screen mode therefore probably more demanding on GPU.
And the title sais don't use GPU while watching movie, and it nothing to do with the CPU tasks.
If you add the option to pause GPU while in full screen whey not also add the option to pause CPU while in full screen. This would allow all possible combinations.
@svrnwnsch CPU computation has no effect on performance, because the CPU tasks are running in very low priority. I can play games or watch movies without any issue, while the boinc is running CPU tasks, even on my wife's laptop, witch has only an Intel I3 5005U CPU and a Geforce 920M GPU.
There's issue with the GPU tasks only, because those don't have priority.
@adamradocz CPU utilization can have a very big impact on how the system behaves. It may not necessarily negatively impact throughput much, but it very much does impact latency, even when the tasks are running at a lowered priority. You will see this more on Linux and BSD systems because working hardware acceleration of things like video decoding is much less ubiquitous there than it is on macOS or Windows, but it does happen everywhere. Put a bit differently, I'd be willing to bet that while you may have no issue gaming or streaming on that laptop, the frame rates you get are lower with BOINC using the CPU.
@Ferroin Sure, the FPS must dip a little, but my point was, you literally can't game if you run a GPU task. And manually turning it off is tedious. I bet because of this unnecessary process, a lot of people only compute GPU tasks if the computer not in used.
@Ferroin The FPS drops a little in most games. And it drops a lot in CPU-intensive (mostly open-world) games like WATCH_DOGS2.
Lately, however, I was nicely surprised how well my AMD CPU (Ryzen 7 1800X) handles this CPU 100% load (computing 16 tasks in the background) while gaming. (i.e. in 2D games like InsideMyRadio, it went from 240 FPS-idle to 200 FPS-while-computing). LATENCY decrease put aside... : in 3D games I have mostly about 25 percent decreased FPS. (And up to 67 percent decreased FPS in openWorld CPU+MEM-intensive games!).
So, YES, it would be a very nice-to-have feature! (Not having to manually suspend my GPU-project in BoincManager before each light-weight gaming-session. - while also NOT having to add every light-weight game into the "GPU exclusive apps" list.)
@adamradocz It's not just GPU tasks though. There are a lot of games out there that are extremely demanding on the CPU and don't tolerate latency very well. Minecraft is a pretty good trivial example, it's essentially unplayable on systems that have other things pushing the CPU utilization to 100%, even if those things are at a low priority in the scheduler.
I'm not saying that we shouldn't have the ability to suspend GPU usage if things are running in full-screen, just that we should also have an equivalent setting for CPU apps (or, alternatively, an arrangement like the current 'computer in-use' option, one option that suspends all computation when something is running full screen, and another one (possibly enabled by default) that suspends only GPU computation).
Recently I noticed that I can play World of Warcraft with 8 WCG tasks running on 8 cores and with GPU disabled - there was noticeable slowdown in new ares (from last expansion) where most of players are now, but older areas with less players were fine. However when I switched to Yafu, game became non-playable, I had to disable CPU processing at all. I did not check if this was because of high disc I/O or other reason. I suspect that movies would be affected in similar way. This is another reason to monitor CPU load from non-BOINC apps.
For specific applications, including games and movie players, the Exclusive Applications feature under the Options menu will already allow you to automatically suspend either all tasks or only GPU tasks. IMO, BOINC is already far too complicated with too many options and controls; we should be trying to reduce the number of options, not add to them.
I have the opposite opinion: tool should have as much options as necessary to be configured for comfortable usage. Yes, some options should be present in Advanced preferences section. But their presence make application more usable.
Best regards, Vitalii
Sent via Android
вт, 30 окт. 2018 г., 2:07 CharlieFenton notifications@github.com:
For specific applications, including games and movie players, the Exclusive Applications feature under the Options menu will already allow you to automatically suspend either all tasks or only GPU tasks. IMO, BOINC is already far too complicated with too many options and controls; we should be trying to reduce the number of options, not add to them.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BOINC/boinc/issues/2301#issuecomment-434125428, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFZoeSqM8rMBTXIIlv4EigeCaKH9Dyrks5up5gugaJpZM4Rdcpc .
@CharlieFenton The problem is that the exclusive applications mechanism isn't exactly user friendly. Getting the desired behavior with that requires the following steps for a user:
In contrast, there would be exactly one step for the proposed feature, namely just turning it on.
There are also other issues with the exclusive application approach that this solves:
And as a reminder of the topic here: it isn't the application that's the problem, it's the behaviour.
Case in point: I'm typing this into a web browser, so the 'in use' trigger works (keyboard activity). If I used the same browser to watch a YouTube movie, it wouldn't be 'in use'. I wouldn't be prepared to stop BOINC by setting a browser as an exclusive app, nor would I be prepared to use different browsers for interactive or passive purposes.
I reread your comments and an option to pause CPU while in full screen is totally valid. :)
It's working fine on Windows 7 and 10 with NVIDIA GPU's. BOINC don't slow the video on those configurations. What you are using? NVIDIA GPU have an independent video processing block. For AMD and Intel I don't sure about this.
While watching a movie (streaming or DVD) the computer looks idle and BOINC starts using the GPU, which glitches the movie display.
CE's user testing found this to be a common and major issue.
How to tell if we're watching a movie? I'm not sure. I don't see any relevant APIs in Windows. Maybe if we monitor read I/O and it remains above a certain level.