Commit 870810e0 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

SkiaRenderer/macOS: Plumb CALayerParams

Add CALayerParams to gfx::SwapCompletionResult. Populate this
parameter in ImageTransportSurfaceOverlayMac, and use this
parameter to populate gpu::SwapBuffersCompleteParams.

Bug: 894929
Change-Id: I484fd6075b0724ef40a2f7157cc2037ae0fbe98a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2225460
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarCorentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774519}
parent d318a01e
......@@ -126,9 +126,8 @@ const gpu::SwapBuffersCompleteParams& SkiaOutputDevice::SwapInfo::Complete(
gfx::SwapCompletionResult result) {
params_.swap_response.result = result.swap_result;
params_.swap_response.timings.swap_end = base::TimeTicks::Now();
// TODO(https://crbug.com/894929): Pass CALayerParams from from |result| to
// |params_| here.
if (result.ca_layer_params)
params_.ca_layer_params = *result.ca_layer_params;
return params_;
}
......
......@@ -51,6 +51,15 @@ ImageTransportSurfaceOverlayMacBase<BaseClass>::
ca_layer_tree_coordinator_.reset(new ui::CALayerTreeCoordinator(
use_remote_layer_api_, allow_av_sample_buffer_display_layer));
// Create the CAContext to send this to the GPU process, and the layer for
// the context.
if (use_remote_layer_api_) {
CGSConnectionID connection_id = CGSMainConnectionID();
ca_context_.reset([[CAContext contextWithCGSConnection:connection_id
options:@{}] retain]);
[ca_context_ setLayer:ca_layer_tree_coordinator_->GetCALayerForDisplay()];
}
}
template <typename BaseClass>
......@@ -63,14 +72,6 @@ ImageTransportSurfaceOverlayMacBase<
template <typename BaseClass>
bool ImageTransportSurfaceOverlayMacBase<BaseClass>::Initialize(
gl::GLSurfaceFormat format) {
// Create the CAContext to send this to the GPU process, and the layer for
// the context.
if (use_remote_layer_api_) {
CGSConnectionID connection_id = CGSMainConnectionID();
ca_context_.reset([
[CAContext contextWithCGSConnection:connection_id options:@{}] retain]);
[ca_context_ setLayer:ca_layer_tree_coordinator_->GetCALayerForDisplay()];
}
return true;
}
......@@ -175,11 +176,13 @@ ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersInternal(
// Send the swap parameters to the browser.
if (completion_callback) {
// TODO(https://crbug.com/894929): Add CALayerParams here.
gfx::SwapCompletionResult result(gfx::SwapResult::SWAP_ACK);
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(completion_callback), std::move(result)));
base::BindOnce(
std::move(completion_callback),
gfx::SwapCompletionResult(
gfx::SwapResult::SWAP_ACK,
std::make_unique<gfx::CALayerParams>(params.ca_layer_params))));
}
delegate_->DidSwapBuffersComplete(std::move(params));
constexpr int64_t kRefreshIntervalInMicroseconds =
......
......@@ -4,6 +4,7 @@
#include "ui/gfx/swap_result.h"
#include "ui/gfx/ca_layer_params.h"
#include "ui/gfx/gpu_fence.h"
namespace gfx {
......@@ -16,6 +17,11 @@ SwapCompletionResult::SwapCompletionResult(
std::unique_ptr<gfx::GpuFence> gpu_fence)
: swap_result(swap_result), gpu_fence(std::move(gpu_fence)) {}
SwapCompletionResult::SwapCompletionResult(
gfx::SwapResult swap_result,
std::unique_ptr<gfx::CALayerParams> ca_layer_params)
: swap_result(swap_result), ca_layer_params(std::move(ca_layer_params)) {}
SwapCompletionResult::SwapCompletionResult(SwapCompletionResult&& other) =
default;
SwapCompletionResult::~SwapCompletionResult() = default;
......
......@@ -12,6 +12,7 @@
namespace gfx {
struct CALayerParams;
class GpuFence;
enum class SwapResult {
......@@ -56,6 +57,8 @@ struct GFX_EXPORT SwapCompletionResult {
explicit SwapCompletionResult(gfx::SwapResult swap_result);
SwapCompletionResult(gfx::SwapResult swap_result,
std::unique_ptr<gfx::GpuFence> gpu_fence);
SwapCompletionResult(gfx::SwapResult swap_result,
std::unique_ptr<gfx::CALayerParams> ca_layer_params);
SwapCompletionResult(SwapCompletionResult&& other);
~SwapCompletionResult();
......@@ -64,7 +67,7 @@ struct GFX_EXPORT SwapCompletionResult {
gfx::SwapResult swap_result = SwapResult::SWAP_FAILED;
std::unique_ptr<GpuFence> gpu_fence;
// TODO(https://crbug.com/894929): Add CALayerParams here.
std::unique_ptr<CALayerParams> ca_layer_params;
};
} // namespace gfx
......
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