lin
2025-07-30 fcd736bf35fd93b563e9bbf594f2aa7b62028cc9
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
/*
 * Copyright 2017 The Chromium Authors.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */
 
#ifndef ANDROID_SF_PRIVATE_HWCOMPOSER2_ARC_PRIVATE_H
#define ANDROID_SF_PRIVATE_HWCOMPOSER2_ARC_PRIVATE_H
 
__BEGIN_DECLS
 
/* Optional ARC private capabilities. The particular set of supported private
 * capabilities for a given device may be retrieved using
 * getArcPrivateCapabilities. */
typedef enum {
    HWC2_ARC_PRIVATE_CAPABILITY_INVALID = 0,
 
    /* Specifies that the device supports ARC attribute data. Decoding the data
     * is an implementation detail for the device. Note that ordinarily the
     * Android framework does not send this data. It is assumed that a vendor
     * that wants this data has also modified the framework to send it. */
    HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES = 1,
 
    /* Specifies that the device is an ARC windowing composer. A windowing
     * composer generates windowed output inside some external
     * implementation-defined windowing environment. It means that there is no
     * longer a single output frame buffer being used. The device must handle
     * all composition, and the client must not do so. The client cannot do any
     * culling of layers either -- it may not have full knowledge of what is
     * actually visible or not. */
    HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER = 2,
} hwc2_arc_private_capability_t;
 
/* ARC private function descriptors for use with getFunction.
 * The first entry needs to be maintained so there is no overlap with the
 * constants there. */
typedef enum {
    HWC2_ARC_PRIVATE_FUNCTION_GET_CAPABILITIES = 0x10000,
 
    // For HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER
    HWC2_ARC_PRIVATE_FUNCTION_GET_DISPLAY_ATTRIBUTE,
 
    // For HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES
    HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_ATTRIBUTES,
 
    // For HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER
    HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_HIDDEN,
 
    // For HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES
    HWC2_ARC_PRIVATE_FUNCTION_ATTRIBUTES_SHOULD_FORCE_UPDATE,
} hwc2_arc_private_function_descriptor_t;
 
typedef enum {
    HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_INVALID = 0,
    HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_OUTPUT_ROTATION = 1,
} hwc2_arc_private_display_attribute_t;
 
typedef enum {
    HWC2_ARC_PRIVATE_HIDDEN_INVALID = 0,
    HWC2_ARC_PRIVATE_HIDDEN_ENABLE = 1,
    HWC2_ARC_PRIVATE_HIDDEN_DISABLE = 2,
} hwc2_arc_private_hidden_t;
 
/*
 * Stringification Functions
 */
 
#ifdef HWC2_INCLUDE_STRINGIFICATION
 
static inline const char* getArcPrivateCapabilityName(hwc2_arc_private_capability_t capability)
{
    switch (capability) {
    case HWC2_ARC_PRIVATE_CAPABILITY_INVALID:
        return "Invalid";
    case HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES:
        return "ArcAttributes";
    case HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER:
        return "ArcWindowingComposer";
    default:
        return "Unknown";
    }
}
 
static inline const char* getArcPrivateFunctionDescriptorName(
        hwc2_arc_private_function_descriptor_t desc)
{
    switch (desc) {
    case HWC2_ARC_PRIVATE_FUNCTION_GET_CAPABILITIES:
        return "ArcGetCapabilities";
    case HWC2_ARC_PRIVATE_FUNCTION_GET_DISPLAY_ATTRIBUTE:
        return "ArcGetDisplayAttribute";
    case HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_ATTRIBUTES:
        return "ArcSetLayerAttributes";
    case HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_HIDDEN:
        return "ArcSetLayerHidden";
    case HWC2_ARC_PRIVATE_FUNCTION_ATTRIBUTES_SHOULD_FORCE_UPDATE:
        return "ArcAttributesShouldForceUpdate";
    default:
        return "Unknown";
    }
}
 
static inline const char* getArcPrivateDisplayAttributeName(hwc2_arc_private_display_attribute_t attribute)
{
    switch (attribute) {
    case HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_INVALID:
        return "Invalid";
    case HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_OUTPUT_ROTATION:
        return "OutputRotation";
    default:
        return "Unknown";
    }
}
 
