Bug 1150944 - Don't force the discrete GPU for skia gl. r=jrmuizel

This commit is contained in:
Matt Woodrow 2015-07-29 16:35:55 -04:00
Родитель 501c8bec02
Коммит 04c916856f
3 изменённых файлов: 21 добавлений и 5 удалений

Просмотреть файл

@ -23,6 +23,8 @@ enum class CreateContextFlags : int8_t {
REQUIRE_COMPAT_PROFILE = 1 << 0,
// Force the use of hardware backed GL, don't allow software implementations.
FORCE_ENABLE_HARDWARE = 1 << 1,
/* Don't force discrete GPU to be used (if applicable) */
ALLOW_OFFLINE_RENDERER = 1 << 2,
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CreateContextFlags)

Просмотреть файл

@ -187,6 +187,11 @@ static const NSOpenGLPixelFormatAttribute kAttribs_offscreen[] = {
0
};
static const NSOpenGLPixelFormatAttribute kAttribs_offscreen_allow_offline[] = {
NSOpenGLPFAAllowOfflineRenderers,
0
};
static const NSOpenGLPixelFormatAttribute kAttribs_offscreen_accel[] = {
NSOpenGLPFAAccelerated,
0
@ -269,10 +274,18 @@ CreateOffscreenFBOContext(CreateContextFlags flags)
if (!context) {
profile = ContextProfile::OpenGLCompatibility;
if (gfxPrefs::RequireHardwareGL())
context = CreateWithFormat(kAttribs_offscreen_accel);
else
context = CreateWithFormat(kAttribs_offscreen);
if (flags & CreateContextFlags::ALLOW_OFFLINE_RENDERER) {
if (gfxPrefs::RequireHardwareGL())
context = CreateWithFormat(kAttribs_singleBuffered);
else
context = CreateWithFormat(kAttribs_offscreen_allow_offline);
} else {
if (gfxPrefs::RequireHardwareGL())
context = CreateWithFormat(kAttribs_offscreen_accel);
else
context = CreateWithFormat(kAttribs_offscreen);
}
}
if (!context) {
NS_WARNING("Failed to create NSOpenGLContext.");

Просмотреть файл

@ -1090,7 +1090,8 @@ gfxPlatform::GetSkiaGLGlue()
* stands, this only works on the main thread.
*/
nsRefPtr<GLContext> glContext;
glContext = GLContextProvider::CreateHeadless(CreateContextFlags::REQUIRE_COMPAT_PROFILE);
glContext = GLContextProvider::CreateHeadless(CreateContextFlags::REQUIRE_COMPAT_PROFILE |
CreateContextFlags::ALLOW_OFFLINE_RENDERER);
if (!glContext) {
printf_stderr("Failed to create GLContext for SkiaGL!\n");
return nullptr;