sdm: Implement GetFirstDisplayInterfaceType API
CRs-Fixed: 3306578
Change-Id: I4f194001ec0e02d3a07af346b4e3a606681fbc26
diff --git a/sdm/libs/dal/hw_info_drm.cpp b/sdm/libs/dal/hw_info_drm.cpp
index cd982ae..573b0b7 100644
--- a/sdm/libs/dal/hw_info_drm.cpp
+++ b/sdm/libs/dal/hw_info_drm.cpp
@@ -32,7 +32,7 @@
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
-* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
@@ -893,8 +893,24 @@
}
DisplayError HWInfoDRM::GetFirstDisplayInterfaceType(HWDisplayInterfaceInfo *hw_disp_info) {
- hw_disp_info->type = kBuiltIn;
- hw_disp_info->is_connected = true;
+ HWDisplaysInfo hw_displays_info = {};
+
+ DisplayError error = GetDisplaysStatus(&hw_displays_info);
+ if (error != kErrorNone) {
+ DLOGE("Failed to get connected display list. Error = %d", error);
+ return error;
+ }
+
+ for (auto &iter : hw_displays_info) {
+ auto &info = iter.second;
+ if (info.is_primary) {
+ hw_disp_info->type = info.display_type;
+ hw_disp_info->is_connected = info.is_connected;
+ DLOGI("Primary display: %d-%d, connected: %s", info.display_id,
+ info.display_type, info.is_connected ? "true" : "false");
+ break;
+ }
+ }
return kErrorNone;
}