[webkit-changes] [WebKit/WebKit] 8d6cca: Clarify the usage of the colorspace on IOSurface

Simon Fraser noreply at github.com
Fri Nov 11 10:21:14 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8d6ccacd0fbbb0dcc0719e096fc77bbaaa12976d
      https://github.com/WebKit/WebKit/commit/8d6ccacd0fbbb0dcc0719e096fc77bbaaa12976d
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2022-11-11 (Fri, 11 Nov 2022)

  Changed paths:
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
    M Source/WebCore/platform/graphics/cocoa/IOSurface.h
    M Source/WebCore/platform/graphics/cocoa/IOSurface.mm
    M Source/WebCore/platform/xr/PlatformXR.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp
    M Source/WebKit/WebProcess/GPU/webrtc/SharedVideoFrame.cpp

  Log Message:
  -----------
  Clarify the usage of the colorspace on IOSurface
https://bugs.webkit.org/show_bug.cgi?id=247776
rdar://102221177

Reviewed by Tim Horton.

The colorspace argument to `IOSurface::createFromSendRight()` was ambiguous; it would set `m_colorSpace`, but that
doesn't affect any metadata in the IOSurface; it's only used when drawing to that IOSurface. `createFromSurface()`
had a similar issue.

So remove the colorspace argument from `createFromSendRight()` and make `m_colorSpace` a `std::optional<>`;
this will remain unset unless one of the functions that requires a colorspace is called, at which point we'll
try to get the colorspace from the IOSurface metadata, falling back to sRGB.

`createFromSurface()` takes an optional DestinationColorSpace; this will replace the colorspace in the
IOSurface metadata (if any); if unset, we'll fetch the colorspace from the IOSurface metadata.

* Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayerCocoa::setContents):
* Source/WebCore/platform/graphics/cocoa/IOSurface.h:
* Source/WebCore/platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::createFromSendRight):
(WebCore::IOSurface::createFromSurface):
(WebCore::IOSurface::IOSurface):
(WebCore::IOSurface::createCompatibleBitmap):
(WebCore::IOSurface::ensurePlatformContext):
(WebCore::IOSurface::colorSpace):
(WebCore::IOSurface::setColorSpaceProperty):
(WebCore::IOSurface::ensureColorSpace):
(WebCore::IOSurface::surfaceColorSpace const):
* Source/WebCore/platform/xr/PlatformXR.h:
(PlatformXR::Device::FrameData::LayerData::decode):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::recursivelyMapIOSurfaceBackingStore):
* Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):
* Source/WebKit/WebProcess/GPU/webrtc/SharedVideoFrame.cpp:
(WebKit::SharedVideoFrameReader::readBuffer):

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




More information about the webkit-changes mailing list