1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "hdi_device_test.h"
17 #include <chrono>
18 #include <cinttypes>
19 #include <algorithm>
20 #include "v1_1/include/idisplay_composer_interface.h"
21 #include "v1_1/display_composer_type.h"
22 #include "v1_0/display_buffer_type.h"
23 #include "display_test.h"
24 #include "display_test_utils.h"
25 #include "hdi_composition_check.h"
26 #include "hdi_test_device.h"
27 #include "hdi_test_device_common.h"
28 #include "hdi_test_display.h"
29 #include "hdi_test_render_utils.h"
30
31 using namespace OHOS::HDI::Display::Buffer::V1_0;
32 using namespace OHOS::HDI::Display::Composer::V1_1;
33 using namespace OHOS::HDI::Display::TEST;
34
35 const int SLEEP_CONT_100 = 100;
36 const int SLEEP_CONT_2000 = 2000;
37
38 static const std::vector<std::vector<LayerSettings>> TEST_SINGLE_LAYER = {
39 // one layer display test
40 {
41 {
42 .rectRatio = { 0, 0, 1.0f, 0.125f },
43 .color = RED
44 },
45 },
46 {
47 {
48 .rectRatio = { 0, 0.875f, 1.0f, 0.125f },
49 .color = GREEN
50 },
51 },
52 {
53 {
54 .rectRatio = { 0, 0.0, 1.0f, 1.0f },
55 .color = YELLOW
56 },
57 },
58 };
59
60 static const std::vector<std::vector<LayerSettings>> TEST_MULTILAYER = {
61
62 // three layer displayrect test
63 {
64 {
65 .rectRatio = { 0, 0, 1.0f, 1.0f },
66 .color = RED
67 },
68 {
69 .rectRatio = { 0, 0, 1.0f, 0.125f },
70 .color = GREEN
71 },
72 {
73 .rectRatio = { 0, 0.875f, 1.0f, 0.125f },
74 .color = YELLOW
75 },
76 }
77
78 };
79
80 static const std::vector<std::vector<LayerSettings>> TEST_SCALE = {
81 // scale layer test
82 {
83 {
84 .rectRatio = { 0, 0, 1.0f, 1.0f },
85 .color = RED,
86 .bufferRatio = { 1, 1 }
87 },
88 },
89 {
90 {
91 .rectRatio = { 0, 0, 1.0f, 0.125f },
92 .color = GREEN,
93 .bufferRatio = { 1, 1 }
94 },
95 },
96 {
97 {
98 .rectRatio = { 0, 0.875f, 1.0f, 0.125f },
99 .color = YELLOW,
100 .bufferRatio = { 1, 1 }
101 },
102 }
103 };
104
105 static const std::vector<std::vector<LayerSettings>> TEST_VIDEO = {
106 // video layer test
107 {
108 {
109 .rectRatio = { 0, 0, 1.0f, 0.125f },
110 .color = GREEN,
111 .compositionType = Composer::V1_0::CompositionType::COMPOSITION_VIDEO
112 },
113 },
114
115 {
116 {
117 .rectRatio = { 0, 0, 1.0f, 1.0f },
118 .color = RED },
119 {
120 .rectRatio = { 0, 0, 1.0f, 1.0f },
121 .color = RED,
122 .compositionType = Composer::V1_0::CompositionType::COMPOSITION_VIDEO
123 },
124 },
125 {
126 {
127 .rectRatio = { 0, 0, 1.0f, 1.0f },
128 .color = RED },
129 {
130 .rectRatio = { 0, 0, 1.0f, 0.125f },
131 .color = GREEN,
132 .compositionType = Composer::V1_0::CompositionType::COMPOSITION_VIDEO
133 },
134 },
135 {
136 {
137 .rectRatio = { 0, 0, 1.0f, 1.0f },
138 .color = RED },
139 {
140 .rectRatio = { 0, 0.875f, 1.0f, 0.125f },
141 .color = YELLOW,
142 .compositionType = Composer::V1_0::CompositionType::COMPOSITION_VIDEO
143 },
144 }
145 };
146
147 static const std::vector<std::vector<LayerSettings>> TEST_ALPHA = {
148 // alpha layer test
149 {
150 {
151 .rectRatio = { 0, 0, 1.0f, 1.0f },
152 .color = RED,
153 .alpha = 0xFF
154 },
155 },
156 {
157 {
158 .rectRatio = { 0, 0, 1.0f, 1.0f },
159 .color = RED,
160 .alpha = 0xFF
161 },
162 },
163 {
164 {
165 .rectRatio = { 0, 0, 1.0f, 1.0f },
166 .color = RED,
167 .alpha = 0xFF
168 },
169 },
170 // RED float will override, must use green now
171 {
172 {
173 .rectRatio = { 0, 0, 1.0f, 1.0f },
174 .color = GREEN,
175 .alpha = 0xFF,
176 .blendType = BLEND_SRCOVER
177 },
178 },
179 {
180 {
181 .rectRatio = { 0, 0, 1.0f, 1.0f },
182 .color = GREEN,
183 .alpha = 0xFF,
184 .blendType = BLEND_SRCOVER
185 },
186 },
187 {
188 {
189 .rectRatio = { 0, 0, 1.0f, 1.0f },
190 .color = GREEN,
191 .alpha = 0xFF,
192 .blendType = BLEND_SRCOVER
193 },
194 },
195 };
196
197 static const std::vector<LayerSettings> TEST_ROTATE = {
198 {
199 .rectRatio = { 0, 0, 1.0f, 1.0f },
200 .color = RED,
201 .rotate = ROTATE_NONE
202 },
203 {
204 .rectRatio = { 0, 0, 1.0f, 1.0f },
205 .color = RED,
206 .rotate = ROTATE_90
207 },
208 {
209 .rectRatio = { 0, 0, 1.0f, 1.0f },
210 .color = RED,
211 .rotate = ROTATE_180
212 },
213 {
214 .rectRatio = { 0, 0, 1.0f, 1.0f },
215 .color = RED,
216 .rotate = ROTATE_270
217 },
218 };
219
GetFirstDisplay()220 static inline std::shared_ptr<HdiTestDisplay> GetFirstDisplay()
221 {
222 return HdiTestDevice::GetInstance().GetFirstDisplay();
223 }
224
CheckComposition(std::vector<LayerSettings> & layers,BufferHandle * clientBuffer,uint32_t checkType=HdiCompositionCheck::CHECK_VERTEX)225 static int32_t CheckComposition(std::vector<LayerSettings> &layers, BufferHandle* clientBuffer,
226 uint32_t checkType = HdiCompositionCheck::CHECK_VERTEX)
227 {
228 DISPLAY_TEST_CHK_RETURN((clientBuffer == nullptr), DISPLAY_NULL_PTR, DISPLAY_TEST_LOGE("client buffer is nullptr"));
229 return HdiCompositionCheck::GetInstance().Check(layers, *clientBuffer, checkType);
230 }
231
CreateTestLayer(LayerSettings setting,uint32_t zorder)232 static std::shared_ptr<HdiTestLayer> CreateTestLayer(LayerSettings setting, uint32_t zorder)
233 {
234 int ret;
235 HdiTestDevice::GetInstance();
236 DISPLAY_TEST_LOGD("color 0x%x", setting.color);
237 std::shared_ptr<HdiTestDisplay> display = HdiTestDevice::GetInstance().GetFirstDisplay();
238 DISPLAY_TEST_CHK_RETURN((display == nullptr), nullptr, DISPLAY_TEST_LOGE("can not get display"));
239
240 std::shared_ptr<HdiTestLayer> layer = display->CreateHdiTestLayer(setting.bufferSize.w, setting.bufferSize.h);
241 DISPLAY_TEST_CHK_RETURN((layer == nullptr), nullptr, DISPLAY_TEST_LOGE("can not create hdi test layer"));
242
243 layer->SetLayerPosition(setting.displayRect);
244
245 layer->SetCompType(setting.compositionType);
246
247 if ((setting.alpha >= 0) && (setting.alpha <= 0xff)) { // alpha rang 0x00 ~ 0xff
248 LayerAlpha alpha = { 0 };
249 alpha.gAlpha = setting.alpha;
250 alpha.enGlobalAlpha = true;
251 layer->SetAlpha(alpha);
252 }
253 HdiGrallocBuffer* handle = layer->GetFrontBuffer();
254 DISPLAY_TEST_CHK_RETURN((handle == nullptr), nullptr, DISPLAY_TEST_LOGE("can not get front buffer"));
255 ClearColor(*(handle->Get()), setting.color);
256 ret = layer->SwapFrontToBackQ();
257 DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), nullptr, DISPLAY_TEST_LOGE("SwapFrontToBackQ failed"));
258 layer->SetZorder(zorder);
259 layer->SetBlendType(setting.blendType);
260 layer->SetTransform(setting.rotate);
261 return layer;
262 }
263
PrepareAndPrensent()264 static int PrepareAndPrensent()
265 {
266 int ret;
267 DISPLAY_TEST_LOGD();
268 std::shared_ptr<HdiTestDisplay> display = HdiTestDevice::GetInstance().GetFirstDisplay();
269 DISPLAY_TEST_CHK_RETURN((display == nullptr), DISPLAY_FAILURE, DISPLAY_TEST_LOGE("can not get display"));
270
271 ret = display->PrepareDisplayLayers();
272 DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE,
273 DISPLAY_TEST_LOGE("PrepareDisplayLayers failed"));
274
275 ret = display->Commit();
276 DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_TEST_LOGE("Commit failed"));
277 return DISPLAY_SUCCESS;
278 }
279
TestVBlankCallback(unsigned int sequence,uint64_t ns,void * data)280 static void TestVBlankCallback(unsigned int sequence, uint64_t ns, void* data)
281 {
282 static uint64_t lastns;
283 DISPLAY_TEST_LOGD("seq %{public}d ns %" PRId64 " duration %" PRId64 " ns", sequence, ns, (ns - lastns));
284 lastns = ns;
285 VblankCtr::GetInstance().NotifyVblank(sequence, ns, data);
286 }
287
AdjustLayerSettings(std::vector<LayerSettings> & settings,uint32_t w,uint32_t h)288 static void AdjustLayerSettings(std::vector<LayerSettings> &settings, uint32_t w, uint32_t h)
289 {
290 DISPLAY_TEST_LOGD();
291 for (uint32_t i = 0; i < settings.size(); i++) {
292 LayerSettings& setting = settings[i];
293 DISPLAY_TEST_LOGD(" ratio w: %f ratio h: %f", setting.rectRatio.w, setting.rectRatio.h);
294 if ((setting.rectRatio.w > 0.0f) && (setting.rectRatio.h > 0.0f)) {
295 setting.displayRect.h = static_cast<uint32_t>(setting.rectRatio.h * h);
296 setting.displayRect.w = static_cast<uint32_t>(setting.rectRatio.w * w);
297 setting.displayRect.x = static_cast<uint32_t>(setting.rectRatio.x * w);
298 setting.displayRect.y = static_cast<uint32_t>(setting.rectRatio.y * h);
299 DISPLAY_TEST_LOGD("display rect adust form %f %f %f %f to %{public}d %{public}d %{public}d %{public}d ",
300 setting.rectRatio.x, setting.rectRatio.y, setting.rectRatio.w, setting.rectRatio.h,
301 setting.displayRect.x, setting.displayRect.y, setting.displayRect.w, setting.displayRect.h);
302 }
303
304 if ((setting.bufferRatio.h > 0.0f) || (setting.bufferRatio.w > 0.0f)) {
305 setting.bufferSize.h = static_cast<uint32_t>(setting.bufferRatio.h * h);
306 setting.bufferSize.w = static_cast<uint32_t>(setting.bufferRatio.w * w);
307 DISPLAY_TEST_LOGD("buffer size adjust for %f %f to %{public}d %{public}d",
308 setting.bufferRatio.w, setting.bufferRatio.h, setting.bufferSize.w, setting.bufferSize.h);
309 }
310
311 if ((setting.bufferSize.w == 0) || (setting.bufferSize.h == 0)) {
312 DISPLAY_TEST_LOGD("buffer size adjust for %{public}d %{public}d to %{public}d %{public}d",
313 setting.bufferSize.w, setting.bufferSize.h, setting.displayRect.w, setting.displayRect.h);
314
315 setting.bufferSize.w = setting.displayRect.w;
316 setting.bufferSize.h = setting.displayRect.h;
317 }
318 }
319 }
320
CreateLayers(std::vector<LayerSettings> & settings)321 static std::vector<std::shared_ptr<HdiTestLayer>> CreateLayers(std::vector<LayerSettings> &settings)
322 {
323 DISPLAY_TEST_LOGD("settings %{public}zd", settings.size());
324 std::vector<std::shared_ptr<HdiTestLayer>> layers;
325 DisplayModeInfo mode = GetFirstDisplay()->GetCurrentMode();
326 AdjustLayerSettings(settings, mode.width, mode.height);
327 for (uint32_t i = 0; i < settings.size(); i++) {
328 LayerSettings setting = settings[i];
329
330 auto layer = CreateTestLayer(setting, i);
331 layers.push_back(layer);
332 }
333
334 return layers;
335 }
336
PresentAndCheck(std::vector<LayerSettings> & layerSettings,uint32_t checkType=HdiCompositionCheck::CHECK_VERTEX)337 static inline void PresentAndCheck(std::vector<LayerSettings> &layerSettings,
338 uint32_t checkType = HdiCompositionCheck::CHECK_VERTEX)
339 {
340 int ret = PrepareAndPrensent();
341 ASSERT_TRUE((ret == DISPLAY_SUCCESS));
342 if ((GetFirstDisplay()->SnapShot()) != nullptr) {
343 HdiTestDevice::GetInstance().GetGrallocInterface()->InvalidateCache(*(GetFirstDisplay()->SnapShot()));
344 ret = CheckComposition(layerSettings, GetFirstDisplay()->SnapShot(), checkType);
345 ASSERT_TRUE((ret == DISPLAY_SUCCESS));
346 }
347 }
348
PrepareAndCommit()349 static int PrepareAndCommit()
350 {
351 DISPLAY_TEST_LOGD();
352 std::shared_ptr<HdiTestDisplay> display = HdiTestDevice::GetInstance().GetFirstDisplay();
353 DISPLAY_TEST_CHK_RETURN((display == nullptr), DISPLAY_FAILURE, DISPLAY_TEST_LOGE("can not get display"));
354
355 int ret = display->PrepareDisplayLayers(); // 确定顶压策略(是否走GPU合成)、刷新layer列表
356 DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE,
357 DISPLAY_TEST_LOGE("PrepareDisplayLayers failed"));
358
359 ret = display->Commit(); // 送显
360 DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_TEST_LOGE("Commit failed"));
361 return DISPLAY_SUCCESS;
362 }
363
TearDown()364 void LayerRotateTest::TearDown()
365 {
366 HdiTestDevice::GetInstance().Clear();
367 }
368
TearDownTestCase()369 void LayerRotateTest::TearDownTestCase()
370 {
371 HdiTestDevice::GetInstance().GetFirstDisplay()->ResetClientLayer();
372 }
373
SetUpTestCase()374 void DeviceTest::SetUpTestCase()
375 {
376 int ret = HdiTestDevice::GetInstance().InitDevice();
377 ASSERT_TRUE(ret == DISPLAY_SUCCESS);
378 }
379
TearDown()380 void DeviceTest::TearDown()
381 {
382 HdiTestDevice::GetInstance().Clear();
383 }
384
TearDown()385 void DeviceLayerDisplay::TearDown()
386 {
387 HdiTestDevice::GetInstance().Clear();
388 #ifndef DISPLAY_COMMUNITY
389 HdiTestDevice::GetInstance().GetFirstDisplay()->ResetClientLayer();
390 #endif
391 }
392
NotifyVblank(unsigned int sequence,uint64_t ns,const void * data)393 void VblankCtr::NotifyVblank(unsigned int sequence, uint64_t ns, const void* data)
394 {
395 DISPLAY_TEST_LOGD();
396 if (data != nullptr) {
397 DISPLAY_TEST_LOGD("sequence = %{public}u, ns = %" PRIu64 "", sequence, ns);
398 }
399 std::unique_lock<std::mutex> lg(vblankMutex_);
400 hasVblank_ = true;
401 vblankCondition_.notify_one();
402 DISPLAY_TEST_LOGD();
403 }
404
~VblankCtr()405 VblankCtr::~VblankCtr() {}
406
WaitVblank(uint32_t ms)407 int32_t VblankCtr::WaitVblank(uint32_t ms)
408 {
409 bool ret = false;
410 DISPLAY_TEST_LOGD();
411 std::unique_lock<std::mutex> lck(vblankMutex_);
412 ret = vblankCondition_.wait_for(lck, std::chrono::milliseconds(ms), [=] { return hasVblank_; });
413 DISPLAY_TEST_LOGD();
414 if (!ret) {
415 return DISPLAY_FAILURE;
416 }
417 return DISPLAY_SUCCESS;
418 }
419
TEST_P(DeviceLayerDisplay,LayerDisplay)420 TEST_P(DeviceLayerDisplay, LayerDisplay)
421 {
422 std::vector<LayerSettings> layerSettings = GetParam();
423 CreateLayers(layerSettings);
424 PresentAndCheck(layerSettings);
425 if (TestParemeter::GetInstance().mTestSleep > 0) {
426 sleep(TestParemeter::GetInstance().mTestSleep);
427 }
428 }
429
TEST_F(DeviceTest,zorder)430 TEST_F(DeviceTest, zorder)
431 {
432 std::vector<LayerSettings> settings = {
433 {
434 .rectRatio = { 0, 0, 1.0f, 1.0f },
435 .color = RED },
436 {
437 .rectRatio = { 0, 0, 1.0f, 0.125f },
438 .color = GREEN },
439 {
440 .rectRatio = { 0, 0.875f, 1.0f, 0.125f },
441 .color = YELLOW },
442 };
443
444 std::vector<std::vector<int>> zorders = {
445 #ifdef DISPLAY_COMMUNITY
446 { 3, 2, 1 }, { 1, 3, 2 }, { 3, 1, 2 }, { 1, 2, 3 }, { 2, 1, 3 }, { 9, 100, 3 },
447 #else
448 { 0, 2, 1 }, { 1, 0, 2 }, { 0, 1, 2 }, { 1, 2, 0 }, { 2, 1, 0 },
449 #endif // DISPLAY_COMMUNITY
450 };
451 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
452
453 for (const auto& zorderList : zorders) {
454 // adjust the zorder
455 for (uint32_t i = 0; i < zorderList.size(); i++) {
456 settings[i].zorder = zorderList[i];
457 layers[i]->SetZorder(zorderList[i]);
458 }
459 std::vector<LayerSettings> tempSettings = settings;
460 std::sort(tempSettings.begin(), tempSettings.end(),
461 [=](const auto& l, auto const& r) { return l.zorder < r.zorder; });
462 // present and check
463 PresentAndCheck(tempSettings);
464 }
465 HdiTestDevice::GetInstance().Clear();
466 }
467
468 #ifdef DISPLAY_COMMUNITY
TEST_P(LayerRotateTest,SplitCheck)469 TEST_P(LayerRotateTest, SplitCheck)
470 {
471 LayerSettings settings = GetParam();
472 std::vector<LayerSettings> layersSetting = { settings };
473 std::vector<uint32_t> splitColors = { RED, GREEN, YELLOW, TRANSPARENT };
474 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(layersSetting);
475 ASSERT_TRUE((layers.size() > 0));
476 // split the buffer
477 auto layer = layers[0];
478 HdiGrallocBuffer* handle = layer->GetBackBuffer(); // the backbuffer has not present now
479 ASSERT_TRUE((handle != nullptr));
480 auto splitRects = SplitBuffer(*(handle->Get()), splitColors);
481 ASSERT_TRUE(splitRects.size() == splitColors.size()); // ensure the splitRects size
482 PrepareAndPrensent();
483 // change the rect and color to clockwise.
484 std::swap(splitColors[2], splitColors[1]);
485 std::swap(splitColors[2], splitColors[3]);
486 std::swap(splitRects[2], splitRects[1]);
487 std::swap(splitRects[2], splitRects[3]);
488
489 // rotation is clockwise,the color will change clockwise, we just change the color start index
490 uint32_t startIndex = 0;
491 switch (settings.rotate) {
492 case ROTATE_90:
493 startIndex = 3; // start form color index 3
494 break;
495 case ROTATE_180:
496 startIndex = 2; // start form color index 2
497 break;
498 case ROTATE_270:
499 startIndex = 1; // start form color index 1
500 break;
501 default:
502 startIndex = 0;
503 break;
504 }
505 std::vector<LayerSettings> layersCheck;
506 for (uint32_t i = 0; i < splitRects.size(); i++) {
507 uint32_t color = splitColors[(i + startIndex) % 4];
508 layersCheck.push_back({.displayRect = splitRects[i], .color = color});
509 }
510 ASSERT_TRUE((handle != nullptr));
511 /* for rotation may scale the buffer, Near the edge of rect the color will Smooth gradient,
512 so we must use the center to check.
513 */
514 PresentAndCheck(layersCheck, HdiCompositionCheck::CHECK_CENTER);
515 }
516 #endif // DISPLAY_COMMUNITY
517
TEST_F(DeviceTest,crop)518 TEST_F(DeviceTest, crop)
519 {
520 std::vector<LayerSettings> settings = {
521 {
522 .rectRatio = { 0, 0, 1.0f, 1.0f },
523 .color = RED },
524 };
525 std::vector<uint32_t> splitColors = { { RED, GREEN, YELLOW, TRANSPARENT } };
526
527 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
528 ASSERT_TRUE((layers.size() > 0));
529 // split the buffer
530 auto layer = layers[0];
531 HdiGrallocBuffer* handle = layer->GetBackBuffer(); // the backbuffer has not present now
532 ASSERT_TRUE((handle != nullptr));
533 auto splitRects = SplitBuffer(*(handle->Get()), splitColors);
534 PrepareAndPrensent();
535 for (uint32_t i = 0; i < splitRects.size(); i++) {
536 settings[0].color = splitColors[i];
537 layer->SetLayerCrop(splitRects[i]);
538 PresentAndCheck(settings);
539 }
540 }
541
TEST_F(DeviceTest,CtrlTest)542 TEST_F(DeviceTest, CtrlTest)
543 {
544 int ret;
545 DISPLAY_TEST_LOGD();
546 std::shared_ptr<HdiTestDisplay> display = HdiTestDevice::GetInstance().GetFirstDisplay();
547 ASSERT_TRUE(display != nullptr) << "get display failed";
548 ret = display->RegDisplayVBlankCallback(TestVBlankCallback, nullptr);
549 ASSERT_TRUE(ret == DISPLAY_SUCCESS) << "RegDisplayVBlankCallback failed";
550 ret = display->SetDisplayVsyncEnabled(true);
551 ASSERT_TRUE(ret == DISPLAY_SUCCESS) << "SetDisplayVsyncEnabled failed";
552
553 std::vector<LayerSettings> settings = {
554 {
555 .rectRatio = { 0, 0, 1.0f, 1.0f },
556 .color = PINK
557 },
558 };
559 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
560 ASSERT_TRUE((layers.size() > 0));
561 VblankCtr::GetInstance().hasVblank_ = false;
562 PrepareAndCommit();
563 ret = VblankCtr::GetInstance().WaitVblank(SLEEP_CONT_2000); // 2000ms
564 ASSERT_TRUE(ret == DISPLAY_SUCCESS) << "WaitVblank timeout";
565 ret = display->SetDisplayVsyncEnabled(false);
566 ASSERT_TRUE(ret == DISPLAY_SUCCESS) << "SetDisplayVsyncEnabled failed";
567 usleep(SLEEP_CONT_100 * SLEEP_CONT_2000); // wait for 100ms avoid the last vsync.
568 VblankCtr::GetInstance().hasVblank_ = false;
569 ret = VblankCtr::GetInstance().WaitVblank(SLEEP_CONT_2000); // 2000ms
570 ASSERT_TRUE(ret != DISPLAY_SUCCESS) << "vblank do not disable";
571 }
572
573 INSTANTIATE_TEST_SUITE_P(MultiLayer, DeviceLayerDisplay, ::testing::ValuesIn(TEST_MULTILAYER));
574 INSTANTIATE_TEST_SUITE_P(SingleLayer, DeviceLayerDisplay, ::testing::ValuesIn(TEST_SINGLE_LAYER));
575 INSTANTIATE_TEST_SUITE_P(ScaleLayer, DeviceLayerDisplay, ::testing::ValuesIn(TEST_SCALE));
576 INSTANTIATE_TEST_SUITE_P(LayerAlpha, DeviceLayerDisplay, ::testing::ValuesIn(TEST_ALPHA));
577 #ifdef DISPLAY_COMMUNITY
578 INSTANTIATE_TEST_SUITE_P(VideoLayer, DeviceLayerDisplay, ::testing::ValuesIn(TEST_VIDEO));
579 INSTANTIATE_TEST_SUITE_P(Rotation, LayerRotateTest, ::testing::ValuesIn(TEST_ROTATE));
580 #endif // DISPLAY_COMMUNITY
581