• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #ifndef RS_TAG_TRACKER
16 #define RS_TAG_TRACKER
17 #include "image/gpu_context.h"
18 #include "common/rs_common_def.h"
19 #include "common/rs_macros.h"
20 #include "platform/common/rs_system_properties.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 class RSB_EXPORT RSTagTracker {
25 public:
26     enum TAGTYPE : uint32_t {
27         TAG_DRAW_SURFACENODE = 1, // don't change head and tail, insert the middle if u add data.
28         TAG_SUB_THREAD,
29         TAG_SAVELAYER_DRAW_NODE,
30         TAG_RESTORELAYER_DRAW_NODE,
31         TAG_SAVELAYER_COLOR_FILTER,
32         TAG_ACQUIRE_SURFACE,
33         TAG_FILTER,
34         TAG_RENDER_FRAME,
35         TAG_UNTAGGED,
36         TAG_CAPTURE,
37     };
38     enum SOURCETYPE : uint32_t {
39         SOURCE_OTHER,
40         SOURCE_RSCUSTOMMODIFIERDRAWABLE,
41         SOURCE_RSBEGINBLENDERDRAWABLE,
42         SOURCE_RSSHADOWDRAWABLE,
43         SOURCE_RSBACKGROUNDIMAGEDRAWABLE,
44         SOURCE_RSBACKGROUNDEFFECTDRAWABLE,
45         SOURCE_RSUSEEFFECTDRAWABLE,
46         SOURCE_RSDYNAMICLIGHTUPDRAWABLE,
47         SOURCE_RSBINARIZATIONDRAWABLE,
48         SOURCE_RSCOLORFILTERDRAWABLE,
49         SOURCE_RSLIGHTUPEFFECTDRAWABLE,
50         SOURCE_RSDYNAMICDIMDRAWABLE,
51         SOURCE_RSFOREGROUNDFILTERDRAWABLE,
52         SOURCE_RSFOREGROUNDFILTERRESTOREDRAWABLE,
53         SOURCE_RSPIXELSTRETCHDRAWABLE,
54         SOURCE_RSPOINTLIGHTDRAWABLE,
55         SOURCE_RSPROPERTYDRAWABLE,
56         SOURCE_RSFILTERDRAWABLE,
57         SOURCE_FINISHOFFSCREENRENDER,
58         SOURCE_DRAWSELFDRAWINGNODEBUFFER,
59         SOURCE_ONCAPTURE,
60         SOURCE_INITCACHEDSURFACE,
61         SOURCE_DRAWRENDERCONTENT,
62         SOURCE_FILTERCACHEENABLEVMA = 100,
63     };
64     RSTagTracker(const std::shared_ptr<Drawing::GPUContext>& gpuContext, RSTagTracker::TAGTYPE tagType);
65     RSTagTracker(const std::shared_ptr<Drawing::GPUContext>& gpuContext, RSTagTracker::SOURCETYPE sourceType);
66     RSTagTracker(const std::shared_ptr<Drawing::GPUContext>& gpuContext, NodeId nodeId,
67         RSTagTracker::TAGTYPE tagType, const std::string& name);
68     RSTagTracker(const std::shared_ptr<Drawing::GPUContext>& gpuContext, Drawing::GPUResourceTag& tag);
69     void SetTagEnd();
70     ~RSTagTracker();
71     static void UpdateReleaseResourceEnabled(bool releaseResEnabled);
72     static std::string TagType2String(TAGTYPE type);
73 private:
74     bool isSetTagEnd_ = false;
75     std::shared_ptr<Drawing::GPUContext> gpuContext_ = nullptr;
76 };
77 } // namespace Rosen
78 } // namespace OHOS
79 #endif