• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef DVSYNC_PARAM_H
17 #define DVSYNC_PARAM_H
18 
19 #include "feature_param.h"
20 
21 namespace OHOS::Rosen {
22 class DVSyncParam : public FeatureParam {
23 public:
24     DVSyncParam() = default;
25     ~DVSyncParam() = default;
26 
27     static bool IsDVSyncEnable();
28     static bool IsUiDVSyncEnable();
29     static bool IsNativeDVSyncEnable();
30     static bool IsAdaptiveDVSyncEnable();
31     static uint32_t GetUiBufferCount();
32     static uint32_t GetRsBufferCount();
33     static uint32_t GetNativeBufferCount();
34     static uint32_t GetWebBufferCount();
35     static std::unordered_map<std::string, std::string> GetAdaptiveConfig();
36 
37 protected:
38     static void SetDVSyncEnable(bool isEnable);
39     static void SetUiDVSyncEnable(bool isEnable);
40     static void SetNativeDVSyncEnable(bool isEnable);
41     static void SetAdaptiveDVSyncEnable(bool isEnable);
42     static void SetRsBufferCount(int32_t cnt);
43     static void SetUiBufferCount(int32_t cnt);
44     static void SetNativeBufferCount(int32_t cnt);
45     static void SetWebBufferCount(int32_t cnt);
46     static void SetAdaptiveConfig(const std::string &name, const std::string &val);
47 
48 private:
49     inline static bool isRsDVSyncEnabled_ = false;
50     inline static bool isUiDVSyncEnabled_ = false;
51     inline static bool isNativeDVSyncEnabled_ = false;
52     inline static bool isAdaptiveDVSyncEnabled_ = false;
53     inline static uint32_t uiBufferCount_ = 3;
54     inline static uint32_t rsBufferCount_ = 1;
55     inline static uint32_t nativeBufferCount_ = 2;
56     inline static uint32_t webBufferCount_ = 1;
57     inline static std::unordered_map<std::string, std::string> adaptiveConfig_;
58 
59     friend class DVSyncParamParse;
60 };
61 } // namespace OHOS::Rosen
62 #endif // DVSYNC_PARAM_H