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 <GraphicBuffer.h> 18 19 namespace android { 20 namespace intel { 21 22 GraphicBuffer::GraphicBuffer(buffer_handle_t handle) 23 : DataBuffer(handle) 24 { 25 initBuffer(handle); 26 } 27 28 void GraphicBuffer::resetBuffer(buffer_handle_t handle) 29 { 30 DataBuffer::resetBuffer(handle); 31 initBuffer(handle); 32 } 33 34 bool GraphicBuffer::isProtectedUsage(uint32_t usage) 35 { 36 if (usage == USAGE_INVALID) { 37 return false; 38 } 39 40 return (usage & GRALLOC_USAGE_PROTECTED) != 0; 41 } 42 43 bool GraphicBuffer::isProtectedBuffer(GraphicBuffer *buffer) 44 { 45 if (buffer == NULL) { 46 return false; 47 } 48 49 return isProtectedUsage(buffer->mUsage); 50 } 51 52 bool GraphicBuffer::isCompressionUsage(uint32_t usage) 53 { 54 if (usage == USAGE_INVALID) { 55 return false; 56 } 57 58 return false; 59 } 60 61 bool GraphicBuffer::isCompressionBuffer(GraphicBuffer *buffer) 62 { 63 if (buffer == NULL) { 64 return false; 65 } 66 67 return isCompressionUsage(buffer->mUsage); 68 } 69 70 void GraphicBuffer::initBuffer(buffer_handle_t handle) 71 { 72 mUsage = USAGE_INVALID; 73 mBpp = 0; 74 } 75 76 } 77 } 78