Changeset 188522 in webkit
- Timestamp:
- Aug 17, 2015 8:36:16 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r188520 r188522 1 2015-08-17 Jinyoung Hur <hur.ims@navercorp.com> 2 3 Fix possible EGL and GLX makeCurrent problem of GLPlatformContext and GLPlatformSurface 4 https://bugs.webkit.org/show_bug.cgi?id=147695 5 6 Reviewed by Gyuyoung Kim. 7 8 GLPLatformContext::makeCurrent is implemented to do no-op when it thinks, comparing with a static 9 variable declared in GLPlatformContext.cpp, there is no changes. This can lead to not-working 10 makeCurrent when other part of codes, e.g., Cairo-gl, change EGL or GLX current context by calling 11 something like eglMakeCurrent. So modify GLPLatformContext::makeCurrent to use the return value of 12 eglGetCurrentContext or glXGetCurrentContext as a comparing target rather than a static variable. 13 In addition, GLPlatformSurface::isCurrentDrawable is also modified to use eglGetCurrentSurface or 14 glXGetCurrentDrawable rather than a static variable. 15 16 There are no tests because already existing GL tests will verify this change. 17 18 * platform/graphics/opengl/GLPlatformContext.cpp: 19 (WebCore::GLPlatformContext::makeCurrent): 20 (WebCore::GLPlatformContext::releaseCurrent): 21 (WebCore::GLCurrentContextWrapper::GLCurrentContextWrapper): Deleted. 22 (WebCore::GLPlatformContext::~GLPlatformContext): Deleted. 23 (WebCore::GLPlatformContext::isCurrentContext): Deleted. 24 (WebCore::GLPlatformContext::getCurrent): Deleted. 25 * platform/graphics/opengl/GLPlatformContext.h: 26 * platform/graphics/opengl/GLPlatformSurface.cpp: 27 (WebCore::GLPlatformSurface::~GLPlatformSurface): Deleted. 28 (WebCore::GLPlatformSurface::isCurrentDrawable): Deleted. 29 (WebCore::GLPlatformSurface::onMakeCurrent): Deleted. 30 (WebCore::GLPlatformSurface::destroy): Deleted. 31 * platform/graphics/opengl/GLPlatformSurface.h: 32 * platform/graphics/surfaces/egl/EGLSurface.cpp: 33 (WebCore::EGLTransportSurface::isCurrentDrawable): 34 (WebCore::EGLOffScreenSurface::isCurrentDrawable): 35 * platform/graphics/surfaces/egl/EGLSurface.h: 36 * platform/graphics/surfaces/glx/GLXSurface.cpp: 37 (WebCore::GLXTransportSurface::isCurrentContext): 38 (WebCore::GLXOffScreenSurface::isCurrentContext): 39 * platform/graphics/surfaces/glx/GLXSurface.h: 40 1 41 2015-08-15 Chris Dumez <cdumez@apple.com> 2 42 -
trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp
r183432 r188522 44 44 static PFNGLGETGRAPHICSRESETSTATUSARBPROC glGetGraphicsResetStatus = 0; 45 45 #endif 46 static GLPlatformContext* m_currentContext = 0;47 46 48 47 class GLCurrentContextWrapper : public GLPlatformContext { … … 57 56 m_contextHandle = eglGetCurrentContext(); 58 57 #endif 59 if (m_contextHandle)60 m_currentContext = this;61 58 } 62 59 63 60 virtual ~GLCurrentContextWrapper() { } 61 62 bool isCurrentContext() const override 63 { 64 return true; 65 } 64 66 }; 65 67 … … 186 188 GLPlatformContext::~GLPlatformContext() 187 189 { 188 if (this == m_currentContext)189 m_currentContext = 0;190 190 } 191 191 … … 194 194 m_contextLost = false; 195 195 196 if ( m_currentContext == this&& (!surface || surface->isCurrentDrawable()))197 return true; 198 199 m_currentContext = 0;196 if (isCurrentContext() && (!surface || surface->isCurrentDrawable())) 197 return true; 198 199 GLPlatformContext* currentContext = 0; 200 200 201 201 if (!surface || (surface && !surface->drawable())) 202 202 platformReleaseCurrent(); 203 203 else if (platformMakeCurrent(surface)) { 204 m_currentContext = this;204 currentContext = this; 205 205 surface->onMakeCurrent(); 206 206 } … … 229 229 } 230 230 231 return m_currentContext;231 return currentContext; 232 232 } 233 233 … … 239 239 void GLPlatformContext::releaseCurrent() 240 240 { 241 if (this == m_currentContext) { 242 m_currentContext = 0; 241 if (isCurrentContext()) 243 242 platformReleaseCurrent(); 244 }245 243 } 246 244 … … 250 248 } 251 249 252 bool GLPlatformContext::i sCurrentContext() const250 bool GLPlatformContext::initialize(GLPlatformSurface*, PlatformContext) 253 251 { 254 252 return true; 255 }256 257 bool GLPlatformContext::initialize(GLPlatformSurface*, PlatformContext)258 {259 return true;260 }261 262 GLPlatformContext* GLPlatformContext::getCurrent()263 {264 return m_currentContext;265 253 } 266 254 -
trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.h
r166889 r188522 74 74 virtual PlatformContext handle() const; 75 75 76 virtual bool isCurrentContext() const ;76 virtual bool isCurrentContext() const = 0; 77 77 78 78 bool isValid() const; … … 80 80 // Destroys any GL resources associated with this context. 81 81 virtual void destroy(); 82 83 static GLPlatformContext* getCurrent();84 82 85 83 protected: -
trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp
r183868 r188522 41 41 namespace WebCore { 42 42 43 static GLPlatformSurface* m_currentDrawable = 0;44 45 43 std::unique_ptr<GLPlatformSurface> GLPlatformSurface::createOffScreenSurface(SurfaceAttributes attributes) 46 44 { … … 69 67 GLPlatformSurface::~GLPlatformSurface() 70 68 { 71 if (m_currentDrawable == this)72 m_currentDrawable = 0;73 69 } 74 70 … … 98 94 } 99 95 100 bool GLPlatformSurface::isCurrentDrawable() const101 {102 return m_currentDrawable == this;103 }104 105 96 void GLPlatformSurface::onMakeCurrent() 106 97 { 107 m_currentDrawable = this;108 98 } 109 99 … … 118 108 void GLPlatformSurface::destroy() 119 109 { 120 if (m_currentDrawable == this)121 m_currentDrawable = 0;122 110 } 123 111 -
trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h
r183868 r188522 64 64 virtual void swapBuffers(); 65 65 66 virtual bool isCurrentDrawable() const; 66 virtual bool isCurrentDrawable() const = 0; 67 67 68 virtual void onMakeCurrent(); 68 69 -
trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp
r183868 r188522 87 87 } 88 88 89 bool EGLTransportSurface::isCurrentDrawable() const 90 { 91 return m_drawable == eglGetCurrentSurface(EGL_DRAW); 92 } 93 89 94 EGLTransportSurface::~EGLTransportSurface() 90 95 { … … 139 144 } 140 145 146 bool EGLOffScreenSurface::isCurrentDrawable() const 147 { 148 return m_drawable == eglGetCurrentSurface(EGL_DRAW); 149 } 150 141 151 PlatformSurfaceConfig EGLOffScreenSurface::configuration() 142 152 { -
trunk/Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h
r177429 r188522 45 45 virtual void destroy() override; 46 46 virtual GLPlatformSurface::SurfaceAttributes attributes() const override; 47 virtual bool isCurrentDrawable() const override; 47 48 48 49 protected: … … 58 59 virtual void destroy() override; 59 60 virtual GLPlatformSurface::SurfaceAttributes attributes() const override; 61 virtual bool isCurrentDrawable() const override; 60 62 61 63 protected: -
trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp
r184197 r188522 129 129 } 130 130 131 bool GLXTransportSurface::isCurrentDrawable() const 132 { 133 return m_drawable == glXGetCurrentDrawable(); 134 } 135 131 136 GLXOffScreenSurface::GLXOffScreenSurface(SurfaceAttributes surfaceAttributes) 132 137 : GLPlatformSurface(surfaceAttributes) … … 166 171 { 167 172 return m_configSelector->pixmapContextConfig(); 173 } 174 175 bool GLXOffScreenSurface::isCurrentDrawable() const 176 { 177 return m_drawable == glXGetCurrentDrawable(); 168 178 } 169 179 -
trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h
r177429 r188522 44 44 virtual void setGeometry(const IntRect&) override; 45 45 virtual GLPlatformSurface::SurfaceAttributes attributes() const override; 46 virtual bool isCurrentDrawable() const override; 46 47 virtual void destroy() override; 47 48 … … 56 57 virtual ~GLXOffScreenSurface(); 57 58 virtual PlatformSurfaceConfig configuration() override; 59 virtual bool isCurrentDrawable() const override; 58 60 virtual void destroy() override; 59 61
Note: See TracChangeset
for help on using the changeset viewer.