Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

gaaclarke
Copy link
Member

Description

Also, added the ability for IOSContexts to store their skia contexts so we can make the OpenGL code work like the Metal code.

Related Issues

flutter/flutter#72021

Tests

I added the following tests:

FlutterEngineTest_mrc test asserts changed.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the contributor guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the C++, Objective-C, Java style guides for the engine.
  • I read the tree hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation.
  • All existing and new tests are passing.
  • I am willing to follow-up on review comments in a timely manner.

Reviewer Checklist

Breaking Change

Did any tests fail when you ran them? Please read handling breaking changes.

@@ -43,6 +43,16 @@
GrBackend::kOpenGL_GrBackend, GPUSurfaceGLDelegate::GetDefaultPlatformGLInterface());
}

// |IOSContext|
sk_sp<GrDirectContext> IOSContextGL::GetMainContext() const {
/// TODO(b/tbd): Currently the GPUSurfaceGL creates the main context for
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll write up the issue once this PR has been approved. This means the savings won't happen on OpenGL until that PR is resolved. It was risky enough and lower priority since less people are on OpenGL so I punted for now.

@gaaclarke gaaclarke marked this pull request as ready for review January 9, 2021 00:55
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@@ -106,6 +106,14 @@ class IOSContext {
int64_t texture_id,
fml::scoped_nsobject<NSObject<FlutterTexture>> texture) = 0;

//----------------------------------------------------------------------------
/// @brief Accessor for the Skia context associated with IOSSurfaces.
///
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a bit more description and tie the wording back to existing wording in the class doc like Manages the lifetime of the on-screen and off-screen rendering. Where does "main" fit into the existing picture. Also describe why this is exposed and other contexts are not a bit. Also when is this available. Is there sequencing expected with the other methods in this class?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this docstring. I think it addresses your points if you want to give a look.

I didn't name this method, I just promoted it to its superclass to make opengl and metal behave similarly and make my work easier (the opengl refactor will be done at a later date). There is 1 skia context for the raster thread for rendering to the screen. There can be any number of resource contexts. In practice only one is ever created for use with the io thread.

@@ -24,7 +24,7 @@ class IOSContextMetal final : public IOSContext {

fml::scoped_nsobject<FlutterDarwinContextMetal> GetDarwinContext() const;

sk_sp<GrDirectContext> GetMainContext() const;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the idea is that there's 2, a main rendering context on the raster thread and a resource secondary context on the io thread? If so, be fully descriptive in the doc so someone new can understand.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated docstring in ios_context, added link to it.

for IOSContexts to store their skia contexts so we can make the OpenGL
code work like the Metal code.
@gaaclarke gaaclarke force-pushed the lfe-share-gpu-context-2 branch from 42ff328 to 9857163 Compare January 11, 2021 23:26
@gaaclarke
Copy link
Member Author

Landing on read, the last CI task has a known issue with timeouts (flutter/flutter#72391) This task has completed successfully previously without any code changes afterwards, just to documentation.

@gaaclarke gaaclarke merged commit 62e2529 into flutter:master Jan 12, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 12, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 12, 2021
gspencergoog pushed a commit to gspencergoog/engine that referenced this pull request Jan 20, 2021
Started asserting that metal gpu contexts are shared, added ability
for IOSContexts to store their skia contexts so we can make the OpenGL
code work like the Metal code.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants