Skip to content

[WebXR][GTK][WPE] Implement PlatformXrCoordinator::getPrimaryDeviceInfo() #47071

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

Conversation

svillar
Copy link
Contributor

@svillar svillar commented Jun 23, 2025

19bf33d

[WebXR][GTK][WPE] Implement PlatformXrCoordinator::getPrimaryDeviceInfo()
https://bugs.webkit.org/show_bug.cgi?id=294843

Reviewed by Carlos Garcia Campos.

The PlatformXrCoordinator is one of the most important object in the UIProcess
related to XR. Among other things it's responsible for:
* retrieving info and capabilities of the XR device/system
* start/stop XR sessions
* schedule frame rendering

For GTK & WPE ports that coordinator is implemented using OpenXR. This PR
implements the method that retrieves the device capabilities as a first step.

* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/webxr/webxr_availability.http.sub-expected.txt: Added.
* LayoutTests/platform/gtk/TestExpectations: Unskipped tests.
* LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/feature-policy/reporting/xr-reporting.https-expected.txt:
* LayoutTests/platform/wpe/TestExpectations: Unskipped tests.
* Source/WTF/wtf/PlatformUse.h:
* Source/WebCore/SourcesGTK.txt:
* Source/WebCore/SourcesWPE.txt:
* Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp: Added.
(PlatformXR::Instance::singleton):
(PlatformXR::Instance::Instance):
(PlatformXR::Instance::enumerateImmersiveXRDevices):
* Source/WebCore/platform/xr/openxr/PlatformXROpenXR.h: Added.
* Source/WebKit/PlatformGTK.cmake:
* Source/WebKit/PlatformWPE.cmake:
* Source/WebKit/SourcesGTK.txt:
* Source/WebKit/SourcesWPE.txt:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didAttachToRunningProcess):
(WebKit::WebPageProxy::resetState):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp:
* Source/WebKit/UIProcess/XR/openxr/OpenXRExtensions.cpp: Added.
(WebKit::OpenXRExtensions::create):
(WebKit::OpenXRExtensions::OpenXRExtensions):
(WebKit::OpenXRExtensions::loadMethods):
(WebKit::OpenXRExtensions::isExtensionSupported const):
* Source/WebKit/UIProcess/XR/openxr/OpenXRExtensions.h: Added.
* Source/WebKit/UIProcess/XR/openxr/OpenXRUtils.h: Added.
(WebKit::createOpenXRStruct):
(WebKit::checkXrResult):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp: Added.
(WebKit::OpenXRCoordinator::OpenXRCoordinator):
(WebKit::OpenXRCoordinator::~OpenXRCoordinator):
(WebKit::OpenXRCoordinator::getPrimaryDeviceInfo):
(WebKit::OpenXRCoordinator::createInstance):
(WebKit::OpenXRCoordinator::recommendedResolution const):
(WebKit::OpenXRCoordinator::collectViewConfigurations):
(WebKit::OpenXRCoordinator::initializeSystem):
(WebKit::OpenXRCoordinator::initializeDevice):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h: Added.
* Source/WebKit/UIProcess/XR/openxr/PlatformXRSystemOpenXR.cpp: Added.
(WebKit::PlatformXRSystem::xrCoordinator):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/cmake/FindOpenXR.cmake:
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:

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

512b3b9

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
✅ 🛠 🧪 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

@svillar svillar requested review from a team and cdumez as code owners June 23, 2025 16:59
@svillar svillar self-assigned this Jun 23, 2025
@svillar svillar added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Jun 23, 2025
@svillar svillar requested a review from carlosgcampos June 23, 2025 17:01
@svillar svillar force-pushed the eng/openxr_platformxr_coordinator branch from d484d9b to 86e68f6 Compare June 23, 2025 17:12
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 23, 2025
@svillar svillar removed the merging-blocked Applied to prevent a change from being merged label Jun 23, 2025
@svillar svillar force-pushed the eng/openxr_platformxr_coordinator branch from 86e68f6 to d0c1d44 Compare June 23, 2025 19:18
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 23, 2025
@svillar svillar removed the merging-blocked Applied to prevent a change from being merged label Jun 24, 2025
@svillar svillar force-pushed the eng/openxr_platformxr_coordinator branch from d0c1d44 to 3c9e7f6 Compare June 24, 2025 13:57
@svillar svillar force-pushed the eng/openxr_platformxr_coordinator branch from 3c9e7f6 to 2fbc72b Compare June 24, 2025 15:39
@svillar svillar requested a review from carlosgcampos June 24, 2025 17:52
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 24, 2025
@svillar svillar removed the merging-blocked Applied to prevent a change from being merged label Jun 24, 2025
@svillar svillar force-pushed the eng/openxr_platformxr_coordinator branch from 2fbc72b to 3b4d636 Compare June 24, 2025 19:08

