-
Notifications
You must be signed in to change notification settings - Fork 6k
Reuse texture cache in ios_external_texture_gl. #9806
Conversation
|
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. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
1 similar comment
|
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. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
|
I signed it! |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
| GrContext* context) { | ||
| EnsureTextureCacheExists(); | ||
| if (!freeze) { | ||
| if ( (!freeze && new_frame_ready_ ) || !texture_ref_) { |
There was a problem hiding this comment.
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:
- We are frozen (
freeze = true) andtexture_ref_is nil. - 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?
There was a problem hiding this comment.
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_.
There was a problem hiding this comment.
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.
|
@loongliu could you please add a comment explaining it as I mentioned above. We can proceed to land this PR after that. |
|
@iskakaushik Changes has done. |
There was a problem hiding this 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)) { |
There was a problem hiding this comment.
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
iskakaushik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit.
|
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. |
|
@iskakaushik Invitation is sent. |
|
@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. |
|
@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.
|
@loongliu Thanks! I've rebased the PR, squashed the commits, and re-pushed. Just waiting on the presubmits now. |
) 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.
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.
[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
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.
MarkNewFrameAvailablefunction is ignored. This commit changes the dataflow. Now ios_external_texture_gl caches previous opengl texture, if no new frame are available, it do notcopyPixelBuffermethod, just uses cached opengl texture to draw.