Skip to contentSkip to conversation

Portrait display mode

DISCUSSION Otto Wyss 3 participants 9 messages Sep 10, 2002 – Sep 17, 2002 2 messages not in the archive Framebuffer layer

lore
Share & tools
lore

Otto Wyss

author
#0 lore raw

I guess the framebuffer drivers so far don't support turning the display 90° as the Pivot software does for Windows/MacOS. Since I'm considering buying a turnable display I rather see this feature implemented. I even may help but can spend much time. How difficult would it be?

O. Wyss

Signature · 8 lines
Author of "Debian partial mirror synch script"
("http://dpartialmirror.sourceforge.net/")


-------------------------------------------------------
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
#1 lore raw
Quoted 2 lines · Otto Wyss

I guess the framebuffer drivers so far don't support turning the display 90° as the Pivot software does for Windows/MacOS. Since I'm considering buying a

I posted a patch under the thread titled "Console Rotation" 2 days ago. It should support rotation in 3 additional directions (90, 180 and 270 degrees). As far as fb-based apps, they have to do the rotation on their own. XFbdev in 4.2.0 already does that.

Quoted 3 lines

turnable display I rather see this feature implemented. I even may help but can spend much time. How difficult would it be?

It should not be too difficult to add per-driver support once the rotation wrappers are implemented. The main requirement is that the driver must support the drawing primitives (xxxfillrect, xxxcopyarea, xxximageblit -- main reason I like the primitives is because you can do a lot of fancy things with minimal code change). I already did this with VESA fb, and it required less than 100 lines of code.

Doing this in 2.4 will be trickier because of absence of support for drawing primitives. (The i810fb driver had console rotation for half a year now, though)

If you are interested, try the patches (apply them in the order I mentioned). http://i810fb.sourceforge.net/fb_rotate.tar.gz

Tony

-------------------------------------------------------
In remembrance
www.osdn.com/911/

#2 lore raw
Quoted 8 lines · Antonino Daplas
Quoted 2 lines · Otto Wyss

I guess the framebuffer drivers so far don't support turning the display 90° as the Pivot software does for Windows/MacOS. Since I'm considering buying a

I posted a patch under the thread titled "Console Rotation" 2 days ago. It should support rotation in 3 additional directions (90, 180 and 270 degrees). As far as fb-based apps, they have to do the rotation on their own. XFbdev in 4.2.0 already does that.

Quoted 4 lines
Quoted 3 lines

turnable display I rather see this feature implemented. I even may help but can spend much time. How difficult would it be?

It should not be too difficult to add per-driver support once the

Can't this be moved up to generic code, so we don't have to modify all drivers?

Quoted 5 lines

rotation wrappers are implemented. The main requirement is that the driver must support the drawing primitives (xxxfillrect, xxxcopyarea, xxximageblit -- main reason I like the primitives is because you can do a lot of fancy things with minimal code change). I already did this with VESA fb, and it required less than 100 lines of code.

Since in the end all drivers will, this is not a real issue.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-------------------------------------------------------
In remembrance
www.osdn.com/911/

#3 lore raw
Quoted 7 lines · Geert Uytterhoeven
Quoted 4 lines
Quoted 3 lines

turnable display I rather see this feature implemented. I even may help but can spend much time. How difficult would it be?

It should not be too difficult to add per-driver support once the

Can't this be moved up to generic code, so we don't have to modify all drivers?

I have thought about that, but since the patch was preliminary, I chose not to disrupt the framework yet. The tricky part in making the support generic is display panning.

Here is my train of thought. Moving support into fbgen might involve a few assumptions. Firstly, info->var is assumed to be device specific (ie, it does not care about the orientation). Secondly, the display->var as well as those received from other sources (such as in an ioctl call) are partly device independent. When a structure var is passed to the driver, it will undergo conversion so the structure is sane from the driver's perspective. The same is done vice-versa. I've introduced two (exportable) functions, convert_var_to_physical(), and convert_var_to_logical() that should do that.

All fbops functions should be passed with device-specific var except for fb_set_var since I'm not too sure where to look for specific entry points for fb_set_var. I guess fb_check_var and fb_pan_display are the most critical ones, since the other fbops functions do not look at the framelengths, nor the offsets.

With the changes, drivers that support fbcon_accel and gen_* functions should have support for console rotation automatically.

For those that support fbcon_accel, but not gen_* functions, the driver should not look at display->var anymore, but look instead into info->var. If possible, use the convert_to_var functions when passing/getting information to/from structure display.

For those, that don't support fbcon_accel, behaviour should remain as usual.

I'm not too sure if this is the correct way of doing this, but it's the best I can think of at the moment without causing very intrusive changes.

Attached is a patch (fb_rotate2.diff). Please apply the patches I have sent previously before applying this patch.

Tony

drivers/video/Config.in +0 -8
diff -Naur linux-2.5.33/drivers/video/Config.in linux/drivers/video/Config.in
@@ -227,7 +227,6 @@
       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
@@ -368,13 +367,6 @@
 	      "$CONFIG_FB_CLPS711X" = "m" -o "$CONFIG_FB_3DFX" = "m" -o \
 	      "$CONFIG_FB_RIVA" = "m" -o "$CONFIG_FB_SGIVW" = "m" ]; then 
 	    define_tristate CONFIG_FBCON_ACCEL m
-         fi       
-      fi
-      if [ "$CONFIG_FB_VESA" = "y" ]; then
-	 define_tristate CONFIG_FBCON_ROTATE y
-      else
-	 if [ "$CONFIG_FB_VESA" = "m" ]; then 
-	    define_tristate CONFIG_FBCON_ROTATE m
          fi       
       fi
       if [ "$CONFIG_FB_AMIGA" = "y" ]; then
drivers/video/Makefile +2 -3
diff -Naur linux-2.5.33/drivers/video/Makefile linux/drivers/video/Makefile
@@ -68,7 +68,7 @@
 obj-$(CONFIG_FB_S3TRIO)           += S3triofb.o
 obj-$(CONFIG_FB_TGA)              += tgafb.o
 obj-$(CONFIG_FB_VESA)             += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o 
-obj-$(CONFIG_FB_VGA16)            += vga16fb.o fbcon-vga-planes.o
+obj-$(CONFIG_FB_VGA16)            += vga16fb.o fbcon-vga-planes.o 
 obj-$(CONFIG_FB_VIRGE)            += virgefb.o
 obj-$(CONFIG_FB_G364)             += g364fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_FM2)              += fm2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
@@ -117,8 +117,7 @@
 obj-$(CONFIG_FBCON_MFB)           += fbcon-mfb.o
 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 
+obj-$(CONFIG_FBCON_ACCEL)	  += fbcon-accel.o fbcon-rotate.o
 
 include $(TOPDIR)/Rules.make
 
drivers/video/cfbcopyarea.c +0 -7
diff -Naur linux-2.5.33/drivers/video/cfbcopyarea.c linux/drivers/video/cfbcopyarea.c
@@ -28,7 +28,6 @@
 #include <asm/io.h>
 #include <video/fbcon.h>
 
-#include "fbcon-rotate.h"
 
 #define LONG_MASK  (BITS_PER_LONG - 1)
 
@@ -329,12 +328,6 @@
 
 	vxres = p->var.xres_virtual;
 	vyres = p->var.yres_virtual;
-#ifdef FBCON_HAS_ROTATE
-	if (p->var.vmode & (FB_VMODE_ROTATE_CW | FB_VMODE_ROTATE_CCW)) {
-		vxres = p->var.yres_virtual;
-		vyres = p->var.xres_virtual;
-	}
-#endif
 
 	if (area->dx > vxres || 
 	    area->sx > vxres ||
drivers/video/cfbfillrect.c +0 -8
diff -Naur linux-2.5.33/drivers/video/cfbfillrect.c linux/drivers/video/cfbfillrect.c
@@ -22,8 +22,6 @@
 #include <asm/types.h>
 #include <video/fbcon.h>
 
-#include "fbcon-rotate.h"
-
 #if BITS_PER_LONG == 32
 #define FB_WRITEL fb_writel
 #define FB_READL  fb_readl
@@ -53,12 +51,6 @@
 
 	vxres = p->var.xres_virtual;
 	vyres = p->var.yres_virtual;
-#ifdef FBCON_HAS_ROTATE
-	if (p->var.vmode & (FB_VMODE_ROTATE_CW | FB_VMODE_ROTATE_CCW)) {
-		vxres = p->var.yres_virtual;
-		vyres = p->var.xres_virtual;
-	}
-#endif
 
 	if (!rect->width || !rect->height ||
 	    rect->dx > vxres ||
drivers/video/cfbimgblt.c +0 -7
diff -Naur linux-2.5.33/drivers/video/cfbimgblt.c linux/drivers/video/cfbimgblt.c
@@ -39,7 +39,6 @@
 #include <asm/types.h>
 
 #include <video/fbcon.h>
-#include "fbcon-rotate.h"
 
 #define DEBUG
 
@@ -298,12 +297,6 @@
 
 	vxres = p->var.xres_virtual;
 	vyres = p->var.yres_virtual;
-#ifdef FBCON_HAS_ROTATE
-	if (p->var.vmode & (FB_VMODE_ROTATE_CW | FB_VMODE_ROTATE_CCW)) {
-		vxres = p->var.yres_virtual;
-		vyres = p->var.xres_virtual;
-	}
-#endif
 
 	/* 
 	 * We could use hardware clipping but on many cards you get around hardware
drivers/video/fbcon-rotate.c +26 -26

150 lines not on this page · raw message

drivers/video/fbcon-rotate.h +0 -10
diff -Naur linux-2.5.33/drivers/video/fbcon-rotate.h linux/drivers/video/fbcon-rotate.h
@@ -7,16 +7,6 @@
 
 #include <linux/config.h>
 
-#ifdef MODULE
-#if defined(CONFIG_FBCON_ROTATE) || defined(CONFIG_FBCON_ROTATE_MODULE)
-#define FBCON_HAS_ROTATE
-#endif
-#else
-#if defined(CONFIG_FBCON_ROTATE)
-#define FBCON_HAS_ROTATE
-#endif
-#endif
-
 extern struct display_switch fbcon_rr;
 extern void fbcon_rr_setup(struct display *p);
 extern void fbcon_rr_bmove(struct display *p, int sy, int sx, int dy,
drivers/video/fbgen.c +103 -14

189 lines not on this page · raw message

drivers/video/fbmem.c +5 -1
diff -Naur linux-2.5.33/drivers/video/fbmem.c linux/drivers/video/fbmem.c
@@ -476,7 +476,9 @@
 		return -ENODEV;
 	switch (cmd) {
 	case FBIOGET_VSCREENINFO:
-		return copy_to_user((void *) arg, &info->var,
+		var = info->var;
+		convert_var_to_logical(&var);
+		return copy_to_user((void *) arg, &var,
 				    sizeof(var)) ? -EFAULT : 0;
 	case FBIOPUT_VSCREENINFO:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
@@ -504,8 +506,10 @@
 			return -EFAULT;
 		if (fb->fb_pan_display == NULL)
 			return (var.xoffset || var.yoffset) ? -EINVAL : 0;
+		convert_var_to_phys(&var);
 		if ((i=fb->fb_pan_display(&var, PROC_CONSOLE(info), info)))
 			return i;
+		convert_var_to_logical(&var);
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
 		return i;
drivers/video/vesafb.c +1 -66

107 lines not on this page · raw message

include/linux/fb.h +2 -0
diff -Naur linux-2.5.33/include/linux/fb.h linux/include/linux/fb.h
@@ -419,6 +419,8 @@
 extern int fb_blank(int blank, struct fb_info *info);
 extern int gen_switch(int con, struct fb_info *info);
 extern void gen_set_disp(int con, struct fb_info *info);
+extern void convert_var_to_logical(struct fb_var_screeninfo *var);
+extern void convert_var_to_phys(struct fb_var_screeninfo *var);
 
 /* drivers/video/fbmem.c */
 extern int register_framebuffer(struct fb_info *fb_info);
author
#4 lore raw
In reply to Antonino Daplas
Quoted 3 lines

I posted a patch under the thread titled "Console Rotation" 2 days ago. It should support rotation in 3 additional directions (90, 180 and 270 degrees). As far as fb-based apps, they have to do the rotation on

I should have looked more closely at the messages, "Console ..." misguided me.

Quoted 2 lines

their own. XFbdev in 4.2.0 already does that.

When the fb drivers support rotation, XFbdev doesn't need rotation anymore.

Quoted 4 lines

Doing this in 2.4 will be trickier because of absence of support for drawing primitives. (The i810fb driver had console rotation for half a year now, though)

Does this mean I have to use 2.5 to get rotation?

Quoted 3 lines

If you are interested, try the patches (apply them in the order I mentioned). http://i810fb.sourceforge.net/fb_rotate.tar.gz

I'm currently using "aty128fb" but may be able to switch to "matroxfb". I'm also considering buying card with an DVI plug (hopefully without fan :-( )

O. Wyss

Signature · 7 lines
Author of "Debian partial mirror synch script"
("http://dpartialmirror.sourceforge.net/")


-------------------------------------------------------
In remembrance
www.osdn.com/911/
#5 lore raw
Quoted 9 lines · Otto Wyss
Quoted 3 lines

I posted a patch under the thread titled "Console Rotation" 2 days ago. It should support rotation in 3 additional directions (90, 180 and 270 degrees). As far as fb-based apps, they have to do the rotation on

I should have looked more closely at the messages, "Console ..." misguided me.

Quoted 2 lines

their own. XFbdev in 4.2.0 already does that.

When the fb drivers support rotation, XFbdev doesn't need rotation anymore.

It really is just console rotation, all other fb-based apps would still display in the standard "upright" position unless specifically written for display rotation, such as Xfbdev.

Quoted 6 lines
Quoted 5 lines

Doing this in 2.4 will be trickier because of absence of support for drawing primitives. (The i810fb driver had console rotation for half a year now, though)

Does this mean I have to use 2.5 to get rotation?

I'm not sure if the patch I submitted will even be accepted. My point is that it's easier to do this in the 2.5 fb framework than in 2.2-2.4. But you can already use Xfbdev in 2.4 to rotate the display.

Quoted 7 lines
Quoted 4 lines

If you are interested, try the patches (apply them in the order I mentioned). http://i810fb.sourceforge.net/fb_rotate.tar.gz

I'm currently using "aty128fb" but may be able to switch to "matroxfb". I'm also considering buying card with an DVI plug (hopefully without fan :-( )

It depends if the driver maintainers will support the drawing primitives. Some may refuse not to, and that is understandable.

Tony

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#8 lore raw
In reply to a message not in the archive
Quoted 5 lines · Otto Wyss

Sorry if I'm looking "heavy of understandig" (translated from German) but does this mean that some parts are written with and some without rotation? Or does it mean in console mode everything is rotated if the used driver supports it? Vise versa X?

Diagramatically, the fb-based console looks something like this:

Console -> fbcon -> fbdev -> graphics-capable hardware

Rotation is done at the fbcon layer. fbdev on the other hand is just an abstraction of the underlying graphics hardware. It is fbdev that is actually used by fb-based applications, such as Xfree86. fbdev does not know about display orientation, but Xfbdev does, and so can fbcon.

Quoted 1 line

What does a rotation unter X bring as long as the console doesn't? Okay for

This is actually what triggered me to submit the patches, it is quite disconcerting to switch from a rotated Xfree86 display to an upright console.

Quoted 2 lines

anyone only using X the Xfbdev solution might be okay, but when the fb-diver supports rotation Xfbdev should use this.

See above. fbdev does not know about rotation, nor does it need to.

Tony

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

author
#9 lore raw
Quoted 9 lines

Diagramatically, the fb-based console looks something like this:

Console -> fbcon -> fbdev -> graphics-capable hardware

Rotation is done at the fbcon layer. fbdev on the other hand is just an abstraction of the underlying graphics hardware. It is fbdev that is actually used by fb-based applications, such as Xfree86. fbdev does not know about display orientation, but Xfbdev does, and so can fbcon.

What about applications compiled with GTK+ target linux-fb or similar toolsets? If I understand it right only the fbcon layer should be used (if possible) to be on the save side.

Quoted 5 lines
Quoted 1 line

What does a rotation unter X bring as long as the console doesn't? Okay for

This is actually what triggered me to submit the patches, it is quite disconcerting to switch from a rotated Xfree86 display to an upright console.

Okay I'm not so much interested in Xfbdev than in fbcon. Can you transferred your code to the generic part as Geert Uytterhoeven already asked. I could help test patches against kernel 2.4.19. And what about kernel 2.5, I've read of a feature freeze soon?

O. Wyss

Signature · 9 lines
Author of "Debian partial mirror synch script"
("http://dpartialmirror.sourceforge.net/")


-------------------------------------------------------
This SF.NET email is sponsored by: AMD - Your access to the experts
on Hammer Technology! Open Source & Linux Developers, register now
for the AMD Developer Symposium. Code: EX8664
http://www.developwithamd.com/developerlab
#10 lore raw
Quoted 4 lines · Otto Wyss
Quoted 4 lines

Diagramatically, the fb-based console looks something like this:

Console -> fbcon -> fbdev -> graphics-capable hardware

Quoted 9 lines
Quoted 5 lines

Rotation is done at the fbcon layer. fbdev on the other hand is just an abstraction of the underlying graphics hardware. It is fbdev that is actually used by fb-based applications, such as Xfree86. fbdev does not know about display orientation, but Xfbdev does, and so can fbcon.

What about applications compiled with GTK+ target linux-fb or similar toolsets? If I understand it right only the fbcon layer should be used (if possible) to be on the save side.

fbcon is text-based, so it's the same for all of them. If rotation is needed, it has to be added at the user level. I guess DirectFB is the best choice at the moment. Maybe you can ask the developers there for the possibility -- [email protected].

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

What does a rotation unter X bring as long as the console doesn't? Okay for

This is actually what triggered me to submit the patches, it is quite disconcerting to switch from a rotated Xfree86 display to an upright console.

Okay I'm not so much interested in Xfbdev than in fbcon. Can you transferred your code to the generic part as Geert Uytterhoeven already asked. I could help

I already did, but it's against 2.5.33. See my response to Geert. It will only work if the driver itself uses the generic functions and has drawing primitives. It's very preliminary since James is still rewriting the FB framework.

Quoted 3 lines

test patches against kernel 2.4.19. And what about kernel 2.5, I've read of a feature freeze soon?

In November, I think.

Tony

-------------------------------------------------------
This SF.NET email is sponsored by: AMD - Your access to the experts on Hammer Technology! Open Source & Linux Developers, register now for the AMD Developer Symposium. Code: EX8664
http://www.developwithamd.com/developerlab