Skip to contentSkip to conversation

Some questions

DISCUSSION Applied Thomas Winischhofer 6 participants 93 messages Mar 5, 2003 – Mar 12, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

I am currently porting the SiS framebuffer driver to the - more or less
- new API. Better late than never :)

Anyway, during this, I noticed some issues: (I am using stock 2.5.63 for development, no fbdev patches)

1) Sisfb currently does not work if compiled statically into the kernel. (It works as a module if fbcon is a module, too). If sisfb and fbcon are the kernel, the mode switch occures but the only thing I see is a white rectangle at the left egde of the screen, vertically centered, with some flashing grey dots. I almost looks like text mode output while in graphics mode, or - better - if fbcon assumes a font size of 1 pixel. Finally, it seems to oops, but I can't say that for sure because I don't see anything (and I unfortunately don't have a serial console available).

Can anybody confirm that this (ie both low level driver and fbcon in kernel) is supposed to work in 2.5.63 (making it a bug in my sisfb implementation)? Did I perhaps miss anything, like a kernel parameter to activate fbcon or similar?

2) If both sisfb and fbcon are modules, everything works s supposed when first modprobing sisfb and then fbcon. Upon modprobing fbcon, the mode switch occures and I see a graphical console (with a white rectangle of the size of the previous console size which vanishes upon pressing enter).

However, I could not manage to gain a graphical console if sisfb is a module, but fbcon is in the kernel. Is this combination supposed to work? If so, how?

3) The resizing using stty is - how do I put this - slightly imperfect. I don't know how you fbdev folks do it, but I am not used to think in row/col categories, but *resolutions* instead. Apart from this - IMHO a bit annoying - inconvenience, this method has further issues:

a) Calculating the desired mode resolution my simply multiplying the rows/cols by the font size very often results in odd modes like 800x592. This even when using a standard 8x16 font, not thinking of situations where for instance 12x22 fonts are used. How is the low level driver supposed to handle this?

To temporarily overcome this, I implemented a somewhat fuzzy mode identification routine, searching for modes with resolutions within a range of [desired res] - [desired res + 16]. But I can't imagine this being the Real Thing.

b) The call to fb_set_var() inside fbcon_resize() is checked for errors, but not the call to fbcon_resize() from within fbcon_switch(). This leads to catastrophic drawing errors if the requested mode is not supported by the low level driver.

c) fbcon_resize() only changes var.xres and var.yres, leaving everything else - var.pixclock, for instance - alone. fb_set_var() just calles the driver's check_var() routine and then set_par(). How is the low level driver supposed to behave in this situation, especially considering the unchanged pixclock?

d) Starting with a mode of 1024x768 and resizing to 800x600 using stty works after all (see a)), but only if I execute stty twice. The desired mode the low level driver receives at the first attempt is 800x768. Could this be related to an outdated or buggy stty, calling the console code twice if rows and cols are specified at the same time...?

3) About y panning: In the 2.4 version of sisfb, I simply forced the console to do y panning (unless positively disabled by the user) by "patching" yres_virtual to the maximum, depending on the available video memory. I am allowed to do that with the 2.5 API? (The rivafb code makes be believe so...)

Thomas

Signature · 12 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#1 lore raw
Quoted 15 lines · Thomas Winischhofer

I am currently porting the SiS framebuffer driver to the - more or less
- new API. Better late than never :)

Anyway, during this, I noticed some issues: (I am using stock 2.5.63 for development, no fbdev patches)

1) Sisfb currently does not work if compiled statically into the kernel. (It works as a module if fbcon is a module, too). If sisfb and fbcon are the kernel, the mode switch occures but the only thing I see is a white rectangle at the left egde of the screen, vertically centered, with some flashing grey dots. I almost looks like text mode output while in graphics mode, or - better - if fbcon assumes a font size of 1 pixel. Finally, it seems to oops, but I can't say that for sure because I don't see anything (and I unfortunately don't have a serial console available).

Quoted 4 lines

Can anybody confirm that this (ie both low level driver and fbcon in kernel) is supposed to work in 2.5.63 (making it a bug in my sisfb implementation)? Did I perhaps miss anything, like a kernel parameter to activate fbcon or similar?

Yes, it it does work.

Quoted 5 lines

2) If both sisfb and fbcon are modules, everything works s supposed when first modprobing sisfb and then fbcon. Upon modprobing fbcon, the mode switch occures and I see a graphical console (with a white rectangle of the size of the previous console size which vanishes upon pressing enter).

Ideally, fbdev should only change the video mode on the first fb_open() or fb_set_par() and restore the state on the last fb_close(). This is so you can load fbdev without having a framebuffer console. If memory serves me correctly, that's how sisfb in 2.4 works?.

Quoted 4 lines

However, I could not manage to gain a graphical console if sisfb is a module, but fbcon is in the kernel. Is this combination supposed to work? If so, how?

No, fbcon will not load unless there's at least one registered fbdev. So, you must compile sisfb statically too.

Quoted 11 lines

3) The resizing using stty is - how do I put this - slightly imperfect. I don't know how you fbdev folks do it, but I am not used to think in row/col categories, but *resolutions* instead. Apart from this - IMHO a bit annoying - inconvenience, this method has further issues:

a) Calculating the desired mode resolution my simply multiplying the rows/cols by the font size very often results in odd modes like 800x592. This even when using a standard 8x16 font, not thinking of situations where for instance 12x22 fonts are used. How is the low level driver supposed to handle this?

Ideally, the driver should round up to the nearest mode it's capable of. The "fraction of a character dimensions" will be automatically cleared by the "clear_margins" hook.

Quoted 5 lines

To temporarily overcome this, I implemented a somewhat fuzzy mode identification routine, searching for modes with resolutions within a range of [desired res] - [desired res + 16]. But I can't imagine this being the Real Thing.

Yes, that's the Real Thing :-) fbcon_resize has a "fuzzy mode" too -- it won't do an fb_set_var() if the change in dimensions is only a fraction of a character's dimension.

Quoted 5 lines

b) The call to fb_set_var() inside fbcon_resize() is checked for errors, but not the call to fbcon_resize() from within fbcon_switch(). This leads to catastrophic drawing errors if the requested mode is not supported by the low level driver.

Yes, it's a bug. I think I submitted a patch to fix that, but I'm not sure if James applied it to his tree.

Quoted 7 lines

c) fbcon_resize() only changes var.xres and var.yres, leaving everything else - var.pixclock, for instance - alone. fb_set_var() just calles the driver's check_var() routine and then set_par(). How is the low level driver supposed to behave in this situation, especially considering the unchanged pixclock?

Right, using stty to change the window size assumes that the fbdev driver has an algorithm to calculate modelines based on xres and yres independently. This is probably a bit of work for most driver authors. There's new code in fbmon.c (fb_find_mode and fb_validate_mode) that should ease code writing if you have a VESA GTF compliant monitor. You can use that if you want as long as the display's operating limits are known (info->monspecs).

Another solution is to reimplement resizing by fbset. The code is not very difficult and can be added if most people want it.

Quoted 5 lines

d) Starting with a mode of 1024x768 and resizing to 800x600 using stty works after all (see a)), but only if I execute stty twice. The desired mode the low level driver receives at the first attempt is 800x768. Could this be related to an outdated or buggy stty, calling the console code twice if rows and cols are specified at the same time...?

Yes, this is a limitation of stty. It calls con_resize twice (one for row and another for cols, depending on the order of the options) so it will not work if the driver only supports a fixed set of modes. Another reason to bring back fbset resizing.

Quoted 6 lines

3) About y panning: In the 2.4 version of sisfb, I simply forced the console to do y panning (unless positively disabled by the user) by "patching" yres_virtual to the maximum, depending on the available video memory. I am allowed to do that with the 2.5 API? (The rivafb code makes be believe so...)

Scrolling mode is now determined by fbcon. If var->accel_flag is nonzero, scrolling is ypan, otherwise, it's yredraw. It's because ypan requres a lot of block copy which is slow when done by software.

I still believe though that scrolling should be determined by the driver, not fbcon.

Tony

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

#2 lore raw
Quoted 6 lines · Antonino Daplas
Quoted 4 lines

Can anybody confirm that this (ie both low level driver and fbcon in kernel) is supposed to work in 2.5.63 (making it a bug in my sisfb implementation)? Did I perhaps miss anything, like a kernel parameter to activate fbcon or similar?

Yes, it it does work.

OK, now it works here, too. Seems my debug-printks during initialisation made the kernel go bananas. As soon as I removed them, it walks along...

But I noticed another issue here:

When switching to gfx mode during boot (ie as soon as the penguin appears), the text console is aligned correctly at all edges, with all lines visible.

But when "initial console" starts, the mode is again changed, and now the last line of text is nearly invisible, its upper half appears at the lower screen edge, the lower half is below the screen's edge. The space between the penguin and the text is notably thicker.

This can be recovered by switching to another VT and back. This makes the penguin disappear, and restores the console dimensions/edges to normal.

Interestingly, this only happens with 800x600; this mode is chosen upon requesting 800x592 (because of the font size). At 1024x768, everything is as it should.

Quoted 6 lines
Quoted 3 lines

However, I could not manage to gain a graphical console if sisfb is a module, but fbcon is in the kernel. Is this combination supposed to work? If so, how?

No, fbcon will not load unless there's at least one registered fbdev. So, you must compile sisfb statically too.

Then this should definitely go into the kernel config rules, I guess :)

Quoted 9 lines
Quoted 5 lines

a) Calculating the desired mode resolution my simply multiplying the rows/cols by the font size very often results in odd modes like 800x592. This even when using a standard 8x16 font, not thinking of situations where for instance 12x22 fonts are used. How is the low level driver supposed to handle this?

Ideally, the driver should round up to the nearest mode it's capable of. The "fraction of a character dimensions" will be automatically cleared by the "clear_margins" hook.

OK, that's exactly what I do now. I currently tend to the assumption that this mode should be larger than the requested one...?

Quoted 8 lines
Quoted 4 lines

To temporarily overcome this, I implemented a somewhat fuzzy mode identification routine, searching for modes with resolutions within a range of [desired res] - [desired res + 16]. But I can't imagine this being the Real Thing.

Yes, that's the Real Thing :-) fbcon_resize has a "fuzzy mode" too -- it won't do an fb_set_var() if the change in dimensions is only a fraction of a character's dimension.

Ack. Is 16 fuzzy enough, what do you think?

Quoted 3 lines

Right, using stty to change the window size assumes that the fbdev driver has an algorithm to calculate modelines based on xres and yres independently. This is probably a bit of work for most driver authors.

Well, not as much work as more a lack of definition. If the user specified a default of 800x600-75 I can't simply assume he also wants 1024x768-75.

Quoted 4 lines

There's new code in fbmon.c (fb_find_mode and fb_validate_mode) that should ease code writing if you have a VESA GTF compliant monitor. You can use that if you want as long as the display's operating limits are known (info->monspecs).

Well, this assumes that the user always want the best refresh rate, which is not desired in all cases.

Quoted 2 lines

Another solution is to reimplement resizing by fbset. The code is not very difficult and can be added if most people want it.

Awaiting public demand :)

Quoted 4 lines

Yes, this is a limitation of stty. It calls con_resize twice (one for row and another for cols, depending on the order of the options) so it will not work if the driver only supports a fixed set of modes. Another reason to bring back fbset resizing.

Think so, too. That's a really stupid behavior otherwise, since it involves two mode changes, with one really undesired mode on the way.

Quoted 6 lines

Scrolling mode is now determined by fbcon. If var->accel_flag is nonzero, scrolling is ypan, otherwise, it's yredraw. It's because ypan requres a lot of block copy which is slow when done by software.

I still believe though that scrolling should be determined by the driver, not fbcon.

Well, what should I do now?

The rivafb only forces y panning (ie sets yres_virtual to maximum) if yres_virtual is -1. This is never the case, as default var is constantly reused and I nowhere saw that any of the res_virtuals was set to -1.

Thomas

Signature · 12 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#3 lore raw
Quoted 9 lines · Thomas Winischhofer
Quoted 6 lines
Quoted 3 lines

However, I could not manage to gain a graphical console if sisfb is a module, but fbcon is in the kernel. Is this combination supposed to work? If so, how?

No, fbcon will not load unless there's at least one registered fbdev. So, you must compile sisfb statically too.

Then this should definitely go into the kernel config rules, I guess :)

I think so, except that fbcon will depend on so many drivers that no one has the patience to add that to Kconfig yet :-)

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

a) Calculating the desired mode resolution my simply multiplying the rows/cols by the font size very often results in odd modes like 800x592. This even when using a standard 8x16 font, not thinking of situations where for instance 12x22 fonts are used. How is the low level driver supposed to handle this?

Quoted 6 lines
Quoted 3 lines

Ideally, the driver should round up to the nearest mode it's capable of. The "fraction of a character dimensions" will be automatically cleared by the "clear_margins" hook.

OK, that's exactly what I do now. I currently tend to the assumption that this mode should be larger than the requested one...?

Yes. If it's smaller, it unconditionally calls fb_set_var(), I think.

Quoted 11 lines
Quoted 9 lines
Quoted 5 lines

To temporarily overcome this, I implemented a somewhat fuzzy mode identification routine, searching for modes with resolutions within a range of [desired res] - [desired res + 16]. But I can't imagine this being the Real Thing.

Yes, that's the Real Thing :-) fbcon_resize has a "fuzzy mode" too -- it won't do an fb_set_var() if the change in dimensions is only a fraction of a character's dimension.

Ack. Is 16 fuzzy enough, what do you think?

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

Quoted 9 lines
Quoted 4 lines

Right, using stty to change the window size assumes that the fbdev driver has an algorithm to calculate modelines based on xres and yres independently. This is probably a bit of work for most driver authors.

Well, not as much work as more a lack of definition. If the user specified a default of 800x600-75 I can't simply assume he also wants 1024x768-75.

Quoted 8 lines
Quoted 4 lines

There's new code in fbmon.c (fb_find_mode and fb_validate_mode) that should ease code writing if you have a VESA GTF compliant monitor. You can use that if you want as long as the display's operating limits are known (info->monspecs).

Well, this assumes that the user always want the best refresh rate, which is not desired in all cases.

fb_get_mode() accepts 4 flags. Maximum refresh rate, hscan-driven, vrefresh-driven and dotclock-driven calculations. It's flexible enough, but of course not as flexible as specifying your own modeline.

Quoted 18 lines
Quoted 2 lines

Another solution is to reimplement resizing by fbset. The code is not very difficult and can be added if most people want it.

Awaiting public demand :)

Quoted 4 lines

Yes, this is a limitation of stty. It calls con_resize twice (one for row and another for cols, depending on the order of the options) so it will not work if the driver only supports a fixed set of modes. Another reason to bring back fbset resizing.

Think so, too. That's a really stupid behavior otherwise, since it involves two mode changes, with one really undesired mode on the way.

Quoted 4 lines

Scrolling mode is now determined by fbcon. If var->accel_flag is nonzero, scrolling is ypan, otherwise, it's yredraw. It's because ypan requres a lot of block copy which is slow when done by software.

Quoted 9 lines
Quoted 2 lines

I still believe though that scrolling should be determined by the driver, not fbcon.

Well, what should I do now?

The rivafb only forces y panning (ie sets yres_virtual to maximum) if yres_virtual is -1. This is never the case, as default var is constantly reused and I nowhere saw that any of the res_virtuals was set to -1.

For now, maximize yres_virtual, then set info->var.accel_flag to 1. It wouldn't work until fbset support is reimplemented again, unless you boot directly to that configuration.

I'll wait a few more days in hope of hearing from more people before submitting a patch.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#4 lore raw
Quoted 6 lines · Antonino Daplas
Quoted 1 line

Ack. Is 16 fuzzy enough, what do you think?

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

How do I - from a low level fb driver - determine the character size?

Quoted 10 lines
Quoted 7 lines
Quoted 2 lines

I still believe though that scrolling should be determined by the driver, not fbcon.

Well, what should I do now?

The rivafb only forces y panning (ie sets yres_virtual to maximum) if yres_virtual is -1. This is never the case, as default var is constantly reused and I nowhere saw that any of the res_virtuals was set to -1.

For now, maximize yres_virtual, then set info->var.accel_flag to 1.

That's what I do.

(shifted boot screen)

Quoted 9 lines
Quoted 4 lines

I am almost sure that this has to do with the fact that I adapt var in my check_var from 800x592 to 800x600. Console (or whoever) seems to attempt to change the mode to its initially desired dimension on many occasions.

Strange. If you boot at 800x600, the console will compute that as 100x37. On fbcon_resize, it will request 800x592 but because the difference is only 8, fb_set_var should be skipped, so no mode change should happen throughout.

But it definitely does. I can see this on my LCD (which goes dark during mode changes) and, of course, the log.

Quoted 4 lines

I have no idea. I booted with other drivers at 800x600 and get no ill effects. I get a margin at the bottom of 8 pixels.

How about checking what the offsets are during fb_pan_display()?

Done that. Nothing special; The penguin is where it should be, but the text below starts 8 lines too low.

Thomas

Signature · 10 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#5 lore raw
Quoted 7 lines · Thomas Winischhofer
Quoted 4 lines · Antonino Daplas
Quoted 1 line

Ack. Is 16 fuzzy enough, what do you think?

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

How do I - from a low level fb driver - determine the character size?

You cannot. That's called fbcon-fbdev separation.

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

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#6 lore raw
Quoted 6 lines · Geert Uytterhoeven
Quoted 4 lines · Thomas Winischhofer
Quoted 2 lines · Antonino Daplas
Quoted 1 line

Ack. Is 16 fuzzy enough, what do you think?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

How do I - from a low level fb driver - determine the character size?

You cannot. That's called fbcon-fbdev separation.

My question was, basically, meant ironic.

But this is funny: You tell me that the difference should not exceed the fraction of a character, but it is impossible to find out how wide/tall characters are.

Guys, that won't work. I have to deal with LCD displays and TV output as well (not to say "mainly") and I can't just set up odd modes like 800x592, or mode resolutions based on calculations with any possible odd font dimension.

Thomas

Signature · 10 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#7 lore raw
Quoted 16 lines · Thomas Winischhofer
Quoted 4 lines · Geert Uytterhoeven
Quoted 3 lines · Thomas Winischhofer
Quoted 2 lines · Antonino Daplas
Quoted 1 line

Ack. Is 16 fuzzy enough, what do you think?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

How do I - from a low level fb driver - determine the character size?

You cannot. That's called fbcon-fbdev separation.

My question was, basically, meant ironic.

Quoted 8 lines

But this is funny: You tell me that the difference should not exceed the fraction of a character, but it is impossible to find out how wide/tall characters are.

Guys, that won't work. I have to deal with LCD displays and TV output as well (not to say "mainly") and I can't just set up odd modes like 800x592, or mode resolutions based on calculations with any possible odd font dimension.

Indeed. That's why fbcon should adapt to fbdev, and not vice versa (IMHO).

I've always been a bit skeptical about the fbcon-driven fbdev-resizing... I don't mind that you change the resolution or fontsize, but it should not influence the fbdev too much.

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

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#8 lore raw
In reply to Thomas Winischhofer
Quoted 18 lines · Thomas Winischhofer
Quoted 6 lines · Geert Uytterhoeven
Quoted 4 lines · Thomas Winischhofer
Quoted 2 lines · Antonino Daplas
Quoted 1 line

Ack. Is 16 fuzzy enough, what do you think?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

How do I - from a low level fb driver - determine the character size?

You cannot. That's called fbcon-fbdev separation.

My question was, basically, meant ironic.

Quoted 9 lines

But this is funny: You tell me that the difference should not exceed the fraction of a character, but it is impossible to find out how wide/tall characters are.

Guys, that won't work. I have to deal with LCD displays and TV output as well (not to say "mainly") and I can't just set up odd modes like 800x592, or mode resolutions based on calculations with any possible odd font dimension.

Yes, using stty is indeed limited. This was implemented because midway during development, when fbdev was completely separated from fbcon, there was no way to resize the window at all. The first solution was to use stty, better it than none at all. It did confuse a lot of people, especially since not all drivers support changing the resolution without help from the user.

Anyway, I have already brought fbset support back in my local copy :-) As I've mentioned, I'll just wait for more replies to the "Feature Freeze?" thread, and I'll submit a test patch.

Tony

Quoted 20 lines

Thomas

Signature · 17 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Linux-fbdev-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#9 lore raw
In reply to Thomas Winischhofer
Quoted 14 lines · Thomas Winischhofer

(shifted boot screen)

Quoted 9 lines
Quoted 4 lines

I am almost sure that this has to do with the fact that I adapt var in my check_var from 800x592 to 800x600. Console (or whoever) seems to attempt to change the mode to its initially desired dimension on many occasions.

Strange. If you boot at 800x600, the console will compute that as 100x37. On fbcon_resize, it will request 800x592 but because the difference is only 8, fb_set_var should be skipped, so no mode change should happen throughout.

But it definitely does. I can see this on my LCD (which goes dark during mode changes) and, of course, the log.

Quoted 8 lines
Quoted 4 lines

I have no idea. I booted with other drivers at 800x600 and get no ill effects. I get a margin at the bottom of 8 pixels.

How about checking what the offsets are during fb_pan_display()?

Done that. Nothing special; The penguin is where it should be, but the text below starts 8 lines too low.

How about removing fbcon_resize() from fbcon_switch()? This should at least give you an idea where the problem is (fbcon_resize, or somewhere else)

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#10 lore raw
Quoted 6 lines · Antonino Daplas
Quoted 6 lines
Quoted 4 lines

Strange. If you boot at 800x600, the console will compute that as 100x37. On fbcon_resize, it will request 800x592 but because the difference is only 8, fb_set_var should be skipped, so no mode change should happen throughout.

But it definitely does. I can see this on my LCD (which goes dark during mode changes) and, of course, the log.

Just check this with the newest versions from fbdev at bk. In my code (which is, as I said in the beginning, the stock 2.5.63 kernel), fbcon_resize does NO check whatsoever. It stupidly calls set_var().

I think that might be one reason for what I see :)

Now for a plain dumb question: Is there a patch available to update my kernel tree to the latest fbdev stuff? (I don't intend to spend much time with bk)

Thomas

Signature · 10 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#11 lore raw
Quoted 6 lines · Thomas Winischhofer
Quoted 5 lines · Antonino Daplas
Quoted 5 lines
Quoted 4 lines

Strange. If you boot at 800x600, the console will compute that as 100x37. On fbcon_resize, it will request 800x592 but because the difference is only 8, fb_set_var should be skipped, so no mode change should happen throughout.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

But it definitely does. I can see this on my LCD (which goes dark during mode changes) and, of course, the log.

Just check this with the newest versions from fbdev at bk. In my code (which is, as I said in the beginning, the stock 2.5.63 kernel), fbcon_resize does NO check whatsoever. It stupidly calls set_var().

Of course. My tree is so modified that I forgot that Jame's latest patch was not yet applied to the main tree :-)

Quoted 2 lines

I think that might be one reason for what I see :)

http://phoenix.infradead.org/~jsimmons/fbdev.diff.gz

Note that there is still a bug in fbcon_resize().

1. in fbcon_resize(), p->vrows must be updated unconditionally

2. fbcon_resize() in fbcon_switch() must be moved higher up the code, preferably before the scroll_phys_max calculation.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#12 lore raw
Quoted 14 lines · Antonino Daplas
Quoted 6 lines · Thomas Winischhofer
Quoted 5 lines · Antonino Daplas
Quoted 5 lines
Quoted 4 lines

Strange. If you boot at 800x600, the console will compute that as 100x37. On fbcon_resize, it will request 800x592 but because the difference is only 8, fb_set_var should be skipped, so no mode change should happen throughout.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

But it definitely does. I can see this on my LCD (which goes dark during mode changes) and, of course, the log.

Just check this with the newest versions from fbdev at bk. In my code (which is, as I said in the beginning, the stock 2.5.63 kernel), fbcon_resize does NO check whatsoever. It stupidly calls set_var().

Quoted 6 lines

Of course. My tree is so modified that I forgot that Jame's latest patch was not yet applied to the main tree :-)

Quoted 2 lines

I think that might be one reason for what I see :)

http://phoenix.infradead.org/~jsimmons/fbdev.diff.gz

Note that this patch is dated Feb 20. In the mean time James applied at least your accel_putcs() optimizations and my logo updates.

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

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#13 lore raw
Quoted 5 lines
Quoted 2 lines

http://phoenix.infradead.org/~jsimmons/fbdev.diff.gz

Note that this patch is dated Feb 20. In the mean time James applied at least your accel_putcs() optimizations and my logo updates.

Please note I just release a new patch. Please try it out.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#14 lore raw
In reply to Antonino Daplas
Quoted 8 lines
Quoted 2 lines

I think that might be one reason for what I see :)

http://phoenix.infradead.org/~jsimmons/fbdev.diff.gz

Note that there is still a bug in fbcon_resize().

1. in fbcon_resize(), p->vrows must be updated unconditionally

Applied in latest patch.

Quoted 2 lines

2. fbcon_resize() in fbcon_switch() must be moved higher up the code, preferably before the scroll_phys_max calculation.

Do you have a patch?

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#15 lore raw
In reply to Antonino Daplas
Quoted 10 lines · Antonino Daplas
Quoted 5 lines · Thomas Winischhofer
Quoted 3 lines

Yes, that's the Real Thing :-) fbcon_resize has a "fuzzy mode" too -- it won't do an fb_set_var() if the change in dimensions is only a fraction of a character's dimension.

Ack. Is 16 fuzzy enough, what do you think?

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

Indeed, accel_clear_margins() calculates the margins as

    unsigned int cw = vc->vc_font.width;
    unsigned int ch = vc->vc_font.height;
    unsigned int rw = info->var.xres % cw;
    unsigned int bh = info->var.yres % ch;

However, if it would use

    unsigned int rw = info->var.xres - (vc->vc_cols*cw);
    unsigned int bh = info->var.yres - (vc->vc_rows*ch);

it would work with higher differences, too. And it would be a bit faster (multiply and subtract vs. modulo).

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

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#16 lore raw
Quoted 19 lines · Geert Uytterhoeven
Quoted 10 lines · Antonino Daplas
Quoted 5 lines · Thomas Winischhofer
Quoted 3 lines

Yes, that's the Real Thing :-) fbcon_resize has a "fuzzy mode" too -- it won't do an fb_set_var() if the change in dimensions is only a fraction of a character's dimension.

Ack. Is 16 fuzzy enough, what do you think?

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

Indeed, accel_clear_margins() calculates the margins as

    unsigned int cw = vc->vc_font.width;
    unsigned int ch = vc->vc_font.height;
    unsigned int rw = info->var.xres % cw;
    unsigned int bh = info->var.yres % ch;
Quoted 8 lines

However, if it would use

    unsigned int rw = info->var.xres - (vc->vc_cols*cw);
    unsigned int bh = info->var.yres - (vc->vc_rows*ch);

it would work with higher differences, too. And it would be a bit faster (multiply and subtract vs. modulo).

Yes, I believe so. This way, it will make rounding off of values more clear cut and still produce an acceptable display (albeit with possibly wider margins).

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#17 lore raw
In reply to Geert Uytterhoeven
Quoted 8 lines

Indeed, accel_clear_margins() calculates the margins as

    unsigned int cw = vc->vc_font.width;
    unsigned int ch = vc->vc_font.height;
    unsigned int rw = info->var.xres % cw;
    unsigned int bh = info->var.yres % ch;
Quoted 7 lines

However, if it would use

    unsigned int rw = info->var.xres - (vc->vc_cols*cw);
    unsigned int bh = info->var.yres - (vc->vc_rows*ch);

it would work with higher differences, too. And it would be a bit faster (multiply and subtract vs. modulo).

Applied.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#18 lore raw
In reply to Antonino Daplas
Quoted 11 lines · Antonino Daplas
Quoted 6 lines
Quoted 4 lines

Yes, that's the Real Thing :-) fbcon_resize has a "fuzzy mode" too -- it won't do an fb_set_var() if the change in dimensions is only a fraction of a character's dimension.

Ack. Is 16 fuzzy enough, what do you think?

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

I apologize for my stupidity, fbdev does not know the font dimensions. I guess, we'll just need to really bring back fbset resizing.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#19 lore raw
Quoted 8 lines
Quoted 5 lines

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

I apologize for my stupidity, fbdev does not know the font dimensions. I guess, we'll just need to really bring back fbset resizing.

I disagree that fbset is the solution to all things. The problem is fbcon_resize is severally broken. The reality is that there are fixed mode resolutions (i.e. LCD displays). So fbcon has to adpat to this. What we shoudl do is set the console mode fit slightly smaller than that the actually resolution. The reason being is partially drawn fonts at the bottom of the screen would look bad. So clearing the margins also has to be fixed. This way we clean up the screen for situtations where the console screen size doesn't quite fit the resolution. This is what shoudl be done.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#20 lore raw
Quoted 1 line · James Simmons

