Bug 100293 - [BISECTED, PATCH] Xorg is crashing after RandR1.2 gamma code v6
Summary: [BISECTED, PATCH] Xorg is crashing after RandR1.2 gamma code v6
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-21 06:24 UTC by Mariusz Białończyk
Modified: 2017-04-17 07:35 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
xorg.conf (2.95 KB, text/plain)
2017-03-21 06:24 UTC, Mariusz Białończyk
no flags Details
patch (625 bytes, patch)
2017-03-21 06:25 UTC, Mariusz Białończyk
no flags Details | Splinter Review
log with xinerama disabled (61.56 KB, text/plain)
2017-03-21 06:25 UTC, Mariusz Białończyk
no flags Details
log with xinerama enabled (48.96 KB, text/plain)
2017-03-21 06:25 UTC, Mariusz Białończyk
no flags Details

Description Mariusz Białończyk 2017-03-21 06:24:20 UTC
I found a big problem with RandR1.2 gamma code v6, which is now
commited in main xserver.

I mean this commit:
commit b4e46c0444bb09f4af59d9d13acc939a0fbbc6d6
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Sat Nov 28 16:50:47 2015 +0900

The problem is, that it is crashing the Xserver when I have
xinerama enabled. I am using two nvidia cards with two
outputs enabled for each. So my working configuration is really
great for tests, because I am using 4 monitors at a time :)

The backtrace for the crash is:
[498150.564] (EE) Backtrace:
[498150.564] (EE) 0: ./Xorg (xorg_backtrace+0x3d) [0x55d361ec194d]
[498150.564] (EE) 1: ./Xorg (0x55d361d1e000+0x1a72a9) [0x55d361ec52a9]
[498150.564] (EE) 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f683870c000+0x110c0) [0x7f683871d0c0]
[498150.564] (EE) 3: ./Xorg (RRCrtcGammaSetSize+0x0) [0x55d361e26a10]
[498150.564] (EE) 4: ./Xorg (0x55d361d1e000+0xcda5a) [0x55d361deba5a]
[498150.564] (EE) 5: ./Xorg (xf86HandleColormaps+0x302) [0x55d361db6b12]
[498150.564] (EE) 6: /dev/shm/a/gfx-test/lib/xorg/modules/drivers/nouveau_drv.so (0x7f6832dcb000+0x10887) [0x7f6832ddb887]
[498150.564] (EE) 7: ./Xorg (AddScreen+0xd7) [0x55d361d6def7]
[498150.564] (EE) 8: ./Xorg (InitOutput+0x410) [0x55d361db1950]
[498150.564] (EE) 9: ./Xorg (0x55d361d1e000+0x53946) [0x55d361d71946]
[498150.565] (EE) 10: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xf1) [0x7f683838e2b1]
[498150.565] (EE) 11: ./Xorg (_start+0x2a) [0x55d361d5cafa]
[498150.565] (EE)
[498150.565] (EE) Segmentation fault at address 0x38
[498150.565] (EE)
Fatal server error:
[498150.565] (EE) Caught signal 11 (Segmentation fault). Server aborting

I was doing the final tests on the following tagged version:
7e5c9bdf7 (tag: xorg-server-1.19.0) Bump version to 1.19.0

