2003-11-28 02:22:11

by Tonnerre Anklin

[permalink] [raw]
Subject: [FBDEV] Console switch/resolution change fix

Salut,

The VT is not resized by the framebuffer driver. However, as we set
the framebuffer resolution on VT switch based on the VT size, we end
up having always the same VT size. This patch adds a call to
vt_resize() to the state change manager and updates the VT
layer. Thus, if we resize the framebuffer, the VT is resized as
well. This fixes the resolution changeback bug.

It also fixes a wrong name in the Makefile and makes some printk()s
more informative.

This patch relies on the Framebuffer patch by James Simmons.

More on this patch can be found at
<URL:http://keepsake.keepsake.ch/~thunder/noyau/2.6.0-test11-ta1/fbcon_resolution_change.xml>

Thunder

diff -Nur linux-2.6.0-test11-fbdev/drivers/video/console/fbcon.c linux-2.6.0-test11-ta1/drivers/video/console/fbcon.c
--- linux-2.6.0-test11-fbdev/drivers/video/console/fbcon.c 2003-11-27 23:29:57.000000000 +0100
+++ linux-2.6.0-test11-ta1/drivers/video/console/fbcon.c 2003-11-27 17:59:01.000000000 +0100
@@ -962,7 +962,7 @@
int s_pitch = (vc->vc_font.width + 7) >> 3;
int size = s_pitch * vc->vc_font.height;
struct fb_cursor cursor;
- int cur_height, c, i;
+ int cur_height = 0, c, i;
u8 *dst;

memset(&cursor, 0, sizeof(struct fb_cursor));
@@ -1620,7 +1620,8 @@
}
if (info)
info->var.yoffset = p->yscroll = 0;
- fbcon_resize(vc, vc->vc_cols, vc->vc_rows);
+
+ 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;
@@ -2260,10 +2261,24 @@
case RESOLUTION_CHANGE: {
// Switch resolution size
int rows, cols;
-
- rows = info->var.xres / vc->vc_font.height;
- cols = info->var.yres / vc->vc_font.width;
- fbcon_resize(vc, cols, rows);
+
+ rows = info->var.yres / vc->vc_font.height;
+ cols = info->var.xres / vc->vc_font.width;
+ if (info->var.activate & FB_ACTIVATE_ALL) {
+ int i;
+
+ for (i = 0; i < MAX_NR_CONSOLES; i++)
+ if (vc_cons_allocated(i)) {
+ vc_resize(i, cols, rows);
+ vc_cons[i].d->vc_rows = rows;
+ vc_cons[i].d->vc_cols = cols;
+ }
+ } else {
+ vc_resize(fg_console, cols, rows);
+ vc_cons[fg_console].d->vc_rows = rows;
+ vc_cons[fg_console].d->vc_cols = cols;
+ }
+ fbcon_resize(vc, cols, rows);
info->state |= flag;
}
break;
diff -Nur linux-2.6.0-test11-fbdev/drivers/video/Makefile linux-2.6.0-test11-ta1/drivers/video/Makefile
--- linux-2.6.0-test11-fbdev/drivers/video/Makefile 2003-11-27 23:29:57.000000000 +0100
+++ linux-2.6.0-test11-ta1/drivers/video/Makefile 2003-11-27 17:59:01.000000000 +0100
@@ -32,7 +32,7 @@
obj-$(CONFIG_FB_CYBER) += cyberfb.o
obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_SGIVW) += sgivwfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
-obj-$(CONFIG_FB_3DFX) += tdfxfb.o cfbimgblit.o
+obj-$(CONFIG_FB_3DFX) += tdfxfb.o cfbimgblt.o
obj-$(CONFIG_FB_MAC) += macfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_HP300) += hpfb.o cfbfillrect.o cfbimgblt.o
obj-$(CONFIG_FB_OF) += offb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o
diff -Nur linux-2.6.0-test11-fbdev/drivers/video/riva/fbdev.c linux-2.6.0-test11-ta1/drivers/video/riva/fbdev.c
--- linux-2.6.0-test11-fbdev/drivers/video/riva/fbdev.c 2003-11-27 23:29:58.000000000 +0100
+++ linux-2.6.0-test11-ta1/drivers/video/riva/fbdev.c 2003-11-28 02:35:03.000000000 +0100
@@ -957,13 +957,13 @@

if (var->xres_virtual < var->xres) {
printk(KERN_ERR PFX
- "virtual X resolution (%d) is smaller than real\n", var->xres_virtual);
+ "virtual X resolution (%d) is smaller than real (%d)\n", var->xres_virtual, var->xres);
return -EINVAL;
}

if (var->yres_virtual < var->yres) {
printk(KERN_ERR PFX
- "virtual Y resolution (%d) is smaller than real\n", var->yres_virtual);
+ "virtual Y resolution (%d) is smaller than real (%d)\n", var->yres_virtual, var->yres);
return -EINVAL;
}
return 0;
@@ -1161,7 +1161,7 @@

riva_load_video_mode(info);
riva_setup_accel(par);
-
+
info->fix.line_length = (info->var.xres_virtual * (info->var.bits_per_pixel >> 3));
info->fix.visual = (info->var.bits_per_pixel == 8) ?
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;


Attachments:
(No filename) (4.32 kB)
signature.asc (189.00 B)
Digital signature
Download all attachments