Check compatible CRTCs before disabling planes

Only disable planes we can make use of.

Disabling other planes causes same noise and failures if the plane
is still being used on another CRTC.

One motivation for disabling all planes may be to potentially get
more bandwidth to work with. However, we can only increase the
avilable bandwidth by disabling previously enabled planes. KMS will
refuse to switch a plane's CRTC without completely disabling it
first.
This commit is contained in:
Simon Ser 2022-09-08 10:10:29 +02:00
parent bcfca8f602
commit 56e3cb9502

22
alloc.c
View file

@ -721,15 +721,19 @@ liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req,
* enabled. */
candidate_planes = 0;
liftoff_list_for_each(plane, &device->planes, link) {
if (plane->layer == NULL) {
candidate_planes++;
liftoff_log(LIFTOFF_DEBUG,
"Disabling plane %"PRIu32, plane->id);
ret = plane_apply(plane, NULL, req);
assert(ret != -EINVAL);
if (ret != 0) {
return ret;
}
if (plane->layer != NULL) {
continue;
}
if ((plane->possible_crtcs & (1 << output->crtc_index)) == 0) {
continue;
}
candidate_planes++;
liftoff_log(LIFTOFF_DEBUG, "Disabling plane %"PRIu32, plane->id);
ret = plane_apply(plane, NULL, req);
assert(ret != -EINVAL);
if (ret != 0) {
return ret;
}
}