Skip to content

Commit a3de468

Browse files
maciej-w-rozyckigregkh
authored andcommitted
vgacon: Record video mode changes with VT_RESIZEX
commit d4d0ad5 upstream. Fix an issue with VGA console font size changes made after the initial video text mode has been changed with a user tool like `svgatextmode' calling the VT_RESIZEX ioctl. As it stands in that case the original screen geometry continues being used to validate further VT resizing. Consequently when the video adapter is firstly reprogrammed from the original say 80x25 text mode using a 9x16 character cell (720x400 pixel resolution) to say 80x37 text mode and the same character cell (720x592 pixel resolution), and secondly the CRTC character cell updated to 9x8 (by loading a suitable font with the KD_FONT_OP_SET request of the KDFONTOP ioctl), the VT geometry does not get further updated from 80x37 and only upper half of the screen is used for the VT, with the lower half showing rubbish corresponding to whatever happens to be there in the video memory that maps to that part of the screen. Of course the proportions change according to text mode geometries and font sizes chosen. Address the problem then, by updating the text mode geometry defaults rather than checking against them whenever the VT is resized via a user ioctl. Signed-off-by: Maciej W. Rozycki <[email protected]> Fixes: e400b6e ("vt/vgacon: Check if screen resize request comes from userspace") Cc: [email protected] # v2.6.24+ Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8e0d302 commit a3de468

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/video/console/vgacon.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,12 +1108,20 @@ static int vgacon_resize(struct vc_data *c, unsigned int width,
11081108
if ((width << 1) * height > vga_vram_size)
11091109
return -EINVAL;
11101110

1111+
if (user) {
1112+
/*
1113+
* Ho ho! Someone (svgatextmode, eh?) may have reprogrammed
1114+
* the video mode! Set the new defaults then and go away.
1115+
*/
1116+
screen_info.orig_video_cols = width;
1117+
screen_info.orig_video_lines = height;
1118+
vga_default_font_height = c->vc_font.height;
1119+
return 0;
1120+
}
11111121
if (width % 2 || width > screen_info.orig_video_cols ||
11121122
height > (screen_info.orig_video_lines * vga_default_font_height)/
11131123
c->vc_font.height)
1114-
/* let svgatextmode tinker with video timings and
1115-
return success */
1116-
return (user) ? 0 : -EINVAL;
1124+
return -EINVAL;
11171125

11181126
if (con_is_visible(c) && !vga_is_gfx) /* who knows */
11191127
vgacon_doresize(c, width, height);

0 commit comments

Comments
 (0)