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 IDISPLAY_DEVICE_H
     17 #define IDISPLAY_DEVICE_H
     18 
     19 #include <Dump.h>
     20 #include <IDisplayContext.h>
     21 #include <DisplayPlane.h>
     22 
     23 namespace android {
     24 namespace intel {
     25 
     26 // display config
     27 class DisplayConfig {
     28 public:
     29     DisplayConfig(int rr, int w, int h, int dpix, int dpiy)
     30         : mRefreshRate(rr),
     31           mWidth(w),
     32           mHeight(h),
     33           mDpiX(dpix),
     34           mDpiY(dpiy)
     35     {}
     36 public:
     37     int getRefreshRate() const { return mRefreshRate; }
     38     int getWidth() const { return mWidth; }
     39     int getHeight() const { return mHeight; }
     40     int getDpiX() const { return mDpiX; }
     41     int getDpiY() const { return mDpiY; }
     42 private:
     43     int mRefreshRate;
     44     int mWidth;
     45     int mHeight;
     46     int mDpiX;
     47     int mDpiY;
     48 };
     49 
     50 
     51 //  display device interface
     52 class IDisplayDevice {
     53 public:
     54     // display device type
     55     enum {
     56         DEVICE_PRIMARY = HWC_DISPLAY_PRIMARY,
     57         DEVICE_EXTERNAL = HWC_DISPLAY_EXTERNAL,
     58 #ifdef INTEL_WIDI_MERRIFIELD
     59         DEVICE_VIRTUAL = HWC_DISPLAY_VIRTUAL,
     60 #endif
     61         DEVICE_COUNT,
     62     };
     63     enum {
     64         DEVICE_DISCONNECTED = 0,
     65         DEVICE_CONNECTED,
     66     };
     67     enum {
     68         DEVICE_DISPLAY_OFF = 0,
     69         DEVICE_DISPLAY_ON,
     70         DEVICE_DISPLAY_STANDBY,
     71     };
     72 public:
     73     IDisplayDevice() {}
     74     virtual ~IDisplayDevice() {}
     75 public:
     76     virtual bool prePrepare(hwc_display_contents_1_t *display) = 0;
     77     virtual bool prepare(hwc_display_contents_1_t *display) = 0;
     78     virtual bool commit(hwc_display_contents_1_t *display,
     79                           IDisplayContext *context) = 0;
     80 
     81     virtual bool vsyncControl(bool enabled) = 0;
     82     virtual bool blank(bool blank) = 0;
     83     virtual bool getDisplaySize(int *width, int *height) = 0;
     84     virtual bool getDisplayConfigs(uint32_t *configs,
     85                                        size_t *numConfigs) = 0;
     86     virtual bool getDisplayAttributes(uint32_t config,
     87                                           const uint32_t *attributes,
     88                                           int32_t *values) = 0;
     89     virtual bool compositionComplete() = 0;
     90 
     91     virtual bool setPowerMode(int mode) = 0;
     92     virtual int  getActiveConfig() = 0;
     93     virtual bool setActiveConfig(int index) = 0;
     94 
     95     virtual bool initialize() = 0;
     96     virtual void deinitialize() = 0;
     97     virtual bool isConnected() const = 0;
     98     virtual const char* getName() const = 0;
     99     virtual int getType() const = 0;
    100     virtual void onVsync(int64_t timestamp) = 0;
    101     virtual void dump(Dump& d) = 0;
    102 };
    103 
    104 }
    105 }
    106 
    107 #endif /* IDISPLAY_DEVICE_H */
    108