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/core/Android.mk b/sdm/libs/core/Android.mk
index 991cfac..14df125 100644
--- a/sdm/libs/core/Android.mk
+++ b/sdm/libs/core/Android.mk
@@ -49,7 +49,7 @@
ifneq ($(TARGET_IS_HEADLESS), true)
LOCAL_SRC_FILES += $(LOCAL_HW_INTF_PATH_2)/hw_info_drm.cpp \
$(LOCAL_HW_INTF_PATH_2)/hw_device_drm.cpp \
- $(LOCAL_HW_INTF_PATH_2)/hw_hdmi_drm.cpp \
+ $(LOCAL_HW_INTF_PATH_2)/hw_tv_drm.cpp \
$(LOCAL_HW_INTF_PATH_2)/hw_events_drm.cpp \
$(LOCAL_HW_INTF_PATH_2)/hw_scale_drm.cpp \
$(LOCAL_HW_INTF_PATH_2)/hw_virtual_drm.cpp \
diff --git a/sdm/libs/core/display_hdmi.cpp b/sdm/libs/core/display_hdmi.cpp
index a6c5c47..2ea2ac2 100644
--- a/sdm/libs/core/display_hdmi.cpp
+++ b/sdm/libs/core/display_hdmi.cpp
@@ -185,37 +185,33 @@
break;
}
}
- if (index < num_modes) {
- best_index = UINT32(index);
- for (size_t index = best_index + 1; index < num_modes; index ++) {
- if (!attrib[index].s3d_config[s3d_mode])
- continue;
- // From the available configs, select the best
- // Ex: 1920x1080@60Hz is better than 1920x1080@30 and 1920x1080@30 is better than 1280x720@60
+ index = 0;
+ best_index = UINT32(index);
+ for (size_t index = best_index + 1; index < num_modes; index ++) {
+ // TODO(user): Need to add support to S3D modes
+ // From the available configs, select the best
+ // Ex: 1920x1080@60Hz is better than 1920x1080@30 and 1920x1080@30 is better than 1280x720@60
+ if (attrib[index].x_pixels > attrib[best_index].x_pixels) {
+ best_index = UINT32(index);
+ } else if (attrib[index].x_pixels == attrib[best_index].x_pixels) {
if (attrib[index].y_pixels > attrib[best_index].y_pixels) {
best_index = UINT32(index);
} else if (attrib[index].y_pixels == attrib[best_index].y_pixels) {
- if (attrib[index].x_pixels > attrib[best_index].x_pixels) {
+ if (attrib[index].vsync_period_ns < attrib[best_index].vsync_period_ns) {
best_index = UINT32(index);
- } else if (attrib[index].x_pixels == attrib[best_index].x_pixels) {
- if (attrib[index].vsync_period_ns < attrib[best_index].vsync_period_ns) {
- best_index = UINT32(index);
- }
}
}
}
- } else {
- DLOGW("%s, could not support S3D mode from EDID info. S3D mode is %d",
- __FUNCTION__, s3d_mode);
}
-
+ char val[kPropertyMax]={};
// Used for changing HDMI Resolution - override the best with user set config
- uint32_t user_config = UINT32(Debug::GetHDMIResolution());
+ bool user_config = (Debug::GetExternalResolution(val));
+
if (user_config) {
uint32_t config_index = 0;
// For the config, get the corresponding index
- DisplayError error = hw_intf_->GetConfigIndex(user_config, &config_index);
+ DisplayError error = hw_intf_->GetConfigIndex(val, &config_index);
if (error == kErrorNone)
return config_index;
}
diff --git a/sdm/libs/core/display_hdmi.h b/sdm/libs/core/display_hdmi.h
index dfee684..8248840 100644
--- a/sdm/libs/core/display_hdmi.h
+++ b/sdm/libs/core/display_hdmi.h
@@ -61,6 +61,7 @@
uint32_t GetBestConfig(HWS3DMode s3d_mode);
void GetScanSupport();
void SetS3DMode(LayerStack *layer_stack);
+ static const int kPropertyMax = 256;
bool underscan_supported_ = false;
HWScanSupport scan_support_;
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp
index 30168ef..9736ad0 100644
--- a/sdm/libs/core/drm/hw_device_drm.cpp
+++ b/sdm/libs/core/drm/hw_device_drm.cpp
@@ -606,7 +606,7 @@
return kErrorNotSupported;
}
-DisplayError HWDeviceDRM::GetConfigIndex(uint32_t mode, uint32_t *index) {
+DisplayError HWDeviceDRM::GetConfigIndex(char *mode, uint32_t *index) {
return kErrorNone;
}
diff --git a/sdm/libs/core/drm/hw_device_drm.h b/sdm/libs/core/drm/hw_device_drm.h
index eb836ed..965ff3b 100644
--- a/sdm/libs/core/drm/hw_device_drm.h
+++ b/sdm/libs/core/drm/hw_device_drm.h
@@ -65,7 +65,7 @@
virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info);
virtual DisplayError SetDisplayAttributes(uint32_t index);
virtual DisplayError SetDisplayAttributes(const HWDisplayAttributes &display_attributes);
- virtual DisplayError GetConfigIndex(uint32_t mode, uint32_t *index);
+ virtual DisplayError GetConfigIndex(char *mode, uint32_t *index);
virtual DisplayError PowerOn();
virtual DisplayError PowerOff();
virtual DisplayError Doze();
@@ -167,6 +167,7 @@
HWResourceInfo hw_resource_ = {};
HWPanelInfo hw_panel_info_ = {};
HWDeviceType device_type_ = {};
+ HWScaleDRM *hw_scale_ = {};
sde_drm::DRMManagerInterface *drm_mgr_intf_ = {};
sde_drm::DRMAtomicReqInterface *drm_atomic_intf_ = {};
sde_drm::DRMConnectorInfo connector_info_ = {};
@@ -177,7 +178,6 @@
bool synchronous_commit_ = false;
HWMixerAttributes mixer_attributes_ = {};
std::string interface_str_ = "DSI";
- HWScaleDRM *hw_scale_ = {};
std::vector<sde_drm::DRMSolidfillStage> solid_fills_ {};
};
diff --git a/sdm/libs/core/drm/hw_hdmi_drm.cpp b/sdm/libs/core/drm/hw_hdmi_drm.cpp
deleted file mode 100644
index 27419c7..0000000
--- a/sdm/libs/core/drm/hw_hdmi_drm.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
-* Copyright (c) 2017, The Linux Foundation. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above
-* copyright notice, this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided
-* with the distribution.
-* * Neither the name of The Linux Foundation nor the names of its
-* contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <drm_lib_loader.h>
-#include <drm_master.h>
-#include <drm_res_mgr.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <utils/debug.h>
-#include <utils/sys.h>
-#include <utils/formats.h>
-
-#include <vector>
-#include <map>
-#include <utility>
-
-#include "hw_hdmi_drm.h"
-
-#define __CLASS__ "HWHDMIDRM"
-
-using drm_utils::DRMMaster;
-using drm_utils::DRMResMgr;
-using drm_utils::DRMLibLoader;
-using drm_utils::DRMBuffer;
-using sde_drm::GetDRMManager;
-using sde_drm::DestroyDRMManager;
-using sde_drm::DRMDisplayType;
-using sde_drm::DRMDisplayToken;
-using sde_drm::DRMConnectorInfo;
-using sde_drm::DRMPPFeatureInfo;
-using sde_drm::DRMOps;
-using sde_drm::DRMTopology;
-
-namespace sdm {
-
-HWHDMIDRM::HWHDMIDRM(BufferSyncHandler *buffer_sync_handler, BufferAllocator *buffer_allocator,
- HWInfoInterface *hw_info_intf)
- : HWDeviceDRM(buffer_sync_handler, buffer_allocator, hw_info_intf),
- active_config_index_(0) {
- HWDeviceDRM::device_type_ = kDeviceHDMI;
- HWDeviceDRM::device_name_ = "HDMI Display Device";
-}
-
-// TODO(user) : split function in base class and avoid code duplicacy
-// by using base implementation for this basic stuff
-DisplayError HWHDMIDRM::Init() {
- DisplayError error = kErrorNone;
-
- default_mode_ = (DRMLibLoader::GetInstance()->IsLoaded() == false);
-
- if (!default_mode_) {
- DRMMaster *drm_master = {};
- int dev_fd = -1;
- DRMMaster::GetInstance(&drm_master);
- drm_master->GetHandle(&dev_fd);
- DRMLibLoader::GetInstance()->FuncGetDRMManager()(dev_fd, &drm_mgr_intf_);
- if (drm_mgr_intf_->RegisterDisplay(DRMDisplayType::TV, &token_)) {
- DLOGE("RegisterDisplay failed");
- return kErrorResources;
- }
-
- drm_mgr_intf_->CreateAtomicReq(token_, &drm_atomic_intf_);
- drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
- InitializeConfigs();
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, ¤t_mode_);
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
-
- if (drm_atomic_intf_->Commit(true /* synchronous */)) {
- DLOGE("Setting up CRTC %d, Connector %d for %s failed", token_.crtc_id, token_.conn_id,
- device_name_);
- return kErrorResources;
- }
-
- // Reload connector info for updated info after 1st commit
- drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
- DLOGI("Setup CRTC %d, Connector %d for %s", token_.crtc_id, token_.conn_id, device_name_);
- }
-
- PopulateDisplayAttributes();
- PopulateHWPanelInfo();
- UpdateMixerAttributes();
-
- return error;
-}
-
-DisplayError HWHDMIDRM::GetNumDisplayAttributes(uint32_t *count) {
- *count = connector_info_.num_modes;
- if (*count <= 0) {
- return kErrorHardware;
- }
-
- return kErrorNone;
-}
-
-DisplayError HWHDMIDRM::GetActiveConfig(uint32_t *active_config_index) {
- *active_config_index = active_config_index_;
- return kErrorNone;
-}
-
-DisplayError HWHDMIDRM::SetDisplayAttributes(uint32_t index) {
- DTRACE_SCOPED();
-
- if (index >= connector_info_.num_modes) {
- return kErrorNotSupported;
- }
-
- active_config_index_ = index;
-
- // TODO(user): fix this hard coding
- frame_rate_ = 60;
-
- // Get the display attributes for current active config index
- GetDisplayAttributes(active_config_index_, &display_attributes_);
- UpdateMixerAttributes();
-
- return kErrorNone;
-}
-
-DisplayError HWHDMIDRM::GetConfigIndex(uint32_t mode, uint32_t *index) {
- *index = mode;
-
- return kErrorNone;
-}
-
-DisplayError HWHDMIDRM::Validate(HWLayers *hw_layers) {
- HWDeviceDRM::ResetDisplayParams();
-
- return HWDeviceDRM::Validate(hw_layers);
-}
-
-DisplayError HWHDMIDRM::Commit(HWLayers *hw_layers) {
- return HWDeviceDRM::Commit(hw_layers);
-}
-
-} // namespace sdm
-
diff --git a/sdm/libs/core/drm/hw_tv_drm.cpp b/sdm/libs/core/drm/hw_tv_drm.cpp
new file mode 100644
index 0000000..0262915
--- /dev/null
+++ b/sdm/libs/core/drm/hw_tv_drm.cpp
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "hw_tv_drm.h"
+#include <utils/debug.h>
+#include <utils/sys.h>
+#include <utils/formats.h>
+#include <drm_lib_loader.h>
+#include <drm_master.h>
+#include <drm_res_mgr.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string>
+#include <vector>
+#include <map>
+#include <utility>
+
+
+#define __CLASS__ "HWTVDRM"
+
+using drm_utils::DRMMaster;
+using drm_utils::DRMResMgr;
+using drm_utils::DRMLibLoader;
+using drm_utils::DRMBuffer;
+using sde_drm::GetDRMManager;
+using sde_drm::DestroyDRMManager;
+using sde_drm::DRMDisplayType;
+using sde_drm::DRMDisplayToken;
+using sde_drm::DRMConnectorInfo;
+using sde_drm::DRMPPFeatureInfo;
+using sde_drm::DRMOps;
+using sde_drm::DRMTopology;
+
+namespace sdm {
+
+HWTVDRM::HWTVDRM(BufferSyncHandler *buffer_sync_handler, BufferAllocator *buffer_allocator,
+ HWInfoInterface *hw_info_intf)
+ : HWDeviceDRM(buffer_sync_handler, buffer_allocator, hw_info_intf), active_config_index_(0) {
+ disp_type_ = DRMDisplayType::TV;
+ device_name_ = "TV Display Device";
+}
+
+// TODO(user) : split function in base class and avoid code duplicacy
+// by using base implementation for this basic stuff
+DisplayError HWTVDRM::Init() {
+ DisplayError error = kErrorNone;
+
+ default_mode_ = (DRMLibLoader::GetInstance()->IsLoaded() == false);
+
+ if (!default_mode_) {
+ DRMMaster *drm_master = {};
+ int dev_fd = -1;
+ DRMMaster::GetInstance(&drm_master);
+ drm_master->GetHandle(&dev_fd);
+ DRMLibLoader::GetInstance()->FuncGetDRMManager()(dev_fd, &drm_mgr_intf_);
+ if (drm_mgr_intf_->RegisterDisplay(DRMDisplayType::TV, &token_)) {
+ DLOGE("RegisterDisplay failed");
+ return kErrorResources;
+ }
+
+ drm_mgr_intf_->CreateAtomicReq(token_, &drm_atomic_intf_);
+ drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
+ InitializeConfigs();
+ }
+
+ hw_info_intf_->GetHWResourceInfo(&hw_resource_);
+
+ // TODO(user): In future, remove has_qseed3 member, add version and pass version to constructor
+ if (hw_resource_.has_qseed3) {
+ hw_scale_ = new HWScaleDRM(HWScaleDRM::Version::V2);
+ }
+
+ if (error != kErrorNone) {
+ return error;
+ }
+
+ return error;
+}
+
+DisplayError HWTVDRM::GetNumDisplayAttributes(uint32_t *count) {
+ *count = connector_info_.num_modes;
+ if (*count <= 0) {
+ return kErrorHardware;
+ }
+
+ return kErrorNone;
+}
+
+DisplayError HWTVDRM::GetActiveConfig(uint32_t *active_config_index) {
+ *active_config_index = active_config_index_;
+ return kErrorNone;
+}
+
+DisplayError HWTVDRM::SetDisplayAttributes(uint32_t index) {
+ if (index >= connector_info_.num_modes) {
+ return kErrorNotSupported;
+ }
+
+ active_config_index_ = index;
+ current_mode_ = connector_info_.modes[index];
+
+ drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, &connector_info_.modes[index]);
+ drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
+
+ // Commit to setup pipeline with mode, which then tells us the topology etc
+ if (drm_atomic_intf_->Commit(true /* synchronous */)) {
+ DLOGE("Setting up CRTC %d, Connector %d for %s failed", token_.crtc_id,
+ token_.conn_id, device_name_);
+ return kErrorResources;
+ }
+
+ // Reload connector info for updated info after 1st commit
+ drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
+ DLOGI("Setup CRTC %d, Connector %d for %s", token_.crtc_id, token_.conn_id, device_name_);
+
+ frame_rate_ = display_attributes_.fps;
+ PopulateDisplayAttributes();
+ PopulateHWPanelInfo();
+ UpdateMixerAttributes();
+
+ return kErrorNone;
+}
+
+DisplayError HWTVDRM::GetConfigIndex(char *mode, uint32_t *index) {
+ uint32_t width = 0, height = 0, fps = 0, format = 0;
+ std::string str(mode);
+
+ // mode should be in width:height:fps:format
+ // TODO(user): it is not fully robust, User needs to provide in above format only
+ if (str.length() != 0) {
+ width = UINT32(stoi(str));
+ height = UINT32(stoi(str.substr(str.find(':') + 1)));
+ std::string str3 = str.substr(str.find(':') + 1);
+ fps = UINT32(stoi(str3.substr(str3.find(':') + 1)));
+ std::string str4 = str3.substr(str3.find(':') + 1);
+ format = UINT32(stoi(str4.substr(str4.find(':') + 1)));
+ }
+
+ for (size_t idex = 0; idex < connector_info_.num_modes; idex ++) {
+ if ((height == connector_info_.modes[idex].vdisplay) &&
+ (width == connector_info_.modes[idex].hdisplay) &&
+ (fps == connector_info_.modes[idex].vrefresh)) {
+ if ((format >> 1) & (connector_info_.modes[idex].flags >> kBitYUV)) {
+ *index = UINT32(idex);
+ }
+
+ if (format & (connector_info_.modes[idex].flags >> kBitRGB)) {
+ *index = UINT32(idex);
+ }
+ }
+ }
+
+ return kErrorNone;
+}
+
+} // namespace sdm
+
diff --git a/sdm/libs/core/drm/hw_hdmi_drm.h b/sdm/libs/core/drm/hw_tv_drm.h
similarity index 84%
rename from sdm/libs/core/drm/hw_hdmi_drm.h
rename to sdm/libs/core/drm/hw_tv_drm.h
index 7e11e5e..7991ae3 100644
--- a/sdm/libs/core/drm/hw_hdmi_drm.h
+++ b/sdm/libs/core/drm/hw_tv_drm.h
@@ -22,8 +22,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __HW_HDMI_DRM_H__
-#define __HW_HDMI_DRM_H__
+#ifndef __HW_TV_DRM_H__
+#define __HW_TV_DRM_H__
#include <map>
#include <vector>
@@ -34,9 +34,9 @@
using std::vector;
-class HWHDMIDRM : public HWDeviceDRM {
+class HWTVDRM : public HWDeviceDRM {
public:
- explicit HWHDMIDRM(BufferSyncHandler *buffer_sync_handler, BufferAllocator *buffer_allocator,
+ explicit HWTVDRM(BufferSyncHandler *buffer_sync_handler, BufferAllocator *buffer_allocator,
HWInfoInterface *hw_info_intf);
protected:
@@ -45,16 +45,17 @@
// Requirement to call this only after the first config has been explicitly set by client
virtual DisplayError GetActiveConfig(uint32_t *active_config);
virtual DisplayError SetDisplayAttributes(uint32_t index);
- virtual DisplayError GetConfigIndex(uint32_t mode, uint32_t *index);
- virtual DisplayError Validate(HWLayers *hw_layers);
- virtual DisplayError Commit(HWLayers *hw_layers);
+ virtual DisplayError GetConfigIndex(char *mode, uint32_t *index);
private:
+ static const int kBitRGB = 20;
+ static const int kBitYUV = 21;
+
uint32_t active_config_index_;
uint32_t frame_rate_ = 0;
};
} // namespace sdm
-#endif // __HW_HDMI_DRM_H__
+#endif // __HW_TV_DRM_H__
diff --git a/sdm/libs/core/fb/hw_device.cpp b/sdm/libs/core/fb/hw_device.cpp
index ff19753..4931e1b 100644
--- a/sdm/libs/core/fb/hw_device.cpp
+++ b/sdm/libs/core/fb/hw_device.cpp
@@ -146,7 +146,7 @@
return kErrorNotSupported;
}
-DisplayError HWDevice::GetConfigIndex(uint32_t mode, uint32_t *index) {
+DisplayError HWDevice::GetConfigIndex(char *mode, uint32_t *index) {
return kErrorNone;
}
diff --git a/sdm/libs/core/fb/hw_device.h b/sdm/libs/core/fb/hw_device.h
index 2c0593a..f32c5bd 100644
--- a/sdm/libs/core/fb/hw_device.h
+++ b/sdm/libs/core/fb/hw_device.h
@@ -69,7 +69,7 @@
virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info);
virtual DisplayError SetDisplayAttributes(uint32_t index);
virtual DisplayError SetDisplayAttributes(const HWDisplayAttributes &display_attributes);
- virtual DisplayError GetConfigIndex(uint32_t mode, uint32_t *index);
+ virtual DisplayError GetConfigIndex(char *mode, uint32_t *index);
virtual DisplayError PowerOn();
virtual DisplayError PowerOff();
virtual DisplayError Doze();
diff --git a/sdm/libs/core/fb/hw_hdmi.cpp b/sdm/libs/core/fb/hw_hdmi.cpp
index 334a043..0602b12 100644
--- a/sdm/libs/core/fb/hw_hdmi.cpp
+++ b/sdm/libs/core/fb/hw_hdmi.cpp
@@ -38,6 +38,7 @@
#include <utils/sys.h>
#include <utils/formats.h>
+#include <string>
#include <vector>
#include <map>
#include <utility>
@@ -407,17 +408,20 @@
return kErrorNone;
}
-DisplayError HWHDMI::GetConfigIndex(uint32_t mode, uint32_t *index) {
+DisplayError HWHDMI::GetConfigIndex(char *mode, uint32_t *index) {
+ std::string str(mode);
+ uint32_t value = UINT32(stoi(str));
+
// Check if the mode is valid and return corresponding index
for (uint32_t i = 0; i < hdmi_modes_.size(); i++) {
- if (hdmi_modes_[i] == mode) {
+ if (hdmi_modes_[i] == value) {
*index = i;
- DLOGI("Index = %d for config = %d", *index, mode);
+ DLOGI("Index = %d for config = %d", *index, value);
return kErrorNone;
}
}
- DLOGE("Config = %d not supported", mode);
+ DLOGE("Config = %d not supported", value);
return kErrorNotSupported;
}
@@ -864,7 +868,9 @@
return kErrorNotSupported;
}
- GetConfigIndex(dst->video_format, config_index);
+ char mode_val[kVideoFormatArrayMax]={};
+ snprintf(mode_val, sizeof(mode_val), "%d", dst->video_format);
+ GetConfigIndex(mode_val, config_index);
data->hor_front_porch = dst->front_porch_h;
data->hor_back_porch = dst->back_porch_h;
diff --git a/sdm/libs/core/fb/hw_hdmi.h b/sdm/libs/core/fb/hw_hdmi.h
index 625782e..83025fa 100644
--- a/sdm/libs/core/fb/hw_hdmi.h
+++ b/sdm/libs/core/fb/hw_hdmi.h
@@ -83,7 +83,7 @@
virtual DisplayError GetMaxCEAFormat(uint32_t *max_cea_format);
virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level);
virtual DisplayError SetDisplayAttributes(uint32_t index);
- virtual DisplayError GetConfigIndex(uint32_t mode, uint32_t *index);
+ virtual DisplayError GetConfigIndex(char *mode, uint32_t *index);
virtual DisplayError Validate(HWLayers *hw_layers);
virtual DisplayError Commit(HWLayers *hw_layers);
virtual DisplayError SetS3DMode(HWS3DMode s3d_mode);
@@ -109,6 +109,7 @@
DisplayError GetDynamicFrameRateMode(uint32_t refresh_rate, uint32_t*mode,
DynamicFPSData *data, uint32_t *config_index);
static const int kThresholdRefreshRate = 1000;
+ static const int kVideoFormatArrayMax = 8;
vector<uint32_t> hdmi_modes_;
// Holds the hdmi timing information. Ex: resolution, fps etc.,
vector<msm_hdmi_mode_timing_info> supported_video_modes_;
diff --git a/sdm/libs/core/fb/hw_primary.cpp b/sdm/libs/core/fb/hw_primary.cpp
index 8102e5f..5ee8121 100644
--- a/sdm/libs/core/fb/hw_primary.cpp
+++ b/sdm/libs/core/fb/hw_primary.cpp
@@ -329,7 +329,7 @@
return kErrorNone;
}
-DisplayError HWPrimary::GetConfigIndex(uint32_t mode, uint32_t *index) {
+DisplayError HWPrimary::GetConfigIndex(char *mode, uint32_t *index) {
return HWDevice::GetConfigIndex(mode, index);
}
diff --git a/sdm/libs/core/fb/hw_primary.h b/sdm/libs/core/fb/hw_primary.h
index 38b3b9a..69b5445 100644
--- a/sdm/libs/core/fb/hw_primary.h
+++ b/sdm/libs/core/fb/hw_primary.h
@@ -44,7 +44,7 @@
virtual DisplayError GetDisplayAttributes(uint32_t index,
HWDisplayAttributes *display_attributes);
virtual DisplayError SetDisplayAttributes(uint32_t index);
- virtual DisplayError GetConfigIndex(uint32_t mode, uint32_t *index);
+ virtual DisplayError GetConfigIndex(char *mode, uint32_t *index);
virtual DisplayError PowerOff();
virtual DisplayError Doze();
virtual DisplayError DozeSuspend();
diff --git a/sdm/libs/core/hw_interface.cpp b/sdm/libs/core/hw_interface.cpp
index f05aa0c..cfaf72b 100644
--- a/sdm/libs/core/hw_interface.cpp
+++ b/sdm/libs/core/hw_interface.cpp
@@ -38,7 +38,7 @@
#ifdef COMPILE_DRM
#include "drm/hw_device_drm.h"
#include "drm/hw_virtual_drm.h"
-#include "drm/hw_hdmi_drm.h"
+#include "drm/hw_tv_drm.h"
#endif
#define __CLASS__ "HWInterface"
@@ -67,7 +67,7 @@
hw = new HWHDMI(buffer_sync_handler, hw_info_intf);
} else {
#ifdef COMPILE_DRM
- hw = new HWHDMIDRM(buffer_sync_handler, buffer_allocator, hw_info_intf);
+ hw = new HWTVDRM(buffer_sync_handler, buffer_allocator, hw_info_intf);
#endif
}
break;
diff --git a/sdm/libs/core/hw_interface.h b/sdm/libs/core/hw_interface.h
index 616e3fb..6774159 100644
--- a/sdm/libs/core/hw_interface.h
+++ b/sdm/libs/core/hw_interface.h
@@ -83,7 +83,7 @@
virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info) = 0;
virtual DisplayError SetDisplayAttributes(uint32_t index) = 0;
virtual DisplayError SetDisplayAttributes(const HWDisplayAttributes &display_attributes) = 0;
- virtual DisplayError GetConfigIndex(uint32_t mode, uint32_t *index) = 0;
+ virtual DisplayError GetConfigIndex(char *mode, uint32_t *index) = 0;
virtual DisplayError PowerOn() = 0;
virtual DisplayError PowerOff() = 0;
virtual DisplayError Doze() = 0;
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) {