From 7efb76e58bde7a96d6d380a5aca8bcbde85bc696 Mon Sep 17 00:00:00 2001 From: xuweinan Date: Thu, 9 Nov 2023 11:48:34 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Description:Hgm=E6=A8=A1=E5=9D=97=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E5=B8=A7=E7=8E=87=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20Feature=20or=20Bugfix:Feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuweinan --- zh-cn/native_sdk/graphic/native_hgm.h | 102 ++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 zh-cn/native_sdk/graphic/native_hgm.h diff --git a/zh-cn/native_sdk/graphic/native_hgm.h b/zh-cn/native_sdk/graphic/native_hgm.h new file mode 100644 index 00000000..fac139e0 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_hgm.h @@ -0,0 +1,102 @@ +/* + * 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 提供Hgm模块的一些接口. + * + * 该模块主要是提供获取帧率及模式的接口,主要使用场景为系统设置应用调用。 + * + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @since 10 + * @version 1.0 + */ + +/** + * @file native_hgm.h + * + * @brief 定义获取和使用NativeHgm的相关函数. + * + * @library libnative_hgm.so + * @since 10 + * @version 1.0 + */ +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 实现设置刷新率模式功能. + * + * 系统设置应用根据选择的刷新档位调用此接口,HGM会按照XML中的配置设置刷新率模式,并将这个数值做持久化 + * 重启之后,进入设置应用,上次选择的档位会被选中 + * + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @param mode 刷新率模式(-1,1,2,3 分别代表智能,标准,中,高). + * @since 10 + * @version 1.0 + */ +void OH_NativeHgm_SetRefreshRateMode(int32_t mode); + +/** + * @brief 实现获取屏幕当前刷新率功能. + * + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @param screen 屏幕id. + * @return 返回当前屏幕的刷新率(一般为60Hz,90Hz,120Hz). + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeHgm_GetScreenCurrentRefreshRate(int32_t screen); + +/** + * @brief 实现获取当前的刷新率模式功能. + * + * 此接口只会在出厂后用户尚未选择一个刷新率档位的时候调用,来决定默认配置的刷新率档位. + * 设置应用会根据接口返回的值来设置默认的刷新率档位. + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @return 返回当前的刷新率模式(-1,1,2,3 分别代表智能,标准,中,高). + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeHgm_GetCurrentRefreshRateMode(); + +/** + * @brief 实现获取屏幕支持的刷新率功能. + * + * 系统设置应用在进入显示子菜单时调用,根据接口返回的值确定给用户显示哪些刷新率模式的可选项. + + * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm + * @param screen 屏幕id. + * @return 返回屏幕支持的刷新率数组. + * @since 10 + * @version 1.0 + */ +int32_t* OH_NativeHgm_GetScreenSupportedRefreshRates(int32_t screen); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file -- Gitee From 70c03c79851c3a66b77b1b3a23ec47fa36ba6e89 Mon Sep 17 00:00:00 2001 From: xuweinan Date: Wed, 15 Nov 2023 15:58:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Description:Hgm=E6=A8=A1=E5=9D=97=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E5=B8=A7=E7=8E=87=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20Feature=20or=20Bugfix:Feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuweinan --- zh-cn/native_sdk/graphic/native_hgm.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_hgm.h b/zh-cn/native_sdk/graphic/native_hgm.h index fac139e0..86ea141d 100644 --- a/zh-cn/native_sdk/graphic/native_hgm.h +++ b/zh-cn/native_sdk/graphic/native_hgm.h @@ -22,9 +22,9 @@ * * @brief 提供Hgm模块的一些接口. * - * 该模块主要是提供获取帧率及模式的接口,主要使用场景为系统设置应用调用。 - * - * + * 该模块主要是提供获取帧率及模式的接口,主要使用场景为系统设置应用调用. + * + * * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm * @since 10 * @version 1.0 @@ -46,7 +46,7 @@ extern "C" { /** * @brief 实现设置刷新率模式功能. - * + * * 系统设置应用根据选择的刷新档位调用此接口,HGM会按照XML中的配置设置刷新率模式,并将这个数值做持久化 * 重启之后,进入设置应用,上次选择的档位会被选中 * @@ -80,13 +80,13 @@ int32_t OH_NativeHgm_GetScreenCurrentRefreshRate(int32_t screen); * @since 10 * @version 1.0 */ -int32_t OH_NativeHgm_GetCurrentRefreshRateMode(); +int32_t OH_NativeHgm_GetCurrentRefreshRateMode(void); /** * @brief 实现获取屏幕支持的刷新率功能. * * 系统设置应用在进入显示子菜单时调用,根据接口返回的值确定给用户显示哪些刷新率模式的可选项. - + * * @syscap SystemCapability.Graphic.Graphic2D.NativeHgm * @param screen 屏幕id. * @return 返回屏幕支持的刷新率数组. @@ -99,4 +99,5 @@ int32_t* OH_NativeHgm_GetScreenSupportedRefreshRates(int32_t screen); } #endif +/** @} */ #endif \ No newline at end of file -- Gitee From f402d732a4e7f2d10bec6663aa672f474b8742c6 Mon Sep 17 00:00:00 2001 From: xuweinan Date: Fri, 8 Dec 2023 10:30:49 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Description:XComponent=E6=96=B0=E5=A2=9ENDK?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=94=AF=E6=8C=81=E5=B8=A7=E7=8E=87?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=8E=E6=98=BE=E7=A4=BA=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20Feature=20or=20Bugfix:Feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuweinan --- .../ace/native_interface_xcomponent.h | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index 53ed97ad..cfe8914b 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -297,6 +297,21 @@ struct OH_NativeXComponent_KeyEvent; */ typedef struct OH_NativeXComponent_KeyEvent OH_NativeXComponent_KeyEvent; +/** + * @brief 定义期望帧率范围。 + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** 期望帧率范围最小值。 */ + int32_t min; + /** 期望帧率范围最大值。 */ + int32_t max; + /** 期望帧率 */ + int32_t expected; +} OH_NativeXComponent_ExpectedRateRange; + /** * @brief 获取ArkUI XComponent的id。 * @@ -528,6 +543,40 @@ int32_t OH_NativeXComponent_GetKeyEventDeviceId(OH_NativeXComponent_KeyEvent* ke */ int32_t OH_NativeXComponent_GetKeyEventTimeStamp(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* timeStamp); +/** + * @brief 设置期望帧率范围。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param range 表示指向期望帧率范围的指针 + * @return 返回执行的状态代码。 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_SetExpectedFrameRateRange( + OH_NativeXComponent* component, OH_NativeXComponent_ExpectedRateRange* range); + +/** + * @brief 为此OH_NativeXComponent实例注册显示更新回调。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param callback 指示指向显示更新回调的指针。 + * @return 返回执行的状态代码。 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterOnFrameCallback(OH_NativeXComponent* component, + void (*callback)(OH_NativeXComponent* component, uint64_t timestamp, uint64_t targetTimestamp)); + +/** + * @brief 为此OH_NativeXComponent实例取消注册回调函数。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @return 返回执行的状态代码。 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_UnRegisterOnFrameCallback(OH_NativeXComponent* component); + #ifdef __cplusplus }; #endif -- Gitee