From 0ee0ae159576bb5a39afde3d9ee8a146baaee0f0 Mon Sep 17 00:00:00 2001 From: xuweinan Date: Thu, 26 Oct 2023 19:21:59 +0800 Subject: [PATCH 1/2] Description:native_hgm add Feature or Bugfix:Feature Binary Source:No Signed-off-by: xuweinan --- graphic/graphic_2d/native_hgm/BUILD.gn | 30 ++++++++++ .../native_hgm/libnative_hgm.ndk.json | 3 + graphic/graphic_2d/native_hgm/native_hgm.h | 60 +++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 graphic/graphic_2d/native_hgm/BUILD.gn create mode 100644 graphic/graphic_2d/native_hgm/libnative_hgm.ndk.json create mode 100644 graphic/graphic_2d/native_hgm/native_hgm.h diff --git a/graphic/graphic_2d/native_hgm/BUILD.gn b/graphic/graphic_2d/native_hgm/BUILD.gn new file mode 100644 index 0000000000..b997d65d07 --- /dev/null +++ b/graphic/graphic_2d/native_hgm/BUILD.gn @@ -0,0 +1,30 @@ +# 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("//build/ohos/ndk/ndk.gni") + +ohos_ndk_headers("native_hgm_header") { + dest_dir = "$ndk_headers_out_dir/native_hgm" + sources = [ + "//interface/sdk_c/graphic/graphic_2d/native_hgm/native_hgm.h", + ] +} + +ohos_ndk_library("libnative_hgm_ndk") { + output_name = "native_hgm" + output_extension = "so" + ndk_description_file = "./libnative_hgm.ndk.json" + system_capability = "SystemCapability.Graphic.Graphic2D.NativeHgm" + system_capability_headers = [ "native_hgm/native_hgm.h" ] +} diff --git a/graphic/graphic_2d/native_hgm/libnative_hgm.ndk.json b/graphic/graphic_2d/native_hgm/libnative_hgm.ndk.json new file mode 100644 index 0000000000..40be5328f2 --- /dev/null +++ b/graphic/graphic_2d/native_hgm/libnative_hgm.ndk.json @@ -0,0 +1,3 @@ +[ + { "name": "OH_NativeHgm_GetScreenCurrentRefreshRate" } +] \ No newline at end of file diff --git a/graphic/graphic_2d/native_hgm/native_hgm.h b/graphic/graphic_2d/native_hgm/native_hgm.h new file mode 100644 index 0000000000..3c9749bc30 --- /dev/null +++ b/graphic/graphic_2d/native_hgm/native_hgm.h @@ -0,0 +1,60 @@ +/* + * 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. + */ + +#ifndef NATIVE_HYPER_GRAPHIC_MANAGER_H_ +#define NATIVE_HYPER_GRAPHIC_MANAGER_H_ + +/** + * @addtogroup NativeHgm + * @{ + * + * @brief Provides the native hyper_graphic_manager capability. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @since 10 + * @version 1.0 + */ + +/** + * @file native_hgm.h + * + * @brief Defines the functions for obtaining and using a native hyper_graphic_manager. + * + * @library libnative_hgm.so + * @since 10 + * @version 1.0 + */ +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates a NativeHgm instance.\n + * A new NativeHgm instance is created each time this function is called. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @param name Indicates the hyper_graphic_manager connection name. + * @param length Indicates the name's length. + * @return Returns int32_t, return value == 0, success, otherwise, failed. + * @since 10 + * @version 1.0 + */ +int OH_NativeHgm_GetScreenCurrentRefreshRate(int32_t screen); +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file -- Gitee From 9067d98f3a761e49bf16f500f4e46856eabe3620 Mon Sep 17 00:00:00 2001 From: xuweinan Date: Mon, 6 Nov 2023 15:20:03 +0800 Subject: [PATCH 2/2] Description:Hgm NDK add Feature or Bugfix:Feature Signed-off-by: xuweinan --- .../native_hgm/libnative_hgm.ndk.json | 5 ++- graphic/graphic_2d/native_hgm/native_hgm.h | 40 +++++++++++++++++-- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/graphic/graphic_2d/native_hgm/libnative_hgm.ndk.json b/graphic/graphic_2d/native_hgm/libnative_hgm.ndk.json index 40be5328f2..c93fd9f1eb 100644 --- a/graphic/graphic_2d/native_hgm/libnative_hgm.ndk.json +++ b/graphic/graphic_2d/native_hgm/libnative_hgm.ndk.json @@ -1,3 +1,6 @@ [ - { "name": "OH_NativeHgm_GetScreenCurrentRefreshRate" } + { "name": "OH_NativeHgm_SetRefreshRateMode" }, + { "name": "OH_NativeHgm_GetScreenCurrentRefreshRate" }, + { "name": "OH_NativeHgm_GetCurrentRefreshRateMode" }, + { "name": "OH_NativeHgm_GetScreenSupportedRefreshRates" } ] \ No newline at end of file diff --git a/graphic/graphic_2d/native_hgm/native_hgm.h b/graphic/graphic_2d/native_hgm/native_hgm.h index 3c9749bc30..3f9d70a3c5 100644 --- a/graphic/graphic_2d/native_hgm/native_hgm.h +++ b/graphic/graphic_2d/native_hgm/native_hgm.h @@ -46,13 +46,47 @@ extern "C" { * A new NativeHgm instance is created each time this function is called. * * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm - * @param name Indicates the hyper_graphic_manager connection name. - * @param length Indicates the name's length. + * @param screen Indicates screenId. + * @since 10 + * @version 1.0 + */ +void OH_NativeHgm_SetRefreshRateMode(int32_t mode); + +/** + * @brief Creates a NativeHgm instance.\n + * A new NativeHgm instance is created each time this function is called. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @param screen Indicates screenId. * @return Returns int32_t, return value == 0, success, otherwise, failed. * @since 10 * @version 1.0 */ -int OH_NativeHgm_GetScreenCurrentRefreshRate(int32_t screen); +int32_t OH_NativeHgm_GetScreenCurrentRefreshRate(int32_t screen); + +/** + * @brief Creates a NativeHgm instance.\n + * A new NativeHgm instance is created each time this function is called. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @return Returns int32_t, return value == 0, success, otherwise, failed. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeHgm_GetCurrentRefreshRateMode(); + +/** + * @brief Creates a NativeHgm instance.\n + * A new NativeHgm instance is created each time this function is called. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @param screen Indicates the hyper_graphic_manager connection name. + * @return Returns int32_t*. + * @since 10 + * @version 1.0 + */ +int32_t* OH_NativeHgm_GetScreenSupportedRefreshRates(int32_t screen); + #ifdef __cplusplus } #endif -- Gitee