Home | History | Annotate | Download | only in include
      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 EXTERNAL_DEVICE_H
     17 #define EXTERNAL_DEVICE_H
     18 
     19 #include <PhysicalDevice.h>
     20 #include <IHdcpControl.h>
     21 #include <common/base/SimpleThread.h>
     22 
     23 namespace android {
     24 namespace intel {
     25 
     26 
     27 class ExternalDevice : public PhysicalDevice {
     28 
     29 public:
     30     ExternalDevice(uint32_t disp, Hwcomposer& hwc, DisplayPlaneManager& dpm);
     31     virtual ~ExternalDevice();
     32 public:
     33     virtual bool initialize();
     34     virtual void deinitialize();
     35     virtual bool blank(bool blank);
     36     virtual bool setDrmMode(drmModeModeInfo& value);
     37     virtual void setRefreshRate(int hz);
     38     virtual bool getDisplaySize(int *width, int *height);
     39     virtual bool getDisplayConfigs(uint32_t *configs,
     40                                        size_t *numConfigs);
     41     virtual bool getDisplayAttributes(uint32_t config,
     42                                           const uint32_t *attributes,
     43                                           int32_t *values);
     44     virtual int  getActiveConfig();
     45     virtual bool setActiveConfig(int index);
     46 
     47 private:
     48     static void HdcpLinkStatusListener(bool success, void *userData);
     49     void HdcpLinkStatusListener(bool success);
     50     void setDrmMode();
     51 
     52 protected:
     53     virtual IHdcpControl* createHdcpControl() = 0;
     54 
     55 protected:
     56     IHdcpControl *mHdcpControl;
     57 
     58 private:
     59     static void hotplugEventListener(void *data);
     60     void hotplugListener();
     61 
     62 private:
     63     Condition mAbortModeSettingCond;
     64     drmModeModeInfo mPendingDrmMode;
     65     bool mHotplugEventPending;
     66 
     67 private:
     68     DECLARE_THREAD(ModeSettingThread, ExternalDevice);
     69 };
     70 
     71 }
     72 }
     73 
     74 #endif /* EXTERNAL_DEVICE_H */
     75