Discussion:
[PATCH] add udev support to mga_vid svn
Tamas, Gergely
2006-07-29 20:53:05 UTC
Permalink
Hi,

This patch adds udev support to mga_vid svn [revision 243].

Put something like the following into '/etc/udev/rules.d/mga_vid.rules'
file :

KERNEL=="mga_vid", NAME="%k", MODE="0660", GROUP="video"

Works fine here with 2.6.18-rc2 .

Please test it...

Thanks,
Gergely

Index: mga_vid.c
===================================================================
--- mga_vid.c (revision 243)
+++ mga_vid.c (working copy)
@@ -57,6 +57,8 @@
#include <linux/string.h>
#include <linux/errno.h>

+#include <linux/device.h>
+
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/init.h>
@@ -254,6 +256,9 @@
#define ICLEAR 0x1e18
#define STATUS 0x1e14

+struct class *mga_vid_class;
+int mga_vid_major;
+
/* Global handles for cdev */
static struct cdev *mga_vid_cdev;
static dev_t mga_cdev_handle;
@@ -1134,8 +1139,14 @@
else
{
mga_cdev_handle = MKDEV(major,0);
- if(!register_chrdev_region(mga_cdev_handle, mga_cards_num, "mga_vid"))
- printk(KERN_INFO "mga_vid: using major: %d (assigned or default!)\n", major);
+ if(!register_chrdev_region(mga_cdev_handle, mga_cards_num, "mga_vid")) {
+ mga_vid_major = major;
+
+ mga_vid_class = class_create(THIS_MODULE, "mga_vid");
+ class_device_create(mga_vid_class, NULL, MKDEV (mga_vid_major, 0), NULL, "mga_vid");
+
+ printk(KERN_INFO "mga_vid: using major: %d (assigned or default!)\n", major);
+ }
}
/* Allocate a cdev for this character device, and fill in some parameters it needs */
mga_vid_cdev = cdev_alloc();
@@ -1184,6 +1195,9 @@
}
}

+ class_device_destroy(mga_vid_class, MKDEV(mga_vid_major, 0));
+ class_destroy(mga_vid_class);
+
//FIXME turn off BES
cdev_del(mga_vid_cdev);
unregister_chrdev_region(mga_cdev_handle, mga_cards_num);
Attila Kinali
2006-07-29 21:30:43 UTC
Permalink
On Sat, 29 Jul 2006 22:53:05 +0200
Post by Tamas, Gergely
This patch adds udev support to mga_vid svn [revision 243].
You don't have to send patches when you have write access to
the repo :)
Post by Tamas, Gergely
Works fine here with 2.6.18-rc2 .
Please test it...
When you commit something, you should be sure that your commit
works.

As a side note, MPlayer coding rules apply here too.
(see DOCS/tech/code-documentation.txt and
DOCS/tech/svn-howto.txt from the MPlayer source tree)

Attila Kinali
--
心をこめて聞け心をこめて話せ
Tamas, Gergely
2006-07-29 21:45:25 UTC
Permalink
Hi,
Post by Attila Kinali
You don't have to send patches when you have write access to
the repo :)
Ok.
Post by Attila Kinali
When you commit something, you should be sure that your commit
works.
I tested it on different machines... But one never knows...

Gergely
Attila Kinali
2006-07-30 07:14:43 UTC
Permalink
On Sat, 29 Jul 2006 23:45:25 +0200
Post by Tamas, Gergely
Post by Attila Kinali
When you commit something, you should be sure that your commit
works.
I tested it on different machines... But one never knows...
Well, it's enough if you follow the kernel docu and test it
on one or two machines. If it fails under some configuration,
the user will for sure complain :)

Attila Kinali
--
心をこめて聞け心をこめて話せ
Peter Magnusson
2006-08-06 23:50:37 UTC
Permalink
Post by Tamas, Gergely
Hi,
This patch adds udev support to mga_vid svn [revision 243].
Put something like the following into '/etc/udev/rules.d/mga_vid.rules'
KERNEL=="mga_vid", NAME="%k", MODE="0660", GROUP="video"
Works fine here with 2.6.18-rc2 .
Could you please make a already patched tar.gz version available somewhere?
I dont succed of patching mga_vid-svn-r241.tar.gz that is the latest
version I got. I dont know how to download files from svn.

It doesnt work so well to load mga_vid-svn-r241:

# modprobe mga_vid
FATAL: Error inserting mga_vid
(/lib/modules/2.6.17-1.2157_FC5smp/extra/mga_vid.ko): Invalid module format
Kernel says: mga_vid: disagrees about version of symbol struct_module
Peter Magnusson
2006-08-07 00:04:52 UTC
Permalink
Post by Tamas, Gergely
Hi,
This patch adds udev support to mga_vid svn [revision 243].
Put something like the following into '/etc/udev/rules.d/mga_vid.rules'
KERNEL=="mga_vid", NAME="%k", MODE="0660", GROUP="video"
Works fine here with 2.6.18-rc2 .
Could you please make a already patched tar.gz version available somewhere? I
dont succed of patching mga_vid-svn-r241.tar.gz that is the latest version I
got. I dont know how to download files from svn.
# modprobe mga_vid
FATAL: Error inserting mga_vid
(/lib/modules/2.6.17-1.2157_FC5smp/extra/mga_vid.ko): Invalid module format
Kernel says: mga_vid: disagrees about version of symbol struct_module
(ok svn checkout svn://svn.mplayerhq.hu/mga_vid was really easy :))
HOWEVER, it doesnt work anyway. Probably because of my fake SMP (HT intel).
I compiles nicely but it installs in /lib/modules/2.6.17-1.2157_FC5/extra
and not in /lib/modules/2.6.17-1.2157_FC5smp/extra like it should.
If I copy it to the correct place I get the same errors as above.
I have created /etc/udev/rules.d/mga_vid.rules.
Tamas, Gergely
2006-08-07 04:44:57 UTC
Permalink
Hi,
Post by Peter Magnusson
HOWEVER, it doesnt work anyway. Probably because of my fake SMP (HT intel).
I compiles nicely but it installs in /lib/modules/2.6.17-1.2157_FC5/extra
and not in /lib/modules/2.6.17-1.2157_FC5smp/extra like it should.
If I copy it to the correct place I get the same errors as above.
Did you compile against the right kernel source? You could try to set
KERNEL_DIR variable in Makefile .

Gergely
Peter Magnusson
2006-08-08 09:42:07 UTC
Permalink
Post by Tamas, Gergely
Hi,
Post by Peter Magnusson
HOWEVER, it doesnt work anyway. Probably because of my fake SMP (HT intel).
I compiles nicely but it installs in /lib/modules/2.6.17-1.2157_FC5/extra
and not in /lib/modules/2.6.17-1.2157_FC5smp/extra like it should.
If I copy it to the correct place I get the same errors as above.
Did you compile against the right kernel source? You could try to set
KERNEL_DIR variable in Makefile .
I only have one source installed.

[***@flashdance kernels]# pwd
/usr/src/kernels
[***@flashdance kernels]# ll
total 4
drwxr-xr-x 18 root 4096 Jul 20 04:14 2.6.17-1.2157_FC5-i686/
lrwxrwxrwx 1 root 22 Jul 20 04:14 2.6.17-1.2157_FC5-smp-i686 ->
2.6.17-1.2157_FC5-i686/
[***@flashdance kernels]#

I changed the Makefile to:
KERNEL_DIR := /usr/src/kernels/2.6.17-1.2157_FC5-i686
and
KERNEL_DIR := /usr/src/kernels/2.6.17-1.2157_FC5-smp-i686
but still the same problem.

Possible to remove the checking of version?
Tamas, Gergely
2006-08-08 18:37:22 UTC
Permalink
Hi,
Post by Peter Magnusson
Possible to remove the checking of version?
'insmod -f'

Gergely
Attila Kinali
2006-08-09 01:54:43 UTC
Permalink
On Tue, 8 Aug 2006 11:42:07 +0200 (CEST)
Post by Peter Magnusson
Possible to remove the checking of version?
Do not do that! There is a reason why the kernel checks
whether the module was compile with the same settings
as the kernel and complains if not. The error message
uses the version string, but the check is actualy against
a certain subset of options (those that change important
structures).

If you have problems compiling mga_vid with the kernel
source provided by FC, either complain to them to provide
the exact kernel source with the exact configuration you
are running. Or build a kernel yourself (see kernel HOWTO)

Attila Kinali
--
心をこめて聞け心をこめて話せ
Peter Magnusson
2006-08-09 12:26:18 UTC
Permalink
Post by Attila Kinali
On Tue, 8 Aug 2006 11:42:07 +0200 (CEST)
Post by Peter Magnusson
Possible to remove the checking of version?
Do not do that! There is a reason why the kernel checks
whether the module was compile with the same settings
as the kernel and complains if not. The error message
uses the version string, but the check is actualy against
a certain subset of options (those that change important
structures).
Hmm.. Ok. To me it seems just like it doesnt get that its the smp version
that are running.

Come on, someone else must have compiled mga_vid on smp? Did it work?
Post by Attila Kinali
If you have problems compiling mga_vid with the kernel
source provided by FC, either complain to them to provide
the exact kernel source with the exact configuration you
are running. Or build a kernel yourself (see kernel HOWTO)
I have the source with the kernel cfg.. Humm, but CONFIG_SMP
isnt set:

[***@flashdance 2.6.17-1.2157_FC5-i686]$ grep -i smp .config
CONFIG_BROKEN_ON_SMP=y
# CONFIG_SMP is not set
# CONFIG_X86_BIGSMP is not set
CONFIG_X86_FIND_SMP_CONFIG=y

But mga_vid doesnt care about what the .config says I guess?
I guess I'll have to build my own kernel if nothing else work.
(I have too many computers, I want to avoid to build kernels if its
possible).
Attila Kinali
2006-08-10 01:02:32 UTC
Permalink
On Wed, 9 Aug 2006 14:26:18 +0200 (CEST)
Post by Peter Magnusson
Hmm.. Ok. To me it seems just like it doesnt get that its the smp version
that are running.
Come on, someone else must have compiled mga_vid on smp? Did it work?
I did on my old machine which i replaced a few weeks ago.
And yes, it worked. Although there might be some locking
problems within mga_vid (aka race conditions), the code
itself works on smp systems.
Post by Peter Magnusson
Post by Attila Kinali
If you have problems compiling mga_vid with the kernel
source provided by FC, either complain to them to provide
the exact kernel source with the exact configuration you
are running. Or build a kernel yourself (see kernel HOWTO)
I have the source with the kernel cfg.. Humm, but CONFIG_SMP
Which suggests that you have the wrong kernel source.
Post by Peter Magnusson
But mga_vid doesnt care about what the .config says I guess?
I guess I'll have to build my own kernel if nothing else work.
(I have too many computers, I want to avoid to build kernels if its
possible).
No, the exact settings in .config ARE IMPORTANT. That's
why the kernel checks for it when you load a module.
(ok, most of them are not, but there are a few that matter,
and these are checked)

Attila Kinali
--
心をこめて聞け心をこめて話せ
Peter Magnusson
2006-08-10 06:01:07 UTC
Permalink
Post by Attila Kinali
Post by Peter Magnusson
Come on, someone else must have compiled mga_vid on smp? Did it work?
I did on my old machine which i replaced a few weeks ago.
And yes, it worked. Although there might be some locking
problems within mga_vid (aka race conditions), the code
itself works on smp systems.
Ok.
Post by Attila Kinali
Post by Peter Magnusson
I have the source with the kernel cfg.. Humm, but CONFIG_SMP
Which suggests that you have the wrong kernel source.
Unfortunable it doesnt exist any kernel-devel-smp for FC5 (or for other FC
versions). Before I used FC3 and used smp there aswell, but there it
worked to compile mga_vid.
Post by Attila Kinali
Post by Peter Magnusson
But mga_vid doesnt care about what the .config says I guess?
I guess I'll have to build my own kernel if nothing else work.
(I have too many computers, I want to avoid to build kernels if its
possible).
No, the exact settings in .config ARE IMPORTANT. That's
why the kernel checks for it when you load a module.
(ok, most of them are not, but there are a few that matter,
and these are checked)
It didnt help to change to CONFIG_SMP=y in the .config and recompile
mga_vid. Not that I would belive it would but anyway.
Robin Humble
2006-08-10 07:16:45 UTC
Permalink
Post by Peter Magnusson
Post by Attila Kinali
Which suggests that you have the wrong kernel source.
Unfortunable it doesnt exist any kernel-devel-smp for FC5 (or for other FC
kernel-smp-devel exists for i386, and kernel-devel (which is essentially
SMP except it can choose UP at runtime) exists for x86_64.
Post by Peter Magnusson
It didnt help to change to CONFIG_SMP=y in the .config and recompile
mga_vid. Not that I would belive it would but anyway.
editing .config by hand is not a path to sanity.
.config needs to match the .config of the kernel you want to run with,
not something arbitrary.

sorry I can't be of more help _ I don't have a SMP mga box to play with,
but have no problems with UP machines.

cheers,
robin
Peter Magnusson
2006-08-10 09:51:30 UTC
Permalink
Post by Robin Humble
kernel-smp-devel exists for i386, and kernel-devel (which is essentially
SMP except it can choose UP at runtime) exists for x86_64.
Thanks. I missed that one.
Post by Robin Humble
editing .config by hand is not a path to sanity.
.config needs to match the .config of the kernel you want to run with,
not something arbitrary.
sorry I can't be of more help _ I don't have a SMP mga box to play with,
but have no problems with UP machines.
Hmm.. Now I have:

kernel-smp-devel-2.6.17-1.2139_FC5
kernel-devel-2.6.17-1.2157_FC5
kernel-smp-2.6.17-1.2157_FC5

installed. It doesnt exist any "kernel-smp-devel-2.6.17-1.2157_FC5".
The kernel 2.6.17-1.2139_FC5 exists however, so I could downgrade.
But that isnt the best way to solve it. What a mess.
Robin Humble
2006-08-10 15:57:14 UTC
Permalink
Post by Peter Magnusson
installed. It doesnt exist any "kernel-smp-devel-2.6.17-1.2157_FC5".
your local yum mirror must be deficient. it exists.
wget http://download.fedora.redhat.com/pub/fedora/linux/core/updates/5/i386/kernel-smp-devel-2.6.17-1.2157_FC5.i686.rpm

cheers,
robin
Peter Magnusson
2006-08-15 05:08:02 UTC
Permalink
Post by Robin Humble
Post by Peter Magnusson
installed. It doesnt exist any "kernel-smp-devel-2.6.17-1.2157_FC5".
your local yum mirror must be deficient. it exists.
wget http://download.fedora.redhat.com/pub/fedora/linux/core/updates/5/i386/kernel-smp-devel-2.6.17-1.2157_FC5.i686.rpm
Thanks.
That helped \o/
Worked directly now.

Now I just wonder what happend to /dev/fb0 and /dev/fb1 as they are needed
for tv-out. They doesnt exist in /dev. Something that has to be added to
/etc/udev/rules.d/ ? Anyone knows?

Hmm. I was hoping that the sudden crash of mplayer at startup that happends
1 of 3 times would stop when I had mga_vid. But it didnt. Mplayer just
crashes with "MPlayer interrupted by signal 11 in module: unknown".
Also, I cant compile MPlayer-1.0pre8 with LIVE555 support or xvid support.
But with MPlayer-1.0pre7try2 everything works fine so now Im using that
one instead. I build mplayer with;

export CC=gcc32
make clean
./configure --enable-mga --enable-xmga --enable-gui --enable-menu
--disable-inet6
make
Attila Kinali
2006-08-16 11:56:13 UTC
Permalink
On Tue, 15 Aug 2006 07:08:02 +0200 (CEST)
Post by Peter Magnusson
Now I just wonder what happend to /dev/fb0 and /dev/fb1 as they are needed
for tv-out. They doesnt exist in /dev. Something that has to be added to
/etc/udev/rules.d/ ? Anyone knows?
You can guess from my lack of support for udev that i don't run it :-)
Post by Peter Magnusson
Hmm. I was hoping that the sudden crash of mplayer at startup that happends
1 of 3 times would stop when I had mga_vid. But it didnt. Mplayer just
crashes with "MPlayer interrupted by signal 11 in module: unknown".
Also, I cant compile MPlayer-1.0pre8 with LIVE555 support or xvid support.
But with MPlayer-1.0pre7try2 everything works fine so now Im using that
one instead. I build mplayer with;
Read bugreports.html and report this to mplayer-users.

Attila Kinali
--
心をこめて聞け心をこめて話せ
Peter Magnusson
2006-08-16 22:35:13 UTC
Permalink
Post by Attila Kinali
On Tue, 15 Aug 2006 07:08:02 +0200 (CEST)
Post by Peter Magnusson
Now I just wonder what happend to /dev/fb0 and /dev/fb1 as they are needed
for tv-out. They doesnt exist in /dev. Something that has to be added to
/etc/udev/rules.d/ ? Anyone knows?
You can guess from my lack of support for udev that i don't run it :-)
udev is teh shit :)
Anyone else that knows?
Post by Attila Kinali
Post by Peter Magnusson
Hmm. I was hoping that the sudden crash of mplayer at startup that happends
1 of 3 times would stop when I had mga_vid. But it didnt. Mplayer just
crashes with "MPlayer interrupted by signal 11 in module: unknown".
Also, I cant compile MPlayer-1.0pre8 with LIVE555 support or xvid support.
But with MPlayer-1.0pre7try2 everything works fine so now Im using that
one instead. I build mplayer with;
Read bugreports.html and report this to mplayer-users.
Oki.
Tamas, Gergely
2006-08-17 05:24:42 UTC
Permalink
Hi!
Post by Peter Magnusson
Now I just wonder what happend to /dev/fb0 and /dev/fb1 as they are needed
for tv-out. They doesnt exist in /dev. Something that has to be added to
/etc/udev/rules.d/ ? Anyone knows?
Do you have your framebuffer driver loaded?

Do you have something like this in udev.rules?
rules.d/udev.rules:KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video"

Gergely
Peter Magnusson
2006-08-17 22:22:14 UTC
Permalink
Post by Tamas, Gergely
Hi!
Post by Peter Magnusson
Now I just wonder what happend to /dev/fb0 and /dev/fb1 as they are needed
for tv-out. They doesnt exist in /dev. Something that has to be added to
/etc/udev/rules.d/ ? Anyone knows?
Do you have your framebuffer driver loaded?
Yes;

matroxfb_crtc2 14017 0
matroxfb_maven 20045 0
i2c_matroxfb 9793 0
i2c_algo_bit 12873 1 i2c_matroxfb
matroxfb_base 34845 2 matroxfb_crtc2,i2c_matroxfb
matroxfb_DAC1064 15297 2 matroxfb_crtc2,matroxfb_base
matroxfb_accel 8513 1 matroxfb_base
matroxfb_Ti3026 10177 1 matroxfb_base
matroxfb_g450 11713 1 matroxfb_base
g450_pll 10433 2 matroxfb_DAC1064,matroxfb_g450
matroxfb_misc 12865 8
matroxfb_crtc2,matroxfb_maven,i2c_matroxfb,matroxfb_base,matroxfb_DAC1064,matroxfb_Ti3026,matroxfb_g450,g450_pll
Post by Tamas, Gergely
Do you have something like this in udev.rules?
rules.d/udev.rules:KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video"
Nope.
I have added it in /etc/udev/rules.d/50-udev.rules now (I have no
udev.rules only) I commented this out first:

#KERNEL=="fb0", SYMLINK+="fb"

Hmm, how to make udev understand that it should re-read the cfgfiles and
create it?
Peter Magnusson
2006-08-17 22:29:13 UTC
Permalink
Post by Peter Magnusson
Post by Peter Magnusson
Hi!
Post by Peter Magnusson
Now I just wonder what happend to /dev/fb0 and /dev/fb1 as they are
needed
Post by Peter Magnusson
for tv-out. They doesnt exist in /dev. Something that has to be added to
/etc/udev/rules.d/ ? Anyone knows?
Do you have your framebuffer driver loaded?
Yes;
matroxfb_crtc2 14017 0
matroxfb_maven 20045 0
i2c_matroxfb 9793 0
i2c_algo_bit 12873 1 i2c_matroxfb
matroxfb_base 34845 2 matroxfb_crtc2,i2c_matroxfb
matroxfb_DAC1064 15297 2 matroxfb_crtc2,matroxfb_base
matroxfb_accel 8513 1 matroxfb_base
matroxfb_Ti3026 10177 1 matroxfb_base
matroxfb_g450 11713 1 matroxfb_base
g450_pll 10433 2 matroxfb_DAC1064,matroxfb_g450
matroxfb_misc 12865 8
matroxfb_crtc2,matroxfb_maven,i2c_matroxfb,matroxfb_base,matroxfb_DAC1064,matroxfb_Ti3026,matroxfb_g450,g450_pll
Post by Peter Magnusson
Do you have something like this in udev.rules?
rules.d/udev.rules:KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video"
Nope.
I have added it in /etc/udev/rules.d/50-udev.rules now (I have no udev.rules
#KERNEL=="fb0", SYMLINK+="fb"
Hmm, how to make udev understand that it should re-read the cfgfiles and
create it?
udevstart did it. They wasnt created however :(

Tamas, Gergely
2006-08-07 04:36:28 UTC
Permalink
Hi,
Post by Peter Magnusson
Could you please make a already patched tar.gz version available somewhere?
http://dice.mfa.kfki.hu/dl/mga_vid-r244.tar.gz

Gergely
Loading...