hwc: Return failure from hwc_device_open when fb open fails

- When fb open fails during hwc initialization, it should be
  flagged as a fatal error and HAL should return error.
- Without this, the SF would make calls to HWC that would fail,
  and display being blank.

Change-Id: I20f08bdcb283d4805449c74a8214b871c2f1c80b
diff --git a/libhwcomposer/hwc_uevents.cpp b/libhwcomposer/hwc_uevents.cpp
index 4d94647..6a70d06 100644
--- a/libhwcomposer/hwc_uevents.cpp
+++ b/libhwcomposer/hwc_uevents.cpp
@@ -202,7 +202,15 @@
                         "uevent thread", __FUNCTION__);
                 ctx->mWfdSyncLock.unlock();
             }
-            ctx->mHDMIDisplay->configure();
+            // If FB open fails ignore this hotplug event
+            int error = ctx->mHDMIDisplay->configure();
+            if (error < 0) {
+                ALOGE("%s: Open Framebuffer for dpy = %d", __FUNCTION__, dpy);
+                ctx->mDrawLock.lock();
+                ctx->dpyAttr[dpy].isConfiguring = false;
+                ctx->mDrawLock.unlock();
+                break;
+            }
             ctx->mHDMIDisplay->activateDisplay();
 
             ctx->mDrawLock.lock();