linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Re: board with broken vga ...
@ 2002-07-22 21:07 Petr Vandrovec
  2002-07-22 21:10 ` Sven
  2002-07-23 14:35 ` Sven LUTHER
  0 siblings, 2 replies; 11+ messages in thread
From: Petr Vandrovec @ 2002-07-22 21:07 UTC (permalink / raw)
  To: Sven; +Cc: linux-fbdev-devel

On 22 Jul 02 at 23:00, Sven wrote:

> > Just put it into vc_screenbuf after register_framebuffer() returns, and
> > force redraw...
> 
> mmm, will try.
> 
> BTW, how can i force a redraw from pm3fb ?
> 
> > If you'll override save_screen, and you'll put set_origin() into visual_init,
> 
> NO, just tried, i got no more display, and the box hanged ...

Oops. fbcon_set_origin will call scrolldelta which ... So what about simple
origin = screenbuf in visual_init ? It should have no side effects.

> How i do it :
> 
> i copy the data in pm3fb just after i first map the framebuffer. i hold it in a special
> array in pm3fb (for now).
> 
> But then, maybe i should see if the location of the set_origin should be changed, maybe i could do it in vc_resize for now.
> 
> BTW, in the first case, i will see the screen flashing shortly with the garbage i see now, and then work ok, isn't it ? 

Yes.

> And i would need to handle resolution changes myself ?

Yes. Or you can copy data just line by line, instead of like one big chunk.
Yes, it is duplicating of vc_resize code.
                                                Petr Vandrovec
                                                


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

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Re: board with broken vga ...
@ 2002-07-22 20:45 Petr Vandrovec
  2002-07-22 21:00 ` Sven
  0 siblings, 1 reply; 11+ messages in thread
From: Petr Vandrovec @ 2002-07-22 20:45 UTC (permalink / raw)
  To: Sven; +Cc: linux-fbdev-devel

On 22 Jul 02 at 22:40, Sven wrote:
> 
> What would solve my problem in the easiest way would be to have some 
> framebuffer restore hook or something in the fbdev driver, which would get called
> in take_over_screen or something such, after the screen has been resized ?

Just put it into vc_screenbuf after register_framebuffer() returns, and
force redraw...
 
> Or Maybe simply tell vc_resize that we use a special way of reading the framebuffer.
> 
> Or i should implement the trick you use for setting the card in 
> graphic mode later on in the setvar stuff ?

If you'll override save_screen, and you'll put set_origin() into visual_init,
I believe that it will work:

(1) in take_over_console, copy data to screenbuf using your own save_screen.
(2) now vc_resize (with prior set_origin) will copy data from old screenbuf
    to reallocated screenbuf (instead of from videoram to reallocated
    screenbuf).
(3) and update_screen() will just paint data which are already on screen
    if resolution changed. If resolutions matched, it will put data on the
    screen.

                                                    Petr
                                                    


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

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Re: board with broken vga ...
@ 2002-07-22 20:18 Petr Vandrovec
  2002-07-22 20:40 ` Sven
  0 siblings, 1 reply; 11+ messages in thread
From: Petr Vandrovec @ 2002-07-22 20:18 UTC (permalink / raw)
  To: Sven; +Cc: linux-fbdev-devel

On 22 Jul 02 at 21:58, Sven wrote:

> I did a bit more looking, and found that :
> 
> Jul 22 21:49:32 iliana kernel: SVEN : c->vc_screenbuf is -1055775808

Having them hexadecimal would be much better... c11223c0... bootmem.
 
> screen buffer is set to that when i overwrite the vgacon save_scree function, and here i save
> it (printed with %ld).
> 
> Jul 22 21:49:32 iliana kernel: SVEN : set_origin : screenbuf is -941350912.

c7e42000... kmalloc

> Jul 22 21:49:32 iliana kernel: SVEN : set_origin : origin is -1072968800.

c00bcba0... inside VGA framebuffer.

> when set_origin is first called (not from do_update_screen) after that, it held this values.
> 
> Clearly the screenbuf is not the same.

Probably resize triggers in. But you are doing something wrong - do
you work with Linus tree or on the top of James work? Inside (and after)
do_update_region you should not have origin pointing to the VGA
framebuffer anymore, it must point to screenbuf area! Or do you
implement some strange set_origin method?
 
> the nredraw_screen is called, which calls again set_origin, and then calls 
> do_update_region as follows :
> 
> Jul 22 21:49:32 iliana kernel: SVEN : do_update_region : + start = -941350912, count = 3700
> 
> here we see that the screenbuf used is the wrongly set one, 
> not the one i copied the stuff to.

Only place which does realloc is vc_resize, and code here should
properly move data. 
 
> Mmm, i suppose that what happens is that the screenbuf is different 
> for fbcon and vgacon or something such, and this seems clearly the reason
> for lot of garbage appearing on my screen, is it not ?

I've got an idea: vc_resize reads data from vc's origin, unconditionally,
without call to save_screen! So if your framebuffer layout is not
compatible with VGA, you are lost. 
fbcon_init -> fbcon_setup -> vc_resize_con -> origin leaved unset...
Adding call to set_origin(currcons) into visual_init, just before
call to sw->con_init() may fix problem. Or maybe it will just make problem
even worse? Who knows?
                                                        Petr
                                                        


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

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Re: board with broken vga ...
@ 2002-07-22 17:54 Petr Vandrovec
  2002-07-22 19:58 ` Sven
  0 siblings, 1 reply; 11+ messages in thread
From: Petr Vandrovec @ 2002-07-22 17:54 UTC (permalink / raw)
  To: Sven; +Cc: linux-fbdev-devel

On 22 Jul 02 at 19:46, Sven wrote:
> PEtr wrote : 
> > thought that:
> >   take_over_console -> update_screen(x) -> redraw_screen(x,0) ->
> > (1) set vc_origin to vc_screenbuf in set_origin()
> > (2) paint picture through do_update_region() -> con_getxy, con_putcs
> > vc_screenbuf is accessed through screenbuf macro from console_macros.h.
> > It is very hard to find anything in console.c. I use simple rule:
> > all X variables you see in function are vc_X members of vt struct unless
> > you see definition of X on your screen.
> 
> Well, i did search for screenbuf and not vc_screenbuf, and i did find the macros.
> 
> I did not find any reference in anything excepth vgacon_switch and vgacon_save_screen.

drivers/char/console.c:set_origin(), vc_resize(), ...
 
> is vc_screenbuf still part of the framebuffer memory, i thought it was some other main memory, a ...

vc_screenbuf is alloc_bootmem() or kmalloc(if screen resize happens) memory.
vgacon uses its own vgacon_set_origin(), which sets vc_origin to
VGA framebuffer, while with fbcon it sets vc_origin to vc_screenbuf.

> BAsically, i am now sure that i copy the right data to the screenbuf (well for the character data, i just use empty attributes, is that ok for now ?, where can i find the attribute format ?).

scr_write() will take a care of byteswapping. If in 8bit characters,
upper 8 bits are attr, low 8 bits is character.

> But it seems the problem is when copying the stuff back to the screen that something goes wrong.
> 
> I suspect that it is not the correct data (the one in screenbuf) that is taken or something like that.

Just idea: force your fbdev to use same resolution as vgacon
(80x25, 640x400, or change vgacon resolution to 80x30 if your fbdev uses
640x480) so that vc_resize path is not triggered. It does some copying
too.
                                                            Petr
                                                            


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

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Re: board with broken vga ...
@ 2002-07-22 17:35 Petr Vandrovec
  2002-07-22 17:46 ` Sven
  0 siblings, 1 reply; 11+ messages in thread
From: Petr Vandrovec @ 2002-07-22 17:35 UTC (permalink / raw)
  To: Sven LUTHER; +Cc: linux-fbdev-devel

On 22 Jul 02 at 19:23, Sven LUTHER wrote:

> Petr wrote :
> > your drivers's init
> >    --> look and init devices
> >        --> call register_framebuffer
> >            --> VGACON reads contents of VGA buffer
> >            --> call to fbdev setvar
> >            --> upper layer restores screen
> > ...
> 
> Mmm, i did manage to override the vga save_screen function, and copy the
> good values into vc_sceenbuf, but to no avail.
> 
> What frustrates me is that i cannot find any reference to some piece of
> code using the data in vc_sceenbuf to write to the screen again.
> 
> How exactly does the upper layer restore the screen ?

I thought that:
  take_over_console -> update_screen(x) -> redraw_screen(x,0) ->
(1) set vc_origin to vc_screenbuf in set_origin()
(2) paint picture through do_update_region() -> con_getxy, con_putcs

vc_screenbuf is accessed through screenbuf macro from console_macros.h.
It is very hard to find anything in console.c. I use simple rule:
all X variables you see in function are vc_X members of vt struct unless
you see definition of X on your screen.
                                                    Petr Vandrovec
                                                    


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

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

end of thread, other threads:[~2002-07-23 14:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-22 21:07 Re: board with broken vga Petr Vandrovec
2002-07-22 21:10 ` Sven
2002-07-23 14:35 ` Sven LUTHER
  -- strict thread matches above, loose matches on Subject: below --
2002-07-22 20:45 Petr Vandrovec
2002-07-22 21:00 ` Sven
2002-07-22 20:18 Petr Vandrovec
2002-07-22 20:40 ` Sven
2002-07-22 17:54 Petr Vandrovec
2002-07-22 19:58 ` Sven
2002-07-22 17:35 Petr Vandrovec
2002-07-22 17:46 ` Sven

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