1 #ifndef TEST_SYNC_IMPLEMENTATION_H
2 #define TEST_SYNC_IMPLEMENTATION_H
5 * Copyright (c) 2024 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.
27 #include <dali/graphics-api/graphics-sync-object-create-info.h>
28 #include <dali/graphics-api/graphics-sync-object.h>
29 #include <dali/integration-api/core.h>
30 #include <dali/integration-api/graphics-sync-abstraction.h>
32 #include "test-trace-call-stack.h"
36 class TestGraphicsSyncImplementation;
38 class TestSyncObject : public Integration::GraphicsSyncAbstraction::SyncObject
41 TestSyncObject(TraceCallStack& trace);
42 ~TestSyncObject() override;
43 bool IsSynced() override;
45 void ClientWait() override;
48 TraceCallStack& mTrace;
52 * Class to emulate the gpu sync functions with tracing
54 class TestGraphicsSyncImplementation : public Integration::GraphicsSyncAbstraction
60 TestGraphicsSyncImplementation();
65 virtual ~TestGraphicsSyncImplementation();
68 * Initialize the sync objects
73 * Create a sync object that can be polled
75 GraphicsSyncAbstraction::SyncObject* CreateSyncObject() override;
78 * Destroy a sync object
80 void DestroySyncObject(GraphicsSyncAbstraction::SyncObject* syncObject) override;
82 public: // TEST FUNCTIONS
83 GraphicsSyncAbstraction::SyncObject* GetLastSyncObject();
86 * Test method to trigger the object sync behaviour.
88 * @param[in] sync The sync value to set
90 void SetObjectSynced(GraphicsSyncAbstraction::SyncObject* syncObject, bool sync);
95 void EnableTrace(bool enable);
98 * Reset the trace callstack
103 * Get the trace object (allows test case to find methods on it)
105 TraceCallStack& GetTrace();
108 * Get the number of sync objects
110 * @return the number of sync objects
112 int32_t GetNumberOfSyncObjects();
114 TestGraphicsSyncImplementation(const TestGraphicsSyncImplementation&) = delete;
115 TestGraphicsSyncImplementation& operator=(const TestGraphicsSyncImplementation&) = delete;
118 typedef std::vector<TestSyncObject*> SyncContainer;
119 typedef SyncContainer::iterator SyncIter;
120 SyncContainer mSyncObjects; ///< The sync objects
121 TraceCallStack mTrace{true, "gl"}; ///< the trace call stack for testing
126 #endif // TEST_GL_SYNC_ABSTRACTION_H