Commit ec20a6bb authored by Mark Yacoub's avatar Mark Yacoub Committed by Commit Bot

Disable disconnected connectors holding to an encoder at Init.

Zombie connectors could be disconnected but holding to an encoder,
taking a CRTC that should be unused (potentially due to bios enabling it
on for the warning screen).
As the CRTC is being initialized, all connectors connected to it should
be disabled. This is a workaround for a bug on Hatch where Puff enables
a connector in dev mode before Chrome even starts. The kernel maps the HW
state at initial modeset (with a dangling connector attached to a CRTC).
When an Atomic Modeset is performed, it fails to modeset as the CRTC is
already attached to another dead connector.

BUG=1067121.
TEST=Puff should be work fine with atomic modeset. All displays should
be enabled with no problem.

Change-Id: I68f554a4450c9384bdd2762d043f6f254d2365be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350359
Commit-Queue: Mark Yacoub <markyacoub@google.com>
Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807585}
parent fdc37ef2
......@@ -337,6 +337,7 @@ bool HardwareDisplayPlaneManager::InitializeCrtcState() {
return false;
}
DisableConnectedConnectorsToCrtcs(resources);
ResetConnectorsCache(resources);
unsigned int num_crtcs_with_out_fence_ptr = 0;
......@@ -393,4 +394,27 @@ bool HardwareDisplayPlaneManager::InitializeCrtcState() {
return true;
}
void HardwareDisplayPlaneManager::DisableConnectedConnectorsToCrtcs(
const ScopedDrmResourcesPtr& resources) {
// Should only be called when no CRTC state has been set yet because we
// hard-disable CRTCs.
DCHECK(crtc_state_.empty());
for (int i = 0; i < resources->count_connectors; ++i) {
ScopedDrmConnectorPtr connector =
drm_->GetConnector(resources->connectors[i]);
if (!connector)
continue;
// Disable Zombie connectors (disconnected connectors but holding to an
// encoder).
if (connector->encoder_id &&
connector->connection == DRM_MODE_DISCONNECTED) {
ScopedDrmEncoderPtr encoder(
drmModeGetEncoder(drm_->get_fd(), connector->encoder_id));
if (encoder)
drm_->DisableCrtc(encoder->crtc_id);
}
}
}
} // namespace ui
......@@ -184,6 +184,16 @@ class HardwareDisplayPlaneManager {
bool InitializeCrtcState();
// As the CRTC is being initialized, all connectors connected to it should
// be disabled. This is a workaround for a bug on Hatch where Puff enables
// a connector in dev mode before Chrome even starts. The kernel maps the HW
// state at initial modeset (with a dangling connector attached to a CRTC).
// When an Atomic Modeset is performed, it fails to modeset as the CRTC is
// already attached to another dead connector. (Analysis: crbug/1067121#c5)
// TODO(b/168154314): Remove this call when the bug is fixed.
void DisableConnectedConnectorsToCrtcs(
const ScopedDrmResourcesPtr& resources);
virtual bool InitializePlanes() = 0;
virtual bool SetPlaneData(HardwareDisplayPlaneList* plane_list,
......
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