Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OffscreenCanvas uses CanvasBase::buffer() directly #29894

Conversation

kkinnunen-apple
Copy link
Contributor

@kkinnunen-apple kkinnunen-apple commented Jun 17, 2024

035c61a

OffscreenCanvas uses CanvasBase::buffer() directly
https://bugs.webkit.org/show_bug.cgi?id=275563
rdar://problem/129989623

Reviewed by Matt Woodrow.

OffscreenCanvas would use CanvasBase::buffer() to transfer the
offscreen canvas rendering to placeholder canvas.
The transfer is a draw operation from offscreen canvas and it changes
conceptually the placeholder *context*, not the placeholder canvas.

Implement this by adding PlaceholderRenderingContext::setPlaceholderBuffer().

Remove redundant ImageBufferPipe and OffscreenCanvasPlaceholderData
classes. PlaceholderRenderingContextSource is the thread-safe refcounted
interface to submit the placeholder buffer.

This is work towards making the rendering contexts be able to manage the
drawing and display buffers, by eventually removing the buffers from
CanvasBase.

* Source/WebCore/platform/graphics/nicosia/NicosiaPlaceholderRenderingContextSource.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp.
(Nicosia::NicosiaPlaceholderRenderingContextSource::NicosiaPlaceholderRenderingContextSource):
(Nicosia::NicosiaPlaceholderRenderingContextSource::~NicosiaPlaceholderRenderingContextSource):
(Nicosia::NicosiaPlaceholderRenderingContextSource::setPlaceholderBuffer):
(Nicosia::NicosiaPlaceholderRenderingContextSource::swapBuffersIfNeeded):
(Nicosia::NicosiaPlaceholderRenderingContextSource::setContentsToLayer):
(WebCore::PlaceholderRenderingContextSource::create):
* Source/WebCore/Headers.cmake:
* Source/WebCore/SmartPointerExpectations/UncountedCallArgsCheckerExpectations:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::transferControlToOffscreen):
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::DetachedOffscreenCanvas::DetachedOffscreenCanvas):
(WebCore::DetachedOffscreenCanvas::takePlaceholderSource):
(WebCore::OffscreenCanvas::create):
(WebCore::OffscreenCanvas::OffscreenCanvas):
(WebCore::OffscreenCanvas::detach):
(WebCore::OffscreenCanvas::commitToPlaceholderCanvas):
(WebCore::OffscreenCanvas::scheduleCommitToPlaceholderCanvas):
(WebCore::OffscreenCanvasPlaceholderData::create): Deleted.
(WebCore::OffscreenCanvasPlaceholderData::placeholder const): Deleted.
(WebCore::OffscreenCanvasPlaceholderData::pipeSource const): Deleted.
(WebCore::OffscreenCanvasPlaceholderData::OffscreenCanvasPlaceholderData): Deleted.
(WebCore::DetachedOffscreenCanvas::takePlaceholderData): Deleted.
* Source/WebCore/html/OffscreenCanvas.h:
* Source/WebCore/html/canvas/PlaceholderRenderingContext.cpp:
(WebCore::PlaceholderRenderingContextSource::create):
(WebCore::PlaceholderRenderingContextSource::PlaceholderRenderingContextSource):
(WebCore::PlaceholderRenderingContextSource::setPlaceholderBuffer):
(WebCore::PlaceholderRenderingContext::create):
(WebCore::PlaceholderRenderingContext::PlaceholderRenderingContext):
(WebCore::PlaceholderRenderingContext::canvas const):
(WebCore::PlaceholderRenderingContext::size const):
(WebCore::PlaceholderRenderingContext::setContentsToLayer):
(WebCore::PlaceholderRenderingContext::setPlaceholderBuffer):
* Source/WebCore/html/canvas/PlaceholderRenderingContext.h:
* Source/WebCore/platform/SourcesNicosia.txt:
* Source/WebCore/platform/graphics/ImageBufferPipe.cpp: Removed.
* Source/WebCore/platform/graphics/ImageBufferPipe.h: Removed.
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.h: Removed.

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

1199811

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2 βœ… πŸ§ͺ wincairo-tests
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ›  wpe-cairo
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ›  gtk
⏳ πŸ›  vision βœ… πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ§ͺ gtk-wk2
⏳ πŸ›  vision-sim βœ… πŸ§ͺ mac-wk2-stress βœ… πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ merge ⏳ πŸ§ͺ vision-wk2
βœ… πŸ›  tv
βœ… πŸ›  tv-sim
βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@kkinnunen-apple kkinnunen-apple self-assigned this Jun 17, 2024
@kkinnunen-apple kkinnunen-apple added the Canvas Bugs related to the canvas element. label Jun 17, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple removed the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple force-pushed the offscreencanvas-no-placeholder-data-1 branch from 7db031b to 5864af2 Compare June 17, 2024 11:02
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple removed the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple force-pushed the offscreencanvas-no-placeholder-data-1 branch from 5864af2 to e05ebcd Compare June 17, 2024 11:12
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple removed the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple force-pushed the offscreencanvas-no-placeholder-data-1 branch from e05ebcd to 8eb4b52 Compare June 17, 2024 11:22
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple removed the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple force-pushed the offscreencanvas-no-placeholder-data-1 branch from 8eb4b52 to 8153893 Compare June 17, 2024 11:29
@kkinnunen-apple kkinnunen-apple removed the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple force-pushed the offscreencanvas-no-placeholder-data-1 branch from 8153893 to b6ca911 Compare June 17, 2024 11:43
@kkinnunen-apple kkinnunen-apple force-pushed the offscreencanvas-no-placeholder-data-1 branch from b6ca911 to 229f611 Compare June 17, 2024 11:45
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple removed the merging-blocked Applied to prevent a change from being merged label Jun 17, 2024
@kkinnunen-apple kkinnunen-apple force-pushed the offscreencanvas-no-placeholder-data-1 branch from 229f611 to 1199811 Compare June 17, 2024 11:58
@kkinnunen-apple kkinnunen-apple requested review from mattwoodrow and removed request for rniwa and cdumez June 17, 2024 13:32
@kkinnunen-apple kkinnunen-apple added the merge-queue Applied to send a pull request to merge-queue label Jun 18, 2024
https://bugs.webkit.org/show_bug.cgi?id=275563
rdar://problem/129989623

