Disable all planes before building the mapping

This commit is contained in:
Simon Ser 2019-08-23 19:20:05 +03:00
parent c5601aef5d
commit 1ca4a03224
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -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;
}