I disagree that fbset is the solution to all things. The problem is fbcon_resize is severally broken. The reality is that there are fixed mode resolutions (i.e. LCD displays). So fbcon has to adpat to this. What we shoudl do is set the console mode fit slightly smaller than that the actually resolution. The reason being is partially drawn fonts at the bottom of the screen would look bad. So clearing the margins also has to be fixed. This way we clean up the screen for situtations where the console screen size doesn't quite fit the resolution. This is what shoudl be done.

Excuse me that I dare to comment on this as a total fbdev-rookie:

Please think about usability, too. Forcing people to fiddle with rows and cols, requiring knowledge about font sizes and stuff is at least inappropriate. Folks are used to think in resolutions, that's what they understand, and that's what is most obvious. I can't imagine anyone caring about the amount of rows or columns on a text screen.

BTW: What happens currently if I instruct console to replace the current font with a bigger one (if that's possible at run-time at all) ?

Thomas

Signature · 8 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#21 lore raw
Quoted 2 lines

Excuse me that I dare to comment on this as a total fbdev-rookie:

No problem. Its rare I take things personally. So I don't mind people critizing my work. You have to have a thick skin for this line of work.

Quoted 5 lines

Please think about usability, too. Forcing people to fiddle with rows and cols, requiring knowledge about font sizes and stuff is at least inappropriate. Folks are used to think in resolutions, that's what they understand, and that's what is most obvious. I can't imagine anyone caring about the amount of rows or columns on a text screen.

Actually it is normal. Changing a console via stty has been around forever. When you ask what size is your VGA console you say 80x25. Now why is that. The main thing is people think of it as a text mode and second you really can't change it or boot to to many different size resolutions. Does this mean VGA console should be limited? NO!!! I plan to make vgacon some day changable in window size. So the final answer is:

Portablity.

You could use stty or some other program using the tty layer to change the resolution on any type of hardware running any type of console driver. The next best thing is some day we can get ride of con_switch in the upper console layers. We can just use set_font and vc_resize on VT switching since that is all you are doing on vc_switching.

P.S
If you look at struct winsize you have a ws_xpixel and a ws_ypixel
field. The question is now do we place the exact size of the screen in pixels or vc->font.width[height]*width[height]. So it is stty program that is limiting and not the tty layer. In theory you could write fbset to use the proper tty ioctl to do this.

Quoted 2 lines

BTW: What happens currently if I instruct console to replace the current font with a bigger one (if that's possible at run-time at all) ?

It should work.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#22 lore raw
Quoted 7 lines · James Simmons

Actually it is normal. Changing a console via stty has been around forever. When you ask what size is your VGA console you say 80x25. Now why is that. The main thing is people think of it as a text mode and second you really can't change it or boot to to many different size resolutions.
Does this mean VGA console should be limited? NO!!! I plan to make vgacon some day changable in window size. So the final answer is:

Portablity.

You could use stty or some other program using the tty layer to change the resolution on any type of hardware running any type of console driver. The next best thing is some day we can get ride of con_switch in the upper console layers. We can just use set_font and vc_resize on VT switching since that is all you are doing on vc_switching.

OK, if this is your final word on this, I - as the maintainer of a driver which due to LCD and TV handling only supports a (huge) number of built-in modes - am forced to do the following:

If I receive a request for a mode that isn't supported, I go with the next larger one that is supported. Even if that leads to differences from requested 813x601 to displayed 1024x768.

Hope you and your console code can deal with that then :)

Quoted 4 lines
Quoted 1 line

BTW: What happens currently if I instruct console to replace the current font with a bigger one (if that's possible at run-time at all) ?

It should work.

... and lead to a mode switch? Funny: If I switch from a 8x16 font to a bigger one, because I forgot my glasses, the mode is switched to a higher one, because the number of cols and rows hasn't changed, leaving me with a nearly identical charcter size?

Thomas

Signature · 10 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#23 lore raw
In reply to Thomas Winischhofer
Quoted 11 lines · Thomas Winischhofer
Quoted 9 lines · James Simmons

I disagree that fbset is the solution to all things. The problem is fbcon_resize is severally broken. The reality is that there are fixed mode resolutions (i.e. LCD displays). So fbcon has to adpat to this. What we shoudl do is set the console mode fit slightly smaller than that the actually resolution. The reason being is partially drawn fonts at the bottom of the screen would look bad. So clearing the margins also has to be fixed. This way we clean up the screen for situtations where the console screen size doesn't quite fit the resolution. This is what shoudl be done.

Quoted 8 lines

Excuse me that I dare to comment on this as a total fbdev-rookie:

Please think about usability, too. Forcing people to fiddle with rows and cols, requiring knowledge about font sizes and stuff is at least inappropriate. Folks are used to think in resolutions, that's what they understand, and that's what is most obvious. I can't imagine anyone caring about the amount of rows or columns on a text screen.

If you are working in a console, then you indeed need to work on rows and columns.

Quoted 2 lines

BTW: What happens currently if I instruct console to replace the current font with a bigger one (if that's possible at run-time at all) ?

It will work, as the rows and columns are recalculated.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#24 lore raw
In reply to James Simmons
Quoted 11 lines · James Simmons
Quoted 8 lines
Quoted 5 lines

I think you should only accept modes where the difference is a fraction of a character width or height. A difference more than that and clear_margins() will not work correctly.

I apologize for my stupidity, fbdev does not know the font dimensions. I guess, we'll just need to really bring back fbset resizing.

I disagree that fbset is the solution to all things. The problem is fbcon_resize is severally broken. The reality is that there are fixed mode

fbcon_resize() is not that broken, it's only trying to do what it's supposed to do. It is indeed limited because it is trying to outguess the low-level drivers on the best resolution for a window size.

However, the brokenness is really on the driver side. They are unable to change the video mode unless they are supplied with the correct timing parameters where in fact they actually have the best knowledge on how to calculate them.

So the question: Do we let fbcon spoonfeed the timings to fbdev, or do we let the drivers calculate it for themselves? I go for the latter, as fbcon really should not have any business with hardware.

Quoted 3 lines

resolutions (i.e. LCD displays). So fbcon has to adpat to this. What we shoudl do is set the console mode fit slightly smaller than that the actually resolution. The reason being is partially drawn fonts at the

Yes, Geert's accel_clear_margin fix should help that.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#25 lore raw
Quoted 8 lines · Antonino Daplas

fbcon_resize() is not that broken, it's only trying to do what it's supposed to do. It is indeed limited because it is trying to outguess the low-level drivers on the best resolution for a window size.

However, the brokenness is really on the driver side. They are unable to change the video mode unless they are supplied with the correct timing parameters where in fact they actually have the best knowledge on how to calculate them.

Yes, BUT ONLY IF the driver has enough parameters to calculate it. This requires at least x and y dimension AND A CLOCK (or a vertical refresh rate, which I would prefer).

The driver is supposed to handle the "var"s it's fed. If that var is like the ones that result from the current fbcon_resize, namely with a new x and y res, but no valid clock, how on earth should the driver do this then? It receives a var which looks correct, and in fact, *could* be correct sometimes:

Suppose we have another application, say DirectFB, feeding the low level drivers with complete and correct "var"s.

In both cases we have valid x any y resultions, and a non-zero clock field.

Should we then let the driver read the x and y resolution and forget about the rest of that var? I hardly think that's what the public var is for. It could be reduced to a struct { USHORT xres, USHORT yres } then.

Quoted 3 lines

So the question: Do we let fbcon spoonfeed the timings to fbdev, or do we let the drivers calculate it for themselves? I go for the latter, as fbcon really should not have any business with hardware.

What about the following solution: What if fbcon_resize sets the clock in the var to 0? We could use this to force low level drivers to decide on the clock for themselves. Otherwise, ie if the clock field is non-zero, they are supposed to take it as the desired clock.

Thomas

Signature · 10 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#26 lore raw
Quoted 29 lines · Thomas Winischhofer
Quoted 8 lines · Antonino Daplas

fbcon_resize() is not that broken, it's only trying to do what it's supposed to do. It is indeed limited because it is trying to outguess the low-level drivers on the best resolution for a window size.

However, the brokenness is really on the driver side. They are unable to change the video mode unless they are supplied with the correct timing parameters where in fact they actually have the best knowledge on how to calculate them.

Yes, BUT ONLY IF the driver has enough parameters to calculate it. This requires at least x and y dimension AND A CLOCK (or a vertical refresh rate, which I would prefer).

The driver is supposed to handle the "var"s it's fed. If that var is like the ones that result from the current fbcon_resize, namely with a new x and y res, but no valid clock, how on earth should the driver do this then? It receives a var which looks correct, and in fact, *could* be correct sometimes:

Suppose we have another application, say DirectFB, feeding the low level drivers with complete and correct "var"s.

In both cases we have valid x any y resultions, and a non-zero clock field.

Should we then let the driver read the x and y resolution and forget about the rest of that var? I hardly think that's what the public var is for. It could be reduced to a struct { USHORT xres, USHORT yres } then.

Quoted 8 lines
Quoted 3 lines

So the question: Do we let fbcon spoonfeed the timings to fbdev, or do we let the drivers calculate it for themselves? I go for the latter, as fbcon really should not have any business with hardware.

What about the following solution: What if fbcon_resize sets the clock in the var to 0? We could use this to force low level drivers to decide on the clock for themselves. Otherwise, ie if the clock field is non-zero, they are supposed to take it as the desired clock.

What if fbcon implements a text console _on top of_ fbdev? I.e. it uses the current resolution?

If you use stty to change the number of cols/rows, or change the font, or use fbset, your text console may end up being smaller or larger than the real screen size, in which case margins are cleared, or columns/lines are lost. (Optionally, we can center the text console if it's smaller than the real
screen size.)

IMHO this is the most orthogonal approach. Fbcon takes care of the text console, fbdev takes care of the graphics hardware and the video mode. Both parts do (try to) not influence each other.

Optionally, fbset can call stty to change the number of cols/rows, if the user wants that.

What do you think?

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

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#27 lore raw
Quoted 10 lines · Geert Uytterhoeven

What if fbcon implements a text console _on top of_ fbdev? I.e. it uses the current resolution?

If you use stty to change the number of cols/rows, or change the font, or use fbset, your text console may end up being smaller or larger than the real screen size, in which case margins are cleared, or columns/lines are lost. (Optionally, we can center the text console if it's smaller than the real
screen size.)

Which is basically what stty does for the standard console (except that lines are not lost, but wrapped, and margins are not cleared).

So, we need to reimplement the clipping code.

Quoted 7 lines

IMHO this is the most orthogonal approach. Fbcon takes care of the text console, fbdev takes care of the graphics hardware and the video mode. Both parts do (try to) not influence each other.

Optionally, fbset can call stty to change the number of cols/rows, if the user wants that.

Or even a simple script that basically does "fbset 1024x768-60 && stty cols 128 rows 48". Of course, adding this to fbset itself will make it transparent to the user.

Sounds very logical to me :-)

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#28 lore raw
Quoted 11 lines · Antonino Daplas
Quoted 9 lines · Geert Uytterhoeven

What if fbcon implements a text console _on top of_ fbdev? I.e. it uses the current resolution?

If you use stty to change the number of cols/rows, or change the font, or use fbset, your text console may end up being smaller or larger than the real screen size, in which case margins are cleared, or columns/lines are lost. (Optionally, we can center the text console if it's smaller than the real
screen size.)

Quoted 4 lines

Which is basically what stty does for the standard console (except that lines are not lost, but wrapped, and margins are not cleared).

So, we need to reimplement the clipping code.

In fbcon, I hope?

Quoted 4 lines
Quoted 4 lines

IMHO this is the most orthogonal approach. Fbcon takes care of the text console, fbdev takes care of the graphics hardware and the video mode. Both parts do (try to) not influence each other.

Quoted 8 lines
Quoted 2 lines

Optionally, fbset can call stty to change the number of cols/rows, if the user wants that.

Or even a simple script that basically does "fbset 1024x768-60 && stty cols 128 rows 48". Of course, adding this to fbset itself will make it transparent to the user.

Sounds very logical to me :-)

Yep ;-)

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

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#29 lore raw
Quoted 12 lines · Geert Uytterhoeven
Quoted 11 lines · Antonino Daplas
Quoted 9 lines · Geert Uytterhoeven

What if fbcon implements a text console _on top of_ fbdev? I.e. it uses the current resolution?

If you use stty to change the number of cols/rows, or change the font, or use fbset, your text console may end up being smaller or larger than the real screen size, in which case margins are cleared, or columns/lines are lost. (Optionally, we can center the text console if it's smaller than the real
screen size.)

Quoted 7 lines
Quoted 4 lines

Which is basically what stty does for the standard console (except that lines are not lost, but wrapped, and margins are not cleared).

So, we need to reimplement the clipping code.

In fbcon, I hope?

Yes, it's easier to do this in fbcon.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#30 lore raw
In reply to Thomas Winischhofer
Quoted 5 lines · Thomas Winischhofer
Quoted 4 lines · Antonino Daplas

fbcon_resize() is not that broken, it's only trying to do what it's supposed to do. It is indeed limited because it is trying to outguess the low-level drivers on the best resolution for a window size.

Quoted 8 lines
Quoted 4 lines

However, the brokenness is really on the driver side. They are unable to change the video mode unless they are supplied with the correct timing parameters where in fact they actually have the best knowledge on how to calculate them.

Yes, BUT ONLY IF the driver has enough parameters to calculate it. This requires at least x and y dimension AND A CLOCK (or a vertical refresh rate, which I would prefer).

The VESA GTF can calculate timings using only xres, yres and any of the three...

1. desired pixelclock
2. desired refresh
3. desired hsync

... all of which can be chosen by the driver, or extracted from the monitor (ie. DDC or uploaded by the user).

For non-GTF compatible monitors, you can choose any of the standard timings table.

Quoted 7 lines

The driver is supposed to handle the "var"s it's fed. If that var is like the ones that result from the current fbcon_resize, namely with a new x and y res, but no valid clock, how on earth should the driver do this then? It receives a var which looks correct, and in fact, *could* be correct sometimes:

Mode checking is not simply looking at xres and yres, but also looking at htotal, and vtotal to derive hsync, vsync and pixelclock. These are then compared to the monitor/graphics card's capability. If any of the values fall outside the limits then the mode is not valid. Otherwise, the new mode should still produce a usable display, perhaps not the one the user wants (ie refresh rate is lower). By this time though, the user can freely use fbset to fine tune all the timings.

For fixed-frequency monitors or analog TV (where timings are critical), you can use very strict operating limits (like vsync_min = 60 and vsync_max = 60). With strict limits, it's unlikely that the new timings will be valid, so the driver will always be forced to calculate a new mode.

Quoted 9 lines

Suppose we have another application, say DirectFB, feeding the low level drivers with complete and correct "var"s.

In both cases we have valid x any y resultions, and a non-zero clock field.

Should we then let the driver read the x and y resolution and forget about the rest of that var? I hardly think that's what the public var is for. It could be reduced to a struct { USHORT xres, USHORT yres } then.

Quoted 9 lines
Quoted 3 lines

So the question: Do we let fbcon spoonfeed the timings to fbdev, or do we let the drivers calculate it for themselves? I go for the latter, as fbcon really should not have any business with hardware.

What about the following solution: What if fbcon_resize sets the clock in the var to 0? We could use this to force low level drivers to decide on the clock for themselves. Otherwise, ie if the clock field is non-zero, they are supposed to take it as the desired clock.

Yes, that's another solution. Just invalidate the timings and force the driver to compute a modeline each time.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#31 lore raw
Quoted 11 lines · Antonino Daplas
Quoted 6 lines · Thomas Winischhofer
Quoted 4 lines

However, the brokenness is really on the driver side. They are unable to change the video mode unless they are supplied with the correct timing parameters where in fact they actually have the best knowledge on how to calculate them.

Yes, BUT ONLY IF the driver has enough parameters to calculate it. This requires at least x and y dimension AND A CLOCK (or a vertical refresh rate, which I would prefer).

The VESA GTF can calculate timings using only xres, yres and any of the three...

Quoted 6 lines

1. desired pixelclock
2. desired refresh
3. desired hsync

... all of which can be chosen by the driver, or extracted from the monitor (ie. DDC or uploaded by the user).

See? Need a clock! My word! :)

Quoted 7 lines

Mode checking is not simply looking at xres and yres, but also looking at htotal, and vtotal to derive hsync, vsync and pixelclock. These are then compared to the monitor/graphics card's capability. If any of the values fall outside the limits then the mode is not valid. Otherwise, the new mode should still produce a usable display, perhaps not the one the user wants (ie refresh rate is lower). By this time though, the user can freely use fbset to fine tune all the timings.

Perhaps I have not made myself clear:

I start with a default 800x600-60. Pixelclock in var is now X.

fbcon_resize adapts the xres and yres, leaving the pixelclock alone.

The driver sees upon the check_var call: xres, yres and X - the old pixelclock (which is non-zero).

That pixelclock *COULD* be valid, but it COULD also be invalid! There is no way of distinguishing!

Quoted 4 lines
Quoted 1 line

What about the following solution: What if fbcon_resize sets the clock in the var to 0? We could use this to force low level drivers to decide on the clock for themselves. Otherwise, ie if the clock field is non-zero, they are supposed to take it as the desired clock.

Yes, that's another solution. Just invalidate the timings and force the driver to compute a modeline each time.

I think Geert came up with a better solution in the meantime.

But a general rule should be anyway: Whenever passing a var to the driver which only changed in a few fields and through this invalidated the timing settings, the caller should set everthing else to ZERO, in other words: invalidate it in a recognizable way. That's IMHO the only way the driver can distinguish between intended and unintended settings.

Thomas

Signature · 10 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#32 lore raw
Quoted 12 lines · Thomas Winischhofer
Quoted 7 lines

Mode checking is not simply looking at xres and yres, but also looking at htotal, and vtotal to derive hsync, vsync and pixelclock. These are then compared to the monitor/graphics card's capability. If any of the values fall outside the limits then the mode is not valid. Otherwise, the new mode should still produce a usable display, perhaps not the one the user wants (ie refresh rate is lower). By this time though, the user can freely use fbset to fine tune all the timings.

Perhaps I have not made myself clear:

I start with a default 800x600-60. Pixelclock in var is now X.

Quoted 8 lines

fbcon_resize adapts the xres and yres, leaving the pixelclock alone.

The driver sees upon the check_var call: xres, yres and X - the old pixelclock (which is non-zero).

That pixelclock *COULD* be valid, but it COULD also be invalid! There is no way of distinguishing!

Yes, there is. Using the "stale" pixelclock, htotal and vtotal, calculate hsync and vsync. Compare this with your monitor's limit -- if any fall outside, the entire mode, pixelclock and all is not valid.

(see fb_get_mode() and fb_validate_mode() in fbmon.c)

And if you use very narrow vsync and hsync ranges, then the "stale" pixelclock will always most certainly be invalid.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#33 lore raw
Quoted 8 lines · Antonino Daplas

Yes, there is. Using the "stale" pixelclock, htotal and vtotal, calculate hsync and vsync. Compare this with your monitor's limit -- if any fall outside, the entire mode, pixelclock and all is not valid.

(see fb_get_mode() and fb_validate_mode() in fbmon.c)

And if you use very narrow vsync and hsync ranges, then the "stale" pixelclock will always most certainly be invalid.

BTW, do we have an easy way of knowing if it is an LCD or analog monitor which is attached to the card (or even a TV) ? I think the radeonfb knows how to do this, not sure though.

Friendly,

Sven Luther

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#34 lore raw
Quoted 5 lines · Sven Luther
Quoted 4 lines · Antonino Daplas

Yes, there is. Using the "stale" pixelclock, htotal and vtotal, calculate hsync and vsync. Compare this with your monitor's limit -- if any fall outside, the entire mode, pixelclock and all is not valid.

Quoted 9 lines
Quoted 4 lines

(see fb_get_mode() and fb_validate_mode() in fbmon.c)

And if you use very narrow vsync and hsync ranges, then the "stale" pixelclock will always most certainly be invalid.

BTW, do we have an easy way of knowing if it is an LCD or analog monitor which is attached to the card (or even a TV) ? I think the radeonfb knows how to do this, not sure though.

There's an EDID parser in fbmon.c. I think it will work only for the PPC. This is currently used by rivafb and radeonfb. For the rest, either we implement DDC or just have something similar to XF86Config's HorizSync and VertRefresh. We can load this either as a kernel/module option or passed via ioctl/sysfs.

I'm already doing this with the i810fb (as boot/module option), which greatly simplified mode switching.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#35 lore raw
Quoted 16 lines · Antonino Daplas
Quoted 5 lines · Sven Luther
Quoted 4 lines · Antonino Daplas

Yes, there is. Using the "stale" pixelclock, htotal and vtotal, calculate hsync and vsync. Compare this with your monitor's limit -- if any fall outside, the entire mode, pixelclock and all is not valid.

Quoted 9 lines
Quoted 4 lines

(see fb_get_mode() and fb_validate_mode() in fbmon.c)

And if you use very narrow vsync and hsync ranges, then the "stale" pixelclock will always most certainly be invalid.

BTW, do we have an easy way of knowing if it is an LCD or analog monitor which is attached to the card (or even a TV) ? I think the radeonfb knows how to do this, not sure though.

Quoted 9 lines

There's an EDID parser in fbmon.c. I think it will work only for the PPC. This is currently used by rivafb and radeonfb. For the rest, either we implement DDC or just have something similar to XF86Config's HorizSync and VertRefresh. We can load this either as a kernel/module option or passed via ioctl/sysfs.

I'm already doing this with the i810fb (as boot/module option), which greatly simplified mode switching.

Oops, totally missed your question :-) But yes, I think the EDID block contains information about the monitor type, not sure thogh.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#36 lore raw
Quoted 12 lines · Antonino Daplas
Quoted 11 lines · Antonino Daplas
Quoted 10 lines · Sven Luther
Quoted 8 lines · Antonino Daplas

Yes, there is. Using the "stale" pixelclock, htotal and vtotal, calculate hsync and vsync. Compare this with your monitor's limit -- if any fall outside, the entire mode, pixelclock and all is not valid.

(see fb_get_mode() and fb_validate_mode() in fbmon.c)

And if you use very narrow vsync and hsync ranges, then the "stale" pixelclock will always most certainly be invalid.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

BTW, do we have an easy way of knowing if it is an LCD or analog monitor which is attached to the card (or even a TV) ? I think the radeonfb knows how to do this, not sure though.

There's an EDID parser in fbmon.c. I think it will work only for the PPC. This is currently used by rivafb and radeonfb. For the rest, either

Mmm, is it because the EDID parser uses the EDID information pased by the OF ?

Quoted 3 lines
Quoted 3 lines

we implement DDC or just have something similar to XF86Config's HorizSync and VertRefresh. We can load this either as a kernel/module option or passed via ioctl/sysfs.

Most monitors today have DDC support, so i guess best would be to use it, and fall back to a command line option if DDC is not supported.

Quoted 5 lines
Quoted 2 lines

I'm already doing this with the i810fb (as boot/module option), which greatly simplified mode switching.

Oops, totally missed your question :-) But yes, I think the EDID block contains information about the monitor type, not sure thogh.

X finds :

Digital Display Input

So, i guess this is it.

Friendly,

Sven Luther

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#37 lore raw
Quoted 7 lines · Sven Luther
Quoted 3 lines
Quoted 3 lines

There's an EDID parser in fbmon.c. I think it will work only for the PPC. This is currently used by rivafb and radeonfb. For the rest, either

Mmm, is it because the EDID parser uses the EDID information pased by the OF ?

Yes.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#38 lore raw
In reply to Sven Luther
Quoted 9 lines
Quoted 3 lines

Oops, totally missed your question :-) But yes, I think the EDID block contains information about the monitor type, not sure thogh.

X finds :

Digital Display Input

So, i guess this is it.

Yes the EDID block does have info on the monitor type. It even has the vendor name. I wonder if it can detect when you unplug a monitor and plug in a new one?

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#39 lore raw
In reply to Sven Luther
Quoted 9 lines
Quoted 5 lines

(see fb_get_mode() and fb_validate_mode() in fbmon.c)

And if you use very narrow vsync and hsync ranges, then the "stale" pixelclock will always most certainly be invalid.

BTW, do we have an easy way of knowing if it is an LCD or analog monitor which is attached to the card (or even a TV) ? I think the radeonfb knows how to do this, not sure though.

Not that I know of.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#40 lore raw

Alright: I tested the newest fbdev patch.

1) Boot logo support: Does not compile, misses a script "p??tologo" or anything like that.

2) Changed sisfb to accept practically any mode, but it now adapts to the next larger supported mode if no exact mode based on rows and cols is found. Previously, this adaption was limited to 16 pixels.

stty does not work at all now, because fbcon's fbcon_resize() checks the returned var from fb_set_var if the mode is off more than one character in height and width - and returns EINVAL in this case.

Since stty calles the console code twice if rows and cols are provided, this fails miserably, because the first attempt (which for example requests 800x768 if switching from 1024x768 to 800x600) fails.

So I changed fbcon from

	if(err || width != var.xres/fw || height != var.yres/fh)

to

	if(err)

and now it works.

However, there is still (at least) one problem within the console layer.

With my patch, I can now have a console of for instance 128x20 characters, on a 1024x768 screen. Scrolling mostly works, but sometimes console seems to forget to pan. I can't reproduce this on purpose, but printing eg. a directory with ls works in 90% of the cases (=scrolls correctly), but prints text beyond the current amount of rows in the remaining 10% of the cases. If I press enter until the last line of the console is on the very bottom of the 1024x768 screen, then it remembers its amount of rows and pans correctly.

For estethical reasons, I would also recommend changing the order or panning and character drawing. Now, the characters seem to be drawn first, and panning is done later. That causes some flickering sometimes, and with a console smaller than the screen resolution (eg. screen is 1024x768, console uses only 20 rows), text is shown below the 20th row for a fraction of a second before the panning is done.

I will send the current sisfb code to James later today. (It also fixes some non-fbdev-related mode switching problems on some Asus laptops)

Thomas

Signature · 10 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#41 lore raw
Quoted 4 lines · Thomas Winischhofer

Alright: I tested the newest fbdev patch.

1) Boot logo support: Does not compile, misses a script "p??tologo" or anything like that.

scripts/Makefile +1 -1
@@ -9,7 +9,7 @@
 # conmakehash:	 Create arrays for initializing the kernel console tables
 
 host-progs    := fixdep split-include conmakehash docproc kallsyms modpost \
-		 mk_elfconfig
+		 mk_elfconfig pnmtologo
 build-targets := $(host-progs) empty.o
 
 modpost-objs  := modpost.o file2alias.o
scripts/pnmtologo.c +507 -0

507 lines not on this page · raw message

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

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#42 lore raw
Quoted 7 lines · Thomas Winischhofer
Quoted 4 lines

Alright: I tested the newest fbdev patch.

1) Boot logo support: Does not compile, misses a script "p??tologo" or anything like that.

??? That is getting annoying. Another patch is coming very soon.

P.S

Almost done with porting matroxfb. Still some more to go tho.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#43 lore raw
In reply to Thomas Winischhofer
Quoted 4 lines · Thomas Winischhofer

However, there is still (at least) one problem within the console layer.

Quoted 9 lines

With my patch, I can now have a console of for instance 128x20 characters, on a 1024x768 screen. Scrolling mostly works, but sometimes console seems to forget to pan. I can't reproduce this on purpose, but printing eg. a directory with ls works in 90% of the cases (=scrolls correctly), but prints text beyond the current amount of rows in the remaining 10% of the cases. If I press enter until the last line of the console is on the very bottom of the 1024x768 screen, then it remembers its amount of rows and pans correctly.

Try this patch. The fbcon_resize test is more liberal and it now correctly updates p->vrows and scroll_phys_max (for panning glitches).

Tony

drivers/video/console/fbcon.c +6 -6
diff -Naur linux-2.5.64-fbdev/drivers/video/console/fbcon.c linux-2.5.64/drivers/video/console/fbcon.c
@@ -580,8 +580,8 @@
 	struct fb_info *info = p->fb_info;
 	unsigned int cw = vc->vc_font.width;
 	unsigned int ch = vc->vc_font.height;
-	unsigned int rw = info->var.xres % cw;
-	unsigned int bh = info->var.yres % ch;
+	unsigned int rw = info->var.xres - (cw * vc->vc_cols);
+	unsigned int bh = info->var.yres - (ch * vc->vc_rows);
 	unsigned int rs = info->var.xres - rw;
 	unsigned int bs = info->var.yres - bh;
 	struct fb_fillrect region;
@@ -1815,14 +1815,14 @@
 	   (y_diff < 0 || y_diff > fh)) {
 		var.activate = FB_ACTIVATE_TEST;
 		err = fb_set_var(&var, info);
-		if (err || width != var.xres/fw ||
-		    height != var.yres/fh)
+		if (err || width > var.xres/fw ||
+		    height > var.yres/fh)
 			return -EINVAL;
 		DPRINTK("resize now %ix%i\n", var.xres, var.yres);
 		var.activate = FB_ACTIVATE_NOW;
 		fb_set_var(&var, info);
-		p->vrows = info->var.yres_virtual/fh;
 	}
