hwc: virtual display: Use outbuf handle width to configure xres

Use outbuf handle width to configure display xres, since that would
have the necessary alignment. The outbuf is guaranteed to be valid
by the framework during hwc_prepare.
We use the framebuffer layer's display frame to obtain the actual
width.
For example, the actual width could be 720 but the aligned width
would be 736.

Bug: 11430248
Change-Id: Ide221b0c7ada5eaedc7b0355c37e536e64c39f65
diff --git a/msm8974/libhwcomposer/hwc.cpp b/msm8974/libhwcomposer/hwc.cpp
index dc1f931..eed6cff 100644
--- a/msm8974/libhwcomposer/hwc.cpp
+++ b/msm8974/libhwcomposer/hwc.cpp
@@ -213,7 +213,7 @@
     hwc_context_t* ctx = (hwc_context_t*)(dev);
     const int dpy = HWC_DISPLAY_VIRTUAL;
 
-    if (list && list->numHwLayers > 1) {
+    if (list && list->outbuf && list->numHwLayers > 1) {
         reset_layer_prop(ctx, dpy, list->numHwLayers - 1);
         uint32_t last = list->numHwLayers - 1;
         hwc_layer_1_t *fbLayer = &list->hwLayers[last];
@@ -228,7 +228,8 @@
         }
 
         ctx->dpyAttr[dpy].fd = Writeback::getInstance()->getFbFd();
-        Writeback::getInstance()->configureDpyInfo(fbWidth, fbHeight);
+        private_handle_t *ohnd = (private_handle_t *)list->outbuf;
+        Writeback::getInstance()->configureDpyInfo(ohnd->width, ohnd->height);
         setListStats(ctx, list, dpy);
 
         if(ctx->mMDPComp[dpy]->prepare(ctx, list) < 0) {