I prepared a patch which is a solution for the problem:
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index 8588c9fba..c43aceec9 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -155,6 +155,9 @@ xf86HandleColormaps(ScreenPtr pScreen,
     int *indices;
     int elements;

+    if (xf86_crtc_supports_gamma(pScrn))
+      return TRUE;
+
     if (!maxColors || !sigRGBbits ||
         (!loadPalette && !xf86_crtc_supports_gamma(pScrn)))
         return FALSE;

After applying the patch, the server is not crashing anymore.
Comment 1 Mariusz Białończyk 2017-03-21 06:24:50 UTC
Created attachment 130331 [details]
xorg.conf
Comment 2 Mariusz Białończyk 2017-03-21 06:25:05 UTC
Created attachment 130332 [details] [review]
patch
Comment 3 Mariusz Białończyk 2017-03-21 06:25:45 UTC
Created attachment 130333 [details]
log with xinerama disabled
Comment 4 Mariusz Białończyk 2017-03-21 06:25:59 UTC
Created attachment 130334 [details]
log with xinerama enabled
Comment 5 Michel Dänzer 2017-03-21 08:36:30 UTC
[ I get bug updates via the xorg-team mailing list ]

Thanks for the report, I'll take a look when I get a chance.

FWIW, the patch isn't a solution, it just avoids the problem by again breaking colormaps for RandR 1.2 capable drivers.
Comment 6 Ilia Mirkin 2017-04-03 18:34:16 UTC
(In reply to Michel Dänzer from comment #5)
> [ I get bug updates via the xorg-team mailing list ]
> 
> Thanks for the report, I'll take a look when I get a chance.
> 
> FWIW, the patch isn't a solution, it just avoids the problem by again
> breaking colormaps for RandR 1.2 capable drivers.

Sounds like b4e46c0444bb09f4af59d9d13acc939a0fbbc6d6 is buggy for previously-working setups. Perhaps a revert until the details can be worked out?

The xinerama configuration is quite common with NVIDIA NVS 450's, as they are dual-GPU boards, with 2 outputs wired to two separate GPUs. Reverse-prime is less-than-perfect, and 3D acceleration is rarely what such users strive for, so Xinerama strikes a nice balance for such users.

In addition to Mariusz, another user has also reported this issue in #nouveau -- I'm guessing as distros are updating to 1.19, the breakage is becoming more apparent.
Comment 7 Ilia Mirkin 2017-04-03 19:19:24 UTC
FTR, this is the list of commits that have to be reverted:

02ff0a5d7e32ce8460d6d0669f532d65ad212fcd
a58dd678bf952560e5422845e186d80a189953fe
5b9f3ea2501a886fb74e5248e82a95e76443f1e8
a446ff84de2dd29439521f6e87d75bde3bbf002c
b4e46c0444bb09f4af59d9d13acc9
17213b74fd7fc4c4e2fe7a3781e7422dd482a0ab
62f44052573b475a7b4c24f8e2da9bd6a8f1bd70

With these, the user reports working Xinerama with Xorg 1.19 again with xf86-video-nouveau on a NVS 450 (2x G98 with 2x DP outputs each, configured with zaphod heads + xinerama).
Comment 8 Mariusz Białończyk 2017-04-03 19:52:38 UTC
Thanks for your input, Ilia.

Also FTR: In my case (dual nvidia gpu with nouveau), I have to use two of "my reverting" patches:
- 1st from this bug:
https://bugs.freedesktop.org/attachment.cgi?id=130332
- and 2nd from bug https://bugs.freedesktop.org/show_bug.cgi?id=100294:
https://bugs.freedesktop.org/attachment.cgi?id=130656

With those two patches on top of tag: xorg-server-1.19.0, I have a working xinerama back again. Of course these are only a workaround-revert patches, not the exact cure for the problems.
Comment 9 Michel Dänzer 2017-04-06 03:24:45 UTC
Fix submitted for review: https://patchwork.freedesktop.org/patch/148662/
Comment 10 Michel Dänzer 2017-04-12 09:38:19 UTC
Comment on attachment 130332 [details] [review]
patch

Better fix posted for review:

https://patchwork.freedesktop.org/patch/149863/
Comment 11 Mariusz Białończyk 2017-04-13 04:30:44 UTC
The patch is working. Please close this bug after merging.
Thank you.
Comment 12 Michel Dänzer 2017-04-17 07:35:50 UTC
Thanks for the report, fixed in Git master:

https://cgit.freedesktop.org/xorg/xserver/commit/?id=41dafcc2a2942fc4c94ce3cbafc4a1b413c460c3


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.