sdm: Provide best mode support for hdmi drm device

DRM userconfig should be in w:h:fps:format.
FB userconfig should be vic mode.

1. Fix existing bugs in loop traversing to iterate through the mode list.
2. Fix best mode selection logic of preferring width over height.

CRs-Fixed: 2078126
Change-Id: Ia4d1621d11f5fcf17b33cfede56222e30bfd7032
diff --git a/sdm/libs/utils/debug.cpp b/sdm/libs/utils/debug.cpp
index 592be68..60ce0ac 100644
--- a/sdm/libs/utils/debug.cpp
+++ b/sdm/libs/utils/debug.cpp
@@ -47,11 +47,14 @@
   return value;
 }
 
-int Debug::GetHDMIResolution() {
-  int value = 0;
-  debug_.debug_handler_->GetProperty("hw.hdmi.resolution", &value);
+bool Debug::GetExternalResolution(char *value) {
+  uint32_t retval = 0;
+  debug_.debug_handler_->GetProperty("hw.hdmi.resolution", value);
+  if (value[0]) {
+    retval = 1;
+  }
 
-  return value;
+  return retval;
 }
 
 void Debug::GetIdleTimeoutMs(uint32_t *active_ms, uint32_t *inactive_ms) {