macos 如何在 Cocoa 中禁用 Macbook Pro 切换到高性能显卡?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4177552/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 07:21:01  来源:igfitidea点击:

How to disable Macbook Pro from switching to a high performance graphics card in Cocoa?

macoscocoagraphicsgpu

提问by Alexey Blinov

All 2010 Macbook Pros come with two graphics cards — a low-performance built-in Intel HD one and a high-performance discrete NVIDIA one — and it switches between them on the fly depending on the needs of the running applications.

所有 2010 款 Macbook Pro 都配备了两个显卡——一个是低性能的内置 Intel HD 显卡,一个是高性能的独立 NVIDIA 显卡——它可以根据运行应用程序的需要在它们之间即时切换。

I have a simple Cocoa application that consists of just a menu bar item with a NSTextFieldin it. All I do is update the text field with an NSAttributedStringfrom time to time. The trouble is that my application switches my Macbook Pro to use the high-performance NVIDIA card (I used the gfxCardStatustool to confirm this).

我有一个简单的 Cocoa 应用程序,NSTextField它只包含一个带有 的菜单栏项。我所做的就是NSAttributedString不时更新文本字段。问题是我的应用程序将我的 Macbook Pro 切换为使用高性能 NVIDIA 卡(我使用gfxCardStatus工具确认了这一点)。

What could possibly need the high-performance card? Is there a known list of reasons for the applications to require high-performance graphics card? Is there a way to force the computer to use the discrete graphics card?

什么可能需要高性能卡?是否有已知的应用程序需要高性能显卡的原因列表?有没有办法强制电脑使用独立显卡?

回答by Thomas Zoechling

There is a good article about GPU switching in the newer MacBook Pros at Ars Technica. I noticed that OS X switches to the dedicated GPU if you

Ars Technica 上有一篇关于更新 MacBook Pro 中 GPU 切换的好文章。我注意到 OS X 会切换到专用 GPU,如果你

  • Start an application that links against OpenGL
  • Connect a second display
  • 启动一个链接到 OpenGL 的应用程序
  • 连接第二个显示器

The code of gfxCardStatus is open source. And it seems that the relevant part is located in switcher.m. You can take a closer look here.

gfxCardStatus 的代码是开源的。似乎相关部分位于 switcher.m 中。你可以在这里仔细看看。

回答by Alexp

In MacOS 10.7 you can specify a setting in the PList to stop going to discrete graphics:

在 MacOS 10.7 中,您可以在 PList 中指定一个设置以停止转到独立显卡:

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

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

Needs to be a 2011+ MacBook Pro.

需要是 2011 年以上的 MacBook Pro。