Bug 440361 - Wayland Intel Iris / Xe Inverted Colors on Latest Plasma Build
Summary: Wayland Intel Iris / Xe Inverted Colors on Latest Plasma Build
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: git master
Platform: Neon Linux
: VHI major
Target Milestone: ---
Assignee: KWin default assignee
URL: https://gitlab.freedesktop.org/drm/in...
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-07-28 16:18 UTC by Andres Betts
Modified: 2021-09-29 12:20 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
waylandinvertedcolors (112.28 KB, image/jpeg)
2021-07-28 16:18 UTC, Andres Betts
Details
drm_info on X11 without KWIN_DRM_NO_AMS set (253.98 KB, text/plain)
2021-08-04 11:35 UTC, Tim Henning
Details
drm_info on Wayland without KWIN_DRM_NO_AMS set (254.50 KB, text/plain)
2021-08-04 11:36 UTC, Tim Henning
Details
output of: journalctl --user | grep kwin_wayland_drm (41.39 KB, text/plain)
2021-08-04 13:50 UTC, Tim Henning
Details
drm_info on GNOME wayland on Arch Linux, colors are correct (256.69 KB, text/plain)
2021-08-04 14:37 UTC, Tim Henning
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andres Betts 2021-07-28 16:18:25 UTC
Created attachment 140375 [details]
waylandinvertedcolors

SUMMARY
It appears that there are some inverted colors in the wayland session on the latest build for Plasma. Please review the attached image.


OBSERVED RESULT
Colors are inverted the moment you log in. The issue is "not" present in X11.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Latest git unstable
(available in About System)
KDE Plasma Version: Latest git unstable
KDE Frameworks Version: Latest git unstable

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2021-07-28 16:19:21 UTC
Can you please attach the output of qdbus org.kde.KWin /KWin supportInformation?
Comment 2 Zamundaaa 2021-07-28 18:30:58 UTC
Looks like the gamma ramp is messed up. Can you try with the environment variable "KWIN_DRM_NO_AMS=1"?
Comment 3 Nate Graham 2021-07-28 18:32:21 UTC
.
Comment 4 Tim Henning 2021-07-30 15:53:00 UTC
I have the same problem. KDE neon unstable, Intel Tiger Lake Xe graphics.

Here is the kwin support information: https://0bin.net/paste/2x-SW6De#qIEtfnuYV1MA2ND-iYjTz0irNoVL1eGE9GMW6+yvSNW
Comment 5 Tim Henning 2021-07-30 15:59:44 UTC
Not sure if this is the right way, but I added 'export KWIN_DRM_NO_AMS=1' to .bashrc, logged out and logged back into a wayland session. Unfortunately the problem persists.

Are there any other logs I should provide? Or anything I can test?
Comment 6 Nate Graham 2021-07-30 16:17:50 UTC
Thanks for the info!
Comment 7 Zamundaaa 2021-07-30 16:31:36 UTC
I don't think bashrc takes effect here. You can put it into /etc/environment instead.

If that still doesn't work then the output of drm_info would be good.
Comment 8 Tim Henning 2021-08-01 10:02:27 UTC
Thanks Zamundaaa, yes it does look normal again when having KWIN_DRM_NO_AMS=1 in /etc/environment!

Do you need anything else from my side to fix this properly? Unfortunately I don't have a kwin dev setup yet, otherwise I would offer to investigate and fix it myself.
Comment 9 Zamundaaa 2021-08-01 11:51:38 UTC
No kwin dev setup necessary, at least not yet. Considering that this issue is only happening to TGL users it's not unliekly that it's a driver bug.

To check if that's the case you can try another wayland compositor, GNOME or Sway for example, in a live boot. You could also install weston and log into the weston session in your current install if that's more convenient.

If another compositor does work then the output of drm_info can be useful (one time from X, one time from KWin without KWIN_DRM_NO_AMS set), the contents of ~/.local/share/sddm/wayland-session.log (after logging in without KWIN_DRM_NO_AMS set) as well.
Comment 10 Andres Betts 2021-08-01 13:28:40 UTC
Sorry for the delay. Here is the output:

