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] Return image decoder error messages to the Dart API #42175

Merged
merged 1 commit into from
May 22, 2023

Conversation

jason-simmons
Copy link
Member

@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 (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

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

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

Some suggested improvements but LGTM with or without them

@@ -162,8 +163,9 @@ std::optional<DecompressResult> ImageDecoderImpeller::DecompressTexture(
const auto pixel_format =
impeller::skia_conversions::ToPixelFormat(image_info.colorType());
if (!pixel_format.has_value()) {
FML_DLOG(ERROR) << "Codec pixel format not supported by Impeller.";
return std::nullopt;
std::string decode_error("Codec pixel format not supported by Impeller.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we include anything here about what the color type was listed as according to Skia?

Copy link
Member

Choose a reason for hiding this comment

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

I'd get rid of the Impeller bit. There aren't pixel formats that are unique to either Skia or Impeller that are supported by Flutter.

ImageDescriptor* descriptor,
SkISize target_size,
impeller::ISize max_texture_size,
bool supports_wide_gamut,
const std::shared_ptr<impeller::Allocator>& allocator) {
TRACE_EVENT0("impeller", __FUNCTION__);
if (!descriptor) {
FML_DLOG(ERROR) << "Invalid descriptor.";
return std::nullopt;
std::string decode_error("Invalid descriptor");
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 a "this should never happen and is a bug in the engine code." I'm not sure if we need to say that here or not.

const std::shared_ptr<impeller::Context>& context,
const std::shared_ptr<impeller::DeviceBuffer>& buffer,
const SkImageInfo& image_info) {
TRACE_EVENT0("impeller", __FUNCTION__);
if (!context || !buffer) {
return nullptr;
return std::make_pair(nullptr, "No Impeller context or buffer available");
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be helpful to split these into separate messages - for example if there is no context there are differnet causes then if the buffer is invalid.

}
const auto pixel_format =
impeller::skia_conversions::ToPixelFormat(image_info.colorType());
if (!pixel_format) {
FML_DLOG(ERROR) << "Pixel format unsupported by Impeller.";
return nullptr;
std::string decode_error("Pixel format unsupported by Impeller.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above, if we can include what the unsupported color type is we should.

const std::shared_ptr<impeller::Context>& context,
std::shared_ptr<SkBitmap> bitmap,
bool create_mips) {
TRACE_EVENT0("impeller", __FUNCTION__);
if (!context || !bitmap) {
return nullptr;
return std::make_pair(nullptr, "No Impeller context or buffer available");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above about splitting context/buffer message.

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

Some suggested improvements but LGTM with or without them

@@ -162,8 +163,9 @@ std::optional<DecompressResult> ImageDecoderImpeller::DecompressTexture(
const auto pixel_format =
impeller::skia_conversions::ToPixelFormat(image_info.colorType());
if (!pixel_format.has_value()) {
FML_DLOG(ERROR) << "Codec pixel format not supported by Impeller.";
return std::nullopt;
std::string decode_error("Codec pixel format not supported by Impeller.");
Copy link
Member

Choose a reason for hiding this comment

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

I'd get rid of the Impeller bit. There aren't pixel formats that are unique to either Skia or Impeller that are supported by Flutter.

@jason-simmons
Copy link
Member Author

Updated the PR with the requested changes

@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label May 22, 2023
@auto-submit auto-submit bot merged commit 1095102 into flutter:main May 22, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 22, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 23, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 23, 2023
…127364)

flutter/engine@a342a91...2a325ee

2023-05-22 skia-flutter-autoroll@skia.org Roll Dart SDK from b3e1eeda4918 to 1ca8f8368ecc (5 revisions) (flutter/engine#42224)
2023-05-22 jason-simmons@users.noreply.github.com [Impeller] Return image decoder error messages to the Dart API (flutter/engine#42175)
2023-05-22 5236035+fzyzcjy@users.noreply.github.com Again a two-word super tiny typo (flutter/engine#42181)
2023-05-22 ychris@google.com Reland "[ios_platform_view] only recycle maskView when the view is applying mutators #41573" (flutter/engine#42115)
2023-05-22 jason-simmons@users.noreply.github.com [Impeller] Use untransformed text bounds to calculate the size of ColorSourceTextContents (flutter/engine#42142)
2023-05-22 jonahwilliams@google.com [Impeller] Add UV compute shader. (flutter/engine#42192)
2023-05-22 jonahwilliams@google.com [Impeller] remove final cmd buffer waitUntilScheduled on physical iOS (flutter/engine#42160)

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 rmistry@google.com,zra@google.com 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 23, 2023
zanderso pushed a commit to flutter/flutter that referenced this pull request May 23, 2023
…sions) (#127369)

Manual roll requested by zra@google.com

flutter/engine@a342a91...2586cbe

2023-05-23 zanderso@users.noreply.github.com Revert "[ios_platform_view]
only recycle maskView when the view is applying mutators #41573"
(flutter/engine#42231)
2023-05-23 skia-flutter-autoroll@skia.org Roll Skia from ac87929b3d2e to
6a57876d0e44 (2 revisions) (flutter/engine#42230)
2023-05-23 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from
QAwORJOkyNl4J3x4Y... to DzmjiSg6XC0JUfbKP... (flutter/engine#42227)
2023-05-23 skia-flutter-autoroll@skia.org Manual roll Dart SDK from
b3e1eeda4918 to 1ca8f8368ecc (5 revisions) (flutter/engine#42229)
2023-05-23 skia-flutter-autoroll@skia.org Roll Skia from d448fe07ea46 to
ac87929b3d2e (8 revisions) (flutter/engine#42226)
2023-05-23 dnfield@google.com Make FML_LOG safe from static
initialization (flutter/engine#42219)
2023-05-23 uysalere@gmail.com [fuchsia] Bind ChildViewWatcher on
platform thread (flutter/engine#42222)
2023-05-22 skia-flutter-autoroll@skia.org Roll Dart SDK from
b3e1eeda4918 to 1ca8f8368ecc (5 revisions) (flutter/engine#42224)
2023-05-22 jason-simmons@users.noreply.github.com [Impeller] Return
image decoder error messages to the Dart API (flutter/engine#42175)
2023-05-22 5236035+fzyzcjy@users.noreply.github.com Again a two-word
super tiny typo (flutter/engine#42181)
2023-05-22 ychris@google.com Reland "[ios_platform_view] only recycle
maskView when the view is applying mutators #41573"
(flutter/engine#42115)
2023-05-22 jason-simmons@users.noreply.github.com [Impeller] Use
untransformed text bounds to calculate the size of
ColorSourceTextContents (flutter/engine#42142)
2023-05-22 jonahwilliams@google.com [Impeller] Add UV compute shader.
(flutter/engine#42192)
2023-05-22 jonahwilliams@google.com [Impeller] remove final cmd buffer
waitUntilScheduled on physical iOS (flutter/engine#42160)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from QAwORJOkyNl4 to DzmjiSg6XC0J

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 rmistry@google.com,zra@google.com 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
CaseyHillers pushed a commit to CaseyHillers/flutter that referenced this pull request May 24, 2023
…lutter#127364)

flutter/engine@a342a91...2a325ee

2023-05-22 skia-flutter-autoroll@skia.org Roll Dart SDK from b3e1eeda4918 to 1ca8f8368ecc (5 revisions) (flutter/engine#42224)
2023-05-22 jason-simmons@users.noreply.github.com [Impeller] Return image decoder error messages to the Dart API (flutter/engine#42175)
2023-05-22 5236035+fzyzcjy@users.noreply.github.com Again a two-word super tiny typo (flutter/engine#42181)
2023-05-22 ychris@google.com Reland "[ios_platform_view] only recycle maskView when the view is applying mutators flutter#41573" (flutter/engine#42115)
2023-05-22 jason-simmons@users.noreply.github.com [Impeller] Use untransformed text bounds to calculate the size of ColorSourceTextContents (flutter/engine#42142)
2023-05-22 jonahwilliams@google.com [Impeller] Add UV compute shader. (flutter/engine#42192)
2023-05-22 jonahwilliams@google.com [Impeller] remove final cmd buffer waitUntilScheduled on physical iOS (flutter/engine#42160)

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 rmistry@google.com,zra@google.com 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
CaseyHillers pushed a commit to CaseyHillers/flutter that referenced this pull request May 24, 2023
…sions) (flutter#127369)

Manual roll requested by zra@google.com

flutter/engine@a342a91...2586cbe

2023-05-23 zanderso@users.noreply.github.com Revert "[ios_platform_view]
only recycle maskView when the view is applying mutators flutter#41573"
(flutter/engine#42231)
2023-05-23 skia-flutter-autoroll@skia.org Roll Skia from ac87929b3d2e to
6a57876d0e44 (2 revisions) (flutter/engine#42230)
2023-05-23 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from
QAwORJOkyNl4J3x4Y... to DzmjiSg6XC0JUfbKP... (flutter/engine#42227)
2023-05-23 skia-flutter-autoroll@skia.org Manual roll Dart SDK from
b3e1eeda4918 to 1ca8f8368ecc (5 revisions) (flutter/engine#42229)
2023-05-23 skia-flutter-autoroll@skia.org Roll Skia from d448fe07ea46 to
ac87929b3d2e (8 revisions) (flutter/engine#42226)
2023-05-23 dnfield@google.com Make FML_LOG safe from static
initialization (flutter/engine#42219)
2023-05-23 uysalere@gmail.com [fuchsia] Bind ChildViewWatcher on
platform thread (flutter/engine#42222)
2023-05-22 skia-flutter-autoroll@skia.org Roll Dart SDK from
b3e1eeda4918 to 1ca8f8368ecc (5 revisions) (flutter/engine#42224)
2023-05-22 jason-simmons@users.noreply.github.com [Impeller] Return
image decoder error messages to the Dart API (flutter/engine#42175)
2023-05-22 5236035+fzyzcjy@users.noreply.github.com Again a two-word
super tiny typo (flutter/engine#42181)
2023-05-22 ychris@google.com Reland "[ios_platform_view] only recycle
maskView when the view is applying mutators flutter#41573"
(flutter/engine#42115)
2023-05-22 jason-simmons@users.noreply.github.com [Impeller] Use
untransformed text bounds to calculate the size of
ColorSourceTextContents (flutter/engine#42142)
2023-05-22 jonahwilliams@google.com [Impeller] Add UV compute shader.
(flutter/engine#42192)
2023-05-22 jonahwilliams@google.com [Impeller] remove final cmd buffer
waitUntilScheduled on physical iOS (flutter/engine#42160)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from QAwORJOkyNl4 to DzmjiSg6XC0J

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 rmistry@google.com,zra@google.com 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
auto-submit bot pushed a commit that referenced this pull request May 29, 2023
Issue: flutter/flutter#126878

Picks in #42349 and #42175

The reason for the second is that the first creates many more conflicts without it, and resolving them was a lot easier. The second PR is also very low risk and improves error messaging.
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 needs tests
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Impeller] Bubble feedback about Image decoder errors up the Dart layer.
3 participants