am e3c65ac1: am f4a09d74: am 87ea1dfa: fix[2222341] Soft reset while going back from camcorder settings

Merge commit 'e3c65ac1403b0221c69b4f1c5023b781a5ca4cad'

* commit 'e3c65ac1403b0221c69b4f1c5023b781a5ca4cad':
  fix[2222341] Soft reset while going back from camcorder settings
This commit is contained in:
Mathias Agopian 2009-11-01 21:55:12 -08:00 committed by Android Git Automerger
commit 3a7373acb2
2 changed files with 40 additions and 0 deletions

View File

@ -77,6 +77,9 @@ extern int gralloc_register_buffer(gralloc_module_t const* module,
extern int gralloc_unregister_buffer(gralloc_module_t const* module,
buffer_handle_t handle);
extern int gralloc_perform(struct gralloc_module_t const* module,
int operation, ... );
/*****************************************************************************/
static struct hw_module_methods_t gralloc_module_methods = {
@ -98,6 +101,7 @@ struct private_module_t HAL_MODULE_INFO_SYM = {
unregisterBuffer: gralloc_unregister_buffer,
lock: gralloc_lock,
unlock: gralloc_unlock,
perform: gralloc_perform,
},
framebuffer: 0,
flags: 0,

View File

@ -19,6 +19,7 @@
#include <pthread.h>
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
#include <sys/mman.h>
#include <sys/stat.h>
@ -284,3 +285,38 @@ int gralloc_unlock(gralloc_module_t const* module,
return 0;
}
/*****************************************************************************/
int gralloc_perform(struct gralloc_module_t const* module,
int operation, ... )
{
int res = -EINVAL;
va_list args;
va_start(args, operation);
switch (operation) {
case GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER: {
int fd = va_arg(args, int);
size_t size = va_arg(args, size_t);
size_t offset = va_arg(args, size_t);
void* base = va_arg(args, void*);
native_handle_t** handle = va_arg(args, native_handle_t**);
private_handle_t* hnd = (private_handle_t*)native_handle_create(
private_handle_t::sNumFds, private_handle_t::sNumInts);
hnd->magic = private_handle_t::sMagic;
hnd->fd = fd;
hnd->flags = private_handle_t::PRIV_FLAGS_USES_PMEM;
hnd->size = size;
hnd->offset = offset;
hnd->base = intptr_t(base) + offset;
hnd->lockState = private_handle_t::LOCK_STATE_MAPPED;
*handle = (native_handle_t *)hnd;
res = 0;
break;
}
}
va_end(args);
return res;
}