1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef GrVulkanTrackerInterface_DEFINED 17 #define GrVulkanTrackerInterface_DEFINED 18 #include <sstream> 19 20 #if defined (SK_VULKAN) && defined (SKIA_DFX_FOR_RECORD_VKIMAGE) 21 #define RECORD_GPU_RESOURCE_DRAWABLE_CALLER(NodeId) ParallelDebug::RecordNodeId(NodeId) 22 #else 23 #define RECORD_GPU_RESOURCE_DRAWABLE_CALLER(NodeId) 24 #endif 25 namespace ParallelDebug { 26 struct VkImageInvokeRecord; 27 SK_API bool IsVkImageDfxEnabled(); 28 SK_API void RecordNodeId(uint64_t id); 29 void DestroyVkImageInvokeRecord(VkImageInvokeRecord*); 30 void DumpAllDestroyVkImage(std::stringstream& ss); 31 VkImageInvokeRecord* GenerateVkImageInvokeRecord(); 32 uint64_t GetNodeId(); 33 } 34 35 // OH ISSUE if real alloc status is setted to true, vulkan memory will be accounted for MemorySnapshot 36 // Supported interfaces: makeImageSnapshot, MakeFromBackendTexture 37 // Constraint: Only effective in the current thread context. 38 #if defined (SK_VULKAN) && defined (SKIA_DFX_FOR_OHOS) 39 #define REAL_ALLOC_CONFIG_SET_STATUS(stat) RealAllocConfig::SetRealAllocStatus(stat) 40 #else 41 #define REAL_ALLOC_CONFIG_SET_STATUS(stat) 42 #endif 43 44 namespace RealAllocConfig { 45 SK_API bool GetRealAllocStatus(); 46 SK_API void SetRealAllocStatus(bool ret); 47 } 48 #endif