Hi, attached are a few patches to fusion:
0001-use-different-base-address-for-sh4.patch 0002-waste-less-memory-on-sh4.patch 0003-a-much-nicer-Makefile.patch 0004-dynamic-fusion-major.patch especially the last one might be useful for more people... Cheers, Andre'
>From 89251f49b9ea46d7c682239107057276b6e15c90 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Andr=C3=A9=20Draszik?= <g...@andred.net> Date: Tue, 14 Apr 2009 18:04:11 +0100 Subject: [PATCH] use different base address for sh4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit as the default one is in the sh4 shared library address space Signed-off-by: André Draszik <g...@andred.net> Signed-off-by: André Draszik <andre.dras...@st.com> --- linux/drivers/char/fusion/shmpool.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/linux/drivers/char/fusion/shmpool.h b/linux/drivers/char/fusion/shmpool.h index 4f10d58..df9fb40 100644 --- a/linux/drivers/char/fusion/shmpool.h +++ b/linux/drivers/char/fusion/shmpool.h @@ -18,8 +18,10 @@ #include "fusiondev.h" #include "types.h" -#ifdef __mips__ +#if defined(__mips__) #define FUSION_SHM_BASE_32 0x50010000 /* virtual base address */ +#elif defined(__sh4__) +#define FUSION_SHM_BASE_32 0x30010000 /* virtual base address */ #else #define FUSION_SHM_BASE_32 0x20010000 /* virtual base address */ #endif -- 1.5.6.3
>From c971a341cdb4f6cdcd895cd8464d52224ded58bb Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Andr=C3=A9=20Draszik?= <g...@andred.net> Date: Tue, 14 Apr 2009 18:05:48 +0100 Subject: [PATCH] waste less memory on sh4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit shared memory needs only to be 16k aligned on sh4, not 64k which is the default assumption fusion makes Signed-off-by: André Draszik <g...@andred.net> Signed-off-by: André Draszik <andre.dras...@st.com> --- linux/drivers/char/fusion/shmpool.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/linux/drivers/char/fusion/shmpool.c b/linux/drivers/char/fusion/shmpool.c index 9954edc..c120207 100644 --- a/linux/drivers/char/fusion/shmpool.c +++ b/linux/drivers/char/fusion/shmpool.c @@ -110,7 +110,17 @@ fusion_shmpool_construct(FusionEntry * entry, void *ctx, void *create_ctx) shmpool->addr_base = poolnew->addr_base = addr_base; addr_base += PAGE_ALIGN(poolnew->max_size) + PAGE_SIZE; - addr_base = (void*)((unsigned long)(addr_base + 0xffff) & ~0xffff); +#ifdef CONFIG_CPU_SH4 + /* a generic kernel api for retrieving information about mmap + restrictions would be nice! On sh4, shm_align_mask is 16k-1 */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) +# define shm_align_mask 0x3fff +#endif +#else +/* FIXME: might have a different value on other arches, we are conservative and use 64k-1 */ +# define shm_align_mask 0xffff +#endif + addr_base = (void*)((unsigned long)(addr_base + shm_align_mask) & ~shm_align_mask); shmpool->addr_entry = add_addr_entry(addr_base); -- 1.5.6.3
>From 0242f8af9d10223b3e037022e02696fec8e97e71 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Andr=C3=A9=20Draszik?= <g...@andred.net> Date: Tue, 14 Apr 2009 18:08:25 +0100 Subject: [PATCH] a much nicer Makefile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit to easily allow (cross-) compilation against any kernel, using standard kernel make variables KERNELDIR= and INSTALL_MOD_PATH= Signed-off-by: André Draszik <g...@andred.net> Signed-off-by: André Draszik <andre.dras...@st.com> --- Makefile | 69 ++++++++++++++++++++++--------------------------------------- 1 files changed, 25 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index 9c98f83..167484c 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,12 @@ -KERNEL_VERSION ?= $(shell uname -r) -KERNEL_MODLIB ?= /lib/modules/$(KERNEL_VERSION) -KERNEL_BUILD ?= $(SYSROOT)$(KERNEL_MODLIB)/build -KERNEL_SOURCE ?= $(SYSROOT)$(KERNEL_MODLIB)/source +#KERNEL_VERSION = $(shell uname -r) +#KERNEL_MODLIB = /lib/modules/$(KERNEL_VERSION) -ifeq ($(shell test -L $(KERNEL_BUILD) && echo yes),yes) - KERNEL_BUILD := $(SYSROOT)$(shell readlink $(KERNEL_BUILD)) -endif - -ifeq ($(shell test -L $(KERNEL_SOURCE) && echo yes),yes) - KERNEL_SOURCE := $(SYSROOT)$(shell readlink $(KERNEL_SOURCE)) -endif - -K_VERSION := $(shell echo $(KERNEL_VERSION) | cut -d . -f 1) -K_PATCHLEVEL := $(shell echo $(KERNEL_VERSION) | cut -d . -f 2) -K_SUBLEVEL := $(shell echo $(KERNEL_VERSION) | cut -d . -f 3 | cut -d '-' -f 1) - - -DESTDIR ?= $(SYSROOT) +INSTALL_MOD_PATH ?= error INSTALL_MOD_PATH is not set +KERNELDIR ?= error KERNELDIR is not set +KERNEL_BUILD = $(KERNELDIR) +KERNEL_SOURCE = $(shell grep ^KERNELSRC $(KERNEL_BUILD)/Makefile | cut -d ' ' -f 6) +KERNEL_PATCHLEVEL = $(shell grep 'PATCHLEVEL =' $(KERNEL_BUILD)/Makefile | cut -d ' ' -f 3) SUB = linux/drivers/char/fusion @@ -36,41 +25,33 @@ ifeq ($(shell test -e $(KERNEL_BUILD)/include/linux/config.h && echo yes),yes) CPPFLAGS += -DHAVE_LINUX_CONFIG_H endif -check-version = $(shell expr \( $(K_VERSION) \* 65536 + $(K_PATCHLEVEL) \* 256 + $(K_SUBLEVEL) \) \>= \( $(1) \* 65536 + $(2) \* 256 + $(3) \)) +.PHONY: all modules modules_install install clean -.PHONY: all install clean +all: modules +install: modules_install -all: +modules: rm -f $(SUB)/Makefile - ln -s Makefile-2.$(K_PATCHLEVEL) $(SUB)/Makefile -ifeq ($(call check-version,2,6,24),1) + ln -s Makefile-2.$(KERNEL_PATCHLEVEL) $(SUB)/Makefile $(MAKE) -C $(KERNEL_BUILD) \ - KCPPFLAGS="$(CPPFLAGS) -I`pwd`/linux/include" \ + CPPFLAGS="$(CPPFLAGS) -D__KERNEL__ -I`pwd`/linux/include -I$(KERNEL_BUILD)/include -I$(KERNEL_BUILD)/include2 -I$(KERNEL_SOURCE)/include $(AUTOCONF_H)" \ SUBDIRS=`pwd`/$(SUB) modules + +modules_install: modules +ifeq ($(KERNEL_PATCHLEVEL),4) + install -d $(KERNEL_MODLIB)/drivers/char/fusion + install -m 644 $(SUB)/fusion.o $(KERNEL_MODLIB)/drivers/char/fusion + rm -f $(KERNEL_MODLIB)/fusion.o + /sbin/depmod -ae -b $(INSTALL_MOD_PATH) $(KERNEL_VERSION) else $(MAKE) -C $(KERNEL_BUILD) \ - CPPFLAGS="$(CPPFLAGS) -D__KERNEL__ -I`pwd`/linux/include -I$(KERNEL_BUILD)/include -I$(KERNEL_SOURCE)/include $(AUTOCONF_H)" \ - SUBDIRS=`pwd`/$(SUB) modules + CPPFLAGS="$(CPPFLAGS) -D__KERNEL__ -I`pwd`/linux/include -I$(KERNEL_BUILD)/include -I$(KERNEL_BUILD)/include2 -I$(KERNEL_SOURCE)/include $(AUTOCONF_H)" \ + SUBDIRS=`pwd`/$(SUB) modules_install endif -install: all - install -d $(DESTDIR)/usr/include/linux - install -m 644 linux/include/linux/fusion.h $(DESTDIR)/usr/include/linux - - install -d $(DESTDIR)$(KERNEL_MODLIB)/drivers/char/fusion - -ifeq ($(K_PATCHLEVEL),4) - install -m 644 $(SUB)/fusion.o $(DESTDIR)$(KERNEL_MODLIB)/drivers/char/fusion - rm -f $(DESTDIR)$(KERNEL_MODLIB)/fusion.o -else - install -m 644 $(SUB)/fusion.ko $(DESTDIR)$(KERNEL_MODLIB)/drivers/char/fusion - rm -f $(DESTDIR)$(KERNEL_MODLIB)/fusion.ko -endif -ifneq ($(strip $(DESTDIR)),) - /sbin/depmod -ae -b $(DESTDIR) $(KERNEL_VERSION) -else - /sbin/depmod -ae $(KERNEL_VERSION) -endif +headers_install: + install -d $(INSTALL_MOD_PATH)/usr/include/linux + install -m 644 linux/include/linux/fusion.h $(INSTALL_MOD_PATH)/usr/include/linux -- 1.5.6.3
>From 2c51b0f4d967c9a779673e09943d7420121b9566 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Andr=C3=A9=20Draszik?= <andre.dras...@st.com> Date: Tue, 14 Apr 2009 18:57:39 +0100 Subject: [PATCH] dynamic fusion major MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Allow for the fusion major device number to be dynamically allocated by the kernel. Don't know since when this feature is available, so we enable it if compiling for a kernel >= 2.6.23 Signed-off-by: André Draszik <andre.dras...@st.com> --- linux/drivers/char/fusion/fusiondev.c | 44 +++++++++++++++++++++----------- 1 files changed, 29 insertions(+), 15 deletions(-) diff --git a/linux/drivers/char/fusion/fusiondev.c b/linux/drivers/char/fusion/fusiondev.c index eb77a19..a19d8a5 100644 --- a/linux/drivers/char/fusion/fusiondev.c +++ b/linux/drivers/char/fusion/fusiondev.c @@ -56,9 +56,15 @@ #define DEBUG(x...) do {} while (0) #endif -#ifndef FUSION_MAJOR -#define FUSION_MAJOR 250 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) + #undef FUSION_MAJOR + #define FUSION_MAJOR 0 +#else + #ifndef FUSION_MAJOR + #define FUSION_MAJOR 250 + #endif #endif +static int fusion_major; MODULE_LICENSE("GPL"); MODULE_AUTHOR("Denis Oliver Kropp <d...@directfb.org>"); @@ -1117,11 +1123,19 @@ static int __init register_devices(void) { int i; - if (register_chrdev(FUSION_MAJOR, "fusion", &fusion_fops)) { - printk(KERN_ERR "fusion: unable to get major %d\n", - FUSION_MAJOR); + fusion_major = register_chrdev (FUSION_MAJOR, "fusion", &fusion_fops); + if (fusion_major < 0) { + printk (KERN_ERR "fusion: unable to get a major\n"); + return fusion_major; + } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) + if (fusion_major > 0) { + printk (KERN_ERR "fusion: unable to get major %d\n", FUSION_MAJOR); return -EIO; } + fusion_major = FUSION_MAJOR; +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 2) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) fusion_class = class_create(THIS_MODULE, "fusion"); @@ -1129,7 +1143,7 @@ static int __init register_devices(void) fusion_class = class_simple_create(THIS_MODULE, "fusion"); #endif if (IS_ERR(fusion_class)) { - unregister_chrdev(FUSION_MAJOR, "fusion"); + unregister_chrdev(fusion_major, "fusion"); return PTR_ERR(fusion_class); } #endif @@ -1142,27 +1156,27 @@ static int __init register_devices(void) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) device_create(fusion_class, NULL, - MKDEV(FUSION_MAJOR, i), NULL, "fusion%d", i); + MKDEV(fusion_major, i), NULL, "fusion%d", i); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) device_create(fusion_class, - NULL, MKDEV(FUSION_MAJOR, i), "fusion%d", i); + NULL, MKDEV(fusion_major, i), "fusion%d", i); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15) class_device_create(fusion_class, NULL, - MKDEV(FUSION_MAJOR, i), + MKDEV(fusion_major, i), NULL, "fusion%d", i); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) class_device_create(fusion_class, - MKDEV(FUSION_MAJOR, i), + MKDEV(fusion_major, i), NULL, "fusion%d", i); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 2) class_simple_device_add(fusion_class, - MKDEV(FUSION_MAJOR, i), + MKDEV(fusion_major, i), NULL, "fusion%d", i); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) - devfs_mk_cdev(MKDEV(FUSION_MAJOR, i), + devfs_mk_cdev(MKDEV(fusion_major, i), S_IFCHR | S_IRUSR | S_IWUSR, "fusion/%d", i); #endif } @@ -1219,11 +1233,11 @@ static void __exit deregister_devices(void) for (i = 0; i < NUM_MINORS; i++) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 2) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) - device_destroy(fusion_class, MKDEV(FUSION_MAJOR, i)); + device_destroy(fusion_class, MKDEV(fusion_major, i)); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) - class_device_destroy(fusion_class, MKDEV(FUSION_MAJOR, i)); + class_device_destroy(fusion_class, MKDEV(fusion_major, i)); #else - class_simple_device_remove(MKDEV(FUSION_MAJOR, i)); + class_simple_device_remove(MKDEV(fusion_major, i)); #endif #endif -- 1.5.6.3
_______________________________________________ directfb-dev mailing list directfb-dev@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev