diff options
author | Kaiyi Li <kaiyili@google.com> | 2024-03-12 09:02:30 -0700 |
---|---|---|
committer | Kaiyi Li <kaiyili@google.com> | 2024-03-12 12:48:39 -0700 |
commit | c1e544c5748c143c405293350978b0db9b495165 (patch) | |
tree | b6fb22d6e5c1ed3f536cf6fef9b75ff87da63ef1 | |
parent | 32e51246d901670ec78965dded50f8b060d6ccd0 (diff) | |
download | goldfish-opengl-c1e544c5748c143c405293350978b0db9b495165.tar.gz |
hwc3: edid: fallback to drmModeConnector display size
... if we fail to parse the EDID blob.
In a downstream crosvm implementation, we don't provide the detailed
timing block in the EDID blob. We provide a display ID extension
instead.
In following CLs, we will refactor the EDID parsing logic to also take
that and correctly fallback the display size in a cascade way.
Bug: b/328091332
Test: presubmit
Change-Id: Ic18cd5a9d8b6298c85c8a629d5b4c9b26c0ce898
-rw-r--r-- | system/hwc3/DrmConnector.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/system/hwc3/DrmConnector.cpp b/system/hwc3/DrmConnector.cpp index c5f9e0d8..081310e3 100644 --- a/system/hwc3/DrmConnector.cpp +++ b/system/hwc3/DrmConnector.cpp @@ -70,13 +70,16 @@ bool DrmConnector::update(::android::base::borrowed_fd drmFd) { if (mStatus == DRM_MODE_CONNECTED) { std::optional<EdidInfo> maybeEdidInfo = loadEdid(drmFd); - if (!maybeEdidInfo) { - ALOGE("%s: failed to parse EDID info for display:%" PRIu32 ".", __FUNCTION__, mId); - return false; + if (maybeEdidInfo) { + const EdidInfo& edidInfo = maybeEdidInfo.value(); + mWidthMillimeters = edidInfo.mWidthMillimeters; + mHeightMillimeters = edidInfo.mHeightMillimeters; + } else { + ALOGW("%s: Use fallback size from drmModeConnector. This can result inaccurate DPIs.", + __FUNCTION__); + mWidthMillimeters = drmConnector->mmWidth; + mHeightMillimeters = drmConnector->mmHeight; } - const EdidInfo& edidInfo = maybeEdidInfo.value(); - mWidthMillimeters = edidInfo.mWidthMillimeters; - mHeightMillimeters = edidInfo.mHeightMillimeters; } DEBUG_LOG("%s: connector:%" PRIu32 " widthMillimeters:%" PRIu32 " heightMillimeters:%" PRIu32, |