Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-tracker.h
1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_TRACKER_H
2 #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TRACKER_H
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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
10 //
11 //     http://floralicense.org/license/
12 //
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.
18 //
19
20 #include <dali/integration-api/gl-sync-abstraction.h>
21 #include <dali/internal/common/message.h>
22
23 namespace Dali
24 {
25 namespace Internal
26 {
27 namespace SceneGraph
28 {
29
30 /**
31  * This class is used to communicate with Fence Sync objects, keeping access solely in
32  * the RenderThread to avoid having mutual exclusion locks or messages back to the UpdateThread.
33  */
34 class RenderTracker
35 {
36 public:
37   /**
38    * Constructor
39    * @param[in] glSyncAbstraction The GlSyncAbstraction
40    * @param[in] resourceId The resource ID of the framebuffer texture being tracked
41    */
42   RenderTracker(Integration::GlSyncAbstraction& glSyncAbstraction);
43
44   /**
45    * Destructor
46    * Delete any outstanding sync objects?
47    */
48   ~RenderTracker();
49
50   /**
51    * Creates a sync object for this tracker. Will delete any existing sync object.
52    */
53   void CreateSyncObject();
54
55   /**
56    * Check the GL Sync objects. This is called from Render Thread.
57    * If the GlSyncObject has been triggered, then atomically set the sync trigger
58    */
59   void PollSyncObject();
60
61   /**
62    * Check the sync trigger. This is called from Update Thread, so atomically reads the sync trigger
63    * It clears the sync trigger if it was set.
64    * @return true if the tracker has been synced
65    */
66   bool IsSynced();
67
68   /**
69    * Atomically reset the sync trigger. This may be called from any thread
70    */
71   void ResetSyncFlag();
72
73   /**
74    * Atomically sets the sync trigger. This may be called from any thread
75    */
76   void SetSyncFlag();
77
78 private:
79   Integration::GlSyncAbstraction& mGlSyncAbstraction; // The sync abstraction
80   volatile int mSyncTrigger;             // Trigger that update thread can read & reset
81   Integration::GlSyncAbstraction::SyncObject* mSyncObject; // Associated sync object
82 };
83
84 } // SceneGraph
85 } // Internal
86 } // Dali
87
88
89 #endif // __DALI_INTERNAL_RENDER_TRACKER_H