diff options
Diffstat (limited to 'sdm/libs/core')
-rw-r--r-- | sdm/libs/core/fb/hw_device.cpp | 44 | ||||
-rw-r--r-- | sdm/libs/core/fb/hw_device.h | 4 | ||||
-rw-r--r-- | sdm/libs/core/fb/hw_info.cpp | 3 |
3 files changed, 39 insertions, 12 deletions
diff --git a/sdm/libs/core/fb/hw_device.cpp b/sdm/libs/core/fb/hw_device.cpp index f75e92ad..3d5cb78a 100644 --- a/sdm/libs/core/fb/hw_device.cpp +++ b/sdm/libs/core/fb/hw_device.cpp @@ -737,7 +737,7 @@ void HWDevice::SetMDPFlags(const Layer *layer, const bool &is_rotator_used, } int HWDevice::GetFBNodeIndex(HWDeviceType device_type) { - for (int i = 0; i <= kDeviceVirtual; i++) { + for (int i = 0; i < kFBNodeMax; i++) { HWPanelInfo panel_info; GetHWPanelInfoByNode(i, &panel_info); switch (device_type) { @@ -748,7 +748,9 @@ int HWDevice::GetFBNodeIndex(HWDeviceType device_type) { break; case kDeviceHDMI: if (panel_info.is_pluggable == true) { - return i; + if (IsFBNodeConnected(i)) { + return i; + } } break; case kDeviceVirtual: @@ -990,17 +992,20 @@ int HWDevice::ParseLine(const char *input, const char *delim, char *tokens[], bool HWDevice::EnableHotPlugDetection(int enable) { char hpdpath[kMaxStringLength]; - int hdmi_node_index = GetFBNodeIndex(kDeviceHDMI); - if (hdmi_node_index < 0) { - return false; - } + char value = enable ? '1' : '0'; - snprintf(hpdpath , sizeof(hpdpath), "%s%d/hpd", fb_path_, hdmi_node_index); + // Enable HPD for all pluggable devices. + for (int i = 0; i < kFBNodeMax; i++) { + HWPanelInfo panel_info; + GetHWPanelInfoByNode(i, &panel_info); + if (panel_info.is_pluggable == true) { + snprintf(hpdpath , sizeof(hpdpath), "%s%d/hpd", fb_path_, i); - char value = enable ? '1' : '0'; - ssize_t length = SysFsWrite(hpdpath, &value, sizeof(value)); - if (length <= 0) { - return false; + ssize_t length = SysFsWrite(hpdpath, &value, sizeof(value)); + if (length <= 0) { + return false; + } + } } return true; @@ -1165,6 +1170,23 @@ ssize_t HWDevice::SysFsWrite(const char* file_node, const char* value, ssize_t l return len; } +bool HWDevice::IsFBNodeConnected(int fb_node) { + string file_name = fb_path_ + to_string(fb_node) + "/connected"; + + Sys::fstream fs(file_name, fstream::in); + if (!fs.is_open()) { + DLOGW("File not found %s", file_name.c_str()); + return false; + } + + string line; + if (!Sys::getline_(fs, line)) { + return false; + } + + return atoi(line.c_str()); +} + DisplayError HWDevice::SetS3DMode(HWS3DMode s3d_mode) { return kErrorNotSupported; } diff --git a/sdm/libs/core/fb/hw_device.h b/sdm/libs/core/fb/hw_device.h index 8916dc47..5543b481 100644 --- a/sdm/libs/core/fb/hw_device.h +++ b/sdm/libs/core/fb/hw_device.h @@ -100,6 +100,9 @@ class HWDevice : public HWInterface { static const int kMaxStringLength = 1024; static const int kNumPhysicalDisplays = 2; + // This indicates the number of fb devices created in the driver for all interfaces. Any addition + // of new fb devices should be added here. + static const int kFBNodeMax = 4; void DumpLayerCommit(const mdp_layer_commit &layer_commit); DisplayError SetFormat(const LayerBufferFormat &source, uint32_t *target); @@ -127,6 +130,7 @@ class HWDevice : public HWInterface { bool EnableHotPlugDetection(int enable); ssize_t SysFsWrite(const char* file_node, const char* value, ssize_t length); + bool IsFBNodeConnected(int fb_node); HWResourceInfo hw_resource_; HWPanelInfo hw_panel_info_; diff --git a/sdm/libs/core/fb/hw_info.cpp b/sdm/libs/core/fb/hw_info.cpp index 81d81a34..121b7c06 100644 --- a/sdm/libs/core/fb/hw_info.cpp +++ b/sdm/libs/core/fb/hw_info.cpp @@ -516,7 +516,8 @@ DisplayError HWInfo::GetFirstDisplayInterfaceType(HWDisplayInterfaceInfo *hw_dis return kErrorHardware; } - if (!strncmp(line.c_str(), "dtv panel", strlen("dtv panel"))) { + if (!strncmp(line.c_str(), "dtv panel", strlen("dtv panel")) || + !strncmp(line.c_str(), "dp panel", strlen("dp panel"))) { hw_disp_info->type = kHDMI; DLOGI("First display is HDMI"); } else { |