Revert "[Tizen] Added 'make clean' on each profile build."
[platform/core/uifw/dali-adaptor.git] / adaptors / common / vsync-monitor.h
1 #ifndef __DALI_INTERNAL_VSYNC_MONITOR_IMPL_H__
2 #define __DALI_INTERNAL_VSYNC_MONITOR_IMPL_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
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
21 // EXTERNAL INCLUDES
22 #include <xf86drm.h>
23
24 // INTERNAL INCLUDES
25 #include <base/interfaces/vsync-monitor-interface.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 namespace Adaptor
34 {
35
36 /**
37  * Tizen interface for monitoring VSync
38  */
39 class VSyncMonitor : public VSyncMonitorInterface
40 {
41 public:
42   /**
43    * Default constructor
44    */
45   VSyncMonitor();
46
47   /**
48    * Destructor
49    */
50   virtual ~VSyncMonitor();
51
52 public:
53
54   /**
55    * Set the use hardware flag
56    * @param[in] useHardware The new state for the use hardware flag.
57    */
58   void SetUseHardwareVSync( bool useHardware );
59
60   /**
61    * Set whether the vsync hardware is available.
62    * (This is public to allow callback method to work...)
63    */
64   void SetHardwareVSyncAvailable(bool available);
65
66 private: // From Dali::Internal::Adaptor::VSyncMonitorInterface
67
68   /**
69    * copydoc Dali::Internal::Adaptor::VSyncMonitorInterface::Initialize
70    */
71   virtual void Initialize();
72
73   /**
74    * copydoc Dali::Internal::Adaptor::VSyncMonitorInterface::Terminate
75    */
76   virtual void Terminate();
77
78   /**
79    * copydoc Dali::Internal::Adaptor::VSyncMonitorInterface::UseHardware
80    */
81   virtual bool UseHardware();
82
83   /**
84    * copydoc Dali::Internal::Adaptor::VSyncMonitorInterface::DoSync
85    */
86   virtual bool DoSync( unsigned int& frameNumber, unsigned int& seconds, unsigned int& microseconds );
87
88 private:
89
90   int       mFileDescriptor;  ///< DRM dev node file descriptor
91   drmVBlank mVBlankInfo;
92   // NOTE cannot use booleans as these are used from multiple threads, must use variable with machine word size for atomic read/write
93   unsigned int mUseHardwareVSync; ///< Whether to use hardware vsync
94   unsigned int mHardwareVSyncAvailable; ///< Whether hardware vsync is available
95 };
96
97 } // namespace Adaptor
98
99 } // namespace Internal
100
101 } // namespace Dali
102
103 #endif // __DALI_INTERNAL_VSYNC_MONITOR_IMPL_H__