Last Comment Bug 737354 - Embedding initialize GL context before gfxPlatform::Init
: Embedding initialize GL context before gfxPlatform::Init
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: Trunk
: x86 Linux
: -- normal (vote)
: mozilla14
Assigned To: Oleg Romashin (:romaxa)
:
: Milan Sreckovic [:milan]
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-20 01:28 PDT by Oleg Romashin (:romaxa)
Modified: 2012-03-22 06:40 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Init GfxPlatform for any first nsIWidget (779 bytes, patch)
2012-03-20 15:38 PDT, Oleg Romashin (:romaxa)
roc: review-
Details | Diff | Splinter Review
Init GfxPlatform for any first qt nsIWidget, and protect ::Init from multiple calls (4.09 KB, patch)
2012-03-20 16:01 PDT, Oleg Romashin (:romaxa)
roc: review+
Details | Diff | Splinter Review

Description Oleg Romashin (:romaxa) 2012-03-20 01:28:43 PDT
I'm having problems with Embedding GL debugging with MOZ_GL_DEBUG, because it crashes due to GLContext initialization happening before gfxPlatform::Init

Can't find symbol 'GetTexImage'
Can't find symbol 'GetTexLevelParameteriv'
Fatal: void mozilla::gl::GLContext::raw_fBindFramebuffer(GLenum, GLuint) called on non-current context 0x4d468400. The current context for this thread is (nil).
###!!! ABORT: file ../../../dist/include/GLContext.h, line 1734
###!!! ABORT: file ../../../dist/include/GLContext.h, line 1734


Basically I see first attempt to create GLContext on PaintEvent () widget GetLayerManager.
Probably we can try init gfxPlatform somewhere in nsWebBrowser::Init... but I'm not sure
Comment 1 Oleg Romashin (:romaxa) 2012-03-20 15:24:56 PDT
Here is backtrace of first attempt to init GLContext (and gfxPlatform::Init not called yet at this moment)
#1  0x3dd34f28 in mozalloc_abort (msg=<value optimized out>) at /memory/mozalloc/mozalloc_abort.cpp:89
#2  0x3f64fbb8 in Abort (aMsg=0xa <Address 0xa out of bounds>) at /xpcom/base/nsDebugImpl.cpp:388
#3  0x3f64fe34 in NS_DebugBreak_P (aSeverity=3, aStr=0x0, aExpr=<value optimized out>, aFile=<value optimized out>, aLine=1734)
    at /xpcom/base/nsDebugImpl.cpp:375
#4  0x3eabb03c in mozilla::gl::GLContext::BeforeGLCall (this=0x44c3f400, 
    glFunction=0x3fea1de0 "void mozilla::gl::GLContext::raw_fBindFramebuffer(GLenum, GLuint)") at ../../../dist/include/GLContext.h:1734
#5  0x3eabb80c in mozilla::gl::GLContext::raw_fBindFramebuffer (this=0xa, target=36160, framebuffer=0) at ../../../dist/include/GLContext.h:2639
#6  0x3f724310 in BindUserDrawFBO (this=0x44c3f400) at /gfx/gl/GLContext.h:1001
#7  mozilla::gl::GLContext::InitFramebuffers (this=0x44c3f400) at /gfx/gl/GLContext.h:1053
#8  0x3f72493c in mozilla::gl::GLContextEGL::Init (this=0x44c3f400)
    at /gfx/gl/GLContextProviderEGL.cpp:354
#9  0x3f725020 in mozilla::gl::GLContextProviderEGL::CreateForWindow (aWidget=<value optimized out>)
    at /gfx/gl/GLContextProviderEGL.cpp:1405
#10 0x3f706990 in mozilla::layers::LayerManagerOGL::CreateContext (this=0x3c2755b0)
    at /gfx/layers/opengl/LayerManagerOGL.cpp:172
#11 0x3f3f8754 in mozilla::layers::LayerManagerOGL::Initialize (this=0xa, force=false) at ../../dist/include/LayerManagerOGL.h:110
#12 0x3f3fad30 in nsBaseWidget::GetLayerManager (this=0x3c28a720, aShadowManager=<value optimized out>, aBackendHint=<value optimized out>, 
    aPersistence=<value optimized out>, aAllowRetaining=0x0) at /widget/xpwidgets/nsBaseWidget.cpp:912
