diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h index 9f7c10b0..b2714c5b 100644 --- a/libgralloc/gralloc_priv.h +++ b/libgralloc/gralloc_priv.h @@ -79,6 +79,7 @@ enum { // libraries GRALLOC_MODULE_PERFORM_GET_STRIDE, GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_FROM_HANDLE, + GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_AND_HEIGHT_FROM_HANDLE, GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES, GRALLOC_MODULE_PERFORM_GET_COLOR_SPACE_FROM_HANDLE, }; diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp index d475fb82..e415b3cc 100644 --- a/libgralloc/mapper.cpp +++ b/libgralloc/mapper.cpp @@ -400,6 +400,25 @@ int gralloc_perform(struct gralloc_module_t const* module, res = 0; } break; + case GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_AND_HEIGHT_FROM_HANDLE: + { + private_handle_t* hnd = va_arg(args, private_handle_t*); + int *stride = va_arg(args, int *); + int *height = va_arg(args, int *); + if (private_handle_t::validate(hnd)) { + return res; + } + MetaData_t *metadata = (MetaData_t *)hnd->base_metadata; + if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) { + *stride = metadata->bufferDim.sliceWidth; + *height = metadata->bufferDim.sliceHeight; + } else { + *stride = hnd->width; + *height = hnd->height; + } + res = 0; + } break; + case GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES: { int width = va_arg(args, int);