Home | History | Annotate | Download | only in base
      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 DISPLAY_ANALYZER_H
     17 #define DISPLAY_ANALYZER_H
     18 
     19 #include <utils/threads.h>
     20 #include <utils/Vector.h>
     21 
     22 
     23 namespace android {
     24 namespace intel {
     25 
     26 
     27 class DisplayAnalyzer {
     28 public:
     29     DisplayAnalyzer();
     30     virtual ~DisplayAnalyzer();
     31 
     32 public:
     33     bool initialize();
     34     void deinitialize();
     35     void analyzeContents(size_t numDisplays, hwc_display_contents_1_t** displays);
     36     void postHotplugEvent(bool connected);
     37 
     38 private:
     39     enum DisplayEventType {
     40         HOTPLUG_EVENT,
     41     };
     42 
     43     struct Event {
     44         int type;
     45 
     46         union {
     47             bool bValue;
     48             int  nValue;
     49         };
     50     };
     51     inline void postEvent(Event& e);
     52     inline bool getEvent(Event& e);
     53     void handlePendingEvents();
     54     void handleHotplugEvent(bool connected);
     55     inline void setCompositionType(hwc_display_contents_1_t *content, int type);
     56     inline void setCompositionType(int device, int type, bool reset);
     57 
     58 
     59 private:
     60     bool mInitialized;
     61     int mCachedNumDisplays;
     62     hwc_display_contents_1_t** mCachedDisplays;
     63     Vector<Event> mPendingEvents;
     64     Mutex mEventMutex;
     65 };
     66 
     67 } // namespace intel
     68 } // namespace android
     69 
     70 
     71 
     72 #endif /* DISPLAY_ANALYZER_H */
     73