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

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Oct 29, 2024

issue: flutter/flutter#157538

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke
Copy link
Member Author

@jonahwilliams I started sketching out what it could look like to have raw pointers in DeviceBuffer. I think I can make this work, especially if we can move DeviceBuffer to unique_ptr in a later PR. The gist is that DeviceBuffer can have ownership or not depending if it's coming from the HostBuffer's DeviceBuffers or not.

@gaaclarke gaaclarke force-pushed the buffer-view-raw-ptrs branch from a7d4e74 to 4dff377 Compare October 29, 2024 23:47
@jonahwilliams
Copy link
Contributor

That sounds like a good approach. off the top of my head, there is a DeviceBuffer::AsBufferView API that is problematic without the buffer view having ownership, but we can fix that by requiring an explicit track too.

}

if (!command_buffer_->Track(index_buffer)) {
std::shared_ptr<const DeviceBuffer> index_buffer =
Copy link
Contributor

Choose a reason for hiding this comment

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

So we only track it if the buffer_view owns the device buffer reference? Oh and then we set the buffer view to use a raw_ptr as we know its tracked already...

Incredibly clever!

@gaaclarke gaaclarke force-pushed the buffer-view-raw-ptrs branch from 4dff377 to fd6eb0f Compare October 30, 2024 16:40
@gaaclarke gaaclarke changed the title Buffer view raw ptrs Allow BufferViews to have non-owning references to DeviceBuffers Oct 30, 2024
@gaaclarke
Copy link
Member Author

The reason this doesn't work as-is right now is that if we stop tracking DeviceBuffers from the HostBuffer; when ~HostBuffer() is called it will schedule those DeviceBuffers in the HostBuffer to be deleted which will result in deleting the DeviceBuffer while the command buffer is referencing it. We'd need to create some sort of mechanism where ~HostBuffer waits for all frames to render. Or maybe in ~HostBuffer passing all the DeviceBuffers to the TrackedObjectsVK.

@gaaclarke gaaclarke force-pushed the buffer-view-raw-ptrs branch from 81c958b to d61d464 Compare October 30, 2024 23:53
@gaaclarke gaaclarke force-pushed the buffer-view-raw-ptrs branch from d61d464 to d5c4736 Compare October 31, 2024 01:00
@gaaclarke gaaclarke force-pushed the buffer-view-raw-ptrs branch from 9228115 to ab09d34 Compare October 31, 2024 15:58
@gaaclarke gaaclarke marked this pull request as ready for review October 31, 2024 17:59
Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 31, 2024
@gaaclarke gaaclarke merged commit 0b5aed1 into flutter:main Oct 31, 2024
30 checks passed
@jonahwilliams
Copy link
Contributor

reason for revert: merge issue.

@jonahwilliams jonahwilliams added the revert Label used to revert changes in a closed and merged pull request. label Oct 31, 2024
auto-submit bot pushed a commit that referenced this pull request Oct 31, 2024
@auto-submit auto-submit bot removed the revert Label used to revert changes in a closed and merged pull request. label Oct 31, 2024
auto-submit bot added a commit that referenced this pull request Oct 31, 2024
…fers (#56224)" (#56285)

Reverts: #56224
Initiated by: jonahwilliams
Reason for reverting: merge issue.
Original PR Author: gaaclarke

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
issue: flutter/flutter#157538

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Oct 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 1, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 1, 2024
…157972)

flutter/engine@bb77cf8...cd46383

2024-10-31 [email protected] reland: Allow BufferViews to have non-owning references to DeviceBuffers (flutter/engine#56286)
2024-10-31 [email protected] Roll Skia from 9168ad248c69 to a5e3b3556739 (1 revision) (flutter/engine#56283)
2024-10-31 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Allow BufferViews to have non-owning references to DeviceBuffers (#56224)" (flutter/engine#56285)
2024-10-31 [email protected] macOS: migrate third_party/accessibility to ARC (flutter/engine#56281)
2024-10-31 [email protected] Allow BufferViews to have non-owning references to DeviceBuffers (flutter/engine#56224)
2024-10-31 [email protected] [Impeller] Do not use fast mask blur for stroked shapes (flutter/engine#56247)
2024-10-31 [email protected] [Impeller] make desktop GL render. (flutter/engine#56274)
2024-10-31 [email protected] Vastly rewrite and expand `et/README.md` (flutter/engine#56250)
2024-10-31 [email protected] Roll Fuchsia Linux SDK from dDWvmfG4AxSEs0BQA... to MjcuejuzYvYGobbFM... (flutter/engine#56280)
2024-10-31 [email protected] Roll Dart SDK from f3e3dc44b1dc to bd93105c4fb6 (2 revisions) (flutter/engine#56278)
2024-10-31 [email protected] Embedder: migrate Metal surfaces to ARC (flutter/engine#56279)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from dDWvmfG4AxSE to MjcuejuzYvYG

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] 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
nick9822 pushed a commit to nick9822/flutter that referenced this pull request Dec 18, 2024
…tter/engine#56224)

issue: flutter#157538

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
nick9822 pushed a commit to nick9822/flutter that referenced this pull request Dec 18, 2024
…fers (flutter#56224)" (flutter/engine#56285)

Reverts: flutter/engine#56224
Initiated by: jonahwilliams
Reason for reverting: merge issue.
Original PR Author: gaaclarke

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
issue: flutter#157538

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

2 participants