[PATCH] fbcon needs to save/restore the screeninfo for vc switches

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[PATCH] fbcon needs to save/restore the screeninfo for vc switches

Bart Oldeman

I observed that the original resolution is lost when I flip consoles back
and forth using the alt-fn keys. This is using Linux kernel 2.6.14,
radeonfb. The patch below fixes this. Perhaps this isn't meant to be
used, and it's a kernel bug, but then it just works around a kernel bug ;)

By the way, does anyone why SDL freezes the application when switched away
using fbcon? It could catch a signal for flipping back, and provide a
fake frame buffer at a fixed position so that the application can work in
the background.

Using ctrl-alt-fn for flipping instead of alt-fn may help a few games that
actually use that key combination. Would such a patch be accepted, or
should something like that be configurable (environment variable?)


Index: src/video/fbcon/SDL_fbevents.c
RCS file: /home/sdlweb/libsdl.org/cvs/SDL12/src/video/fbcon/SDL_fbevents.c,v
retrieving revision 1.14
diff -u -r1.14 SDL_fbevents.c
--- src/video/fbcon/SDL_fbevents.c 4 Jan 2005 19:04:14 -0000 1.14
+++ src/video/fbcon/SDL_fbevents.c 28 Nov 2005 08:13:44 -0000
@@ -834,6 +834,7 @@
  static void switch_vt(_THIS, unsigned short which)
+ struct fb_var_screeninfo vinfo;
  struct vt_stat vtstate;
  unsigned short v_active;
  SDL_Surface *screen;
@@ -858,6 +859,7 @@
  memcpy(screen_contents, screen->pixels, screen_arealen);
  FB_SavePaletteTo(this, 256, saved_pal);
+ ioctl(console_fd, FBIOGET_VSCREENINFO, &vinfo);
  ioctl(keyboard_fd, KDSETMODE, KD_TEXT);

  /* New console, switch to it */
@@ -875,6 +877,7 @@

  /* Restore graphics mode and the contents of the screen */
  ioctl(keyboard_fd, KDSETMODE, KD_GRAPHICS);
+ ioctl(console_fd, FBIOPUT_VSCREENINFO, &vinfo);
  FB_RestorePaletteFrom(this, 256, saved_pal);
  if ( screen_contents ) {
  memcpy(screen->pixels, screen_contents, screen_arealen);

SDL mailing list
[hidden email]