View Single Post
  #101 (permalink)  
Old 26-03-08, 12:44 PM
gustec gustec is offline
N00B
 
Join Date: Mar 2008
Posts: 7
gustec is on a distinguished road
Default

LAME via 3d drivers HOWTO
by brazilian dude that never gives up

First of all, sorry for the bad english.

These instructions are intended for people that cannot compile the driver with newer kernels and newer headers from the dev packages listed on ReleaseNote.txt . I cannot guarantee they will work for you, it works for ME and I only did that on a linux-2.6.24-gentoo-r3 kernel using gentoo distro. Also my case is the VT3336-3364XORG40079-kernel-src_20070611 and I really dont know if these instructions apply to other drivers.

These thing only really worked when I removed AGP support from the kernel. So you should do this too or else all OpenGL applications will segfault and cause a Oops #2 unable to handle kernel paging request at address blah. These will force the driver to use PCI instead of AGP, which is 3 times slower but its the only way I managed to make it work. I tested the driver with the linux-2.6.18 kernel and the glxgears FPS with AGP was about 220. Using PCI it gave me about 89 FPS. These are both real slow, but I think 1) the driver sucks 2) the IGP also really sucks. So dont expect to play fancy games or anything like that. if you want that, you will really have to buy a graphics card

please note: In order to compile the 3d modules you MUST have a 32 bit distribution. There are object files which must be linked to compile the module, and important shared objects that are only available as ELF 32 bit. Im talking about libS3G*.a, libGL.so.1.2, libOGL.so, libddmpeg.so and uma_dri.so. By the default installation method they are installed by the vinstall script and without these the 3d infrastructure simply does not work )

Okay, lets try this. Copy the instructions somewhere so you can have access to them, leave X if youre using it and go to the console.

instructions to compile the 2d driver
you DONT have to be root to do this

unpack the package and cd into dir
cd src/via/X11R7
chmod +w config.log
run ./config_x11r7 (this will copy the src files to the right dir)
run ./configure_xorg7.2

edit Makefile and add -DXFree86Server to the CFLAGS line
edir src/Makefile and add -DXFree86Server -DXFree86LOADER to the DEFS line

mv src/drm.h src/drm.old (this will force using the new drm header on the includes dir and not the old one that is on the src dir)

edit src/via_driver.h and add #include "via_drm.h" after the #include "via_dri.h" line

The driver should now compile fine, but it will complain about vgaHWddc1SetSpeed being an undefined symbol if you try to startx. To fix that, edit src/via_driver.c and find the following comment: "fix the "Undefined Symbol:vgaHWddc1SetSpeed" problem ". Notice there are ifdefs to test the xorg version, but they dont work and I dont know how to make then work. So simply:
change #ifdef XORG_VERSION_CURRENT to #if 1 and
change # if XORG_VERSION_CURRENT >= XF86_VERSION_NUMERIC(7,0,0,0,0) to #if 1

make

Now, as root, cp src/.libs/via_drv.so to /usr/lib/xorg/modules/drivers/

Change the driver in xorg.conf to "via"
The driver will not work yet because the 3d part is not complete. It will actually segfault when trying to set glx visuals, but if you comment the Load "dri" or Load "glx" lines on xorg.conf you will be able to use the 2d driver with no direct rendering. (I guess so, worked for me when I was testing)

So, lets make that 3d module!

instructions to compile the 3d modules
You MUST have a symlink /lib/modules/`uname -r`/source that point to your current kernel sources. Otherwise the make script will complain about not finding kernel sources. If you dont have this link, make it now.
exit (you were root, remember? dont take the root name in vain)
cd ../../3D/DRM/linux-core-release/

edit Makefile and add a line EXTRA_CFLAGS = -O2 -w to it. Then, remove the CFLAGS line. Also add a line CONFIG_DRM_UMA := m

edit drm_irq.c and find SA_SHIRQ word. change it to IRQF_SHARED. (this flag name changed in the kernel some time ago. )
do the same thing for s3g_drv.c (there are two SA_SHIRQ references on this file)

edit drm_stub.c and find the line module_param_named(debug, drm_debug, int, S_IRUGO|S_IWUGO);
change S_IRUGO|S_IWUGO to S_IRUGO|S_IWUSR|S_IWGRP
in the libS3G/ directory there are subdirs for your specific distro which contain the libS3G.a.GCC4.1.2 . This file will link with the uma module so you must copy it to the current dir. In my case Im using gentoo, so I chose the Debian version and did a
cp libS3G/Debian/4.0r0/libS3G.a.GCC4.1.2 ./
now make
if everything goes well, you should now have drm.ko and uma.ko files. These are the kernel modules for the 3d infrastructure. You should install these in the correct place so you can modprobe them. What I do is just cp drm.ko /lib/modules/`uname -r`/extra/ and cp uma.ko /lib/modules/`uname -r`/extra/ ,then I modprobe the modules.

really important shared objects that must be on the right place
the vinstall script would handle this, but since we are doing it by hand you must do it yourself.

in the 3D directory there is the DRI-Xorg_bin directory. There are files for each distribution also, so pick one subdir and
cp uma_dri.so to /usr/lib/dri/
cp libOGL.so to /usr/lib/dri/
cp libGL.so.1.2 to /usr/lib/libGL.so -> the target file may vary from distro to distro, this file is very important, the driver will not work without it. (it will segfault cause I think it sets wrong glx visuals)

also find the libddmpeg.so file that came with the driver and copy it to /usr/lib/ (its on the src/VIA-VMILIB dir)

one last step
When running an OpenGL application somebody tries to write to /var/log but he cant have permissions to do that. It will spit a blahblah *logfile* error. One way to change this is to open up /var/log write access to everybody, but this is not such a good idea. What I did was to figure out what the logfile names are and just set 777 permissions to these files. The best approach really is to create a group and put all X users in that group, then give write permissions to group
The files are
/var/log/cil_log
/var/log/cil_log_reg
/var/log/cil_log_vb

did it work?
okey. this is the exciting part. startx
hope it worked so far. now lets try glxinfo
Is direct rendering enabled?
and you should also get:
OpenGL vendor string: S3 Graphics, Incorporated
OpenGL renderer string: S3 Graphics DeltaChrome

with no segfault or Ooops #2 if you did all the steps with no AGP support at all compiled in the kernel.

Cool. Try glxgears and notice how the wheels actually spin, differently from the very slow speed of vesa driver.

I hope this helps SOMEBODY like it helped me. Im very lame so dont expect much more from my skills. Thats what I did and it works for me, so I decided to share. I know a little bit of C programming and that really helped.
Also grep was my best friend this last three days and without I would never find the answers to the compilation errors. : )

Many thanks to sandman. Without his instructions on the other topic I would not even try to do this in the first place.

Good luck to everyone that tries to do this and I hope it works.

PS: if its slow with 32 or 24 depths, try setting xorg to use 16 bit depth.

cya. :P

Last edited by gustec : 26-03-08 at 01:11 PM.
Reply With Quote