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 GRALLOC_BUFFER_MAPPER_BASE_H
     17 #define GRALLOC_BUFFER_MAPPER_BASE_H
     18 
     19 #include <BufferMapper.h>
     20 #include <ips/common/GrallocSubBuffer.h>
     21 #include <ips/common/GrallocBufferBase.h>
     22 
     23 namespace android {
     24 namespace intel {
     25 
     26 class GrallocBufferMapperBase : public BufferMapper {
     27 public:
     28     GrallocBufferMapperBase(DataBuffer& buffer);
     29     virtual ~GrallocBufferMapperBase();
     30 public:
     31     virtual bool map() = 0;
     32     virtual bool unmap() = 0;
     33 
     34     uint32_t getGttOffsetInPage(int subIndex) const;
     35     void* getCpuAddress(int subIndex) const;
     36     uint32_t getSize(int subIndex) const;
     37     virtual uint32_t getKHandle(int subIndex);
     38     virtual uint32_t getFbHandle(int subIndex) = 0;
     39     virtual void putFbHandle() = 0;
     40 
     41 protected:
     42     // mapped info
     43     uint32_t mGttOffsetInPage[SUB_BUFFER_MAX];
     44     void* mCpuAddress[SUB_BUFFER_MAX];
     45     uint32_t mSize[SUB_BUFFER_MAX];
     46     uint32_t mKHandle[SUB_BUFFER_MAX];
     47 };
     48 
     49 } // namespace intel
     50 } // namespace android
     51 
     52 #endif /* TNG_GRALLOC_BUFFER_MAPPER_H */
     53