19762338dSopenharmony_ci/*
29762338dSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
39762338dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49762338dSopenharmony_ci * you may not use this file except in compliance with the License.
59762338dSopenharmony_ci * You may obtain a copy of the License at
69762338dSopenharmony_ci *
79762338dSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89762338dSopenharmony_ci *
99762338dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109762338dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119762338dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129762338dSopenharmony_ci * See the License for the specific language governing permissions and
139762338dSopenharmony_ci * limitations under the License.
149762338dSopenharmony_ci */
159762338dSopenharmony_ci
169762338dSopenharmony_ci#include <string>
179762338dSopenharmony_ci#include <vector>
189762338dSopenharmony_ci#include <mutex>
199762338dSopenharmony_ci#include "../unittest/hdi_composer_ut.h"
209762338dSopenharmony_ci#include <chrono>
219762338dSopenharmony_ci#include <cinttypes>
229762338dSopenharmony_ci#include <algorithm>
239762338dSopenharmony_ci#include <condition_variable>
249762338dSopenharmony_ci#include <benchmark/benchmark.h>
259762338dSopenharmony_ci#include "gtest/gtest.h"
269762338dSopenharmony_ci#include "v1_2/include/idisplay_composer_interface.h"
279762338dSopenharmony_ci#include "v1_1/display_composer_type.h"
289762338dSopenharmony_ci#include "v1_0/display_buffer_type.h"
299762338dSopenharmony_ci#include "display_test.h"
309762338dSopenharmony_ci#include "display_test_utils.h"
319762338dSopenharmony_ci#include "hdi_composition_check.h"
329762338dSopenharmony_ci#include "hdi_test_device.h"
339762338dSopenharmony_ci#include "hdi_test_device_common.h"
349762338dSopenharmony_ci#include "hdi_test_display.h"
359762338dSopenharmony_ci#include "hdi_test_render_utils.h"
369762338dSopenharmony_ci
379762338dSopenharmony_ciusing namespace OHOS::HDI::Display::Buffer::V1_0;
389762338dSopenharmony_ciusing namespace OHOS::HDI::Display::Composer::V1_1;
399762338dSopenharmony_ciusing namespace OHOS::HDI::Display::TEST;
409762338dSopenharmony_ciusing namespace testing::ext;
419762338dSopenharmony_ci
429762338dSopenharmony_cinamespace {
439762338dSopenharmony_cistatic sptr<Composer::V1_2::IDisplayComposerInterface> g_composerDevice = nullptr;
449762338dSopenharmony_cistatic std::shared_ptr<IDisplayBuffer> g_gralloc = nullptr;
459762338dSopenharmony_cistatic std::vector<uint32_t> g_displayIds;
469762338dSopenharmony_ci
479762338dSopenharmony_ciclass DisplayBenchmarkTest : public benchmark::Fixture {
489762338dSopenharmony_cipublic:
499762338dSopenharmony_ci    void TearDown(const ::benchmark::State &state);
509762338dSopenharmony_ci    static void OnMode(uint32_t modeId, uint64_t vBlankPeriod, void* data);
519762338dSopenharmony_ci    static void OnseamlessChange(uint32_t devId, void* data);
529762338dSopenharmony_ci    static void TestRefreshCallback(uint32_t devId, void* data);
539762338dSopenharmony_ci};
549762338dSopenharmony_ci
559762338dSopenharmony_civoid DisplayBenchmarkTest::TearDown(const ::benchmark::State &state)
569762338dSopenharmony_ci{
579762338dSopenharmony_ci    HdiTestDevice::GetInstance().Clear();
589762338dSopenharmony_ci}
599762338dSopenharmony_ci
609762338dSopenharmony_civoid DisplayBenchmarkTest::OnMode(uint32_t modeId, uint64_t vBlankPeriod, void* data)
619762338dSopenharmony_ci{
629762338dSopenharmony_ci}
639762338dSopenharmony_ci
649762338dSopenharmony_civoid DisplayBenchmarkTest::OnseamlessChange(uint32_t devId, void* data)
659762338dSopenharmony_ci{
669762338dSopenharmony_ci}
679762338dSopenharmony_ci
689762338dSopenharmony_civoid DisplayBenchmarkTest::TestRefreshCallback(uint32_t devId, void* data)
699762338dSopenharmony_ci{
709762338dSopenharmony_ci}
719762338dSopenharmony_ci
729762338dSopenharmony_cistatic inline std::shared_ptr<HdiTestDisplay> GetFirstDisplay()
739762338dSopenharmony_ci{
749762338dSopenharmony_ci    return HdiTestDevice::GetInstance().GetFirstDisplay();
759762338dSopenharmony_ci}
769762338dSopenharmony_ci
779762338dSopenharmony_cistatic int32_t CheckComposition(std::vector<LayerSettings> &layers, BufferHandle* clientBuffer,
789762338dSopenharmony_ci    uint32_t checkType = HdiCompositionCheck::CHECK_VERTEX)
799762338dSopenharmony_ci{
809762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((clientBuffer == nullptr), DISPLAY_NULL_PTR, DISPLAY_TEST_LOGE("client buffer is nullptr"));
819762338dSopenharmony_ci    return HdiCompositionCheck::GetInstance().Check(layers, *clientBuffer, checkType);
829762338dSopenharmony_ci}
839762338dSopenharmony_ci
849762338dSopenharmony_cistatic std::shared_ptr<HdiTestLayer> CreateTestLayer(LayerSettings setting, uint32_t zorder)
859762338dSopenharmony_ci{
869762338dSopenharmony_ci    int ret;
879762338dSopenharmony_ci    HdiTestDevice::GetInstance();
889762338dSopenharmony_ci    DISPLAY_TEST_LOGE("color 0x%x", setting.color);
899762338dSopenharmony_ci    std::shared_ptr<HdiTestDisplay> display = HdiTestDevice::GetInstance().GetFirstDisplay();
909762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((display == nullptr), nullptr, DISPLAY_TEST_LOGE("can not get display"));
919762338dSopenharmony_ci
929762338dSopenharmony_ci    std::shared_ptr<HdiTestLayer> layer = display->CreateHdiTestLayer(setting.bufferSize.w, setting.bufferSize.h);
939762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((layer == nullptr), nullptr, DISPLAY_TEST_LOGE("can not create hdi test layer"));
949762338dSopenharmony_ci
959762338dSopenharmony_ci    layer->SetLayerPosition(setting.displayRect);
969762338dSopenharmony_ci
979762338dSopenharmony_ci    layer->SetCompType(setting.compositionType);
989762338dSopenharmony_ci
999762338dSopenharmony_ci    if ((setting.alpha >= 0) && (setting.alpha <= 0xff)) { // alpha rang 0x00 ~ 0xff
1009762338dSopenharmony_ci        LayerAlpha alpha = { 0 };
1019762338dSopenharmony_ci        alpha.gAlpha = setting.alpha;
1029762338dSopenharmony_ci        alpha.enGlobalAlpha = true;
1039762338dSopenharmony_ci        layer->SetAlpha(alpha);
1049762338dSopenharmony_ci    }
1059762338dSopenharmony_ci    HdiGrallocBuffer* handle = layer->GetFrontBuffer();
1069762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((handle == nullptr), nullptr, DISPLAY_TEST_LOGE("can not get front buffer"));
1079762338dSopenharmony_ci    ClearColor(*(handle->Get()), setting.color);
1089762338dSopenharmony_ci    ret = layer->SwapFrontToBackQ();
1099762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), nullptr, DISPLAY_TEST_LOGE("SwapFrontToBackQ failed"));
1109762338dSopenharmony_ci    layer->SetZorder(zorder);
1119762338dSopenharmony_ci    layer->SetBlendType(setting.blendType);
1129762338dSopenharmony_ci    layer->SetTransform(setting.rotate);
1139762338dSopenharmony_ci    return layer;
1149762338dSopenharmony_ci}
1159762338dSopenharmony_ci
1169762338dSopenharmony_cistatic int PrepareAndPrensent()
1179762338dSopenharmony_ci{
1189762338dSopenharmony_ci    int ret;
1199762338dSopenharmony_ci    DISPLAY_TEST_LOGE();
1209762338dSopenharmony_ci    std::shared_ptr<HdiTestDisplay> display = HdiTestDevice::GetInstance().GetFirstDisplay();
1219762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((display == nullptr), DISPLAY_FAILURE, DISPLAY_TEST_LOGE("can not get display"));
1229762338dSopenharmony_ci
1239762338dSopenharmony_ci    ret = display->PrepareDisplayLayers();
1249762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE,
1259762338dSopenharmony_ci        DISPLAY_TEST_LOGE("PrepareDisplayLayers failed"));
1269762338dSopenharmony_ci
1279762338dSopenharmony_ci    ret = display->Commit();
1289762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_TEST_LOGE("Commit failed"));
1299762338dSopenharmony_ci    return DISPLAY_SUCCESS;
1309762338dSopenharmony_ci}
1319762338dSopenharmony_ci
1329762338dSopenharmony_cistatic void AdjustLayerSettings(std::vector<LayerSettings> &settings, uint32_t w, uint32_t h)
1339762338dSopenharmony_ci{
1349762338dSopenharmony_ci    DISPLAY_TEST_LOGE();
1359762338dSopenharmony_ci    for (uint32_t i = 0; i < settings.size(); i++) {
1369762338dSopenharmony_ci        LayerSettings& setting = settings[i];
1379762338dSopenharmony_ci        DISPLAY_TEST_LOGE(" ratio w: %f  ratio h: %f", setting.rectRatio.w, setting.rectRatio.h);
1389762338dSopenharmony_ci        if ((setting.rectRatio.w > 0.0f) && (setting.rectRatio.h > 0.0f)) {
1399762338dSopenharmony_ci            setting.displayRect.h = static_cast<uint32_t>(setting.rectRatio.h * h);
1409762338dSopenharmony_ci            setting.displayRect.w = static_cast<uint32_t>(setting.rectRatio.w * w);
1419762338dSopenharmony_ci            setting.displayRect.x = static_cast<uint32_t>(setting.rectRatio.x * w);
1429762338dSopenharmony_ci            setting.displayRect.y = static_cast<uint32_t>(setting.rectRatio.y * h);
1439762338dSopenharmony_ci            DISPLAY_TEST_LOGE("display rect adust form %f %f %f %f to %{public}d %{public}d %{public}d %{public}d ",
1449762338dSopenharmony_ci                setting.rectRatio.x, setting.rectRatio.y, setting.rectRatio.w,
1459762338dSopenharmony_ci                setting.rectRatio.h, setting.displayRect.x, setting.displayRect.y,
1469762338dSopenharmony_ci                setting.displayRect.w, setting.displayRect.h);
1479762338dSopenharmony_ci        }
1489762338dSopenharmony_ci
1499762338dSopenharmony_ci        if ((setting.bufferRatio.h > 0.0f) || (setting.bufferRatio.w > 0.0f)) {
1509762338dSopenharmony_ci            setting.bufferSize.h = static_cast<uint32_t>(setting.bufferRatio.h * h);
1519762338dSopenharmony_ci            setting.bufferSize.w = static_cast<uint32_t>(setting.bufferRatio.w * w);
1529762338dSopenharmony_ci            DISPLAY_TEST_LOGE("buffer size adjust for %f %f to %{public}d %{public}d",
1539762338dSopenharmony_ci                setting.bufferRatio.w, setting.bufferRatio.h, setting.bufferSize.w, setting.bufferSize.h);
1549762338dSopenharmony_ci        }
1559762338dSopenharmony_ci
1569762338dSopenharmony_ci        if ((setting.bufferSize.w == 0) || (setting.bufferSize.h == 0)) {
1579762338dSopenharmony_ci            DISPLAY_TEST_LOGE("buffer size adjust for %{public}d %{public}d to %{public}d %{public}d",
1589762338dSopenharmony_ci                setting.bufferSize.w, setting.bufferSize.h, setting.displayRect.w, setting.displayRect.h);
1599762338dSopenharmony_ci
1609762338dSopenharmony_ci            setting.bufferSize.w = setting.displayRect.w;
1619762338dSopenharmony_ci            setting.bufferSize.h = setting.displayRect.h;
1629762338dSopenharmony_ci        }
1639762338dSopenharmony_ci    }
1649762338dSopenharmony_ci}
1659762338dSopenharmony_ci
1669762338dSopenharmony_cistatic std::vector<std::shared_ptr<HdiTestLayer>> CreateLayers(std::vector<LayerSettings> &settings)
1679762338dSopenharmony_ci{
1689762338dSopenharmony_ci    DISPLAY_TEST_LOGE("settings %{public}zd", settings.size());
1699762338dSopenharmony_ci    std::vector<std::shared_ptr<HdiTestLayer>> layers;
1709762338dSopenharmony_ci    DisplayModeInfo mode = GetFirstDisplay()->GetCurrentMode();
1719762338dSopenharmony_ci    AdjustLayerSettings(settings, mode.width, mode.height);
1729762338dSopenharmony_ci    for (uint32_t i = 0; i < settings.size(); i++) {
1739762338dSopenharmony_ci        LayerSettings setting = settings[i];
1749762338dSopenharmony_ci
1759762338dSopenharmony_ci        auto layer = CreateTestLayer(setting, i);
1769762338dSopenharmony_ci        layers.push_back(layer);
1779762338dSopenharmony_ci    }
1789762338dSopenharmony_ci    return layers;
1799762338dSopenharmony_ci}
1809762338dSopenharmony_ci
1819762338dSopenharmony_cistatic inline void PresentAndCheck(std::vector<LayerSettings> &layerSettings,
1829762338dSopenharmony_ci    uint32_t checkType = HdiCompositionCheck::CHECK_VERTEX)
1839762338dSopenharmony_ci{
1849762338dSopenharmony_ci    int ret = PrepareAndPrensent();
1859762338dSopenharmony_ci    ASSERT_TRUE((ret == DISPLAY_SUCCESS));
1869762338dSopenharmony_ci    if ((GetFirstDisplay()->SnapShot()) != nullptr) {
1879762338dSopenharmony_ci        HdiTestDevice::GetInstance().GetGrallocInterface()->InvalidateCache(*(GetFirstDisplay()->SnapShot()));
1889762338dSopenharmony_ci        ret = CheckComposition(layerSettings, GetFirstDisplay()->SnapShot(), checkType);
1899762338dSopenharmony_ci        ASSERT_TRUE((ret == DISPLAY_SUCCESS));
1909762338dSopenharmony_ci    }
1919762338dSopenharmony_ci}
1929762338dSopenharmony_ci
1939762338dSopenharmony_ci/**
1949762338dSopenharmony_ci  * @tc.name: SetClientBufferCacheCountTest
1959762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface SetClientBufferCacheCount.
1969762338dSopenharmony_ci  */
1979762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0100)(benchmark::State &state)
1989762338dSopenharmony_ci{
1999762338dSopenharmony_ci    int32_t ret;
2009762338dSopenharmony_ci    const uint32_t CACHE_COUNT = 5;
2019762338dSopenharmony_ci    for (auto _ : state) {
2029762338dSopenharmony_ci        ret = g_composerDevice->SetClientBufferCacheCount(g_displayIds[0], CACHE_COUNT);
2039762338dSopenharmony_ci    }
2049762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
2059762338dSopenharmony_ci}
2069762338dSopenharmony_ci
2079762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0100)->
2089762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
2099762338dSopenharmony_ci
2109762338dSopenharmony_ci/**
2119762338dSopenharmony_ci  * @tc.name: GetDisplayCapabilityTest
2129762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplayCapability.
2139762338dSopenharmony_ci  */
2149762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0200)(benchmark::State &state)
2159762338dSopenharmony_ci{
2169762338dSopenharmony_ci    int32_t ret;
2179762338dSopenharmony_ci    DisplayCapability info;
2189762338dSopenharmony_ci    for (auto _ : state) {
2199762338dSopenharmony_ci        ret = g_composerDevice->GetDisplayCapability(g_displayIds[0], info);
2209762338dSopenharmony_ci    }
2219762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
2229762338dSopenharmony_ci}
2239762338dSopenharmony_ci
2249762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0200)->
2259762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
2269762338dSopenharmony_ci
2279762338dSopenharmony_ci/**
2289762338dSopenharmony_ci  * @tc.name: GetDisplaySupportedModesTest
2299762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplaySupportedModes.
2309762338dSopenharmony_ci  */
2319762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0300)(benchmark::State &state)
2329762338dSopenharmony_ci{
2339762338dSopenharmony_ci    int32_t ret;
2349762338dSopenharmony_ci    std::vector<DisplayModeInfo> modes;
2359762338dSopenharmony_ci    for (auto _ : state) {
2369762338dSopenharmony_ci        ret = g_composerDevice->GetDisplaySupportedModes(g_displayIds[0], modes);
2379762338dSopenharmony_ci    }
2389762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
2399762338dSopenharmony_ci}
2409762338dSopenharmony_ci
2419762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0300)->
2429762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
2439762338dSopenharmony_ci
2449762338dSopenharmony_ci/**
2459762338dSopenharmony_ci  * @tc.name: GetDisplayModeTest
2469762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplayMode.
2479762338dSopenharmony_ci  */
2489762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0400)(benchmark::State &state)
2499762338dSopenharmony_ci{
2509762338dSopenharmony_ci    int32_t ret;
2519762338dSopenharmony_ci    uint32_t modeId = 0;
2529762338dSopenharmony_ci    for (auto _ : state) {
2539762338dSopenharmony_ci        ret = g_composerDevice->GetDisplayMode(modeId, modeId);
2549762338dSopenharmony_ci    }
2559762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
2569762338dSopenharmony_ci}
2579762338dSopenharmony_ci
2589762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0400)->
2599762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
2609762338dSopenharmony_ci
2619762338dSopenharmony_ci/**
2629762338dSopenharmony_ci  * @tc.name: SetDisplayModeTest
2639762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface SetDisplayMode.
2649762338dSopenharmony_ci  */
2659762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0500)(benchmark::State &state)
2669762338dSopenharmony_ci{
2679762338dSopenharmony_ci    int32_t ret;
2689762338dSopenharmony_ci    const uint32_t modeId = 0;
2699762338dSopenharmony_ci    for (auto _ : state) {
2709762338dSopenharmony_ci        ret = g_composerDevice->SetDisplayMode(g_displayIds[0], modeId);
2719762338dSopenharmony_ci    }
2729762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
2739762338dSopenharmony_ci}
2749762338dSopenharmony_ci
2759762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0500)->
2769762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
2779762338dSopenharmony_ci
2789762338dSopenharmony_ci/**
2799762338dSopenharmony_ci  * @tc.name: GetDisplayPowerStatusTest
2809762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplayPowerStatus.
2819762338dSopenharmony_ci  */
2829762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0600)(benchmark::State &state)
2839762338dSopenharmony_ci{
2849762338dSopenharmony_ci    int32_t ret;
2859762338dSopenharmony_ci    Composer::V1_0::DispPowerStatus powerStatus = Composer::V1_0::DispPowerStatus::POWER_STATUS_OFF;
2869762338dSopenharmony_ci    for (auto _ : state) {
2879762338dSopenharmony_ci        ret = g_composerDevice->GetDisplayPowerStatus(g_displayIds[0], powerStatus);
2889762338dSopenharmony_ci    }
2899762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
2909762338dSopenharmony_ci}
2919762338dSopenharmony_ci
2929762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0600)->
2939762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
2949762338dSopenharmony_ci
2959762338dSopenharmony_ci/**
2969762338dSopenharmony_ci  * @tc.name: SetDisplayPowerStatusTest
2979762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface SetDisplayPowerStatus.
2989762338dSopenharmony_ci  */
2999762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0700)(benchmark::State &state)
3009762338dSopenharmony_ci{
3019762338dSopenharmony_ci    int32_t ret;
3029762338dSopenharmony_ci    for (auto _ : state) {
3039762338dSopenharmony_ci        ret = g_composerDevice->SetDisplayPowerStatus(g_displayIds[0],
3049762338dSopenharmony_ci            Composer::V1_0::DispPowerStatus::POWER_STATUS_ON);
3059762338dSopenharmony_ci    }
3069762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
3079762338dSopenharmony_ci}
3089762338dSopenharmony_ci
3099762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0700)->
3109762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
3119762338dSopenharmony_ci
3129762338dSopenharmony_ci/**
3139762338dSopenharmony_ci  * @tc.name: GetDisplayBacklightTest
3149762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplayBacklight.
3159762338dSopenharmony_ci  */
3169762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0800)(benchmark::State &state)
3179762338dSopenharmony_ci{
3189762338dSopenharmony_ci    int32_t ret;
3199762338dSopenharmony_ci    uint32_t level;
3209762338dSopenharmony_ci    for (auto _ : state) {
3219762338dSopenharmony_ci        ret = g_composerDevice->GetDisplayBacklight(g_displayIds[0], level);
3229762338dSopenharmony_ci    }
3239762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
3249762338dSopenharmony_ci}
3259762338dSopenharmony_ci
3269762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0800)->
3279762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
3289762338dSopenharmony_ci
3299762338dSopenharmony_ci/**
3309762338dSopenharmony_ci  * @tc.name: SetDisplayBacklightTest
3319762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface SetDisplayBacklight.
3329762338dSopenharmony_ci  */
3339762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0900)(benchmark::State &state)
3349762338dSopenharmony_ci{
3359762338dSopenharmony_ci    int32_t ret;
3369762338dSopenharmony_ci    const uint32_t level = 10;
3379762338dSopenharmony_ci    for (auto _ : state) {
3389762338dSopenharmony_ci        ret = g_composerDevice->SetDisplayBacklight(g_displayIds[0], level);
3399762338dSopenharmony_ci    }
3409762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
3419762338dSopenharmony_ci}
3429762338dSopenharmony_ci
3439762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_0900)->
3449762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
3459762338dSopenharmony_ci
3469762338dSopenharmony_ci/**
3479762338dSopenharmony_ci  * @tc.name: CreateAndDestroyLayerTest
3489762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface CreateLayer And DestroyLayer.
3499762338dSopenharmony_ci  */
3509762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1000)(benchmark::State &state)
3519762338dSopenharmony_ci{
3529762338dSopenharmony_ci    int32_t ret;
3539762338dSopenharmony_ci    LayerInfo layerInfo;
3549762338dSopenharmony_ci    uint32_t layerId;
3559762338dSopenharmony_ci    for (auto _ : state) {
3569762338dSopenharmony_ci        uint32_t bufferCount = 3;
3579762338dSopenharmony_ci        ret = g_composerDevice->CreateLayer(g_displayIds[0], layerInfo, bufferCount, layerId);
3589762338dSopenharmony_ci        EXPECT_EQ(DISPLAY_SUCCESS, ret);
3599762338dSopenharmony_ci        ret = g_composerDevice->DestroyLayer(g_displayIds[0], layerId);
3609762338dSopenharmony_ci    }
3619762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
3629762338dSopenharmony_ci}
3639762338dSopenharmony_ci
3649762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1000)->
3659762338dSopenharmony_ci    Iterations(10)->Repetitions(3)->ReportAggregatesOnly();
3669762338dSopenharmony_ci
3679762338dSopenharmony_ci/**
3689762338dSopenharmony_ci  * @tc.name: GetDisplayCompChangeTest
3699762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplayCompChange.
3709762338dSopenharmony_ci  */
3719762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1100)(benchmark::State &state)
3729762338dSopenharmony_ci{
3739762338dSopenharmony_ci    std::vector<uint32_t> layers {};
3749762338dSopenharmony_ci    std::vector<int32_t> type {};
3759762338dSopenharmony_ci    int32_t ret;
3769762338dSopenharmony_ci    for (auto _ : state) {
3779762338dSopenharmony_ci        ret = g_composerDevice->GetDisplayCompChange(g_displayIds[0], layers, type);
3789762338dSopenharmony_ci    }
3799762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
3809762338dSopenharmony_ci}
3819762338dSopenharmony_ci
3829762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1100)->
3839762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
3849762338dSopenharmony_ci
3859762338dSopenharmony_ci/**
3869762338dSopenharmony_ci  * @tc.name: GetDisplayReleaseFenceTest
3879762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplayReleaseFence.
3889762338dSopenharmony_ci  */
3899762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1200)(benchmark::State &state)
3909762338dSopenharmony_ci{
3919762338dSopenharmony_ci    int32_t ret;
3929762338dSopenharmony_ci    std::vector<uint32_t> layers {};
3939762338dSopenharmony_ci    std::vector<int32_t> fences {};
3949762338dSopenharmony_ci    for (auto _ : state) {
3959762338dSopenharmony_ci        ret = g_composerDevice->GetDisplayReleaseFence(g_displayIds[0], layers, fences);
3969762338dSopenharmony_ci    }
3979762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
3989762338dSopenharmony_ci}
3999762338dSopenharmony_ci
4009762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1200)->
4019762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
4029762338dSopenharmony_ci
4039762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1300)(benchmark::State &state)
4049762338dSopenharmony_ci{
4059762338dSopenharmony_ci    BufferHandle* buffer = nullptr;
4069762338dSopenharmony_ci    AllocInfo info;
4079762338dSopenharmony_ci        info.width  = 800;
4089762338dSopenharmony_ci        info.height = 600;
4099762338dSopenharmony_ci        info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_MEM_DMA |
4109762338dSopenharmony_ci                OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_READ |
4119762338dSopenharmony_ci                OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE;
4129762338dSopenharmony_ci    for (auto _ : state) {
4139762338dSopenharmony_ci        g_gralloc->AllocMem(info, buffer);
4149762338dSopenharmony_ci    }
4159762338dSopenharmony_ci}
4169762338dSopenharmony_ci
4179762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1300)->
4189762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
4199762338dSopenharmony_ci
4209762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1400)(benchmark::State &state)
4219762338dSopenharmony_ci{
4229762338dSopenharmony_ci    BufferHandle* buffer = nullptr;
4239762338dSopenharmony_ci    AllocInfo info;
4249762338dSopenharmony_ci    info.width  = 100;
4259762338dSopenharmony_ci    info.height = 100;
4269762338dSopenharmony_ci    info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_MEM_DMA |
4279762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_READ |
4289762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE;
4299762338dSopenharmony_ci    info.format = Composer::V1_0::PIXEL_FMT_RGBA_8888;
4309762338dSopenharmony_ci    g_gralloc->AllocMem(info, buffer);
4319762338dSopenharmony_ci    for (auto _ : state) {
4329762338dSopenharmony_ci        g_gralloc->Mmap(*buffer);
4339762338dSopenharmony_ci    }
4349762338dSopenharmony_ci}
4359762338dSopenharmony_ci
4369762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1400)->
4379762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
4389762338dSopenharmony_ci
4399762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1500)(benchmark::State &state)
4409762338dSopenharmony_ci{
4419762338dSopenharmony_ci    BufferHandle* buffer = nullptr;
4429762338dSopenharmony_ci    AllocInfo info;
4439762338dSopenharmony_ci    info.width  = 100;
4449762338dSopenharmony_ci    info.height = 100;
4459762338dSopenharmony_ci    info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_MEM_DMA |
4469762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_READ |
4479762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE;
4489762338dSopenharmony_ci    info.format = Composer::V1_0::PIXEL_FMT_RGBA_8888;
4499762338dSopenharmony_ci    g_gralloc->AllocMem(info, buffer);
4509762338dSopenharmony_ci    for (auto _ : state) {
4519762338dSopenharmony_ci        g_gralloc->InvalidateCache(*buffer);
4529762338dSopenharmony_ci    }
4539762338dSopenharmony_ci}
4549762338dSopenharmony_ci
4559762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1500)->
4569762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
4579762338dSopenharmony_ci
4589762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1600)(benchmark::State &state)
4599762338dSopenharmony_ci{
4609762338dSopenharmony_ci    BufferHandle* buffer = nullptr;
4619762338dSopenharmony_ci    AllocInfo info;
4629762338dSopenharmony_ci    info.width  = 100;
4639762338dSopenharmony_ci    info.height = 100;
4649762338dSopenharmony_ci    info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_MEM_DMA |
4659762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_READ |
4669762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE;
4679762338dSopenharmony_ci    info.format = Composer::V1_0::PIXEL_FMT_RGBA_8888;
4689762338dSopenharmony_ci    g_gralloc->AllocMem(info, buffer);
4699762338dSopenharmony_ci    for (auto _ : state) {
4709762338dSopenharmony_ci        g_gralloc->FlushCache(*buffer);
4719762338dSopenharmony_ci    }
4729762338dSopenharmony_ci}
4739762338dSopenharmony_ci
4749762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1600)->
4759762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
4769762338dSopenharmony_ci
4779762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1700)(benchmark::State &state)
4789762338dSopenharmony_ci{
4799762338dSopenharmony_ci    BufferHandle* buffer = nullptr;
4809762338dSopenharmony_ci    AllocInfo info;
4819762338dSopenharmony_ci    info.width  = 100;
4829762338dSopenharmony_ci    info.height = 100;
4839762338dSopenharmony_ci    info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_MEM_DMA |
4849762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_READ |
4859762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE;
4869762338dSopenharmony_ci    info.format = Composer::V1_0::PIXEL_FMT_RGBA_8888;
4879762338dSopenharmony_ci    g_gralloc->AllocMem(info, buffer);
4889762338dSopenharmony_ci    for (auto _ : state) {
4899762338dSopenharmony_ci        g_gralloc->Unmap(*buffer);
4909762338dSopenharmony_ci    }
4919762338dSopenharmony_ci}
4929762338dSopenharmony_ci
4939762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1700)->
4949762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
4959762338dSopenharmony_ci
4969762338dSopenharmony_ci/**
4979762338dSopenharmony_ci  * @tc.name: CreateAndDestroyVirtualDisplayTest
4989762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface CreateVirtualDisplay and DestroyVirtualDisplay.
4999762338dSopenharmony_ci  */
5009762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1800)(benchmark::State &state)
5019762338dSopenharmony_ci{
5029762338dSopenharmony_ci    int32_t ret;
5039762338dSopenharmony_ci    const uint32_t WIDTH = 100;
5049762338dSopenharmony_ci    const uint32_t HEIGHT = 100;
5059762338dSopenharmony_ci    int32_t format = 0;
5069762338dSopenharmony_ci    for (auto _ : state) {
5079762338dSopenharmony_ci        ret = g_composerDevice->CreateVirtualDisplay(WIDTH, HEIGHT, format, g_displayIds[0]);
5089762338dSopenharmony_ci        EXPECT_EQ(DISPLAY_FAILURE, ret);
5099762338dSopenharmony_ci        ret = g_composerDevice->DestroyVirtualDisplay(g_displayIds[0]);
5109762338dSopenharmony_ci    }
5119762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_FAILURE, ret);
5129762338dSopenharmony_ci}
5139762338dSopenharmony_ci
5149762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1800)->
5159762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
5169762338dSopenharmony_ci
5179762338dSopenharmony_ci/**
5189762338dSopenharmony_ci  * @tc.name: SetVirtualDisplayBufferTest
5199762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface SetVirtualDisplayBuffer.
5209762338dSopenharmony_ci  */
5219762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1900)(benchmark::State &state)
5229762338dSopenharmony_ci{
5239762338dSopenharmony_ci    BufferHandle* buffer = nullptr;
5249762338dSopenharmony_ci    int32_t ret;
5259762338dSopenharmony_ci    int32_t fence = -1;
5269762338dSopenharmony_ci
5279762338dSopenharmony_ci    AllocInfo info;
5289762338dSopenharmony_ci    info.width  = 100;
5299762338dSopenharmony_ci    info.height = 100;
5309762338dSopenharmony_ci    info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_MEM_DMA |
5319762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_READ |
5329762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE;
5339762338dSopenharmony_ci    info.format = Composer::V1_0::PIXEL_FMT_RGBA_8888;
5349762338dSopenharmony_ci
5359762338dSopenharmony_ci    g_gralloc->AllocMem(info, buffer);
5369762338dSopenharmony_ci    ASSERT_TRUE(buffer != nullptr);
5379762338dSopenharmony_ci
5389762338dSopenharmony_ci    for (auto _ : state) {
5399762338dSopenharmony_ci        ret = g_composerDevice->SetVirtualDisplayBuffer(g_displayIds[0], *buffer, fence);
5409762338dSopenharmony_ci    }
5419762338dSopenharmony_ci    g_gralloc->FreeMem(*buffer);
5429762338dSopenharmony_ci    // not support
5439762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_FAILURE, ret);
5449762338dSopenharmony_ci}
5459762338dSopenharmony_ci
5469762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_1900)->
5479762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
5489762338dSopenharmony_ci
5499762338dSopenharmony_ci/**
5509762338dSopenharmony_ci  * @tc.name: SetDisplayPropertyTest
5519762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface SetDisplayProperty.
5529762338dSopenharmony_ci  */
5539762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2000)(benchmark::State &state)
5549762338dSopenharmony_ci{
5559762338dSopenharmony_ci    int32_t ret;
5569762338dSopenharmony_ci    uint32_t id = 1;
5579762338dSopenharmony_ci    uint64_t value = 0;
5589762338dSopenharmony_ci    for (auto _ : state) {
5599762338dSopenharmony_ci        ret = g_composerDevice->SetDisplayProperty(g_displayIds[0], id, value);
5609762338dSopenharmony_ci    }
5619762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_FAILURE, ret);
5629762338dSopenharmony_ci}
5639762338dSopenharmony_ci
5649762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2000)->
5659762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
5669762338dSopenharmony_ci
5679762338dSopenharmony_ci/**
5689762338dSopenharmony_ci  * @tc.name: GetDisplayPropertyTest
5699762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplayProperty.
5709762338dSopenharmony_ci  */
5719762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2100)(benchmark::State &state)
5729762338dSopenharmony_ci{
5739762338dSopenharmony_ci    int32_t ret;
5749762338dSopenharmony_ci    uint32_t id = 1;
5759762338dSopenharmony_ci    uint64_t value = 0;
5769762338dSopenharmony_ci    for (auto _ : state) {
5779762338dSopenharmony_ci        ret = g_composerDevice->GetDisplayProperty(g_displayIds[0], id, value);
5789762338dSopenharmony_ci    }
5799762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_FAILURE, ret);
5809762338dSopenharmony_ci}
5819762338dSopenharmony_ci
5829762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2100)->
5839762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
5849762338dSopenharmony_ci
5859762338dSopenharmony_ci
5869762338dSopenharmony_ci/**
5879762338dSopenharmony_ci  * @tc.name: GetDisplaySupportedModesExtTest
5889762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplaySupportedModesExtTest.
5899762338dSopenharmony_ci  */
5909762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, GetDisplaySupportedModesExtTest)(benchmark::State &state)
5919762338dSopenharmony_ci{
5929762338dSopenharmony_ci    int32_t ret;
5939762338dSopenharmony_ci    std::vector<DisplayModeInfoExt> modes;
5949762338dSopenharmony_ci    for (auto _ : state) {
5959762338dSopenharmony_ci        ret = g_composerDevice->GetDisplaySupportedModesExt(g_displayIds[0], modes);
5969762338dSopenharmony_ci    }
5979762338dSopenharmony_ci    if (ret == DISPLAY_NOT_SUPPORT) {
5989762338dSopenharmony_ci        return;
5999762338dSopenharmony_ci    }
6009762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
6019762338dSopenharmony_ci}
6029762338dSopenharmony_ci
6039762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, GetDisplaySupportedModesExtTest)->
6049762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
6059762338dSopenharmony_ci
6069762338dSopenharmony_ci/**
6079762338dSopenharmony_ci  * @tc.name: SetDisplayModeAsyncTest
6089762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface SetDisplayModeAsyncTest.
6099762338dSopenharmony_ci  */
6109762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SetDisplayModeAsyncTest)(benchmark::State &state)
6119762338dSopenharmony_ci{
6129762338dSopenharmony_ci    int32_t ret;
6139762338dSopenharmony_ci    uint32_t modeid = 0;
6149762338dSopenharmony_ci    for (auto _ : state) {
6159762338dSopenharmony_ci        ret = g_composerDevice->SetDisplayModeAsync(g_displayIds[0], modeid, OnMode);
6169762338dSopenharmony_ci    }
6179762338dSopenharmony_ci    if (ret == DISPLAY_NOT_SUPPORT) {
6189762338dSopenharmony_ci        return;
6199762338dSopenharmony_ci    }
6209762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
6219762338dSopenharmony_ci}
6229762338dSopenharmony_ci
6239762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SetDisplayModeAsyncTest)->
6249762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
6259762338dSopenharmony_ci
6269762338dSopenharmony_ci/**
6279762338dSopenharmony_ci  * @tc.name: GetDisplayVBlankPeriodTest
6289762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplayVBlankPeriodTest.
6299762338dSopenharmony_ci  */
6309762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, GetDisplayVBlankPeriodTest)(benchmark::State &state)
6319762338dSopenharmony_ci{
6329762338dSopenharmony_ci    int32_t ret;
6339762338dSopenharmony_ci    uint64_t period = 0;
6349762338dSopenharmony_ci    for (auto _ : state) {
6359762338dSopenharmony_ci        ret = g_composerDevice->GetDisplayVBlankPeriod(g_displayIds[0], period);
6369762338dSopenharmony_ci    }
6379762338dSopenharmony_ci    if (ret == DISPLAY_NOT_SUPPORT) {
6389762338dSopenharmony_ci        return;
6399762338dSopenharmony_ci    }
6409762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
6419762338dSopenharmony_ci}
6429762338dSopenharmony_ci
6439762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, GetDisplayVBlankPeriodTest)->
6449762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
6459762338dSopenharmony_ci
6469762338dSopenharmony_ci/**
6479762338dSopenharmony_ci  * @tc.name: RegSeamlessChangeCallbackTest
6489762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface RegSeamlessChangeCallbackTest.
6499762338dSopenharmony_ci  */
6509762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, RegSeamlessChangeCallbackTest)(benchmark::State &state)
6519762338dSopenharmony_ci{
6529762338dSopenharmony_ci    int32_t ret;
6539762338dSopenharmony_ci    for (auto _ : state) {
6549762338dSopenharmony_ci        ret = g_composerDevice->RegSeamlessChangeCallback(OnseamlessChange, nullptr);
6559762338dSopenharmony_ci    }
6569762338dSopenharmony_ci    if (ret == DISPLAY_NOT_SUPPORT) {
6579762338dSopenharmony_ci        return;
6589762338dSopenharmony_ci    }
6599762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
6609762338dSopenharmony_ci}
6619762338dSopenharmony_ci
6629762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, RegSeamlessChangeCallbackTest)->
6639762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
6649762338dSopenharmony_ci
6659762338dSopenharmony_ci/**
6669762338dSopenharmony_ci  * @tc.name: SetLayerPerFrameParameterTest
6679762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface SetLayerPerFrameParameter.
6689762338dSopenharmony_ci  */
6699762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SetLayerPerFrameParameterTest)(benchmark::State &state)
6709762338dSopenharmony_ci{
6719762338dSopenharmony_ci    int32_t ret;
6729762338dSopenharmony_ci    LayerInfo layerInfo;
6739762338dSopenharmony_ci    uint32_t layerId;
6749762338dSopenharmony_ci    std::string key = "FilmFilter";
6759762338dSopenharmony_ci    std::vector<int8_t> value = { 1 };
6769762338dSopenharmony_ci    uint32_t bufferCount = 3;
6779762338dSopenharmony_ci    ret = g_composerDevice->CreateLayer(g_displayIds[0], layerInfo, bufferCount, layerId);
6789762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
6799762338dSopenharmony_ci    for (auto _ : state) {
6809762338dSopenharmony_ci        ret = g_composerDevice->SetLayerPerFrameParameter(g_displayIds[0], layerId, key, value);
6819762338dSopenharmony_ci    }
6829762338dSopenharmony_ci    g_composerDevice->DestroyLayer(g_displayIds[0], layerId);
6839762338dSopenharmony_ci    if (ret == DISPLAY_NOT_SUPPORT) {
6849762338dSopenharmony_ci        return;
6859762338dSopenharmony_ci    }
6869762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
6879762338dSopenharmony_ci}
6889762338dSopenharmony_ci
6899762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SetLayerPerFrameParameterTest)->
6909762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
6919762338dSopenharmony_ci
6929762338dSopenharmony_ci/**
6939762338dSopenharmony_ci  * @tc.name: GetSupportedLayerPerFrameParameterKeyTest
6949762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetSupportedLayerPerFrameParameterKey.
6959762338dSopenharmony_ci  */
6969762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, GetSupportedLayerPerFrameParameterKeyTest)(benchmark::State &state)
6979762338dSopenharmony_ci{
6989762338dSopenharmony_ci    int32_t ret;
6999762338dSopenharmony_ci    std::vector<std::string> keys;
7009762338dSopenharmony_ci    for (auto _ : state) {
7019762338dSopenharmony_ci        ret = g_composerDevice->GetSupportedLayerPerFrameParameterKey(keys);
7029762338dSopenharmony_ci    }
7039762338dSopenharmony_ci    if (ret == DISPLAY_NOT_SUPPORT) {
7049762338dSopenharmony_ci        return;
7059762338dSopenharmony_ci    }
7069762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
7079762338dSopenharmony_ci}
7089762338dSopenharmony_ci
7099762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, GetSupportedLayerPerFrameParameterKeyTest)->
7109762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
7119762338dSopenharmony_ci
7129762338dSopenharmony_ci/**
7139762338dSopenharmony_ci  * @tc.name: SetDisplayOverlayResolutionTest
7149762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface SetDisplayOverlayResolution.
7159762338dSopenharmony_ci  */
7169762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SetDisplayOverlayResolutionTest)(benchmark::State &state)
7179762338dSopenharmony_ci{
7189762338dSopenharmony_ci    int32_t ret;
7199762338dSopenharmony_ci    DisplayModeInfo mode = HdiTestDevice::GetInstance().GetFirstDisplay()->GetCurrentMode();
7209762338dSopenharmony_ci    for (auto _ : state) {
7219762338dSopenharmony_ci        ret = g_composerDevice->SetDisplayOverlayResolution(g_displayIds[0], mode.width, mode.height);
7229762338dSopenharmony_ci    }
7239762338dSopenharmony_ci    if (ret == DISPLAY_NOT_SUPPORT) {
7249762338dSopenharmony_ci        return;
7259762338dSopenharmony_ci    }
7269762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
7279762338dSopenharmony_ci}
7289762338dSopenharmony_ci
7299762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SetDisplayOverlayResolutionTest)->
7309762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
7319762338dSopenharmony_ci
7329762338dSopenharmony_ci/**
7339762338dSopenharmony_ci  * @tc.name: RegRefreshCallbackTest
7349762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface RegRefreshCallback.
7359762338dSopenharmony_ci  */
7369762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, RegRefreshCallbackTest)(benchmark::State &state)
7379762338dSopenharmony_ci{
7389762338dSopenharmony_ci    int32_t ret;
7399762338dSopenharmony_ci    for (auto _ : state) {
7409762338dSopenharmony_ci        ret = g_composerDevice->RegRefreshCallback(TestRefreshCallback, nullptr);
7419762338dSopenharmony_ci    }
7429762338dSopenharmony_ci    if (ret == DISPLAY_NOT_SUPPORT) {
7439762338dSopenharmony_ci        return;
7449762338dSopenharmony_ci    }
7459762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
7469762338dSopenharmony_ci}
7479762338dSopenharmony_ci
7489762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, RegRefreshCallbackTest)->
7499762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
7509762338dSopenharmony_ci
7519762338dSopenharmony_ci/**
7529762338dSopenharmony_ci  * @tc.name: GetDisplaySupportedColorGamutsTest
7539762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetDisplaySupportedColorGamuts.
7549762338dSopenharmony_ci  */
7559762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, GetDisplaySupportedColorGamutsTest)(benchmark::State &state)
7569762338dSopenharmony_ci{
7579762338dSopenharmony_ci    int32_t ret;
7589762338dSopenharmony_ci    std::vector<ColorGamut> gamuts;
7599762338dSopenharmony_ci    for (auto _ : state) {
7609762338dSopenharmony_ci        ret = g_composerDevice->GetDisplaySupportedColorGamuts(g_displayIds[0], gamuts);
7619762338dSopenharmony_ci    }
7629762338dSopenharmony_ci    if (ret == DISPLAY_NOT_SUPPORT) {
7639762338dSopenharmony_ci        return;
7649762338dSopenharmony_ci    }
7659762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
7669762338dSopenharmony_ci}
7679762338dSopenharmony_ci
7689762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, GetDisplaySupportedColorGamutsTest)->
7699762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
7709762338dSopenharmony_ci
7719762338dSopenharmony_ci/**
7729762338dSopenharmony_ci  * @tc.name: GetHDRCapabilityInfosTest
7739762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface GetHDRCapabilityInfos.
7749762338dSopenharmony_ci  */
7759762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, GetHDRCapabilityInfosTest)(benchmark::State &state)
7769762338dSopenharmony_ci{
7779762338dSopenharmony_ci    int32_t ret;
7789762338dSopenharmony_ci    HDRCapability info = { 0 };
7799762338dSopenharmony_ci    for (auto _ : state) {
7809762338dSopenharmony_ci        ret = g_composerDevice->GetHDRCapabilityInfos(g_displayIds[0], info);
7819762338dSopenharmony_ci    }
7829762338dSopenharmony_ci    if (ret == DISPLAY_NOT_SUPPORT) {
7839762338dSopenharmony_ci        return;
7849762338dSopenharmony_ci    }
7859762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
7869762338dSopenharmony_ci}
7879762338dSopenharmony_ci
7889762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, GetHDRCapabilityInfosTest)->
7899762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
7909762338dSopenharmony_ci
7919762338dSopenharmony_ci/**
7929762338dSopenharmony_ci  * @tc.name: SetDisplayClientCropTest
7939762338dSopenharmony_ci  * @tc.desc: Benchmarktest for interface SetDisplayClientCrop.
7949762338dSopenharmony_ci  */
7959762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2200)(benchmark::State &state)
7969762338dSopenharmony_ci{
7979762338dSopenharmony_ci    int32_t ret;
7989762338dSopenharmony_ci    int32_t width = 100;
7999762338dSopenharmony_ci    int32_t height = 100;
8009762338dSopenharmony_ci    IRect rect = {0, 0, width, height};
8019762338dSopenharmony_ci    for (auto _ : state) {
8029762338dSopenharmony_ci        ret = g_composerDevice->SetDisplayClientCrop(g_displayIds[0], rect);
8039762338dSopenharmony_ci    }
8049762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_FAILURE, ret);
8059762338dSopenharmony_ci}
8069762338dSopenharmony_ci
8079762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2200)->
8089762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
8099762338dSopenharmony_ci
8109762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2300)(benchmark::State &state)
8119762338dSopenharmony_ci{
8129762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
8139762338dSopenharmony_ci        {
8149762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
8159762338dSopenharmony_ci            .color = RED
8169762338dSopenharmony_ci        },
8179762338dSopenharmony_ci        {
8189762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
8199762338dSopenharmony_ci            .color = GREEN
8209762338dSopenharmony_ci        },
8219762338dSopenharmony_ci        {
8229762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
8239762338dSopenharmony_ci            .color = YELLOW
8249762338dSopenharmony_ci        },
8259762338dSopenharmony_ci    };
8269762338dSopenharmony_ci
8279762338dSopenharmony_ci    std::vector<std::vector<int>> zorders = {
8289762338dSopenharmony_ci        { 3, 2, 1 }, { 1, 3, 2 }, { 3, 1, 2 }, { 1, 2, 3 }, { 2, 1, 3 }, { 2, 3, 1 },
8299762338dSopenharmony_ci    };
8309762338dSopenharmony_ci    std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
8319762338dSopenharmony_ci
8329762338dSopenharmony_ci    for (auto _ : state) {
8339762338dSopenharmony_ci        for (const auto& zorderList : zorders) {
8349762338dSopenharmony_ci            // adjust the zorder
8359762338dSopenharmony_ci            for (uint32_t i = 0; i < zorderList.size(); i++) {
8369762338dSopenharmony_ci                settings[i].zorder = zorderList[i];
8379762338dSopenharmony_ci                layers[i]->SetZorder(zorderList[i]);
8389762338dSopenharmony_ci            }
8399762338dSopenharmony_ci            std::vector<LayerSettings> tempSettings = settings;
8409762338dSopenharmony_ci            std::sort(tempSettings.begin(), tempSettings.end(),
8419762338dSopenharmony_ci                [=](const auto& l, auto const & r) { return l.zorder < r.zorder; });
8429762338dSopenharmony_ci            // present and check
8439762338dSopenharmony_ci            PresentAndCheck(tempSettings);
8449762338dSopenharmony_ci        }
8459762338dSopenharmony_ci    }
8469762338dSopenharmony_ci    HdiTestDevice::GetInstance().Clear();
8479762338dSopenharmony_ci}
8489762338dSopenharmony_ci
8499762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2300)->
8509762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
8519762338dSopenharmony_ci
8529762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2400)(benchmark::State &state)
8539762338dSopenharmony_ci{
8549762338dSopenharmony_ci    int32_t ret;
8559762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
8569762338dSopenharmony_ci        {
8579762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
8589762338dSopenharmony_ci            .color = GREEN
8599762338dSopenharmony_ci        },
8609762338dSopenharmony_ci    };
8619762338dSopenharmony_ci    for (auto _ : state) {
8629762338dSopenharmony_ci        std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
8639762338dSopenharmony_ci        ASSERT_TRUE((layers.size() > 0));
8649762338dSopenharmony_ci        PrepareAndPrensent();
8659762338dSopenharmony_ci        auto layer = layers[0];
8669762338dSopenharmony_ci        bool preMul = true;
8679762338dSopenharmony_ci        ret = g_composerDevice->SetLayerPreMulti(g_displayIds[0], layer->GetId(), preMul);
8689762338dSopenharmony_ci    }
8699762338dSopenharmony_ci    PrepareAndPrensent();
8709762338dSopenharmony_ci    HdiTestDevice::GetInstance().Clear();
8719762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
8729762338dSopenharmony_ci}
8739762338dSopenharmony_ci
8749762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2400)->
8759762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
8769762338dSopenharmony_ci
8779762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2500)(benchmark::State &state)
8789762338dSopenharmony_ci{
8799762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
8809762338dSopenharmony_ci        {
8819762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
8829762338dSopenharmony_ci            .color = GREEN
8839762338dSopenharmony_ci        },
8849762338dSopenharmony_ci        {
8859762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
8869762338dSopenharmony_ci            .color = RED
8879762338dSopenharmony_ci        },
8889762338dSopenharmony_ci    };
8899762338dSopenharmony_ci
8909762338dSopenharmony_ci    std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
8919762338dSopenharmony_ci    ASSERT_TRUE((layers.size() > 0));
8929762338dSopenharmony_ci
8939762338dSopenharmony_ci    auto layer = layers[1];
8949762338dSopenharmony_ci    LayerAlpha alpha = { 0 };
8959762338dSopenharmony_ci    alpha.enGlobalAlpha = true;
8969762338dSopenharmony_ci    alpha.enPixelAlpha = true;
8979762338dSopenharmony_ci    alpha.gAlpha = 0;
8989762338dSopenharmony_ci    alpha.alpha0 = 0;
8999762338dSopenharmony_ci    alpha.alpha1 = 0;
9009762338dSopenharmony_ci    for (auto _ : state) {
9019762338dSopenharmony_ci        layer->SetAlpha(alpha);
9029762338dSopenharmony_ci    }
9039762338dSopenharmony_ci    PrepareAndPrensent();
9049762338dSopenharmony_ci    HdiTestDevice::GetInstance().Clear();
9059762338dSopenharmony_ci}
9069762338dSopenharmony_ci
9079762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2500)->
9089762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
9099762338dSopenharmony_ci
9109762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2600)(benchmark::State &state)
9119762338dSopenharmony_ci{
9129762338dSopenharmony_ci    int32_t ret;
9139762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
9149762338dSopenharmony_ci        {.rectRatio = {0, 0, 1.0f, 1.0f}, .color = GREEN, .alpha = 0xFF}
9159762338dSopenharmony_ci    };
9169762338dSopenharmony_ci    for (auto _ : state) {
9179762338dSopenharmony_ci        std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
9189762338dSopenharmony_ci        ASSERT_TRUE((layers.size() > 0));
9199762338dSopenharmony_ci
9209762338dSopenharmony_ci        const int32_t WIDTH = 100;
9219762338dSopenharmony_ci        const int32_t HEIGHT = 100;
9229762338dSopenharmony_ci        auto layer = layers[0];
9239762338dSopenharmony_ci        IRect rect = {0, 0, WIDTH, HEIGHT};
9249762338dSopenharmony_ci        ret = g_composerDevice->SetLayerRegion(g_displayIds[0], layer->GetId(), rect);
9259762338dSopenharmony_ci    }
9269762338dSopenharmony_ci    PrepareAndPrensent();
9279762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
9289762338dSopenharmony_ci}
9299762338dSopenharmony_ci
9309762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2600)->
9319762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
9329762338dSopenharmony_ci
9339762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2700)(benchmark::State &state)
9349762338dSopenharmony_ci{
9359762338dSopenharmony_ci    int32_t ret;
9369762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
9379762338dSopenharmony_ci        {
9389762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
9399762338dSopenharmony_ci            .color = BLUE
9409762338dSopenharmony_ci        }
9419762338dSopenharmony_ci    };
9429762338dSopenharmony_ci    for (auto _ : state) {
9439762338dSopenharmony_ci        std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
9449762338dSopenharmony_ci        ASSERT_TRUE((layers.size() > 0));
9459762338dSopenharmony_ci        auto layer = layers[0];
9469762338dSopenharmony_ci        const int32_t WIDTH = 100;
9479762338dSopenharmony_ci        const int32_t HEIGHT = 100;
9489762338dSopenharmony_ci        IRect rect = {0, 0, WIDTH, HEIGHT};
9499762338dSopenharmony_ci        std::vector<IRect> vRects;
9509762338dSopenharmony_ci        vRects.push_back(rect);
9519762338dSopenharmony_ci        ret = g_composerDevice->SetLayerDirtyRegion(g_displayIds[0], layer->GetId(), vRects);
9529762338dSopenharmony_ci    }
9539762338dSopenharmony_ci    PrepareAndPrensent();
9549762338dSopenharmony_ci    HdiTestDevice::GetInstance().Clear();
9559762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
9569762338dSopenharmony_ci}
9579762338dSopenharmony_ci
9589762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2700)->
9599762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
9609762338dSopenharmony_ci
9619762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2800)(benchmark::State &state)
9629762338dSopenharmony_ci{
9639762338dSopenharmony_ci    int32_t ret;
9649762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
9659762338dSopenharmony_ci        {
9669762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
9679762338dSopenharmony_ci            .color = RED
9689762338dSopenharmony_ci        }
9699762338dSopenharmony_ci    };
9709762338dSopenharmony_ci    std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
9719762338dSopenharmony_ci    ASSERT_TRUE((layers.size() > 0));
9729762338dSopenharmony_ci    PrepareAndPrensent();
9739762338dSopenharmony_ci    auto layer = layers[0];
9749762338dSopenharmony_ci    for (auto _ : state) {
9759762338dSopenharmony_ci        TransformType type = TransformType::ROTATE_90;
9769762338dSopenharmony_ci        ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
9779762338dSopenharmony_ci        PrepareAndPrensent();
9789762338dSopenharmony_ci
9799762338dSopenharmony_ci        type = TransformType::ROTATE_180;
9809762338dSopenharmony_ci        ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
9819762338dSopenharmony_ci        PrepareAndPrensent();
9829762338dSopenharmony_ci
9839762338dSopenharmony_ci        type = TransformType::ROTATE_270;
9849762338dSopenharmony_ci        ret = g_composerDevice->SetLayerTransformMode(g_displayIds[0], layer->GetId(), type);
9859762338dSopenharmony_ci        PrepareAndPrensent();
9869762338dSopenharmony_ci    }
9879762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
9889762338dSopenharmony_ci}
9899762338dSopenharmony_ci
9909762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2800)->
9919762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
9929762338dSopenharmony_ci
9939762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2900)(benchmark::State &state)
9949762338dSopenharmony_ci{
9959762338dSopenharmony_ci    int32_t ret;
9969762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
9979762338dSopenharmony_ci        {
9989762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
9999762338dSopenharmony_ci            .color = BLUE
10009762338dSopenharmony_ci        }
10019762338dSopenharmony_ci    };
10029762338dSopenharmony_ci    for (auto _ : state) {
10039762338dSopenharmony_ci        std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
10049762338dSopenharmony_ci        ASSERT_TRUE((layers.size() > 0));
10059762338dSopenharmony_ci        PrepareAndPrensent();
10069762338dSopenharmony_ci        auto layer = layers[0];
10079762338dSopenharmony_ci        const int32_t WIDTH = 500;
10089762338dSopenharmony_ci        const int32_t HEIGHT = 500;
10099762338dSopenharmony_ci        IRect region = {0, 0, WIDTH, HEIGHT};
10109762338dSopenharmony_ci        std::vector<IRect> regions = {};
10119762338dSopenharmony_ci        regions.push_back(region);
10129762338dSopenharmony_ci        ret = g_composerDevice->SetLayerVisibleRegion(g_displayIds[0], layer->GetId(), regions);
10139762338dSopenharmony_ci    }
10149762338dSopenharmony_ci    PrepareAndPrensent();
10159762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
10169762338dSopenharmony_ci}
10179762338dSopenharmony_ci
10189762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_2900)->
10199762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
10209762338dSopenharmony_ci
10219762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3000)(benchmark::State &state)
10229762338dSopenharmony_ci{
10239762338dSopenharmony_ci    int32_t ret;
10249762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
10259762338dSopenharmony_ci        {
10269762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
10279762338dSopenharmony_ci            .color = BLUE
10289762338dSopenharmony_ci        }
10299762338dSopenharmony_ci    };
10309762338dSopenharmony_ci    for (auto _ : state) {
10319762338dSopenharmony_ci        std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
10329762338dSopenharmony_ci        ASSERT_TRUE((layers.size() > 0));
10339762338dSopenharmony_ci        auto layer = layers[0];
10349762338dSopenharmony_ci        Composer::V1_0::CompositionType type = Composer::V1_0::CompositionType::COMPOSITION_CLIENT;
10359762338dSopenharmony_ci        ret = g_composerDevice->SetLayerCompositionType(g_displayIds[0], layer->GetId(), type);
10369762338dSopenharmony_ci    }
10379762338dSopenharmony_ci    PrepareAndPrensent();
10389762338dSopenharmony_ci
10399762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
10409762338dSopenharmony_ci}
10419762338dSopenharmony_ci
10429762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3000)->
10439762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
10449762338dSopenharmony_ci
10459762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3100)(benchmark::State &state)
10469762338dSopenharmony_ci{
10479762338dSopenharmony_ci    int32_t ret;
10489762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
10499762338dSopenharmony_ci        {
10509762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
10519762338dSopenharmony_ci            .color = GREEN
10529762338dSopenharmony_ci        }
10539762338dSopenharmony_ci    };
10549762338dSopenharmony_ci    for (auto _ : state) {
10559762338dSopenharmony_ci        std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
10569762338dSopenharmony_ci        ASSERT_TRUE((layers.size() > 0));
10579762338dSopenharmony_ci        auto layer = layers[0];
10589762338dSopenharmony_ci        BlendType type = BlendType::BLEND_NONE;
10599762338dSopenharmony_ci        ret = g_composerDevice->SetLayerBlendType(g_displayIds[0], layer->GetId(), type);
10609762338dSopenharmony_ci    }
10619762338dSopenharmony_ci    PrepareAndPrensent();
10629762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
10639762338dSopenharmony_ci}
10649762338dSopenharmony_ci
10659762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3100)->
10669762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
10679762338dSopenharmony_ci
10689762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3200)(benchmark::State &state)
10699762338dSopenharmony_ci{
10709762338dSopenharmony_ci    int32_t ret;
10719762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
10729762338dSopenharmony_ci        {
10739762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
10749762338dSopenharmony_ci            .color = GREEN
10759762338dSopenharmony_ci        }
10769762338dSopenharmony_ci    };
10779762338dSopenharmony_ci    for (auto _ : state) {
10789762338dSopenharmony_ci        std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
10799762338dSopenharmony_ci        ASSERT_TRUE((layers.size() > 0));
10809762338dSopenharmony_ci        auto layer = layers[0];
10819762338dSopenharmony_ci        MaskInfo maskInfo = MaskInfo::LAYER_HBM_SYNC;
10829762338dSopenharmony_ci        ret = g_composerDevice->SetLayerMaskInfo(g_displayIds[0], layer->GetId(), maskInfo);
10839762338dSopenharmony_ci    }
10849762338dSopenharmony_ci    PrepareAndPrensent();
10859762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
10869762338dSopenharmony_ci}
10879762338dSopenharmony_ci
10889762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3200)->
10899762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
10909762338dSopenharmony_ci
10919762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3300)(benchmark::State &state)
10929762338dSopenharmony_ci{
10939762338dSopenharmony_ci    int32_t ret;
10949762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
10959762338dSopenharmony_ci        {
10969762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
10979762338dSopenharmony_ci            .color = GREEN
10989762338dSopenharmony_ci        }
10999762338dSopenharmony_ci    };
11009762338dSopenharmony_ci    for (auto _ : state) {
11019762338dSopenharmony_ci        std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
11029762338dSopenharmony_ci        ASSERT_TRUE((layers.size() > 0));
11039762338dSopenharmony_ci        auto layer = layers[0];
11049762338dSopenharmony_ci        const uint32_t COLOR_R = 155;
11059762338dSopenharmony_ci        const uint32_t COLOR_G = 224;
11069762338dSopenharmony_ci        const uint32_t COLOR_B = 88;
11079762338dSopenharmony_ci        const uint32_t COLOR_A = 128;
11089762338dSopenharmony_ci        LayerColor layerColor = {
11099762338dSopenharmony_ci            .r = COLOR_R,
11109762338dSopenharmony_ci            .g = COLOR_G,
11119762338dSopenharmony_ci            .b = COLOR_B,
11129762338dSopenharmony_ci            .a = COLOR_A
11139762338dSopenharmony_ci        };
11149762338dSopenharmony_ci        ret = g_composerDevice->SetLayerColor(g_displayIds[0], layer->GetId(), layerColor);
11159762338dSopenharmony_ci    }
11169762338dSopenharmony_ci    PrepareAndPrensent();
11179762338dSopenharmony_ci
11189762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
11199762338dSopenharmony_ci}
11209762338dSopenharmony_ci
11219762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3300)->
11229762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
11239762338dSopenharmony_ci
11249762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3400)(benchmark::State &state)
11259762338dSopenharmony_ci{
11269762338dSopenharmony_ci    int32_t ret;
11279762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
11289762338dSopenharmony_ci        {
11299762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
11309762338dSopenharmony_ci            .color = PURPLE
11319762338dSopenharmony_ci        }
11329762338dSopenharmony_ci    };
11339762338dSopenharmony_ci    for (auto _ : state) {
11349762338dSopenharmony_ci        std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
11359762338dSopenharmony_ci        ASSERT_TRUE((layers.size() > 0));
11369762338dSopenharmony_ci        auto layer = layers[0];
11379762338dSopenharmony_ci        PrepareAndPrensent();
11389762338dSopenharmony_ci        ret = g_composerDevice->DestroyLayer(g_displayIds[0], layer->GetId());
11399762338dSopenharmony_ci    }
11409762338dSopenharmony_ci    PrepareAndPrensent();
11419762338dSopenharmony_ci    EXPECT_EQ(DISPLAY_SUCCESS, ret);
11429762338dSopenharmony_ci}
11439762338dSopenharmony_ci
11449762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3400)->
11459762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
11469762338dSopenharmony_ci
11479762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3500)(benchmark::State &state)
11489762338dSopenharmony_ci{
11499762338dSopenharmony_ci    std::vector<LayerSettings> settings = {
11509762338dSopenharmony_ci        {
11519762338dSopenharmony_ci            .rectRatio = { 0, 0, 1.0f, 1.0f },
11529762338dSopenharmony_ci            .color = PURPLE
11539762338dSopenharmony_ci        }
11549762338dSopenharmony_ci    };
11559762338dSopenharmony_ci    for (auto _ : state) {
11569762338dSopenharmony_ci        std::vector<std::shared_ptr<HdiTestLayer>> layers = CreateLayers(settings);
11579762338dSopenharmony_ci        ASSERT_TRUE((layers.size() > 0));
11589762338dSopenharmony_ci    }
11599762338dSopenharmony_ci    PrepareAndPrensent();
11609762338dSopenharmony_ci}
11619762338dSopenharmony_ci
11629762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3500)->
11639762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
11649762338dSopenharmony_ci
11659762338dSopenharmony_ci
11669762338dSopenharmony_ciBENCHMARK_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3600)(benchmark::State &state)
11679762338dSopenharmony_ci{
11689762338dSopenharmony_ci    BufferHandle* buffer = nullptr;
11699762338dSopenharmony_ci    AllocInfo info;
11709762338dSopenharmony_ci    info.width  = 100;
11719762338dSopenharmony_ci    info.height = 100;
11729762338dSopenharmony_ci    info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_MEM_DMA |
11739762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_READ |
11749762338dSopenharmony_ci            OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE;
11759762338dSopenharmony_ci    info.format = Composer::V1_0::PIXEL_FMT_RGBA_8888;
11769762338dSopenharmony_ci    for (auto _ : state) {
11779762338dSopenharmony_ci        g_gralloc->AllocMem(info, buffer);
11789762338dSopenharmony_ci        g_gralloc->Unmap(*buffer);
11799762338dSopenharmony_ci        g_gralloc->FreeMem(*buffer);
11809762338dSopenharmony_ci    }
11819762338dSopenharmony_ci}
11829762338dSopenharmony_ci
11839762338dSopenharmony_ciBENCHMARK_REGISTER_F(DisplayBenchmarkTest, SUB_Driver_Display_Performace_3600)->
11849762338dSopenharmony_ci    Iterations(100)->Repetitions(3)->ReportAggregatesOnly();
11859762338dSopenharmony_ci
11869762338dSopenharmony_ci}
11879762338dSopenharmony_ciint main(int argc, char** argv)
11889762338dSopenharmony_ci{
11899762338dSopenharmony_ci    int ret = HdiTestDevice::GetInstance().InitDevice();
11909762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE, DISPLAY_TEST_LOGE("Init Device Failed"));
11919762338dSopenharmony_ci    ::testing::InitGoogleTest(&argc, argv);
11929762338dSopenharmony_ci    ::benchmark::Initialize(&argc, argv);
11939762338dSopenharmony_ci    if (::benchmark::ReportUnrecognizedArguments(argc, argv)) {
11949762338dSopenharmony_ci        return 1; // 1: Benchmark native test suite native solution
11959762338dSopenharmony_ci    }
11969762338dSopenharmony_ci    g_composerDevice = HdiTestDevice::GetInstance().GetDeviceInterface();
11979762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((g_composerDevice == nullptr), DISPLAY_FAILURE,
11989762338dSopenharmony_ci        DISPLAY_TEST_LOGE("get composer interface failed"));
11999762338dSopenharmony_ci    g_gralloc.reset(IDisplayBuffer::Get());
12009762338dSopenharmony_ci    DISPLAY_TEST_CHK_RETURN((g_gralloc == nullptr), DISPLAY_FAILURE,
12019762338dSopenharmony_ci        DISPLAY_TEST_LOGE("get buffer interface failed"));
12029762338dSopenharmony_ci    auto display = HdiTestDevice::GetInstance().GetFirstDisplay();
12039762338dSopenharmony_ci    if (display != nullptr) {
12049762338dSopenharmony_ci        g_displayIds = HdiTestDevice::GetInstance().GetDevIds();
12059762338dSopenharmony_ci        display->SetDisplayVsyncEnabled(false);
12069762338dSopenharmony_ci    }
12079762338dSopenharmony_ci    ::benchmark::RunSpecifiedBenchmarks();
12089762338dSopenharmony_ci    ::benchmark::Shutdown();
12099762338dSopenharmony_ci    HdiTestDevice::GetInstance().GetFirstDisplay()->ResetClientLayer();
12109762338dSopenharmony_ci    return ret;
12119762338dSopenharmony_ci}