Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] cache onscreen render targets. #50751

Merged
merged 4 commits into from
Feb 21, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Feb 18, 2024

Currently we cache render pass objects to offscreen render targets only. Caching onscreen doesn't work as 1) the render targets are stored on the texture_vk object and 2) the texture_vk object is recreated for each frame (see https://github.com/flutter/engine/blob/main/impeller/renderer/backend/vulkan/surface_vk.cc#L14 ).

To make sure the render pass is cached, move the storage to the texture source.

part of flutter/flutter#141750

@jonahwilliams jonahwilliams marked this pull request as ready for review February 20, 2024 17:27
@jonahwilliams
Copy link
Member Author

@dnfield Test added

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 21, 2024
@auto-submit auto-submit bot merged commit db49661 into flutter:main Feb 21, 2024
26 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 21, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 21, 2024
…143875)

flutter/engine@52ffcaa...bf5c003

2024-02-21 [email protected] Roll Skia from 9d86359b5fe8 to 8fa858855820 (15 revisions) (flutter/engine#50827)
2024-02-21 [email protected] Add the `scenario_app` `'solid_blue'` golden to the Android test suite (flutter/engine#50801)
2024-02-21 [email protected] Ignore EOF newline characters and added tests to `dir_contents_diff` tool (flutter/engine#50805)
2024-02-21 [email protected] Make the GL context current in EmbedderSurfaceGLImpeller before creating the GPU surface (flutter/engine#50807)
2024-02-21 [email protected] Fail engine post-submit on skia-gold comparions. (flutter/engine#50826)
2024-02-21 [email protected] Remove WindowManager reflection in SingleViewPresentation.java (flutter/engine#49996)
2024-02-21 [email protected] [Impeller] applied the lerp hack to blur (roughly 2x speedup?) (flutter/engine#50790)
2024-02-21 [email protected] Migrate the Fuchsia embedder to the Dart_RecordTimelineEvent API (flutter/engine#50823)
2024-02-21 [email protected] Hook ImageReaderSurfaceProducer to the onTrimMemory listener interface (flutter/engine#50792)
2024-02-21 [email protected] Fix the local-only lint errors due to an unexpected `GeneratedPluginRegistrant.java` (flutter/engine#50795)
2024-02-21 [email protected] [Impeller] cache onscreen render targets. (flutter/engine#50751)
2024-02-21 [email protected] Use 'et format' in CI. Check formatting of all files in CI (flutter/engine#50810)

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],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@jonahwilliams
Copy link
Member Author

revert: breaking flutter tester --enable-impeller workflow.

@jonahwilliams jonahwilliams added the revert Label used to revert changes in a closed and merged pull request. label Feb 22, 2024
Copy link
Contributor

auto-submit bot commented Feb 22, 2024

A reason for requesting a revert of flutter/engine/50751 could
not be found or the reason was not properly formatted. Begin a comment with 'Reason for revert:' to tell the bot why
this issue is being reverted.

@auto-submit auto-submit bot removed the revert Label used to revert changes in a closed and merged pull request. label Feb 22, 2024
@jonahwilliams
Copy link
Member Author

Reason for revert: breaking flutter tester --enable-impeller workflow

@jonahwilliams jonahwilliams added the revert Label used to revert changes in a closed and merged pull request. label Feb 22, 2024
auto-submit bot pushed a commit that referenced this pull request Feb 22, 2024
@auto-submit auto-submit bot removed the revert Label used to revert changes in a closed and merged pull request. label Feb 22, 2024
auto-submit bot added a commit that referenced this pull request Feb 22, 2024
Reverts #50751

Initiated by: jonahwilliams

Reason for reverting: breaking flutter tester --enable-impeller workflow

Original PR Author: jonahwilliams

Reviewed By: {matanlurey}

This change reverts the following previous change:
Original Description:
Currently we cache render pass objects to offscreen render targets only. Caching onscreen doesn't work as 1) the render targets are stored on the texture_vk object and 2) the texture_vk object is recreated for each frame (see https://github.com/flutter/engine/blob/main/impeller/renderer/backend/vulkan/surface_vk.cc#L14 ).

To make sure the render pass is cached, move the storage to the texture source.

part of flutter/flutter#141750
@dnfield
Copy link
Contributor

dnfield commented Feb 22, 2024

Process 95900 stopped
* thread #16, name = 'Queue<0x155e06ab0>', stop reason = EXC_BAD_ACCESS (code=1, address=0x7d)
    frame #0: 0x00000001031baef8 flutter_tester`vk::ImageView::clear(VkClearValue const&, unsigned int, VkRect2D const&) [inlined] vk::Image::getImageType(this=0x0000000000000061) const at VkImage.hpp:84:44 [opt]
   81  		uint32_t getLastLayerIndex(const VkImageSubresourceRange &subresourceRange) const;
   82  		uint32_t getLastMipLevel(const VkImageSubresourceRange &subresourceRange) const;
   83  	
-> 84  		VkImageType getImageType() const { return imageType; }
   85  		const Format &getFormat() const { return format; }
   86  		Format getFormat(VkImageAspectFlagBits aspect) const;
   87  		uint32_t getArrayLayers() const { return arrayLayers; }
Target 0: (flutter_tester) stopped.
warning: flutter_tester was compiled with optimization - stepping may behave oddly; variables may not be available.
(lldb) bt
* thread #16, name = 'Queue<0x155e06ab0>', stop reason = EXC_BAD_ACCESS (code=1, address=0x7d)
  * frame #0: 0x00000001031baef8 flutter_tester`vk::ImageView::clear(VkClearValue const&, unsigned int, VkRect2D const&) [inlined] vk::Image::getImageType(this=0x0000000000000061) const at VkImage.hpp:84:44 [opt]
    frame #1: 0x00000001031baef8 flutter_tester`vk::ImageView::clear(this=0x0000600001eb1fe8, clearValue=0x00006000020c8160, aspectMask=4, renderArea=0x0000600001980108) at VkImageView.cpp:187:2 [opt]
    frame #2: 0x000000010319c048 flutter_tester`vk::Framebuffer::executeLoadOp(this=0x0000600003484578, renderPass=0x0000600001eb2e88, clearValueCount=<unavailable>, pClearValues=<unavailable>, renderArea=0x0000600001980108) at VkFramebuffer.cpp:126:19 [opt]
    frame #3: 0x00000001031a736c flutter_tester`vk::CommandBuffer::submit(this=0x00006000019800b8, executionState=0x000000017062e800) at VkCommandBuffer.cpp:2330:12 [opt]
    frame #4: 0x00000001031ade98 flutter_tester`vk::Queue::submitQueue(this=0x0000000155e06ab0, task=<unavailable>) at VkQueue.cpp:104:42 [opt]
    frame #5: 0x00000001031ad67c flutter_tester`vk::Queue::taskLoop(this=0x0000000155e06ab0, scheduler=<unavailable>) at VkQueue.cpp:156:4 [opt]
    frame #6: 0x00000001031aeb48 flutter_tester`void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, void (vk::Queue::*)(marl::Scheduler*), vk::Queue*, marl::Scheduler*>>(void*) [inlined] decltype(*std::declval<vk::Queue*>().*std::declval<void (vk::Queue::*)(marl::Scheduler*)>()(std::declval<marl::Scheduler*>())) std::_fl::__invoke[abi:v15000]<void (vk::Queue::*)(marl::Scheduler*), vk::Queue*, marl::Scheduler*, void>(__f=0x00006000034b0698, __a0=0x00006000034b06a8, __args=0x00006000034b06b0) at invoke.h:368:23 [opt]
    frame #7: 0x00000001031aeb28 flutter_tester`void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, void (vk::Queue::*)(marl::Scheduler*), vk::Queue*, marl::Scheduler*>>(void*) [inlined] void std::_fl::__thread_execute[abi:v15000]<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, void (vk::Queue::*)(marl::Scheduler*), vk::Queue*, marl::Scheduler*, 2ul, 3ul>(__t=0x00006000034b0690, (null)=<unavailable>) at thread:284:5 [opt]
    frame #8: 0x00000001031aeb28 flutter_tester`void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, void (vk::Queue::*)(marl::Scheduler*), vk::Queue*, marl::Scheduler*>>(__vp=0x00006000034b0690) at thread:295:5 [opt]
    frame #9: 0x00000001819be034 libsystem_pthread.dylib`_pthread_start + 136

@dnfield
Copy link
Contributor

dnfield commented Feb 22, 2024

This particular test is using the "live" binding. Something's not keeping the vk objects alive long enough I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants