Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit 04ef438

Browse files
committed
Force Vpp composition when video count more than plane count
This scenario is true when ACRN only assign 1 plane to Andriod Then VPP should be used for composition due to 2 reasons 1: If video is protected, 3D patch can't not deal with it 2: Some video effect still wanted on the video layer Change-Id: I892fef1f13cd4e2b7665b2d5edb7c0203faf118a Tracked-On: None Tests: Android UI normal Signed-off-by: Lin Johnson <johnson.lin@intel.com>
1 parent 99affed commit 04ef438

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

common/display/displayplanemanager.cpp

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,21 @@ bool DisplayPlaneManager::ValidateLayers(
130130
j->get()->SetInUse(false);
131131
}
132132

133+
size_t video_layers = 0;
134+
for (size_t lindex = add_index; lindex < layers.size(); lindex++) {
135+
if (layers[lindex].IsVideoLayer())
136+
video_layers++;
137+
}
138+
// If video layers is more than available planes
139+
// We are going to force all the layers bo be composited by VA path
140+
if (video_layers >= overlay_planes_.size() - composition.size()) {
141+
ForceVppForAllLayers(commit_planes, composition, layers, add_index,
142+
mark_later, false);
143+
*re_validation_needed = false;
144+
*commit_checked = true;
145+
return true;
146+
}
147+
133148
std::vector<OverlayLayer *> cursor_layers;
134149
auto layer_begin = layers.begin();
135150
auto layer_end = layers.end();
@@ -850,6 +865,64 @@ bool DisplayPlaneManager::CheckPlaneFormat(uint32_t format) {
850865
return overlay_planes_.at(0)->IsSupportedFormat(format);
851866
}
852867

868+
void DisplayPlaneManager::ForceVppForAllLayers(
869+
std::vector<OverlayPlane> &commit_planes,
870+
DisplayPlaneStateList &composition, std::vector<OverlayLayer> &layers,
871+
size_t add_index, std::vector<NativeSurface *> &mark_later,
872+
bool recycle_resources) {
873+
auto layer_begin = layers.begin() + add_index;
874+
// all planes already assigned, let's reset them into one plane VPP
875+
if (composition.size() >= overlay_planes_.size()) {
876+
layer_begin = layers.begin();
877+
for (DisplayPlaneState &plane : composition) {
878+
MarkSurfacesForRecycling(&plane, mark_later, recycle_resources);
879+
}
880+
DisplayPlaneStateList().swap(composition);
881+
std::vector<OverlayPlane>().swap(commit_planes);
882+
auto overlay_begin = overlay_planes_.begin();
883+
// Let's mark all planes as free to be used.
884+
for (auto j = overlay_begin; j < overlay_planes_.end(); ++j) {
885+
j->get()->SetInUse(false);
886+
}
887+
}
888+
889+
auto layer_end = layers.end();
890+
OverlayLayer *primary_layer = &(*(layer_begin));
891+
DisplayPlane *current_plane = overlay_planes_.at(composition.size()).get();
892+
composition.emplace_back(current_plane, primary_layer, this,
893+
primary_layer->GetZorder(), display_transform_);
894+
DisplayPlaneState &last_plane = composition.back();
895+
last_plane.ForceGPURendering();
896+
layer_begin++;
897+
#ifdef SURFACE_TRACING
898+
ISURFACETRACE("Added layer in ForceGpuForAllLayers: %d \n",
899+
primary_layer->GetZorder());
900+
#endif
901+
902+
for (auto i = layer_begin; i != layer_end; ++i) {
903+
#ifdef SURFACE_TRACING
904+
ISURFACETRACE("Added layer in ForceGpuForAllLayers: %d \n", i->GetZorder());
905+
#endif
906+
last_plane.AddLayer(&(*(i)));
907+
i->SetLayerComposition(OverlayLayer::kGpu);
908+
}
909+
last_plane.SetVideoPlane(true);
910+
EnsureOffScreenTarget(last_plane);
911+
current_plane->SetInUse(true);
912+
913+
commit_planes.emplace_back(
914+
OverlayPlane(last_plane.GetDisplayPlane(), last_plane.GetOverlayLayer()));
915+
// Check for Any display transform to be applied.
916+
ValidateForDisplayTransform(last_plane, commit_planes);
917+
// Check for any change to scalar usage.
918+
ValidateForDisplayScaling(last_plane, commit_planes);
919+
// Check for Downscaling.
920+
ValidateForDownScaling(last_plane, commit_planes);
921+
// Reset andy Scanout validation state.
922+
uint32_t validation_done = DisplayPlaneState::ReValidationType::kScanout;
923+
last_plane.RevalidationDone(validation_done);
924+
}
925+
853926
void DisplayPlaneManager::ForceGpuForAllLayers(
854927
std::vector<OverlayPlane> &commit_planes,
855928
DisplayPlaneStateList &composition, std::vector<OverlayLayer> &layers,

common/display/displayplanemanager.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ class DisplayPlaneManager {
161161
std::vector<NativeSurface *> &mark_later,
162162
bool recycle_resources);
163163

164+
void ForceVppForAllLayers(std::vector<OverlayPlane> &commit_planes,
165+
DisplayPlaneStateList &composition,
166+
std::vector<OverlayLayer> &layers, size_t add_index,
167+
std::vector<NativeSurface *> &mark_later,
168+
bool recycle_resources);
169+
164170
// This should be called only in case of a new cursor layer
165171
// being added and all other layers are same as previous
166172
// frame.

0 commit comments

Comments
 (0)