[BlackBerry] WebGL and 2D canvas output not available to WebPageCompositor

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

Patch by Arvid Nilsson <anilsson@rim.com> on 2012-05-31
Reviewed by George Staikos.

Properly set up resource sharing between WebKit thread EGL contexts and
the compositing thread EGL context, so the texture ID produced by WebGL
and 2D canvas makes sense to the compositing context.

There's no public API to supply an EGLContext yet, so we're lucky that
the embedder never makes its context un-current. Just grab the current
context on the compositing thread and use that as the compositing
context.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::setCompositor):
* Api/WebPageCompositor.cpp:
(BlackBerry::WebKit::WebPageCompositor::WebPageCompositor):
(BlackBerry::WebKit::WebPageCompositor::~WebPageCompositor):
* Api/WebPage_p.h:
(WebPagePrivate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 80fce6ee
......@@ -5664,14 +5664,23 @@ GraphicsLayer* WebPagePrivate::overlayLayer()
return m_overlayLayer.get();
}
void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> compositor)
void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> compositor, EGLContext compositingContext)
{
using namespace BlackBerry::Platform;
// The m_compositor member has to be modified during a sync call for thread
// safe access to m_compositor and its refcount.
if (!userInterfaceThreadMessageClient()->isCurrentThread()) {
userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, this, compositor));
// We depend on the current thread being the WebKit thread when it's not the Compositing thread.
// That seems extremely likely to be the case, but let's assert just to make sure.
ASSERT(webKitThreadMessageClient()->isCurrentThread());
// This method call always round-trips on the WebKit thread (see WebPageCompositor::WebPageCompositor() and ~WebPageCompositor()),
// and the compositing context must be set on the WebKit thread. How convenient!
if (compositingContext != EGL_NO_CONTEXT)
BlackBerry::Platform::Graphics::setCompositingContext(compositingContext);
userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, this, compositor, compositingContext));
return;
}
......
......@@ -32,6 +32,7 @@
#include <BlackBerryPlatformExecutableMessage.h>
#include <BlackBerryPlatformMessage.h>
#include <BlackBerryPlatformMessageClient.h>
#include <EGL/egl.h>
#include <GenericTimerClient.h>
#include <ThreadTimerClient.h>
#include <wtf/CurrentTime.h>
......@@ -259,7 +260,7 @@ WebPageCompositor::WebPageCompositor(WebPage* page, WebPageCompositorClient* cli
// This ensures that the compositor will be around for as long as it's
// needed. Unfortunately RefPtr<T> is not public, so we have declare to
// resort to manual refcounting.
webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), tmp));
webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), tmp, eglGetCurrentContext()));
}
WebPageCompositor::~WebPageCompositor()
......@@ -268,7 +269,7 @@ WebPageCompositor::~WebPageCompositor()
// If we're being destroyed before the page, send a message to disconnect us
if (d->page())
webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), PassRefPtr<WebPageCompositorPrivate>(0)));
webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), PassRefPtr<WebPageCompositorPrivate>(0), EGL_NO_CONTEXT));
d->compositorDestroyed();
d->deref();
}
......
......@@ -24,6 +24,7 @@
#if USE(ACCELERATED_COMPOSITING)
#include "GLES2Context.h"
#include "LayerRenderer.h"
#include <EGL/egl.h>
#endif
#include "KURL.h"
#include "PageClientBlackBerry.h"
......@@ -393,7 +394,7 @@ public:
void commitRootLayer(const WebCore::IntRect&, const WebCore::IntSize&, bool);
bool isAcceleratedCompositingActive() const { return m_compositor; }
WebPageCompositorPrivate* compositor() const { return m_compositor.get(); }
void setCompositor(PassRefPtr<WebPageCompositorPrivate>);
void setCompositor(PassRefPtr<WebPageCompositorPrivate>, EGLContext compositingContext);
bool createCompositor();
void destroyCompositor();
void syncDestroyCompositorOnCompositingThread();
......
2012-05-31 Arvid Nilsson <anilsson@rim.com>
[BlackBerry] WebGL and 2D canvas output not available to WebPageCompositor
https://bugs.webkit.org/show_bug.cgi?id=88012
Reviewed by George Staikos.
Properly set up resource sharing between WebKit thread EGL contexts and
the compositing thread EGL context, so the texture ID produced by WebGL
and 2D canvas makes sense to the compositing context.
There's no public API to supply an EGLContext yet, so we're lucky that
the embedder never makes its context un-current. Just grab the current
context on the compositing thread and use that as the compositing
context.
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::setCompositor):
* Api/WebPageCompositor.cpp:
(BlackBerry::WebKit::WebPageCompositor::WebPageCompositor):
(BlackBerry::WebKit::WebPageCompositor::~WebPageCompositor):
* Api/WebPage_p.h:
(WebPagePrivate):
2012-05-31 George Staikos <staikos@webkit.org>
[Blackberry] Initialize the select client and delete the pointer
......
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