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 <common/utils/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         DEVICE_VIRTUAL = HWC_DISPLAY_VIRTUAL,
     59         DEVICE_COUNT,
     60     };
     61     enum {
     62         DEVICE_DISCONNECTED = 0,
     63         DEVICE_CONNECTED,
     64     };
     65     enum {
     66         DEVICE_DISPLAY_OFF = 0,
     67         DEVICE_DISPLAY_ON,
     68         DEVICE_DISPLAY_STANDBY,
     69     };
     70 public:
     71     IDisplayDevice() {}
     72     virtual ~IDisplayDevice() {}
     73 public:
     74     virtual bool prePrepare(hwc_display_contents_1_t *display) = 0;
     75     virtual bool prepare(hwc_display_contents_1_t *display) = 0;
     76     virtual bool commit(hwc_display_contents_1_t *display,
     77                           IDisplayContext *context) = 0;
     78 
     79     virtual bool vsyncControl(bool enabled) = 0;
     80     virtual bool blank(bool blank) = 0;
     81     virtual bool getDisplaySize(int *width, int *height) = 0;
     82     virtual bool getDisplayConfigs(uint32_t *configs,
     83                                        size_t *numConfigs) = 0;
     84     virtual bool getDisplayAttributes(uint32_t config,
     85                                           const uint32_t *attributes,
     86                                           int32_t *values) = 0;
     87     virtual bool compositionComplete() = 0;
     88 
     89     virtual bool setPowerMode(int mode) = 0;
     90     virtual int  getActiveConfig() = 0;
     91     virtual bool setActiveConfig(int index) = 0;
     92 
     93     virtual bool initialize() = 0;
     94     virtual void deinitialize() = 0;
     95     virtual bool isConnected() const = 0;
     96     virtual const char* getName() const = 0;
     97     virtual int getType() const = 0;
     98     virtual void onVsync(int64_t timestamp) = 0;
     99     virtual void dump(Dump& d) = 0;
    100 };
    101 
    102 }
    103 }
    104 
    105 #endif /* IDISPLAY_DEVICE_H */
    106