FBDEV: VGA Save/Restore module - round 2
PATCH 1/1 FBDEV: VGA Save/Restore module - round 2
Hi,
Attached is an updated patch against linux-2.5.50 + James Simmons' fbdev.diff. Most of the changes are as per suggestions by Petr Vandrovec (Thanks!) targeted towards selective saves/and restores specific to the setting of vgacon.
Tested drivers:
vga16fb using VGA_SAVE_CMAP | VGA_SAVE_MODE flags will correctly restore VGA text mode and high resolution graphics mode.
rivafb (riva128) using VGA_SAVE_CMAP | VGA_SAVE_MODE | VGA_SAVE_FONT0 flags effectively restores VGA text and graphics mode with minor screen corruption.
Tony
PS: Please reverse previous patches (vgastate.diff and vgastate1.diff) if applied.
drivers/video/Makefile +1 -1
@@ -6,7 +6,7 @@ # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'. export-objs := fbmem.o fbcmap.o fbmon.o modedb.o softcursor.o cfbfillrect.o \ - cfbcopyarea.o cfbimgblt.o cyber2000fb.o + cfbcopyarea.o cfbimgblt.o cyber2000fb.o vgastate.o # Each configuration option enables a list of files.
drivers/video/vgastate.c +504 -0
504 lines not on this page · raw message
include/linux/fb.h +24 -0
@@ -321,6 +321,30 @@struct fb_image image;/* Cursor image */ }; +/* VGA State Save and Restore */ +#define VGA_SAVE_FONT0 1/* save/restore plane 2 fonts */ +#define VGA_SAVE_FONT1 2/* save/restore plane 3 fonts */ +#define VGA_SAVE_TEXT 4/* save/restore plane 0/1 fonts */ +#define VGA_SAVE_FONTS 7/* save/restore all fonts */ +#define VGA_SAVE_MODE 8/* save/restore video mode */ +#define VGA_SAVE_CMAP 16/* save/restore color map/DAC */ + +struct fb_vgastate { +caddr_t vgabase;/* mmio base, if supported */ +__u32 flags;/* what state/s to save (see VGA_SAVE_*) */ +__u32 membase;/* VGA window base, 0 for default - 0xa0000*/ +__u32 memsize;/* VGA window size, 0 for default - 64K */ +__u32 depth;/* current fb depth, not important */ +__u32 num_attr;/* number of att registers, 0 for default */ +__u32 num_crtc;/* number of crt registers, 0 for default */ +__u32 num_gfx;/* number of gfx registers, 0 for default */ +__u32 num_seq;/* number of seq registers, 0 for default */ +void *vidstate; +}; + +extern int fb_save_vga (struct fb_vgastate *state); +extern int fb_restore_vga (struct fb_vgastate *state); +#ifdef __KERNEL__#include <linux/fs.h>