Skip to content
Permalink
Browse files
2010-03-12 Jakob Petsovits <jpetsovits@rim.com>
        Reviewed by Dirk Schulze.

        [OpenVG] Add a SurfaceOpenVG constructor for EGL client buffer surfaces
        https://bugs.webkit.org/show_bug.cgi?id=35538

        SurfaceOpenVG can now not only encapsulate pbuffer
        and window surfaces but also VGImage-based ones.

        * platform/graphics/openvg/EGLDisplayOpenVG.cpp:
        (WebCore::EGLDisplayOpenVG::createPbufferFromClientBuffer):
        * platform/graphics/openvg/EGLDisplayOpenVG.h:
        * platform/graphics/openvg/SurfaceOpenVG.cpp:
        (WebCore::SurfaceOpenVG::SurfaceOpenVG):
        * platform/graphics/openvg/SurfaceOpenVG.h:


Canonical link: https://commits.webkit.org/47214@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55919 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Jakob Petsovits committed Mar 12, 2010
1 parent 4cc2866 commit 419be20d7a00d5232d07e0f9ceedb96337c28cce
Showing 5 changed files with 81 additions and 0 deletions.
@@ -1,3 +1,20 @@
2010-03-12 Jakob Petsovits <jpetsovits@rim.com>

Reviewed by Dirk Schulze.

[OpenVG] Add a SurfaceOpenVG constructor for EGL client buffer surfaces
https://bugs.webkit.org/show_bug.cgi?id=35538

SurfaceOpenVG can now not only encapsulate pbuffer
and window surfaces but also VGImage-based ones.

* platform/graphics/openvg/EGLDisplayOpenVG.cpp:
(WebCore::EGLDisplayOpenVG::createPbufferFromClientBuffer):
* platform/graphics/openvg/EGLDisplayOpenVG.h:
* platform/graphics/openvg/SurfaceOpenVG.cpp:
(WebCore::SurfaceOpenVG::SurfaceOpenVG):
* platform/graphics/openvg/SurfaceOpenVG.h:

2010-03-12 Alpha Lam <hclam@chromium.org>

Reviewed by Eric Carlson.
@@ -263,6 +263,30 @@ EGLSurface EGLDisplayOpenVG::createPbufferSurface(const IntSize& size, const EGL
return surface;
}

EGLSurface EGLDisplayOpenVG::createPbufferFromClientBuffer(
EGLClientBuffer clientBuffer, EGLenum bufferType, const EGLConfig& config, EGLint* errorCode)
{
EGLSurface surface = eglCreatePbufferFromClientBuffer(m_display,
bufferType, clientBuffer, config, 0 /* attribList */);

if (errorCode)
*errorCode = eglGetError();
else
ASSERT_EGL_NO_ERROR();

if (surface == EGL_NO_SURFACE)
return EGL_NO_SURFACE;

EGLint surfaceConfigId;
EGLBoolean success = eglGetConfigAttrib(m_display, config, EGL_CONFIG_ID, &surfaceConfigId);
ASSERT(success == EGL_TRUE);
ASSERT(surfaceConfigId != EGL_BAD_ATTRIBUTE);

ASSERT(!m_surfaceConfigIds.contains(surface));
m_surfaceConfigIds.set(surface, surfaceConfigId);
return surface;
}

EGLSurface EGLDisplayOpenVG::surfaceForWindow(EGLNativeWindowType wId, const EGLConfig& config)
{
if (m_windowSurfaces.contains(wId))
@@ -51,6 +51,7 @@ class EGLDisplayOpenVG {
* If no surface could be created and errorCode is zero, this method
* will trigger an assertion by itself. */
EGLSurface createPbufferSurface(const IntSize&, const EGLConfig&, EGLint* errorCode = 0);
EGLSurface createPbufferFromClientBuffer(EGLClientBuffer, EGLenum bufferType, const EGLConfig&, EGLint* errorCode = 0);

EGLSurface surfaceForWindow(EGLNativeWindowType, const EGLConfig&);

@@ -64,6 +64,25 @@ SurfaceOpenVG::SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGL
EGLDisplayOpenVG::registerPlatformSurface(this);
}

SurfaceOpenVG::SurfaceOpenVG(EGLClientBuffer buffer, EGLenum bufferType, const EGLDisplay& display, EGLConfig* confPtr, EGLint* errorCode)
: m_activePainter(0)
, m_eglDisplay(display)
, m_eglSurface(EGL_NO_SURFACE)
, m_eglContext(EGL_NO_CONTEXT)
{
ASSERT(m_eglDisplay != EGL_NO_DISPLAY);

EGLDisplayOpenVG* displayManager = EGLDisplayOpenVG::forDisplay(m_eglDisplay);
EGLConfig config = confPtr ? (*confPtr) : displayManager->defaultPbufferConfig();
m_eglSurface = displayManager->createPbufferFromClientBuffer(buffer, bufferType, config, errorCode);

if (m_eglSurface == EGL_NO_SURFACE)
return;

m_eglContext = displayManager->contextForSurface(m_eglSurface);
EGLDisplayOpenVG::registerPlatformSurface(this);
}

SurfaceOpenVG::SurfaceOpenVG(EGLNativeWindowType window, const EGLDisplay& display, EGLConfig* confPtr)
: m_activePainter(0)
, m_eglDisplay(display)
@@ -66,6 +66,26 @@ class SurfaceOpenVG : public Noncopyable {
*/
SurfaceOpenVG(const IntSize& size, const EGLDisplay& display, EGLConfig* config = 0, EGLint* errorCode = 0);

/**
* Create a new EGL pbuffer surface that will be bound to the given
* client buffer (read: VGImage), with the specified config on the
* given display. If config is not specified, the display's default
* pbuffer config is used.
*
* After the surface is created, you will only be able to access the
* client buffer image if the surface is not current. The recommended way
* to ensure this is to call surface->sharedSurface()->makeCurrent() if you
* simply want to access the image's pixel contents, or if you intend to
* draw the image directly, making the draw target surface current.
*
* This constructor will trigger an assertion if creation of the surface
* fails, unless you pledge to manually process the error code by passing
* a non-zero pointer as errorCode parameter. The error code returned by
* eglGetError() will be written to that variable.
*/
SurfaceOpenVG(EGLClientBuffer buffer, EGLenum bufferType,
const EGLDisplay& display, EGLConfig* config = 0, EGLint* errorCode = 0);

/**
* Create a new EGL window surface with the specified native window handle
* and config on the given display. If config is not specified, the

0 comments on commit 419be20

Please sign in to comment.