Bug 476858

Summary: Region streaming has the wrong position with multiple screen scale factors and stream scale greater than 1
Product: [Plasma] kwin Reporter: Noah Davis <noahadvs>
Component: effects-variousAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahiemstra, kde, nate, xaver.hugl
Priority: NOR Keywords: qt6
Version First Reported In: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: region_stream-2x-centered
The actual region I tried to record

Description Noah Davis 2023-11-11 22:22:08 UTC
SUMMARY
When doing region screencasting with an FHD@1x screen on the left, a 4K@2x screen on the right and a stream scale of 2, the region being streamed is farther to the bottom-right than it should be.

STEPS TO REPRODUCE
1. Set a screen to the left at 1x scale and a screen to the right at 2x scale.
2. Start a region stream with width half of unified screens rect width, height half of unified screens rect height, placed in the center of all screens, with the highest screen scale (2x) as the stream scale.

OBSERVED RESULT
The streamed region will be aligned with the bottom left corner of the right screen.

EXPECTED RESULT
The streamed region should be in the center of all screens.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20231103
KDE Plasma Version: 5.81.0
KDE Frameworks Version: 5.245.0
Qt Version: 6.6.0
Kernel Version: 6.5.9-1-default (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 4800H with Radeon Graphics
Memory: 30.8 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Comment 1 Noah Davis 2023-11-11 22:23:12 UTC
Created attachment 163059 [details]
region_stream-2x-centered
Comment 2 Noah Davis 2023-11-11 22:24:22 UTC
Created attachment 163060 [details]
The actual region I tried to record
Comment 3 Bug Janitor Service 2023-11-27 11:35:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4715
Comment 4 Vlad Zahorodnii 2023-11-28 09:01:52 UTC
Git commit c8d4f26a9fbab3d23aac19393b0f98246b5dfc58 by Vlad Zahorodnii.
Committed on 28/11/2023 at 09:52.
Pushed by vladz into branch 'master'.

plugins/screencast: Fix hidpi region screencasting

Currently hidpi region screencasting is broken because output textures
are inappropriately scaled.

The orthographic projection is set up with logical pixels, but the
remaining rendering code uses "1 / m_scale" scale factor, which is wrong.

In order to fix hidpi and also simplify rendering logic, this change
makes rendering code use logical coordinate system. It's okay to do in
screencasting because we don't need to worry about snapping to the pixel
grid.
Related: bug 476859

M  +3    -3    src/plugins/screencast/regionscreencastsource.cpp

https://invent.kde.org/plasma/kwin/-/commit/c8d4f26a9fbab3d23aac19393b0f98246b5dfc58