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 <HwcTrace.h> 17 #include <tangier/TngGrallocBuffer.h> 18 19 namespace android { 20 namespace intel { 21 TngGrallocBuffer(buffer_handle_t handle)22TngGrallocBuffer::TngGrallocBuffer(buffer_handle_t handle) 23 :GrallocBufferBase(handle) 24 { 25 initBuffer(handle); 26 } 27 ~TngGrallocBuffer()28TngGrallocBuffer::~TngGrallocBuffer() 29 { 30 } 31 resetBuffer(buffer_handle_t handle)32void TngGrallocBuffer::resetBuffer(buffer_handle_t handle) 33 { 34 GrallocBufferBase::resetBuffer(handle); 35 initBuffer(handle); 36 } 37 initBuffer(buffer_handle_t handle)38void TngGrallocBuffer::initBuffer(buffer_handle_t handle) 39 { 40 TngIMGGrallocBuffer *grallocHandle = (TngIMGGrallocBuffer *)handle; 41 42 CTRACE(); 43 44 if (!grallocHandle) { 45 ETRACE("gralloc handle is null"); 46 return; 47 } 48 49 mFormat = grallocHandle->iFormat; 50 mWidth = grallocHandle->iWidth; 51 mHeight = grallocHandle->iHeight; 52 mUsage = grallocHandle->usage; 53 mKey = grallocHandle->ui64Stamp; 54 mBpp = grallocHandle->uiBpp; 55 56 // stride can only be initialized after format is set 57 initStride(); 58 } 59 60 61 } 62 } 63