1 /*
2 * Copyright (c) 2023-2024 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_composer_ut.h"
17 #include <chrono>
18 #include <cinttypes>
19 #include <algorithm>
20 #include "v1_2/include/idisplay_composer_interface.h"
21 #include "v1_2/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 #include "timer.h"
31 #include <sys/time.h>
32 #include <thread>
33
34 using namespace OHOS::HDI::Display::Buffer::V1_0;
35 using namespace OHOS::HDI::Display::Composer::V1_2;
36 using namespace OHOS::HDI::Display::TEST;
37 using namespace testing::ext;
38
39 static sptr<Composer::V1_2::IDisplayComposerInterface> g_composerDevice = nullptr;
40 static std::shared_ptr<IDisplayBuffer> g_gralloc = nullptr;
41 static std::vector<uint32_t> g_displayIds;
42 const int SLEEP_CONT_10 = 10;
43 const int SLEEP_CONT_100 = 100;
44 const int SLEEP_CONT_2000 = 2000;
45 static bool g_isOnSeamlessChangeCalled = false;
46 static bool g_isOnModeCalled = false;
47 static bool g_threadCtrl = false;
48
GetFirstDisplay()49 static inline std::shared_ptr<HdiTestDisplay> GetFirstDisplay()
50 {
51 return HdiTestDevice::GetInstance().GetFirstDisplay();
52 }
53
CheckComposition(std::vector<LayerSettings> & layers,BufferHandle * clientBuffer,uint32_t checkType=HdiCompositionCheck::CHECK_VERTEX)54 static int32_t CheckComposition(std::vector<LayerSettings> &layers, BufferHandle* clientBuffer,
55 uint32_t checkType = HdiCompositionCheck::CHECK_VERTEX)
56 {
57 DISPLAY_TEST_CHK_RETURN((clientBuffer == nullptr), DISPLAY_NULL_PTR, DISPLAY_TEST_LOGE("client buffer is nullptr"));
58 return HdiCompositionCheck::GetInstance().Check(layers, *clientBuffer, checkType);
59 }
60
CreateTestLayer(LayerSettings setting,uint32_t zorder)61 static std::shared_ptr<HdiTestLayer> CreateTestLayer(LayerSettings setting, uint32_t zorder)
62 {
63 int ret;
64 HdiTestDevice::GetInstance();
65 DISPLAY_TEST_LOGE("color 0x%x", setting.color);
66 std::shared_ptr<HdiTestDisplay> display = HdiTestDevice::GetInstance().GetFirstDisplay();
67 DISPLAY_TEST_CHK_RETURN((display == nullptr), nullptr, DISPLAY_TEST_LOGE("can not get display"));
68
69 std::shared_ptr<HdiTestLayer> layer = display->CreateHdiTestLayer(setting.bufferSize.w, setting.bufferSize.h);
70 DISPLAY_TEST_CHK_RETURN((layer == nullptr), nullptr, DISPLAY_TEST_LOGE("can not create hdi test layer"));
71
72 layer->SetLayerPosition(setting.displayRect);
73
74 layer->SetCompType(setting.compositionType);
75
76 if ((setting.alpha >= 0) && (setting.alpha <= 0xff)) { // alpha rang 0x00 ~ 0xff
77 LayerAlpha alpha = { 0 };
78 alpha.gAlpha = setting.alpha;
79 alpha.enGlobalAlpha = true;
80 layer->SetAlpha(alpha);
81 }
82 HdiGrallocBuffer* handle = layer->GetFrontBuffer();
83 DISPLAY_TEST_CHK_RETURN((handle == nullptr), nullptr, DISPLAY_TEST_LOGE("can not get front buffer"));
84 ClearColor(*(handle->Get()), setting.color);
85 ret = layer->SwapFrontToBackQ();
86 DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), nullptr, DISPLAY_TEST_LOGE("SwapFrontToBackQ failed"));
87 layer->SetZorder(zorder);
88 layer->SetBlendType(setting.blendType);
89 layer->SetTransform(setting.rotate);
90 return layer;
91 }
92
PrepareAndCommit()93 static int PrepareAndCommit()
94 {
95 int ret;
96 DISPLAY_TEST_LOGE();
97 std::shared_ptr<HdiTestDisplay> display = HdiTestDevice::GetInstance().GetFirstDisplay();
98 DISPLAY_TEST_CHK_RETURN((display == nullptr), DISPLAY_FAILURE, DISPLAY_TEST_LOGE("can not get display"));
99
100 ret = display->PrepareDisplayLayers(); // 确定顶压策略(是否走GPU合成)、刷新layer列表
101 DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE,
102 DISPLAY_TEST_LOGE("PrepareDisplayLayers failed"));
103
104 ret = display->Commit(); // 送显
105 DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_TEST_LOGE("Commit failed"));
106 return DISPLAY_SUCCESS;
107 }
108
LoopCommit()109 static void LoopCommit()
110 {
111 while (!g_threadCtrl) {
112 PrepareAndCommit();
113 std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_CONT_10));
114 }
115 }
116
TestVBlankCallback(unsigned int sequence,uint64_t ns,void * data)117 static void TestVBlankCallback(unsigned int sequence, uint64_t ns, void* data)
118 {
119 static uint64_t lastns;
120 DISPLAY_TEST_LOGE("seq %{public}d ns %" PRId64 " duration %" PRId64 " ns", sequence, ns, (ns - lastns));
121 lastns = ns;
122 VblankCtr::GetInstance().NotifyVblank(sequence, ns, data);
123 }
124
AdjustLayerSettings(std::vector<LayerSettings> & settings,uint32_t w,uint32_t h)125 static void AdjustLayerSettings(std::vector<LayerSettings> &settings, uint32_t w, uint32_t h)
126 {
127 DISPLAY_TEST_LOGE();
128 for (uint32_t i = 0; i < settings.size(); i++) {
129 LayerSettings& setting = settings[i];
130 DISPLAY_TEST_LOGE(" ratio w: %f ratio h: %f", setting.rectRatio.w, setting.rectRatio.h);
131 if ((setting.rectRatio.w > 0.0f) && (setting.rectRatio.h > 0.0f)) {
132 setting.displayRect.h = static_cast<uint32_t>(setting.rectRatio.h * h);
133 setting.displayRect.w = static_cast<uint32_t>(setting.rectRatio.w * w);
134 setting.displayRect.x = static_cast<uint32_t>(setting.rectRatio.x * w);
135 setting.displayRect.y = static_cast<uint32_t>(setting.rectRatio.y * h);
136 DISPLAY_TEST_LOGE("display rect adust form %f %f %f %f to %{public}d %{public}d %{public}d %{public}d ",
137 setting.rectRatio.x, setting.rectRatio.y, setting.rectRatio.w, setting.rectRatio.h, setting.displayRect.x,
138 setting.displayRect.y, setting.displayRect.w, setting.displayRect.h);
139 }
140
141 if ((setting.bufferRatio.h > 0.0f) || (setting.bufferRatio.w > 0.0f)) {
142 setting.bufferSize.h = static_cast<uint32_t>(setting.bufferRatio.h * h);
143 setting.bufferSize.w = static_cast<uint32_t>(setting.bufferRatio.w * w);
144 DISPLAY_TEST_LOGE("buffer size adjust for %f %f to %{public}d %{public}d",
145 setting.bufferRatio.w, setting.bufferRatio.h, setting.bufferSize.w, setting.bufferSize.h);
146 }
147
148 if ((setting.bufferSize.w == 0) || (setting.bufferSize.h == 0)) {
149 DISPLAY_TEST_LOGE("buffer size adjust for %{public}d %{public}d to %{public}d %{public}d",
150 setting.bufferSize.w, setting.bufferSize.h, setting.displayRect.w, setting.displayRect.h);
151
152 setting.bufferSize.w = setting.displayRect.w;
153 setting.bufferSize.h = setting.displayRect.h;
154 }
155 }
156 }
157
CreateLayers(std::vector<LayerSettings> & settings)158 static std::vector<std::shared_ptr<HdiTestLayer>> CreateLayers(std::vector<LayerSettings> &settings)
159 {
160 DISPLAY_TEST_LOGE("settings %{public}zd", settings.size());
161 std::vector<std::shared_ptr<HdiTestLayer>> layers;
162 DisplayModeInfo mode = GetFirstDisplay()->GetCurrentMode();
163 AdjustLayerSettings(settings, mode.width, mode.height);
164 for (uint32_t i = 0; i < settings.size(); i++) {
165 LayerSettings setting = settings[i];
166
167 auto layer = CreateTestLayer(setting, i);
168 layers.push_back(layer);
169 }
170
171 return layers;
172 }
173
PresentAndCheck(std::vector<LayerSettings> & layerSettings,uint32_t checkType=HdiCompositionCheck::CHECK_VERTEX)174 static inline void PresentAndCheck(std::vector<LayerSettings> &layerSettings,
175 uint32_t checkType = HdiCompositionCheck::CHECK_VERTEX)
176 {
177 int ret = PrepareAndCommit();
178 ASSERT_TRUE((ret == DISPLAY_SUCCESS));
179 if ((GetFirstDisplay()->SnapShot()) != nullptr) {
180 HdiTestDevice::GetInstance().GetGrallocInterface()->InvalidateCache(*(GetFirstDisplay()->SnapShot()));
181 ret = CheckComposition(layerSettings, GetFirstDisplay()->SnapShot(), checkType);
182 ASSERT_TRUE((ret == DISPLAY_SUCCESS));
183 }
184 }
185
DestroyLayer(std::shared_ptr<HdiTestLayer> layer)186 static void DestroyLayer(std::shared_ptr<HdiTestLayer> layer)
187 {
188 std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_CONT_100));
189 auto ret = g_composerDevice->DestroyLayer(g_displayIds[0], layer->GetId());
190 if (ret != DISPLAY_SUCCESS && ret != DISPLAY_NOT_SUPPORT) {
191 DISPLAY_TEST_LOGE("DestroyLayer fail or not support, ret: %{public}d", ret);
192 return;
193 }
194 std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_CONT_100));
195 }
196
SetUpTestCase()197 void DeviceTest::SetUpTestCase()
198 {
199 int ret = HdiTestDevice::GetInstance().InitDevice();
200 ASSERT_TRUE(ret == DISPLAY_SUCCESS);
201
202 g_composerDevice = HdiTestDevice::GetInstance().GetDeviceInterface();
203 ASSERT_TRUE(g_composerDevice != nullptr);
204
205 g_gralloc.reset(IDisplayBuffer::Get());
206 ASSERT_TRUE(g_gralloc != nullptr);
207
208 g_displayIds = HdiTestDevice::GetInstance().GetDevIds();
209 ASSERT_TRUE(g_displayIds.size() > 0);
210 }
211
TearDownTestCase()212 void DeviceTest::TearDownTestCase()
213 {
214 HdiTestDevice::GetInstance().Clear();
215 HdiTestDevice::GetInstance().GetFirstDisplay()->ResetClientLayer();
216 }
217
NotifyVblank(unsigned int sequence,uint64_t ns,const void * data)218 void VblankCtr::NotifyVblank(unsigned int sequence, uint64_t ns, const void* data)
219 {
220 DISPLAY_TEST_LOGE();
221 if (data != nullptr) {
222 DISPLAY_TEST_LOGE("sequence = %{public}u, ns = %" PRIu64 "", sequence, ns);
223 }
224 std::unique_lock<std::mutex> lg(vblankMutex_);
225 hasVblank_ = true;
226 vblankCondition_.notify_one();
227 DISPLAY_TEST_LOGE();
228 }
229
~VblankCtr()230 VblankCtr::~VblankCtr() {}
231
WaitVblank(uint32_t ms)232 int32_t VblankCtr::WaitVblank(uint32_t ms)
233 {
234 bool ret = false;
235 DISPLAY_TEST_LOGE();
236 std::unique_lock<std::mutex> lck(vblankMutex_);
237 ret = vblankCondition_.wait_for(lck, std::chrono::milliseconds(ms), [=] { return hasVblank_; });
238 DISPLAY_TEST_LOGE();
239 if (!ret) {
240 return DISPLAY_FAILURE;
241 }
242 return DISPLAY_SUCCESS;
243 }
244
245 /**
246 * @tc.number: SUB_Driver_Display_HDI_4600
247 * @tc.name: test_SetClientBufferCacheCount
248 * @tc.desc: test cache count Random
249 * @tc.size: MediumTest
250 * @tc.type: Function
251 */
252 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_4600, TestSize.Level1)
253 {
254 const uint32_t CACHE_COUNT = 5;
255 auto ret = g_composerDevice->SetClientBufferCacheCount(g_displayIds[0], CACHE_COUNT);
256 EXPECT_EQ(DISPLAY_SUCCESS, ret);
257 }
258
259 /**
260 * @tc.number: SUB_Driver_Display_HDI_4700
261 * @tc.name: test_GetDisplayCapability
262 * @tc.desc: Obtains the display modes supported by a display device
263 * @tc.size: MediumTest
264 * @tc.type: Function
265 */
266 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_4700, TestSize.Level1)
267 {
268 DisplayCapability info;
269 auto ret = g_composerDevice->GetDisplayCapability(g_displayIds[0], info);
270 EXPECT_EQ(DISPLAY_SUCCESS, ret);
271 }
272
273 /**
274 * @tc.number: SUB_Driver_Display_HDI_4800
275 * @tc.name: test_GetDisplaySupportedModes
276 * @tc.desc: Obtains the current display mode of a display device
277 * @tc.size: MediumTest
278 * @tc.type: Function
279 */
280 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_4800, TestSize.Level1)
281 {
282 std::vector<DisplayModeInfo> modes;
283 auto ret = g_composerDevice->GetDisplaySupportedModes(g_displayIds[0], modes);
284 EXPECT_EQ(DISPLAY_SUCCESS, ret);
285 }
286
287 /**
288 * @tc.number: SUB_Driver_Display_HDI_4900
289 * @tc.name: test_GetDisplayMode
290 * @tc.desc: Get the pattern with pattern ID 0
291 * @tc.size: MediumTest
292 * @tc.type: Function
293 */
294 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_4900, TestSize.Level1)
295 {
296 uint32_t MODE = 0;
297 auto ret = g_composerDevice->GetDisplayMode(g_displayIds[0], MODE);
298 EXPECT_EQ(DISPLAY_SUCCESS, ret);
299 }
300
301 /**
302 * @tc.number: SUB_Driver_Display_HDI_5000
303 * @tc.name: test_SetDisplayMode
304 * @tc.desc: Set the display mode ID to 0
305 * @tc.size: MediumTest
306 * @tc.type: Function
307 */
308 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_5000, TestSize.Level1)
309 {
310 const uint32_t MODE = 0;
311 auto ret = g_composerDevice->SetDisplayMode(g_displayIds[0], MODE);
312 EXPECT_EQ(DISPLAY_SUCCESS, ret);
313 }
314
315 /**
316 * @tc.number: SUB_Driver_Display_HDI_5100
317 * @tc.name: test_GetDisplayPowerStatus
318 * @tc.desc: Set the power status of the display device POWER_STATUS_OFF
319 * @tc.size: MediumTest
320 * @tc.type: Function
321 */
322 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_5100, TestSize.Level1)
323 {
324 Composer::V1_0::DispPowerStatus powerStatus = Composer::V1_0::DispPowerStatus::POWER_STATUS_OFF;
325 auto ret = g_composerDevice->GetDisplayPowerStatus(g_displayIds[0], powerStatus);
326 EXPECT_EQ(DISPLAY_SUCCESS, ret);
327 }
328
329 /**
330 * @tc.number: SUB_Driver_Display_HDI_5200
331 * @tc.name: test_SetDisplayPowerStatus_001
332 * @tc.desc: Set the power status of the display device
333 * @tc.size: MediumTest
334 * @tc.type: Function
335 */
336 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_5200, TestSize.Level1)
337 {
338 auto ret = g_composerDevice->SetDisplayPowerStatus(g_displayIds[0],
339 Composer::V1_0::DispPowerStatus::POWER_STATUS_STANDBY);
340 EXPECT_EQ(DISPLAY_SUCCESS, ret);
341
342 ret = g_composerDevice->SetDisplayPowerStatus(g_displayIds[0],
343 Composer::V1_0::DispPowerStatus::POWER_STATUS_ON);
344 EXPECT_EQ(DISPLAY_SUCCESS, ret);
345 }
346
347 /**
348 * @tc.number: SUB_Driver_Display_HDI_5300
349 * @tc.name: test_GetDisplayBacklight
350 * @tc.desc: Set the backlight value of the display device to leve1
351 * @tc.size: MediumTest
352 * @tc.type: Function
353 */
354 #ifdef DISPLAY_COMMUNITY
355 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_5300, TestSize.Level1)
356 {
357 uint32_t level;
358 auto ret = g_composerDevice->GetDisplayBacklight(g_displayIds[0], level);
359 EXPECT_EQ(DISPLAY_SUCCESS, ret);
360 }
361 #endif
362
363 /**
364 * @tc.number: SUB_Driver_Display_HDI_5400
365 * @tc.name: test_SetDisplayBacklight
366 * @tc.desc: Sets the backlight value for a display device
367 * @tc.size: MediumTest
368 * @tc.type: Function
369 */
370 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_5400, TestSize.Level1)
371 {
372 const uint32_t LEVEL = 10;
373 auto ret = g_composerDevice->SetDisplayBacklight(g_displayIds[0], LEVEL);
374 EXPECT_EQ(DISPLAY_SUCCESS, ret);
375 }
376
377 /**
378 * @tc.number: SUB_Driver_Display_HDI_5500
379 * @tc.name: test_GetDisplayProperty
380 * @tc.desc: Obtains the property for a display device
381 * @tc.size: MediumTest
382 * @tc.type: Function
383 */
384 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_5500, TestSize.Level1)
385 {
386 const uint32_t PROPERTY_ID = 1;
387 uint64_t propertyValue = 0;
388 auto ret = g_composerDevice->GetDisplayProperty(g_displayIds[0], PROPERTY_ID, propertyValue);
389 #ifdef DISPLAY_COMMUNITY
390 EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
391 #else
392 if (ret == DISPLAY_NOT_SUPPORT) {
393 DISPLAY_TEST_LOGE("GetDisplayProperty not support");
394 return;
395 }
396 EXPECT_EQ(DISPLAY_SUCCESS, ret);
397 #endif
398 }
399
400 /**
401 * @tc.number: SUB_Driver_Display_HardWare_0100
402 * @tc.name: test_UpdateHardwareCursor
403 * @tc.desc: Set Hard Cursor Position
404 * @tc.size: MediumTest
405 * @tc.type: Function
406 */
407 HWTEST_F(DeviceTest, SUB_Driver_Display_HardWare_0100, TestSize.Level1)
408 {
409 BufferHandle* buffer = nullptr;
410 const int32_t WIDTH = 512;
411 const int32_t HEIGHT = 512;
412
413 AllocInfo info;
414 info.width = WIDTH;
415 info.height = HEIGHT;
416 info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_MEM_DMA |
417 OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_READ |
418 OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE |
419 OHOS::HDI::Display::Composer::V1_0::HBM_USE_HW_COMPOSER;
420 info.format = Composer::V1_0::PIXEL_FMT_RGBA_8888;
421
422 g_gralloc->AllocMem(info, buffer);
423 ASSERT_TRUE(buffer != nullptr);
424
425 std::vector<LayerSettings> settings = {
426 {.rectRatio = { 0, 0, 1.0f, 1.0f }, .color = RED},
427 };
428
429 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
430 ASSERT_TRUE((layers.size() > 0));
431
432 auto layer = layers[0];
433 PrepareAndCommit();
434 sleep(1);
435 HdiTestDevice::GetInstance().Clear();
436 DestroyLayer(layer);
437
438 int32_t x = 1;
439 int32_t y = 1;
440 auto ret = g_composerDevice->UpdateHardwareCursor(g_displayIds[0], x, y, buffer);
441 g_gralloc->FreeMem(*buffer);
442 #ifdef DISPLAY_COMMUNITY
443 EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
444 #else
445 if (ret == DISPLAY_NOT_SUPPORT) {
446 DISPLAY_TEST_LOGE("UpdateHardwareCursor not support");
447 return;
448 }
449 EXPECT_EQ(DISPLAY_SUCCESS, ret);
450 #endif
451 }
452
453 /**
454 * @tc.number: SUB_Driver_Display_HardWare_0200
455 * @tc.name: test_EnableHardwareCursorStats
456 * @tc.desc: Enable hardware cursor statistics
457 * @tc.size: MediumTest
458 * @tc.type: Function
459 */
460 HWTEST_F(DeviceTest, SUB_Driver_Display_HardWare_0200, TestSize.Level1)
461 {
462 bool enable = true;
463 auto ret = g_composerDevice->EnableHardwareCursorStats(g_displayIds[0], enable);
464 #ifdef DISPLAY_COMMUNITY
465 EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
466 #else
467 if (ret == DISPLAY_NOT_SUPPORT) {
468 DISPLAY_TEST_LOGE("EnableHardwareCursorStats not support");
469 return;
470 }
471 EXPECT_EQ(DISPLAY_SUCCESS, ret);
472 #endif
473 }
474
475 /**
476 * @tc.number: SUB_Driver_Display_HardWare_0300
477 * @tc.name: test_GetHardwareCursorStats
478 * @tc.desc: Obtains hardware cursor statistics.
479 * @tc.size: MediumTest
480 * @tc.type: Function
481 */
482 HWTEST_F(DeviceTest, SUB_Driver_Display_HardWare_0300, TestSize.Level1)
483 {
484 uint32_t frameCount = 0;
485 uint32_t vsyncCount = 0;
486 auto ret = g_composerDevice->GetHardwareCursorStats(g_displayIds[0], frameCount, vsyncCount);
487 #ifdef DISPLAY_COMMUNITY
488 EXPECT_EQ(DISPLAY_NOT_SUPPORT, ret);
489 #else
490 if (ret == DISPLAY_NOT_SUPPORT) {
491 DISPLAY_TEST_LOGE("GetHardwareCursorStats not support");
492 return;
493 }
494 EXPECT_EQ(DISPLAY_SUCCESS, ret);
495 #endif
496 }
497
498 /**
499 * @tc.number: SUB_Driver_Display_HDI_5600
500 * @tc.name: test_GetDisplayCompChange
501 * @tc.desc: Obtains the layers whose composition types have changed
502 * @tc.size: MediumTest
503 * @tc.type: Function
504 */
505 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_5600, TestSize.Level1)
506 {
507 std::vector<uint32_t> layers {};
508 std::vector<int32_t> type {};
509 auto ret = g_composerDevice->GetDisplayCompChange(g_displayIds[0], layers, type);
510 EXPECT_EQ(DISPLAY_SUCCESS, ret);
511 }
512
513 /**
514 * @tc.number: SUB_Driver_Display_HDI_5700
515 * @tc.name: test_SetDisplayClientCrop
516 * @tc.desc: Sets the cropped region for a display device
517 * @tc.size: MediumTest
518 * @tc.type: Function
519 */
520 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_5700, TestSize.Level1)
521 {
522 const int32_t WIDTH = 1920;
523 const int32_t HEIGHT = 1080;
524 IRect rect = {0, 0, WIDTH, HEIGHT};
525 auto ret = g_composerDevice->SetDisplayClientCrop(g_displayIds[0], rect);
526 // not support
527 EXPECT_EQ(DISPLAY_FAILURE, ret);
528 }
529
530 /**
531 * @tc.number: SUB_Driver_Display_HDI_5800
532 * @tc.name: test_GetDisplayReleaseFence
533 * @tc.desc: Obtains the fences of the display layers after the commit operation
534 * @tc.size: MediumTest
535 * @tc.type: Function
536 */
537 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_5800, TestSize.Level1)
538 {
539 std::vector<uint32_t> layers {};
540 std::vector<int32_t> fences {};
541 auto ret = g_composerDevice->GetDisplayReleaseFence(g_displayIds[0], layers, fences);
542 EXPECT_EQ(DISPLAY_SUCCESS, ret);
543 }
544
545 /**
546 * @tc.number: SUB_Driver_Display_HDI_5900
547 * @tc.name: test_SetDisplayClientBuffer
548 * @tc.desc: Sets the display buffer for a display device
549 * @tc.size: MediumTest
550 * @tc.type: Function
551 */
552 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_5900, TestSize.Level1)
553 {
554 BufferHandle* buffer = nullptr;
555 const int32_t WIDTH = 800;
556 const int32_t HEIGHT = 600;
557
558 AllocInfo info;
559 info.width = WIDTH;
560 info.height = HEIGHT;
561 info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_MEM_DMA |
562 OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_READ |
563 OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE;
564 info.format = Composer::V1_0::PIXEL_FMT_RGBA_8888;
565
566 g_gralloc->AllocMem(info, buffer);
567 ASSERT_TRUE(buffer != nullptr);
568
569 uint32_t bufferSeq = 1;
570 auto ret = g_composerDevice->SetDisplayClientBuffer(g_displayIds[0], buffer, bufferSeq, -1);
571 g_gralloc->FreeMem(*buffer);
572 EXPECT_EQ(DISPLAY_SUCCESS, ret);
573 }
574
575 /**
576 * @tc.number: SUB_Driver_Display_HDI_6000
577 * @tc.name: test_SetDisplayClientDamage
578 * @tc.desc: Sets the dirty region for a display device
579 * @tc.size: MediumTest
580 * @tc.type: Function
581 */
582 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_6000, TestSize.Level1)
583 {
584 const int32_t WIDTH = 1920;
585 const int32_t HEIGHT = 1080;
586 IRect rect = {0, 0, WIDTH, HEIGHT};
587 std::vector<IRect> vRects;
588 vRects.push_back(rect);
589 auto ret = g_composerDevice->SetDisplayClientDamage(g_displayIds[0], vRects);
590 // not support
591 EXPECT_EQ(DISPLAY_SUCCESS, ret);
592 }
593
594 /**
595 * @tc.number: SUB_Driver_Display_HDI_6100
596 * @tc.name: test_CreateVirtualDisplay
597 * @tc.desc: Creates a virtual display device
598 * @tc.size: MediumTest
599 * @tc.type: Function
600 */
601 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_6100, TestSize.Level1)
602 {
603 const uint32_t WIDTH = 1920;
604 const uint32_t HEIGHT = 1080;
605 int32_t format = 0;
606 uint32_t devId = 0;
607 auto ret = g_composerDevice->CreateVirtualDisplay(WIDTH, HEIGHT, format, devId);
608 // not support
609 EXPECT_EQ(DISPLAY_FAILURE, ret);
610 }
611
612 /**
613 * @tc.number: SUB_Driver_Display_HDI_6200
614 * @tc.name: test_DestroyVirtualDisplay
615 * @tc.desc: UpdateSettings, OHOS_CONTROL_AE_MODE
616 * @tc.size: MediumTest
617 * @tc.type: Function
618 */
619 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_6200, TestSize.Level1)
620 {
621 uint32_t devId = 0;
622 auto ret = g_composerDevice->DestroyVirtualDisplay(devId);
623 // not support
624 EXPECT_EQ(DISPLAY_FAILURE, ret);
625 }
626
627 /**
628 * @tc.number: SUB_Driver_Display_HDI_6300
629 * @tc.name: test_SetVirtualDisplayBuffer
630 * @tc.desc: Destroys a virtual display device
631 * @tc.size: MediumTest
632 * @tc.type: Function
633 */
634 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_6300, TestSize.Level1)
635 {
636 BufferHandle* buffer = nullptr;
637 int32_t fence = -1;
638 const int32_t WIDTH = 800;
639 const int32_t HEIGHT = 600;
640
641 AllocInfo info;
642 info.width = WIDTH;
643 info.height = HEIGHT;
644 info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_MEM_DMA |
645 OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_READ |
646 OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE;
647 info.format = Composer::V1_0::PIXEL_FMT_RGBA_8888;
648
649 g_gralloc->AllocMem(info, buffer);
650 ASSERT_TRUE(buffer != nullptr);
651
652 auto ret = g_composerDevice->SetVirtualDisplayBuffer(g_displayIds[0], *buffer, fence);
653 g_gralloc->FreeMem(*buffer);
654 // not support
655 EXPECT_EQ(DISPLAY_FAILURE, ret);
656 }
657
658 /**
659 * @tc.number: SUB_Driver_Display_HDI_6400
660 * @tc.name: test_SetDisplayProperty
661 * @tc.desc: Sets the property for a display device
662 * @tc.size: MediumTest
663 * @tc.type: Function
664 */
665 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_6400, TestSize.Level1)
666 {
667 const uint32_t PROPERTY_ID = 1;
668 const uint64_t PROPERTY_VALUE = 0;
669 auto ret = g_composerDevice->SetDisplayProperty(g_displayIds[0], PROPERTY_ID, PROPERTY_VALUE);
670 // not support
671 EXPECT_EQ(DISPLAY_FAILURE, ret);
672 }
673
674 /**
675 * @tc.number: SUB_Driver_Display_HDI_6500
676 * @tc.name: test_SetLayerCrop
677 * @tc.desc: Sets the rectangular area to crop for a layer, Please note that failing to save the composite
678 * data using clientLayer during display HDI adaptation image synthesis will cause this use case to fail
679 * @tc.size: MediumTest
680 * @tc.type: Function
681 */
682 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_6500, TestSize.Level1)
683 {
684 std::vector<LayerSettings> settings = {
685 {
686 .rectRatio = { 0, 0, 1.0f, 1.0f },
687 .color = RED
688 },
689 };
690 std::vector<uint32_t> splitColors = { { RED, GREEN, YELLOW, BLUE, PINK, PURPLE, CYAN, TRANSPARENT } };
691
692 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
693 ASSERT_TRUE((layers.size() > 0));
694 // split the buffer
695 auto layer = layers[0];
696 HdiGrallocBuffer* handle = layer->GetBackBuffer(); // the backbuffer has not present now
697 ASSERT_TRUE((handle != nullptr));
698 auto splitRects = SplitBuffer(*(handle->Get()), splitColors);
699 PrepareAndCommit();
700 for (uint32_t i = 0; i < splitRects.size(); i++) {
701 settings[0].color = splitColors[i];
702 layer->SetLayerCrop(splitRects[i]);
703 PresentAndCheck(settings);
704 }
705
706 DestroyLayer(layer);
707 }
708
709 /**
710 * @tc.number: SUB_Driver_Display_HDI_6600
711 * @tc.name: test_SetLayerZorder
712 * @tc.desc: Sets the z-order for a layer, Please note that failing to save the composite data
713 * using clientLayer during display HDI adaptation image synthesis will cause this use case to fail
714 * @tc.size: MediumTest
715 * @tc.type: Function
716 */
717 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_6600, TestSize.Level1)
718 {
719 std::vector<LayerSettings> settings = {
720 {
721 .rectRatio = { 0, 0, 1.0f, 1.0f },
722 .color = RED
723 },
724 {
725 .rectRatio = { 0, 0, 1.0f, 1.0f },
726 .color = GREEN
727 },
728 {
729 .rectRatio = { 0, 0, 1.0f, 1.0f },
730 .color = YELLOW
731 },
732 };
733
734 std::vector<std::vector<int>> zorders = {
735 { 3, 2, 1 }, { 1, 3, 2 }, { 3, 1, 2 }, { 1, 2, 3 }, { 2, 1, 3 }, { 2, 3, 1 },
736 };
737 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
738
739 for (const auto& zorderList : zorders) {
740 // adjust the zorder
741 for (uint32_t i = 0; i < zorderList.size(); i++) {
742 settings[i].zorder = zorderList[i];
743 layers[i]->SetZorder(zorderList[i]);
744 }
745 std::vector<LayerSettings> tempSettings = settings;
746 std::sort(tempSettings.begin(), tempSettings.end(),
__anonea52b2c60202(const auto& l, auto const & r) 747 [=](const auto& l, auto const & r) { return l.zorder < r.zorder; });
748 // present and check
749 PresentAndCheck(tempSettings);
750 }
751 HdiTestDevice::GetInstance().Clear();
752 }
753
754 /**
755 * @tc.number: SUB_Driver_Display_HDI_6700
756 * @tc.name: test_SetLayerPreMulti
757 * @tc.desc: Sets layer premultiplication
758 * @tc.size: MediumTest
759 * @tc.type: Function
760 */
761 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_6700, TestSize.Level1)
762 {
763 std::vector<LayerSettings> settings = {
764 {
765 .rectRatio = { 0, 0, 1.0f, 1.0f },
766 .color = GREEN
767 },
768 };
769
770 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
771 ASSERT_TRUE((layers.size() > 0));
772 PrepareAndCommit();
773
774 auto layer = layers[0];
775 bool preMul = true;
776 auto ret = g_composerDevice->SetLayerPreMulti(g_displayIds[0], layer->GetId(), preMul);
777
778 PrepareAndCommit();
779 HdiTestDevice::GetInstance().Clear();
780 EXPECT_EQ(DISPLAY_SUCCESS, ret);
781
782 DestroyLayer(layer);
783 }
784
785 /**
786 * @tc.number: SUB_Driver_Display_HDI_6800
787 * @tc.name: test_SetLayerAlpha
788 * @tc.desc: Sets the alpha value for a layer
789 * @tc.size: MediumTest
790 * @tc.type: Function
791 */
792 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_6800, TestSize.Level1)
793 {
794 std::vector<LayerSettings> settings = {
795 {
796 .rectRatio = { 0, 0, 1.0f, 1.0f },
797 .color = GREEN
798 },
799 {
800 .rectRatio = { 0, 0, 1.0f, 1.0f },
801 .color = RED
802 },
803 };
804
805 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
806 ASSERT_TRUE((layers.size() > 0));
807
808 auto layer = layers[1];
809 LayerAlpha alpha = { 0 };
810 alpha.enGlobalAlpha = true;
811 alpha.enPixelAlpha = true;
812 alpha.gAlpha = 0;
813 alpha.alpha0 = 0;
814 alpha.alpha1 = 0;
815 layer->SetAlpha(alpha);
816
817 PrepareAndCommit();
818 HdiTestDevice::GetInstance().Clear();
819
820 DestroyLayer(layer);
821 }
822
823 /**
824 * @tc.number: SUB_Driver_Display_HDI_6900
825 * @tc.name: test_SetLayerRegion
826 * @tc.desc: Sets the region for a layer
827 * @tc.size: MediumTest
828 * @tc.type: Function
829 */
830 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_6900, TestSize.Level1)
831 {
832 std::vector<LayerSettings> settings = {
833 {.rectRatio = {0, 0, 1.0f, 1.0f}, .color = GREEN, .alpha = 0xFF}
834 };
835
836 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
837 ASSERT_TRUE((layers.size() > 0));
838
839 const int32_t WIDTH = 100;
840 const int32_t HEIGHT = 100;
841 auto layer = layers[0];
842 IRect rect = {0, 0, WIDTH, HEIGHT};
843 auto ret = g_composerDevice->SetLayerRegion(g_displayIds[0], layer->GetId(), rect);
844
845 PrepareAndCommit();
846 EXPECT_EQ(DISPLAY_SUCCESS, ret);
847
848 DestroyLayer(layer);
849 }
850
851 /**
852 * @tc.number: SUB_Driver_Display_HDI_7000
853 * @tc.name: test_SetLayerDirtyRegion
854 * @tc.desc: Sets the flushing area for a layer
855 * @tc.size: MediumTest
856 * @tc.type: Function
857 */
858 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_7000, TestSize.Level1)
859 {
860 std::vector<LayerSettings> settings = {
861 {
862 .rectRatio = { 0, 0, 1.0f, 1.0f },
863 .color = BLUE
864 }
865 };
866
867 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
868 ASSERT_TRUE((layers.size() > 0));
869
870 auto layer = layers[0];
871
872 const int32_t WIDTH = 100;
873 const int32_t HEIGHT = 100;
874 IRect rect = {0, 0, WIDTH, HEIGHT};
875 std::vector<IRect> vRects;
876 vRects.push_back(rect);
877 auto ret = g_composerDevice->SetLayerDirtyRegion(g_displayIds[0], layer->GetId(), vRects);
878
879 PrepareAndCommit();
880 HdiTestDevice::GetInstance().Clear();
881
882 EXPECT_EQ(DISPLAY_SUCCESS, ret);
883
884 DestroyLayer(layer);
885 }
886
887 /**
888 * @tc.number: SUB_Driver_Display_HDI_7100
889 * @tc.name: test_SetLayerTransformMode_001
890 * @tc.desc: Sets the type of graphic rotation
891 * @tc.size: MediumTest
892 * @tc.type: Function
893 */
894 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_7100, TestSize.Level1)
895 {
896 std::vector<LayerSettings> settings = {
897 {
898 .rectRatio = { 0, 0, 1.0f, 1.0f },
899 .color = RED
900 }
901 };
902
903 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
904 ASSERT_TRUE((layers.size() > 0));
905
906 PrepareAndCommit();
907
908 auto layer = layers[0];
909
910 TransformType type = TransformType::ROTATE_90;
911 auto ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
912 PrepareAndCommit();
913
914 type = TransformType::ROTATE_180;
915 ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
916 PrepareAndCommit();
917
918 type = TransformType::ROTATE_270;
919 ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
920 PrepareAndCommit();
921
922 EXPECT_EQ(DISPLAY_SUCCESS, ret);
923
924 DestroyLayer(layer);
925 }
926
927 /**
928 * @tc.number: SUB_Driver_Display_HDI_7200
929 * @tc.name: test_SetLayerVisibleRegion
930 * @tc.desc: Set the visible region for a layer
931 * @tc.size: MediumTest
932 * @tc.type: Function
933 */
934 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_7200, TestSize.Level1)
935 {
936 std::vector<LayerSettings> settings = {
937 {
938 .rectRatio = { 0, 0, 1.0f, 1.0f },
939 .color = BLUE
940 }
941 };
942
943 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
944 ASSERT_TRUE((layers.size() > 0));
945 PrepareAndCommit();
946 auto layer = layers[0];
947
948 const int32_t WIDTH = 500;
949 const int32_t HEIGHT = 500;
950 IRect region = {0, 0, WIDTH, HEIGHT};
951 std::vector<IRect> regions = {};
952 regions.push_back(region);
953 auto ret = g_composerDevice->SetLayerVisibleRegion(g_displayIds[0], layer->GetId(), regions);
954 PrepareAndCommit();
955
956 EXPECT_EQ(DISPLAY_SUCCESS, ret);
957
958 DestroyLayer(layer);
959 }
960
961 /**
962 * @tc.number: SUB_Driver_Display_HDI_7300
963 * @tc.name: test_SetLayerBuffer
964 * @tc.desc: Set the buffer for a layer
965 * @tc.size: MediumTest
966 * @tc.type: Function
967 */
968 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_7300, TestSize.Level1)
969 {
970 std::vector<LayerSettings> settings = {
971 {
972 .rectRatio = { 0, 0, 1.0f, 1.0f },
973 .color = GREEN
974 }
975 };
976
977 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
978 ASSERT_TRUE((layers.size() > 0));
979
980 auto layer = layers[0];
981
982 auto graphicBuffer = layer->AcquireBackBuffer();
__anonea52b2c60302(const BufferHandle* buffer, uint32_t seqNo) 983 int32_t ret = graphicBuffer->SetGraphicBuffer([&](const BufferHandle* buffer, uint32_t seqNo) -> int32_t {
984 std::vector<uint32_t> deletingList;
985 int32_t result = g_composerDevice->SetLayerBuffer(g_displayIds[0], layer->GetId(), buffer, seqNo, -1,
986 deletingList);
987 return result;
988 });
989 PrepareAndCommit();
990
991 EXPECT_EQ(DISPLAY_SUCCESS, ret);
992
993 DestroyLayer(layer);
994 }
995
996 /**
997 * @tc.number: SUB_Driver_Display_HDI_7400
998 * @tc.name: test_SetLayerCompositionType_001
999 * @tc.desc: set the composition type which the client expect
1000 * @tc.size: MediumTest
1001 * @tc.type: Function
1002 */
1003 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_7400, TestSize.Level1)
1004 {
1005 std::vector<LayerSettings> settings = {
1006 {
1007 .rectRatio = { 0, 0, 1.0f, 1.0f },
1008 .color = BLUE
1009 }
1010 };
1011
1012 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1013 ASSERT_TRUE((layers.size() > 0));
1014
1015 auto layer = layers[0];
1016
1017 Composer::V1_0::CompositionType type = Composer::V1_0::CompositionType::COMPOSITION_CLIENT;
1018 auto ret = g_composerDevice->SetLayerCompositionType(g_displayIds[0], layer->GetId(), type);
1019
1020 PrepareAndCommit();
1021
1022 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1023
1024 DestroyLayer(layer);
1025 }
1026
1027 /**
1028 * @tc.number: SUB_Driver_Display_HDI_7500
1029 * @tc.name: test_SetLayerBlendType_001
1030 * @tc.desc: Set the blend type to BLEND-NONE
1031 * @tc.size: MediumTest
1032 * @tc.type: Function
1033 */
1034 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_7500, TestSize.Level1)
1035 {
1036 std::vector<LayerSettings> settings = {
1037 {
1038 .rectRatio = { 0, 0, 1.0f, 1.0f },
1039 .color = GREEN
1040 }
1041 };
1042
1043 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1044 ASSERT_TRUE((layers.size() > 0));
1045
1046 auto layer = layers[0];
1047
1048 BlendType type = BlendType::BLEND_NONE;
1049 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1050
1051 PrepareAndCommit();
1052
1053 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1054
1055 DestroyLayer(layer);
1056 }
1057
1058 /**
1059 * @tc.number: SUB_Driver_Display_MaskInfo_0100
1060 * @tc.name: test_SetLayerMaskInfo_001
1061 * @tc.desc: Sets the current mask frame information to the vendor driver
1062 * @tc.size: MediumTest
1063 * @tc.type: Function
1064 */
1065 HWTEST_F(DeviceTest, SUB_Driver_Display_MaskInfo_0100, TestSize.Level1)
1066 {
1067 std::vector<LayerSettings> settings = {
1068 {
1069 .rectRatio = { 0, 0, 1.0f, 1.0f },
1070 .color = GREEN
1071 }
1072 };
1073
1074 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1075 ASSERT_TRUE((layers.size() > 0));
1076
1077 auto layer = layers[0];
1078
1079 MaskInfo maskInfo = MaskInfo::LAYER_HBM_SYNC;
1080 auto ret = g_composerDevice->SetLayerMaskInfo(g_displayIds[0], layer->GetId(), maskInfo);
1081
1082 PrepareAndCommit();
1083
1084 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1085
1086 DestroyLayer(layer);
1087 }
1088
1089 /**
1090 * @tc.number: SUB_Driver_Display_Luminance_0100
1091 * @tc.name: test_SetLayerColor
1092 * @tc.desc: Sets the solid color layer
1093 * @tc.size: MediumTest
1094 * @tc.type: Function
1095 */
1096 HWTEST_F(DeviceTest, SUB_Driver_Display_Luminance_0100, TestSize.Level1)
1097 {
1098 std::vector<LayerSettings> settings = {
1099 {
1100 .rectRatio = { 0, 0, 1.0f, 1.0f },
1101 .color = GREEN
1102 }
1103 };
1104
1105 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1106 ASSERT_TRUE((layers.size() > 0));
1107
1108 auto layer = layers[0];
1109 const uint32_t COLOR_R = 155;
1110 const uint32_t COLOR_G = 224;
1111 const uint32_t COLOR_B = 88;
1112 const uint32_t COLOR_A = 128;
1113
1114 LayerColor layerColor = {
1115 .r = COLOR_R,
1116 .g = COLOR_G,
1117 .b = COLOR_B,
1118 .a = COLOR_A
1119 };
1120
1121 auto ret = g_composerDevice->SetLayerColor(g_displayIds[0], layer->GetId(), layerColor);
1122
1123 PrepareAndCommit();
1124
1125 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1126
1127 DestroyLayer(layer);
1128 }
1129
1130 /**
1131 * @tc.number: SUB_Driver_Display_HDI_7600
1132 * @tc.name: test_DestroyLayer
1133 * @tc.desc: Closes a layer that is no longer required on a specified display device
1134 * @tc.size: MediumTest
1135 * @tc.type: Function
1136 */
1137 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_7600, TestSize.Level1)
1138 {
1139 std::vector<LayerSettings> settings = {
1140 {
1141 .rectRatio = { 0, 0, 1.0f, 1.0f },
1142 .color = PURPLE
1143 }
1144 };
1145
1146 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1147 ASSERT_TRUE((layers.size() > 0));
1148 auto layer = layers[0];
1149 PrepareAndCommit();
1150
1151 sleep(1);
1152 auto ret = g_composerDevice->DestroyLayer(g_displayIds[0], layer->GetId());
1153 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1154 std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_CONT_100));
1155 }
1156
1157 /**
1158 * @tc.number: SUB_Driver_Display_HDI_7700
1159 * @tc.name: test_RegDisplayVBlankCallback
1160 * @tc.desc: Registers the callback to be invoked when a VBLANK event occurs
1161 * @tc.size: MediumTest
1162 * @tc.type: Function
1163 */
1164 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_7700, TestSize.Level1)
1165 {
1166 int ret;
1167 DISPLAY_TEST_LOGE();
1168 std::shared_ptr<HdiTestDisplay> display = HdiTestDevice::GetInstance().GetFirstDisplay();
1169 ASSERT_TRUE(display != nullptr) << "get display failed";
1170 ret = display->RegDisplayVBlankCallback(TestVBlankCallback, nullptr);
1171 ASSERT_TRUE(ret == DISPLAY_SUCCESS) << "RegDisplayVBlankCallback failed";
1172 ret = display->SetDisplayVsyncEnabled(true);
1173 ASSERT_TRUE(ret == DISPLAY_SUCCESS) << "SetDisplayVsyncEnabled failed";
1174
1175 std::vector<LayerSettings> settings = {
1176 {
1177 .rectRatio = { 0, 0, 1.0f, 1.0f },
1178 .color = PINK
1179 },
1180 };
1181 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1182 ASSERT_TRUE((layers.size() > 0));
1183 VblankCtr::GetInstance().hasVblank_ = false;
1184 PrepareAndCommit();
1185 ret = VblankCtr::GetInstance().WaitVblank(SLEEP_CONT_100); // 100ms
1186 ASSERT_TRUE(ret == DISPLAY_SUCCESS) << "WaitVblank timeout";
1187 ret = display->SetDisplayVsyncEnabled(false);
1188 ASSERT_TRUE(ret == DISPLAY_SUCCESS) << "SetDisplayVsyncEnabled failed";
1189 usleep(SLEEP_CONT_100 * SLEEP_CONT_2000); // wait for 100ms avoid the last vsync.
1190 VblankCtr::GetInstance().hasVblank_ = false;
1191 ret = VblankCtr::GetInstance().WaitVblank(SLEEP_CONT_100); // 100ms
1192 ASSERT_TRUE(ret != DISPLAY_SUCCESS) << "vblank do not disable";
1193
1194 DestroyLayer(layers[0]);
1195 }
1196
OnMode(uint32_t modeId,uint64_t vBlankPeriod,void * data)1197 void DeviceTest::OnMode(uint32_t modeId, uint64_t vBlankPeriod, void* data)
1198 {
1199 g_isOnModeCalled = true;
1200 }
1201
OnSeamlessChange(uint32_t devId,void * data)1202 void DeviceTest::OnSeamlessChange(uint32_t devId, void* data)
1203 {
1204 g_isOnSeamlessChangeCalled = true;
1205 }
1206
1207 /**
1208 * @tc.number: SUB_Driver_Display_HDI_7800
1209 * @tc.name: test_GetDisplaySupportedModesExt
1210 * @tc.desc: Obtains the display modes supported by a display device
1211 * @tc.size: MediumTest
1212 * @tc.type: Function
1213 */
1214 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_7800, TestSize.Level1)
1215 {
1216 std::vector<DisplayModeInfoExt> modes;
1217 auto ret = g_composerDevice->GetDisplaySupportedModesExt(g_displayIds[0], modes);
1218 if (ret == DISPLAY_NOT_SUPPORT) {
1219 DISPLAY_TEST_LOGE("GetDisplaySupportedModesExt not support");
1220 return;
1221 }
1222 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1223 }
1224
1225 /**
1226 * @tc.number: SUB_Driver_Display_HDI_7900
1227 * @tc.name: test_SetDisplayModeAsync
1228 * @tc.desc: Sets the display mode of a display device
1229 * @tc.size: MediumTest
1230 * @tc.type: Function
1231 */
1232 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_7900, TestSize.Level1)
1233 {
1234 g_isOnModeCalled = false;
1235 std::vector<DisplayModeInfo> oldModes;
1236 std::vector<LayerSettings> settings = {
1237 {
1238 .rectRatio = { 0, 0, 1.0f, 1.0f },
1239 .color = RED
1240 }
1241 };
1242
1243 // 先注册VBlankCallback
1244 auto ret = g_composerDevice->RegDisplayVBlankCallback(g_displayIds[0], TestVBlankCallback, nullptr);
1245 ASSERT_TRUE(ret == DISPLAY_SUCCESS) << "RegDisplayVBlankCallback failed";
1246
1247 ret = g_composerDevice->GetDisplaySupportedModes(g_displayIds[0], oldModes);
1248 ASSERT_EQ(DISPLAY_SUCCESS, ret);
1249 ASSERT_EQ(oldModes.size() > 0, true);
1250
1251 uint32_t modeid = oldModes[0].id;
1252 ret = g_composerDevice->SetDisplayModeAsync(g_displayIds[0], modeid, OnMode);
1253 if (ret == DISPLAY_NOT_SUPPORT) {
1254 return;
1255 }
1256 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1257 if (ret == DISPLAY_SUCCESS) {
1258 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1259 ASSERT_TRUE((layers.size() > 0));
1260 g_threadCtrl = false;
1261 std::thread commitThread(LoopCommit);
1262 std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_CONT_100));
1263 g_threadCtrl = true;
1264 commitThread.join();
1265 ASSERT_EQ(g_isOnModeCalled, true);
1266
1267 DestroyLayer(layers[0]);
1268 }
1269 }
1270
1271 /**
1272 * @tc.number: SUB_Driver_Display_HDI_8000
1273 * @tc.name: test_GetDisplayVBlankPeriod
1274 * @tc.desc: Get the current vblank period
1275 * @tc.size: MediumTest
1276 * @tc.type: Function
1277 */
1278 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_8000, TestSize.Level1)
1279 {
1280 uint64_t period = 0;
1281 auto ret = g_composerDevice->GetDisplayVBlankPeriod(g_displayIds[0], period);
1282 if (ret == DISPLAY_NOT_SUPPORT) {
1283 DISPLAY_TEST_LOGE("GetDisplayVBlankPeriod not support");
1284 return;
1285 }
1286 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1287 EXPECT_EQ(period != 0, true);
1288 }
1289
1290 /**
1291 * @tc.number: SUB_Driver_Display_HDI_8100
1292 * @tc.name: test_RegSeamlessChangeCallback
1293 * @tc.desc: UpdateSettings, OHOS_CONTROL_AE_MODE
1294 * @tc.size: MediumTest
1295 * @tc.type: Function
1296 */
1297 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_8100, TestSize.Level1)
1298 {
1299 g_isOnSeamlessChangeCalled = false;
1300 auto ret = g_composerDevice->RegSeamlessChangeCallback(OnSeamlessChange, nullptr);
1301 if (ret == DISPLAY_NOT_SUPPORT) {
1302 DISPLAY_TEST_LOGE("RegSeamlessChangeCallback not support");
1303 return;
1304 }
1305 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1306 if (ret == DISPLAY_SUCCESS) {
1307 std::this_thread::sleep_for(std::chrono::milliseconds(5000));
1308 ASSERT_EQ(g_isOnSeamlessChangeCalled, true);
1309 }
1310 }
1311
1312 /**
1313 * @tc.number: SUB_Driver_Display_HDI_8200
1314 * @tc.name: test_SetLayerPerFrameParameter
1315 * @tc.desc: Sets parameter for the given layer
1316 * @tc.size: MediumTest
1317 * @tc.type: Function
1318 */
1319 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_8200, TestSize.Level1)
1320 {
1321 std::vector<LayerSettings> settings = {
1322 {
1323 .rectRatio = { 0, 0, 1.0f, 1.0f },
1324 .color = GREEN
1325 },
1326 };
1327
1328 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1329 ASSERT_TRUE((layers.size() > 0));
1330 auto layer = layers[0];
1331 std::vector<std::string> ValidKeys = { "FilmFilter", "ArsrDoEnhance", "SDRBrightnessRatio", "BrightnessNit",
1332 "ViewGroupHasValidAlpha", "SourceCropTuning" };
1333 std::string key;
1334 std::vector<int8_t> value = { 1 };
1335 key = "NotSupportKey";
1336 auto ret = g_composerDevice->SetLayerPerFrameParameter(g_displayIds[0], layer->GetId(), key, value);
1337 if (ret == DISPLAY_NOT_SUPPORT) {
1338 DISPLAY_TEST_LOGE("SetLayerPerFrameParameter not support");
1339 return;
1340 }
1341 ASSERT_EQ(ret, -1) << "key not support, ret:" << ret;
1342 key = ValidKeys[0];
1343 ret = g_composerDevice->SetLayerPerFrameParameter(g_displayIds[0], layer->GetId(), key, value);
1344 ASSERT_EQ(ret, 0) << "key support, ret:" << ret;
1345 if (ret == DISPLAY_NOT_SUPPORT) {
1346 DISPLAY_TEST_LOGE("SetLayerPerFrameParameter not support");
1347 return;
1348 }
1349 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1350 }
1351
1352 /**
1353 * @tc.number: SUB_Driver_Display_HDI_8300
1354 * @tc.name: test_GetSupportedLayerPerFrameParameterKey
1355 * @tc.desc: returns the list of supported parameter keys
1356 * @tc.size: MediumTest
1357 * @tc.type: Function
1358 */
1359 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_8300, TestSize.Level1)
1360 {
1361 std::vector<std::string> keys;
1362 auto ret = g_composerDevice->GetSupportedLayerPerFrameParameterKey(keys);
1363 if (ret == DISPLAY_NOT_SUPPORT) {
1364 DISPLAY_TEST_LOGE("GetSupportedLayerPerFrameParameterKey not support");
1365 return;
1366 }
1367 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1368 }
1369
1370 /**
1371 * @tc.number: SUB_Driver_Display_HDI_8400
1372 * @tc.name: test_SetDisplayOverlayResolution
1373 * @tc.desc: Sets parameter for the given layer
1374 * @tc.size: MediumTest
1375 * @tc.type: Function
1376 */
1377 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_8400, TestSize.Level1)
1378 {
1379 DisplayModeInfo mode = GetFirstDisplay()->GetCurrentMode();
1380 auto ret = g_composerDevice->SetDisplayOverlayResolution(g_displayIds[0], mode.width, mode.height);
1381 if (ret == DISPLAY_NOT_SUPPORT) {
1382 DISPLAY_TEST_LOGE("SetDisplayOverlayResolution not support");
1383 return;
1384 }
1385 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1386 }
1387
TestRefreshCallback(uint32_t devId,void * data)1388 static void TestRefreshCallback(uint32_t devId, void* data)
1389 {
1390 }
1391
1392 /**
1393 * @tc.number: SUB_Driver_Display_HDI_8500
1394 * @tc.name: test_RegRefreshCallback
1395 * @tc.desc: Registers the callback to be invoked when a refresh event occurs
1396 * @tc.size: MediumTest
1397 * @tc.type: Function
1398 */
1399 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_8500, TestSize.Level1)
1400 {
1401 auto ret = g_composerDevice->RegRefreshCallback(TestRefreshCallback, nullptr);
1402 if (ret == DISPLAY_NOT_SUPPORT) {
1403 DISPLAY_TEST_LOGE("RegRefreshCallback not support");
1404 return;
1405 }
1406 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1407 }
1408
1409 /**
1410 * @tc.number: SUB_Driver_Display_HDI_8600
1411 * @tc.name: test_GetDisplaySupportedColorGamuts
1412 * @tc.desc: Obtains the color gamuts of a display device
1413 * @tc.size: MediumTest
1414 * @tc.type: Function
1415 */
1416 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_8600, TestSize.Level1)
1417 {
1418 std::vector<ColorGamut> gamuts;
1419 auto ret = g_composerDevice->GetDisplaySupportedColorGamuts(g_displayIds[0], gamuts);
1420 if (ret == DISPLAY_NOT_SUPPORT) {
1421 DISPLAY_TEST_LOGE("GetDisplaySupportedColorGamuts not support");
1422 return;
1423 }
1424 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1425 }
1426
1427 /**
1428 * @tc.number: SUB_Driver_Display_HDI_8700
1429 * @tc.name: test_GetHDRCapabilityInfos
1430 * @tc.desc: Obtains the capabilities of a display device
1431 * @tc.size: MediumTest
1432 * @tc.type: Function
1433 */
1434 HWTEST_F(DeviceTest, SUB_Driver_Display_HDI_8700, TestSize.Level1)
1435 {
1436 HDRCapability info = { 0 };
1437 auto ret = g_composerDevice->GetHDRCapabilityInfos(g_displayIds[0], info);
1438 if (ret == DISPLAY_NOT_SUPPORT) {
1439 DISPLAY_TEST_LOGE("GetHDRCapabilityInfos not support");
1440 return;
1441 }
1442 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1443 }
1444
1445 /**
1446 * @tc.number: SUB_DriverSystem_DisplayComposer_0340
1447 * @tc.name: test_SetLayerTransformMode_002
1448 * @tc.desc: Sets the type of graphic rotation
1449 * @tc.size: MediumTest
1450 * @tc.type: Function
1451 */
1452 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0340, TestSize.Level1)
1453 {
1454 std::vector<LayerSettings> settings = {
1455 {
1456 .rectRatio = { 0, 0, 1.0f, 1.0f },
1457 .color = RED
1458 }
1459 };
1460
1461 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1462 ASSERT_TRUE((layers.size() > 0));
1463
1464 PrepareAndCommit();
1465
1466 auto layer = layers[0];
1467
1468 TransformType type = TransformType::MIRROR_H;
1469 auto ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
1470 PrepareAndCommit();
1471
1472 type = TransformType::MIRROR_V;
1473 ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
1474 PrepareAndCommit();
1475
1476 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1477
1478 DestroyLayer(layer);
1479 }
1480
1481 /**
1482 * @tc.number: SUB_DriverSystem_DisplayComposer_0350
1483 * @tc.name: test_SetLayerTransformMode_003
1484 * @tc.desc: Sets the type of graphic rotation
1485 * @tc.size: MediumTest
1486 * @tc.type: Function
1487 */
1488 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0350, TestSize.Level1)
1489 {
1490 std::vector<LayerSettings> settings = {
1491 {
1492 .rectRatio = { 0, 0, 1.0f, 1.0f },
1493 .color = RED
1494 }
1495 };
1496
1497 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1498 ASSERT_TRUE((layers.size() > 0));
1499
1500 PrepareAndCommit();
1501
1502 auto layer = layers[0];
1503
1504 TransformType type = TransformType::MIRROR_H_ROTATE_90;
1505 auto ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
1506 PrepareAndCommit();
1507
1508 type = TransformType::MIRROR_V_ROTATE_90;
1509 ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
1510 PrepareAndCommit();
1511
1512 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1513
1514 DestroyLayer(layer);
1515 }
1516
1517 /**
1518 * @tc.number: SUB_DriverSystem_DisplayComposer_0360
1519 * @tc.name: test_SetLayerTransformMode_004
1520 * @tc.desc: Sets the type of graphic rotation
1521 * @tc.size: MediumTest
1522 * @tc.type: Function
1523 */
1524 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0360, TestSize.Level1)
1525 {
1526 std::vector<LayerSettings> settings = {
1527 {
1528 .rectRatio = { 0, 0, 1.0f, 1.0f },
1529 .color = RED
1530 }
1531 };
1532
1533 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1534 ASSERT_TRUE((layers.size() > 0));
1535
1536 PrepareAndCommit();
1537
1538 auto layer = layers[0];
1539
1540 TransformType type = TransformType::ROTATE_BUTT;
1541 auto ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
1542 PrepareAndCommit();
1543 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1544 DestroyLayer(layer);
1545 }
1546
1547 /**
1548 * @tc.number: SUB_DriverSystem_DisplayComposer_0370
1549 * @tc.name: test_SetDisplayPowerStatus_002
1550 * @tc.desc: Set the power status of the display device
1551 * @tc.size: MediumTest
1552 * @tc.type: Function
1553 */
1554 #ifdef DISPLAY_COMMUNITY
1555 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0370, TestSize.Level1)
1556 {
1557 auto ret = g_composerDevice->SetDisplayPowerStatus(g_displayIds[0],
1558 Composer::V1_0::DispPowerStatus::POWER_STATUS_SUSPEND);
1559 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1560
1561 ret = g_composerDevice->SetDisplayPowerStatus(g_displayIds[0],
1562 Composer::V1_0::DispPowerStatus::POWER_STATUS_BUTT);
1563 EXPECT_EQ(DISPLAY_FAILURE, ret);
1564 }
1565 #endif
1566
1567 /**
1568 * @tc.number: SUB_DriverSystem_DisplayComposer_0380
1569 * @tc.name: test_SetLayerBlendType_002
1570 * @tc.desc: Set the blend type to BLEND_CLEAR
1571 * @tc.size: MediumTest
1572 * @tc.type: Function
1573 */
1574 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0380, TestSize.Level1)
1575 {
1576 std::vector<LayerSettings> settings = {
1577 {
1578 .rectRatio = { 0, 0, 1.0f, 1.0f },
1579 .color = GREEN
1580 }
1581 };
1582
1583 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1584 ASSERT_TRUE((layers.size() > 0));
1585
1586 auto layer = layers[0];
1587
1588 BlendType type = BlendType::BLEND_CLEAR;
1589 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1590
1591 PrepareAndCommit();
1592
1593 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1594 DestroyLayer(layer);
1595 }
1596
1597 /**
1598 * @tc.number: SUB_DriverSystem_DisplayComposer_0390
1599 * @tc.name: test_SetLayerBlendType_003
1600 * @tc.desc: Set the blend type to BLEND_SRC
1601 * @tc.size: MediumTest
1602 * @tc.type: Function
1603 */
1604 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0390, TestSize.Level1)
1605 {
1606 std::vector<LayerSettings> settings = {
1607 {
1608 .rectRatio = { 0, 0, 1.0f, 1.0f },
1609 .color = GREEN
1610 }
1611 };
1612
1613 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1614 ASSERT_TRUE((layers.size() > 0));
1615
1616 auto layer = layers[0];
1617
1618 BlendType type = BlendType::BLEND_SRC;
1619 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1620
1621 PrepareAndCommit();
1622
1623 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1624 DestroyLayer(layer);
1625 }
1626
1627 /**
1628 * @tc.number: SUB_DriverSystem_DisplayComposer_0400
1629 * @tc.name: test_SetLayerBlendType_004
1630 * @tc.desc: Set the blend type to BLEND_SRCOVER
1631 * @tc.size: MediumTest
1632 * @tc.type: Function
1633 */
1634 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0400, TestSize.Level1)
1635 {
1636 std::vector<LayerSettings> settings = {
1637 {
1638 .rectRatio = { 0, 0, 1.0f, 1.0f },
1639 .color = GREEN
1640 }
1641 };
1642
1643 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1644 ASSERT_TRUE((layers.size() > 0));
1645
1646 auto layer = layers[0];
1647
1648 BlendType type = BlendType::BLEND_SRCOVER;
1649 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1650
1651 PrepareAndCommit();
1652
1653 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1654 DestroyLayer(layer);
1655 }
1656
1657 /**
1658 * @tc.number: SUB_DriverSystem_DisplayComposer_0410
1659 * @tc.name: test_SetLayerBlendType_005
1660 * @tc.desc: Set the blend type to BLEND_DSTOVER
1661 * @tc.size: MediumTest
1662 * @tc.type: Function
1663 */
1664 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0410, TestSize.Level1)
1665 {
1666 std::vector<LayerSettings> settings = {
1667 {
1668 .rectRatio = { 0, 0, 1.0f, 1.0f },
1669 .color = GREEN
1670 }
1671 };
1672
1673 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1674 ASSERT_TRUE((layers.size() > 0));
1675
1676 auto layer = layers[0];
1677
1678 BlendType type = BlendType::BLEND_DSTOVER;
1679 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1680
1681 PrepareAndCommit();
1682
1683 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1684 DestroyLayer(layer);
1685 }
1686
1687 /**
1688 * @tc.number: SUB_DriverSystem_DisplayComposer_0420
1689 * @tc.name: test_SetLayerBlendType_006
1690 * @tc.desc: Set the blend type to BLEND_SRCIN
1691 * @tc.size: MediumTest
1692 * @tc.type: Function
1693 */
1694 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0420, TestSize.Level1)
1695 {
1696 std::vector<LayerSettings> settings = {
1697 {
1698 .rectRatio = { 0, 0, 1.0f, 1.0f },
1699 .color = GREEN
1700 }
1701 };
1702
1703 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1704 ASSERT_TRUE((layers.size() > 0));
1705
1706 auto layer = layers[0];
1707
1708 BlendType type = BlendType::BLEND_SRCIN;
1709 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1710
1711 PrepareAndCommit();
1712
1713 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1714 DestroyLayer(layer);
1715 }
1716
1717 /**
1718 * @tc.number: SUB_DriverSystem_DisplayComposer_0430
1719 * @tc.name: test_SetLayerBlendType_007
1720 * @tc.desc: Set the blend type to BLEND_DSTIN
1721 * @tc.size: MediumTest
1722 * @tc.type: Function
1723 */
1724 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0430, TestSize.Level1)
1725 {
1726 std::vector<LayerSettings> settings = {
1727 {
1728 .rectRatio = { 0, 0, 1.0f, 1.0f },
1729 .color = GREEN
1730 }
1731 };
1732
1733 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1734 ASSERT_TRUE((layers.size() > 0));
1735
1736 auto layer = layers[0];
1737
1738 BlendType type = BlendType::BLEND_DSTIN;
1739 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1740
1741 PrepareAndCommit();
1742
1743 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1744 DestroyLayer(layer);
1745 }
1746
1747 /**
1748 * @tc.number: SUB_DriverSystem_DisplayComposer_0440
1749 * @tc.name: test_SetLayerBlendType_008
1750 * @tc.desc: Set the blend type to BLEND_SRCOUT
1751 * @tc.size: MediumTest
1752 * @tc.type: Function
1753 */
1754 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0440, TestSize.Level1)
1755 {
1756 std::vector<LayerSettings> settings = {
1757 {
1758 .rectRatio = { 0, 0, 1.0f, 1.0f },
1759 .color = GREEN
1760 }
1761 };
1762
1763 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1764 ASSERT_TRUE((layers.size() > 0));
1765
1766 auto layer = layers[0];
1767
1768 BlendType type = BlendType::BLEND_SRCOUT;
1769 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1770
1771 PrepareAndCommit();
1772
1773 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1774 DestroyLayer(layer);
1775 }
1776
1777 /**
1778 * @tc.number: SUB_DriverSystem_DisplayComposer_0450
1779 * @tc.name: test_SetLayerBlendType_009
1780 * @tc.desc: Set the blend type to BLEND_DSTOUT
1781 * @tc.size: MediumTest
1782 * @tc.type: Function
1783 */
1784 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0450, TestSize.Level1)
1785 {
1786 std::vector<LayerSettings> settings = {
1787 {
1788 .rectRatio = { 0, 0, 1.0f, 1.0f },
1789 .color = GREEN
1790 }
1791 };
1792
1793 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1794 ASSERT_TRUE((layers.size() > 0));
1795
1796 auto layer = layers[0];
1797
1798 BlendType type = BlendType::BLEND_DSTOUT;
1799 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1800
1801 PrepareAndCommit();
1802
1803 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1804 DestroyLayer(layer);
1805 }
1806
1807 /**
1808 * @tc.number: SUB_DriverSystem_DisplayComposer_0460
1809 * @tc.name: test_SetLayerBlendType_010
1810 * @tc.desc: Set the blend type to BLEND_SRCATOP
1811 * @tc.size: MediumTest
1812 * @tc.type: Function
1813 */
1814 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0460, TestSize.Level1)
1815 {
1816 std::vector<LayerSettings> settings = {
1817 {
1818 .rectRatio = { 0, 0, 1.0f, 1.0f },
1819 .color = GREEN
1820 }
1821 };
1822
1823 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1824 ASSERT_TRUE((layers.size() > 0));
1825
1826 auto layer = layers[0];
1827
1828 BlendType type = BlendType::BLEND_SRCATOP;
1829 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1830
1831 PrepareAndCommit();
1832
1833 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1834 DestroyLayer(layer);
1835 }
1836
1837 /**
1838 * @tc.number: SUB_DriverSystem_DisplayComposer_0470
1839 * @tc.name: test_SetLayerBlendType_011
1840 * @tc.desc: Set the blend type to BLEND_DSTATOP
1841 * @tc.size: MediumTest
1842 * @tc.type: Function
1843 */
1844 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0470, TestSize.Level1)
1845 {
1846 std::vector<LayerSettings> settings = {
1847 {
1848 .rectRatio = { 0, 0, 1.0f, 1.0f },
1849 .color = GREEN
1850 }
1851 };
1852
1853 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1854 ASSERT_TRUE((layers.size() > 0));
1855
1856 auto layer = layers[0];
1857
1858 BlendType type = BlendType::BLEND_DSTATOP;
1859 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1860
1861 PrepareAndCommit();
1862
1863 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1864 DestroyLayer(layer);
1865 }
1866
1867 /**
1868 * @tc.number: SUB_DriverSystem_DisplayComposer_0480
1869 * @tc.name: test_SetLayerBlendType_012
1870 * @tc.desc: Set the blend type to BLEND_ADD
1871 * @tc.size: MediumTest
1872 * @tc.type: Function
1873 */
1874 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0480, TestSize.Level1)
1875 {
1876 std::vector<LayerSettings> settings = {
1877 {
1878 .rectRatio = { 0, 0, 1.0f, 1.0f },
1879 .color = GREEN
1880 }
1881 };
1882
1883 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1884 ASSERT_TRUE((layers.size() > 0));
1885
1886 auto layer = layers[0];
1887
1888 BlendType type = BlendType::BLEND_ADD;
1889 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1890
1891 PrepareAndCommit();
1892
1893 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1894 DestroyLayer(layer);
1895 }
1896
1897 /**
1898 * @tc.number: SUB_DriverSystem_DisplayComposer_0490
1899 * @tc.name: test_SetLayerBlendType_013
1900 * @tc.desc: Set the blend type to BLEND_XOR
1901 * @tc.size: MediumTest
1902 * @tc.type: Function
1903 */
1904 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0490, TestSize.Level1)
1905 {
1906 std::vector<LayerSettings> settings = {
1907 {
1908 .rectRatio = { 0, 0, 1.0f, 1.0f },
1909 .color = GREEN
1910 }
1911 };
1912
1913 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1914 ASSERT_TRUE((layers.size() > 0));
1915
1916 auto layer = layers[0];
1917
1918 BlendType type = BlendType::BLEND_XOR;
1919 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1920
1921 PrepareAndCommit();
1922
1923 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1924 DestroyLayer(layer);
1925 }
1926
1927 /**
1928 * @tc.number: SUB_DriverSystem_DisplayComposer_0500
1929 * @tc.name: test_SetLayerBlendType_014
1930 * @tc.desc: Set the blend type to BLEND_DST
1931 * @tc.size: MediumTest
1932 * @tc.type: Function
1933 */
1934 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0500, TestSize.Level1)
1935 {
1936 std::vector<LayerSettings> settings = {
1937 {
1938 .rectRatio = { 0, 0, 1.0f, 1.0f },
1939 .color = GREEN
1940 }
1941 };
1942
1943 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1944 ASSERT_TRUE((layers.size() > 0));
1945
1946 auto layer = layers[0];
1947
1948 BlendType type = BlendType::BLEND_DST;
1949 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1950
1951 PrepareAndCommit();
1952
1953 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1954 DestroyLayer(layer);
1955 }
1956
1957 /**
1958 * @tc.number: SUB_DriverSystem_DisplayComposer_0510
1959 * @tc.name: test_SetLayerBlendType_015
1960 * @tc.desc: Set the blend type to BLEND_AKS
1961 * @tc.size: MediumTest
1962 * @tc.type: Function
1963 */
1964 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0510, TestSize.Level1)
1965 {
1966 std::vector<LayerSettings> settings = {
1967 {
1968 .rectRatio = { 0, 0, 1.0f, 1.0f },
1969 .color = GREEN
1970 }
1971 };
1972
1973 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
1974 ASSERT_TRUE((layers.size() > 0));
1975
1976 auto layer = layers[0];
1977
1978 BlendType type = BlendType::BLEND_AKS;
1979 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
1980
1981 PrepareAndCommit();
1982
1983 EXPECT_EQ(DISPLAY_SUCCESS, ret);
1984 DestroyLayer(layer);
1985 }
1986
1987 /**
1988 * @tc.number: SUB_DriverSystem_DisplayComposer_0520
1989 * @tc.name: test_SetLayerBlendType_016
1990 * @tc.desc: Set the blend type to BLEND_AKD
1991 * @tc.size: MediumTest
1992 * @tc.type: Function
1993 */
1994 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0520, TestSize.Level1)
1995 {
1996 std::vector<LayerSettings> settings = {
1997 {
1998 .rectRatio = { 0, 0, 1.0f, 1.0f },
1999 .color = GREEN
2000 }
2001 };
2002
2003 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2004 ASSERT_TRUE((layers.size() > 0));
2005
2006 auto layer = layers[0];
2007
2008 BlendType type = BlendType::BLEND_AKD;
2009 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
2010
2011 PrepareAndCommit();
2012
2013 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2014 DestroyLayer(layer);
2015 }
2016
2017 /**
2018 * @tc.number: SUB_DriverSystem_DisplayComposer_0530
2019 * @tc.name: test_SetLayerBlendType_017
2020 * @tc.desc: Set the blend type to BLEND_BUTT
2021 * @tc.size: MediumTest
2022 * @tc.type: Function
2023 */
2024 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0530, TestSize.Level1)
2025 {
2026 std::vector<LayerSettings> settings = {
2027 {
2028 .rectRatio = { 0, 0, 1.0f, 1.0f },
2029 .color = GREEN
2030 }
2031 };
2032
2033 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2034 ASSERT_TRUE((layers.size() > 0));
2035
2036 auto layer = layers[0];
2037
2038 BlendType type = BlendType::BLEND_BUTT;
2039 auto ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
2040
2041 PrepareAndCommit();
2042
2043 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2044 DestroyLayer(layer);
2045 }
2046
2047 /**
2048 * @tc.number: SUB_DriverSystem_DisplayComposer_0540
2049 * @tc.name: test_SetLayerMaskInfo_002
2050 * @tc.desc: Sets the current mask frame information to the vendor driver
2051 * @tc.size: MediumTest
2052 * @tc.type: Function
2053 */
2054 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0540, TestSize.Level1)
2055 {
2056 std::vector<LayerSettings> settings = {
2057 {
2058 .rectRatio = { 0, 0, 1.0f, 1.0f },
2059 .color = GREEN
2060 }
2061 };
2062
2063 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2064 ASSERT_TRUE((layers.size() > 0));
2065
2066 auto layer = layers[0];
2067
2068 MaskInfo maskInfo = MaskInfo::LAYER_NORAML;
2069 auto ret = g_composerDevice->SetLayerMaskInfo(g_displayIds[0], layer->GetId(), maskInfo);
2070
2071 PrepareAndCommit();
2072
2073 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2074
2075 DestroyLayer(layer);
2076 }
2077
2078 /**
2079 * @tc.number: SUB_DriverSystem_DisplayComposer_0550
2080 * @tc.name: test_SetLayerCompositionType_002
2081 * @tc.desc: set the composition type which the client expect
2082 * @tc.size: MediumTest
2083 * @tc.type: Function
2084 */
2085 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0550, TestSize.Level1)
2086 {
2087 std::vector<LayerSettings> settings = {
2088 {
2089 .rectRatio = { 0, 0, 1.0f, 1.0f },
2090 .color = BLUE
2091 }
2092 };
2093
2094 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2095 ASSERT_TRUE((layers.size() > 0));
2096
2097 auto layer = layers[0];
2098
2099 Composer::V1_0::CompositionType type = Composer::V1_0::CompositionType::COMPOSITION_DEVICE;
2100 auto ret = g_composerDevice->SetLayerCompositionType(g_displayIds[0], layer->GetId(), type);
2101
2102 PrepareAndCommit();
2103
2104 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2105 DestroyLayer(layer);
2106 }
2107
2108 /**
2109 * @tc.number: SUB_DriverSystem_DisplayComposer_0560
2110 * @tc.name: test_SetLayerCompositionType_003
2111 * @tc.desc: set the composition type which the client expect
2112 * @tc.size: MediumTest
2113 * @tc.type: Function
2114 */
2115 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0560, TestSize.Level1)
2116 {
2117 std::vector<LayerSettings> settings = {
2118 {
2119 .rectRatio = { 0, 0, 1.0f, 1.0f },
2120 .color = BLUE
2121 }
2122 };
2123
2124 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2125 ASSERT_TRUE((layers.size() > 0));
2126
2127 auto layer = layers[0];
2128
2129 Composer::V1_0::CompositionType type = Composer::V1_0::CompositionType::COMPOSITION_CURSOR;
2130 auto ret = g_composerDevice->SetLayerCompositionType(g_displayIds[0], layer->GetId(), type);
2131
2132 PrepareAndCommit();
2133
2134 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2135 DestroyLayer(layer);
2136 }
2137
2138 /**
2139 * @tc.number: SUB_DriverSystem_DisplayComposer_0570
2140 * @tc.name: test_SetLayerCompositionType_004
2141 * @tc.desc: set the composition type which the client expect
2142 * @tc.size: MediumTest
2143 * @tc.type: Function
2144 */
2145 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0570, TestSize.Level1)
2146 {
2147 std::vector<LayerSettings> settings = {
2148 {
2149 .rectRatio = { 0, 0, 1.0f, 1.0f },
2150 .color = BLUE
2151 }
2152 };
2153
2154 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2155 ASSERT_TRUE((layers.size() > 0));
2156
2157 auto layer = layers[0];
2158
2159 Composer::V1_0::CompositionType type = Composer::V1_0::CompositionType::COMPOSITION_VIDEO;
2160 auto ret = g_composerDevice->SetLayerCompositionType(g_displayIds[0], layer->GetId(), type);
2161
2162 PrepareAndCommit();
2163
2164 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2165 DestroyLayer(layer);
2166 }
2167
2168 /**
2169 * @tc.number: SUB_DriverSystem_DisplayComposer_0580
2170 * @tc.name: test_SetLayerCompositionType_005
2171 * @tc.desc: set the composition type which the client expect
2172 * @tc.size: MediumTest
2173 * @tc.type: Function
2174 */
2175 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0580, TestSize.Level1)
2176 {
2177 std::vector<LayerSettings> settings = {
2178 {
2179 .rectRatio = { 0, 0, 1.0f, 1.0f },
2180 .color = BLUE
2181 }
2182 };
2183
2184 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2185 ASSERT_TRUE((layers.size() > 0));
2186
2187 auto layer = layers[0];
2188
2189 Composer::V1_0::CompositionType type = Composer::V1_0::CompositionType::COMPOSITION_DEVICE_CLEAR;
2190 auto ret = g_composerDevice->SetLayerCompositionType(g_displayIds[0], layer->GetId(), type);
2191
2192 PrepareAndCommit();
2193
2194 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2195 DestroyLayer(layer);
2196 }
2197
2198 /**
2199 * @tc.number: SUB_DriverSystem_DisplayComposer_0590
2200 * @tc.name: test_SetLayerCompositionType_006
2201 * @tc.desc: set the composition type which the client expect
2202 * @tc.size: MediumTest
2203 * @tc.type: Function
2204 */
2205 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0590, TestSize.Level1)
2206 {
2207 std::vector<LayerSettings> settings = {
2208 {
2209 .rectRatio = { 0, 0, 1.0f, 1.0f },
2210 .color = BLUE
2211 }
2212 };
2213
2214 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2215 ASSERT_TRUE((layers.size() > 0));
2216
2217 auto layer = layers[0];
2218
2219 Composer::V1_0::CompositionType type = Composer::V1_0::CompositionType::COMPOSITION_CLIENT_CLEAR;
2220 auto ret = g_composerDevice->SetLayerCompositionType(g_displayIds[0], layer->GetId(), type);
2221
2222 PrepareAndCommit();
2223
2224 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2225 DestroyLayer(layer);
2226 }
2227
2228 /**
2229 * @tc.number: SUB_DriverSystem_DisplayComposer_0600
2230 * @tc.name: test_SetLayerCompositionType_007
2231 * @tc.desc: set the composition type which the client expect
2232 * @tc.size: MediumTest
2233 * @tc.type: Function
2234 */
2235 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0600, TestSize.Level1)
2236 {
2237 std::vector<LayerSettings> settings = {
2238 {
2239 .rectRatio = { 0, 0, 1.0f, 1.0f },
2240 .color = BLUE
2241 }
2242 };
2243
2244 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2245 ASSERT_TRUE((layers.size() > 0));
2246
2247 auto layer = layers[0];
2248
2249 Composer::V1_0::CompositionType type = Composer::V1_0::CompositionType::COMPOSITION_TUNNEL;
2250 auto ret = g_composerDevice->SetLayerCompositionType(g_displayIds[0], layer->GetId(), type);
2251
2252 PrepareAndCommit();
2253
2254 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2255 DestroyLayer(layer);
2256 }
2257
2258 /**
2259 * @tc.number: SUB_DriverSystem_DisplayComposer_0610
2260 * @tc.name: test_SetLayerCompositionType_008
2261 * @tc.desc: set the composition type which the client expect
2262 * @tc.size: MediumTest
2263 * @tc.type: Function
2264 */
2265 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0610, TestSize.Level1)
2266 {
2267 std::vector<LayerSettings> settings = {
2268 {
2269 .rectRatio = { 0, 0, 1.0f, 1.0f },
2270 .color = BLUE
2271 }
2272 };
2273
2274 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2275 ASSERT_TRUE((layers.size() > 0));
2276
2277 auto layer = layers[0];
2278
2279 Composer::V1_0::CompositionType type = Composer::V1_0::CompositionType::COMPOSITION_BUTT;
2280 auto ret = g_composerDevice->SetLayerCompositionType(g_displayIds[0], layer->GetId(), type);
2281
2282 PrepareAndCommit();
2283
2284 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2285 DestroyLayer(layer);
2286 }
2287
2288 /**
2289 * @tc.number: SUB_DriverSystem_DisplayComposer_0620
2290 * @tc.name: test_SetLayerTransformMode_005
2291 * @tc.desc: Sets the type of graphic rotation
2292 * @tc.size: MediumTest
2293 * @tc.type: Function
2294 */
2295 HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0620, TestSize.Level1)
2296 {
2297 std::vector<LayerSettings> settings = {
2298 {
2299 .rectRatio = { 0, 0, 1.0f, 1.0f },
2300 .color = RED
2301 }
2302 };
2303
2304 std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
2305 ASSERT_TRUE((layers.size() > 0));
2306
2307 PrepareAndCommit();
2308
2309 auto layer = layers[0];
2310
2311 TransformType type = TransformType::ROTATE_NONE;
2312 auto ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
2313 PrepareAndCommit();
2314 EXPECT_EQ(DISPLAY_SUCCESS, ret);
2315 DestroyLayer(layer);
2316 }