Bug 431074 - Crash in KScreen::Mode::size() when attempting to enable external monitors with PRIME Render offload.
Summary: Crash in KScreen::Mode::size() when attempting to enable external monitors wi...
Status: RESOLVED UPSTREAM
Alias: None
Product: KScreen
Classification: Plasma
Component: libkscreen (show other bugs)
Version: 5.20.4
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords: multiscreen, usability
: 438714 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-01-02 17:56 UTC by Jeannie Stevenson
Modified: 2021-06-16 16:51 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Backtrace of the crash with debugging symbols (10.81 KB, text/vnd.kde.kcrash-report)
2021-01-02 17:56 UTC, Jeannie Stevenson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeannie Stevenson 2021-01-02 17:56:22 UTC
Created attachment 134480 [details]
Backtrace of the crash with debugging symbols

SUMMARY
systemsettings5 crashes when attempting to enable external monitors with PRIME Render offload.

STEPS TO REPRODUCE
1. Get an NVIDIA optimus laptop with the internal display connected to the Intel card and external outputs connected to the NVIDIA card and an external monitor.
2. Install NVIDIA drivers > 450.57 and run in PRIME Render Offload mode. (450.57 is when support for external displays using this configuration was added)
3. Attempt to enable external monitor(s)

OBSERVED RESULT
When external monitors are enabled nothing happens at first, systemsettings5 shows that external monitors are enabled despite the fact they are clearly not. When moving monitors in the Display Configuration systemsettings5 crashes and all displays go black, with only the mouse still visible. The mouse can be moved and interact with applications.

EXPECTED RESULT
External monitors work and show display output.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu, Gentoo, and Arch
(available in About System)
KDE Plasma Version: 5.20.4
KDE Frameworks Version: 5.77.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Tested on Kubuntu, Arch, and Gentoo with both OpenGL and XRender backends, same results. I have heard other uses have had success on other desktop environments though I have yet to confirm those claims.
Comment 1 Nate Graham 2021-01-04 21:32:44 UTC
[KCrash Handler]
#4  KScreen::Mode::size (this=this@entry=0x0) at /usr/src/debug/libkscreen-5.20.4/src/mode.cpp:102
#5  0x00007fa4c3fe084a in operator() (mode=..., __closure=<optimized out>) at /usr/src/debug/kscreen-5.20.4/kcm/output_model.cpp:373
#6  __gnu_cxx::__ops::_Iter_pred<OutputModel::setRefreshRate(int, int)::<lambda(const ModePtr&)> >::operator()<QMap<QString, QSharedPointer<KScreen::Mode> >::const_iterator> (__it=..., this=<optimized out>) at /usr/include/c++/10.2.0/bits/predefined_ops.h:316
#7  std::__find_if<QMap<QString, QSharedPointer<KScreen::Mode> >::const_iterator, __gnu_cxx::__ops::_Iter_pred<OutputModel::setRefreshRate(int, int)::<lambda(const ModePtr&)> > > (__pred=..., __last=..., __first=...) at /usr/include/c++/10.2.0/bits/stl_algobase.h:1915
#8  std::__find_if<QMap<QString, QSharedPointer<KScreen::Mode> >::const_iterator, __gnu_cxx::__ops::_Iter_pred<OutputModel::setRefreshRate(int, int)::<lambda(const ModePtr&)> > > (__pred=..., __last=..., __first=...) at /usr/include/c++/10.2.0/bits/stl_algobase.h:1977
#9  std::find_if<QMap<QString, QSharedPointer<KScreen::Mode> >::const_iterator, OutputModel::setRefreshRate(int, int)::<lambda(const ModePtr&)> > (__pred=..., __last=..., __first=...) at /usr/include/c++/10.2.0/bits/stl_algo.h:3928
#10 OutputModel::setRefreshRate (this=0x559643903180, outputIndex=1, refIndex=<optimized out>) at /usr/src/debug/kscreen-5.20.4/kcm/output_model.cpp:375
#11 0x00007fa504b844f2 in non-virtual thunk to VDMModelDelegateDataType::metaCall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQt5QmlModels.so.5
#12 0x00007fa50636e81d in QQmlPropertyData::writeProperty (flags=..., value=0x7fff69ce6ee0, target=0x5596445b8a20, this=0x5596439b8c18) at /usr/src/debug/qtdeclarative-everywhere-src-5.15.2/include/QtQml/5.15.2/QtQml/private/../../../../../src/qml/qml/qqmlpropertydata_p.h:285
Comment 2 Zamundaaa 2021-01-05 01:32:57 UTC
What does `xrandr --verbose` say, and what happens if you try to enable/disable an output or set the mode with xrandr?
Comment 3 Jeannie Stevenson 2021-01-06 03:13:40 UTC
Output of first command
xrandr --verbose: https://pastebin.com/REyYH5VD

Nothing happens when I run
xrandr --auto --output DP-1-0.2 
xrandr --output DP-1-0.2 --left-of eDP-1
xrandr --output DP-1-0.2 --right-of eDP-1

But when I specify --auto after the output the primary screen goes black for a few seconds and I get this error, the external monitor never flashes or turns on.
xrandr --output DP-1-0.2 --auto: https://pastebin.com/hqLiVJyF

Same here when I specify a mode, only the error is slightly different.
xrandr --output DP-1-0.2 --left-of eDP-1 --mode 1920x1080: https://pastebin.com/HHdR8tfY
Comment 4 Jeannie Stevenson 2021-01-10 00:05:13 UTC
Resolved, this was a problem with NVIDIA drivers ≤ 455.45.01 and Linux kernel ≥ 5.9 which has since been fixed in newer releases.
Comment 5 Nate Graham 2021-06-16 16:51:27 UTC
*** Bug 438714 has been marked as a duplicate of this bug. ***