Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable option to not switch to dedicated GPU on mac also with an integrated GPU #894

Merged
merged 1 commit into from
Jul 7, 2017

Conversation

tomfogg
Copy link
Contributor

@tomfogg tomfogg commented Jun 6, 2017

Adding this flag allows an app built with glutin to run without triggering a switch to the dedicated GPU on a mac (eg on a macbook with low power intel GPU and high power dedicated GPU).

This is mainly for this issue on the alacritty project

From testing, the app also needs to set NSSupportsAutomaticGraphicsSwitching to true in the Info.plist in its app bundle to stop the GPU switch. That means this flag is probably OK to add by default since app behaviour won't change without also having that Info.plist setting.

There are some details about multiple GPU support in this technical note

@tomaka
Copy link
Contributor

tomaka commented Jun 6, 2017

Thanks for the PR.

As usual I'm not familiar enough with MacOS to have an opinion on this.
I'll merge in a few days if nobody is opposed to it.

Copy link

@trishume trishume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked into this same issue and this is the correct and necessary thing to do. It shouldn't break anything existing since you also need the Info.plist key for it to actually do anything, and even with that key most things should just work.

This is also pretty much a prerequisite for nice GUI frameworks on OSX. Nobody wants their non-intensive apps switching to the high-power GPU.

@tomaka
Copy link
Contributor

tomaka commented Jul 7, 2017

Err I totally forgot about this PR.

@tomaka tomaka merged commit abd8d2e into rust-windowing:master Jul 7, 2017
@tomaka
Copy link
Contributor

tomaka commented Jul 7, 2017

Thanks for the insight @trishume

@lilianmoraru
Copy link

Seems to fail the CI on macOS(Rust nightly): https://travis-ci.org/tomaka/glutin/builds/251043521

@trishume
Copy link

@lilianmoraru the CI breakage isn't related to this PR, it seems to be the cocoa crate that broke.

mstange added a commit to mstange/glutin that referenced this pull request Nov 29, 2017
This commit is cherry-picked from the upstream PR rust-windowing#894 .
bors-servo pushed a commit to servo/glutin that referenced this pull request Nov 29, 2017
Specify the NSOpenGLPFAAllowOfflineRenderers attribute.

This commit is cherry-picked from the upstream PR rust-windowing#894 .

Without this attribute, on dual-GPU Macs, creating the context will always force a switch to the dedicated GPU. With this attribute, applications can opt in to using the integrated GPU by adding the `NSSupportsAutomaticGraphicsSwitching` key to their app bundle's Info.plist.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/glutin/137)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants