drm_hwcomposer: Update FlatteningController behavior
Under the previous behavior, NewFrame both updated the internal state tracking to indicate that the scene is not idle, as well as returning a bool to indicate whether the scene should be flattened or not. ShouldFlatten was not being used, and would return `true` during the interval between the refresh callback being triggered and the next NewFrame, which would be in response to the refresh callback. Subsequent calls to ShouldFlatten would return `false` even though the scene remains idle. This commit updates NewFrame to only update the internal state. Callers should call ShouldFlatten to check whether the controller has detected that the scene should be flattened. After the callback is triggered, ShouldFlatten returns true. It will continue to return true after the first NewFrame, which would be in response to the refresh callback. Subsequent NewFrame calls will reset the idle detection. Change-Id: I8b11a55bb6b101bb2ce473a844f5b9795a027956
This commit is contained in:
parent
ce65d6c6e3
commit
2432cb0dfa
3 changed files with 18 additions and 12 deletions
|
|
@ -47,13 +47,13 @@ auto Backend::ValidateDisplay(HwcDisplay* display) -> ValidatedComposition {
|
|||
|
||||
auto flatcon = display->GetFlatCon();
|
||||
if (flatcon) {
|
||||
bool should_flatten = false;
|
||||
if (layers.size() <= 1)
|
||||
if (layers.size() <= 1) {
|
||||
flatcon->Disable();
|
||||
else
|
||||
should_flatten = flatcon->NewFrame();
|
||||
} else {
|
||||
flatcon->NewFrame();
|
||||
}
|
||||
|
||||
if (should_flatten) {
|
||||
if (flatcon->ShouldFlatten()) {
|
||||
display->total_stats().frames_flattened++;
|
||||
return GetFlattenedComposition(layers);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue