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