On Apr 24, 2019, at 10:42 AM, Zhiyi Zhang zzhang@codeweavers.com wrote:
On 4/24/19 11:22 PM, Ken Thomases wrote:
On Apr 23, 2019, at 2:22 AM, Zhiyi Zhang zzhang@codeweavers.com wrote:
On 4/23/19 11:56 AM, Ken Thomases wrote:
There's a question as to what should be considered the primary GPU. On Macs with automatic graphics switching, the integrated GPU might be current for the main display at initialization time. We'd then consider that primary. If we ever support apps specifying which GPU they want to use for graphics, we probably don't want to tell them that the integrated GPU is primary.
The primary GPU here is the one that drives the main display, which is where the dock is shown. The primary concept is the Windows one, where you choose a monitor to be primary.
Right, but with automatic graphics switching there are two GPUs that could potentially drive the main display.
On thinking about this some more, the ideal approach would be to treat the two potential GPUs driving the main display as a single GPU (with the characteristics of the discrete GPU). That is, we should hide the integrated GPU from Windows apps for the case where automatic graphics switching is supported. The problem is detecting that case. We'll probably have to do some tests on a Mac with automatic graphics switching.
Integrated GPU for presenting and discrete GPU for rendering?
Well, I'm not sure how it works under the hood (see Henri's and Chip's comments), but from the API perspective the discrete GPU is used for both rendering and presenting once the switch is made. That's why I suggest reporting the discrete GPU as the one driving the main display.
In this case, we think it would make more sense to report the integrated GPU driving the main display. And report the discrete GPU not directly connected to a display. The framebuffer is on the integrated GPU and discrete GPU may be turn off at any second to save power.
No, when the discrete GPU is being used, the framebuffer is on the discrete GPU, at least from the perspective of IOKit. And the discrete GPU won't be turned off if an app is using it and that app doesn't tell the system that it's prepared to handle a switch back to the integrated GPU. I don't know if Windows apps are expected to handle that well — maybe Direct3D apps, but not OpenGL apps? — and we currently don't tell the OS that we're capable of handling that. So, as long as a Wine process has an OpenGL context or Metal device, the discrete GPU will be active.
Again, this is why I think we should only report the discrete GPU of an auto-switching pair.
-Ken