std::unique_ptr<OpenXRExtensions> OpenXRExtensions::create()
{
uint32_t extensionCount { 0 };
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it's not needed here either?

ASSERT(RunLoop::isMain());
ASSERT(m_instance != XR_NULL_HANDLE);

uint32_t viewConfigurationCount = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nor here

XrInstance m_instance { XR_NULL_HANDLE };
XrSystemId m_systemId { XR_NULL_SYSTEM_ID };
Vector<XrViewConfigurationType> m_viewConfigurations;
XrViewConfigurationType m_currentViewConfiguration;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be initialized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could but it does not really make much sense in this case because it is something provided by the runtime and there is no value we could assume as "default"

@svillar svillar force-pushed the eng/openxr_platformxr_coordinator branch from 3b4d636 to 512b3b9 Compare June 25, 2025 07:43
@svillar svillar added the merge-queue Applied to send a pull request to merge-queue label Jun 25, 2025
…fo()

https://bugs.webkit.org/show_bug.cgi?id=294843

Reviewed by Carlos Garcia Campos.

The PlatformXrCoordinator is one of the most important object in the UIProcess
related to XR. Among other things it's responsible for:
* retrieving info and capabilities of the XR device/system
* start/stop XR sessions
* schedule frame rendering

For GTK & WPE ports that coordinator is implemented using OpenXR. This PR
implements the method that retrieves the device capabilities as a first step.

* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/webxr/webxr_availability.http.sub-expected.txt: Added.
* LayoutTests/platform/gtk/TestExpectations: Unskipped tests.
* LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/feature-policy/reporting/xr-reporting.https-expected.txt:
* LayoutTests/platform/wpe/TestExpectations: Unskipped tests.
* Source/WTF/wtf/PlatformUse.h:
* Source/WebCore/SourcesGTK.txt:
* Source/WebCore/SourcesWPE.txt:
* Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp: Added.
(PlatformXR::Instance::singleton):
(PlatformXR::Instance::Instance):
(PlatformXR::Instance::enumerateImmersiveXRDevices):
* Source/WebCore/platform/xr/openxr/PlatformXROpenXR.h: Added.
* Source/WebKit/PlatformGTK.cmake:
* Source/WebKit/PlatformWPE.cmake:
* Source/WebKit/SourcesGTK.txt:
* Source/WebKit/SourcesWPE.txt:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didAttachToRunningProcess):
(WebKit::WebPageProxy::resetState):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp:
* Source/WebKit/UIProcess/XR/openxr/OpenXRExtensions.cpp: Added.
(WebKit::OpenXRExtensions::create):
(WebKit::OpenXRExtensions::OpenXRExtensions):
(WebKit::OpenXRExtensions::loadMethods):
(WebKit::OpenXRExtensions::isExtensionSupported const):
* Source/WebKit/UIProcess/XR/openxr/OpenXRExtensions.h: Added.
* Source/WebKit/UIProcess/XR/openxr/OpenXRUtils.h: Added.
(WebKit::createOpenXRStruct):
(WebKit::checkXrResult):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp: Added.
(WebKit::OpenXRCoordinator::OpenXRCoordinator):
(WebKit::OpenXRCoordinator::~OpenXRCoordinator):
(WebKit::OpenXRCoordinator::getPrimaryDeviceInfo):
(WebKit::OpenXRCoordinator::createInstance):
(WebKit::OpenXRCoordinator::recommendedResolution const):
(WebKit::OpenXRCoordinator::collectViewConfigurations):
(WebKit::OpenXRCoordinator::initializeSystem):
(WebKit::OpenXRCoordinator::initializeDevice):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h: Added.
* Source/WebKit/UIProcess/XR/openxr/PlatformXRSystemOpenXR.cpp: Added.
(WebKit::PlatformXRSystem::xrCoordinator):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/cmake/FindOpenXR.cmake:
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:

Canonical link: https://commits.webkit.org/296610@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/openxr_platformxr_coordinator branch from 512b3b9 to 19bf33d Compare June 25, 2025 09:23
@webkit-commit-queue
Copy link
Collaborator

Committed 296610@main (19bf33d): https://commits.webkit.org/296610@main

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

@webkit-commit-queue webkit-commit-queue merged commit 19bf33d into WebKit:main Jun 25, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 25, 2025
@svillar svillar deleted the eng/openxr_platformxr_coordinator branch June 30, 2025 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Bugs Unclassified bugs are placed in this component until the correct component can be determined.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants