Commit 305a60d5 authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

Fix buffer queue swap size in landscape

Buffer queue may not change orientation on rotation, and the swap size
would have the width and height swapped for code that expects the swap
size to be in landscape.

This fixes the surfaceRedrawNeededAsync timeout when rotating from
portrait to landscape.

This also fixes 1136033 where on initial launch in landscape, android
side does not have a timeout for surfaceRedrawNeededAsync like it does
for rotation.

Bug: 1136033
Change-Id: I91b3d81252f3e02fb3d85bf1ac91d5d802544490
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459569Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815332}
parent 61cd5fb8
...@@ -288,7 +288,7 @@ void SkiaOutputDeviceBufferQueue::SwapBuffers( ...@@ -288,7 +288,7 @@ void SkiaOutputDeviceBufferQueue::SwapBuffers(
swap_completion_callbacks_.emplace_back( swap_completion_callbacks_.emplace_back(
std::make_unique<CancelableSwapCompletionCallback>(base::BindOnce( std::make_unique<CancelableSwapCompletionCallback>(base::BindOnce(
&SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers, &SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers,
base::Unretained(this), image_size_, std::move(latency_info), base::Unretained(this), GetSwapBuffersSize(), std::move(latency_info),
submitted_image_ ? submitted_image_->GetWeakPtr() : nullptr, submitted_image_ ? submitted_image_->GetWeakPtr() : nullptr,
std::move(committed_overlay_mailboxes_)))); std::move(committed_overlay_mailboxes_))));
committed_overlay_mailboxes_.clear(); committed_overlay_mailboxes_.clear();
...@@ -323,7 +323,7 @@ void SkiaOutputDeviceBufferQueue::PostSubBuffer( ...@@ -323,7 +323,7 @@ void SkiaOutputDeviceBufferQueue::PostSubBuffer(
swap_completion_callbacks_.emplace_back( swap_completion_callbacks_.emplace_back(
std::make_unique<CancelableSwapCompletionCallback>(base::BindOnce( std::make_unique<CancelableSwapCompletionCallback>(base::BindOnce(
&SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers, &SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers,
base::Unretained(this), image_size_, std::move(latency_info), base::Unretained(this), GetSwapBuffersSize(), std::move(latency_info),
submitted_image_ ? submitted_image_->GetWeakPtr() : nullptr, submitted_image_ ? submitted_image_->GetWeakPtr() : nullptr,
std::move(committed_overlay_mailboxes_)))); std::move(committed_overlay_mailboxes_))));
committed_overlay_mailboxes_.clear(); committed_overlay_mailboxes_.clear();
...@@ -354,7 +354,7 @@ void SkiaOutputDeviceBufferQueue::CommitOverlayPlanes( ...@@ -354,7 +354,7 @@ void SkiaOutputDeviceBufferQueue::CommitOverlayPlanes(
swap_completion_callbacks_.emplace_back( swap_completion_callbacks_.emplace_back(
std::make_unique<CancelableSwapCompletionCallback>(base::BindOnce( std::make_unique<CancelableSwapCompletionCallback>(base::BindOnce(
&SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers, &SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers,
base::Unretained(this), image_size_, std::move(latency_info), base::Unretained(this), GetSwapBuffersSize(), std::move(latency_info),
submitted_image_ ? submitted_image_->GetWeakPtr() : nullptr, submitted_image_ ? submitted_image_->GetWeakPtr() : nullptr,
std::move(committed_overlay_mailboxes_)))); std::move(committed_overlay_mailboxes_))));
committed_overlay_mailboxes_.clear(); committed_overlay_mailboxes_.clear();
...@@ -404,6 +404,20 @@ void SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers( ...@@ -404,6 +404,20 @@ void SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers(
PageFlipComplete(image.get()); PageFlipComplete(image.get());
} }
gfx::Size SkiaOutputDeviceBufferQueue::GetSwapBuffersSize() {
switch (overlay_transform_) {
case gfx::OVERLAY_TRANSFORM_ROTATE_90:
case gfx::OVERLAY_TRANSFORM_ROTATE_270:
return gfx::Size(image_size_.height(), image_size_.width());
case gfx::OVERLAY_TRANSFORM_INVALID:
case gfx::OVERLAY_TRANSFORM_NONE:
case gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL:
case gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL:
case gfx::OVERLAY_TRANSFORM_ROTATE_180:
return image_size_;
}
}
bool SkiaOutputDeviceBufferQueue::Reshape(const gfx::Size& size, bool SkiaOutputDeviceBufferQueue::Reshape(const gfx::Size& size,
float device_scale_factor, float device_scale_factor,
const gfx::ColorSpace& color_space, const gfx::ColorSpace& color_space,
...@@ -418,6 +432,7 @@ bool SkiaOutputDeviceBufferQueue::Reshape(const gfx::Size& size, ...@@ -418,6 +432,7 @@ bool SkiaOutputDeviceBufferQueue::Reshape(const gfx::Size& size,
color_space_ = color_space; color_space_ = color_space;
image_size_ = size; image_size_ = size;
overlay_transform_ = transform;
FreeAllSurfaces(); FreeAllSurfaces();
images_ = presenter_->AllocateImages(color_space_, image_size_, images_ = presenter_->AllocateImages(color_space_, image_size_,
......
...@@ -80,6 +80,8 @@ class VIZ_SERVICE_EXPORT SkiaOutputDeviceBufferQueue : public SkiaOutputDevice { ...@@ -80,6 +80,8 @@ class VIZ_SERVICE_EXPORT SkiaOutputDeviceBufferQueue : public SkiaOutputDevice {
std::vector<gpu::Mailbox> overlay_mailboxes, std::vector<gpu::Mailbox> overlay_mailboxes,
gfx::SwapCompletionResult result); gfx::SwapCompletionResult result);
gfx::Size GetSwapBuffersSize();
std::unique_ptr<OutputPresenter> presenter_; std::unique_ptr<OutputPresenter> presenter_;
SkiaOutputSurfaceDependency* const dependency_; SkiaOutputSurfaceDependency* const dependency_;
...@@ -87,6 +89,7 @@ class VIZ_SERVICE_EXPORT SkiaOutputDeviceBufferQueue : public SkiaOutputDevice { ...@@ -87,6 +89,7 @@ class VIZ_SERVICE_EXPORT SkiaOutputDeviceBufferQueue : public SkiaOutputDevice {
// Format of images // Format of images
gfx::ColorSpace color_space_; gfx::ColorSpace color_space_;
gfx::Size image_size_; gfx::Size image_size_;
gfx::OverlayTransform overlay_transform_ = gfx::OVERLAY_TRANSFORM_NONE;
// All allocated images. // All allocated images.
std::vector<std::unique_ptr<OutputPresenter::Image>> images_; std::vector<std::unique_ptr<OutputPresenter::Image>> images_;
......
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