Cherry-pick 307450@main (39eb51251d8f). https://bugs.webkit.org/show_bug.cgi?id=275100#68429
Merged
Conversation
Collaborator
|
EWS run on current version of this PR (hash 7578e98) Details |
…gi?id=306613 Remove unused code from ImageBitmapRenderingContext https://bugs.webkit.org/show_bug.cgi?id=306613 rdar://169267153 Reviewed by Anne van Kesteren. Remove unused code and merge trivial functions that are used only once. Remove stale comments. The spec text has changed, and the comments make the trivial code more complex. Makes future changes moving ImageBuffer out of CanvasBase more reviewable. * Source/WebCore/html/canvas/ImageBitmapRenderingContext.cpp: (WebCore::ImageBitmapRenderingContext::transferFromImageBitmap): (WebCore::ImageBitmapRenderingContext::setBlank): (WebCore::ImageBitmapRenderingContext::setOutputBitmap): Deleted. * Source/WebCore/html/canvas/ImageBitmapRenderingContext.h: Canonical link: https://commits.webkit.org/306490@main Canonical link: https://commits.webkit.org/305877.804@webkitglib/2.52
…gi?id=306606 Remove HTMLCanvasElement::clearImageBuffer, it is redundant https://bugs.webkit.org/show_bug.cgi?id=306606 rdar://169253510 Reviewed by Simon Fraser. 2D context canvas is cleared in 2DCanvasRenderingContext::reset() already. The function makes it harder to move the ImageBuffer to 2DCanvasRenderingContext. * Source/WebCore/html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::didUpdateSizeProperties): (WebCore::HTMLCanvasElement::createImageBuffer const): (WebCore::HTMLCanvasElement::clearCopiedImage const): (WebCore::HTMLCanvasElement::clearImageBuffer const): Deleted. * Source/WebCore/html/HTMLCanvasElement.h: Canonical link: https://commits.webkit.org/306510@main Canonical link: https://commits.webkit.org/305877.805@webkitglib/2.52
…gi?id=306603 Remove CanvasBase::m_contextStateSaver, it is not useful https://bugs.webkit.org/show_bug.cgi?id=306603 rdar://169252451 Reviewed by Simon Fraser. GraphicsContextStateSaver is a RAII class, it's not more useful than explicit save/restore useful when managed explicitly. Having the state saver in CanvasBase makes it harder to move the ImageBuffer from CanvasBase to 2DCanvasRenderingContextBase. * Source/WebCore/html/CanvasBase.cpp: (WebCore::CanvasBase::setImageBuffer const): (WebCore::CanvasBase::resetGraphicsContextState const): Deleted. * Source/WebCore/html/CanvasBase.h: * Source/WebCore/html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::didUpdateSizeProperties): * Source/WebCore/html/OffscreenCanvas.cpp: (WebCore::OffscreenCanvas::didUpdateSizeProperties): * Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::unwindStateStack): (WebCore::CanvasRenderingContext2DBase::reset): Canonical link: https://commits.webkit.org/306511@main Canonical link: https://commits.webkit.org/305877.806@webkitglib/2.52
…gi?id=306608 Move memory cost reporting to canvas rendering contexts https://bugs.webkit.org/show_bug.cgi?id=306608 rdar://169256162 Reviewed by Simon Fraser. Before, the canvas element or offscreen canvas object would report the memory cost The rendering context holds the resources and the cost is per rendering context type. This simplifies moving the ImageBuffer to CanvasRenderingContext2DBase. The current memory cost is bound to the image buffer size, and this is wildly inaccurate for WebGL and WebGPU. This will be fixed later. * Source/WebCore/html/CanvasBase.cpp: (WebCore::CanvasBase::setImageBuffer const): (WebCore::CanvasBase::memoryCost const): Deleted. (WebCore::CanvasBase::externalMemoryCost const): Deleted. * Source/WebCore/html/CanvasBase.h: * Source/WebCore/html/HTMLCanvasElement.idl: * Source/WebCore/html/OffscreenCanvas.idl: * Source/WebCore/html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::updateMemoryCostOnAllocation): (WebCore::CanvasRenderingContext::memoryCost const): (WebCore::CanvasRenderingContext::externalMemoryCost const): * Source/WebCore/html/canvas/CanvasRenderingContext.h: * Source/WebCore/html/canvas/CanvasRenderingContext2D.idl: * Source/WebCore/html/canvas/GPUCanvasContext.idl: * Source/WebCore/html/canvas/ImageBitmapRenderingContext.idl: * Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.idl: * Source/WebCore/html/canvas/WebGL2RenderingContext.idl: * Source/WebCore/html/canvas/WebGLRenderingContext.idl: * Source/WebCore/inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::buildObjectForCanvas): * Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::didChangeCanvasMemory): Canonical link: https://commits.webkit.org/306625@main Canonical link: https://commits.webkit.org/305877.807@webkitglib/2.52
…gi?id=306617 Avoid using CanvasBase::allocateImageBuffer() in WebGL, WebGPU transferToImageBuffer() https://bugs.webkit.org/show_bug.cgi?id=306617 rdar://169276497 Reviewed by Mike Wyrzykowski. The allocation function is related to how 2D context backing store is allocated. transferToImageBuffer needs a general purpose ImageBuffer, where the WebGL, WebGPU backing store is transferred to. This makes it simpler to move 2D context related ImageBuffer code to 2D rendering context classes. * LayoutTests/platform/mac-wk2/fast/canvas/offscreen-giant-transfer-to-imagebitmap-expected.txt: Example of failure being fixed here: Previously transferToImageBitmap of a giant WebGL context failed due to canvas area limitations. * Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm: (WebCore::GPUCanvasContextCocoa::transferToImageBuffer): * Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::transferToImageBuffer): Canonical link: https://commits.webkit.org/306772@main Canonical link: https://commits.webkit.org/305877.808@webkitglib/2.52
…gi?id=275100 CanvasBase owns a ImageBuffer that belongs to the CanvasRenderingContext https://bugs.webkit.org/show_bug.cgi?id=275100 rdar://129208981 Reviewed by Simon Fraser. Before, CanvasBase would own a ImageBuffer that was historically the 2d context drawing backing store. This ImageBuffer was then repurposed for bitmaprenderer, webgl, webgpu backing store to paint all these contexts to page (i.e layer) contents. This coden organization is not good, because this dictates that the content will exist in an ImageBuffer. This needs an extra draw to bitmap to be used. This in turn results in loss of performance and memory for all context types, and loss of correctness for bitmaprenderer. Fix by moving the ImageBuffer backing store to CanvasRenderingContext2DBase. Fix by introducing the paint buffer backing store specific to each rendering context. In subsequent commits, each of the context type may hold and assign the paint buffer backing store in efficient manner suitable for each context type. Also in subsequent commits, the paint storage will be held in NativeImages, avoiding the need to use ImageBuffer for context types that do not originate their images from ImageBuffer. * LayoutTests/platform/ios/fast/canvas/offscreen-giant-transfer-to-imagebitmap-expected.txt: * LayoutTests/platform/mac-wk2/fast/canvas/offscreen-giant-transfer-to-imagebitmap-expected.txt: * Source/WebCore/dom/Document.cpp: (WebCore::Document::getCSSCanvasContext): * Source/WebCore/html/CanvasBase.cpp: (WebCore::CanvasBase::~CanvasBase): (WebCore::CanvasBase::makeRenderingResultsAvailable): (WebCore::CanvasBase::setSize): (WebCore::CanvasBase::shouldAccelerate const): (WebCore::CanvasBase::validateArea const): (WebCore::CanvasBase::buffer const): Deleted. (WebCore::CanvasBase::setImageBuffer const): Deleted. (WebCore::CanvasBase::allocateImageBuffer const): Deleted. * Source/WebCore/html/CanvasBase.h: (WebCore::CanvasBase::setImageBufferAndMarkDirty): Deleted. (WebCore::CanvasBase::setHasCreatedImageBuffer): Deleted. (WebCore::CanvasBase::hasCreatedImageBuffer const): Deleted. (WebCore::CanvasBase::createImageBuffer const): Deleted. * Source/WebCore/html/CustomPaintCanvas.cpp: (WebCore::CustomPaintCanvas::~CustomPaintCanvas): * Source/WebCore/html/CustomPaintCanvas.h: * Source/WebCore/html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::~HTMLCanvasElement): (WebCore::HTMLCanvasElement::attributeChanged): (WebCore::HTMLCanvasElement::setSizeForControllingContext): (WebCore::HTMLCanvasElement::didUpdateSizeProperties): (WebCore::HTMLCanvasElement::setCSSCanvasContextSize): Deleted. (WebCore::HTMLCanvasElement::createImageBuffer const): Deleted. (WebCore::HTMLCanvasElement::setImageBufferAndMarkDirty): Deleted. * Source/WebCore/html/HTMLCanvasElement.h: * Source/WebCore/html/OffscreenCanvas.cpp: (WebCore::OffscreenCanvas::~OffscreenCanvas): (WebCore::OffscreenCanvas::setWidth): (WebCore::OffscreenCanvas::setHeight): (WebCore::OffscreenCanvas::setSizeForControllingContext): (WebCore::OffscreenCanvas::didUpdateSizeProperties): (WebCore::OffscreenCanvas::transferToImageBitmap): (WebCore::OffscreenCanvas::createImageBuffer const): Deleted. (WebCore::OffscreenCanvas::setImageBufferAndMarkDirty): Deleted. * Source/WebCore/html/OffscreenCanvas.h: * Source/WebCore/html/canvas/CanvasRenderingContext.cpp: (WebCore::CanvasRenderingContext::updateMemoryCost const): (WebCore::CanvasRenderingContext::surfaceBufferToImageBuffer): Deleted. (WebCore::CanvasRenderingContext::isSurfaceBufferTransparentBlack const): Deleted. (WebCore::CanvasRenderingContext::updateMemoryCostOnAllocation): Deleted. * Source/WebCore/html/canvas/CanvasRenderingContext.h: * Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::~CanvasRenderingContext2DBase): (WebCore::CanvasRenderingContext2DBase::surfaceBufferToImageBuffer): (WebCore::CanvasRenderingContext2DBase::isSurfaceBufferTransparentBlack const): (WebCore::CanvasRenderingContext2DBase::layerContentsDisplayDelegate): (WebCore::CanvasRenderingContext2DBase::flushDeferredOperations): (WebCore::CanvasRenderingContext2DBase::reset): (WebCore::CanvasRenderingContext2DBase::didUpdateCanvasSizeProperties): (WebCore::CanvasRenderingContext2DBase::drawingContext const): (WebCore::CanvasRenderingContext2DBase::existingDrawingContext const): (WebCore::CanvasRenderingContext2DBase::baseTransform const): (WebCore::CanvasRenderingContext2DBase::prepareForDisplay): (WebCore::CanvasRenderingContext2DBase::putImageData): (WebCore::CanvasRenderingContext2DBase::getEffectiveRenderingModeForTesting): (WebCore::CanvasRenderingContext2DBase::buffer const): (WebCore::CanvasRenderingContext2DBase::allocateImageBuffer const): * Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h: (WebCore::CanvasRenderingContext2DBase::hasCreatedImageBuffer const): * Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h: * Source/WebCore/html/canvas/GPUCanvasContextCocoa.h: * Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm: (WebCore::GPUCanvasContextCocoa::didUpdateCanvasSizeProperties): (WebCore::GPUCanvasContextCocoa::surfaceBufferToImageBuffer): (WebCore::GPUCanvasContextCocoa::unconfigure): (WebCore::GPUCanvasContextCocoa::prepareForDisplay): (WebCore::GPUCanvasContextCocoa::markContextChangedAndNotifyCanvasObservers): (WebCore::GPUCanvasContextCocoa::updateMemoryCost const): (WebCore::GPUCanvasContextCocoa::reshape): Deleted. * Source/WebCore/html/canvas/ImageBitmapRenderingContext.cpp: (WebCore::ImageBitmapRenderingContext::transferFromImageBitmap): (WebCore::ImageBitmapRenderingContext::transferToImageBuffer): (WebCore::ImageBitmapRenderingContext::surfaceBufferToImageBuffer): (WebCore::ImageBitmapRenderingContext::setBlank): Deleted. * Source/WebCore/html/canvas/ImageBitmapRenderingContext.h: * Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.cpp: (WebCore::OffscreenCanvasRenderingContext2D::transferToImageBuffer): * Source/WebCore/html/canvas/PlaceholderRenderingContext.cpp: (WebCore::PlaceholderRenderingContext::setContentsToLayer): (WebCore::PlaceholderRenderingContext::setPlaceholderBuffer): (WebCore::PlaceholderRenderingContext::pixelFormat const): (WebCore::PlaceholderRenderingContext::surfaceBufferToImageBuffer): (WebCore::PlaceholderRenderingContext::isSurfaceBufferTransparentBlack const): (WebCore::PlaceholderRenderingContext::didUpdateCanvasSizeProperties): * Source/WebCore/html/canvas/PlaceholderRenderingContext.h: * Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::initializeNewContext): (WebCore::WebGLRenderingContextBase::initializeContextState): (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver): (WebCore::createImageBufferForWebGLContextReads): (WebCore::WebGLRenderingContextBase::surfaceBufferToImageBuffer): (WebCore::WebGLRenderingContextBase::transferToImageBuffer): (WebCore::WebGLRenderingContextBase::didUpdateCanvasSizeProperties): (WebCore::WebGLRenderingContextBase::prepareForDisplay): (WebCore::WebGLRenderingContextBase::updateMemoryCost const): (WebCore::WebGLRenderingContextBase::reshape): Deleted. * Source/WebCore/html/canvas/WebGLRenderingContextBase.h: * Source/WebCore/inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl): * Source/WebCore/inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didChangeCanvasMemory): * Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::didChangeCanvasMemory): (WebCore::InspectorCanvasAgent::findInspectorCanvas): * Source/WebCore/inspector/agents/InspectorCanvasAgent.h: * Source/WebCore/rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): Canonical link: https://commits.webkit.org/307450@main # Conflicts: # Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp # Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.cpp # Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp # Source/WebCore/rendering/RenderLayerBacking.cpp Canonical link: https://commits.webkit.org/305877.809@webkitglib/2.52
7578e98 to
5c9a25e
Compare
Collaborator
|
Committed 305877.809@webkitglib/2.52 (5c9a25e): https://commits.webkit.org/305877.809@webkitglib/2.52 Reviewed commits have been landed. Closing PR #68429 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
5c9a25e
e3ccffb
ecfaa2e
212940b
f7982e4
c7f74f6
7578e98
🛠 ios🛠 mac🛠 win🛠 ios-sim🛠 mac-AS-debug🧪 win-tests🧪 ios-wk2🧪 api-mac🧪 ios-wk2-wpt🧪 api-mac-debug🧪 jsc-x86-64🧪 api-ios🧪 mac-wk2🛠 ios-safer-cpp🧪 mac-AS-debug-wk2🛠 vision🧪 mac-wk2-stress🛠 vision-sim🧪 mac-intel-wk2🛠 playstation🧪 vision-wk2🛠 mac-safer-cpp🛠 tv🧪 mac-site-isolation🛠 tv-sim🛠 watch🛠 watch-sim