Bug 10132

Summary: dri doesn't work on second head (r128)
Product: Mesa Reporter: Peter Cordes <peter>
Component: Drivers/DRI/r128Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: xorg.conf.multihead.glx
xorg.0.log.gz

Description Peter Cordes 2007-02-28 16:32:43 UTC
I run AMD64 Ubuntu Edgy (xorg 7.1) on an Intel DG965WH mobo (g965 graphics) with a 16MB PCI r128 AIW.  I have mesa, drm (user and kernel), and xf86-video-intel compile from the git sources (as of today, Feb 28, 2007).

 In a multihead non-Xinerama (:0.0 is i965, :0.1 is r128) dri is broken on the second head.
peter@tesla:~/bug/x/second-head-nogl$ LIBGL_DEBUG=verbose MESA_DEBUG=1 glxgears -printfps
libGL: XF86DRIGetClientDriverName: 1.7.4 i965 (screen 0)
libGL: OpenDriver: trying /usr/X11R6/lib/modules/dri/i965_dri.so
libGL: XF86DRIGetClientDriverName: 4.1.0 r128 (screen 1)
libGL: OpenDriver: trying /usr/X11R6/lib/modules/dri/r128_dri.so
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 4, (OK)
drmOpenByBusid: Searching for BusID pci:0000:00:02.0
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 4, (OK)
drmOpenByBusid: drmOpenMinor returns 4
drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 5, (OK)
drmOpenByBusid: Searching for BusID pci:0000:06:01.0
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 5, (OK)
drmOpenByBusid: drmOpenMinor returns 5
drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0
drmOpenDevice: node name is /dev/dri/card1
drmOpenDevice: open result is 5, (OK)
drmOpenByBusid: drmOpenMinor returns 5
drmOpenByBusid: drmGetBusid reports pci:0000:06:01.0
Error: nConfigOptions (3) does not match the actual number of options in
       __driConfigOptions (4).
Mesa warning: couldn't open libtxc_dxtn.so, software DXTn compression/decompression unavailable
libGL error: 
Can't open configuration file /etc/drirc: No such file or directory.
libGL error: 
Can't open configuration file /home/peter/.drirc: No such file or directory.
glxgears: ../common/xmlconfig.c:991: driQueryOptioni: Assertion `cache->info[i].name != ((void *)0)' failed.
Aborted

 This happens with Ubuntu's stock mesa/dri, too (LD_LIBRARY_PATH=/usr/lib LIBGL_DRIVERS_PATH=/usr/lib/dri).  Same output.

backtrace:
(gdb) run
Starting program: /usr/bin/glxgears 
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 47017478787552 (LWP 7838)]
Error: nConfigOptions (3) does not match the actual number of options in
       __driConfigOptions (4).
glxgears: ../common/xmlconfig.c:991: driQueryOptioni: Assertion `cache->info[i].name != ((void *)0)' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 47017478787552 (LWP 7838)]
0x00002ac31abff47b in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00002ac31abff47b in raise () from /lib/libc.so.6
#1  0x00002ac31ac00da0 in abort () from /lib/libc.so.6
#2  0x00002ac31abf8bf6 in __assert_fail () from /lib/libc.so.6
#3  0x00002ac31c228481 in driQueryOptioni (cache=0x510a38, 
    name=<value optimized out>) at ../common/xmlconfig.c:991
#4  0x00002ac31c6b7a4d in r128CreateContext (glVisual=<value optimized out>, 
    driContextPriv=0x511c30, sharedContextPrivate=0x514424)
    at r128_context.c:183
#5  0x00002ac31c227653 in driCreateNewContext (dpy=0x505010, modes=0x513b80, 
    render_type=<value optimized out>, sharedPrivate=<value optimized out>, 
    pctx=0x5105b0) at ../common/dri_util.c:830
#6  0x00002ac31a62c08e in CreateContext (dpy=0x505010, vis=0x5101e0, 
    fbconfig=0x0, shareList=0x0, allowDirect=1, contextID=0, use_glx_1_3=0, 
    renderType=0) at glxcmds.c:353
#7  0x00002ac31a62c415 in glXCreateContext (dpy=0x1e9e, vis=0x1e9e, 
    shareList=0xffffffffffffffff, allowDirect=7838) at glxcmds.c:430
#8  0x000000000040371f in ?? ()
#9  0x0000000000403dea in ?? ()
#10 0x00002ac31abec0c4 in __libc_start_main () from /lib/libc.so.6
#11 0x0000000000401619 in ?? ()
#12 0x00007fff905b8eb8 in ?? ()
#13 0x0000000000000000 in ?? ()

 Is the dri parser code broken on screen != 0?  I started to look at it, and I don't see why an option has to be in the cache just because it was requested. Maybe the cache is supposed to be filled with the defaults first...  If so, that probably didn't happen for the second head.

I'll attach my xorg.conf and my X log.

 Running X on either the i965 or r128 head with a single screen on a single display works fine (xv, glx/dri, xrandr, etc. are all ok).  This is also the case in multiseat mode (2 kbds with evdev input driver, and X -sharevts, two separate DISPLAYs).  Both cards can be running glxgears at the same time.  Very useful for running a web browser + a full screen keyboard-grabbing game.
Comment 1 Peter Cordes 2007-02-28 16:34:16 UTC
Created attachment 8916 [details]
xorg.conf.multihead.glx
Comment 2 Peter Cordes 2007-02-28 16:36:44 UTC
Created attachment 8917 [details]
xorg.0.log.gz
Comment 3 Peter Cordes 2007-02-28 16:45:08 UTC
I forgot to mention that driconf is broken (on either screen, since it calls glxinfo, which tries to do both screens).
peter@tesla:~$ glxinfo
... (normal output for screen 0)

glxinfo: ../common/xmlconfig.c:991: driQueryOptioni: Assertion `cache->info[i].name != ((void *)0)' failed.
Aborted



dri on the i965 head works, but always produces this error message while starting:
$ glxgears
Error: nConfigOptions (3) does not match the actual number of options in
       __driConfigOptions (4).
Comment 4 Peter Cordes 2007-02-28 17:00:24 UTC
Hmm, this ~/.drirc doesn't help.

<driconf>
    <device screen="1" driver="r128">
        <application name="Default">
            <option name="no_rast" value="false" />
            <option name="vblank_mode" value="1" />
            <option name="texture_depth" value="0" />
        </application>
    </device>
    <device screen="0" driver="i965">
        <application name="Default">
            <option name="force_s3tc_enable" value="true" />
            <option name="fthrottle_mode" value="2" />
            <option name="vblank_mode" value="1" />
            <option name="allow_large_textures" value="1" />
        </application>
    </device>
</driconf>

 (I assume those screen number refer to X11 screens, not displays or something).

with gdb:
run
...aborts
fr 4
l
 shows that name is "texture_depth", which is defined in that drirc.

 With debug env vars, glxgears prints:
libGL error: 
Warning in /home/peter/.drirc line 4, column 12: undefined option: no_rast.
libGL error: 
Warning in /home/peter/.drirc line 6, column 12: undefined option: texture_depth.

ok, so there's something bogus about the options list.
(gdb) p rmesa->optionCache
$16 = {info = 0x513f10, values = 0x5554f0, tableSize = 3}

(gdb) p (driOptionInfo [3])*(rmesa->optionCache->info)
$15 = {{name = 0x0, type = DRI_BOOL, ranges = 0x0, nRanges = 0}, 
{ name = 0x511cd0 "force_s3tc_enable", type = DRI_BOOL, ranges = 0x0, nRanges = 0},
{ name = 0x511d10 "allow_large_textures", type = DRI_ENUM, ranges = 0x511d50, nRanges = 1}}

 These options were set in the i965 section, not r128.  No wonder the r128 DRI driver is having problems.
Comment 5 Michel Dänzer 2007-12-04 09:33:35 UTC
Fixed in Git master and mesa_7_0_branch.
Comment 6 Adam Jackson 2009-08-24 12:26:00 UTC
Mass version move, cvs -> git

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.