1
0
Fork 0

drm_hwcomposer: Teardown the pipeline and DRM resources on disconnect

This commit properly tears down the display pieline when the
display is disconnected. This frees up the DRM CRTC and other
resources used by the connector. This ensures that the
consecutive hotplugs work correctly to reallocate the CRTCs
when new displays are connected.

This was verified by ensuring the CRTCs, mode, connectors
are freed up in modetest.

This fixes the issue of display not coming back after
screen timeout and fixes the Android VTS SetPowerMode(Off) failures

Fixes: 025ea5bfbb ("drm_hwcomposer: Teardown the pipeline and DRM
resources on disconnect")
Change-Id: Icdca56433b5cd565d1658b1a415565adc7980088
Signed-off-by: Manasi Navare <navaremanasi@google.com>
This commit is contained in:
Manasi Navare 2025-04-02 22:19:52 +00:00
parent 3ea1c36308
commit 2d4621a7c3
3 changed files with 8 additions and 0 deletions

View file

@ -123,6 +123,12 @@ auto DrmAtomicStateManager::CommitFrame(AtomicCommitArgs &args) -> int {
!connector->GetCrtcIdProperty().AtomicSet(*pset, crtc->GetId())) {
return -EINVAL;
}
if (!*args.active && args.teardown) {
if (!connector->GetCrtcIdProperty().AtomicSet(*pset, 0) ||
!crtc->GetModeProperty().AtomicSet(*pset, 0)) {
return -EINVAL;
}
}
}
auto *drm = pipe_->device;

View file

@ -34,6 +34,7 @@ struct AtomicCommitArgs {
/* inputs. All fields are optional, but at least one has to be specified */
bool test_only = false;
bool blocking = false;
bool teardown = false;
std::optional<DrmMode> display_mode;
std::optional<bool> active;
std::shared_ptr<DrmKmsPlan> composition;

View file

@ -516,6 +516,7 @@ void HwcDisplay::Deinit() {
GetPipe().atomic_state_manager->ExecuteAtomicCommit(a_args);
a_args.composition = {};
a_args.active = false;
a_args.teardown = true;
GetPipe().atomic_state_manager->ExecuteAtomicCommit(a_args);
current_plan_.reset();