[argyllcms] [PATCH] argyll 1.0.3: Fixes problems with outi->crtc set to 0

On my system argyll crashed with the following output:

$ dispwin
dispwin: ../../src/xcb_io.c:542: _XRead: Assertion `dpy->xcb->reply_data
!= 0' failed.
Aborted

I was able to track it down to the call of XRRGetCrtcGamma in the
function get_displays (source dispwin.c).  The function assumes that a
output in connected state has always a valid crtc entry which is not
true with my hardware.

I added a test for outi->crtc != 0 (see attached patch against argyll
1.0.3) and everything works fine. I took the idea for checking crtc from
xrandr.c.

For more information I attached a file xrandr.output which contains
information about my monitor setup (xrandr -q --verbose).

Hardware is the following:

- Lenovo Thinkpad T60 with ATI Radeon X1400
- Advanced Minidock Docking Station with DVI connector
- Monitor HP LP2475w attached through DVI
- internal Display of Notebook is turned off (maybe the cause of the
problem?)

Software versions:

- X.Org Version 1.6.0
- ATI Radeon Driver 6.12.1
- libxrandr 1.3.0
- x11-server-utils 7.4 (containing xrandr)

Regards,

        Torsten

diff --git a/spectro/dispwin.c b/spectro/dispwin.c
index 1859e30..5e86bad 100644
--- a/spectro/dispwin.c
+++ b/spectro/dispwin.c
@@ -549,6 +549,9 @@ disppath **get_displays() {
                                        continue;
                                }
 
+                               if (outi->crtc == 0)
+                                       continue;
+
                                /* Check that the VideoLUT's are accessible */
                                {
                                        XRRCrtcGamma *crtcgam;
Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 1920 x 1200
VGA-0 disconnected (normal left inverted right x axis y axis)
        Identifier: 0x4b
        Timestamp:  37190
        Subpixel:   no subpixels
        Clones:     DVI-0
        CRTCs:      0 1
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                   filter: 
        load_detection: 1 (0x00000001)  range:  (0,1)
LVDS connected (normal left inverted right x axis y axis)
        Identifier: 0x4c
        Timestamp:  37190
        Subpixel:   horizontal rgb
        Clones:    
        CRTCs:      0
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                   filter: 
        EDID_DATA:
                00ffffffffffff0030ae224000000000
                000f0103801d1578ea2d059757518a27
                23505421080081800101010101010101
                010101010101302a7820511a10403070
                13001ed61000001925237820511a1040
                307013001ed6100000190000000f0090
                43329043280f01004ca35034000000fe
                004c544e31343150342d4c30320a0019
        scaler: full
  1400x1050 (0x4e)  108.0MHz -HSync -VSync +preferred
        h: width  1400 start 1448 end 1560 total 1688 skew    0 clock   64.0KHz
        v: height 1050 start 1051 end 1054 total 1066           clock   60.0Hz
  1400x1050 (0x4f)   90.0MHz -HSync -VSync
        h: width  1400 start 1448 end 1560 total 1688 skew    0 clock   53.3KHz
        v: height 1050 start 1051 end 1054 total 1066           clock   50.0Hz
  1280x1024 (0x50)  109.0MHz -HSync +VSync
        h: width  1280 start 1368 end 1496 total 1712 skew    0 clock   63.7KHz
        v: height 1024 start 1027 end 1034 total 1063           clock   59.9Hz
  1280x1024 (0x51)  108.0MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock   64.0KHz
        v: height 1024 start 1025 end 1028 total 1066           clock   60.0Hz
  1280x960 (0x52)  101.2MHz -HSync +VSync
        h: width  1280 start 1360 end 1488 total 1696 skew    0 clock   59.7KHz
        v: height  960 start  963 end  967 total  996           clock   59.9Hz
  1280x854 (0x53)   89.2MHz -HSync +VSync
        h: width  1280 start 1352 end 1480 total 1680 skew    0 clock   53.1KHz
        v: height  854 start  857 end  867 total  887           clock   59.9Hz
  1280x800 (0x54)   83.5MHz -HSync +VSync
        h: width  1280 start 1352 end 1480 total 1680 skew    0 clock   49.7KHz
        v: height  800 start  803 end  809 total  831           clock   59.8Hz
  1280x720 (0x55)   74.5MHz -HSync +VSync
        h: width  1280 start 1344 end 1472 total 1664 skew    0 clock   44.8KHz
        v: height  720 start  723 end  728 total  748           clock   59.9Hz
  1152x768 (0x56)   71.8MHz -HSync +VSync
        h: width  1152 start 1216 end 1328 total 1504 skew    0 clock   47.7KHz
        v: height  768 start  771 end  781 total  798           clock   59.8Hz
  1024x768 (0x57)   65.0MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock   48.4KHz
        v: height  768 start  771 end  777 total  806           clock   60.0Hz
  1024x768 (0x58)   63.5MHz -HSync +VSync
        h: width  1024 start 1072 end 1176 total 1328 skew    0 clock   47.8KHz
        v: height  768 start  771 end  775 total  798           clock   59.9Hz
  800x600 (0x59)   40.0MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock   37.9KHz
        v: height  600 start  601 end  605 total  628           clock   60.3Hz
  800x600 (0x5a)   38.2MHz -HSync +VSync
        h: width   800 start  832 end  912 total 1024 skew    0 clock   37.4KHz
        v: height  600 start  603 end  607 total  624           clock   59.9Hz
  640x480 (0x5b)   25.2MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock   31.5KHz
        v: height  480 start  490 end  492 total  525           clock   59.9Hz
  640x480 (0x5c)   23.8MHz -HSync +VSync
        h: width   640 start  664 end  720 total  800 skew    0 clock   29.7KHz
        v: height  480 start  483 end  487 total  500           clock   59.4Hz
DVI-0 connected 1920x1200+0+0 (0x9d) normal (normal left inverted right x axis 
y axis) 546mm x 352mm
        Identifier: 0x4d
        Timestamp:  37190
        Subpixel:   horizontal rgb
        Clones:     VGA-0
        CRTC:       0
        CRTCs:      0 1
        Panning:    0x0+0+0
        Tracking:   0x0+0+0
        Border:     0/0/0/0
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                   filter: 
        EDID_DATA:
                00ffffffffffff0022f0f72601010101
                0113010380362378eece50a3544c9926
                0f5054a56b808140a900a940b300d100
                010101010101283c80a070b023403020
                360022602100001a000000fc00485020
                4c5032343735770a2020000000fd0030
                551e5e11000a202020202020000000ff
                00435a4339303130304b590a2020006f
        scaler: off
        coherent_mode: 1 (0x00000001)   range:  (0,1)
  1920x1200 (0x9d)  154.0MHz +HSync -VSync *current +preferred
        h: width  1920 start 1968 end 2000 total 2080 skew    0 clock   74.0KHz
        v: height 1200 start 1203 end 1209 total 1235           clock   60.0Hz
  1600x1200 (0x9e)  162.0MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock   75.0KHz
        v: height 1200 start 1201 end 1204 total 1250           clock   60.0Hz
  1680x1050 (0x9f)  119.0MHz +HSync -VSync
        h: width  1680 start 1728 end 1760 total 1840 skew    0 clock   64.7KHz
        v: height 1050 start 1053 end 1059 total 1080           clock   59.9Hz
  1600x1000 (0xa0)  133.1MHz -HSync +VSync
        h: width  1600 start 1704 end 1872 total 2144 skew    0 clock   62.1KHz
        v: height 1000 start 1001 end 1004 total 1035           clock   60.0Hz
  1280x1024 (0xa1)  135.0MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock   80.0KHz
        v: height 1024 start 1025 end 1028 total 1066           clock   75.0Hz
  1280x960 (0xa2)  108.0MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock   60.0KHz
        v: height  960 start  961 end  964 total 1000           clock   60.0Hz
  1152x864 (0xa3)  108.0MHz +HSync +VSync
        h: width  1152 start 1216 end 1344 total 1600 skew    0 clock   67.5KHz
        v: height  864 start  865 end  868 total  900           clock   75.0Hz
  1024x768 (0xa4)   78.8MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock   60.0KHz
        v: height  768 start  769 end  772 total  800           clock   75.0Hz
  1024x768 (0x57)   65.0MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock   48.4KHz
        v: height  768 start  771 end  777 total  806           clock   60.0Hz
  832x624 (0xa5)   57.3MHz -HSync -VSync
        h: width   832 start  864 end  928 total 1152 skew    0 clock   49.7KHz
        v: height  624 start  625 end  628 total  667           clock   74.6Hz
  800x600 (0xa6)   49.5MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock   46.9KHz
        v: height  600 start  601 end  604 total  625           clock   75.0Hz
  800x600 (0x59)   40.0MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock   37.9KHz
        v: height  600 start  601 end  605 total  628           clock   60.3Hz
  640x480 (0xa7)   31.5MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock   37.5KHz
        v: height  480 start  481 end  484 total  500           clock   75.0Hz
  640x480 (0x5b)   25.2MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock   31.5KHz
        v: height  480 start  490 end  492 total  525           clock   59.9Hz
  720x400 (0xa8)   28.3MHz -HSync +VSync
        h: width   720 start  738 end  846 total  900 skew    0 clock   31.5KHz
        v: height  400 start  412 end  414 total  449           clock   70.1Hz

Other related posts: