Thanks for the detailed reply, that makes a lot of sense. I tried putting the display capturing in multiple places, without any success. My temporary work around really is to just call CGDisplaySetDisplayMode twice (as that is the only „easy" solution I found), as I don’t really wan’t to write a lot of detection code for GPU switch for something that will hopefully be fixed sooner than later. I might have to go down that route though.
Thanks! Matthias Am 22.05.2014 um 07:17 schrieb Ken Thomases <k...@codeweavers.com>: > On May 21, 2014, at 6:25 PM, Matthias Dörfelt wrote: > >> Capturing the display does not make a difference. > > Did you capture it before or after creating the pixel format object? > >> Anyways, your guess about the GPU switching was spot on! If I disable it, >> the issue disappears. Is there any way to fix this in my code? I.e. an >> NSOpenGLPixelFormat flag that would take that into account? > > Technical Q&A QA1734: Allowing OpenGL applications to utilize the integrated > GPU > https://developer.apple.com/library/mac/qa/qa1734/_index.html > > That will avoid switching the GPU, but then you have to make your app cope > with something else changing the GPU on the fly: > > Technical Note TN2229: Supporting Multiple GPUs on Mac OS X > https://developer.apple.com/library/mac/technotes/tn2229/_index.html > > > On May 21, 2014, at 8:45 PM, Matthias Dörfelt wrote: > >> The more I think about this, the more I think this deserves a bug report. > > Sure. The behavior is clearly not something that a developer could or should > anticipate. > >> If the automatic GPU switching gets triggered by switching the display mode >> in the first place, and the newly active GPU supports the same display >> format, shouldn’t it make sure it keeps the same format? I don’t see how >> that should be the job of client code. Any thoughts? > > It's not changing the display mode which switches the GPU. It's the use of > OpenGL. > > The two GPUs use different display modes. Since you're calling > CGDisplayCopyAllDisplayModes() after triggering the switch, you should be OK, > because you should get the modes appropriate for the discrete GPU. > Obviously, that's not happening. > > I suspect that Quartz needs an opportunity to detect the change of GPU before > it starts returning the new set of display modes. I suspect that returning > to the run loop between creating the pixel format and changing the display > mode would let it notice. Apparently, the attempt to change the display mode > also gives it an opportunity to update itself. At that point, it's too late > for that particular attempt but fixes the next one. I guess. > > I also suspect that capturing the display between creating the pixel format > object and querying the display modes would give Quartz the opportunity to > notice the GPU change. > > Regards, > Ken > > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com