blob: 02d065881b8be4778480ae2a7fbce613ca7b88be (
plain)
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
|
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <android/hardware/graphics/common/1.1/types.h>
#include <android/hardware/graphics/composer/2.4/IComposer.h>
#include <android/hardware/graphics/composer/2.4/IComposerClient.h>
#define ERROR_HAS_CHANGES 5
namespace android {
namespace hardware::graphics::composer::hal {
namespace types = android::hardware::graphics::common;
namespace V2_1 = android::hardware::graphics::composer::V2_1;
namespace V2_2 = android::hardware::graphics::composer::V2_2;
namespace V2_3 = android::hardware::graphics::composer::V2_3;
namespace V2_4 = android::hardware::graphics::composer::V2_4;
using types::V1_0::ColorTransform;
using types::V1_0::Transform;
using types::V1_1::RenderIntent;
using types::V1_2::ColorMode;
using types::V1_2::Dataspace;
using types::V1_2::Hdr;
using types::V1_2::PixelFormat;
using V2_1::Error;
using V2_4::IComposer;
using V2_4::IComposerCallback;
using V2_4::IComposerClient;
using V2_4::VsyncPeriodChangeTimeline;
using V2_4::VsyncPeriodNanos;
using Attribute = IComposerClient::Attribute;
using BlendMode = IComposerClient::BlendMode;
using Color = IComposerClient::Color;
using Composition = IComposerClient::Composition;
using Connection = IComposerCallback::Connection;
using ContentType = IComposerClient::ContentType;
using Capability = IComposer::Capability;
using ClientTargetProperty = IComposerClient::ClientTargetProperty;
using DisplayCapability = IComposerClient::DisplayCapability;
using DisplayRequest = IComposerClient::DisplayRequest;
using DisplayType = IComposerClient::DisplayType;
using HWConfigId = V2_1::Config;
using HWDisplayId = V2_1::Display;
using HWError = V2_1::Error;
using HWLayerId = V2_1::Layer;
using LayerGenericMetadataKey = IComposerClient::LayerGenericMetadataKey;
using LayerRequest = IComposerClient::LayerRequest;
using PerFrameMetadata = IComposerClient::PerFrameMetadata;
using PerFrameMetadataKey = IComposerClient::PerFrameMetadataKey;
using PerFrameMetadataBlob = IComposerClient::PerFrameMetadataBlob;
using PowerMode = IComposerClient::PowerMode;
using Vsync = IComposerClient::Vsync;
using VsyncPeriodChangeConstraints = IComposerClient::VsyncPeriodChangeConstraints;
} // namespace hardware::graphics::composer::hal
inline bool hasChangesError(hardware::graphics::composer::hal::Error error) {
return ERROR_HAS_CHANGES == static_cast<int32_t>(error);
}
inline std::string to_string(hardware::graphics::composer::hal::Attribute attribute) {
switch (attribute) {
case hardware::graphics::composer::hal::Attribute::INVALID:
return "Invalid";
case hardware::graphics::composer::hal::Attribute::WIDTH:
return "Width";
case hardware::graphics::composer::hal::Attribute::HEIGHT:
return "Height";
case hardware::graphics::composer::hal::Attribute::VSYNC_PERIOD:
return "VsyncPeriod";
case hardware::graphics::composer::hal::Attribute::DPI_X:
return "DpiX";
case hardware::graphics::composer::hal::Attribute::DPI_Y:
return "DpiY";
default:
return "Unknown";
}
}
inline std::string to_string(hardware::graphics::composer::hal::Composition composition) {
switch (composition) {
case hardware::graphics::composer::hal::Composition::INVALID:
return "Invalid";
case hardware::graphics::composer::hal::Composition::CLIENT:
return "Client";
case hardware::graphics::composer::hal::Composition::DEVICE:
return "Device";
case hardware::graphics::composer::hal::Composition::SOLID_COLOR:
return "SolidColor";
case hardware::graphics::composer::hal::Composition::CURSOR:
return "Cursor";
case hardware::graphics::composer::hal::Composition::SIDEBAND:
return "Sideband";
default:
return "Unknown";
}
}
inline std::string to_string(hardware::graphics::composer::hal::V2_4::Error error) {
// 5 is reserved for historical reason, during validation 5 means has changes.
if (ERROR_HAS_CHANGES == static_cast<int32_t>(error)) {
return "HasChanges";
}
switch (error) {
case hardware::graphics::composer::hal::V2_4::Error::NONE:
return "None";
case hardware::graphics::composer::hal::V2_4::Error::BAD_CONFIG:
return "BadConfig";
case hardware::graphics::composer::hal::V2_4::Error::BAD_DISPLAY:
return "BadDisplay";
case hardware::graphics::composer::hal::V2_4::Error::BAD_LAYER:
return "BadLayer";
case hardware::graphics::composer::hal::V2_4::Error::BAD_PARAMETER:
return "BadParameter";
case hardware::graphics::composer::hal::V2_4::Error::NO_RESOURCES:
return "NoResources";
case hardware::graphics::composer::hal::V2_4::Error::NOT_VALIDATED:
return "NotValidated";
case hardware::graphics::composer::hal::V2_4::Error::UNSUPPORTED:
return "Unsupported";
case hardware::graphics::composer::hal::V2_4::Error::SEAMLESS_NOT_ALLOWED:
return "SeamlessNotAllowed";
case hardware::graphics::composer::hal::V2_4::Error::SEAMLESS_NOT_POSSIBLE:
return "SeamlessNotPossible";
default:
return "Unknown";
}
}
inline std::string to_string(hardware::graphics::composer::hal::Error error) {
return to_string(static_cast<hardware::graphics::composer::hal::V2_4::Error>(error));
}
inline std::string to_string(hardware::graphics::composer::hal::PowerMode mode) {
switch (mode) {
case hardware::graphics::composer::hal::PowerMode::OFF:
return "Off";
case hardware::graphics::composer::hal::PowerMode::DOZE:
return "Doze";
case hardware::graphics::composer::hal::PowerMode::ON:
return "On";
case hardware::graphics::composer::hal::PowerMode::DOZE_SUSPEND:
return "DozeSuspend";
case hardware::graphics::composer::hal::PowerMode::ON_SUSPEND:
return "OnSuspend";
default:
return "Unknown";
}
}
inline std::string to_string(hardware::graphics::composer::hal::Vsync vsync) {
switch (vsync) {
case hardware::graphics::composer::hal::Vsync::ENABLE:
return "Enable";
case hardware::graphics::composer::hal::Vsync::DISABLE:
return "Disable";
default:
return "Unknown";
}
}
} // namespace android
|