Commit e839aed3 authored by Roman Stratiienko's avatar Roman Stratiienko Committed by John Stultz
Browse files

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 36a7f285 ("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: 36a7f285

  ("drm_hwcomposer: Rework display Mode Setting and DPMS handling")
Signed-off-by: default avatarRoman Stratiienko <roman.o.stratiienko@globallogic.com>
[jstultz: Added commit message, reworked a comment]
Signed-off-by: John Stultz's avatarJohn Stultz <john.stultz@linaro.org>
Change-Id: Ie4d1f967da052b0b3ef73257c2ca76b30504a6c2
parent 7f576ec5
Pipeline #481881 passed with stages
in 7 minutes and 18 seconds
......@@ -757,6 +757,12 @@ HWC2::Error DrmHwcTwo::HwcDisplay::CreateComposition(AtomicCommitArgs &a_args) {
}
a_args.composition = composition;
if (staged_mode) {
a_args.display_mode = *staged_mode;
if (!a_args.test_only) {
staged_mode.reset();
}
}
ret = compositor_.ExecuteAtomicCommit(a_args);
if (ret) {
......@@ -764,6 +770,11 @@ HWC2::Error DrmHwcTwo::HwcDisplay::CreateComposition(AtomicCommitArgs &a_args) {
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 +816,7 @@ HWC2::Error DrmHwcTwo::HwcDisplay::SetActiveConfig(hwc2_config_t config) {
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 +897,13 @@ HWC2::Error DrmHwcTwo::HwcDisplay::SetPowerMode(int32_t mode_in) {
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:
......
......@@ -22,6 +22,7 @@
#include <array>
#include <map>
#include <optional>
#include "compositor/DrmDisplayCompositor.h"
#include "compositor/Planner.h"
......@@ -347,6 +348,8 @@ class DrmHwcTwo : public hwc2_device_t {
DrmHwcTwo *hwc2_;
std::optional<DrmMode> staged_mode;
ResourceManager *resource_manager_;
DrmDevice *drm_;
DrmDisplayCompositor compositor_;
......
......@@ -23,6 +23,7 @@
#include <functional>
#include <memory>
#include <optional>
#include <sstream>
#include <tuple>
......
Supports Markdown
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