#13 0x3f3e6c34 in nsWindow::DoPaint (this=0x3c28a720, aPainter=0xae97d64c, aOption=<value optimized out>, aWidget=0x3c292980)
    at /widget/qt/nsWindow.cpp:1079
#14 0x3b36ae54 in _q_paintItem (item=<value optimized out>, painter=0xae97d64c, option=0x3c2972ac, widget=0x3c292980, 
    useWindowOpacity=<value optimized out>, painterStateProtection=true) at graphicsview/qgraphicsscene.cpp:4316
#15 0x3b3844f0 in QGraphicsScenePrivate::drawItemHelper (this=<value optimized out>, item=0x4433cca8, painter=0xae97d64c, option=0x3c2972ac, 
    widget=0x3c292980, painterStateProtection=true) at graphicsview/qgraphicsscene.cpp:4429
#16 0x3b38908c in QGraphicsScenePrivate::draw (this=0x3c297180, item=0x4433cca8, painter=0xae97d64c, viewTransform=<value optimized out>, 
    transformPtr=0x441a8750, exposedRegion=0x3c20c6f8, widget=0x3c292980, opacity=1, effectTransform=0x0, wasDirtyParentSceneTransform=false, 
    drawItem=true) at graphicsview/qgraphicsscene.cpp:4964
#17 0x3b389b5c in QGraphicsScenePrivate::drawSubtreeRecursive (this=<value optimized out>, item=<value optimized out>, painter=0xae97d64c, 
    viewTransform=0x0, exposedRegion=0x3c20c6f8, widget=0x3c292980, parentOpacity=<value optimized out>, effectTransform=0x0)
    at graphicsview/qgraphicsscene.cpp:4855
#18 0x3b389138 in QGraphicsScenePrivate::draw (this=0x3c297180, item=0xae97e938, painter=0xae97d64c, viewTransform=<value optimized out>, 
    transformPtr=0x0, exposedRegion=0x3c20c6f8, widget=0x3c292980, opacity=1, effectTransform=0x0, wasDirtyParentSceneTransform=false, 
    drawItem=false) at graphicsview/qgraphicsscene.cpp:4981
#19 0x3b389b5c in QGraphicsScenePrivate::drawSubtreeRecursive (this=<value optimized out>, item=<value optimized out>, painter=0xae97d64c, 
    viewTransform=0x0, exposedRegion=0x3c20c6f8, widget=0x3c292980, parentOpacity=<value optimized out>, effectTransform=0x0)
    at graphicsview/qgraphicsscene.cpp:4855
Comment 2 Oleg Romashin (:romaxa) 2012-03-20 15:38:53 PDT
Created attachment 607746 [details] [diff] [review]
Init GfxPlatform for any first nsIWidget

O, not sure if anyone does embedmozilla in other toolkits, but for Qt case we can ensure gfxPlatform for first nsIWidget
Comment 3 Robert O'Callahan (:roc) (email my personal email if necessary) 2012-03-20 15:40:46 PDT
Comment on attachment 607746 [details] [diff] [review]
Init GfxPlatform for any first nsIWidget

Review of attachment 607746 [details] [diff] [review]:
-----------------------------------------------------------------

Er, hang on ... gfxPlatform::Init isn't protected against multiple initializations.

Please fix that.
Comment 4 Oleg Romashin (:romaxa) 2012-03-20 16:01:34 PDT
Created attachment 607754 [details] [diff] [review]
Init GfxPlatform for any first qt nsIWidget, and protect ::Init from multiple calls
Comment 5 Robert O'Callahan (:roc) (email my personal email if necessary) 2012-03-20 16:12:32 PDT
Comment on attachment 607754 [details] [diff] [review]
Init GfxPlatform for any first qt nsIWidget, and protect ::Init from multiple calls

Review of attachment 607754 [details] [diff] [review]:
-----------------------------------------------------------------

::: widget/qt/nsWindow.cpp
@@ +257,5 @@
>      mPinchEvent.needDispatch = false;
>      mMoveEvent.needDispatch = false;
>      
>      if (!gGlobalsInitialized) {
> +        gfxPlatrform::GetPlatform();

fix typo
Comment 6 Marco Bonardo [::mak] 2012-03-22 06:40:52 PDT
https://hg.mozilla.org/mozilla-central/rev/501cf2524658

Note You need to log in before you can comment on or make changes to this bug.