Skip to content

[GStreamer][GL] Enable DMABuf sink #10588

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

Merged
merged 1 commit into from
Feb 27, 2023

Conversation

philn
Copy link
Member

@philn philn commented Feb 23, 2023

e962336

[GStreamer][GL] Enable DMABuf sink
https://bugs.webkit.org/show_bug.cgi?id=252826

Reviewed by Žan Doberšek and Xabier Rodriguez-Calvar.

Unconditionally enable the DMABuf sink when running with GStreamer 1.22 and newer. The
WEBKIT_GST_DMABUF_SINK_DISABLED environment variable can be set to fallback to the GL sink.

* Source/WebCore/platform/graphics/gstreamer/DMABufVideoSinkGStreamer.cpp:
(webKitDMABufVideoSinkGetProperty):
(webKitDMABufVideoSinkIsEnabled):
(webKitDMABufVideoSinkProbePlatform):
* Tools/Scripts/webkitpy/port/glib.py:
(GLibPort.setup_environ_for_server):

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

bd1b6f2

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🛠 gtk
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 gtk-wk2
✅ 🧪 webkitpy ✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🧪 api-gtk
✅ 🛠 tv ✅ 🧪 mac-wk2
✅ 🛠 tv-sim ✅ 🧪 mac-AS-debug-wk2
✅ 🛠 watch ✅ 🧪 mac-wk2-stress
✅ 🛠 🧪 merge ✅ 🛠 watch-sim

@philn philn self-assigned this Feb 23, 2023
@philn philn added the Platform Portability improvements and other general platform improvements not driven directly by site bugs. label Feb 23, 2023
@philn philn requested review from magomez and calvaris February 23, 2023 16:05
if (webKitDMABufVideoSinkIsEnabled() && webKitDMABufVideoSinkProbePlatform())
if (webKitDMABufVideoSinkProbePlatform())
Copy link
Contributor

Choose a reason for hiding this comment

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

These two conditions should match conditions in createVideoSinkDMABuf(). Otherwise things can get weird with using TextureMapperPlatformLayerProxyDMABuf along with a GL sink.

So I would recommend keeping webKitDMABufVideoSinkIsEnabled(), and using WEBKIT_GST_DISABLE_DMABUF_SINK env to disable it. That way behavior between DMABuf sink and GL sink can be examined by selectively disabling one or the other, as long as they coexist.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense! I'll update the PR, thanks for the review.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we can make this work with GST_PLUGIN_FEATURE_RANK=webkitdmabufsink:0 too. I can try that, I've been wondering lately about avoid new env vars when we can...

Copy link
Member Author

Choose a reason for hiding this comment

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

GST_PLUGIN_FEATURE_RANK works only during gst_init_check() so for our custom elements registered afterwards we'd need to re-parse the env var... Not sure it's worth.

Copy link
Contributor

@calvaris calvaris left a comment

Choose a reason for hiding this comment

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

Other than what @zdobersek said, I think we would be good to go.

@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for 681cc1e. Live statuses available at the PR page, #10588

@philn philn marked this pull request as draft February 24, 2023 17:25
@philn
Copy link
Member Author

philn commented Feb 24, 2023

The test bots doesn't like this PR at all. Somehow the dmabuf sink is misbehaving there, is that supposed to work in XvFB and similar antique setups?

@clopez
Copy link
Contributor

clopez commented Feb 24, 2023

Check https://ews-build.webkit.org/#/builders/86/builds/389
The WPE EWS for layout tests (still on testing) have detected more than 500 crashes caused by this patch. Check here the crash logs: https://ews-build.s3-us-west-2.amazonaws.com/WPE-WK2-Tests-EWS/5a201291-389/results.html

And the GTK EWS for layout tests seems to be detecting something similar.
https://ews-build.webkit.org/#/builders/35/builds/43165

@philn
Copy link
Member Author

philn commented Feb 24, 2023

Yeah I noticed the previous version of the patch was already flagged... Crash is in gbm_bo_create()... I guess those bots don't have whatever GBM requires, like a GPU?

@clopez
Copy link
Contributor

clopez commented Feb 24, 2023

Yeah I noticed the previous version of the patch was already flagged... Crash is in gbm_bo_create()... I guess those bots don't have whatever GBM requires, like a GPU?

That is right: the bots don't have a GPU. There are no /dev/dri/* devices on them.

@philn
Copy link
Member Author

philn commented Feb 24, 2023

@zdobersek wdyt about making webKitDMABufVideoSinkProbePlatform() check /dev/dri/whatever char devices? Would it make sense?

@clopez
Copy link
Contributor

clopez commented Feb 24, 2023

@zdobersek wdyt about making webKitDMABufVideoSinkProbePlatform() check /dev/dri/whatever char devices? Would it make sense?

Sounds a bit hackish. Maybe an idea is checking that we pass a valid device when calling gbm_bo_create() at GBMBufferSwapchain.cpp ?

I guess (not checked) the call to drmGetDevices2() at GBMDevice.cpp is returning zero devices so device.device() returns nullptr causing the crash when gbm_bo_create() is called with nullptr as first argument

@philn
Copy link
Member Author

philn commented Feb 25, 2023

We want to fallback to the GL sink when dmabuf sink is not usable, so doing the check in GBMBufferSwapchain seems a bit late, no?

@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for bd1b6f2. Live statuses available at the PR page, #10588

@clopez
Copy link
Contributor

clopez commented Feb 25, 2023

bd1b6f2 worked 🎉 -> https://ews-build.webkit.org/#/builders/86/builds/590
Great solution!

@philn philn requested a review from zdobersek February 25, 2023 12:40
@philn philn marked this pull request as ready for review February 25, 2023 12:40
@philn philn added the merge-queue Applied to send a pull request to merge-queue label Feb 27, 2023
https://bugs.webkit.org/show_bug.cgi?id=252826

Reviewed by Žan Doberšek and Xabier Rodriguez-Calvar.

Unconditionally enable the DMABuf sink when running with GStreamer 1.22 and newer. The
WEBKIT_GST_DMABUF_SINK_DISABLED environment variable can be set to fallback to the GL sink.

* Source/WebCore/platform/graphics/gstreamer/DMABufVideoSinkGStreamer.cpp:
(webKitDMABufVideoSinkGetProperty):
(webKitDMABufVideoSinkIsEnabled):
(webKitDMABufVideoSinkProbePlatform):
* Tools/Scripts/webkitpy/port/glib.py:
(GLibPort.setup_environ_for_server):

Canonical link: https://commits.webkit.org/260881@main
@webkit-commit-queue
Copy link
Collaborator

Committed 260881@main (e962336): https://commits.webkit.org/260881@main

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

@webkit-early-warning-system webkit-early-warning-system merged commit e962336 into WebKit:main Feb 27, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Feb 27, 2023
@philn philn deleted the eng/252826 branch February 27, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform Portability improvements and other general platform improvements not driven directly by site bugs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants