diff options
author | Adrian Salido <salidoa@google.com> | 2017-04-12 05:18:06 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-04-12 05:18:06 +0000 |
commit | b736291ace9281afab9484b141dd523b614d0214 (patch) | |
tree | 2551498494ae1dd22bbf2ae66efb5574905a1a4c | |
parent | afa2a8a0d7d88b03244ccfde07263994fd7e4b4d (diff) | |
parent | 45002321ef3a9023642cfb9854eb4171fa5653cb (diff) | |
download | drm_hwcomposer-b736291ace9281afab9484b141dd523b614d0214.tar.gz |
drm_hwcomposer: fix pre comp regions during protected playback
am: 45002321ef
Change-Id: Iead343d835ab82f1bb1d38ca0ab2c97118d5056c
-rw-r--r-- | platform.cpp | 28 | ||||
-rw-r--r-- | platform.h | 12 | ||||
-rw-r--r-- | platformnv.cpp | 1 |
3 files changed, 41 insertions, 0 deletions
diff --git a/platform.cpp b/platform.cpp index 105d8f7..e920872 100644 --- a/platform.cpp +++ b/platform.cpp @@ -140,6 +140,34 @@ int PlanStageProtected::ProvisionPlanes( return 0; } +int PlanStagePrecomp::ProvisionPlanes( + std::vector<DrmCompositionPlane> *composition, + std::map<size_t, DrmHwcLayer *> &layers, DrmCrtc *crtc, + std::vector<DrmPlane *> *planes) { + DrmCompositionPlane *precomp = GetPrecomp(composition); + if (!precomp || precomp->source_layers().empty()) + return 0; + + // Find lowest zorder out of precomp layers + size_t precomp_zorder = *std::min_element( + precomp->source_layers().begin(), precomp->source_layers().end(), + [](size_t a, size_t b) { return a < b; }); + + // if there are any remaining layers on top of any of the precomp layers, + // add them to precomp to avoid blending issues since precomp is always at + // highest zorder + for (auto i = layers.begin(); i != layers.end();) { + if (i->first < precomp_zorder) { + i++; + continue; + } + precomp->source_layers().emplace_back(i->first); + i = layers.erase(i); + } + + return 0; +} + int PlanStageGreedy::ProvisionPlanes( std::vector<DrmCompositionPlane> *composition, std::map<size_t, DrmHwcLayer *> &layers, DrmCrtc *crtc, @@ -152,6 +152,18 @@ class PlanStageProtected : public Planner::PlanStage { std::vector<DrmPlane *> *planes); }; +// This plan stage provisions the precomp plane with any remaining layers that +// are on top of the current precomp layers. This stage should be included in +// all platforms before loosely allocating layers (i.e. PlanStageGreedy) if +// any previous plan could have modified the precomp plane layers +// (ex. PlanStageProtected). +class PlanStagePrecomp : public Planner::PlanStage { + public: + int ProvisionPlanes(std::vector<DrmCompositionPlane> *composition, + std::map<size_t, DrmHwcLayer *> &layers, DrmCrtc *crtc, + std::vector<DrmPlane *> *planes); +}; + // This plan stage places as many layers on dedicated planes as possible (first // come first serve), and then sticks the rest in a precomposition plane (if // needed). diff --git a/platformnv.cpp b/platformnv.cpp index db7ee36..084d4f0 100644 --- a/platformnv.cpp +++ b/platformnv.cpp @@ -190,6 +190,7 @@ std::unique_ptr<Planner> Planner::CreateInstance(DrmResources *) { std::unique_ptr<Planner> planner(new Planner); planner->AddStage<PlanStageProtectedRotated>(); planner->AddStage<PlanStageProtected>(); + planner->AddStage<PlanStagePrecomp>(); planner->AddStage<PlanStageGreedy>(); return planner; } |