Commit 6aa19a2a authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

SkiaRenderer/macOS: Plumb swap params in SkiaOutputDevice

Change SkiaOutputDevice::FinishSwapBuffers to take a
gfx::SwapCompletionResult instead of just a gfx::SwapResult. This makes
its way to the population of the gpu::SwapBuffersCompleteParams in
SkiaOutputDevice::SwapInfo::Complete, where we will be adding the
gfx::CALayerParams structure in a subsequent patch.

Bug: 894929
Change-Id: I873f6611b3e87a0b3bedb116d33224aed59b7dc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2225360Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773837}
parent e03da15c
...@@ -82,13 +82,13 @@ void SkiaOutputDevice::StartSwapBuffers(BufferPresentedCallback feedback) { ...@@ -82,13 +82,13 @@ void SkiaOutputDevice::StartSwapBuffers(BufferPresentedCallback feedback) {
} }
void SkiaOutputDevice::FinishSwapBuffers( void SkiaOutputDevice::FinishSwapBuffers(
gfx::SwapResult result, gfx::SwapCompletionResult result,
const gfx::Size& size, const gfx::Size& size,
std::vector<ui::LatencyInfo> latency_info) { std::vector<ui::LatencyInfo> latency_info) {
DCHECK(!pending_swaps_.empty()); DCHECK(!pending_swaps_.empty());
const gpu::SwapBuffersCompleteParams& params = const gpu::SwapBuffersCompleteParams& params =
pending_swaps_.front().Complete(result); pending_swaps_.front().Complete(std::move(result));
did_swap_buffer_complete_callback_.Run(params, size); did_swap_buffer_complete_callback_.Run(params, size);
...@@ -123,9 +123,11 @@ SkiaOutputDevice::SwapInfo::SwapInfo(SwapInfo&& other) = default; ...@@ -123,9 +123,11 @@ SkiaOutputDevice::SwapInfo::SwapInfo(SwapInfo&& other) = default;
SkiaOutputDevice::SwapInfo::~SwapInfo() = default; SkiaOutputDevice::SwapInfo::~SwapInfo() = default;
const gpu::SwapBuffersCompleteParams& SkiaOutputDevice::SwapInfo::Complete( const gpu::SwapBuffersCompleteParams& SkiaOutputDevice::SwapInfo::Complete(
gfx::SwapResult result) { gfx::SwapCompletionResult result) {
params_.swap_response.result = result; params_.swap_response.result = result.swap_result;
params_.swap_response.timings.swap_end = base::TimeTicks::Now(); params_.swap_response.timings.swap_end = base::TimeTicks::Now();
// TODO(https://crbug.com/894929): Pass CALayerParams from from |result| to
// |params_| here.
return params_; return params_;
} }
......
...@@ -129,7 +129,8 @@ class SkiaOutputDevice { ...@@ -129,7 +129,8 @@ class SkiaOutputDevice {
SwapInfo(uint64_t swap_id, BufferPresentedCallback feedback); SwapInfo(uint64_t swap_id, BufferPresentedCallback feedback);
SwapInfo(SwapInfo&& other); SwapInfo(SwapInfo&& other);
~SwapInfo(); ~SwapInfo();
const gpu::SwapBuffersCompleteParams& Complete(gfx::SwapResult result); const gpu::SwapBuffersCompleteParams& Complete(
gfx::SwapCompletionResult result);
void CallFeedback(); void CallFeedback();
private: private:
...@@ -150,7 +151,7 @@ class SkiaOutputDevice { ...@@ -150,7 +151,7 @@ class SkiaOutputDevice {
// Helper method for SwapBuffers() and PostSubBuffer(). It should be called // Helper method for SwapBuffers() and PostSubBuffer(). It should be called
// at the end of SwapBuffers() and PostSubBuffer() implementations // at the end of SwapBuffers() and PostSubBuffer() implementations
void FinishSwapBuffers(gfx::SwapResult result, void FinishSwapBuffers(gfx::SwapCompletionResult result,
const gfx::Size& size, const gfx::Size& size,
std::vector<ui::LatencyInfo> latency_info); std::vector<ui::LatencyInfo> latency_info);
......
...@@ -603,7 +603,7 @@ void SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers( ...@@ -603,7 +603,7 @@ void SkiaOutputDeviceBufferQueue::DoFinishSwapBuffers(
std::vector<OverlayData> overlays, std::vector<OverlayData> overlays,
gfx::SwapCompletionResult result) { gfx::SwapCompletionResult result) {
DCHECK(!result.gpu_fence); DCHECK(!result.gpu_fence);
FinishSwapBuffers(result.swap_result, size, latency_info); FinishSwapBuffers(std::move(result), size, latency_info);
PageFlipComplete(image.get()); PageFlipComplete(image.get());
} }
......
...@@ -86,7 +86,7 @@ void SkiaOutputDeviceDawn::SwapBuffers( ...@@ -86,7 +86,7 @@ void SkiaOutputDeviceDawn::SwapBuffers(
std::vector<ui::LatencyInfo> latency_info) { std::vector<ui::LatencyInfo> latency_info) {
StartSwapBuffers({}); StartSwapBuffers({});
swap_chain_.Present(); swap_chain_.Present();
FinishSwapBuffers(gfx::SwapResult::SWAP_ACK, FinishSwapBuffers(gfx::SwapCompletionResult(gfx::SwapResult::SWAP_ACK),
gfx::Size(size_.width(), size_.height()), gfx::Size(size_.width(), size_.height()),
std::move(latency_info)); std::move(latency_info));
......
...@@ -192,7 +192,8 @@ void SkiaOutputDeviceGL::SwapBuffers( ...@@ -192,7 +192,8 @@ void SkiaOutputDeviceGL::SwapBuffers(
std::move(latency_info)); std::move(latency_info));
gl_surface_->SwapBuffersAsync(std::move(callback), std::move(feedback)); gl_surface_->SwapBuffersAsync(std::move(callback), std::move(feedback));
} else { } else {
FinishSwapBuffers(gl_surface_->SwapBuffers(std::move(feedback)), FinishSwapBuffers(gfx::SwapCompletionResult(
gl_surface_->SwapBuffers(std::move(feedback))),
surface_size, std::move(latency_info)); surface_size, std::move(latency_info));
} }
} }
...@@ -215,10 +216,10 @@ void SkiaOutputDeviceGL::PostSubBuffer( ...@@ -215,10 +216,10 @@ void SkiaOutputDeviceGL::PostSubBuffer(
std::move(feedback)); std::move(feedback));
} else { } else {
FinishSwapBuffers( FinishSwapBuffers(gfx::SwapCompletionResult(gl_surface_->PostSubBuffer(
gl_surface_->PostSubBuffer(rect.x(), rect.y(), rect.width(), rect.x(), rect.y(), rect.width(), rect.height(),
rect.height(), std::move(feedback)), std::move(feedback))),
surface_size, std::move(latency_info)); surface_size, std::move(latency_info));
} }
} }
...@@ -237,8 +238,10 @@ void SkiaOutputDeviceGL::CommitOverlayPlanes( ...@@ -237,8 +238,10 @@ void SkiaOutputDeviceGL::CommitOverlayPlanes(
gl_surface_->CommitOverlayPlanesAsync(std::move(callback), gl_surface_->CommitOverlayPlanesAsync(std::move(callback),
std::move(feedback)); std::move(feedback));
} else { } else {
FinishSwapBuffers(gl_surface_->CommitOverlayPlanes(std::move(feedback)), FinishSwapBuffers(
surface_size, std::move(latency_info)); gfx::SwapCompletionResult(
gl_surface_->CommitOverlayPlanes(std::move(feedback))),
surface_size, std::move(latency_info));
} }
} }
...@@ -247,7 +250,7 @@ void SkiaOutputDeviceGL::DoFinishSwapBuffers( ...@@ -247,7 +250,7 @@ void SkiaOutputDeviceGL::DoFinishSwapBuffers(
std::vector<ui::LatencyInfo> latency_info, std::vector<ui::LatencyInfo> latency_info,
gfx::SwapCompletionResult result) { gfx::SwapCompletionResult result) {
DCHECK(!result.gpu_fence); DCHECK(!result.gpu_fence);
FinishSwapBuffers(result.swap_result, size, latency_info); FinishSwapBuffers(std::move(result), size, latency_info);
} }
void SkiaOutputDeviceGL::SetDrawRectangle(const gfx::Rect& draw_rectangle) { void SkiaOutputDeviceGL::SetDrawRectangle(const gfx::Rect& draw_rectangle) {
......
...@@ -63,7 +63,7 @@ void SkiaOutputDeviceOffscreen::SwapBuffers( ...@@ -63,7 +63,7 @@ void SkiaOutputDeviceOffscreen::SwapBuffers(
DCHECK(backend_texture_.isValid()); DCHECK(backend_texture_.isValid());
StartSwapBuffers(std::move(feedback)); StartSwapBuffers(std::move(feedback));
FinishSwapBuffers(gfx::SwapResult::SWAP_ACK, FinishSwapBuffers(gfx::SwapCompletionResult(gfx::SwapResult::SWAP_ACK),
gfx::Size(size_.width(), size_.height()), gfx::Size(size_.width(), size_.height()),
std::move(latency_info)); std::move(latency_info));
} }
......
...@@ -116,7 +116,8 @@ void SkiaOutputDeviceVulkan::PostSubBuffer( ...@@ -116,7 +116,8 @@ void SkiaOutputDeviceVulkan::PostSubBuffer(
is_new_swapchain_ = false; is_new_swapchain_ = false;
result = gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS; result = gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS;
} }
FinishSwapBuffers(result, image_size, std::move(latency_info)); FinishSwapBuffers(gfx::SwapCompletionResult(result), image_size,
std::move(latency_info));
} }
SkSurface* SkiaOutputDeviceVulkan::BeginPaint( SkSurface* SkiaOutputDeviceVulkan::BeginPaint(
......
...@@ -80,8 +80,9 @@ void SkiaOutputDeviceWebView::SwapBuffers( ...@@ -80,8 +80,9 @@ void SkiaOutputDeviceWebView::SwapBuffers(
gfx::Size surface_size = gfx::Size surface_size =
gfx::Size(sk_surface_->width(), sk_surface_->height()); gfx::Size(sk_surface_->width(), sk_surface_->height());
FinishSwapBuffers(gl_surface_->SwapBuffers(std::move(feedback)), surface_size, FinishSwapBuffers(
std::move(latency_info)); gfx::SwapCompletionResult(gl_surface_->SwapBuffers(std::move(feedback))),
surface_size, std::move(latency_info));
} }
SkSurface* SkiaOutputDeviceWebView::BeginPaint( SkSurface* SkiaOutputDeviceWebView::BeginPaint(
......
...@@ -137,7 +137,7 @@ void SkiaOutputDeviceX11::PostSubBuffer( ...@@ -137,7 +137,7 @@ void SkiaOutputDeviceX11::PostSubBuffer(
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
XFlush(display_); XFlush(display_);
FinishSwapBuffers(gfx::SwapResult::SWAP_ACK, FinishSwapBuffers(gfx::SwapCompletionResult(gfx::SwapResult::SWAP_ACK),
gfx::Size(sk_surface_->width(), sk_surface_->height()), gfx::Size(sk_surface_->width(), sk_surface_->height()),
std::move(latency_info)); std::move(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