Title: [269331] trunk/Source
- Revision
- 269331
- Author
- [email protected]
- Date
- 2020-11-03 13:24:17 -0800 (Tue, 03 Nov 2020)
Log Message
[GPU Process] Flush canvas displayList from doAfterUpdateRendering
https://bugs.webkit.org/show_bug.cgi?id=218401
Patch by Rini Patel <[email protected]> on 2020-11-03
Reviewed by Simon Fraser.
Source/WebCore:
Leverage prepareCanvasesForDisplayIfNeeded() for canvas 2D context to flush the display list items via doAfterUpdateRendering.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createContext2d):
(WebCore::HTMLCanvasElement::prepareForDisplay):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::prepareForDisplay):
* html/canvas/CanvasRenderingContext2DBase.h:
* platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::flushDrawingContextAndCommit):
Source/WebKit:
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::flushDrawingContextAndCommit): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (269330 => 269331)
--- trunk/Source/WebCore/ChangeLog 2020-11-03 21:08:38 UTC (rev 269330)
+++ trunk/Source/WebCore/ChangeLog 2020-11-03 21:24:17 UTC (rev 269331)
@@ -1,3 +1,21 @@
+2020-11-03 Rini Patel <[email protected]>
+
+ [GPU Process] Flush canvas displayList from doAfterUpdateRendering
+ https://bugs.webkit.org/show_bug.cgi?id=218401
+
+ Reviewed by Simon Fraser.
+
+ Leverage prepareCanvasesForDisplayIfNeeded() for canvas 2D context to flush the display list items via doAfterUpdateRendering.
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::createContext2d):
+ (WebCore::HTMLCanvasElement::prepareForDisplay):
+ * html/canvas/CanvasRenderingContext2DBase.cpp:
+ (WebCore::CanvasRenderingContext2DBase::prepareForDisplay):
+ * html/canvas/CanvasRenderingContext2DBase.h:
+ * platform/graphics/ImageBuffer.h:
+ (WebCore::ImageBuffer::flushDrawingContextAndCommit):
+
2020-11-03 Wenson Hsieh <[email protected]>
Replace DisplayList::Recorder::Delegate::(will|did)AppendItem with (will|did)AppendItemOfType
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (269330 => 269331)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2020-11-03 21:08:38 UTC (rev 269330)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2020-11-03 21:24:17 UTC (rev 269331)
@@ -950,6 +950,9 @@
const_cast<HTMLCanvasElement*>(this)->invalidateStyleAndLayerComposition();
}
#endif
+
+ if (m_context && buffer() && buffer()->prefersPreparationForDisplay())
+ const_cast<HTMLCanvasElement*>(this)->addObserver(document());
}
void HTMLCanvasElement::setImageBufferAndMarkDirty(RefPtr<ImageBuffer>&& buffer)
@@ -1073,12 +1076,10 @@
void HTMLCanvasElement::prepareForDisplay()
{
-#if ENABLE(WEBGL)
ASSERT(needsPreparationForDisplay());
if (m_context)
m_context->prepareForDisplay();
-#endif
}
bool HTMLCanvasElement::isControlledByOffscreen() const
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (269330 => 269331)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp 2020-11-03 21:08:38 UTC (rev 269330)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp 2020-11-03 21:24:17 UTC (rev 269331)
@@ -2039,6 +2039,21 @@
return canvasBase().drawingContext();
}
+void CanvasRenderingContext2DBase::prepareForDisplay()
+{
+ if (auto buffer = canvasBase().buffer())
+ buffer->flushDrawingContextAndCommit();
+}
+
+bool CanvasRenderingContext2DBase::needsPreparationForDisplay() const
+{
+ auto buffer = canvasBase().buffer();
+ if (buffer && buffer->prefersPreparationForDisplay())
+ return true;
+
+ return false;
+}
+
static RefPtr<ImageData> createEmptyImageData(const IntSize& size)
{
auto data = ""
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h (269330 => 269331)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h 2020-11-03 21:08:38 UTC (rev 269330)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h 2020-11-03 21:24:17 UTC (rev 269331)
@@ -307,6 +307,8 @@
void didDrawEntireCanvas();
void paintRenderingResultsToCanvas() override;
+ bool needsPreparationForDisplay() const final;
+ void prepareForDisplay() final;
GraphicsContext* drawingContext() const;
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (269330 => 269331)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2020-11-03 21:08:38 UTC (rev 269330)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2020-11-03 21:24:17 UTC (rev 269331)
@@ -69,7 +69,9 @@
virtual void flushContext() = 0;
virtual DisplayList::DrawingContext* drawingContext() { return nullptr; }
+ virtual bool prefersPreparationForDisplay() { return false; }
virtual void flushDrawingContext() { }
+ virtual void flushDrawingContextAndCommit() { }
virtual void flushDisplayList(const DisplayList::DisplayList&) { }
virtual AffineTransform baseTransform() const = 0;
Modified: trunk/Source/WebKit/ChangeLog (269330 => 269331)
--- trunk/Source/WebKit/ChangeLog 2020-11-03 21:08:38 UTC (rev 269330)
+++ trunk/Source/WebKit/ChangeLog 2020-11-03 21:24:17 UTC (rev 269331)
@@ -1,3 +1,13 @@
+2020-11-03 Rini Patel <[email protected]>
+
+ [GPU Process] Flush canvas displayList from doAfterUpdateRendering
+ https://bugs.webkit.org/show_bug.cgi?id=218401
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
+ (WebKit::RemoteImageBufferProxy::flushDrawingContextAndCommit): Deleted.
+
2020-11-03 Wenson Hsieh <[email protected]>
Replace DisplayList::Recorder::Delegate::(will|did)AppendItem with (will|did)AppendItemOfType
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (269330 => 269331)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h 2020-11-03 21:08:38 UTC (rev 269330)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h 2020-11-03 21:24:17 UTC (rev 269331)
@@ -122,9 +122,10 @@
// This means that putImageData() is only called when m_resolutionScale == 1.
ASSERT(m_backend->resolutionScale() == 1);
m_drawingContext.recorder().putImageData(inputFormat, imageData, srcRect, destPoint, destFormat);
- flushDrawingContextAndCommit();
}
+ bool prefersPreparationForDisplay() override { return true; }
+
void flushContext() override
{
flushDrawingContext();
@@ -137,7 +138,7 @@
timeoutWaitForFlushDisplayListWasCommitted();
}
- void flushDrawingContextAndCommit()
+ void flushDrawingContextAndCommit() override
{
if (!m_remoteRenderingBackendProxy)
return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes