-
-
Notifications
You must be signed in to change notification settings - Fork 477
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
regression in 0.12, forces use of dedicated GPU on macbook #980
Comments
I thought it may have been related to turning on hardware acceleration in src/platform/macos/helpers.rs from this PR so I tested with this extra fn locally
Then I compiled Alacritty with this local version of glutin and with this change:
No luck though. Even with not explicitly enabling hardware acceleration it still required the high perf gpu. |
It seems like the PR: #963 broken the integrated graphics switching. In this PR, file It needs to add the if-else sentences to switch the attribute between
|
@tywtyw2002 What was the code change you were testing there? Just changing the NSOpenGLPFAAccelerated to NSOpenGLPFAAllowOfflineRenderers? |
Yes. That just a hack. Someone needs to fix this code. |
@tywtyw2002 I'm totally new to Rust but I tried (I think) recompilling Alacritty with local My main goal is to get Alacritty to work locally (hacking if needed) without burning the laptop in the process :) |
It's tough for me to work on this, since my Mac build doesn't have a discrete GPU, but this seems to be quite informative: https://bugs.chromium.org/p/chromium/issues/detail?id=88788 |
Was there a reason why determining the GL version from app kit version was changed to initializing pixel formats. This diff works to get rid of the high perf gpu requirement:
The one less than desirable aspect is having to have an unsafe block for accessing the NSAppKitVersionNumber but other than that this is basically the code as it existed before for determining the latest opengl version. |
@francesca64 Modifying alacritty to create the context with a 4.1 version also works:
Looking back at #963 it seems like the main issue was that build_nsattributes wasn't ever adding the NSOpenGLPFAAccelerated attribute. The only reason for modifying it to use initWithAttributes instead of using the app kit version was "When Latest non-compatibility version is requested, try 4.1 and 3.2 explicitly instead of relying on software versions." It seems only tangentially related to that PR. Another thing to consider is that the initWithAttributes method is only available in the macOS 10.10 SDK and above so really this branch could just return NSOpenGLProfileVersion4_1Core and be done as this shouldn't properly link pre 10.10 |
So macOS API docs can be tricky. Looking further initWithAttributes is available pre 10.10 but its behavior changed a little. |
@francesca64 Ignore me. I think the reasoning is that while macOS 10.9 has support for opengl 4.1 maybe not all the hardware in older macs that support 10.9 are compatible? |
So I think swapping offline renderers for accelerated does work (not sure why it didn't for me before). Additionally you can specify offline renderers and accelerated and it will still work.
The way I understand offline renderers is that its to switch between and use arbitrary gpus not connected to a display. In the case of laptops they are integrated and discrete but in other cases like a mac pro they are both equally powered discrete gpus. Is there any reason why we cant just always call initWithAttributes here with offline enabled? I am not sure if its a general fix but it definitely seems to fix alacritty which is what I personally want. |
@mkeeler I don't understand the specifics of what you've written (as I lack low level knowledge in the area), but I can confirm that your latest diff indeed makes Alacritty stick with integrated graphics card. |
Does this change make it impossible to use the discrete GPU with glutin, though? |
That is the question. Is there a program known to use glutin and require the discrete gpu I could test out with the changes. I do not believe allowing offline renderers conflicts with hw accel but without testing it would be hard to know for certain |
The gfx examples are something you'd likely want to run on the discrete GPU. |
@zeroDivisible https://gist.github.com/tywtyw2002/c65c5fe7a7a86fef2dcd65a2bd06e19b |
I haven't tried the proposed changes but bear in mind the original change also needed |
I think that my PR leaves things in a good state. The get_gl_profile now respects double buffering and hw accel from the pf_reqs and the ContextBuilder now has functions to configure those as well so applications like alacritty can override the defaults. Like I mentioned in the PR, having NSOpenGlPFAAllowOfflineRenderers always on does not prevent switching over to the discrete gpu. How macOS makes the determination I am not sure but the gfx-rs examples still required the discrete GPU and alacritty didn't. |
@francesca64 Is there a date for the next glutin release when I can expect to see these changes on crates.io? |
Wednesday seems likely. |
version 0.12 appears to have a regression of #894 which allowed apps using glutin to use the integrated GPU on macbooks. 0.12 appears to force the dedicated GPU on all the time
The text was updated successfully, but these errors were encountered: