Commit b3d81781 authored by Lowry Li's avatar Lowry Li Committed by John Stultz
Browse files

drm_hwcomposer: Add GetDisplayCapabilities and getDisplayIdentificationData

Implement GetDisplayCapabilities() to get a list of supported capabilities.
The drm core doesn't support layer CTM property yet and CRTC not having the
CTM property member neither. So for this patch, we just return 0 for now.
It can fix the segment fault while booting the Android on HWC2.3, caused by
lack of this API.

Implement getDisplayIdentificationData() to get the EDID blob data
along with the size and port.
Add edid property in DrmConnector.
Signed-off-by: Lowry Li's avatarLowry Li (Arm Technology China) <>
parent 4163efcb
Pipeline #93756 passed with stage
in 32 seconds
......@@ -58,6 +58,11 @@ int DrmConnector::Init() {
ALOGE("Could not get CRTC_ID property\n");
return ret;
ret = drm_->GetConnectorProperty(*this, "EDID", &edid_property_);
if (ret) {
ALOGE("Could not get EDID property\n");
return ret;
if (writeback()) {
ret = drm_->GetConnectorProperty(*this, "WRITEBACK_PIXEL_FORMATS",
......@@ -191,6 +196,10 @@ const DrmProperty &DrmConnector::crtc_id_property() const {
return crtc_id_property_;
const DrmProperty &DrmConnector::edid_property() const {
return edid_property_;
const DrmProperty &DrmConnector::writeback_pixel_formats() const {
return writeback_pixel_formats_;
......@@ -956,6 +956,43 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
return *num_types ? HWC2::Error::HasChanges : HWC2::Error::None;
HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayIdentificationData(
uint8_t *outPort, uint32_t *outDataSize, uint8_t *outData) {
drmModePropertyBlobPtr blob;
int ret;
uint64_t blob_id;
std::tie(ret, blob_id) = connector_->edid_property().value();
if (ret) {
ALOGE("Failed to get edid property value.");
return HWC2::Error::Unsupported;
blob = drmModeGetPropertyBlob(drm_->fd(), blob_id);
outData = static_cast<uint8_t *>(blob->data);
*outPort = connector_->id();
*outDataSize = blob->length;
return HWC2::Error::None;
HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayCapabilities(
uint32_t *outNumCapabilities, uint32_t *outCapabilities) {
unsupported(__func__, outCapabilities);
if (outNumCapabilities == NULL) {
return HWC2::Error::BadParameter;
*outNumCapabilities = 0;
return HWC2::Error::None;
HWC2::Error DrmHwcTwo::HwcLayer::SetCursorPosition(int32_t x, int32_t y) {
cursor_x_ = x;
......@@ -1278,6 +1315,16 @@ hwc2_function_pointer_t DrmHwcTwo::HookDevGetFunction(
&HwcDisplay::ValidateDisplay, uint32_t *, uint32_t *>);
case HWC2::FunctionDescriptor::GetDisplayIdentificationData:
&HwcDisplay::GetDisplayIdentificationData, uint8_t *,
uint32_t *, uint8_t *>);
case HWC2::FunctionDescriptor::GetDisplayCapabilities:
&HwcDisplay::GetDisplayCapabilities, uint32_t *,
uint32_t *>);
// Layer functions
case HWC2::FunctionDescriptor::SetCursorPosition:
......@@ -62,6 +62,7 @@ class DrmConnector {
const DrmProperty &dpms_property() const;
const DrmProperty &crtc_id_property() const;
const DrmProperty &edid_property() const;
const DrmProperty &writeback_pixel_formats() const;
const DrmProperty &writeback_fb_id() const;
const DrmProperty &writeback_out_fence() const;
......@@ -100,6 +101,7 @@ class DrmConnector {
DrmProperty dpms_property_;
DrmProperty crtc_id_property_;
DrmProperty edid_property_;
DrmProperty writeback_pixel_formats_;
DrmProperty writeback_fb_id_;
DrmProperty writeback_out_fence_;
......@@ -173,6 +173,11 @@ class DrmHwcTwo : public hwc2_device_t {
uint32_t *num_elements, hwc2_layer_t *layers,
int32_t *layer_requests);
HWC2::Error GetDisplayType(int32_t *type);
HWC2::Error GetDisplayIdentificationData(uint8_t *outPort,
uint32_t *outDataSize,
uint8_t *outData);
HWC2::Error GetDisplayCapabilities(uint32_t *outNumCapabilities,
uint32_t *outCapabilities);
HWC2::Error GetDozeSupport(int32_t *support);
HWC2::Error GetHdrCapabilities(uint32_t *num_types, int32_t *types,
float *max_luminance,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment