[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