Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1e66e746033fb1e8e29c91cd301149d76a62888e
      
https://github.com/WebKit/WebKit/commit/1e66e746033fb1e8e29c91cd301149d76a62888e
  Author: Gerald Squelart <[email protected]>
  Date:   2026-07-23 (Thu, 23 Jul 2026)

  Changed paths:
    R LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-expected.txt
    A 
LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-large-unaccelerated-expected.txt
    A 
LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-large-unaccelerated.html
    A 
LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-small-accelerated-expected.txt
    A 
LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-small-accelerated.html
    R LayoutTests/fast/canvas/hdr/float16-canvas-imagedata.html
    A LayoutTests/fast/canvas/hdr/float16-canvas-imagedata.js
    M Source/WebCore/platform/graphics/ImageBufferBackend.cpp
    M Source/WebCore/platform/graphics/ShareableBitmap.cpp
    M Source/WebCore/platform/graphics/ShareableBitmap.h
    M Source/WebCore/platform/graphics/cairo/ShareableBitmapCairo.cpp
    M Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp
    M Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm
    M Source/WebCore/platform/graphics/skia/ShareableBitmapSkia.cpp
    M Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M 
Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp

  Log Message:
  -----------
  Add PixelFormat to ShareableBitmapConfiguration
https://bugs.webkit.org/show_bug.cgi?id=319966
rdar://182891101

Reviewed by Mike Wyrzykowski.

In order to correctly share bitmap buffers between processes, their
pixel format is needed to compute the buffer memory size, especially
when potentially dealing with HDR float16 buffers.

- Add PixelFormat to ShareableBitmapConfiguration, and ensure it's
  de/serialized.
- If not specified, infer it from whether the color space uses extended-
  range color values.
- Use this PixelFormat (instead of the color space) when computing
  memory sizes. Note that some platforms still rely solely on the color
  space.
- Test that HDR pixels near the end of a canvas are correctly written
  and read.

Additionally:
- Remove the std::optional shell around
  ShareableBitmapConfiguration::m_colorSpace, it was effectively
  checked at every access, so instead it's now pre-computed once during
  construction.
- Make the deserializing ShareableBitmapConfiguration constructor
  private, as it's only used by friend struct IPC::ArgumentCoder.

Tests: fast/canvas/hdr/float16-canvas-imagedata-large-unaccelerated.html
       fast/canvas/hdr/float16-canvas-imagedata-small-accelerated.html

* 
LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-large-unaccelerated-expected.txt:
 Copied from LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-expected.txt.
* 
LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-large-unaccelerated.html: 
Added.
* 
LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-small-accelerated-expected.txt:
 Renamed from LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-expected.txt.
* LayoutTests/fast/canvas/hdr/float16-canvas-imagedata-small-accelerated.html: 
Added.
* LayoutTests/fast/canvas/hdr/float16-canvas-imagedata.js: Renamed from 
LayoutTests/fast/canvas/hdr/float16-canvas-imagedata.html.
* Source/WebCore/platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::calculateSafeBackendSize):
* Source/WebCore/platform/graphics/ShareableBitmap.cpp:
(WebCore::ShareableBitmapConfiguration::ShareableBitmapConfiguration):
(WebCore::ShareableBitmapConfiguration::calculateSizeInBytes):
* Source/WebCore/platform/graphics/ShareableBitmap.h:
(WebCore::ShareableBitmapConfiguration::colorSpace const):
(WebCore::ShareableBitmapConfiguration::pixelFormat const):
(WebCore::ShareableBitmap::colorSpace const):
(WebCore::ShareableBitmap::pixelFormat const):
* Source/WebCore/platform/graphics/cairo/ShareableBitmapCairo.cpp:
(WebCore::ShareableBitmapConfiguration::validateColorSpace):
(WebCore::ShareableBitmapConfiguration::calculateBitsPerComponent):
(WebCore::ShareableBitmapConfiguration::calculateBytesPerPixel):
(WebCore::ShareableBitmapConfiguration::calculateBytesPerRow):
* Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::create):
* Source/WebCore/platform/graphics/cg/ShareableBitmapCG.mm:
(WebCore::ShareableBitmapConfiguration::validateColorSpace):
(WebCore::ShareableBitmapConfiguration::calculateBitsPerComponent):
(WebCore::ShareableBitmapConfiguration::calculateBytesPerPixel):
(WebCore::ShareableBitmapConfiguration::calculateBytesPerRow):
(WebCore::ShareableBitmapConfiguration::calculateBitmapInfo):
* Source/WebCore/platform/graphics/skia/ShareableBitmapSkia.cpp:
(WebCore::ShareableBitmapConfiguration::validateColorSpace):
(WebCore::ShareableBitmapConfiguration::calculateBitsPerComponent):
(WebCore::ShareableBitmapConfiguration::calculateBytesPerPixel):
(WebCore::ShareableBitmapConfiguration::calculateBytesPerRow):
* Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::calculateSafeBackendSize):
(WebKit::ImageBufferShareableBitmapBackend::calculateBytesPerRow):
(WebKit::ImageBufferShareableBitmapBackend::create):

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



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

Reply via email to