Commit 459d7acc authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

macOS/ARM: Make gpu::SwitchableGPUsSupported always return true

This flag gates whether or not we specify kCGLPFAAllowOfflineRenderers,
and whether or not we call CGLSetVirtualScreen to manually migrate our
compositing/raster contexts on GPU switch.

ARM DTKs only have the single integrated AGX GPU, and do not recognize
external GPUs, so this is necessarily untested. Indications are that
it would be a good idea to add this to our initial ARM shipping build.
Note that this would enable the flag even on single-GPU systems,
because we haven't been able to test multi-GPU detection code on
multi-GPU ARM machines (and so this could end up being unused if that
code failed to detect the multi-GPU configuration).

Bug: 1131312
Change-Id: I38404a8fc380d9f7542f0aaf93f969893815fac2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522431Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825578}
parent 2f1358c4
......@@ -18,6 +18,10 @@
#include "ui/gl/gl_switches.h"
#include "ui/gl/gpu_preference.h"
#if defined(OS_MAC)
#include "base/mac/mac_util.h"
#endif // OS_MAC
namespace gpu {
namespace {
......@@ -60,14 +64,24 @@ bool SwitchableGPUsSupported(const GPUInfo& gpu_info,
gl::kGLImplementationANGLEName)) {
return false;
}
// Always allow offline renderers on ARM-based macs.
// https://crbug.com/1131312
switch (base::mac::GetCPUType()) {
case base::mac::CPUType::kArm:
case base::mac::CPUType::kTranslatedIntel:
return true;
default:
break;
}
if (gpu_info.secondary_gpus.size() != 1) {
return false;
}
// Only advertise that we have two GPUs to the rest of
// Chrome's code if we find an Intel GPU and some other
// vendor's GPU. Otherwise we don't understand the
// configuration and don't deal well with it (an example being
// the dual AMD GPUs in recent Mac Pros).
// Only advertise that we have two GPUs to the rest of Chrome's code if we
// find an Intel GPU and some other vendor's GPU. Otherwise we don't
// understand the configuration and don't deal well with it (an example being
// the dual AMD GPUs in recent Mac Pros). Motivation is explained in:
// http://crbug.com/380026#c70.
const uint32_t kVendorIntel = 0x8086;
return ((gpu_info.gpu.vendor_id == kVendorIntel &&
gpu_info.secondary_gpus[0].vendor_id != kVendorIntel) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment