Skip to contentSkip to conversation

x11-fb driver

DISCUSSION Robert Schwebel 2 participants 3 messages Mar 31, 2006 – Apr 3, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

here's an updated patch of Gerd Knorr's x11-fb patch, taken from here:
http://user-mode-linux.sourceforge.net/work/current/2.6/2.6.16/patches/x11-fb

It compiles on 2.6.16 and works at least a little bit. I get some initial output, see the screenshot here:

http://www.pengutronix.de/uml-x11.gif

However, the window is never redrawn and I didn't manage to make input working, but it may be a start for others. It was a little bit messy to find the right kconfig switches which had to be enabled, because the uml's kconfig structure is very different from the mainstream one.

Gerd, are you still actively working on this driver?

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9
#1 lore raw
Quoted 1 line · Robert Schwebel

here's an updated patch [...]

# X11 framebuffer driver from Gerd Knorr.
# You have to enable CONFIG_FB (UML-specific options/Graphics support/ # Support for frabe buffer devices), disable CONFIG_VGA_CONSOLE # (UML-specific options/Graphics support/Console display driver support/ # VGA text console), and enable Framebuffer Console support (in the same # place), plus some fonts. You also seem to have to put
# 'x11=<width>x<height>

# on the command line.
#
# Ported to 2.6.16 by Robert Schwebel.
#
diff -urN linux-2.6.16/arch/um/defconfig linux-2.6.16-x11-uml/arch/um/defconfig
--- linux-2.6.16/arch/um/defconfig	2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16-x11-uml/arch/um/defconfig	2006-03-31 17:48:27.000000000 +0200
@@ -33,6 +33,56 @@
 CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_LD_SCRIPT_DYN=y
 CONFIG_NET=y
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+# CONFIG_SERIO_I8042 is not set
+CONFIG_SERIO_SERPORT=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=m
 # CONFIG_HOSTFS is not set
@@ -437,7 +487,6 @@
 # Multi-device support (RAID and LVM)
 #
 # CONFIG_MD is not set
-# CONFIG_INPUT is not set

#
# Kernel hacking

arch/um/drivers/Makefile +13 -8
diff -urN linux-2.6.16/arch/um/drivers/Makefile linux-2.6.16-x11-uml/arch/um/drivers/Makefile
@@ -1,4 +1,4 @@
-# 
+#
 # Copyright (C) 2000, 2002, 2003 Jeff Dike ([email protected])
 # Licensed under the GPL
 #
@@ -16,6 +16,10 @@
 ubd-objs := ubd_kern.o ubd_user.o
 port-objs := port_kern.o port_user.o
 harddog-objs := harddog_kern.o harddog_user.o
+x11-objs := x11_kern.o x11_user.o \
+	../../../drivers/video/cfbfillrect.o \
+	../../../drivers/video/cfbcopyarea.o \
+	../../../drivers/video/cfbimgblt.o
 
 LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a)
 
@@ -36,18 +40,19 @@
 
 obj-$(CONFIG_UML_NET_SLIP) += slip.o slip_common.o
 obj-$(CONFIG_UML_NET_SLIRP) += slirp.o slip_common.o
-obj-$(CONFIG_UML_NET_DAEMON) += daemon.o 
-obj-$(CONFIG_UML_NET_MCAST) += mcast.o 
+obj-$(CONFIG_UML_NET_DAEMON) += daemon.o
+obj-$(CONFIG_UML_NET_MCAST) += mcast.o
 obj-$(CONFIG_UML_NET_PCAP) += pcap.o
-obj-$(CONFIG_UML_NET) += net.o 
+obj-$(CONFIG_UML_NET) += net.o
 obj-$(CONFIG_MCONSOLE) += mconsole.o
-obj-$(CONFIG_MMAPPER) += mmapper_kern.o 
-obj-$(CONFIG_BLK_DEV_UBD) += ubd.o 
+obj-$(CONFIG_MMAPPER) += mmapper_kern.o
+obj-$(CONFIG_BLK_DEV_UBD) += ubd.o
 obj-$(CONFIG_HOSTAUDIO) += hostaudio.o
-obj-$(CONFIG_NULL_CHAN) += null.o 
+obj-$(CONFIG_NULL_CHAN) += null.o
 obj-$(CONFIG_PORT_CHAN) += port.o
 obj-$(CONFIG_PTY_CHAN) += pty.o
-obj-$(CONFIG_TTY_CHAN) += tty.o 
+obj-$(CONFIG_TTY_CHAN) += tty.o
+obj-$(CONFIG_X11_FB) += x11.o
 obj-$(CONFIG_XTERM_CHAN) += xterm.o xterm_kern.o
 obj-$(CONFIG_UML_WATCHDOG) += harddog.o
 obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o
arch/um/drivers/x11_kern.c +530 -0

530 lines not on this page · raw message

arch/um/drivers/x11_user.c +445 -0

445 lines not on this page · raw message

arch/um/include/x11_kern.h +9 -0
diff -urN linux-2.6.16/arch/um/include/x11_kern.h linux-2.6.16-x11-uml/arch/um/include/x11_kern.h
@@ -0,0 +1,9 @@
+/* x11_kern */
+
+struct x11_window;
+struct x11_kerndata;
+
+void x11_kbd_input(struct x11_kerndata *kd, int key, int down);
+void x11_mouse_input(struct x11_kerndata *kd, int key, int down,
+		     int x, int y);
+void x11_cad(struct x11_kerndata *kd);
arch/um/include/x11_user.h +14 -0
diff -urN linux-2.6.16/arch/um/include/x11_user.h linux-2.6.16-x11-uml/arch/um/include/x11_user.h
@@ -0,0 +1,14 @@
+/* x11_user */
+
+struct x11_window;
+struct x11_kerndata;
+
+struct x11_window *x11_open(int width, int height);
+int x11_has_data(struct x11_window *win, struct x11_kerndata *kd);
+int x11_blit_fb(struct x11_window *win, int x1, int x2, int y1, int y2);
+
+int x11_get_fd(struct x11_window *win);
+struct fb_fix_screeninfo* x11_get_fix(struct x11_window *win);
+struct fb_var_screeninfo* x11_get_var(struct x11_window *win);
+void* x11_get_fbmem(struct x11_window *win);
+
arch/um/Kconfig +7 -0
diff -urN linux-2.6.16/arch/um/Kconfig linux-2.6.16-x11-uml/arch/um/Kconfig
@@ -117,6 +117,13 @@
 	recommended to read the NET-HOWTO, available from
 	<http://www.tldp.org/docs.html#howto>.
 
+source "drivers/input/Kconfig"
+source "drivers/char/Kconfig"
+source "drivers/video/Kconfig"
+
+config X11_FB
+	bool "X11 Framebuffer driver"
+	depends on FB && !MODE_TT && !STATIC_LINK
 
 source "fs/Kconfig.binfmt"
 
arch/um/kernel/um_arch.c +11 -7
diff -urN linux-2.6.16/arch/um/kernel/um_arch.c linux-2.6.16-x11-uml/arch/um/kernel/um_arch.c
@@ -14,6 +14,7 @@
 #include "linux/bootmem.h"
 #include "linux/spinlock.h"
 #include "linux/utsname.h"
+#include "linux/console.h"
 #include "linux/sysrq.h"
 #include "linux/seq_file.h"
 #include "linux/delay.h"
@@ -58,7 +59,7 @@
 	strcat(command_line, arg);
 }
 
-struct cpuinfo_um boot_cpu_data = { 
+struct cpuinfo_um boot_cpu_data = {
 	.loops_per_jiffy	= 0,
 	.ipi_pipe		= { -1, -1 }
 };
@@ -148,20 +149,20 @@
 
 	umid = get_umid();
 	if(*umid != '\0'){
-		snprintf(argv1_begin, 
-			 (argv1_end - argv1_begin) * sizeof(*ptr), 
+		snprintf(argv1_begin,
+			 (argv1_end - argv1_begin) * sizeof(*ptr),
 			 "(%s) ", umid);
 		ptr = &argv1_begin[strlen(argv1_begin)];
 	}
 	else ptr = argv1_begin;
 
 	snprintf(ptr, (argv1_end - ptr) * sizeof(*ptr), "[%s]", cmd);
-	memset(argv1_begin + strlen(argv1_begin), '\0', 
+	memset(argv1_begin + strlen(argv1_begin), '\0',
 	       argv1_end - argv1_begin - strlen(argv1_begin));
 #endif
 }
 
-static char *usage_string = 
+static char *usage_string =
 "User Mode Linux v%s\n"
 "	available at http://user-mode-linux.sourceforge.net/\n\n";
 
@@ -224,7 +225,7 @@
 
 __uml_setup("ncpus=", uml_ncpus_setup,
 "ncpus=<# of desired CPUs>\n"
-"    This tells an SMP kernel how many virtual processors to start.\n\n" 
+"    This tells an SMP kernel how many virtual processors to start.\n\n"
 );
 #endif
 
@@ -406,7 +407,7 @@
 	argv1_begin = argv[1];
 	argv1_end = &argv[1][strlen(argv[1])];
 #endif
-  
+
 	highmem = 0;
 	iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK;
 	max_physmem = get_kmem_end() - uml_physmem - iomem_size - MIN_VMALLOC;
@@ -482,6 +483,9 @@
         strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
  	*cmdline_p = command_line;
 	setup_hostinfo();
+#if defined(CONFIG_DUMMY_CONSOLE)
+	conswitchp = &dummy_con;
+#endif
 }
 
 void __init check_bugs(void)
arch/um/Makefile +6 -1
diff -urN linux-2.6.16/arch/um/Makefile linux-2.6.16-x11-uml/arch/um/Makefile
@@ -131,12 +131,17 @@
 #The wrappers will select whether using "malloc" or the kernel allocator.
 LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
 
+UML_LIBS := -lutil
+ifeq ($(CONFIG_X11_FB),y)
+UML_LIBS += -L/usr/X11R6/lib -lX11 -lXext
+endif
+
 CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS)
 define cmd_vmlinux__
 	$(CC) $(CFLAGS_vmlinux) -o $@ \
 	-Wl,-T,$(vmlinux-lds) $(vmlinux-init) \
 	-Wl,--start-group $(vmlinux-main) -Wl,--end-group \
-	-lutil \
+	$(UML_LIBS) \
 	$(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) \
 	FORCE ,$^) ; rm -f linux
 endef
drivers/char/Kconfig +1 -1
diff -urN linux-2.6.16/drivers/char/Kconfig linux-2.6.16-x11-uml/drivers/char/Kconfig
@@ -59,7 +59,7 @@
 
 config HW_CONSOLE
 	bool
-	depends on VT && !S390 && !UML
+	depends on VT && !S390
 	default y
 
 config SERIAL_NONSTANDARD
drivers/video/fbmem.c +2 -0
diff -urN linux-2.6.16/drivers/video/fbmem.c linux-2.6.16-x11-uml/drivers/video/fbmem.c
@@ -1209,9 +1209,11 @@
 #else
 #warning What do we have to do here??
 #endif
+#ifndef CONFIG_UML
 	if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
 			     vma->vm_end - vma->vm_start, vma->vm_page_prot))
 		return -EAGAIN;
+#endif
 #endif /* !__sparc_v9__ */
 	return 0;
 #endif /* !sparc32 */
include/asm-um/irq.h +1 -0
diff -urN linux-2.6.16/include/asm-um/irq.h linux-2.6.16-x11-uml/include/asm-um/irq.h
@@ -15,6 +15,7 @@
 #define SIGIO_WRITE_IRQ 	11
 #define TELNETD_IRQ 		12
 #define XTERM_IRQ 		13
+#define X11_IRQ			14
 
 #define LAST_IRQ XTERM_IRQ
 #define NR_IRQS (LAST_IRQ + 1)
#2 lore raw
In reply to Robert Schwebel
Quoted 1 line

Gerd, are you still actively working on this driver?

Well, I rarely use UML these days, maybe that changes once the TLS support bits are merged which hopefully makes it much easier to run recent distros on UML. Last time I tried (around 2.6.15) the driver worked just fine for me. Jeff had some problems to get it work on his machine, not sure why, maybe you see the same problem, maybe the driver must be adapted to some recent uml kernel changes ...

cheers,

Gerd

Signature · 3 lines
Gerd 'just married' Hoffmann <[email protected]>
I'm the hacker formerly known as Gerd Knorr.
http://www.suse.de/~kraxel/just-married.jpeg