libgralloc: Add gralloc perform to create handle from a buffer

Change-Id: I11fb9add49f32cc5d518baf47cb61507474f6809
This commit is contained in:
Naseer Ahmed 2011-11-23 12:25:38 -08:00 committed by Linux Build Service Account
parent f79ec0f398
commit ba64a65af2
2 changed files with 13 additions and 17 deletions

View File

@ -52,6 +52,13 @@ enum {
GRALLOC_USAGE_PRIVATE_ION = 0x00020000,
};
enum {
/* Gralloc perform enums
*/
GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER = 0x080000001,
};
enum {
GPU_COMPOSITION,
C2D_COMPOSITION,

View File

@ -309,7 +309,6 @@ int gralloc_perform(struct gralloc_module_t const* module,
int res = -EINVAL;
va_list args;
va_start(args, operation);
#if 0
switch (operation) {
case GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER:
{
@ -317,6 +316,9 @@ int gralloc_perform(struct gralloc_module_t const* module,
size_t size = va_arg(args, size_t);
size_t offset = va_arg(args, size_t);
void* base = va_arg(args, void*);
int width = va_arg(args, int);
int height = va_arg(args, int);
int format = va_arg(args, int);
native_handle_t** handle = va_arg(args, native_handle_t**);
int memoryFlags = va_arg(args, int);
@ -346,31 +348,18 @@ int gralloc_perform(struct gralloc_module_t const* module,
hnd->size = size;
hnd->offset = offset;
hnd->base = intptr_t(base) + offset;
hnd->lockState = private_handle_t::LOCK_STATE_MAPPED;
hnd->gpuaddr = 0;
hnd->width = width;
hnd->height = height;
hnd->format = format;
*handle = (native_handle_t *)hnd;
res = 0;
break;
}
case GRALLOC_MODULE_PERFORM_UPDATE_BUFFER_HANDLE:
{
native_handle_t* handle = va_arg(args, native_handle_t*);
int w = va_arg(args, int);
int h = va_arg(args, int);
int f = va_arg(args, int);
private_handle_t* hnd = (private_handle_t*)handle;
hnd->width = w;
hnd->height = h;
if (hnd->format != f) {
hnd->format = f;
}
break;
}
default:
break;
}
#endif
va_end(args);
return res;
}