tdesktop icon indicating copy to clipboard operation
tdesktop copied to clipboard

Linux: group voice chat window is not shown since 2.9: qt.qpa.backingstore: composeAndFlush: makeCurrent() failed

Open powerman opened this issue 3 years ago • 26 comments

Steps to reproduce

  1. Run 2.9.0 or 2.9.2 on Linux
  2. In some group, start voice chat or join to already started

Expected behaviour

New window should opens with voice chat UI.

Actual behaviour

New window is created (it is shown on task panel and it affect switching between windows by Alt-Tab), but it is not shown on the screen.

Configuration

Operating system: Gentoo Linux, up to date.

Version of Telegram Desktop: 2.9.0 and 2.9.2 has this issue. 2.8.10 works okay.

Installation source (Linux Only) - the official website / GitHub releases / flatpak / snap / distribution package: Gentoo package net-im/telegram-desktop-bin.

Used theme: Day, blue.

Logs: I've compared stdout/err output for 2.8.10 (which works okay) and 2.9.2 - the only noticeable difference is 2.9.2 output a LOT of times this line:

error: : cannot open error: : cannot open error: : cannot open QPainter::setRenderHint: Painter must be active to set rendering hints qt.qpa.backingstore: composeAndFlush: makeCurrent() failed qt.qpa.backingstore: composeAndFlush: makeCurrent() failed ... (channel.cc:902): Changing voice state, recv=1 send=0 for {mid: audio1, media_type: audio} qt.qpa.backingstore: composeAndFlush: makeCurrent() failed qt.qpa.backingstore: composeAndFlush: makeCurrent() failed (audio_device_buffer.cc:287): Size of playout buffer: 960 qt.qpa.backingstore: composeAndFlush: makeCurrent() failed qt.qpa.backingstore: composeAndFlush: makeCurrent() failed qt.qpa.backingstore: composeAndFlush: makeCurrent() failed qt.qpa.backingstore: composeAndFlush: makeCurrent() failed qt.qpa.backingstore: composeAndFlush: makeCurrent() failed qt.qpa.backingstore: composeAndFlush: makeCurrent() failed qt.qpa.backingstore: composeAndFlush: makeCurrent() failed qt.qpa.backingstore: composeAndFlush: makeCurrent() failed qt.qpa.backingstore: composeAndFlush: makeCurrent() failed ...

powerman avatar Aug 18 '21 02:08 powerman

  1. Is the version from https://desktop.telegram.org working?
  2. Is it working if you disable OpenGL in Settings > Advanced > Performance?

john-preston avatar Aug 19 '21 07:08 john-preston

  1. I believe this Gentoo package uses official binaries, look at https://github.com/gentoo/gentoo/blob/master/net-im/telegram-desktop-bin/telegram-desktop-bin-2.9.2.ebuild#L11-L12
  2. Yes, disabling OpenGL helps, thanks!

powerman avatar Aug 19 '21 19:08 powerman

God damn it, finally found the solution for it using arch btw disabling opengl helped as well, I have an nvidia card

foodornt avatar Sep 20 '21 20:09 foodornt

God damn it, finally found the solution for it using arch btw disabling opengl helped as well, I have an nvidia card

what drivers version you are using? and what specific nvidia card?

Aokromes avatar Sep 20 '21 20:09 Aokromes

There's QT_FATAL_WARNINGS environment variable, it makes the app crash on Nth Qt warning. E.g. QT_FATAL_WARNINGS=1 will make the app crash on first warning. That way, a backtrace can be gotten. What's needed here is a backtrace for qt.qpa.backingstore: composeAndFlush: makeCurrent() failed line, it's second warning in the log from first post (error : cannot open aren't Qt warnings, it's hunspell). When the app will crash after that line, you can send a crash report on next launch, post crash report tag here. You should use the version from official website and have installation of beta versions enabled in order to get crash report window.

ilya-fedin avatar Sep 21 '21 08:09 ilya-fedin

I got the same problem and fix it too by disabling opengl support. So to debug I re-enable the opengl setting and launch telegram-desktop by using QT_FATAL_WARNINGS=1.

First try no succes because of this:

QApplication: invalid style override 'adwaita-dark' passed, ignoring it.
	Available styles: Windows, Fusion

So I've launched telegram-desktop with QT_STYLE_OVERRIDE="" QT_FATAL_WARNINGS=1 then I make a video group call and the application crash on this warning:

QPainter::setRenderHint: Painter must be active to set rendering hints

zen2 avatar Oct 11 '21 18:10 zen2

You can use numbers greater than 1 if you're getting other warnings.

ilya-fedin avatar Oct 11 '21 18:10 ilya-fedin

God damn it, finally found the solution for it using arch btw disabling opengl helped as well, I have an nvidia card

what drivers version you are using? and what specific nvidia card?

The 470 one I have a 1050ti

and now I actually got it fixed with OpenGL enabled by enabling pipeline composition iirc from nvidia-settings

foodornt avatar Oct 13 '21 04:10 foodornt

I have a 1050ti

and now I actually got it fixed with OpenGL enabled by enabling pipeline composition iirc from nvidia-settings

I've a GTX 1060. I've tried enabling "Force Composition Pipeline", then "Force Full Composition Pipeline" - nothing helps.

powerman avatar Oct 13 '21 08:10 powerman

@Aokromes can you restore the label since no one did the required steps?

ilya-fedin avatar Oct 13 '21 14:10 ilya-fedin

This only happens on i3wm (and probably similar WMs too) for me and my friend. I tought it was the WM's problem and didn't look further. I'm in a state similar to powerman, with a Nvidia's Geforce 1060 I have tried messing with composition pipeline and nothing helps. Only thing that did it for me was to disable OpenGL.

Click to expand backtrace. Compiled using instructions on repo exactly as stated.
[New Thread 0x7fffdbdfe640 (LWP 194320)]
(audio_device_buffer.cc:64): AudioDeviceBuffer::ctor
(audio_device_buffer.cc:180): SetRecordingSampleRate(48000)
(audio_device_buffer.cc:200): SetRecordingChannels(1)
(audio_device_buffer.cc:81): RegisterAudioCallback
(webrtc_voice_engine.cc:269): WebRtcVoiceEngine::WebRtcVoiceEngine
(webrtc_video_engine.cc:629): WebRtcVideoEngine::WebRtcVideoEngine()
(webrtc_voice_engine.cc:291): WebRtcVoiceEngine::Init
[New Thread 0x7fffdaffe640 (LWP 194321)]
(audio_device_buffer.cc:81): RegisterAudioCallback
(adm_helpers.cc:77): Failed to set stereo recording mode.
qt.qpa.backingstore: composeAndFlush: makeCurrent() failed

Thread 1 "Telegram" received signal SIGABRT, Aborted.
0x00007ffff76d1d22 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff76d1d22 in raise () at /usr/lib/libc.so.6
#1  0x00007ffff76bb862 in abort () at /usr/lib/libc.so.6
#2  0x000000000873e336 in qt_message_fatal (context=..., message=...)
    at global/qlogging.cpp:1914
#3  QMessageLogger::warning(char const*, ...) const
    (this=this@entry=0x7fffffffd210, msg=msg@entry=0x127106f8 "composeAndFlush: makeCurrent() failed") at global/qlogging.cpp:660
#4  0x00000000107e5644 in QPlatformBackingStore::composeAndFlush(QWindow*, QRegion const&, QPoint const&, QPlatformTextureList*, bool)
    (this=this@entry=0x7fffd9370f50, window=window@entry=
    0x7fffedb46c00, region=..., offset=..., textures=textures@entry=0x7ffff260e880, translucentBackground=translucentBackground@entry=false)
    at painting/qplatformbackingstore.cpp:353
#5  0x000000000ff83684 in QXcbBackingStore::composeAndFlush(QWindow*, QRegion const&, QPoint const&, QPlatformTextureList*, bool)
    (translucentBackground=false, textures=0x7ffff260e880, offset=..., region=..., window=0x7fffedb46c00, this=0x7fffd9370f50) at qxcbbackingstore.cpp:900
#6  QXcbBackingStore::composeAndFlush(QWindow*, QRegion const&, QPoint const&, QPlatformTextureList*, bool) (
    this=0x7fffd9370f50, window=0x7fffedb46c00, region=..., offset=..., textures=0x7ffff260e880, translucentBackground=<optimized out>) at qxcbbackingstore.cpp:891
#7  0x00000000104be8fa in QWidgetRepaintManager::flush(QWidget*, QRegion const&, QPlatformTextureList*)
    (widgetTextures=0x7ffff260e880, region=<optimized out>, widget=0x7fffd927e520, this=<optimized out>) at kernel/qwidgetrepaintmanager.cpp:1179
#8  QWidgetRepaintManager::flush(QWidget*, QRegion const&, QPlatformTextureList*)
    (this=<optimized out>, widget=0x7fffd927e520, region=<optimized out>, widgetTextures=<optimized out>) at kernel/qwidgetrepaintmanager.cpp:1114
