Log Message
[EFL][WK2] Enable WebGL https://bugs.webkit.org/show_bug.cgi?id=97652 Patch by Regina Chung <[email protected]> on 2012-10-26 Reviewed by Gyuyoung Kim.
.: Use Graphics Surface to enable WebGL for WebKit2 EFL. * Source/cmake/OptionsEfl.cmake: Source/WebCore: Implemented GraphicsSurface for EFL to enable WebGL for WebKit2. Depends on GLX since Evas doesn't provide the necessary functionality. No new tests. Covered by existing tests. * PlatformEfl.cmake: * platform/graphics/GraphicsContext3D.h: * platform/graphics/efl/GraphicsContext3DEfl.cpp: (WebCore::GraphicsContext3D::createGraphicsSurfaces): * platform/graphics/efl/GraphicsContext3DPrivate.cpp: (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate): (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate): (WebCore): (WebCore::GraphicsContext3DPrivate::createGraphicsSurfaces): (WebCore::GraphicsContext3DPrivate::copyToGraphicsSurface): (WebCore::GraphicsContext3DPrivate::graphicsSurfaceToken): * platform/graphics/efl/GraphicsContext3DPrivate.h: (GraphicsContext3DPrivate): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::reshape): * platform/graphics/surfaces/efl: Added. * platform/graphics/surfaces/efl/GraphicsSurfaceEfl.cpp: Added. (WebCore): (WebCore::OffScreenRootWindow::get): (WebCore::OffScreenRootWindow::~OffScreenRootWindow): (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate): (WebCore::GraphicsSurfacePrivate::createSurface): (WebCore::GraphicsSurfacePrivate::makeCurrent): (WebCore::GraphicsSurfacePrivate::doneCurrent): (WebCore::GraphicsSurfacePrivate::swapBuffers): (WebCore::GraphicsSurface::platformBeginPaint): (WebCore::GraphicsSurface::createReadOnlyImage): * platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp: * platform/graphics/surfaces/qt/GraphicsSurfaceGLX.h: Added. (WebCore): (OffScreenRootWindow): (WebCore::OffScreenRootWindow::OffScreenRootWindow): (GraphicsSurfacePrivate): (WebCore::GraphicsSurfacePrivate::~GraphicsSurfacePrivate): (WebCore::GraphicsSurfacePrivate::createPixmap): (WebCore::GraphicsSurfacePrivate::copyFromTexture): (WebCore::GraphicsSurfacePrivate::display): (WebCore::GraphicsSurfacePrivate::glxPixmap): (WebCore::GraphicsSurfacePrivate::size): (WebCore::GraphicsSurfacePrivate::glContext): (WebCore::resolveGLMethods): * platform/graphics/surfaces/qt/GraphicsSurfaceQt.cpp: (WebCore): (WebCore::OffScreenRootWindow::OffScreenRootWindow::get): (WebCore::OffScreenRootWindow::~OffScreenRootWindow): (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate): (WebCore::GraphicsSurfacePrivate::createSurface): (WebCore::GraphicsSurfacePrivate::makeCurrent): (WebCore::GraphicsSurfacePrivate::doneCurrent): (WebCore::GraphicsSurfacePrivate::swapBuffers): Source/WebKit2: Set WebGLEnabled to true when WebGL is enabled. * UIProcess/API/efl/ewk_view.cpp: (_ewk_view_initialize):
Modified Paths
- trunk/ChangeLog
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/PlatformEfl.cmake
- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h
- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp
- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp
- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.h
- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
- trunk/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp
- trunk/Source/WebKit/PlatformEfl.cmake
- trunk/Source/WebKit2/ChangeLog
- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
- trunk/Source/cmake/OptionsEfl.cmake
Diff
Modified: trunk/ChangeLog (132626 => 132627)
--- trunk/ChangeLog 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/ChangeLog 2012-10-26 12:18:57 UTC (rev 132627)
@@ -1,3 +1,14 @@
+2012-10-26 Regina Chung <[email protected]>
+
+ [EFL][WK2] Enable WebGL
+ https://bugs.webkit.org/show_bug.cgi?id=97652
+
+ Reviewed by Gyuyoung Kim.
+
+ Use Graphics Surface to enable WebGL for WebKit2 EFL.
+
+ * Source/cmake/OptionsEfl.cmake:
+
2012-10-26 Sheriff Bot <[email protected]>
Unreviewed, rolling out r132601.
Modified: trunk/Source/WebCore/ChangeLog (132626 => 132627)
--- trunk/Source/WebCore/ChangeLog 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebCore/ChangeLog 2012-10-26 12:18:57 UTC (rev 132627)
@@ -1,3 +1,66 @@
+2012-10-26 Regina Chung <[email protected]>
+
+ [EFL][WK2] Enable WebGL
+ https://bugs.webkit.org/show_bug.cgi?id=97652
+
+ Reviewed by Gyuyoung Kim.
+
+ Implemented GraphicsSurface for EFL to enable WebGL for WebKit2.
+ Depends on GLX since Evas doesn't provide the necessary functionality.
+
+ No new tests. Covered by existing tests.
+
+ * PlatformEfl.cmake:
+ * platform/graphics/GraphicsContext3D.h:
+ * platform/graphics/efl/GraphicsContext3DEfl.cpp:
+ (WebCore::GraphicsContext3D::createGraphicsSurfaces):
+ * platform/graphics/efl/GraphicsContext3DPrivate.cpp:
+ (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
+ (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
+ (WebCore):
+ (WebCore::GraphicsContext3DPrivate::createGraphicsSurfaces):
+ (WebCore::GraphicsContext3DPrivate::copyToGraphicsSurface):
+ (WebCore::GraphicsContext3DPrivate::graphicsSurfaceToken):
+ * platform/graphics/efl/GraphicsContext3DPrivate.h:
+ (GraphicsContext3DPrivate):
+ * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+ (WebCore::GraphicsContext3D::reshape):
+ * platform/graphics/surfaces/efl: Added.
+ * platform/graphics/surfaces/efl/GraphicsSurfaceEfl.cpp: Added.
+ (WebCore):
+ (WebCore::OffScreenRootWindow::get):
+ (WebCore::OffScreenRootWindow::~OffScreenRootWindow):
+ (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
+ (WebCore::GraphicsSurfacePrivate::createSurface):
+ (WebCore::GraphicsSurfacePrivate::makeCurrent):
+ (WebCore::GraphicsSurfacePrivate::doneCurrent):
+ (WebCore::GraphicsSurfacePrivate::swapBuffers):
+ (WebCore::GraphicsSurface::platformBeginPaint):
+ (WebCore::GraphicsSurface::createReadOnlyImage):
+ * platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp:
+ * platform/graphics/surfaces/qt/GraphicsSurfaceGLX.h: Added.
+ (WebCore):
+ (OffScreenRootWindow):
+ (WebCore::OffScreenRootWindow::OffScreenRootWindow):
+ (GraphicsSurfacePrivate):
+ (WebCore::GraphicsSurfacePrivate::~GraphicsSurfacePrivate):
+ (WebCore::GraphicsSurfacePrivate::createPixmap):
+ (WebCore::GraphicsSurfacePrivate::copyFromTexture):
+ (WebCore::GraphicsSurfacePrivate::display):
+ (WebCore::GraphicsSurfacePrivate::glxPixmap):
+ (WebCore::GraphicsSurfacePrivate::size):
+ (WebCore::GraphicsSurfacePrivate::glContext):
+ (WebCore::resolveGLMethods):
+ * platform/graphics/surfaces/qt/GraphicsSurfaceQt.cpp:
+ (WebCore):
+ (WebCore::OffScreenRootWindow::OffScreenRootWindow::get):
+ (WebCore::OffScreenRootWindow::~OffScreenRootWindow):
+ (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
+ (WebCore::GraphicsSurfacePrivate::createSurface):
+ (WebCore::GraphicsSurfacePrivate::makeCurrent):
+ (WebCore::GraphicsSurfacePrivate::doneCurrent):
+ (WebCore::GraphicsSurfacePrivate::swapBuffers):
+
2012-10-26 Alexander Pavlov <[email protected]>
Web Inspector: [Overrides] Do not persist the User Agent "master switch"
Modified: trunk/Source/WebCore/PlatformEfl.cmake (132626 => 132627)
--- trunk/Source/WebCore/PlatformEfl.cmake 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebCore/PlatformEfl.cmake 2012-10-26 12:18:57 UTC (rev 132627)
@@ -283,6 +283,7 @@
LIST(APPEND WebCore_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/platform/graphics/cairo"
"${WEBCORE_DIR}/platform/graphics/opengl"
+ "${WEBCORE_DIR}/platform/graphics/surfaces"
"${WEBCORE_DIR}/platform/graphics/texmap"
)
LIST(APPEND WebCore_SOURCES
@@ -294,6 +295,8 @@
platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
+ platform/graphics/surfaces/GraphicsSurface.cpp
+ platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp
platform/graphics/texmap/TextureMapperGL.cpp
platform/graphics/texmap/TextureMapperShaderManager.cpp
)
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (132626 => 132627)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2012-10-26 12:18:57 UTC (rev 132627)
@@ -72,6 +72,7 @@
typedef QSurface* PlatformGraphicsSurface3D;
#else
typedef void* PlatformGraphicsContext3D;
+typedef void* PlatformGraphicsSurface3D;
#endif
#if (PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY)) && USE(SKIA)
@@ -947,7 +948,7 @@
bool reshapeFBOs(const IntSize&);
void resolveMultisamplingIfNecessary(const IntRect& = IntRect());
-#if PLATFORM(QT) && USE(GRAPHICS_SURFACE)
+#if (PLATFORM(QT) || PLATFORM(EFL)) && USE(GRAPHICS_SURFACE)
void createGraphicsSurfaces(const IntSize&);
#endif
Modified: trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp (132626 => 132627)
--- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp 2012-10-26 12:18:57 UTC (rev 132627)
@@ -226,7 +226,7 @@
#if USE(GRAPHICS_SURFACE)
void GraphicsContext3D::createGraphicsSurfaces(const IntSize& size)
{
- notImplemented();
+ m_private->createGraphicsSurfaces(size);
}
#endif
Modified: trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp (132626 => 132627)
--- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp 2012-10-26 12:18:57 UTC (rev 132627)
@@ -25,6 +25,7 @@
#include "GraphicsContext.h"
#include "HostWindow.h"
#include "NotImplemented.h"
+#include "PlatformContextCairo.h"
#include <Ecore_Evas.h>
#include <Evas_GL.h>
#include <wtf/OwnArrayPtr.h>
@@ -87,6 +88,13 @@
return;
makeContextCurrent();
+
+#if USE(GRAPHICS_SURFACE)
+ IntSize surfaceSize(m_context->m_currentWidth, m_context->m_currentHeight);
+ m_surfaceFlags = GraphicsSurface::SupportsTextureTarget | GraphicsSurface::SupportsSharing;
+ if (!surfaceSize.isEmpty())
+ m_graphicsSurface = GraphicsSurface::create(surfaceSize, m_surfaceFlags);
+#endif
}
GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
@@ -101,9 +109,12 @@
evas_gl_context_destroy(m_evasGL, m_evasGLContext);
evas_gl_free(m_evasGL);
+
+#if USE(GRAPHICS_SURFACE)
+ m_graphicsSurface.clear();
+#endif
}
-
bool GraphicsContext3DPrivate::createSurface(PageClientEfl* pageClient, bool renderDirectlyToHostWindow)
{
// If RenderStyle is RenderOffscreen, we will be rendering to a FBO,
@@ -169,6 +180,32 @@
notImplemented();
}
#endif
+
+#if USE(GRAPHICS_SURFACE)
+void GraphicsContext3DPrivate::createGraphicsSurfaces(const IntSize& size)
+{
+ if (size.isEmpty())
+ m_graphicsSurface.clear();
+ else
+ m_graphicsSurface = GraphicsSurface::create(size, m_surfaceFlags);
+}
+
+uint32_t GraphicsContext3DPrivate::copyToGraphicsSurface()
+{
+ if (!m_graphicsSurface)
+ return 0;
+
+ makeContextCurrent();
+ m_graphicsSurface->copyFromTexture(m_context->m_texture, IntRect(0, 0, m_context->m_currentWidth, m_context->m_currentHeight));
+ return m_graphicsSurface->swapBuffers();
+}
+
+GraphicsSurfaceToken GraphicsContext3DPrivate::graphicsSurfaceToken() const
+{
+ return m_graphicsSurface->exportToken();
+}
+#endif
+
} // namespace WebCore
#endif // USE(3D_GRAPHICS) || USE(ACCELERATED_COMPOSITING)
Modified: trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.h (132626 => 132627)
--- trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.h 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.h 2012-10-26 12:18:57 UTC (rev 132627)
@@ -26,6 +26,10 @@
#include <texmap/TextureMapperPlatformLayer.h>
#endif
+#if USE(GRAPHICS_SURFACE)
+#include "GraphicsSurface.h"
+#endif
+
typedef struct _Evas_GL Evas_GL;
typedef struct _Evas_GL_Surface Evas_GL_Surface;
typedef struct _Evas_GL_Context Evas_GL_Context;
@@ -52,6 +56,12 @@
#if USE(TEXTURE_MAPPER_GL)
virtual void paintToTextureMapper(TextureMapper*, const FloatRect& target, const TransformationMatrix&, float opacity, BitmapTexture* mask);
#endif
+#if USE(GRAPHICS_SURFACE)
+ virtual uint32_t copyToGraphicsSurface();
+ virtual GraphicsSurfaceToken graphicsSurfaceToken() const;
+ void createGraphicsSurfaces(const IntSize&);
+#endif
+
bool makeContextCurrent();
bool createSurface(PageClientEfl*, bool renderDirectlyToEvasGLObject);
void setCurrentGLContext(void*, void*);
@@ -59,6 +69,10 @@
GraphicsContext3D::Attributes m_attributes;
GraphicsContext3D* m_context;
HostWindow* m_hostWindow;
+#if USE(GRAPHICS_SURFACE)
+ GraphicsSurface::Flags m_surfaceFlags;
+ RefPtr<GraphicsSurface> m_graphicsSurface;
+#endif
ListHashSet<GC3Denum> m_syntheticErrors;
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (132626 => 132627)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2012-10-26 12:18:57 UTC (rev 132627)
@@ -222,7 +222,7 @@
if (width == m_currentWidth && height == m_currentHeight)
return;
-#if PLATFORM(QT) && USE(GRAPHICS_SURFACE)
+#if (PLATFORM(QT) || PLATFORM(EFL)) && USE(GRAPHICS_SURFACE)
::glFlush(); // Make sure all GL calls have been committed before resizing.
createGraphicsSurfaces(IntSize(width, height));
#endif
Modified: trunk/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp (132626 => 132627)
--- trunk/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp 2012-10-26 12:18:57 UTC (rev 132627)
@@ -22,13 +22,20 @@
#if USE(GRAPHICS_SURFACE)
+#include "NotImplemented.h"
#include "TextureMapperGL.h"
+
+#if PLATFORM(QT)
// Qt headers must be included before glx headers.
#include <QCoreApplication>
#include <QOpenGLContext>
#include <QVector>
#include <QWindow>
#include <qpa/qplatformwindow.h>
+#elif PLATFORM(EFL)
+#include <GL/gl.h>
+#endif
+
#include <GL/glext.h>
#include <GL/glx.h>
#include <X11/extensions/Xcomposite.h>
@@ -53,6 +60,7 @@
++refCount;
}
+#if PLATFORM(QT)
QWindow* get(Display* dpy)
{
if (!window) {
@@ -67,22 +75,52 @@
return window;
}
+#elif PLATFORM(EFL)
+ Window* get(Display* dpy)
+ {
+ if (!window) {
+ window = XCreateSimpleWindow(dpy, XDefaultRootWindow(dpy), -1, -1, 1, 1, 0, BlackPixel(dpy, 0), WhitePixel(dpy, 0));
+ XSetWindowAttributes attributes;
+ attributes.override_redirect = true;
+ XChangeWindowAttributes(dpy, window, X11OverrideRedirect, &attributes);
+ display = dpy;
+ // Map window to the screen
+ XMapWindow(dpy, window);
+ }
+ return &window;
+ }
+#endif
+
~OffScreenRootWindow()
{
if (!--refCount) {
+#if PLATFORM(QT)
delete window;
window = 0;
+#elif PLATFORM(EFL)
+ XUnmapWindow(display, window);
+ XDestroyWindow(display, window);
+#endif
}
}
private:
static int refCount;
+#if PLATFORM(QT)
static QWindow* window;
+#elif PLATFORM(EFL)
+ static Window window;
+ Display* display;
+#endif
};
int OffScreenRootWindow::refCount = 0;
+#if PLATFORM(QT)
QWindow* OffScreenRootWindow::window = 0;
+#elif PLATFORM(EFL)
+Window OffScreenRootWindow::window = 0;
+#endif
static const int glxSpec[] = {
// The specification is a set key value pairs stored in a simple array.
@@ -106,18 +144,20 @@
: m_display(0)
, m_xPixmap(0)
, m_glxPixmap(0)
- , m_glContext(adoptPtr(new QOpenGLContext))
+ , m_glContext(0)
, m_detachedContext(0)
, m_detachedSurface(0)
, m_textureIsYInverted(false)
, m_hasAlpha(false)
{
+#if PLATFORM(QT)
QSurface* currentSurface = 0;
QOpenGLContext* currentContext = QOpenGLContext::currentContext();
if (currentContext)
currentSurface = currentContext->surface();
m_display = XOpenDisplay(0);
+ m_glContext = adoptPtr(new QOpenGLContext);
m_glContext->setShareContext(shareContext);
m_glContext->create();
@@ -125,6 +165,25 @@
// Therefore we have to make the previous context current again.
if (currentContext)
currentContext->makeCurrent(currentSurface);
+#elif PLATFORM(EFL)
+ m_display = XOpenDisplay(0);
+
+ int attributes[] = {
+ GLX_LEVEL, 0,
+ GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
+ GLX_RENDER_TYPE, GLX_RGBA_BIT,
+ GLX_RED_SIZE, 1,
+ GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1,
+ GLX_DOUBLEBUFFER, True,
+ None
+ };
+
+ int numReturned;
+ m_fbConfigs = glXChooseFBConfig(m_display, DefaultScreen(m_display), attributes, &numReturned);
+ // Create a GLX context for OpenGL rendering
+ m_glContext = glXCreateNewContext(m_display, m_fbConfigs[0], GLX_RGBA_TYPE, 0, true);
+#endif
}
~GraphicsSurfacePrivate()
@@ -144,6 +203,7 @@
uint32_t createSurface(const IntSize& size)
{
+#if PLATFORM(QT)
m_surface = adoptPtr(new QWindow(m_offScreenWindow.get(m_display)));
m_surface->setSurfaceType(QSurface::OpenGLSurface);
m_surface->setGeometry(0, 0, size.width(), size.height());
@@ -158,6 +218,30 @@
m_surface->show();
return m_surface->handle()->winId();
+#elif PLATFORM(EFL)
+ XVisualInfo* visualInfo = glXGetVisualFromFBConfig(m_display, m_fbConfigs[0]);
+ if (!visualInfo)
+ return 0;
+
+ Colormap cmap = XCreateColormap(m_display, *m_offScreenWindow.get(m_display), visualInfo->visual, AllocNone);
+ XSetWindowAttributes a;
+ a.background_pixel = WhitePixel(m_display, 0);
+ a.border_pixel = BlackPixel(m_display, 0);
+ a.colormap = cmap;
+ m_surface = XCreateWindow(m_display, *m_offScreenWindow.get(m_display), 0, 0, size.width(), size.height(),
+ 0, visualInfo->depth, InputOutput, visualInfo->visual,
+ CWBackPixel | CWBorderPixel | CWColormap, &a);
+ XSetWindowBackgroundPixmap(m_display, m_surface, 0);
+ XCompositeRedirectWindow(m_display, m_surface, CompositeRedirectManual);
+
+ // Make sure the XRender Extension is available.
+ int eventBasep, errorBasep;
+ if (!XRenderQueryExtension(m_display, &eventBasep, &errorBasep))
+ return 0;
+
+ XMapWindow(m_display, m_surface);
+ return m_surface;
+#endif
}
void createPixmap(uint32_t winId)
@@ -184,18 +268,30 @@
void makeCurrent()
{
+#if PLATFORM(QT)
m_detachedContext = QOpenGLContext::currentContext();
if (m_detachedContext)
m_detachedSurface = m_detachedContext->surface();
if (m_surface && m_glContext)
m_glContext->makeCurrent(m_surface.get());
+#elif PLATFORM(EFL)
+ m_detachedContext = glXGetCurrentContext();
+ m_detachedSurface = glXGetCurrentDrawable();
+ if (m_surface && m_glContext)
+ glXMakeCurrent(m_display, m_surface, m_glContext);
+#endif
}
void doneCurrent()
{
if (m_detachedContext)
+#if PLATFORM(QT)
m_detachedContext->makeCurrent(m_detachedSurface);
+#elif PLATFORM(EFL)
+ glXMakeCurrent(m_display, m_detachedSurface, m_detachedContext);
+#endif
+ m_detachedContext = 0;
}
void swapBuffers()
@@ -206,6 +302,7 @@
if (m_xPixmap)
return;
+#if PLATFORM(QT)
if (!m_surface->isVisible())
return;
@@ -222,6 +319,17 @@
glContext->swapBuffers(m_surface.get());
pGlBindFramebuffer(GL_FRAMEBUFFER, oldFBO);
}
+#elif PLATFORM(EFL)
+ GLXContext glContext = glXGetCurrentContext();
+
+ if (m_surface && glContext) {
+ GLint oldFBO;
+ glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFBO);
+ pGlBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glXSwapBuffers(m_display, m_surface);
+ pGlBindFramebuffer(GL_FRAMEBUFFER, oldFBO);
+ }
+#endif
}
void copyFromTexture(uint32_t texture, const IntRect& sourceRect)
@@ -242,7 +350,11 @@
glBindTexture(GL_TEXTURE_2D, texture);
pGlFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
+#if PLATFORM(QT)
pGlBindFramebuffer(GL_DRAW_FRAMEBUFFER, glContext()->defaultFramebufferObject());
+#elif PLATFORM(EFL)
+ pGlBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+#endif
pGlBlitFramebuffer(x, y, width, height, x, y, width, height, GL_COLOR_BUFFER_BIT, GL_LINEAR);
pGlFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
@@ -254,14 +366,15 @@
doneCurrent();
}
-
Display* display() const { return m_display; }
GLXPixmap glxPixmap() const { return m_glxPixmap; }
IntSize size() const { return m_size; }
+#if PLATFORM(QT)
QOpenGLContext* glContext() { return m_glContext.get(); }
+#endif
private:
OffScreenRootWindow m_offScreenWindow;
@@ -269,10 +382,18 @@
Display* m_display;
Pixmap m_xPixmap;
GLXPixmap m_glxPixmap;
+#if PLATFORM(QT)
OwnPtr<QWindow> m_surface;
OwnPtr<QOpenGLContext> m_glContext;
QOpenGLContext* m_detachedContext;
QSurface* m_detachedSurface;
+#elif PLATFORM(EFL)
+ Window m_surface;
+ GLXContext m_glContext;
+ GLXContext m_detachedContext;
+ GLXDrawable m_detachedSurface;
+ GLXFBConfig* m_fbConfigs;
+#endif
bool m_textureIsYInverted;
bool m_hasAlpha;
};
@@ -282,7 +403,7 @@
static bool resolved = false;
if (resolved)
return true;
-
+#if PLATFORM(QT)
QOpenGLContext* glContext = p->glContext();
pGlXBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT"));
pGlXReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT"));
@@ -292,7 +413,16 @@
pGlGenFramebuffers = reinterpret_cast<PFNGLGENFRAMEBUFFERSPROC>(glContext->getProcAddress("glGenFramebuffers"));
pGlDeleteFramebuffers = reinterpret_cast<PFNGLDELETEFRAMEBUFFERSPROC>(glContext->getProcAddress("glDeleteFramebuffers"));
pGlFramebufferTexture2D = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DPROC>(glContext->getProcAddress("glFramebufferTexture2D"));
+#elif PLATFORM(EFL)
+ pGlXBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXBindTexImageEXT")));
+ pGlXReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXReleaseTexImageEXT")));
+ pGlBindFramebuffer = reinterpret_cast<PFNGLBINDFRAMEBUFFERPROC>(glXGetProcAddress(reinterpret_cast<const GLubyte*>("glBindFramebuffer")));
+ pGlBlitFramebuffer = reinterpret_cast<PFNGLBLITFRAMEBUFFERPROC>(glXGetProcAddress(reinterpret_cast<const GLubyte*>("glBlitFramebuffer")));
+ pGlGenFramebuffers = reinterpret_cast<PFNGLGENFRAMEBUFFERSPROC>(glXGetProcAddress(reinterpret_cast<const GLubyte*>("glGenFramebuffers")));
+ pGlDeleteFramebuffers = reinterpret_cast<PFNGLDELETEFRAMEBUFFERSPROC>(glXGetProcAddress(reinterpret_cast<const GLubyte*>("glDeleteFramebuffers")));
+ pGlFramebufferTexture2D = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DPROC>(glXGetProcAddress(reinterpret_cast<const GLubyte*>("glFramebufferTexture2D")));
+#endif
resolved = pGlBlitFramebuffer && pGlBindFramebuffer && pGlXBindTexImageEXT && pGlXReleaseTexImageEXT;
return resolved;
@@ -410,5 +540,18 @@
m_private = 0;
}
+#if !PLATFORM(QT)
+PassOwnPtr<GraphicsContext> GraphicsSurface::platformBeginPaint(const IntSize&, char*, int)
+{
+ notImplemented();
+ return nullptr;
}
+
+PassRefPtr<Image> GraphicsSurface::createReadOnlyImage(const IntRect&)
+{
+ notImplemented();
+ return 0;
+}
#endif
+}
+#endif
Modified: trunk/Source/WebKit/PlatformEfl.cmake (132626 => 132627)
--- trunk/Source/WebKit/PlatformEfl.cmake 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebKit/PlatformEfl.cmake 2012-10-26 12:18:57 UTC (rev 132627)
@@ -80,6 +80,7 @@
IF (WTF_USE_TEXTURE_MAPPER_GL)
LIST(APPEND WebKit_INCLUDE_DIRECTORIES
+ "${WEBCORE_DIR}/platform/graphics/surfaces"
"${WEBCORE_DIR}/platform/graphics/texmap"
"${THIRDPARTY_DIR}/ANGLE/include/GLSLANG"
)
Modified: trunk/Source/WebKit2/ChangeLog (132626 => 132627)
--- trunk/Source/WebKit2/ChangeLog 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebKit2/ChangeLog 2012-10-26 12:18:57 UTC (rev 132627)
@@ -1,3 +1,15 @@
+2012-10-26 Regina Chung <[email protected]>
+
+ [EFL][WK2] Enable WebGL
+ https://bugs.webkit.org/show_bug.cgi?id=97652
+
+ Reviewed by Gyuyoung Kim.
+
+ Set WebGLEnabled to true when WebGL is enabled.
+
+ * UIProcess/API/efl/ewk_view.cpp:
+ (_ewk_view_initialize):
+
2012-10-26 Christophe Dumez <[email protected]>
[EFL][WK2] Add Ewk_Color_Picker API
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (132626 => 132627)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-10-26 12:18:57 UTC (rev 132627)
@@ -572,7 +572,10 @@
impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
impl->pageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
impl->pageProxy->setUseFixedLayout(true);
+#if ENABLE(WEBGL)
+ impl->pageProxy->pageGroup()->preferences()->setWebGLEnabled(true);
#endif
+#endif
impl->pageProxy->initializeWebPage();
impl->backForwardList = Ewk_Back_Forward_List::create(toAPI(impl->pageProxy->backForwardList()));
Modified: trunk/Source/cmake/OptionsEfl.cmake (132626 => 132627)
--- trunk/Source/cmake/OptionsEfl.cmake 2012-10-26 12:16:10 UTC (rev 132626)
+++ trunk/Source/cmake/OptionsEfl.cmake 2012-10-26 12:18:57 UTC (rev 132627)
@@ -192,6 +192,11 @@
SET(ENABLE_3D_RENDERING 1)
ADD_DEFINITIONS(-DENABLE_3D_RENDERING=1)
+ SET (ENABLE_WEBGL 1)
+ SET (WTF_USE_GRAPHICS_SURFACE 1)
+ ADD_DEFINITIONS(-DWTF_USE_GRAPHICS_SURFACE=1)
+ ADD_DEFINITIONS(-DHAVE_GLX)
+
FIND_PACKAGE(OpenGL REQUIRED)
ENDIF()
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo/webkit-changes
