Commit b4ebe550 authored by akaba's avatar akaba Committed by Commit Bot

GetLatestInFlightSurface should output something for non-existent fallbacks

GetLatestInFlightSurface should not return nullptr if fallback doesn't exist.
Instead it should try to search for active surfaces in primary's FrameSinkId.

Bug: 875381
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: I8940c374b7f52f728e4d88c88358aeb177dc8520
Reviewed-on: https://chromium-review.googlesource.com/1179989Reviewed-by: default avatarFady Samuel <fsamuel@chromium.org>
Commit-Queue: Andre Kaba <akaba@google.com>
Cr-Commit-Position: refs/heads/master@{#585139}
parent 0f751883
......@@ -1606,7 +1606,7 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, InvalidSurfaceReference) {
// SolidColorDrawQuad should be placed in lieu of a frame.
TEST_F(SurfaceAggregatorValidSurfaceTest, ValidSurfaceReferenceWithNoFrame) {
LocalSurfaceId empty_local_surface_id = allocator_.GenerateId();
SurfaceId surface_with_no_frame_id(support_->frame_sink_id(),
SurfaceId surface_with_no_frame_id(kArbitraryFrameSinkId1,
empty_local_surface_id);
Quad quads[] = {
......
......@@ -2243,8 +2243,9 @@ TEST_F(SurfaceSynchronizationTest, LatestInFlightSurfaceWithoutFallback) {
EXPECT_EQ(GetSurfaceForId(child_id1),
GetLatestInFlightSurface(child_id2, child_id1));
// Fallback is not specified and primary doesn't exists so we return nullptr.
EXPECT_EQ(nullptr, GetLatestInFlightSurface(child_id2, base::nullopt));
// Fallback is not specified and |child_id1| is the latest.
EXPECT_EQ(GetSurfaceForId(child_id1),
GetLatestInFlightSurface(child_id2, base::nullopt));
// Activate |child_id2|
child_support1().SubmitCompositorFrame(child_id2.local_surface_id(),
......
......@@ -495,18 +495,11 @@ void SurfaceManager::RemoveTemporaryReference(const SurfaceId& surface_id,
Surface* SurfaceManager::GetLatestInFlightSurface(
const SurfaceRange& surface_range) {
// If primary exists, we return it.
Surface* primary_surface = GetSurfaceForId(surface_range.end());
if (primary_surface && primary_surface->HasActiveFrame())
return primary_surface;
// If fallback is not specified we return nullptr.
// TODO(akaba): after fixing https://crbug.com/861769 we need to return
// something older than primary.
if (!surface_range.start())
return nullptr;
// If both end of the range exists, we try the primary's FrameSinkId first.
Surface* latest_surface = GetLatestInFlightSurfaceForFrameSinkId(
surface_range, surface_range.end().frame_sink_id());
......@@ -519,9 +512,12 @@ Surface* SurfaceManager::GetLatestInFlightSurface(
// Fallback might have neither temporary or presistent references, so we
// consider it separately.
if (!latest_surface)
if (!latest_surface && surface_range.start())
latest_surface = GetSurfaceForId(*surface_range.start());
return latest_surface;
if (latest_surface && latest_surface->HasActiveFrame())
return latest_surface;
return nullptr;
}
void SurfaceManager::ExpireOldTemporaryReferences() {
......
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