gralloc: Perform func to return stride and height

The custom stride and height can be set by video
decoder for smooth streaming. Return this in
perform so that graphics can use it

Change-Id: I44c814b2bae1f61d3ec5c36a22d1c6119542b10a
diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h
index 9f7c10b..b2714c5 100644
--- a/libgralloc/gralloc_priv.h
+++ b/libgralloc/gralloc_priv.h
@@ -79,6 +79,7 @@
     // 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 c3ae070..62a6ee5 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -364,6 +364,25 @@
                 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);