<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>502630</bug_id>
          
          <creation_ts>2025-04-10 03:27:41 +0000</creation_ts>
          <short_desc>Screen Mirroring doesn&apos;t take monitor rotation into account</short_desc>
          <delta_ts>2025-04-16 15:55:02 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>kwin</product>
          <component>multi-screen</component>
          <version>6.3.4</version>
          <rep_platform>Fedora RPMs</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>multiscreen</keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Will Styler">will</reporter>
          <assigned_to name="KWin default assignee">kwin-bugs-null</assigned_to>
          <cc>john</cc>
    
    <cc>kdedev</cc>
    
    <cc>nate</cc>
    
    <cc>xaver.hugl</cc>
          
          <cf_commitlink>https://invent.kde.org/plasma/kwin/-/commit/3e0ecbaad2981874608118005d4dc28daf6e3ec4</cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2414528</commentid>
    <comment_count>0</comment_count>
    <who name="Will Styler">will</who>
    <bug_when>2025-04-10 03:27:41 +0000</bug_when>
    <thetext>SUMMARY

This is a bit of an odd one. I have a device (GPD Pocket 4) which has a display which is wired to be vertical, used horizontally. As a result, I need to use screen rotation to get the proper aspect ratio horizontally. Kwin does fine with this, using display settings.

However, when I connect a second monitor, everything goes off the rails.

STEPS TO REPRODUCE
1. Have a display which is properly oriented only when rotated.
2. Connect a second monitor which is naturally oriented.
3. Hit &quot;Mirror Screens&quot;

EXPECTED

The built in display mirrors the external display, letterboxing where needed, with both displays oriented as they would be if selected individually, at a shared resolution.

OBSERVED RESULT

Depending on rotation in display  settings, the 16:10 internal display is mirrored as a 10:16 display which is oriented correctly (but aggressively letterboxed, and in an aspect ratio not reproducible on the second display) OR, the screens are mirrored properly, but the built-in display is oriented according to the natural (right side down) rotation of the screen, and letterboxing takes up the majority of the screen.

Put differently, there appears to be no permutation of display settings which results in both the correct orientation of the screen, and the correct, horizontal is wider aspect ratio. You can choose one, or the other, and the Meta+P mirror displays command gives the 10:16 version, which is arguably the worse of the two.  Changing display orientation at the kernel level does not appear to fix this, although it does make the LUKS unlock orient properly. Thanks!

SOFTWARE/OS VERSIONS

Operating System: Fedora Linux 41
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.2
Kernel Version: 6.13.9-200.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen AI 9 HX 370 w/Radeon 890M
Memory: 30.9 GiB of RAM
Graphics Processor: AMD Radeon Graphics</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2414806</commentid>
    <comment_count>1</comment_count>
    <who name="Will Styler">will</who>
    <bug_when>2025-04-10 20:26:14 +0000</bug_when>
    <thetext>OK, I&apos;ve found a way to coerce display settings into giving the desired output, confirming that this is software, not hardware. On the built in screen, in Display Settings, I need:
- Enabled, Primary, 1600x2560 (10:16)
- 90 CCW rotation Manual

On the external screen, I need:
- Enabled, Not Primary, 1680x1050 (16:10)

- No Rotation, Manual
- Replica of Built-In Screen

Note the counterintuitive fact that the aspect ratio is listed as different for the two screens, even though they are displaying the same content.

This creates the desired mirroring effect. However, when I pull up the Display Switcher with Meta+P and hit mirror displays, it creates:</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2414807</commentid>
    <comment_count>2</comment_count>
    <who name="Will Styler">will</who>
    <bug_when>2025-04-10 20:34:32 +0000</bug_when>
    <thetext>Apologies for the spam. Turns out Tab doesn&apos;t do tab things here.

When I hit Mirror Displays from Meta+P, I get

Primary Display:
- Enabled, Primary, 1600x2560 (10:16)
- 90 CCW rotation Manual
But oddly, the 10:16 is actually displayed as a vertical rectangle with heavy letterboxing, which constrains the usable space on the other monitor.

External:
- Enabled, Not Primary, 1920x1080 (16:9)
- No Rotation, Manual
- Replica of Built-In Screen

For reference, the native resolution of the external display is 1920x1080, and of the internal display (when rotated properly) is 1600x2560 (which is listed in Display setup as being 1600x2560, despite that not being what is displayed).

Sorry for the deep dive here, but I think I found a corner case and wanted to flag it to the project. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2415549</commentid>
    <comment_count>3</comment_count>
    <who name="John Kizer">john</who>
    <bug_when>2025-04-13 06:10:17 +0000</bug_when>
    <thetext>I can&apos;t reproduce this one myself, but for reference for others...I wonder if this is possibly related to https://bugs.kde.org/show_bug.cgi?id=502374 ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2416357</commentid>
    <comment_count>4</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2025-04-16 15:55:02 +0000</bug_when>
    <thetext>Git commit 3e0ecbaad2981874608118005d4dc28daf6e3ec4 by Xaver Hugl.
Committed on 16/04/2025 at 15:20.
Pushed by zamundaaa into branch &apos;master&apos;.

outputconfigurationstore: implement better screen mirroring

Instead of KScreen trying to move and scale outputs in a way that kind of looks
like mirroring, this makes KWin aware of which outputs replicate which, and makes
it responsible for implementing mirroring in whatever way is best.

This commit implements simliar workarounds like KScreen had, with the only real
difference being that it avoids modifying the source display mode and position,
and takes screen rotation into account.
A better implementation can replace that bit later on, while making use of the
same information stored in the configuration.
Related: bug 481222

M  +11   -6    autotests/integration/outputchanges_test.cpp
M  +1    -0    src/backends/drm/drm_output.cpp
M  +1    -0    src/backends/virtual/virtual_output.cpp
M  +1    -0    src/backends/wayland/wayland_output.cpp
M  +9    -0    src/core/output.cpp
M  +3    -0    src/core/output.h
M  +1    -0    src/core/outputconfiguration.h
M  +88   -0    src/outputconfigurationstore.cpp
M  +2    -0    src/outputconfigurationstore.h
M  +26   -1    src/wayland/outputdevice_v2.cpp
M  +1    -0    src/wayland/outputdevice_v2.h
M  +12   -1    src/wayland/outputmanagement_v2.cpp
M  +4    -3    src/workspace.cpp
M  +1    -1    src/workspace.h

https://invent.kde.org/plasma/kwin/-/commit/3e0ecbaad2981874608118005d4dc28daf6e3ec4</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>