drm_hwcomposer: Presentation to cursor plane
This change adds support for presenting to the cursor plane.
Logic is added to match cursor layers with cursor planes during
composition, plus additional test commit logic with backoff
behavior. Prior to this change, cursor planes were never
considered during composition. After this change, cursor
planes are available to be matched with compatible layers and
then used for presentation.
Change-Id: I3acd131cd210de46ff19af5a8960b07a82f462b2
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
diff --git a/compositor/DrmKmsPlan.cpp b/compositor/DrmKmsPlan.cpp
index 443b515..1155697 100644
--- a/compositor/DrmKmsPlan.cpp
+++ b/compositor/DrmKmsPlan.cpp
@@ -23,17 +23,30 @@
#include "utils/log.h"
namespace android {
-auto DrmKmsPlan::CreateDrmKmsPlan(DrmDisplayPipeline &pipe,
- std::vector<LayerData> composition)
- -> std::unique_ptr<DrmKmsPlan> {
+auto DrmKmsPlan::CreateDrmKmsPlan(
+ DrmDisplayPipeline &pipe, std::vector<LayerData> composition,
+ std::optional<LayerData> cursor_layer) -> std::unique_ptr<DrmKmsPlan> {
auto plan = std::make_unique<DrmKmsPlan>();
auto [avail_planes, cursor_plane] = pipe.GetUsablePlanes();
int z_pos = 0;
+ if (cursor_layer.has_value()) {
+ if (cursor_plane &&
+ cursor_plane->Get()->IsValidForLayer(&cursor_layer.value())) {
+ plan->plan.emplace_back(
+ LayerToPlaneJoining{.layer = std::move(cursor_layer.value()),
+ .plane = cursor_plane,
+ .z_pos = z_pos++});
+ } else {
+ // Cursor layer can't use cursor plane, so let it match normally with
+ // others.
+ composition.push_back(std::move(cursor_layer.value()));
+ }
+ }
+
for (auto &dhl : composition) {
std::shared_ptr<BindingOwner<DrmPlane>> plane;
-
/* Skip unsupported planes */
do {
if (avail_planes.empty()) {