[BlackBerry] Update WebPageCompositor::render() API

https://bugs.webkit.org/show_bug.cgi?id=87565

Patch by Arvid Nilsson <anilsson@rim.com> on 2012-05-28
Reviewed by Rob Buis.

Source/WebCore:

The new API allows the embedder to specify the root transform and many
OpenGL related parameters.

Also refactor the code to allow several sets of layers to be rendered,
and to allow interleaving the rendering of layers with rendering of
buffers and checkerboard.

Reviewed internally by Filip Spacek.

PR #154334

* platform/graphics/blackberry/LayerCompositingThread.cpp:
(WebCore::LayerCompositingThread::drawTextures):
(WebCore::LayerCompositingThread::drawSurface):
* platform/graphics/blackberry/LayerRenderer.cpp:
(WebCore::LayerRenderer::orthoMatrix):
(WebCore::LayerRenderer::LayerRenderer):
(WebCore::LayerRenderer::prepareFrame):
(WebCore):
(WebCore::LayerRenderer::setViewport):
(WebCore::LayerRenderer::compositeLayers):
(WebCore::LayerRenderer::compositeBuffer):
(WebCore::LayerRenderer::drawCheckerboardPattern):
(WebCore::LayerRenderer::drawLayersOnSurfaces):
(WebCore::LayerRenderer::prepareFrameRecursive):
(WebCore::LayerRenderer::updateLayersRecursive):
(WebCore::LayerRenderer::compositeLayersRecursive):
(WebCore::LayerRenderer::updateScissorIfNeeded):
(WebCore::LayerRenderingResults::addHolePunchRect):
* platform/graphics/blackberry/LayerRenderer.h:
(LayerRenderer):

Source/WebKit/blackberry:

The new API allows the embedder to specify the root transform and many
OpenGL related parameters to be used when rendering the web page.

To honor the transform, we have to implement a way to composite the
BackingStore output using a generic transform. This method,
BackingStorePrivate::compositeContents(), uses a strategy that differs
from blitContents(), because that one is optimized for software
blitting, while this one is optimized for GPU rendering. Specifically,
instead of drawing the checkerboard first, and the rendered subregions
of the tile afterward, we draw the whole tile in one call, and then
draw checkered regions on top, if any.

Removed the blit generation condvar from the new code paths for drawing
BackingStore output using a transform, since the condvar is ineffective
in preventing flicker when we're not in charge of swapping the window.
Instead, another synchronization solution will be implemented in the
future.

Reviewed internally by Filip Spacek.
Some parts reviewed internally by Jacky Jiang and others by
Mike Lattanzio.

PR #151887, #154334

* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::render):
(BlackBerry::WebKit::BackingStorePrivate::blitContents):
(WebKit):
(BlackBerry::WebKit::BackingStorePrivate::compositeContents):
* Api/BackingStore_p.h:
(WebCore):
(BackingStorePrivate):
* Api/WebPageCompositor.cpp:
(BlackBerry::WebKit::WebPageCompositorPrivate::setContext):
(BlackBerry::WebKit::WebPageCompositorPrivate::setRootLayer):
(BlackBerry::WebKit::WebPageCompositorPrivate::prepareFrame):
(BlackBerry::WebKit::WebPageCompositorPrivate::render):
(BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers):
(BlackBerry::WebKit::WebPageCompositor::prepareFrame):
(BlackBerry::WebKit::WebPageCompositor::render):
* Api/WebPageCompositor.h:
* Api/WebPageCompositorClient.h:
* Api/WebPageCompositor_p.h:
(WebPageCompositorPrivate):
* WebCoreSupport/ChromeClientBlackBerry.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@118696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f0f0a276
2012-05-28 Arvid Nilsson <anilsson@rim.com>
[BlackBerry] Update WebPageCompositor::render() API
https://bugs.webkit.org/show_bug.cgi?id=87565
Reviewed by Rob Buis.
The new API allows the embedder to specify the root transform and many
OpenGL related parameters.
Also refactor the code to allow several sets of layers to be rendered,
and to allow interleaving the rendering of layers with rendering of
buffers and checkerboard.
Reviewed internally by Filip Spacek.
PR #154334
* platform/graphics/blackberry/LayerCompositingThread.cpp:
(WebCore::LayerCompositingThread::drawTextures):
(WebCore::LayerCompositingThread::drawSurface):
* platform/graphics/blackberry/LayerRenderer.cpp:
(WebCore::LayerRenderer::orthoMatrix):
(WebCore::LayerRenderer::LayerRenderer):
(WebCore::LayerRenderer::prepareFrame):
(WebCore):
(WebCore::LayerRenderer::setViewport):
(WebCore::LayerRenderer::compositeLayers):
(WebCore::LayerRenderer::compositeBuffer):
(WebCore::LayerRenderer::drawCheckerboardPattern):
(WebCore::LayerRenderer::drawLayersOnSurfaces):
(WebCore::LayerRenderer::prepareFrameRecursive):
(WebCore::LayerRenderer::updateLayersRecursive):
(WebCore::LayerRenderer::compositeLayersRecursive):
(WebCore::LayerRenderer::updateScissorIfNeeded):
(WebCore::LayerRenderingResults::addHolePunchRect):
* platform/graphics/blackberry/LayerRenderer.h:
(LayerRenderer):
2012-05-28 Antti Koivisto <antti@apple.com>
REGRESSION(r96517): Attribute selector fails to match dynamically modified style attribute
......
......@@ -187,7 +187,7 @@ FloatQuad LayerCompositingThread::getTransformedHolePunchRect() const
void LayerCompositingThread::drawTextures(int positionLocation, int texCoordLocation, const FloatRect& visibleRect)
{
float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 };
static float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 };
if (m_pluginView) {
if (m_isVisible) {
......@@ -279,7 +279,7 @@ void LayerCompositingThread::drawSurface(const TransformationMatrix& drawTransfo
FloatQuad surfaceQuad = getTransformedRect(m_bounds, IntRect(IntPoint::zero(), m_bounds), drawTransform);
glVertexAttribPointer(positionLocation, 2, GL_FLOAT, GL_FALSE, 0, &surfaceQuad);
float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 };
static float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 };
glVertexAttribPointer(texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, texcoords);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
......
......@@ -79,6 +79,8 @@ private:
class LayerRenderer {
WTF_MAKE_NONCOPYABLE(LayerRenderer);
public:
static TransformationMatrix orthoMatrix(float left, float right, float bottom, float top, float nearZ, float farZ);
static PassOwnPtr<LayerRenderer> create(BlackBerry::Platform::Graphics::GLES2Context*);
LayerRenderer(BlackBerry::Platform::Graphics::GLES2Context*);
......@@ -86,11 +88,26 @@ public:
void releaseLayerResources();
// Recomposites all the layers. Returns true if it needs more draw.
void drawLayers(const FloatRect& visibleRect, const IntRect& layoutRect, const IntSize& contentsSize, const IntRect& dstRect);
// In order to render the layers, you must do the following 3 operations, in order.
// 1. Upload textures and other operations that should be performed at the beginning of each frame.
// Note, this call also resets the last rendering results.
void prepareFrame(double animationTime, LayerCompositingThread* rootLayer);
void setRootLayer(LayerCompositingThread*);
LayerCompositingThread* rootLayer() { return m_rootLayer.get(); }
// 2. Set the OpenGL viewport and store other viewport-related parameters
// viewport is the GL viewport
// clipRect is an additional clip rect, if clipping is required beyond the clipping effect of the viewport.
// visibleRect is the subrect of the web page that you wish to composite, expressed in content coordinates
// The last two parameters are required to draw fixed position elements in the right place:
// layoutRect is the subrect of the web page that the WebKit thread believes is visible (scroll position, actual visible size).
// contentsSize is the contents size of the web page
void setViewport(const IntRect& viewport, const IntRect& clipRect, const FloatRect& visibleRect, const IntRect& layoutRect, const IntSize& contentsSize);
// 3. Prepares all the layers for compositing
// transform is the model-view-project matrix that goes all the way from contents to normalized device coordinates.
void compositeLayers(const TransformationMatrix&, LayerCompositingThread* rootLayer);
void compositeBuffer(const TransformationMatrix&, const FloatRect& contents, BlackBerry::Platform::Graphics::Buffer*, float opacity);
void drawCheckerboardPattern(const TransformationMatrix&, const FloatRect& contents);
// Keep track of layers that need cleanup when the LayerRenderer is destroyed
void addLayer(LayerCompositingThread*);
......@@ -118,7 +135,8 @@ public:
bool layerAlreadyOnSurface(LayerCompositingThread*) const;
private:
void updateLayersRecursive(LayerCompositingThread*, const TransformationMatrix& parentMatrix, Vector<RefPtr<LayerCompositingThread> >& surfaceLayers, float opacity, FloatRect clipRect, double currentTime);
void prepareFrameRecursive(LayerCompositingThread*, double animationTime, bool isContextCurrent);
void updateLayersRecursive(LayerCompositingThread*, const TransformationMatrix& parentMatrix, Vector<RefPtr<LayerCompositingThread> >& surfaceLayers, float opacity, FloatRect clipRect);
void compositeLayersRecursive(LayerCompositingThread*, int stencilValue, FloatRect clipRect);
void updateScissorIfNeeded(const FloatRect& clipRect);
......@@ -158,14 +176,14 @@ private:
int m_checkerSurfaceHeightLocation;
// Current draw configuration.
double m_animationTime;
FloatRect m_visibleRect;
IntRect m_layoutRect;
IntSize m_contentsSize;
IntRect m_viewport;
IntRect m_scissorRect;
RefPtr<LayerCompositingThread> m_rootLayer;
IntRect m_viewport; // In render target coordinates
IntRect m_scissorRect; // In render target coordinates
FloatRect m_clipRect; // In normalized device coordinates
unsigned m_fbo;
LayerRendererSurface* m_currentLayerRendererSurface;
......
......@@ -1028,8 +1028,6 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect)
m_suspendBackingStoreUpdates ? "true" : "false");
#endif
bool blittingDirectlyToCompositingWindow = isOpenGLCompositing();
BackingStoreGeometry* currentState = frontState();
TileMap currentMap = currentState->tileMap();
......@@ -1078,7 +1076,11 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect)
BlackBerry::Platform::Graphics::Buffer* nativeBuffer
= tile->backBuffer()->nativeBuffer();
if (blittingDirectlyToCompositingWindow) {
// This code is only needed for EGLImage code path, and only effective if we are swapping the render target.
// This combination is only true if there's a GLES2Usage window.
// FIXME: Use an EGL fence instead, PR152132
Window* window = m_webPage->client()->window();
if (window && window->windowUsage() == Window::GLES2Usage) {
pthread_mutex_lock(&m_blitGenerationLock);
while (m_blitGeneration == tile->backBuffer()->blitGeneration()) {
int err = pthread_cond_timedwait(&m_blitGenerationCond, &m_blitGenerationLock, &m_currentBlitEnd);
......@@ -1532,8 +1534,6 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect,
}
}
bool blittingDirectlyToCompositingWindow = isOpenGLCompositing();
#if USE(ACCELERATED_COMPOSITING)
if (WebPageCompositorPrivate* compositor = m_webPage->d->compositor()) {
WebCore::FloatRect contentsRect = m_webPage->d->mapFromTransformedFloatRect(WebCore::FloatRect(WebCore::IntRect(contents)));
......@@ -1542,7 +1542,7 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect,
paintDefaultBackground(contents, transformation, false /*flush*/);
}
if (!blittingDirectlyToCompositingWindow)
if (!isOpenGLCompositing())
blendCompositingSurface(dstRect);
#endif
......@@ -1604,7 +1604,11 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect,
invalidateWindow(dstRect);
if (blittingDirectlyToCompositingWindow && !blittedTiles.isEmpty()) {
// This code is only needed for EGLImage code path, and only effective if we are swapping the render target.
// This combination is only true if there's a GLES2Usage window.
// FIXME: Use an EGL fence instead
Window* window = m_webPage->client()->window();
if (window && window->windowUsage() == Window::GLES2Usage && !blittedTiles.isEmpty()) {
pthread_mutex_lock(&m_blitGenerationLock);
++m_blitGeneration;
......@@ -1623,6 +1627,73 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect,
}
}
#if USE(ACCELERATED_COMPOSITING)
void BackingStorePrivate::compositeContents(WebCore::LayerRenderer* layerRenderer, const WebCore::TransformationMatrix& transform, const WebCore::FloatRect& contents)
{
const Platform::IntRect transformedContentsRect = Platform::IntRect(Platform::IntPoint(0, 0), m_client->transformedContentsSize());
Platform::IntRect transformedContents = enclosingIntRect(m_webPage->d->m_transformationMatrix->mapRect(contents));
transformedContents.intersect(transformedContentsRect);
if (transformedContents.isEmpty())
return;
if (!isActive())
return;
if (m_webPage->d->compositorDrawsRootLayer())
return;
BackingStoreGeometry* currentState = frontState();
TileMap currentMap = currentState->tileMap();
Platform::IntRectRegion transformedContentsRegion = transformedContents;
Platform::IntRectRegion backingStoreRegion = currentState->backingStoreRect();
Platform::IntRectRegion checkeredRegion
= Platform::IntRectRegion::subtractRegions(transformedContentsRegion, backingStoreRegion);
// Blit checkered to those parts that are not covered by the backingStoreRect.
IntRectList checkeredRects = checkeredRegion.rects();
for (size_t i = 0; i < checkeredRects.size(); ++i)
layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(WebCore::IntRect(checkeredRects.at(i))));
// Get the list of tile rects that makeup the content.
TileRectList tileRectList = mapFromTransformedContentsToTiles(transformedContents, currentState);
for (size_t i = 0; i < tileRectList.size(); ++i) {
TileRect tileRect = tileRectList[i];
TileIndex index = tileRect.first;
Platform::IntRect dirtyTileRect = tileRect.second;
BackingStoreTile* tile = currentMap.get(index);
TileBuffer* tileBuffer = tile->frontBuffer();
// This dirty rect is in tile coordinates, but it needs to be in
// transformed contents coordinates.
Platform::IntRect dirtyRect = mapFromTilesToTransformedContents(tileRect, currentState->backingStoreRect());
if (!dirtyRect.intersects(transformedContents))
continue;
TileRect wholeTileRect;
wholeTileRect.first = index;
wholeTileRect.second = this->tileRect();
Platform::IntRect wholeRect = mapFromTilesToTransformedContents(wholeTileRect, currentState->backingStoreRect());
bool committed = tile->isCommitted();
if (!committed)
layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(dirtyRect)));
else {
layerRenderer->compositeBuffer(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(wholeRect)), tileBuffer->nativeBuffer(), 1.0f);
// Intersect the rendered region.
Platform::IntRectRegion notRenderedRegion = Platform::IntRectRegion::subtractRegions(dirtyTileRect, tileBuffer->renderedRegion());
IntRectList notRenderedRects = notRenderedRegion.rects();
for (size_t i = 0; i < notRenderedRects.size(); ++i)
layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(notRenderedRects.at(i))));
}
}
}
#endif
Platform::IntRect BackingStorePrivate::blitTileRect(TileBuffer* tileBuffer,
const TileRect& tileRect,
const Platform::IntPoint& origin,
......
......@@ -32,6 +32,8 @@
namespace WebCore {
class IntRect;
class FloatRect;
class LayerRenderer;
class TransformationMatrix;
}
......@@ -196,8 +198,15 @@ public:
Platform::IntRect blitTileRect(TileBuffer*, const TileRect&, const Platform::IntPoint&, const WebCore::TransformationMatrix&, BackingStoreGeometry*);
#if USE(ACCELERATED_COMPOSITING)
// Use instead of blitContents if you need more control over OpenGL state.
// Note that contents is expressed in untransformed content coordinates.
// Preconditions: You have to call prepareFrame and setViewport on the LayerRenderer before
// calling this.
void compositeContents(WebCore::LayerRenderer*, const WebCore::TransformationMatrix&, const WebCore::FloatRect& contents);
void blendCompositingSurface(const Platform::IntRect& dstRect);
void clearCompositingSurface();
bool drawLayersOnCommitIfNeeded();
void drawAndBlendLayersForDirectRendering(const Platform::IntRect& dirtyRect);
// WebPage will call this when drawing layers to tell us we don't need to
......
......@@ -34,6 +34,7 @@
#include <BlackBerryPlatformMessageClient.h>
#include <GenericTimerClient.h>
#include <ThreadTimerClient.h>
#include <wtf/CurrentTime.h>
using namespace WebCore;
......@@ -65,7 +66,6 @@ void WebPageCompositorPrivate::setContext(Platform::Graphics::GLES2Context* cont
}
m_layerRenderer = LayerRenderer::create(m_context);
m_layerRenderer->setRootLayer(m_rootLayer.get());
}
bool WebPageCompositorPrivate::hardwareCompositing() const
......@@ -76,34 +76,56 @@ bool WebPageCompositorPrivate::hardwareCompositing() const
void WebPageCompositorPrivate::setRootLayer(LayerCompositingThread* rootLayer)
{
m_rootLayer = rootLayer;
if (m_layerRenderer)
m_layerRenderer->setRootLayer(m_rootLayer.get());
}
void WebPageCompositorPrivate::commit(LayerWebKitThread* rootLayer)
void WebPageCompositorPrivate::prepareFrame(double animationTime)
{
if (!rootLayer)
if (!m_layerRenderer)
return;
rootLayer->commitOnCompositingThread();
// Unfortunately, we have to use currentTime() because the animations are
// started in that time coordinate system.
animationTime = currentTime();
if (m_rootLayer)
m_layerRenderer->prepareFrame(animationTime, m_rootLayer.get());
}
void WebPageCompositorPrivate::render(const IntRect& dstRect, const IntRect& transformedContents)
void WebPageCompositorPrivate::render(const IntRect& targetRect, const IntRect& clipRect, const TransformationMatrix& transformIn, const FloatRect& transformedContents, const FloatRect& /*viewport*/)
{
// It's not safe to call into the BackingStore if the compositor hasn't been set yet.
// For thread safety, we have to do it using a round-trip to the WebKit thread, so the
// embedder might call this before the round-trip to WebPagePrivate::setCompositor() is
// done.
if (m_webPage->compositor() != this)
if (!m_layerRenderer) {
// It's not safe to call into the BackingStore if the compositor hasn't been set yet.
// For thread safety, we have to do it using a round-trip to the WebKit thread, so the
// embedder might call this before the round-trip to WebPagePrivate::setCompositor() is
// done.
if (m_webPage->compositor() != this)
return;
// The clip rect is in OpenGL coordinate system, so turn it upside down to get to window coordinates.
IntRect dstRect(clipRect.x(), m_context->surfaceSize().height() - clipRect.y() - clipRect.height(), clipRect.width(), clipRect.height());
m_webPage->m_backingStore->d->blitContents(dstRect, enclosingIntRect(transformedContents), true);
return;
}
// The BackingStore is the root layer
if (BackingStore* backingStore = m_webPage->m_backingStore)
backingStore->d->blitContents(dstRect, transformedContents, true);
else {
FloatRect contents = m_webPage->mapFromTransformedFloatRect(FloatRect(transformedContents));
drawLayers(dstRect, contents);
m_layerRenderer->setClearSurfaceOnDrawLayers(false);
FloatRect contents = m_webPage->mapFromTransformedFloatRect(transformedContents);
m_layerRenderer->setViewport(targetRect, clipRect, contents, m_layoutRectForCompositing, m_contentsSizeForCompositing);
TransformationMatrix transform(transformIn);
transform *= *m_webPage->m_transformationMatrix;
if (!drawsRootLayer())
m_webPage->m_backingStore->d->compositeContents(m_layerRenderer.get(), transform, contents);
if (m_rootLayer)
m_layerRenderer->compositeLayers(transform, m_rootLayer.get());
m_lastCompositingResults = m_layerRenderer->lastRenderingResults();
if (m_lastCompositingResults.needsAnimationFrame) {
Platform::AnimationFrameRateController::instance()->addClient(this);
m_webPage->updateDelegatedOverlays();
}
}
......@@ -122,7 +144,25 @@ bool WebPageCompositorPrivate::drawLayers(const IntRect& dstRect, const FloatRec
shouldClear = shouldClear || !backingStore->d->isOpenGLCompositing();
m_layerRenderer->setClearSurfaceOnDrawLayers(shouldClear);
m_layerRenderer->drawLayers(contents, m_layoutRectForCompositing, m_contentsSizeForCompositing, dstRect);
// OpenGL window coordinates origin is at the lower left corner of the surface while
// WebKit uses upper left as the origin of the window coordinate system. The passed in 'dstRect'
// is in WebKit window coordinate system. Here we setup the viewport to the corresponding value
// in OpenGL window coordinates.
m_layerRenderer->prepareFrame(currentTime(), m_rootLayer.get());
int viewportY = std::max(0, m_context->surfaceSize().height() - dstRect.maxY());
IntRect viewport = IntRect(dstRect.x(), viewportY, dstRect.width(), dstRect.height());
m_layerRenderer->setViewport(viewport, viewport, contents, m_layoutRectForCompositing, m_contentsSizeForCompositing);
// WebKit uses row vectors which are multiplied by the matrix on the left (i.e. v*M)
// Transformations are composed on the left so that M1.xform(M2) means M2*M1
// We therefore start with our (othogonal) projection matrix, which will be applied
// as the last transformation.
TransformationMatrix transform = LayerRenderer::orthoMatrix(0, contents.width(), contents.height(), 0, -1000, 1000);
transform.translate3d(-contents.x(), -contents.y(), 0);
if (m_rootLayer)
m_layerRenderer->compositeLayers(transform, m_rootLayer.get());
m_lastCompositingResults = m_layerRenderer->lastRenderingResults();
if (m_lastCompositingResults.needsAnimationFrame) {
......@@ -202,15 +242,21 @@ WebPageCompositorClient* WebPageCompositor::client() const
return d->client();
}
void WebPageCompositor::prepareFrame(Platform::Graphics::GLES2Context* context, double timestamp)
void WebPageCompositor::prepareFrame(Platform::Graphics::GLES2Context* context, double animationTime)
{
d->setContext(context);
d->prepareFrame(animationTime);
}
void WebPageCompositor::render(Platform::Graphics::GLES2Context* context, const Platform::IntRect& dstRect, const Platform::IntRect& contents)
void WebPageCompositor::render(Platform::Graphics::GLES2Context* context,
const Platform::IntRect& targetRect,
const Platform::IntRect& clipRect,
const Platform::TransformationMatrix& transform,
const Platform::FloatRect& contents,
const Platform::FloatRect& viewport)
{
d->setContext(context);
d->render(dstRect, contents);
d->render(targetRect, clipRect, TransformationMatrix(reinterpret_cast<const TransformationMatrix&>(transform)), contents, viewport);
}
void WebPageCompositor::cleanup(Platform::Graphics::GLES2Context* context)
......@@ -252,7 +298,12 @@ void WebPageCompositor::prepareFrame(Platform::Graphics::GLES2Context*, double)
{
}
void WebPageCompositor::render(Platform::Graphics::GLES2Context*, const Platform::IntRect&, const Platform::IntRect&)
void WebPageCompositor::render(Platform::Graphics::GLES2Context*,
const Platform::IntRect&,
const Platform::IntRect&,
const Platform::TransformationMatrix&,
const Platform::FloatRect&,
const Platform::FloatRect&)
{
}
......
......@@ -39,10 +39,14 @@ public:
WebPageCompositorClient* client() const;
void prepareFrame(Platform::Graphics::GLES2Context*, double timestamp);
// FIXME: dstRect should be a Platform::TransformationMatrix instead. PR142628
void render(Platform::Graphics::GLES2Context*, const Platform::IntRect& dstRect, const Platform::IntRect& contents);
void prepareFrame(Platform::Graphics::GLES2Context*, double animationTime);
void render(Platform::Graphics::GLES2Context*,
const Platform::IntRect& targetRect,
const Platform::IntRect& clipRect,
const Platform::TransformationMatrix&,
const Platform::FloatRect& contents,
const Platform::FloatRect& viewport);
void cleanup(Platform::Graphics::GLES2Context*);
......
......@@ -32,7 +32,6 @@ public:
virtual double requestAnimationFrame() = 0;
virtual void invalidate(double animationFrameTimestamp) = 0;
virtual void requestCleanup() = 0;
};
} // namespace WebKit
......
......@@ -50,6 +50,15 @@ public:
~WebPageCompositorPrivate();
// Public API
void prepareFrame(double animationTime);
void render(const WebCore::IntRect& targetRect,
const WebCore::IntRect& clipRect,
const WebCore::TransformationMatrix&,
const WebCore::FloatRect& contents, // This is public API, thus takes transformed contents
const WebCore::FloatRect& viewport);
// Internal
bool hardwareCompositing() const;
Platform::Graphics::GLES2Context* context() const { return m_context; }
......@@ -58,12 +67,6 @@ public:
WebCore::LayerCompositingThread* rootLayer() const { return m_rootLayer.get(); }
void setRootLayer(WebCore::LayerCompositingThread*);
void commit(WebCore::LayerWebKitThread* rootLayerProxy);
// This is mapped from the public API, thus takes transformed contents
void render(const WebCore::IntRect& dstRect, const WebCore::IntRect& transformedContents);
// Returns true if the WebPageCompositor draws the root layer, false if the BackingStore draws the root layer
bool drawsRootLayer() const;
void setDrawsRootLayer(bool drawsRootLayer) { m_drawsRootLayer = drawsRootLayer; }
......
2012-05-28 Arvid Nilsson <anilsson@rim.com>
[BlackBerry] Update WebPageCompositor::render() API
https://bugs.webkit.org/show_bug.cgi?id=87565
Reviewed by Rob Buis.
The new API allows the embedder to specify the root transform and many
OpenGL related parameters to be used when rendering the web page.
To honor the transform, we have to implement a way to composite the
BackingStore output using a generic transform. This method,
BackingStorePrivate::compositeContents(), uses a strategy that differs
from blitContents(), because that one is optimized for software
blitting, while this one is optimized for GPU rendering. Specifically,
instead of drawing the checkerboard first, and the rendered subregions
of the tile afterward, we draw the whole tile in one call, and then
draw checkered regions on top, if any.
Removed the blit generation condvar from the new code paths for drawing
BackingStore output using a transform, since the condvar is ineffective
in preventing flicker when we're not in charge of swapping the window.
Instead, another synchronization solution will be implemented in the
future.
Reviewed internally by Filip Spacek.
Some parts reviewed internally by Jacky Jiang and others by
Mike Lattanzio.
PR #151887, #154334
* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::render):
(BlackBerry::WebKit::BackingStorePrivate::blitContents):
(WebKit):
(BlackBerry::WebKit::BackingStorePrivate::compositeContents):
* Api/BackingStore_p.h:
(WebCore):
(BackingStorePrivate):
* Api/WebPageCompositor.cpp:
(BlackBerry::WebKit::WebPageCompositorPrivate::setContext):
(BlackBerry::WebKit::WebPageCompositorPrivate::setRootLayer):
(BlackBerry::WebKit::WebPageCompositorPrivate::prepareFrame):
(BlackBerry::WebKit::WebPageCompositorPrivate::render):
(BlackBerry::WebKit::WebPageCompositorPrivate::drawLayers):
(BlackBerry::WebKit::WebPageCompositor::prepareFrame):
(BlackBerry::WebKit::WebPageCompositor::render):
* Api/WebPageCompositor.h:
* Api/WebPageCompositorClient.h:
* Api/WebPageCompositor_p.h:
(WebPageCompositorPrivate):
* WebCoreSupport/ChromeClientBlackBerry.cpp:
2012-05-28 Arvid Nilsson <anilsson@rim.com>
[BlackBerry] Plumb through the return value of makeCurrent to caller
......
......@@ -36,6 +36,7 @@
#include "FrameLoader.h"
#include "Geolocation.h"
#include "GeolocationControllerClientBlackBerry.h"
#include "GraphicsLayer.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "HitTestResult.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment