[engine] Split encode and submit into two different surface frame callbacks. (flutter/engine#54200)

This makes it much easier to implement the deferred submit required for https://github.com/flutter/engine/pull/53826
This commit is contained in:
Jonah Williams
2024-07-30 12:58:21 -07:00
committed by GitHub
parent e078967646
commit 9650917c7e
18 changed files with 331 additions and 191 deletions

View File

@@ -17,12 +17,14 @@ namespace flutter {
SurfaceFrame::SurfaceFrame(sk_sp<SkSurface> surface,
FramebufferInfo framebuffer_info,
const EncodeCallback& encode_callback,
const SubmitCallback& submit_callback,
SkISize frame_size,
std::unique_ptr<GLContextResult> context_result,
bool display_list_fallback)
: surface_(std::move(surface)),
framebuffer_info_(framebuffer_info),
encode_callback_(encode_callback),
submit_callback_(submit_callback),
context_result_(std::move(context_result)) {
FML_DCHECK(submit_callback_);
@@ -47,8 +49,23 @@ SurfaceFrame::SurfaceFrame(sk_sp<SkSurface> surface,
}
}
bool SurfaceFrame::Encode() {
TRACE_EVENT0("flutter", "SurfaceFrame::Encode");
if (encoded_) {
return false;
}
encoded_ = PerformEncode();
return encoded_;
}
bool SurfaceFrame::Submit() {
TRACE_EVENT0("flutter", "SurfaceFrame::Submit");
if (!encoded_ && !Encode()) {
return false;
}
if (submitted_) {
return false;
}
@@ -70,12 +87,24 @@ sk_sp<SkSurface> SurfaceFrame::SkiaSurface() const {
return surface_;
}
bool SurfaceFrame::PerformEncode() {
if (encode_callback_ == nullptr) {
return false;
}
if (encode_callback_(*this, Canvas())) {
return true;
}
return false;
}
bool SurfaceFrame::PerformSubmit() {
if (submit_callback_ == nullptr) {
return false;
}
if (submit_callback_(*this, Canvas())) {
if (submit_callback_(*this)) {
return true;
}

View File

@@ -17,14 +17,19 @@
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkSurface.h"
namespace impeller {
class Surface;
}
namespace flutter {
// This class represents a frame that has been fully configured for the
// underlying client rendering API. A frame may only be submitted once.
class SurfaceFrame {
public:
using SubmitCallback =
using EncodeCallback =
std::function<bool(SurfaceFrame& surface_frame, DlCanvas* canvas)>;
using SubmitCallback = std::function<bool(SurfaceFrame& surface_frame)>;
// Information about the underlying framebuffer
struct FramebufferInfo {
@@ -58,6 +63,7 @@ class SurfaceFrame {
SurfaceFrame(sk_sp<SkSurface> surface,
FramebufferInfo framebuffer_info,
const EncodeCallback& encode_callback,
const SubmitCallback& submit_callback,
SkISize frame_size,
std::unique_ptr<GLContextResult> context_result = nullptr,
@@ -89,6 +95,8 @@ class SurfaceFrame {
bool frame_boundary = true;
};
bool Encode();
bool Submit();
bool IsSubmitted() const;
@@ -106,8 +114,17 @@ class SurfaceFrame {
sk_sp<DisplayList> BuildDisplayList();
void set_user_data(std::shared_ptr<impeller::Surface> data) {
user_data_ = std::move(data);
}
std::shared_ptr<impeller::Surface> take_user_data() {
return std::move(user_data_);
}
private:
bool submitted_ = false;
bool encoded_ = false;
#if !SLIMPELLER
DlSkCanvasAdapter adapter_;
@@ -117,11 +134,15 @@ class SurfaceFrame {
DlCanvas* canvas_ = nullptr;
FramebufferInfo framebuffer_info_;
SubmitInfo submit_info_;
EncodeCallback encode_callback_;
SubmitCallback submit_callback_;
std::shared_ptr<impeller::Surface> user_data_;
std::unique_ptr<GLContextResult> context_result_;
bool PerformSubmit();
bool PerformEncode();
FML_DISALLOW_COPY_AND_ASSIGN(SurfaceFrame);
};

View File

@@ -11,13 +11,19 @@ namespace flutter {
TEST(FlowTest, SurfaceFrameDoesNotSubmitInDtor) {
SurfaceFrame::FramebufferInfo framebuffer_info;
auto callback = [](const SurfaceFrame&, DlCanvas*) {
auto callback = [](const SurfaceFrame&) {
EXPECT_FALSE(true);
return true;
};
auto encode_callback = [](const SurfaceFrame&, DlCanvas*) {
EXPECT_FALSE(true);
return true;
};
auto surface_frame = std::make_unique<SurfaceFrame>(
/*surface=*/nullptr,
/*framebuffer_info=*/framebuffer_info,
/*encode_callback=*/encode_callback,
/*submit_callback=*/callback,
/*frame_size=*/SkISize::Make(800, 600));
surface_frame.reset();
@@ -26,10 +32,12 @@ TEST(FlowTest, SurfaceFrameDoesNotSubmitInDtor) {
TEST(FlowTest, SurfaceFrameDoesNotHaveEmptyCanvas) {
SurfaceFrame::FramebufferInfo framebuffer_info;
auto callback = [](const SurfaceFrame&, DlCanvas*) { return true; };
auto submit_callback = [](const SurfaceFrame&) { return true; };
SurfaceFrame frame(
/*surface=*/nullptr,
/*framebuffer_info=*/framebuffer_info,
/*submit_callback=*/callback,
/*encode_callback=*/callback,
/*submit_callback=*/submit_callback,
/*frame_size=*/SkISize::Make(800, 600),
/*context_result=*/nullptr,
/*display_list_fallback=*/true);
@@ -41,10 +49,12 @@ TEST(FlowTest, SurfaceFrameDoesNotHaveEmptyCanvas) {
TEST(FlowTest, SurfaceFrameDoesNotPrepareRtree) {
SurfaceFrame::FramebufferInfo framebuffer_info;
auto callback = [](const SurfaceFrame&, DlCanvas*) { return true; };
auto submit_callback = [](const SurfaceFrame&) { return true; };
auto surface_frame = std::make_unique<SurfaceFrame>(
/*surface=*/nullptr,
/*framebuffer_info=*/framebuffer_info,
/*submit_callback=*/callback,
/*encode_callback=*/callback,
/*submit_callback=*/submit_callback,
/*frame_size=*/SkISize::Make(800, 600),
/*context_result=*/nullptr,
/*display_list_fallback=*/true);

View File

@@ -104,35 +104,33 @@ auto renderer = impeller::Renderer(context);
while(true) {
std::unique_ptr<impeller::Surface> surface = /* Wrap the window surface */;
renderer->Render(surface, [&scene](RenderTarget& render_target) {
/// Render a perspective view.
const auto& render_target = surface->GetTargetRenderPassDescriptor();
auto camera =
impeller::Camera::MakePerspective(
/* fov */ kPiOver4,
/* position */ {50, -30, 50})
.LookAt(
/* target */ impeller::Vector3::Zero,
/* up */ {0, -1, 0});
/// Render a perspective view.
scene.Render(render_target, camera);
auto camera =
impeller::Camera::MakePerspective(
/* fov */ kPiOver4,
/* position */ {50, -30, 50})
.LookAt(
/* target */ impeller::Vector3::Zero,
/* up */ {0, -1, 0});
scene.Render(render_target, camera);
/// Render an overhead view on the bottom right corner of the screen.
auto size = render_target.GetRenderTargetSize();
auto minimap_camera =
impeller::Camera::MakeOrthographic(
/* view */ Rect::MakeLTRB(-100, -100, 100, 100),
/* position */ {0, -50, 0})
.LookAt(
/* target */ impeller::Vector3::Zero,
/* up */ {0, 0, 1})
.WithViewport(IRect::MakeXYWH(size.width / 4, size.height / 4,
size.height / 5, size.height / 5));
auto size = render_target.GetRenderTargetSize();
auto minimap_camera =
impeller::Camera::MakeOrthographic(
/* view */ Rect::MakeLTRB(-100, -100, 100, 100),
/* position */ {0, -50, 0})
.LookAt(
/* target */ impeller::Vector3::Zero,
/* up */ {0, 0, 1})
.WithViewport(IRect::MakeXYWH(size.width / 4, size.height / 4,
size.height / 5, size.height / 5));
scene.Render(render_target, minimap_camera);
return true;
});
scene.Render(render_target, minimap_camera);
}
```

View File

@@ -4,6 +4,7 @@
#define FML_USED_ON_EMBEDDER
#include "flow/surface_frame.h"
#include "flutter/shell/common/rasterizer.h"
#include <memory>
@@ -209,7 +210,8 @@ TEST(RasterizerTest,
auto surface_frame = std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*encode_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame&) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
EXPECT_CALL(*surface, AllowsDrawingWhenGpuDisabled()).WillOnce(Return(true));
EXPECT_CALL(*surface, AcquireFrame(SkISize()))
@@ -287,7 +289,8 @@ TEST(
auto surface_frame = std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*encode_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame&) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
EXPECT_CALL(*surface, AllowsDrawingWhenGpuDisabled()).WillOnce(Return(true));
EXPECT_CALL(*surface, AcquireFrame(SkISize()))
@@ -365,7 +368,8 @@ TEST(
auto surface_frame = std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*encode_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame&) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
EXPECT_CALL(*surface, AllowsDrawingWhenGpuDisabled()).WillOnce(Return(true));
EXPECT_CALL(*surface, AcquireFrame(SkISize()))
@@ -440,12 +444,14 @@ TEST(RasterizerTest,
auto surface_frame1 = std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*encode_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame&) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
auto surface_frame2 = std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*encode_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame&) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
EXPECT_CALL(*surface, AllowsDrawingWhenGpuDisabled())
.WillRepeatedly(Return(true));
@@ -688,7 +694,8 @@ TEST(RasterizerTest, drawMultipleViewsWithExternalViewEmbedder) {
return std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*encode_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame&) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
});
EXPECT_CALL(*surface, MakeRenderContextCurrent())
@@ -765,7 +772,8 @@ TEST(RasterizerTest,
auto surface_frame = std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, /*framebuffer_info=*/framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*encode_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame&) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
EXPECT_CALL(*surface, AllowsDrawingWhenGpuDisabled()).WillOnce(Return(true));
ON_CALL(delegate, GetIsGpuDisabledSyncSwitch())
@@ -826,7 +834,8 @@ TEST(
auto surface_frame = std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, /*framebuffer_info=*/framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*encode_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame&) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
EXPECT_CALL(*surface, AllowsDrawingWhenGpuDisabled()).WillOnce(Return(true));
ON_CALL(delegate, GetIsGpuDisabledSyncSwitch())
@@ -888,7 +897,8 @@ TEST(
auto surface_frame = std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, /*framebuffer_info=*/framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*encode_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame&) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
EXPECT_CALL(*surface, AllowsDrawingWhenGpuDisabled()).WillOnce(Return(false));
EXPECT_CALL(delegate, GetIsGpuDisabledSyncSwitch())
@@ -949,7 +959,8 @@ TEST(
auto surface_frame = std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, /*framebuffer_info=*/framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*encode_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame&) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
EXPECT_CALL(*surface, AllowsDrawingWhenGpuDisabled()).WillOnce(Return(false));
EXPECT_CALL(delegate, GetIsGpuDisabledSyncSwitch())
@@ -1074,8 +1085,9 @@ TEST(RasterizerTest,
return std::make_unique<SurfaceFrame>(
/*surface=*/
nullptr, framebuffer_info,
/*submit_callback=*/
[](const SurfaceFrame& frame, DlCanvas*) { return true; },
/*encode_callback=*/
[](const SurfaceFrame&, DlCanvas*) { return true; },
/*submit_callback=*/[](const SurfaceFrame& frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
}));
ON_CALL(*surface, MakeRenderContextCurrent())

View File

@@ -203,17 +203,21 @@ ShellTestPlatformViewVulkan::OffScreenSurface::AcquireFrame(
SkAlphaType::kOpaque_SkAlphaType);
auto surface = SkSurfaces::RenderTarget(context_.get(), skgpu::Budgeted::kNo,
image_info, 0, nullptr);
SurfaceFrame::SubmitCallback callback = [](const SurfaceFrame&,
DlCanvas* canvas) -> bool {
SurfaceFrame::EncodeCallback encode_callback = [](const SurfaceFrame&,
DlCanvas* canvas) -> bool {
canvas->Flush();
return true;
};
SurfaceFrame::SubmitCallback submit_callback =
[](const SurfaceFrame&) -> bool { return true; };
SurfaceFrame::FramebufferInfo framebuffer_info;
framebuffer_info.supports_readback = true;
return std::make_unique<SurfaceFrame>(std::move(surface), framebuffer_info,
std::move(callback),
std::move(encode_callback),
std::move(submit_callback),
/*frame_size=*/SkISize::Make(800, 600));
}

View File

@@ -4,6 +4,7 @@
#include "flutter/shell/gpu/gpu_surface_gl_impeller.h"
#include "flow/surface_frame.h"
#include "flutter/fml/make_copyable.h"
#include "impeller/display_list/dl_dispatcher.h"
#include "impeller/renderer/backend/gles/surface_gles.h"
@@ -83,7 +84,7 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceGLImpeller::AcquireFrame(
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
size);
[](const SurfaceFrame& surface_frame) { return true; }, size);
}
GLFrameInfo frame_info = {static_cast<uint32_t>(size.width()),
@@ -97,46 +98,44 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceGLImpeller::AcquireFrame(
impeller::ISize{size.width(), size.height()} // fbo_size
);
SurfaceFrame::SubmitCallback submit_callback =
fml::MakeCopyable([aiks_context = aiks_context_, //
surface = std::move(surface) //
](SurfaceFrame& surface_frame, DlCanvas* canvas) mutable -> bool {
if (!aiks_context) {
return false;
}
const impeller::RenderTarget& render_target =
surface->GetTargetRenderPassDescriptor();
auto display_list = surface_frame.BuildDisplayList();
if (!display_list) {
FML_LOG(ERROR) << "Could not build display list for surface frame.";
return false;
}
SurfaceFrame::EncodeCallback encode_calback =
[aiks_context = aiks_context_, //
render_target](SurfaceFrame& surface_frame,
DlCanvas* canvas) mutable -> bool {
if (!aiks_context) {
return false;
}
auto cull_rect =
surface->GetTargetRenderPassDescriptor().GetRenderTargetSize();
impeller::Rect dl_cull_rect = impeller::Rect::MakeSize(cull_rect);
impeller::DlDispatcher impeller_dispatcher(dl_cull_rect);
display_list->Dispatch(
impeller_dispatcher,
SkIRect::MakeWH(cull_rect.width, cull_rect.height));
auto picture = impeller_dispatcher.EndRecordingAsPicture();
const bool reset_host_buffer =
surface_frame.submit_info().frame_boundary;
auto display_list = surface_frame.BuildDisplayList();
if (!display_list) {
FML_LOG(ERROR) << "Could not build display list for surface frame.";
return false;
}
const impeller::RenderTarget& render_target =
surface->GetTargetRenderPassDescriptor();
if (!aiks_context->Render(picture, render_target, reset_host_buffer)) {
return false;
}
return surface->Present();
});
auto cull_rect = render_target.GetRenderTargetSize();
impeller::Rect dl_cull_rect = impeller::Rect::MakeSize(cull_rect);
impeller::DlDispatcher impeller_dispatcher(dl_cull_rect);
display_list->Dispatch(impeller_dispatcher,
SkIRect::MakeWH(cull_rect.width, cull_rect.height));
auto picture = impeller_dispatcher.EndRecordingAsPicture();
const bool reset_host_buffer = surface_frame.submit_info().frame_boundary;
return aiks_context->Render(picture, render_target, reset_host_buffer);
};
return std::make_unique<SurfaceFrame>(
nullptr, // surface
delegate_->GLContextFramebufferInfo(), // framebuffer info
submit_callback, // submit callback
size, // frame size
std::move(context_switch), // context result
true // display list fallback
encode_calback, // encode callback
fml::MakeCopyable([surface = std::move(surface)](const SurfaceFrame&) {
return surface->Present();
}), // submit callback
size, // frame size
std::move(context_switch), // context result
true // display list fallback
);
}

View File

@@ -235,7 +235,7 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceGLSkia::AcquireFrame(
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
size);
[](const SurfaceFrame& surface_frame) { return true; }, size);
}
const auto root_surface_transformation = GetRootTransformation();
@@ -248,10 +248,20 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceGLSkia::AcquireFrame(
}
surface->getCanvas()->setMatrix(root_surface_transformation);
SurfaceFrame::SubmitCallback submit_callback =
SurfaceFrame::EncodeCallback encode_callback =
[weak = weak_factory_.GetWeakPtr()](const SurfaceFrame& surface_frame,
DlCanvas* canvas) {
return weak ? weak->PresentSurface(surface_frame, canvas) : false;
TRACE_EVENT0("flutter", "GrDirectContext::flushAndSubmit");
if (weak) {
weak->context_->flushAndSubmit();
return true;
}
return false;
};
SurfaceFrame::SubmitCallback submit_callback =
[weak = weak_factory_.GetWeakPtr()](const SurfaceFrame& surface_frame) {
return weak ? weak->PresentSurface(surface_frame) : false;
};
framebuffer_info = delegate_->GLContextFramebufferInfo();
@@ -259,23 +269,17 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceGLSkia::AcquireFrame(
framebuffer_info.existing_damage = existing_damage_;
}
return std::make_unique<SurfaceFrame>(surface, framebuffer_info,
submit_callback, size,
encode_callback, submit_callback, size,
std::move(context_switch));
}
bool GPUSurfaceGLSkia::PresentSurface(const SurfaceFrame& frame,
DlCanvas* canvas) {
if (delegate_ == nullptr || canvas == nullptr || context_ == nullptr) {
bool GPUSurfaceGLSkia::PresentSurface(const SurfaceFrame& frame) {
if (delegate_ == nullptr || context_ == nullptr) {
return false;
}
delegate_->GLContextSetDamageRegion(frame.submit_info().buffer_damage);
{
TRACE_EVENT0("flutter", "GrDirectContext::flushAndSubmit");
context_->flushAndSubmit();
}
GLPresentInfo present_info = {
.fbo_id = fbo_id_,
.frame_damage = frame.submit_info().frame_damage,

View File

@@ -62,7 +62,7 @@ class GPUSurfaceGLSkia : public Surface {
const SkISize& untransformed_size,
const SkMatrix& root_surface_transformation);
bool PresentSurface(const SurfaceFrame& frame, DlCanvas* canvas);
bool PresentSurface(const SurfaceFrame& frame);
GPUSurfaceGLDelegate* delegate_;
sk_sp<GrDirectContext> context_;

View File

@@ -6,6 +6,8 @@
#import <Metal/Metal.h>
#import <QuartzCore/QuartzCore.h>
#include "flow/surface.h"
#include "flow/surface_frame.h"
#include "flutter/common/settings.h"
#include "flutter/fml/make_copyable.h"
@@ -60,7 +62,8 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalImpeller::AcquireFrame(const SkISiz
if (!render_to_surface_) {
return std::make_unique<SurfaceFrame>(
nullptr, SurfaceFrame::FramebufferInfo(),
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) { return true; }, frame_size);
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) { return true; },
[](const SurfaceFrame& surface_frame) { return true; }, frame_size);
}
switch (render_target_type_) {
@@ -100,7 +103,8 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalImpeller::AcquireFrameFromCAMetalLa
#endif // IMPELLER_DEBUG
id<MTLTexture> last_texture = static_cast<id<MTLTexture>>(last_texture_);
SurfaceFrame::SubmitCallback submit_callback =
SurfaceFrame::EncodeCallback encode_callback =
fml::MakeCopyable([damage = damage_,
disable_partial_repaint = disable_partial_repaint_, //
aiks_context = aiks_context_, //
@@ -149,13 +153,17 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalImpeller::AcquireFrameFromCAMetalLa
}
if (clip_rect && clip_rect->IsEmpty()) {
return surface->Present();
surface_frame.set_user_data(std::move(surface));
return true;
}
impeller::IRect cull_rect = surface->coverage();
SkIRect sk_cull_rect = SkIRect::MakeWH(cull_rect.GetWidth(), cull_rect.GetHeight());
const impeller::RenderTarget& render_target = surface->GetTargetRenderPassDescriptor();
surface->SetFrameBoundary(surface_frame.submit_info().frame_boundary);
surface_frame.set_user_data(std::move(surface));
#if EXPERIMENTAL_CANVAS
impeller::TextFrameDispatcher collector(aiks_context->GetContentContext(),
impeller::Matrix());
@@ -169,19 +177,13 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalImpeller::AcquireFrameFromCAMetalLa
impeller_dispatcher.FinishRecording();
aiks_context->GetContentContext().GetTransientsBuffer().Reset();
aiks_context->GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames();
return surface->Present();
return true;
#else
impeller::DlDispatcher impeller_dispatcher(cull_rect);
display_list->Dispatch(impeller_dispatcher, sk_cull_rect);
auto picture = impeller_dispatcher.EndRecordingAsPicture();
const bool reset_host_buffer = surface_frame.submit_info().frame_boundary;
surface->SetFrameBoundary(surface_frame.submit_info().frame_boundary);
if (!aiks_context->Render(picture, render_target, reset_host_buffer)) {
return false;
}
return surface->Present();
return aiks_context->Render(picture, render_target, reset_host_buffer);
#endif
});
@@ -199,12 +201,14 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalImpeller::AcquireFrameFromCAMetalLa
framebuffer_info.supports_partial_repaint = true;
}
return std::make_unique<SurfaceFrame>(nullptr, // surface
framebuffer_info, // framebuffer info
submit_callback, // submit callback
frame_size, // frame size
nullptr, // context result
true // display list fallback
return std::make_unique<SurfaceFrame>(
nullptr, // surface
framebuffer_info, // framebuffer info
encode_callback, // submit callback
[](SurfaceFrame& surface_frame) { return surface_frame.take_user_data()->Present(); },
frame_size, // frame size
nullptr, // context result
true // display list fallback
);
}
@@ -226,13 +230,11 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalImpeller::AcquireFrameFromMTLTextur
impeller::ContextMTL::Cast(*aiks_context_->GetContext()).GetCaptureManager()->StartCapture();
#endif // IMPELLER_DEBUG
SurfaceFrame::SubmitCallback submit_callback =
SurfaceFrame::EncodeCallback encode_callback =
fml::MakeCopyable([disable_partial_repaint = disable_partial_repaint_, //
damage = damage_,
aiks_context = aiks_context_, //
texture_info, //
mtl_texture, //
delegate = delegate_ //
mtl_texture //
](SurfaceFrame& surface_frame, DlCanvas* canvas) mutable -> bool {
if (!aiks_context) {
return false;
@@ -303,9 +305,14 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalImpeller::AcquireFrameFromMTLTextur
return false;
}
return delegate->PresentTexture(texture_info);
return true;
});
SurfaceFrame::SubmitCallback submit_callback =
[texture_info, delegate = delegate_](const SurfaceFrame& surface_frame) {
return delegate->PresentTexture(texture_info);
};
SurfaceFrame::FramebufferInfo framebuffer_info;
framebuffer_info.supports_readback = true;
@@ -322,10 +329,11 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalImpeller::AcquireFrameFromMTLTextur
return std::make_unique<SurfaceFrame>(nullptr, // surface
framebuffer_info, // framebuffer info
submit_callback, // submit callback
frame_size, // frame size
nullptr, // context result
true // display list fallback
encode_callback,
submit_callback, // submit callback
frame_size, // frame size
nullptr, // context result
true // display list fallback
);
}

View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flow/surface_frame.h"
#if !SLIMPELLER
#include "flutter/shell/gpu/gpu_surface_metal_skia.h"
@@ -102,8 +103,12 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalSkia::AcquireFrame(const SkISize& f
if (!render_to_surface_) {
return std::make_unique<SurfaceFrame>(
nullptr, SurfaceFrame::FramebufferInfo(),
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) { return true; }, frame_size);
nullptr, //
SurfaceFrame::FramebufferInfo(), //
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) { return true; }, //
[](const SurfaceFrame& surface_frame) { return true; }, //
frame_size //
);
}
PrecompileKnownSkSLsIfNecessary();
@@ -152,9 +157,8 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalSkia::AcquireFrameFromCAMetalLayer(
return nullptr;
}
auto submit_callback = [this, drawable](const SurfaceFrame& surface_frame,
auto encode_callback = [this, drawable](const SurfaceFrame& surface_frame,
DlCanvas* canvas) -> bool {
TRACE_EVENT0("flutter", "GPUSurfaceMetal::Submit");
if (canvas == nullptr) {
FML_DLOG(ERROR) << "Canvas not available.";
return false;
@@ -179,6 +183,11 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalSkia::AcquireFrameFromCAMetalLayer(
damage_[texture] = SkIRect::MakeEmpty();
}
return true;
};
auto submit_callback = [this, drawable](const SurfaceFrame& surface_frame) -> bool {
TRACE_EVENT0("flutter", "GPUSurfaceMetal::Submit");
return delegate_->PresentDrawable(drawable);
};
@@ -196,8 +205,8 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalSkia::AcquireFrameFromCAMetalLayer(
framebuffer_info.supports_partial_repaint = true;
}
return std::make_unique<SurfaceFrame>(std::move(surface), framebuffer_info, submit_callback,
frame_info);
return std::make_unique<SurfaceFrame>(std::move(surface), framebuffer_info, encode_callback,
submit_callback, frame_info);
}
std::unique_ptr<SurfaceFrame> GPUSurfaceMetalSkia::AcquireFrameFromMTLTexture(
@@ -220,9 +229,7 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalSkia::AcquireFrameFromMTLTexture(
return nullptr;
}
auto submit_callback = [texture = texture, delegate = delegate_](
const SurfaceFrame& surface_frame, DlCanvas* canvas) -> bool {
TRACE_EVENT0("flutter", "GPUSurfaceMetal::PresentTexture");
auto encode_callback = [](const SurfaceFrame& surface_frame, DlCanvas* canvas) -> bool {
if (canvas == nullptr) {
FML_DLOG(ERROR) << "Canvas not available.";
return false;
@@ -233,14 +240,19 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceMetalSkia::AcquireFrameFromMTLTexture(
canvas->Flush();
}
return true;
};
auto submit_callback = [texture = texture,
delegate = delegate_](const SurfaceFrame& surface_frame) {
TRACE_EVENT0("flutter", "GPUSurfaceMetal::PresentTexture");
return delegate->PresentTexture(texture);
};
SurfaceFrame::FramebufferInfo framebuffer_info;
framebuffer_info.supports_readback = true;
return std::make_unique<SurfaceFrame>(std::move(surface), framebuffer_info, submit_callback,
frame_info);
return std::make_unique<SurfaceFrame>(std::move(surface), framebuffer_info, encode_callback,
submit_callback, frame_info);
}
// |Surface|

View File

@@ -6,6 +6,7 @@
#include <memory>
#include "flow/surface_frame.h"
#include "flutter/fml/logging.h"
#include "third_party/skia/include/core/SkSurface.h"
@@ -39,7 +40,7 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceSoftware::AcquireFrame(
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
logical_size);
[](const SurfaceFrame& surface_frame) { return true; }, logical_size);
}
if (!IsValid()) {
@@ -64,7 +65,7 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceSoftware::AcquireFrame(
SkCanvas* canvas = backing_store->getCanvas();
canvas->resetMatrix();
SurfaceFrame::SubmitCallback on_submit =
SurfaceFrame::EncodeCallback encode_callback =
[self = weak_factory_.GetWeakPtr()](const SurfaceFrame& surface_frame,
DlCanvas* canvas) -> bool {
// If the surface itself went away, there is nothing more to do.
@@ -73,12 +74,21 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceSoftware::AcquireFrame(
}
canvas->Flush();
return self->delegate_->PresentBackingStore(surface_frame.SkiaSurface());
return true;
};
SurfaceFrame::SubmitCallback submit_callback =
[self = weak_factory_.GetWeakPtr()](const SurfaceFrame& surface_frame) {
// If the surface itself went away, there is nothing more to do.
if (!self || !self->IsValid()) {
return false;
}
return self->delegate_->PresentBackingStore(
surface_frame.SkiaSurface());
};
return std::make_unique<SurfaceFrame>(backing_store, framebuffer_info,
on_submit, logical_size);
encode_callback, submit_callback,
logical_size);
}
// |Surface|

View File

@@ -50,7 +50,7 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceVulkan::AcquireFrame(
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
frame_size);
[](const SurfaceFrame& surface_frame) { return true; }, frame_size);
}
FlutterVulkanImage image = delegate_->AcquireImage(frame_size);
@@ -67,10 +67,9 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceVulkan::AcquireFrame(
return nullptr;
}
SurfaceFrame::SubmitCallback callback = [image = image, delegate = delegate_](
const SurfaceFrame&,
DlCanvas* canvas) -> bool {
TRACE_EVENT0("flutter", "GPUSurfaceVulkan::PresentImage");
SurfaceFrame::EncodeCallback encode_callback =
[image = image, delegate = delegate_](const SurfaceFrame&,
DlCanvas* canvas) -> bool {
if (canvas == nullptr) {
FML_DLOG(ERROR) << "Canvas not available.";
return false;
@@ -82,10 +81,18 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceVulkan::AcquireFrame(
static_cast<VkFormat>(image.format));
};
SurfaceFrame::SubmitCallback submit_callback =
[image = image, delegate = delegate_](const SurfaceFrame&) -> bool {
TRACE_EVENT0("flutter", "GPUSurfaceVulkan::PresentImage");
return delegate->PresentImage(reinterpret_cast<VkImage>(image.image),
static_cast<VkFormat>(image.format));
};
SurfaceFrame::FramebufferInfo framebuffer_info{.supports_readback = true};
return std::make_unique<SurfaceFrame>(std::move(surface), framebuffer_info,
std::move(callback), frame_size);
std::move(encode_callback),
std::move(submit_callback), frame_size);
}
SkMatrix GPUSurfaceVulkan::GetRootTransformation() const {

View File

@@ -4,6 +4,7 @@
#include "flutter/shell/gpu/gpu_surface_vulkan_impeller.h"
#include "flow/surface_frame.h"
#include "flutter/fml/make_copyable.h"
#include "impeller/display_list/dl_dispatcher.h"
#include "impeller/renderer/backend/vulkan/surface_context_vk.h"
@@ -58,67 +59,64 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceVulkanImpeller::AcquireFrame(
return nullptr;
}
SurfaceFrame::SubmitCallback submit_callback =
fml::MakeCopyable([aiks_context = aiks_context_, //
surface = std::move(surface) //
auto cull_rect =
surface->GetTargetRenderPassDescriptor().GetRenderTargetSize();
const impeller::RenderTarget& render_target =
surface->GetTargetRenderPassDescriptor();
SurfaceFrame::EncodeCallback encode_callback = [aiks_context =
aiks_context_, //
render_target,
cull_rect //
](SurfaceFrame& surface_frame, DlCanvas* canvas) mutable -> bool {
if (!aiks_context) {
return false;
}
if (!aiks_context) {
return false;
}
auto display_list = surface_frame.BuildDisplayList();
if (!display_list) {
FML_LOG(ERROR) << "Could not build display list for surface frame.";
return false;
}
auto display_list = surface_frame.BuildDisplayList();
if (!display_list) {
FML_LOG(ERROR) << "Could not build display list for surface frame.";
return false;
}
auto cull_rect =
surface->GetTargetRenderPassDescriptor().GetRenderTargetSize();
const impeller::RenderTarget& render_target =
surface->GetTargetRenderPassDescriptor();
#if EXPERIMENTAL_CANVAS
impeller::TextFrameDispatcher collector(
aiks_context->GetContentContext(), impeller::Matrix());
display_list->Dispatch(
collector, SkIRect::MakeWH(cull_rect.width, cull_rect.height));
impeller::ExperimentalDlDispatcher impeller_dispatcher(
aiks_context->GetContentContext(), render_target,
display_list->root_has_backdrop_filter(),
display_list->max_root_blend_mode(),
impeller::IRect::RoundOut(impeller::Rect::MakeSize(cull_rect)));
display_list->Dispatch(
impeller_dispatcher,
SkIRect::MakeWH(cull_rect.width, cull_rect.height));
impeller_dispatcher.FinishRecording();
aiks_context->GetContentContext().GetTransientsBuffer().Reset();
aiks_context->GetContentContext()
.GetLazyGlyphAtlas()
->ResetTextFrames();
return surface->Present();
impeller::TextFrameDispatcher collector(aiks_context->GetContentContext(),
impeller::Matrix());
display_list->Dispatch(collector,
SkIRect::MakeWH(cull_rect.width, cull_rect.height));
impeller::ExperimentalDlDispatcher impeller_dispatcher(
aiks_context->GetContentContext(), render_target,
display_list->root_has_backdrop_filter(),
display_list->max_root_blend_mode(),
impeller::IRect::RoundOut(impeller::Rect::MakeSize(cull_rect)));
display_list->Dispatch(impeller_dispatcher,
SkIRect::MakeWH(cull_rect.width, cull_rect.height));
impeller_dispatcher.FinishRecording();
aiks_context->GetContentContext().GetTransientsBuffer().Reset();
aiks_context->GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames();
return true;
#else
impeller::Rect dl_cull_rect = impeller::Rect::MakeSize(cull_rect);
impeller::DlDispatcher impeller_dispatcher(dl_cull_rect);
display_list->Dispatch(
impeller_dispatcher,
SkIRect::MakeWH(cull_rect.width, cull_rect.height));
auto picture = impeller_dispatcher.EndRecordingAsPicture();
const bool reset_host_buffer =
surface_frame.submit_info().frame_boundary;
if (!aiks_context->Render(picture, render_target, reset_host_buffer)) {
return false;
}
return surface->Present();
impeller::Rect dl_cull_rect = impeller::Rect::MakeSize(cull_rect);
impeller::DlDispatcher impeller_dispatcher(dl_cull_rect);
display_list->Dispatch(impeller_dispatcher,
SkIRect::MakeWH(cull_rect.width, cull_rect.height));
auto picture = impeller_dispatcher.EndRecordingAsPicture();
const bool reset_host_buffer = surface_frame.submit_info().frame_boundary;
return aiks_context->Render(picture, render_target, reset_host_buffer);
#endif
});
};
return std::make_unique<SurfaceFrame>(
nullptr, // surface
SurfaceFrame::FramebufferInfo{}, // framebuffer info
submit_callback, // submit callback
size, // frame size
nullptr, // context result
true // display list fallback
encode_callback, // encode callback
fml::MakeCopyable([surface = std::move(surface)](const SurfaceFrame&) {
return surface->Present();
}), // submit callback
size, // frame size
nullptr, // context result
true // display list fallback
);
}

View File

@@ -273,12 +273,14 @@ TEST(AndroidExternalViewEmbedder, SubmitFlutterView) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
auto surface_frame_2 = std::make_unique<SurfaceFrame>(
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
auto surface_mock = std::make_unique<SurfaceMock>();
@@ -314,6 +316,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFlutterView) {
}
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
embedder->SubmitFlutterView(kImplicitViewId, gr_context.get(), nullptr,
@@ -384,6 +387,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFlutterView) {
}
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
embedder->SubmitFlutterView(kImplicitViewId, gr_context.get(), nullptr,
@@ -452,6 +456,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFlutterView) {
}
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
embedder->SubmitFlutterView(kImplicitViewId, gr_context.get(), nullptr,
std::move(surface_frame));
@@ -485,6 +490,7 @@ TEST(AndroidExternalViewEmbedder, OverlayCoverTwoPlatformViews) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
auto surface_mock = std::make_unique<SurfaceMock>();
@@ -560,6 +566,7 @@ TEST(AndroidExternalViewEmbedder, OverlayCoverTwoPlatformViews) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) mutable {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
embedder->SubmitFlutterView(kImplicitViewId, gr_context.get(), nullptr,
@@ -585,6 +592,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrameOverlayComposition) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
auto surface_mock = std::make_unique<SurfaceMock>();
@@ -665,6 +673,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFrameOverlayComposition) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) mutable {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
embedder->SubmitFlutterView(kImplicitViewId, gr_context.get(), nullptr,
@@ -690,6 +699,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFramePlatformViewWithoutAnyOverlay) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
auto surface_mock = std::make_unique<SurfaceMock>();
@@ -735,6 +745,7 @@ TEST(AndroidExternalViewEmbedder, SubmitFramePlatformViewWithoutAnyOverlay) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) mutable {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
embedder->SubmitFlutterView(kImplicitViewId, gr_context.get(), nullptr,
@@ -780,6 +791,7 @@ TEST(AndroidExternalViewEmbedder, DestroyOverlayLayersOnSizeChange) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
auto surface_mock = std::make_unique<SurfaceMock>();
@@ -839,6 +851,7 @@ TEST(AndroidExternalViewEmbedder, DestroyOverlayLayersOnSizeChange) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
embedder->SubmitFlutterView(kImplicitViewId, gr_context.get(), nullptr,
std::move(surface_frame));
@@ -870,6 +883,7 @@ TEST(AndroidExternalViewEmbedder, DoesNotDestroyOverlayLayersOnSizeChange) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
auto surface_mock = std::make_unique<SurfaceMock>();
@@ -928,6 +942,7 @@ TEST(AndroidExternalViewEmbedder, DoesNotDestroyOverlayLayersOnSizeChange) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
embedder->SubmitFlutterView(kImplicitViewId, gr_context.get(), nullptr,
std::move(surface_frame));
@@ -998,6 +1013,7 @@ TEST(AndroidExternalViewEmbedder, Teardown) {
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) {
return true;
},
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
auto surface_mock = std::make_unique<SurfaceMock>();
@@ -1042,6 +1058,7 @@ TEST(AndroidExternalViewEmbedder, Teardown) {
auto surface_frame = std::make_unique<SurfaceFrame>(
SkSurfaces::Null(1000, 1000), framebuffer_info,
[](const SurfaceFrame& surface_frame, DlCanvas* canvas) { return true; },
[](const SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
embedder->SubmitFlutterView(kImplicitViewId, gr_context.get(), nullptr,
std::move(surface_frame));

View File

@@ -2402,6 +2402,7 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(const std::string& name) {
auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
nullptr, framebuffer_info,
[](const flutter::SurfaceFrame& surface_frame, flutter::DlCanvas* canvas) { return false; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
XCTAssertFalse(
flutterPlatformViewsController->SubmitFrame(nullptr, nullptr, std::move(mock_surface)));
@@ -2413,6 +2414,7 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(const std::string& name) {
auto mock_surface_submit_true = std::make_unique<flutter::SurfaceFrame>(
nullptr, framebuffer_info,
[](const flutter::SurfaceFrame& surface_frame, flutter::DlCanvas* canvas) { return true; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
XCTAssertTrue(flutterPlatformViewsController->SubmitFrame(nullptr, nullptr,
std::move(mock_surface_submit_true)));
@@ -2592,6 +2594,7 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(const std::string& name) {
auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
std::move(mock_sk_surface), framebuffer_info,
[](const flutter::SurfaceFrame& surface_frame, flutter::DlCanvas* canvas) { return true; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
XCTAssertTrue(
@@ -2620,6 +2623,7 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(const std::string& name) {
mock_surface = std::make_unique<flutter::SurfaceFrame>(
std::move(mock_sk_surface), framebuffer_info,
[](const flutter::SurfaceFrame& surface_frame, flutter::DlCanvas* canvas) { return true; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
XCTAssertTrue(
flutterPlatformViewsController->SubmitFrame(nullptr, nullptr, std::move(mock_surface)));
@@ -2692,6 +2696,7 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(const std::string& name) {
auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
std::move(mock_sk_surface), framebuffer_info,
[](const flutter::SurfaceFrame& surface_frame, flutter::DlCanvas* canvas) { return true; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
XCTAssertTrue(
@@ -2720,6 +2725,7 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(const std::string& name) {
mock_surface = std::make_unique<flutter::SurfaceFrame>(
std::move(mock_sk_surface), framebuffer_info,
[](const flutter::SurfaceFrame& surface_frame, flutter::DlCanvas* canvas) { return true; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
XCTAssertTrue(
flutterPlatformViewsController->SubmitFrame(nullptr, nullptr, std::move(mock_surface)));
@@ -3201,6 +3207,7 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(const std::string& name) {
auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
std::move(mock_sk_surface), framebuffer_info,
[](const flutter::SurfaceFrame& surface_frame, flutter::DlCanvas* canvas) { return true; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
XCTAssertTrue(
flutterPlatformViewsController->SubmitFrame(nullptr, nullptr, std::move(mock_surface)));
@@ -3228,6 +3235,7 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(const std::string& name) {
auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
std::move(mock_sk_surface), framebuffer_info,
[](const flutter::SurfaceFrame& surface_frame, flutter::DlCanvas* canvas) { return true; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
XCTAssertTrue(
flutterPlatformViewsController->SubmitFrame(nullptr, nullptr, std::move(mock_surface)));
@@ -3296,6 +3304,7 @@ fml::RefPtr<fml::TaskRunner> CreateNewThread(const std::string& name) {
auto mock_surface = std::make_unique<flutter::SurfaceFrame>(
std::move(mock_sk_surface), framebuffer_info,
[](const flutter::SurfaceFrame& surface_frame, flutter::DlCanvas* canvas) { return true; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
/*frame_size=*/SkISize::Make(800, 600));
flutterPlatformViewsController->SubmitFrame(nullptr, nullptr, std::move(mock_surface));

View File

@@ -36,7 +36,7 @@ std::unique_ptr<flutter::SurfaceFrame> Surface::AcquireFrame(
nullptr, std::move(framebuffer_info),
[](const flutter::SurfaceFrame& surface_frame,
flutter::DlCanvas* canvas) { return true; },
size);
[](const flutter::SurfaceFrame& surface_frame) { return true; }, size);
}
// |flutter::Surface|

View File

@@ -343,6 +343,7 @@ void DrawSimpleFrame(ExternalViewEmbedder& external_view_embedder,
nullptr, std::move(framebuffer_info),
[](const flutter::SurfaceFrame& surface_frame,
flutter::DlCanvas* canvas) { return true; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
frame_size));
}
@@ -375,6 +376,7 @@ void DrawFrameWithView(
nullptr, std::move(framebuffer_info),
[](const flutter::SurfaceFrame& surface_frame,
flutter::DlCanvas* canvas) { return true; },
[](const flutter::SurfaceFrame& surface_frame) { return true; },
frame_size));
}