1 /* 2 // Copyright (c) 2014 Intel Corporation 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 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