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

Conversation

@loongliu
Copy link
Contributor

In current implementation, external texture data flow is a producer-consumer model. When painting external texture, it always asks registered external texture object to produce new CVPixelBuffer, then transforms it to texture. MarkNewFrameAvailable function is ignored. This commit changes the dataflow. Now ios_external_texture_gl caches previous opengl texture, if no new frame are available, it do not copyPixelBuffer method, just uses cached opengl texture to draw.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@loongliu
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

GrContext* context) {
EnsureTextureCacheExists();
if (!freeze) {
if ( (!freeze && new_frame_ready_ ) || !texture_ref_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need the || !texture_ref_ part? I'm trying to understand the following branches:

  1. We are frozen (freeze = true) and texture_ref_ is nil.
  2. No new frame is ready and texture_ref_ is nil.

In both these cases wouldn't we always have an older texture generated from previous frame's pixel buffer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When app resigns and enters background, texture_ref_ resets to nil in OnGrContextDestroyed. Then, app becomes active, freeze is false, new_frame_ready_ is false, texture_ref is nil.
If texture_ref_ is nil, the texture rendering output is blank.
In this case, it is needed to regenerate texture_ref_.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is useful. Could you factor this conditional into a method and document this behavior? We would ideally have a test for this, but since that is currently hard, lets document this behavior.

@iskakaushik
Copy link
Contributor

@loongliu could you please add a comment explaining it as I mentioned above. We can proceed to land this PR after that.

@loongliu
Copy link
Contributor Author

@iskakaushik Changes has done.

Copy link
Contributor

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

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

LGTM, with minor nit.

GrContext* context) {
EnsureTextureCacheExists();
if (!freeze) {
if (NeedUpdateTexture(freeze)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a better name here would be TextureNeedsUpdate

Copy link
Contributor

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

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

minor nit.

@iskakaushik
Copy link
Contributor

Can you rebase on top of the new master, i think that will fix the build failures. If you could give me permission to commit to your fork, i can try and fix them.

@loongliu
Copy link
Contributor Author

@iskakaushik Invitation is sent.

@cbracken
Copy link
Member

@iskakaushik have you had time to look into doing a quick rebase of this PR? If not, I'm happy to do it, but assume I need permission.

@loongliu
Copy link
Contributor Author

@cbracken I sent you an invitation, would you do a rebase?

In current implementation, external texture data flow is a producer-consumer model. When painting external texture, it always asks registered external texture object to produce new CVPixelBuffer, then transforms it to texture. `MarkNewFrameAvailable` function is ignored. This commit changes the dataflow. Now ios_external_texture_gl caches previous opengl texture, if no new frame are available, it do not `copyPixelBuffer` method, just uses cached opengl texture to draw.
@cbracken
Copy link
Member

@loongliu Thanks! I've rebased the PR, squashed the commits, and re-pushed. Just waiting on the presubmits now.

@cbracken cbracken merged commit 94b3174 into flutter:master Aug 27, 2019
@cbracken cbracken deleted the rework_io_external_texture branch August 27, 2019 09:00
@cbracken cbracken restored the rework_io_external_texture branch August 27, 2019 09:00
cbracken added a commit that referenced this pull request Aug 27, 2019
)

Broke iOS builds:

    ../../flutter/shell/platform/darwin/ios/ios_external_texture_gl.mm:56:28: error: out-of-line definition of 'NeedUpdateTexture' does not match any declaration in 'flutter::IOSExternalTextureGL'
    bool IOSExternalTextureGL::NeedUpdateTexture(bool freeze) {
                           ^~~~~~~~~~~~~~~~~

This reverts commit 94b3174.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 27, 2019
cbracken added a commit that referenced this pull request Aug 27, 2019
In current implementation, external texture data flow is a
producer-consumer model. When painting external texture, it always asks
registered external texture object to produce new CVPixelBuffer, then
transforms it to texture. `MarkNewFrameAvailable` function is ignored.
This commit changes the dataflow. Now ios_external_texture_gl caches
previous opengl texture, if no new frame are available, it do not
`copyPixelBuffer` method, just uses cached opengl texture to draw.

This is a re-land of #9806, which was previously reverted
in #11522.
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Aug 27, 2019
[email protected]:flutter/engine.git/compare/4d7ea15cae36...bf77966

git log 4d7ea15..bf77966 --no-merges --oneline
2019-08-27 [email protected] Revert "Reuse texture cache in ios_external_texture_gl. (#9806)" (flutter/engine#11522)
2019-08-27 [email protected] Reuse texture cache in ios_external_texture_gl. (flutter/engine#9806)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants