DO NOT MERGE: drm_hwcomposer: On error, free active composition am: b4cf01b8ea
am: 7ca7746261

Change-Id: Ibf56c0cf4d74bc186e86acaadc5cc40841cd797c
diff --git a/drmconnector.cpp b/drmconnector.cpp
index 8f9ad49..ccb38e2 100644
--- a/drmconnector.cpp
+++ b/drmconnector.cpp
@@ -69,7 +69,7 @@
 
 bool DrmConnector::built_in() const {
   return type_ == DRM_MODE_CONNECTOR_LVDS || type_ == DRM_MODE_CONNECTOR_eDP ||
-         type_ == DRM_MODE_CONNECTOR_DSI;
+         type_ == DRM_MODE_CONNECTOR_DSI || type_ == DRM_MODE_CONNECTOR_VIRTUAL;
 }
 
 int DrmConnector::UpdateModes() {
diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
index 279d5a6..92323b6 100644
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -1061,7 +1061,7 @@
   // Make sure there is more than one layer to squash.
   size_t src_planes_with_layer = std::count_if(
       src_planes.begin(), src_planes.end(), [](DrmCompositionPlane &p) {
-        return p.type() == DrmCompositionPlane::Type::kLayer;
+        return p.type() != DrmCompositionPlane::Type::kDisable;
       });
   if (src_planes_with_layer <= 1)
     return -EALREADY;
diff --git a/platformdrmgeneric.cpp b/platformdrmgeneric.cpp
index e94bf26..90ba0e2 100644
--- a/platformdrmgeneric.cpp
+++ b/platformdrmgeneric.cpp
@@ -25,8 +25,6 @@
 #include <xf86drmMode.h>
 
 #include <cutils/log.h>
-#include <gralloc_drm.h>
-#include <gralloc_drm_priv.h>
 #include <gralloc_drm_handle.h>
 #include <hardware/gralloc.h>
 
@@ -90,12 +88,6 @@
   if (!gr_handle)
     return -EINVAL;
 
-  struct gralloc_drm_bo_t *gralloc_bo = gr_handle->data;
-  if (!gralloc_bo) {
-    ALOGE("Could not get drm bo from handle");
-    return -EINVAL;
-  }
-
   uint32_t gem_handle;
   int ret = drmPrimeFDToHandle(drm_->fd(), gr_handle->prime_fd, &gem_handle);
   if (ret) {