Bug 476859 - 2x scale region streams downscale then upscale 2x scale screens
Summary: 2x scale region streams downscale then upscale 2x scale screens
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-various (show other bugs)
Version: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
: 476632 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-11-11 23:08 UTC by Noah Davis
Modified: 2023-12-14 14:59 UTC (History)
4 users (show)

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


Attachments
background: actual content; left video: 1x scale stream video played on a 2x scale screen for reference; right video: 2x scale stream video (2.14 MB, image/png)
2023-11-11 23:10 UTC, Noah Davis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Noah Davis 2023-11-11 23:08:13 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, you cannot actually get a 2x scale stream of the 2x scale screen. If the recorded region is partly on the 1x scale screen on the left, the 2x scale screen will appear to be downscaled to 1x before being scaled back up to 2x.

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 2x as the stream scale and the following region: QRect(screensRect.width / 8, screensRect.height / 8, screensRect.width / 2, screensRect.height / 2)

OBSERVED RESULT
The 2x scale screen will appear to be downscaled to 1x before being upscaled to 2x.

EXPECTED RESULT
The 2x scale screen should appear to be 2x scale.

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 23:10:40 UTC
Created attachment 163061 [details]
background: actual content; left video: 1x scale stream video played on a 2x scale screen for reference; right video: 2x scale stream video

Notice how the video of the 2x scale stream is sharper but still low quality while the video of the 1x scale stream was upscaled differently. The 2x scale stream appears to actually be scaled up by 2x, but the content was already downscaled to 1x.
Comment 2 Noah Davis 2023-11-11 23:25:02 UTC
Note, this also happens when the region is entirely within the 2x scale screen, but you must divide the region position by the scale first to get it on the 2x screen because of https://bugs.kde.org/show_bug.cgi?id=476858
Comment 3 Bug Janitor Service 2023-11-27 11:35:55 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:44 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 476858

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

https://invent.kde.org/plasma/kwin/-/commit/c8d4f26a9fbab3d23aac19393b0f98246b5dfc58
Comment 5 Noah Davis 2023-12-14 14:59:24 UTC
*** Bug 476632 has been marked as a duplicate of this bug. ***