drm_hwcomposer: Fixes for display hotplug / headless mode
Further testing showed that several issues is still present:
1. Boot without display doesn't work.
2. Unplug/plug primary display has some flaws due to incomplete
HwcDisplay disposal.
3. In case creation of the pipeline fails, hwcomposer crashes.
This commit aims to address them.
Fixes: bb594baa1c68 ("drm_hwcomposer: Rework HwcDisplay disposal to avoid races")
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
diff --git a/drm/ResourceManager.cpp b/drm/ResourceManager.cpp
index c8235e9..ddf59dd 100644
--- a/drm/ResourceManager.cpp
+++ b/drm/ResourceManager.cpp
@@ -136,8 +136,10 @@
if (connected) {
auto pipeline = DrmDisplayPipeline::CreatePipeline(*conn);
- frontend_interface_->BindDisplay(pipeline.get());
- attached_pipelines_[conn] = std::move(pipeline);
+ if (pipeline) {
+ frontend_interface_->BindDisplay(pipeline.get());
+ attached_pipelines_[conn] = std::move(pipeline);
+ }
} else {
auto &pipeline = attached_pipelines_[conn];
frontend_interface_->UnbindDisplay(pipeline.get());