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
This commit is contained in:
committed by
Prabhanjan Kandula
parent
dbc8aed64d
commit
5d320c6bb2
@@ -63,7 +63,7 @@ class Debug {
|
|||||||
}
|
}
|
||||||
static inline DebugHandler* Get() { return debug_.debug_handler_; }
|
static inline DebugHandler* Get() { return debug_.debug_handler_; }
|
||||||
static int GetSimulationFlag();
|
static int GetSimulationFlag();
|
||||||
static int GetHDMIResolution();
|
static bool GetExternalResolution(char *val);
|
||||||
static void GetIdleTimeoutMs(uint32_t *active_ms, uint32_t *inactive_ms);
|
static void GetIdleTimeoutMs(uint32_t *active_ms, uint32_t *inactive_ms);
|
||||||
static int GetBootAnimLayerCount();
|
static int GetBootAnimLayerCount();
|
||||||
static bool IsRotatorDownScaleDisabled();
|
static bool IsRotatorDownScaleDisabled();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ LOCAL_SRC_FILES := core_interface.cpp \
|
|||||||
ifneq ($(TARGET_IS_HEADLESS), true)
|
ifneq ($(TARGET_IS_HEADLESS), true)
|
||||||
LOCAL_SRC_FILES += $(LOCAL_HW_INTF_PATH_2)/hw_info_drm.cpp \
|
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_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_events_drm.cpp \
|
||||||
$(LOCAL_HW_INTF_PATH_2)/hw_scale_drm.cpp \
|
$(LOCAL_HW_INTF_PATH_2)/hw_scale_drm.cpp \
|
||||||
$(LOCAL_HW_INTF_PATH_2)/hw_virtual_drm.cpp \
|
$(LOCAL_HW_INTF_PATH_2)/hw_virtual_drm.cpp \
|
||||||
|
|||||||
@@ -185,37 +185,33 @@ uint32_t DisplayHDMI::GetBestConfig(HWS3DMode s3d_mode) {
|
|||||||
break;
|
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
|
index = 0;
|
||||||
// Ex: 1920x1080@60Hz is better than 1920x1080@30 and 1920x1080@30 is better than 1280x720@60
|
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) {
|
if (attrib[index].y_pixels > attrib[best_index].y_pixels) {
|
||||||
best_index = UINT32(index);
|
best_index = UINT32(index);
|
||||||
} else if (attrib[index].y_pixels == attrib[best_index].y_pixels) {
|
} 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);
|
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
|
// 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) {
|
if (user_config) {
|
||||||
uint32_t config_index = 0;
|
uint32_t config_index = 0;
|
||||||
// For the config, get the corresponding index
|
// 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)
|
if (error == kErrorNone)
|
||||||
return config_index;
|
return config_index;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class DisplayHDMI : public DisplayBase, HWEventHandler {
|
|||||||
uint32_t GetBestConfig(HWS3DMode s3d_mode);
|
uint32_t GetBestConfig(HWS3DMode s3d_mode);
|
||||||
void GetScanSupport();
|
void GetScanSupport();
|
||||||
void SetS3DMode(LayerStack *layer_stack);
|
void SetS3DMode(LayerStack *layer_stack);
|
||||||
|
static const int kPropertyMax = 256;
|
||||||
|
|
||||||
bool underscan_supported_ = false;
|
bool underscan_supported_ = false;
|
||||||
HWScanSupport scan_support_;
|
HWScanSupport scan_support_;
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ DisplayError HWDeviceDRM::SetDisplayAttributes(const HWDisplayAttributes &displa
|
|||||||
return kErrorNotSupported;
|
return kErrorNotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWDeviceDRM::GetConfigIndex(uint32_t mode, uint32_t *index) {
|
DisplayError HWDeviceDRM::GetConfigIndex(char *mode, uint32_t *index) {
|
||||||
return kErrorNone;
|
return kErrorNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class HWDeviceDRM : public HWInterface {
|
|||||||
virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info);
|
virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info);
|
||||||
virtual DisplayError SetDisplayAttributes(uint32_t index);
|
virtual DisplayError SetDisplayAttributes(uint32_t index);
|
||||||
virtual DisplayError SetDisplayAttributes(const HWDisplayAttributes &display_attributes);
|
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 PowerOn();
|
||||||
virtual DisplayError PowerOff();
|
virtual DisplayError PowerOff();
|
||||||
virtual DisplayError Doze();
|
virtual DisplayError Doze();
|
||||||
@@ -167,6 +167,7 @@ class HWDeviceDRM : public HWInterface {
|
|||||||
HWResourceInfo hw_resource_ = {};
|
HWResourceInfo hw_resource_ = {};
|
||||||
HWPanelInfo hw_panel_info_ = {};
|
HWPanelInfo hw_panel_info_ = {};
|
||||||
HWDeviceType device_type_ = {};
|
HWDeviceType device_type_ = {};
|
||||||
|
HWScaleDRM *hw_scale_ = {};
|
||||||
sde_drm::DRMManagerInterface *drm_mgr_intf_ = {};
|
sde_drm::DRMManagerInterface *drm_mgr_intf_ = {};
|
||||||
sde_drm::DRMAtomicReqInterface *drm_atomic_intf_ = {};
|
sde_drm::DRMAtomicReqInterface *drm_atomic_intf_ = {};
|
||||||
sde_drm::DRMConnectorInfo connector_info_ = {};
|
sde_drm::DRMConnectorInfo connector_info_ = {};
|
||||||
@@ -177,7 +178,6 @@ class HWDeviceDRM : public HWInterface {
|
|||||||
bool synchronous_commit_ = false;
|
bool synchronous_commit_ = false;
|
||||||
HWMixerAttributes mixer_attributes_ = {};
|
HWMixerAttributes mixer_attributes_ = {};
|
||||||
std::string interface_str_ = "DSI";
|
std::string interface_str_ = "DSI";
|
||||||
HWScaleDRM *hw_scale_ = {};
|
|
||||||
std::vector<sde_drm::DRMSolidfillStage> solid_fills_ {};
|
std::vector<sde_drm::DRMSolidfillStage> solid_fills_ {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,23 +27,22 @@
|
|||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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_lib_loader.h>
|
||||||
#include <drm_master.h>
|
#include <drm_master.h>
|
||||||
#include <drm_res_mgr.h>
|
#include <drm_res_mgr.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string>
|
||||||
#include <utils/debug.h>
|
|
||||||
#include <utils/sys.h>
|
|
||||||
#include <utils/formats.h>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "hw_hdmi_drm.h"
|
|
||||||
|
|
||||||
#define __CLASS__ "HWHDMIDRM"
|
#define __CLASS__ "HWTVDRM"
|
||||||
|
|
||||||
using drm_utils::DRMMaster;
|
using drm_utils::DRMMaster;
|
||||||
using drm_utils::DRMResMgr;
|
using drm_utils::DRMResMgr;
|
||||||
@@ -60,17 +59,16 @@ using sde_drm::DRMTopology;
|
|||||||
|
|
||||||
namespace sdm {
|
namespace sdm {
|
||||||
|
|
||||||
HWHDMIDRM::HWHDMIDRM(BufferSyncHandler *buffer_sync_handler, BufferAllocator *buffer_allocator,
|
HWTVDRM::HWTVDRM(BufferSyncHandler *buffer_sync_handler, BufferAllocator *buffer_allocator,
|
||||||
HWInfoInterface *hw_info_intf)
|
HWInfoInterface *hw_info_intf)
|
||||||
: HWDeviceDRM(buffer_sync_handler, buffer_allocator, hw_info_intf),
|
: HWDeviceDRM(buffer_sync_handler, buffer_allocator, hw_info_intf), active_config_index_(0) {
|
||||||
active_config_index_(0) {
|
disp_type_ = DRMDisplayType::TV;
|
||||||
HWDeviceDRM::device_type_ = kDeviceHDMI;
|
device_name_ = "TV Display Device";
|
||||||
HWDeviceDRM::device_name_ = "HDMI Display Device";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(user) : split function in base class and avoid code duplicacy
|
// TODO(user) : split function in base class and avoid code duplicacy
|
||||||
// by using base implementation for this basic stuff
|
// by using base implementation for this basic stuff
|
||||||
DisplayError HWHDMIDRM::Init() {
|
DisplayError HWTVDRM::Init() {
|
||||||
DisplayError error = kErrorNone;
|
DisplayError error = kErrorNone;
|
||||||
|
|
||||||
default_mode_ = (DRMLibLoader::GetInstance()->IsLoaded() == false);
|
default_mode_ = (DRMLibLoader::GetInstance()->IsLoaded() == false);
|
||||||
@@ -89,28 +87,23 @@ DisplayError HWHDMIDRM::Init() {
|
|||||||
drm_mgr_intf_->CreateAtomicReq(token_, &drm_atomic_intf_);
|
drm_mgr_intf_->CreateAtomicReq(token_, &drm_atomic_intf_);
|
||||||
drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
|
drm_mgr_intf_->GetConnectorInfo(token_.conn_id, &connector_info_);
|
||||||
InitializeConfigs();
|
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();
|
hw_info_intf_->GetHWResourceInfo(&hw_resource_);
|
||||||
PopulateHWPanelInfo();
|
|
||||||
UpdateMixerAttributes();
|
// 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;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWHDMIDRM::GetNumDisplayAttributes(uint32_t *count) {
|
DisplayError HWTVDRM::GetNumDisplayAttributes(uint32_t *count) {
|
||||||
*count = connector_info_.num_modes;
|
*count = connector_info_.num_modes;
|
||||||
if (*count <= 0) {
|
if (*count <= 0) {
|
||||||
return kErrorHardware;
|
return kErrorHardware;
|
||||||
@@ -119,45 +112,72 @@ DisplayError HWHDMIDRM::GetNumDisplayAttributes(uint32_t *count) {
|
|||||||
return kErrorNone;
|
return kErrorNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWHDMIDRM::GetActiveConfig(uint32_t *active_config_index) {
|
DisplayError HWTVDRM::GetActiveConfig(uint32_t *active_config_index) {
|
||||||
*active_config_index = active_config_index_;
|
*active_config_index = active_config_index_;
|
||||||
return kErrorNone;
|
return kErrorNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWHDMIDRM::SetDisplayAttributes(uint32_t index) {
|
DisplayError HWTVDRM::SetDisplayAttributes(uint32_t index) {
|
||||||
DTRACE_SCOPED();
|
|
||||||
|
|
||||||
if (index >= connector_info_.num_modes) {
|
if (index >= connector_info_.num_modes) {
|
||||||
return kErrorNotSupported;
|
return kErrorNotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
active_config_index_ = index;
|
active_config_index_ = index;
|
||||||
|
current_mode_ = connector_info_.modes[index];
|
||||||
|
|
||||||
// TODO(user): fix this hard coding
|
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, &connector_info_.modes[index]);
|
||||||
frame_rate_ = 60;
|
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
|
||||||
|
|
||||||
// Get the display attributes for current active config index
|
// Commit to setup pipeline with mode, which then tells us the topology etc
|
||||||
GetDisplayAttributes(active_config_index_, &display_attributes_);
|
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();
|
UpdateMixerAttributes();
|
||||||
|
|
||||||
return kErrorNone;
|
return kErrorNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWHDMIDRM::GetConfigIndex(uint32_t mode, uint32_t *index) {
|
DisplayError HWTVDRM::GetConfigIndex(char *mode, uint32_t *index) {
|
||||||
*index = mode;
|
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;
|
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
|
} // namespace sdm
|
||||||
|
|
||||||
@@ -22,8 +22,8 @@
|
|||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __HW_HDMI_DRM_H__
|
#ifndef __HW_TV_DRM_H__
|
||||||
#define __HW_HDMI_DRM_H__
|
#define __HW_TV_DRM_H__
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -34,9 +34,9 @@ namespace sdm {
|
|||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
class HWHDMIDRM : public HWDeviceDRM {
|
class HWTVDRM : public HWDeviceDRM {
|
||||||
public:
|
public:
|
||||||
explicit HWHDMIDRM(BufferSyncHandler *buffer_sync_handler, BufferAllocator *buffer_allocator,
|
explicit HWTVDRM(BufferSyncHandler *buffer_sync_handler, BufferAllocator *buffer_allocator,
|
||||||
HWInfoInterface *hw_info_intf);
|
HWInfoInterface *hw_info_intf);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -45,16 +45,17 @@ class HWHDMIDRM : public HWDeviceDRM {
|
|||||||
// Requirement to call this only after the first config has been explicitly set by client
|
// Requirement to call this only after the first config has been explicitly set by client
|
||||||
virtual DisplayError GetActiveConfig(uint32_t *active_config);
|
virtual DisplayError GetActiveConfig(uint32_t *active_config);
|
||||||
virtual DisplayError SetDisplayAttributes(uint32_t index);
|
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);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static const int kBitRGB = 20;
|
||||||
|
static const int kBitYUV = 21;
|
||||||
|
|
||||||
uint32_t active_config_index_;
|
uint32_t active_config_index_;
|
||||||
uint32_t frame_rate_ = 0;
|
uint32_t frame_rate_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sdm
|
} // namespace sdm
|
||||||
|
|
||||||
#endif // __HW_HDMI_DRM_H__
|
#endif // __HW_TV_DRM_H__
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ DisplayError HWDevice::SetDisplayAttributes(const HWDisplayAttributes &display_a
|
|||||||
return kErrorNotSupported;
|
return kErrorNotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWDevice::GetConfigIndex(uint32_t mode, uint32_t *index) {
|
DisplayError HWDevice::GetConfigIndex(char *mode, uint32_t *index) {
|
||||||
return kErrorNone;
|
return kErrorNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class HWDevice : public HWInterface {
|
|||||||
virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info);
|
virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info);
|
||||||
virtual DisplayError SetDisplayAttributes(uint32_t index);
|
virtual DisplayError SetDisplayAttributes(uint32_t index);
|
||||||
virtual DisplayError SetDisplayAttributes(const HWDisplayAttributes &display_attributes);
|
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 PowerOn();
|
||||||
virtual DisplayError PowerOff();
|
virtual DisplayError PowerOff();
|
||||||
virtual DisplayError Doze();
|
virtual DisplayError Doze();
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include <utils/sys.h>
|
#include <utils/sys.h>
|
||||||
#include <utils/formats.h>
|
#include <utils/formats.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@@ -407,17 +408,20 @@ DisplayError HWHDMI::SetDisplayAttributes(uint32_t index) {
|
|||||||
return kErrorNone;
|
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
|
// Check if the mode is valid and return corresponding index
|
||||||
for (uint32_t i = 0; i < hdmi_modes_.size(); i++) {
|
for (uint32_t i = 0; i < hdmi_modes_.size(); i++) {
|
||||||
if (hdmi_modes_[i] == mode) {
|
if (hdmi_modes_[i] == value) {
|
||||||
*index = i;
|
*index = i;
|
||||||
DLOGI("Index = %d for config = %d", *index, mode);
|
DLOGI("Index = %d for config = %d", *index, value);
|
||||||
return kErrorNone;
|
return kErrorNone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DLOGE("Config = %d not supported", mode);
|
DLOGE("Config = %d not supported", value);
|
||||||
return kErrorNotSupported;
|
return kErrorNotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -864,7 +868,9 @@ DisplayError HWHDMI::GetDynamicFrameRateMode(uint32_t refresh_rate, uint32_t *mo
|
|||||||
return kErrorNotSupported;
|
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_front_porch = dst->front_porch_h;
|
||||||
data->hor_back_porch = dst->back_porch_h;
|
data->hor_back_porch = dst->back_porch_h;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class HWHDMI : public HWDevice {
|
|||||||
virtual DisplayError GetMaxCEAFormat(uint32_t *max_cea_format);
|
virtual DisplayError GetMaxCEAFormat(uint32_t *max_cea_format);
|
||||||
virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level);
|
virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level);
|
||||||
virtual DisplayError SetDisplayAttributes(uint32_t index);
|
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 Validate(HWLayers *hw_layers);
|
||||||
virtual DisplayError Commit(HWLayers *hw_layers);
|
virtual DisplayError Commit(HWLayers *hw_layers);
|
||||||
virtual DisplayError SetS3DMode(HWS3DMode s3d_mode);
|
virtual DisplayError SetS3DMode(HWS3DMode s3d_mode);
|
||||||
@@ -109,6 +109,7 @@ class HWHDMI : public HWDevice {
|
|||||||
DisplayError GetDynamicFrameRateMode(uint32_t refresh_rate, uint32_t*mode,
|
DisplayError GetDynamicFrameRateMode(uint32_t refresh_rate, uint32_t*mode,
|
||||||
DynamicFPSData *data, uint32_t *config_index);
|
DynamicFPSData *data, uint32_t *config_index);
|
||||||
static const int kThresholdRefreshRate = 1000;
|
static const int kThresholdRefreshRate = 1000;
|
||||||
|
static const int kVideoFormatArrayMax = 8;
|
||||||
vector<uint32_t> hdmi_modes_;
|
vector<uint32_t> hdmi_modes_;
|
||||||
// Holds the hdmi timing information. Ex: resolution, fps etc.,
|
// Holds the hdmi timing information. Ex: resolution, fps etc.,
|
||||||
vector<msm_hdmi_mode_timing_info> supported_video_modes_;
|
vector<msm_hdmi_mode_timing_info> supported_video_modes_;
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ DisplayError HWPrimary::SetRefreshRate(uint32_t refresh_rate) {
|
|||||||
return kErrorNone;
|
return kErrorNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWPrimary::GetConfigIndex(uint32_t mode, uint32_t *index) {
|
DisplayError HWPrimary::GetConfigIndex(char *mode, uint32_t *index) {
|
||||||
return HWDevice::GetConfigIndex(mode, index);
|
return HWDevice::GetConfigIndex(mode, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class HWPrimary : public HWDevice {
|
|||||||
virtual DisplayError GetDisplayAttributes(uint32_t index,
|
virtual DisplayError GetDisplayAttributes(uint32_t index,
|
||||||
HWDisplayAttributes *display_attributes);
|
HWDisplayAttributes *display_attributes);
|
||||||
virtual DisplayError SetDisplayAttributes(uint32_t index);
|
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 PowerOff();
|
||||||
virtual DisplayError Doze();
|
virtual DisplayError Doze();
|
||||||
virtual DisplayError DozeSuspend();
|
virtual DisplayError DozeSuspend();
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#ifdef COMPILE_DRM
|
#ifdef COMPILE_DRM
|
||||||
#include "drm/hw_device_drm.h"
|
#include "drm/hw_device_drm.h"
|
||||||
#include "drm/hw_virtual_drm.h"
|
#include "drm/hw_virtual_drm.h"
|
||||||
#include "drm/hw_hdmi_drm.h"
|
#include "drm/hw_tv_drm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __CLASS__ "HWInterface"
|
#define __CLASS__ "HWInterface"
|
||||||
@@ -67,7 +67,7 @@ DisplayError HWInterface::Create(DisplayType type, HWInfoInterface *hw_info_intf
|
|||||||
hw = new HWHDMI(buffer_sync_handler, hw_info_intf);
|
hw = new HWHDMI(buffer_sync_handler, hw_info_intf);
|
||||||
} else {
|
} else {
|
||||||
#ifdef COMPILE_DRM
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class HWInterface {
|
|||||||
virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info) = 0;
|
virtual DisplayError GetHWPanelInfo(HWPanelInfo *panel_info) = 0;
|
||||||
virtual DisplayError SetDisplayAttributes(uint32_t index) = 0;
|
virtual DisplayError SetDisplayAttributes(uint32_t index) = 0;
|
||||||
virtual DisplayError SetDisplayAttributes(const HWDisplayAttributes &display_attributes) = 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 PowerOn() = 0;
|
||||||
virtual DisplayError PowerOff() = 0;
|
virtual DisplayError PowerOff() = 0;
|
||||||
virtual DisplayError Doze() = 0;
|
virtual DisplayError Doze() = 0;
|
||||||
|
|||||||
@@ -47,11 +47,14 @@ int Debug::GetSimulationFlag() {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Debug::GetHDMIResolution() {
|
bool Debug::GetExternalResolution(char *value) {
|
||||||
int value = 0;
|
uint32_t retval = 0;
|
||||||
debug_.debug_handler_->GetProperty("hw.hdmi.resolution", &value);
|
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) {
|
void Debug::GetIdleTimeoutMs(uint32_t *active_ms, uint32_t *inactive_ms) {
|
||||||
|
|||||||
Reference in New Issue
Block a user