+	p->vrows = info->var.yres_virtual/fh;
 	return 0;
 }
 
@@ -1857,6 +1857,7 @@
 	}
 	if (info)
 		info->var.yoffset = p->yscroll = 0;
+        fbcon_resize(vc, vc->vc_cols, vc->vc_rows);
 	switch (p->scrollmode & __SCROLL_YMASK) {
 	case __SCROLL_YWRAP:
 		scrollback_phys_max = p->vrows - vc->vc_rows;
@@ -1875,7 +1876,6 @@
 
 	info->currcon = unit;
 	
-        fbcon_resize(vc, vc->vc_cols, vc->vc_rows);
 	update_var(unit, info);
 	fbcon_set_palette(vc, color_table); 	
 

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#44 lore raw

This works - perfectly, I must say.

However, the scrolling problem is still here, but I think I know the reason for this:

Imagine a console of 120x40 (using the std 8x16 font), on a screen of 1024x768, using ypanning.

This uses only 40*16=640 pixels vertically instead of the 768 available.

The problem is the y panning, and is kind of both console's as well as the driver's fault:

When the y panning area reaches its end, it's supposed to copy the screen to the beginning of this area and pan to position 0.

However, fbcon calculates p->vrows by info->var.yres_virtual / fontheight.

This disregards the fact that the visible screen area is actually larger than the area console is supposed to use.

Therefore, the calculation of vrows has to take the difference between these two into account.

The attached patch fixes this for me but I have no idea if I cought all possible itches. It will no apply cleanly, because I had made changes to fbcon.c before making a backup copy - but it sure illustrates the problem.

Why you used info->var.yres_virtual (and not the adapted var.yres_virtual) in fbcon_resize() is beyond me, BTW.

Thomas

Quoted 65 lines · Antonino Daplas
Quoted 5 lines · Thomas Winischhofer

However, there is still (at least) one problem within the console layer.

With my patch, I can now have a console of for instance 128x20 characters, on a 1024x768 screen. Scrolling mostly works, but sometimes console seems to forget to pan. I can't reproduce this on purpose, but printing eg. a directory with ls works in 90% of the cases (=scrolls correctly), but prints text beyond the current amount of rows in the remaining 10% of the cases. If I press enter until the last line of the console is on the very bottom of the 1024x768 screen, then it remembers its amount of rows and pans correctly.

Try this patch. The fbcon_resize test is more liberal and it now correctly updates p->vrows and scroll_phys_max (for panning glitches).

Tony

diff -Naur linux-2.5.64-fbdev/drivers/video/console/fbcon.c linux-2.5.64/drivers/video/console/fbcon.c

drivers/video/console/fbcon.c +6 -6
@@ -580,8 +580,8 @@
 	struct fb_info *info = p->fb_info;
 	unsigned int cw = vc->vc_font.width;
 	unsigned int ch = vc->vc_font.height;
-	unsigned int rw = info->var.xres % cw;
-	unsigned int bh = info->var.yres % ch;
+	unsigned int rw = info->var.xres - (cw * vc->vc_cols);
+	unsigned int bh = info->var.yres - (ch * vc->vc_rows);
 	unsigned int rs = info->var.xres - rw;
 	unsigned int bs = info->var.yres - bh;
 	struct fb_fillrect region;
@@ -1815,14 +1815,14 @@
 	   (y_diff < 0 || y_diff > fh)) {
 		var.activate = FB_ACTIVATE_TEST;
 		err = fb_set_var(&var, info);
-		if (err || width != var.xres/fw ||
-		    height != var.yres/fh)
+		if (err || width > var.xres/fw ||
+		    height > var.yres/fh)
 			return -EINVAL;
 		DPRINTK("resize now %ix%i\n", var.xres, var.yres);
 		var.activate = FB_ACTIVATE_NOW;
 		fb_set_var(&var, info);
-		p->vrows = info->var.yres_virtual/fh;
 	}
+	p->vrows = info->var.yres_virtual/fh;
 	return 0;
 }
 
@@ -1857,6 +1857,7 @@
 	}
 	if (info)
 		info->var.yoffset = p->yscroll = 0;
+        fbcon_resize(vc, vc->vc_cols, vc->vc_rows);
 	switch (p->scrollmode & __SCROLL_YMASK) {
 	case __SCROLL_YWRAP:
 		scrollback_phys_max = p->vrows - vc->vc_rows;
@@ -1875,7 +1876,6 @@
 
 	info->currcon = unit;
 
-        fbcon_resize(vc, vc->vc_cols, vc->vc_rows);
 	update_var(unit, info);
 	fbcon_set_palette(vc, color_table); 	
 
Signature · 3 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/
#45 lore raw
Quoted 22 lines · Thomas Winischhofer

This works - perfectly, I must say.

However, the scrolling problem is still here, but I think I know the reason for this:

Imagine a console of 120x40 (using the std 8x16 font), on a screen of 1024x768, using ypanning.

This uses only 40*16=640 pixels vertically instead of the 768 available.

The problem is the y panning, and is kind of both console's as well as the driver's fault:

When the y panning area reaches its end, it's supposed to copy the screen to the beginning of this area and pan to position 0.

However, fbcon calculates p->vrows by info->var.yres_virtual / fontheight.

This disregards the fact that the visible screen area is actually larger than the area console is supposed to use.

Quoted 7 lines

Therefore, the calculation of vrows has to take the difference between these two into account.

The attached patch fixes this for me but I have no idea if I cought all possible itches. It will no apply cleanly, because I had made changes to fbcon.c before making a backup copy - but it sure illustrates the problem.

Right, fbcon never dealt with margins greater than a character width/height before :-). I think your patch will do the Right Thing.

As for the one you commented out as INCOMPLETE, my guess is it won't matter since that particular section of code is called only during initialization. An fbcon_switch() will be called later on, I think.

Quoted 3 lines

Why you used info->var.yres_virtual (and not the adapted var.yres_virtual) in fbcon_resize() is beyond me, BTW.

Because info->var will _always_ contain the correct var, so we trust that above all.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#46 lore raw
Quoted 2 lines · Antonino Daplas

Right, fbcon never dealt with margins greater than a character width/height before :-). I think your patch will do the Right Thing.

I hope so :) But please think it through, I have no idea about the possible impacts of this.

Quoted 3 lines

As for the one you commented out as INCOMPLETE, my guess is it won't matter since that particular section of code is called only during initialization. An fbcon_switch() will be called later on, I think.

No idea, but ... you're the expert!

Quoted 4 lines
Quoted 1 line

Why you used info->var.yres_virtual (and not the adapted var.yres_virtual) in fbcon_resize() is beyond me, BTW.

Because info->var will _always_ contain the correct var, so we trust that above all.

Then I must have misunderstood the code. You submit var (and not info->var) to fb_set_var, so it is that var that will be treated by check_var and used for set_par. Since check_var() may (and does) change the yres_virtual according to the desired resolution/depth and so on, I thought it might be more correct to use it instead of info->var...

I have in the meantime submitted a new sisfb patch to James; it depends, however, on the changes to fbcon we are discussing now (especially the fbcon_resize thing which is too intolerant in James' current code base). Otherwise, mode switches using stty won't work.

Thomas

Signature · 10 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#47 lore raw
Quoted 12 lines · Thomas Winischhofer
Quoted 5 lines
Quoted 2 lines

Why you used info->var.yres_virtual (and not the adapted var.yres_virtual) in fbcon_resize() is beyond me, BTW.

Because info->var will _always_ contain the correct var, so we trust that above all.

Then I must have misunderstood the code. You submit var (and not info->var) to fb_set_var, so it is that var that will be treated by check_var and used for set_par. Since check_var() may (and does) change the yres_virtual according to the desired resolution/depth and so on, I thought it might be more correct to use it instead of info->var...

Note that fbcon_resize made a copy of info->var, then modified it according to the requested width and height. Then it goes through a test if it needs an fb_set_var or not. So info->var and the modified var can be different if fb_set_var() wasn't called at all. If it indeed went through fb_set_var(), the var returned from check_var() will be placed automatically to info->var before calling set_par(). So, yes, in this case, info->var and the adjusted var will be the same.

Of course, in this particular code it is not important whichever var is used because we're only interested in yres_virtual. But using info->var instead of the adjusted var is safer because it is guaranteed to be always correct.

BTW: I'll check the patch against vesafb and let you know.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#48 lore raw
In reply to Thomas Winischhofer
Quoted 10 lines

Therefore, the calculation of vrows has to take the difference between these two into account.

The attached patch fixes this for me but I have no idea if I cought all possible itches. It will no apply cleanly, because I had made changes to fbcon.c before making a backup copy - but it sure illustrates the problem.

Why you used info->var.yres_virtual (and not the adapted var.yres_virtual) in fbcon_resize() is beyond me, BTW.

My mistake. I applied your patch.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#49 lore raw
Quoted 7 lines · James Simmons
Quoted 7 lines

Therefore, the calculation of vrows has to take the difference between these two into account.

The attached patch fixes this for me but I have no idea if I cought all possible itches. It will no apply cleanly, because I had made changes to fbcon.c before making a backup copy - but it sure illustrates the problem.

Quoted 5 lines
Quoted 2 lines

Why you used info->var.yres_virtual (and not the adapted var.yres_virtual) in fbcon_resize() is beyond me, BTW.

My mistake. I applied your patch.

Reading first Toni's post (because it came one minute earlier) and now yours, what's true resp. correct now?

Thomas

PS: James, are you "entitled" to add maintainers to the MAINTAINERS file? I have actually been the maintainer of sisfb since a year back, so I think this should perhaps be mentioned..?

SIS FRAMEBUFFER DRIVER
P: Thomas Winischhofer
M: [email protected]
W: http://www.winischhofer.net/linuxsisvga.shtml
S: Maintained

Signature · 10 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#50 lore raw
Quoted 10 lines

PS: James, are you "entitled" to add maintainers to the MAINTAINERS file? I have actually been the maintainer of sisfb since a year back, so I think this should perhaps be mentioned..?

SIS FRAMEBUFFER DRIVER
P: Thomas Winischhofer
M: [email protected]
W: http://www.winischhofer.net/linuxsisvga.shtml
S: Maintained

Added.

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en

#51 lore raw
In reply to Thomas Winischhofer
Quoted 14 lines · Thomas Winischhofer

This works - perfectly, I must say.

However, the scrolling problem is still here, but I think I know the reason for this:

Imagine a console of 120x40 (using the std 8x16 font), on a screen of 1024x768, using ypanning.

This uses only 40*16=640 pixels vertically instead of the 768 available.

The problem is the y panning, and is kind of both console's as well as the driver's fault:

Quoted 7 lines

When the y panning area reaches its end, it's supposed to copy the screen to the beginning of this area and pan to position 0.

However, fbcon calculates p->vrows by info->var.yres_virtual / fontheight.

This disregards the fact that the visible screen area is actually larger than the area console is supposed to use.

I've tested where the virtual window size is much smaller than the physical dimensions, and I do see the glitch you mentioned. But it's mainly due to clear_margins(). clear_margins always erases a constant amount (physical_height - actual height). So if you happen to pan just enough that there's not enough screen estate left, it will attempt to clear past yres_virtual. Bad for drivers that do not implement clipping. Perhaps, block moves are involved here also, I'm not sure.

So your patch has the correct idea, but here's a simpler one. It just reserves enough screen estate equal to difference of physical height and virtual height. I've tested this even using stty cols 2, and it works okay.

NOTE: Since we need var->yres, this time, we need to refer to info->var instead of the adjusted var.

BTW: I've tested moving clear_margins before panning, it still doesn't remove the onrushing text past the virtual window height. This would seem to need clipping to remove that eyesore.

If the patch doesn't apply cleanly, it should be easy enough to do so manually.

Tony

drivers/video/console/fbcon.c +4 -1
diff -Naur linux-2.5.64-fbdev/drivers/video/console/fbcon.c linux-2.5.64/drivers/video/console/fbcon.c
@@ -1044,6 +1044,7 @@
 		vc->vc_rows = nr_rows;
 	}
 	p->vrows = info->var.yres_virtual / vc->vc_font.height;
+	p->vrows -= info->var.yres - vc->vc_rows;
 	if ((info->var.yres % vc->vc_font.height) &&
 	    (info->var.yres_virtual % vc->vc_font.height <
 	     info->var.yres % vc->vc_font.height))
@@ -1821,8 +1822,9 @@
 		DPRINTK("resize now %ix%i\n", var.xres, var.yres);
 		var.activate = FB_ACTIVATE_NOW;
 		fb_set_var(&var, info);
-		p->vrows = info->var.yres_virtual/fh;
 	}
+	p->vrows = info->var.yres_virtual/fh;
+	p->vrows -= (info->var.yres + (fh - 1))/fh - vc->vc_rows;
 	return 0;
 }
 
@@ -2094,6 +2096,7 @@
 		/* reset wrap/pan */
 		info->var.xoffset = info->var.yoffset = p->yscroll = 0;
 		p->vrows = info->var.yres_virtual / h;
+		p->vrows -= info->var.yres/h - vc->vc_rows;
 		if ((info->var.yres % h)
 		    && (info->var.yres_virtual % h < info->var.yres % h))
 			p->vrows--;

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#52 lore raw
Quoted 19 lines · Antonino Daplas
Quoted 8 lines · Thomas Winischhofer

This works - perfectly, I must say.

However, the scrolling problem is still here, but I think I know the reason for this:

Imagine a console of 120x40 (using the std 8x16 font), on a screen of 1024x768, using ypanning.

This uses only 40*16=640 pixels vertically instead of the 768 available.

Quoted 7 lines

The problem is the y panning, and is kind of both console's as well as the driver's fault:

When the y panning area reaches its end, it's supposed to copy the screen to the beginning of this area and pan to position 0.

However, fbcon calculates p->vrows by info->var.yres_virtual / fontheight.

This disregards the fact that the visible screen area is actually larger than the area console is supposed to use.

Quoted 7 lines

I've tested where the virtual window size is much smaller than the physical dimensions, and I do see the glitch you mentioned. But it's mainly due to clear_margins(). clear_margins always erases a constant amount (physical_height - actual height). So if you happen to pan just enough that there's not enough screen estate left, it will attempt to clear past yres_virtual. Bad for drivers that do not implement clipping. Perhaps, block moves are involved here also, I'm not sure.

1) Sisfb does no clipping, but there is plenty of video RAM past the virtual area.

2) I don't think we are talking about the same thing. Clear_margins() (which I haven't looked at, I confess) assumingly ... erm.. clears the margins. But why is it involved in scrolling any panning?

Quoted 4 lines

So your patch has the correct idea, but here's a simpler one. It just reserves enough screen estate equal to difference of physical height and virtual height. I've tested this even using stty cols 2, and it works okay.

I don't see why this is simpler, but I do see it wastes a lot of screen space :)

BTW:

p->vrows = info->var.yres_virtual / vc->vc_font.height;
+ p->vrows -= info->var.yres - vc->vc_rows;

Look:

rows = 40
yres = 768
yres_v = 2048
font height = 16

vrows = 2048 / 16 = 128 (character unit)

128 - (768 - 40)

is negative...

Personally, I'd go with my first patch from earlier today. I tested this intensively in the meantime, and it Simpy Works(tm).

Quoted 6 lines

NOTE: Since we need var->yres, this time, we need to refer to info->var instead of the adjusted var.

BTW: I've tested moving clear_margins before panning, it still doesn't remove the onrushing text past the virtual window height. This would seem to need clipping to remove that eyesore.

Honestly, I don't consider this important... But I thought you'd simply exchange the order of calling pan_var and drawing the characters... (which IMHO would be the correct order, logically speaking)

Thomas

Signature · 8 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#53 lore raw
Quoted 3 lines · Thomas Winischhofer

I don't see why this is simpler, but I do see it wastes a lot of screen space :)

yep, it'a a typo.

Tony

drivers/video/console/fbcon.c +4 -1
diff -Naur linux-2.5.64-fbdev/drivers/video/console/fbcon.c linux-2.5.64/drivers/video/console/fbcon.c
@@ -1044,6 +1044,7 @@
 		vc->vc_rows = nr_rows;
 	}
 	p->vrows = info->var.yres_virtual / vc->vc_font.height;
+	p->vrows -= info->var.yres/h - vc->vc_rows;
 	if ((info->var.yres % vc->vc_font.height) &&
 	    (info->var.yres_virtual % vc->vc_font.height <
 	     info->var.yres % vc->vc_font.height))
@@ -1821,8 +1822,9 @@
 		DPRINTK("resize now %ix%i\n", var.xres, var.yres);
 		var.activate = FB_ACTIVATE_NOW;
 		fb_set_var(&var, info);
-		p->vrows = info->var.yres_virtual/fh;
 	}
+	p->vrows = info->var.yres_virtual/fh;
+	p->vrows -= (info->var.yres + (fh - 1))/fh - vc->vc_rows;
 	return 0;
 }
 
@@ -2094,6 +2096,7 @@
 		/* reset wrap/pan */
 		info->var.xoffset = info->var.yoffset = p->yscroll = 0;
 		p->vrows = info->var.yres_virtual / h;
+		p->vrows -= info->var.yres/h - vc->vc_rows;
 		if ((info->var.yres % h)
 		    && (info->var.yres_virtual % h < info->var.yres % h))
 			p->vrows--;

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#54 lore raw
Quoted 13 lines · Antonino Daplas
Quoted 3 lines · Thomas Winischhofer

I don't see why this is simpler, but I do see it wastes a lot of screen space :)

yep, it'a a typo.

Tony

diff -Naur linux-2.5.64-fbdev/drivers/video/console/fbcon.c linux-2.5.64/drivers/video/console/fbcon.c

drivers/video/console/fbcon.c line 1047

Quoted 4 lines
drivers/video/console/fbcon.c +1 -0
@@ -1044,6 +1044,7 @@
 		vc->vc_rows = nr_rows;
 	}
 	p->vrows = info->var.yres_virtual / vc->vc_font.height;
+	p->vrows -= info->var.yres/h - vc->vc_rows;
                    ^^^^^^^^^^^^^^^^

I also meant info->var.yres/vc->vc_font.height :-)

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#55 lore raw
Quoted 6 lines · Antonino Daplas

Review

Quoted 2 lines
	p->vrows = info->var.yres_virtual / vc->vc_font.height;
(quoted diff) +1 -0
+	p->vrows -= info->var.yres/h - vc->vc_rows;
                    ^^^^^^^^^^^^^^^^

I also meant info->var.yres/vc->vc_font.height :-)

Tony,

Both ways it works, granted. But I still don't see the advantage of your solution over mine. Your's wastes an area of the size of a whole screen.

Certainly no offence, but can you explain why you think this is better?

Thomas

Signature · 8 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#56 lore raw
In reply to Antonino Daplas

Continued: What happens with your solution of the virtual area is only 1.5 times the size of the visible area? Did your check this?

Quoted 2 lines

Review

Quoted 2 lines
	p->vrows = info->var.yres_virtual / vc->vc_font.height;
(quoted diff) +1 -0
+	p->vrows -= info->var.yres/vc->vc_font.height - vc->vc_rows;

yres = 768
yres_virtual = 1152
fontheight= 16
rows = 48

vrows = 1152 / 16 = 72
72 - (768 / 16) - 48 = -24

:) Any question?

Thomas

Quoted 28 lines · Antonino Daplas
Quoted 13 lines · Antonino Daplas
Quoted 2 lines · Thomas Winischhofer

I don't see why this is simpler, but I do see it wastes a lot of screen space :)

yep, it'a a typo.

Tony

diff -Naur linux-2.5.64-fbdev/drivers/video/console/fbcon.c linux-2.5.64/drivers/video/console/fbcon.c

drivers/video/console/fbcon.c line 1047

Quoted 4 lines
drivers/video/console/fbcon.c +1 -0
@@ -1044,6 +1044,7 @@
 		vc->vc_rows = nr_rows;
 	}
 	p->vrows = info->var.yres_virtual / vc->vc_font.height;
+	p->vrows -= info->var.yres/h - vc->vc_rows;
                    ^^^^^^^^^^^^^^^^

I also meant info->var.yres/vc->vc_font.height :-)

Tony

Signature · 8 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#57 lore raw
Quoted 13 lines · Thomas Winischhofer

Continued: What happens with your solution of the virtual area is only 1.5 times the size of the visible area? Did your check this?

Quoted 2 lines

Review

Quoted 2 lines
	p->vrows = info->var.yres_virtual / vc->vc_font.height;
(quoted diff) +1 -0
+	p->vrows -= info->var.yres/vc->vc_font.height - vc->vc_rows;

yres = 768
yres_virtual = 1152
fontheight= 16
rows = 48

Quoted 5 lines

vrows = 1152 / 16 = 72
72 - (768 / 16) - 48 = -24

:) Any question?

Why?

Your example - 1024x768, yres_virtual = 1152, font = 8x16

2 cases:

1. full screeen console
vc->vc_rows = 48

p->vrows = 72 - (768/16 - 48)
p->vrows = 72 - 0
p->vrows = 72

2. half-height console:
vc->vc_rows = 24

p->vrows = 1152 - (768/16 - 24)
p->vrows = 72 - 24
p->vrows = 48

Second case, 24 rows are wasted, why? See accel_clear_margins:

ch = vc->vc_font_height
bh = yres - (vc->vc_rows * ch)
bh = 768 - (24 * 16)
bh = 768 - 384
bh = 384

This means that a rectangle of height 384 scanlines (_always_) at the bottom of the display will be cleared . If you pan to the end of graphics memory, attempting to clear from yres_virtual + 384 will cause the chipset to crash. But it won't because we reserved 24 rows (384 pixels) to accomodate this.

For the clincher, this is your code:

if(info->var.yres > (vc->vc_font.height * (vc->vc_rows + 1))) {
	p->vrows -= (info->var.yres - (vc->vc_font.height * 		    

vc->vc_rows)) / vc->vc_font.height;
}

Simplifying the second line....

p->vrows -= (info->var.yres/vc->vc_font.height) - (vc->vc_font.height * vc->vc_rows)/vc->vc_font.height;
p->vrows -= info->var.yres/vc->vc_font.height - vc->vc_rows;

Do you recognize the last line? Yep, it's mine. It's also simpler (1 division and 1 subtraction vs 1 division, 1 multiplication and 1 subtraction).

Code correctness was never the issue. The only thing I'm questioning is using info->var.yres instead of var.yres, and I have explained this enough times already.

Granted, the patch I submitted was a quickwrite, never meant to be applied but serves only to illustrate. This is a more proper patch, applied against James latest fbdev.diff. It simplifies the equation, remove the unnecessary 'if' conditional. Apply it, don't apply it, I don't care.

Tony

drivers/video/console/fbcon.c +4 -11
diff -Naur linux-2.5.64-fbdev/drivers/video/console/fbcon.c linux-2.5.64/drivers/video/console/fbcon.c
@@ -1044,9 +1044,7 @@
 		vc->vc_rows = nr_rows;
 	}
 	p->vrows = info->var.yres_virtual / vc->vc_font.height;
-	if(info->var.yres > (vc->vc_font.height * (vc->vc_rows + 1))) {
-		p->vrows -= (info->var.yres - (vc->vc_font.height * vc->vc_rows)) / vc->vc_font.height;
-	}
+	p->vrows -= info->var.yres/vc->vc_font.height - vc->vc_rows;
 	if ((info->var.yres % vc->vc_font.height) &&
 	    (info->var.yres_virtual % vc->vc_font.height <
 	     info->var.yres % vc->vc_font.height))
@@ -1825,9 +1823,8 @@
 		var.activate = FB_ACTIVATE_NOW;
 		fb_set_var(&var, info);
 	}
-	p->vrows = var.yres_virtual/fh;
-	if(var.yres > (fh * (height + 1)))
-		p->vrows -= (var.yres - (fh * height)) / fh;
+	p->vrows = info->var.yres_virtual/fh;
+	p->vrows -= (info->var.yres + (fh - 1))/fh - height;
 	return 0;
 }
 
@@ -2099,11 +2096,7 @@
 		/* reset wrap/pan */
 		info->var.xoffset = info->var.yoffset = p->yscroll = 0;
 		p->vrows = info->var.yres_virtual / h;
-
-#if 0          /* INCOMPLETE - let the console gurus handle this */
-		if(info->var.yres > (h * (vc->vc_rows + 1))
-			p->vrows -= (info->var.yres - (h * vc->vc_rows)) / h;
-#endif
+		p->vrows -= info->var.yres/h  - vc->vc_rows;
 		if ((info->var.yres % h)
 		    && (info->var.yres_virtual % h < info->var.yres % h))
 			p->vrows--;

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#58 lore raw

Antonino,

Quoted 10 lines

Your example - 1024x768, yres_virtual = 1152, font = 8x16

2 cases:

1. full screeen console
vc->vc_rows = 48

p->vrows = 72 - (768/16 - 48)
p->vrows = 72 - 0
p->vrows = 72

You're right. I made a mistake in my calculation.

Quoted 5 lines

Granted, the patch I submitted was a quickwrite, never meant to be applied but serves only to illustrate. This is a more proper patch, applied against James latest fbdev.diff. It simplifies the equation, remove the unnecessary 'if' conditional. Apply it, don't apply it, I don't care.

That's not up to me to decide. For me, the only thing that counts is that the console can deal with text areas that are smaller than the screen resolution. Besides, your last sentence was certainly not neccessary. You among friends here.

Thomas

Signature · 8 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#59 lore raw
Quoted 7 lines · Thomas Winischhofer
Quoted 6 lines

Granted, the patch I submitted was a quickwrite, never meant to be applied but serves only to illustrate. This is a more proper patch, applied against James latest fbdev.diff. It simplifies the equation, remove the unnecessary 'if' conditional. Apply it, don't apply it, I don't care.

Quoted 5 lines

That's not up to me to decide. For me, the only thing that counts is that the console can deal with text areas that are smaller than the screen resolution. Besides, your last sentence was certainly not neccessary. You among friends here.

My apologies if I sounded too harsh, no offense was intended. I just meant that your code and mine achieves the same and (hopefully) correct results And because the code is in a non-performance critical section, I don't care whichever is used (except for the var->yres and info->var.yres issue).

If the code affects a critical section (blitting, character painting, etc), of course, that's another story.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#60 lore raw
In reply to Antonino Daplas
Quoted 3 lines

Try this patch. The fbcon_resize test is more liberal and it now correctly updates p->vrows and scroll_phys_max (for panning glitches).

Applied.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#61 lore raw
In reply to Antonino Daplas
Quoted 9 lines

However, the brokenness is really on the driver side. They are unable to change the video mode unless they are supplied with the correct timing parameters where in fact they actually have the best knowledge on how to calculate them.

So the question: Do we let fbcon spoonfeed the timings to fbdev, or do we let the drivers calculate it for themselves? I go for the latter, as fbcon really should not have any business with hardware.

I agree.

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en

#62 lore raw
Quoted 11 lines · James Simmons
Quoted 8 lines

However, the brokenness is really on the driver side. They are unable to change the video mode unless they are supplied with the correct timing parameters where in fact they actually have the best knowledge on how to calculate them.

So the question: Do we let fbcon spoonfeed the timings to fbdev, or do we let the drivers calculate it for themselves? I go for the latter, as fbcon really should not have any business with hardware.

I agree.

Me Too(tm). SiSfb (sorry for mentioning this one over and over, but that's the only one I am working on) does that now, according to the following assumptions:

If old_x == new_x && old_y == new_y && old_clock == new_clock

-> assume a change in depth, hence recalculate the clock based on the htotal and vtotal values (which are calculated using var's horizontal and vertical timing.

else if (old_x != new_x || old_y != new_y) && old_clock == new_clock

	-> assume a mode change originating from fbcon_resize (where
	only xres and yres are changed, everything else left unchanged; 	 

hence, use the default clock (user selectable) because clock is
invalid.

else if(timings are valid)

	-> use these timings, they originate from an application
	using the framebuffer device properly (directFB, for instance)

else -> use default clock

Works perfectly. Tested all possible applications (mplayer, sdl stuff, etc), no problems.

Thomas

Signature · 9 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
#63 lore raw
In reply to Antonino Daplas
Quoted 8 lines
Quoted 4 lines

Well, this assumes that the user always want the best refresh rate, which is not desired in all cases.

fb_get_mode() accepts 4 flags. Maximum refresh rate, hscan-driven, vrefresh-driven and dotclock-driven calculations. It's flexible enough, but of course not as flexible as specifying your own modeline.

Things like pixclock rates can be changes by fbset and fbcon still sees these changes. stty is for the basic changes and fbset for advance changes.

On a personal note. Many fbdev drivers in 2.4.X where also broken in that only the boot mode worked. This is where the fbset mode database in userland hack came in (/etc/fb.modes). This is horriable. Even with that userland database I often couldn't change video modes after booting.

We should split the monitor programing stuff out from stuff like bpp etc. Now if you think about it we can do things like change the bpp without having to redo the monitor programming. This is the flaw with the old and even the new api.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#64 lore raw
Quoted 3 lines · James Simmons

On a personal note. Many fbdev drivers in 2.4.X where also broken in that only the boot mode worked. This is where the fbset mode database in userland hack came in (/etc/fb.modes). This is horriable. Even with that

Do you remember how modes were set before the existence of fbset? I guess not :-)

A driver could support up to 31 modes (cfr. the old minors). You changed mode by touch'ing the /dev/fb0my_favorite_mode special device that corresponded to the mode you wanted.

Quoted 1 line

userland database I often couldn't change video modes after booting.

Ugh, those are serious driver bugs....

Quoted 4 lines

We should split the monitor programing stuff out from stuff like bpp etc. Now if you think about it we can do things like change the bpp without having to redo the monitor programming. This is the flaw with the old and even the new api.

You could have done that from the beginning. Just look at which fields have changed and which haven't.

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

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#65 lore raw
Quoted 3 lines

Do you remember how modes were set before the existence of fbset? I guess not :-)

before my time.

Quoted 3 lines

A driver could support up to 31 modes (cfr. the old minors). You changed mode by touch'ing the /dev/fb0my_favorite_mode special device that corresponded to the mode you wanted.

Yuck!!!!

Quoted 3 lines
Quoted 1 line

userland database I often couldn't change video modes after booting.

Ugh, those are serious driver bugs....

So the arrgument that fbset is the solution to all problems is bogus IMO.

Quoted 7 lines
Quoted 4 lines

We should split the monitor programing stuff out from stuff like bpp etc. Now if you think about it we can do things like change the bpp without having to redo the monitor programming. This is the flaw with the old and even the new api.

You could have done that from the beginning. Just look at which fields have changed and which haven't.

I should of but didn't because I knew driver would take teh path of lest resistance to port there drivers. TO much change would have made the current situtation much much worst.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#66 lore raw
Quoted 8 lines · James Simmons
Quoted 5 lines
Quoted 2 lines

We should split the monitor programing stuff out from stuff like bpp etc.
Now if you think about it we can do things like change the bpp without having to redo the monitor programming. This is the flaw with the old and even the new api.

You could have done that from the beginning. Just look at which fields have changed and which haven't.

I should of but didn't because I knew driver would take teh path of lest resistance to port there drivers. TO much change would have made the current situtation much much worst.

One could argue that changing stuff more or less constantly does not make it any easier to keep up with a working driver.... :)

Thomas

Signature · 8 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#67 lore raw
Quoted 7 lines
Quoted 4 lines

I should of but didn't because I knew driver would take teh path of lest resistance to port there drivers. TO much change would have made the current situtation much much worst.

One could argue that changing stuff more or less constantly does not make it any easier to keep up with a working driver.... :)

