gralloc: Perform function to return custom stride
The custom stride can be set by video for smooth streaming.
Return this in perform so that graphics can use it.
Change-Id: I798fc0894b8d9662e93769a53a540cb61b527a44
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 30754dd..ca0db00 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -332,6 +332,21 @@
*stride = AdrenoMemInfo::getInstance().getStride(width, format);
res = 0;
} break;
+ case GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_FROM_HANDLE:
+ {
+ private_handle_t* hnd = va_arg(args, private_handle_t*);
+ int *stride = 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;
+ } else {
+ *stride = hnd->width;
+ }
+ res = 0;
+ } break;
default:
break;
}