Reviewed by Matt Woodrow.

OffscreenCanvas would use CanvasBase::buffer() to transfer the
offscreen canvas rendering to placeholder canvas.
The transfer is a draw operation from offscreen canvas and it changes
conceptually the placeholder *context*, not the placeholder canvas.

Implement this by adding PlaceholderRenderingContext::setPlaceholderBuffer().

Remove redundant ImageBufferPipe and OffscreenCanvasPlaceholderData
classes. PlaceholderRenderingContextSource is the thread-safe refcounted
interface to submit the placeholder buffer.

This is work towards making the rendering contexts be able to manage the
drawing and display buffers, by eventually removing the buffers from
CanvasBase.

* Source/WebCore/platform/graphics/nicosia/NicosiaPlaceholderRenderingContextSource.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp.
(Nicosia::NicosiaPlaceholderRenderingContextSource::NicosiaPlaceholderRenderingContextSource):
(Nicosia::NicosiaPlaceholderRenderingContextSource::~NicosiaPlaceholderRenderingContextSource):
(Nicosia::NicosiaPlaceholderRenderingContextSource::setPlaceholderBuffer):
(Nicosia::NicosiaPlaceholderRenderingContextSource::swapBuffersIfNeeded):
(Nicosia::NicosiaPlaceholderRenderingContextSource::setContentsToLayer):
(WebCore::PlaceholderRenderingContextSource::create):
* Source/WebCore/Headers.cmake:
* Source/WebCore/SmartPointerExpectations/UncountedCallArgsCheckerExpectations:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::transferControlToOffscreen):
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::DetachedOffscreenCanvas::DetachedOffscreenCanvas):
(WebCore::DetachedOffscreenCanvas::takePlaceholderSource):
(WebCore::OffscreenCanvas::create):
(WebCore::OffscreenCanvas::OffscreenCanvas):
(WebCore::OffscreenCanvas::detach):
(WebCore::OffscreenCanvas::commitToPlaceholderCanvas):
(WebCore::OffscreenCanvas::scheduleCommitToPlaceholderCanvas):
(WebCore::OffscreenCanvasPlaceholderData::create): Deleted.
(WebCore::OffscreenCanvasPlaceholderData::placeholder const): Deleted.
(WebCore::OffscreenCanvasPlaceholderData::pipeSource const): Deleted.
(WebCore::OffscreenCanvasPlaceholderData::OffscreenCanvasPlaceholderData): Deleted.
(WebCore::DetachedOffscreenCanvas::takePlaceholderData): Deleted.
* Source/WebCore/html/OffscreenCanvas.h:
* Source/WebCore/html/canvas/PlaceholderRenderingContext.cpp:
(WebCore::PlaceholderRenderingContextSource::create):
(WebCore::PlaceholderRenderingContextSource::PlaceholderRenderingContextSource):
(WebCore::PlaceholderRenderingContextSource::setPlaceholderBuffer):
(WebCore::PlaceholderRenderingContext::create):
(WebCore::PlaceholderRenderingContext::PlaceholderRenderingContext):
(WebCore::PlaceholderRenderingContext::canvas const):
(WebCore::PlaceholderRenderingContext::size const):
(WebCore::PlaceholderRenderingContext::setContentsToLayer):
(WebCore::PlaceholderRenderingContext::setPlaceholderBuffer):
* Source/WebCore/html/canvas/PlaceholderRenderingContext.h:
* Source/WebCore/platform/SourcesNicosia.txt:
* Source/WebCore/platform/graphics/ImageBufferPipe.cpp: Removed.
* Source/WebCore/platform/graphics/ImageBufferPipe.h: Removed.
* Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.h: Removed.

Canonical link: https://commits.webkit.org/280115@main
@webkit-commit-queue webkit-commit-queue force-pushed the offscreencanvas-no-placeholder-data-1 branch from 1199811 to 035c61a Compare June 18, 2024 08:43
@webkit-commit-queue
Copy link
Collaborator

Committed 280115@main (035c61a): https://commits.webkit.org/280115@main

Reviewed commits have been landed. Closing PR #29894 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 035c61a into WebKit:main Jun 18, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Canvas Bugs related to the canvas element.
Projects
None yet
5 participants