drm_hwcomposer: Send crtc.active and crtc.mode together with the frame
On HiKey/HiKey960 boards, enabling the crtc before the first
composition is set can cause trouble, as part of the display
engine is configured in the atomic plane update method.
So when commit 36a7f28516a4 ("drm_hwcomposer: Rework display
Mode Setting and DPMS handling"), which reworked the dpms and
modeset logic to commit the modeset immediately, landed it
caused bootup regressions on those boards.
Talking with others it seems other drivers likely may have
issues trying to enable the crtc without a plane.
Thus this patch changes the logic to queue modesets so they
are submitted with the initial composition. Similarly it
removes the crtc activation, as the initial composition will
implicitly activate the crtc.
Fixes: 36a7f28516a4 ("drm_hwcomposer: Rework display Mode Setting and DPMS handling")
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
[jstultz: Added commit message, reworked a comment]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: Ie4d1f967da052b0b3ef73257c2ca76b30504a6c2
diff --git a/DrmHwcTwo.cpp b/DrmHwcTwo.cpp
index 8142e6c..291bbdd 100644
--- a/DrmHwcTwo.cpp
+++ b/DrmHwcTwo.cpp
@@ -757,6 +757,9 @@
}
a_args.composition = composition;
+ if (staged_mode) {
+ a_args.display_mode = *staged_mode;
+ }
ret = compositor_.ExecuteAtomicCommit(a_args);
if (ret) {
@@ -764,6 +767,11 @@
ALOGE("Failed to apply the frame composition ret=%d", ret);
return HWC2::Error::BadParameter;
}
+
+ if (!a_args.test_only) {
+ staged_mode.reset();
+ }
+
return HWC2::Error::None;
}
@@ -805,16 +813,7 @@
auto &mode = hwc_configs_[conf].mode;
- AtomicCommitArgs a_args = {
- .display_mode = mode,
- .clear_active_composition = true,
- };
-
- int err = compositor_.ExecuteAtomicCommit(a_args);
- if (err != 0) {
- ALOGE("Failed to queue mode changing commit %d", err);
- return HWC2::Error::BadConfig;
- }
+ staged_mode = mode;
active_config_id_ = conf;
@@ -895,7 +894,13 @@
a_args.active = false;
break;
case HWC2::PowerMode::On:
- a_args.active = true;
+ /*
+ * Setting the display to active before we have a composition
+ * can break some drivers, so skip setting a_args.active to
+ * true, as the next composition frame will implicitly activate
+ * the display
+ */
+ return HWC2::Error::None;
break;
case HWC2::PowerMode::Doze:
case HWC2::PowerMode::DozeSuspend: