Title: [88027] trunk/Source/WebKit2
- Revision
- 88027
- Author
- [email protected]
- Date
- 2011-06-03 09:54:12 -0700 (Fri, 03 Jun 2011)
Log Message
2011-06-03 No'am Rosenthal <[email protected]>
Reviewed by Andreas Kling.
[Qt][WK2] Make tiling on WebKit2 more responsive.
https://bugs.webkit.org/show_bug.cgi?id=50064
Instead of creating and destroying pixmaps, and copying them using QPixmap::copy()
or relying on the implicit sharing functionality, we keep the QPixmaps alive
and just make sure their content is synchronized.
This seems to improve responsiveness noticably, as now the UI process doesn't deal
with allocating/deallocating pixmaps, and the copies are done with the optimized
path (QPainter) vs the unoptimized ones (QPixmap::copy().)
* UIProcess/TiledDrawingAreaTile.h:
* UIProcess/qt/TiledDrawingAreaTileQt.cpp:
(WebKit::TiledDrawingAreaTile::TiledDrawingAreaTile):
(WebKit::TiledDrawingAreaTile::isReadyToPaint):
(WebKit::TiledDrawingAreaTile::hasReadyBackBuffer):
(WebKit::TiledDrawingAreaTile::swapBackBufferToFront):
(WebKit::TiledDrawingAreaTile::incorporateUpdate):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (88026 => 88027)
--- trunk/Source/WebKit2/ChangeLog 2011-06-03 16:26:15 UTC (rev 88026)
+++ trunk/Source/WebKit2/ChangeLog 2011-06-03 16:54:12 UTC (rev 88027)
@@ -1,3 +1,26 @@
+2011-06-03 No'am Rosenthal <[email protected]>
+
+ Reviewed by Andreas Kling.
+
+ [Qt][WK2] Make tiling on WebKit2 more responsive.
+ https://bugs.webkit.org/show_bug.cgi?id=50064
+
+ Instead of creating and destroying pixmaps, and copying them using QPixmap::copy()
+ or relying on the implicit sharing functionality, we keep the QPixmaps alive
+ and just make sure their content is synchronized.
+
+ This seems to improve responsiveness noticably, as now the UI process doesn't deal
+ with allocating/deallocating pixmaps, and the copies are done with the optimized
+ path (QPainter) vs the unoptimized ones (QPixmap::copy().)
+
+ * UIProcess/TiledDrawingAreaTile.h:
+ * UIProcess/qt/TiledDrawingAreaTileQt.cpp:
+ (WebKit::TiledDrawingAreaTile::TiledDrawingAreaTile):
+ (WebKit::TiledDrawingAreaTile::isReadyToPaint):
+ (WebKit::TiledDrawingAreaTile::hasReadyBackBuffer):
+ (WebKit::TiledDrawingAreaTile::swapBackBufferToFront):
+ (WebKit::TiledDrawingAreaTile::incorporateUpdate):
+
2011-06-03 Mikhail Naganov <[email protected]>
Reviewed by Yury Semikhatsky.
Modified: trunk/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h (88026 => 88027)
--- trunk/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h 2011-06-03 16:26:15 UTC (rev 88026)
+++ trunk/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h 2011-06-03 16:54:12 UTC (rev 88027)
@@ -80,6 +80,8 @@
#if PLATFORM(QT)
QPixmap m_buffer;
QPixmap m_backBuffer;
+ bool m_isBackBufferValid;
+ bool m_isFrontBufferValid;
QRegion m_dirtyRegion;
#endif
};
Modified: trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp (88026 => 88027)
--- trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp 2011-06-03 16:26:15 UTC (rev 88026)
+++ trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp 2011-06-03 16:54:12 UTC (rev 88027)
@@ -47,6 +47,8 @@
, m_coordinate(tileCoordinate)
, m_rect(proxy->tileRectForCoordinate(tileCoordinate))
, m_hasUpdatePending(false)
+ , m_isBackBufferValid(false)
+ , m_isFrontBufferValid(false)
, m_dirtyRegion(m_rect)
{
static int id = 0;
@@ -70,12 +72,12 @@
bool TiledDrawingAreaTile::isReadyToPaint() const
{
- return !m_buffer.isNull();
+ return m_isFrontBufferValid;
}
bool TiledDrawingAreaTile::hasReadyBackBuffer() const
{
- return !m_backBuffer.isNull() && !m_hasUpdatePending;
+ return m_isBackBufferValid && !m_hasUpdatePending;
}
void TiledDrawingAreaTile::invalidate(const IntRect& dirtyRect)
@@ -101,8 +103,11 @@
{
ASSERT(!m_backBuffer.isNull());
+ const QPixmap swap = m_buffer;
m_buffer = m_backBuffer;
- m_backBuffer = QPixmap();
+ m_isFrontBufferValid = m_isBackBufferValid;
+ m_isBackBufferValid = false;
+ m_backBuffer = swap;
}
void TiledDrawingAreaTile::paint(GraphicsContext* context, const IntRect& rect)
@@ -120,24 +125,22 @@
void TiledDrawingAreaTile::incorporateUpdate(const UpdateInfo& updateInfo, float)
{
+ m_isBackBufferValid = true;
+ m_hasUpdatePending = false;
+
RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.bitmapHandle);
QImage image(bitmap->createQImage());
const IntRect& updateChunkRect = updateInfo.updateRectBounds;
-#ifdef TILE_DEBUG_LOG
- qDebug() << "tile updated id=" << ID() << " rect=" << QRect(updateChunkRect);
-#endif
- if (updateChunkRect.size() == m_proxy->tileSize()) {
- // Make a deep copy of the image since it's in shared memory.
- m_backBuffer = QPixmap::fromImage(image.copy());
- } else {
- if (m_backBuffer.isNull())
- m_backBuffer = m_buffer.isNull() ? QPixmap(m_proxy->tileSize()) : m_buffer;
- QPainter painter(&m_backBuffer);
- IntSize drawPoint = updateChunkRect.location() - m_rect.location();
- painter.drawImage(QPoint(drawPoint.width(), drawPoint.height()), image);
- }
- m_hasUpdatePending = false;
+ const QSize tileSize = m_proxy->tileSize();
+
+ if (m_backBuffer.size() != tileSize)
+ m_backBuffer = QPixmap(tileSize);
+
+ QPainter painter(&m_backBuffer);
+ painter.drawPixmap(0, 0, m_buffer);
+ IntSize drawPoint = updateChunkRect.location() - m_rect.location();
+ painter.drawImage(QPoint(drawPoint.width(), drawPoint.height()), image);
}
void TiledDrawingAreaTile::updateBackBuffer()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes