Bug 103135

Summary: i915 DRI driver broken?
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Stefan Dirsch <sndirsch>
Component: X.OrgAssignee: Stefan Dirsch <sndirsch>
Status: RESOLVED FIXED QA Contact: Stefan Dirsch <sndirsch>
Severity: Major    
Priority: P5 - None CC: eich, peter
Version: Beta 1   
Target Milestone: ---   
Hardware: Other   
OS: All   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Patch by alanh mentioned above
strace -f -eopen glxinfo > i855gm 2>&1
i915 GM support
945G support
Patch required for Mesa 6.2 branch

Description Stefan Dirsch 2005-08-09 18:34:49 UTC
Looks like the i915 DRI driver is currently broken.

# glxinfo
ERROR: line 125, Function intelInitDriver, File intel_screen.c
libGL warning: 3D driver returned no fbconfigs
libGL errror: INitDriver failed
libGL error: reverting to (slow) indirect rendering

Same problem on 915GM and 945G.
Comment 1 Stefan Dirsch 2005-08-09 18:40:00 UTC
--> Mesa --> ./src/mesa/drivers/dri/i915/intel_screen.c
[...]
   if (drmMap(sPriv->fd,
              intelScreen->back.handle,
              intelScreen->back.size,
              (drmAddress *)&intelScreen->back.map) != 0) {
      fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
              __LINE__, __FUNCTION__, __FILE__);                   <-- line 125
      FREE(intelScreen);
      sPriv->private = NULL;
      return GL_FALSE;
   }
[...]

I remembered a patch by Alan H.:

  * Bump the DDX version to 1.4.0 to indicate the removal of 
    drmAddress. Thus allowing 32/64bit clients to cohabit.

and reverted it, but this didn't help at all. I attach the patch (not reverted)
for convenience.
Comment 2 Stefan Dirsch 2005-08-09 18:41:30 UTC
Created attachment 45381 [details]
Patch by alanh mentioned above

* Bump the DDX version to 1.4.0 to indicate the removal of drmAddress. Thus
allowing 32/64bit clients to cohabit.
Comment 3 Stefan Dirsch 2005-08-09 18:44:32 UTC
For building the i915 DRI module I currently use Mesa 6.3 and DRM 1.0.0. Maybe I
need to downgrade Mesa and/or DRM or we have a general DRM problem into our
kernel. I'm not sure whether DRI currently works at all on any hardware with any
driver ...
Comment 4 Egbert Eich 2005-08-10 07:46:28 UTC
The size of the strucutre may have changed do to the removal of drmAddress. The
drmAddress elements in those structures were not needed in most of the cases (or
could be worked around). On the other hand there should be a version check for
this. Not all drivers had drmAddress elements. The ATi drivers did not nor did
the Matrox drivers.
The Intel driver was the only one this has been applied to and I asked Alan to
coordinate those changes (which are needed for 64/32bit compatibility) so that
we commit the stuff to each component at the same time. 
Structures containing drmAddress are not used in the kernel so we don't see any
compatibility problem there. The kernel ABI remains compatible no matter what.
There will be a change in the kernel which will only affect user space at
compile time: the type of drm_handle_t (which isn't used in the kernel) will change.
Comment 5 Stefan Dirsch 2005-08-10 08:55:40 UTC
I tried with earlier Mesa/DRM versions I used for building and I surely know
that at least with one of them DRI worked fine on my 945G machine, but this
didn't help. :-( 
No matter if I use the  i810 driver with drmAdress in the structure or not. 
BTW, here are the RPMs with earlier Mesa/DRM versions for testing:

# ls x11-dri-i915*
x11-dri-i915-20050705.i386.rpm
x11-dri-i915-20050705.x86_64.rpm
x11-dri-i915-20050715.i386.rpm
x11-dri-i915-20050715.x86_64.rpm
x11-dri-i915-20050725.i386.rpm
x11-dri-i915-20050725.x86_64.rpm

20050705:
- Mesa CVS 050629
- DRM CVS 050701

20050715:
- Mesa CVS 050629
- DRM CVS 050701
- used RPM_OPT_FLAGS for building

20050725:
- Mesa CVS 050713
- DRM 1.0

Beta1:
- Mesa 6.3
- DRM 1.0
Comment 6 Matthias Hopf 2005-08-10 09:28:26 UTC
(In reply to comment #3)
> For building the i915 DRI module I currently use Mesa 6.3 and DRM 1.0.0. Maybe I
> need to downgrade Mesa and/or DRM or we have a general DRM problem into our
> kernel. I'm not sure whether DRI currently works at all on any hardware with any
> driver ...

It works in SL10b1 with radeon. Verifyed yesterday.
Comment 7 peter czanik 2005-08-10 10:09:06 UTC
Same problem with an Intel 855GM.
Comment 8 Stefan Dirsch 2005-08-10 10:15:30 UTC
> Same problem with an Intel 855GM.

Really? Please attach the output of strace -f -eopen glxinfo. You need to
install package strace before. Thanks.
Comment 9 peter czanik 2005-08-10 10:33:14 UTC
Created attachment 45484 [details]
strace -f -eopen glxinfo > i855gm 2>&1
Comment 10 Stefan Dirsch 2005-08-10 10:35:57 UTC
> open("/usr/X11R6/lib/modules/dri/i915_dri.so", O_RDONLY) = 4

Oops, 855 now also uses the i915 DRI module. I forgot this. Thanks.
Comment 11 Stefan Dirsch 2005-08-10 12:16:35 UTC
I'll also try the i915 DRI driver from X.Org CVS. It should match the i810 video
driver from X.Org CVS best.
Comment 12 Stefan Dirsch 2005-08-10 21:46:43 UTC
Just that this informatin does not get lost. ro just told me, that the drivers 
from the Intel site don't work as well. 
 
http://support.intel.com/support/graphics/sb/CS-010512.htm 
- dri-I915-v1.1-20041217.i386.rpm 
- i915Graphics.tar.gz 
Comment 13 Stefan Dirsch 2005-08-12 13:20:45 UTC
> I'll also try the i915 DRI driver from X.Org CVS. It should match the i810 video
> driver from X.Org CVS best.

Unfortunately it's not that easy or even impossible to compile the i915 X.Org
CVS DRI driver (Mesa 6.3 based) inside Mesa 6.1 of X.Org 6.8.2. I'll try to
compile it inside of Mesa 6.3, but I didn't see any relevant changes between
i915 X.Org CVS DRI driver and the i915 driver inside Mesa 6.3.
Comment 14 Stefan Dirsch 2005-08-12 14:21:41 UTC
> I'll try to compile it inside of Mesa 6.3, but I didn't see any relevant
changes > between i915 X.Org CVS DRI driver and the i915 driver inside Mesa 6.3.

Similar problems. I'll try to find the required hunks for 915GM and 945G support
in Mesa 6.3 (not that much AFAICS) and create a patch against Mesa 6.1.
Comment 15 Stefan Dirsch 2005-08-12 16:28:49 UTC
TODO:

--> Mesa --> ./src/mesa/drivers/dri/i915/intel_screen.c
[...]
   if (drmMap(sPriv->fd,
              intelScreen->back.handle,
              intelScreen->back.size,
              (drmAddress *)&intelScreen->back.map) != 0) {
      fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
              __LINE__, __FUNCTION__, __FILE__);                   <-- line 125
      FREE(intelScreen);
      sPriv->private = NULL;
      return GL_FALSE;
   }
[...]

- compare values of intelScreen structure inside Xserver and DRI client. These 
  should match. 
- print errno
- have a look at kernel logfile

For the 945G machine freezes after terminating Xserver:
- debug Xserver and step into i830closescreen
Comment 16 Stefan Dirsch 2005-08-12 21:30:19 UTC
Created attachment 45953 [details]
 i915 GM support

Should be sufficient for Mesa 6.1.
Comment 17 Stefan Dirsch 2005-08-12 21:30:44 UTC
Created attachment 45954 [details]
945G support 

Should be sufficient for Mesa 6.1.
Comment 18 Stefan Dirsch 2005-08-12 21:32:26 UTC
Though I must admit that I didn't test the 915GM/945G patches right above yet. 
Comment 19 Stefan Dirsch 2005-08-13 14:39:58 UTC
Hmm ... at least the i945G patch didn't help. Still the same problem. Probably 
the Mesa 6.1 DRI driver of X.Org 6.8.2 doesn't work any longer together with
newer Kernel DRM versions. Need to verifiy this with a Intel <= i915G machine.
Comment 20 Stefan Dirsch 2005-08-13 16:28:13 UTC
I was wrong. It works. Probably the broken i915 DRI driver confused the system.
But for whatever reason debug seems to be enabled by default now, so it seems
that for each vertex information is now printed. :-(

RPMs for testing:

/suse/sndirsch/xorg-x11-Mesa-6.8.2-89.i586.rpm
/suse/sndirsch/xorg-x11-Mesa-6.8.2-89.x86_64.rpm

It overwrites i915_dri.so of x11-dri-i915 package!
Comment 21 Stefan Dirsch 2005-08-13 17:28:07 UTC
> But for whatever reason debug seems to be enabled by default now, so it seems
> that for each vertex information is now printed. :-(

Looks like this when starting glxgears:

   -- v(0): 42f3b308/121.849670
   -- v(1): 4342b12c/194.692078
   -- v(2): 3f73c3be/0.952206
   -- v(3): ffc11800/nan

   -- v(0): 42f3b308/121.849670
   -- v(1): 4342b12c/194.692078
   -- v(2): 3f73c3be/0.952206
   -- v(3): ffc11800/nan

[...]
Comment 22 Matthias Hopf 2005-08-15 09:33:16 UTC
I don't get any debug output, and 3D direct rendering seems to work again :)))

Thanks, Stefan, good work!

submit -> stable, please.

BTW - the v(3) with nan looks weired. This is the w component of the homogenous
coordinates, presumably after(!) perspective division, because you wouldn't see
anything on the screen otherwise. After perspective division it isn't used any
more, but it also shouldn't change...
Comment 23 peter czanik 2005-08-15 09:59:10 UTC
(In reply to comment #20)
> /suse/sndirsch/xorg-x11-Mesa-6.8.2-89.i586.rpm
> /suse/sndirsch/xorg-x11-Mesa-6.8.2-89.x86_64.rpm

Can I download it outside SuSE? I couldn't find it in /pub/people/sndirsch
Comment 24 Stefan Dirsch 2005-08-15 10:02:12 UTC
No. There are still serious problems with it.
Comment 25 Stefan Dirsch 2005-08-15 15:28:22 UTC
Created attachment 46072 [details]
Patch required for Mesa 6.2 branch

I went back to Mesa 6.2 branch (includes support for 915GM/945G, recommended by
Alan H.), which requires this patch to reflect the changes in i810 DDX driver
and the use of tnl_vertex_cull_stage in i915 DRI driver.
Comment 26 Stefan Dirsch 2005-08-15 16:03:26 UTC
Still does not work. :-( I added some debug info ...

INFO: sPriv->devPrivSize = 104
INFO: sizeof(I830DRIRec) = 136

ERROR!  sizeof(I830DRIRec) does not match passed size from 2D driver
libGL warning: 3D driver returned no fbconfigs.
libGL error: InitDriver failed
libGL error: reverting to (slow) indirect rendering
[...]

I made sure that drmAdress is not in I830DRIRec when compiling i915 DRI driver.
Comment 27 Stefan Dirsch 2005-08-16 03:43:22 UTC
Compiling the Mesa 6.2 branch i915 DRI driver inside X.Org 6.8.2 
(which includes Mesa 6.2.1) make the driver finally working. Probably 
I took the wrong DRM version for compiling Mesa (the sources which are 
specified with DRM_SOURCE_PATH for Mesa build). 
 
The problem with debug output remains (at least on 945G). Need to 
figure out how to disable it. Matthias, could you please help here? 
 
# glxgears 
 
   -- v(0): 42f3b308/121.849670 
   -- v(1): 4342b12c/194.692078 
   -- v(2): 3f73c3be/0.952206 
   -- v(3): ffc11800/nan 
 
   -- v(0): 42f3b308/121.849670 
   -- v(1): 4342b12c/194.692078 
   -- v(2): 3f73c3be/0.952206 
   -- v(3): ffc11800/nan 
 
Packages for testing: 
 
~sndirsch/xorg-x11-Mesa-6.8.2-90.i586.rpm 
~sndirsch/xorg-x11-Mesa-6.8.2-90.x86_64.rpm 
Comment 28 Stefan Dirsch 2005-08-16 04:02:17 UTC
--- extras/Mesa/src/mesa/drivers/dri/i915/intel_tris.c.orig 
+++ extras/Mesa/src/mesa/drivers/dri/i915/intel_tris.c 
@@ -63,9 +63,9 @@ 
 #else 
 #define COPY_DWORDS( j, vb, vertsize, v )      \ 
 do {                                           \ 
-   if (1) fprintf(stderr, "\n");       \ 
+   if (0) fprintf(stderr, "\n");       \ 
    for ( j = 0 ; j < vertsize ; j++ ) {                \ 
-      if (1) fprintf(stderr, "   -- v(%d): %x/%f\n",j, \ 
+      if (0) fprintf(stderr, "   -- v(%d): %x/%f\n",j, \ 
              ((GLuint *)v)[j],                 \ 
              ((GLfloat *)v)[j]);               \ 
       vb[j] = ((GLuint *)v)[j];                        \ 
 
Comment 29 Stefan Dirsch 2005-08-16 10:09:51 UTC
Alan H. approved my patch. The new driver was now tested successfully on
915GM/945G. Packages for testing are available (until Beta3 is released):

--> ftp://ftp.suse.com/pub/people/sndirsch/RPMS/bug#103135

Feedback will be appreciated with info on the gfx chipset and platform
(i386/x86_64). Especially for Intel chipsets <=915G (830/845/855/865/915G).
Comment 30 Stefan Dirsch 2005-08-16 11:02:19 UTC
The new driver works also on 855 (i386), tested by ro.