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 #include <HwcTrace.h> 17 #include <Drm.h> 18 #include <Hwcomposer.h> 19 #include <common/GrallocBufferMapperBase.h> 20 21 namespace android { 22 namespace intel { 23 24 GrallocBufferMapperBase::GrallocBufferMapperBase(DataBuffer& buffer) 25 : BufferMapper(buffer) 26 { 27 CTRACE(); 28 29 for (int i = 0; i < SUB_BUFFER_MAX; i++) { 30 mGttOffsetInPage[i] = 0; 31 mCpuAddress[i] = 0; 32 mSize[i] = 0; 33 mKHandle[i] = 0; 34 } 35 } 36 37 GrallocBufferMapperBase::~GrallocBufferMapperBase() 38 { 39 CTRACE(); 40 } 41 42 uint32_t GrallocBufferMapperBase::getGttOffsetInPage(int subIndex) const 43 { 44 if (subIndex >= 0 && subIndex < SUB_BUFFER_MAX) 45 return mGttOffsetInPage[subIndex]; 46 return 0; 47 } 48 49 void* GrallocBufferMapperBase::getCpuAddress(int subIndex) const 50 { 51 if (subIndex >=0 && subIndex < SUB_BUFFER_MAX) 52 return mCpuAddress[subIndex]; 53 return 0; 54 } 55 56 uint32_t GrallocBufferMapperBase::getSize(int subIndex) const 57 { 58 if (subIndex >= 0 && subIndex < SUB_BUFFER_MAX) 59 return mSize[subIndex]; 60 return 0; 61 } 62 63 buffer_handle_t GrallocBufferMapperBase::getKHandle(int subIndex) 64 { 65 if (subIndex >= 0 && subIndex < SUB_BUFFER_MAX) 66 return mKHandle[subIndex]; 67 return 0; 68 } 69 70 71 } // namespace intel 72 } // namespace android 73