Home | History | Annotate | Download | only in observers
      1 /*
      2 // Copyright(c)2014 IntelCorporation
      3 //
      4 // LicensedundertheApacheLicense,Version2.0(the"License");
      5 // youmaynotusethisfileexceptincompliancewiththeLicense.
      6 // YoumayobtainacopyoftheLicenseat
      7 //
      8 // http://www.apache.org/licenses/LICENSE-2.0
      9 //
     10 // Unlessrequiredbyapplicablelaworagreedtoinwriting,software
     11 // distributedundertheLicenseisdistributedonan"ASIS"BASIS,
     12 // WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.
     13 // SeetheLicenseforthespecificlanguagegoverningpermissionsand
     14 // limitationsundertheLicense.
     15 */
     16 #ifndef __VSYNC_EVENT_OBSERVER_H__
     17 #define __VSYNC_EVENT_OBSERVER_H__
     18 
     19 #include <common/base/SimpleThread.h>
     20 #include <IVsyncControl.h>
     21 
     22 namespace android {
     23 namespace intel {
     24 
     25 class PhysicalDevice;
     26 
     27 class VsyncEventObserver {
     28 public:
     29     VsyncEventObserver(PhysicalDevice& disp);
     30     virtual ~VsyncEventObserver();
     31 
     32 public:
     33     virtual bool initialize();
     34     virtual void deinitialize();
     35     bool control(bool enabled);
     36 
     37 private:
     38     mutable Mutex mLock;
     39     Condition mCondition;
     40     PhysicalDevice& mDisplayDevice;
     41     IVsyncControl *mVsyncControl;
     42     int  mDevice;
     43     bool mEnabled;
     44     bool mExitThread;
     45     bool mInitialized;
     46 
     47 private:
     48     DECLARE_THREAD(VsyncEventPollThread, VsyncEventObserver);
     49 };
     50 
     51 } // namespace intel
     52 } // namespace android
     53 
     54 
     55 
     56 #endif /* __VSYNC_EVENT_OBSERVER_H__ */
     57