Home | History | Annotate | Download | only in common
      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 TTMBUFFERMAPPER_H_
     17 #define TTMBUFFERMAPPER_H_
     18 
     19 #include <DataBuffer.h>
     20 #include <BufferMapper.h>
     21 #include <ips/common/Wsbm.h>
     22 
     23 namespace android {
     24 namespace intel {
     25 
     26 class TTMBufferMapper : public BufferMapper {
     27 public:
     28     TTMBufferMapper(Wsbm& wsbm, DataBuffer& buffer);
     29     virtual ~TTMBufferMapper();
     30 public:
     31     bool map();
     32     bool unmap();
     33 
     34     uint32_t getGttOffsetInPage(int /* subIndex */) const {
     35         return mGttOffsetInPage;
     36     }
     37     void* getCpuAddress(int /* subIndex */) const {
     38         return mCpuAddress;
     39     }
     40     uint32_t getSize(int /* subIndex */) const {
     41         return mSize;
     42     }
     43     uint32_t getKHandle(int /* subIndex */) {
     44         return 0;
     45     }
     46     uint32_t getFbHandle(int /* subIndex */) {
     47         return 0;
     48     }
     49     void putFbHandle() {
     50         return;
     51     }
     52 
     53     // wait idle
     54     bool waitIdle();
     55 private:
     56     int mRefCount;
     57     Wsbm& mWsbm;
     58     void* mBufferObject;
     59 
     60     // mapped info
     61     uint32_t mGttOffsetInPage;
     62     void* mCpuAddress;
     63     uint32_t mSize;
     64 };
     65 
     66 } //namespace intel
     67 } //namespace android
     68 
     69 
     70 #endif /* TTMBUFFERMAPPER_H_ */
     71