diff --git a/yangfan/device.gni b/yangfan/device.gni index 1d93ed8..e74b063 100755 --- a/yangfan/device.gni +++ b/yangfan/device.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 iSoftStone Device Co., Ltd. +# Copyright (c) 2021 - 2023 iSoftStone 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 @@ -22,16 +22,12 @@ if (!defined(defines)) { } product_config_path = "//vendor/${product_company}/${product_name}" -board_camera_path = "//device/board/${product_company}/${device_name}/kernel/hdf/drivers/camera/src" +board_camera_path = + "//device/board/${product_company}/${device_name}/kernel/hdf/drivers/camera" chipset_camera_path = "//device/board/${product_company}/${device_name}/kernel/hdf/drivers/camera" is_support_v4l2 = true if (is_support_v4l2) { is_support_mpi = false defines += [ "SUPPORT_V4L2" ] - chipset_build_deps = "$chipset_camera_path:chipset_build" - camera_device_manager_deps = - "$board_camera_path/device_manager:camera_device_manager" - camera_pipeline_core_deps = - "$board_camera_path/pipeline_core:camera_pipeline_core" } diff --git a/yangfan/kernel/hdf/drivers/camera/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/BUILD.gn index f876813..2982ed9 100644 --- a/yangfan/kernel/hdf/drivers/camera/BUILD.gn +++ b/yangfan/kernel/hdf/drivers/camera/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 - 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 @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") +import("//device/board/${product_company}/${device_name}/device.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") import("//drivers/peripheral/camera/camera.gni") import("$hdf_framework_path/tools/hc-gen/hc_gen.gni") @@ -26,8 +27,8 @@ ohos_prebuilt_etc("camera_host_config.hcb") { hcs_outputs = get_target_outputs(":build_camera_host_config") source = hcs_outputs[0] relative_install_dir = "hdfconfig" - subsystem_name = "hdf" - part_name = "hdf" + subsystem_name = "rockchip_products" + part_name = "rockchip_products" } hc_gen_c("generate_source") { @@ -86,8 +87,8 @@ ohos_prebuilt_etc("ipp_algo_config.hcb") { hcs_outputs = get_target_outputs(":build_ipp_algo_config") source = hcs_outputs[0] relative_install_dir = "hdfconfig" - subsystem_name = "hdf" - part_name = "hdf" + subsystem_name = "rockchip_products" + part_name = "rockchip_products" } config("example_config") { @@ -106,7 +107,201 @@ group("chipset_build") { ":config.c", ":ipp_algo_config.hcb", ":params.c", - "$camera_device_name_path/camera/src/pipeline_core:camera_ipp_algo_example", - "$camera_path/adapter/platform/v4l2/src/driver_adapter:camera_v4l2_adapter", + "$camera_device_name_path/camera/pipeline_core:camera_ipp_algo_example", ] } + +config("camhdi_impl_config") { + visibility = [ ":*" ] + cflags = [ + "-DGST_DISABLE_DEPRECATED", + "-DHAVE_CONFIG_H", + ] + + ldflags = [ "-Wl" ] + + if (enable_camera_device_utest) { + cflags += [ + "-fprofile-arcs", + "-ftest-coverage", + ] + + ldflags += [ "--coverage" ] + } +} + +host_sources = [ + "$camera_path/../v4l2/src/camera_device/camera_device_vdi_impl.cpp", + "$camera_path/../v4l2/src/camera_dump.cpp", + "$camera_path/../v4l2/src/camera_host/camera_host_config.cpp", + "$camera_path/../v4l2/src/camera_host/camera_host_vdi_impl.cpp", + "$camera_path/../v4l2/src/camera_host/hcs_deal.cpp", + "$camera_path/../v4l2/src/offline_stream_operator/offline_stream.cpp", + "$camera_path/../v4l2/src/offline_stream_operator/offline_stream_operator_vdi_impl.cpp", + "$camera_path/../v4l2/src/stream_operator/capture_message.cpp", + "$camera_path/../v4l2/src/stream_operator/capture_request.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_base.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_operator_vdi_impl.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_post_view.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_preview.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_statistics.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_still_capture.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard/stream_tunnel.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_video.cpp", +] + +host_includes = [ + "$camera_path/../../interfaces/include", + "$camera_path/include", + "$camera_path/metadata_manager/include", + "$camera_path/utils/watchdog", + "$camera_path/../interfaces", + "$camera_path/../v4l2/include", + "$camera_path/../v4l2/include/camera_host", + "$camera_path/../v4l2/include/camera_device", + "$camera_path/../v4l2/include/stream_operator", + "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard", + "$camera_path/../v4l2/include/offline_stream_operator", + "$camera_path/device_manager/include/", + "$camera_path/buffer_manager/src/buffer_adapter/standard", + "$camera_path/utils/event", + "$camera_path/../../display/interfaces/include", + + #producer + "$camera_path/pipeline_core/utils", + "$camera_path/pipeline_core/include", + "$camera_path/pipeline_core/host_stream/include", + "$camera_path/pipeline_core/nodes/include", + "$camera_path/pipeline_core/nodes/src/node_base", + "$camera_path/pipeline_core/nodes/src/dummy_node", + "$camera_path/pipeline_core/pipeline_impl/include", + "$camera_path/pipeline_core/pipeline_impl/src", + "$camera_path/pipeline_core/pipeline_impl/src/builder", + "$camera_path/pipeline_core/pipeline_impl/src/dispatcher", + "$camera_path/pipeline_core/pipeline_impl/src/parser", + "$camera_path/pipeline_core/pipeline_impl/src/strategy", + "$camera_path/pipeline_core/ipp/include", +] + +ohos_shared_library("camera_host_vdi_impl_1.0") { + sources = host_sources + include_dirs = host_includes + + deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "$board_camera_path/metadata_manager:camera_metadata_manager", + "$board_camera_path/pipeline_core:camera_pipeline_core", + "$camera_path/buffer_manager:camera_buffer_manager", + "$camera_path/utils:camera_utils", + ] + + defines = [] + if (enable_camera_device_utest) { + defines += [ "CAMERA_DEVICE_UTEST" ] + } + if (use_hitrace) { + defines += [ "HITRACE_LOG_ENABLED" ] + } + + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_host", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hdf_core:libhdi", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + ] + if (use_hitrace) { + external_deps += [ "hitrace_native:libhitracechain" ] + } + } else { + external_deps = [ "hilog:libhilog" ] + } + external_deps += [ + "drivers_interface_camera:libcamera_stub_1.0", + "drivers_interface_camera:metadata", + "hitrace_native:hitrace_meter", + "ipc:ipc_single", + ] + public_configs = [ ":camhdi_impl_config" ] + install_images = [ chipset_base_dir ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" +} + +ohos_static_library("camera_host_vdi_impl_1.0_static") { + sources = host_sources + include_dirs = host_includes + + deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "$board_camera_path/metadata_manager:camera_metadata_manager", + "$board_camera_path/pipeline_core:camera_pipeline_core", + "$camera_path/buffer_manager:camera_buffer_manager", + "$camera_path/utils:camera_utils", + ] + + defines = [] + if (enable_camera_device_utest) { + defines += [ "CAMERA_DEVICE_UTEST" ] + } + if (use_hitrace) { + defines += [ "HITRACE_LOG_ENABLED" ] + } + + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_host", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hdf_core:libhdi", + "hitrace_native:hitrace_meter", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + ] + if (use_hitrace) { + external_deps += [ "hitrace_native:libhitracechain" ] + } + } else { + external_deps = [ "hilog:libhilog" ] + } + external_deps += [ + "drivers_interface_camera:libcamera_stub_1.0", + "drivers_interface_camera:metadata", + "hitrace_native:hitrace_meter", + "ipc:ipc_single", + ] + + public_configs = [ ":camhdi_impl_config" ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" +} + +group("camera_board_test") { + if (target_cpu == "x86_64") { + deps = [] + } else { + testonly = true + deps = [ + #device manager test + "device_manager/test/unittest:camera_board_device_manager_unittest", + + #driver adapter v4l2 test + "driver_adapter/test/v4l2_test:v4l2_main", + + #driver adapter v4l2 unittest + "driver_adapter/test/unittest:v4l2_adapter_unittest", + + # pipeline core test + "pipeline_core/test/unittest:camera_pipeline_core_test_ut", + + # demo test + "demo:ohos_camera_demo", + ] + } +} diff --git a/yangfan/kernel/hdf/drivers/camera/demo/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/demo/BUILD.gn new file mode 100644 index 0000000..1bc8d59 --- /dev/null +++ b/yangfan/kernel/hdf/drivers/camera/demo/BUILD.gn @@ -0,0 +1,104 @@ +# 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.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") + +config("ohos_camera_demo_config") { + visibility = [ ":*" ] + cflags_cc = [ + "-Wno-error", + "-std=c++17", + ] +} + +ohos_executable("ohos_camera_demo") { + install_enable = false + sources = [ + "$camera_path/../../test/demo/demo_main.cpp", + "$camera_path/../../test/demo/ohos_camera_demo.cpp", + "$camera_path/../../test/demo/stream_customer.cpp", + ] + + include_dirs = [ + "$board_camera_path/demo/include", + "$camera_path/../../test/demo/include", + "$camera_path/../../interfaces/include", + "$camera_path/../../interfaces/hdi_ipc", + "$camera_path/../../interfaces/hdi_ipc/utils/include", + "$camera_path/../../test/common/callback/include", + "$camera_path/include", + "$camera_path/../v4l2", + "$camera_path/../v4l2/include", + "$camera_path/../v4l2/include/camera_host", + "$camera_path/../v4l2/include/camera_device", + "$camera_path/../v4l2/include/stream_operator", + "$camera_path/../v4l2/include/offline_stream_operator", + "$camera_path/device_manager/include/", + "$camera_path/device_manager/include/mpi", + "$camera_path/utils/event", + + #producer + "$camera_path/pipeline_core/utils", + "$camera_path/pipeline_core/include", + "$camera_path/pipeline_core/host_stream/include", + "$camera_path/pipeline_core/nodes/include", + "$camera_path/pipeline_core/nodes/src/node_base", + "$camera_path/pipeline_core/nodes/src/dummy_node", + "$camera_path/pipeline_core/pipeline_impl/src/strategy/config", + "$camera_path/pipeline_core/pipeline_impl/include", + "$camera_path/pipeline_core/pipeline_impl/src", + "$camera_path/pipeline_core/pipeline_impl/src/builder", + "$camera_path/pipeline_core/pipeline_impl/src/dispatcher", + "$camera_path/pipeline_core/pipeline_impl/src/parser", + "$camera_path/pipeline_core/pipeline_impl/src/strategy", + "$camera_path/pipeline_core/ipp/include", + ] + + deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "$board_camera_path/pipeline_core:camera_pipeline_core", + "$camera_path/../../hdi_service/v1_0:camera_host_service_1.0_static", + "$camera_path/buffer_manager:camera_buffer_manager", + ] + + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_host", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hdf_core:libhdi", + "hiviewdfx_hilog_native:libhilog", + "samgr:samgr_proxy", + ] + } else { + external_deps = [ "hilog:libhilog" ] + } + + external_deps += [ + "drivers_interface_camera:libcamera_proxy_1.0", + "drivers_interface_camera:metadata", + "ipc:ipc_single", + "samgr:samgr_proxy", + ] + + public_configs = [ ":ohos_camera_demo_config" ] + install_enable = false + install_images = [ chipset_base_dir ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" +} diff --git a/yangfan/kernel/hdf/drivers/camera/camera_demo/project_camera_demo.h b/yangfan/kernel/hdf/drivers/camera/demo/include/project_camera_demo.h similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/camera_demo/project_camera_demo.h rename to yangfan/kernel/hdf/drivers/camera/demo/include/project_camera_demo.h diff --git a/yangfan/kernel/hdf/drivers/camera/src/device_manager/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/device_manager/BUILD.gn similarity index 89% rename from yangfan/kernel/hdf/drivers/camera/src/device_manager/BUILD.gn rename to yangfan/kernel/hdf/drivers/camera/device_manager/BUILD.gn index 8bd7b4c..78f1ae2 100644 --- a/yangfan/kernel/hdf/drivers/camera/src/device_manager/BUILD.gn +++ b/yangfan/kernel/hdf/drivers/camera/device_manager/BUILD.gn @@ -11,8 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") +import("//device/board/${product_company}/${device_name}/device.gni") import("//drivers/peripheral/camera/camera.gni") -import("../../camera.gni") +import("../camera.gni") config("device_manager_config") { visibility = [ ":*" ] @@ -45,7 +46,7 @@ config("device_manager_config") { ohos_shared_library("camera_device_manager") { sources = [ - "$camera_device_name_path/camera/src/device_manager/rkispv5.cpp", + "$camera_device_name_path/camera/device_manager/src/rkispv5.cpp", "$camera_path/adapter/platform/v4l2/src/device_manager/enumerator_manager.cpp", "$camera_path/adapter/platform/v4l2/src/device_manager/flash_controller.cpp", "$camera_path/adapter/platform/v4l2/src/device_manager/flash_manager.cpp", @@ -65,7 +66,7 @@ ohos_shared_library("camera_device_manager") { "$camera_path/include", "$camera_path/utils/event", "$camera_path/device_manager/include", - "$camera_device_name_path/camera/include/device_manager", + "$camera_device_name_path/camera/device_manager/include", "$camera_path/adapter/platform/v4l2/src/device_manager/include", "$camera_path/adapter/platform/v4l2/src/driver_adapter/include/", "//commonlibrary/c_utils/base/include", @@ -75,9 +76,7 @@ ohos_shared_library("camera_device_manager") { "c_utils:utils", "hdf_core:libhdf_utils", ] - deps = [ - "$camera_path/adapter/platform/v4l2/src/driver_adapter:camera_v4l2_adapter", - ] + deps = [ "$board_camera_path/driver_adapter:camera_v4l2_adapter" ] if (is_standard_system) { external_deps += [ "hiviewdfx_hilog_native:libhilog" ] @@ -86,6 +85,6 @@ ohos_shared_library("camera_device_manager") { } external_deps += [ "drivers_interface_camera:metadata" ] public_configs = [ ":device_manager_config" ] - subsystem_name = "hdf" - part_name = "hdf" + subsystem_name = "rockchip_products" + part_name = "rockchip_products" } diff --git a/yangfan/kernel/hdf/drivers/camera/include/device_manager/imx600.h b/yangfan/kernel/hdf/drivers/camera/device_manager/include/imx600.h similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/include/device_manager/imx600.h rename to yangfan/kernel/hdf/drivers/camera/device_manager/include/imx600.h diff --git a/yangfan/kernel/hdf/drivers/camera/include/device_manager/project_hardware.h b/yangfan/kernel/hdf/drivers/camera/device_manager/include/project_hardware.h similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/include/device_manager/project_hardware.h rename to yangfan/kernel/hdf/drivers/camera/device_manager/include/project_hardware.h diff --git a/yangfan/kernel/hdf/drivers/camera/include/device_manager/rkispv5.h b/yangfan/kernel/hdf/drivers/camera/device_manager/include/rkispv5.h similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/include/device_manager/rkispv5.h rename to yangfan/kernel/hdf/drivers/camera/device_manager/include/rkispv5.h diff --git a/yangfan/kernel/hdf/drivers/camera/src/device_manager/imx600.cpp b/yangfan/kernel/hdf/drivers/camera/device_manager/src/imx600.cpp similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/src/device_manager/imx600.cpp rename to yangfan/kernel/hdf/drivers/camera/device_manager/src/imx600.cpp diff --git a/yangfan/kernel/hdf/drivers/camera/src/device_manager/rkispv5.cpp b/yangfan/kernel/hdf/drivers/camera/device_manager/src/rkispv5.cpp similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/src/device_manager/rkispv5.cpp rename to yangfan/kernel/hdf/drivers/camera/device_manager/src/rkispv5.cpp diff --git a/yangfan/kernel/hdf/drivers/camera/device_manager/test/unittest/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/device_manager/test/unittest/BUILD.gn new file mode 100644 index 0000000..e8fe854 --- /dev/null +++ b/yangfan/kernel/hdf/drivers/camera/device_manager/test/unittest/BUILD.gn @@ -0,0 +1,63 @@ +# Copyright (c) 2021 - 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/test.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") + +module_output_path = "$root_out_dir/test/unittest/hdf" +config("v4l2_device_config") { + visibility = [ ":*" ] + cflags_cc = [ + "-DGST_DISABLE_DEPRECATED", + "-DHAVE_CONFIG_H", + "-DCOLORSPACE=\"videoconvert\"", + ] +} +ohos_unittest("camera_board_device_manager_unittest") { + testonly = true + module_out_path = module_output_path + sources = [ "$camera_path/device_manager/test/unittest/v4l2/utest_v4l2_device_manager.cpp" ] + include_dirs = [ + "$camera_path/device_manager", + "$camera_path/device_manager/include", + "$camera_path/device_manager/include/v4l2", + "$camera_path/device_manager/src", + "$camera_path/device_manager/src/v4l2", + "$camera_path/driver_adapter/include", + "$camera_path/include", + "$camera_path/device_manager/test/unittest/v4l2", + "$camera_path/utils/event", + "$camera_path/adapter/platform/v4l2/src/device_manager/include", + "$board_camera_path/device_manager/include", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/include", + ] + deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest_main", + ] + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + ] + } else { + external_deps = [ "hilog:libhilog" ] + } + external_deps += [ "drivers_interface_camera:metadata" ] + public_configs = [ ":v4l2_device_config" ] +} diff --git a/yangfan/kernel/hdf/drivers/camera/driver_adapter/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/driver_adapter/BUILD.gn new file mode 100644 index 0000000..42f5207 --- /dev/null +++ b/yangfan/kernel/hdf/drivers/camera/driver_adapter/BUILD.gn @@ -0,0 +1,86 @@ +# 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("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/peripheral/camera/camera.gni") + +if (defined(ohos_lite)) { + copy("driver_adapter") { + sources = [ "//device/hisilicon/hardware/media/hal/camera/libs/hispark_taurus/libdriver_adapter.so" ] + outputs = [ "$root_out_dir/{{source_file_part}}" ] + } +} else { + import("//build/ohos.gni") + import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") + + ohos_prebuilt_etc("driver_adapter") { + if (use_musl) { + source = "//device/hisilicon/hardware/media/hal/camera/libs/hispark_taurus/libdriver_adapter.z.so" + } else { + source = "//device/hisilicon/hardware/media/hal/camera/libs/hispark_taurus/std/libdriver_adapter.z.so" + } + module_install_dir = "lib/" + part_name = "rockchip_products" + subsystem_name = "rockchip_products" + } +} + +config("v4l2_config") { + visibility = [ ":*" ] + + cflags = [ + "-DGST_DISABLE_DEPRECATED", + "-DHAVE_CONFIG_H", + "-DCOLORSPACE=\"videoconvert\"", + ] + + if (enable_camera_device_utest) { + cflags += [ + "-fprofile-arcs", + "-ftest-coverage", + ] + + ldflags = [ "--coverage" ] + } +} + +ohos_shared_library("camera_v4l2_adapter") { + sources = [ + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_buffer.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_control.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_dev.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_fileformat.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_stream.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_uvc.cpp", + ] + + include_dirs = [ + "$camera_path/include", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/include", + ] + + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + ] + } else { + external_deps = [ "hilog:libhilog" ] + } + external_deps += [ "drivers_interface_camera:metadata" ] + public_configs = [ ":v4l2_config" ] + install_images = [ chipset_base_dir ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" +} diff --git a/yangfan/kernel/hdf/drivers/camera/src/driver_adapter/test/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/driver_adapter/test/unittest/BUILD.gn old mode 100644 new mode 100755 similarity index 79% rename from yangfan/kernel/hdf/drivers/camera/src/driver_adapter/test/BUILD.gn rename to yangfan/kernel/hdf/drivers/camera/driver_adapter/test/unittest/BUILD.gn index 4646948..30e9bba --- a/yangfan/kernel/hdf/drivers/camera/src/driver_adapter/test/BUILD.gn +++ b/yangfan/kernel/hdf/drivers/camera/driver_adapter/test/unittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 - 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 @@ -12,10 +12,11 @@ # limitations under the License. import("//build/test.gni") +import("//device/board/${product_company}/${device_name}/device.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") import("//drivers/peripheral/camera/camera.gni") -module_output_path = "hdf/v4l2_adapter_test" +module_output_path = "$root_out_dir/test/unittest/hdf" config("v4l2_utest_config") { visibility = [ ":*" ] @@ -50,19 +51,18 @@ ohos_unittest("v4l2_adapter_unittest") { test_type = "unittest" testonly = true module_out_path = module_output_path - sources = [ "unittest/utest_v4l2.cpp" ] + sources = [ "src/utest_v4l2.cpp" ] include_dirs = [ "$camera_path/include", "$camera_path/adapter/platform/v4l2/src/driver_adapter/include", - "$camera_device_name_path/camera/src/driver_adapter/test/unittest/include", + "include", "//third_party/googletest/googletest/include/gtest", "//commonlibrary/c_utils/base/include", ] - external_deps = [ "c_utils:utils" ] deps = [ - "$camera_path/adapter/platform/v4l2/src/driver_adapter:camera_v4l2_adapter", + "$board_camera_path/driver_adapter:camera_v4l2_adapter", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest", "//third_party/googletest:gtest_main", @@ -71,9 +71,16 @@ ohos_unittest("v4l2_adapter_unittest") { defines += [ "V4L2_UTEST" ] if (is_standard_system) { - external_deps += [ "hiviewdfx_hilog_native:libhilog" ] + external_deps = [ + "c_utils:utils", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + ] } else { - external_deps += [ "hilog:libhilog" ] + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + ] } public_configs = [ ":v4l2_utest_config" ] diff --git a/yangfan/kernel/hdf/drivers/camera/src/driver_adapter/test/unittest/include/utest_v4l2.h b/yangfan/kernel/hdf/drivers/camera/driver_adapter/test/unittest/include/utest_v4l2.h similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/src/driver_adapter/test/unittest/include/utest_v4l2.h rename to yangfan/kernel/hdf/drivers/camera/driver_adapter/test/unittest/include/utest_v4l2.h diff --git a/yangfan/kernel/hdf/drivers/camera/src/driver_adapter/test/unittest/utest_v4l2.cpp b/yangfan/kernel/hdf/drivers/camera/driver_adapter/test/unittest/src/utest_v4l2.cpp similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/src/driver_adapter/test/unittest/utest_v4l2.cpp rename to yangfan/kernel/hdf/drivers/camera/driver_adapter/test/unittest/src/utest_v4l2.cpp diff --git a/yangfan/kernel/hdf/drivers/camera/driver_adapter/test/v4l2_test/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/driver_adapter/test/v4l2_test/BUILD.gn new file mode 100644 index 0000000..065de37 --- /dev/null +++ b/yangfan/kernel/hdf/drivers/camera/driver_adapter/test/v4l2_test/BUILD.gn @@ -0,0 +1,59 @@ +# 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/test.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") + +config("v4l2_maintest") { + visibility = [ ":*" ] + + cflags = [ + "-DGST_DISABLE_DEPRECATED", + "-DHAVE_CONFIG_H", + "-DCOLORSPACE=\"videoconvert\"", + ] +} + +ohos_executable("v4l2_main") { + install_enable = false + sources = [ + "$camera_path/adapter/platform/v4l2/src/driver_adapter/main_test/v4l2_main.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_buffer.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_control.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_dev.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_fileformat.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_stream.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_uvc.cpp", + ] + + include_dirs = [ + "$board_camera_path/driver_adapter/test/v4l2_test/include", + "$camera_path/include", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/include", + ] + + external_deps = [ + "c_utils:utils", + "drivers_interface_camera:metadata", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + ] + defines += [ "V4L2_MAIN_TEST" ] + + public_configs = [ ":v4l2_maintest" ] + install_images = [ chipset_base_dir ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" +} diff --git a/yangfan/kernel/hdf/drivers/camera/src/driver_adapter/main_test/project_v4l2_main.h b/yangfan/kernel/hdf/drivers/camera/driver_adapter/test/v4l2_test/include/project_v4l2_main.h similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/src/driver_adapter/main_test/project_v4l2_main.h rename to yangfan/kernel/hdf/drivers/camera/driver_adapter/test/v4l2_test/include/project_v4l2_main.h diff --git a/yangfan/kernel/hdf/drivers/camera/metadata_manager/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/metadata_manager/BUILD.gn new file mode 100644 index 0000000..584f41e --- /dev/null +++ b/yangfan/kernel/hdf/drivers/camera/metadata_manager/BUILD.gn @@ -0,0 +1,77 @@ +# 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.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") + +if (!defined(ohos_lite)) { + config("camera_metadata_manager_config") { + visibility = [ ":*" ] + cflags = [ + "-DGST_DISABLE_DEPRECATED", + "-DHAVE_CONFIG_H", + ] + + if (enable_camera_device_utest) { + cflags += [ + "-fprofile-arcs", + "-ftest-coverage", + ] + + ldflags += [ "--coverage" ] + } + } + + ohos_shared_library("camera_metadata_manager") { + sources = [ + "$camera_path/metadata_manager/src/metadata_config.cpp", + "$camera_path/metadata_manager/src/metadata_controller.cpp", + ] + include_dirs = [ + "$camera_path/../../interfaces/include", + "$camera_path/include", + "$camera_path/device_manager/include", + "$camera_path/metadata_manager/include", + ] + + deps = [ "$board_camera_path/device_manager:camera_device_manager" ] + + if (is_standard_system) { + external_deps = [ + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_host", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hdf_core:libhdi", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + ] + if (use_hitrace) { + external_deps += [ "hitrace_native:libhitrace" ] + } + } else { + external_deps = [ "hilog:libhilog" ] + } + external_deps += [ + "drivers_interface_camera:metadata", + "ipc:ipc_single", + ] + + public_configs = [ ":camera_metadata_manager_config" ] + install_images = [ chipset_base_dir ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" + } +} diff --git a/yangfan/kernel/hdf/drivers/camera/src/pipeline_core/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/pipeline_core/BUILD.gn similarity index 91% rename from yangfan/kernel/hdf/drivers/camera/src/pipeline_core/BUILD.gn rename to yangfan/kernel/hdf/drivers/camera/pipeline_core/BUILD.gn index 42b014b..1487137 100644 --- a/yangfan/kernel/hdf/drivers/camera/src/pipeline_core/BUILD.gn +++ b/yangfan/kernel/hdf/drivers/camera/pipeline_core/BUILD.gn @@ -11,9 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") +import("//device/board/${product_company}/${device_name}/device.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") import("//drivers/peripheral/camera/camera.gni") -import("../../camera.gni") +import("../camera.gni") config("pipe_config") { visibility = [ ":*" ] @@ -46,7 +47,7 @@ config("pipe_config") { ohos_shared_library("camera_pipeline_core") { sources = [ - "$camera_device_name_path/camera/src/pipeline_core/node/rk_codec_node.cpp", + "$camera_device_name_path/camera/pipeline_core/src/node/rk_codec_node.cpp", "$camera_path/adapter/platform/v4l2/src/pipeline_core/nodes/uvc_node/uvc_node.cpp", "$camera_path/adapter/platform/v4l2/src/pipeline_core/nodes/v4l2_source_node/v4l2_source_node.cpp", "$camera_path/pipeline_core/host_stream/src/host_stream_impl.cpp", @@ -110,13 +111,13 @@ ohos_shared_library("camera_pipeline_core") { "$camera_path/interfaces/hdi", "$camera_path/utils/event", "$camera_path/adapter/platform/v4l2/src/device_manager/include", - "$camera_device_name_path/camera/include/device_manager", + "$camera_device_name_path/camera/device_manager/include", "$camera_path/adapter/platform/v4l2/src/pipeline_core/nodes/v4l2_source_node", "$camera_path/adapter/platform/v4l2/src/pipeline_core/nodes/uvc_node", "$camera_path/adapter/platform/v4l2/src/driver_adapter/include/", "//foundation/communication/ipc/ipc/native/src/core/include", "//commonlibrary/c_utils/base/include", - "$camera_device_name_path/camera/src/pipeline_core/node", + "$camera_device_name_path/camera/pipeline_core/src/node", "//device/soc/rockchip/rk3399/hardware/rga/include", "//device/soc/rockchip/rk3399/hardware/mpp/include", "//third_party/libjpeg-turbo", @@ -128,9 +129,9 @@ ohos_shared_library("camera_pipeline_core") { ] deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "$board_camera_path/metadata_manager:camera_metadata_manager", "$camera_path/buffer_manager:camera_buffer_manager", - "$camera_path/device_manager:camera_device_manager", - "$camera_path/metadata_manager:camera_metadata_manager", "//device/soc/rockchip/rk3399/hardware/mpp:libmpp", "//device/soc/rockchip/rk3399/hardware/rga:librga", "//drivers/interface/camera/v1_0:libcamera_stub_1.0", @@ -151,8 +152,8 @@ ohos_shared_library("camera_pipeline_core") { } external_deps += [ "drivers_interface_camera:metadata" ] public_configs = [ ":pipe_config" ] - subsystem_name = "hdf" - part_name = "camera_device_driver" + subsystem_name = "rockchip_products" + part_name = "rockchip_products" } config("example_config") { @@ -166,7 +167,7 @@ config("example_config") { } ohos_shared_library("camera_ipp_algo_example") { - sources = [ "$camera_device_name_path/camera/src/pipeline_core/ipp_algo_example/ipp_algo_example.c" ] + sources = [ "$camera_device_name_path/camera/pipeline_core/src/ipp_algo_example/ipp_algo_example.c" ] include_dirs = [ "$camera_path/pipeline_core/ipp/include", @@ -174,6 +175,6 @@ ohos_shared_library("camera_ipp_algo_example") { ] external_deps = [ "c_utils:utils" ] public_configs = [ ":example_config" ] - subsystem_name = "hdf" - part_name = "camera_device_driver" + subsystem_name = "rockchip_products" + part_name = "rockchip_products" } diff --git a/yangfan/kernel/hdf/drivers/camera/src/pipeline_core/ipp_algo_example/ipp_algo_example.c b/yangfan/kernel/hdf/drivers/camera/pipeline_core/src/ipp_algo_example/ipp_algo_example.c similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/src/pipeline_core/ipp_algo_example/ipp_algo_example.c rename to yangfan/kernel/hdf/drivers/camera/pipeline_core/src/ipp_algo_example/ipp_algo_example.c diff --git a/yangfan/kernel/hdf/drivers/camera/src/pipeline_core/node/rk_codec_node.cpp b/yangfan/kernel/hdf/drivers/camera/pipeline_core/src/node/rk_codec_node.cpp similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/src/pipeline_core/node/rk_codec_node.cpp rename to yangfan/kernel/hdf/drivers/camera/pipeline_core/src/node/rk_codec_node.cpp diff --git a/yangfan/kernel/hdf/drivers/camera/src/pipeline_core/node/rk_codec_node.h b/yangfan/kernel/hdf/drivers/camera/pipeline_core/src/node/rk_codec_node.h similarity index 100% rename from yangfan/kernel/hdf/drivers/camera/src/pipeline_core/node/rk_codec_node.h rename to yangfan/kernel/hdf/drivers/camera/pipeline_core/src/node/rk_codec_node.h diff --git a/yangfan/kernel/hdf/drivers/camera/pipeline_core/test/unittest/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/pipeline_core/test/unittest/BUILD.gn new file mode 100644 index 0000000..f009027 --- /dev/null +++ b/yangfan/kernel/hdf/drivers/camera/pipeline_core/test/unittest/BUILD.gn @@ -0,0 +1,108 @@ +# 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/test.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") +ut_root_path = "$camera_path/../../test/ut" + +module_output_path = "$root_out_dir/test/unittest/hdf" + +config("camera_ut_test_config") { + visibility = [ ":*" ] + + cflags_cc = [] + + ldflags = [ "--coverage" ] +} +ohos_unittest("camera_pipeline_core_test_ut") { + testonly = true + module_out_path = module_output_path + sources = [ + # pipeline core test + "$ut_root_path/pipeline_core/pipeline_core_test.cpp", + "$ut_root_path/pipeline_core/stream_pipeline_builder_test.cpp", + "$ut_root_path/pipeline_core/stream_pipeline_dispatcher_test.cpp", + "$ut_root_path/pipeline_core/stream_pipeline_strategy_test.cpp", + ] + + include_dirs = [ + # camera common includes + "$camera_path/include", + "$camera_path/../../interfaces/include", + "$camera_path/../../interfaces/hdi_passthrough", + "$camera_path/../../test/common/callback/include", + "$camera_path/utils/event", + + # device manager includes + "$camera_path/device_manager/include", + + # buffer manager includes + "$camera_path/buffer_manager/include", + "$camera_path/buffer_manager/src/buffer_adapter/lite", + "//third_party/googletest/googletest/include", + "$camera_path/../../base", + "$camera_path/../../display/interfaces/include", + + # pipeline core includes + "$camera_path/pipeline_core", + "$camera_path/pipeline_core/host_stream/include", + "$camera_path/pipeline_core/utils", + "$camera_path/pipeline_core/nodes/include", + "$camera_path/pipeline_core/nodes/src/node_base", + "$camera_path/pipeline_core/nodes/src/sink_node", + "$camera_path/pipeline_core/nodes/src/sensor_node", + "$camera_path/pipeline_core/nodes/src/merge_node", + "$camera_path/pipeline_core/nodes/src/dummy_node", + "$camera_path/pipeline_core/pipeline_impl/include", + "$camera_path/pipeline_core/pipeline_impl/src", + "$camera_path/pipeline_core/include", + "$camera_path/pipeline_core/pipeline_impl/src/builder", + "$camera_path/pipeline_core/pipeline_impl/src/dispatcher", + "$camera_path/pipeline_core/pipeline_impl/src/parser", + "$camera_path/pipeline_core/pipeline_impl/src/strategy", + "$camera_path/pipeline_core/pipeline_impl/src/strategy/config", + "$camera_path/pipeline_core/ipp/include", + ] + + deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "$board_camera_path/pipeline_core:camera_pipeline_core", + "$camera_path/buffer_manager:camera_buffer_manager", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest", + "//third_party/googletest:gtest_main", + ] + + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "drivers_interface_camera:libcamera_proxy_1.0", + "drivers_interface_camera:libcamera_stub_1.0", + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + "samgr:samgr_proxy", + ] + } else { + external_deps = [ "hilog:libhilog" ] + } + + external_deps += [ + "drivers_interface_camera:metadata", + "ipc:ipc_single", + "samgr:samgr_proxy", + ] + public_configs = [ ":camera_ut_test_config" ] +} diff --git a/yangfan/kernel/hdf/drivers/camera/product.gni b/yangfan/kernel/hdf/drivers/camera/product.gni index f39921c..01fed26 100644 --- a/yangfan/kernel/hdf/drivers/camera/product.gni +++ b/yangfan/kernel/hdf/drivers/camera/product.gni @@ -16,12 +16,15 @@ if (!defined(defines)) { } camera_product_name_path = "//vendor/${product_company}/${product_name}" -camera_device_name_path = "//device/board/${product_company}/${device_name}/kernel/hdf/driver" +camera_device_name_path = + "//device/board/${product_company}/${device_name}/kernel/hdf/driver" is_support_v4l2 = true if (is_support_v4l2) { is_support_mpi = false defines += [ "SUPPORT_V4L2" ] chipset_build_deps = "$camera_device_name_path/camera/:chipset_build" - camera_device_manager_deps = "$camera_device_name_path/camera/src/device_manager:camera_device_manager" - camera_pipeline_core_deps = "$camera_device_name_path/camera/src/pipeline_core:camera_pipeline_core" + camera_device_manager_deps = + "$camera_device_name_path/camera/device_manager:camera_device_manager" + camera_pipeline_core_deps = + "$camera_device_name_path/camera/pipeline_core:camera_pipeline_core" } diff --git a/yangfan/kernel/hdf/drivers/camera/src/demo/include/project_camera_demo.h b/yangfan/kernel/hdf/drivers/camera/src/demo/include/project_camera_demo.h deleted file mode 100644 index ac126c2..0000000 --- a/yangfan/kernel/hdf/drivers/camera/src/demo/include/project_camera_demo.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2021 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. - */ - -#ifndef HOS_CAMERA_PROJET_CAMERA_DEMO_H -#define HOS_CAMERA_PROJET_CAMERA_DEMO_H - -namespace OHOS::Camera { -#define CAMERA_PREVIEW_WIDTH 640 -#define CAMERA_PREVIEW_HEIGHT 480 -#define CAMERA_CAPTURE_WIDTH 1280 -#define CAMERA_CAPTURE_HEIGHT 960 -#define CAMERA_VIDEO_WIDTH 1280 -#define CAMERA_VIDEO_HEIGHT 960 - -#define CAMERA_CAPTURE_ENCODE_TYPE ENCODE_TYPE_JPEG -#define CAMERA_VIDEO_ENCODE_TYPE ENCODE_TYPE_H264 - -#define CAMERA_FORMAT PIXEL_FMT_RGBA_8888 -} // namespace OHOS::Camera -#endif diff --git a/yangfan/kernel/hdf/drivers/camera/src/driver_adapter/BUILD.gn b/yangfan/kernel/hdf/drivers/camera/src/driver_adapter/BUILD.gn deleted file mode 100644 index 5df63ae..0000000 --- a/yangfan/kernel/hdf/drivers/camera/src/driver_adapter/BUILD.gn +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. - -import("//drivers/peripheral/camera/camera.gni") - -if (defined(ohos_lite)) { - copy("driver_adapter") { - sources = [ "//device/hisilicon/hardware/media/hal/camera/libs/hispark_taurus/libdriver_adapter.so" ] - outputs = [ "$root_out_dir/{{source_file_part}}" ] - } -} else { - import("//build/ohos.gni") - import("//drivers/adapter/uhdf2/uhdf.gni") - - ohos_prebuilt_etc("driver_adapter") { - if (use_musl) { - source = "//device/hisilicon/hardware/media/hal/camera/libs/hispark_taurus/libdriver_adapter.z.so" - } else { - source = "//device/hisilicon/hardware/media/hal/camera/libs/hispark_taurus/std/libdriver_adapter.z.so" - } - module_install_dir = "lib/" - part_name = "hdf" - subsystem_name = "hdf" - } -} diff --git a/yangfan/ohos.build b/yangfan/ohos.build index d6ebf32..62ad4fc 100755 --- a/yangfan/ohos.build +++ b/yangfan/ohos.build @@ -6,7 +6,12 @@ "//device/board/isoftstone/${product_name}:rk3399_group", "//vendor/isoftstone/${product_name}/bluetooth:libbt_vendor", "//vendor/isoftstone/${product_name}/bluetooth:BCM4343A1.hcd", - "//device/board/isoftstone/${product_name}/kernel/drivers/wifi:ap6xxx" + "//device/board/isoftstone/${product_name}/kernel/drivers/wifi:ap6xxx", + "//device/board/isoftstone/${product_name}/kernel/hdf/drivers/camera:chipset_build", + "//device/board/isoftstone/${product_name}/kernel/hdf/drivers/camera:camera_host_vdi_impl_1.0" + ], + "test_list": [ + "//device/board/isoftstone/${product_name}/kernel/hdf/drivers/camera:camera_board_test" ] } } diff --git a/zhiyuan/device.gni b/zhiyuan/device.gni index 9fcf64e..6c55a9c 100755 --- a/zhiyuan/device.gni +++ b/zhiyuan/device.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2021 iSoftStone Device Co., Ltd. +# Copyright (c) 2021 - 2023 iSoftStone 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 @@ -28,9 +28,4 @@ is_support_v4l2 = true if (is_support_v4l2) { is_support_mpi = false defines += [ "SUPPORT_V4L2" ] - chipset_build_deps = "$board_camera_path:chipset_build" - camera_device_manager_deps = - "$board_camera_path/device_manager:camera_device_manager" - camera_pipeline_core_deps = - "$board_camera_path/pipeline_core:camera_pipeline_core" } diff --git a/zhiyuan/kernel/hdf/driver/camera/BUILD.gn b/zhiyuan/kernel/hdf/driver/camera/BUILD.gn index 474f5e6..9e79f15 100755 --- a/zhiyuan/kernel/hdf/driver/camera/BUILD.gn +++ b/zhiyuan/kernel/hdf/driver/camera/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) iSoftStone Device Co., Ltd. 2022. All rights reserved. +# Copyright (C) iSoftStone Device Co., Ltd. 2022 - 2023. All rights reserved. # 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 @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") +import("//device/board/${product_company}/${device_name}/device.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") import("//drivers/peripheral/camera/camera.gni") import("$hdf_framework_path/tools/hc-gen/hc_gen.gni") @@ -26,8 +27,8 @@ ohos_prebuilt_etc("camera_host_config.hcb") { source = hcs_outputs[0] relative_install_dir = "hdfconfig" install_images = [ chipset_base_dir ] - subsystem_name = "hdf" - part_name = "camera_device_driver" + subsystem_name = "rockchip_products" + part_name = "rockchip_products" } hc_gen_c("generate_source") { @@ -87,8 +88,8 @@ ohos_prebuilt_etc("ipp_algo_config.hcb") { source = hcs_outputs[0] relative_install_dir = "hdfconfig" install_images = [ chipset_base_dir ] - subsystem_name = "hdf" - part_name = "camera_device_driver" + subsystem_name = "rockchip_products" + part_name = "rockchip_products" } config("example_config") { @@ -108,7 +109,200 @@ group("chipset_build") { ":ipp_algo_config.hcb", ":params.c", "$board_camera_path/pipeline_core:camera_ipp_algo_example", - "$camera_path/adapter/platform/v4l2/src/driver_adapter:camera_v4l2_adapter", - "$camera_path/adapter/platform/v4l2/src/driver_adapter/main_test:v4l2_main", ] } + +config("camhdi_impl_config") { + visibility = [ ":*" ] + cflags = [ + "-DGST_DISABLE_DEPRECATED", + "-DHAVE_CONFIG_H", + ] + + ldflags = [ "-Wl" ] + + if (enable_camera_device_utest) { + cflags += [ + "-fprofile-arcs", + "-ftest-coverage", + ] + + ldflags += [ "--coverage" ] + } +} + +host_sources = [ + "$camera_path/../v4l2/src/camera_device/camera_device_vdi_impl.cpp", + "$camera_path/../v4l2/src/camera_dump.cpp", + "$camera_path/../v4l2/src/camera_host/camera_host_config.cpp", + "$camera_path/../v4l2/src/camera_host/camera_host_vdi_impl.cpp", + "$camera_path/../v4l2/src/camera_host/hcs_deal.cpp", + "$camera_path/../v4l2/src/offline_stream_operator/offline_stream.cpp", + "$camera_path/../v4l2/src/offline_stream_operator/offline_stream_operator_vdi_impl.cpp", + "$camera_path/../v4l2/src/stream_operator/capture_message.cpp", + "$camera_path/../v4l2/src/stream_operator/capture_request.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_base.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_operator_vdi_impl.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_post_view.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_preview.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_statistics.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_still_capture.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard/stream_tunnel.cpp", + "$camera_path/../v4l2/src/stream_operator/stream_video.cpp", +] + +host_includes = [ + "$camera_path/../../interfaces/include", + "$camera_path/include", + "$camera_path/metadata_manager/include", + "$camera_path/utils/watchdog", + "$camera_path/../interfaces", + "$camera_path/../v4l2/include", + "$camera_path/../v4l2/include/camera_host", + "$camera_path/../v4l2/include/camera_device", + "$camera_path/../v4l2/include/stream_operator", + "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard", + "$camera_path/../v4l2/include/offline_stream_operator", + "$camera_path/device_manager/include/", + "$camera_path/buffer_manager/src/buffer_adapter/standard", + "$camera_path/utils/event", + "$camera_path/../../display/interfaces/include", + + #producer + "$camera_path/pipeline_core/utils", + "$camera_path/pipeline_core/include", + "$camera_path/pipeline_core/host_stream/include", + "$camera_path/pipeline_core/nodes/include", + "$camera_path/pipeline_core/nodes/src/node_base", + "$camera_path/pipeline_core/nodes/src/dummy_node", + "$camera_path/pipeline_core/pipeline_impl/include", + "$camera_path/pipeline_core/pipeline_impl/src", + "$camera_path/pipeline_core/pipeline_impl/src/builder", + "$camera_path/pipeline_core/pipeline_impl/src/dispatcher", + "$camera_path/pipeline_core/pipeline_impl/src/parser", + "$camera_path/pipeline_core/pipeline_impl/src/strategy", + "$camera_path/pipeline_core/ipp/include", +] + +ohos_shared_library("camera_host_vdi_impl_1.0") { + sources = host_sources + include_dirs = host_includes + + deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "$board_camera_path/metadata_manager:camera_metadata_manager", + "$board_camera_path/pipeline_core:camera_pipeline_core", + "$camera_path/buffer_manager:camera_buffer_manager", + "$camera_path/utils:camera_utils", + ] + + defines = [] + if (enable_camera_device_utest) { + defines += [ "CAMERA_DEVICE_UTEST" ] + } + if (use_hitrace) { + defines += [ "HITRACE_LOG_ENABLED" ] + } + + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_host", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hdf_core:libhdi", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + ] + if (use_hitrace) { + external_deps += [ "hitrace_native:libhitracechain" ] + } + } else { + external_deps = [ "hilog:libhilog" ] + } + external_deps += [ + "drivers_interface_camera:libcamera_stub_1.0", + "drivers_interface_camera:metadata", + "hitrace_native:hitrace_meter", + "ipc:ipc_single", + ] + public_configs = [ ":camhdi_impl_config" ] + install_images = [ chipset_base_dir ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" +} + +ohos_static_library("camera_host_vdi_impl_1.0_static") { + sources = host_sources + include_dirs = host_includes + + deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "$board_camera_path/metadata_manager:camera_metadata_manager", + "$board_camera_path/pipeline_core:camera_pipeline_core", + "$camera_path/buffer_manager:camera_buffer_manager", + "$camera_path/utils:camera_utils", + ] + + defines = [] + if (enable_camera_device_utest) { + defines += [ "CAMERA_DEVICE_UTEST" ] + } + if (use_hitrace) { + defines += [ "HITRACE_LOG_ENABLED" ] + } + + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_host", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hdf_core:libhdi", + "hitrace_native:hitrace_meter", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + ] + if (use_hitrace) { + external_deps += [ "hitrace_native:libhitracechain" ] + } + } else { + external_deps = [ "hilog:libhilog" ] + } + external_deps += [ + "drivers_interface_camera:libcamera_stub_1.0", + "drivers_interface_camera:metadata", + "hitrace_native:hitrace_meter", + "ipc:ipc_single", + ] + + public_configs = [ ":camhdi_impl_config" ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" +} + +group("camera_board_test") { + if (target_cpu == "x86_64") { + deps = [] + } else { + testonly = true + deps = [ + #device manager test + "device_manager/test/unittest:camera_board_device_manager_unittest", + + #driver adapter v4l2 test + "driver_adapter/test/v4l2_test:v4l2_main", + + #driver adapter v4l2 unittest + "driver_adapter/test/unittest:v4l2_adapter_unittest", + + # pipeline core test + "pipeline_core/test/unittest:camera_pipeline_core_test_ut", + + # demo test + "demo:ohos_camera_demo", + ] + } +} diff --git a/zhiyuan/kernel/hdf/driver/camera/demo/BUILD.gn b/zhiyuan/kernel/hdf/driver/camera/demo/BUILD.gn new file mode 100644 index 0000000..1bc8d59 --- /dev/null +++ b/zhiyuan/kernel/hdf/driver/camera/demo/BUILD.gn @@ -0,0 +1,104 @@ +# 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.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") + +config("ohos_camera_demo_config") { + visibility = [ ":*" ] + cflags_cc = [ + "-Wno-error", + "-std=c++17", + ] +} + +ohos_executable("ohos_camera_demo") { + install_enable = false + sources = [ + "$camera_path/../../test/demo/demo_main.cpp", + "$camera_path/../../test/demo/ohos_camera_demo.cpp", + "$camera_path/../../test/demo/stream_customer.cpp", + ] + + include_dirs = [ + "$board_camera_path/demo/include", + "$camera_path/../../test/demo/include", + "$camera_path/../../interfaces/include", + "$camera_path/../../interfaces/hdi_ipc", + "$camera_path/../../interfaces/hdi_ipc/utils/include", + "$camera_path/../../test/common/callback/include", + "$camera_path/include", + "$camera_path/../v4l2", + "$camera_path/../v4l2/include", + "$camera_path/../v4l2/include/camera_host", + "$camera_path/../v4l2/include/camera_device", + "$camera_path/../v4l2/include/stream_operator", + "$camera_path/../v4l2/include/offline_stream_operator", + "$camera_path/device_manager/include/", + "$camera_path/device_manager/include/mpi", + "$camera_path/utils/event", + + #producer + "$camera_path/pipeline_core/utils", + "$camera_path/pipeline_core/include", + "$camera_path/pipeline_core/host_stream/include", + "$camera_path/pipeline_core/nodes/include", + "$camera_path/pipeline_core/nodes/src/node_base", + "$camera_path/pipeline_core/nodes/src/dummy_node", + "$camera_path/pipeline_core/pipeline_impl/src/strategy/config", + "$camera_path/pipeline_core/pipeline_impl/include", + "$camera_path/pipeline_core/pipeline_impl/src", + "$camera_path/pipeline_core/pipeline_impl/src/builder", + "$camera_path/pipeline_core/pipeline_impl/src/dispatcher", + "$camera_path/pipeline_core/pipeline_impl/src/parser", + "$camera_path/pipeline_core/pipeline_impl/src/strategy", + "$camera_path/pipeline_core/ipp/include", + ] + + deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "$board_camera_path/pipeline_core:camera_pipeline_core", + "$camera_path/../../hdi_service/v1_0:camera_host_service_1.0_static", + "$camera_path/buffer_manager:camera_buffer_manager", + ] + + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_host", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hdf_core:libhdi", + "hiviewdfx_hilog_native:libhilog", + "samgr:samgr_proxy", + ] + } else { + external_deps = [ "hilog:libhilog" ] + } + + external_deps += [ + "drivers_interface_camera:libcamera_proxy_1.0", + "drivers_interface_camera:metadata", + "ipc:ipc_single", + "samgr:samgr_proxy", + ] + + public_configs = [ ":ohos_camera_demo_config" ] + install_enable = false + install_images = [ chipset_base_dir ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" +} diff --git a/zhiyuan/kernel/hdf/driver/camera/device_manager/BUILD.gn b/zhiyuan/kernel/hdf/driver/camera/device_manager/BUILD.gn index e75525b..cc2dbaf 100755 --- a/zhiyuan/kernel/hdf/driver/camera/device_manager/BUILD.gn +++ b/zhiyuan/kernel/hdf/driver/camera/device_manager/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") +import("//device/board/${product_company}/${device_name}/device.gni") import("//drivers/peripheral/camera/camera.gni") config("device_manager_config") { @@ -74,9 +75,7 @@ ohos_shared_library("camera_device_manager") { "c_utils:utils", "hdf_core:libhdf_utils", ] - deps = [ - "$camera_path/adapter/platform/v4l2/src/driver_adapter:camera_v4l2_adapter", - ] + deps = [ "$board_camera_path/driver_adapter:camera_v4l2_adapter" ] if (is_standard_system) { external_deps += [ "hiviewdfx_hilog_native:libhilog" ] @@ -86,6 +85,6 @@ ohos_shared_library("camera_device_manager") { external_deps += [ "drivers_interface_camera:metadata" ] public_configs = [ ":device_manager_config" ] install_images = [ chipset_base_dir ] - subsystem_name = "hdf" - part_name = "camera_device_driver" + subsystem_name = "rockchip_products" + part_name = "rockchip_products" } diff --git a/zhiyuan/kernel/hdf/driver/camera/device_manager/test/unittest/BUILD.gn b/zhiyuan/kernel/hdf/driver/camera/device_manager/test/unittest/BUILD.gn new file mode 100644 index 0000000..e8fe854 --- /dev/null +++ b/zhiyuan/kernel/hdf/driver/camera/device_manager/test/unittest/BUILD.gn @@ -0,0 +1,63 @@ +# Copyright (c) 2021 - 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/test.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") + +module_output_path = "$root_out_dir/test/unittest/hdf" +config("v4l2_device_config") { + visibility = [ ":*" ] + cflags_cc = [ + "-DGST_DISABLE_DEPRECATED", + "-DHAVE_CONFIG_H", + "-DCOLORSPACE=\"videoconvert\"", + ] +} +ohos_unittest("camera_board_device_manager_unittest") { + testonly = true + module_out_path = module_output_path + sources = [ "$camera_path/device_manager/test/unittest/v4l2/utest_v4l2_device_manager.cpp" ] + include_dirs = [ + "$camera_path/device_manager", + "$camera_path/device_manager/include", + "$camera_path/device_manager/include/v4l2", + "$camera_path/device_manager/src", + "$camera_path/device_manager/src/v4l2", + "$camera_path/driver_adapter/include", + "$camera_path/include", + "$camera_path/device_manager/test/unittest/v4l2", + "$camera_path/utils/event", + "$camera_path/adapter/platform/v4l2/src/device_manager/include", + "$board_camera_path/device_manager/include", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/include", + ] + deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest_main", + ] + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + ] + } else { + external_deps = [ "hilog:libhilog" ] + } + external_deps += [ "drivers_interface_camera:metadata" ] + public_configs = [ ":v4l2_device_config" ] +} diff --git a/zhiyuan/kernel/hdf/driver/camera/driver_adapter/BUILD.gn b/zhiyuan/kernel/hdf/driver/camera/driver_adapter/BUILD.gn index fab135f..b1bd916 100755 --- a/zhiyuan/kernel/hdf/driver/camera/driver_adapter/BUILD.gn +++ b/zhiyuan/kernel/hdf/driver/camera/driver_adapter/BUILD.gn @@ -1,16 +1,56 @@ -# Copyright (C) iSoftStone Device Co., Ltd. 2022. All rights reserved. +# Copyright (C) iSoftStone Device Co., Ltd. 2022 - 2023. All rights reserved. -# import("//build/ohos.gni") -# import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") -# import("//drivers/peripheral/camera/camera.gni") +import("//build/ohos.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") -# ohos_prebuilt_etc("driver_adapter") { -# if (use_musl) { -# source = "//device/board/seed/T507/camera/src/driver_adapter/libs/libdriver_adapter.z.so" -# } else { -# source = "//device/board/seed/T507/camera/src/driver_adapter/libs/libdriver_adapter.z.so" -# } -# module_install_dir = "lib/" -# part_name = "hdf" -# subsystem_name = "hdf" -# } +config("v4l2_config") { + visibility = [ ":*" ] + + cflags = [ + "-DGST_DISABLE_DEPRECATED", + "-DHAVE_CONFIG_H", + "-DCOLORSPACE=\"videoconvert\"", + ] + + if (enable_camera_device_utest) { + cflags += [ + "-fprofile-arcs", + "-ftest-coverage", + ] + + ldflags = [ "--coverage" ] + } +} + +ohos_shared_library("camera_v4l2_adapter") { + sources = [ + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_buffer.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_control.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_dev.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_fileformat.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_stream.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_uvc.cpp", + ] + + include_dirs = [ + "$camera_path/include", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/include", + ] + + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + ] + } else { + external_deps = [ "hilog:libhilog" ] + } + external_deps += [ "drivers_interface_camera:metadata" ] + public_configs = [ ":v4l2_config" ] + install_images = [ chipset_base_dir ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" +} diff --git a/zhiyuan/kernel/hdf/driver/camera/driver_adapter/test/BUILD.gn b/zhiyuan/kernel/hdf/driver/camera/driver_adapter/test/unittest/BUILD.gn similarity index 77% rename from zhiyuan/kernel/hdf/driver/camera/driver_adapter/test/BUILD.gn rename to zhiyuan/kernel/hdf/driver/camera/driver_adapter/test/unittest/BUILD.gn index 47a492e..ef30dd8 100755 --- a/zhiyuan/kernel/hdf/driver/camera/driver_adapter/test/BUILD.gn +++ b/zhiyuan/kernel/hdf/driver/camera/driver_adapter/test/unittest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 - 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 @@ -12,10 +12,11 @@ # limitations under the License. import("//build/test.gni") -import("//drivers/adapter/uhdf2/uhdf.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") import("//drivers/peripheral/camera/camera.gni") -module_output_path = "hdf/v4l2_adapter_test" +module_output_path = "$root_out_dir/test/unittest/hdf" config("v4l2_utest_config") { visibility = [ ":*" ] @@ -50,19 +51,18 @@ ohos_unittest("v4l2_adapter_unittest") { test_type = "unittest" testonly = true module_out_path = module_output_path - sources = [ "unittest/src/utest_v4l2_dev.cpp" ] + sources = [ "src/utest_v4l2_dev.cpp" ] include_dirs = [ "$camera_path/include", "$camera_path/adapter/platform/v4l2/src/driver_adapter/include", - "test/unittest/include", + "include", "//third_party/googletest/googletest/include/gtest", "//commonlibrary/c_utils/base/include", ] - external_deps = [ "c_utils:utils" ] deps = [ - "$camera_path/adapter/platform/v4l2/src/driver_adapter:camera_v4l2_adapter", + "$board_camera_path/driver_adapter:camera_v4l2_adapter", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest", "//third_party/googletest:gtest_main", @@ -71,9 +71,16 @@ ohos_unittest("v4l2_adapter_unittest") { defines += [ "V4L2_UTEST" ] if (is_standard_system) { - external_deps += [ "hiviewdfx_hilog_native:libhilog" ] + external_deps = [ + "c_utils:utils", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + ] } else { - external_deps += [ "hilog:libhilog" ] + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + ] } public_configs = [ ":v4l2_utest_config" ] diff --git a/zhiyuan/kernel/hdf/driver/camera/driver_adapter/test/v4l2_test/BUILD.gn b/zhiyuan/kernel/hdf/driver/camera/driver_adapter/test/v4l2_test/BUILD.gn new file mode 100644 index 0000000..065de37 --- /dev/null +++ b/zhiyuan/kernel/hdf/driver/camera/driver_adapter/test/v4l2_test/BUILD.gn @@ -0,0 +1,59 @@ +# 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/test.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") + +config("v4l2_maintest") { + visibility = [ ":*" ] + + cflags = [ + "-DGST_DISABLE_DEPRECATED", + "-DHAVE_CONFIG_H", + "-DCOLORSPACE=\"videoconvert\"", + ] +} + +ohos_executable("v4l2_main") { + install_enable = false + sources = [ + "$camera_path/adapter/platform/v4l2/src/driver_adapter/main_test/v4l2_main.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_buffer.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_control.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_dev.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_fileformat.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_stream.cpp", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/src/v4l2_uvc.cpp", + ] + + include_dirs = [ + "$board_camera_path/driver_adapter/test/v4l2_test/include", + "$camera_path/include", + "$camera_path/adapter/platform/v4l2/src/driver_adapter/include", + ] + + external_deps = [ + "c_utils:utils", + "drivers_interface_camera:metadata", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + ] + defines += [ "V4L2_MAIN_TEST" ] + + public_configs = [ ":v4l2_maintest" ] + install_images = [ chipset_base_dir ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" +} diff --git a/zhiyuan/kernel/hdf/driver/camera/metadata_manager/BUILD.gn b/zhiyuan/kernel/hdf/driver/camera/metadata_manager/BUILD.gn new file mode 100644 index 0000000..584f41e --- /dev/null +++ b/zhiyuan/kernel/hdf/driver/camera/metadata_manager/BUILD.gn @@ -0,0 +1,77 @@ +# 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.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") + +if (!defined(ohos_lite)) { + config("camera_metadata_manager_config") { + visibility = [ ":*" ] + cflags = [ + "-DGST_DISABLE_DEPRECATED", + "-DHAVE_CONFIG_H", + ] + + if (enable_camera_device_utest) { + cflags += [ + "-fprofile-arcs", + "-ftest-coverage", + ] + + ldflags += [ "--coverage" ] + } + } + + ohos_shared_library("camera_metadata_manager") { + sources = [ + "$camera_path/metadata_manager/src/metadata_config.cpp", + "$camera_path/metadata_manager/src/metadata_controller.cpp", + ] + include_dirs = [ + "$camera_path/../../interfaces/include", + "$camera_path/include", + "$camera_path/device_manager/include", + "$camera_path/metadata_manager/include", + ] + + deps = [ "$board_camera_path/device_manager:camera_device_manager" ] + + if (is_standard_system) { + external_deps = [ + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_host", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hdf_core:libhdi", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + ] + if (use_hitrace) { + external_deps += [ "hitrace_native:libhitrace" ] + } + } else { + external_deps = [ "hilog:libhilog" ] + } + external_deps += [ + "drivers_interface_camera:metadata", + "ipc:ipc_single", + ] + + public_configs = [ ":camera_metadata_manager_config" ] + install_images = [ chipset_base_dir ] + subsystem_name = "rockchip_products" + part_name = "rockchip_products" + } +} diff --git a/zhiyuan/kernel/hdf/driver/camera/pipeline_core/BUILD.gn b/zhiyuan/kernel/hdf/driver/camera/pipeline_core/BUILD.gn index 32caee2..186689c 100755 --- a/zhiyuan/kernel/hdf/driver/camera/pipeline_core/BUILD.gn +++ b/zhiyuan/kernel/hdf/driver/camera/pipeline_core/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") +import("//device/board/${product_company}/${device_name}/device.gni") import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") import("//drivers/peripheral/camera/camera.gni") import("../../camera.gni") @@ -130,9 +131,9 @@ ohos_shared_library("camera_pipeline_core") { deps = [ "$board_camera_path:config.c", "$board_camera_path:params.c", + "$board_camera_path/device_manager:camera_device_manager", + "$board_camera_path/metadata_manager:camera_metadata_manager", "$camera_path/buffer_manager:camera_buffer_manager", - "$camera_path/device_manager:camera_device_manager", - "$camera_path/metadata_manager:camera_metadata_manager", "$camera_path/utils:camera_utils", "//device/soc/allwinner/t507/hardware/rga:librga", "//drivers/interface/camera/v1_0:libcamera_stub_1.0", @@ -155,8 +156,8 @@ ohos_shared_library("camera_pipeline_core") { public_configs = [ ":pipe_config" ] install_images = [ chipset_base_dir ] - subsystem_name = "hdf" - part_name = "camera_device_driver" + subsystem_name = "rockchip_products" + part_name = "rockchip_products" } config("example_config") { @@ -179,6 +180,6 @@ ohos_shared_library("camera_ipp_algo_example") { external_deps = [ "c_utils:utils" ] public_configs = [ ":example_config" ] install_images = [ chipset_base_dir ] - subsystem_name = "hdf" - part_name = "camera_device_driver" + subsystem_name = "rockchip_products" + part_name = "rockchip_products" } diff --git a/zhiyuan/kernel/hdf/driver/camera/pipeline_core/test/unittest/BUILD.gn b/zhiyuan/kernel/hdf/driver/camera/pipeline_core/test/unittest/BUILD.gn new file mode 100644 index 0000000..f009027 --- /dev/null +++ b/zhiyuan/kernel/hdf/driver/camera/pipeline_core/test/unittest/BUILD.gn @@ -0,0 +1,108 @@ +# 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/test.gni") +import("//device/board/${product_company}/${device_name}/device.gni") +import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") +import("//drivers/peripheral/camera/camera.gni") +ut_root_path = "$camera_path/../../test/ut" + +module_output_path = "$root_out_dir/test/unittest/hdf" + +config("camera_ut_test_config") { + visibility = [ ":*" ] + + cflags_cc = [] + + ldflags = [ "--coverage" ] +} +ohos_unittest("camera_pipeline_core_test_ut") { + testonly = true + module_out_path = module_output_path + sources = [ + # pipeline core test + "$ut_root_path/pipeline_core/pipeline_core_test.cpp", + "$ut_root_path/pipeline_core/stream_pipeline_builder_test.cpp", + "$ut_root_path/pipeline_core/stream_pipeline_dispatcher_test.cpp", + "$ut_root_path/pipeline_core/stream_pipeline_strategy_test.cpp", + ] + + include_dirs = [ + # camera common includes + "$camera_path/include", + "$camera_path/../../interfaces/include", + "$camera_path/../../interfaces/hdi_passthrough", + "$camera_path/../../test/common/callback/include", + "$camera_path/utils/event", + + # device manager includes + "$camera_path/device_manager/include", + + # buffer manager includes + "$camera_path/buffer_manager/include", + "$camera_path/buffer_manager/src/buffer_adapter/lite", + "//third_party/googletest/googletest/include", + "$camera_path/../../base", + "$camera_path/../../display/interfaces/include", + + # pipeline core includes + "$camera_path/pipeline_core", + "$camera_path/pipeline_core/host_stream/include", + "$camera_path/pipeline_core/utils", + "$camera_path/pipeline_core/nodes/include", + "$camera_path/pipeline_core/nodes/src/node_base", + "$camera_path/pipeline_core/nodes/src/sink_node", + "$camera_path/pipeline_core/nodes/src/sensor_node", + "$camera_path/pipeline_core/nodes/src/merge_node", + "$camera_path/pipeline_core/nodes/src/dummy_node", + "$camera_path/pipeline_core/pipeline_impl/include", + "$camera_path/pipeline_core/pipeline_impl/src", + "$camera_path/pipeline_core/include", + "$camera_path/pipeline_core/pipeline_impl/src/builder", + "$camera_path/pipeline_core/pipeline_impl/src/dispatcher", + "$camera_path/pipeline_core/pipeline_impl/src/parser", + "$camera_path/pipeline_core/pipeline_impl/src/strategy", + "$camera_path/pipeline_core/pipeline_impl/src/strategy/config", + "$camera_path/pipeline_core/ipp/include", + ] + + deps = [ + "$board_camera_path/device_manager:camera_device_manager", + "$board_camera_path/pipeline_core:camera_pipeline_core", + "$camera_path/buffer_manager:camera_buffer_manager", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest", + "//third_party/googletest:gtest_main", + ] + + if (is_standard_system) { + external_deps = [ + "c_utils:utils", + "drivers_interface_camera:libcamera_proxy_1.0", + "drivers_interface_camera:libcamera_stub_1.0", + "graphic_chipsetsdk:surface", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + "samgr:samgr_proxy", + ] + } else { + external_deps = [ "hilog:libhilog" ] + } + + external_deps += [ + "drivers_interface_camera:metadata", + "ipc:ipc_single", + "samgr:samgr_proxy", + ] + public_configs = [ ":camera_ut_test_config" ] +} diff --git a/zhiyuan/ohos.build b/zhiyuan/ohos.build index aef36fa..3e56406 100755 --- a/zhiyuan/ohos.build +++ b/zhiyuan/ohos.build @@ -3,7 +3,9 @@ "parts": { "allwinner_products": { "module_list": [ - "//device/board/isoftstone/${product_name}:products_group" + "//device/board/isoftstone/${product_name}:products_group", + "//device/board/isoftstone/${product_name}/kernel/hdf/driver/camera:chipset_build", + "//device/board/isoftstone/${product_name}/kernel/hdf/driver/camera:camera_host_vdi_impl_1.0" ] } }