android: add helper to convert buffer_handle_t to gralloc_handle_t ptr

Clients frequently need to convert a buffer_handle_t (aka
native_handle_t *) to a gralloc_handle_t ptr. This is a simple cast, but
add an inline function to do the conversion.

Reviewed-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
main
Rob Herring 2018-02-14 17:05:42 -06:00
parent 652bcea5a6
commit 86c62e49c8
1 changed files with 5 additions and 0 deletions

View File

@ -76,6 +76,11 @@ struct gralloc_handle_t {
((sizeof(struct gralloc_handle_t) - sizeof(native_handle_t))/sizeof(int)) \
- GRALLOC_HANDLE_NUM_FDS)
static inline struct gralloc_handle_t *gralloc_handle(buffer_handle_t handle)
{
return (struct gralloc_handle_t *)handle;
}
/**
* Create a buffer handle.
*/