hwc: Configure MDP with updated content attributes of PTOR layers

Since there is no content underneath a PTOR layer, all overlapped
contents have been composed by Copybit on render buffer. So for a
PTOR layer, we can set blending to HWC_BLENDING_NONE and planeAlpha
to 0xFF. And the transform for the PTOR layer should be set to 0 to
avoid MDP flipping again.

Change-Id: I26fec26dcde4d9b0b62f94107a013d82074628b5
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 863c69e..162ee4f 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -907,6 +907,11 @@
     private_handle_t *renderBuf = ctx->mCopyBit[mDpy]->getCurrentRenderBuffer();
     Whf layerWhf[numPTORLayersFound]; // To store w,h,f of PTOR layers
 
+    // Store the blending mode, planeAlpha, and transform of PTOR layers
+    int32_t blending[numPTORLayersFound];
+    uint8_t planeAlpha[numPTORLayersFound];
+    uint32_t transform[numPTORLayersFound];
+
     for(int j = 0; j < numPTORLayersFound; j++) {
         int index =  ctx->mPtorInfo.layerIndex[j];
 
@@ -925,6 +930,14 @@
         hnd->height = renderBuf->height;
         hnd->format = renderBuf->format;
 
+        // Store & update blending mode, planeAlpha and transform of PTOR layer
+        blending[j] = layer->blending;
+        planeAlpha[j] = layer->planeAlpha;
+        transform[j] = layer->transform;
+        layer->blending = HWC_BLENDING_NONE;
+        layer->planeAlpha = 0xFF;
+        layer->transform = 0;
+
         // Remove overlap from crop & displayFrame of below layers
         for (int i = 0; i < index && index !=-1; i++) {
             layer = &list->hwLayers[i];
@@ -964,13 +977,17 @@
         layer->sourceCropf.bottom = (float)sourceCrop[i].bottom;
     }
 
-    // Restore w,h,f of PTOR layers
+    // Restore w,h,f, blending attributes, and transform of PTOR layers
     for (int i = 0; i < numPTORLayersFound; i++) {
         int idx = ctx->mPtorInfo.layerIndex[i];
+        hwc_layer_1_t* layer = &list->hwLayers[idx];
         private_handle_t *hnd = (private_handle_t *)list->hwLayers[idx].handle;
         hnd->width = layerWhf[i].w;
         hnd->height = layerWhf[i].h;
         hnd->format = layerWhf[i].format;
+        layer->blending = blending[i];
+        layer->planeAlpha = planeAlpha[i];
+        layer->transform = transform[i];
     }
 
     if (!result) {