Changeset 135083 in webkit


Ignore:
Timestamp:
Nov 18, 2012, 3:07:30 PM (13 years ago)
Author:
rakuco@webkit.org
Message:

Unreviewed, rolling out r135074.
http://trac.webkit.org/changeset/135074
https://bugs.webkit.org/show_bug.cgi?id=102619

Made most layout tests crash. (Requested by rakuco on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-11-18

  • PlatformEfl.cmake:
  • platform/graphics/efl/GraphicsContext3DEfl.cpp:

(WebCore::GraphicsContext3D::create):
(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::GraphicsContext3D::~GraphicsContext3D):
(WebCore::GraphicsContext3D::makeContextCurrent):
(WebCore::GraphicsContext3D::setContextLostCallback):

  • platform/graphics/efl/GraphicsContext3DPrivate.cpp:

(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::createSurface):
(WebCore::GraphicsContext3DPrivate::setCurrentGLContext):
(WebCore::GraphicsContext3DPrivate::platformGraphicsContext3D):
(WebCore::GraphicsContext3DPrivate::makeContextCurrent):
(WebCore::GraphicsContext3DPrivate::createGraphicsSurfaces):
(WebCore::GraphicsContext3DPrivate::copyToGraphicsSurface):
(WebCore::GraphicsContext3DPrivate::graphicsSurfaceToken):

  • platform/graphics/efl/GraphicsContext3DPrivate.h:

(GraphicsContext3DPrivate):

  • platform/graphics/opengl/GLDefs.h: Removed.
  • platform/graphics/opengl/GLPlatformContext.cpp: Removed.
  • platform/graphics/opengl/GLPlatformContext.h: Removed.
  • platform/graphics/opengl/GLPlatformSurface.cpp: Removed.
  • platform/graphics/opengl/GLPlatformSurface.h: Removed.
  • platform/graphics/surfaces/glx/GLXContext.cpp: Removed.
  • platform/graphics/surfaces/glx/GLXContext.h: Removed.
  • platform/graphics/surfaces/glx/GLXSurface.cpp: Removed.
  • platform/graphics/surfaces/glx/GLXSurface.h: Removed.
Location:
trunk/Source/WebCore
Files:
6 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r135082 r135083  
     12012-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
    1392012-11-18  Antti Koivisto  <antti@apple.com>
    240
  • trunk/Source/WebCore/PlatformEfl.cmake

    r135074 r135083  
    278278    "${WEBCORE_DIR}/platform/graphics/opengl"
    279279    "${WEBCORE_DIR}/platform/graphics/surfaces"
    280     "${WEBCORE_DIR}/platform/graphics/surfaces/glx"
    281280    "${WEBCORE_DIR}/platform/graphics/texmap"
    282281  )
     
    288287    platform/graphics/opengl/Extensions3DOpenGL.cpp
    289288    platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
    290     platform/graphics/opengl/GLPlatformContext.cpp
    291     platform/graphics/opengl/GLPlatformSurface.cpp
    292289    platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
    293290    platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
    294291    platform/graphics/surfaces/GraphicsSurface.cpp
    295     platform/graphics/surfaces/glx/GLXSurface.cpp
    296     platform/graphics/surfaces/glx/GLXContext.cpp
    297292    platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp
    298293    platform/graphics/texmap/TextureMapperGL.cpp
  • trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp

    r135074 r135083  
    11/*
    22    Copyright (C) 2012 Samsung Electronics
    3     Copyright (C) 2012 Intel Corporation.
    43
    54    This library is free software; you can redistribute it and/or
     
    2928#include "OpenGLShims.h"
    3029#include "PlatformContextCairo.h"
     30#include <GL/glx.h>
    3131
    3232#if USE(OPENGL_ES_2)
     
    4040PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, RenderStyle renderStyle)
    4141{
    42     if (renderStyle == RenderDirectlyToHostWindow)
    43         return 0;
    44 
    4542    RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attrs, hostWindow, renderStyle));
    4643    return context->m_private ? context.release() : 0;
     
    7168    , m_private(adoptPtr(new GraphicsContext3DPrivate(this, hostWindow, renderStyle)))
    7269{
    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) {
    7482        m_private = nullptr;
    7583        return;
    7684    }
    7785
    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    }
    7993
    8094    if (renderStyle == RenderOffscreen) {
     
    134148    glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
    135149#endif
    136     glClearColor(0.0, 0.0, 0.0, 0.0);
    137150}
    138151
    139152GraphicsContext3D::~GraphicsContext3D()
    140153{
    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();
    149158    glDeleteTextures(1, &m_texture);
    150159
     
    157166        glDeleteFramebuffers(1, &m_multisampleFBO);
    158167    } else if (m_attrs.stencil || m_attrs.depth) {
     168
    159169#if USE(OPENGL_ES_2)
    160170        if (m_attrs.depth)
     
    166176        glDeleteRenderbuffers(1, &m_depthStencilBuffer);
    167177    }
    168 
    169178    glDeleteFramebuffers(1, &m_fbo);
    170     m_private->releaseResources();
    171179}
    172180
     
    190198bool GraphicsContext3D::makeContextCurrent()
    191199{
     200    if (!m_private)
     201        return false;
     202
     203    if (m_renderStyle == RenderToCurrentGLContext)
     204        return true;
     205
    192206    return m_private->makeContextCurrent();
    193207}
     
    202216}
    203217
    204 void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback> callBack)
    205 {
    206     m_private->setContextLostCallback(callBack);
     218void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>)
     219{
     220    notImplemented();
    207221}
    208222
  • trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp

    r135074 r135083  
    11/*
    22    Copyright (C) 2012 Samsung Electronics
    3     Copyright (C) 2012 Intel Corporation.
    43
    54    This library is free software; you can redistribute it and/or
     
    2019
    2120#include "config.h"
     21
     22#if USE(3D_GRAPHICS) || USE(ACCELERATED_COMPOSITING)
    2223#include "GraphicsContext3DPrivate.h"
    2324
    24 #if USE(3D_GRAPHICS) || USE(ACCELERATED_COMPOSITING)
    25 
     25#include "GraphicsContext.h"
    2626#include "HostWindow.h"
    2727#include "NotImplemented.h"
    2828#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>
    3633
    3734namespace WebCore {
     
    4037    : m_context(context)
    4138    , 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
    4450    if (m_hostWindow && m_hostWindow->platformPageClient()) {
    4551        // FIXME: Implement this code path for WebKit1.
     
    4854    }
    4955
    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
    5592#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
     100GraphicsContext3DPrivate::~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
    69113#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
     118bool 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.
    75130    }
    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
     158void GraphicsContext3DPrivate::setCurrentGLContext(void* context, void* surface)
     159{
     160    m_glContext = context;
     161    m_glSurface = surface;
    104162}
    105163
    106164PlatformGraphicsContext3D GraphicsContext3DPrivate::platformGraphicsContext3D() const
    107165{
    108     return m_platformContext->handle();
     166    if (m_renderStyle == GraphicsContext3D::RenderToCurrentGLContext)
     167        return m_glContext;
     168
     169    return m_evasGLContext;
    109170}
    110171
    111172bool GraphicsContext3DPrivate::makeContextCurrent()
    112173{
    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);
    122175}
    123176
     
    130183
    131184#if USE(GRAPHICS_SURFACE)
    132 void GraphicsContext3DPrivate::createGraphicsSurfaces(const IntSize&)
    133 {
    134     m_pendingSurfaceResize = true;
     185void GraphicsContext3DPrivate::createGraphicsSurfaces(const IntSize& size)
     186{
     187    if (size.isEmpty())
     188        m_graphicsSurface.clear();
     189    else
     190        m_graphicsSurface = GraphicsSurface::create(size, m_surfaceFlags);
    135191}
    136192
    137193uint32_t GraphicsContext3DPrivate::copyToGraphicsSurface()
    138194{
    139     if (!m_platformContext || !makeContextCurrent())
     195    if (!m_graphicsSurface)
    140196        return 0;
    141197
    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();
    157201}
    158202
    159203GraphicsSurfaceToken GraphicsContext3DPrivate::graphicsSurfaceToken() const
    160204{
    161     return m_surfaceHandle;
     205    return m_graphicsSurface->exportToken();
    162206}
    163207#endif
  • trunk/Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.h

    r135074 r135083  
    11/*
    22    Copyright (C) 2012 Samsung Electronics
    3     Copyright (C) 2012 Intel Corporation.
    43
    54    This library is free software; you can redistribute it and/or
     
    2221#define GraphicsContext3DPrivate_h
    2322
    24 #if USE(3D_GRAPHICS) || USE(ACCELERATED_COMPOSITING)
    25 
    2623#include "GraphicsContext3D.h"
    2724
     
    3128
    3229#if USE(GRAPHICS_SURFACE)
    33 #include "GLPlatformSurface.h"
     30#include "GraphicsSurface.h"
    3431#endif
    3532
    36 #include "GLPlatformContext.h"
    37 #include <wtf/PassOwnPtr.h>
     33typedef struct _Evas_GL               Evas_GL;
     34typedef struct _Evas_GL_Surface       Evas_GL_Surface;
     35typedef struct _Evas_GL_Context       Evas_GL_Context;
     36typedef struct _Evas_GL_Config        Evas_GL_Config;
     37typedef struct _Evas_GL_API           Evas_GL_API;
    3838
    3939class PageClientEfl;
     
    4949    ~GraphicsContext3DPrivate();
    5050
    51     bool createSurface(PageClientEfl*, bool);
    5251    PlatformGraphicsContext3D platformGraphicsContext3D() const;
    53     void setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback>  callBack);
     52
    5453#if USE(ACCELERATED_COMPOSITING)
    5554    PlatformLayer* platformLayer() const;
     
    6362    void createGraphicsSurfaces(const IntSize&);
    6463#endif
     64
    6565    bool makeContextCurrent();
    66     void releaseResources();
     66    bool createSurface(PageClientEfl*, bool renderDirectlyToEvasGLObject);
     67    void setCurrentGLContext(void*, void*);
     68
    6769    GraphicsContext3D::Attributes m_attributes;
    6870    GraphicsContext3D* m_context;
    6971    HostWindow* m_hostWindow;
    70     OwnPtr<GLPlatformContext> m_platformContext;
    71     OwnPtr<GLPlatformSurface> m_platformSurface;
    7272#if USE(GRAPHICS_SURFACE)
    73     GraphicsSurfaceToken m_surfaceHandle;
     73    GraphicsSurface::Flags m_surfaceFlags;
     74    RefPtr<GraphicsSurface> m_graphicsSurface;
    7475#endif
    75     OwnPtr<GraphicsContext3D::ContextLostCallback> m_contextLostCallback;
     76
    7677    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;
    7887};
    7988
    8089} // namespace WebCore
    8190
    82 #endif
    83 
    84 #endif
     91#endif // GraphicsLayerEfl_h
Note: See TracChangeset for help on using the changeset viewer.