Subject: mgadrm && xorg-server 1.3.0, now working
To: None <tech-x11@netbsd.org>
From: theglass <theglass@email.it>
List: tech-x11
Date: 05/13/2007 00:09:19
Hi all,

I just wanted to aknowledge you that I've partially resolved
in making the DRM/DRI work on my machine.

I had to: 

1) disable AIGLX

2) add Option "OldDmaInit" from the mga(4) driver
 
3) remove Load "GLcore" from the module section
   (it is automatically loaded further on).

My working xorg.conf (if you also like to update the 
documentation page) is:

Section "Device"
        Identifier  "Matrox G400"
        Driver      "mga"
        BusID       "PCI:1:0:0" 
        Option      "DRI" 
        Option      "OverclockMem" 
        Option      "AGPMode" "2"
        Option      "AGPSIze" "64"
        Option      "AccelMethod" "XAA"
        Option      "XAANoOffScreenPixmaps" "True"
        Option      "OldDmaInit" "True"
EndSection

(Actually, I didn't try it without explicitly setting the BusID..
it shouldn't be a problem, anyway).



Just two words on the accel types: the DRI seems to work fine with XAA, 
while with EXA, the xorg-server crashes saying 

[drm:pid1305:drm_close] *ERROR* can't find authenticator

when I run 'glxinfo' (glxgears goes fine).

It crashes in the same way (same error message), with the usual 
DMA initialization (omitting "OldDmaInit").

I have to say (don't know if it's a real problem) that the DRI
has still some unpleasant graphics bugs (glxgears keeps on wheelin' even after
closing its window, I have to kill it), maybe due to some configuration 
compromise between my up-to-date system (xorg-server 1.3.0.0 && mesa-dri 
running on -current) and my (old) k6-2 machine (see the OldDmaInit option).

Anyway, I still have to try someother GL-software, and first of all,
rebuild everything (my xorg and Mesa libraries needs to be coherently compiled)


Last but not least (if it can be useful), while I was looking for "the error", 
I tried to add these lines in drm_drv.c:drm_open(), 

--- sys/dev/drm/drm_drv.c.orig  2007-05-12 23:21:32.000000000 +0200
+++ sys/dev/drm/drm_drv.c       2007-05-12 23:17:50.000000000 +0200
@@ -755,6 +755,12 @@
 
        dev = DRIVER_SOFTC(minor(kdev));
 
+       if(dev==NULL) 
+       {
+               DRM_ERROR("drm%d : no such device\n", minor(kdev));
+               return DRM_ERR(ENODEV);
+       }
+
        DRM_DEBUG( "open_count = %d\n", dev->open_count );
 
that prevented a kernel panic when the xserver (o someother software) 
tried to open a drm minor > 0 (before a busid scan, for instance).

 
I hope that my immersion in these drm-troubles can be useful to someone
else (other than me).
 
I'll stay tuned for some more news!

see you,

--theglass