Bug 491634 - Weird colors on external display connected to nvidia dGPU after 6bd07ad6b30e34f43652934630d30234ad65ac7c
Summary: Weird colors on external display connected to nvidia dGPU after 6bd07ad6b30e3...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (other bugs)
Version First Reported In: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-08-12 17:13 UTC by fanzhuyifan
Modified: 2024-08-15 13:35 UTC (History)
4 users (show)

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


Attachments
old behavior (good) (1.36 MB, image/jpeg)
2024-08-12 17:14 UTC, fanzhuyifan
Details
new behavior (bad) (804.01 KB, image/jpeg)
2024-08-12 17:15 UTC, fanzhuyifan
Details
On external display white background is darker than mouse (2.54 MB, image/jpeg)
2024-08-12 19:19 UTC, fanzhuyifan
Details
On internal display white background is the same color as cursor (616.50 KB, image/jpeg)
2024-08-12 19:20 UTC, fanzhuyifan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fanzhuyifan 2024-08-12 17:13:47 UTC
SUMMARY

After https://invent.kde.org/plasma/kwin/-/commit/6bd07ad6b30e34f43652934630d30234ad65ac7c, I see weird colors on my external display connected to nvidia dGPU (see attachments for demonstration).

I see the following in the journal logs:

Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_scene_opengl: 0x500: GL_INVALID_ENUM error generated. Invalid <face>.
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_scene_opengl: Invalid framebuffer status:  "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_scene_opengl: 0x502: GL_INVALID_OPERATION error generated. <image> and <target> are incompatible
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_scene_opengl: Invalid framebuffer status:  "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_wayland_drm: Failed to create framebuffer: Invalid argument
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_wayland_drm: Failed to create framebuffer: Invalid argument
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT)
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT)
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT)
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT)
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT)
Aug 12 10:06:52 arch kwin_wayland[59151]: kwin_scene_opengl: 0x2: GL_INVALID_OPERATION in glDrawBuffers(unsupported buffer GL_BACK_LEFT)

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.1.80
KDE Frameworks Version: 6.5.0
Qt Version: 6.8.0
Kernel Version: 6.10.2-arch1-2 (64-bit)
Graphics Platform: Wayland
Processors: 20 × 13th Gen Intel® Core™ i9-13900H
Memory: 15.2 GiB of RAM
Graphics Processor: Mesa Intel® Graphics

ADDITIONAL INFORMATION
Currently using the 550.100 proprietary nvidia drivers (555 was too buggy).
Comment 1 fanzhuyifan 2024-08-12 17:14:39 UTC
Created attachment 172550 [details]
old behavior (good)
Comment 2 fanzhuyifan 2024-08-12 17:15:06 UTC
Created attachment 172551 [details]
new behavior (bad)
Comment 3 Zamundaaa 2024-08-12 18:47:18 UTC
Does it work correctly again if you comment out the code about post blending pipelines here? https://invent.kde.org/plasma/kwin/-/blob/cfc0f05c942eec50d4596d5531b183356e504784/src/backends/drm/drm_crtc.cpp#L52
Comment 4 fanzhuyifan 2024-08-12 19:10:24 UTC
(In reply to Zamundaaa from comment #3)
> Does it work correctly again if you comment out the code about post blending
> pipelines here?
> https://invent.kde.org/plasma/kwin/-/blob/
> cfc0f05c942eec50d4596d5531b183356e504784/src/backends/drm/drm_crtc.cpp#L52

That fixes the issues with fonts appearing bold.

But the colors still seem a bit off -- white appears as grey instead of white. That is particularly noticeable if I put the cursor on white background -- there is color difference on the external monitor, but no color difference on the internal display.

I will check if https://invent.kde.org/plasma/kwin/-/merge_requests/6221 fixes the later issue.

I still get these in my logs though:

Aug 12 12:04:27 arch kwin_wayland[29246]: kwin_scene_opengl: 0x500: GL_INVALID_ENUM error generated. Invalid <face>.
Aug 12 12:04:27 arch kwin_wayland[29246]: kwin_scene_opengl: Invalid framebuffer status:  "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"
Aug 12 12:04:27 arch kwin_wayland[29246]: kwin_scene_opengl: 0x502: GL_INVALID_OPERATION error generated. <image> and <target> are incompatible
Aug 12 12:04:27 arch kwin_wayland[29246]: kwin_scene_opengl: Invalid framebuffer status:  "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"
Aug 12 12:04:27 arch kwin_wayland[29246]: kwin_wayland_drm: Failed to create framebuffer: Invalid argument
Aug 12 12:04:27 arch kwin_wayland[29246]: kwin_wayland_drm: Failed to create framebuffer: Invalid argument
Comment 5 fanzhuyifan 2024-08-12 19:19:45 UTC
Created attachment 172559 [details]
On external display white background is darker than mouse

The grayer colors are not fixed by https://invent.kde.org/plasma/kwin/-/merge_requests/6221
Comment 6 fanzhuyifan 2024-08-12 19:20:25 UTC
Created attachment 172560 [details]
On internal display white background is the same color as cursor
Comment 7 Bug Janitor Service 2024-08-13 12:46:51 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6237
Comment 8 Zamundaaa 2024-08-13 12:50:28 UTC
This doesn't happen for me on driver 555, could you test if that works for you too?

> But the colors still seem a bit off -- white appears as grey instead of white. That is particularly noticeable if I put the cursor on white background -- there is color difference on the external monitor, but no color difference on the internal display.
That's with all the post blending CRTC stuff commented out? With HDR enabled, the cursor is brighter than the rest here too, but only with DEGAMMA_LUT used (as the linked MR explains)
Comment 9 fanzhuyifan 2024-08-13 16:52:26 UTC
(In reply to Zamundaaa from comment #8)
> This doesn't happen for me on driver 555, could you test if that works for
> you too?

On 555, without commenting out the lines, I get the same issue with fonts appearing bolded on external display/weird colors.
Comment 10 Zamundaaa 2024-08-15 13:35:45 UTC
Git commit fe5db7f97d25362c3fe63cfa07c183e666536455 by Xaver Hugl.
Committed on 15/08/2024 at 13:26.
Pushed by zamundaaa into branch 'master'.

backends/drm: disable degamma_lut and ctm on NVidia

The NVidia driver maps them to hardware planes, which means they do not
apply to the cursor because the cursor plane doesn't have these color
operations.

M  +2    -2    src/backends/drm/drm_crtc.cpp

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