linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Error in fbcon_switch ?
@ 2008-05-20 21:11 Krzysztof Helt
  2008-05-21  7:17 ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Krzysztof Helt @ 2008-05-20 21:11 UTC (permalink / raw)
  To: Linux-fbdev-devel

Hi,

I run into issue when two virtual consoles (tty1 and tty2) are set to different
display modes: one with interlace and one without. When console is switched,
the setting of the interlaced mode is not honoured, ie. 

tty1 (lace) -> tty2 (non-lace) -> tty1 (lace) -> tty2 (non-lace)

gives

tty1 (lace) -> tty2 (lace) -> tty1 (lace) -> tty2 (lace)

Of course, the refresh rate (and other timings) are not correct on the tty2 as
the resolution and pixclock are preserved.

I found that root of the problem is that fbcon_switch copies the var.vmode 
field from the previous console. If this copy is removed everything is alright, ie.

tty1 (lace) -> tty2 (non-lace) -> tty1 (lace) -> tty2 (non-lace)

Is this a correct solution to the problem? What is a purpose of copying vmode field?

The vmode field contains following settings:

#define FB_VMODE_INTERLACED     1       /* interlaced   */
#define FB_VMODE_DOUBLE         2       /* double scan */
#define FB_VMODE_ODD_FLD_FIRST  4       /* interlaced: top line first */
#define FB_VMODE_MASK           255

#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       */

IMO, at least the first three should not be copied. I am not sure about YWRAP and 
CONUPDATE/SMOOTH_XPAN.

Regards,
Krzysztof
PS. The patch below is my fix:

diff -urp linux-old/drivers/video/console/fbcon.c linux-new/drivers/video/console/fbcon.c
--- linux-old/drivers/video/console/fbcon.c	2008-05-12 19:27:04.305519626 +0200
+++ linux-new/drivers/video/console/fbcon.c	2008-05-20 23:06:44.235878754 +0200
@@ -2266,7 +2266,6 @@ static int fbcon_switch(struct vc_data *
 	info->var.activate = var.activate;
 	var.yoffset = info->var.yoffset;
 	var.xoffset = info->var.xoffset;
-	var.vmode = info->var.vmode;
 	fb_set_var(info, &var);
 	ops->var = info->var;
 


---------------------------------------------------------------------- 	 
4 wolne dni przed Toba!!!
Sprawdz pogode na dlugi weekend >> http://link.interia.pl/f1e02




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: Error in fbcon_switch ?
  2008-05-20 21:11 Error in fbcon_switch ? Krzysztof Helt
@ 2008-05-21  7:17 ` Geert Uytterhoeven
  2008-05-22 16:47   ` Krzysztof Helt
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2008-05-21  7:17 UTC (permalink / raw)
  To: Krzysztof Helt; +Cc: Linux-fbdev-devel

On Tue, 20 May 2008, Krzysztof Helt wrote:
> I run into issue when two virtual consoles (tty1 and tty2) are set to different
> display modes: one with interlace and one without. When console is switched,
> the setting of the interlaced mode is not honoured, ie. 
> 
> tty1 (lace) -> tty2 (non-lace) -> tty1 (lace) -> tty2 (non-lace)
> 
> gives
> 
> tty1 (lace) -> tty2 (lace) -> tty1 (lace) -> tty2 (lace)
> 
> Of course, the refresh rate (and other timings) are not correct on the tty2 as
> the resolution and pixclock are preserved.

Interesting, I'll give it a try on my Amiga tonight...

> I found that root of the problem is that fbcon_switch copies the var.vmode 
> field from the previous console. If this copy is removed everything is alright, ie.
> 
> tty1 (lace) -> tty2 (non-lace) -> tty1 (lace) -> tty2 (non-lace)
> 
> Is this a correct solution to the problem? What is a purpose of copying vmode field?
> 
> The vmode field contains following settings:
> 
> #define FB_VMODE_INTERLACED     1       /* interlaced   */
> #define FB_VMODE_DOUBLE         2       /* double scan */
> #define FB_VMODE_ODD_FLD_FIRST  4       /* interlaced: top line first */
> #define FB_VMODE_MASK           255
> 
> #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       */
> 
> IMO, at least the first three should not be copied. I am not sure about YWRAP and 
> CONUPDATE/SMOOTH_XPAN.

As it copies [xy]offset, it probably needs YWRAP/SMOOTH_XPAN/CONUPDATE.
So I guess it should keep the bits under FB_VMODE_MASK.

> Regards,
> Krzysztof
> PS. The patch below is my fix:
> 
> diff -urp linux-old/drivers/video/console/fbcon.c linux-new/drivers/video/console/fbcon.c
> --- linux-old/drivers/video/console/fbcon.c	2008-05-12 19:27:04.305519626 +0200
> +++ linux-new/drivers/video/console/fbcon.c	2008-05-20 23:06:44.235878754 +0200
> @@ -2266,7 +2266,6 @@ static int fbcon_switch(struct vc_data *
>  	info->var.activate = var.activate;
>  	var.yoffset = info->var.yoffset;
>  	var.xoffset = info->var.xoffset;
> -	var.vmode = info->var.vmode;
>  	fb_set_var(info, &var);
>  	ops->var = info->var;

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: Error in fbcon_switch ?
  2008-05-21  7:17 ` Geert Uytterhoeven
@ 2008-05-22 16:47   ` Krzysztof Helt
  2008-05-22 20:57     ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Krzysztof Helt @ 2008-05-22 16:47 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux-fbdev-devel

On Wed, 21 May 2008 09:17:45 +0200 (CEST)
Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> On Tue, 20 May 2008, Krzysztof Helt wrote:

> > I found that root of the problem is that fbcon_switch copies the var.vmode 
> > field from the previous console. If this copy is removed everything is alright, ie.
> > 
> > tty1 (lace) -> tty2 (non-lace) -> tty1 (lace) -> tty2 (non-lace)
> > 
> > Is this a correct solution to the problem? What is a purpose of copying vmode field?
> > 
(...)
> > IMO, at least the first three should not be copied. I am not sure about YWRAP and 
> > CONUPDATE/SMOOTH_XPAN.
> 
> As it copies [xy]offset, it probably needs YWRAP/SMOOTH_XPAN/CONUPDATE.

As I thought more about it, the copy of [xy]offset is also wrong. What if I have
one console with 4096 vyres and another with only 1024 vyres. Copying offsets
between them does not make any sense. Setting offsets to zero makes more sense
(there is no scrollback buffer available anyway).

> So I guess it should keep the bits under FB_VMODE_MASK.
> 

Actually, the opposite. Bits under FB_VMODE_MASK should be cleared
for old console, the remaining ones (YWRAP/SMOOTH_XPAN/CONUPDATE)
can be copied (or-ed with new ones).

Kind regards,
Krzysztof


----------------------------------------------------------------------
Zainwestujesz w hodowle, czy w pszenice?
Farmersi > strategia online http://link.interia.pl/f1e00


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: Error in fbcon_switch ?
  2008-05-22 16:47   ` Krzysztof Helt
@ 2008-05-22 20:57     ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2008-05-22 20:57 UTC (permalink / raw)
  To: Krzysztof Helt; +Cc: Linux-fbdev-devel

On Thu, 22 May 2008, Krzysztof Helt wrote:
> On Wed, 21 May 2008 09:17:45 +0200 (CEST)
> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Tue, 20 May 2008, Krzysztof Helt wrote:
> 
> > > I found that root of the problem is that fbcon_switch copies the var.vmode 
> > > field from the previous console. If this copy is removed everything is alright, ie.
> > > 
> > > tty1 (lace) -> tty2 (non-lace) -> tty1 (lace) -> tty2 (non-lace)

I could easily reproduce it on my Amiga. Haven't tried on the PS3 yet.

Seems to be introduced by

commit e4fc27618b75234b721c4a13d0e0d9d07e75e641
Author: Antonino A. Daplas <adaplas@gmail.com>
Date:   Tue Nov 8 21:39:09 2005 -0800

    [PATCH] fbcon: Console Rotation - Prepare fbcon for console rotation

Strange I never noticed it before... Oh well, interlace doesn't seem to
be popular anymore.

> > > Is this a correct solution to the problem? What is a purpose of copying vmode field?
> > > 
> (...)
> > > IMO, at least the first three should not be copied. I am not sure about YWRAP and 
> > > CONUPDATE/SMOOTH_XPAN.
> > 
> > As it copies [xy]offset, it probably needs YWRAP/SMOOTH_XPAN/CONUPDATE.
> 
> As I thought more about it, the copy of [xy]offset is also wrong. What if I have
> one console with 4096 vyres and another with only 1024 vyres. Copying offsets
> between them does not make any sense. Setting offsets to zero makes more sense
> (there is no scrollback buffer available anyway).
> 
> > So I guess it should keep the bits under FB_VMODE_MASK.
> 
> Actually, the opposite. Bits under FB_VMODE_MASK should be cleared
> for old console, the remaining ones (YWRAP/SMOOTH_XPAN/CONUPDATE)
> can be copied (or-ed with new ones).

Sorry, that's what I meant (`keep' means do not copy).

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

end of thread, other threads:[~2008-05-22 20:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-20 21:11 Error in fbcon_switch ? Krzysztof Helt
2008-05-21  7:17 ` Geert Uytterhoeven
2008-05-22 16:47   ` Krzysztof Helt
2008-05-22 20:57     ` Geert Uytterhoeven

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).