• 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     bool IsDVSyncEnable() const;
28     bool IsUiDVSyncEnable() const;
29     bool IsNativeDVSyncEnable() const;
30     bool IsAdaptiveDVSyncEnable() const;
31     uint32_t GetUiBufferCount() const;
32     uint32_t GetRsBufferCount() const;
33     uint32_t GetNativeBufferCount() const;
34     uint32_t GetWebBufferCount() const;
35     std::unordered_map<std::string, std::string> GetAdaptiveConfig() const;
36 
37 protected:
38     void SetDVSyncEnable(bool isEnable);
39     void SetUiDVSyncEnable(bool isEnable);
40     void SetNativeDVSyncEnable(bool isEnable);
41     void SetAdaptiveDVSyncEnable(bool isEnable);
42     void SetRsBufferCount(int32_t cnt);
43     void SetUiBufferCount(int32_t cnt);
44     void SetNativeBufferCount(int32_t cnt);
45     void SetWebBufferCount(int32_t cnt);
46     void SetAdaptiveConfig(const std::string &name, const std::string &val);
47 
48 private:
49     bool isRsDVSyncEnabled_ = false;
50     bool isUiDVSyncEnabled_ = false;
51     bool isNativeDVSyncEnabled_ = false;
52     bool isAdaptiveDVSyncEnabled_ = false;
53     uint32_t uiBufferCount_ = 3;
54     uint32_t rsBufferCount_ = 1;
55     uint32_t nativeBufferCount_ = 2;
56     uint32_t webBufferCount_ = 1;
57     std::unordered_map<std::string, std::string> adaptiveConfig_;
58 
59     friend class DVSyncParamParse;
60 };
61 } // namespace OHOS::Rosen
62 #endif // DVSYNC_PARAM_H