1 #ifndef DALI_GRAPHICS_EGL_GRAPHICS_CONTROLLER_DEBUG_H
2 #define DALI_GRAPHICS_EGL_GRAPHICS_CONTROLLER_DEBUG_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #include <dali/internal/graphics/gles-impl/gles-graphics-command-buffer.h>
22 namespace Dali::Graphics
25 * Struct to manage dumping N command buffers. In this file, "frame" really
26 * means each call to EglGraphicsController::Flush(), and doesn't necessarily
27 * correspond to a complete render frame.
29 struct GraphicsFrameDump
31 using UniqueFilePtr = std::unique_ptr<std::FILE, int (*)(std::FILE*)>;
32 UniqueFilePtr outputStream;
33 FILE* output{nullptr};
34 bool dumpingFrame{false};
35 bool firstBuffer{true};
36 bool firstFrame{true};
39 const int NTH_FRAME{10}; // dump first N "frames"
46 void DumpCommandBuffer(const GLES::CommandBuffer* cmdBuf);
50 #if defined(DEBUG_ENABLED) && defined(ENABLE_COMMAND_BUFFER_FRAME_DUMP)
51 #define DUMP_FRAME_INIT() std::unique_ptr<Dali::Graphics::GraphicsFrameDump> gGraphicsFrameDump(new Dali::Graphics::GraphicsFrameDump)
52 #define DUMP_FRAME_START() \
53 if(gGraphicsFrameDump) \
55 gGraphicsFrameDump->Start(); \
57 #define DUMP_FRAME_COMMAND_BUFFER(cmdBuffer) \
58 if(gGraphicsFrameDump) \
60 gGraphicsFrameDump->DumpCommandBuffer(cmdBuffer); \
62 #define DUMP_FRAME_END() \
63 if(gGraphicsFrameDump) \
65 gGraphicsFrameDump->End(); \
68 #define DUMP_FRAME_INIT()
69 #define DUMP_FRAME_START()
70 #define DUMP_FRAME_COMMAND_BUFFER(cmdBuffer)
71 #define DUMP_FRAME_END()
74 } // namespace Dali::Graphics
76 #endif //DALI_GRAPHICS_EGL_GRAPHICS_CONTROLLER_DEBUG_H