Well that was a policy change later on. At first the approach was small changes at a time. I was even converting each driver by myself. This upset some people. It was discussed the best solution would be to dump all the changes at one time and then let the driver maintainers deal with it. That is why the shift in what was going on.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#68 lore raw
In reply to James Simmons
Quoted 11 lines · James Simmons
Quoted 7 lines
Quoted 4 lines

We should split the monitor programing stuff out from stuff like bpp etc. Now if you think about it we can do things like change the bpp without having to redo the monitor programming. This is the flaw with the old and even the new api.

You could have done that from the beginning. Just look at which fields have changed and which haven't.

I should of but didn't because I knew driver would take teh path of lest resistance to port there drivers. TO much change would have made the current situtation much much worst.

One other reason why this isn't done is because X may interfere with it. If we don't do a full register update, but change the parts that need a change only, we will see less flickering (no PLL reprogramming), but we will suffer if X doesn't restore the registers to the exact same values they were before.

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

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#69 lore raw
Quoted 9 lines · Geert Uytterhoeven
Quoted 8 lines · James Simmons
Quoted 7 lines
Quoted 4 lines

We should split the monitor programing stuff out from stuff like bpp etc. Now if you think about it we can do things like change the bpp without having to redo the monitor programming. This is the flaw with the old and even the new api.

You could have done that from the beginning. Just look at which fields have changed and which haven't.

Quoted 8 lines
Quoted 3 lines

I should of but didn't because I knew driver would take teh path of lest resistance to port there drivers. TO much change would have made the current situtation much much worst.

One other reason why this isn't done is because X may interfere with it. If we don't do a full register update, but change the parts that need a change only, we will see less flickering (no PLL reprogramming), but we will suffer if X doesn't restore the registers to the exact same values they were before.

X is supposed to do that, even if it doesn't know anything about fbdevs, maybe especially if it doesn't know anything about fbdevs. If it knows about fbdev and uses it, X should not be touching the modes anyway, right ?

So, we are saving/restoring things twice, one time in X, the other in the fbdev.

Friendly,

Sven Luther

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#70 lore raw
In reply to Geert Uytterhoeven
Quoted 9 lines · Geert Uytterhoeven
Quoted 8 lines · James Simmons
Quoted 7 lines
Quoted 4 lines

We should split the monitor programing stuff out from stuff like bpp etc. Now if you think about it we can do things like change the bpp without having to redo the monitor programming. This is the flaw with the old and even the new api.

You could have done that from the beginning. Just look at which fields have changed and which haven't.

Quoted 9 lines
Quoted 3 lines

I should of but didn't because I knew driver would take teh path of lest resistance to port there drivers. TO much change would have made the current situtation much much worst.

One other reason why this isn't done is because X may interfere with it. If we don't do a full register update, but change the parts that need a change only, we will see less flickering (no PLL reprogramming), but we will suffer if X doesn't restore the registers to the exact same values they were before.

Ideally, that is what should happen. However, fb_set_var does a check if the passed var is different from the default var. If it's the same, fb_set_par is skipped. Switching back from X, this check will be mostly false, so fb_set_par will be skipped, and register refreshing would have failed.

So, I think fbcon should also detect if the previous console is not fbcon (ie previous con > last_fbvc || previous con < first_fbvc), and if it isn't, force an fb_set_par.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#71 lore raw
Quoted 4 lines

So, I think fbcon should also detect if the previous console is not fbcon (ie previous con > last_fbvc || previous con < first_fbvc), and if it isn't, force an fb_set_par.

This whole idea of mapping a specific VC to a specific piece of hardware is just plain dumb and overly complex. The new console system will allocate a set of 16 console to each independent VT.

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en

#72 lore raw
Quoted 9 lines · James Simmons
Quoted 4 lines

So, I think fbcon should also detect if the previous console is not fbcon (ie previous con > last_fbvc || previous con < first_fbvc), and if it isn't, force an fb_set_par.

This whole idea of mapping a specific VC to a specific piece of hardware is just plain dumb and overly complex. The new console system will allocate a set of 16 console to each independent VT.

Well, you have info->currcon, fg_console etc... No mapping is done, fbcon will just keep track of the tty's it's currently switched to (vt.c does it, and so does fbcon_switch), and fbcon will just look if the vc has a valid PID (which means a process installed its own vc) and therefore not trust it to completely preserve the graphics state.

Note that X does something like this to protect itself. When switch from console to X, it refreshes its own registers.

I think you may need some support for this. Several have already reported that switching from X to a console results in a corrupted display which can be cleared by doing an fbset.

The choices are:

1. refresh the registers at every switch - slowest but guarantees hardware state is always preserved

2. do not refresh unless var changed - fasted but can result in corruption/crash if registers were changed behind the back of fbdev

3. selective refresh - do not refresh if switching between "trusted" consoles, refresh if switching from "untrusted" consoles.

4. Find a method to detect if the registers were changed behind the back of fbdev.

Tony

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en

#73 lore raw
Quoted 8 lines · Antonino Daplas

Well, you have info->currcon, fg_console etc... No mapping is done, fbcon will just keep track of the tty's it's currently switched to (vt.c does it, and so does fbcon_switch), and fbcon will just look if the vc has a valid PID (which means a process installed its own vc) and therefore not trust it to completely preserve the graphics state.

Note that X does something like this to protect itself. When switch from console to X, it refreshes its own registers.

Which does not neccessarily mean that the framebuffer driver must do the same, resulting in two mode switches. Not really healthy for LCD panels.

The current implementation (as with James' latest patch) does not show any problems with this, even when switching back to a console with a different resolution than the one X was started under. Then again, maybe that's just due to a all too well working sis driver combination :)

Quoted 8 lines

I think you may need some support for this. Several have already reported that switching from X to a console results in a corrupted display which can be cleared by doing an fbset.

The choices are:

1. refresh the registers at every switch - slowest but guarantees hardware state is always preserved

Bad. Takes long time, especially on LCD displays which always need a little delay for backlight and sync stability reasons.

Quoted 2 lines

2. do not refresh unless var changed - fasted but can result in corruption/crash if registers were changed behind the back of fbdev

I think one can rely on tidyness of applications changing the registers. Like X does.

Quoted 5 lines

3. selective refresh - do not refresh if switching between "trusted" consoles, refresh if switching from "untrusted" consoles.

4. Find a method to detect if the registers were changed behind the back of fbdev.

Very time taking on some hardware (such as ... erm... SiS) with more than 100 registers for graphic mode setup.

Thomas

Signature · 9 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
#74 lore raw
Quoted 6 lines · Thomas Winischhofer
Quoted 5 lines

The choices are:

1. refresh the registers at every switch - slowest but guarantees hardware state is always preserved

Quoted 8 lines

Bad. Takes long time, especially on LCD displays which always need a little delay for backlight and sync stability reasons.

Quoted 2 lines

2. do not refresh unless var changed - fasted but can result in corruption/crash if registers were changed behind the back of fbdev

I think one can rely on tidyness of applications changing the registers. Like X does.

Unfortunately, this is what we are trying to prevent. X assumes that the console is in text mode, so only registers that affect text mode are restored. Frequently, cursor registers and bitmaps, as an example, are not refreshed. There's probably more, ie accel engine, etc.

Of course, X is not totally to blame, it's doing its best to restore the console back. It really depends on the X drivers, how complicated they are, how comprehensive are their restore routines, etc.

Quoted 2 lines
Quoted 2 lines

3. selective refresh - do not refresh if switching between "trusted" consoles, refresh if switching from "untrusted" consoles.

I actually prefer #3, and I already have working code for this. We can also make this driver switchable (ie, drivers that are not affected by X can disable this, and only drivers that are affected such as the riva, aty, radeon, etc can turn this on).

Tony

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en

#75 lore raw
Quoted 10 lines · Antonino Daplas
Quoted 4 lines
Quoted 2 lines

2. do not refresh unless var changed - fasted but can result in corruption/crash if registers were changed behind the back of fbdev

I think one can rely on tidyness of applications changing the registers. Like X does.

Unfortunately, this is what we are trying to prevent. X assumes that the console is in text mode, so only registers that affect text mode are restored. Frequently, cursor registers and bitmaps, as an example, are not refreshed. There's probably more, ie accel engine, etc.

That surprises me. The X drivers I looked at (quite a bunch) restore all registers (that need to be restored, that is)

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

3. selective refresh - do not refresh if switching between "trusted" consoles, refresh if switching from "untrusted" consoles.

I actually prefer #3, and I already have working code for this. We can also make this driver switchable (ie, drivers that are not affected by X can disable this, and only drivers that are affected such as the riva, aty, radeon, etc can turn this on).

What exactly is a "trusted" console?

Thomas

Signature · 9 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
#76 lore raw
Quoted 8 lines · Thomas Winischhofer
Quoted 5 lines

I actually prefer #3, and I already have working code for this. We can also make this driver switchable (ie, drivers that are not affected by X can disable this, and only drivers that are affected such as the riva, aty, radeon, etc can turn this on).

What exactly is a "trusted" console?

By default, the pid of each vt is -1. When X loads, it installs its own VT (ie vt7), which in that case the pid of that particular vt == X's pid. We can check this pid, and if switching from a vt with pid == -1, we can safely assume that the hardware state is still sane, and if not, assume the hardware state is undefined.

Tony

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en

#77 lore raw
Quoted 7 lines · Antonino Daplas
Quoted 6 lines · Thomas Winischhofer
Quoted 5 lines

I actually prefer #3, and I already have working code for this. We can also make this driver switchable (ie, drivers that are not affected by X can disable this, and only drivers that are affected such as the riva, aty, radeon, etc can turn this on).

Quoted 7 lines
Quoted 1 line

What exactly is a "trusted" console?

By default, the pid of each vt is -1. When X loads, it installs its own VT (ie vt7), which in that case the pid of that particular vt == X's pid. We can check this pid, and if switching from a vt with pid == -1, we can safely assume that the hardware state is still sane, and if not, assume the hardware state is undefined.

Can you also detect when the app has opened the framebuffer device, and assume it's playing nice when it has? (for Option "UseFBDev")

Signature · 10 lines
Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
#78 lore raw
Quoted 10 lines · Michel Dänzer
Quoted 9 lines · Antonino Daplas
Quoted 7 lines · Thomas Winischhofer
Quoted 5 lines

I actually prefer #3, and I already have working code for this. We can also make this driver switchable (ie, drivers that are not affected by X can disable this, and only drivers that are affected such as the riva, aty, radeon, etc can turn this on).

What exactly is a "trusted" console?

Quoted 9 lines
Quoted 5 lines

By default, the pid of each vt is -1. When X loads, it installs its own VT (ie vt7), which in that case the pid of that particular vt == X's pid. We can check this pid, and if switching from a vt with pid == -1, we can safely assume that the hardware state is still sane, and if not, assume the hardware state is undefined.

Can you also detect when the app has opened the framebuffer device, and assume it's playing nice when it has? (for Option "UseFBDev")

X using fbdev will also have the same limitation. I have implemented something like this before. For each fb_open, the current->pid can be saved into a "white list" and removed for each fb_close. fbcon can then compare this to the pid of the vt it's switching from.

This is becoming to sound very ugly though. I guess, the best way is to really support Option "UseFBDev", or at least have the user decide if he/she wants to have the hardware refreshed.

Tony

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en

#79 lore raw
Quoted 17 lines · Antonino Daplas
Quoted 16 lines · Michel Dänzer
Quoted 14 lines · Antonino Daplas
Quoted 7 lines · Thomas Winischhofer
Quoted 5 lines

I actually prefer #3, and I already have working code for this. We can also make this driver switchable (ie, drivers that are not affected by X can disable this, and only drivers that are affected such as the riva, aty, radeon, etc can turn this on).

What exactly is a "trusted" console?

By default, the pid of each vt is -1. When X loads, it installs its own VT (ie vt7), which in that case the pid of that particular vt == X's pid. We can check this pid, and if switching from a vt with pid == -1, we can safely assume that the hardware state is still sane, and if not, assume the hardware state is undefined.

Quoted 8 lines
Quoted 3 lines

Can you also detect when the app has opened the framebuffer device, and assume it's playing nice when it has? (for Option "UseFBDev")

X using fbdev will also have the same limitation. I have implemented something like this before. For each fb_open, the current->pid can be saved into a "white list" and removed for each fb_close. fbcon can then compare this to the pid of the vt it's switching from.

I see, makes sense.

Quoted 3 lines

This is becoming to sound very ugly though. I guess, the best way is to really support Option "UseFBDev", or at least have the user decide if he/she wants to have the hardware refreshed.

I'm afraid I don't understand what you're saying here.

Signature · 10 lines
Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
#80 lore raw
Quoted 18 lines · On 12 Mar 2003, Michel [ISO-8859-1] Dänzer wrote:
Quoted 17 lines · Antonino Daplas
Quoted 16 lines · Michel Dänzer
Quoted 14 lines · Antonino Daplas
Quoted 7 lines · Thomas Winischhofer
Quoted 5 lines

I actually prefer #3, and I already have working code for this. We can also make this driver switchable (ie, drivers that are not affected by X can disable this, and only drivers that are affected such as the riva, aty, radeon, etc can turn this on).

What exactly is a "trusted" console?

By default, the pid of each vt is -1. When X loads, it installs its own VT (ie vt7), which in that case the pid of that particular vt == X's pid. We can check this pid, and if switching from a vt with pid == -1, we can safely assume that the hardware state is still sane, and if not, assume the hardware state is undefined.

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

Can you also detect when the app has opened the framebuffer device, and assume it's playing nice when it has? (for Option "UseFBDev")

X using fbdev will also have the same limitation. I have implemented something like this before. For each fb_open, the current->pid can be saved into a "white list" and removed for each fb_close. fbcon can then compare this to the pid of the vt it's switching from.

The application cannot play not nice unless it mmap()s the MMIO registers. To be able to do that, it first has to clear FB_ACCELF_TEXT in var.accel_flags.

Quoted 5 lines
Quoted 3 lines

This is becoming to sound very ugly though. I guess, the best way is to really support Option "UseFBDev", or at least have the user decide if he/she wants to have the hardware refreshed.

I'm afraid I don't understand what you're saying here.

But I think you do agree :-) He says that if fbdev is active, the X server has to be fbdev compliant and thus not mess with the hardware where it's not allowed to.

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

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en

#81 lore raw
Quoted 22 lines · Geert Uytterhoeven
Quoted 21 lines · On 12 Mar 2003, Michel [ISO-8859-1] Dänzer wrote:
Quoted 20 lines · Antonino Daplas
Quoted 18 lines · Michel Dänzer
Quoted 7 lines · Antonino Daplas
Quoted 6 lines · Thomas Winischhofer
Quoted 5 lines

I actually prefer #3, and I already have working code for this. We can also make this driver switchable (ie, drivers that are not affected by X can disable this, and only drivers that are affected such as the riva, aty, radeon, etc can turn this on).

Quoted 7 lines
Quoted 1 line

What exactly is a "trusted" console?

By default, the pid of each vt is -1. When X loads, it installs its own VT (ie vt7), which in that case the pid of that particular vt == X's pid. We can check this pid, and if switching from a vt with pid == -1, we can safely assume that the hardware state is still sane, and if not, assume the hardware state is undefined.

Can you also detect when the app has opened the framebuffer device, and assume it's playing nice when it has? (for Option "UseFBDev")

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

X using fbdev will also have the same limitation. I have implemented something like this before. For each fb_open, the current->pid can be saved into a "white list" and removed for each fb_close. fbcon can then compare this to the pid of the vt it's switching from.

The application cannot play not nice unless it mmap()s the MMIO registers. To be able to do that, it first has to clear FB_ACCELF_TEXT in var.accel_flags.

X will map the MMIO registers with Option "UseFBDev" and still play nice (hopefully :).

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

This is becoming to sound very ugly though. I guess, the best way is to really support Option "UseFBDev", or at least have the user decide if he/she wants to have the hardware refreshed.

I'm afraid I don't understand what you're saying here.

But I think you do agree :-) He says that if fbdev is active, the X server has to be fbdev compliant and thus not mess with the hardware where it's not allowed to.

I agree that's how it should be.

Signature · 10 lines
Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
#82 lore raw
In reply to Antonino Daplas
Quoted 4 lines · Antonino Daplas

Unfortunately, this is what we are trying to prevent. X assumes that the console is in text mode, so only registers that affect text mode are restored. Frequently, cursor registers and bitmaps, as an example, are not refreshed. There's probably more, ie accel engine, etc.

Argh.. of course, cursor and accelerator registers are usually not restored, you're right at this. But the drivers usually leave the engine in the same state as when started. (A "restore" of accelerator engine registers is mostly impossible, because a complete restore would cause the last command to be executed again)

Thomas

Signature · 9 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
#83 lore raw
Quoted 6 lines · Thomas Winischhofer
Quoted 4 lines · Antonino Daplas

Unfortunately, this is what we are trying to prevent. X assumes that the console is in text mode, so only registers that affect text mode are restored. Frequently, cursor registers and bitmaps, as an example, are not refreshed. There's probably more, ie accel engine, etc.

Quoted 6 lines

Argh.. of course, cursor and accelerator registers are usually not restored, you're right at this. But the drivers usually leave the engine in the same state as when started. (A "restore" of accelerator engine registers is mostly impossible, because a complete restore would cause the last command to be executed again)

The accel engine is probably not a problem if it uses mmio. However, engines that use command buffers are more susceptible to this if the buffers can be dynamically allocated by the process.

The i810 for instance uses ringbuffers. It has to be dynamically allocated via agpgart. Fortunately, the i810 can support 2 ringbuffers, so X can use one and fb the other, so there's no conflict.

Then you also have DRI joining in the confusion :-)

The best solution, personally, is to have one module controlling chipset access -- DRM for 2D and 3D, and fb for video mode switching.

Tony

-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en

#84 lore raw
Quoted 3 lines · Antonino Daplas

The accel engine is probably not a problem if it uses mmio. However, engines that use command buffers are more susceptible to this if the buffers can be dynamically allocated by the process.

OK, ack.

Quoted 6 lines

The i810 for instance uses ringbuffers. It has to be dynamically allocated via agpgart. Fortunately, the i810 can support 2 ringbuffers, so X can use one and fb the other, so there's no conflict.

Then you also have DRI joining in the confusion :-)

Not in my case :) The SiS DRI stuff is made in a way to prevent problems of this kind. But I ack that it might be on others.

Quoted 2 lines

The best solution, personally, is to have one module controlling chipset access -- DRM for 2D and 3D, and fb for video mode switching.

Well. I personally don't want every graphics application to depend on kernel modules.

Thomas

Signature · 9 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]          *** http://www.winischhofer.net



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
#85 lore raw
In reply to Antonino Daplas
Quoted 11 lines · Antonino Daplas
Quoted 10 lines

3) The resizing using stty is - how do I put this - slightly imperfect. I don't know how you fbdev folks do it, but I am not used to think in row/col categories, but *resolutions* instead. Apart from this - IMHO a bit annoying - inconvenience, this method has further issues:

a) Calculating the desired mode resolution my simply multiplying the rows/cols by the font size very often results in odd modes like 800x592. This even when using a standard 8x16 font, not thinking of situations where for instance 12x22 fonts are used. How is the low level driver supposed to handle this?

Quoted 3 lines

Ideally, the driver should round up to the nearest mode it's capable of. The "fraction of a character dimensions" will be automatically cleared by the "clear_margins" hook.

But if I say e.g. `fbset 800x600-90', I do want a 90 Hz 800x600 mode, whatever the font may be.

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

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

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

Ideally, the driver should round up to the nearest mode it's capable of. The "fraction of a character dimensions" will be automatically cleared by the "clear_margins" hook.

But if I say e.g. `fbset 800x600-90', I do want a 90 Hz 800x600 mode, whatever the font may be.

Seems the fbdev people themselves aren't really happy with that stty solution...? :)

Thomas

Signature · 12 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#87 lore raw
In reply to Antonino Daplas

Further to my mail from a few minutes ago:

Quoted 11 lines · I wrote:

But I noticed another issue here:

When switching to gfx mode during boot (ie as soon as the penguin appears), the text console is aligned correctly at all edges, with all lines visible.

But when "initial console" starts, the mode is again changed, and now the last line of text is nearly invisible, its upper half appears at the lower screen edge, the lower half is below the screen's edge. The space between the penguin and the text is notably thicker.

Quoted 7 lines

This can be recovered by switching to another VT and back. This makes the penguin disappear, and restores the console dimensions/edges to normal.

Interestingly, this only happens with 800x600; this mode is chosen upon requesting 800x592 (because of the font size). At 1024x768, everything is as it should.

I am almost sure that this has to do with the fact that I adapt var in my check_var from 800x592 to 800x600. Console (or whoever) seems to attempt to change the mode to its initially desired dimension on many occasions.

- This leads to the (unncessary) second mode switch during boot (when the "initial console" starts), assumingly because the xres does not match fontsize * rows,

- and probably is the reason for that vertical offset I see after this mode switch: The text area on the screen is shifted down by exactly 8 pixels - 600-592=8

Any hints?

Thomas

Signature · 12 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#88 lore raw
Quoted 19 lines · Thomas Winischhofer

Further to my mail from a few minutes ago:

Quoted 14 lines · I wrote:

But I noticed another issue here:

When switching to gfx mode during boot (ie as soon as the penguin appears), the text console is aligned correctly at all edges, with all lines visible.

But when "initial console" starts, the mode is again changed, and now the last line of text is nearly invisible, its upper half appears at the lower screen edge, the lower half is below the screen's edge. The space between the penguin and the text is notably thicker.

This can be recovered by switching to another VT and back. This makes the penguin disappear, and restores the console dimensions/edges to normal.

Quoted 9 lines
Quoted 3 lines

Interestingly, this only happens with 800x600; this mode is chosen upon requesting 800x592 (because of the font size). At 1024x768, everything is as it should.

I am almost sure that this has to do with the fact that I adapt var in my check_var from 800x592 to 800x600. Console (or whoever) seems to attempt to change the mode to its initially desired dimension on many occasions.

Strange. If you boot at 800x600, the console will compute that as 100x37. On fbcon_resize, it will request 800x592 but because the difference is only 8, fb_set_var should be skipped, so no mode change should happen throughout.

Quoted 3 lines

- This leads to the (unncessary) second mode switch during boot (when the "initial console" starts), assumingly because the xres does not match fontsize * rows,

At boot time, there are several times the display changes (not necessarily mode changes) -- while the logo is being displayed, after the logo got displayed, and during init.

Quoted 7 lines

- and probably is the reason for that vertical offset I see after this mode switch: The text area on the screen is shifted down by exactly 8 pixels - 600-592=8

Any hints?

I have no idea. I booted with other drivers at 800x600 and get no ill effects. I get a margin at the bottom of 8 pixels.

How about checking what the offsets are during fb_pan_display()?

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#89 lore raw
In reply to Antonino Daplas

Sorry, but I send mails faster than I can think sometimes:

Quoted 3 lines

- and probably is the reason for that vertical offset I see after this mode switch: The text area on the screen is shifted down by exactly 8
pixels - 600-592=8

Or perhaps the fbcon_resize stuff does

1) either not take the penguin into account,

or

2) does this too early, namely before the call to check_var()?

Thomas

Signature · 10 lines
Thomas Winischhofer
Vienna/Austria
mailto:[email protected]            http://www.winischhofer.net/





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
#90 lore raw
In reply to Antonino Daplas
Quoted 7 lines
Quoted 4 lines

However, I could not manage to gain a graphical console if sisfb is a module, but fbcon is in the kernel. Is this combination supposed to work? If so, how?

No, fbcon will not load unless there's at least one registered fbdev. So, you must compile sisfb statically too.

I fixed this in my latest patch. You can use con2fb again!!!!!!

Quoted 7 lines
Quoted 4 lines

b) The call to fb_set_var() inside fbcon_resize() is checked for errors, but not the call to fbcon_resize() from within fbcon_switch(). This leads to catastrophic drawing errors if the requested mode is not supported by the low level driver.

Yes, it's a bug. I think I submitted a patch to fix that, but I'm not sure if James applied it to his tree.

Applied.

Quoted 2 lines

Another solution is to reimplement resizing by fbset. The code is not very difficult and can be added if most people want it.

:-(

Quoted 4 lines

Yes, this is a limitation of stty. It calls con_resize twice (one for row and another for cols, depending on the order of the options) so it will not work if the driver only supports a fixed set of modes. Another reason to bring back fbset resizing.

???? stty rows 128 cols 48 works for me. It should'nt calling con_resize twice.

Quoted 6 lines
Quoted 5 lines

3) About y panning: In the 2.4 version of sisfb, I simply forced the console to do y panning (unless positively disabled by the user) by "patching" yres_virtual to the maximum, depending on the available video memory. I am allowed to do that with the 2.5 API? (The rivafb code makes be believe so...)

Quoted 6 lines

Scrolling mode is now determined by fbcon. If var->accel_flag is nonzero, scrolling is ypan, otherwise, it's yredraw. It's because ypan requres a lot of block copy which is slow when done by software.

I still believe though that scrolling should be determined by the driver, not fbcon.

Scrolling needs alot of work. I plan to fix that.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#91 lore raw
Quoted 8 lines · James Simmons
Quoted 4 lines

Yes, this is a limitation of stty. It calls con_resize twice (one for row and another for cols, depending on the order of the options) so it will not work if the driver only supports a fixed set of modes. Another reason to bring back fbset resizing.

???? stty rows 128 cols 48 works for me. It should'nt calling con_resize twice.

It does. You probably won't notice it if the driver supports flexible video mode changing. For drivers that don't it will fail. For instance, if a driver supports 800x600 and 1024x768 only, and stty is used to change the mode from 1024x768 to 800x600, it will be done like this:

resize to 800x768 <--- because no mode matches this, resizing fails resize to 800x600

If you don't believe me, do an strace stty cols 80 rows 30.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com

#92 lore raw
In reply to Thomas Winischhofer
Quoted 6 lines

I am currently porting the SiS framebuffer driver to the - more or less
- new API. Better late than never :)

Anyway, during this, I noticed some issues: (I am using stock 2.5.63 for development, no fbdev patches)

Please try your driver with the patch I post and tell me what problems you still have. Most of those shoudl have been fixes now.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com