From 56e3cb9502f9db5fbca9aca5087f81c92ddc1747 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 8 Sep 2022 10:10:29 +0200 Subject: [PATCH] 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. --- alloc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/alloc.c b/alloc.c index fcc54ae..e6bc172 100644 --- a/alloc.c +++ b/alloc.c @@ -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; } }