summaryrefslogtreecommitdiffstats
path: root/src/core/render_widget_host_view_qt.cpp
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2016-12-23 14:03:03 +0100
committerMichael BrĂ¼ning <michael.bruning@qt.io>2017-01-11 08:49:37 +0000
commit4804e331304c5bcb79ebc785485793e5f1d8759e (patch)
tree7f484e566ef7bab9a5dae07410510d7b872eaf65 /src/core/render_widget_host_view_qt.cpp
parent17f9e58022b181b1a097ec75cf824714778c8946 (diff)
Optimize scene graph rendering by reusing old nodes if possible
Previously, Qt WebEngine always dropped all existing scene graph nodes that were created for previous frames and built up a whole new tree. The main reason for this was that the render pass structure is not guaranteed to remain the same across two frames. This resulted in a full repaint of every new frame, even if only a small area had changed. We now check first if the structure of the frame data has changed across two sequential frames. We only discard the old nodes if there actually has been a change. Otherwise, we reuse the scene graph nodes and only update the nodes that have changed. A general exception to this at the moment is video. In case any streaming video or yuv video nodes are found in the render pass, all nodes get recreated. Task-number: QTBUG-57720 Change-Id: I8998577af48a163d54144f205c316ee427ed0307 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r--src/core/render_widget_host_view_qt.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 70ffe0dcb..fef3831e3 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -666,6 +666,8 @@ void RenderWidgetHostViewQt::OnSwapCompositorFrame(uint32_t output_surface_id, c
m_pendingOutputSurfaceId = output_surface_id;
Q_ASSERT(frame.delegated_frame_data);
Q_ASSERT(!m_chromiumCompositorData->frameData || m_chromiumCompositorData->frameData->resource_list.empty());
+ if (m_chromiumCompositorData->frameData.get())
+ m_chromiumCompositorData->previousFrameData = std::move(m_chromiumCompositorData->frameData);
m_chromiumCompositorData->frameData = std::move(frame.delegated_frame_data);
m_chromiumCompositorData->frameDevicePixelRatio = frame.metadata.device_scale_factor;