← All issues

[HDR] Introduce GainMap and ShareableGainMap

ff6f5a8

Source/WebCore/platform/graphics/cocoa/ShareableGainMap.cpp

+RetainPtr<CGImageRef> ShareableGainMap::applyGainMapToBaseImage(CGImageRef baseImage) const
+{
+ auto basePixelBuffer = createMetalCompatibleCVPixelBufferFromImage(baseImage);
+ if (!basePixelBuffer) return nullptr;
+ auto outputPixelBuffer = createScratchMetalCompatibleCVPixelBuffer(*basePixelBuffer);
+ if (!outputPixelBuffer) return nullptr;
+ OSStatus status = CGImageApplyHDRGainMap(basePixelBuffer.get(), m_gainMapPixelBuffer.get(), outputPixelBuffer.get(), nullptr);
+ if (status) return nullptr;
+ return createCGImageFromCVPixelBuffer(outputPixelBuffer.get());
+}

WebKit의 GPU process model은 rendering을 web content로부터 격리합니다. ShareableBitmap은 rasterize된 image data를 process 경계 너머로 전달하는 shared-memory primitive입니다. CVPixelBuffer는 CoreVideo의 reference-counted pixel buffer 타입입니다. ISO gain map은 HEIF/JPEG-XL에서 표준화된 형식으로, 픽셀별 HDR headroom을 보조 image layer로 인코딩합니다. Apple의 private SPI인 CGImageApplyHDRGainMap은 Metal을 통해 이를 base image에 합성합니다. 이 commit은 GainMap(CVPixelBuffer + metadata + colorSpace)을 NativeImageShareableBitmapConfiguration을 통해 연결했습니다. GPU process에서는 ShareableBitmap::createPlatformImage()가 조건부로 해당 SPI를 호출하도록 구성되었습니다.

HDR rendering을 위한 cross-process 경로를 구축하는 변경입니다. WebProcess에서 GPU process로 흐르는 IPC-serialized CVPixelBuffer 데이터가 새롭게 도입되었으며, pixel-buffer lifetime 관리와 null options dict를 전달하는 private SPI 호출이 새로운 attack surface를 형성합니다.

🔒

New cross-process pixel-buffer and metadata paths feed private SPI — edge cases in dimension validation and lifetime handling are worth auditing.

더 확인하려면 구독해 주세요