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