OverlayPlane(temp.GetDisplayPlane(), temp.GetOverlayLayer()));
}
- if (check_plane && add_index <= 0) {
+ if (check_plane && add_index == -1) {
+ bool temp;
// We are only revalidating planes and can avoid full validation.
return ReValidatePlanes(commit_planes, composition, layers, mark_later,
- recycle_resources);
+ &temp, recycle_resources);
}
if (!previous_composition.empty() && add_index <= 0) {
auto layer_begin = layers.begin();
auto layer_end = layers.end();
bool render_layers = false;
+ bool validate_final_layers = false;
OverlayLayer *previous_layer = NULL;
if (add_index > 0) {
// If we are able to composite buffer with the given plane, lets use
// it.
bool fall_back = FallbacktoGPU(plane, layer, commit_planes);
+ validate_final_layers = false;
if (!fall_back || prefer_seperate_plane) {
composition.emplace_back(plane, layer, layer->GetZorder());
plane->SetInUse(true);
if (fall_back) {
ResetPlaneTarget(last_plane, commit_planes.back());
+ validate_final_layers = true;
}
break;
} else {
last_plane.AddLayer(layer);
if (!last_plane.GetOffScreenTarget()) {
ResetPlaneTarget(last_plane, commit_planes.back());
+ validate_final_layers = true;
}
}
}
}
if (last_plane.NeedsOffScreenComposition()) {
- if (previous_layer) {
- // In this case we need to fallback to 3Dcomposition till Media
- // backend adds support for multiple layers.
- bool force_buffer = false;
- if (is_video && last_plane.GetSourceLayers().size() > 1 &&
- last_plane.GetOffScreenTarget()) {
- MarkSurfacesForRecycling(&last_plane, mark_later,
- recycle_resources);
- force_buffer = true;
- }
+ // In this case we need to fallback to 3Dcomposition till Media
+ // backend adds support for multiple layers.
+ bool force_buffer = false;
+ if (is_video && last_plane.GetSourceLayers().size() > 1 &&
+ last_plane.GetOffScreenTarget()) {
+ MarkSurfacesForRecycling(&last_plane, mark_later, recycle_resources);
+ force_buffer = true;
+ }
- if (!last_plane.GetOffScreenTarget() || force_buffer) {
- ResetPlaneTarget(last_plane, commit_planes.back());
- }
+ if (!last_plane.GetOffScreenTarget() || force_buffer) {
+ ResetPlaneTarget(last_plane, commit_planes.back());
+ validate_final_layers = true;
+ }
+ if (previous_layer) {
ValidateForDisplayScaling(composition.back(), commit_planes,
previous_layer);
}
}
if (!cursor_layers.empty()) {
- bool render_cursor_layer =
- ValidateCursorLayer(commit_planes, cursor_layers, mark_later,
- composition, recycle_resources);
+ bool render_cursor_layer = ValidateCursorLayer(
+ commit_planes, cursor_layers, mark_later, composition,
+ &validate_final_layers, recycle_resources);
if (!render_layers) {
render_layers = render_cursor_layer;
}
}
- if (render_layers) {
- ValidateFinalLayers(commit_planes, composition, layers, mark_later,
- recycle_resources);
+ if (check_plane) {
+ // We are only revalidating planes and can avoid full validation.
+ bool status =
+ ReValidatePlanes(commit_planes, composition, layers, mark_later,
+ &validate_final_layers, recycle_resources);
+ if (!render_layers) {
+ render_layers = status;
+ }
+ }
- if (check_plane) {
- render_layers = ReValidatePlanes(commit_planes, composition, layers,
- mark_later, recycle_resources);
+ if (render_layers) {
+ if (validate_final_layers) {
+ ValidateFinalLayers(commit_planes, composition, layers, mark_later,
+ recycle_resources);
}
for (DisplayPlaneState &plane : composition) {
void DisplayPlaneManager::PreparePlaneForCursor(
DisplayPlaneState *plane, std::vector<NativeSurface *> &mark_later,
- bool reset_buffer, bool recycle_resources) {
+ bool *validate_final_layers, bool reset_buffer, bool recycle_resources) {
NativeSurface *surface = NULL;
if (reset_buffer) {
MarkSurfacesForRecycling(plane, mark_later, recycle_resources);
if (!surface) {
SetOffScreenPlaneTarget(*plane);
+ *validate_final_layers = true;
} else {
// If Last frame surface is re-cycled and surfaces are
// less than 3, make sure we have the offscreen surface
std::vector<OverlayPlane> &commit_planes,
std::vector<OverlayLayer *> &cursor_layers,
std::vector<NativeSurface *> &mark_later,
- DisplayPlaneStateList &composition, bool recycle_resources) {
+ DisplayPlaneStateList &composition, bool *validate_final_layers,
+ bool recycle_resources) {
CTRACE();
if (cursor_layers.empty()) {
return false;
OverlayLayer *cursor_layer = cursor_layers.at(cursor_index);
commit_planes.emplace_back(OverlayPlane(plane, cursor_layer));
bool fall_back = FallbacktoGPU(plane, cursor_layer, commit_planes);
+ if (fall_back) {
+ status = true;
+ } else {
+ *validate_final_layers = false;
+ }
// Lets ensure we fall back to GPU composition in case
// cursor layer cannot be scanned out directly.
if (fall_back && !is_video) {
if (!last_plane->GetOffScreenTarget() || is_video)
reset_overlay = true;
- PreparePlaneForCursor(last_plane, mark_later, is_video,
- recycle_resources);
+ PreparePlaneForCursor(last_plane, mark_later, validate_final_layers,
+ is_video, recycle_resources);
if (reset_overlay) {
// Layer for the plane should have changed, reset commit planes.
ValidateForDisplayScaling(*last_plane, commit_planes, cursor_layer,
false);
- status = true;
} else {
composition.emplace_back(plane, cursor_layer, cursor_layer->GetZorder());
plane->SetInUse(true);
}
if (last_layer) {
- PreparePlaneForCursor(last_plane, mark_later, is_video, recycle_resources);
+ PreparePlaneForCursor(last_plane, mark_later, validate_final_layers,
+ is_video, recycle_resources);
ValidateForDisplayScaling(*last_plane, commit_planes, last_layer, false);
}
bool DisplayPlaneManager::ReValidatePlanes(
std::vector<OverlayPlane> &commit_planes,
DisplayPlaneStateList &composition, std::vector<OverlayLayer> &layers,
- std::vector<NativeSurface *> &mark_later, bool recycle_resources) {
+ std::vector<NativeSurface *> &mark_later, bool *validate_final_layers,
+ bool recycle_resources) {
#ifdef SURFACE_TRACING
ISURFACETRACE("ReValidatePlanes called \n");
#endif
ISURFACETRACE("ReValidatePlanes called: moving to scan \n");
#endif
MarkSurfacesForRecycling(&last_plane, mark_later, recycle_resources);
+ *validate_final_layers = false;
}
}