Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 23124 Details for
Bug 26552
mplayer and development kernel (2.6.0-test2)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
mga_vid-kern26.patch
mga_vid-kern26.patch (text/plain), 9.91 KB, created by
Georgi Georgiev
on 2004-01-03 21:53:29 UTC
(
hide
)
Description:
mga_vid-kern26.patch
Filename:
MIME Type:
Creator:
Georgi Georgiev
Created:
2004-01-03 21:53:29 UTC
Size:
9.91 KB
patch
obsolete
>diff -ru Makefile Makefile >--- Makefile 2003-10-18 16:00:07.000000000 +0200 >+++ Makefile 2003-10-18 11:53:03.000000000 +0200 >@@ -1,16 +1,29 @@ >- > KERNEL_INCLUDES = /usr/src/linux/include > INCLUDES = -I$(KERNEL_INCLUDES) >-CFLAGS = -O2 -D__KERNEL__ -DMODULE -include $(KERNEL_INCLUDES)/linux/modversions.h -Wall > VERSION = $(shell grep UTS_RELEASE $(KERNEL_INCLUDES)/linux/version.h | cut -d '"' -f2) > MDIR = /lib/modules/$(VERSION)/misc > >-all: mga_vid.o mga_vid_test >+ifneq (,$(findstring 2.6, $(VERSION))) >+obj-m += mga_vid.o >+CFLAGS = -O2 -D__KERNEL__ -DMODULE -include $(KERNEL_INCLUDES)/config/modversions.h -Wall >+else >+CFLAGS = -O2 -D__KERNEL__ -DMODULE -include $(KERNEL_INCLUDES)/linux/modversions.h -Wall >+endif >+ >+all: >+ifneq (,$(findstring 2.6, $(VERSION))) >+ $(MAKE) mga_vid.ko mga_vid_test >+else >+ $(MAKE) mga_vid.o mga_vid_test >+endif > # sis_vid.o > > mga_vid.o: mga_vid.c mga_vid.h > $(CC) $(CFLAGS) $(INCLUDES) -c $(basename $@).c > >+mga_vid.ko: mga_vid.c mga_vid.h >+ $(MAKE) -C /usr/src/linux SUBDIRS=$(PWD) modules >+ > sis_vid.o: sis_vid.c sis_vid.h > $(CC) $(CFLAGS) $(INCLUDES) -c $(basename $@).c > >@@ -25,13 +38,21 @@ > > install: mga_vid.o > if test ! -d $(MDIR) ; then mkdir -p $(MDIR) ; fi >+ifneq (,$(findstring 2.6, $(VERSION))) >+ install -m 644 mga_vid.ko $(MDIR)/mga_vid.ko >+else > install -m 644 mga_vid.o $(MDIR)/mga_vid.o >+endif > depmod -a > > dep: > > clean: > rm -f *.o *~ >+ifneq (,$(findstring 2.6, $(VERSION))) >+ rm -f *.ko .mga* mga_vid.mod.c >+endif > > distclean: clean > rm -f mga_vid_test >+ >diff -ru mga_vid.c mga_vid.c >--- mga_vid.c 2003-10-18 16:00:08.000000000 +0200 >+++ mga_vid.c 2003-10-18 15:58:58.000000000 +0200 >@@ -4,6 +4,9 @@ > // double buffering added by A'rpi/ESP-team > // brightness/contrast introduced by eyck > // multiple card support by Attila Kinali <attila@kinali.ch> >+// ported to the 2.6 series kernels by F.O. Tempel >+// thankfully using the ground work done by Ed Sweetman (for the devfs work) >+// and Gergely Nagy for pushing into the right direction with his patch for 2.6.0-test1 > > // Set this value, if autodetection fails! (video ram size in megabytes) > // #define MGA_MEMORY_SIZE 16 >@@ -36,6 +39,9 @@ > #include <linux/config.h> > #include <linux/version.h> > #include <linux/module.h> >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+#include <linux/moduleparam.h> >+#endif > #include <linux/types.h> > #include <linux/kernel.h> > #include <linux/sched.h> >@@ -117,7 +123,8 @@ > #ifndef min > #define min(x,y) (((x)<(y))?(x):(y)) > #endif >- >+// These functions are provided by the 2.6.0 kernel these days. >+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) > #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) > #include <linux/ctype.h> > >@@ -155,7 +162,7 @@ > return simple_strtoul(cp,endp,base); > } > #endif >- >+#endif // 2.6.0 > > typedef struct bes_registers_s > { >@@ -350,15 +357,23 @@ > > > // global devfs handle for /dev/mga_vid >-#ifdef CONFIG_DEVFS_FS >-static devfs_handle_t dev_handle = NULL; >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+ typedef struct devfs_entry *devfs_handle_t; >+ devfs_handle_t dev_handle = NULL; >+#endif >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) >+ devfs_handle_t dev_handle = NULL; > #endif > > // card local config > typedef struct mga_card_s { > > // local devfs handle for /dev/mga_vidX >-#ifdef CONFIG_DEVFS_FS >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+ struct devfs_entry *devfs_handle_t; >+ devfs_handle_t dev_handle; >+#endif >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) > devfs_handle_t dev_handle; > #endif > >@@ -411,11 +426,19 @@ > static int mga_contrast[MGA_MAX_CARDS] = MGA_MAX_CARDS_INIT_ARRAY; > static int mga_top_reserved[MGA_MAX_CARDS] = MGA_MAX_CARDS_INIT_ARRAY; > >+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+module_param(mga_ram_size, int, 0); >+module_param(mga_top_reserved, int, 0); >+module_param(mga_brightness, int, 0); >+module_param(mga_contrast, int, 0); >+module_param(major, int, 0); >+#else > MODULE_PARM(mga_ram_size, "1-" __MODULE_STRING(MGA_MAX_CARDS) "i"); > MODULE_PARM(mga_top_reserved, "1-" __MODULE_STRING(MGA_MAX_CARDS) "i"); > MODULE_PARM(mga_brightness, "1-" __MODULE_STRING(MGA_MAX_CARDS) "i"); > MODULE_PARM(mga_contrast, "1-" __MODULE_STRING(MGA_MAX_CARDS) "i"); > MODULE_PARM(major, "i"); >+#endif > > #ifdef CRTC2 > static void crtc2_frame_sel(mga_card_t * card, int frame) >@@ -1317,6 +1340,11 @@ > static void cards_init(mga_card_t * card, struct pci_dev * dev, int card_number, int is_g400); > > // returns the number of found cards >+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) >+#define PCI_DEV_NAME(d) (d)->name >+#else >+#define PCI_DEV_NAME(d) pci_name((d)) >+#endif > static int mga_vid_find_card(void) > { > struct pci_dev *dev = NULL; >@@ -1347,27 +1375,27 @@ > switch(dev->device) { > case PCI_DEVICE_ID_MATROX_G550: > mga_dev_name = "MGA G550"; >- printk(KERN_INFO "mga_vid: Found %s at %s [%s]\n", mga_dev_name, dev->slot_name, dev->name); >+ printk(KERN_INFO "mga_vid: Found %s at %s [%s]\n", mga_dev_name, dev->slot_name, PCI_DEV_NAME(dev)); > cards_init(card, dev, mga_cards_num - 1, 1); > break; > case PCI_DEVICE_ID_MATROX_G400: > mga_dev_name = "MGA G400/G450"; >- printk(KERN_INFO "mga_vid: Found %s at %s [%s]\n", mga_dev_name, dev->slot_name, dev->name); >+ printk(KERN_INFO "mga_vid: Found %s at %s [%s]\n", mga_dev_name, dev->slot_name, PCI_DEV_NAME(dev)); > cards_init(card, dev, mga_cards_num - 1, 1); > break; > case PCI_DEVICE_ID_MATROX_G200_AGP: > mga_dev_name = "MGA G200 AGP"; >- printk(KERN_INFO "mga_vid: Found %s at %s [%s]\n", mga_dev_name, dev->slot_name, dev->name); >+ printk(KERN_INFO "mga_vid: Found %s at %s [%s]\n", mga_dev_name, dev->slot_name, PCI_DEV_NAME(dev)); > cards_init(card, dev, mga_cards_num - 1, 0); > break; > case PCI_DEVICE_ID_MATROX_G200_PCI: > mga_dev_name = "MGA G200"; >- printk(KERN_INFO "mga_vid: Found %s at %s [%s]\n", mga_dev_name, dev->slot_name, dev->name); >+ printk(KERN_INFO "mga_vid: Found %s at %s [%s]\n", mga_dev_name, dev->slot_name, PCI_DEV_NAME(dev)); > cards_init(card, dev, mga_cards_num - 1, 0); > break; > default: > mga_cards_num--; >- printk(KERN_INFO "mga_vid: ignoring matrox device (%d) at %s [%s]\n", dev->device, dev->slot_name, dev->name); >+ printk(KERN_INFO "mga_vid: ignoring matrox device (%d) at %s [%s]\n", dev->device, dev->slot_name, PCI_DEV_NAME(dev)); > break; > } > } >@@ -1493,8 +1521,11 @@ > // card->config.colkey_on=0; //!!! > mga_vid_write_regs(card, 1); > card->vid_in_use = 0; >- >+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) > MOD_DEC_USE_COUNT; >+#else >+ try_module_get(THIS_MODULE); >+#endif > return 0; > } > >@@ -1507,7 +1538,7 @@ > { > mga_card_t * card; > >-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2) >+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) > int minor = MINOR(inode->i_rdev.value); > #else > int minor = MINOR(inode->i_rdev); >@@ -1539,7 +1570,11 @@ > return(-EBUSY); > > card->vid_in_use = 1; >+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) > MOD_INC_USE_COUNT; >+#else >+ module_put(THIS_MODULE); >+#endif > return(0); > } > >@@ -1574,7 +1609,7 @@ > { > unsigned int card_option; > // temp buffer for device filename creation used only by devfs >-#ifdef CONFIG_DEVFS_FS >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) > char buffer[16]; > #endif > >@@ -1685,7 +1720,15 @@ > #endif > > // register devfs, let the kernel give us major and minor numbers >-#ifdef CONFIG_DEVFS_FS >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+ dev_t dev_handle = MKDEV(major,card_number); >+ devfs_mk_cdev(dev_handle, S_IFCHR | S_IRUSR | S_IRGRP | S_IWUSR, "video/mga_vid%d",card_number); >+ /* Register a symlink for the first card found. Lets not break default behaviour, eh? */ >+ if( card_number == 0 ) { >+ devfs_mk_symlink("mga_vid","video/mga_vid0"); >+ } >+#endif >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) > snprintf(buffer, 16, "mga_vid%d", card_number); > card->dev_handle = devfs_register(NULL, buffer, DEVFS_FL_AUTO_DEVNUM, > 0, 0, >@@ -1728,25 +1771,40 @@ > unregister_chrdev(major, "mga_vid"); > return -EINVAL; > } >-#ifdef CONFIG_DEVFS_FS >- else { >- // we assume that this always succeedes >+/* >+ // we assume that this always succeedes >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+ else { >+ dev_t dev_handle = MKDEV(major,0); >+ devfs_mk_cdev(dev_handle, S_IFCHR | S_IRUSR | S_IRGRP | S_IWUSR,"%s","mga_vid"); >+ } >+#endif >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) >+ else { > dev_handle = devfs_register(NULL, "mga_vid", DEVFS_FL_AUTO_DEVNUM, > 0,0, > S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IFCHR, > &mga_vid_fops, mga_cards[0]); > } > #endif >- >+*/ > return(0); > } > >+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+module_init(mga_vid_initialize); >+#else > int init_module(void) > { > return mga_vid_initialize(); > } >+#endif > >+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+static void mga_cleanup_module(void) >+#else > void cleanup_module(void) >+#endif > { > int i; > mga_card_t * card; >@@ -1765,7 +1823,10 @@ > iounmap(card->mmio_base); > if(card->param_buff) > kfree(card->param_buff); >-#ifdef CONFIG_DEVFS_FS >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+ devfs_remove("video/mga_vid%d",i); >+#endif >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) > if(card->dev_handle) devfs_unregister(card->dev_handle); > #endif > >@@ -1776,8 +1837,15 @@ > > //FIXME turn off BES > printk(KERN_INFO "mga_vid: Cleaning up module\n"); >-#ifdef CONFIG_DEVFS_FS >- if(dev_handle) devfs_unregister(dev_handle); >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+ devfs_remove("%s","mga_vid"); >+#endif >+#if CONFIG_DEVFS_FS && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) >+ devfs_unregister(dev_handle); > #endif > unregister_chrdev(major, "mga_vid"); > } >+ >+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) >+module_exit(mga_cleanup_module); >+#endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 26552
: 23124 |
23125