blob: 8ce9f0dec3b7ec7bb23b2a3088202ac466eb3227 [file] [log] [blame]
Naseer Ahmed31da0b12012-07-31 18:55:33 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
Arun Kumar K.R361da4f2012-11-28 10:42:59 -08003 * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
Naseer Ahmed31da0b12012-07-31 18:55:33 -07004 *
5 * Not a Contribution, Apache license notifications and license are retained
6 * for attribution purposes only.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
Naseer Ahmed45a99602012-07-31 19:15:24 -070021#define DEBUG_COPYBIT 0
Naseer Ahmed72cf9762012-07-21 12:17:13 -070022#include <copybit.h>
Arun Kumar K.R361da4f2012-11-28 10:42:59 -080023#include <utils/Timers.h>
Naseer Ahmed45a99602012-07-31 19:15:24 -070024#include "hwc_copybit.h"
25#include "comptype.h"
Naseer Ahmed31da0b12012-07-31 18:55:33 -070026
Naseer Ahmed74214722013-02-09 08:11:36 -050027//XXX: Remove HWC_BLIT
28#ifndef QCOM_BSP
29#define HWC_BLIT 4
30#endif
31
Naseer Ahmed31da0b12012-07-31 18:55:33 -070032namespace qhwc {
33
Naseer Ahmed31da0b12012-07-31 18:55:33 -070034struct range {
35 int current;
36 int end;
37};
38struct region_iterator : public copybit_region_t {
39
40 region_iterator(hwc_region_t region) {
41 mRegion = region;
42 r.end = region.numRects;
43 r.current = 0;
44 this->next = iterate;
45 }
46
47private:
48 static int iterate(copybit_region_t const * self, copybit_rect_t* rect){
49 if (!self || !rect) {
50 ALOGE("iterate invalid parameters");
51 return 0;
52 }
53
54 region_iterator const* me =
55 static_cast<region_iterator const*>(self);
56 if (me->r.current != me->r.end) {
57 rect->l = me->mRegion.rects[me->r.current].left;
58 rect->t = me->mRegion.rects[me->r.current].top;
59 rect->r = me->mRegion.rects[me->r.current].right;
60 rect->b = me->mRegion.rects[me->r.current].bottom;
61 me->r.current++;
62 return 1;
63 }
64 return 0;
65 }
66
67 hwc_region_t mRegion;
68 mutable range r;
69};
70
Arun Kumar K.R361da4f2012-11-28 10:42:59 -080071void CopyBit::reset() {
72 mIsModeOn = false;
73 mCopyBitDraw = false;
Naseer Ahmed31da0b12012-07-31 18:55:33 -070074}
75
Naseer Ahmed45a99602012-07-31 19:15:24 -070076bool CopyBit::canUseCopybitForYUV(hwc_context_t *ctx) {
77 // return true for non-overlay targets
78 if(ctx->mMDP.hasOverlay) {
79 return false;
Naseer Ahmed31da0b12012-07-31 18:55:33 -070080 }
81 return true;
82}
Naseer Ahmed45a99602012-07-31 19:15:24 -070083
Arun Kumar K.R361da4f2012-11-28 10:42:59 -080084bool CopyBit::canUseCopybitForRGB(hwc_context_t *ctx,
85 hwc_display_contents_1_t *list,
86 int dpy) {
87 int compositionType = qdutils::QCCompositionType::
88 getInstance().getCompositionType();
Naseer Ahmed45a99602012-07-31 19:15:24 -070089
90 if ((compositionType & qdutils::COMPOSITION_TYPE_C2D) ||
91 (compositionType & qdutils::COMPOSITION_TYPE_DYN)) {
Arun Kumar K.R361da4f2012-11-28 10:42:59 -080092 if(ctx->listStats[dpy].yuvCount) {
Naseer Ahmed45a99602012-07-31 19:15:24 -070093 //Overlay up & running. Dont use COPYBIT for RGB layers.
Naseer Ahmed45a99602012-07-31 19:15:24 -070094 return false;
95 }
96 }
97
98 if (compositionType & qdutils::COMPOSITION_TYPE_DYN) {
99 // DYN Composition:
100 // use copybit, if (TotalRGBRenderArea < 2 * FB Area)
101 // this is done based on perf inputs in ICS
102 // TODO: Above condition needs to be re-evaluated in JB
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800103 int fbWidth = ctx->dpyAttr[dpy].xres;
104 int fbHeight = ctx->dpyAttr[dpy].yres;
105 unsigned int fbArea = (fbWidth * fbHeight);
Naseer Ahmed45a99602012-07-31 19:15:24 -0700106 unsigned int renderArea = getRGBRenderingArea(list);
107 ALOGD_IF (DEBUG_COPYBIT, "%s:renderArea %u, fbArea %u",
108 __FUNCTION__, renderArea, fbArea);
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800109 if (renderArea <= (2 * fbArea)) {
Naseer Ahmed45a99602012-07-31 19:15:24 -0700110 return true;
111 }
112 } else if ((compositionType & qdutils::COMPOSITION_TYPE_MDP)) {
113 // MDP composition, use COPYBIT always
114 return true;
115 } else if ((compositionType & qdutils::COMPOSITION_TYPE_C2D)) {
116 // C2D composition, use COPYBIT
117 return true;
118 }
119 return false;
120}
121
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800122unsigned int CopyBit::getRGBRenderingArea
123 (const hwc_display_contents_1_t *list) {
Naseer Ahmed45a99602012-07-31 19:15:24 -0700124 //Calculates total rendering area for RGB layers
125 unsigned int renderArea = 0;
126 unsigned int w=0, h=0;
127 for (unsigned int i=0; i<list->numHwLayers; i++) {
128 private_handle_t *hnd = (private_handle_t *)list->hwLayers[i].handle;
129 if (hnd) {
130 if (BUFFER_TYPE_UI == hnd->bufferType) {
131 getLayerResolution(&list->hwLayers[i], w, h);
132 renderArea += (w*h);
133 }
134 }
135 }
136 return renderArea;
137}
138
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800139bool CopyBit::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list,
140 int dpy) {
Naseer Ahmed45a99602012-07-31 19:15:24 -0700141
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800142 if(mEngine == NULL) {
143 // No copybit device found - cannot use copybit
144 return false;
145 }
146 int compositionType = qdutils::QCCompositionType::
147 getInstance().getCompositionType();
Naseer Ahmed45a99602012-07-31 19:15:24 -0700148
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800149 if ((compositionType == qdutils::COMPOSITION_TYPE_GPU) ||
150 (compositionType == qdutils::COMPOSITION_TYPE_CPU)) {
Naseer Ahmed45a99602012-07-31 19:15:24 -0700151 //GPU/CPU composition, don't change layer composition type
152 return true;
153 }
154
Naseer Ahmed45a99602012-07-31 19:15:24 -0700155 if(!(validateParams(ctx, list))) {
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800156 ALOGE("%s:Invalid Params", __FUNCTION__);
157 return false;
Naseer Ahmed45a99602012-07-31 19:15:24 -0700158 }
159
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800160 if(ctx->listStats[dpy].skipCount) {
161 //GPU will be anyways used
162 return false;
163 }
164
165 bool useCopybitForYUV = canUseCopybitForYUV(ctx);
166 bool useCopybitForRGB = canUseCopybitForRGB(ctx, list, dpy);
167
168 // numAppLayers-1, as we iterate till 0th layer index
169 for (int i = ctx->listStats[dpy].numAppLayers-1; i >= 0 ; i--) {
Naseer Ahmed45a99602012-07-31 19:15:24 -0700170 private_handle_t *hnd = (private_handle_t *)list->hwLayers[i].handle;
171
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800172 if (hnd->bufferType == BUFFER_TYPE_VIDEO) {
173 //YUV layer, check, if copybit can be used
174 // mark the video layer to gpu when all layer is
175 // going to gpu in case of dynamic composition.
176 if (useCopybitForYUV) {
177 list->hwLayers[i].compositionType = HWC_BLIT;
178 mCopyBitDraw = true;
179 }
180 } else if (hnd->bufferType == BUFFER_TYPE_UI) {
181 //RGB layer, check, if copybit can be used
182 if (useCopybitForRGB) {
183 ALOGD_IF(DEBUG_COPYBIT, "%s: Marking layer[%d] for copybit for"
184 "dpy[%d] ", __FUNCTION__, i, dpy);
185 list->hwLayers[i].compositionType = HWC_BLIT;
186 mCopyBitDraw = true;
187 }
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700188 }
189 }
190 return true;
191}
192
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800193bool CopyBit::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list,
194 int dpy, int32_t *fd) {
195 // draw layers marked for COPYBIT
196 int retVal = true;
197 int copybitLayerCount = 0;
198
199 if(mCopyBitDraw == false) // there is no layer marked for copybit
200 return true ;
201
202 size_t fbLayerIndex = ctx->listStats[dpy].fbLayerIndex;
203 hwc_layer_1_t *fbLayer = &list->hwLayers[fbLayerIndex];
204 //render buffer
205 private_handle_t *renderBuffer = (private_handle_t *)fbLayer->handle;
206 if (!renderBuffer) {
207 ALOGE("%s: HWC_FRAMEBUFFER_TARGET layer handle is NULL", __FUNCTION__);
208 return false;
209 }
210 // numAppLayers-1, as we iterate from 0th layer index with HWC_BLIT flag
211 for (int i = 0; i <= (ctx->listStats[dpy].numAppLayers-1); i++) {
212 hwc_layer_1_t *layer = &list->hwLayers[i];
213 if(!list->hwLayers[i].compositionType == HWC_BLIT) {
214 ALOGD_IF(DEBUG_COPYBIT, "%s: Not Marked for C2D", __FUNCTION__);
215 continue;
216 }
217 int ret = -1;
218 if (list->hwLayers[i].acquireFenceFd != -1 ) {
219 // Wait for acquire Fence on the App buffers.
220 ret = sync_wait(list->hwLayers[i].acquireFenceFd, 1000);
221 if(ret < 0) {
222 ALOGE("%s: sync_wait error!! error no = %d err str = %s",
223 __FUNCTION__, errno, strerror(errno));
224 }
225 close(list->hwLayers[i].acquireFenceFd);
226 list->hwLayers[i].acquireFenceFd = -1;
227 }
228 retVal = drawLayerUsingCopybit(ctx, &(list->hwLayers[i]),
229 renderBuffer, dpy);
230 copybitLayerCount++;
231 if(retVal < 0) {
232 ALOGE("%s : drawLayerUsingCopybit failed", __FUNCTION__);
233 }
234 }
235
236 if (copybitLayerCount) {
237 copybit_device_t *copybit = getCopyBitDevice();
238 // Async mode
239 copybit->flush_get_fence(copybit, fd);
240 }
241 return true;
242}
243
Naseer Ahmed5b6708a2012-08-02 13:46:08 -0700244int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_1_t *layer,
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800245 private_handle_t *renderBuffer, int dpy)
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700246{
247 hwc_context_t* ctx = (hwc_context_t*)(dev);
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800248 int err = 0;
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700249 if(!ctx) {
250 ALOGE("%s: null context ", __FUNCTION__);
251 return -1;
252 }
253
254 private_handle_t *hnd = (private_handle_t *)layer->handle;
255 if(!hnd) {
256 ALOGE("%s: invalid handle", __FUNCTION__);
257 return -1;
258 }
259
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800260 private_handle_t *fbHandle = (private_handle_t *)renderBuffer;
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700261 if(!fbHandle) {
262 ALOGE("%s: Framebuffer handle is NULL", __FUNCTION__);
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700263 return -1;
264 }
265
266 // Set the copybit source:
267 copybit_image_t src;
268 src.w = hnd->width;
269 src.h = hnd->height;
270 src.format = hnd->format;
271 src.base = (void *)hnd->base;
272 src.handle = (native_handle_t *)layer->handle;
273 src.horiz_padding = src.w - hnd->width;
274 // Initialize vertical padding to zero for now,
275 // this needs to change to accomodate vertical stride
276 // if needed in the future
277 src.vert_padding = 0;
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700278
279 // Copybit source rect
280 hwc_rect_t sourceCrop = layer->sourceCrop;
281 copybit_rect_t srcRect = {sourceCrop.left, sourceCrop.top,
282 sourceCrop.right,
283 sourceCrop.bottom};
284
285 // Copybit destination rect
286 hwc_rect_t displayFrame = layer->displayFrame;
287 copybit_rect_t dstRect = {displayFrame.left, displayFrame.top,
288 displayFrame.right,
289 displayFrame.bottom};
290
291 // Copybit dst
292 copybit_image_t dst;
293 dst.w = ALIGN(fbHandle->width,32);
294 dst.h = fbHandle->height;
295 dst.format = fbHandle->format;
296 dst.base = (void *)fbHandle->base;
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800297 dst.handle = (native_handle_t *)fbHandle;
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700298
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800299 copybit_device_t *copybit = mEngine;
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700300
301 int32_t screen_w = displayFrame.right - displayFrame.left;
302 int32_t screen_h = displayFrame.bottom - displayFrame.top;
303 int32_t src_crop_width = sourceCrop.right - sourceCrop.left;
304 int32_t src_crop_height = sourceCrop.bottom -sourceCrop.top;
305
306 // Copybit dst
307 float copybitsMaxScale =
308 (float)copybit->get(copybit,COPYBIT_MAGNIFICATION_LIMIT);
309 float copybitsMinScale =
310 (float)copybit->get(copybit,COPYBIT_MINIFICATION_LIMIT);
311
312 if((layer->transform == HWC_TRANSFORM_ROT_90) ||
313 (layer->transform == HWC_TRANSFORM_ROT_270)) {
314 //swap screen width and height
315 int tmp = screen_w;
316 screen_w = screen_h;
317 screen_h = tmp;
318 }
319 private_handle_t *tmpHnd = NULL;
320
321 if(screen_w <=0 || screen_h<=0 ||src_crop_width<=0 || src_crop_height<=0 ) {
322 ALOGE("%s: wrong params for display screen_w=%d src_crop_width=%d \
323 screen_w=%d src_crop_width=%d", __FUNCTION__, screen_w,
324 src_crop_width,screen_w,src_crop_width);
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700325 return -1;
326 }
327
328 float dsdx = (float)screen_w/src_crop_width;
329 float dtdy = (float)screen_h/src_crop_height;
330
331 float scaleLimitMax = copybitsMaxScale * copybitsMaxScale;
332 float scaleLimitMin = copybitsMinScale * copybitsMinScale;
333 if(dsdx > scaleLimitMax ||
334 dtdy > scaleLimitMax ||
335 dsdx < 1/scaleLimitMin ||
336 dtdy < 1/scaleLimitMin) {
337 ALOGE("%s: greater than max supported size dsdx=%f dtdy=%f \
338 scaleLimitMax=%f scaleLimitMin=%f", __FUNCTION__,dsdx,dtdy,
339 scaleLimitMax,1/scaleLimitMin);
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700340 return -1;
341 }
342 if(dsdx > copybitsMaxScale ||
343 dtdy > copybitsMaxScale ||
344 dsdx < 1/copybitsMinScale ||
345 dtdy < 1/copybitsMinScale){
346 // The requested scale is out of the range the hardware
347 // can support.
348 ALOGE("%s:%d::Need to scale twice dsdx=%f, dtdy=%f,copybitsMaxScale=%f,\
349 copybitsMinScale=%f,screen_w=%d,screen_h=%d \
350 src_crop_width=%d src_crop_height=%d",__FUNCTION__,__LINE__,
351 dsdx,dtdy,copybitsMaxScale,1/copybitsMinScale,screen_w,screen_h,
352 src_crop_width,src_crop_height);
353
354 //Driver makes width and height as even
355 //that may cause wrong calculation of the ratio
356 //in display and crop.Hence we make
357 //crop width and height as even.
358 src_crop_width = (src_crop_width/2)*2;
359 src_crop_height = (src_crop_height/2)*2;
360
361 int tmp_w = src_crop_width;
362 int tmp_h = src_crop_height;
363
364 if (dsdx > copybitsMaxScale || dtdy > copybitsMaxScale ){
365 tmp_w = src_crop_width*copybitsMaxScale;
366 tmp_h = src_crop_height*copybitsMaxScale;
367 }else if (dsdx < 1/copybitsMinScale ||dtdy < 1/copybitsMinScale ){
368 tmp_w = src_crop_width/copybitsMinScale;
369 tmp_h = src_crop_height/copybitsMinScale;
370 tmp_w = (tmp_w/2)*2;
371 tmp_h = (tmp_h/2)*2;
372 }
373 ALOGE("%s:%d::tmp_w = %d,tmp_h = %d",__FUNCTION__,__LINE__,tmp_w,tmp_h);
374
375 int usage = GRALLOC_USAGE_PRIVATE_MM_HEAP;
376
377 if (0 == alloc_buffer(&tmpHnd, tmp_w, tmp_h, fbHandle->format, usage)){
378 copybit_image_t tmp_dst;
379 copybit_rect_t tmp_rect;
380 tmp_dst.w = tmp_w;
381 tmp_dst.h = tmp_h;
382 tmp_dst.format = tmpHnd->format;
383 tmp_dst.handle = tmpHnd;
384 tmp_dst.horiz_padding = src.horiz_padding;
385 tmp_dst.vert_padding = src.vert_padding;
386 tmp_rect.l = 0;
387 tmp_rect.t = 0;
388 tmp_rect.r = tmp_dst.w;
389 tmp_rect.b = tmp_dst.h;
390 //create one clip region
391 hwc_rect tmp_hwc_rect = {0,0,tmp_rect.r,tmp_rect.b};
392 hwc_region_t tmp_hwc_reg = {1,(hwc_rect_t const*)&tmp_hwc_rect};
393 region_iterator tmp_it(tmp_hwc_reg);
394 copybit->set_parameter(copybit,COPYBIT_TRANSFORM,0);
Naseer Ahmed45a99602012-07-31 19:15:24 -0700395 //TODO: once, we are able to read layer alpha, update this
396 copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 255);
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700397 err = copybit->stretch(copybit,&tmp_dst, &src, &tmp_rect,
398 &srcRect, &tmp_it);
399 if(err < 0){
400 ALOGE("%s:%d::tmp copybit stretch failed",__FUNCTION__,
401 __LINE__);
402 if(tmpHnd)
403 free_buffer(tmpHnd);
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700404 return err;
405 }
406 // copy new src and src rect crop
407 src = tmp_dst;
408 srcRect = tmp_rect;
409 }
410 }
411 // Copybit region
412 hwc_region_t region = layer->visibleRegionScreen;
413 region_iterator copybitRegion(region);
414
415 copybit->set_parameter(copybit, COPYBIT_FRAMEBUFFER_WIDTH,
416 renderBuffer->width);
417 copybit->set_parameter(copybit, COPYBIT_FRAMEBUFFER_HEIGHT,
418 renderBuffer->height);
419 copybit->set_parameter(copybit, COPYBIT_TRANSFORM,
420 layer->transform);
Naseer Ahmed45a99602012-07-31 19:15:24 -0700421 //TODO: once, we are able to read layer alpha, update this
422 copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 255);
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800423 copybit->set_parameter(copybit, COPYBIT_BLEND_MODE,
424 layer->blending);
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700425 copybit->set_parameter(copybit, COPYBIT_DITHER,
426 (dst.format == HAL_PIXEL_FORMAT_RGB_565)?
427 COPYBIT_ENABLE : COPYBIT_DISABLE);
428 copybit->set_parameter(copybit, COPYBIT_BLIT_TO_FRAMEBUFFER,
429 COPYBIT_ENABLE);
430 err = copybit->stretch(copybit, &dst, &src, &dstRect, &srcRect,
431 &copybitRegion);
432 copybit->set_parameter(copybit, COPYBIT_BLIT_TO_FRAMEBUFFER,
433 COPYBIT_DISABLE);
434
435 if(tmpHnd)
436 free_buffer(tmpHnd);
437
438 if(err < 0)
439 ALOGE("%s: copybit stretch failed",__FUNCTION__);
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700440 return err;
441}
442
Naseer Ahmed5b6708a2012-08-02 13:46:08 -0700443void CopyBit::getLayerResolution(const hwc_layer_1_t* layer,
Naseer Ahmed45a99602012-07-31 19:15:24 -0700444 unsigned int& width, unsigned int& height)
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700445{
446 hwc_rect_t displayFrame = layer->displayFrame;
447
448 width = displayFrame.right - displayFrame.left;
449 height = displayFrame.bottom - displayFrame.top;
450}
451
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800452bool CopyBit::validateParams(hwc_context_t *ctx,
453 const hwc_display_contents_1_t *list) {
454 //Validate parameters
455 if (!ctx) {
456 ALOGE("%s:Invalid HWC context", __FUNCTION__);
457 return false;
458 } else if (!list) {
459 ALOGE("%s:Invalid HWC layer list", __FUNCTION__);
460 return false;
461 }
462 return true;
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700463}
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700464
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700465
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800466struct copybit_device_t* CopyBit::getCopyBitDevice() {
467 return mEngine;
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700468}
469
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800470CopyBit::CopyBit():mIsModeOn(false), mCopyBitDraw(false){
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700471 hw_module_t const *module;
472 if (hw_get_module(COPYBIT_HARDWARE_MODULE_ID, &module) == 0) {
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800473 if(copybit_open(module, &mEngine) < 0) {
474 ALOGE("FATAL ERROR: copybit open failed.");
475 }
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700476 } else {
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800477 ALOGE("FATAL ERROR: copybit hw module not found");
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700478 }
479}
Saurabh Shah661a58f2012-08-30 15:30:49 -0700480
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800481CopyBit::~CopyBit()
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700482{
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800483 if(mEngine)
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700484 {
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800485 copybit_close(mEngine);
486 mEngine = NULL;
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700487 }
488}
Naseer Ahmed31da0b12012-07-31 18:55:33 -0700489}; //namespace qhwc