drm_hwcomposer: Use atomic modeset to set crtc timing

Use the new drm blob ioctl and atomic modeset properties to
do atomic modesetting, as opposed to the old setCrtc call.

This allows us to set timing as soon as the system layer requests
a new active config, as opposed to delaying it until we have
an fb. Aside from reducing complexity, this should help with
event control requests as we'll be able to service them with
hw vblanks instead of synthesized sleeps.

Change-Id: I9c80d44f52f52881a3a25b2ae518973d468bc110
Signed-off-by: Sean Paul <seanpaul@chromium.org>
diff --git a/drmconnector.cpp b/drmconnector.cpp
index 44864b9..7e9b0c1 100644
--- a/drmconnector.cpp
+++ b/drmconnector.cpp
@@ -50,6 +50,11 @@
     ALOGE("Could not get DPMS property\n");
     return ret;
   }
+  ret = drm_->GetConnectorProperty(*this, "CRTC_ID", &crtc_id_property_);
+  if (ret) {
+    ALOGE("Could not get CRTC_ID property\n");
+    return ret;
+  }
   return 0;
 }
 
@@ -105,21 +110,18 @@
   return active_mode_;
 }
 
-int DrmConnector::set_active_mode(uint32_t mode_id) {
-  for (std::vector<DrmMode>::const_iterator iter = modes_.begin();
-       iter != modes_.end(); ++iter) {
-    if (iter->id() == mode_id) {
-      active_mode_ = *iter;
-      return 0;
-    }
-  }
-  return -ENOENT;
+void DrmConnector::set_active_mode(const DrmMode &mode) {
+  active_mode_ = mode;
 }
 
 const DrmProperty &DrmConnector::dpms_property() const {
   return dpms_property_;
 }
 
+const DrmProperty &DrmConnector::crtc_id_property() const {
+  return crtc_id_property_;
+}
+
 DrmConnector::ModeIter DrmConnector::begin_modes() const {
   return modes_.begin();
 }