EGLWaylandSurface implementation. 41/5041/2
authorKondapally Kalyan <kalyan.kondapally@intel.com>
Sun, 30 Jun 2013 21:30:41 +0000 (00:30 +0300)
committerKondapally Kalyan <kalyan.kondapally@intel.com>
Sun, 30 Jun 2013 21:30:41 +0000 (00:30 +0300)
This patch adds support for EGLWaylandSurface which creates
and manages wl EGL window.

Change-Id: If79e47966df634979f0a04a6e184c6d9c27b83f9

Source/WebCore/PlatformTizen.cmake
Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp
Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h
Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp
Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.cpp
Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.h
Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp
Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h
Source/WebCore/platform/graphics/surfaces/egl/EGLWaylandSurface.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/surfaces/egl/EGLWaylandSurface.h [new file with mode: 0644]

index 335a32a..fdd1ed6 100755 (executable)
@@ -221,6 +221,7 @@ IF (WTF_USE_ACCELERATED_COMPOSITING AND ENABLE_WEBKIT2)
         )
     ELSEIF (WTF_PLATFORM_WAYLAND)
         LIST(APPEND WebCore_SOURCES
+            platform/graphics/surfaces/egl/EGLWaylandSurface.cpp
             platform/graphics/surfaces/wayland/WaylandHelper.cpp
         )
     ENDIF()
index eadc482..016ac87 100644 (file)
@@ -112,6 +112,12 @@ void GLPlatformSurface::onMakeCurrent()
     m_currentDrawable = this;
 }
 
+void GLPlatformSurface::releaseCurrent()
+{
+    if (this == m_currentDrawable)
+        m_currentDrawable = 0;
+}
+
 GLPlatformSurface* GLPlatformSurface::getCurrent()
 {
     return m_currentDrawable;
index 608b652..7218ffb 100644 (file)
@@ -75,6 +75,7 @@ public:
 
     virtual bool isCurrentDrawable() const;
     virtual void onMakeCurrent();
+    void releaseCurrent();
 
     // Convenience Function to update surface backbuffer with texture contents.
     // Note that the function doesn't track or restore any GL states.
index 82a641e..0c6bdc7 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "EGLContext.h"
 
-#if USE(EGL)
+#if USE(EGL) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE)
 
 #include "EGLHelper.h"
 #include <wtf/text/WTFString.h>
@@ -49,19 +49,6 @@ static const EGLint contextRobustnessAttributes[] = {
     EGL_NONE
 };
 
-static bool isRobustnessExtSupported(EGLDisplay display)
-{
-    static bool didQueryForRobustnessExtension = false;
-    static bool isRobustnessExtensionSupported = false;
-
-    if (!didQueryForRobustnessExtension) {
-        didQueryForRobustnessExtension = true;
-        isRobustnessExtensionSupported = GLPlatformContext::supportsEGLExtension(display, "EGL_EXT_create_context_robustness");
-    }
-
-    return isRobustnessExtensionSupported;
-}
-
 EGLOffScreenContext::EGLOffScreenContext()
     : GLPlatformContext()
 {
@@ -85,7 +72,8 @@ bool EGLOffScreenContext::initialize(GLPlatformSurface* surface, PlatformContext
     if (!config)
         return false;
 
-    if (isRobustnessExtSupported(display))
+    static bool isRobustnessExtensionSupported = GLPlatformContext::supportsEGLExtension(display, "EGL_EXT_create_context_robustness");
+    if (isRobustnessExtensionSupported)
         m_contextHandle = eglCreateContext(display, config, sharedContext, contextRobustnessAttributes);
 
     if (m_contextHandle != EGL_NO_CONTEXT) {
@@ -93,10 +81,20 @@ bool EGLOffScreenContext::initialize(GLPlatformSurface* surface, PlatformContext
         // EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT bit set must also support GL_EXT_robustness or
         // a version of OpenGL incorporating equivalent functionality.
         // The spec also defines similar requirements for attribute EGL_LOSE_CONTEXT_ON_RESET_EXT.
-        if (platformMakeCurrent(surface) && (GLPlatformContext::supportsGLExtension("GL_EXT_robustness")))
+        GLPlatformContext* currentContext = GLPlatformContext::getCurrent();
+        GLPlatformSurface* currentSurface = GLPlatformSurface::getCurrent();
+
+        if (GLPlatformContext::makeCurrent(surface) && (GLPlatformContext::supportsGLExtension("GL_EXT_robustness")))
             m_resetLostContext = true;
         else
             eglDestroyContext(display, m_contextHandle);
+
+        if (currentContext && currentSurface)
+            currentContext->makeCurrent(currentSurface);
+        else {
+            releaseCurrent();
+            surface->releaseCurrent();
+        }
     }
 
     if (m_contextHandle == EGL_NO_CONTEXT)
@@ -110,8 +108,10 @@ bool EGLOffScreenContext::initialize(GLPlatformSurface* surface, PlatformContext
 
 EGLOffScreenContext::~EGLOffScreenContext()
 {
-    platformReleaseCurrent();
-    destroy();
+    if (m_contextHandle) {
+        platformReleaseCurrent();
+        destroy();
+    }
 }
 
 bool EGLOffScreenContext::isCurrentContext() const
index d6c9eee..8ab6836 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "EGLHelper.h"
 
-#if USE(EGL)
+#if USE(EGL) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE)
 
 #include <opengl/GLPlatformContext.h>
 
@@ -98,7 +98,9 @@ private:
         if (m_eglDisplay == EGL_NO_DISPLAY)
             return;
 
+        eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
         eglTerminate(m_eglDisplay);
+        eglReleaseThread();
         m_eglDisplay = EGL_NO_DISPLAY;
     }
 
@@ -122,7 +124,7 @@ PlatformDisplay EGLHelper::currentDisplay()
     return display;
 }
 
-void EGLHelper::resolveEGLBindings()
+void EGLHelper::resolveEGLBindings(EGLDisplay eglDisplay)
 {
     static bool initialized = false;
 
@@ -131,41 +133,60 @@ void EGLHelper::resolveEGLBindings()
 
     initialized = true;
 
-    EGLDisplay display = currentDisplay();
+    EGLDisplay display = eglDisplay;
+    if (display == EGL_NO_DISPLAY)
+        display = currentDisplay();
 
     if (display == EGL_NO_DISPLAY)
         return;
 
-    if (GLPlatformContext::supportsEGLExtension(display, "EGL_KHR_image") && GLPlatformContext::supportsEGLExtension(display, "EGL_KHR_image_pixmap") && GLPlatformContext::supportsGLExtension("GL_OES_EGL_image")) {
-        eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR");
-        eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR");
-        eglImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
-    }
-
     if (GLPlatformContext::supportsEGLExtension(display, "EGL_KHR_lock_surface")) {
         eglLockSurfaceKHR = (PFNEGLLOCKSURFACEKHRPROC)eglGetProcAddress("eglLockSurfaceKHR");
         eglUnlockSurfaceKHR = (PFNEGLUNLOCKSURFACEKHRPROC)eglGetProcAddress("eglUnlockSurfaceKHR");
     }
+
+    if (!GLPlatformContext::supportsGLExtension("GL_OES_EGL_image")) {
+        LOG_ERROR("Platform doesn't support GL_OES_EGL_image. Support for this extension is required for Hardware Acceleration.");
+        return;
+    }
+
+#if PLATFORM(WAYLAND)
+    if (GLPlatformContext::supportsEGLExtension(display, "EGL_KHR_image_base") && GLPlatformContext::supportsEGLExtension(display, "EGL_WL_bind_wayland_display")) {
+#else
+    if (GLPlatformContext::supportsEGLExtension(display, "EGL_KHR_image") && GLPlatformContext::supportsEGLExtension(display, "EGL_KHR_image_pixmap")) {
+#endif
+        eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR");
+        eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR");
+        eglImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
+    } else
+#if PLATFORM(WAYLAND)
+        LOG_ERROR("Platform doesn't support EGL_KHR_image_base or EGL_WL_bind_wayland_display. Support for these extensions is required for Hardware Acceleration.");
+#else
+        LOG_ERROR("Platform doesn't support EGL_KHR_image or EGL_KHR_image_pixmap. Support for these extensions is required for Hardware Acceleration.");
+#endif
 }
 
-void EGLHelper::createEGLImage(EGLImageKHR* image, GLenum target, const EGLClientBuffer clientBuffer, const EGLint attributes[])
+void EGLHelper::createEGLImage(EGLImageKHR* image, GLenum target, const EGLClientBuffer clientBuffer, const EGLint attributes[], EGLDisplay eglDisplay)
 {
-    EGLDisplay display = currentDisplay();
+    EGLDisplay display = eglDisplay;
+    if (display == EGL_NO_DISPLAY)
+        display = currentDisplay();
 
     if (display == EGL_NO_DISPLAY)
         return;
 
     EGLImageKHR tempHandle = EGL_NO_IMAGE_KHR;
-
     if (eglCreateImageKHR && eglImageTargetTexture2DOES && eglDestroyImageKHR)
-        tempHandle =  eglCreateImageKHR(display, EGL_NO_CONTEXT, target, clientBuffer, attributes);
+        tempHandle = eglCreateImageKHR(display, EGL_NO_CONTEXT, target, clientBuffer, attributes);
 
     *image = tempHandle;
 }
 
-void EGLHelper::destroyEGLImage(const EGLImageKHR image)
+void EGLHelper::destroyEGLImage(const EGLImageKHR image, EGLDisplay eglDisplay)
 {
-    EGLDisplay display = currentDisplay();
+    EGLDisplay display = eglDisplay;
+    if (display == EGL_NO_DISPLAY)
+        display = currentDisplay();
 
     if (display == EGL_NO_DISPLAY)
         return;
@@ -176,12 +197,15 @@ void EGLHelper::destroyEGLImage(const EGLImageKHR image)
 
 void EGLHelper::imageTargetTexture2DOES(const EGLImageKHR image)
 {
-    eglImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(image));
+    if (eglImageTargetTexture2DOES)
+        eglImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(image));
 }
 
-bool EGLHelper::lockSurface(EGLSurface surface, EGLint lockAttrib[])
+bool EGLHelper::lockSurface(EGLSurface surface, EGLint lockAttrib[], EGLDisplay eglDisplay)
 {
-    EGLDisplay display = currentDisplay();
+    EGLDisplay display = eglDisplay;
+    if (display == EGL_NO_DISPLAY)
+        display = currentDisplay();
 
     if (display == EGL_NO_DISPLAY)
         return false;
@@ -196,9 +220,11 @@ bool EGLHelper::lockSurface(EGLSurface surface, EGLint lockAttrib[])
     return true;
 }
 
-bool EGLHelper::unlockSurface(EGLSurface surface)
+bool EGLHelper::unlockSurface(EGLSurface surface, EGLDisplay eglDisplay)
 {
-    EGLDisplay display = currentDisplay();
+    EGLDisplay display = eglDisplay;
+    if (display == EGL_NO_DISPLAY)
+        display = currentDisplay();
 
     if (display == EGL_NO_DISPLAY)
         return false;
@@ -213,9 +239,11 @@ bool EGLHelper::unlockSurface(EGLSurface surface)
     return true;
 }
 
-bool EGLHelper::querySurface(EGLSurface surface, EGLint attribute, EGLint* value)
+bool EGLHelper::querySurface(EGLSurface surface, EGLint attribute, EGLint* value, EGLDisplay eglDisplay)
 {
-    EGLDisplay display = currentDisplay();
+    EGLDisplay display = eglDisplay;
+    if (display == EGL_NO_DISPLAY)
+        display = currentDisplay();
 
     if (display == EGL_NO_DISPLAY)
         return false;
@@ -253,12 +281,14 @@ void EGLHelper::HandleEGLError(const char* name)
         LOG_ERROR("'%s' returned egl error '%s' (0x%x)\n", name, egErrorStrings[errorCode - EGL_SUCCESS], errorCode);
 }
 
-bool EGLHelper::isVendor(const String& vendorName)
+bool EGLHelper::isVendor(const String& vendorName, EGLDisplay eglDisplay)
 {
     static Vector<String> vendorComponents;
 
     if (!vendorComponents.size()) {
-        EGLDisplay display = currentDisplay();
+        EGLDisplay display = eglDisplay;
+        if (display == EGL_NO_DISPLAY)
+            display = currentDisplay();
 
         if (display == EGL_NO_DISPLAY)
             return false;
index 4cde004..bf3f1d1 100644 (file)
 #ifndef EGLHelper_h
 #define EGLHelper_h
 
-#if USE(EGL)
+#if USE(EGL) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE)
 
 #include "EGLSurface.h"
+#if PLATFORM(WAYLAND)
+#include "WaylandHelper.h"
+#endif
 #include <wtf/text/WTFString.h>
 
 #define GL_GLEXT_PROTOTYPES 1
@@ -46,15 +49,15 @@ class EGLHelper {
 public:
     static PlatformDisplay eglDisplay();
     static PlatformDisplay currentDisplay();
-    static void resolveEGLBindings();
-    static void createEGLImage(EGLImageKHR*, GLenum, const EGLClientBuffer, const EGLint* = 0);
-    static void destroyEGLImage(const EGLImageKHR);
+    static void resolveEGLBindings(EGLDisplay = EGL_NO_DISPLAY);
+    static void createEGLImage(EGLImageKHR*, GLenum, const EGLClientBuffer, const EGLint* = 0, EGLDisplay = EGL_NO_DISPLAY);
+    static void destroyEGLImage(const EGLImageKHR, EGLDisplay = EGL_NO_DISPLAY);
     static void imageTargetTexture2DOES(const EGLImageKHR);
-    static bool isVendor(const String&);
+    static bool isVendor(const String&, EGLDisplay = EGL_NO_DISPLAY);
     static void HandleEGLError(const char* name);
-    static bool lockSurface(EGLSurface, EGLint[]);
-    static bool unlockSurface(EGLSurface);
-    static bool querySurface(EGLSurface, EGLint, EGLint*);
+    static bool lockSurface(EGLSurface, EGLint[], EGLDisplay = EGL_NO_DISPLAY);
+    static bool unlockSurface(EGLSurface, EGLDisplay = EGL_NO_DISPLAY);
+    static bool querySurface(EGLSurface, EGLint, EGLint*, EGLDisplay = EGL_NO_DISPLAY);
 };
 
 }
index 1aae26b..ec2952c 100644 (file)
 #include "config.h"
 #include "EGLSurface.h"
 
-#if USE(EGL)
+#if USE(EGL) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE)
 
 #include "EGLConfigSelector.h"
 #include "EGLHelper.h"
-#include "GLPlatformContext.h"
 
 #if PLATFORM(X11)
 #include "EGLXSurface.h"
+#elif PLATFORM(WAYLAND)
+#include "EGLWaylandSurface.h"
 #endif
 
+#include <wtf/UnusedParam.h>
 namespace WebCore {
 
 PassOwnPtr<GLPlatformSurface> EGLTransportSurface::createTransportSurface(const IntSize& size, SurfaceAttributes attributes)
@@ -92,7 +94,7 @@ void EGLTransportSurface::destroy()
 
 PlatformSurfaceConfig EGLTransportSurface::configuration()
 {
-    return m_configSelector->pixmapContextConfig();
+    return m_configSelector->surfaceContextConfig();
 }
 
 PassOwnPtr<GLPlatformSurface> EGLOffScreenSurface::createOffScreenSurface(const IntSize& size, SurfaceAttributes attributes)
@@ -101,13 +103,18 @@ PassOwnPtr<GLPlatformSurface> EGLOffScreenSurface::createOffScreenSurface(const
     OwnPtr<GLPlatformSurface> surface;
 #if PLATFORM(X11)
     surface = adoptPtr(new EGLPixmapSurface(size, attributes));
+#elif PLATFORM(WAYLAND)
+    SurfaceAttributes surfaceAttributes = attributes;
+    surfaceAttributes |= GLPlatformSurface::DoubleBuffered;
+    surface = adoptPtr(new EGLWindowSurface(size, surfaceAttributes));
 #else
     UNUSED_PARAM(attributes);
 #endif
 
-    if (surface)
+    if (surface && surface->handle() && surface->drawable())
         return surface.release();
 
+    LOG_ERROR("Failed to create EGL OffscreenSurface.");
     return nullptr;
 }
 
@@ -141,6 +148,8 @@ void EGLOffScreenSurface::destroy()
     if (m_sharedDisplay == EGL_NO_DISPLAY || m_drawable == EGL_NO_SURFACE)
         return;
 
+    GLPlatformSurface::destroy();
+
     if (m_drawable) {
         eglDestroySurface(m_sharedDisplay, m_drawable);
         m_drawable = EGL_NO_SURFACE;
index b54cbea..c5f921b 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef EGLSurface_h
 #define EGLSurface_h
 
-#if USE(EGL)
+#if USE(EGL) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE)
 
 #include "GLPlatformSurface.h"
 #include <wtf/PassOwnPtr.h>
 #if PLATFORM(WAYLAND)
 #include <wayland-client.h>
 #include <wayland-egl.h>
+#include <wayland-server.h>
 #endif
 
 #define EGL_EGLEXT_PROTOTYPES 1
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
 
+#if PLATFORM(WAYLAND)
+#include <EGL/eglmesaext.h>
+#endif
+
 #define GL_GLEXT_PROTOTYPES 1
 #if USE(OPENGL_ES_2)
 #include <GLES2/gl2.h>
diff --git a/Source/WebCore/platform/graphics/surfaces/egl/EGLWaylandSurface.cpp b/Source/WebCore/platform/graphics/surfaces/egl/EGLWaylandSurface.cpp
new file mode 100644 (file)
index 0000000..7c9276b
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "EGLWaylandSurface.h"
+
+#if PLATFORM(WAYLAND) && (USE(EGL) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE))
+
+#include "EGLConfigSelector.h"
+#include "EGLHelper.h"
+#include "WaylandHelper.h"
+
+#include <wtf/UnusedParam.h>
+
+namespace WebCore {
+static int sharedBufferHandle = 0;
+EGLWindowSurface::EGLWindowSurface(const IntSize& size, GLPlatformSurface::SurfaceAttributes attributes)
+    : EGLOffScreenSurface(attributes)
+    , m_nativeWindow(0)
+    , m_surface(0)
+{
+    if (!m_configSelector)
+        return;
+
+    if (!m_configSelector->surfaceContextConfig()) {
+        destroy();
+        return;
+    }
+
+    m_surface = wl_compositor_create_surface(WaylandHelper::compositor());
+
+    if (!m_surface) {
+        LOG_ERROR("Failed to create surface.");
+        destroy();
+        return;
+    }
+
+    m_nativeWindow = wl_egl_window_create(m_surface, size.width(), size.height());
+
+    if (!m_nativeWindow) {
+        LOG_ERROR("Failed to create Native Window.");
+        destroy();
+        return;
+    }
+
+    m_drawable = eglCreateWindowSurface(m_sharedDisplay, m_configSelector->surfaceContextConfig(), m_nativeWindow, 0);
+
+    if (m_drawable == EGL_NO_SURFACE) {
+        LOG_ERROR("Failed to create EGL surface(%d).", eglGetError());
+        destroy();
+        return;
+    }
+
+    sharedBufferHandle++;
+    m_bufferHandle = sharedBufferHandle;
+}
+
+EGLWindowSurface::~EGLWindowSurface()
+{
+    if (m_nativeWindow || m_surface || (m_drawable != EGL_NO_SURFACE))
+        LOG_ERROR("Resources not destroyed for surface with id: %d", m_bufferHandle);
+
+    m_bufferHandle = 0;
+}
+
+void EGLWindowSurface::swapBuffers()
+{
+    if (!eglSwapBuffers(m_sharedDisplay, m_drawable))
+        LOG_ERROR("Failed to SwapBuffers(%d).", eglGetError());
+
+    wl_display_dispatch(WaylandHelper::nativeDisplay());
+}
+
+void EGLWindowSurface::destroy()
+{
+    EGLOffScreenSurface::destroy();
+
+    if (!m_nativeWindow && !m_surface)
+        return;
+
+    if (m_nativeWindow) {
+        wl_egl_window_destroy(m_nativeWindow);
+        m_nativeWindow = 0;
+    }
+
+    if (m_surface) {
+        wl_surface_destroy(m_surface);
+        m_surface = 0;
+    }
+}
+
+PlatformSurfaceConfig EGLWindowSurface::configuration()
+{
+    return m_configSelector->surfaceContextConfig();
+}
+
+}
+
+#endif
diff --git a/Source/WebCore/platform/graphics/surfaces/egl/EGLWaylandSurface.h b/Source/WebCore/platform/graphics/surfaces/egl/EGLWaylandSurface.h
new file mode 100644 (file)
index 0000000..862274b
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EGLWaylandSurface_h
+#define EGLWaylandSurface_h
+
+#if PLATFORM(WAYLAND) && (USE(EGL) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE))
+
+#include "EGLSurface.h"
+
+namespace WebCore {
+
+// Contents of the surface are backed by native window.
+class EGLWindowSurface : public EGLOffScreenSurface {
+public:
+    EGLWindowSurface(const IntSize&, GLPlatformSurface::SurfaceAttributes);
+    virtual ~EGLWindowSurface();
+    virtual void swapBuffers() OVERRIDE;
+    virtual void destroy() OVERRIDE;
+    virtual PlatformSurfaceConfig configuration() OVERRIDE;
+
+private:
+    struct wl_egl_window* m_nativeWindow;
+    struct wl_surface* m_surface;
+};
+
+}
+
+#endif
+
+#endif