Add LockSurface support in GLPlatformSurface. 61/4161/1
authorKondapally Kalyan <kalyan.kondapally@intel.com>
Thu, 20 Jun 2013 16:40:14 +0000 (19:40 +0300)
committerKondapally Kalyan <kalyan.kondapally@intel.com>
Thu, 20 Jun 2013 16:40:14 +0000 (19:40 +0300)
This patch makes changes to make it possible for
EGL implementations to handle the lock surface support.

Change-Id: I91741ad02090ebe4788aa7752208bf84e98f078d

Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp
Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp
Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h
Source/WebCore/platform/graphics/surfaces/egl/EGLXSurface.cpp
Source/WebCore/platform/graphics/surfaces/egl/EGLXSurface.h

index 23a1327..a21f106 100755 (executable)
@@ -283,13 +283,12 @@ void ImageBuffer::swapPlatformSurfaces()
 
 bool ImageBuffer::lockSurface() const
 {
-    static EGLint lockAttrib[] = { EGL_LOCK_USAGE_HINT_KHR, EGL_WRITE_SURFACE_BIT_KHR, EGL_NONE };
-    return EGLHelper::lockSurface(m_offScreenSurface->drawable(), lockAttrib);
+    return m_offScreenSurface->lockSurface();
 }
 
 bool ImageBuffer::unlockSurface() const
 {
-    return EGLHelper::unlockSurface(m_offScreenSurface->drawable());
+    return m_offScreenSurface->unlockSurface();
 }
 
 PassRefPtr<cairo_surface_t> ImageBuffer::querySurface() const
index ce826e4..fd206de 100755 (executable)
@@ -187,13 +187,12 @@ bool SharedPlatformSurfaceTizen::lockSurface()
     if (vendorNeedsMakeCurrent())
         makeContextCurrent();
 
-    static EGLint lockAttrib[] = { EGL_LOCK_USAGE_HINT_KHR, EGL_WRITE_SURFACE_BIT_KHR, EGL_NONE };
-    return EGLHelper::lockSurface(m_offScreenSurface->drawable(), lockAttrib);
+    return m_offScreenSurface->lockSurface();
 }
 
 bool SharedPlatformSurfaceTizen::unlockSurface()
 {
-    return EGLHelper::unlockSurface(m_offScreenSurface->drawable());
+    return m_offScreenSurface->unlockSurface();
 }
 
 bool SharedPlatformSurfaceTizen::querySurface(int** value)
index a8c8679..eadc482 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "GLPlatformSurface.h"
 
-#if USE(ACCELERATED_COMPOSITING)
+#if USE(ACCELERATED_COMPOSITING) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE)
 
 #include "GraphicsContext.h"
 
@@ -112,6 +112,11 @@ void GLPlatformSurface::onMakeCurrent()
     m_currentDrawable = this;
 }
 
+GLPlatformSurface* GLPlatformSurface::getCurrent()
+{
+    return m_currentDrawable;
+}
+
 void GLPlatformSurface::updateContents(const uint32_t)
 {
 }
@@ -131,6 +136,16 @@ GLPlatformSurface::SurfaceAttributes GLPlatformSurface::attributes() const
     return GLPlatformSurface::Default;
 }
 
+bool GLPlatformSurface::lockSurface()
+{
+    return false;
+}
+
+bool GLPlatformSurface::unlockSurface()
+{
+    return false;
+}
+
 }
 
 #endif
index b4f6a60..608b652 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef GLPlatformSurface_h
 #define GLPlatformSurface_h
 
-#if USE(ACCELERATED_COMPOSITING)
+#if USE(ACCELERATED_COMPOSITING) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE)
 
 #include "GLDefs.h"
 #include "IntRect.h"
@@ -89,6 +89,11 @@ public:
 
     virtual void destroy();
 
+    virtual bool lockSurface();
+    virtual bool unlockSurface();
+
+    static GLPlatformSurface* getCurrent();
+
 protected:
     GLPlatformSurface();
 
index 41955c9..4517239 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "EGLXSurface.h"
 
-#if PLATFORM(X11) && USE(EGL)
+#if PLATFORM(X11) && (USE(EGL) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE))
 
 #include "GLPlatformContext.h"
 #include "EGLConfigSelector.h"
@@ -138,6 +138,23 @@ void EGLPixmapSurface::destroy()
     }
 }
 
+bool EGLPixmapSurface::lockSurface()
+{
+    if (!(m_configSelector->attributes() & GLPlatformSurface::Lockable))
+        return false;
+
+    static EGLint lockAttrib[] = { EGL_LOCK_USAGE_HINT_KHR, EGL_WRITE_SURFACE_BIT_KHR, EGL_NONE };
+    return EGLHelper::lockSurface(m_drawable, lockAttrib);
+}
+
+bool EGLPixmapSurface::unlockSurface()
+{
+    if (!(m_configSelector->attributes() & GLPlatformSurface::Lockable))
+        return false;
+
+    return EGLHelper::unlockSurface(m_drawable);
+}
+
 EGLTextureFromPixmap::EGLTextureFromPixmap(const NativePixmap handle, bool hasAlpha, EGLConfig config)
     : m_eglImage(0)
     , m_surface(EGL_NO_SURFACE)
index 94aceae..59a0187 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef EGLXSurface_h
 #define EGLXSurface_h
 
-#if PLATFORM(X11) && USE(EGL)
+#if PLATFORM(X11) && (USE(EGL) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE))
 
 #include "EGLSurface.h"
 #include "X11Helper.h"
@@ -50,6 +50,8 @@ public:
     EGLPixmapSurface(const IntSize&, GLPlatformSurface::SurfaceAttributes);
     virtual ~EGLPixmapSurface();
     virtual void destroy() OVERRIDE;
+    virtual bool lockSurface() OVERRIDE;
+    virtual bool unlockSurface() OVERRIDE;
 };
 
 class EGLTextureFromPixmap {