Home | History | Annotate | Download | only in tangier
      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 <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 
     23 TngGrallocBuffer::TngGrallocBuffer(uint32_t handle)
     24     :GrallocBufferBase(handle)
     25 {
     26     initBuffer(handle);
     27 }
     28 
     29 TngGrallocBuffer::~TngGrallocBuffer()
     30 {
     31 }
     32 
     33 void TngGrallocBuffer::resetBuffer(uint32_t handle)
     34 {
     35     GrallocBufferBase::resetBuffer(handle);
     36     initBuffer(handle);
     37 }
     38 
     39 void 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