hwc: Enable MDP rotation for GPU rendered RGB layers.

Use MDP rotator to rotate GPU rendered RGB layers buffers, if the
buffer is not intended for secure display.

Change-Id: Id756f3f1561a32a5d404c45ea8846b2b907af56b
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index c409db4..7334bcf 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -1113,22 +1113,24 @@
 bool isRotatorSupportedFormat(private_handle_t *hnd) {
     // Following rotator src formats are supported by mdp driver
     // TODO: Add more formats in future, if mdp driver adds support
-    switch(hnd->format) {
-        case HAL_PIXEL_FORMAT_RGBA_8888:
-        case HAL_PIXEL_FORMAT_RGB_565:
-        case HAL_PIXEL_FORMAT_RGB_888:
-        case HAL_PIXEL_FORMAT_BGRA_8888:
-            return true;
-        default:
-            return false;
+    if(hnd != NULL) {
+        switch(hnd->format) {
+            case HAL_PIXEL_FORMAT_RGBA_8888:
+            case HAL_PIXEL_FORMAT_RGB_565:
+            case HAL_PIXEL_FORMAT_RGB_888:
+            case HAL_PIXEL_FORMAT_BGRA_8888:
+                return true;
+            default:
+                return false;
+        }
     }
     return false;
 }
 
 bool isRotationDoable(hwc_context_t *ctx, private_handle_t *hnd) {
-    // Rotate layers, if it is YUV type or rendered by CPU and not
+    // Rotate layers, if it is not secure display buffer and not
     // for the MDP versions below MDP5
-    if((isCPURendered(hnd) && isRotatorSupportedFormat(hnd) &&
+    if((!isSecureDisplayBuffer(hnd) && isRotatorSupportedFormat(hnd) &&
         !ctx->mMDP.version < qdutils::MDSS_V5)
                    || isYuvBuffer(hnd)) {
         return true;