Bug 477791 - On wayland, Maximized window on external monitor set to 175% scale sometimes has large vertical gap at top with certain display configurations
Summary: On wayland, Maximized window on external monitor set to 175% scale sometimes ...
Status: RESOLVED FIXED
Alias: None
Product: KScreen
Classification: Plasma
Component: common (show other bugs)
Version: git
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: fanzhuyifan
URL:
Keywords: qt6, wayland
Depends on:
Blocks:
 
Reported: 2023-11-30 19:11 UTC by fanzhuyifan
Modified: 2024-03-06 15:50 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0


Attachments
maximize has vertical space (414.48 KB, image/jpeg)
2023-11-30 19:18 UTC, fanzhuyifan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fanzhuyifan 2023-11-30 19:11:36 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Plug in external display in wayland session
2. In display configuration, arrange displays vertically, such that the external display is above the internal display
3. apply config
4. Open a window on external display and maximize it

OBSERVED RESULT
Large vertical gap on top of the window.

EXPECTED RESULT
The maximized window should use up the whole external display.

Operating System: Arch Linux 
KDE Plasma Version: 5.90.0
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.1
Kernel Version: 6.6.3-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 20 × 13th Gen Intel® Core™ i9-13900H
Memory: 15.2 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: ROG Zephyrus G16 GU603VV_GU603VV
System Version: 1.0

ADDITIONAL INFORMATION
Output of `kscreen-doctor -o`:

Output: 1 eDP-2
        enabled
        connected
        priority 1
        Panel
        Modes:  0:2560x1600@240*!  1:2560x1600@60  2:1600x1200@60  3:1280x1024@60  4:1024x768@60  5:2560x1600@60  6:1920x1200@60  7:1280x800@60  8:2560x1440@60  9:1920x1080@60  10:1600x900@60  11:1368x768@60  12:1280x720@60
        Geometry: 2194,163 1896x1185
        Scale: 1.35
        Rotation: 1
        Overscan: 0
        Vrr: Automatic
        RgbRange: Automatic
        HDR: incapable
        Wide Color Gamut: incapable
        ICC profile: none
Output: 2 HDMI-A-1
        enabled
        connected
        priority 2
        HDMI
        Modes:  0:3840x2160@60*!  1:3840x2160@60  2:3840x2160@50  3:3840x2160@30  4:3840x2160@30  5:3840x2160@25  6:3840x2160@24  7:1920x2160@60  8:2560x1440@60  9:2048x1280@60  10:1920x1080@60  11:1920x1080@60  12:1920x1080@50  13:1920x1080@24  14:1600x1200@60  15:1280x1024@75  16:1280x1024@60  17:1280x800@60  18:1152x864@75  19:1280x720@60  20:1280x720@50  21:1024x768@75  22:1024x768@60  23:800x600@75  24:800x600@60  25:720x576@50  26:720x480@60  27:640x480@75  28:640x480@60  29:640x480@60
        Geometry: 0,0 2194x1234
        Scale: 1.75
        Rotation: 1
        Overscan: 0
        Vrr: incapable
        RgbRange: unknown
        HDR: incapable
        Wide Color Gamut: incapable
        ICC profile: none
Comment 1 fanzhuyifan 2023-11-30 19:18:44 UTC
Created attachment 163665 [details]
maximize has vertical space

black part is caused by misalignment of the screens and does not actually show up on the physical screen.
Comment 2 fanzhuyifan 2023-11-30 19:43:17 UTC
Not sure why, but I cannot reproduce this on neon unstable on the same machine. Main difference is nvidia driver version--arch is on 545, while neon unstable is still on 535. Will check if that makes a difference.
Comment 3 fanzhuyifan 2023-11-30 23:29:08 UTC
On arch where I observed this, this was not consistently reproducible. It only happens some of the time.
Comment 4 Nate Graham 2023-12-05 17:20:51 UTC
Cannot reproduce at all with an Intel iGPU.
Comment 5 fanzhuyifan 2023-12-05 20:28:47 UTC
I would add that in the screen configuration mentioned above, this happens when the scale of the external monitor is set to 175%, but not when it is set to 170%.
Comment 6 fanzhuyifan 2023-12-05 20:29:39 UTC
I am using intel iGPU with NVIDIA dGPU
Comment 7 fanzhuyifan 2023-12-08 19:43:30 UTC
On a different external monitor, can also be triggered with this screen configuration: (external monitor set to 110% scale).
There is also a vertical gap above maximized windows in the external screen.

Output: 1 eDP-2
        enabled
        connected
        priority 1
        Panel
        Modes:  0:2560x1600@240*!  1:2560x1600@60  2:1600x1200@60  3:1280x1024@60  4:1024x768@60  5:2560x1600@60  6:1920x1200@60  7:1280x800@60  8:2560x1440@60  9:1920x1080@60  10:1600x900@60  11:1368x768@60  12:1280x720@60
        Geometry: 1745,97 1707x1067
        Scale: 1.5
        Rotation: 1
        Overscan: 0
        Vrr: Automatic
        RgbRange: Automatic
        HDR: incapable
        Wide Color Gamut: incapable
        ICC profile: none
Output: 2 HDMI-A-1
        enabled
        connected
        priority 2
        HDMI
        Modes:  0:1920x1080@60*!  1:1920x1080@72  2:1920x1080@60  3:1920x1080@50  4:1680x1050@60  5:1600x900@60  6:1280x1024@60  7:1440x900@60  8:1280x800@60  9:1280x720@60  10:1280x720@60  11:1280x720@50  12:1024x768@70  13:1024x768@60  14:800x600@72  15:800x600@60  16:800x600@56  17:720x576@50  18:720x480@60  19:640x480@73  20:640x480@60
        Geometry: 0,0 1745x982
        Scale: 1.1
        Rotation: 1
        Overscan: 0
        Vrr: incapable
        RgbRange: unknown
        HDR: incapable
        Wide Color Gamut: incapable
        ICC profile: none
Comment 8 fanzhuyifan 2023-12-08 20:56:43 UTC
Observation (assuming some fractional scaling that can trigger this bug): 
This gap at the top of the external monitor only appear when there is a top panel in the other monitor set to always visible.
In this case, the vertical gap scales with the vertical offset between the two monitors -- the lower the position of the screen with the top panel, the bigger the vertical gap.

This issue also disappears when I manually set the two screens to have a gap of 1 pixel between them.

These suggest that this bug has the same root cause as 464842 -- under fractional scaling, content on one screen can have an impact on the other screen.
Comment 9 Bug Janitor Service 2023-12-08 23:11:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/libkscreen/-/merge_requests/172
Comment 10 Bug Janitor Service 2023-12-08 23:15:36 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kscreen/-/merge_requests/264
Comment 11 fanzhuyifan 2023-12-11 14:23:57 UTC
Git commit 6f797a908360de5c9654cd6cbd1dcc170b35207c by Yifan Zhu.
Committed on 10/12/2023 at 04:33.
Pushed by zamundaaa into branch 'master'.

Round up output geometry

Under fractional scaling, output screens can have non-integral sizes.
Previous code uses QSizeF::toSize(), which rounds to the nearest
integer. This sometimes results in different screens sharing one pixel
at the edge, which causes BUG 464842 and BUG 477791.

Implement Output::explicitLogicalSizeInt() and
Config::logicalSizeForOutputInt to explicitly round up non-integral
sizes, and use them in calculating output geometry.
Related: bug 464842

M  +1    -1    autotests/testscreenconfig.cpp
M  +7    -1    src/config.cpp
M  +7    -0    src/config.h
M  +7    -1    src/output.cpp
M  +11   -0    src/output.h

https://invent.kde.org/plasma/libkscreen/-/commit/6f797a908360de5c9654cd6cbd1dcc170b35207c
Comment 12 Zamundaaa 2023-12-11 14:26:16 UTC
Git commit cff5739c872393bfbfe9bca43a5763f4d9ec3e6e by Xaver Hugl, on behalf of Yifan Zhu.
Committed on 11/12/2023 at 15:23.
Pushed by zamundaaa into branch 'master'.

Round up output geometry

Under fractional scaling, output screens can have non-integral sizes.
Previous code uses QSizeF::toSize(), which rounds to the nearest
integer. This sometimes results in different screens sharing one pixel
at the edge, which causes BUG 464842 and BUG 477791.

Use the new Output::explicitLogicalSizeInt() and
Config::logicalSizeForOutputInt functions to explicitly round up
non-integral sizes.
Related: bug 464842

M  +6    -6    kcm/output_model.cpp

https://invent.kde.org/plasma/kscreen/-/commit/cff5739c872393bfbfe9bca43a5763f4d9ec3e6e