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