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

Discontinue use of the dedicated GPU on Intel MacBook Pros #32

Open
ideologysec opened this issue Jan 9, 2022 · 6 comments · May be fixed by #34
Open

Discontinue use of the dedicated GPU on Intel MacBook Pros #32

ideologysec opened this issue Jan 9, 2022 · 6 comments · May be fixed by #34

Comments

@ideologysec
Copy link

Postsack causes MacBook Pros with two GPUs to switch to the dedicated GPU, causing increased battery drain.

There's no reason I can see why it would need to do that; I presume it's a consequence of the Egui library usage.

Please investigate and fix, so battery life usage can decrease. Thanks!

@terhechte
Copy link
Owner

Hey, thanks for the comment. I'll investigate why that is happening. You're right, I suppose that's egui. I don't own a Macbook with a dedicated internal GPU, so I might ping you back for testing if I think I have a solution.

@ideologysec
Copy link
Author

Happy to test; also happy to dive into the code a bit more when I have a chance to see if I can isolate why it's happening.

@terhechte
Copy link
Owner

Hey, I did some research and it seems two things are required:

First: Adding this entry to the Info.plist:

<key>NSSupportsAutomaticGraphicsSwitching</key>
<string>YES</string>

https://developer.apple.com/library/archive/qa/qa1734/_index.html

Second: egui-glium needs a PR to disable requiring the dedicated GPU. The problematic line is here.

This context builder needs an additional .with_hardware_acceleration(Some(false)). See this discussion:

I'll look into creating a PR for this. I you want, you could create a lokal egui-glium fork, add that one line of code, add the plist entry, and check if this fixes it for you.

@ideologysec
Copy link
Author

So, the info.plist key is

<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>

which by itself only causes the app to crash.

Working on the recompilation step; will attempt to repro and report back.

@terhechte
Copy link
Owner

which by itself only causes the app to crash.

Did you try to edit the Info.plist in the app downloaded from Github or did you build it yourself? The downloaded one is Gatekeeper Notarised, so editing any of the contents (e.g. the Info.plist) will invalidate the hash and thus the notarisation. When I build it with the info plist key, it doesn't crash - at least on my M1 system.

@terhechte
Copy link
Owner

I've created an egui issue to see if the project is interested in implementing a fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants