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 <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
PlatfBufferManager()24 PlatfBufferManager::PlatfBufferManager()
25 : BufferManager()
26 {
27
28 }
29
~PlatfBufferManager()30 PlatfBufferManager::~PlatfBufferManager()
31 {
32
33 }
34
initialize()35 bool PlatfBufferManager::initialize()
36 {
37 return BufferManager::initialize();
38 }
39
deinitialize()40 void PlatfBufferManager::deinitialize()
41 {
42 BufferManager::deinitialize();
43 }
44
createDataBuffer(gralloc_module_t *,uint32_t handle)45 DataBuffer* PlatfBufferManager::createDataBuffer(gralloc_module_t * /* module */,
46 uint32_t handle)
47 {
48 return new TngGrallocBuffer(handle);
49 }
50
createBufferMapper(gralloc_module_t * module,DataBuffer & buffer)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
blitGrallocBuffer(uint32_t srcHandle,uint32_t dstHandle,crop_t & srcCrop,uint32_t async)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