From 1ca4a03224ed19fc9c4121b1c04d14ba8f7fecaf Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 23 Aug 2019 19:20:05 +0300 Subject: [PATCH] Disable all planes before building the mapping --- display.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/display.c b/display.c index 6acec76..23ae563 100644 --- a/display.c +++ b/display.c @@ -227,7 +227,8 @@ bool hwc_display_apply(struct hwc_display *display, drmModeAtomicReq *req) struct hwc_layer *layer; struct hwc_plane *plane; - /* TODO: incremental updates keeping old configuration if possible */ + /* Unset all existing plane and layer mappings. + TODO: incremental updates keeping old configuration if possible */ for (i = 0; i < display->planes_len; i++) { plane = &display->planes[i]; if (plane->layer != NULL) { @@ -236,6 +237,16 @@ bool hwc_display_apply(struct hwc_display *display, drmModeAtomicReq *req) } } + /* Disable all planes. Do it before building mappings to make sure not + to hit bandwidth limits because too many planes are enabled. */ + for (i = 0; i < display->planes_len; i++) { + plane = &display->planes[i]; + if (plane->layer == NULL) { + fprintf(stderr, "Disabling plane %d\n", plane->id); + plane_apply(plane, NULL, req); + } + } + hwc_list_for_each(output, &display->outputs, link) { hwc_list_for_each(layer, &output->layers, link) { if (!layer_choose_plane(layer, req)) { @@ -246,13 +257,5 @@ bool hwc_display_apply(struct hwc_display *display, drmModeAtomicReq *req) } } - for (i = 0; i < display->planes_len; i++) { - plane = &display->planes[i]; - if (plane->layer == NULL) { - fprintf(stderr, "Disabling plane %d\n", plane->id); - plane_apply(plane, NULL, req); - } - } - return true; }