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 RSTagTracker(Drawing::GPUContext* gpuContext, RSTagTracker::TAGTYPE tagType); 39 RSTagTracker(Drawing::GPUContext* gpuContext, NodeId nodeId, 40 RSTagTracker::TAGTYPE tagType, const std::string& name); 41 RSTagTracker(Drawing::GPUContext* gpuContext, Drawing::GPUResourceTag& tag); 42 void SetTagEnd(); 43 ~RSTagTracker(); 44 static void UpdateReleaseResourceEnabled(bool releaseResEnabled); 45 static std::string TagType2String(TAGTYPE type); 46 private: 47 bool isSetTagEnd_ = false; 48 Drawing::GPUContext* gpuContext_ = nullptr; 49 }; 50 } // namespace Rosen 51 } // namespace OHOS 52 #endif