[Qt][WK2] Manage graphics buffers in the web process
authornoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Apr 2012 21:52:39 +0000 (21:52 +0000)
committernoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Apr 2012 21:52:39 +0000 (21:52 +0000)
commit693a9bc40b784ab0607ad31ac631dd811d5ecb20
tree83b1e3b472e39ff4edc2464dbb6c4422344810f2
parent3580568b5e67a1ceac6a8231298b11c53a788d0e
[Qt][WK2] Manage graphics buffers in the web process
https://bugs.webkit.org/show_bug.cgi?id=78675

Source/WebCore:

Added WebCore::GraphicsSurface, a wrapper class to a platform-dependant
surface that can be accessed efficiently by both the CPU and the GPU.
This will allow fast texture uploads for WebKit2, and in the future
fast copies for 2D canvas and WebGL.
The first implementation is for Mac using IOSurfaces.

TextureMapperGL had to be modified to use GL_UNSIGNED_INT_8_8_8_8_REV
for textures on Mac, since that's the native pixel format of BGRA
IOSurfaces.

Though this feature is not written in a Qt-specific way, it's currently
only enabled for Qt and is protected by USE(GRAPHICS_SURFACE).

Reviewed by Kenneth Rohde Christiansen.

Covered by existing API tests.

* Target.pri:
* WebCore.pri:
* platform/graphics/surfaces/GraphicsSurface.cpp: Added.
* platform/graphics/surfaces/GraphicsSurface.h: Added.
* platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp: Added.
* platform/graphics/surfaces/qt/GraphicsSurfaceQt.cpp: Added.
(WebCore::GraphicsSurface::didReleaseImage):
(WebCore):
(WebCore::GraphicsSurface::platformBeginPaint):
(WebCore::GraphicsSurface::createReadOnlyImage):
* platform/graphics/texmap/TextureMapper.h:
(WebCore::BitmapTexture::isOpenGLBacked):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::toBitmapTextureGL):
(WebCore):
(WebCore::BitmapTextureGL::didReset):
(WebCore::BitmapTextureGL::updateContents):
* platform/graphics/texmap/TextureMapperGL.h:
(WebCore::BitmapTextureGL::isOpenGLBacked):
(WebCore):

Source/WebKit2:

Added ShareableSurface, a class allowing the use of GPU-enabled
surfaces for bitmap transfer between the web and UI processes.
Since GraphicsSurfaces may not always be available, ShareableSurface
uses a standard ShareableBitmap as a fallback backend.

The necessary plumbing was added in WebKit2 for passing updates via
ShareableSurfaces instead of ShareableBitmaps. SurfaceUpdateInfo was
added, as to not make UpdateInfo more complicated.

Reviewed by Kenneth Rohde Christiansen.

* Shared/ShareableSurface.cpp: Added.
* Shared/ShareableSurface.h: Added.
* Shared/SurfaceUpdateInfo.cpp: Added.
* Shared/SurfaceUpdateInfo.h: Added.
* Target.pri:
* UIProcess/LayerTreeHostProxy.cpp:
(WebKit::LayerTreeHostProxy::createTileForLayer):
(WebKit::LayerTreeHostProxy::updateTileForLayer):
* UIProcess/LayerTreeHostProxy.h:
(LayerTreeHostProxy):
* UIProcess/LayerTreeHostProxy.messages.in:
* UIProcess/WebLayerTreeRenderer.cpp:
(WebKit::WebLayerTreeRenderer::updateTile):
* UIProcess/WebLayerTreeRenderer.h:
(TileUpdate):
(WebKit::WebLayerTreeRenderer::TileUpdate::TileUpdate):
* UIProcess/qt/LayerBackingStore.cpp:
(WebKit::LayerBackingStoreTile::swapBuffers):
(WebKit::LayerBackingStoreTile::setBackBuffer):
(WebKit::LayerBackingStore::updateTile):
* UIProcess/qt/LayerBackingStore.h:
(LayerBackingStoreTile):
(LayerBackingStore):
* WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::beginContentUpdate):
(WebCore::WebGraphicsLayer::createTile):
(WebCore::WebGraphicsLayer::updateTile):
* WebProcess/WebCoreSupport/WebGraphicsLayer.h:
(WebGraphicsLayerClient):
(WebGraphicsLayer):
* WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp:
(WebKit::TiledBackingStoreRemoteTile::updateBackBuffer):
* WebProcess/WebPage/TiledBackingStoreRemoteTile.h:
(WebKit):
(TiledBackingStoreRemoteTileClient):
* WebProcess/WebPage/UpdateAtlas.cpp:
(WebKit::UpdateAtlas::UpdateAtlas):
(WebKit::UpdateAtlas::beginPaintingOnAvailableBuffer):
* WebProcess/WebPage/UpdateAtlas.h:
(WebKit::UpdateAtlas::surface):
(WebKit::UpdateAtlas::size):
* WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
(WebKit::LayerTreeHostQt::createTile):
(WebKit::LayerTreeHostQt::updateTile):
(WebKit::LayerTreeHostQt::beginContentUpdate):
* WebProcess/WebPage/qt/LayerTreeHostQt.h:
(LayerTreeHostQt):

Tools:

Enable graphics surfaces on Mac for Qt.

Reviewed by Kenneth Rohde Christiansen.

* qmake/mkspecs/features/features.prf:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113773 268f45cc-cd09-0410-ab3c-d52691b4dbfc
33 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Target.pri
Source/WebCore/WebCore.pri
Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h [new file with mode: 0644]
Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceQt.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/texmap/TextureMapper.h
Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperGL.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/ShareableSurface.cpp [new file with mode: 0644]
Source/WebKit2/Shared/ShareableSurface.h [new file with mode: 0644]
Source/WebKit2/Shared/SurfaceUpdateInfo.cpp [new file with mode: 0644]
Source/WebKit2/Shared/SurfaceUpdateInfo.h [new file with mode: 0644]
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/LayerTreeHostProxy.cpp
Source/WebKit2/UIProcess/LayerTreeHostProxy.h
Source/WebKit2/UIProcess/LayerTreeHostProxy.messages.in
Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp
Source/WebKit2/UIProcess/WebLayerTreeRenderer.h
Source/WebKit2/UIProcess/qt/LayerBackingStore.cpp
Source/WebKit2/UIProcess/qt/LayerBackingStore.h
Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h
Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp
Source/WebKit2/WebProcess/WebPage/TiledBackingStoreRemoteTile.h
Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp
Source/WebKit2/WebProcess/WebPage/UpdateAtlas.h
Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp
Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h
Tools/ChangeLog
Tools/qmake/mkspecs/features/features.prf