Bug 452397 - [Wayland] Cannot change resolution in external monitor
Summary: [Wayland] Cannot change resolution in external monitor
Status: RESOLVED FIXED
Alias: None
Product: KScreen
Classification: Plasma
Component: common (show other bugs)
Version: 5.24.4
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords: wayland
Depends on:
Blocks:
 
Reported: 2022-04-08 10:54 UTC by Mario
Modified: 2022-05-17 16:31 UTC (History)
2 users (show)

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


Attachments
grep kwin_wayland_drm ~/.local/share/sddm/wayland-session.log (17.66 KB, text/plain)
2022-04-11 10:46 UTC, Mario
Details
video - running on Manjaro Daily (82 bytes, text/plain)
2022-05-15 14:56 UTC, Mario
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario 2022-04-08 10:54:58 UTC
SUMMARY
I have a Lenovo X1 Extreme Gen2 with an Nvidia GTX 1650 video card. When I log in with an X11 session, my external monitor's resolution is correctly set to 5120x1440. However, when I log in with a Wayland session the monitor is set to 3840x1080. If I open the Display Configuration I see the 5120x1440 resolution is available. However, when I try to set it there is no change (the monitor stays at 3840x1080 even though the Display Configuration screen says 5120x1440).

As an additional data point, the laptop's internal LCD is 1920x1080.


STEPS TO REPRODUCE
1. Plug in external monitor with a different vertical resolution than the laptop one(in my case the resolutions are as noted above)
2. Open Display Configuration and change the external monitor's resolution to its native resolution. Apply changes.

OBSERVED RESULT

The Display Configuration shows the new resolution, but the monitor's resolution is not changed.

EXPECTED RESULT

The monitor's resolution should change to what is selected.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 21.10 / Plasma 5.24.4
(available in About System)
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION
Comment 1 Zamundaaa 2022-04-10 12:14:54 UTC
Please attach the output of "grep kwin_wayland_drm ~/.local/share/sddm/wayland-session.log". It'll be more useful if you have debug logging enabled (put QT_LOGGING_RULES="kwin_*.debug=true" into /etc/environment and reboot for that)

When you close display settings and open it again, is the resolution still not matching what your monitor is actually running at?
Comment 2 Mario 2022-04-11 10:46:01 UTC
Created attachment 148095 [details]
grep kwin_wayland_drm ~/.local/share/sddm/wayland-session.log

Here is the output of `grep kwin_wayland_drm ~/.local/share/sddm/wayland-session.log`, together with `env | sort` in case there is something weird in my environment.
Comment 3 Mario 2022-04-11 10:47:28 UTC
(In reply to Zamundaaa from comment #1)
> Please attach the output of "grep kwin_wayland_drm
> ~/.local/share/sddm/wayland-session.log". It'll be more useful if you have
> debug logging enabled (put QT_LOGGING_RULES="kwin_*.debug=true" into
> /etc/environment and reboot for that)
> 
> When you close display settings and open it again, is the resolution still
> not matching what your monitor is actually running at?

When reopening display settings I see the resolution that the monitor is running at, not what I set. As an additional data point, when changing the resolution and pressing Apply, I don't get the "Keep/Restore" dialog. It's as if Display Settings doesn't detect that I changed the resolution.
Comment 4 Zamundaaa 2022-04-13 19:41:58 UTC
I think your BAR is full / KWin is allocating too much CPU-visible memory in VRAM. I can make KWin release some ~16MiB of VRAM earlier in your case, but it carries a risk of things breaking worse if that fails.
As a better solution, I'll try to make KWin use hardware accelerated copy more often, which doesn't require filling up CPU-visible memory.
Comment 5 Mario 2022-04-19 16:12:22 UTC
(In reply to Zamundaaa from comment #4)
> I think your BAR is full / KWin is allocating too much CPU-visible memory in
> VRAM. I can make KWin release some ~16MiB of VRAM earlier in your case, but
> it carries a risk of things breaking worse if that fails.
> As a better solution, I'll try to make KWin use hardware accelerated copy
> more often, which doesn't require filling up CPU-visible memory.

Thank you. Is there anything I can do to help/test/get more information?
Comment 6 Zamundaaa 2022-04-19 18:20:26 UTC
You can test https://invent.kde.org/plasma/kwin/-/merge_requests/2249. If you compile it with Mesa 21.1 or newer there's a decent chance that it'll help
Comment 7 Nate Graham 2022-04-21 16:45:52 UTC
.
Comment 8 Mario 2022-04-26 10:51:11 UTC
(In reply to Zamundaaa from comment #6)
> You can test https://invent.kde.org/plasma/kwin/-/merge_requests/2249. If
> you compile it with Mesa 21.1 or newer there's a decent chance that it'll
> help

Thanks @Zamundaaa. Is there a way to get a binary or some easier way of testing it that doesn't involve building all of the packages? This is my first time trying to build anything KDE-related from source, and I'm bumping into dependency hell.Also,  once I get a binary, will it be just a drop-in replacement for my installed kwin? The only laptop I have is my daily driver and it would really suck to break it.
Comment 9 Zamundaaa 2022-04-26 15:17:17 UTC
Git commit 68a54a67b88025c1c0679ffe1658222f61b0cc81 by Xaver Hugl.
Committed on 26/04/2022 at 15:03.
Pushed by zamundaaa into branch 'master'.

backends/drm: enable format modifiers by default

Format modifiers enable the graphics hardware to be much more efficient,
especially when it comes to multi-gpu transfers. With the issues regarding
bandwidth limits now solved, enable them by default to make all supported
systems benefit from them.
Related: bug 452219

M  +1    -1    src/backends/drm/egl_gbm_layer_surface.cpp

https://invent.kde.org/plasma/kwin/commit/68a54a67b88025c1c0679ffe1658222f61b0cc81
Comment 10 Zamundaaa 2022-04-26 20:39:56 UTC
You can use kdesrc-build to avoid messing with your base install, and make the whole thing easier: https://community.kde.org/Get_Involved/development#Set_up_kdesrc-build

Alternatively, the kde neon developer edition (https://neon.kde.org/download) or manjaro plasma daily (https://github.com/manjaro/plasma-daily/tags) images should have the commit within a few days, so you can also just download one of these and test from a flash drive instead.
Comment 11 Bug Janitor Service 2022-05-11 04:35:04 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 12 Mario 2022-05-15 14:56:57 UTC
Created attachment 148857 [details]
video - running on Manjaro Daily
Comment 13 Mario 2022-05-15 14:59:29 UTC
Hello,

Thank you for the suggestions. Sorry for taking so long to reply, it's been a bit of a challenge to find enough free time to test this.

I tried with Manjaro Plasma Daily 202205150340. The monitor changes the resolutions correctly but there are a couple of problems:

* The window size changes on both monitors
* The pointer position does not match where it should be (video attached)
* It looks like Wayland has problems with screens of different vertical sizes. At the beginning of the video, when I show both screens, you can see that the bottom panel is not showing up at all in the laptop monitor, only a piece of it shows on the external monitor. I would expect the bottom panel to show up only on the laptop monitor (not overflow into the external one) and that it's at the actual bottom of the laptop screen and not somewhere below it.
Comment 14 Mario 2022-05-15 15:01:58 UTC
Hello,

Thank you for the suggestions. Sorry for taking so long to reply, it's been a bit of a challenge to find enough free time to test this.

I tried with Manjaro Plasma Daily 202205150340. The monitor changes the resolutions correctly but there are a couple of problems. I've placed a video at https://drive.google.com/file/d/1ObjYEPyLyjzFsv5I59Hp6ozzOD0xIBjn/view?usp=sharing:

* The window size changes on both monitors
* The pointer position does not match where it should be (see video)
* It looks like Wayland has problems with screens of different vertical sizes. At the beginning of the video, when I show both screens, you can see that the bottom panel is not showing up at all in the laptop monitor, only a piece of it shows on the external monitor. I would expect the bottom panel to show up only on the laptop monitor (not overflow into the external one) and that it's at the actual bottom of the laptop screen and not somewhere below it.
Comment 15 Nate Graham 2022-05-15 18:50:52 UTC
Thanks for testing! Those seem like other issues. Can you file bug reports for them separately? Thanks!
Comment 16 Mario 2022-05-17 16:31:57 UTC
I might have jumped the gun on giving it my OK. While submitting the new bug report (https://bugs.kde.org/show_bug.cgi?id=453930) I realized that:

* Manjaro Plasm Daily (on which I tested) starts up with X11 (not Wayland)
* The KDE Neon live CD does not include the proprietary Nvidia drivers, and I can't seem to activate my external monitor with Nouveau

So the test I did was with X11. It's weird, because the scaling issue does not occur on my main Kubuntu install on X11. I haven't found a reasonably simple way of booting KDE on Wayland with proprietary Nvidia drivers from a live CD.