Skip to content

REGRESSION(295899@main): Video as an image source does not display its frames #47221

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

Conversation

shallawa
Copy link
Contributor

@shallawa shallawa commented Jun 26, 2025

f5b453a

REGRESSION(295899@main): Video as an image source does not display its frames
https://bugs.webkit.org/show_bug.cgi?id=295015
rdar://154358072

Reviewed by Simon Fraser.

Three bugs are the cause of this regression:

1. Headroom constructor is not explicit. So any numerical value including `bool`
   can construct a Headroom structure.

2. A new argument to ShareableBitmapConfiguration of type Headroom was added in
   295899@main. RemoteImageDecoderAVFProxy::createFrameImageAtIndex() was not
   modified to include a headroom when calling ShareableBitmap::create(). Instead
   a `bool` false was passed instead. This `bool` constructs a Headroom of type
   Headroom::FromImage which is very special value and should not be passed from
   WebProcess to GPUProcess or vice versa.

3. In 295899@main ShareableBitmap::createCGImage() was changed such that it calls
   CGImageCreateWithContentHeadroom() if m_configuration.headroom() != Headroom::None.
   This code is now hit in the video scenario because RemoteImageDecoderAVFProxy
   ::createFrameImageAtIndex() passes the wrong Headroom.

The fix is to:

1. Make the constructor of Headroom explicit so we do not hit this bug again.

2. Make RemoteImageDecoderAVFProxy::createFrameImageAtIndex() pass the headroom
   of the decoded image to ShareableBitmap::create().

3. Assert in ShareableBitmap and ShareableBitmapConfiguration that the passed
   headroom has a valid Headroom value.

* LayoutTests/TestExpectations:
* LayoutTests/fast/images/resources/red-green-blue.mov: Added.
* LayoutTests/fast/images/video-as-image-expected.html: Added.
* LayoutTests/fast/images/video-as-image.html: Added.
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac/TestExpectations:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateDisplayEDRHeadroom):
* Source/WebCore/platform/graphics/ImageTypes.h:
(WebCore::Headroom::Headroom):
* Source/WebCore/platform/graphics/ShareableBitmap.cpp:
(WebCore::ShareableBitmapConfiguration::ShareableBitmapConfiguration):
(WebCore::ShareableBitmap::create):
(WebCore::ShareableBitmap::ShareableBitmap):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::drawNativeImageInternal):
* Source/WebCore/platform/graphics/cg/NativeImageCG.cpp:
(WebCore::PlatformImageNativeImageBackend::headroom const):
* Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm:
(WebCore::ShareableBitmap::createCGImage const):
* Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex):
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::drawNativeImageInternal):

Canonical link: https://commits.webkit.org/296680@main

f751b47

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision 🧪 mac-AS-debug-wk2 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@shallawa shallawa requested a review from cdumez as a code owner June 26, 2025 04:39
@shallawa shallawa self-assigned this Jun 26, 2025
@shallawa shallawa added the Images For bugs in image handling. label Jun 26, 2025
@shallawa shallawa force-pushed the eng/REGRESSION-295899-main-Video-as-an-image-source-does-not-display-its-frames branch from 65cc5ee to 41e20ff Compare June 26, 2025 04:52
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 26, 2025
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Jun 26, 2025
@shallawa shallawa force-pushed the eng/REGRESSION-295899-main-Video-as-an-image-source-does-not-display-its-frames branch from 41e20ff to fdf49a6 Compare June 26, 2025 06:58
@smfr
Copy link
Contributor

smfr commented Jun 26, 2025

  1. A new argument to ShareableBitmapConfiguration of type Headroom was added in
    295899@main. RemoteImageDecoderAVFProxy::createFrameImageAtIndex() was not
    modify to include a headroom when calling ShareableBitmap::create(). Instead

modified

@shallawa shallawa force-pushed the eng/REGRESSION-295899-main-Video-as-an-image-source-does-not-display-its-frames branch from fdf49a6 to f751b47 Compare June 26, 2025 18:28
@shallawa shallawa added the merge-queue Applied to send a pull request to merge-queue label Jun 26, 2025
…s frames

https://bugs.webkit.org/show_bug.cgi?id=295015
rdar://154358072

Reviewed by Simon Fraser.

Three bugs are the cause of this regression:

1. Headroom constructor is not explicit. So any numerical value including `bool`
   can construct a Headroom structure.

2. A new argument to ShareableBitmapConfiguration of type Headroom was added in
   295899@main. RemoteImageDecoderAVFProxy::createFrameImageAtIndex() was not
   modified to include a headroom when calling ShareableBitmap::create(). Instead
   a `bool` false was passed instead. This `bool` constructs a Headroom of type
   Headroom::FromImage which is very special value and should not be passed from
   WebProcess to GPUProcess or vice versa.

3. In 295899@main ShareableBitmap::createCGImage() was changed such that it calls
   CGImageCreateWithContentHeadroom() if m_configuration.headroom() != Headroom::None.
   This code is now hit in the video scenario because RemoteImageDecoderAVFProxy
   ::createFrameImageAtIndex() passes the wrong Headroom.

The fix is to:

1. Make the constructor of Headroom explicit so we do not hit this bug again.

2. Make RemoteImageDecoderAVFProxy::createFrameImageAtIndex() pass the headroom
   of the decoded image to ShareableBitmap::create().

3. Assert in ShareableBitmap and ShareableBitmapConfiguration that the passed
   headroom has a valid Headroom value.

* LayoutTests/TestExpectations:
* LayoutTests/fast/images/resources/red-green-blue.mov: Added.
* LayoutTests/fast/images/video-as-image-expected.html: Added.
* LayoutTests/fast/images/video-as-image.html: Added.
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac/TestExpectations:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateDisplayEDRHeadroom):
* Source/WebCore/platform/graphics/ImageTypes.h:
(WebCore::Headroom::Headroom):
* Source/WebCore/platform/graphics/ShareableBitmap.cpp:
(WebCore::ShareableBitmapConfiguration::ShareableBitmapConfiguration):
(WebCore::ShareableBitmap::create):
(WebCore::ShareableBitmap::ShareableBitmap):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::drawNativeImageInternal):
* Source/WebCore/platform/graphics/cg/NativeImageCG.cpp:
(WebCore::PlatformImageNativeImageBackend::headroom const):
* Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm:
(WebCore::ShareableBitmap::createCGImage const):
* Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex):
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::drawNativeImageInternal):

Canonical link: https://commits.webkit.org/296680@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/REGRESSION-295899-main-Video-as-an-image-source-does-not-display-its-frames branch from f751b47 to f5b453a Compare June 26, 2025 20:34
@webkit-commit-queue
Copy link
Collaborator

Committed 296680@main (f5b453a): https://commits.webkit.org/296680@main

Reviewed commits have been landed. Closing PR #47221 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit f5b453a into WebKit:main Jun 26, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Images For bugs in image handling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants