Skip to content

Conversation

@spenap
Copy link
Contributor

@spenap spenap commented Sep 25, 2025

a9128cb

[GTK][WPE][OpenXR] Allow running API tests without DMA buf support
https://bugs.webkit.org/show_bug.cgi?id=299525

Reviewed by Carlos Garcia Campos and Adrian Perez de Castro.

When an OpenXR coordinator is initializing, it requires the
MESA_image_dma_buf_export extension. However, when running tests
headless, like what we do in most bots, that extension is not available.

This change adds an internal web preference,
OpenXRDMABufRelaxedForTesting, (defaulting to false and only available
when building on developer mode) that lets the OpenXR coordinator accept
displays without that extension.

This is enough to run API tests with a headless environment and a null
compositor. Validating this change on the bots exposed a few additional
things: the tests can now run regardless of the value of
LIBGL_ALWAYS_SOFTWARE, and they need XR_RUNTIME_JSON to be defined in
order to find the runtime details.

Test: Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebXR.cpp
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: the new
  internal preference allowing to relax the extension check.
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp:
(WebKit::OpenXRCoordinator::getPrimaryDeviceInfo): Use the page proxy to
query the preferences, and pass it into initializeDevice.
(WebKit::OpenXRCoordinator::createGLDisplay const): Pass and use an
"isTesting" boolean.
(WebKit::OpenXRCoordinator::initializeDevice): Pass an isTesting
boolean.
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h:
* Tools/Scripts/webkitpy/port/monadodriver.py:
(MonadoDriver._get_runtime_path):
(MonadoDriver._setup_environ_for_test):
* Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebXR.cpp:
(findFeature): helper function to get the web preference.
(relaxDMABufRequirement): helper function that enables a setting
relaxing the DMA-BUF requirement.
(WebXRTest::WebXRTest): relax the requirement by default in all WebXR
tests.
(testWebKitWebXRLeaveImmersiveModeAndWaitUntilImmersiveModeChanged): use
the new settings before loading the test.
(testWebKitXRPermissionRequest): Ditto.
* Tools/glib/api_test_runner.py:
(TestRunner._run_test_glib):

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

4e95933

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
✅ 🧪 webkitpy ✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 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 ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🧪 jsc-armv7-tests
✅ 🛠 watch
✅ 🛠 watch-sim

@spenap spenap requested review from a team, JonWBedard, cdumez and gsnedders as code owners September 25, 2025 15:22
@spenap spenap self-assigned this Sep 25, 2025
@spenap spenap added the WebXR For bugs in WebXR label Sep 25, 2025
@spenap spenap force-pushed the eng/GTK-WPE-OpenXR-Allow-running-API-tests-without-DMA-buf-support branch from dcd326f to b29f009 Compare September 26, 2025 10:41
@spenap
Copy link
Contributor Author

spenap commented Sep 26, 2025

I am not sure why there are these 3 failures in the WebKitGTK bot:

0 s Found 3 new API test failures: TestWTF:CompletionHandlerDeathTest.MainThreadHandlerOnThreadAssertsDeathTest, WebKitGTK/TestInspector:/webkit/WebKitWebInspector/manual-attach-detach, TestWTF:CompletionHandlerDeathTest.ConstructionThreadHandlerOnThreadAssertsDeathTest (failure)

They are OK when run locally with webkit-container-sdk-bots infrastructure. Maybe it's something only exposed with flatpak?

@spenap
Copy link
Contributor Author

spenap commented Sep 26, 2025

I am not sure why there are these 3 failures in the WebKitGTK bot:

0 s Found 3 new API test failures: TestWTF:CompletionHandlerDeathTest.MainThreadHandlerOnThreadAssertsDeathTest, WebKitGTK/TestInspector:/webkit/WebKitWebInspector/manual-attach-detach, TestWTF:CompletionHandlerDeathTest.ConstructionThreadHandlerOnThreadAssertsDeathTest (failure)

They are OK when run locally with webkit-container-sdk-bots infrastructure. Maybe it's something only exposed with flatpak?

Oh, I should have seen. These are now failing in other PRs: https://ews-build.webkit.org/#/builders/21

@spenap spenap force-pushed the eng/GTK-WPE-OpenXR-Allow-running-API-tests-without-DMA-buf-support branch from b29f009 to 4991232 Compare October 7, 2025 10:10
Copy link
Contributor

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

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

I have just one minor nit, otherwise I think this is okay.

Comment on lines +42 to +50
static WebKitFeature* findFeature(WebKitFeatureList *featureList, const char *identifier)
{
for (gsize i = 0; i < webkit_feature_list_get_length(featureList); i++) {
WebKitFeature* feature = webkit_feature_list_get(featureList, i);
if (!g_ascii_strcasecmp(identifier, webkit_feature_get_identifier(feature)))
return feature;
}
return nullptr;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I've seen similar functions in a few places (MiniBrowser, Cog, etc.) to find a WebKitFeature given its name. I think at some point we should add a webkit_settings_find_feature() and/or webkit_feature_list_find() functions to the public API... but that would be something to do another day.

@spenap spenap force-pushed the eng/GTK-WPE-OpenXR-Allow-running-API-tests-without-DMA-buf-support branch from 4991232 to e344223 Compare October 7, 2025 14:28
@spenap spenap force-pushed the eng/GTK-WPE-OpenXR-Allow-running-API-tests-without-DMA-buf-support branch from e344223 to 4e95933 Compare October 8, 2025 08:37
@spenap spenap added safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks merge-queue Applied to send a pull request to merge-queue and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Oct 8, 2025
https://bugs.webkit.org/show_bug.cgi?id=299525

Reviewed by Carlos Garcia Campos and Adrian Perez de Castro.

When an OpenXR coordinator is initializing, it requires the
MESA_image_dma_buf_export extension. However, when running tests
headless, like what we do in most bots, that extension is not available.

This change adds an internal web preference,
OpenXRDMABufRelaxedForTesting, (defaulting to false and only available
when building on developer mode) that lets the OpenXR coordinator accept
displays without that extension.

This is enough to run API tests with a headless environment and a null
compositor. Validating this change on the bots exposed a few additional
things: the tests can now run regardless of the value of
LIBGL_ALWAYS_SOFTWARE, and they need XR_RUNTIME_JSON to be defined in
order to find the runtime details.

Test: Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebXR.cpp
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: the new
  internal preference allowing to relax the extension check.
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp:
(WebKit::OpenXRCoordinator::getPrimaryDeviceInfo): Use the page proxy to
query the preferences, and pass it into initializeDevice.
(WebKit::OpenXRCoordinator::createGLDisplay const): Pass and use an
"isTesting" boolean.
(WebKit::OpenXRCoordinator::initializeDevice): Pass an isTesting
boolean.
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h:
* Tools/Scripts/webkitpy/port/monadodriver.py:
(MonadoDriver._get_runtime_path):
(MonadoDriver._setup_environ_for_test):
* Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebXR.cpp:
(findFeature): helper function to get the web preference.
(relaxDMABufRequirement): helper function that enables a setting
relaxing the DMA-BUF requirement.
(WebXRTest::WebXRTest): relax the requirement by default in all WebXR
tests.
(testWebKitWebXRLeaveImmersiveModeAndWaitUntilImmersiveModeChanged): use
the new settings before loading the test.
(testWebKitXRPermissionRequest): Ditto.
* Tools/glib/api_test_runner.py:
(TestRunner._run_test_glib):

Canonical link: https://commits.webkit.org/301203@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/GTK-WPE-OpenXR-Allow-running-API-tests-without-DMA-buf-support branch from 4e95933 to a9128cb Compare October 8, 2025 13:28
@webkit-commit-queue
Copy link
Collaborator

Committed 301203@main (a9128cb): https://commits.webkit.org/301203@main

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

@webkit-commit-queue webkit-commit-queue merged commit a9128cb into WebKit:main Oct 8, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Oct 8, 2025
@spenap spenap deleted the eng/GTK-WPE-OpenXR-Allow-running-API-tests-without-DMA-buf-support branch October 8, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebXR For bugs in WebXR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants