List items
Items from the current list are shown below.
Gecko
21 May 2024 : Day 239 #
I got a bit carried away yesterday delving into the reasons why QuickMozView::updatePaintNode() was failing to fire on ESR 91. My conclusion was that it came down to the mIsPainted flag, part of the QMozViewPrivate class and which was remaining stubbornly set to false when running ESR 91.
While in this state the invalidTexture flag inside updatePaintNode() never gets set to false since it's defined like this:
That all sounds very plausible and comprehensible, but it begs the question: "why is mIsPainted never being set to true?". That's what I plan to find out over the coming days.
Unsurprisingly we can see the initial value it's set to in the QMozViewPrivate constructor, where it's initially set to false:
But as you can see the Gecko debug symbols are messed up: we can see eight calls to methods inside libxul in a row, but it's not telling us the names of the methods.
So I'm going to reinstall the packages, including the debug packages, to get the symbols back. Before the gap I was using a custom build with extra debug output and exporting of textures, but I don't need any of that any more so I can just reinstall the packages from the official repositories. Much easier and quicker than rebuilding the packages locally and installing them that way:
For completeness I also performed the same checks on ESR 91. You'll not be surprised to hear that the QMozViewPrivate::OnFirstPaint() method is never called in the newer build.
The ESR 78 backtrace tells us what should be happening on ESR 91. So our task now is to find out why it's not. This takes us a step forwards and gives us something to look into further; we'll pick this avenue of investigation up again tomorrow.
If you'd like to read any of my other gecko diary entries, they're all available on my Gecko-dev Diary page.
While in this state the invalidTexture flag inside updatePaintNode() never gets set to false since it's defined like this:
const bool invalidTexture = !mComposited || !d->mIsPainted || !d->mViewInitialized || !d->mHasCompositor || !d->mContext->registeredWindow() || !d->mMozWindow;Notice how if any single value in this list is set to false then the combined value of invalidTexture will be set to true. The consequence of this is that the following clause is always executed:
if (!mTexture && invalidTexture) { QSGSimpleRectNode *node = static_cast<QSGSimpleRectNode *>(oldNode); if (!node) { node = new QSGSimpleRectNode; } node->setColor(d->mBackgroundColor); node->setRect(boundingRect); return node; }The return at the end of this means the updatePaintNode() method returns early. This means that the code beyond the clause never gets executed and crucially this section is never entered:
if (!node) { QMozExtTexture * const texture = new QMozExtTexture; mTexture = texture; connect(texture, &QMozExtTexture::getPlatformImage, d->mMozWindow, &QMozWindow::getPlatformImage, Qt::DirectConnection); node = new MozExtMaterialNode; node->setTexture(mTexture); }Here we can see both mTexture and the MozExtMaterialNode object being created. That's what we need for the rendering to proceed. So if this portion of code is never executed, we'll never get the rendered page to appear.
That all sounds very plausible and comprehensible, but it begs the question: "why is mIsPainted never being set to true?". That's what I plan to find out over the coming days.
Unsurprisingly we can see the initial value it's set to in the QMozViewPrivate constructor, where it's initially set to false:
QMozViewPrivate::QMozViewPrivate(IMozQViewIface *aViewIface, QObject *publicPtr) : mViewIface(aViewIface) [...] , mIsPainted(false) [...]It's also set to false after a call to QMozViewPrivate::reset():
QMozViewPrivate::reset() { if (mIsPainted) { mIsPainted = false; mViewIface->firstPaint(-1, -1); } [...]But the important part is where it gets set to true and that only happens in one place; here in the OnFirstPaint() method:
void QMozViewPrivate::OnFirstPaint(int32_t aX, int32_t aY) { mIsPainted = true; mViewIface->firstPaint(aX, aY); }This method doesn't get explicitly called anywhere in the QtMozEmbed code, so to find out where it's actually getting used I'm going to drop to the debugger on my ESR 78 device.
(gdb) break QMozViewPrivate::OnFirstPaint Breakpoint 13 at 0x7fbfbf56b8: file qmozview_p.cpp, line 1113. (gdb) r [...] Thread 1 "harbour-webview" hit Breakpoint 13, QMozViewPrivate:: OnFirstPaint (this=0x55557b08f0, aX=0, aY=0) at qmozview_p.cpp:1113 1113 mIsPainted = true; (gdb) bt #0 QMozViewPrivate::OnFirstPaint (this=0x55557b08f0, aX=0, aY=0) at qmozview_p.cpp:1113 #1 0x0000007fbb2f5d90 in ?? () from /usr/lib64/xulrunner-qt5-78.15.1/libxul.so #2 0x0000007fb8932f50 in ?? () from /usr/lib64/xulrunner-qt5-78.15.1/libxul.so #3 0x0000007fb8920238 in ?? () from /usr/lib64/xulrunner-qt5-78.15.1/libxul.so #4 0x0000007fb88428cc in ?? () from /usr/lib64/xulrunner-qt5-78.15.1/libxul.so #5 0x0000007fb88482d8 in ?? () from /usr/lib64/xulrunner-qt5-78.15.1/libxul.so #6 0x0000007fb8849d58 in ?? () from /usr/lib64/xulrunner-qt5-78.15.1/libxul.so #7 0x0000007fb8809d48 in ?? () from /usr/lib64/xulrunner-qt5-78.15.1/libxul.so #8 0x0000007fb880e740 in ?? () from /usr/lib64/xulrunner-qt5-78.15.1/libxul.so #9 0x0000007fbfbed924 in MessagePumpQt::HandleDispatch (this=0x555578ef30) at qmessagepump.cpp:63 #10 0x0000007fbfbeda9c in MessagePumpQt::event (this=<optimized out>, e=<optimized out>) at qmessagepump.cpp:51 #11 0x0000007fbebe1144 in QCoreApplication::notify(QObject*, QEvent*) () from / usr/lib64/libQt5Core.so.5 #12 0x0000007fbebe12e8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ( ) from /usr/lib64/libQt5Core.so.5 #13 0x0000007fbebe36b8 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQt5Core.so.5 [...] #21 0x0000005555557bcc in main () (gdb)Well that's an unhelpful mess. But it is at least getting called from inside the Gecko code and that in itself is both helpful to know and a good thing (I was concerned it might be called from inside Qt which would have made it considerably harder to track down; the fact it's coming from Gecko means we can skip a layer of Qt indirection and get closer to the source of the problem more quickly).
But as you can see the Gecko debug symbols are messed up: we can see eight calls to methods inside libxul in a row, but it's not telling us the names of the methods.
So I'm going to reinstall the packages, including the debug packages, to get the symbols back. Before the gap I was using a custom build with extra debug output and exporting of textures, but I don't need any of that any more so I can just reinstall the packages from the official repositories. Much easier and quicker than rebuilding the packages locally and installing them that way:
# zypper install --force xulrunner-qt5-78.15.1+git33.2-1.21.1.jolla xulrunner-qt5-debuginfo-78.15.1+git33.2-1.21.1.jolla xul runner-qt5-debugsource-78.15.1+git33.2-1.21.1.jolla xulrunner-qt5-misc-78.15.1+git33.2-1.21.1.jolla Loading repository data... Reading installed packages... Forcing installation of 'xulrunner-qt5-78.15.1+git33.2-1.21.1.jolla.aarch64' from repository 'jolla'. Forcing installation of 'xulrunner-qt5-debuginfo-78.15.1+git33.2-1.21.1.jolla.aarch64' from repository 'jolla'. Forcing installation of 'xulrunner-qt5-debugsource-78.15.1+git33.2-1.21.1.jolla.aarch64' from repository 'jolla'. Forcing installation of 'xulrunner-qt5-misc-78.15.1+git33.2-1.21.1.jolla.aarch64' from repository 'jolla'. [...] 2 packages to downgrade, 2 to reinstall, 2 to change vendor. Overall download size: 758.8 MiB. Already cached: 0 B. After the operation, 2.4 GiB will be freed. Continue? [y/n/v/...? shows all options] (y): y [...]Okay, with the debug symbols now properly aligned we can try getting the backtrace again, but hopefully this time with a bit more helpful detail.
Thread 1 "harbour-webview" hit Breakpoint 1, QMozViewPrivate:: OnFirstPaint (this=0x55555cb830, aX=0, aY=0) at qmozview_p.cpp:1113 1113 mIsPainted = true; (gdb) bt #0 QMozViewPrivate::OnFirstPaint (this=0x55555cb830, aX=0, aY=0) at qmozview_p.cpp:1113 #1 0x0000007fbb2f5d90 in mozilla::embedlite::EmbedLiteViewParent:: RecvOnFirstPaint (this=0x55555d9d70, aX=@0x7fffffea18: 0, aY=@0x7fffffea28: 0) at mobile/sailfishos/embedshared/EmbedLiteViewParent.cpp:237 #2 0x0000007fb8932f50 in mozilla::embedlite::PEmbedLiteViewParent:: OnMessageReceived (this=0x55555d9d70, msg__=...) at PEmbedLiteViewParent.cpp:1600 #3 0x0000007fb8920238 in mozilla::embedlite::PEmbedLiteAppParent:: OnMessageReceived (this=<optimized out>, msg__=...) at obj-build-mer-qt-xr/dist/include/mozilla/ipc/ProtocolUtils.h:866 #4 0x0000007fb88428cc in mozilla::ipc::MessageChannel::DispatchAsyncMessage ( this=this@entry=0x7f8c888578, aProxy=aProxy@entry=0x555560d1d0, aMsg=...) at obj-build-mer-qt-xr/dist/include/mozilla/ipc/ProtocolUtils.h:866 #5 0x0000007fb88482d8 in mozilla::ipc::MessageChannel::DispatchMessage ( this=0x7f8c888578, aMsg=...) at ipc/glue/MessageChannel.cpp:2100 #6 0x0000007fb8849b50 in mozilla::ipc::MessageChannel::RunMessage ( this=<optimized out>, aTask=...) at ipc/glue/MessageChannel.cpp:1959 #7 0x0000007fb8849d58 in mozilla::ipc::MessageChannel::MessageTask::Run ( this=0x7f8e127650) at obj-build-mer-qt-xr/dist/include/mozilla/ipc/MessageChannel.h:610 #8 0x0000007fb8809d48 in MessageLoop::RunTask (aTask=..., this=0x55557c5200) at ipc/chromium/src/base/message_loop.cc:487 #9 MessageLoop::DeferOrRunPendingTask (pending_task=..., this=0x55557c5200) at ipc/chromium/src/base/message_loop.cc:478 #10 MessageLoop::DeferOrRunPendingTask (this=0x55557c5200, pending_task=...) at ipc/chromium/src/base/message_loop.cc:476 #11 0x0000007fb880e740 in MessageLoop::DoWork (this=<optimized out>) at ipc/chromium/src/base/message_loop.cc:551 #12 MessageLoop::DoWork (this=0x55557c5200) at ipc/chromium/src/base/ message_loop.cc:530 #13 0x0000007fbfbed924 in MessagePumpQt::HandleDispatch (this=0x55557a6f40) at qmessagepump.cpp:63 #14 0x0000007fbfbeda9c in MessagePumpQt::event (this=<optimized out>, e=<optimized out>) at qmessagepump.cpp:51 #15 0x0000007fbebe1144 in QCoreApplication::notify(QObject*, QEvent*) () from / usr/lib64/libQt5Core.so.5 #16 0x0000007fbebe12e8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ( ) from /usr/lib64/libQt5Core.so.5 #17 0x0000007fbebe36b8 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQt5Core.so.5 [...] #25 0x0000005555557bcc in main () (gdb)That's much better and gives us a much clearer idea of where OnFirstPaint() is getting called. But as we can see from this it's actually being triggered by receipt of a message. The next step will therefore be to find out where the OnFirstPaint message is being sent from.
For completeness I also performed the same checks on ESR 91. You'll not be surprised to hear that the QMozViewPrivate::OnFirstPaint() method is never called in the newer build.
The ESR 78 backtrace tells us what should be happening on ESR 91. So our task now is to find out why it's not. This takes us a step forwards and gives us something to look into further; we'll pick this avenue of investigation up again tomorrow.
If you'd like to read any of my other gecko diary entries, they're all available on my Gecko-dev Diary page.
Comments
Uncover Disqus comments