signal void org.kde.KWin.reloadConfig()
method Q_NOREPLY void org.kde.KWin.cascadeDesktop()
method int org.kde.KWin.currentDesktop()
method QVariantMap org.kde.KWin.getWindowInfo(QString)
method Q_NOREPLY void org.kde.KWin.killWindow()
method void org.kde.KWin.nextDesktop()
method void org.kde.KWin.previousDesktop()
method QVariantMap org.kde.KWin.queryWindowInfo()
method Q_NOREPLY void org.kde.KWin.reconfigure()
method void org.kde.KWin.replace()
method bool org.kde.KWin.setCurrentDesktop(int desktop)
method void org.kde.KWin.showDebugConsole()
method bool org.kde.KWin.startActivity(QString)
method bool org.kde.KWin.stopActivity(QString)
method QString org.kde.KWin.supportInformation()
method Q_NOREPLY void org.kde.KWin.unclutterDesktop()
signal void org.freedesktop.DBus.Properties.PropertiesChanged(QString interface_name, QVariantMap changed_properties, QStringList invalidated_properties)
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface_name, QString property_name)
method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()
method QString org.freedesktop.DBus.Peer.GetMachineId()
method void org.freedesktop.DBus.Peer.Ping()
Comment 11 Andres Betts 2021-08-01 13:40:36 UTC
(In reply to Tim Henning from comment #8)
> Thanks Zamundaaa, yes it does look normal again when having
> KWIN_DRM_NO_AMS=1 in /etc/environment!
> 
> Do you need anything else from my side to fix this properly? Unfortunately I
> don't have a kwin dev setup yet, otherwise I would offer to investigate and
> fix it myself.

I can also confirm that the session works after making this change.
Comment 12 Andres Betts 2021-08-01 17:15:40 UTC
Here is the correct output:

==========================

Version
=======
KWin version: 5.22.80
Qt Version: 5.15.3
Qt compile version: 5.15.3
XCB compile version: 1.14

Operation Mode: Xwayland

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: yes
HAVE_GBM: yes
HAVE_EGL_STREAMS: yes
HAVE_X11_XCB: yes
HAVE_EPOXY_GLX: yes
HAVE_WAYLAND_EGL: yes

X11
===
Vendor: The X.Org Foundation
Vendor Release: 12009000
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme: 
Plugin recommends border size: None
Blur: 0
onAllDesktopsAvailable: false
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 2
decorationButtonsRight: 6, 3, 4, 5
borderSize: 0
gridUnit: 10
font: Noto Sans,10,-1,0,50,0,0,0,0,0
smallSpacing: 2
largeSpacing: 10

Platform
==========
Name: DRM
Active: true
Atomic Mode Setting on GPU 0: false
Using EGL Streams: false

Cursor
======
themeName: breeze_cursors
themeSize: 24

Options
=======
focusPolicy: 0
xwaylandCrashPolicy: 
xwaylandMaxCrashCount: 3
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 28
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 28
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 28
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777250
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
compositingMode: 1
useCompositing: true
hiddenPreviews: 1
glSmoothScale: 2
glStrictBinding: false
glStrictBindingFollowsDriver: true
glCoreProfile: false
glPreferBufferSwap: 101
glPlatformInterface: 2
windowsBlockCompositing: true
latencyPolicy: 
renderTimeEstimator: 

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: false
cursorPushBackDistance: 1x1
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 0
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Active screen follows mouse:  yes
Number of Screens: 1

Screen 0:
---------
Name: eDP-1
Geometry: 0,0,2560x1440
Scale: 1.5
Refresh Rate: 60
Adaptive Sync: incapable

Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) Iris(R) Plus Graphics (ICL GT2)
OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.2.6
OpenGL platform interface: EGL
OpenGL shading language version string: 4.60
Driver: Intel
GPU class: Ice Lake
OpenGL version: 4.6
GLSL version: 4.60
Mesa version: 20.2.6
Linux kernel version: 5.8
Direct rendering: Requires strict binding: no
GLSL shaders:  yes
Texture NPOT support:  yes
Virtual Machine:  no
OpenGL 2 Shaders are used

Loaded Effects:
---------------
zoom
kwin4_effect_sessionquit
kwin4_effect_login
slidingpopups
kwin4_effect_logout
slide
screenshot
kwin4_effect_windowaperture
desktopgrid
colorpicker
kwin4_effect_fadingpopups
kwin4_effect_fade
kwin4_effect_maximize
kwin4_effect_squash
kwin4_effect_fullscreen
kwin4_effect_frozenapp
kwin4_effect_morphingpopups
presentwindows
highlightwindow
kwin4_effect_dialogparent
blur
contrast
startupfeedback
screenedge
kscreen

Currently Active Effects:
-------------------------
blur
contrast

Effect Settings:
----------------
zoom:
zoomFactor: 1.2
mousePointer: 0
mouseTracking: 0
focusTrackingEnabled: false
textCaretTrackingEnabled: false
focusDelay: 350
moveFactor: 20
targetZoom: 1

kwin4_effect_sessionquit:
pluginId: kwin4_effect_sessionquit
isActiveFullScreenEffect: false

kwin4_effect_login:
pluginId: kwin4_effect_login
isActiveFullScreenEffect: false

slidingpopups:
slideInDuration: 150
slideOutDuration: 250

kwin4_effect_logout:
pluginId: kwin4_effect_logout
isActiveFullScreenEffect: false

slide:
duration: 500
horizontalGap: 45
verticalGap: 20
slideDocks: false
slideBackground: true

screenshot:

kwin4_effect_windowaperture:
pluginId: kwin4_effect_windowaperture
isActiveFullScreenEffect: false

desktopgrid:
zoomDuration: 300
border: 10
desktopNameAlignment: 0
layoutMode: 0
customLayoutRows: 2
usePresentWindows: true

colorpicker:

kwin4_effect_fadingpopups:
pluginId: kwin4_effect_fadingpopups
isActiveFullScreenEffect: false

kwin4_effect_fade:
pluginId: kwin4_effect_fade
isActiveFullScreenEffect: false

kwin4_effect_maximize:
pluginId: kwin4_effect_maximize
isActiveFullScreenEffect: false

kwin4_effect_squash:
pluginId: kwin4_effect_squash
isActiveFullScreenEffect: false

kwin4_effect_fullscreen:
pluginId: kwin4_effect_fullscreen
isActiveFullScreenEffect: false

kwin4_effect_frozenapp:
pluginId: kwin4_effect_frozenapp
isActiveFullScreenEffect: false

kwin4_effect_morphingpopups:
pluginId: kwin4_effect_morphingpopups
isActiveFullScreenEffect: false

presentwindows:
layoutMode: 0
showCaptions: true
showIcons: true
doNotCloseWindows: false
ignoreMinimized: false
accuracy: 20
fillGaps: true
fadeDuration: 150
showPanel: true
leftButtonWindow: 1
rightButtonWindow: 2
middleButtonWindow: 0
leftButtonDesktop: 2
middleButtonDesktop: 0
rightButtonDesktop: 0

highlightwindow:

kwin4_effect_dialogparent:
pluginId: kwin4_effect_dialogparent
isActiveFullScreenEffect: false

blur:

contrast:

startupfeedback:
type: 1

screenedge:

kscreen:


Loaded Plugins:
---------------
kwin5_plugin_colord
kwin5_plugin_krunner
kwin5_plugin_nightcolor
kwin5_plugin_screencast

Available Plugins:
------------------
kwin5_plugin_colord
kwin5_plugin_krunner
kwin5_plugin_nightcolor
kwin5_plugin_screencast
Comment 13 Tim Henning 2021-08-04 11:35:56 UTC
Created attachment 140510 [details]
drm_info on X11 without KWIN_DRM_NO_AMS set
Comment 14 Tim Henning 2021-08-04 11:36:13 UTC
Created attachment 140511 [details]
drm_info on Wayland without KWIN_DRM_NO_AMS set
Comment 15 Tim Henning 2021-08-04 11:42:57 UTC
I tested a Weston session and it works fine, so probably not a driver bug.

I attached the drm_info on X11 and Wayland without the KWIN_DRM_NO_AMS env variable set (the wrong colors are visible again on Wayland).

~/.local/share/sddm/wayland-session.log is empty on my system. Any idea why or where the log is instead?

Beside that, on both X11 and Wayland the monitor went black after running drm_info and I had to re-plug it.

