Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt6: Current master segfaults on qt-xcb(x11) and qt-wayland qpa on Qt6.4+ #754

Open
warpme opened this issue May 21, 2023 · 19 comments · May be fixed by #984
Open

Qt6: Current master segfaults on qt-xcb(x11) and qt-wayland qpa on Qt6.4+ #754

warpme opened this issue May 21, 2023 · 19 comments · May be fixed by #984

Comments

@warpme
Copy link
Contributor

warpme commented May 21, 2023

  • Platform:
    MiniMyth2; qt6 build from sources

  • MythTV version:
    current master (tested on v34-Pre-d54bb609dac)

  • Package version:

  • Component:
    Qt6

What steps will reproduce the bug?

Build myth-master on system with Qt6 newer than 6.3 and run mythtv with drawing to x11 or wayland.
Drawing to eglfs qpa works ok.
As issue:

  1. starts to happen only when Qt6 is newer than 6.3
  2. Verification of relevant qt6 dependencies looks ok (libs vers. verified with documentation; no any warnings from Qt configure)
  3. all version newer than 6.3 (6.4.0 from 7 moths ago) are failing - I don't believe it is 7+ months long-standing Qt6 bug.
    I suspect issue might be rather related to i.e. https://doc.qt.io/qt-6/opengl-changes-qt6.html starting to manifetst incompatibility between mythtv OpenGL code and Qt6 current OpenGL support?

How often does it reproduce? Is there a required condition?

always

What is the expected behaviour?

correct operation on Qt6.4 and Qt6.5

What do you see instead?

Qt 6.5.0 with drawing to X11 gives me segfault like this: https://gist.github.com/warpme/95abdde87d468ce8cf4bb2416159e6d4

The same binaries (qt6, mythtv) are working ok with drawing to eglfs.
(https://gist.github.com/warpme/cdc7e9a23bca4cb10c0433d880cc288d).

Additional information

I tested following Qt versions:
(each time only qt was rebuild)

  • 5.15.9 - ok
  • 6.2.3 - ok
  • 6.3.2 - ok (last in v6.3 line)
  • 6.4.0 - nok (first in v6.4 line)
  • 6.4.3 - nok (last in v6.4 line)
  • 6.5.0 - nok
@warpme
Copy link
Contributor Author

warpme commented May 23, 2023

Small update with this issue:

I filled (potential) QTbug report about this issue (https://bugreports.qt.io/browse/QTBUG-113728)

Qt devs replayed:

Guessing after a quick look at the code base that you are relying on top-level QWidgets being backed by a QWindow with RasterGLSurface https://doc.qt.io/qt-6/qsurface.html#SurfaceType-enum by default. That type is not used from 6.4 on, rather the window for top-level widgets default to RasterSurface, OpenGLSurface, VulkanSurface, Direct3DSurface, etc. depending on the presence of QOpenGLWidget and QQuickWidget instances within the child hierarchy. Since those are probably not used in your case, the top-level widget is always backed by a RasterSurface QWindow from 6.4 on.

So this looks like not QTbug - but rather MythTV incompatibility with Qt6.4+

I'm opened to any ideas/code changes/tests needed to be done to move forward to fix this issue....

@garybuhrmaster
Copy link
Contributor

As I recall, at least one related crash is caused by calling initializeOpenGLFunctions before setting a valid OpenGL context (and MythTV does not currently set a valid context). There needs to be a ....->makeCurrent(...surface...) before calling initializeOpenGLFunctions (and perhaps other setup, too).

I presume someone fluent in Qt6 and OpenGL would be able to quickly determine what needs to be done.

@kmdewaal
Copy link
Contributor

Problem can be reproduced.

@kmdewaal kmdewaal self-assigned this Jun 1, 2023
@kmdewaal kmdewaal removed their assignment Jul 16, 2023
@kmdewaal
Copy link
Contributor

I did have a look at it but I do not think that I can fix this on the short term.

@jhoyt4
Copy link
Contributor

jhoyt4 commented Dec 14, 2023

I believe I'm experiencing a similar issue on macOS with QT 6.4 through 6.6

Mythfrontend output and top of the crash report follow:

% /Volumes/MythFrontend-arm64-14.1.1-v34-Pre-598-g0a25e6693e/mythfrontend.app/Contents/MacOS/mythfrontend.sh 
2023-12-14 15:24:18.518681 I  Setup Interrupt: 2 handler
2023-12-14 15:24:18.518687 I  Setup Terminated: 15 handler
2023-12-14 15:24:18.518688 I  Setup Segmentation fault: 11 handler
2023-12-14 15:24:18.518690 I  Setup Abort trap: 6 handler
2023-12-14 15:24:18.518691 I  Setup Floating point exception: 8 handler
2023-12-14 15:24:18.518692 I  Setup Illegal instruction: 4 handler
2023-12-14 15:24:18.518693 I  Setup Bus error: 10 handler
2023-12-14 15:24:18.518695 I  Setup Hangup: 1 handler
2023-12-14 15:24:18.518696 I  Setup User defined signal 1: 30 handler
2023-12-14 15:24:18.518697 I  Setup User defined signal 2: 31 handler
2023-12-14 15:24:18.518915 C  mythfrontend version: master [v34-Pre-598-g0a25e6693e] www.mythtv.org
2023-12-14 15:24:18.518916 C  Qt version: compile: 6.6.0, runtime: 6.6.0
2023-12-14 15:24:18.518926 I  macOS 14.1 (arm64)
2023-12-14 15:24:18.518926 N  Enabled verbose msgs:  general
2023-12-14 15:24:18.518928 N  Setting Log Level to LOG_INFO
2023-12-14 15:24:18.530064 I  Added logging to the console
2023-12-14 15:24:18.530083 N  Using runtime prefix = /Volumes/MythFrontend-arm64-14.1.1-v34-Pre-598-g0a25e6693e/mythfrontend.app/Contents/Resources
2023-12-14 15:24:18.530084 N  Using configuration directory = /Users/jhoyt/.mythtv
2023-12-14 15:24:18.530200 I  Assumed character encoding: en_US.UTF-8
2023-12-14 15:24:18.531205 I  Loading en_us translation for module mythfrontend
2023-12-14 15:24:18.532391 I  Empty LocalHostName. This is typical.
2023-12-14 15:24:18.532396 I  Using a profile name of: 'miniM1.home.jgh4.com' (Usually the same as this host's name.)
2023-12-14 15:24:18.532471 I  Start up testing connections. DB 192.168.0.9, BE , attempt 0, status dbAwake, Delay: 2000
2023-12-14 15:24:20.174798 N  Setting QT default locale to en_US
2023-12-14 15:24:20.174801 I  Current locale en_US
2023-12-14 15:24:20.175001 N  Reading locale defaults from /Volumes/MythFrontend-arm64-14.1.1-v34-Pre-598-g0a25e6693e/mythfrontend.app/Contents/Resources/share/mythtv//locales/en_us.xml
2023-12-14 15:24:20.229679 E  PowerOSX: Failed to setup power source callback
2023-12-14 15:24:20.229733 I  Power: Supported actions: Suspend,Restart,Shutdown
2023-12-14 15:24:20.436597 I  Listening on TCP 0.0.0.0:6551
2023-12-14 15:24:20.438389 I  Listening on TCP [::]:6551
2023-12-14 15:24:20.615867 I  Loading en_us translation for module mythfrontend
2023-12-14 15:24:20.624867 I  Display: Screen '(Make: Unknown Model: Unknown)' not found, defaulting to primary screen (Hanns.G HH241)
2023-12-14 15:24:20.624890 I  Display: Using screen 'Hanns.G HH241' (Make: Unknown Model: Unknown)
2023-12-14 15:24:20.624938 I  Display: Qt screen pixel ratio: 1.00
2023-12-14 15:24:20.624946 I  Display: Geometry: 1920x1080+0+0 Size(Qt): 518.809mmx288.758mm
2023-12-14 15:24:20.624998 I  VRR: No variable refresh rate support detected
2023-12-14 15:24:20.625009 N  Display: Desktop video mode: 1920x1080 60.000Hz
2023-12-14 15:24:20.646605 I  InputHandler: Starting
2023-12-14 15:24:20.646702 E  AppleRemote::_findAppleRemoteDevice(AppleIRController) failed
2023-12-14 15:24:20.646723 E  AppleRemote::_findAppleRemoteDevice(AppleTVIRReceiver) failed
2023-12-14 15:24:20.646724 E  AppleRemote::startListening() failed
2023-12-14 15:24:20.646989 I  UDPListener: Enabling
2023-12-14 15:24:20.666413 I  Binding to UDP 0.0.0.0:6948
2023-12-14 15:24:20.666456 I  Binding to UDP [::]:6948
dbus[53120]: Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
2023-12-14 15:24:20.734063 I  Using Frameless Window
2023-12-14 15:24:20.734066 I  Using Full Screen Window
2023-12-14 15:24:20.734081 I  Display: Have main widget
2023-12-14 15:24:20.734082 I  Display: Have main window
2023-12-14 15:24:20.734088 I  Display: Screen '(Make: Unknown Model: Unknown)' not found, defaulting to primary screen (Hanns.G HH241)
2023-12-14 15:24:20.886596 I  Qt: QOpenGLContext::makeCurrent() called with non-opengl surface 0x600001a54f10
2023-12-14 15:24:20.886598 E  OpenGL: makeCurrent failed
Handling Segmentation fault: 11
/Volumes/MythFrontend-arm64-14.1.1-v34-Pre-598-g0a25e6693e/mythfrontend.app/Contents/MacOS/mythfrontend.sh: line 15: 53120 Segmentation fault: 11  ./mythfrontend $@
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               mythfrontend [53120]
Path:                  /Volumes/VOLUME/mythfrontend.app/Contents/MacOS/mythfrontend
Identifier:            mythfrontend
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        Exited process [52828]
Responsible:           Terminal [43146]
User ID:               501

Date/Time:             2023-12-14 15:24:21.9127 -0500
OS Version:            macOS 14.1.1 (23B81)
Report Version:        12
Anonymous UUID:        0BFA2638-A4CC-8E49-1FBF-D9DD6CD2D1AF

Sleep/Wake UUID:       4F159E84-088D-4513-9B04-F5A08552CBF6

Time Awake Since Boot: 2000000 seconds
Time Since Wake:       80 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000008
Exception Codes:       0x0000000000000001, 0x0000000000000008

VM Region Info: 0x8 is not in any region.  Bytes before following region: 4328570872
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      10200c000-10231c000    [ 3136K] r-x/r-x SM=COW  .../mythfrontend

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   QtGui                         	       0x1081b9780 QOpenGLContext::shareGroup() const + 0
1   QtGui                         	       0x1081c3ba8 0x107f44000 + 2620328
2   QtGui                         	       0x1081c36ec QOpenGLFunctions::initializeOpenGLFunctions() + 24
3   libmythui-34.34.dylib         	       0x10386e918 MythRenderOpenGL::Init() + 68

Thread 1:
0   libsystem_pthread.dylib       	       0x181877e28 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib       	       0x181877e28 start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib       	       0x181877e28 start_wqthread + 0

Thread 4:: com.apple.CFSocket.private
0   libsystem_kernel.dylib        	       0x181847a14 __select + 8
1   CoreFoundation                	       0x1819830d4 __CFSocketManager + 636
2   libsystem_pthread.dylib       	       0x18187d034 _pthread_start + 136
3   libsystem_pthread.dylib       	       0x181877e3c thread_start + 8

Thread 5:: LogForward
0   libsystem_kernel.dylib        	       0x1818400ac __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18187d5fc _pthread_cond_wait + 1228
2   QtCore                        	       0x1086294cc 0x108488000 + 1709260
3   QtCore                        	       0x1086291fc 0x108488000 + 1708540
4   QtCore                        	       0x108629140 QWaitCondition::wait(QMutex*, QDeadlineTimer) + 108
5   QtCore                        	       0x1086290a4 QWaitCondition::wait(QMutex*, unsigned long) + 64
6   libmythbase-34.34.dylib       	       0x104c2194c LogForwardThread::run() + 428
7   libsystem_pthread.dylib       	       0x18187d034 _pthread_start + 136
8   libsystem_pthread.dylib       	       0x181877e3c thread_start + 8

Thread 6:: Logger
0   libsystem_kernel.dylib        	       0x1818400ac __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18187d5fc _pthread_cond_wait + 1228
2   QtCore                        	       0x1086294cc 0x108488000 + 1709260
3   QtCore                        	       0x1086291fc 0x108488000 + 1708540
4   QtCore                        	       0x108629140 QWaitCondition::wait(QMutex*, QDeadlineTimer) + 108
5   QtCore                        	       0x1086290a4 QWaitCondition::wait(QMutex*, unsigned long) + 64
6   libmythbase-34.34.dylib       	       0x104c18a9c LoggerThread::run() + 708
7   libsystem_pthread.dylib       	       0x18187d034 _pthread_start + 136
8   libsystem_pthread.dylib       	       0x181877e3c thread_start + 8

Thread 7:: com.apple.NSEventThread
0   libsystem_kernel.dylib        	       0x18183c8b4 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x18184ed30 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x1818454f0 mach_msg_overwrite + 476
3   libsystem_kernel.dylib        	       0x18183cc38 mach_msg + 24
4   CoreFoundation                	       0x181959ea4 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x18195876c __CFRunLoopRun + 1208
6   CoreFoundation                	       0x181957c5c CFRunLoopRunSpecific + 608
7   AppKit                        	       0x18525c404 _NSEventThread + 144
8   libsystem_pthread.dylib       	       0x18187d034 _pthread_start + 136
9   libsystem_pthread.dylib       	       0x181877e3c thread_start + 8

Thread 8:
0   libsystem_pthread.dylib       	       0x181877e28 start_wqthread + 0

Thread 9:: SSDP
0   libsystem_kernel.dylib        	       0x18183fea8 __semwait_signal + 8
1   libsystem_c.dylib             	       0x1817232f8 nanosleep + 220
2   libc++.1.dylib                	       0x1817b681c std::__1::this_thread::sleep_for(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l>> const&) + 84
3   libmythbase-34.34.dylib       	       0x104c7280c PortChecker::checkPort(QString&, int, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000l>>, bool) + 2584
4   libsystem_pthread.dylib       	       0x18187d034 _pthread_start + 136
5   libsystem_pthread.dylib       	       0x181877e3c thread_start + 8

Thread 10:: TaskQueue
0   libsystem_kernel.dylib        	       0x18183fea8 __semwait_signal + 8
1   libsystem_c.dylib             	       0x1817232f8 nanosleep + 220
2   libc++.1.dylib                	       0x1817b681c std::__1::this_thread::sleep_for(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l>> const&) + 84
3   libmythupnp-34.34.dylib       	       0x102f48ab8 UPnpNotifyTask::SendNotifyMsg(MSocketDevice*, QString const&, QString const&) + 2140
4   libsystem_pthread.dylib       	       0x18187d034 _pthread_start + 136
5   libsystem_pthread.dylib       	       0x181877e3c thread_start + 8

Thread 11:: UDP
0   libsystem_kernel.dylib        	       0x18184522c poll + 8
1   QtCore                        	       0x10861cc70 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 436
2   QtCore                        	       0x10861dbb4 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 584
3   QtCore                        	       0x108501f5c QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 448
4   QtCore                        	       0x1085a9678 QThread::exec() + 156
5   libmythbase-34.34.dylib       	       0x104b508d4 MThread::run() + 48
6   libsystem_pthread.dylib       	       0x18187d034 _pthread_start + 136
7   libsystem_pthread.dylib       	       0x181877e3c thread_start + 8

Thread 12:: QDBusConnectionManager
0   libsystem_kernel.dylib        	       0x18184522c poll + 8
1   QtCore                        	       0x10861cc70 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 436
2   QtCore                        	       0x10861dbb4 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 584
3   QtCore                        	       0x108501f5c QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 448
4   QtCore                        	       0x1085a9678 QThread::exec() + 156
5   QtDBus                        	       0x106d67498 0x106d58000 + 62616
6   QtCore                        	       0x108621a80 0x108488000 + 1677952
7   libsystem_pthread.dylib       	       0x18187d034 _pthread_start + 136
8   libsystem_pthread.dylib       	       0x181877e3c thread_start + 8


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000107f44000   x3: 0x000060000246e4a8
    x4: 0x0000000000000004   x5: 0x0000000000001200   x6: 0x000000010810b9f8   x7: 0x00000000000006c0
    x8: 0x00000001d68d3b30   x9: 0x0000000000000002  x10: 0x0000000000000000  x11: 0x0000000000000002
   x12: 0x0000000000000000  x13: 0x0000000000000000  x14: 0x0000000047801139  x15: 0x0000000000000139
   x16: 0x0000000181877b4c  x17: 0x00000001e0a19030  x18: 0x0000000000000000  x19: 0x000000012c71cb90
   x20: 0x0000000000000000  x21: 0x0000000108370510  x22: 0x0000600002b88cc0  x23: 0x000000016ddf2ac8
   x24: 0x0000600003ebd060  x25: 0x0000000104e106c8  x26: 0x0000000104e15ac8  x27: 0x00000001030cd9f0
   x28: 0x0000000000000000   fp: 0x000000016ddf29c0   lr: 0x00000001081c3ba8
    sp: 0x000000016ddf2990   pc: 0x00000001081b9780 cpsr: 0x60001000
   far: 0x0000000000000000  esr: 0x56000080  Address size fault

Binary Images:
       0x11cd10000 -        0x11cd7bfff com.apple.AppleMetalOpenGLRenderer (1.0) <227d0ea7-67f7-36da-949b-01c1f245b799> /System/Library/Extensions/AppleMetalOpenGLRenderer.bundle/Contents/MacOS/AppleMetalOpenGLRenderer
       0x11b0c0000 -        0x11b0cffff libqcertonlybackend.dylib (*) <0c37c55b-73cc-3165-a307-f215096f669a> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/PlugIns/tls/libqcertonlybackend.dylib
       0x11b448000 -        0x11b477fff libqopensslbackend.dylib (*) <124d278f-aa20-3779-a49c-598cf87df18f> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/PlugIns/tls/libqopensslbackend.dylib
       0x1195b8000 -        0x1195dbfff libqsecuretransportbackend.dylib (*) <05be07c5-9611-3c4c-83d2-1985b934ee0c> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/PlugIns/tls/libqsecuretransportbackend.dylib
       0x1193d0000 -        0x1193dbfff libobjc-trampolines.dylib (*) <c9ce7923-2f2d-31eb-a6e4-0f3b7a78f895> /usr/lib/libobjc-trampolines.dylib
       0x119534000 -        0x119543fff libqsqlmysql.dylib (*) <a6fd3a14-2557-39c0-b0ac-9396f364b303> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/PlugIns/sqldrivers/libqsqlmysql.dylib
       0x11b664000 -        0x11b9a3fff libmysqlclient.22.dylib (*) <14ed0ef8-c905-3ec8-b2ea-ee74e4e24783> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmysqlclient.22.dylib
       0x11b000000 -        0x11b07ffff libssl.3.dylib (*) <90d6c193-d824-3057-8168-33e1a3e05187> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libssl.3.dylib
       0x119558000 -        0x119567fff libz.1.dylib (*) <e610549b-c525-3095-b218-f349ec39a349> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libz.1.dylib
       0x119390000 -        0x1193b3fff libqmacstyle.dylib (*) <64c06816-03f7-3e70-be48-8f2ab1509c7d> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/PlugIns/styles/libqmacstyle.dylib
       0x102518000 -        0x1025a3fff libqcocoa.dylib (*) <e1117263-b1a0-3009-998f-643712e82538> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/PlugIns/platforms/libqcocoa.dylib
       0x1074ac000 -        0x1074cbfff com.apple.security.csparser (3.0) <af53e762-bef4-3d88-9797-ff28f3f85e76> /System/Library/Frameworks/Security.framework/Versions/A/PlugIns/csparser.bundle/Contents/MacOS/csparser
       0x1028ac000 -        0x102943fff libmythswscale.6.dylib (*) <913a64a0-95f0-3436-a062-7e9fcd7583d6> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythswscale.6.dylib
       0x102ba8000 -        0x102da3fff libmythavformat.59.dylib (*) <b5f0c823-6441-3217-9dac-d7e3f694e048> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythavformat.59.dylib
       0x102824000 -        0x102837fff libmythswresample.4.dylib (*) <cfdd0998-7d36-3922-9140-7339261795c1> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythswresample.4.dylib
       0x1029fc000 -        0x102a77fff libmythavutil.57.dylib (*) <3f09897e-e84a-36ca-b25a-aa48507cc454> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythavutil.57.dylib
       0x10397c000 -        0x10446bfff libmythavcodec.59.dylib (*) <7a4ae3cb-2b88-3118-b852-0ec937574223> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythavcodec.59.dylib
       0x102844000 -        0x10284ffff libmythpostproc.56.dylib (*) <fd221b55-cdda-3d3b-a489-758c2b40c96d> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythpostproc.56.dylib
       0x103198000 -        0x1034a3fff libmythavfilter.8.dylib (*) <3fe99b47-6a48-3a0c-b951-03a30453689e> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythavfilter.8.dylib
       0x105584000 -        0x105e5ffff libmythtv-34.34.dylib (*) <5ac21da8-9994-3152-a74c-cc1b169cc6d5> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythtv-34.34.dylib
       0x102f08000 -        0x102fdbfff libmythupnp-34.34.dylib (*) <dc8f8219-c6a5-3ac9-a345-ba98f3c18391> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythupnp-34.34.dylib
       0x104b40000 -        0x104e07fff libmythbase-34.34.dylib (*) <4b7226a9-1f62-35f8-b838-4128f78b380f> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythbase-34.34.dylib
       0x103744000 -        0x1038d3fff libmythui-34.34.dylib (*) <d8e80414-95e4-3261-beb3-a6c845bc271d> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythui-34.34.dylib
       0x10301c000 -        0x1030c3fff libmyth-34.34.dylib (*) <671842b3-6802-30ca-8386-8d9950c4d564> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmyth-34.34.dylib
       0x104e98000 -        0x104fc3fff libmythmetadata-34.34.dylib (*) <f9c96677-ce00-3996-8d79-385cb1243566> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythmetadata-34.34.dylib
       0x102df4000 -        0x102e3ffff libmythservicecontracts-34.34.dylib (*) <c3af2947-1234-38e8-93b0-560762b12140> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythservicecontracts-34.34.dylib
       0x102e74000 -        0x102eaffff libmythprotoserver-34.34.dylib (*) <3a302671-2b80-3c57-b0d0-10918d5311a3> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythprotoserver-34.34.dylib
       0x103104000 -        0x10315bfff libmythfreemheg-34.34.dylib (*) <7cc0ce10-8ff9-3338-ba9b-74fcb2802bad> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythfreemheg-34.34.dylib
       0x103604000 -        0x103677fff libtag.1.dylib (*) <16db7c62-0673-311e-b6cc-5a6c13311104> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libtag.1.dylib
       0x106014000 -        0x1061e7fff libmythexiv2-0.28.34.dylib (*) <40317daf-6c32-3d82-8220-56aa8acf44f3> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmythexiv2-0.28.34.dylib
       0x1062e4000 -        0x1065c7fff libcrypto.3.dylib (*) <32dfd93b-1394-3803-b2e8-80371c0f0b96> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libcrypto.3.dylib
       0x10295c000 -        0x10297ffff libass.9.dylib (*) <804484f2-e37e-380d-a26e-52d45a319b38> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libass.9.dylib
       0x105008000 -        0x1050a3fff libdav1d.7.dylib (*) <471c0141-d1a5-3b21-9957-6bced38f2316> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libdav1d.7.dylib
       0x1066b4000 -        0x106a17fff libaom.3.dylib (*) <2ec97542-d90a-3450-9fe0-659a807033a2> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libaom.3.dylib
       0x1050e8000 -        0x10510ffff libvmaf.1.dylib (*) <ac34865d-55cf-3bad-a21a-c2b1c5abe9e3> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libvmaf.1.dylib
       0x10531c000 -        0x105447fff libjxl.0.8.dylib (*) <2ceccdcd-a84e-3249-9137-95a998c095db> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libjxl.0.8.dylib
       0x102884000 -        0x102893fff libhdhomerun.dylib (*) <f2bafc1a-7554-31a9-ba3b-514a47922311> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libhdhomerun.dylib
       0x106a8c000 -        0x106baffff libx264.164.dylib (*) <cdbfaf38-a184-31fe-abd6-7ff7ddf2f0ef> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libx264.164.dylib
       0x103540000 -        0x103573fff libmp3lame.0.dylib (*) <3a72093f-1e3b-385a-841e-faf56748ee12> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmp3lame.0.dylib
       0x1035b4000 -        0x1035e7fff libfontconfig.1.dylib (*) <284c2952-31dc-36a1-b387-a289e698c2d4> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libfontconfig.1.dylib
       0x105268000 -        0x1052e3fff libfreetype.6.dylib (*) <9f468009-9a2d-3ff0-90d8-1bc0fe3b3bae> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libfreetype.6.dylib
       0x102994000 -        0x1029a7fff libzip.5.dylib (*) <1c0c8b9a-537b-3097-935a-73cfdf859eae> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libzip.5.dylib
       0x1051d8000 -        0x105217fff libbluray.2.dylib (*) <95b756a6-466e-3a84-b5fb-9964bb0f75bd> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libbluray.2.dylib
       0x102860000 -        0x10286bfff libSoundTouch.1.dylib (*) <11acdb51-05e1-3a17-b786-972ba468276c> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libSoundTouch.1.dylib
       0x106e44000 -        0x106faffff libsamplerate.0.dylib (*) <735678b6-2058-3c85-95bc-2dfa165ca332> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libsamplerate.0.dylib
       0x1054ec000 -        0x105543fff org.qt-project.QtOpenGL (6.6) <929bb79a-4d9a-339d-80f8-097f934df591> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/QtOpenGL.framework/Versions/A/QtOpenGL
       0x1074e8000 -        0x1078b3fff org.qt-project.QtWidgets (6.6) <31cc4af9-a5fb-37e8-aa64-4eb31bfffd52> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       0x107f44000 -        0x108347fff org.qt-project.QtGui (6.6) <2960d657-84ba-3582-867b-4f5097effabb> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/QtGui.framework/Versions/A/QtGui
       0x106fc4000 -        0x1070affff org.qt-project.QtNetwork (6.6) <e2553f8d-9c2b-32d2-ad67-6e35c4c0c641> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/QtNetwork.framework/Versions/A/QtNetwork
       0x102ec8000 -        0x102edffff org.qt-project.QtXml (6.6) <196ddb63-5b89-38be-aa34-7487bc462196> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/QtXml.framework/Versions/A/QtXml
       0x105460000 -        0x105487fff org.qt-project.QtSql (6.6) <02412f20-f5e6-36e6-9bf8-e55d256242c9> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/QtSql.framework/Versions/A/QtSql
       0x106d58000 -        0x106dc3fff org.qt-project.QtDBus (6.6) <f5723eeb-00fd-3958-892e-a9a7e61f7cdc> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/QtDBus.framework/Versions/A/QtDBus
       0x108488000 -        0x10882ffff org.qt-project.QtCore (6.6) <d922b920-7632-3cb3-b377-002b45ff5907> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       0x1071fc000 -        0x1072cffff libX11.6.dylib (*) <e34d1012-2916-30a6-80cb-a797f99a8cb5> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libX11.6.dylib
       0x1036c8000 -        0x1036dbfff libxcb.1.dylib (*) <1c86d4cd-7c39-38da-a5ee-559bfadb2f5c> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libxcb.1.dylib
       0x1029b8000 -        0x1029bbfff libXau.6.dylib (*) <bf6689dc-5292-350c-94b7-d1d71956c572> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libXau.6.dylib
       0x102814000 -        0x102817fff libXdmcp.6.dylib (*) <a066fce2-d9df-3441-9eb3-6675f314422e> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libXdmcp.6.dylib
       0x107a0c000 -        0x107b7bfff libgnutls.30.dylib (*) <77695e72-05d6-3e13-99c3-43a30860ae5b> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libgnutls.30.dylib
       0x107bc8000 -        0x107d17fff libvpx.8.dylib (*) <bb4c9fb4-ba14-309b-bab3-2a0b7a108a5c> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libvpx.8.dylib
       0x1036f8000 -        0x103717fff liblzma.5.dylib (*) <d5449959-8b9e-3de7-ae04-f9f30d6ba829> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/liblzma.5.dylib
       0x108b68000 -        0x108d6ffff libx265.199.dylib (*) <e6d3a150-9129-3ba6-be46-eaeebc624121> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libx265.199.dylib
       0x1029e4000 -        0x1029ebfff libhwy.1.dylib (*) <efcc8295-edb2-3b0b-9b67-ab4160aea3b7> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libhwy.1.dylib
       0x103724000 -        0x10372ffff libbrotlidec.1.dylib (*) <cc77e640-3de5-3d9c-9565-c60ed8119746> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libbrotlidec.1.dylib
       0x105228000 -        0x105247fff libbrotlicommon.1.dylib (*) <cbb61532-d27c-331e-996e-843ed45f10e9> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libbrotlicommon.1.dylib
       0x1072f0000 -        0x10737bfff libbrotlienc.1.dylib (*) <159e74da-1746-3bd8-92e3-42426d7faf27> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libbrotlienc.1.dylib
       0x106dec000 -        0x106e27fff liblcms2.2.dylib (*) <c7dd544b-7b20-3b48-9cf2-e460b25517bd> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/liblcms2.2.dylib
       0x106cc4000 -        0x106ce7fff libpng16.16.dylib (*) <7396dd62-d1eb-3564-b3f5-2f50f51f84f5> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libpng16.16.dylib
       0x1054a8000 -        0x1054bffff libintl.8.dylib (*) <00fe864a-7259-3f14-8dc2-ad6e85504fef> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libintl.8.dylib
       0x107d30000 -        0x107e27fff libp11-kit.0.dylib (*) <47b51415-5fe7-30b7-8cfb-a94db701c48b> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libp11-kit.0.dylib
       0x107108000 -        0x107137fff libidn2.0.dylib (*) <5d182aed-a9c3-3395-9e49-90f0e148654a> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libidn2.0.dylib
       0x108dd8000 -        0x108f6ffff libunistring.5.dylib (*) <33a7ff2f-1650-39b8-b13a-6c8ec574a6dc> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libunistring.5.dylib
       0x1052f8000 -        0x105303fff libtasn1.6.dylib (*) <8b813670-a25c-3d8a-9272-957bdbe5bc39> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libtasn1.6.dylib
       0x107148000 -        0x10717ffff libnettle.8.dylib (*) <26f48c98-968d-3597-b84d-6a97e57af30c> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libnettle.8.dylib
       0x107198000 -        0x1071cffff libhogweed.6.dylib (*) <71bc8b79-f1d5-383b-b7f3-8ba0ad1a95f3> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libhogweed.6.dylib
       0x1073fc000 -        0x107453fff libgmp.10.dylib (*) <f6a7b957-4314-3ea5-ac52-39a649bd3a58> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libgmp.10.dylib
       0x106cf8000 -        0x106d13fff libfribidi.0.dylib (*) <44e9e265-1a6e-33c9-8180-0bae3f7e6f5c> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libfribidi.0.dylib
       0x108908000 -        0x1089c3fff libharfbuzz.0.dylib (*) <5c2fa5f7-2c3c-3157-8edf-73b749ac5233> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libharfbuzz.0.dylib
       0x106d24000 -        0x106d43fff libunibreak.5.dylib (*) <a7b6512f-3138-322c-a9d6-3e358654517f> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libunibreak.5.dylib
       0x108f8c000 -        0x10907bfff libglib-2.0.0.dylib (*) <c3c3f473-6698-3b0d-8607-0f468b6c4b63> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libglib-2.0.0.dylib
       0x10738c000 -        0x10739ffff libgraphite2.3.dylib (*) <dadd250f-e2ba-36f3-b960-ea391395d1e7> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libgraphite2.3.dylib
       0x1089e0000 -        0x108a53fff libpcre2-8.0.dylib (*) <a02c2f70-1f04-38dc-ab6d-41d8b391cb88> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libpcre2-8.0.dylib
       0x1073ac000 -        0x1073c3fff liblzo2.2.dylib (*) <d7f6d4ef-d1f3-38db-9cff-92fd4b3ad173> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/liblzo2.2.dylib
       0x1073d0000 -        0x1073dffff libhdhomerun_arm64.dylib (*) <f2bafc1a-7554-31a9-ba3b-514a47922311> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libhdhomerun_arm64.dylib
       0x108a64000 -        0x108aebfff libzstd.1.dylib (*) <2bdff40f-1b63-3633-a720-9b2c512f6256> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libzstd.1.dylib
       0x10394c000 -        0x103957fff libmd4c.0.dylib (*) <364e1807-c71c-378c-b4a7-1bc7eda8a11e> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libmd4c.0.dylib
       0x1029cc000 -        0x1029cffff libgthread-2.0.0.dylib (*) <8259d5ae-290d-3e70-ab80-8cc5c0ea504f> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libgthread-2.0.0.dylib
       0x107e54000 -        0x107e83fff libdbus-1.3.dylib (*) <39e8ef3d-0a4a-3f7f-a729-c37ebc8e538c> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libdbus-1.3.dylib
       0x10930c000 -        0x109497fff libicui18n.73.dylib (*) <4cf242d7-3baf-3426-9e42-d6ec6f105989> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libicui18n.73.dylib
       0x10956c000 -        0x10969bfff libicuuc.73.dylib (*) <fa375bc4-1f53-30a6-a543-2936b3ffe895> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libicuuc.73.dylib
       0x10b5d0000 -        0x10d45ffff libicudata.73.dylib (*) <d67db6a8-bbba-3786-9027-da6298d24d60> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libicudata.73.dylib
       0x1054d0000 -        0x1054dbfff libdouble-conversion.3.dylib (*) <1bc9d57e-cefd-3a29-9378-50c756f892b3> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libdouble-conversion.3.dylib
       0x1071e0000 -        0x1071e7fff libb2.1.dylib (*) <82f85bf6-93d0-3be3-9cc8-23cbf361e60f> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libb2.1.dylib
       0x107ea0000 -        0x107f0bfff libpcre2-16.0.dylib (*) <27f77b43-8908-3e08-928d-c981ca5e9a1c> /Volumes/VOLUME/mythfrontend.app/Contents/Frameworks/libpcre2-16.0.dylib
       0x10200c000 -        0x10231bfff mythfrontend (*) <40002f1e-0e24-36b0-b506-4839bfb1e57a> /Volumes/VOLUME/mythfrontend.app/Contents/MacOS/mythfrontend
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x181876000 -        0x181882ff3 libsystem_pthread.dylib (*) <daf95373-5de6-39a1-a6ce-d87f3f0629cc> /usr/lib/system/libsystem_pthread.dylib
       0x18183b000 -        0x181875fef libsystem_kernel.dylib (*) <b7751381-1442-30b5-91b9-ad7be461bebe> /usr/lib/system/libsystem_kernel.dylib
       0x1818dc000 -        0x181db3fff com.apple.CoreFoundation (6.9) <9f046e36-7286-3a6e-a280-699d6e47cfaf> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       0x1850f9000 -        0x18640dfff com.apple.AppKit (6.9) <b475e541-691d-39c6-8ca4-e414b0d3dd88> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       0x181716000 -        0x181794ffb libsystem_c.dylib (*) <decb8685-f34a-3979-afcb-71fb55747e41> /usr/lib/system/libsystem_c.dylib
       0x181795000 -        0x181822ff7 libc++.1.dylib (*) <3702eede-997d-38e6-a6a1-c08eb22c375b> /usr/lib/libc++.1.dylib

@kmdewaal
Copy link
Contributor

kmdewaal commented Jan 2, 2024

Yes, the failure on MacOS is identical to that on Linux. I am having another look at it.

@kmdewaal
Copy link
Contributor

I did not get very far on this but is what I did. Attached is a test patch that can be applied to the current master.
20240115-qt6-wip.patch.gz

The result is something that does not crash anymore but now it gives an endless loop of these messages:
CoreContext mythcommandlineparser.cpp:2923:operator() Qt: QPainter::begin: Paint device returned engine == 0, type: 1

The basic idea was, as suggested in this thread by the quote from the Qt dev, to change the top level window from a raster surface to an OpenGL surface by inheriting from a QOpenGLWidget instead of a QWidget.

Some comments on the code changes in the patch:

To get it compiled with qt6 do add the following option to the ./configure command: --qmake=/lib64/qt6/bin/qmake
The configure script now complains about the locale being C, and these complains can be removed as follows:

 # Prevent locale nonsense from breaking basic text processing.
-LC_ALL=C
+LC_ALL=C.UTF8
 export LC_ALL

To be able to use the QOpenGLWidget, add the following to the libmythui.pro:

 using_opengl: QT += opengl
+using_opengl: contains(QT_MAJOR_VERSION, 6): {
+    QT += openglwidgets
+}

And then in mythpainterwindow.cpp/.h the QOpenGLWidget is used instead of the QWidget.

There are also a lot of messages added so that the flow through the code can be followed.
The amazing thing is that mythavtest does seem to work however with this patch.

Suggestions on how to continue with this are welcome!

@jhoyt4
Copy link
Contributor

jhoyt4 commented Mar 1, 2024

@kmdewaal - my apologies for just getting around to this. I was waiting on some upstream qt6 fixes to see if anything changed.

Like you state, on macOS I'm no longer crashing with myhfrontend. My endless loop statement is similar, but points to Qt: QPainter:

2024-03-01 09:55:32.514091 I  Qt: QPainter::begin: Paint device returned engine == 0, type: 1
2024-03-01 09:55:32.528974 I  KdW trace RenderIsShared
2024-03-01 09:55:32.529041 I  KdW trace paintEngine
2024-03-01 09:55:32.529046 I  KdW trace paintEngine
2024-03-01 09:55:32.531193 I  KdW trace paintEngine

While watching mythfrontend load, I did see a picture of my theme for a very brief moment then the screen went black and stayed there with the looping output.

@bjoernv
Copy link

bjoernv commented Apr 27, 2024

I get this bug on Qt6 6.7.0 (openSUSE Tumbleweed). If I try to debug mythfrontend with gdb, the whole X11 screen freezes.

Without gdb, mythfrontend crashes after some seconds:

2024-04-27 23:56:00.884475 I  Display: Have main window
2024-04-27 23:56:00.884499 I  Display: Found screen number 0 (DVI-D-0)
2024-04-27 23:56:00.901949 I  Qt: QOpenGLContext::makeCurrent() called with non-opengl surface 0x565235e75cc0
2024-04-27 23:56:00.901957 E  OpenGL: makeCurrent failed
Handling Segmentation fault
Segmentation fault (core dumped)

@mitchcapper
Copy link
Contributor

So I have hit this for awhile and tried to just install 6.3 and compile mythtv there as I run it in a container anyway, but mythtv's min versions is: QT6_MIN_VERSION_STR="6.4" so that doesn't seem like a valid option. Clearly this doesn't hit everyone but im not sure what the reach of this is.

@jhoyt4
Copy link
Contributor

jhoyt4 commented Aug 25, 2024

I was hoping a bump to qt 6.7 would magically resolve this, unfortunately I'm still getting the same error on macOS 14.6

2024-08-24 20:04:20.081994 I UIBounds: New UI bounds: 1080x720+0+0 2024-08-24 20:04:20.137242 I Qt: QOpenGLContext::makeCurrent() called with non-opengl surface 0x6000001af1f0 2024-08-24 20:04:20.137244 E OpenGL: makeCurrent failed Handling Segmentation fault: 11

@mitchcapper
Copy link
Contributor

OK.
So compiling with latest master:

I can confirm a few things (at least on linux):

  • back compiling with QC 6.3 works if you modify the mythtv min version (per my note above) older QT can be installed with something like aqtinstall
  • with Qt version: compile: 6.4.2
  • The suggestion from @alpqr of dropping the android conditional: https://github.com/MythTV/mythtv/blob/v35-Pre/mythtv/libs/libmythui/opengl/mythrenderopengl.cpp#L544 which manually sets the surface to open GL works, this is despite @warpme 's testing where they had it still fail. Not sure if something changed but WFM.
  • Originally I tested setting it to the true old surface type (from what @alpqr mentioned as well QSurface::RasterGLSurface which is an internal only value but would be closest to the exact old. This worked too.

Can anyone confirm this is still not working for them as a solution?

@warpme
Copy link
Contributor Author

warpme commented Dec 5, 2024

Mitch,

This becomes really interesting!
I build fresh 6.8.1 (from vanilla Qt sources) then current myth master.
Testing (on aarch64) gives me results:

  1. myth draws to EGLFS: works
  2. myth draws to X11-xcb: segfaults the same like with older Qt6 versions
  3. myth draws to wayland: segfaults the same like with older Qt6 versions

then i applied #984 and test again:

  1. myth draws to EGLFS: works
  2. myth draws to X11-xcb: segfaults the same like with older Qt6 versions
  3. myth draws to wayland: segfaults the same like with older Qt6 versions

Now: as qt6 6.8.1 seems work for you:

  1. are yours tests were with x11-xcb qt platform?
  2. if 1) is "yes" then: are you using vanilla Qt6 or patched (e.g. with OS vendor qt fixes applied)?
  3. if 2) is "patched" : do you know what fixes were applied to qt6 which are making qt6 6.8.1 working with myth current master?

@mitchcapper
Copy link
Contributor

While I did compile a newer QT version originally to see if that would fix it right now I have defaulted back to the container's os builtin QT version. I am using ubuntu noble (24.04) as my base docker image for mythtv. Ubuntu is using QT 6.4 by default (although one can use aqtinstall for others). I am on x64.

As per your questions:

  1. Yes
  2. OS supplied QT, although previously using aqtinstall which uses official binaries I believe
  3. There are no patches I am using other than to mythtv itself.

The error discussed here QOpenGLContext::makeCurrent() called with non-opengl surface is quite telling and accurate it would seem. If you are crashing is that still why? If the change I suggest in #984 doesn't work did you try setting the surface type to the alternate I mention in #984?

As you seem to follow a set of steps each time, I might try a clean patched build to make sure it isn't using an old object or binary.

Personally I am more interested in why more users don't hit this. Given mythTV has required QT 6.4 for quite awhile I can't imagine it is they are using an older QT version. This doesn't sound like a real bug as much as a code change that should have happened from what the QT dev mentioned.

Related Logs

[903246.145] (II) NVIDIA(0): Validated MetaModes:
[903246.145] (II) NVIDIA(0):     "DFP-4:3840x2160@120"
2024-12-10 22:24:33.686646 I  OpenGL: OpenGL vendor        : NVIDIA Corporation
2024-12-10 22:24:33.686648 I  OpenGL: OpenGL renderer      : NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2
2024-12-10 22:24:33.686650 I  OpenGL: OpenGL version       : 4.6.0 NVIDIA 535.183.01
2024-12-10 22:24:33.686652 I  OpenGL: Qt platform          : xcb
2024-12-10 22:24:33.686680 I  OpenGL: EGL display          : No
2024-12-10 22:24:33.686682 I  OpenGL: EGL images           : No
2024-12-10 22:24:33.686683 I  OpenGL: Qt OpenGL module     : OpenGL (not ES)
2024-12-10 22:24:33.686685 I  OpenGL: Qt OpenGL format     : OpenGL 4.6
2024-12-10 22:24:33.686686 I  OpenGL: Qt OpenGL surface    : RGBA: 8:8:8:0 Depth: 24 Stencil: 0
2024-12-10 22:24:33.686688 I  OpenGL: Max texture size     : 32768
2024-12-10 22:24:33.686691 I  OpenGL: Shaders              : Vertex,Fragment,Geometry,Compute
2024-12-10 22:24:33.686692 I  OpenGL: 16bit framebuffers   : Yes
2024-12-10 22:24:33.686694 I  OpenGL: Unpack Subimage      : Yes
2024-12-10 22:24:33.686695 I  OpenGL: Buffer mapping       : Yes
2024-12-10 22:24:33.686696 I  OpenGL: Rectangular textures : Yes
2024-12-10 22:24:33.686698 I  OpenGL: NPOT textures        : Yes
2024-12-10 22:24:33.686699 I  OpenGL: Max texture units    : 192
2024-12-10 22:24:33.686701 I  OpenGL: GL_RED/GL_R8         : Yes
2024-12-10 22:24:33.321567 N  Display: Display is using sRGB colourspace
2024-12-10 22:24:33.321583 N  Display: Supported HDR formats: HDR10,Hybrid Log-Gamma
2024-12-10 22:24:33.536058 I  Qt: "/usr/lib/x86_64-linux-gnu/qt6/plugins/xcbglintegrations/libqxcb-glx-integration.so" loaded library
2024-12-10 22:24:33.525151 I  Qt: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/accessible" ...
2024-12-10 22:24:33.525196 I  Qt: checking directory path "/usr/local/bin/accessible" ...
2024-12-10 22:24:33.532644 I  Qt: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/xcbglintegrations" ...
2024-12-10 22:24:33.532730 I  Qt: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/xcbglintegrations/libqxcb-glx-integration.so"
2024-12-10 22:24:33.532893 I  Qt: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/xcbglintegrations/libqxcb-glx-integration.so, metadata=
2024-12-10 22:24:51.046424 I  VidOutGPU: Allowed renderers for MPEG-4 nvdec (Decoder: nvdec): 'opengl-hw'
2024-12-10 22:24:51.046435 I  VideoProfile: Safe renderers for 'nvdec': opengl-hw
2024-12-10 22:24:51.046440 I  VidOutGPU: Allowed renderers (filt: nvdec): opengl-hw

@kmdewaal
Copy link
Contributor

About why not more people complain. I think that most people, including me, are still using Qt5 and have not yet switched to Qt6.

One possible reason why the fix does work for you is that you are using Nvidia graphics.
I currently only use Intel graphics and I suspect also Piotr does not use Nvidia graphics.

I did a lot of testing a while ago and I could not get it to work on Fedora 40.
I now upgraded to Fedora 41 with Qt 6.8.0 and done some tests.

Test 1 Today's master, unmodified.
Result:

2024-12-11 10:18:49.448373 I [125876/125876] CoreContext mythcommandlineparser.cpp:2927:operator()  Qt: QOpenGLContext::makeCurrent() called with non-opengl surface 0x3160baa0
2024-12-11 10:18:49.448388 E [125876/125876] CoreContext mythrenderopengl.cpp:571:makeCurrent  OpenGL: makeCurrent failed
Handling Segmentation fault

As expected, but it is good to have a baseline.

Test 2 As test 1 but with patch from #984 applied, so the following code is always executed:

    m_window->setSurfaceType(QWindow::OpenGLSurface);
    if (native && native->windowHandle())
        native->windowHandle()->setSurfaceType(QWindow::OpenGLSurface);

Result is crash but different:

2024-12-11 10:26:42.146515 I [127163/127163] CoreContext mythcommandlineparser.cpp:2927:operator()  Qt: QEGLPlatformContext: eglMakeCurrent failed: 300d
2024-12-11 10:26:42.146525 E [127163/127163] CoreContext mythrenderopengl.cpp:572:makeCurrent  OpenGL: makeCurrent failed
Handling Segmentation fault

Test 3 As test 2 but with the code changed to use the RasterGLSurface:

    m_window->setSurfaceType(QSurface::RasterGLSurface);
    if (native && native->windowHandle())
        native->windowHandle()->setSurfaceType(QSurface::RasterGLSurface);

Result same as test 2:

2024-12-11 10:41:20.781531 I [128736/128736] CoreContext mythcommandlineparser.cpp:2927:operator()  Qt: QEGLPlatformContext: eglMakeCurrent failed: 300d
2024-12-11 10:41:20.781540 E [128736/128736] CoreContext mythrenderopengl.cpp:576:makeCurrent  OpenGL: makeCurrent failed
Handling Segmentation fault

My tentative conclusion is that the fix does work on Nvidia graphics but not on Intel or embedded platforms.

@mitchcapper
Copy link
Contributor

I think you have hit a 'new' bug essentially. This original bug was 'by design' in terms of that error throwing. Now when you set a surface to use opengl however you crash. You might want to take a look at the QT options for controlling egl:
https://doc.qt.io/qt-6/embedded-linux.html

I would probably file a new ticket with QT, and if possible create a simple test program that just creates a surface and sets its type to GL to see if you can easily crash that way.

@jhoyt4
Copy link
Contributor

jhoyt4 commented Dec 12, 2024

I'm pretty sure the macOS community doesn't complain about the bug since the build script sets qt5 as default or they're using the prebuilt binaries for which the github CI is uses qt5. I've been wanting to upgrade both to qt6, but this bug has been in the way.

Thankfully testing Mitch's suggested fix seems to work on at least on macOS 15 with qt 6.8.

@mitchcapper
Copy link
Contributor

But the minimum to build mythtv has been at 6.4 for awhile. Surely at least developers can launch mythtv master so not sure what systems it would work out of the box on.

@warpme
Copy link
Contributor Author

warpme commented Dec 12, 2024

FYI: I put some more investigations in https://bugreports.qt.io/browse/QTBUG-113728

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants