Skip to contentSkip to conversation

Console Rotation

PATCH New Antonino Daplas 1 participant 1 message Sep 9, 2002 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Console Rotation

The patch (fb_rotate.diff) adds console rotation support to the fb framework. Console rotation wrappers are lumped in fbcon-rotate.h and fbcon-rotate.c.

p->fontdata is pre-rotated during fbcon_xx_setup(), thus changing fonts may corrupt the display until fbcon_setup() is called again.

Tony

<<----------------------------------------------------------------------->>

drivers/video/Config.in +1 -0
diff -Naur linux-2.5.33/drivers/video/Config.in linux/drivers/video/Config.in
@@ -227,6 +227,7 @@
       tristate '    24 bpp packed pixels support' CONFIG_FBCON_CFB24
       tristate '    32 bpp packed pixels support' CONFIG_FBCON_CFB32
       tristate '    Hardware acceleration support' CONFIG_FBCON_ACCEL
+      dep_tristate '    Console Display Rotation support' CONFIG_FBCON_ROTATE $CONFIG_FBCON_ACCEL	
       tristate '    Amiga bitplanes support' CONFIG_FBCON_AFB
       tristate '    Amiga interleaved bitplanes support' CONFIG_FBCON_ILBM
       tristate '    Atari interleaved bitplanes (2 planes) support' CONFIG_FBCON_IPLAN2P2
drivers/video/Makefile +2 -1
diff -Naur linux-2.5.33/drivers/video/Makefile linux/drivers/video/Makefile
@@ -6,7 +6,7 @@
 # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
 
 export-objs    	:= fbmem.o fbcmap.o fbcon.o fbmon.o modedb.o \
-		   fbcon-afb.o fbcon-ilbm.o fbcon-accel.o \
+		   fbcon-afb.o fbcon-ilbm.o fbcon-accel.o fbcon-rotate.o \
 		   fbcon-vga.o fbcon-iplan2p2.o fbcon-iplan2p4.o \
 		   fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \
 		   fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \
@@ -118,6 +118,7 @@
 obj-$(CONFIG_FBCON_HGA)           += fbcon-hga.o
 obj-$(CONFIG_FBCON_STI)           += fbcon-sti.o
 obj-$(CONFIG_FBCON_ACCEL)	  += fbcon-accel.o
+obj-$(CONFIG_FBCON_ROTATE)	  += fbcon-rotate.o 
 
 include $(TOPDIR)/Rules.make
 
drivers/video/fbcon-rotate.c +611 -0

611 lines not on this page · raw message

drivers/video/fbcon-rotate.h +62 -0

62 lines not on this page · raw message

drivers/video/fbgen.c +12 -2
diff -Naur linux-2.5.33/drivers/video/fbgen.c linux/drivers/video/fbgen.c
@@ -29,6 +29,7 @@
 #include <video/fbcon-cfb24.h>
 #include <video/fbcon-cfb32.h>
 #include "fbcon-accel.h"
+#include "fbcon-rotate.h"
 
 int gen_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
 {
@@ -156,10 +157,19 @@
 
 #ifdef FBCON_HAS_ACCEL
 	display->scrollmode = SCROLL_YNOMOVE;
-	display->dispsw = &fbcon_accel;
+#ifdef FBCON_HAS_ROTATE
+	if (info->var.vmode & FB_VMODE_ROTATE_CW)
+		display->dispsw = &fbcon_rr;
+	else if (info->var.vmode & FB_VMODE_ROTATE_CCW)
+		display->dispsw = &fbcon_rl;
+	else if (info->var.vmode & FB_VMODE_ROTATE_UD)
+		display->dispsw = &fbcon_ud;
+	else 
+#endif /* FBCON_HAS_ROTATE */
+		display->dispsw = &fbcon_accel;
 #else
 	display->dispsw = &fbcon_dummy;
-#endif
+#endif /* FBCON_HAS_ACCEL */
 	return;
 }
 
include/linux/fb.h +5 -0
diff -Naur linux-2.5.33/include/linux/fb.h linux/include/linux/fb.h
@@ -166,6 +166,11 @@
 #define FB_VMODE_DOUBLE		2	/* double scan */
 #define FB_VMODE_MASK		255
 
+#define FB_VMODE_ROTATE_CW      0x010000 /* rotate console by 90 degrees  */
+#define FB_VMODE_ROTATE_CCW     0x020000 /* rotate console by 270 degrees */
+#define FB_VMODE_ROTATE_UD      0x040000 /* rotate console by 180 degrees */
+#define FB_ROTATE_MASK          0xFF0000
+
 #define FB_VMODE_YWRAP		256	/* ywrap instead of panning     */
 #define FB_VMODE_SMOOTH_XPAN	512	/* smooth xpan possible (internally used) */
 #define FB_VMODE_CONUPDATE	512	/* don't update x/yoffset	*/

-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390