static inline const char* getArcPrivateHiddenName(hwc2_arc_private_hidden_t hidden)
{
    switch (hidden) {
    case HWC2_ARC_PRIVATE_HIDDEN_INVALID:
        return "Invalid";
    case HWC2_ARC_PRIVATE_HIDDEN_ENABLE:
        return "Enable";
    case HWC2_ARC_PRIVATE_HIDDEN_DISABLE:
        return "Disable";
    default:
        return "Unknown";
    }
}
 
#endif  // HWC2_INCLUDE_STRINGIFICATION
 
/*
 * C++11 features
 */
 
#ifdef HWC2_USE_CPP11
__END_DECLS
 
#ifdef HWC2_INCLUDE_STRINGIFICATION
#include <string>
#endif
 
namespace HWC2 {
 
enum class ArcPrivateCapability : int32_t {
    Invalid = HWC2_ARC_PRIVATE_CAPABILITY_INVALID,
    Attributes = HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES,
    WindowingComposer = HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER,
};
TO_STRING(hwc2_arc_private_capability_t, ArcPrivateCapability, getArcPrivateCapabilityName)
 
enum class ArcPrivateFunctionDescriptor : int32_t {
    // Since we are extending the HWC2 FunctionDescriptor, we duplicate
    // all of its
    GetCapabilities = HWC2_ARC_PRIVATE_FUNCTION_GET_CAPABILITIES,
    GetDisplayAttribute = HWC2_ARC_PRIVATE_FUNCTION_GET_DISPLAY_ATTRIBUTE,
    SetLayerAttributes = HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_ATTRIBUTES,
    SetLayerHidden = HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_HIDDEN,
    AttributesShouldForceUpdate = HWC2_ARC_PRIVATE_FUNCTION_ATTRIBUTES_SHOULD_FORCE_UPDATE,
};
TO_STRING(hwc2_arc_private_function_descriptor_t, ArcPrivateFunctionDescriptor,
        getArcPrivateFunctionDescriptorName)
 
enum class ArcPrivateDisplayAttribute : int32_t {
    Invalid = HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_INVALID,
    OutputRotation = HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_OUTPUT_ROTATION,
};
TO_STRING(hwc2_arc_private_display_attribute_t, ArcPrivateDisplayAttribute,
        getArcPrivateDisplayAttributeName)
 
enum class ArcPrivateHidden : int32_t {
    Invalid = HWC2_ARC_PRIVATE_HIDDEN_INVALID,
    Enable = HWC2_ARC_PRIVATE_HIDDEN_ENABLE,
    Disable = HWC2_ARC_PRIVATE_HIDDEN_DISABLE,
};
TO_STRING(hwc2_arc_private_hidden_t, ArcPrivateHidden, getArcPrivateHiddenName)
 
}  // namespace HWC2
 
__BEGIN_DECLS
#endif  // HWC2_USE_CPP11
 
/*
 * ARC Private device Functions
 *
 * All of these functions take as their first parameter a device pointer, so
 * this parameter is omitted from the described parameter lists.
 */
 
/* arcGetCapabilities(..., outCount, outCapabilities)
 * Descriptor: HWC2_ARC_PRIVATE_FUNCTION_GET_CAPABILITIES
 *
 * Gets additional capabilities supported by the device.
 *
 * Parameters:
 *   outCount - if outCapabilities was NULL, the number of capabilities which
 *       would have been returned; if outCapabilities was not NULL, the number
 *       of capabilities returned, which must not exceed the value stored in
 *       outCount priort to the call; pointer will be non-NULL
 *   outCapabilities - an array of capabilities
 * */
typedef void (*HWC2_ARC_PRIVATE_PFN_GET_CAPABILITIES)(hwc2_device_t* device, uint32_t* outCount,
        int32_t* /*hwc2_arc_private_capability_t*/ outCapabilities);
 
/*
 * ARC Private display functions
 *
 * All of these functions take as their first two parameters a device pointer,
 * and a display handle for the display. These parameters are omitted from the
 * described parameter lists.
 */
 
