/*****************************************************************************/
-int grallocMap(gralloc_module_t const* module, private_handle_t *hnd)
-{
- return gralloc_map(module, hnd);
-}
-
-int grallocUnmap(gralloc_module_t const* module, private_handle_t *hnd)
-{
- return gralloc_unmap(module, hnd);
-}
-
int getIonFd(gralloc_module_t const *module)
{
private_module_t* m = const_cast<private_module_t*>(reinterpret_cast<const private_module_t*>(module));
int gralloc_register_buffer(gralloc_module_t const* module,
buffer_handle_t handle)
{
- int err;
if (private_handle_t::validate(handle) < 0)
return -EINVAL;
- err = gralloc_map(module, handle);
-
private_handle_t* hnd = (private_handle_t*)handle;
ALOGV("%s: base %p %d %d %d %d\n", __func__, hnd->base, hnd->size,
hnd->width, hnd->height, hnd->stride);
ALOGE("error importing handle2 %d %x\n", hnd->fd2, hnd->format);
}
- return err;
+ return ret;
}
int gralloc_unregister_buffer(gralloc_module_t const* module,
return -EINVAL;
private_handle_t* hnd = (private_handle_t*)handle;
+ if (!hnd->base)
+ gralloc_map(module, hnd);
*vaddr = (void*)hnd->base;
return 0;
}
{
// we're done with a software buffer. nothing to do in this
// implementation. typically this is used to flush the data cache.
+ private_handle_t* hnd = (private_handle_t*)handle;
+ ion_sync_fd(getIonFd(module), hnd->fd);
+ if (hnd->fd1 >= 0)
+ ion_sync_fd(getIonFd(module), hnd->fd1);
+ if (hnd->fd2 >= 0)
+ ion_sync_fd(getIonFd(module), hnd->fd2);
if (private_handle_t::validate(handle) < 0)
return -EINVAL;