Commit 23a637ea authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

SkiaOutputSurfaceBufferQueue: support empty swap with CommitOverlayPlanes

For empty swap case, SchedulePrimaryPlane() will re-schedule the last
submitted image.

Bug: 1041035
Change-Id: Ic2994b3596e8919bf8f7a1828bcc73274e561470
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007475
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733049}
parent 1a8076b8
...@@ -141,6 +141,9 @@ void DirectRenderer::Initialize() { ...@@ -141,6 +141,9 @@ void DirectRenderer::Initialize() {
.disable_non_empty_post_sub_buffers) { .disable_non_empty_post_sub_buffers) {
use_partial_swap_ = false; use_partial_swap_ = false;
} }
} else {
allow_empty_swap_ |=
output_surface_->capabilities().supports_commit_overlay_planes;
} }
initialized_ = true; initialized_ = true;
......
...@@ -64,6 +64,8 @@ class VIZ_SERVICE_EXPORT OutputSurface { ...@@ -64,6 +64,8 @@ class VIZ_SERVICE_EXPORT OutputSurface {
bool supports_stencil = false; bool supports_stencil = false;
// Whether this OutputSurface supports post sub buffer or not. // Whether this OutputSurface supports post sub buffer or not.
bool supports_post_sub_buffer = false; bool supports_post_sub_buffer = false;
// Whether this OutputSurface supports commit overlay planes.
bool supports_commit_overlay_planes = false;
// Whether this OutputSurface supports gpu vsync callbacks. // Whether this OutputSurface supports gpu vsync callbacks.
bool supports_gpu_vsync = false; bool supports_gpu_vsync = false;
// Whether this OutputSurface supports pre transform. If it is supported, // Whether this OutputSurface supports pre transform. If it is supported,
......
...@@ -27,6 +27,12 @@ SkiaOutputDevice::SkiaOutputDevice( ...@@ -27,6 +27,12 @@ SkiaOutputDevice::SkiaOutputDevice(
SkiaOutputDevice::~SkiaOutputDevice() = default; SkiaOutputDevice::~SkiaOutputDevice() = default;
void SkiaOutputDevice::CommitOverlayPlanes(
BufferPresentedCallback feedback,
std::vector<ui::LatencyInfo> latency_info) {
NOTREACHED();
}
void SkiaOutputDevice::PostSubBuffer( void SkiaOutputDevice::PostSubBuffer(
const gfx::Rect& rect, const gfx::Rect& rect,
BufferPresentedCallback feedback, BufferPresentedCallback feedback,
......
...@@ -88,6 +88,8 @@ class SkiaOutputDevice { ...@@ -88,6 +88,8 @@ class SkiaOutputDevice {
virtual void PostSubBuffer(const gfx::Rect& rect, virtual void PostSubBuffer(const gfx::Rect& rect,
BufferPresentedCallback feedback, BufferPresentedCallback feedback,
std::vector<ui::LatencyInfo> latency_info); std::vector<ui::LatencyInfo> latency_info);
virtual void CommitOverlayPlanes(BufferPresentedCallback feedback,
std::vector<ui::LatencyInfo> latency_info);
// Set the rectangle that will be drawn into on the surface. // Set the rectangle that will be drawn into on the surface.
virtual void SetDrawRectangle(const gfx::Rect& draw_rectangle); virtual void SetDrawRectangle(const gfx::Rect& draw_rectangle);
......
...@@ -42,9 +42,8 @@ class VIZ_SERVICE_EXPORT SkiaOutputDeviceBufferQueue final ...@@ -42,9 +42,8 @@ class VIZ_SERVICE_EXPORT SkiaOutputDeviceBufferQueue final
void SwapBuffers(BufferPresentedCallback feedback, void SwapBuffers(BufferPresentedCallback feedback,
std::vector<ui::LatencyInfo> latency_info) override; std::vector<ui::LatencyInfo> latency_info) override;
void PostSubBuffer(const gfx::Rect& rect, void CommitOverlayPlanes(BufferPresentedCallback feedback,
BufferPresentedCallback feedback, std::vector<ui::LatencyInfo> latency_info) override;
std::vector<ui::LatencyInfo> latency_info) override;
bool Reshape(const gfx::Size& size, bool Reshape(const gfx::Size& size,
float device_scale_factor, float device_scale_factor,
const gfx::ColorSpace& color_space, const gfx::ColorSpace& color_space,
...@@ -70,33 +69,37 @@ class VIZ_SERVICE_EXPORT SkiaOutputDeviceBufferQueue final ...@@ -70,33 +69,37 @@ class VIZ_SERVICE_EXPORT SkiaOutputDeviceBufferQueue final
base::CancelableOnceCallback<void(gfx::SwapResult, base::CancelableOnceCallback<void(gfx::SwapResult,
std::unique_ptr<gfx::GpuFence>)>; std::unique_ptr<gfx::GpuFence>)>;
Image* GetCurrentImage(); Image* GetNextImage();
std::unique_ptr<Image> GetNextImage(); void PageFlipComplete(Image* image);
void PageFlipComplete(std::unique_ptr<Image> image);
void FreeAllSurfaces(); void FreeAllSurfaces();
// Used as callback for SwapBuffersAsync and PostSubBufferAsync to finish // Used as callback for SwapBuff ersAsync and PostSubBufferAsync to finish
// operation // operation
void DoFinishSwapBuffers(const gfx::Size& size, void DoFinishSwapBuffers(const gfx::Size& size,
std::vector<ui::LatencyInfo> latency_info, std::vector<ui::LatencyInfo> latency_info,
std::unique_ptr<Image> image, Image* image,
std::vector<OverlayData> overlays, std::vector<OverlayData> overlays,
gfx::SwapResult result, gfx::SwapResult result,
std::unique_ptr<gfx::GpuFence> gpu_fence); std::unique_ptr<gfx::GpuFence> gpu_fence);
SkiaOutputSurfaceDependency* const dependency_; SkiaOutputSurfaceDependency* const dependency_;
scoped_refptr<gl::GLSurface> gl_surface_; scoped_refptr<gl::GLSurface> gl_surface_;
const bool supports_async_swap_;
// Format of images // Format of images
gfx::ColorSpace color_space_; gfx::ColorSpace color_space_;
gfx::Size image_size_; gfx::Size image_size_;
ResourceFormat image_format_; ResourceFormat image_format_;
// All allocated images.
std::vector<std::unique_ptr<Image>> images_;
// This image is currently used by Skia as RenderTarget. This may be nullptr // This image is currently used by Skia as RenderTarget. This may be nullptr
// if no drawing in progress or if allocation failed at bind. // if there is no drawing for the current frame or if allocation failed.
std::unique_ptr<Image> current_image_; Image* current_image_ = nullptr;
// The last image submitted for presenting.
Image* submitted_image_ = nullptr;
// The image currently on the screen, if any. // The image currently on the screen, if any.
std::unique_ptr<Image> displayed_image_; Image* displayed_image_ = nullptr;
// These are free for use, and are not nullptr. // These are free for use, and are not nullptr.
std::vector<std::unique_ptr<Image>> available_images_; std::vector<Image*> available_images_;
// These cancelable callbacks bind images that have been scheduled to display // These cancelable callbacks bind images that have been scheduled to display
// but are not displayed yet. This deque will be cleared when represented // but are not displayed yet. This deque will be cleared when represented
// frames are destroyed. Use CancelableOnceCallback to prevent resources // frames are destroyed. Use CancelableOnceCallback to prevent resources
......
...@@ -136,6 +136,23 @@ class MockGLSurfaceAsync : public gl::GLSurfaceStub { ...@@ -136,6 +136,23 @@ class MockGLSurfaceAsync : public gl::GLSurfaceStub {
callback_ = std::move(completion_callback); callback_ = std::move(completion_callback);
} }
void CommitOverlayPlanesAsync(
SwapCompletionCallback completion_callback,
PresentationCallback presentation_callback) override {
DCHECK(!callback_);
callback_ = std::move(completion_callback);
}
bool ScheduleOverlayPlane(int z_order,
gfx::OverlayTransform transform,
gl::GLImage* image,
const gfx::Rect& bounds_rect,
const gfx::RectF& crop_rect,
bool enable_blend,
std::unique_ptr<gfx::GpuFence> gpu_fence) override {
return true;
}
void SwapComplete() { void SwapComplete() {
std::move(callback_).Run(gfx::SwapResult::SWAP_ACK, nullptr); std::move(callback_).Run(gfx::SwapResult::SWAP_ACK, nullptr);
} }
...@@ -211,13 +228,13 @@ class SkiaOutputDeviceBufferQueueTest : public TestOnGpu { ...@@ -211,13 +228,13 @@ class SkiaOutputDeviceBufferQueueTest : public TestOnGpu {
using Image = SkiaOutputDeviceBufferQueue::Image; using Image = SkiaOutputDeviceBufferQueue::Image;
Image* current_image() { return output_device_->current_image_.get(); } Image* current_image() { return output_device_->current_image_; }
const std::vector<std::unique_ptr<Image>>& available_images() { const std::vector<Image*>& available_images() {
return output_device_->available_images_; return output_device_->available_images_;
} }
Image* displayed_image() { return output_device_->displayed_image_.get(); } Image* displayed_image() { return output_device_->displayed_image_; }
base::circular_deque<std::unique_ptr< base::circular_deque<std::unique_ptr<
SkiaOutputDeviceBufferQueue::CancelableSwapCompletionCallback>>& SkiaOutputDeviceBufferQueue::CancelableSwapCompletionCallback>>&
...@@ -239,8 +256,8 @@ class SkiaOutputDeviceBufferQueueTest : public TestOnGpu { ...@@ -239,8 +256,8 @@ class SkiaOutputDeviceBufferQueueTest : public TestOnGpu {
void CheckUnique() { void CheckUnique() {
std::set<Image*> images; std::set<Image*> images;
for (const auto& image : available_images()) for (auto* image : available_images())
images.insert(image.get()); images.insert(image);
if (displayed_image()) if (displayed_image())
images.insert(displayed_image()); images.insert(displayed_image());
...@@ -252,12 +269,17 @@ class SkiaOutputDeviceBufferQueueTest : public TestOnGpu { ...@@ -252,12 +269,17 @@ class SkiaOutputDeviceBufferQueueTest : public TestOnGpu {
(size_t)CountBuffers()); (size_t)CountBuffers());
} }
Image* GetCurrentImage() { Image* PaintAndSchedulePrimaryPlane() {
// Call Begin/EndPaint to ensusre the image is initialized before use. // Call Begin/EndPaint to ensusre the image is initialized before use.
output_device_->BeginPaint(); output_device_->BeginPaint();
GrBackendSemaphore semaphore; output_device_->EndPaint(GrBackendSemaphore());
output_device_->EndPaint(semaphore); SchedulePrimaryPlane();
return output_device_->GetCurrentImage(); return current_image();
}
void SchedulePrimaryPlane() {
output_device_->SchedulePrimaryPlane(
OverlayProcessorInterface::OutputSurfaceOverlayPlane());
} }
void SwapBuffers() { void SwapBuffers() {
...@@ -268,6 +290,14 @@ class SkiaOutputDeviceBufferQueueTest : public TestOnGpu { ...@@ -268,6 +290,14 @@ class SkiaOutputDeviceBufferQueueTest : public TestOnGpu {
std::vector<ui::LatencyInfo>()); std::vector<ui::LatencyInfo>());
} }
void CommitOverlayPlanes() {
auto present_callback =
base::DoNothing::Once<const gfx::PresentationFeedback&>();
output_device_->CommitOverlayPlanes(std::move(present_callback),
std::vector<ui::LatencyInfo>());
}
void PageFlipComplete() { gl_surface_->SwapComplete(); } void PageFlipComplete() { gl_surface_->SwapComplete(); }
protected: protected:
...@@ -287,11 +317,11 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, MultipleGetCurrentBufferCalls) { ...@@ -287,11 +317,11 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, MultipleGetCurrentBufferCalls) {
output_device_->Reshape(screen_size, 1.0f, gfx::ColorSpace(), false, output_device_->Reshape(screen_size, 1.0f, gfx::ColorSpace(), false,
gfx::OVERLAY_TRANSFORM_NONE); gfx::OVERLAY_TRANSFORM_NONE);
EXPECT_EQ(0U, memory_tracker().GetSize()); EXPECT_EQ(0U, memory_tracker().GetSize());
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
EXPECT_NE(0U, memory_tracker().GetSize()); EXPECT_NE(0U, memory_tracker().GetSize());
EXPECT_EQ(1, CountBuffers()); EXPECT_EQ(1, CountBuffers());
auto* fb = current_image(); auto* fb = current_image();
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
EXPECT_NE(0U, memory_tracker().GetSize()); EXPECT_NE(0U, memory_tracker().GetSize());
EXPECT_EQ(1, CountBuffers()); EXPECT_EQ(1, CountBuffers());
EXPECT_EQ(fb, current_image()); EXPECT_EQ(fb, current_image());
...@@ -304,7 +334,7 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckDoubleBuffering) { ...@@ -304,7 +334,7 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckDoubleBuffering) {
EXPECT_EQ(0U, memory_tracker().GetSize()); EXPECT_EQ(0U, memory_tracker().GetSize());
EXPECT_EQ(0, CountBuffers()); EXPECT_EQ(0, CountBuffers());
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
EXPECT_NE(0U, memory_tracker().GetSize()); EXPECT_NE(0U, memory_tracker().GetSize());
EXPECT_EQ(1, CountBuffers()); EXPECT_EQ(1, CountBuffers());
EXPECT_NE(current_image(), nullptr); EXPECT_NE(current_image(), nullptr);
...@@ -314,7 +344,7 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckDoubleBuffering) { ...@@ -314,7 +344,7 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckDoubleBuffering) {
PageFlipComplete(); PageFlipComplete();
EXPECT_EQ(0U, swap_completion_callbacks().size()); EXPECT_EQ(0U, swap_completion_callbacks().size());
EXPECT_TRUE(displayed_image()); EXPECT_TRUE(displayed_image());
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
EXPECT_NE(0U, memory_tracker().GetSize()); EXPECT_NE(0U, memory_tracker().GetSize());
EXPECT_EQ(2, CountBuffers()); EXPECT_EQ(2, CountBuffers());
CheckUnique(); CheckUnique();
...@@ -325,12 +355,13 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckDoubleBuffering) { ...@@ -325,12 +355,13 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckDoubleBuffering) {
CheckUnique(); CheckUnique();
EXPECT_EQ(1U, swap_completion_callbacks().size()); EXPECT_EQ(1U, swap_completion_callbacks().size());
EXPECT_TRUE(displayed_image()); EXPECT_TRUE(displayed_image());
PageFlipComplete(); PageFlipComplete();
CheckUnique(); CheckUnique();
EXPECT_EQ(0U, swap_completion_callbacks().size()); EXPECT_EQ(0U, swap_completion_callbacks().size());
EXPECT_EQ(1U, available_images().size()); EXPECT_EQ(1U, available_images().size());
EXPECT_TRUE(displayed_image()); EXPECT_TRUE(displayed_image());
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
EXPECT_NE(0U, memory_tracker().GetSize()); EXPECT_NE(0U, memory_tracker().GetSize());
EXPECT_EQ(2, CountBuffers()); EXPECT_EQ(2, CountBuffers());
CheckUnique(); CheckUnique();
...@@ -344,11 +375,11 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckTripleBuffering) { ...@@ -344,11 +375,11 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckTripleBuffering) {
EXPECT_EQ(0U, memory_tracker().GetSize()); EXPECT_EQ(0U, memory_tracker().GetSize());
// This bit is the same sequence tested in the doublebuffering case. // This bit is the same sequence tested in the doublebuffering case.
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
EXPECT_FALSE(displayed_image()); EXPECT_FALSE(displayed_image());
SwapBuffers(); SwapBuffers();
PageFlipComplete(); PageFlipComplete();
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
SwapBuffers(); SwapBuffers();
EXPECT_NE(0U, memory_tracker().GetSize()); EXPECT_NE(0U, memory_tracker().GetSize());
...@@ -356,7 +387,7 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckTripleBuffering) { ...@@ -356,7 +387,7 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckTripleBuffering) {
CheckUnique(); CheckUnique();
EXPECT_EQ(1U, swap_completion_callbacks().size()); EXPECT_EQ(1U, swap_completion_callbacks().size());
EXPECT_TRUE(displayed_image()); EXPECT_TRUE(displayed_image());
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
EXPECT_NE(0U, memory_tracker().GetSize()); EXPECT_NE(0U, memory_tracker().GetSize());
EXPECT_EQ(3, CountBuffers()); EXPECT_EQ(3, CountBuffers());
CheckUnique(); CheckUnique();
...@@ -380,7 +411,7 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckEmptySwap) { ...@@ -380,7 +411,7 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckEmptySwap) {
EXPECT_EQ(0, CountBuffers()); EXPECT_EQ(0, CountBuffers());
EXPECT_EQ(0U, memory_tracker().GetSize()); EXPECT_EQ(0U, memory_tracker().GetSize());
auto* image = GetCurrentImage(); auto* image = PaintAndSchedulePrimaryPlane();
EXPECT_NE(image, nullptr); EXPECT_NE(image, nullptr);
EXPECT_NE(0U, memory_tracker().GetSize()); EXPECT_NE(0U, memory_tracker().GetSize());
EXPECT_EQ(1, CountBuffers()); EXPECT_EQ(1, CountBuffers());
...@@ -389,22 +420,26 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckEmptySwap) { ...@@ -389,22 +420,26 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckEmptySwap) {
SwapBuffers(); SwapBuffers();
// Make sure we won't be drawing to the texture we just sent for scanout. // Make sure we won't be drawing to the texture we just sent for scanout.
auto* new_image = GetCurrentImage(); auto* new_image = PaintAndSchedulePrimaryPlane();
EXPECT_NE(new_image, nullptr); EXPECT_NE(new_image, nullptr);
EXPECT_NE(image, new_image); EXPECT_NE(image, new_image);
EXPECT_EQ(1U, swap_completion_callbacks().size()); EXPECT_EQ(1U, swap_completion_callbacks().size());
PageFlipComplete(); PageFlipComplete();
// Test swapbuffers without calling BeginPaint/EndPaint (i.e without // Test CommitOverlayPlanes without calling BeginPaint/EndPaint (i.e without
// GetCurrentImage) // PaintAndSchedulePrimaryPlane)
SwapBuffers(); SwapBuffers();
EXPECT_EQ(1U, swap_completion_callbacks().size()); EXPECT_EQ(1U, swap_completion_callbacks().size());
// Schedule the primary plane without drawing.
SchedulePrimaryPlane();
PageFlipComplete(); PageFlipComplete();
EXPECT_EQ(0U, swap_completion_callbacks().size()); EXPECT_EQ(0U, swap_completion_callbacks().size());
EXPECT_EQ(current_image(), nullptr); EXPECT_EQ(current_image(), nullptr);
SwapBuffers(); CommitOverlayPlanes();
EXPECT_EQ(1U, swap_completion_callbacks().size()); EXPECT_EQ(1U, swap_completion_callbacks().size());
PageFlipComplete(); PageFlipComplete();
EXPECT_EQ(0U, swap_completion_callbacks().size()); EXPECT_EQ(0U, swap_completion_callbacks().size());
...@@ -415,10 +450,10 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckCorrectBufferOrdering) { ...@@ -415,10 +450,10 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckCorrectBufferOrdering) {
gfx::OVERLAY_TRANSFORM_NONE); gfx::OVERLAY_TRANSFORM_NONE);
const size_t kSwapCount = 5; const size_t kSwapCount = 5;
EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
for (size_t i = 0; i < kSwapCount; ++i) { for (size_t i = 0; i < kSwapCount; ++i) {
EXPECT_NE(GetCurrentImage(), nullptr);
SwapBuffers(); SwapBuffers();
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
PageFlipComplete(); PageFlipComplete();
} }
...@@ -426,13 +461,13 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckCorrectBufferOrdering) { ...@@ -426,13 +461,13 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, CheckCorrectBufferOrdering) {
EXPECT_EQ(3, CountBuffers()); EXPECT_EQ(3, CountBuffers());
for (size_t i = 0; i < kSwapCount; ++i) { for (size_t i = 0; i < kSwapCount; ++i) {
EXPECT_NE(GetCurrentImage(), nullptr);
auto* next_image = current_image(); auto* next_image = current_image();
SwapBuffers(); SwapBuffers();
EXPECT_EQ(current_image(), nullptr); EXPECT_EQ(current_image(), nullptr);
EXPECT_EQ(1U, swap_completion_callbacks().size()); EXPECT_EQ(1U, swap_completion_callbacks().size());
PageFlipComplete(); PageFlipComplete();
EXPECT_EQ(displayed_image(), next_image); EXPECT_EQ(displayed_image(), next_image);
EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
} }
} }
...@@ -442,10 +477,10 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, ReshapeWithInFlightSurfaces) { ...@@ -442,10 +477,10 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, ReshapeWithInFlightSurfaces) {
const size_t kSwapCount = 5; const size_t kSwapCount = 5;
EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
for (size_t i = 0; i < kSwapCount; ++i) { for (size_t i = 0; i < kSwapCount; ++i) {
EXPECT_NE(GetCurrentImage(), nullptr);
SwapBuffers(); SwapBuffers();
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
PageFlipComplete(); PageFlipComplete();
} }
...@@ -463,7 +498,7 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, ReshapeWithInFlightSurfaces) { ...@@ -463,7 +498,7 @@ TEST_F_GPU(SkiaOutputDeviceBufferQueueTest, ReshapeWithInFlightSurfaces) {
EXPECT_EQ(0u, available_images().size()); EXPECT_EQ(0u, available_images().size());
// Test swap after reshape // Test swap after reshape
EXPECT_NE(GetCurrentImage(), nullptr); EXPECT_NE(PaintAndSchedulePrimaryPlane(), nullptr);
SwapBuffers(); SwapBuffers();
PageFlipComplete(); PageFlipComplete();
EXPECT_NE(displayed_image(), nullptr); EXPECT_NE(displayed_image(), nullptr);
......
...@@ -996,17 +996,23 @@ void SkiaOutputSurfaceImplOnGpu::SwapBuffers( ...@@ -996,17 +996,23 @@ void SkiaOutputSurfaceImplOnGpu::SwapBuffers(
output_surface_plane_.reset(); output_surface_plane_.reset();
} }
if (frame.sub_buffer_rect && frame.sub_buffer_rect->IsEmpty()) { if (frame.sub_buffer_rect) {
// Call SwapBuffers() to present overlays. if (capabilities().supports_post_sub_buffer) {
output_device_->SwapBuffers(buffer_presented_callback_, if (!capabilities().flipped_output_surface)
std::move(frame.latency_info)); frame.sub_buffer_rect->set_y(size_.height() -
} else if (capabilities().supports_post_sub_buffer && frame.sub_buffer_rect) { frame.sub_buffer_rect->y() -
if (!capabilities().flipped_output_surface) frame.sub_buffer_rect->height());
frame.sub_buffer_rect->set_y(size_.height() - frame.sub_buffer_rect->y() - output_device_->PostSubBuffer(*frame.sub_buffer_rect,
frame.sub_buffer_rect->height()); buffer_presented_callback_,
output_device_->PostSubBuffer(*frame.sub_buffer_rect, std::move(frame.latency_info));
buffer_presented_callback_,
std::move(frame.latency_info)); } else if (capabilities().supports_commit_overlay_planes) {
DCHECK(frame.sub_buffer_rect->IsEmpty());
output_device_->CommitOverlayPlanes(buffer_presented_callback_,
std::move(frame.latency_info));
} else {
NOTREACHED();
}
} else { } else {
output_device_->SwapBuffers(buffer_presented_callback_, output_device_->SwapBuffers(buffer_presented_callback_,
std::move(frame.latency_info)); std::move(frame.latency_info));
......
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