Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f59489c669a20aededb0e299e54d3ed448424b9b
      
https://github.com/WebKit/WebKit/commit/f59489c669a20aededb0e299e54d3ed448424b9b
  Author: Adrian Perez de Castro <[email protected]>
  Date:   2025-09-24 (Wed, 24 Sep 2025)

  Changed paths:
    M Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp
    M Source/WebCore/PlatformWPE.cmake
    M Source/WebCore/SourcesWPE.txt
    M Source/WebCore/platform/graphics/GraphicsContextGL.h
    A 
Source/WebCore/platform/graphics/android/GraphicsContextGLTextureMapperAndroid.cpp
    A 
Source/WebCore/platform/graphics/android/GraphicsContextGLTextureMapperAndroid.h
    M Source/WebCore/platform/graphics/egl/GLDisplay.cpp
    M Source/WebCore/platform/graphics/egl/GLDisplay.h
    M 
Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp
    M Source/WebCore/platform/xr/PlatformXR.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/Shared/XR/PlatformXR.serialization.in
    M Source/WebKit/UIProcess/XR/openxr/OpenXRExtensions.cpp
    M Source/WebKit/UIProcess/XR/openxr/OpenXRExtensions.h
    M Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.cpp
    M Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.h
    M Source/WebKit/UIProcess/XR/openxr/OpenXRSwapchain.h
    M Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp
    M Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h

  Log Message:
  -----------
  [OpenXR] Use AHardwareBuffer for buffer sharing on Android
https://bugs.webkit.org/show_bug.cgi?id=298312

Reviewed by Carlos Garcia Campos.

Add a new GraphicsContextGLTextureMapperAndroid class, which mostly
reuses the functionality from the GraphicsContextGLTextureMapperANGLE;
but adds its own implementation of methods used by the WebXR machinery
to use GCGLExternalImage instances backed by AHardwareBuffer that can be
shared with the rendering process (currently WebProcess, but could be
GPUProcess). Buffer sharing across processes uses the support added
in 299311@main.

It is not possible to extract the AHardwareBuffer backing an existing
texture provided by the OpenXR runtime as part of its swapchain (and
textures may not even use one), so instead new compatible buffers are
created where the actual rendering is done, and then the result blitted
onto the OpenXR-provided textures. This reuses the existing blitting
mechanism used as fallback when the MESA_image_dma_buf_export is not
available, which was introduced in introduced in 299044@main.

The last bit of the piece is handling XrInstanceCreateInfoAndroidKHR
during OpenXR initialization: the runtime needs to know which JavaVM
instance for the application, and the Activity from the Android UI
framework to associate with the XrInstance. To obtain these, the code
expects the following two functions to be defined and resolvable at
run time via dlsym(RTLD_DEFAULT, ...):

  JavaVM* wpe_android_runtime_get_current_java_vm()
  jobject wpe_android_runtime_get_current_activity()

The WPE-Android project has incorporated those in the following patch:

  https://github.com/Igalia/wpe-android/pull/214

* Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp:
(WebCore::makeExternalImageSource):
(WebCore::WebXROpaqueFramebuffer::reusableDisplayAttachments const):
(WebCore::WebXROpaqueFramebuffer::bindCompositorTexturesForDisplay):
* Source/WebCore/PlatformWPE.cmake:
* Source/WebCore/SourcesWPE.txt:
* Source/WebCore/platform/graphics/GraphicsContextGL.h:
* 
Source/WebCore/platform/graphics/android/GraphicsContextGLTextureMapperAndroid.cpp:
 Added.
(WebCore::GraphicsContextGLTextureMapperAndroid::create):
(WebCore::GraphicsContextGLTextureMapperAndroid::platformInitializeExtensions):
(WebCore::GraphicsContextGLTextureMapperAndroid::createExternalImage):
(WebCore::GraphicsContextGLTextureMapperAndroid::bindExternalImage):
(WebCore::GraphicsContextGLTextureMapperAndroid::enableRequiredWebXRExtensions):
* 
Source/WebCore/platform/graphics/android/GraphicsContextGLTextureMapperAndroid.h:
 Added.
* Source/WebCore/platform/graphics/egl/GLDisplay.cpp:
(WebCore::GLDisplay::GLDisplay):
* Source/WebCore/platform/graphics/egl/GLDisplay.h:
* 
Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp:
(WebCore::createWebProcessGraphicsContextGL):
* Source/WebCore/platform/xr/PlatformXR.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/Shared/XR/PlatformXR.serialization.in:
* Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.cpp:
(WebKit::OpenXRLayer::exportOpenXRTextureAndroid):
(WebKit::OpenXRLayer::exportOpenXRTexture):
(WebKit::OpenXRLayerProjection::endFrame):
* Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.h:
(WebKit::OpenXRLayer::needsBlitTexture const):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp:
(WebKit::OpenXRCoordinator::createInstance):
(WebKit::OpenXRCoordinator::createGLDisplay const):
(WebKit::OpenXRCoordinator::tryInitializeGraphicsBinding):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to