Bug 466655 - Wayland: Red and blue channels are swapped when screencasting in certain applications
Summary: Wayland: Red and blue channels are swapped when screencasting in certain appl...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.27.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2023-03-01 13:28 UTC by Naxdy
Modified: 2024-07-10 06:30 UTC (History)
6 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Naxdy 2023-03-01 13:28:43 UTC
SUMMARY
Since 5.27.2, and possibly 5.27.1 (untested - but not 5.27.0), the red and blue color channels are swapped when screencasting in certain applications.

It seems that applications using WebRTC are affected by this, tested using Firefox and Slack. OBS, for example, is NOT affected by this.

NOTE: In 5.27.0, this bug affected the mouse cursor only, but since at least 5.27.2, it is affecting the entire image.

STEPS TO REPRODUCE
1. Open an affected application (e.g. Firefox, Slack)
2. Begin screencasting (type doesn't matter, i.e. window or screen)

OBSERVED RESULT
Screencasted image has red and blue color channels swapped.
(confirm by screenshotting the casted image and swapping the red & blue color channels in GIMP to get the original image back)

EXPECTED RESULT
Screencasted image does not have red and blue color channels swapped.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Gentoo
(available in About System)
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Mesa: 23.0.0

ADDITIONAL INFORMATION
-
Comment 1 Bug Janitor Service 2023-03-03 18:39:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3746
Comment 2 Bug Janitor Service 2023-03-03 18:48:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3747
Comment 3 Aleix Pol 2023-03-05 00:26:44 UTC
Git commit 5ac5251674d910e3402885144dc6ce9479a960eb by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 04/03/2023 at 23:47.
Pushed by apol into branch 'Plasma/5.27'.

screencasting: on memfd, skip the QImage step

We were using QImage as an intermediary step. GL -> QImage -> spa
buffer. While it abstracted things out neatly and eventually helped with
debugging, it was unnecessary and woudl present some handicaps, such as
the lack of a QImage::Format_BGRA.
So we just it out to download right into the buffer.

M  +2    -2    src/plugins/screencast/outputscreencastsource.cpp
M  +1    -1    src/plugins/screencast/outputscreencastsource.h
M  +2    -2    src/plugins/screencast/regionscreencastsource.cpp
M  +1    -1    src/plugins/screencast/regionscreencastsource.h
M  +3    -1    src/plugins/screencast/screencastsource.h
M  +5    -5    src/plugins/screencast/screencaststream.cpp
M  +18   -15   src/plugins/screencast/screencastutils.h
M  +2    -2    src/plugins/screencast/windowscreencastsource.cpp
M  +1    -1    src/plugins/screencast/windowscreencastsource.h

https://invent.kde.org/plasma/kwin/commit/5ac5251674d910e3402885144dc6ce9479a960eb
Comment 4 Aleix Pol 2023-03-05 00:31:33 UTC
Git commit 85b614e75c41cbdeb63b276162ed9777232daf28 by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 04/03/2023 at 23:47.
Pushed by apol into branch 'master'.

screencasting: on memfd, skip the QImage step

We were using QImage as an intermediary step. GL -> QImage -> spa
buffer. While it abstracted things out neatly and eventually helped with
debugging, it was unnecessary and woudl present some handicaps, such as
the lack of a QImage::Format_BGRA.
So we just it out to download right into the buffer.
(cherry picked from commit 121454580711c409b612d06865ab9d221dcbac6b)

M  +2    -2    src/plugins/screencast/outputscreencastsource.cpp
M  +1    -1    src/plugins/screencast/outputscreencastsource.h
M  +2    -2    src/plugins/screencast/regionscreencastsource.cpp
M  +1    -1    src/plugins/screencast/regionscreencastsource.h
M  +3    -1    src/plugins/screencast/screencastsource.h
M  +5    -5    src/plugins/screencast/screencaststream.cpp
M  +18   -15   src/plugins/screencast/screencastutils.h
M  +2    -2    src/plugins/screencast/windowscreencastsource.cpp
M  +1    -1    src/plugins/screencast/windowscreencastsource.h

https://invent.kde.org/plasma/kwin/commit/85b614e75c41cbdeb63b276162ed9777232daf28