Marissa Wall | 4d60005 | 2016-12-15 12:16:01 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <array> |
Marissa Wall | cfb9a07 | 2017-02-17 20:53:18 -0800 | [diff] [blame] | 18 | #include <unordered_set> |
Marissa Wall | 4d60005 | 2016-12-15 12:16:01 -0800 | [diff] [blame] | 19 | #include <gtest/gtest.h> |
| 20 | #include <dlfcn.h> |
| 21 | #include <hardware/hardware.h> |
| 22 | |
| 23 | #define HWC2_INCLUDE_STRINGIFICATION |
| 24 | #define HWC2_USE_CPP11 |
| 25 | #include <hardware/hwcomposer2.h> |
| 26 | #undef HWC2_INCLUDE_STRINGIFICATION |
| 27 | #undef HWC2_USE_CPP11 |
| 28 | |
Marissa Wall | cfb9a07 | 2017-02-17 20:53:18 -0800 | [diff] [blame] | 29 | void hwc2TestHotplugCallback(hwc2_callback_data_t callbackData, |
| 30 | hwc2_display_t display, int32_t connected); |
| 31 | |
Marissa Wall | 4d60005 | 2016-12-15 12:16:01 -0800 | [diff] [blame] | 32 | class Hwc2Test : public testing::Test { |
| 33 | public: |
| 34 | |
| 35 | virtual void SetUp() |
| 36 | { |
| 37 | hw_module_t const* hwc2Module; |
| 38 | |
| 39 | int err = hw_get_module(HWC_HARDWARE_MODULE_ID, &hwc2Module); |
| 40 | ASSERT_GE(err, 0) << "failed to get hwc hardware module: " |
| 41 | << strerror(-err); |
| 42 | |
| 43 | /* The following method will fail if you have not run |
| 44 | * "adb shell stop" */ |
| 45 | err = hwc2_open(hwc2Module, &mHwc2Device); |
| 46 | ASSERT_GE(err, 0) << "failed to open hwc hardware module: " |
| 47 | << strerror(-err); |
Marissa Wall | cfb9a07 | 2017-02-17 20:53:18 -0800 | [diff] [blame] | 48 | |
| 49 | populateDisplays(); |
Marissa Wall | 4d60005 | 2016-12-15 12:16:01 -0800 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | virtual void TearDown() |
| 53 | { |
Marissa Wall | 1db2e37 | 2016-12-15 12:19:39 -0800 | [diff] [blame] | 54 | |
| 55 | for (auto itr = mLayers.begin(); itr != mLayers.end();) { |
| 56 | hwc2_display_t display = itr->first; |
| 57 | hwc2_layer_t layer = itr->second; |
| 58 | itr++; |
| 59 | /* Destroys and removes the layer from mLayers */ |
| 60 | destroyLayer(display, layer); |
| 61 | } |
| 62 | |
Marissa Wall | 4d60005 | 2016-12-15 12:16:01 -0800 | [diff] [blame] | 63 | if (mHwc2Device) |
| 64 | hwc2_close(mHwc2Device); |
| 65 | } |
| 66 | |
Marissa Wall | a4b0148 | 2017-02-17 20:52:03 -0800 | [diff] [blame] | 67 | void registerCallback(hwc2_callback_descriptor_t descriptor, |
| 68 | hwc2_callback_data_t callbackData, hwc2_function_pointer_t pointer, |
| 69 | hwc2_error_t* outErr = nullptr) |
| 70 | { |
| 71 | auto pfn = reinterpret_cast<HWC2_PFN_REGISTER_CALLBACK>( |
| 72 | getFunction(HWC2_FUNCTION_REGISTER_CALLBACK)); |
| 73 | ASSERT_TRUE(pfn) << "failed to get function"; |
| 74 | |
| 75 | auto err = static_cast<hwc2_error_t>(pfn(mHwc2Device, descriptor, |
| 76 | callbackData, pointer)); |
| 77 | if (outErr) { |
| 78 | *outErr = err; |
| 79 | } else { |
| 80 | ASSERT_EQ(err, HWC2_ERROR_NONE) << "failed to register callback"; |
| 81 | } |
| 82 | } |
| 83 | |
Marissa Wall | cfb9a07 | 2017-02-17 20:53:18 -0800 | [diff] [blame] | 84 | void getDisplayType(hwc2_display_t display, hwc2_display_type_t* outType, |
| 85 | hwc2_error_t* outErr = nullptr) |
| 86 | { |
| 87 | auto pfn = reinterpret_cast<HWC2_PFN_GET_DISPLAY_TYPE>( |
| 88 | getFunction(HWC2_FUNCTION_GET_DISPLAY_TYPE)); |
| 89 | ASSERT_TRUE(pfn) << "failed to get function"; |
| 90 | |
| 91 | auto err = static_cast<hwc2_error_t>(pfn(mHwc2Device, display, |
| 92 | reinterpret_cast<int32_t*>(outType))); |
| 93 | if (outErr) { |
| 94 | *outErr = err; |
| 95 | } else { |
| 96 | ASSERT_EQ(err, HWC2_ERROR_NONE) << "failed to get display type"; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | /* If the populateDisplays function is still receiving displays and the |
| 101 | * display is connected, the display handle is stored in mDisplays. */ |
| 102 | void hotplugCallback(hwc2_display_t display, int32_t connected) |
| 103 | { |
| 104 | std::lock_guard<std::mutex> lock(mHotplugMutex); |
| 105 | |
| 106 | if (mHotplugStatus != Hwc2TestHotplugStatus::Receiving) |
| 107 | return; |
| 108 | |
| 109 | if (connected == HWC2_CONNECTION_CONNECTED) |
| 110 | mDisplays.insert(display); |
| 111 | |
| 112 | mHotplugCv.notify_all(); |
| 113 | } |
| 114 | |
Marissa Wall | 1db2e37 | 2016-12-15 12:19:39 -0800 | [diff] [blame] | 115 | void createLayer(hwc2_display_t display, hwc2_layer_t* outLayer, |
| 116 | hwc2_error_t* outErr = nullptr) |
| 117 | { |
| 118 | auto pfn = reinterpret_cast<HWC2_PFN_CREATE_LAYER>( |
| 119 | getFunction(HWC2_FUNCTION_CREATE_LAYER)); |
| 120 | ASSERT_TRUE(pfn) << "failed to get function"; |
| 121 | |
| 122 | auto err = static_cast<hwc2_error_t>(pfn(mHwc2Device, display, |
| 123 | outLayer)); |
| 124 | |
| 125 | if (err == HWC2_ERROR_NONE) |
| 126 | mLayers.insert(std::make_pair(display, *outLayer)); |
| 127 | |
| 128 | if (outErr) { |
| 129 | *outErr = err; |
| 130 | } else { |
| 131 | ASSERT_EQ(err, HWC2_ERROR_NONE) << "failed to create layer"; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | void destroyLayer(hwc2_display_t display, hwc2_layer_t layer, |
| 136 | hwc2_error_t* outErr = nullptr) |
| 137 | { |
| 138 | auto pfn = reinterpret_cast<HWC2_PFN_DESTROY_LAYER>( |
| 139 | getFunction(HWC2_FUNCTION_DESTROY_LAYER)); |
| 140 | ASSERT_TRUE(pfn) << "failed to get function"; |
| 141 | |
| 142 | auto err = static_cast<hwc2_error_t>(pfn(mHwc2Device, display, layer)); |
| 143 | |
| 144 | if (err == HWC2_ERROR_NONE) |
| 145 | mLayers.erase(std::make_pair(display, layer)); |
| 146 | |
| 147 | if (outErr) { |
| 148 | *outErr = err; |
| 149 | } else { |
| 150 | ASSERT_EQ(err, HWC2_ERROR_NONE) << "failed to destroy layer " |
| 151 | << layer; |
| 152 | } |
| 153 | } |
| 154 | |
Marissa Wall | cf935cb | 2016-12-15 12:20:47 -0800 | [diff] [blame] | 155 | void getDisplayAttribute(hwc2_display_t display, hwc2_config_t config, |
| 156 | hwc2_attribute_t attribute, int32_t* outValue, |
| 157 | hwc2_error_t* outErr = nullptr) |
| 158 | { |
| 159 | auto pfn = reinterpret_cast<HWC2_PFN_GET_DISPLAY_ATTRIBUTE>( |
| 160 | getFunction(HWC2_FUNCTION_GET_DISPLAY_ATTRIBUTE)); |
| 161 | ASSERT_TRUE(pfn) << "failed to get function"; |
| 162 | |
| 163 | auto err = static_cast<hwc2_error_t>(pfn(mHwc2Device, display, config, |
| 164 | attribute, outValue)); |
| 165 | |
| 166 | if (outErr) { |
| 167 | *outErr = err; |
| 168 | } else { |
| 169 | ASSERT_EQ(err, HWC2_ERROR_NONE) << "failed to get display attribute " |
| 170 | << getAttributeName(attribute) << " for config " << config; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | void getDisplayConfigs(hwc2_display_t display, |
| 175 | std::vector<hwc2_config_t>* outConfigs, |
| 176 | hwc2_error_t* outErr = nullptr) |
| 177 | { |
| 178 | auto pfn = reinterpret_cast<HWC2_PFN_GET_DISPLAY_CONFIGS>( |
| 179 | getFunction(HWC2_FUNCTION_GET_DISPLAY_CONFIGS)); |
| 180 | ASSERT_TRUE(pfn) << "failed to get function"; |
| 181 | |
| 182 | uint32_t numConfigs = 0; |
| 183 | |
| 184 | auto err = static_cast<hwc2_error_t>(pfn(mHwc2Device, display, |
| 185 | &numConfigs, nullptr)); |
| 186 | |
| 187 | if (err == HWC2_ERROR_NONE) { |
| 188 | outConfigs->resize(numConfigs); |
| 189 | |
| 190 | err = static_cast<hwc2_error_t>(pfn(mHwc2Device, display, |
| 191 | &numConfigs, outConfigs->data())); |
| 192 | } |
| 193 | |
| 194 | if (outErr) { |
| 195 | *outErr = err; |
| 196 | } else { |
| 197 | ASSERT_EQ(err, HWC2_ERROR_NONE) << "failed to get configs for" |
| 198 | " display " << display; |
| 199 | } |
| 200 | } |
| 201 | |
Marissa Wall | 93dc04f | 2016-12-15 12:21:46 -0800 | [diff] [blame^] | 202 | void getActiveConfig(hwc2_display_t display, hwc2_config_t* outConfig, |
| 203 | hwc2_error_t* outErr = nullptr) |
| 204 | { |
| 205 | auto pfn = reinterpret_cast<HWC2_PFN_GET_ACTIVE_CONFIG>( |
| 206 | getFunction(HWC2_FUNCTION_GET_ACTIVE_CONFIG)); |
| 207 | ASSERT_TRUE(pfn) << "failed to get function"; |
| 208 | |
| 209 | auto err = static_cast<hwc2_error_t>(pfn(mHwc2Device, display, |
| 210 | outConfig)); |
| 211 | if (outErr) { |
| 212 | *outErr = err; |
| 213 | } else { |
| 214 | ASSERT_EQ(err, HWC2_ERROR_NONE) << "failed to get active config on" |
| 215 | " display " << display; |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | void setActiveConfig(hwc2_display_t display, hwc2_config_t config, |
| 220 | hwc2_error_t* outErr = nullptr) |
| 221 | { |
| 222 | auto pfn = reinterpret_cast<HWC2_PFN_SET_ACTIVE_CONFIG>( |
| 223 | getFunction(HWC2_FUNCTION_SET_ACTIVE_CONFIG)); |
| 224 | ASSERT_TRUE(pfn) << "failed to get function"; |
| 225 | |
| 226 | auto err = static_cast<hwc2_error_t>(pfn(mHwc2Device, display, config)); |
| 227 | if (outErr) { |
| 228 | *outErr = err; |
| 229 | } else { |
| 230 | ASSERT_EQ(err, HWC2_ERROR_NONE) << "failed to set active config " |
| 231 | << config; |
| 232 | } |
| 233 | } |
| 234 | |
Marissa Wall | 4d60005 | 2016-12-15 12:16:01 -0800 | [diff] [blame] | 235 | protected: |
| 236 | hwc2_function_pointer_t getFunction(hwc2_function_descriptor_t descriptor) |
| 237 | { |
| 238 | return mHwc2Device->getFunction(mHwc2Device, descriptor); |
| 239 | } |
| 240 | |
| 241 | void getCapabilities(std::vector<hwc2_capability_t>* outCapabilities) |
| 242 | { |
| 243 | uint32_t num = 0; |
| 244 | |
| 245 | mHwc2Device->getCapabilities(mHwc2Device, &num, nullptr); |
| 246 | |
| 247 | outCapabilities->resize(num); |
| 248 | |
| 249 | mHwc2Device->getCapabilities(mHwc2Device, &num, |
| 250 | reinterpret_cast<int32_t*>(outCapabilities->data())); |
| 251 | } |
| 252 | |
Marissa Wall | cfb9a07 | 2017-02-17 20:53:18 -0800 | [diff] [blame] | 253 | /* Registers a hotplug callback and waits for hotplug callbacks. This |
| 254 | * function will have no effect if called more than once. */ |
| 255 | void populateDisplays() |
| 256 | { |
| 257 | /* Sets the hotplug status to receiving */ |
| 258 | { |
| 259 | std::lock_guard<std::mutex> lock(mHotplugMutex); |
| 260 | |
| 261 | if (mHotplugStatus != Hwc2TestHotplugStatus::Init) |
| 262 | return; |
| 263 | mHotplugStatus = Hwc2TestHotplugStatus::Receiving; |
| 264 | } |
| 265 | |
| 266 | /* Registers the callback. This function call cannot be locked because |
| 267 | * a callback could happen on the same thread */ |
| 268 | ASSERT_NO_FATAL_FAILURE(registerCallback(HWC2_CALLBACK_HOTPLUG, this, |
| 269 | reinterpret_cast<hwc2_function_pointer_t>( |
| 270 | hwc2TestHotplugCallback))); |
| 271 | |
| 272 | /* Waits for hotplug events. If a hotplug event has not come within 1 |
| 273 | * second, stop waiting. */ |
| 274 | std::unique_lock<std::mutex> lock(mHotplugMutex); |
| 275 | |
| 276 | while (mHotplugCv.wait_for(lock, std::chrono::seconds(1)) != |
| 277 | std::cv_status::timeout) { } |
| 278 | |
| 279 | /* Sets the hotplug status to done. Future calls will have no effect */ |
| 280 | mHotplugStatus = Hwc2TestHotplugStatus::Done; |
| 281 | } |
| 282 | |
| 283 | void getBadDisplay(hwc2_display_t* outDisplay) |
| 284 | { |
| 285 | for (hwc2_display_t display = 0; display < UINT64_MAX; display++) { |
| 286 | if (mDisplays.count(display) == 0) { |
| 287 | *outDisplay = display; |
| 288 | return; |
| 289 | } |
| 290 | } |
| 291 | ASSERT_TRUE(false) << "Unable to find bad display. UINT64_MAX displays" |
| 292 | " are registered. This should never happen."; |
| 293 | } |
| 294 | |
Marissa Wall | 1db2e37 | 2016-12-15 12:19:39 -0800 | [diff] [blame] | 295 | /* NOTE: will create min(newlayerCnt, max supported layers) layers */ |
| 296 | void createLayers(hwc2_display_t display, |
| 297 | std::vector<hwc2_layer_t>* outLayers, size_t newLayerCnt) |
| 298 | { |
| 299 | std::vector<hwc2_layer_t> newLayers; |
| 300 | hwc2_layer_t layer; |
| 301 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 302 | |
| 303 | for (size_t i = 0; i < newLayerCnt; i++) { |
| 304 | |
| 305 | EXPECT_NO_FATAL_FAILURE(createLayer(display, &layer, &err)); |
| 306 | if (err == HWC2_ERROR_NO_RESOURCES) |
| 307 | break; |
| 308 | if (err != HWC2_ERROR_NONE) { |
| 309 | newLayers.clear(); |
| 310 | ASSERT_EQ(err, HWC2_ERROR_NONE) << "failed to create layer"; |
| 311 | } |
| 312 | newLayers.push_back(layer); |
| 313 | } |
| 314 | |
| 315 | *outLayers = std::move(newLayers); |
| 316 | } |
| 317 | |
| 318 | void destroyLayers(hwc2_display_t display, |
| 319 | std::vector<hwc2_layer_t>&& layers) |
| 320 | { |
| 321 | for (hwc2_layer_t layer : layers) { |
| 322 | EXPECT_NO_FATAL_FAILURE(destroyLayer(display, layer)); |
| 323 | } |
| 324 | } |
| 325 | |
Marissa Wall | cf935cb | 2016-12-15 12:20:47 -0800 | [diff] [blame] | 326 | void getInvalidConfig(hwc2_display_t display, hwc2_config_t* outConfig) |
| 327 | { |
| 328 | std::vector<hwc2_config_t> configs; |
| 329 | |
| 330 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs)); |
| 331 | |
| 332 | hwc2_config_t CONFIG_MAX = UINT32_MAX; |
| 333 | |
| 334 | ASSERT_LE(configs.size() - 1, CONFIG_MAX) << "every config value" |
| 335 | " (2^32 values) has been taken which shouldn't happen"; |
| 336 | |
| 337 | hwc2_config_t config; |
| 338 | for (config = 0; config < CONFIG_MAX; config++) { |
| 339 | if (std::count(configs.begin(), configs.end(), config) == 0) |
| 340 | break; |
| 341 | } |
| 342 | |
| 343 | *outConfig = config; |
| 344 | } |
| 345 | |
Marissa Wall | 4d60005 | 2016-12-15 12:16:01 -0800 | [diff] [blame] | 346 | hwc2_device_t* mHwc2Device = nullptr; |
Marissa Wall | cfb9a07 | 2017-02-17 20:53:18 -0800 | [diff] [blame] | 347 | |
| 348 | enum class Hwc2TestHotplugStatus { |
| 349 | Init = 1, |
| 350 | Receiving, |
| 351 | Done, |
| 352 | }; |
| 353 | |
| 354 | std::mutex mHotplugMutex; |
| 355 | std::condition_variable mHotplugCv; |
| 356 | Hwc2TestHotplugStatus mHotplugStatus = Hwc2TestHotplugStatus::Init; |
| 357 | std::unordered_set<hwc2_display_t> mDisplays; |
Marissa Wall | 1db2e37 | 2016-12-15 12:19:39 -0800 | [diff] [blame] | 358 | |
| 359 | /* Store all created layers that have not been destroyed. If an ASSERT_* |
| 360 | * fails, then destroy the layers on exit */ |
| 361 | std::set<std::pair<hwc2_display_t, hwc2_layer_t>> mLayers; |
Marissa Wall | 4d60005 | 2016-12-15 12:16:01 -0800 | [diff] [blame] | 362 | }; |
| 363 | |
Marissa Wall | cfb9a07 | 2017-02-17 20:53:18 -0800 | [diff] [blame] | 364 | void hwc2TestHotplugCallback(hwc2_callback_data_t callbackData, |
| 365 | hwc2_display_t display, int32_t connection) |
| 366 | { |
| 367 | if (callbackData) |
| 368 | static_cast<Hwc2Test*>(callbackData)->hotplugCallback(display, |
| 369 | connection); |
| 370 | } |
| 371 | |
Marissa Wall | 4d60005 | 2016-12-15 12:16:01 -0800 | [diff] [blame] | 372 | |
| 373 | static const std::array<hwc2_function_descriptor_t, 42> requiredFunctions = {{ |
| 374 | HWC2_FUNCTION_ACCEPT_DISPLAY_CHANGES, |
| 375 | HWC2_FUNCTION_CREATE_LAYER, |
| 376 | HWC2_FUNCTION_CREATE_VIRTUAL_DISPLAY, |
| 377 | HWC2_FUNCTION_DESTROY_LAYER, |
| 378 | HWC2_FUNCTION_DESTROY_VIRTUAL_DISPLAY, |
| 379 | HWC2_FUNCTION_DUMP, |
| 380 | HWC2_FUNCTION_GET_ACTIVE_CONFIG, |
| 381 | HWC2_FUNCTION_GET_CHANGED_COMPOSITION_TYPES, |
| 382 | HWC2_FUNCTION_GET_CLIENT_TARGET_SUPPORT, |
| 383 | HWC2_FUNCTION_GET_COLOR_MODES, |
| 384 | HWC2_FUNCTION_GET_DISPLAY_ATTRIBUTE, |
| 385 | HWC2_FUNCTION_GET_DISPLAY_CONFIGS, |
| 386 | HWC2_FUNCTION_GET_DISPLAY_NAME, |
| 387 | HWC2_FUNCTION_GET_DISPLAY_REQUESTS, |
| 388 | HWC2_FUNCTION_GET_DISPLAY_TYPE, |
| 389 | HWC2_FUNCTION_GET_DOZE_SUPPORT, |
| 390 | HWC2_FUNCTION_GET_HDR_CAPABILITIES, |
| 391 | HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT, |
| 392 | HWC2_FUNCTION_GET_RELEASE_FENCES, |
| 393 | HWC2_FUNCTION_PRESENT_DISPLAY, |
| 394 | HWC2_FUNCTION_REGISTER_CALLBACK, |
| 395 | HWC2_FUNCTION_SET_ACTIVE_CONFIG, |
| 396 | HWC2_FUNCTION_SET_CLIENT_TARGET, |
| 397 | HWC2_FUNCTION_SET_COLOR_MODE, |
| 398 | HWC2_FUNCTION_SET_COLOR_TRANSFORM, |
| 399 | HWC2_FUNCTION_SET_CURSOR_POSITION, |
| 400 | HWC2_FUNCTION_SET_LAYER_BLEND_MODE, |
| 401 | HWC2_FUNCTION_SET_LAYER_BUFFER, |
| 402 | HWC2_FUNCTION_SET_LAYER_COLOR, |
| 403 | HWC2_FUNCTION_SET_LAYER_COMPOSITION_TYPE, |
| 404 | HWC2_FUNCTION_SET_LAYER_DATASPACE, |
| 405 | HWC2_FUNCTION_SET_LAYER_DISPLAY_FRAME, |
| 406 | HWC2_FUNCTION_SET_LAYER_PLANE_ALPHA, |
| 407 | HWC2_FUNCTION_SET_LAYER_SOURCE_CROP, |
| 408 | HWC2_FUNCTION_SET_LAYER_SURFACE_DAMAGE, |
| 409 | HWC2_FUNCTION_SET_LAYER_TRANSFORM, |
| 410 | HWC2_FUNCTION_SET_LAYER_VISIBLE_REGION, |
| 411 | HWC2_FUNCTION_SET_LAYER_Z_ORDER, |
| 412 | HWC2_FUNCTION_SET_OUTPUT_BUFFER, |
| 413 | HWC2_FUNCTION_SET_POWER_MODE, |
| 414 | HWC2_FUNCTION_SET_VSYNC_ENABLED, |
| 415 | HWC2_FUNCTION_VALIDATE_DISPLAY, |
| 416 | }}; |
| 417 | |
| 418 | /* TESTCASE: Tests that the HWC2 supports all required functions. */ |
| 419 | TEST_F(Hwc2Test, GET_FUNCTION) |
| 420 | { |
| 421 | for (hwc2_function_descriptor_t descriptor : requiredFunctions) { |
| 422 | hwc2_function_pointer_t pfn = getFunction(descriptor); |
| 423 | EXPECT_TRUE(pfn) << "failed to get function " |
| 424 | << getFunctionDescriptorName(descriptor); |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | /* TESTCASE: Tests that the HWC2 fails to retrieve and invalid function. */ |
| 429 | TEST_F(Hwc2Test, GET_FUNCTION_invalid_function) |
| 430 | { |
| 431 | hwc2_function_pointer_t pfn = getFunction(HWC2_FUNCTION_INVALID); |
| 432 | EXPECT_FALSE(pfn) << "failed to get invalid function"; |
| 433 | } |
| 434 | |
| 435 | /* TESTCASE: Tests that the HWC2 does not return an invalid capability. */ |
| 436 | TEST_F(Hwc2Test, GET_CAPABILITIES) |
| 437 | { |
| 438 | std::vector<hwc2_capability_t> capabilities; |
| 439 | |
| 440 | getCapabilities(&capabilities); |
| 441 | |
| 442 | EXPECT_EQ(std::count(capabilities.begin(), capabilities.end(), |
| 443 | HWC2_CAPABILITY_INVALID), 0); |
| 444 | } |
Marissa Wall | a4b0148 | 2017-02-17 20:52:03 -0800 | [diff] [blame] | 445 | |
| 446 | static const std::array<hwc2_callback_descriptor_t, 3> callbackDescriptors = {{ |
| 447 | HWC2_CALLBACK_HOTPLUG, |
| 448 | HWC2_CALLBACK_REFRESH, |
| 449 | HWC2_CALLBACK_VSYNC, |
| 450 | }}; |
| 451 | |
| 452 | /* TESTCASE: Tests that the HWC2 can successfully register all required |
| 453 | * callback functions. */ |
| 454 | TEST_F(Hwc2Test, REGISTER_CALLBACK) |
| 455 | { |
| 456 | hwc2_callback_data_t data = reinterpret_cast<hwc2_callback_data_t>( |
| 457 | const_cast<char*>("data")); |
| 458 | |
| 459 | for (auto descriptor : callbackDescriptors) { |
| 460 | ASSERT_NO_FATAL_FAILURE(registerCallback(descriptor, data, |
| 461 | []() { return; })); |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | /* TESTCASE: Test that the HWC2 fails to register invalid callbacks. */ |
| 466 | TEST_F(Hwc2Test, REGISTER_CALLBACK_bad_parameter) |
| 467 | { |
| 468 | hwc2_callback_data_t data = reinterpret_cast<hwc2_callback_data_t>( |
| 469 | const_cast<char*>("data")); |
| 470 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 471 | |
| 472 | ASSERT_NO_FATAL_FAILURE(registerCallback(HWC2_CALLBACK_INVALID, data, |
| 473 | []() { return; }, &err)); |
| 474 | EXPECT_EQ(err, HWC2_ERROR_BAD_PARAMETER) << "returned wrong error code"; |
| 475 | } |
| 476 | |
| 477 | /* TESTCASE: Tests that the HWC2 can register a callback with null data. */ |
| 478 | TEST_F(Hwc2Test, REGISTER_CALLBACK_null_data) |
| 479 | { |
| 480 | hwc2_callback_data_t data = nullptr; |
| 481 | |
| 482 | for (auto descriptor : callbackDescriptors) { |
| 483 | ASSERT_NO_FATAL_FAILURE(registerCallback(descriptor, data, |
| 484 | []() { return; })); |
| 485 | } |
| 486 | } |
Marissa Wall | cfb9a07 | 2017-02-17 20:53:18 -0800 | [diff] [blame] | 487 | |
| 488 | /* TESTCASE: Tests that the HWC2 returns the correct display type for each |
| 489 | * physical display. */ |
| 490 | TEST_F(Hwc2Test, GET_DISPLAY_TYPE) |
| 491 | { |
| 492 | for (auto display : mDisplays) { |
| 493 | hwc2_display_type_t type; |
| 494 | |
| 495 | ASSERT_NO_FATAL_FAILURE(getDisplayType(display, &type)); |
| 496 | EXPECT_EQ(type, HWC2_DISPLAY_TYPE_PHYSICAL) << "failed to return" |
| 497 | " correct display type"; |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | /* TESTCASE: Tests that the HWC2 returns an error when the display type of a bad |
| 502 | * display is requested. */ |
| 503 | TEST_F(Hwc2Test, GET_DISPLAY_TYPE_bad_display) |
| 504 | { |
| 505 | hwc2_display_t display; |
| 506 | hwc2_display_type_t type; |
| 507 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 508 | |
| 509 | ASSERT_NO_FATAL_FAILURE(getBadDisplay(&display)); |
| 510 | |
| 511 | ASSERT_NO_FATAL_FAILURE(getDisplayType(display, &type, &err)); |
| 512 | EXPECT_EQ(err, HWC2_ERROR_BAD_DISPLAY) << "returned wrong error code"; |
| 513 | } |
Marissa Wall | 1db2e37 | 2016-12-15 12:19:39 -0800 | [diff] [blame] | 514 | |
| 515 | /* TESTCASE: Tests that the HWC2 can create and destroy layers. */ |
| 516 | TEST_F(Hwc2Test, CREATE_DESTROY_LAYER) |
| 517 | { |
| 518 | for (auto display : mDisplays) { |
| 519 | hwc2_layer_t layer; |
| 520 | |
| 521 | ASSERT_NO_FATAL_FAILURE(createLayer(display, &layer)); |
| 522 | |
| 523 | ASSERT_NO_FATAL_FAILURE(destroyLayer(display, layer)); |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | /* TESTCASE: Tests that the HWC2 cannot create a layer for a bad display */ |
| 528 | TEST_F(Hwc2Test, CREATE_LAYER_bad_display) |
| 529 | { |
| 530 | hwc2_display_t display; |
| 531 | hwc2_layer_t layer; |
| 532 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 533 | |
| 534 | ASSERT_NO_FATAL_FAILURE(getBadDisplay(&display)); |
| 535 | |
| 536 | ASSERT_NO_FATAL_FAILURE(createLayer(display, &layer, &err)); |
| 537 | EXPECT_EQ(err, HWC2_ERROR_BAD_DISPLAY) << "returned wrong error code"; |
| 538 | } |
| 539 | |
| 540 | /* TESTCASE: Tests that the HWC2 will either support a large number of resources |
| 541 | * or will return no resources. */ |
| 542 | TEST_F(Hwc2Test, CREATE_LAYER_no_resources) |
| 543 | { |
| 544 | const size_t layerCnt = 1000; |
| 545 | |
| 546 | for (auto display : mDisplays) { |
| 547 | std::vector<hwc2_layer_t> layers; |
| 548 | |
| 549 | ASSERT_NO_FATAL_FAILURE(createLayers(display, &layers, layerCnt)); |
| 550 | |
| 551 | ASSERT_NO_FATAL_FAILURE(destroyLayers(display, std::move(layers))); |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | /* TESTCASE: Tests that the HWC2 cannot destroy a layer for a bad display */ |
| 556 | TEST_F(Hwc2Test, DESTROY_LAYER_bad_display) |
| 557 | { |
| 558 | hwc2_display_t badDisplay; |
| 559 | |
| 560 | ASSERT_NO_FATAL_FAILURE(getBadDisplay(&badDisplay)); |
| 561 | |
| 562 | for (auto display : mDisplays) { |
| 563 | hwc2_layer_t layer = 0; |
| 564 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 565 | |
| 566 | ASSERT_NO_FATAL_FAILURE(destroyLayer(badDisplay, layer, &err)); |
| 567 | EXPECT_EQ(err, HWC2_ERROR_BAD_DISPLAY) << "returned wrong error code"; |
| 568 | |
| 569 | ASSERT_NO_FATAL_FAILURE(createLayer(display, &layer)); |
| 570 | |
| 571 | ASSERT_NO_FATAL_FAILURE(destroyLayer(badDisplay, layer, &err)); |
| 572 | EXPECT_EQ(err, HWC2_ERROR_BAD_DISPLAY) << "returned wrong error code"; |
| 573 | |
| 574 | ASSERT_NO_FATAL_FAILURE(destroyLayer(display, layer)); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | /* TESTCASE: Tests that the HWC2 cannot destory a bad layer */ |
| 579 | TEST_F(Hwc2Test, DESTROY_LAYER_bad_layer) |
| 580 | { |
| 581 | for (auto display : mDisplays) { |
| 582 | hwc2_layer_t layer; |
| 583 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 584 | |
| 585 | ASSERT_NO_FATAL_FAILURE(destroyLayer(display, UINT64_MAX / 2, &err)); |
| 586 | EXPECT_EQ(err, HWC2_ERROR_BAD_LAYER) << "returned wrong error code"; |
| 587 | |
| 588 | ASSERT_NO_FATAL_FAILURE(destroyLayer(display, 0, &err)); |
| 589 | EXPECT_EQ(err, HWC2_ERROR_BAD_LAYER) << "returned wrong error code"; |
| 590 | |
| 591 | ASSERT_NO_FATAL_FAILURE(destroyLayer(display, UINT64_MAX - 1, &err)); |
| 592 | EXPECT_EQ(err, HWC2_ERROR_BAD_LAYER) << "returned wrong error code"; |
| 593 | |
| 594 | ASSERT_NO_FATAL_FAILURE(destroyLayer(display, 1, &err)); |
| 595 | EXPECT_EQ(err, HWC2_ERROR_BAD_LAYER) << "returned wrong error code"; |
| 596 | |
| 597 | ASSERT_NO_FATAL_FAILURE(destroyLayer(display, UINT64_MAX, &err)); |
| 598 | EXPECT_EQ(err, HWC2_ERROR_BAD_LAYER) << "returned wrong error code"; |
| 599 | |
| 600 | ASSERT_NO_FATAL_FAILURE(createLayer(display, &layer)); |
| 601 | |
| 602 | ASSERT_NO_FATAL_FAILURE(destroyLayer(display, layer + 1, &err)); |
| 603 | EXPECT_EQ(err, HWC2_ERROR_BAD_LAYER) << "returned wrong error code"; |
| 604 | |
| 605 | ASSERT_NO_FATAL_FAILURE(destroyLayer(display, layer)); |
| 606 | |
| 607 | ASSERT_NO_FATAL_FAILURE(destroyLayer(display, layer, &err)); |
| 608 | EXPECT_EQ(err, HWC2_ERROR_BAD_LAYER) << "returned wrong error code"; |
| 609 | } |
| 610 | } |
Marissa Wall | cf935cb | 2016-12-15 12:20:47 -0800 | [diff] [blame] | 611 | |
| 612 | static const std::array<hwc2_attribute_t, 2> requiredAttributes = {{ |
| 613 | HWC2_ATTRIBUTE_WIDTH, |
| 614 | HWC2_ATTRIBUTE_HEIGHT, |
| 615 | }}; |
| 616 | |
| 617 | static const std::array<hwc2_attribute_t, 3> optionalAttributes = {{ |
| 618 | HWC2_ATTRIBUTE_VSYNC_PERIOD, |
| 619 | HWC2_ATTRIBUTE_DPI_X, |
| 620 | HWC2_ATTRIBUTE_DPI_Y, |
| 621 | }}; |
| 622 | |
| 623 | /* TESTCASE: Tests that the HWC2 can return display attributes for a valid |
| 624 | * config. */ |
| 625 | TEST_F(Hwc2Test, GET_DISPLAY_ATTRIBUTE) |
| 626 | { |
| 627 | for (auto display : mDisplays) { |
| 628 | std::vector<hwc2_config_t> configs; |
| 629 | |
| 630 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs)); |
| 631 | |
| 632 | for (auto config : configs) { |
| 633 | int32_t value; |
| 634 | |
| 635 | for (auto attribute : requiredAttributes) { |
| 636 | ASSERT_NO_FATAL_FAILURE(getDisplayAttribute(display, config, |
| 637 | attribute, &value)); |
| 638 | EXPECT_GE(value, 0) << "missing required attribute " |
| 639 | << getAttributeName(attribute) << " for config " |
| 640 | << config; |
| 641 | } |
| 642 | for (auto attribute : optionalAttributes) { |
| 643 | ASSERT_NO_FATAL_FAILURE(getDisplayAttribute(display, config, |
| 644 | attribute, &value)); |
| 645 | } |
| 646 | } |
| 647 | } |
| 648 | } |
| 649 | |
| 650 | /* TESTCASE: Tests that the HWC2 will return a value of -1 for an invalid |
| 651 | * attribute */ |
| 652 | TEST_F(Hwc2Test, GET_DISPLAY_ATTRIBUTE_invalid_attribute) |
| 653 | { |
| 654 | const hwc2_attribute_t attribute = HWC2_ATTRIBUTE_INVALID; |
| 655 | |
| 656 | for (auto display : mDisplays) { |
| 657 | std::vector<hwc2_config_t> configs; |
| 658 | |
| 659 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs)); |
| 660 | |
| 661 | for (auto config : configs) { |
| 662 | int32_t value; |
| 663 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 664 | |
| 665 | ASSERT_NO_FATAL_FAILURE(getDisplayAttribute(display, config, |
| 666 | attribute, &value, &err)); |
| 667 | EXPECT_EQ(value, -1) << "failed to return -1 for an invalid" |
| 668 | " attribute for config " << config; |
| 669 | } |
| 670 | } |
| 671 | } |
| 672 | |
| 673 | /* TESTCASE: Tests that the HWC2 will fail to get attributes for a bad display */ |
| 674 | TEST_F(Hwc2Test, GET_DISPLAY_ATTRIBUTE_bad_display) |
| 675 | { |
| 676 | hwc2_display_t display; |
| 677 | const hwc2_config_t config = 0; |
| 678 | int32_t value; |
| 679 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 680 | |
| 681 | ASSERT_NO_FATAL_FAILURE(getBadDisplay(&display)); |
| 682 | |
| 683 | for (auto attribute : requiredAttributes) { |
| 684 | ASSERT_NO_FATAL_FAILURE(getDisplayAttribute(display, config, attribute, |
| 685 | &value, &err)); |
| 686 | EXPECT_EQ(err, HWC2_ERROR_BAD_DISPLAY) << "returned wrong error code"; |
| 687 | } |
| 688 | |
| 689 | for (auto attribute : optionalAttributes) { |
| 690 | ASSERT_NO_FATAL_FAILURE(getDisplayAttribute(display, config, attribute, |
| 691 | &value, &err)); |
| 692 | EXPECT_EQ(err, HWC2_ERROR_BAD_DISPLAY) << "returned wrong error code"; |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | /* TESTCASE: Tests that the HWC2 will fail to get attributes for a bad config */ |
| 697 | TEST_F(Hwc2Test, GET_DISPLAY_ATTRIBUTE_bad_config) |
| 698 | { |
| 699 | for (auto display : mDisplays) { |
| 700 | hwc2_config_t config; |
| 701 | int32_t value; |
| 702 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 703 | |
| 704 | ASSERT_NO_FATAL_FAILURE(getInvalidConfig(display, &config)); |
| 705 | |
| 706 | for (auto attribute : requiredAttributes) { |
| 707 | ASSERT_NO_FATAL_FAILURE(getDisplayAttribute(display, config, |
| 708 | attribute, &value, &err)); |
| 709 | EXPECT_EQ(err, HWC2_ERROR_BAD_CONFIG) << "returned wrong error code"; |
| 710 | } |
| 711 | |
| 712 | for (auto attribute : optionalAttributes) { |
| 713 | ASSERT_NO_FATAL_FAILURE(getDisplayAttribute(display, config, |
| 714 | attribute, &value, &err)); |
| 715 | EXPECT_EQ(err, HWC2_ERROR_BAD_CONFIG) << "returned wrong error code"; |
| 716 | } |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | /* TESTCASE: Tests that the HWC2 will get display configs for active displays */ |
| 721 | TEST_F(Hwc2Test, GET_DISPLAY_CONFIGS) |
| 722 | { |
| 723 | for (auto display : mDisplays) { |
| 724 | std::vector<hwc2_config_t> configs; |
| 725 | |
| 726 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs)); |
| 727 | } |
| 728 | } |
| 729 | |
| 730 | /* TESTCASE: Tests that the HWC2 will not get display configs for bad displays */ |
| 731 | TEST_F(Hwc2Test, GET_DISPLAY_CONFIGS_bad_display) |
| 732 | { |
| 733 | hwc2_display_t display; |
| 734 | std::vector<hwc2_config_t> configs; |
| 735 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 736 | |
| 737 | ASSERT_NO_FATAL_FAILURE(getBadDisplay(&display)); |
| 738 | |
| 739 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs, &err)); |
| 740 | |
| 741 | EXPECT_EQ(err, HWC2_ERROR_BAD_DISPLAY) << "returned wrong error code"; |
| 742 | EXPECT_TRUE(configs.empty()) << "returned configs for bad display"; |
| 743 | } |
| 744 | |
| 745 | /* TESTCASE: Tests that the HWC2 will return the same config list multiple |
| 746 | * times in a row. */ |
| 747 | TEST_F(Hwc2Test, GET_DISPLAY_CONFIGS_same) |
| 748 | { |
| 749 | for (auto display : mDisplays) { |
| 750 | std::vector<hwc2_config_t> configs1, configs2; |
| 751 | |
| 752 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs1)); |
| 753 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs2)); |
| 754 | |
| 755 | EXPECT_TRUE(std::is_permutation(configs1.begin(), configs1.end(), |
| 756 | configs2.begin())) << "returned two different config sets"; |
| 757 | } |
| 758 | } |
| 759 | |
| 760 | /* TESTCASE: Tests that the HWC2 does not return duplicate display configs */ |
| 761 | TEST_F(Hwc2Test, GET_DISPLAY_CONFIGS_duplicate) |
| 762 | { |
| 763 | for (auto display : mDisplays) { |
| 764 | std::vector<hwc2_config_t> configs; |
| 765 | |
| 766 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs)); |
| 767 | |
| 768 | std::unordered_set<hwc2_config_t> configsSet(configs.begin(), |
| 769 | configs.end()); |
| 770 | EXPECT_EQ(configs.size(), configsSet.size()) << "returned duplicate" |
| 771 | " configs"; |
| 772 | } |
| 773 | } |
Marissa Wall | 93dc04f | 2016-12-15 12:21:46 -0800 | [diff] [blame^] | 774 | |
| 775 | /* TESTCASE: Tests that the HWC2 returns the active config for a display */ |
| 776 | TEST_F(Hwc2Test, GET_ACTIVE_CONFIG) |
| 777 | { |
| 778 | for (auto display : mDisplays) { |
| 779 | std::vector<hwc2_config_t> configs; |
| 780 | |
| 781 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs)); |
| 782 | |
| 783 | for (auto config : configs) { |
| 784 | hwc2_config_t activeConfig; |
| 785 | |
| 786 | ASSERT_NO_FATAL_FAILURE(setActiveConfig(display, config)); |
| 787 | ASSERT_NO_FATAL_FAILURE(getActiveConfig(display, &activeConfig)); |
| 788 | |
| 789 | EXPECT_EQ(activeConfig, config) << "failed to get active config"; |
| 790 | } |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | /* TESTCASE: Tests that the HWC2 does not return an active config for a bad |
| 795 | * display. */ |
| 796 | TEST_F(Hwc2Test, GET_ACTIVE_CONFIG_bad_display) |
| 797 | { |
| 798 | hwc2_display_t display; |
| 799 | hwc2_config_t activeConfig; |
| 800 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 801 | |
| 802 | ASSERT_NO_FATAL_FAILURE(getBadDisplay(&display)); |
| 803 | |
| 804 | ASSERT_NO_FATAL_FAILURE(getActiveConfig(display, &activeConfig, &err)); |
| 805 | |
| 806 | EXPECT_EQ(err, HWC2_ERROR_BAD_DISPLAY) << "returned wrong error code"; |
| 807 | } |
| 808 | |
| 809 | /* TESTCASE: Tests that the HWC2 either begins with a valid active config |
| 810 | * or returns an error when getActiveConfig is called. */ |
| 811 | TEST_F(Hwc2Test, GET_ACTIVE_CONFIG_bad_config) |
| 812 | { |
| 813 | for (auto display : mDisplays) { |
| 814 | std::vector<hwc2_config_t> configs; |
| 815 | hwc2_config_t activeConfig; |
| 816 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 817 | |
| 818 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs)); |
| 819 | |
| 820 | if (configs.empty()) |
| 821 | return; |
| 822 | |
| 823 | ASSERT_NO_FATAL_FAILURE(getActiveConfig(display, &activeConfig, &err)); |
| 824 | if (err == HWC2_ERROR_NONE) { |
| 825 | EXPECT_NE(std::count(configs.begin(), configs.end(), |
| 826 | activeConfig), 0) << "active config is not found in " |
| 827 | " configs for display"; |
| 828 | } else { |
| 829 | EXPECT_EQ(err, HWC2_ERROR_BAD_CONFIG) << "returned wrong error code"; |
| 830 | } |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | /* TESTCASE: Tests that the HWC2 can set every display config as an active |
| 835 | * config */ |
| 836 | TEST_F(Hwc2Test, SET_ACTIVE_CONFIG) |
| 837 | { |
| 838 | for (auto display : mDisplays) { |
| 839 | std::vector<hwc2_config_t> configs; |
| 840 | |
| 841 | ASSERT_NO_FATAL_FAILURE(getDisplayConfigs(display, &configs)); |
| 842 | |
| 843 | for (auto config : configs) { |
| 844 | EXPECT_NO_FATAL_FAILURE(setActiveConfig(display, config)); |
| 845 | } |
| 846 | } |
| 847 | } |
| 848 | |
| 849 | /* TESTCASE: Tests that the HWC2 cannot set an active config for a bad display */ |
| 850 | TEST_F(Hwc2Test, SET_ACTIVE_CONFIG_bad_display) |
| 851 | { |
| 852 | hwc2_display_t display; |
| 853 | const hwc2_config_t config = 0; |
| 854 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 855 | |
| 856 | ASSERT_NO_FATAL_FAILURE(getBadDisplay(&display)); |
| 857 | |
| 858 | ASSERT_NO_FATAL_FAILURE(setActiveConfig(display, config, &err)); |
| 859 | EXPECT_EQ(err, HWC2_ERROR_BAD_DISPLAY) << "returned wrong error code"; |
| 860 | } |
| 861 | |
| 862 | /* TESTCASE: Tests that the HWC2 cannot set an invalid active config */ |
| 863 | TEST_F(Hwc2Test, SET_ACTIVE_CONFIG_bad_config) |
| 864 | { |
| 865 | for (auto display : mDisplays) { |
| 866 | hwc2_config_t config; |
| 867 | hwc2_error_t err = HWC2_ERROR_NONE; |
| 868 | |
| 869 | ASSERT_NO_FATAL_FAILURE(getInvalidConfig(display, &config)); |
| 870 | |
| 871 | ASSERT_NO_FATAL_FAILURE(setActiveConfig(display, config, &err)); |
| 872 | EXPECT_EQ(err, HWC2_ERROR_BAD_CONFIG) << "returned wrong error code"; |
| 873 | } |
| 874 | } |