/* arcGetDisplayAttributes(..., attribute, outValue)
 * Descriptor: HWC2_ARC_PRIVATE_FUNCTION_GET_DISPLAY_ATTRIBUTE
 * Provided by HWC2 devices which support
 * HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER
 *
 * Gets additional display attribute data.
 *
 * Parameters:
 *   attribute - The attribute to get
 *   outValue - A location to store the value of the attribute
 *
 * Returns HWC2_ERROR_NONE if a value was set, or HWC2_ERROR_BAD_DISPLAY, or
 * HWC2_ERROR_BAD_PARAMETER
 */
typedef int32_t /*hwc2_error_t*/ (*HWC2_ARC_PRIVATE_PFN_GET_DISPLAY_ATTRIBUTE)(
        hwc2_device_t* device, hwc2_display_t display, const int32_t attribute, int32_t* outValue);
 
/*
 * ARC Private layer Functions
 *
 * These are functions which operate on layers, but which do not modify state
 * that must be validated before use. See also 'Layer State Functions' below.
 *
 * All of these functions take as their first three parameters a device pointer,
 * a display handle for the display which contains the layer, and a layer
 * handle, so these parameters are omitted from the described parameter lists.
 */
 
/* arcSetLayerAttributes(..., numElements, ids, sizes, values)
 * Descriptor: HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_ATTRIBUTES
 * Provided by HWC2 devices which support
 * HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES
 *
 * Sets additional surface data in the form of id/value pairs sent down by the
 * framework. The meaning of each attribute is opaque to the client, and is
 * assumed to be understood by the device implementation.
 *
 * Parameters:
 *   numElements - the number of elements in each array.
 *   ids - an array of surface attribute ids
 *   sizes - an array of sizes, giving the size in bytes of each value
 *   values - an array of pointers to the data for each value
 *
 * Returns HWC2_ERROR_NONE or one of the following errors:
 *   HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in
 */
typedef int32_t /*hwc2_error_t*/ (*HWC2_ARC_PRIVATE_PFN_SET_LAYER_ATTRIBUTES)(hwc2_device_t* device,
        hwc2_display_t display, hwc2_layer_t layer, uint32_t numElements, const int32_t* ids,
        const uint32_t* sizes, const uint8_t** values);
 
/* arcSetLayerHidden(..., hidden)
 * Descriptor: HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_HIDDEN
 * Provided by HWC2 devices which support
 * HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER
 *
 * Indicates whether the layer should be hidden or not. This flag is set by the
 * window manager.
 *
 * Parameters:
 *   hidden - the setting to use.
 *
 * Returns HWC2_ERROR_NONE or one of the following errors:
 *   HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in
 */
typedef int32_t /*hwc2_error_t*/ (*HWC2_ARC_PRIVATE_PFN_SET_LAYER_HIDDEN)(
        hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer,
        int32_t /* hwc2_arc_private_hidden_t */ hidden);
 
/* arcAttributesShouldForceUpdate(..., numElements, ids, sizes, values, outShouldForceUpdate)
 * Descriptor: HWC2_ARC_PRIVATE_FUNCTION_ATTRIBUTES_SHOULD_FORCE_UPDATE
 * Provided by HWC2 devices which support
 * HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES
 *
 * Outputs to |outShouldForceUpdate| whether to send geometry updates without
 * waiting for a matching buffer, given the specified layer attributes.
 *
 * Parameters:
 *   numElements - the number of elements in each array.
 *   ids - an array of surface attribute ids
 *   sizes - an array of sizes, giving the size in bytes of each value
 *   values - an array of pointers to the data for each value
 *   outShouldForceUpdate - whether to send geometry updates without waiting
 *      for a matching buffer
 *
 * Returns HWC2_ERROR_NONE or one of the following errors:
 *   HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in
 */
typedef int32_t /*hwc2_error_t*/ (*HWC2_ARC_PRIVATE_PFN_ATTRIBUTES_SHOULD_FORCE_UPDATE)(
    hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer,
    uint32_t numElements, const int32_t* ids, const uint32_t* sizes,
    const uint8_t** values, bool* outShouldForceUpdate);
 
__END_DECLS
 
#endif