Home | History | Annotate | Download | only in merrifield_plus
      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 <platforms/merrifield_plus/PlatfBufferManager.h>
     18 #include <ips/tangier/TngGrallocBuffer.h>
     19 #include <ips/tangier/TngGrallocBufferMapper.h>
     20 
     21 namespace android {
     22 namespace intel {
     23 
     24 PlatfBufferManager::PlatfBufferManager()
     25     : BufferManager()
     26 {
     27 
     28 }
     29 
     30 PlatfBufferManager::~PlatfBufferManager()
     31 {
     32 
     33 }
     34 
     35 bool PlatfBufferManager::initialize()
     36 {
     37     return BufferManager::initialize();
     38 }
     39 
     40 void PlatfBufferManager::deinitialize()
     41 {
     42     BufferManager::deinitialize();
     43 }
     44 
     45 DataBuffer* PlatfBufferManager::createDataBuffer(gralloc_module_t * /* module */,
     46         uint32_t handle)
     47 {
     48     return new TngGrallocBuffer(handle);
     49 }
     50 
     51 BufferMapper* PlatfBufferManager::createBufferMapper(gralloc_module_t *module,
     52                                                         DataBuffer& buffer)
     53 {
     54     if (!module)
     55         return 0;
     56 
     57     return new TngGrallocBufferMapper(*(IMG_gralloc_module_public_t*)module,
     58                                         buffer);
     59 }
     60 
     61 bool PlatfBufferManager::blitGrallocBuffer(uint32_t srcHandle, uint32_t dstHandle,
     62                                   crop_t& srcCrop, uint32_t async)
     63 
     64 {
     65     IMG_gralloc_module_public_t *imgGrallocModule = (IMG_gralloc_module_public_t *) mGrallocModule;
     66     if (imgGrallocModule->Blit(imgGrallocModule, (buffer_handle_t)srcHandle,
     67                                 (buffer_handle_t)dstHandle,
     68                                 srcCrop.w, srcCrop.h, srcCrop.x,
     69                                 srcCrop.y, 0, async)) {
     70         ELOGTRACE("Blit failed");
     71         return false;
     72     }
     73     return true;
     74 }
     75 
     76 
     77 } // namespace intel
     78 } // namespace android
     79