Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d5d69806a3887a44747c4b00854f932a140d583f
      
https://github.com/WebKit/WebKit/commit/d5d69806a3887a44747c4b00854f932a140d583f
  Author: Nikolas Zimmermann <[email protected]>
  Date:   2026-04-23 (Thu, 23 Apr 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/gbm/DMABufBuffer.cpp
    M Source/WebCore/platform/graphics/gbm/GBMVersioning.h
    M Source/WebCore/platform/graphics/gbm/MemoryMappedGPUBuffer.cpp
    M Source/WebCore/platform/graphics/gbm/MemoryMappedGPUBuffer.h
    M Source/cmake/OptionsGTK.cmake
    M Source/cmake/OptionsWPE.cmake

  Log Message:
  -----------
  [GTK][WPE] Always route GPU-sampling dma-buf exports through 
gbm_bo_get_fd_for_plane()
https://bugs.webkit.org/show_bug.cgi?id=313068

The capability-probe PR (311802@main) routed every dma-buf FD export through
MemoryMappedGPUBuffer::exportFDForPlane(), which on systems where the probe
selects DRMSystemCall calls drmPrimeHandleToFD(DRM_RDWR) directly. Bypassing
GBM there means Mesa never observes the export and never attaches its
implicit-sync dma_resv fence to the buffer. When the same dma-buf is later
sampled by the GPU (for us, via EGLImage re-import), gallium's pre-draw
fence wait returns EINVAL ("wait failed: -22") and aborts at flush time.

Split the FD export by purpose via a new FDExportPurpose enum parameter on
exportFDForPlane(). GPUSampling always goes through gbm_bo_get_fd_for_plane()
so Mesa keeps tracking the export; DMABufBuffer::fromGBMBufferObject() -- the
consumer that wraps the FD for GPU-side sampling -- passes this purpose.
CPUMapping keeps the two-strategy probe dispatch, since the whole reason it
exists is to find a path that yields an RDWR-mappable FD on Mesa versions
where gbm_bo_get_fd_for_plane() doesn't. That FD is stored in a new
m_exportedFDForMapping member of MemoryMappedGPUBuffer, distinct from the
GPU-sampling FDs held by m_dmaBuf; mapIfNeeded() mmaps it lazily and
DMA_BUF_IOCTL_SYNC reuses it.

Also short-circuit the capability probe: if gbm_bo_get_fd_for_plane()
already yields an mmap-capable FD we skip the DRMSystemCall probe entirely,
saving one gbm_bo alloc/export/mmap cycle at session startup.

Drop the gbm_bo_get_fd_for_plane() compatibility shim and its cmake check;
we no longer support Mesa < 21 nor Debian 11, where this was standard.

* Source/WebCore/platform/graphics/gbm/DMABufBuffer.cpp:
(WebCore::DMABufBufferAttributes::fromGBMBufferObject):
* Source/WebCore/platform/graphics/gbm/GBMVersioning.h:
(gbm_bo_get_fd_for_plane): Deleted.
* Source/WebCore/platform/graphics/gbm/MemoryMappedGPUBuffer.cpp:
(WebCore::runCapabilityProbe):
(WebCore::MemoryMappedGPUBuffer::exportFDForPlane):
(WebCore::MemoryMappedGPUBuffer::create):
(WebCore::MemoryMappedGPUBuffer::primaryPlaneDmaBufFD): Deleted.
(WebCore::MemoryMappedGPUBuffer::mapIfNeeded):
(WebCore::MemoryMappedGPUBuffer::performDMABufSyncSystemCall):
* Source/WebCore/platform/graphics/gbm/MemoryMappedGPUBuffer.h:
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to