Changeset 119185 in webkit


Ignore:
Timestamp:
May 31, 2012 6:37:40 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[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):

Location:
trunk/Source/WebKit/blackberry
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r119119 r119185  
    56655665}
    56665666
    5667 void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> compositor)
     5667void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> compositor, EGLContext compositingContext)
    56685668{
    56695669    using namespace BlackBerry::Platform;
     
    56725672    // safe access to m_compositor and its refcount.
    56735673    if (!userInterfaceThreadMessageClient()->isCurrentThread()) {
    5674         userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, this, compositor));
     5674        // We depend on the current thread being the WebKit thread when it's not the Compositing thread.
     5675        // That seems extremely likely to be the case, but let's assert just to make sure.
     5676        ASSERT(webKitThreadMessageClient()->isCurrentThread());
     5677
     5678        // This method call always round-trips on the WebKit thread (see WebPageCompositor::WebPageCompositor() and ~WebPageCompositor()),
     5679        // and the compositing context must be set on the WebKit thread. How convenient!
     5680        if (compositingContext != EGL_NO_CONTEXT)
     5681            BlackBerry::Platform::Graphics::setCompositingContext(compositingContext);
     5682
     5683        userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, this, compositor, compositingContext));
    56755684        return;
    56765685    }
  • trunk/Source/WebKit/blackberry/Api/WebPageCompositor.cpp

    r118750 r119185  
    3333#include <BlackBerryPlatformMessage.h>
    3434#include <BlackBerryPlatformMessageClient.h>
     35#include <EGL/egl.h>
    3536#include <GenericTimerClient.h>
    3637#include <ThreadTimerClient.h>
     
    260261    // needed. Unfortunately RefPtr<T> is not public, so we have declare to
    261262    // resort to manual refcounting.
    262     webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), tmp));
     263    webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), tmp, eglGetCurrentContext()));
    263264}
    264265
     
    269270    // If we're being destroyed before the page, send a message to disconnect us
    270271    if (d->page())
    271         webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), PassRefPtr<WebPageCompositorPrivate>(0)));
     272        webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), PassRefPtr<WebPageCompositorPrivate>(0), EGL_NO_CONTEXT));
    272273    d->compositorDestroyed();
    273274    d->deref();
  • trunk/Source/WebKit/blackberry/Api/WebPage_p.h

    r119119 r119185  
    2525#include "GLES2Context.h"
    2626#include "LayerRenderer.h"
     27#include <EGL/egl.h>
    2728#endif
    2829#include "KURL.h"
     
    394395    bool isAcceleratedCompositingActive() const { return m_compositor; }
    395396    WebPageCompositorPrivate* compositor() const { return m_compositor.get(); }
    396     void setCompositor(PassRefPtr<WebPageCompositorPrivate>);
     397    void setCompositor(PassRefPtr<WebPageCompositorPrivate>, EGLContext compositingContext);
    397398    bool createCompositor();
    398399    void destroyCompositor();
  • trunk/Source/WebKit/blackberry/ChangeLog

    r119134 r119185  
     12012-05-31  Arvid Nilsson  <anilsson@rim.com>
     2
     3        [BlackBerry] WebGL and 2D canvas output not available to WebPageCompositor
     4        https://bugs.webkit.org/show_bug.cgi?id=88012
     5
     6        Reviewed by George Staikos.
     7
     8        Properly set up resource sharing between WebKit thread EGL contexts and
     9        the compositing thread EGL context, so the texture ID produced by WebGL
     10        and 2D canvas makes sense to the compositing context.
     11
     12        There's no public API to supply an EGLContext yet, so we're lucky that
     13        the embedder never makes its context un-current. Just grab the current
     14        context on the compositing thread and use that as the compositing
     15        context.
     16
     17        * Api/WebPage.cpp:
     18        (BlackBerry::WebKit::WebPagePrivate::setCompositor):
     19        * Api/WebPageCompositor.cpp:
     20        (BlackBerry::WebKit::WebPageCompositor::WebPageCompositor):
     21        (BlackBerry::WebKit::WebPageCompositor::~WebPageCompositor):
     22        * Api/WebPage_p.h:
     23        (WebPagePrivate):
     24
    1252012-05-31  George Staikos  <staikos@webkit.org>
    226
Note: See TracChangeset for help on using the changeset viewer.