Changeset 135083 in webkit
- Timestamp:
- Nov 18, 2012, 3:07:30 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r135082 r135083 1 2012-11-18 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r135074. 4 http://trac.webkit.org/changeset/135074 5 https://bugs.webkit.org/show_bug.cgi?id=102619 6 7 Made most layout tests crash. (Requested by rakuco on 8 #webkit). 9 10 * PlatformEfl.cmake: 11 * platform/graphics/efl/GraphicsContext3DEfl.cpp: 12 (WebCore::GraphicsContext3D::create): 13 (WebCore::GraphicsContext3D::GraphicsContext3D): 14 (WebCore::GraphicsContext3D::~GraphicsContext3D): 15 (WebCore::GraphicsContext3D::makeContextCurrent): 16 (WebCore::GraphicsContext3D::setContextLostCallback): 17 * platform/graphics/efl/GraphicsContext3DPrivate.cpp: 18 (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate): 19 (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate): 20 (WebCore::GraphicsContext3DPrivate::createSurface): 21 (WebCore::GraphicsContext3DPrivate::setCurrentGLContext): 22 (WebCore::GraphicsContext3DPrivate::platformGraphicsContext3D): 23 (WebCore::GraphicsContext3DPrivate::makeContextCurrent): 24 (WebCore::GraphicsContext3DPrivate::createGraphicsSurfaces): 25 (WebCore::GraphicsContext3DPrivate::copyToGraphicsSurface): 26 (WebCore::GraphicsContext3DPrivate::graphicsSurfaceToken): 27 * platform/graphics/efl/GraphicsContext3DPrivate.h: 28 (GraphicsContext3DPrivate): 29 * platform/graphics/opengl/GLDefs.h: Removed. 30 * platform/graphics/opengl/GLPlatformContext.cpp: Removed. 31 * platform/graphics/opengl/GLPlatformContext.h: Removed. 32 * platform/graphics/opengl/GLPlatformSurface.cpp: Removed. 33 * platform/graphics/opengl/GLPlatformSurface.h: Removed. 34 * platform/graphics/surfaces/glx/GLXContext.cpp: Removed. 35 * platform/graphics/surfaces/glx/GLXContext.h: Removed. 36 * platform/graphics/surfaces/glx/GLXSurface.cpp: Removed. 37 * platform/graphics/surfaces/glx/GLXSurface.h: Removed. 38 1 39 2012-11-18 Antti Koivisto <antti@apple.com> 2 40 -
trunk/Source/WebCore/PlatformEfl.cmake
r135074 r135083 278 278 "${WEBCORE_DIR}/platform/graphics/opengl" 279 279 "${WEBCORE_DIR}/platform/graphics/surfaces" 280 "${WEBCORE_DIR}/platform/graphics/surfaces/glx"281 280 "${WEBCORE_DIR}/platform/graphics/texmap" 282 281 ) … … 288 287 platform/graphics/opengl/Extensions3DOpenGL.cpp 289 288 platform/graphics/opengl/Extensions3DOpenGLCommon.cpp 290 platform/graphics/opengl/GLPlatformContext.cpp291 platform/graphics/opengl/GLPlatformSurface.cpp292 289 platform/graphics/opengl/GraphicsContext3DOpenGL.cpp 293 290 platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 294 291 platform/graphics/surfaces/GraphicsSurface.cpp 295 platform/graphics/surfaces/glx/GLXSurface.cpp296 platform/graphics/surfaces/glx/GLXContext.cpp297 292 platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp 298 293 platform/graphics/texmap/TextureMapperGL.cpp -
trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp
r135074 r135083 1 1 /* 2 2 Copyright (C) 2012 Samsung Electronics 3 Copyright (C) 2012 Intel Corporation.4 3 5 4 This library is free software; you can redistribute it and/or … … 29 28 #include "OpenGLShims.h" 30 29 #include "PlatformContextCairo.h" 30 #include <GL/glx.h> 31 31 32 32 #if USE(OPENGL_ES_2) … … 40 40 PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, RenderStyle renderStyle) 41 41 { 42 if (renderStyle == RenderDirectlyToHostWindow)43 return 0;44 45 42 RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attrs, hostWindow, renderStyle)); 46 43 return context->m_private ? context.release() : 0; … … 71 68 , m_private(adoptPtr(new GraphicsContext3DPrivate(this, hostWindow, renderStyle))) 72 69 { 73 if (!m_private || !m_private->m_platformContext) { 70 validateAttributes(); 71 72 if (!m_private) 73 return; 74 75 static bool initializedShims = false; 76 static bool success = true; 77 if (!initializedShims) { 78 success = initializeOpenGLShims(); 79 initializedShims = true; 80 } 81 if (!success) { 74 82 m_private = nullptr; 75 83 return; 76 84 } 77 85 78 validateAttributes(); 86 if (renderStyle == RenderToCurrentGLContext) { 87 // Evas doesn't allow including gl headers and Evas_GL headers at the same time, 88 // so we need to query the current gl context/surface here instead of in GraphicsContext3DPrivate. 89 void* currentContext = (void*)glXGetCurrentContext(); 90 void* currentSurface = (void*)glXGetCurrentDrawable(); 91 m_private->setCurrentGLContext(currentContext, currentSurface); 92 } 79 93 80 94 if (renderStyle == RenderOffscreen) { … … 134 148 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); 135 149 #endif 136 glClearColor(0.0, 0.0, 0.0, 0.0);137 150 } 138 151 139 152 GraphicsContext3D::~GraphicsContext3D() 140 153 { 141 if (!m_private || !makeContextCurrent()) 142 return; 143 144 if (!m_fbo) { 145 m_private->releaseResources(); 146 return; 147 } 148 154 if (m_renderStyle == RenderToCurrentGLContext || !m_private) 155 return; 156 157 makeContextCurrent(); 149 158 glDeleteTextures(1, &m_texture); 150 159 … … 157 166 glDeleteFramebuffers(1, &m_multisampleFBO); 158 167 } else if (m_attrs.stencil || m_attrs.depth) { 168 159 169 #if USE(OPENGL_ES_2) 160 170 if (m_attrs.depth) … … 166 176 glDeleteRenderbuffers(1, &m_depthStencilBuffer); 167 177 } 168 169 178 glDeleteFramebuffers(1, &m_fbo); 170 m_private->releaseResources();171 179 } 172 180 … … 190 198 bool GraphicsContext3D::makeContextCurrent() 191 199 { 200 if (!m_private) 201 return false; 202 203 if (m_renderStyle == RenderToCurrentGLContext) 204 return true; 205 192 206 return m_private->makeContextCurrent(); 193 207 } … … 202 216 } 203 217 204 void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback> callBack)205 { 206 m_private->setContextLostCallback(callBack);218 void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>) 219 { 220 notImplemented(); 207 221 } 208 222 -
trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp
r135074 r135083 1 1 /* 2 2 Copyright (C) 2012 Samsung Electronics 3 Copyright (C) 2012 Intel Corporation.4 3 5 4 This library is free software; you can redistribute it and/or … … 20 19 21 20 #include "config.h" 21 22 #if USE(3D_GRAPHICS) || USE(ACCELERATED_COMPOSITING) 22 23 #include "GraphicsContext3DPrivate.h" 23 24 24 #if USE(3D_GRAPHICS) || USE(ACCELERATED_COMPOSITING) 25 25 #include "GraphicsContext.h" 26 26 #include "HostWindow.h" 27 27 #include "NotImplemented.h" 28 28 #include "PlatformContextCairo.h" 29 30 #if USE(OPENGL_ES_2) 31 #include <GLES2/gl2.h> 32 #include <GLES2/gl2ext.h> 33 #else 34 #include "OpenGLShims.h" 35 #endif 29 #include <Ecore_Evas.h> 30 #include <Evas_GL.h> 31 #include <wtf/OwnArrayPtr.h> 32 #include <wtf/text/CString.h> 36 33 37 34 namespace WebCore { … … 40 37 : m_context(context) 41 38 , m_hostWindow(hostWindow) 42 , m_pendingSurfaceResize(false) 43 { 39 , m_evasGL(0) 40 , m_evasGLContext(0) 41 , m_evasGLSurface(0) 42 , m_glContext(0) 43 , m_glSurface(0) 44 , m_api(0) 45 , m_renderStyle(renderStyle) 46 { 47 if (renderStyle == GraphicsContext3D::RenderToCurrentGLContext) 48 return; 49 44 50 if (m_hostWindow && m_hostWindow->platformPageClient()) { 45 51 // FIXME: Implement this code path for WebKit1. … … 48 54 } 49 55 50 m_platformContext = GLPlatformContext::createContext(renderStyle); 51 if (!m_platformContext) 52 return; 53 54 if (renderStyle == GraphicsContext3D::RenderOffscreen) { 56 // For WebKit2, we need to create a dummy ecoreEvas object for the WebProcess in order to use EvasGL APIs. 57 #ifdef HAVE_ECORE_X 58 ecore_evas_init(); 59 m_ecoreEvas = adoptPtr(ecore_evas_gl_x11_new(0, 0, 0, 0, 1, 1)); 60 if (!m_ecoreEvas) 61 return; 62 #else 63 return; 64 #endif 65 66 Evas* evas = ecore_evas_get(m_ecoreEvas.get()); 67 if (!evas) 68 return; 69 70 // Create a new Evas_GL object for gl rendering on efl. 71 m_evasGL = evas_gl_new(evas); 72 if (!m_evasGL) 73 return; 74 75 // Get the API for rendering using OpenGL. 76 // This returns a structure that contains all the OpenGL functions we can use to render in Evas 77 m_api = evas_gl_api_get(m_evasGL); 78 if (!m_api) 79 return; 80 81 // Create a context 82 m_evasGLContext = evas_gl_context_create(m_evasGL, 0); 83 if (!m_evasGLContext) 84 return; 85 86 // Create a surface 87 if (!createSurface(0, renderStyle == GraphicsContext3D::RenderDirectlyToHostWindow)) 88 return; 89 90 makeContextCurrent(); 91 55 92 #if USE(GRAPHICS_SURFACE) 56 m_platformSurface = GLPlatformSurface::createTransportSurface(); 57 #else 58 m_platformSurface = GLPlatformSurface::createOffscreenSurface(); 59 #endif 60 if (!m_platformSurface) { 61 m_platformContext = nullptr; 62 return; 63 } 64 65 if (!m_platformContext->initialize(m_platformSurface.get()) || !m_platformContext->makeCurrent(m_platformSurface.get())) { 66 releaseResources(); 67 m_platformContext = nullptr; 68 m_platformSurface = nullptr; 93 IntSize surfaceSize(m_context->m_currentWidth, m_context->m_currentHeight); 94 m_surfaceFlags = GraphicsSurface::SupportsTextureTarget | GraphicsSurface::SupportsSharing; 95 if (!surfaceSize.isEmpty()) 96 m_graphicsSurface = GraphicsSurface::create(surfaceSize, m_surfaceFlags); 97 #endif 98 } 99 100 GraphicsContext3DPrivate::~GraphicsContext3DPrivate() 101 { 102 if (!m_evasGL) 103 return; 104 105 if (m_evasGLSurface) 106 evas_gl_surface_destroy(m_evasGL, m_evasGLSurface); 107 108 if (m_evasGLContext) 109 evas_gl_context_destroy(m_evasGL, m_evasGLContext); 110 111 evas_gl_free(m_evasGL); 112 69 113 #if USE(GRAPHICS_SURFACE) 70 } else 71 m_surfaceHandle = GraphicsSurfaceToken(m_platformSurface->handle()); 72 #else 73 } 74 #endif 114 m_graphicsSurface.clear(); 115 #endif 116 } 117 118 bool GraphicsContext3DPrivate::createSurface(PageClientEfl* pageClient, bool renderDirectlyToHostWindow) 119 { 120 // If RenderStyle is RenderOffscreen, we will be rendering to a FBO, 121 // so Evas_GL_Surface has a 1x1 dummy surface. 122 int width = 1; 123 int height = 1; 124 125 // But, in case of RenderDirectlyToHostWindow, we have to render to a render target surface with the same size as our webView. 126 if (renderDirectlyToHostWindow) { 127 if (!pageClient) 128 return false; 129 // FIXME: Get geometry of webView and set size of target surface. 75 130 } 76 } 77 78 GraphicsContext3DPrivate::~GraphicsContext3DPrivate() 79 { 80 } 81 82 void GraphicsContext3DPrivate::releaseResources() 83 { 84 // Release the current context and drawable only after destroying any associated gl resources. 85 if (m_platformContext) 86 m_platformContext->destroy(); 87 88 if (m_platformSurface) 89 m_platformSurface->destroy(); 90 91 if (m_platformContext) 92 m_platformContext->releaseCurrent(); 93 } 94 95 bool GraphicsContext3DPrivate::createSurface(PageClientEfl*, bool) 96 { 97 notImplemented(); 98 return false; 99 } 100 101 void GraphicsContext3DPrivate::setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback> callBack) 102 { 103 m_contextLostCallback = callBack; 131 132 Evas_GL_Config config = { 133 EVAS_GL_RGBA_8888, 134 EVAS_GL_DEPTH_BIT_8, 135 EVAS_GL_STENCIL_NONE, // FIXME: set EVAS_GL_STENCIL_BIT_8 after fixing Evas_GL bug. 136 EVAS_GL_OPTIONS_NONE, 137 EVAS_GL_MULTISAMPLE_NONE 138 }; 139 140 // Create a new Evas_GL_Surface object 141 m_evasGLSurface = evas_gl_surface_create(m_evasGL, &config, width, height); 142 if (!m_evasGLSurface) 143 return false; 144 145 #if USE(ACCELERATED_COMPOSITING) 146 if (renderDirectlyToHostWindow) { 147 Evas_Native_Surface nativeSurface; 148 // Fill in the Native Surface information from the given Evas GL surface. 149 evas_gl_native_surface_get(m_evasGL, m_evasGLSurface, &nativeSurface); 150 151 // FIXME: Create and specially set up a evas_object which act as the render targer surface. 152 } 153 #endif 154 155 return true; 156 } 157 158 void GraphicsContext3DPrivate::setCurrentGLContext(void* context, void* surface) 159 { 160 m_glContext = context; 161 m_glSurface = surface; 104 162 } 105 163 106 164 PlatformGraphicsContext3D GraphicsContext3DPrivate::platformGraphicsContext3D() const 107 165 { 108 return m_platformContext->handle(); 166 if (m_renderStyle == GraphicsContext3D::RenderToCurrentGLContext) 167 return m_glContext; 168 169 return m_evasGLContext; 109 170 } 110 171 111 172 bool GraphicsContext3DPrivate::makeContextCurrent() 112 173 { 113 bool returnValue = m_platformContext->makeCurrent(m_platformSurface.get()); 114 115 if (m_contextLostCallback && !m_platformContext->isValid()) { 116 returnValue = false; 117 m_contextLostCallback->onContextLost(); 118 // FIXME: Restore context 119 } 120 121 return returnValue; 174 return evas_gl_make_current(m_evasGL, m_evasGLSurface, m_evasGLContext); 122 175 } 123 176 … … 130 183 131 184 #if USE(GRAPHICS_SURFACE) 132 void GraphicsContext3DPrivate::createGraphicsSurfaces(const IntSize&) 133 { 134 m_pendingSurfaceResize = true; 185 void GraphicsContext3DPrivate::createGraphicsSurfaces(const IntSize& size) 186 { 187 if (size.isEmpty()) 188 m_graphicsSurface.clear(); 189 else 190 m_graphicsSurface = GraphicsSurface::create(size, m_surfaceFlags); 135 191 } 136 192 137 193 uint32_t GraphicsContext3DPrivate::copyToGraphicsSurface() 138 194 { 139 if (!m_ platformContext || !makeContextCurrent())195 if (!m_graphicsSurface) 140 196 return 0; 141 197 142 if (m_pendingSurfaceResize) { 143 m_pendingSurfaceResize = false; 144 m_platformSurface->setGeometry(IntRect(0, 0, m_context->m_currentWidth, m_context->m_currentHeight)); 145 } 146 147 if (m_context->m_attrs.antialias) { 148 #if !USE(OPENGL_ES_2) 149 glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, m_context->m_multisampleFBO); 150 glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, m_context->m_fbo); 151 glBlitFramebuffer(0, 0, m_context->m_currentWidth, m_context->m_currentHeight, 0, 0, m_context->m_currentWidth, m_context->m_currentHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); 152 #endif 153 } 154 155 m_platformSurface->updateContents(m_context->m_texture, IntRect(0, 0, m_context->m_currentWidth, m_context->m_currentHeight), m_context->m_boundFBO); 156 return 0; 198 makeContextCurrent(); 199 m_graphicsSurface->copyFromTexture(m_context->m_texture, IntRect(0, 0, m_context->m_currentWidth, m_context->m_currentHeight)); 200 return m_graphicsSurface->swapBuffers(); 157 201 } 158 202 159 203 GraphicsSurfaceToken GraphicsContext3DPrivate::graphicsSurfaceToken() const 160 204 { 161 return m_ surfaceHandle;205 return m_graphicsSurface->exportToken(); 162 206 } 163 207 #endif -
trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.h
r135074 r135083 1 1 /* 2 2 Copyright (C) 2012 Samsung Electronics 3 Copyright (C) 2012 Intel Corporation.4 3 5 4 This library is free software; you can redistribute it and/or … … 22 21 #define GraphicsContext3DPrivate_h 23 22 24 #if USE(3D_GRAPHICS) || USE(ACCELERATED_COMPOSITING)25 26 23 #include "GraphicsContext3D.h" 27 24 … … 31 28 32 29 #if USE(GRAPHICS_SURFACE) 33 #include "G LPlatformSurface.h"30 #include "GraphicsSurface.h" 34 31 #endif 35 32 36 #include "GLPlatformContext.h" 37 #include <wtf/PassOwnPtr.h> 33 typedef struct _Evas_GL Evas_GL; 34 typedef struct _Evas_GL_Surface Evas_GL_Surface; 35 typedef struct _Evas_GL_Context Evas_GL_Context; 36 typedef struct _Evas_GL_Config Evas_GL_Config; 37 typedef struct _Evas_GL_API Evas_GL_API; 38 38 39 39 class PageClientEfl; … … 49 49 ~GraphicsContext3DPrivate(); 50 50 51 bool createSurface(PageClientEfl*, bool);52 51 PlatformGraphicsContext3D platformGraphicsContext3D() const; 53 void setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback> callBack); 52 54 53 #if USE(ACCELERATED_COMPOSITING) 55 54 PlatformLayer* platformLayer() const; … … 63 62 void createGraphicsSurfaces(const IntSize&); 64 63 #endif 64 65 65 bool makeContextCurrent(); 66 void releaseResources(); 66 bool createSurface(PageClientEfl*, bool renderDirectlyToEvasGLObject); 67 void setCurrentGLContext(void*, void*); 68 67 69 GraphicsContext3D::Attributes m_attributes; 68 70 GraphicsContext3D* m_context; 69 71 HostWindow* m_hostWindow; 70 OwnPtr<GLPlatformContext> m_platformContext;71 OwnPtr<GLPlatformSurface> m_platformSurface;72 72 #if USE(GRAPHICS_SURFACE) 73 GraphicsSurfaceToken m_surfaceHandle; 73 GraphicsSurface::Flags m_surfaceFlags; 74 RefPtr<GraphicsSurface> m_graphicsSurface; 74 75 #endif 75 OwnPtr<GraphicsContext3D::ContextLostCallback> m_contextLostCallback; 76 76 77 ListHashSet<GC3Denum> m_syntheticErrors; 77 bool m_pendingSurfaceResize; 78 79 OwnPtr<Ecore_Evas> m_ecoreEvas; 80 Evas_GL* m_evasGL; 81 Evas_GL_Context* m_evasGLContext; 82 Evas_GL_Surface* m_evasGLSurface; 83 void* m_glContext; 84 void* m_glSurface; 85 Evas_GL_API* m_api; 86 GraphicsContext3D::RenderStyle m_renderStyle; 78 87 }; 79 88 80 89 } // namespace WebCore 81 90 82 #endif 83 84 #endif 91 #endif // GraphicsLayerEfl_h
Note:
See TracChangeset
for help on using the changeset viewer.