sdm: Add support to query display port information.
1. Add binder and display interface to query display port information. 2. Add permission for audio client to use display services. CRs-Fixed: 1044314 Change-Id: I67a9549cd6e01e421534dcb139a2e39672873775
This commit is contained in:
@@ -78,7 +78,7 @@ int getDisplayAttributes(int dpy, DisplayAttributes_t& dpyattr) {
|
||||
dpyattr.yres = outParcel.readInt32();
|
||||
dpyattr.xdpi = outParcel.readFloat();
|
||||
dpyattr.ydpi = outParcel.readFloat();
|
||||
dpyattr.panel_type = (char) outParcel.readInt32();
|
||||
dpyattr.panel_type = outParcel.readInt32();
|
||||
} else {
|
||||
ALOGE("%s() failed with err %d", __FUNCTION__, err);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ int setActiveConfig(int configIndex, int /*dpy*/) {
|
||||
}
|
||||
|
||||
DisplayAttributes getDisplayAttributes(int configIndex, int /*dpy*/) {
|
||||
DisplayAttributes dpyattr;
|
||||
DisplayAttributes dpyattr = {};
|
||||
sp<IQService> binder = getBinder();
|
||||
if(binder != NULL) {
|
||||
Parcel inParcel, outParcel;
|
||||
@@ -252,7 +252,7 @@ DisplayAttributes getDisplayAttributes(int configIndex, int /*dpy*/) {
|
||||
dpyattr.yres = outParcel.readInt32();
|
||||
dpyattr.xdpi = outParcel.readFloat();
|
||||
dpyattr.ydpi = outParcel.readFloat();
|
||||
dpyattr.panel_type = (char) outParcel.readInt32();
|
||||
dpyattr.panel_type = outParcel.readInt32();
|
||||
dpyattr.is_yuv = outParcel.readInt32();
|
||||
ALOGI("%s() Received attrs for index %d: xres %d, yres %d",
|
||||
__FUNCTION__, configIndex, dpyattr.xres, dpyattr.yres);
|
||||
|
||||
@@ -76,18 +76,26 @@ enum {
|
||||
COMMAND_MODE,
|
||||
};
|
||||
|
||||
enum {
|
||||
DISPLAY_PORT_DEFAULT = 0,
|
||||
DISPLAY_PORT_DSI,
|
||||
DISPLAY_PORT_DTV,
|
||||
DISPLAY_PORT_WRITEBACK,
|
||||
DISPLAY_PORT_LVDS,
|
||||
DISPLAY_PORT_EDP,
|
||||
DISPLAY_PORT_DP,
|
||||
};
|
||||
|
||||
// Display Attributes that are available to clients of this library
|
||||
// Not to be confused with a similar struct in hwc_utils (in the hwc namespace)
|
||||
typedef struct DisplayAttributes {
|
||||
uint32_t vsync_period; //nanoseconds
|
||||
uint32_t xres;
|
||||
uint32_t yres;
|
||||
float xdpi;
|
||||
float ydpi;
|
||||
char panel_type;
|
||||
bool is_yuv;
|
||||
DisplayAttributes() : vsync_period(0), xres(0), yres(0), xdpi(0.0f),
|
||||
ydpi(0.0f), panel_type(0), is_yuv(false) {}
|
||||
uint32_t vsync_period = 0; //nanoseconds
|
||||
uint32_t xres = 0;
|
||||
uint32_t yres = 0;
|
||||
float xdpi = 0.0f;
|
||||
float ydpi = 0.0f;
|
||||
int panel_type = DISPLAY_PORT_DEFAULT;
|
||||
bool is_yuv = false;
|
||||
} DisplayAttributes_t;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
@@ -92,6 +92,7 @@ status_t BnQService::onTransact(
|
||||
callerUid == AID_GRAPHICS ||
|
||||
callerUid == AID_ROOT ||
|
||||
callerUid == AID_CAMERASERVER ||
|
||||
callerUid == AID_AUDIO ||
|
||||
callerUid == AID_SYSTEM);
|
||||
|
||||
if (code == CONNECT_HWC_CLIENT) {
|
||||
|
||||
@@ -118,6 +118,20 @@ enum ContentQuality {
|
||||
kContentQualityMax,
|
||||
};
|
||||
|
||||
/*! @brief This enum represents the display port.
|
||||
|
||||
@sa DisplayInterface::GetDisplayPort
|
||||
*/
|
||||
enum DisplayPort {
|
||||
kPortDefault,
|
||||
kPortDSI, // Display is connected to DSI port.
|
||||
kPortDTV, // Display is connected to DTV port
|
||||
kPortWriteBack, // Display is connected to writeback port
|
||||
kPortLVDS, // Display is connected to LVDS port
|
||||
kPortEDP, // Display is connected to EDP port
|
||||
kPortDP, // Display is connected to DP port.
|
||||
};
|
||||
|
||||
/*! @brief This structure defines configuration for fixed properties of a display device.
|
||||
|
||||
@sa DisplayInterface::GetConfig
|
||||
@@ -573,6 +587,14 @@ class DisplayInterface {
|
||||
*/
|
||||
virtual DisplayError SetDetailEnhancerData(const DisplayDetailEnhancerData &de_data) = 0;
|
||||
|
||||
/*! @brief Method to get display port information.
|
||||
|
||||
@param[out] port \link DisplayPort \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetDisplayPort(DisplayPort *port) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~DisplayInterface() { }
|
||||
};
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <bitset>
|
||||
|
||||
namespace sdm {
|
||||
using std::string;
|
||||
|
||||
const int kMaxSDELayers = 16; // Maximum number of layers that can be handled by hardware in a
|
||||
// given layer stack.
|
||||
#define MAX_PLANES 4
|
||||
@@ -63,15 +65,6 @@ enum HWDisplayMode {
|
||||
kModeCommand,
|
||||
};
|
||||
|
||||
enum HWDisplayPort {
|
||||
kPortDefault,
|
||||
kPortDSI,
|
||||
kPortDTv,
|
||||
kPortWriteBack,
|
||||
kPortLVDS,
|
||||
kPortEDP,
|
||||
};
|
||||
|
||||
enum PipeType {
|
||||
kPipeTypeUnused,
|
||||
kPipeTypeVIG,
|
||||
@@ -215,7 +208,7 @@ enum HWS3DMode {
|
||||
};
|
||||
|
||||
struct HWPanelInfo {
|
||||
HWDisplayPort port = kPortDefault; // Display port
|
||||
DisplayPort port = kPortDefault; // Display port
|
||||
HWDisplayMode mode = kModeDefault; // Display mode
|
||||
bool partial_update = false; // Partial update feature
|
||||
int left_align = 0; // ROI left alignment restriction
|
||||
|
||||
@@ -1038,4 +1038,16 @@ DisplayError DisplayBase::SetDetailEnhancerData(const DisplayDetailEnhancerData
|
||||
return kErrorNone;
|
||||
}
|
||||
|
||||
DisplayError DisplayBase::GetDisplayPort(DisplayPort *port) {
|
||||
lock_guard<recursive_mutex> obj(recursive_mutex_);
|
||||
|
||||
if (!port) {
|
||||
return kErrorParameters;
|
||||
}
|
||||
|
||||
*port = hw_panel_info_.port;
|
||||
|
||||
return kErrorNone;
|
||||
}
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
@@ -109,6 +109,7 @@ class DisplayBase : public DisplayInterface, DumpImpl {
|
||||
virtual DisplayError SetFrameBufferConfig(const DisplayConfigVariableInfo &variable_info);
|
||||
virtual DisplayError GetFrameBufferConfig(DisplayConfigVariableInfo *variable_info);
|
||||
virtual DisplayError SetDetailEnhancerData(const DisplayDetailEnhancerData &de_data);
|
||||
virtual DisplayError GetDisplayPort(DisplayPort *port);
|
||||
|
||||
protected:
|
||||
// DumpImpl method
|
||||
|
||||
@@ -805,13 +805,16 @@ void HWDevice::GetHWPanelInfoByNode(int device_node, HWPanelInfo *panel_info) {
|
||||
}
|
||||
}
|
||||
|
||||
GetHWDisplayPortAndMode(device_node, &panel_info->port, &panel_info->mode);
|
||||
GetHWDisplayPortAndMode(device_node, panel_info);
|
||||
GetSplitInfo(device_node, panel_info);
|
||||
GetHWPanelNameByNode(device_node, panel_info);
|
||||
GetHWPanelMaxBrightnessFromNode(panel_info);
|
||||
}
|
||||
|
||||
void HWDevice::GetHWDisplayPortAndMode(int device_node, HWDisplayPort *port, HWDisplayMode *mode) {
|
||||
void HWDevice::GetHWDisplayPortAndMode(int device_node, HWPanelInfo *panel_info) {
|
||||
DisplayPort *port = &panel_info->port;
|
||||
HWDisplayMode *mode = &panel_info->mode;
|
||||
|
||||
*port = kPortDefault;
|
||||
*mode = kModeDefault;
|
||||
|
||||
@@ -841,11 +844,14 @@ void HWDevice::GetHWDisplayPortAndMode(int device_node, HWDisplayPort *port, HWD
|
||||
*port = kPortEDP;
|
||||
*mode = kModeVideo;
|
||||
} else if ((strncmp(line.c_str(), "dtv panel", strlen("dtv panel")) == 0)) {
|
||||
*port = kPortDTv;
|
||||
*port = kPortDTV;
|
||||
*mode = kModeVideo;
|
||||
} else if ((strncmp(line.c_str(), "writeback panel", strlen("writeback panel")) == 0)) {
|
||||
*port = kPortWriteBack;
|
||||
*mode = kModeCommand;
|
||||
} else if ((strncmp(line.c_str(), "dp panel", strlen("dp panel")) == 0)) {
|
||||
*port = kPortDP;
|
||||
*mode = kModeVideo;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -115,7 +115,7 @@ class HWDevice : public HWInterface {
|
||||
void PopulateHWPanelInfo();
|
||||
void GetHWPanelInfoByNode(int device_node, HWPanelInfo *panel_info);
|
||||
void GetHWPanelNameByNode(int device_node, HWPanelInfo *panel_info);
|
||||
void GetHWDisplayPortAndMode(int device_node, HWDisplayPort *port, HWDisplayMode *mode);
|
||||
void GetHWDisplayPortAndMode(int device_node, HWPanelInfo *panel_info);
|
||||
void GetSplitInfo(int device_node, HWPanelInfo *panel_info);
|
||||
void GetHWPanelMaxBrightnessFromNode(HWPanelInfo *panel_info);
|
||||
int ParseLine(const char *input, char *tokens[], const uint32_t max_token, uint32_t *count);
|
||||
|
||||
@@ -1386,4 +1386,9 @@ bool HWCDisplay::IsSurfaceUpdated(const std::vector<LayerRect> &dirty_regions) {
|
||||
return (dirty_regions.empty() || IsValid(dirty_regions.at(0)));
|
||||
}
|
||||
|
||||
int HWCDisplay::GetDisplayPort(DisplayPort *port) {
|
||||
return display_intf_->GetDisplayPort(port) == kErrorNone ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
@@ -117,6 +117,7 @@ class HWCDisplay : public DisplayEventHandler {
|
||||
PPPendingParams *pending_action);
|
||||
int GetVisibleDisplayRect(hwc_rect_t* rect);
|
||||
DisplayClass GetDisplayClass();
|
||||
int GetDisplayPort(DisplayPort *port);
|
||||
|
||||
protected:
|
||||
enum DisplayStatus {
|
||||
|
||||
@@ -940,6 +940,41 @@ android::status_t HWCSession::HandleGetDisplayConfigCount(const android::Parcel
|
||||
return error;
|
||||
}
|
||||
|
||||
android::status_t HWCSession::SetDisplayPort(DisplayPort sdm_disp_port, int *hwc_disp_port) {
|
||||
if (!hwc_disp_port) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (sdm_disp_port) {
|
||||
case kPortDSI:
|
||||
*hwc_disp_port = qdutils::DISPLAY_PORT_DSI;
|
||||
break;
|
||||
case kPortDTV:
|
||||
*hwc_disp_port = qdutils::DISPLAY_PORT_DTV;
|
||||
break;
|
||||
case kPortLVDS:
|
||||
*hwc_disp_port = qdutils::DISPLAY_PORT_LVDS;
|
||||
break;
|
||||
case kPortEDP:
|
||||
*hwc_disp_port = qdutils::DISPLAY_PORT_EDP;
|
||||
break;
|
||||
case kPortWriteBack:
|
||||
*hwc_disp_port = qdutils::DISPLAY_PORT_WRITEBACK;
|
||||
break;
|
||||
case kPortDP:
|
||||
*hwc_disp_port = qdutils::DISPLAY_PORT_DP;
|
||||
break;
|
||||
case kPortDefault:
|
||||
*hwc_disp_port = qdutils::DISPLAY_PORT_DEFAULT;
|
||||
break;
|
||||
default:
|
||||
DLOGE("Invalid sdm display port %d", sdm_disp_port);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
android::status_t HWCSession::HandleGetDisplayAttributesForConfig(const android::Parcel
|
||||
*input_parcel,
|
||||
android::Parcel *output_parcel) {
|
||||
@@ -947,6 +982,8 @@ android::status_t HWCSession::HandleGetDisplayAttributesForConfig(const android:
|
||||
int dpy = input_parcel->readInt32();
|
||||
int error = android::BAD_VALUE;
|
||||
DisplayConfigVariableInfo display_attributes;
|
||||
DisplayPort sdm_disp_port = kPortDefault;
|
||||
int hwc_disp_port = qdutils::DISPLAY_PORT_DEFAULT;
|
||||
|
||||
if (dpy > HWC_DISPLAY_VIRTUAL) {
|
||||
return android::BAD_VALUE;
|
||||
@@ -955,12 +992,16 @@ android::status_t HWCSession::HandleGetDisplayAttributesForConfig(const android:
|
||||
if (hwc_display_[dpy]) {
|
||||
error = hwc_display_[dpy]->GetDisplayAttributesForConfig(config, &display_attributes);
|
||||
if (error == 0) {
|
||||
hwc_display_[dpy]->GetDisplayPort(&sdm_disp_port);
|
||||
|
||||
SetDisplayPort(sdm_disp_port, &hwc_disp_port);
|
||||
|
||||
output_parcel->writeInt32(INT(display_attributes.vsync_period_ns));
|
||||
output_parcel->writeInt32(INT(display_attributes.x_pixels));
|
||||
output_parcel->writeInt32(INT(display_attributes.y_pixels));
|
||||
output_parcel->writeFloat(display_attributes.x_dpi);
|
||||
output_parcel->writeFloat(display_attributes.y_dpi);
|
||||
output_parcel->writeInt32(0); // Panel type, unsupported.
|
||||
output_parcel->writeInt32(hwc_disp_port);
|
||||
output_parcel->writeInt32(display_attributes.is_yuv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +124,7 @@ class HWCSession : hwc_composer_device_1_t, public qClient::BnQClient {
|
||||
android::status_t GetBWTransactionStatus(const android::Parcel *input_parcel,
|
||||
android::Parcel *output_parcel);
|
||||
android::status_t SetMixerResolution(const android::Parcel *input_parcel);
|
||||
android::status_t SetDisplayPort(DisplayPort sdm_disp_port, int *hwc_disp_port);
|
||||
|
||||
static Locker locker_;
|
||||
CoreInterface *core_intf_ = NULL;
|
||||
|
||||
Reference in New Issue
Block a user