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) { ...@@ -1606,7 +1606,7 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, InvalidSurfaceReference) {
// SolidColorDrawQuad should be placed in lieu of a frame. // SolidColorDrawQuad should be placed in lieu of a frame.
TEST_F(SurfaceAggregatorValidSurfaceTest, ValidSurfaceReferenceWithNoFrame) { TEST_F(SurfaceAggregatorValidSurfaceTest, ValidSurfaceReferenceWithNoFrame) {
LocalSurfaceId empty_local_surface_id = allocator_.GenerateId(); 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); empty_local_surface_id);
Quad quads[] = { Quad quads[] = {
......
...@@ -2243,8 +2243,9 @@ TEST_F(SurfaceSynchronizationTest, LatestInFlightSurfaceWithoutFallback) { ...@@ -2243,8 +2243,9 @@ TEST_F(SurfaceSynchronizationTest, LatestInFlightSurfaceWithoutFallback) {
EXPECT_EQ(GetSurfaceForId(child_id1), EXPECT_EQ(GetSurfaceForId(child_id1),
GetLatestInFlightSurface(child_id2, child_id1)); GetLatestInFlightSurface(child_id2, child_id1));
// Fallback is not specified and primary doesn't exists so we return nullptr. // Fallback is not specified and |child_id1| is the latest.
EXPECT_EQ(nullptr, GetLatestInFlightSurface(child_id2, base::nullopt)); EXPECT_EQ(GetSurfaceForId(child_id1),
GetLatestInFlightSurface(child_id2, base::nullopt));
// Activate |child_id2| // Activate |child_id2|
child_support1().SubmitCompositorFrame(child_id2.local_surface_id(), child_support1().SubmitCompositorFrame(child_id2.local_surface_id(),
......
...@@ -495,18 +495,11 @@ void SurfaceManager::RemoveTemporaryReference(const SurfaceId& surface_id, ...@@ -495,18 +495,11 @@ void SurfaceManager::RemoveTemporaryReference(const SurfaceId& surface_id,
Surface* SurfaceManager::GetLatestInFlightSurface( Surface* SurfaceManager::GetLatestInFlightSurface(
const SurfaceRange& surface_range) { const SurfaceRange& surface_range) {
// If primary exists, we return it. // If primary exists, we return it.
Surface* primary_surface = GetSurfaceForId(surface_range.end()); Surface* primary_surface = GetSurfaceForId(surface_range.end());
if (primary_surface && primary_surface->HasActiveFrame()) if (primary_surface && primary_surface->HasActiveFrame())
return primary_surface; 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. // If both end of the range exists, we try the primary's FrameSinkId first.
Surface* latest_surface = GetLatestInFlightSurfaceForFrameSinkId( Surface* latest_surface = GetLatestInFlightSurfaceForFrameSinkId(
surface_range, surface_range.end().frame_sink_id()); surface_range, surface_range.end().frame_sink_id());
...@@ -519,9 +512,12 @@ Surface* SurfaceManager::GetLatestInFlightSurface( ...@@ -519,9 +512,12 @@ Surface* SurfaceManager::GetLatestInFlightSurface(
// Fallback might have neither temporary or presistent references, so we // Fallback might have neither temporary or presistent references, so we
// consider it separately. // consider it separately.
if (!latest_surface) if (!latest_surface && surface_range.start())
latest_surface = GetSurfaceForId(*surface_range.start()); latest_surface = GetSurfaceForId(*surface_range.start());
if (latest_surface && latest_surface->HasActiveFrame())
return latest_surface; return latest_surface;
return nullptr;
} }
void SurfaceManager::ExpireOldTemporaryReferences() { 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