blob: 828c624519790e3918e258dcd11c17439d86cabc [file] [log] [blame] [view]
Sean Gilhuly150ecbf72021-02-24 22:23:501## GPU Process Fallback
2
3When the GPU process crashes repeatedly, usually 3 crashes in a short timeframe,
4a less desirable but hopefully more stable mode will be chosen for the next
5startup. Where available, we want to use Vulkan over GL, and GL over software.
6Vulkan is more experimental than GL and doesn't have the same level of support
7or maturity. Software rendering should be more stable than accelerated graphics
8because it doesn't rely on third party drivers, or on graphics hardware outside
9our control.
10
11
12### Crash Counting
13
14GPU process crashes are counted in `GpuProcessHost::RecordProcessCrash()`.
15Occasional crashes are permitted without triggering the fallback behaviour,
16so one crash is forgiven per interval elapsed since the last crash. For example,
17if the GPU crashes for a second time after N minutes, the previous crash is
18forgiven. This interval is determined by `GetForgiveMinutes()`. If the crash
19limit is hit, then fallback occurs.
20
21The crash limit, determined by `kGpuFallbackCrashCount`, is higher on Android
22and ChromeOS because these platforms don't support software rendering.
23Additionally, on Android, the OS can kill the GPU process arbitrarily. So the
24crash tolerance is a little bit wider here.
25
26
27### Fallback Order
28
29The order of GPU process modes is determined at startup based on the platform,
30command line switches, and enabled features. This is then stored as a stack in
31`GpuDataManagerImplPrivate::fallback_modes_`.
32
33For example, on Linux with all options available, the stack of GPU modes will
34look like this after initialization:
35
36 +--------------------+
37 | HARDWARE_VULKAN | <--
38 +--------------------+
39 | HARDWARE_GL |
40 +--------------------+
41 | SWIFTSHADER |
42 +--------------------+
43 | DISPLAY_COMPOSITOR |
44 +--------------------+
45
46After the order is determined, or when fallback occurs, the top element from the
47stack is popped and used as the next GPU mode. If the stack is empty when
48fallback occurs, then the GPU process is too unstable to use, and the Browser
49process intentionally crashes.
50
51
52### GPU Modes
53
54
55#### `HARDWARE_GL`
56
57The GPU process is running with OpenGL hardware acceleration enabled.
58
59
60#### `HARDWARE_METAL` and `HARDWARE_VULKAN`
61
62The GPU process is running with OpenGL hardware acceleration enabled, as well as
63Metal or Vulkan.
64
65This doesn't necessarily determine what Metal or Vulkan are being used for, just
66that they are initialized. In particular, for Vulkan, `--enable-features=Vulkan`
67will cause Vulkan to be used for compositing and rasterization, whereas
68`--use-vulkan` by itself will only initialize Vulkan so that it can be used for
69other purposes, such as WebGPU.
70
71
72#### `SWIFTSHADER`
73
74The GPU process is running with hardware acceleration disabled, but SwiftShader
75will be initialized for software-backed WebGL.
76
77
78#### `DISPLAY_COMPOSITOR`
79
80The GPU process is running for the display compositor only, no acceleration is
81enabled.
82
83
Sean Gilhuly150ecbf72021-02-24 22:23:5084### Special Cases
85
86There are a few platforms that expect hardware acceleration, with some
87exceptions for certain circumstances.
88
89
90#### Android Chromecast Audio-Only
91
92Android requires hardware acceleration, except in the case of Chromecast
93audio-only builds. These run with the flag `--disable-gpu`, and the GPU process
Zhenyao Mo4af7d3fb2021-04-29 21:08:0294is launched in `DISPLAY_COMPOSITOR` mode.
Sean Gilhuly150ecbf72021-02-24 22:23:5095
96
97#### Fuchsia
98
99Fuchsia always expects Vulkan to be available, and doesn't support falling back
100to using GL or software. For testing purposes, the flag `--disable-gpu` is
101allowed, and the GPU process will be launched in `SWIFTSHADER` mode.