-
Notifications
You must be signed in to change notification settings - Fork 6k
Add format
field to EGL surface backing store
#54499
Add format
field to EGL surface backing store
#54499
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). 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. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
@vially Thanks for opening this patch! I think it would be better if we followed the other backing stores' pattern and instead introduced a FYI, we just recently landed #54329 which moves away from |
29fe6de
to
281241b
Compare
format
field EGL surface backing store
@loic-sharma Thanks for the review. I have updated the implementation with your suggestion by adding a Does it make sense to also add some logic to set the default format to Or maybe backwards compatibility is not a real concern in this case, since the EGL surface backing store (#43683) was only merged a few days ago? /cc @ardera |
format
field EGL surface backing storeformat
field to EGL surface backing store
Oof thanks for the fix, I wasn't aware of this. IMO I think it's also a good idea to document this limitation in the embedder API, e.g.: typedef struct {
// . . .
/// The surface format (example GL_RGBA8).
///
/// Due to limitations in Skia, this needs to be GL_BGRA8_EXT when either:
/// - GL_EXT_texture_format_BGRA8888 is present or
/// - GL_APPLE_texture_format_BGRA8888 is present and GL version is larger than 3.0
/// otherwise it should be GL_RGBA8.
/// (or whatever the correct logic is)
uint32_t format;
} FlutterOpenGLSurface; Maybe also with a TODO link for an issue. It's a bit ugly to write that there, but it's even more annoying to run into the assert, and having to dig through engine / other embedder sources to find the fix. I'd say backwards compatibility is not a concern yet, it hasn't even reached stable yet. We also ignored backwards compatibility for #38847 (and that was when the software pixel formats were already in stable) (though that was API not ABI) EDIT: Ah, with |
Agreed. The current approach looks good to me, but @chinmaygarde has the final word here :)
Agreed documenting allowed formats this is a good idea, but I wouldn't prescribe the logic to choose the format as that's likely highly dependent on the embedder and its platform. Perhaps a comment like: typedef struct {
...
/// The surface format.
///
/// Allowed values:
/// - GL_RGBA8
/// - GL_BGRA8_EXT
uint32_t format;
} FlutterOpenGLSurface; |
f602b6c
to
76d1b84
Compare
Thank you both. I have updated the field comment with your suggestions to list the allowed values. I've also updated the test producer class to set to format in order to make the tests pass. |
shell/platform/embedder/tests/embedder_test_backingstore_producer.cc
Outdated
Show resolved
Hide resolved
Are there any tests we could add for this? |
0a89dfa
to
58b6fcc
Compare
I have added a new test for validating that passing an invalid format will result in an invalid Skia surface. The "happy" path of valid format resulting in valid Skia surface is already covered by the original tests from #43683, so I think the common code-paths are now covered. It would be nice if the tests covered some of the edge-cases too (e.g.: trying to use |
58b6fcc
to
77ef0e1
Compare
@loic-sharma - friendly ping |
I've tested this patch on Linux/X11 and now GL finally works! Before only GLES worked. |
@loic-sharma Can you tell us how to proceed here? |
Apologies for the delay, this fell off my radar. |
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.
These changes look good to me (modulo this minor comment).
I'm not an expert in this area, please get an approval from @chinmaygarde before merging this.
Replace hard-coded `BGRA8` value with `FlutterOpenGLSurface.format` field
77ef0e1
to
6cad98e
Compare
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
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.
Re-LGTM with updates - thanks for the wonderful contribution!
auto label is removed for flutter/engine/54499, due to - The status or check suite Linux linux_arm_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…155811) flutter/engine@e57b440...7c603de 2024-09-27 skia-flutter-autoroll@skia.org Roll Skia from 9ebb7c3640a1 to e77818421e91 (4 revisions) (flutter/engine#55479) 2024-09-27 jonahwilliams@google.com [ci] make opengles impeller scenario app non-bringup (flutter/engine#55474) 2024-09-27 jonahwilliams@google.com [Impeller] dont use blend shader for simple drawAtlas calls. (flutter/engine#55420) 2024-09-27 valentin.haloiu@gmail.com Add `format` field to EGL surface backing store (flutter/engine#54499) 2024-09-26 jonahwilliams@google.com [Impeller] avoid reading font while parsing sktextblob. (flutter/engine#55442) 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 bdero@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://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
Trying to use the
GL_BGRA8_EXT
format for the EGL surface backing store on desktop OpenGL platforms would fail at:engine/shell/platform/embedder/embedder.cc
Line 869 in bde314b
This seems to be a known issue and both the Linux and Windows embedders have some logic to pick a different format depending on the OpenGL context information:
engine/shell/platform/windows/compositor_opengl.cc
Lines 23 to 34 in 088dcfa
engine/shell/platform/linux/fl_framebuffer.cc
Lines 81 to 104 in 088dcfa
This pull-request gets rid of the hard-coded
GL_BGRA8_EXT
format and makes it configurable by adding aformat
field to theFlutterOpenGLSurface
struct.Disclaimer: This has only been tested on desktop Linux (Wayland) using the
GR_GL_RGBA8
format which seemed to work as expected.This change is related to the recently introduced EGL surface backing store: flutter/flutter#58363
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.