1 /*
2 * Copyright (c) 2021-2023 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 #include "platform/common/rs_system_properties.h"
17
18 #include <cstdlib>
19 #include <parameter.h>
20 #include <parameters.h>
21 #include "param/sys_param.h"
22 #include "platform/common/rs_log.h"
23 #include "transaction/rs_render_service_client.h"
24 #include "scene_board_judgement.h"
25 #include "pipeline/rs_uni_render_judgement.h"
26
27 namespace OHOS {
28 namespace Rosen {
29 namespace {
30 constexpr int DEFAULT_CACHE_WIDTH = 1250;
31 constexpr int DEFAULT_CACHE_HEIGHT = 2710;
32 constexpr int DEFAULT_PARTIAL_RENDER_ENABLED_VALUE = 2;
33 constexpr int DEFAULT_UNI_PARTIAL_RENDER_ENABLED_VALUE = 4;
34 constexpr int DEFAULT_CORRECTION_MODE_VALUE = 999;
35 constexpr int DEFAULT_SCALE_MODE = 2;
36 constexpr const char* DEFAULT_CLIP_RECT_THRESHOLD = "0.9";
37 }
38
39 #if (defined (ACE_ENABLE_GL) && defined (ACE_ENABLE_VK)) || (defined (RS_ENABLE_GL) && defined (RS_ENABLE_VK))
40 const GpuApiType RSSystemProperties::systemGpuApiType_ = Drawing::SystemProperties::GetGpuApiType();
41 #elif defined (ACE_ENABLE_GL) || defined (RS_ENABLE_GL)
42 const GpuApiType RSSystemProperties::systemGpuApiType_ = GpuApiType::OPENGL;
43 #else
44 const GpuApiType RSSystemProperties::systemGpuApiType_ = GpuApiType::VULKAN;
45 #endif
46
ConvertToInt(const char * originValue,int defaultValue)47 int ConvertToInt(const char *originValue, int defaultValue)
48 {
49 return originValue == nullptr ? defaultValue : std::atoi(originValue);
50 }
ParseDfxSurfaceNamesString(const std::string & paramsStr,std::vector<std::string> & splitStrs,const std::string & seperator)51 static void ParseDfxSurfaceNamesString(const std::string& paramsStr,
52 std::vector<std::string>& splitStrs, const std::string& seperator)
53 {
54 std::string::size_type pos1 = 0;
55 std::string::size_type pos2 = paramsStr.find(seperator);
56 if (std::string::npos == pos2) {
57 splitStrs.push_back(paramsStr);
58 return;
59 }
60 while (std::string::npos != pos2) {
61 splitStrs.push_back(paramsStr.substr(pos1, pos2 - pos1));
62 pos1 = pos2 + seperator.size();
63 pos2 = paramsStr.find(seperator, pos1);
64 }
65 if (pos1 != paramsStr.length()) {
66 splitStrs.push_back(paramsStr.substr(pos1));
67 }
68 }
69
IsSceneBoardEnabled()70 bool RSSystemProperties::IsSceneBoardEnabled()
71 {
72 static bool isSCBEnabled = SceneBoardJudgement::IsSceneBoardEnabled();
73 return isSCBEnabled;
74 }
75
76 // used by clients
GetDumpFrameNum()77 int RSSystemProperties::GetDumpFrameNum()
78 {
79 static CachedHandle g_Handle = CachedParameterCreate("rosen.recording.frameNum", "0");
80 int changed = 0;
81 const char *num = CachedParameterGetChanged(g_Handle, &changed);
82 return ConvertToInt(num, 0);
83 }
84
GetRecordingEnabled()85 int RSSystemProperties::GetRecordingEnabled()
86 {
87 static CachedHandle g_Handle = CachedParameterCreate("debug.graphic.recording.enabled", "0");
88 int changed = 0;
89 const char *num = CachedParameterGetChanged(g_Handle, &changed);
90 return ConvertToInt(num, 0);
91 }
92
93
SetRecordingDisenabled()94 void RSSystemProperties::SetRecordingDisenabled()
95 {
96 system::SetParameter("debug.graphic.recording.enabled", "0");
97 RS_LOGD("RSSystemProperties::SetRecordingDisenabled");
98 }
99
GetProfilerEnabled()100 bool RSSystemProperties::GetProfilerEnabled()
101 {
102 static CachedHandle handle = CachedParameterCreate("persist.graphic.profiler.enabled", "0");
103 int32_t changed = 0;
104 return ConvertToInt(CachedParameterGetChanged(handle, &changed), 0) != 0;
105 }
106
GetVkQueueDividedEnable()107 bool RSSystemProperties::GetVkQueueDividedEnable()
108 {
109 static CachedHandle g_Handle = CachedParameterCreate("persist.sys.graphic.q.divided.enalbed", "0");
110 int changed = 0;
111 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
112 return ConvertToInt(enable, 0) != 0;
113 }
114
GetInstantRecording()115 bool RSSystemProperties::GetInstantRecording()
116 {
117 return (system::GetParameter("debug.graphic.instant.recording.enabled", "0") != "0");
118 }
119
SetInstantRecording(bool flag)120 void RSSystemProperties::SetInstantRecording(bool flag)
121 {
122 system::SetParameter("debug.graphic.instant.recording.enabled", flag ? "1" : "0");
123 }
124
GetBetaRecordingMode()125 uint32_t RSSystemProperties::GetBetaRecordingMode()
126 {
127 static CachedHandle handle = CachedParameterCreate("persist.graphic.profiler.betarecording", "0");
128 int32_t changed = 0;
129 const char* state = CachedParameterGetChanged(handle, &changed);
130 return ConvertToInt(state, 0);
131 }
132
SetBetaRecordingMode(uint32_t param)133 void RSSystemProperties::SetBetaRecordingMode(uint32_t param)
134 {
135 system::SetParameter("persist.graphic.profiler.betarecording", std::to_string(param));
136 }
137
GetSaveRDC()138 bool RSSystemProperties::GetSaveRDC()
139 {
140 return (system::GetParameter("debug.graphic.rdcenabled", "0") != "0");
141 }
142
SetSaveRDC(bool flag)143 void RSSystemProperties::SetSaveRDC(bool flag)
144 {
145 system::SetParameter("debug.graphic.rdcenabled", flag ? "1" : "0");
146 }
147
GetRecordingFile()148 std::string RSSystemProperties::GetRecordingFile()
149 {
150 static CachedHandle g_Handle = CachedParameterCreate("rosen.dumpfile.path", "");
151 int changed = 0;
152 const char *file = CachedParameterGetChanged(g_Handle, &changed);
153 return file == nullptr ? "" : file;
154 }
155
GetUniRenderEnabled()156 bool RSSystemProperties::GetUniRenderEnabled()
157 {
158 static bool inited = false;
159 if (inited) {
160 return isUniRenderEnabled_;
161 }
162
163 isUniRenderEnabled_ = std::static_pointer_cast<RSRenderServiceClient>(RSIRenderClient::CreateRenderServiceClient())
164 ->GetUniRenderEnabled();
165 inited = true;
166 ROSEN_LOGD("RSSystemProperties::GetUniRenderEnabled:%{public}d", isUniRenderEnabled_);
167 return isUniRenderEnabled_;
168 }
169
GetDrawOpTraceEnabled()170 bool RSSystemProperties::GetDrawOpTraceEnabled()
171 {
172 static bool code = system::GetParameter("persist.rosen.drawoptrace.enabled", "0") != "0";
173 return code;
174 }
175
GetRenderNodeTraceEnabled()176 bool RSSystemProperties::GetRenderNodeTraceEnabled()
177 {
178 static bool isNeedTrace = system::GetParameter("persist.rosen.rendernodetrace.enabled", "0") != "0";
179 return isNeedTrace;
180 }
181
GetAnimationTraceEnabled()182 bool RSSystemProperties::GetAnimationTraceEnabled()
183 {
184 static bool isNeedTrace = system::GetParameter("persist.rosen.animationtrace.enabled", "0") != "0";
185 return isNeedTrace;
186 }
187
GetRSScreenRoundCornerEnable()188 bool RSSystemProperties::GetRSScreenRoundCornerEnable()
189 {
190 static bool isNeedScreenRCD = system::GetParameter("persist.rosen.screenroundcornerrcd.enabled", "1") != "0";
191 return isNeedScreenRCD;
192 }
193
GetRenderNodePurgeEnabled()194 bool RSSystemProperties::GetRenderNodePurgeEnabled()
195 {
196 static bool isPurgeable = system::GetParameter("persist.rosen.rendernode.purge.enabled", "1") != "0";
197 return isPurgeable;
198 }
199
GetRSImagePurgeEnabled()200 bool RSSystemProperties::GetRSImagePurgeEnabled()
201 {
202 static bool isPurgeable = system::GetParameter("persist.rosen.rsimage.purge.enabled", "0") != "0";
203 return isPurgeable;
204 }
205
GetDirtyRegionDebugType()206 DirtyRegionDebugType RSSystemProperties::GetDirtyRegionDebugType()
207 {
208 static CachedHandle g_Handle = CachedParameterCreate("rosen.dirtyregiondebug.enabled", "0");
209 int changed = 0;
210 const char *type = CachedParameterGetChanged(g_Handle, &changed);
211 return static_cast<DirtyRegionDebugType>(ConvertToInt(type, 0));
212 }
213
GetPartialRenderEnabled()214 PartialRenderType RSSystemProperties::GetPartialRenderEnabled()
215 {
216 static CachedHandle g_Handle = CachedParameterCreate("rosen.partialrender.enabled", "2");
217 int changed = 0;
218 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
219 return static_cast<PartialRenderType>(ConvertToInt(enable, DEFAULT_PARTIAL_RENDER_ENABLED_VALUE));
220 }
221
GetUniPartialRenderEnabled()222 PartialRenderType RSSystemProperties::GetUniPartialRenderEnabled()
223 {
224 int changed = 0;
225 static CachedHandle g_Handle = CachedParameterCreate("rosen.uni.partialrender.enabled", "4");
226 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
227 return static_cast<PartialRenderType>(ConvertToInt(enable, DEFAULT_UNI_PARTIAL_RENDER_ENABLED_VALUE));
228 }
229
GetClipRectThreshold()230 float RSSystemProperties::GetClipRectThreshold()
231 {
232 int changed = 0;
233 static CachedHandle g_Handle = CachedParameterCreate("rosen.uni.cliprect.threshold", DEFAULT_CLIP_RECT_THRESHOLD);
234 const char *threshold = CachedParameterGetChanged(g_Handle, &changed);
235 return threshold == nullptr ? std::atof(DEFAULT_CLIP_RECT_THRESHOLD) : std::atof(threshold);
236 }
237
GetAllSurfaceVisibleDebugEnabled()238 bool RSSystemProperties::GetAllSurfaceVisibleDebugEnabled()
239 {
240 static CachedHandle g_Handle = CachedParameterCreate("rosen.uni.allsurfacevisibledebug.enabled", "0");
241 int changed = 0;
242 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
243 return ConvertToInt(enable, 0) != 0;
244 }
245
GetVirtualDirtyDebugEnabled()246 bool RSSystemProperties::GetVirtualDirtyDebugEnabled()
247 {
248 static CachedHandle g_Handle = CachedParameterCreate("rosen.uni.virtualdirtydebug.enabled", "0");
249 int changed = 0;
250 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
251 return ConvertToInt(enable, 0) != 0;
252 }
253
GetVirtualDirtyEnabled()254 bool RSSystemProperties::GetVirtualDirtyEnabled()
255 {
256 static CachedHandle g_Handle = CachedParameterCreate("rosen.uni.virtualdirty.enabled", "1");
257 int changed = 0;
258 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
259 return ConvertToInt(enable, 0) != 0;
260 }
261
GetExpandScreenDirtyEnabled()262 bool RSSystemProperties::GetExpandScreenDirtyEnabled()
263 {
264 static CachedHandle g_Handle = CachedParameterCreate("rosen.uni.expandscreendirty.enabled", "0");
265 int changed = 0;
266 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
267 return ConvertToInt(enable, 0) != 0;
268 }
269
GetReleaseResourceEnabled()270 bool RSSystemProperties::GetReleaseResourceEnabled()
271 {
272 static CachedHandle g_Handle = CachedParameterCreate("persist.release.gpuresource.enabled", "1");
273 int changed = 0;
274 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
275 return ConvertToInt(enable, 1) != 0;
276 }
277
GetOcclusionEnabled()278 bool RSSystemProperties::GetOcclusionEnabled()
279 {
280 static CachedHandle g_Handle = CachedParameterCreate("rosen.occlusion.enabled", "1");
281 int changed = 0;
282 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
283 return ConvertToInt(enable, 1) != 0;
284 }
285
GetAceDebugBoundaryEnabled()286 bool RSSystemProperties::GetAceDebugBoundaryEnabled()
287 {
288 static CachedHandle g_Handle = CachedParameterCreate("persist.ace.debug.boundary.enabled", "false");
289 int changed = 0;
290 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
291 if (enable) {
292 return (strcmp(enable, "true") == 0);
293 }
294 return false;
295 }
296
GetHardwareComposerEnabled()297 bool RSSystemProperties::GetHardwareComposerEnabled()
298 {
299 static bool hardwareComposerEnabled = system::GetParameter(
300 "persist.rosen.hardwarecomposer.enabled", "1") != "0";
301 return hardwareComposerEnabled;
302 }
303
GetHardwareComposerEnabledForMirrorMode()304 bool RSSystemProperties::GetHardwareComposerEnabledForMirrorMode()
305 {
306 static bool hardwareComposerMirrorEnabled =
307 system::GetParameter("persist.rosen.hardwarecomposer.mirror.enabled", "1") != "0";
308 return hardwareComposerMirrorEnabled;
309 }
310
GetHwcRegionDfxEnabled()311 bool RSSystemProperties::GetHwcRegionDfxEnabled()
312 {
313 static bool hwcRegionDfxEnabled = system::GetParameter(
314 "persist.rosen.hwcRegionDfx.enabled", "0") != "0";
315 return hwcRegionDfxEnabled;
316 }
317
GetPixelmapDfxEnabled()318 bool RSSystemProperties::GetPixelmapDfxEnabled()
319 {
320 static CachedHandle g_Handle = CachedParameterCreate("rosen.pixelmapdfx.enabled", "0");
321 int changed = 0;
322 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
323 return ConvertToInt(enable, 0) != 0;
324 }
325
GetAFBCEnabled()326 bool RSSystemProperties::GetAFBCEnabled()
327 {
328 static CachedHandle g_Handle = CachedParameterCreate("rosen.afbc.enabled", "1");
329 int changed = 0;
330 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
331 return ConvertToInt(enable, 1) != 0;
332 }
333
GetRSEventProperty(const std::string & paraName)334 std::string RSSystemProperties::GetRSEventProperty(const std::string ¶Name)
335 {
336 return system::GetParameter(paraName, "0");
337 }
338
GetDirectClientCompEnableStatus()339 bool RSSystemProperties::GetDirectClientCompEnableStatus()
340 {
341 // If the value of rosen.directClientComposition.enabled is not 0 then enable the direct CLIENT composition.
342 // Direct CLIENT composition will be processed only when the num of layer is larger than 11
343 static CachedHandle g_Handle = CachedParameterCreate("rosen.directClientComposition.enabled", "1");
344 int changed = 0;
345 const char *status = CachedParameterGetChanged(g_Handle, &changed);
346 return ConvertToInt(status, 1) != 0;
347 }
348
GetHighContrastStatus()349 bool RSSystemProperties::GetHighContrastStatus()
350 {
351 // If the value of rosen.directClientComposition.enabled is not 0 then enable the direct CLIENT composition.
352 // Direct CLIENT composition will be processed only when the num of layer is larger than 11
353 static CachedHandle g_Handle = CachedParameterCreate("rosen.HighContrast.enabled", "0");
354 int changed = 0;
355 const char *status = CachedParameterGetChanged(g_Handle, &changed);
356 return ConvertToInt(status, 0) != 0;
357 }
358
GetDrmEnabled()359 bool RSSystemProperties::GetDrmEnabled()
360 {
361 static CachedHandle g_Handle = CachedParameterCreate("rosen.drm.enabled", "1");
362 int changed = 0;
363 const char *enabled = CachedParameterGetChanged(g_Handle, &changed);
364 return ConvertToInt(enabled, 0) != 0;
365 }
366
GetTargetDirtyRegionDfxEnabled(std::vector<std::string> & dfxTargetSurfaceNames_)367 bool RSSystemProperties::GetTargetDirtyRegionDfxEnabled(std::vector<std::string>& dfxTargetSurfaceNames_)
368 {
369 static CachedHandle g_Handle = CachedParameterCreate("rosen.dirtyregiondebug.surfacenames", "0");
370 int changed = 0;
371 const char *targetSurfacesStr = CachedParameterGetChanged(g_Handle, &changed);
372 if (targetSurfacesStr == nullptr || strcmp(targetSurfacesStr, "0") == 0) {
373 dfxTargetSurfaceNames_.clear();
374 return false;
375 }
376 dfxTargetSurfaceNames_.clear();
377 ParseDfxSurfaceNamesString(targetSurfacesStr, dfxTargetSurfaceNames_, ",");
378 return true;
379 }
380
GetOpaqueRegionDfxEnabled()381 bool RSSystemProperties::GetOpaqueRegionDfxEnabled()
382 {
383 static CachedHandle g_Handle = CachedParameterCreate("rosen.uni.opaqueregiondebug", "0");
384 int changed = 0;
385 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
386 return ConvertToInt(enable, 0) != 0;
387 }
388
GetVisibleRegionDfxEnabled()389 bool RSSystemProperties::GetVisibleRegionDfxEnabled()
390 {
391 static CachedHandle g_Handle = CachedParameterCreate("rosen.uni.visibleregiondebug", "0");
392 int changed = 0;
393 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
394 return ConvertToInt(enable, 0) != 0;
395 }
396
GetSurfaceRegionDfxType()397 SurfaceRegionDebugType RSSystemProperties::GetSurfaceRegionDfxType()
398 {
399 static CachedHandle g_Handle = CachedParameterCreate("rosen.uni.surfaceregiondebug", "0");
400 int changed = 0;
401 const char *type = CachedParameterGetChanged(g_Handle, &changed);
402 return static_cast<SurfaceRegionDebugType>(ConvertToInt(type, 0));
403 }
404
GetCorrectionMode()405 uint32_t RSSystemProperties::GetCorrectionMode()
406 {
407 // If the value of rosen.directClientComposition.enabled is not 0 then enable the direct CLIENT composition.
408 // Direct CLIENT composition will be processed only when the num of layer is larger than 11
409 static CachedHandle g_Handle = CachedParameterCreate("rosen.CorrectionMode", "999");
410 int changed = 0;
411 const char *mode = CachedParameterGetChanged(g_Handle, &changed);
412 return ConvertToInt(mode, DEFAULT_CORRECTION_MODE_VALUE);
413 }
414
GetDumpSurfaceType()415 DumpSurfaceType RSSystemProperties::GetDumpSurfaceType()
416 {
417 static CachedHandle g_Handle = CachedParameterCreate("rosen.dumpsurfacetype.enabled", "0");
418 int changed = 0;
419 const char *type = CachedParameterGetChanged(g_Handle, &changed);
420 return static_cast<DumpSurfaceType>(ConvertToInt(type, 0));
421 }
422
GetDumpSurfaceId()423 long long int RSSystemProperties::GetDumpSurfaceId()
424 {
425 static CachedHandle g_Handle = CachedParameterCreate("rosen.dumpsurfaceid", "0");
426 int changed = 0;
427 const char *surfaceId = CachedParameterGetChanged(g_Handle, &changed);
428 return surfaceId == nullptr ? std::atoll("0") : std::atoll(surfaceId);
429 }
430
GetDumpLayersEnabled()431 bool RSSystemProperties::GetDumpLayersEnabled()
432 {
433 static CachedHandle g_Handle = CachedParameterCreate("rosen.dumplayer.enabled", "0");
434 int changed = 0;
435 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
436 return ConvertToInt(enable, 0) != 0;
437 }
438
SetDrawTextAsBitmap(bool flag)439 void RSSystemProperties::SetDrawTextAsBitmap(bool flag)
440 {
441 isDrawTextAsBitmap_ = flag;
442 }
GetDrawTextAsBitmap()443 bool RSSystemProperties::GetDrawTextAsBitmap()
444 {
445 return isDrawTextAsBitmap_;
446 }
447
SetCacheEnabledForRotation(bool flag)448 void RSSystemProperties::SetCacheEnabledForRotation(bool flag)
449 {
450 cacheEnabledForRotation_ = flag;
451 }
452
GetCacheEnabledForRotation()453 bool RSSystemProperties::GetCacheEnabledForRotation()
454 {
455 return cacheEnabledForRotation_;
456 }
457
SetDefaultDeviceRotationOffset(uint32_t offset)458 void RSSystemProperties::SetDefaultDeviceRotationOffset(uint32_t offset)
459 {
460 defaultDeviceRotationOffset_ = offset;
461 }
462
GetDefaultDeviceRotationOffset()463 uint32_t RSSystemProperties::GetDefaultDeviceRotationOffset()
464 {
465 return defaultDeviceRotationOffset_;
466 }
467
GetPrepareParallelRenderingEnabled()468 ParallelRenderingType RSSystemProperties::GetPrepareParallelRenderingEnabled()
469 {
470 static ParallelRenderingType systemPropertiePrepareType = static_cast<ParallelRenderingType>(
471 std::atoi((system::GetParameter("persist.rosen.prepareparallelrender.enabled", "1")).c_str()));
472 return systemPropertiePrepareType;
473 }
474
GetParallelRenderingEnabled()475 ParallelRenderingType RSSystemProperties::GetParallelRenderingEnabled()
476 {
477 static ParallelRenderingType systemPropertieType = static_cast<ParallelRenderingType>(
478 std::atoi((system::GetParameter("persist.rosen.parallelrender.enabled", "0")).c_str()));
479 return systemPropertieType;
480 }
481
GetHgmRefreshRatesEnabled()482 HgmRefreshRates RSSystemProperties::GetHgmRefreshRatesEnabled()
483 {
484 static CachedHandle g_Handle = CachedParameterCreate("rosen.sethgmrefreshrate.enabled", "0");
485 int changed = 0;
486 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
487 return static_cast<HgmRefreshRates>(ConvertToInt(enable, 0));
488 }
489
SetHgmRefreshRateModesEnabled(std::string param)490 void RSSystemProperties::SetHgmRefreshRateModesEnabled(std::string param)
491 {
492 system::SetParameter("persist.rosen.sethgmrefreshratemode.enabled", param);
493 RS_LOGI("RSSystemProperties::SetHgmRefreshRateModesEnabled set to %{public}s", param.c_str());
494 }
495
GetHgmRefreshRateModesEnabled()496 HgmRefreshRateModes RSSystemProperties::GetHgmRefreshRateModesEnabled()
497 {
498 static CachedHandle g_Handle = CachedParameterCreate("persist.rosen.sethgmrefreshratemode.enabled", "0");
499 int changed = 0;
500 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
501 return static_cast<HgmRefreshRateModes>(ConvertToInt(enable, 0));
502 }
503
GetSkipForAlphaZeroEnabled()504 bool RSSystemProperties::GetSkipForAlphaZeroEnabled()
505 {
506 static CachedHandle g_Handle = CachedParameterCreate("persist.skipForAlphaZero.enabled", "1");
507 int changed = 0;
508 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
509 return ConvertToInt(enable, 1) != 0;
510 }
511
GetSkipGeometryNotChangeEnabled()512 bool RSSystemProperties::GetSkipGeometryNotChangeEnabled()
513 {
514 static bool skipGeoNotChangeEnabled =
515 std::atoi((system::GetParameter("persist.skipGeometryNotChange.enabled", "1")).c_str()) != 0;
516 return skipGeoNotChangeEnabled;
517 }
518
GetAnimationCacheEnabled()519 bool RSSystemProperties::GetAnimationCacheEnabled()
520 {
521 static bool animationCacheEnabled =
522 std::atoi((system::GetParameter("persist.animation.cache.enabled", "0")).c_str()) != 0;
523 return animationCacheEnabled;
524 }
525
GetAnimationScale()526 float RSSystemProperties::GetAnimationScale()
527 {
528 static CachedHandle g_Handle = CachedParameterCreate("persist.sys.graphic.animationscale", "1.0");
529 int changed = 0;
530 const char *scale = CachedParameterGetChanged(g_Handle, &changed);
531 return scale == nullptr ? std::atof("1.0") : std::atof(scale);
532 }
533
GetFilterCacheEnabled()534 bool RSSystemProperties::GetFilterCacheEnabled()
535 {
536 // Determine whether the filter cache should be enabled. The default value is 1, which means that it is enabled.
537 // If dirty-region is not properly implemented, the filter cache will act as a skip-frame strategy for filters.
538 static bool filterCacheEnabled =
539 std::atoi((system::GetParameter("persist.sys.graphic.filterCacheEnabled", "1")).c_str()) != 0;
540 return filterCacheEnabled;
541 }
542
GetFilterCacheUpdateInterval()543 int RSSystemProperties::GetFilterCacheUpdateInterval()
544 {
545 // Configure whether to enable skip-frame for the filter cache. The default value is 1, which means that the cached
546 // image is updated with a delay of 1 frame.
547 static int filterCacheUpdateInterval =
548 std::atoi((system::GetParameter("persist.sys.graphic.filterCacheUpdateInterval", "1")).c_str());
549 return filterCacheUpdateInterval;
550 }
551
GetFilterCacheSizeThreshold()552 int RSSystemProperties::GetFilterCacheSizeThreshold()
553 {
554 // Set the minimum size for enabling skip-frame in the filter cache. By default, this value is 400, which means that
555 // skip-frame is only enabled for regions where both the width and height are greater than 400.
556 static int filterCacheSizeThreshold =
557 std::atoi((system::GetParameter("persist.sys.graphic.filterCacheSizeThreshold", "400")).c_str());
558 return filterCacheSizeThreshold;
559 }
560
GetMaskLinearBlurEnabled()561 bool RSSystemProperties::GetMaskLinearBlurEnabled()
562 {
563 // Determine whether the mask LinearBlur render should be enabled. The default value is 0,
564 // which means that it is unenabled.
565 static bool enabled =
566 std::atoi((system::GetParameter("persist.sys.graphic.maskLinearBlurEnabled", "1")).c_str()) != 0;
567 return enabled;
568 }
569
GetMotionBlurEnabled()570 bool RSSystemProperties::GetMotionBlurEnabled()
571 {
572 // Determine whether the motionBlur render should be enabled. The default value is 0,
573 // which means that it is unenabled.
574 static bool enabled =
575 std::atoi((system::GetParameter("persist.sys.graphic.motionBlurEnabled", "1")).c_str()) != 0;
576 return enabled;
577 }
578
GetDynamicBrightnessEnabled()579 bool RSSystemProperties::GetDynamicBrightnessEnabled()
580 {
581 // Determine whether the daynamic brightness render should be enabled. The default value is 1,
582 // which means that it is enabled.
583 static bool enabled =
584 std::atoi((system::GetParameter("persist.sys.graphic.dynamicBrightnessEnabled", "1")).c_str()) != 0;
585 return enabled;
586 }
587
GetMagnifierEnabled()588 bool RSSystemProperties::GetMagnifierEnabled()
589 {
590 // Determine whether the magnifier render should be enabled. The default value is 0,
591 // which means that it is unenabled.
592 static bool enabled =
593 std::atoi((system::GetParameter("persist.sys.graphic.magnifierEnabled", "1")).c_str()) != 0;
594 return enabled;
595 }
596
GetKawaseEnabled()597 bool RSSystemProperties::GetKawaseEnabled()
598 {
599 static bool kawaseBlurEnabled =
600 std::atoi((system::GetParameter("persist.sys.graphic.kawaseEnable", "1")).c_str()) != 0;
601 return kawaseBlurEnabled;
602 }
603
SetForceHpsBlurDisabled(bool flag)604 void RSSystemProperties::SetForceHpsBlurDisabled(bool flag)
605 {
606 forceHpsBlurDisabled_ = flag;
607 }
608
GetHpsBlurEnabled()609 bool RSSystemProperties::GetHpsBlurEnabled()
610 {
611 static bool hpsBlurEnabled =
612 std::atoi((system::GetParameter("persist.sys.graphic.HpsBlurEnable", "1")).c_str()) != 0;
613 return hpsBlurEnabled && !forceHpsBlurDisabled_;
614 }
615
GetMESABlurFuzedEnabled()616 bool RSSystemProperties::GetMESABlurFuzedEnabled()
617 {
618 static bool blurPixelStretchEnabled =
619 std::atoi((system::GetParameter("persist.sys.graphic.mesaBlurFuzedEnable", "1")).c_str()) != 0;
620 return blurPixelStretchEnabled;
621 }
622
GetKawaseRandomColorFactor()623 float RSSystemProperties::GetKawaseRandomColorFactor()
624 {
625 static float randomFactor =
626 std::atof((system::GetParameter("persist.sys.graphic.kawaseFactor", "1.75")).c_str());
627 return randomFactor;
628 }
629
GetRandomColorEnabled()630 bool RSSystemProperties::GetRandomColorEnabled()
631 {
632 static bool randomColorEnabled =
633 std::atoi((system::GetParameter("persist.sys.graphic.randomColorEnable", "1")).c_str()) != 0;
634 return randomColorEnabled;
635 }
636
GetKawaseOriginalEnabled()637 bool RSSystemProperties::GetKawaseOriginalEnabled()
638 {
639 static bool kawaseOriginalEnabled =
640 std::atoi((system::GetParameter("persist.sys.graphic.kawaseOriginalEnable", "0")).c_str()) != 0;
641 return kawaseOriginalEnabled;
642 }
643
644 // this will migrate to rs_system_parameters.cpp
GetQuickPrepareEnabled()645 bool RSSystemProperties::GetQuickPrepareEnabled()
646 {
647 static bool quickPrepareEnabled =
648 std::atoi((system::GetParameter("persist.sys.graphic.quickPrepareEnabled", "1")).c_str()) != 0;
649 return quickPrepareEnabled;
650 }
651
GetRenderParallelEnabled()652 bool RSSystemProperties::GetRenderParallelEnabled()
653 {
654 static bool enable =
655 std::atoi((system::GetParameter("persist.sys.graphic.renderParallel", "1")).c_str()) != 0;
656 return enable;
657 }
658
GetBlurEnabled()659 bool RSSystemProperties::GetBlurEnabled()
660 {
661 static bool blurEnabled =
662 std::atoi((system::GetParameter("persist.sys.graphic.blurEnabled", "1")).c_str()) != 0;
663 return blurEnabled;
664 }
665
GetForegroundFilterEnabled()666 bool RSSystemProperties::GetForegroundFilterEnabled()
667 {
668 static bool foregroundFilterEnabled =
669 std::atoi((system::GetParameter("persist.sys.graphic.foregroundFilterEnabled", "1")).c_str()) != 0;
670 return foregroundFilterEnabled;
671 }
672
GetAiInvertCoef()673 const std::vector<float>& RSSystemProperties::GetAiInvertCoef()
674 {
675 // Configure AiInvertCoef: Low, High, Threshold, Opacity, Saturation, Filter Radius.
676 static std::vector<float> aiInvertCoef = {0.0, 1.0, 0.55, 0.4, 1.6, 45.0};
677 static bool initialized = false;
678 if (!initialized) {
679 initialized = true;
680 // Configure AiInvertCoef0: Low
681 aiInvertCoef[0] =
682 std::atof((system::GetParameter("persist.sys.graphic.aiInvertLow", "0.5")).c_str());
683 // Configure AiInvertCoef1: High.
684 aiInvertCoef[1] =
685 std::atof((system::GetParameter("persist.sys.graphic.aiInvertHigh", "0.7")).c_str());
686 // Configure AiInvertCoef2: Threshold.
687 aiInvertCoef[2] =
688 std::atof((system::GetParameter("persist.sys.graphic.aiInvertThreshold", "0.5")).c_str());
689 // Configure AiInvertCoef3: Opacity.
690 aiInvertCoef[3] =
691 std::atof((system::GetParameter("persist.sys.graphic.aiInvertOpacity", "0.2")).c_str());
692 // Configure AiInvertCoef4: Saturation.
693 aiInvertCoef[4] =
694 std::atof((system::GetParameter("persist.sys.graphic.aiInvertSaturation", "1.0")).c_str());
695 // Configure AiInvertCoef5: Filter Radius.
696 aiInvertCoef[5] =
697 std::atof((system::GetParameter("persist.sys.graphic.aiInvertFilterRadius", "300")).c_str());
698 }
699 return aiInvertCoef;
700 }
701
GetProxyNodeDebugEnabled()702 bool RSSystemProperties::GetProxyNodeDebugEnabled()
703 {
704 static bool proxyNodeDebugEnabled = system::GetParameter("persist.sys.graphic.proxyNodeDebugEnabled", "0") != "0";
705 return proxyNodeDebugEnabled;
706 }
707
GetUIFirstEnabled()708 bool RSSystemProperties::GetUIFirstEnabled()
709 {
710 #ifdef ROSEN_EMULATOR
711 return false;
712 #else
713 static CachedHandle g_Handle = CachedParameterCreate("rosen.ui.first.enabled", "1");
714 int changed = 0;
715 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
716 return ConvertToInt(enable, 1) != 0;
717 #endif
718 }
719
GetSurfaceOffscreenEnadbled()720 bool RSSystemProperties::GetSurfaceOffscreenEnadbled()
721 {
722 static CachedHandle g_Handle = CachedParameterCreate("persist.sys.graphic.surfaceOffscreenEnabled", "1");
723 int changed = 0;
724 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
725 return ConvertToInt(enable, 1) != 0;
726 }
727
GetUIFirstDebugEnabled()728 bool RSSystemProperties::GetUIFirstDebugEnabled()
729 {
730 static bool debugEnable = system::GetIntParameter("persist.sys.graphic.uifirstDebugEnabled", 0) != 0;
731 return debugEnable;
732 }
733
GetDebugTraceEnabled()734 bool RSSystemProperties::GetDebugTraceEnabled()
735 {
736 static bool openDebugTrace = system::GetIntParameter("persist.sys.graphic.openDebugTrace", 0) != 0;
737 return openDebugTrace;
738 }
739
GetImageReleaseUsingPostTask()740 bool RSSystemProperties::GetImageReleaseUsingPostTask()
741 {
742 static bool flag =
743 std::atoi((system::GetParameter("persist.sys.graphic.iamgeReleasePostTask", "0")).c_str()) != 0;
744 return flag;
745 }
746
GetDebugTraceLevel()747 int RSSystemProperties::GetDebugTraceLevel()
748 {
749 static int openDebugTraceLevel =
750 std::atoi((system::GetParameter("persist.sys.graphic.openDebugTrace", "0")).c_str());
751 return openDebugTraceLevel;
752 }
753
GetDumpImgEnabled()754 bool RSSystemProperties::GetDumpImgEnabled()
755 {
756 static bool dumpImgEnabled =
757 std::atoi((system::GetParameter("persist.sys.graphic.dumpImgEnabled", "0")).c_str()) != 0;
758 return dumpImgEnabled;
759 }
760
GetTransactionTerminateEnabled()761 bool RSSystemProperties::GetTransactionTerminateEnabled()
762 {
763 static bool terminateEnabled =
764 std::atoi((system::GetParameter("persist.sys.graphic.transactionTerminateEnabled", "0")).c_str()) != 0;
765 return terminateEnabled;
766 }
767
FindNodeInTargetList(std::string node)768 bool RSSystemProperties::FindNodeInTargetList(std::string node)
769 {
770 static std::string targetStr = system::GetParameter("persist.sys.graphic.traceTargetList", "");
771 static auto strSize = targetStr.size();
772 if (strSize == 0) {
773 return false;
774 }
775 static std::vector<std::string> targetVec;
776 static bool loaded = false;
777 if (!loaded) {
778 const std::string pattern = ";";
779 targetStr += pattern;
780 strSize = targetStr.size();
781 std::string::size_type pos;
782 for (std::string::size_type i = 0; i < strSize; i++) {
783 pos = targetStr.find(pattern, i);
784 if (pos >= strSize) {
785 break;
786 }
787 auto str = targetStr.substr(i, pos - i);
788 if (str.size() > 0) {
789 targetVec.emplace_back(str);
790 }
791 i = pos;
792 }
793 loaded = true;
794 }
795 bool res = std::find(targetVec.begin(), targetVec.end(), node) != targetVec.end();
796 return res;
797 }
798
IsFoldScreenFlag()799 bool RSSystemProperties::IsFoldScreenFlag()
800 {
801 static bool isFoldScreenFlag = system::GetParameter("const.window.foldscreen.type", "") != "";
802 return isFoldScreenFlag;
803 }
804
GetCacheCmdEnabled()805 bool RSSystemProperties::GetCacheCmdEnabled()
806 {
807 static CachedHandle g_Handle = CachedParameterCreate("rosen.cacheCmd.enabled", "1");
808 int changed = 0;
809 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
810 return ConvertToInt(enable, 1) != 0;
811 }
812
GetASTCEnabled()813 bool RSSystemProperties::GetASTCEnabled()
814 {
815 static bool isASTCEnabled = std::atoi((system::GetParameter("persist.rosen.astc.enabled", "0")).c_str()) != 0;
816 return isASTCEnabled;
817 }
818
819 // GetCachedBlurPartialRenderEnabled Option On: no need to expand blur dirtyregion if blur has background cache
GetCachedBlurPartialRenderEnabled()820 bool RSSystemProperties::GetCachedBlurPartialRenderEnabled()
821 {
822 static CachedHandle g_Handle = CachedParameterCreate("rosen.cachedblurpartialrender.enabled", "0");
823 int changed = 0;
824 const char *type = CachedParameterGetChanged(g_Handle, &changed);
825 return ConvertToInt(type, 1) != 0;
826 }
827
GetParallelUploadTexture()828 bool RSSystemProperties::GetParallelUploadTexture()
829 {
830 static bool enable = std::atoi((system::GetParameter("rosen.parallelUpload,enabled", "1")).c_str()) != 0;
831 return enable;
832 }
833
GetImageGpuResourceCacheEnable(int width,int height)834 bool RSSystemProperties::GetImageGpuResourceCacheEnable(int width, int height)
835 {
836 static bool cacheEnable =
837 std::atoi((system::GetParameter("persist.sys.graphic.gpuResourceCacheEnable", "1")).c_str()) != 0;
838 if (!cacheEnable) {
839 return false;
840 }
841
842 // default cache full screen image gpu resource.
843 static int widthConfig =
844 std::atoi((system::GetParameter("persist.sys.graphic.gpuResourceCacheWidth", "0")).c_str());
845 static int heightConfig =
846 std::atoi((system::GetParameter("persist.sys.graphic.gpuResourceCacheHeight", "0")).c_str());
847 int cacheWidth = widthConfig == 0 ? DEFAULT_CACHE_WIDTH : widthConfig;
848 int cacheHeight = heightConfig == 0 ? DEFAULT_CACHE_HEIGHT : heightConfig;
849 if (width >= cacheWidth && height >= cacheHeight) {
850 return true;
851 }
852 return false;
853 }
854
GetBoolSystemProperty(const char * name,bool defaultValue)855 bool RSSystemProperties::GetBoolSystemProperty(const char* name, bool defaultValue)
856 {
857 static CachedHandle g_Handle = CachedParameterCreate(name, defaultValue ? "1" : "0");
858 int changed = 0;
859 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
860 return ConvertToInt(enable, defaultValue ? 1 : 0) != 0;
861 }
862
WatchSystemProperty(const char * name,OnSystemPropertyChanged func,void * context)863 int RSSystemProperties::WatchSystemProperty(const char* name, OnSystemPropertyChanged func, void* context)
864 {
865 return WatchParameter(name, func, context);
866 }
867
GetSnapshotWithDMAEnabled()868 bool RSSystemProperties::GetSnapshotWithDMAEnabled()
869 {
870 static bool isSupportDma = (system::GetParameter("const.product.devicetype", "pc") == "phone" ||
871 system::GetParameter("const.product.devicetype", "pc") == "tablet" ||
872 system::GetParameter("const.product.devicetype", "pc") == "pc" ||
873 system::GetParameter("const.product.devicetype", "pc") == "2in1") &&
874 system::GetBoolParameter("rosen.snapshotDma.enabled", true);
875 return isSupportDma;
876 }
877
IsPhoneType()878 bool RSSystemProperties::IsPhoneType()
879 {
880 static bool isPhone = system::GetParameter("const.product.devicetype", "pc") == "phone";
881 return isPhone;
882 }
883
IsTabletType()884 bool RSSystemProperties::IsTabletType()
885 {
886 static bool isTablet = system::GetParameter("const.product.devicetype", "pc") == "tablet";
887 return isTablet;
888 }
889
IsPcType()890 bool RSSystemProperties::IsPcType()
891 {
892 static bool isPc = (system::GetParameter("const.product.devicetype", "pc") == "pc") ||
893 (system::GetParameter("const.product.devicetype", "pc") == "2in1");
894 return isPc;
895 }
896
GetSyncTransactionEnabled()897 bool RSSystemProperties::GetSyncTransactionEnabled()
898 {
899 static bool syncTransactionEnabled =
900 std::atoi((system::GetParameter("persist.sys.graphic.syncTransaction.enabled", "1")).c_str()) != 0;
901 return syncTransactionEnabled;
902 }
903
GetSyncTransactionWaitDelay()904 int RSSystemProperties::GetSyncTransactionWaitDelay()
905 {
906 static int syncTransactionWaitDelay =
907 std::atoi((system::GetParameter("persist.sys.graphic.syncTransactionWaitDelay", "1500")).c_str());
908 return syncTransactionWaitDelay;
909 }
910
GetSingleFrameComposerEnabled()911 bool RSSystemProperties::GetSingleFrameComposerEnabled()
912 {
913 static bool singleFrameComposerEnabled =
914 (std::atoi((system::GetParameter("persist.sys.graphic.singleFrameComposer", "0")).c_str()) != 0);
915 return singleFrameComposerEnabled;
916 }
917
GetSingleFrameComposerCanvasNodeEnabled()918 bool RSSystemProperties::GetSingleFrameComposerCanvasNodeEnabled()
919 {
920 static bool singleFrameComposerCanvasNodeEnabled =
921 (std::atoi((system::GetParameter("persist.sys.graphic.singleFrameComposerCanvasNode", "0")).c_str()) != 0);
922 return singleFrameComposerCanvasNodeEnabled;
923 }
924
GetDrawFilterWithoutSnapshotEnabled()925 bool RSSystemProperties::GetDrawFilterWithoutSnapshotEnabled()
926 {
927 static bool drawFilterWithoutSnahpshotEnabled =
928 (std::atoi(system::GetParameter("persist.sys.graphic.drawFilterWithoutSnahpshot", "0").c_str()) != 0);
929 return drawFilterWithoutSnahpshotEnabled;
930 }
931
GetBlurExtraFilterEnabled()932 bool RSSystemProperties::GetBlurExtraFilterEnabled()
933 {
934 static bool blurExtraFilterEnabled =
935 (std::atoi(system::GetParameter("persist.sys.graphic.blurExtraFilter", "0").c_str()) != 0);
936 return blurExtraFilterEnabled;
937 }
938
GetPurgeBetweenFramesEnabled()939 bool RSSystemProperties::GetPurgeBetweenFramesEnabled()
940 {
941 static bool purgeResourcesEveryEnabled =
942 (std::atoi(system::GetParameter("persist.sys.graphic.mem.purge_between_frames_enabled", "1").c_str()) != 0);
943 return purgeResourcesEveryEnabled;
944 }
945
GetGpuMemoryAsyncReclaimerEnabled()946 bool RSSystemProperties::GetGpuMemoryAsyncReclaimerEnabled()
947 {
948 static bool gpuMemoryAsyncReclaimerEnabled =
949 (std::atoi(
950 system::GetParameter("persist.sys.graphic.mem.gpu_async_reclaimer_between_frames_enabled", "1").c_str()) !=
951 0);
952 return gpuMemoryAsyncReclaimerEnabled;
953 }
954
GetGpuCacheSuppressWindowEnabled()955 bool RSSystemProperties::GetGpuCacheSuppressWindowEnabled()
956 {
957 static bool gpuCacheSuppressWindowEnabled =
958 (std::atoi(
959 system::GetParameter("persist.sys.graphic.mem.gpu_suppress_window_between_frames_enabled", "1").c_str()) !=
960 0);
961 return gpuCacheSuppressWindowEnabled;
962 }
963
964 const DdgrOpincType RSSystemProperties::ddgrOpincType_ =
965 static_cast<DdgrOpincType>(std::atoi((system::GetParameter("persist.ddgr.opinctype", "2")).c_str()));
966 const DdgrOpincDfxType RSSystemProperties::ddgrOpincDfxType_ =
967 static_cast<DdgrOpincDfxType>(std::atoi((
968 system::GetParameter("persist.rosen.ddgr.opinctype.debugtype", "0")).c_str()));
969
GetDdgrOpincType()970 DdgrOpincType RSSystemProperties::GetDdgrOpincType()
971 {
972 return RSSystemProperties::ddgrOpincType_;
973 }
974
IsDdgrOpincEnable()975 bool RSSystemProperties::IsDdgrOpincEnable()
976 {
977 return (GetDdgrOpincType() == DdgrOpincType::OPINC_AUTOCACHE_REALDRAW ||
978 GetDdgrOpincType() == DdgrOpincType::OPINC_AUTOCACHE);
979 }
980
IsOpincRealDrawCacheEnable()981 bool RSSystemProperties::IsOpincRealDrawCacheEnable()
982 {
983 return GetDdgrOpincType() == DdgrOpincType::OPINC_AUTOCACHE_REALDRAW;
984 }
985
GetDdgrOpincDfxType()986 DdgrOpincDfxType RSSystemProperties::GetDdgrOpincDfxType()
987 {
988 return ddgrOpincDfxType_;
989 }
990
GetAutoCacheDebugEnabled()991 bool RSSystemProperties::GetAutoCacheDebugEnabled()
992 {
993 return GetDdgrOpincDfxType() == DdgrOpincDfxType::OPINC_DFX_AUTO;
994 }
995
996 #ifdef RS_ENABLE_STACK_CULLING
GetViewOcclusionCullingEnabled()997 bool RSSystemProperties::GetViewOcclusionCullingEnabled()
998 {
999 static bool stackViewCullingEnabled =
1000 system::GetBoolParameter("persist.sys.graphic.stack.culling.enabled", true);
1001 return stackViewCullingEnabled;
1002 }
1003 #endif
1004
GetSubSurfaceEnabled()1005 bool RSSystemProperties::GetSubSurfaceEnabled()
1006 {
1007 static bool subSurfaceEnabled =
1008 std::atoi((system::GetParameter("persist.sys.graphic.subSurface", "0")).c_str());
1009 return subSurfaceEnabled;
1010 }
1011
GetSecurityPermissionCheckEnabled()1012 bool RSSystemProperties::GetSecurityPermissionCheckEnabled()
1013 {
1014 static bool openSecurityPermissionCheck =
1015 std::atoi((system::GetParameter("persist.sys.graphic.openSecurityPermissionCheck", "0")).c_str()) != 0;
1016 return openSecurityPermissionCheck;
1017 }
1018
GetEffectMergeEnabled()1019 bool RSSystemProperties::GetEffectMergeEnabled()
1020 {
1021 static CachedHandle g_Handle = CachedParameterCreate("rosen.graphic.effectMergeEnabled", "1");
1022 int changed = 0;
1023 const char *enable = CachedParameterGetChanged(g_Handle, &changed);
1024 return ConvertToInt(enable, 1) != 0;
1025 }
1026
GetDumpUICaptureEnabled()1027 bool RSSystemProperties::GetDumpUICaptureEnabled()
1028 {
1029 bool dumpUICaptureEnabled =
1030 std::atoi((system::GetParameter("rosen.dumpUICaptureEnabled.enabled", "0")).c_str()) != 0;
1031 return dumpUICaptureEnabled;
1032 }
1033
GetDumpUIPixelmapEnabled()1034 bool RSSystemProperties::GetDumpUIPixelmapEnabled()
1035 {
1036 bool dumpUIPixelmapEnabled =
1037 std::atoi((system::GetParameter("rosen.dumpUIPixelmapEnabled.enabled", "0")).c_str()) != 0;
1038 return dumpUIPixelmapEnabled;
1039 }
1040
GetVirtualScreenScaleModeDFX()1041 int RSSystemProperties::GetVirtualScreenScaleModeDFX()
1042 {
1043 static int scaleModeDFX =
1044 std::atoi((system::GetParameter("persist.rosen.virtualScreenScaleMode.debugType", "2")).c_str());
1045 return (scaleModeDFX > DEFAULT_SCALE_MODE) ? DEFAULT_SCALE_MODE : scaleModeDFX;
1046 }
1047
GetSubTreePrepareCheckType()1048 SubTreePrepareCheckType RSSystemProperties::GetSubTreePrepareCheckType()
1049 {
1050 static CachedHandle g_Handle = CachedParameterCreate("persist.sys.graphic.SubTreePrepareCheckType.type", "2");
1051 int changed = 0;
1052 const char *type = CachedParameterGetChanged(g_Handle, &changed);
1053 return static_cast<SubTreePrepareCheckType>(ConvertToInt(type, 2)); // Default value 2
1054 }
1055
GetHDRImageEnable()1056 bool RSSystemProperties::GetHDRImageEnable()
1057 {
1058 static CachedHandle g_Handle = CachedParameterCreate("rosen.hdrimage.enable", "1");
1059 int changed = 0;
1060 const char *num = CachedParameterGetChanged(g_Handle, &changed);
1061 return ConvertToInt(num, 0);
1062 }
1063
IsForceClient()1064 bool RSSystemProperties::IsForceClient()
1065 {
1066 static CachedHandle g_Handle = CachedParameterCreate("rosen.client_composition.enabled", "0");
1067 int changed = 0;
1068 const char *num = CachedParameterGetChanged(g_Handle, &changed);
1069 return ConvertToInt(num, 0);
1070 }
1071
GetTextBlobAsPixelMap()1072 bool RSSystemProperties::GetTextBlobAsPixelMap()
1073 {
1074 static bool pixelMapEnabled =
1075 std::atoi((system::GetParameter("persist.rosen.textBlobAsPixelMapEnable.enable", "0")).c_str()) != 0;
1076 return pixelMapEnabled;
1077 }
1078
GetRSNodeLimit()1079 int RSSystemProperties::GetRSNodeLimit()
1080 {
1081 static int rsNodeLimit =
1082 std::atoi((system::GetParameter("persist.sys.graphic.rsNodeLimit", "500")).c_str());
1083 return rsNodeLimit;
1084 }
1085
GetGpuOverDrawBufferOptimizeEnabled()1086 bool RSSystemProperties::GetGpuOverDrawBufferOptimizeEnabled()
1087 {
1088 static bool flag = system::GetParameter("rosen.gpu.overdraw.optimize.enabled", "0") != "0";
1089 return flag;
1090 }
1091
GetSkipDisplayIfScreenOffEnabled()1092 bool RSSystemProperties::GetSkipDisplayIfScreenOffEnabled()
1093 {
1094 static CachedHandle g_Handle = CachedParameterCreate("rosen.graphic.screenoffskipdisplayenabled", "1");
1095 int changed = 0;
1096 const char *num = CachedParameterGetChanged(g_Handle, &changed);
1097 return ConvertToInt(num, 1) != 0;
1098 }
1099
GetBatchRemovingOnRemoteDiedEnabled()1100 bool RSSystemProperties::GetBatchRemovingOnRemoteDiedEnabled()
1101 {
1102 static CachedHandle g_Handle = CachedParameterCreate("rosen.graphic.batchRemovingOnRemoteDied.enabled", "1");
1103 int changed = 0;
1104 const char *num = CachedParameterGetChanged(g_Handle, &changed);
1105 return ConvertToInt(num, 1) != 0;
1106 }
1107
GetVersionType()1108 std::string RSSystemProperties::GetVersionType()
1109 {
1110 static std::string versionType = system::GetParameter("const.logsystem.versiontype", "");
1111 return versionType;
1112 }
1113
GetDrmMarkedFilterEnabled()1114 bool RSSystemProperties::GetDrmMarkedFilterEnabled()
1115 {
1116 static CachedHandle g_Handle = CachedParameterCreate("rosen.drm.markedFilter.enabled", "1");
1117 int changed = 0;
1118 const char *num = CachedParameterGetChanged(g_Handle, &changed);
1119 return ConvertToInt(num, 0);
1120 }
1121
GetHwcDirtyRegionEnabled()1122 bool RSSystemProperties::GetHwcDirtyRegionEnabled()
1123 {
1124 static bool hwcDirtyRegionEnabled =
1125 std::atoi((system::GetParameter("persist.rosen.graphic.hwcdirtyregion.enabled", "1")).c_str()) != 0;
1126 return hwcDirtyRegionEnabled;
1127 }
1128 } // namespace Rosen
1129 } // namespace OHOS
1130