mirror of
https://gitee.com/openharmony/xts_hats
synced 2024-11-27 09:00:57 +00:00
commit
96a1ab118d
@ -18,7 +18,10 @@ import("//test/xts/tools/build/suite.gni")
|
||||
group("HatsHdfDisplayTest") {
|
||||
testonly = true
|
||||
if (xts_hats_rich == true) {
|
||||
deps = [ "gralloc/adaptation:HatsHdfDisplayAdaptationTest" ]
|
||||
deps = [
|
||||
"buffer:HatsHdfDisplayBufferTest",
|
||||
"composer:HatsHdfDisplayComposerTest",
|
||||
]
|
||||
} else {
|
||||
deps = [
|
||||
#"device:HatsHdfDisplayDeviceTest",
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
@ -13,59 +13,13 @@
|
||||
|
||||
import("//build/ohos_var.gni")
|
||||
import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni")
|
||||
import("//test/xts/hats/build.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
group("HatsHdfDisplayBufferTest") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":HatsHdfDisplayBufferDeathTest",
|
||||
":HatsHdfDisplayBufferUtTest",
|
||||
"death:HatsHdfDisplayBufferDeathTest",
|
||||
"unittest:HatsHdfDisplayBufferUtTest",
|
||||
]
|
||||
}
|
||||
|
||||
module_output_path = "hats/display"
|
||||
base_root = "../../../../../../"
|
||||
|
||||
ohos_moduletest_suite("HatsHdfDisplayBufferUtTest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [ "display_buffer_ut.cpp" ]
|
||||
deps = [ "$base_root/third_party/googletest:gtest_main" ]
|
||||
include_dirs = [
|
||||
"utils",
|
||||
"$base_root/drivers/peripheral/base",
|
||||
"$base_root/drivers/interface/display/composer/hdifd_parcelable",
|
||||
]
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"drivers_interface_display:display_buffer_idl_headers",
|
||||
"drivers_interface_display:display_composer_idl_headers",
|
||||
"drivers_interface_display:libdisplay_buffer_hdi_impl",
|
||||
"hdf_core:libhdf_utils",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
]
|
||||
subsystem_name = "hdf"
|
||||
part_name = "drivers_peripheral_display"
|
||||
}
|
||||
|
||||
ohos_moduletest_suite("HatsHdfDisplayBufferDeathTest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [ "death_test.cpp" ]
|
||||
deps = [ "$base_root/third_party/googletest:gtest_main" ]
|
||||
include_dirs = [
|
||||
"utils",
|
||||
"$base_root/drivers/peripheral/base",
|
||||
"$base_root/drivers/interface/display/composer/hdifd_parcelable",
|
||||
]
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"drivers_interface_display:display_buffer_idl_headers",
|
||||
"drivers_interface_display:display_composer_idl_headers",
|
||||
"drivers_interface_display:libdisplay_buffer_hdi_impl",
|
||||
"hdf_core:libhdf_utils",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
]
|
||||
subsystem_name = "hdf"
|
||||
part_name = "drivers_peripheral_display"
|
||||
}
|
||||
|
44
hdf/display/buffer/death/BUILD.gn
Normal file
44
hdf/display/buffer/death/BUILD.gn
Normal file
@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos_var.gni")
|
||||
import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni")
|
||||
import("//drivers/peripheral/display/display_config.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
module_output_path = "hats/display"
|
||||
base_root = "../../../../../../../"
|
||||
|
||||
ohos_moduletest_suite("HatsHdfDisplayBufferDeathTest") {
|
||||
defines = []
|
||||
defines += display_defines
|
||||
module_out_path = module_output_path
|
||||
sources = [ "death_test.cpp" ]
|
||||
deps = [ "$base_root/third_party/googletest:gtest_main" ]
|
||||
include_dirs = [
|
||||
"utils",
|
||||
"$base_root/drivers/peripheral/base",
|
||||
"$base_root/drivers/interface/display/composer/hdifd_parcelable",
|
||||
]
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"drivers_interface_display:display_buffer_idl_headers",
|
||||
"drivers_interface_display:display_composer_idl_headers",
|
||||
"drivers_interface_display:libdisplay_buffer_hdi_impl",
|
||||
"hdf_core:libhdf_utils",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
]
|
||||
subsystem_name = "hdf"
|
||||
part_name = "drivers_peripheral_display"
|
||||
}
|
18
hdf/display/buffer/death/Test.json
Normal file
18
hdf/display/buffer/death/Test.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"kits": [
|
||||
{
|
||||
"push": [
|
||||
"HatsHdfDisplayBufferDeathTest->/data/local/tmp/HatsHdfDisplayBufferDeathTest"
|
||||
],
|
||||
"type": "PushKit"
|
||||
}
|
||||
],
|
||||
"driver": {
|
||||
"native-test-timeout": "120000",
|
||||
"type": "CppTest",
|
||||
"module-name": "HatsHdfDisplayBufferDeathTest",
|
||||
"runtime-hint": "1s",
|
||||
"native-test-device-path": "/data/local/tmp"
|
||||
},
|
||||
"description": "Configuration for HatsHdfDisplayBufferDeathTest Tests"
|
||||
}
|
@ -1,395 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "display_buffer_ut.h"
|
||||
#include <securec.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "v1_0/display_buffer_type.h"
|
||||
#include "v1_0/display_composer_type.h"
|
||||
#include "v1_0/include/idisplay_buffer.h"
|
||||
#include "hdf_base.h"
|
||||
#include "hdf_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace HDI {
|
||||
namespace Display {
|
||||
namespace TEST {
|
||||
using namespace OHOS::HDI::Display::Composer::V1_0;
|
||||
using namespace OHOS::HDI::Display::Buffer::V1_0;
|
||||
|
||||
#define ALIGN_UP(x, a) ((((x) + ((a)-1)) / (a)) * (a))
|
||||
|
||||
#ifndef DISPLAY_TEST_CHK_RETURN
|
||||
#define DISPLAY_TEST_CHK_RETURN(val, ret, ...) \
|
||||
do { \
|
||||
if (val) { \
|
||||
__VA_ARGS__; \
|
||||
return (ret); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
const uint32_t HEIGHT_ALIGN = 2U; // height align
|
||||
const uint32_t ALLOC_SIZE_1080 = 1080; // alloc size 1080
|
||||
const uint32_t ALLOC_SIZE_1920 = 1920; // alloc size 1920
|
||||
const uint32_t ALLOC_SIZE_1280 = 1280; // alloc size 1280
|
||||
const uint32_t ALLOC_SIZE_720 = 720; // alloc size 720
|
||||
const uint32_t EXPECT_STRIDE = 1088; // expect image stride
|
||||
const uint32_t EXPECT_STRIDE_SCALE_4 = 4; // 4 times of expect image stride
|
||||
const uint32_t EXPECT_STRIDE_SCALE_3 = 3; // 3 times of expect image stride
|
||||
const uint32_t EXPECT_STRIDE_SCALE_2 = 2; // 2 times of expect image stride
|
||||
|
||||
|
||||
const AllocTestPrms DISPLAY_BUFFER_TEST_SETS[] = {
|
||||
// num0
|
||||
// SUB_DriverSystem_DisplayHdi_0050
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1920,
|
||||
.height = ALLOC_SIZE_1080,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
.expectStride = ALLOC_SIZE_1920 * EXPECT_STRIDE_SCALE_4,
|
||||
.expectSize = ALLOC_SIZE_1920 * ALLOC_SIZE_1080 * EXPECT_STRIDE_SCALE_4
|
||||
},
|
||||
// num1
|
||||
// SUB_DriverSystem_DisplayHdi_0060
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4
|
||||
},
|
||||
// num2
|
||||
// SUB_DriverSystem_DisplayHdi_0070
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1280,
|
||||
.height = ALLOC_SIZE_720,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
.expectStride = ALLOC_SIZE_1280 * EXPECT_STRIDE_SCALE_4,
|
||||
.expectSize = ALLOC_SIZE_1280 * ALLOC_SIZE_720 * EXPECT_STRIDE_SCALE_4
|
||||
},
|
||||
// num3
|
||||
// SUB_DriverSystem_DisplayHdi_0080
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBA_8888
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4
|
||||
},
|
||||
// num4
|
||||
// SUB_DriverSystem_DisplayHdi_0090
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGB_888
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_3,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_3
|
||||
},
|
||||
// num5
|
||||
// SUB_DriverSystem_DisplayHdi_0100
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRA_8888
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4
|
||||
},
|
||||
// num6
|
||||
// SUB_DriverSystem_DisplayHdi_0110
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRX_8888
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4
|
||||
},
|
||||
// num7
|
||||
// SUB_DriverSystem_DisplayHdi_0120
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBA_4444
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2
|
||||
},
|
||||
// num8
|
||||
// SUB_DriverSystem_DisplayHdi_0130
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBX_4444
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2
|
||||
},
|
||||
// num9
|
||||
// SUB_DriverSystem_DisplayHdi_0140
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRA_4444
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2
|
||||
},
|
||||
// num10
|
||||
// SUB_DriverSystem_DisplayHdi_0150
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRX_4444
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2
|
||||
},
|
||||
// num11
|
||||
// SUB_DriverSystem_DisplayHdi_0160
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGR_565
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2
|
||||
},
|
||||
// num12
|
||||
// SUB_DriverSystem_DisplayHdi_0170
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRA_5551
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2
|
||||
},
|
||||
// num13
|
||||
// SUB_DriverSystem_DisplayHdi_0180
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRX_5551
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_2
|
||||
},
|
||||
// num14
|
||||
// SUB_DriverSystem_DisplayHdi_0190
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_YCBCR_420_SP
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_3 / EXPECT_STRIDE_SCALE_2,
|
||||
},
|
||||
// num15
|
||||
// SUB_DriverSystem_DisplayHdi_0200
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_YCRCB_420_SP
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_3 / EXPECT_STRIDE_SCALE_2,
|
||||
},
|
||||
// num16
|
||||
// SUB_DriverSystem_DisplayHdi_0210
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_YCBCR_420_P
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_3 / EXPECT_STRIDE_SCALE_2
|
||||
},
|
||||
// num17
|
||||
// SUB_DriverSystem_DisplayHdi_0220
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_YCRCB_420_P
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_3 / EXPECT_STRIDE_SCALE_2
|
||||
},
|
||||
// num18
|
||||
// SUB_DriverSystem_DisplayHdi_0230
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4
|
||||
},
|
||||
// num19
|
||||
// SUB_DriverSystem_DisplayHdi_0240
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4
|
||||
},
|
||||
// num20
|
||||
// SUB_DriverSystem_DisplayHdi_0250
|
||||
{
|
||||
.allocInfo = {
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
.expectStride = EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4,
|
||||
.expectSize = ALLOC_SIZE_1920 * EXPECT_STRIDE * EXPECT_STRIDE_SCALE_4
|
||||
},
|
||||
};
|
||||
|
||||
static bool CheckBufferHandle(AllocTestPrms &info, BufferHandle &buffer)
|
||||
{
|
||||
if (buffer.stride != (ALIGN_UP(info.expectStride, HEIGHT_ALIGN))) {
|
||||
HDF_LOGE("stride check failed stride %{public}d, expect stride %{public}d ", buffer.stride, info.expectStride);
|
||||
HDF_LOGE("stride check failed format %{public}d width %{public}d, height %{public}d ", info.allocInfo.format,
|
||||
info.allocInfo.width, info.allocInfo.height);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (buffer.size != info.expectSize) {
|
||||
HDF_LOGE("size check failed size %{public}d, expect size %{public}d ", buffer.size, info.expectSize);
|
||||
HDF_LOGE("stride check failed format %{public}d width %{public}d, height %{public}d ", info.allocInfo.format,
|
||||
info.allocInfo.width, info.allocInfo.height);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void DisplayBufferUt::SetUp()
|
||||
{
|
||||
displayBuffer_ = IDisplayBuffer::Get();
|
||||
if (displayBuffer_ == nullptr) {
|
||||
HDF_LOGE("IDisplayBuffer get failed");
|
||||
ASSERT_TRUE(0);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayBufferUt::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
int32_t DisplayBufferUt::AllocMemTest(AllocTestPrms& info)
|
||||
{
|
||||
int ret;
|
||||
BufferHandle *buffer = nullptr;
|
||||
const int TEST_COUNT = 40; // test 40 times
|
||||
for (int i = 0; i < TEST_COUNT; i++) {
|
||||
ret = displayBuffer_->AllocMem(info.allocInfo, buffer);
|
||||
if (ret != DISPLAY_SUCCESS) {
|
||||
HDF_LOGE("AllocMem failed");
|
||||
return ret;
|
||||
}
|
||||
void *vAddr = displayBuffer_->Mmap(*buffer);
|
||||
if (vAddr == nullptr) {
|
||||
HDF_LOGE("Mmap failed");
|
||||
return DISPLAY_FAILURE;
|
||||
}
|
||||
|
||||
if (info.allocInfo.usage & (HBM_USE_CPU_READ | HBM_USE_CPU_WRITE)) {
|
||||
ret = displayBuffer_->InvalidateCache(*buffer);
|
||||
if (ret != DISPLAY_SUCCESS) {
|
||||
HDF_LOGE("InvalidateCache failed");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (memset_s(vAddr, buffer->size, 0, buffer->size) != EOK) {
|
||||
HDF_LOGE("Insufficient memory");
|
||||
return DISPLAY_NOMEM;
|
||||
}
|
||||
DISPLAY_TEST_CHK_RETURN(!CheckBufferHandle(info, *buffer), DISPLAY_FAILURE,
|
||||
HDF_LOGE("buffer check failed"));
|
||||
if (info.allocInfo.usage & (HBM_USE_CPU_READ | HBM_USE_CPU_WRITE)) {
|
||||
ret = displayBuffer_->FlushCache(*buffer);
|
||||
if (ret != DISPLAY_SUCCESS) {
|
||||
HDF_LOGE("FlushCache failed");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
displayBuffer_->Unmap(*buffer);
|
||||
displayBuffer_->FreeMem(*buffer);
|
||||
}
|
||||
return DISPLAY_SUCCESS;
|
||||
}
|
||||
|
||||
TEST_P(DisplayBufferUt, DisplayBufferUt)
|
||||
{
|
||||
AllocTestPrms params = GetParam();
|
||||
int ret = AllocMemTest(params);
|
||||
ASSERT_TRUE(ret == DISPLAY_SUCCESS);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(AllocTest, DisplayBufferUt, ::testing::ValuesIn(DISPLAY_BUFFER_TEST_SETS));
|
||||
} // OHOS
|
||||
} // HDI
|
||||
} // DISPLAY
|
||||
} // TEST
|
44
hdf/display/buffer/unittest/BUILD.gn
Normal file
44
hdf/display/buffer/unittest/BUILD.gn
Normal file
@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos_var.gni")
|
||||
import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni")
|
||||
import("//drivers/peripheral/display/display_config.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
module_output_path = "hats/display"
|
||||
base_root = "../../../../../../../"
|
||||
|
||||
ohos_moduletest_suite("HatsHdfDisplayBufferUtTest") {
|
||||
defines = []
|
||||
defines += display_defines
|
||||
module_out_path = module_output_path
|
||||
sources = [ "display_buffer_ut.cpp" ]
|
||||
deps = [ "$base_root/third_party/googletest:gtest_main" ]
|
||||
include_dirs = [
|
||||
"utils",
|
||||
"$base_root/drivers/peripheral/base",
|
||||
"$base_root/drivers/interface/display/composer/hdifd_parcelable",
|
||||
]
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"drivers_interface_display:display_buffer_idl_headers",
|
||||
"drivers_interface_display:display_composer_idl_headers",
|
||||
"drivers_interface_display:libdisplay_buffer_hdi_impl",
|
||||
"hdf_core:libhdf_utils",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
]
|
||||
subsystem_name = "hdf"
|
||||
part_name = "drivers_peripheral_display"
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
"kits": [
|
||||
{
|
||||
"push": [
|
||||
"HatsHdfDisplayBufferTest->/data/local/tmp/HatsHdfDisplayBufferTest"
|
||||
"HatsHdfDisplayBufferUtTest->/data/local/tmp/HatsHdfDisplayBufferUtTest"
|
||||
],
|
||||
"type": "PushKit"
|
||||
}
|
||||
@ -10,9 +10,9 @@
|
||||
"driver": {
|
||||
"native-test-timeout": "120000",
|
||||
"type": "CppTest",
|
||||
"module-name": "HatsHdfDisplayBufferTest",
|
||||
"module-name": "HatsHdfDisplayBufferUtTest",
|
||||
"runtime-hint": "1s",
|
||||
"native-test-device-path": "/data/local/tmp"
|
||||
},
|
||||
"description": "Configuration for HatsHdfDisplayBufferTest Tests"
|
||||
"description": "Configuration for HatsHdfDisplayBufferUtTest Tests"
|
||||
}
|
287
hdf/display/buffer/unittest/display_buffer_ut.cpp
Normal file
287
hdf/display/buffer/unittest/display_buffer_ut.cpp
Normal file
@ -0,0 +1,287 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "display_buffer_ut.h"
|
||||
#include <securec.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "v1_0/display_buffer_type.h"
|
||||
#include "v1_0/display_composer_type.h"
|
||||
#include "v1_0/include/idisplay_buffer.h"
|
||||
#include "hdf_base.h"
|
||||
#include "hdf_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace HDI {
|
||||
namespace Display {
|
||||
namespace TEST {
|
||||
using namespace OHOS::HDI::Display::Composer::V1_0;
|
||||
using namespace OHOS::HDI::Display::Buffer::V1_0;
|
||||
|
||||
#ifndef DISPLAY_TEST_CHK_RETURN
|
||||
#define DISPLAY_TEST_CHK_RETURN(val, ret, ...) \
|
||||
do { \
|
||||
if (val) { \
|
||||
__VA_ARGS__; \
|
||||
return (ret); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
const uint32_t ALLOC_SIZE_1080 = 1080; // alloc size 1080
|
||||
const uint32_t ALLOC_SIZE_1920 = 1920; // alloc size 1920
|
||||
const uint32_t ALLOC_SIZE_1280 = 1280; // alloc size 1280
|
||||
const uint32_t ALLOC_SIZE_720 = 720; // alloc size 720
|
||||
|
||||
const AllocInfo DISPLAY_BUFFER_TEST_SETS[] = {
|
||||
// num0
|
||||
// SUB_DriverSystem_DisplayHdi_0050
|
||||
{
|
||||
.width = ALLOC_SIZE_1920,
|
||||
.height = ALLOC_SIZE_1080,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
// num1
|
||||
// SUB_DriverSystem_DisplayHdi_0060
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
// num2
|
||||
// SUB_DriverSystem_DisplayHdi_0070
|
||||
{
|
||||
.width = ALLOC_SIZE_1280,
|
||||
.height = ALLOC_SIZE_720,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
// num3
|
||||
// SUB_DriverSystem_DisplayHdi_0080
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBA_8888
|
||||
},
|
||||
// num4
|
||||
// SUB_DriverSystem_DisplayHdi_0090
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRA_8888
|
||||
},
|
||||
|
||||
// num5
|
||||
// SUB_DriverSystem_DisplayHdi_0100
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_YCBCR_420_SP
|
||||
},
|
||||
// num6
|
||||
// SUB_DriverSystem_DisplayHdi_0110
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_YCRCB_420_SP
|
||||
},
|
||||
// num7
|
||||
// SUB_DriverSystem_DisplayHdi_0120
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_YCBCR_420_P
|
||||
},
|
||||
// num8
|
||||
// SUB_DriverSystem_DisplayHdi_0130
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_YCRCB_420_P
|
||||
},
|
||||
// num9
|
||||
// SUB_DriverSystem_DisplayHdi_0140
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
// num10
|
||||
// SUB_DriverSystem_DisplayHdi_0150
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
// num11
|
||||
// SUB_DriverSystem_DisplayHdi_0160
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBX_8888
|
||||
},
|
||||
#ifdef DISPLAY_COMMUNITY
|
||||
// num12
|
||||
// SUB_DriverSystem_DisplayHdi_0170
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGB_888
|
||||
},
|
||||
// num13
|
||||
// SUB_DriverSystem_DisplayHdi_0180
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRX_8888
|
||||
},
|
||||
// num14
|
||||
// SUB_DriverSystem_DisplayHdi_0190
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBA_4444
|
||||
},
|
||||
// num15
|
||||
// SUB_DriverSystem_DisplayHdi_0200
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_RGBX_4444
|
||||
},
|
||||
// num16
|
||||
// SUB_DriverSystem_DisplayHdi_0210
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRA_4444
|
||||
},
|
||||
// num17
|
||||
// SUB_DriverSystem_DisplayHdi_0220
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRX_4444
|
||||
},
|
||||
// num18
|
||||
// SUB_DriverSystem_DisplayHdi_0230
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGR_565
|
||||
},
|
||||
// num19
|
||||
// SUB_DriverSystem_DisplayHdi_0240
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRA_5551
|
||||
},
|
||||
// num20
|
||||
// SUB_DriverSystem_DisplayHdi_0250
|
||||
{
|
||||
.width = ALLOC_SIZE_1080,
|
||||
.height = ALLOC_SIZE_1920,
|
||||
.usage = HBM_USE_MEM_DMA | HBM_USE_CPU_READ | HBM_USE_CPU_WRITE,
|
||||
.format = PIXEL_FMT_BGRX_5551
|
||||
},
|
||||
#endif // DISPLAY_COMMUNITY
|
||||
};
|
||||
|
||||
void DisplayBufferUt::SetUp()
|
||||
{
|
||||
displayBuffer_ = IDisplayBuffer::Get();
|
||||
if (displayBuffer_ == nullptr) {
|
||||
HDF_LOGE("IDisplayBuffer get failed");
|
||||
ASSERT_TRUE(0);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayBufferUt::TearDown()
|
||||
{
|
||||
}
|
||||
|
||||
int32_t DisplayBufferUt::AllocMemTest(AllocInfo& info)
|
||||
{
|
||||
int ret;
|
||||
BufferHandle *buffer = nullptr;
|
||||
const int TEST_COUNT = 40; // test 40 times
|
||||
for (int i = 0; i < TEST_COUNT; i++) {
|
||||
ret = displayBuffer_->AllocMem(info, buffer);
|
||||
if (ret != DISPLAY_SUCCESS || buffer == nullptr) {
|
||||
HDF_LOGE("AllocMem failed");
|
||||
return ret;
|
||||
}
|
||||
void *vAddr = displayBuffer_->Mmap(*buffer);
|
||||
if (vAddr == nullptr) {
|
||||
HDF_LOGE("Mmap failed");
|
||||
return DISPLAY_FAILURE;
|
||||
}
|
||||
|
||||
if (info.usage & (HBM_USE_CPU_READ | HBM_USE_CPU_WRITE)) {
|
||||
ret = displayBuffer_->InvalidateCache(*buffer);
|
||||
if (ret != DISPLAY_SUCCESS) {
|
||||
HDF_LOGE("InvalidateCache failed");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (memset_s(vAddr, buffer->size, 0, buffer->size) != EOK) {
|
||||
HDF_LOGE("Insufficient memory");
|
||||
return DISPLAY_NOMEM;
|
||||
}
|
||||
|
||||
if (info.usage & (HBM_USE_CPU_READ | HBM_USE_CPU_WRITE)) {
|
||||
ret = displayBuffer_->FlushCache(*buffer);
|
||||
if (ret != DISPLAY_SUCCESS) {
|
||||
HDF_LOGE("FlushCache failed");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
displayBuffer_->Unmap(*buffer);
|
||||
displayBuffer_->FreeMem(*buffer);
|
||||
}
|
||||
return DISPLAY_SUCCESS;
|
||||
}
|
||||
|
||||
TEST_P(DisplayBufferUt, DisplayBufferUt)
|
||||
{
|
||||
AllocInfo params = GetParam();
|
||||
int ret = AllocMemTest(params);
|
||||
ASSERT_TRUE(ret == DISPLAY_SUCCESS);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(AllocTest, DisplayBufferUt, ::testing::ValuesIn(DISPLAY_BUFFER_TEST_SETS));
|
||||
} // OHOS
|
||||
} // HDI
|
||||
} // DISPLAY
|
||||
} // TEST
|
@ -30,22 +30,16 @@ using OHOS::HDI::Display::Buffer::V1_0::IMapper;
|
||||
using OHOS::HDI::Display::Buffer::V1_0::AllocInfo;
|
||||
using OHOS::HDI::Display::Buffer::V1_0::IDisplayBuffer;
|
||||
|
||||
struct AllocTestPrms {
|
||||
AllocInfo allocInfo;
|
||||
int32_t expectStride;
|
||||
int32_t expectSize;
|
||||
};
|
||||
|
||||
class DisplayBufferUt : public ::testing::TestWithParam<AllocTestPrms> {
|
||||
class DisplayBufferUt : public ::testing::TestWithParam<AllocInfo> {
|
||||
protected:
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
public:
|
||||
IDisplayBuffer* displayBuffer_{ nullptr };
|
||||
int32_t AllocMemTest(AllocTestPrms& info);
|
||||
int32_t AllocMemTest(AllocInfo& info);
|
||||
};
|
||||
} // OHOS
|
||||
} // HDI
|
||||
} // DISPLAY
|
||||
} // TEST
|
||||
#endif // DISPLAY_BUFFER_UT_H
|
||||
#endif // DISPLAY_BUFFER_UT_H
|
@ -13,11 +13,13 @@
|
||||
|
||||
import("//build/ohos_var.gni")
|
||||
import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni")
|
||||
import("//test/xts/hats/build.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
group("HatsHdfDisplayComposerTest") {
|
||||
testonly = true
|
||||
deps = [
|
||||
"death:HatsHdfDisplayComposerDeathTest",
|
||||
"moduletest:HatsHdfDisplayComposerMtTest",
|
||||
"unittest:HatsHdfDisplayComposerUtTest",
|
||||
]
|
||||
|
@ -55,7 +55,7 @@ void HdiCompositionCheck::SimpleHandleAlpha(const LayerSettings& layers, uint32_
|
||||
}
|
||||
|
||||
std::vector<uint32_t> HdiCompositionCheck::GetCheckColors(const std::vector<LayerSettings> &layers,
|
||||
const std::vector<Point> &points)
|
||||
const std::vector<Point> &points) const
|
||||
{
|
||||
std::vector<uint32_t> colors;
|
||||
for (auto point : points) {
|
||||
@ -78,7 +78,8 @@ std::vector<uint32_t> HdiCompositionCheck::GetCheckColors(const std::vector<Laye
|
||||
return colors;
|
||||
}
|
||||
|
||||
int32_t HdiCompositionCheck::Check(std::vector<LayerSettings> &layers, const BufferHandle& clientBuffer, uint32_t checkType)
|
||||
int32_t HdiCompositionCheck::Check(const std::vector<LayerSettings> &layers,
|
||||
const BufferHandle& clientBuffer, uint32_t checkType)
|
||||
{
|
||||
int ret = DISPLAY_SUCCESS;
|
||||
const int MID_POS = 2;
|
||||
|
@ -43,12 +43,14 @@ public:
|
||||
CHECK_CENTER,
|
||||
CHECK_VERTEX
|
||||
};
|
||||
int32_t Check(std::vector<LayerSettings> &layers, const BufferHandle& clientBuffer, uint32_t checkType = CHECK_VERTEX);
|
||||
int32_t Check(const std::vector<LayerSettings> &layers,
|
||||
const BufferHandle& clientBuffer, uint32_t checkType = CHECK_VERTEX);
|
||||
|
||||
private:
|
||||
void GetCheckPoints(Point center, std::vector<Point> &points) const;
|
||||
void SimpleHandleAlpha(const LayerSettings& layers, uint32_t& color) const;
|
||||
std::vector<uint32_t> GetCheckColors(const std::vector<LayerSettings> &layers, const std::vector<Point> &points);
|
||||
std::vector<uint32_t> GetCheckColors(const std::vector<LayerSettings> &layers,
|
||||
const std::vector<Point> &points) const;
|
||||
HdiCompositionCheck() {}
|
||||
~HdiCompositionCheck() {}
|
||||
uint32_t dispW_ = 0;
|
||||
|
54
hdf/display/composer/death/BUILD.gn
Normal file
54
hdf/display/composer/death/BUILD.gn
Normal file
@ -0,0 +1,54 @@
|
||||
# Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos_var.gni")
|
||||
import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
module_output_path = "hats/display"
|
||||
base_root = "../../../../../../../"
|
||||
|
||||
config("module_private_config") {
|
||||
visibility = [ ":*" ]
|
||||
}
|
||||
|
||||
ohos_moduletest_suite("HatsHdfDisplayComposerDeathTest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [ "hdi_death_test.cpp" ]
|
||||
deps = [
|
||||
"$base_root/test/xts/hats/hdf/display/composer/common:disp_dev_hdi_test",
|
||||
"$base_root/third_party/googletest:gtest_main",
|
||||
]
|
||||
include_dirs = [
|
||||
"$base_root/drivers/interface/display/composer/hdifd_parcelable",
|
||||
"$base_root/drivers/interface/display/composer/bufferhandle_parcelable",
|
||||
"$base_root/test/xts/hats/hdf/display/composer/common",
|
||||
"$base_root/foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
|
||||
"$base_root/drivers/peripheral/display/utils/include",
|
||||
"$base_root/drivers/peripheral/base",
|
||||
"utils",
|
||||
".",
|
||||
]
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"drivers_interface_display:display_buffer_idl_headers",
|
||||
"drivers_interface_display:display_composer_idl_headers",
|
||||
"drivers_interface_display:libdisplay_buffer_hdi_impl",
|
||||
"drivers_interface_display:libdisplay_composer_hdi_impl",
|
||||
"hdf_core:libhdf_utils",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
]
|
||||
cflags = [ "-Wno-unused-function" ]
|
||||
subsystem_name = "hdf"
|
||||
part_name = "drivers_peripheral_display"
|
||||
}
|
18
hdf/display/composer/death/Test.json
Normal file
18
hdf/display/composer/death/Test.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"kits": [
|
||||
{
|
||||
"push": [
|
||||
"HatsHdfDisplayComposerDeathTest->/data/local/tmp/HatsHdfDisplayComposerDeathTest"
|
||||
],
|
||||
"type": "PushKit"
|
||||
}
|
||||
],
|
||||
"driver": {
|
||||
"native-test-timeout": "120000",
|
||||
"type": "CppTest",
|
||||
"module-name": "HatsHdfDisplayComposerDeathTest",
|
||||
"runtime-hint": "1s",
|
||||
"native-test-device-path": "/data/local/tmp"
|
||||
},
|
||||
"description": "Configuration for HatsHdfDisplayComposerDeathTest Tests"
|
||||
}
|
@ -377,7 +377,7 @@ VblankCtr::~VblankCtr() {}
|
||||
|
||||
int32_t VblankCtr::WaitVblank(uint32_t ms)
|
||||
{
|
||||
bool ret;
|
||||
bool ret = false;
|
||||
DISPLAY_TEST_LOGE();
|
||||
std::unique_lock<std::mutex> lck(vblankMutex_);
|
||||
hasVblank_ = false; // must wait next vblank
|
||||
|
@ -15,14 +15,6 @@ import("//build/ohos_var.gni")
|
||||
import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
group("HatsHdfDisplayComposerUtTest") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":HatsHdfDisplayComposerDeathTest",
|
||||
":HatsHdfDisplayComposerDeviceTest",
|
||||
]
|
||||
}
|
||||
|
||||
module_output_path = "hats/display"
|
||||
base_root = "../../../../../../../"
|
||||
|
||||
@ -30,7 +22,7 @@ config("module_private_config") {
|
||||
visibility = [ ":*" ]
|
||||
}
|
||||
|
||||
ohos_moduletest_suite("HatsHdfDisplayComposerDeviceTest") {
|
||||
ohos_moduletest_suite("HatsHdfDisplayComposerUtTest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [ "hdi_composer_ut.cpp" ]
|
||||
deps = [
|
||||
@ -45,7 +37,6 @@ ohos_moduletest_suite("HatsHdfDisplayComposerDeviceTest") {
|
||||
"$base_root/drivers/peripheral/base",
|
||||
"utils",
|
||||
".",
|
||||
"$base_root/drivers/interface/display/display/v1_0",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
@ -61,35 +52,3 @@ ohos_moduletest_suite("HatsHdfDisplayComposerDeviceTest") {
|
||||
subsystem_name = "hdf"
|
||||
part_name = "drivers_peripheral_display"
|
||||
}
|
||||
|
||||
ohos_moduletest_suite("HatsHdfDisplayComposerDeathTest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [ "hdi_death_test.cpp" ]
|
||||
deps = [
|
||||
"$base_root/test/xts/hats/hdf/display/composer/common:disp_dev_hdi_test",
|
||||
"$base_root/third_party/googletest:gtest_main",
|
||||
]
|
||||
include_dirs = [
|
||||
"$base_root/drivers/interface/display/composer/hdifd_parcelable",
|
||||
"$base_root/drivers/interface/display/composer/bufferhandle_parcelable",
|
||||
"$base_root/test/xts/hats/hdf/display/composer/common",
|
||||
"$base_root/foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
|
||||
"$base_root/drivers/peripheral/display/utils/include",
|
||||
"$base_root/drivers/peripheral/base",
|
||||
"utils",
|
||||
".",
|
||||
"$base_root/drivers/interface/display/display/v1_0",
|
||||
]
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"drivers_interface_display:display_buffer_idl_headers",
|
||||
"drivers_interface_display:display_composer_idl_headers",
|
||||
"drivers_interface_display:libdisplay_buffer_hdi_impl",
|
||||
"drivers_interface_display:libdisplay_composer_hdi_impl",
|
||||
"hdf_core:libhdf_utils",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
]
|
||||
cflags = [ "-Wno-unused-function" ]
|
||||
subsystem_name = "hdf"
|
||||
part_name = "drivers_peripheral_display"
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"kits": [
|
||||
{
|
||||
"push": [
|
||||
"HatsHdfDisplayComposerMtTest->/data/local/tmp/HatsHdfDisplayComposerMtTest"
|
||||
"HatsHdfDisplayComposerUtTest->/data/local/tmp/HatsHdfDisplayComposerUtTest"
|
||||
],
|
||||
"type": "PushKit"
|
||||
}
|
||||
@ -10,9 +10,9 @@
|
||||
"driver": {
|
||||
"native-test-timeout": "120000",
|
||||
"type": "CppTest",
|
||||
"module-name": "HatsHdfDisplayComposerMtTest",
|
||||
"module-name": "HatsHdfDisplayComposerUtTest",
|
||||
"runtime-hint": "1s",
|
||||
"native-test-device-path": "/data/local/tmp"
|
||||
},
|
||||
"description": "Configuration for HatsHdfDisplayComposerMtTest Tests"
|
||||
"description": "Configuration for HatsHdfDisplayComposerUtTest Tests"
|
||||
}
|
@ -162,9 +162,11 @@ static inline void PresentAndCheck(std::vector<LayerSettings> &layerSettings,
|
||||
{
|
||||
int ret = PrepareAndPrensent();
|
||||
ASSERT_TRUE((ret == DISPLAY_SUCCESS));
|
||||
HdiTestDevice::GetInstance().GetGrallocInterface()->InvalidateCache(*(GetFirstDisplay()->SnapShot()));
|
||||
ret = CheckComposition(layerSettings, GetFirstDisplay()->SnapShot(), checkType);
|
||||
ASSERT_TRUE((ret == DISPLAY_SUCCESS));
|
||||
if ((GetFirstDisplay()->SnapShot()) != nullptr) {
|
||||
HdiTestDevice::GetInstance().GetGrallocInterface()->InvalidateCache(*(GetFirstDisplay()->SnapShot()));
|
||||
ret = CheckComposition(layerSettings, GetFirstDisplay()->SnapShot(), checkType);
|
||||
ASSERT_TRUE((ret == DISPLAY_SUCCESS));
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceTest::TearDown()
|
||||
@ -189,7 +191,7 @@ VblankCtr::~VblankCtr() {}
|
||||
|
||||
int32_t VblankCtr::WaitVblank(uint32_t ms)
|
||||
{
|
||||
bool ret;
|
||||
bool ret = false;
|
||||
DISPLAY_TEST_LOGE();
|
||||
std::unique_lock<std::mutex> lck(vblankMutex_);
|
||||
hasVblank_ = false; // must wait next vblank
|
||||
@ -256,12 +258,14 @@ HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0060, TestSize.Level1)
|
||||
EXPECT_EQ(DISPLAY_SUCCESS, ret);
|
||||
}
|
||||
|
||||
#ifdef DISPLAY_COMMUNITY
|
||||
HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0070, TestSize.Level1)
|
||||
{
|
||||
uint32_t level;
|
||||
auto ret = g_composerDevice->GetDisplayBacklight(g_displayIds[0], level);
|
||||
EXPECT_EQ(DISPLAY_SUCCESS, ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
HWTEST_F(DeviceTest, SUB_DriverSystem_DisplayComposer_0080, TestSize.Level1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user