Commit e8a2d456 authored by Fady Samuel's avatar Fady Samuel Committed by Commit Bot

Surface Synchronization: Simplify Fallback Surface Closure

We close fallback surfaces in order to speed up the arrival of the primary
surface from a child client. That logic was complex and difficult to follow.
Now with SurfaceRanges, that logic can be simplified somewhat.

Bug: 672962
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: Ied2efb4eac61f297fe6784825084f0a88e716dab
Reviewed-on: https://chromium-review.googlesource.com/1147114
Commit-Queue: Fady Samuel <fsamuel@chromium.org>
Reviewed-by: default avatarSaman Sami <samans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577381}
parent 4df7c5aa
......@@ -1646,7 +1646,7 @@ TEST_F(SurfaceSynchronizationTest, FallbackSurfacesClosed) {
// while the parent CompositorFrame is blocked.
parent_support().SubmitCompositorFrame(
parent_id1.local_surface_id(),
MakeCompositorFrame({child_id2}, {SurfaceRange(child_id1)},
MakeCompositorFrame({child_id2}, {SurfaceRange(child_id1, child_id2)},
std::vector<TransferableResource>(),
MakeDefaultDeadline()));
EXPECT_TRUE(parent_surface()->has_deadline());
......
......@@ -122,29 +122,19 @@ void Surface::UpdateSurfaceReferences() {
}
void Surface::RejectCompositorFramesToFallbackSurfaces() {
const std::vector<SurfaceId>& activation_dependencies =
GetPendingFrame().metadata.activation_dependencies;
for (const SurfaceRange& surface_range :
GetPendingFrame().metadata.referenced_surfaces) {
if (!surface_range.start())
continue;
const SurfaceId& surface_id = *surface_range.start();
// A surface ID in |referenced_surfaces| that has a corresponding surface
// ID in |activation_dependencies| with the same frame sink ID is said to
// be a fallback surface that can be used in place of the primary surface
// if the deadline passes before the dependency becomes available.
auto it = std::find_if(
activation_dependencies.begin(), activation_dependencies.end(),
[surface_id](const SurfaceId& dependency) {
return dependency.frame_sink_id() == surface_id.frame_sink_id();
});
bool is_fallback_surface = it != activation_dependencies.end();
if (!is_fallback_surface)
// Only close the fallback surface if it exists, has a different
// LocalSurfaceId than the primary surface but has the same FrameSinkId
// as the primary surface.
if (!surface_range.start() ||
surface_range.start() == surface_range.end() ||
surface_range.start()->frame_sink_id() !=
surface_range.end().frame_sink_id()) {
continue;
Surface* fallback_surface =
surface_manager_->GetLatestInFlightSurface(*it, surface_id);
}
Surface* fallback_surface = surface_manager_->GetLatestInFlightSurface(
surface_range.end(), *surface_range.start());
// A misbehaving client may report a non-existent surface ID as a
// |referenced_surface|. In that case, |surface| would be nullptr, and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment