linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fb rotation 2.6.x
@ 2005-03-15  8:58 Komal Shah
  2005-03-15 20:50 ` Antonino A. Daplas
  0 siblings, 1 reply; 4+ messages in thread
From: Komal Shah @ 2005-03-15  8:58 UTC (permalink / raw)
  To: linux-fbdev-devel

Hi All,

We have added the code for hardware rotation in the
framebuffer driver for omap242x processor from TI
[2.6.x kernel]. 

It has been reported to work on 2.4.x.

But when I had made it changed for 2.6.x follwoing
behaviour is seen:

1. When I rotate the framebuffer ( Linux logo screen)
by 180 degree then it shows only Linux logo image for
a second only and then it disappears.

2. Whereas while doing in 90 degree rotation, it shows
the black square of Linux logo size on the 270 degree
rotation position. 

The reasons we found are as below:

-----------------snip-----------------
That is because in 2.4, the fb_display's var structure
is updated by the driver - which we do consistently.
In 2.6, on the other hand, the fb_info's var structure
is
updated by the driver, and all the fb_displays are
updated by either fb_mem or fb_con - which I think is
not done correctly. Also the set_par function is
called so many times - I don't understand why.

What is happening is that, first, fb_info's var
structure is updated, which rotates the display. But
this var does not get passed to the current
fb_display's var. Then when the fbcon_switch function
is called, the current fb_display's var settings are
affected - which 'unrotates' the display.

We have to see if any other driver has rotation
support and how they are implementing it. Otherwise,
most probably fb_con needs fixing, I think.
-----------------snip-----------------

Log of sequence in which functions are being called in
driver when we issue FBIOPUT_VSCREENINFO, with xres,
yres, xoffset, yoffset and rotate variables value.

-------long output for 180 degree rotation----

omap24xxfb_check_var: Enter
omap24xxfb_check_mode: Enter
omap24xxfb_check_mode: Exit
var_to_depth: Enter
omap24xxfb_check_var: Exit
omap24xxfb_set_par: Enter
var_to_depth: Enter
omap24xxfb_change_mode: Enter
omap24xxfb_change_mode: Exit
horizontal_sync_freq: Enter
pixels_per_clock: Enter
pixels_per_clock: Exit
horizontal_sync_freq: Exit
vertical_sync_freq: Enter
horizontal_sync_freq: Enter
pixels_per_clock: Enter
pixels_per_clock: Exit
horizontal_sync_freq: Exit
vertical_sync_freq: Exit
var_to_depth: Enter
omap24xxfb_set_sms_rotation: Enter
omap24xxfb_set_sms_rotation: Exit
omap24xxfb_write_state: Enter
omap24xxfb_disable: Enter
omap24xxfb_disable: Exit
omap24xxfb_enable: Enter
wait_for_go: Enter
wait_for_go: Exit
omap24xxfb_enable: Exit
omap24xxfb_write_state: Exit
omap24xxfb_set_par: Exit
omap24xxfb_pan_display: Enter
omap24xxfb_pan_display: Exit
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_check_var: Enter
omap24xxfb_check_mode: Enter
omap24xxfb_check_mode: Exit
var_to_depth: Enter
omap24xxfb_check_var: Exit
omap24xxfb_set_par: Enter
var_to_depth: Enter
omap24xxfb_change_mode: Enter
omap24xxfb_change_mode: Exit
horizontal_sync_freq: Enter
pixels_per_clock: Enter
pixels_per_clock: Exit
horizontal_sync_freq: Exit
vertical_sync_freq: Enter
horizontal_sync_freq: Enter
pixels_per_clock: Enter
pixels_per_clock: Exit
horizontal_sync_freq: Exit
vertical_sync_freq: Exit
var_to_depth: Enter
omap24xxfb_set_sms_rotation: Enter
omap24xxfb_set_sms_rotation: Exit
omap24xxfb_write_state: Enter
omap24xxfb_disable: Enter
omap24xxfb_disable: Exit
omap24xxfb_enable: Enter
wait_for_go: Enter
wait_for_go: Exit
omap24xxfb_enable: Exit
omap24xxfb_write_state: Exit
omap24xxfb_set_par: Exit
omap24xxfb_pan_display: Enter
omap24xxfb_pan_display: Exit
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_pan_display: Enter
omap24xxfb_pan_display: Exit
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_pan_display: Enter
omap24xxfb_pan_display: Exit
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_pan_display: Enter
omap24xxfb_pan_display: Exit
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
omap24xxfb_setcolreg: Enter
---------lon output ends--------

Above output is generated when I call my test
application with 180 degree rotation. You can see that
set_par is called many times, why?

Let me know what changes I need to do in fb driver, so
that I can remove the effect.

Let me know if you guys need more info/driver source?

---Komal Shah


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search. 
http://info.mail.yahoo.com/mail_250


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fb rotation 2.6.x
  2005-03-15  8:58 Fb rotation 2.6.x Komal Shah
@ 2005-03-15 20:50 ` Antonino A. Daplas
  2005-03-15 23:47   ` Antonino A. Daplas
  0 siblings, 1 reply; 4+ messages in thread
From: Antonino A. Daplas @ 2005-03-15 20:50 UTC (permalink / raw)
  To: linux-fbdev-devel, Komal Shah

On Tuesday 15 March 2005 16:58, Komal Shah wrote:
> Hi All,
>
> We have added the code for hardware rotation in the
> framebuffer driver for omap242x processor from TI
> [2.6.x kernel].
>
> It has been reported to work on 2.4.x.
>
> But when I had made it changed for 2.6.x follwoing
> behaviour is seen:
>
> 1. When I rotate the framebuffer ( Linux logo screen)
> by 180 degree then it shows only Linux logo image for
> a second only and then it disappears.
>
> 2. Whereas while doing in 90 degree rotation, it shows
> the black square of Linux logo size on the 270 degree
> rotation position.
>
> The reasons we found are as below:
>
> -----------------snip-----------------
> That is because in 2.4, the fb_display's var structure
> is updated by the driver - which we do consistently.
> In 2.6, on the other hand, the fb_info's var structure
> is
> updated by the driver, and all the fb_displays are
> updated by either fb_mem or fb_con - which I think is
> not done correctly. Also the set_par function is
> called so many times - I don't understand why.

Sometimes people use multiple fbdevs mapped to different consoles, so a
set_par() is called for each fb_info mapped for each console.

I guess I can add an "already_initialized" flag so fbcon doesn't do multiple
set_pars().

>
> What is happening is that, first, fb_info's var
> structure is updated, which rotates the display. But
> this var does not get passed to the current
> fb_display's var. Then when the fbcon_switch function
> is called, the current fb_display's var settings are
> affected - which 'unrotates' the display.

What fields do you use in var that is important for rotation? Is it
var->rotate? If that is the case, just add those fields in struct display in
fbcon.h, and update the functions display_to_var() and var_to_display() in
fbcon.c to also include the said fields.

Tony




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fb rotation 2.6.x
  2005-03-15 20:50 ` Antonino A. Daplas
@ 2005-03-15 23:47   ` Antonino A. Daplas
  2005-03-16 13:59     ` Komal Shah
  0 siblings, 1 reply; 4+ messages in thread
From: Antonino A. Daplas @ 2005-03-15 23:47 UTC (permalink / raw)
  To: linux-fbdev-devel, Komal Shah

On Wednesday 16 March 2005 04:50, Antonino A. Daplas wrote:
> On Tuesday 15 March 2005 16:58, Komal Shah wrote:
>
> Sometimes people use multiple fbdevs mapped to different consoles, so a
> set_par() is called for each fb_info mapped for each console.
>
> I guess I can add an "already_initialized" flag so fbcon doesn't do
> multiple set_pars().
>

>
> What fields do you use in var that is important for rotation? Is it
> var->rotate? If that is the case, just add those fields in struct display
> in fbcon.h, and update the functions display_to_var() and var_to_display()
> in fbcon.c to also include the said fields.

Try the attached patch.  It adds var->rotate to the set of parameters saved
by fbcon.  The patch also includes minimizing the number of set_pars done
during init.  Let me know if there are still set_pars that escaped.

BTW, the patch is against my tree, but it should apply reasonably well to
any recent 2.6 kernel + a few rejects which you can easily apply by hand.

Tony

diff -Nru a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
--- a/drivers/video/console/fbcon.c	2004-11-21 22:54:54 +08:00
+++ b/drivers/video/console/fbcon.c	2005-03-16 07:39:24 +08:00
@@ -599,9 +599,10 @@
 
 	ops->currcon = fg_console;
 
-	if (info->fbops->fb_set_par)
+	if (info->fbops->fb_set_par && !(ops->flags & FBCON_FLAGS_INIT))
 		info->fbops->fb_set_par(info);
 
+	ops->flags |= FBCON_FLAGS_INIT;
 	ops->graphics = 0;
 
 	if (vc)
@@ -703,6 +704,7 @@
 	disp->green = var->green;
 	disp->blue = var->blue;
 	disp->transp = var->transp;
+	disp->rotate = var->rotate;
 	disp->mode = fb_match_mode(var, &info->modelist);
 	if (disp->mode == NULL)
 		/* This should not happen */
@@ -726,6 +728,7 @@
 	var->green = disp->green;
 	var->blue = disp->blue;
 	var->transp = disp->transp;
+	var->rotate = disp->rotate;
 }
 
 static const char *fbcon_startup(void)
@@ -898,6 +901,7 @@
 static void fbcon_init(struct vc_data *vc, int init)
 {
 	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
+	struct fbcon_ops *ops;
 	struct vc_data **default_mode = vc->vc_display_fg;
 	struct vc_data *svc = *default_mode;
 	struct display *t, *p = &fb_display[vc->vc_num];
@@ -948,6 +952,8 @@
 	new_cols = info->var.xres / vc->vc_font.width;
 	new_rows = info->var.yres / vc->vc_font.height;
 	vc_resize(vc, new_cols, new_rows);
+
+	ops = info->fbcon_par;
 	/*
 	 * We must always set the mode. The mode of the previous console
 	 * driver could be in the same resolution but we are using different
@@ -955,10 +961,14 @@
 	 *
 	 * We need to do it in fbcon_init() to prevent screen corruption.
 	 */
-	if (CON_IS_VISIBLE(vc) && info->fbops->fb_set_par)
-		info->fbops->fb_set_par(info);
+	if (CON_IS_VISIBLE(vc)) {
+		if (info->fbops->fb_set_par && 
+		    !(ops->flags & FBCON_FLAGS_INIT))
+			info->fbops->fb_set_par(info);
+		ops->flags |= FBCON_FLAGS_INIT;
+	}
 
-	((struct fbcon_ops *) info->fbcon_par)->graphics = 0;
+	ops->graphics = 0;
 
 	if ((cap & FBINFO_HWACCEL_COPYAREA) &&
 	    !(cap & FBINFO_HWACCEL_DISABLED))
diff -Nru a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
--- a/drivers/video/console/fbcon.h	2004-11-21 22:26:19 +08:00
+++ b/drivers/video/console/fbcon.h	2005-03-16 07:39:24 +08:00
@@ -18,6 +18,8 @@
 
 #include <asm/io.h>
 
+#define FBCON_FLAGS_INIT 1
+
    /*
     *    This is the interface between the low-level console driver and the
     *    low-level frame buffer device
@@ -41,6 +43,7 @@
     u32 grayscale;
     u32 nonstd;
     u32 accel_flags;
+    u32 rotate;
     struct fb_bitfield red;
     struct fb_bitfield green;
     struct fb_bitfield blue;
@@ -68,6 +71,7 @@
 	int    cursor_reset;
 	int    blank_state;
 	int    graphics;
+	int    flags;
 	char  *cursor_data;
 };
     /*




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fb rotation 2.6.x
  2005-03-15 23:47   ` Antonino A. Daplas
@ 2005-03-16 13:59     ` Komal Shah
  0 siblings, 0 replies; 4+ messages in thread
From: Komal Shah @ 2005-03-16 13:59 UTC (permalink / raw)
  To: linux-fbdev-devel

--- "Antonino A. Daplas" <adaplas@hotpop.com> wrote:
> Sometimes people use multiple fbdevs mapped to
> different consoles, so a
> set_par() is called for each fb_info mapped for
> each console.

Thanx for the reply. My kernel seems to be old 2.6.9 -
compared to the patches you had supplied me. I should
update my omap242x tree to 2.6.11 atleast. So that it
can cover the all the changes which were went in for
fbcon.

But before that too, I will try to call set_par only
once and update the var info as you had suggested in
the patch , and will let you know about what happens
on LCD panel :-).

---Komal Shah


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-16 13:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-15  8:58 Fb rotation 2.6.x Komal Shah
2005-03-15 20:50 ` Antonino A. Daplas
2005-03-15 23:47   ` Antonino A. Daplas
2005-03-16 13:59     ` Komal Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).