1 /* 2 // Copyright (c) 2014 Intel Corporation 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 */ 16 #include <common/utils/HwcTrace.h> 17 #include <GraphicBuffer.h> 18 19 namespace android { 20 namespace intel { 21 GraphicBuffer(uint32_t handle)22GraphicBuffer::GraphicBuffer(uint32_t handle) 23 : DataBuffer(handle) 24 { 25 initBuffer(handle); 26 } 27 resetBuffer(uint32_t handle)28void GraphicBuffer::resetBuffer(uint32_t handle) 29 { 30 DataBuffer::resetBuffer(handle); 31 initBuffer(handle); 32 } 33 isProtectedUsage(uint32_t usage)34bool 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 isProtectedBuffer(GraphicBuffer * buffer)43bool GraphicBuffer::isProtectedBuffer(GraphicBuffer *buffer) 44 { 45 if (buffer == NULL) { 46 return false; 47 } 48 49 return isProtectedUsage(buffer->mUsage); 50 } 51 isCompressionUsage(uint32_t usage)52bool GraphicBuffer::isCompressionUsage(uint32_t usage) 53 { 54 if (usage == USAGE_INVALID) { 55 return false; 56 } 57 58 return false; 59 } 60 isCompressionBuffer(GraphicBuffer * buffer)61bool GraphicBuffer::isCompressionBuffer(GraphicBuffer *buffer) 62 { 63 if (buffer == NULL) { 64 return false; 65 } 66 67 return isCompressionUsage(buffer->mUsage); 68 } 69 initBuffer(uint32_t)70void GraphicBuffer::initBuffer(uint32_t /*handle*/) 71 { 72 mUsage = USAGE_INVALID; 73 mBpp = 0; 74 } 75 76 } 77 } 78