Embedding initialize GL context before gfxPlatform::Init

RESOLVED FIXED in mozilla14

Status

()

Core
Graphics
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: romaxa, Assigned: romaxa)

Tracking

Trunk
mozilla14
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

6 years ago
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
(Assignee)

Comment 1

6 years ago
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
(Assignee)

Comment 2

6 years ago
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
Assignee: nobody → romaxa
Status: NEW → ASSIGNED
Attachment #607746 - Flags: review?(roc)
Attachment #607746 - Flags: review?(roc) → review+
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.
Attachment #607746 - Flags: review+ → review-
(Assignee)

Comment 4

6 years ago
Created attachment 607754 [details] [diff] [review]
Init GfxPlatform for any first qt nsIWidget, and protect ::Init from multiple calls
Attachment #607746 - Attachment is obsolete: true
Attachment #607754 - Flags: review?(roc)
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
Attachment #607754 - Flags: review?(roc) → review+
https://hg.mozilla.org/mozilla-central/rev/501cf2524658
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
You need to log in before you can comment on or make changes to this bug.