When re-plugging the monitor in general on Wayland, the background image is not shown correctly afterward and e.g. Konsole crashes (not sure about other apps, Plasma and Latte dock seem to work correctly). Of course this is probably a different bug but I just wanted to mention it.

On a different note, this system is a notebook with Intel Tiger Lake Xe integrated graphics and Nvidia MX450 dedicated graphics. The Nvidia card is not used. Only the nouveau (no proprietary driver) is installed and the internal and external monitors are connected to the Intel graphics I think.
Comment 16 Tim Henning 2021-08-04 11:46:41 UTC
Maybe also relevant: the internal monitor is HDR capable, maybe that confuses kwin (its an OLED panel), but the problem also appears on the external, non HDR display.
Comment 17 Zamundaaa 2021-08-04 13:16:15 UTC
> ~/.local/share/sddm/wayland-session.log is empty on my system. Any idea why or where the log is instead?

You're using the systemd boot, probably because Fedora does that by default. Try "journalctl --user | grep kwin_wayland_drm"

> "GAMMA_LUT_SIZE" (immutable): range [0, UINT32_MAX] = 262145
> "DEGAMMA_LUT_SIZE" (immutable): range [0, UINT32_MAX] = 33

That's a big and a very small LUT table. Too big and too small respectively. I am fairly certain this is the cause of the bug, those values don't make sense.

> I tested a Weston session and it works fine, so probably not a driver bug.

Unfortunately that doesn't seem to do the trick. I had a suspicion that Weston only uses legacy functions (which we do with KWIN_DRM_NO_AMS set, too) to set gamma, but it turns out that it doesn't set gamma at all. Could you try another wayland compositor that does set gamma? A live usb with the latest GNOME or Sway should do it.
Comment 18 Tim Henning 2021-08-04 13:50:27 UTC
Created attachment 140514 [details]
output of: journalctl --user | grep kwin_wayland_drm

I opened a wayland session without the KWIN_DRM_NO_AMS flag today (August 4th) on 13:28, so probably only the last four lines are relevant.
Comment 19 Tim Henning 2021-08-04 13:52:48 UTC
Actually I'm on KDE neon, but anyway I attached the output of journalctl --user | grep kwin_wayland_drm.

I will try an up-to-date GNOME wayland session as soon as possible. (I'm currently thinking of switching to Arch, so I will try it there and maybe can also try kwinft, to see if it works with the new wlroots backend.)
Comment 20 Tim Henning 2021-08-04 14:37:55 UTC
Created attachment 140515 [details]
drm_info on GNOME wayland on Arch Linux, colors are correct
Comment 21 Tim Henning 2021-08-04 14:39:30 UTC
I just tried GNOME wayland on Arch and the colors are correct. I attached the drm_info output. I think the GAMMA LUT values are the same.

Btw, the external monitor goes black when running drm_info on GNOME wayland aswell.
Comment 22 Zamundaaa 2021-08-04 16:05:50 UTC
Thanks, that confirms it. For some reason this drm_info output contains some additional information:
> Gamma size: 256

So it's a driver bug, GNOME just ignores the atomic GAMMA_LUT_SIZE property and uses the legacy value. We can do the same but please report GAMMA_LUT_SIZE and DEGAMMA_LUT_SIZE being wrong to https://gitlab.freedesktop.org/drm/intel/-/issues
Comment 23 Nate Graham 2021-08-04 17:03:13 UTC
So we started doing the right thing but triggered a driver bug? Gross. Please do report upstream. However since this is a significant regression, can we work around it on our side until upstream fixes the bug?
Comment 24 Zamundaaa 2021-08-04 17:43:38 UTC
I'd say in this case it's acceptable. See https://invent.kde.org/plasma/kwin/-/merge_requests/1224
Comment 25 Zamundaaa 2021-08-05 12:26:18 UTC
Git commit 7879450cdf0a8a7326f22611c692920095d93a8d by Xaver Hugl.
Committed on 05/08/2021 at 12:25.
Pushed by zamundaaa into branch 'master'.

platforms/drm: work around tigerlake bug

M  +0    -1    src/plugins/platforms/drm/drm_object_crtc.cpp
M  +0    -4    src/plugins/platforms/drm/drm_object_crtc.h

https://invent.kde.org/plasma/kwin/commit/7879450cdf0a8a7326f22611c692920095d93a8d