[webkit-changes] [WebKit/WebKit] 71065f: [Linux] DMABufObject modifiers should default to b...

Žan Doberšek noreply at github.com
Fri Feb 24 03:57:18 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 71065ff83269f32d9b25ae7ec79f900d3cd46e6c
      https://github.com/WebKit/WebKit/commit/71065ff83269f32d9b25ae7ec79f900d3cd46e6c
  Author: Žan Doberšek <zdobersek at igalia.com>
  Date:   2023-02-24 (Fri, 24 Feb 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/gbm/DMABufEGLUtilities.h
    M Source/WebCore/platform/graphics/gbm/DMABufObject.h
    M Source/WebCore/platform/graphics/gbm/GBMBufferSwapchain.cpp
    M Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

  Log Message:
  -----------
  [Linux] DMABufObject modifiers should default to being not-present
https://bugs.webkit.org/show_bug.cgi?id=252744

Reviewed by Carlos Garcia Campos.

Until now, the modifier values on the DMABufObject instances defaulted to 0,
which is equivalent to DRM_FORMAT_MOD_LINEAR. These values were then used in
the constructEGLCreateImageAttributes() helper, specifying the modifier value
for the EGLImage import as long as the driver supported the relevant extension.

DRM_FORMAT_MOD_LINEAR enforces the linear format, but that is not the same as
leaving the modifier unspecified. The latter step is necessary when the
modifier value has not been specified otherwise, since it allows the driver to
detect the corresponding modifier through internal logic.

This problem has been exhibited with some GStreamer decoders that yield DMABufs
without any modifier specified (perhaps because a specified modifier isn't
required, but mostly because the GStreamer pipeline doesn't relay that
information yet). When the linear modifier was specified, sampling of the
DMABuf-backed EGLImage was incorrect.

To fix this, modifier presence is now tracked alongside the per-plane modifier
value. Only when the modifier usage is enabled and the modifier is actually
present, the relevant EGL attributes are set during the EGLImage import.

GStreamer sink, when operating on DMABufs, leaves the modifiers unspecified,
since for now there's no information to work with. In GBMBufferSwapchain, when
creating a DMABufObject for a given buffer, that information is retrievable
through libgbm API, and the modifier for a given plane is marked as present.

* Source/WebCore/platform/graphics/gbm/DMABufEGLUtilities.h:
(WebCore::DMABufEGLUtilities::constructEGLCreateImageAttributes):
* Source/WebCore/platform/graphics/gbm/DMABufObject.h:
(WebCore::DMABufObject::encode):
(WebCore::DMABufObject::decode):
* Source/WebCore/platform/graphics/gbm/GBMBufferSwapchain.cpp:
(WebCore::GBMBufferSwapchain::Buffer::createDMABufObject const):
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::pushDMABufToCompositor):

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




More information about the webkit-changes mailing list