blob: 338f9db636cc2184a6e4a75fe1e6c39b3d4cacdd [file] [log] [blame]
Iliyan Malchev202a77d2012-06-11 14:41:12 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
Shuzhen Wangc502c872014-01-28 16:10:42 -08003 * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
Iliyan Malchev202a77d2012-06-11 14:41:12 -07004 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#include <limits.h>
19#include <errno.h>
20#include <pthread.h>
21#include <unistd.h>
22#include <string.h>
23#include <stdarg.h>
24
25#include <sys/mman.h>
26#include <sys/stat.h>
27#include <sys/types.h>
28#include <sys/ioctl.h>
29#include <linux/ashmem.h>
30
31#include <cutils/log.h>
32#include <cutils/atomic.h>
33#include <cutils/ashmem.h>
34
35#include <hardware/hardware.h>
36#include <hardware/gralloc.h>
Iliyan Malchev202a77d2012-06-11 14:41:12 -070037
38#include "gralloc_priv.h"
39#include "gr.h"
40#include "alloc_controller.h"
41#include "memalloc.h"
Ramkumar Radhakrishnan47573e22012-11-07 11:36:41 -080042#include <qdMetaData.h>
Iliyan Malchev202a77d2012-06-11 14:41:12 -070043
44using namespace gralloc;
Iliyan Malchev202a77d2012-06-11 14:41:12 -070045/*****************************************************************************/
46
47// Return the type of allocator -
48// these are used for mapping/unmapping
Naseer Ahmed01d3fd32012-07-14 21:08:13 -070049static IMemAlloc* getAllocator(int flags)
Iliyan Malchev202a77d2012-06-11 14:41:12 -070050{
Naseer Ahmed01d3fd32012-07-14 21:08:13 -070051 IMemAlloc* memalloc;
52 IAllocController* alloc_ctrl = IAllocController::getInstance();
Iliyan Malchev202a77d2012-06-11 14:41:12 -070053 memalloc = alloc_ctrl->getAllocator(flags);
54 return memalloc;
55}
56
57static int gralloc_map(gralloc_module_t const* module,
Naseer Ahmed34d33bc2013-05-08 12:28:37 -040058 buffer_handle_t handle)
Iliyan Malchev202a77d2012-06-11 14:41:12 -070059{
Arun Kumar K.R6c85f052014-01-21 21:47:41 -080060 if(!module)
61 return -EINVAL;
62
Iliyan Malchev202a77d2012-06-11 14:41:12 -070063 private_handle_t* hnd = (private_handle_t*)handle;
64 void *mappedAddress;
65 if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER) &&
66 !(hnd->flags & private_handle_t::PRIV_FLAGS_SECURE_BUFFER)) {
67 size_t size = hnd->size;
Naseer Ahmed01d3fd32012-07-14 21:08:13 -070068 IMemAlloc* memalloc = getAllocator(hnd->flags) ;
Iliyan Malchev202a77d2012-06-11 14:41:12 -070069 int err = memalloc->map_buffer(&mappedAddress, size,
Naseer Ahmed29a26812012-06-14 00:56:20 -070070 hnd->offset, hnd->fd);
Ramkumar Radhakrishnan47573e22012-11-07 11:36:41 -080071 if(err || mappedAddress == MAP_FAILED) {
Iliyan Malchev202a77d2012-06-11 14:41:12 -070072 ALOGE("Could not mmap handle %p, fd=%d (%s)",
Naseer Ahmed29a26812012-06-14 00:56:20 -070073 handle, hnd->fd, strerror(errno));
Iliyan Malchev202a77d2012-06-11 14:41:12 -070074 hnd->base = 0;
75 return -errno;
76 }
77
Iliyan Malchev202a77d2012-06-11 14:41:12 -070078 hnd->base = intptr_t(mappedAddress) + hnd->offset;
Ramkumar Radhakrishnan47573e22012-11-07 11:36:41 -080079 mappedAddress = MAP_FAILED;
80 size = ROUND_UP_PAGESIZE(sizeof(MetaData_t));
81 err = memalloc->map_buffer(&mappedAddress, size,
82 hnd->offset_metadata, hnd->fd_metadata);
83 if(err || mappedAddress == MAP_FAILED) {
84 ALOGE("Could not mmap handle %p, fd=%d (%s)",
85 handle, hnd->fd_metadata, strerror(errno));
86 hnd->base_metadata = 0;
87 return -errno;
88 }
89 hnd->base_metadata = intptr_t(mappedAddress) + hnd->offset_metadata;
Iliyan Malchev202a77d2012-06-11 14:41:12 -070090 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -070091 return 0;
92}
93
94static int gralloc_unmap(gralloc_module_t const* module,
Naseer Ahmed29a26812012-06-14 00:56:20 -070095 buffer_handle_t handle)
Iliyan Malchev202a77d2012-06-11 14:41:12 -070096{
Arun Kumar K.R6c85f052014-01-21 21:47:41 -080097 if(!module)
98 return -EINVAL;
99
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700100 private_handle_t* hnd = (private_handle_t*)handle;
101 if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) {
102 int err = -EINVAL;
103 void* base = (void*)hnd->base;
104 size_t size = hnd->size;
Naseer Ahmed01d3fd32012-07-14 21:08:13 -0700105 IMemAlloc* memalloc = getAllocator(hnd->flags) ;
Ramkumar Radhakrishnan47573e22012-11-07 11:36:41 -0800106 if(memalloc != NULL) {
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700107 err = memalloc->unmap_buffer(base, size, hnd->offset);
Ramkumar Radhakrishnan47573e22012-11-07 11:36:41 -0800108 if (err) {
109 ALOGE("Could not unmap memory at address %p", base);
110 }
111 base = (void*)hnd->base_metadata;
112 size = ROUND_UP_PAGESIZE(sizeof(MetaData_t));
113 err = memalloc->unmap_buffer(base, size, hnd->offset_metadata);
114 if (err) {
115 ALOGE("Could not unmap memory at address %p", base);
116 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700117 }
118 }
Ramkumar Radhakrishnan7bf31c32013-01-28 22:51:51 -0800119 /* need to initialize the pointer to NULL otherwise unmapping for that
120 * buffer happens twice which leads to crash */
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700121 hnd->base = 0;
Ramkumar Radhakrishnan7bf31c32013-01-28 22:51:51 -0800122 hnd->base_metadata = 0;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700123 return 0;
124}
125
126/*****************************************************************************/
127
128static pthread_mutex_t sMapLock = PTHREAD_MUTEX_INITIALIZER;
129
130/*****************************************************************************/
131
132int gralloc_register_buffer(gralloc_module_t const* module,
Naseer Ahmed29a26812012-06-14 00:56:20 -0700133 buffer_handle_t handle)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700134{
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800135 if (!module || private_handle_t::validate(handle) < 0)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700136 return -EINVAL;
137
138 // In this implementation, we don't need to do anything here
139
140 /* NOTE: we need to initialize the buffer as not mapped/not locked
141 * because it shouldn't when this function is called the first time
142 * in a new process. Ideally these flags shouldn't be part of the
143 * handle, but instead maintained in the kernel or at least
144 * out-of-line
145 */
146
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700147 private_handle_t* hnd = (private_handle_t*)handle;
Kinjal Bhavsar139e1622012-09-10 12:35:11 -0700148 hnd->base = 0;
Ramkumar Radhakrishnan7bf31c32013-01-28 22:51:51 -0800149 hnd->base_metadata = 0;
Naseer Ahmed34d33bc2013-05-08 12:28:37 -0400150 int err = gralloc_map(module, handle);
Kinjal Bhavsar139e1622012-09-10 12:35:11 -0700151 if (err) {
152 ALOGE("%s: gralloc_map failed", __FUNCTION__);
153 return err;
154 }
155
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700156 return 0;
157}
158
159int gralloc_unregister_buffer(gralloc_module_t const* module,
Naseer Ahmed29a26812012-06-14 00:56:20 -0700160 buffer_handle_t handle)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700161{
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800162 if (!module || private_handle_t::validate(handle) < 0)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700163 return -EINVAL;
164
165 /*
166 * If the buffer has been mapped during a lock operation, it's time
167 * to un-map it. It's an error to be here with a locked buffer.
168 * NOTE: the framebuffer is handled differently and is never unmapped.
169 */
170
171 private_handle_t* hnd = (private_handle_t*)handle;
172
Kinjal Bhavsar139e1622012-09-10 12:35:11 -0700173 if (hnd->base != 0) {
174 gralloc_unmap(module, handle);
175 }
176 hnd->base = 0;
Ramkumar Radhakrishnan7bf31c32013-01-28 22:51:51 -0800177 hnd->base_metadata = 0;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700178 return 0;
179}
180
181int terminateBuffer(gralloc_module_t const* module,
Naseer Ahmed29a26812012-06-14 00:56:20 -0700182 private_handle_t* hnd)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700183{
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800184 if(!module)
185 return -EINVAL;
186
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700187 /*
188 * If the buffer has been mapped during a lock operation, it's time
189 * to un-map it. It's an error to be here with a locked buffer.
190 */
191
192 if (hnd->base != 0) {
193 // this buffer was mapped, unmap it now
194 if (hnd->flags & (private_handle_t::PRIV_FLAGS_USES_PMEM |
195 private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP |
196 private_handle_t::PRIV_FLAGS_USES_ASHMEM |
197 private_handle_t::PRIV_FLAGS_USES_ION)) {
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700198 gralloc_unmap(module, hnd);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700199 } else {
Naseer Ahmed29a26812012-06-14 00:56:20 -0700200 ALOGE("terminateBuffer: unmapping a non pmem/ashmem buffer flags = 0x%x",
201 hnd->flags);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700202 gralloc_unmap(module, hnd);
203 }
204 }
205
206 return 0;
207}
208
Naseer Ahmed34d33bc2013-05-08 12:28:37 -0400209static int gralloc_map_and_invalidate (gralloc_module_t const* module,
210 buffer_handle_t handle, int usage)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700211{
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800212 if (!module || private_handle_t::validate(handle) < 0)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700213 return -EINVAL;
214
215 int err = 0;
216 private_handle_t* hnd = (private_handle_t*)handle;
217 if (usage & (GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK)) {
218 if (hnd->base == 0) {
219 // we need to map for real
220 pthread_mutex_t* const lock = &sMapLock;
221 pthread_mutex_lock(lock);
Naseer Ahmed34d33bc2013-05-08 12:28:37 -0400222 err = gralloc_map(module, handle);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700223 pthread_mutex_unlock(lock);
224 }
Naseer Ahmedec147982013-06-14 17:06:46 -0400225 if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) {
226 //Invalidate if reading in software. No need to do this for the
227 //metadata buffer as it is only read/written in software.
228 IMemAlloc* memalloc = getAllocator(hnd->flags) ;
229 err = memalloc->clean_buffer((void*)hnd->base,
230 hnd->size, hnd->offset, hnd->fd,
231 CACHE_INVALIDATE);
232 if (usage & GRALLOC_USAGE_SW_WRITE_MASK) {
233 // Mark the buffer to be flushed after cpu read/write
234 hnd->flags |= private_handle_t::PRIV_FLAGS_NEEDS_FLUSH;
235 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700236 }
Naseer Ahmedaeab91f2013-03-20 21:01:19 -0400237 } else {
238 hnd->flags |= private_handle_t::PRIV_FLAGS_DO_NOT_FLUSH;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700239 }
240 return err;
241}
242
Naseer Ahmed34d33bc2013-05-08 12:28:37 -0400243int gralloc_lock(gralloc_module_t const* module,
244 buffer_handle_t handle, int usage,
245 int /*l*/, int /*t*/, int /*w*/, int /*h*/,
246 void** vaddr)
247{
248 private_handle_t* hnd = (private_handle_t*)handle;
249 int err = gralloc_map_and_invalidate(module, handle, usage);
250 if(!err)
251 *vaddr = (void*)hnd->base;
252 return err;
253}
254
255int gralloc_lock_ycbcr(gralloc_module_t const* module,
256 buffer_handle_t handle, int usage,
257 int /*l*/, int /*t*/, int /*w*/, int /*h*/,
258 struct android_ycbcr *ycbcr)
259{
260 private_handle_t* hnd = (private_handle_t*)handle;
261 int err = gralloc_map_and_invalidate(module, handle, usage);
Naseer Ahmedb29fdfd2014-04-08 20:23:47 -0400262 if(!err)
263 err = getYUVPlaneInfo(hnd, ycbcr);
Naseer Ahmed34d33bc2013-05-08 12:28:37 -0400264 return err;
265}
266
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700267int gralloc_unlock(gralloc_module_t const* module,
Naseer Ahmed29a26812012-06-14 00:56:20 -0700268 buffer_handle_t handle)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700269{
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800270 if (!module || private_handle_t::validate(handle) < 0)
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700271 return -EINVAL;
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800272
Naseer Ahmedaeab91f2013-03-20 21:01:19 -0400273 int err = 0;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700274 private_handle_t* hnd = (private_handle_t*)handle;
275
Naseer Ahmedec147982013-06-14 17:06:46 -0400276 if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) {
Naseer Ahmed69662ac2013-08-28 13:16:48 -0400277 IMemAlloc* memalloc = getAllocator(hnd->flags);
Naseer Ahmedec147982013-06-14 17:06:46 -0400278 if (hnd->flags & private_handle_t::PRIV_FLAGS_NEEDS_FLUSH) {
279 err = memalloc->clean_buffer((void*)hnd->base,
280 hnd->size, hnd->offset, hnd->fd,
281 CACHE_CLEAN_AND_INVALIDATE);
282 hnd->flags &= ~private_handle_t::PRIV_FLAGS_NEEDS_FLUSH;
283 } else if(hnd->flags & private_handle_t::PRIV_FLAGS_DO_NOT_FLUSH) {
284 hnd->flags &= ~private_handle_t::PRIV_FLAGS_DO_NOT_FLUSH;
285 } else {
286 //Probably a round about way to do this, but this avoids adding new
287 //flags
288 err = memalloc->clean_buffer((void*)hnd->base,
289 hnd->size, hnd->offset, hnd->fd,
290 CACHE_INVALIDATE);
291 }
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700292 }
293
Naseer Ahmedaeab91f2013-03-20 21:01:19 -0400294 return err;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700295}
296
297/*****************************************************************************/
298
299int gralloc_perform(struct gralloc_module_t const* module,
Naseer Ahmed29a26812012-06-14 00:56:20 -0700300 int operation, ... )
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700301{
302 int res = -EINVAL;
303 va_list args;
Arun Kumar K.R6c85f052014-01-21 21:47:41 -0800304 if(!module)
305 return res;
306
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700307 va_start(args, operation);
308 switch (operation) {
309 case GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER:
310 {
311 int fd = va_arg(args, int);
312 size_t size = va_arg(args, size_t);
313 size_t offset = va_arg(args, size_t);
314 void* base = va_arg(args, void*);
315 int width = va_arg(args, int);
316 int height = va_arg(args, int);
317 int format = va_arg(args, int);
318
319 native_handle_t** handle = va_arg(args, native_handle_t**);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700320 private_handle_t* hnd = (private_handle_t*)native_handle_create(
Naseer Ahmed29a26812012-06-14 00:56:20 -0700321 private_handle_t::sNumFds, private_handle_t::sNumInts);
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700322 hnd->magic = private_handle_t::sMagic;
323 hnd->fd = fd;
Naseer Ahmed01d3fd32012-07-14 21:08:13 -0700324 hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION;
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700325 hnd->size = size;
326 hnd->offset = offset;
327 hnd->base = intptr_t(base) + offset;
328 hnd->gpuaddr = 0;
329 hnd->width = width;
330 hnd->height = height;
331 hnd->format = format;
332 *handle = (native_handle_t *)hnd;
333 res = 0;
334 break;
335
336 }
Naseer Ahmed74214722013-02-09 08:11:36 -0500337#ifdef QCOM_BSP
Ramkumar Radhakrishnan935cb682012-11-07 16:43:38 -0800338 case GRALLOC_MODULE_PERFORM_UPDATE_BUFFER_GEOMETRY:
339 {
340 int width = va_arg(args, int);
341 int height = va_arg(args, int);
342 int format = va_arg(args, int);
343 private_handle_t* hnd = va_arg(args, private_handle_t*);
344 if (private_handle_t::validate(hnd)) {
345 return res;
346 }
347 hnd->width = width;
348 hnd->height = height;
349 hnd->format = format;
350 res = 0;
351 }
352 break;
Naseer Ahmedc0593ea2013-03-18 11:46:24 -0400353#endif
Naomi Luisa44100c2013-02-08 12:42:03 -0800354 case GRALLOC_MODULE_PERFORM_GET_STRIDE:
355 {
356 int width = va_arg(args, int);
357 int format = va_arg(args, int);
358 int *stride = va_arg(args, int *);
Ramkumar Radhakrishnan473f4082013-11-04 14:29:18 -0800359 int alignedw = 0, alignedh = 0;
360 AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(width,
Manoj Kumar AVM8a220812013-10-10 11:46:06 -0700361 0, format, false, alignedw, alignedh);
Ramkumar Radhakrishnan473f4082013-11-04 14:29:18 -0800362 *stride = alignedw;
Naomi Luisa44100c2013-02-08 12:42:03 -0800363 res = 0;
364 } break;
Manoj Kumar AVM8a220812013-10-10 11:46:06 -0700365
Naseer Ahmeda978f952013-09-26 14:36:28 -0400366 case GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_FROM_HANDLE:
367 {
368 private_handle_t* hnd = va_arg(args, private_handle_t*);
369 int *stride = va_arg(args, int *);
370 if (private_handle_t::validate(hnd)) {
371 return res;
372 }
373 MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
374 if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
375 *stride = metadata->bufferDim.sliceWidth;
376 } else {
377 *stride = hnd->width;
378 }
379 res = 0;
380 } break;
Manoj Kumar AVM8a220812013-10-10 11:46:06 -0700381
Raj Kamal3d01d8d2014-03-04 05:25:33 +0530382 case GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_AND_HEIGHT_FROM_HANDLE:
383 {
384 private_handle_t* hnd = va_arg(args, private_handle_t*);
385 int *stride = va_arg(args, int *);
386 int *height = va_arg(args, int *);
387 if (private_handle_t::validate(hnd)) {
388 return res;
389 }
390 MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
391 if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
392 *stride = metadata->bufferDim.sliceWidth;
393 *height = metadata->bufferDim.sliceHeight;
394 } else {
395 *stride = hnd->width;
396 *height = hnd->height;
397 }
398 res = 0;
399 } break;
400
Manoj Kumar AVM8a220812013-10-10 11:46:06 -0700401 case GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES:
402 {
403 int width = va_arg(args, int);
404 int height = va_arg(args, int);
405 int format = va_arg(args, int);
406 int usage = va_arg(args, int);
407 int *alignedWidth = va_arg(args, int *);
408 int *alignedHeight = va_arg(args, int *);
409 int *tileEnabled = va_arg(args,int *);
410 *tileEnabled = isMacroTileEnabled(format, usage);
411 AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(width,
412 height, format, *tileEnabled, *alignedWidth,
413 *alignedHeight);
414 res = 0;
415 } break;
416
Shuzhen Wangc502c872014-01-28 16:10:42 -0800417 case GRALLOC_MODULE_PERFORM_GET_COLOR_SPACE_FROM_HANDLE:
418 {
419 private_handle_t* hnd = va_arg(args, private_handle_t*);
420 int *color_space = va_arg(args, int *);
421 if (private_handle_t::validate(hnd)) {
422 return res;
423 }
424 MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
425 if(metadata && metadata->operation & UPDATE_COLOR_SPACE) {
426 *color_space = metadata->colorSpace;
427 res = 0;
428 }
429 } break;
Naseer Ahmedb29fdfd2014-04-08 20:23:47 -0400430 case GRALLOC_MODULE_PERFORM_GET_YUV_PLANE_INFO:
431 {
432 private_handle_t* hnd = va_arg(args, private_handle_t*);
433 android_ycbcr* ycbcr = va_arg(args, struct android_ycbcr *);
Naseer Ahmedf5ff33a2014-04-30 15:30:39 -0400434 if (!private_handle_t::validate(hnd)) {
Naseer Ahmedb29fdfd2014-04-08 20:23:47 -0400435 res = getYUVPlaneInfo(hnd, ycbcr);
436 }
437 } break;
438
Iliyan Malchev202a77d2012-06-11 14:41:12 -0700439 default:
440 break;
441 }
442 va_end(args);
443 return res;
444}