forked from google/angle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EGL_ANGLE_power_preference.txt
163 lines (113 loc) · 5 KB
/
EGL_ANGLE_power_preference.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
Name
ANGLE_power_preference
Name Strings
EGL_ANGLE_power_preference
Contributors
Kenneth Russell
Kimmo Kinnunen
Contacts
Kenneth Russell, Google Inc. (kbr 'at' google.com)
Status
Draft
Version
Version 3, March 10, 2022
Number
EGL Extension #??
Dependencies
This extension is written against the wording of the EGL 1.4
Specification.
Overview
This extension allows selection of the high- or low-power GPU on
dual-GPU systems, specifically on macOS.
New Types
None
New Procedures and Functions
void eglReleaseHighPowerGPUANGLE(
EGLDisplay dpy,
EGLContext context);
void eglReacquireHighPowerGPUANGLE(
EGLDisplay dpy,
EGLContext context);
void eglHandleGPUSwitchANGLE(EGLDisplay dpy);
void eglForceGPUSwitchANGLE(EGLDisplay dpy, EGLint gpuIDHigh,
EGLint gpuIDLow);
New Tokens
Accepted as an attribute name in the <*attrib_list> argument to
eglCreateContext:
EGL_POWER_PREFERENCE_ANGLE 0x3482
Accepted as an attribute value in the <*attrib_list> argument to
eglCreateContext:
EGL_LOW_POWER_ANGLE 0x0001
EGL_HIGH_POWER_ANGLE 0x0002
Additions to the EGL 1.4 Specification
Add the following to section 3.7.1 "Creating Rendering Contexts":
EGL_POWER_PREFERENCE_ANGLE indicates whether the context should be
created on the integrated (low-power) or discrete (high-power) GPU
on dual-GPU systems. EGL_POWER_PREFERENCE_ANGLE is only a legal
context creation attribute when the EGL_ANGLE_power_preference
extension is advertised. The valid values for this attribute are
EGL_LOW_POWER_ANGLE and EGL_HIGH_POWER_ANGLE. If this extension is
advertised and this context creation attribute is not specified,
the default value is EGL_LOW_POWER_ANGLE.
The containing application must set the
NSSupportsAutomaticGraphicsSwitching attribute to true in its
Info.plist in order for this extension to operate as advertised.
eglReleaseHighPowerGPUANGLE, when passed an EGLContext allocated
with the EGL_POWER_PREFERENCE_ANGLE context creation attribute set
to EGL_HIGH_POWER_ANGLE, will cause that context to release its
hold on the high-power GPU.
eglReacquireHighPowerGPUANGLE, when passed an EGLContext allocated
with the EGL_POWER_PREFERENCE_ANGLE context creation attribute set
to EGL_HIGH_POWER_ANGLE and which was previously released via
eglReleaseHighPowerGPUANGLE, will cause that context to reacquire
its hold on the high-power GPU.
eglReleaseHighPowerGPUANGLE and eglReacquireHighPowerGPUANGLE have
no effect on contexts that were allocated with the
EGL_LOW_POWER_ANGLE preference, or contexts not allocated with
either preference.
For either eglReleaseHighPowerGPUANGLE or
eglReacquireHighPowerGPUANGLE:
If |dpy| is not a valid display, an EGL_BAD_DISPLAY error is
generated.
if |dpy| is an uninitialized display, an EGL_NOT_INITIALIZED error
is generated.
If |context| is not a valid context, an EGL_BAD_CONTEXT error is
generated.
eglHandleGPUSwitchANGLE should be called in response to a display
reconfiguration callback (registered via
CGDisplayRegisterReconfigurationCallback) in order to complete
transitions between the low-power and high-power GPUs. For calls
to this function:
If |dpy| is not a valid display, an EGL_BAD_DISPLAY error is
generated.
if |dpy| is an uninitialized display, an EGL_NOT_INITIALIZED error
is generated.
eglForceGPUSwitchANGLE should be called with an explicit gpuID to transition
between the low-power and high-power GPUs. This should be called if
the environment is altered in such a way that eglHandleGPUSwitchANGLE
will not work.
On the macOS platform, the sandbox policy might prevent eglHandleGPUSwitchANGLE
from obtaining the current main active GPU. In these cases, the gpuID can
be obtained another way (e.g in other process) and communicated via
eglForceGPUSwitchANGLE to the OpenGL display.
If gpuID does not match any available GPUs in the system,
nothing happens.
For calls to this function:
If |dpy| is not a valid display, an EGL_BAD_DISPLAY error is
generated.
if |dpy| is an uninitialized display, an EGL_NOT_INITIALIZED error
is generated.
|gpuIDHigh| the high 32 bits of the IOKit registry ID of the GPU to
use for all contexts in the display.
|gpuIDLow| the low 32 bits of the IOKit registry ID of the GPU to
use for all contexts in the display.
Issues
None yet.
Revision History
Rev. Date Author Changes
---- ------------- --------- ----------------------------------------
1 Apr 16, 2019 kbr Initial version
2 June 5, 2020 kbr Add eglReleaseHighPowerGPUANGLE,
eglReacquireHighPowerGPUANGLE, and
eglHandleGPUSwitchANGLE
3 March 10, 2022 kkinnunen Add eglForceGPUSwitchANGLE