Fix early bailout when we already have a better allocation

In case we can't do better than the current best allocation even if we manage
to allocate all remaining planes, we bail out early. However the bailout
condition was incorrect and didn't account for the current score.
This commit is contained in:
Simon Ser 2019-09-12 10:17:03 +03:00
parent 1509e50fd5
commit fc901d0e26
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -322,7 +322,7 @@ bool output_choose_layers(struct hwc_output *output, struct plane_alloc *alloc,
next_data.alloc = data->alloc;
remaining_planes = alloc->planes_len - data->plane_idx;
if (alloc->best_score >= (int)remaining_planes) {
if (alloc->best_score >= data->score + (int)remaining_planes) {
/* Even if we find a layer for all remaining planes, we won't
* find a better allocation. Give up. */
return true;