#9  0x00000000104bf885 in QWidgetRepaintManager::flush()
    (this=this@entry=0x7fffd927f160) at kernel/qwidgetrepaintmanager.cpp:1082
#10 0x00000000104c1e1c in QWidgetRepaintManager::paintAndFlush()
    (this=this@entry=0x7fffd927f160) at kernel/qwidgetrepaintmanager.cpp:1014
#11 0x00000000104c26cf in QWidgetRepaintManager::sync(QWidget*, QRegion const&)
    (this=0x7fffd927f160, exposedWidget=0x7fffd927e520, exposedRegion=...)
    at kernel/qwidgetrepaintmanager.cpp:743
#12 0x000000001023f2b4 in QWidgetWindow::handleExposeEvent(QExposeEvent*)
    (this=<optimized out>, event=0x7fffffffdae0)
    at ../../include/QtGui/../../src/gui/kernel/qevent.h:479
#13 0x000000001023fc70 in QWidgetWindow::event(QEvent*)
    (event=0x7fffffffdae0, this=0x7fffedb46c00) at kernel/qwidgetwindow.cpp:347
#14 QWidgetWindow::event(QEvent*) (this=0x7fffedb46c00, event=0x7fffffffdae0)
    at kernel/qwidgetwindow.cpp:239
#15 0x00000000101f59af in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    (this=this@entry=0x7ffff6eb4480, receiver=receiver@entry=0x7fffedb46c00, e=e@entry=0x7fffffffdae0) at kernel/qapplication.cpp:3645
#16 0x00000000101ff198 in QApplication::notify(QObject*, QEvent*)
    (this=0x7fffffffe000, receiver=0x7fffedb46c00, e=0x7fffffffdae0)
    at kernel/qapplication.cpp:3169
#17 0x0000000009f8269b in Core::Sandbox::notifyOrInvoke(QObject*, QEvent*)
    (this=0x7fffffffe000, receiver=0x7fffedb46c00, e=0x7fffffffdae0)
    at /usr/src/tdesktop/Telegram/SourceFiles/core/sandbox.cpp:540
#18 0x0000000009f827b0 in Core::Sandbox::notify(QObject*, QEvent*)
    (this=0x7fffffffe000, receiver=0x7fffedb46c00, e=0x7fffffffdae0)
    at /usr/src/tdesktop/Telegram/SourceFiles/core/sandbox.cpp:556
--Type <RET> for more, q to quit, c to continue without paging--c
#19 0x0000000010b771e0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (event=0x7fffffffdae0, receiver=0x7fffedb46c00) at kernel/qcoreapplication.cpp:1063
#20 QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) (receiver=receiver@entry=0x7fffedb46c00, event=event@entry=0x7fffffffdae0) at kernel/qcoreapplication.cpp:1470
#21 0x00000000105560d7 in QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*) (e=0x7fffdb80cc40) at kernel/qguiapplication.cpp:3258
#22 0x00000000105562f1 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) (e=e@entry=0x7fffdb80cc40) at kernel/qguiapplication.cpp:2070
#23 0x000000001052cae4 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#24 0x000000000ff8fc8a in xcbSourceDispatch(GSource*, GSourceFunc, gpointer) (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#25 0x00007ffff7cac4dc in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#26 0x00007ffff7d00749 in  () at /usr/lib/libglib-2.0.so.0
#27 0x00007ffff7ca9bc1 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#28 0x0000000010bcfb4e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7fffee9e7940, flags=...) at kernel/qeventdispatcher_glib.cpp:427
#29 0x0000000010b7585e in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (flags=..., this=0x7fffffffdde0) at kernel/qeventloop.cpp:139
#30 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7fffffffdde0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:232
#31 0x0000000010b7e926 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#32 0x0000000009f7e9ae in Core::Sandbox::start() (this=0x7fffffffe000) at /usr/src/tdesktop/Telegram/SourceFiles/core/sandbox.cpp:157
#33 0x0000000009f66104 in Core::Launcher::executeApplication() (this=0x7ffff6e1d520) at /usr/src/tdesktop/Telegram/SourceFiles/core/launcher.cpp:534
#34 0x0000000009f63b6f in Core::Launcher::exec() (this=0x7ffff6e1d520) at /usr/src/tdesktop/Telegram/SourceFiles/core/launcher.cpp:333
#35 0x000000000c174157 in Platform::Launcher::exec() (this=0x7ffff6e1d520) at /usr/src/tdesktop/Telegram/SourceFiles/platform/linux/launcher_linux.cpp:76
#36 0x000000000cdb9d0c in main(int, char**) (argc=1, argv=0x7fffffffe348) at /usr/src/tdesktop/Telegram/SourceFiles/main.cpp:12
(gdb) 

Henriquelay avatar Oct 15 '21 23:10 Henriquelay

Maybe blacklist proprietary nvidia driver... Looks like Qt's OpenGL handling is not compatible with it.

ilya-fedin avatar Oct 15 '21 23:10 ilya-fedin

Can someone affected provide Telegram's log.txt with debug mode activated?

ilya-fedin avatar Oct 15 '21 23:10 ilya-fedin

There you go. Haven't run from the built debug mode binary after pasting that backtrace, so should be about the same execution. log.txt

Henriquelay avatar Oct 15 '21 23:10 Henriquelay

Changing from the downloaded binary from official website to telegram-desktop in arch community repo fixed the issue.

Henriquelay avatar Nov 03 '21 19:11 Henriquelay

Apparently, because they built 3.1.11 that is supposed to be macOS only and includes nvidia blacklist?

ilya-fedin avatar Nov 03 '21 22:11 ilya-fedin

I'm not sure. The release didn't say anything about the whole release being exclusive do macOS besides Run natively on Apple Silicon (macOS only)., which I assume it's only this feature that's macOS specific. I can say the Telegram proccess shows up on nvidia-smi, but I don't really know what that means exacly, but I think it is running OpenGL on the gpu.

Henriquelay avatar Nov 04 '21 15:11 Henriquelay

but I think it is running OpenGL on the gpu.

I don't think so. The blacklist commit is present since v3.1.10 tag.

ilya-fedin avatar Nov 04 '21 15:11 ilya-fedin

As I said, I don't really know what appearing on nvidia-smi means, but it is there, along with other hardware-accelerated processes. photo_2021-11-04_13-03-18

Henriquelay avatar Nov 04 '21 16:11 Henriquelay

If your version is newer than 3.1.10, it doesn't use OpenGL. And nvidia-smi is lying then.

ilya-fedin avatar Nov 04 '21 23:11 ilya-fedin

That is very curious, since disabling OpenGL in the options menu makes it not appear on nvidia-smi, and enabling it again makes it show up there, as intended if OpenGL were working fine. On both occasions, group call window render fine. opengl-on-censored opengl-off-censored What does it use if it's not OpenGL? Blacklisted or not, something is running on my NVidia card. I'm just curious to what's going on.

Henriquelay avatar Nov 05 '21 04:11 Henriquelay

When opengl is disabled in settings, it doesn't do any calls to opengl, when it's enabled, it gets hardware info via Qt's OpenGL API and stops further initialization if hardware is blacklisted. Apparently, calling these calls is enough for process to be shown in nvidia-smi.

ilya-fedin avatar Nov 05 '21 04:11 ilya-fedin

Thanks for the explanation! But since I can't change my drivers (yah I'll buy AMD next), I can't reproduce the issue on current versions and keep feeding information, so I'll leave it to the others. Also, thanks for so many quick responses.

Henriquelay avatar Nov 05 '21 04:11 Henriquelay

Also, you should see OpenGL: Disable on NVIDIA driver on Linux. in the log.txt (when OpenGL is enabled of course)

ilya-fedin avatar Nov 05 '21 04:11 ilya-fedin

@john-preston You have unconditionally blocked OpenGL acceleration on NVIDIA drivers. Could you please add an option for experienced users to reenable GL who encounter no any issues with the drivers? I would prefer the "Enable OpenGL rendering for media" checkbox in Advanced Settings works in a more predictable way. So that it would reflect the real state of hardware rendering. If you consider acceleration should be disabled by default on NVIDIA in Linux, it is okay but please let one to activate the feature on their own risk.

I have checked group video chats and their window with Qt 5.12.2 on NVIDIA GeForce 940M (this is laptop revision). I use MATE from fully updated Ubuntu 21.10. And I personally experience no bugs nor glitches when OpenGL is on. For this, I had to rewrite the checkVendor static variable by means of a debugger. Not to mention this is very inconvenient for day-to-day usage.

For history and for anyone interested, I am leaving here commands which I used with tdesktop of version 3.4.8.

my GDB script: gdb telegram-desktop
break Telegram/lib_ui/ui/gl/gl_detection.cpp:179
run
set {bool}& 'Ui::GL::CheckCapabilities(QWidget*)::checkVendor' = true
disable
continue

mymedia2 avatar Jan 23 '22 15:01 mymedia2

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

stale[bot] avatar Jul 30 '22 14:07 stale[bot]