Commit 7726d376 authored by James Simmons's avatar James Simmons

Some more small fixes.

parent a2dd1416
# Makefile for the Linux video drivers.
# 5 Aug 1999, James Simmons, <mailto:jsimmons@edgeglobal.com>
# 5 Aug 1999, James Simmons, <mailto:jsimmons@users.sf.net>
# Rewritten to use lists instead of if-statements.
O_TARGET := video.o
......@@ -10,7 +10,7 @@ mod-subdirs := matrox
# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
export-objs := fbmem.o fbcmap.o fbcon.o fbmon.o modedb.o \
fbcon-afb.o fbcon-ilbm.o \
fbcon-afb.o fbcon-ilbm.o fbcon-accel.o \
fbcon-vga.o fbcon-iplan2p2.o fbcon-iplan2p4.o \
fbcon-iplan2p8.o fbcon-vga-planes.o fbcon-cfb16.o \
fbcon-cfb2.o fbcon-cfb24.o fbcon-cfb32.o fbcon-cfb4.o \
......
......@@ -21,6 +21,14 @@
#include <asm/io.h>
#include <video/fbcon.h>
#include <video/fbcon-mfb.h>
#include <video/fbcon-cfb2.h>
#include <video/fbcon-cfb4.h>
#include <video/fbcon-cfb8.h>
#include <video/fbcon-cfb16.h>
#include <video/fbcon-cfb24.h>
#include <video/fbcon-cfb32.h>
#include "fbcon-accel.h"
/* ---- `Generic' versions of the frame buffer device operations ----------- */
......@@ -113,6 +121,7 @@ int fbgen_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
struct fb_info_gen *info2 = (struct fb_info_gen *)info;
int err;
int oldxres, oldyres, oldbpp, oldxres_virtual, oldyres_virtual, oldyoffset;
struct fb_bitfield oldred, oldgreen, oldblue;
if ((err = fbgen_do_set_var(var, con == info->currcon, info2)))
return err;
......@@ -122,12 +131,18 @@ int fbgen_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
oldxres_virtual = fb_display[con].var.xres_virtual;
oldyres_virtual = fb_display[con].var.yres_virtual;
oldbpp = fb_display[con].var.bits_per_pixel;
oldred = fb_display[con].var.red;
oldgreen = fb_display[con].var.green;
oldblue = fb_display[con].var.blue;
oldyoffset = fb_display[con].var.yoffset;
fb_display[con].var = *var;
if (oldxres != var->xres || oldyres != var->yres ||
oldxres_virtual != var->xres_virtual ||
oldyres_virtual != var->yres_virtual ||
oldbpp != var->bits_per_pixel ||
(!(memcmp(&oldred, &(var->red), sizeof(struct fb_bitfield)))) ||
(!(memcmp(&oldgreen, &(var->green), sizeof(struct fb_bitfield)))) ||
(!(memcmp(&oldblue, &(var->blue), sizeof(struct fb_bitfield)))) ||
oldyoffset != var->yoffset) {
fbgen_set_disp(con, info2);
if (info->changevar)
......@@ -142,6 +157,40 @@ int fbgen_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
}
int gen_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info)
{
int err;
if (con < 0 || (memcmp(&info->var, var, sizeof(struct fb_var_screeninfo)))) {
if (!info->fbops->fb_check_var) {
*var = info->var;
return 0;
}
if ((err = info->fbops->fb_check_var(var, info)))
return err;
if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
info->var = *var;
if (con == info->currcon) {
if (info->fbops->fb_set_par)
info->fbops->fb_set_par(info);
if (info->fbops->fb_pan_display)
info->fbops->fb_pan_display(&info->var, con, info);
gen_set_disp(con, info);
fb_set_cmap(&info->cmap, 1, info);
}
if (info->changevar)
info->changevar(con);
}
}
return 0;
}
/**
* fbgen_get_cmap - get the colormap
* @cmap: frame buffer colormap structure
......@@ -181,7 +230,7 @@ int gen_get_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info)
}
/**
* gen_set_cmap - set the colormap
* fbgen_set_cmap - set the colormap
* @cmap: frame buffer colormap structure
* @kspc: boolean, 0 copy local, 1 get_user() function
* @con: virtual console number
......@@ -194,23 +243,47 @@ int gen_get_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info)
*
*/
int gen_set_cmap(struct fb_cmap *cmap, int kspc, int con,
int fbgen_set_cmap(struct fb_cmap *cmap, int kspc, int con,
struct fb_info *info)
{
struct display *disp = (con < 0) ? info->disp: &fb_display[con];
int err, size = disp->var.bits_per_pixel == 16 ? 32 : 256;
int err;
if (!disp->cmap.len) { /* no colormap allocated ? */
if ((err = fb_alloc_cmap(&disp->cmap, size, 0)))
if (!fb_display[con].cmap.len) { /* no colormap allocated ? */
int size = fb_display[con].var.bits_per_pixel == 16 ? 64 : 256;
if ((err = fb_alloc_cmap(&fb_display[con].cmap, size, 0)))
return err;
}
if (con == info->currcon) /* current console ? */
return fb_set_cmap(cmap, kspc, info);
else
fb_copy_cmap(cmap, &disp->cmap, kspc ? 0 : 1);
fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
return 0;
}
int gen_set_cmap(struct fb_cmap *cmap, int kspc, int con,
struct fb_info *info)
{
struct display *disp = (con < 0) ? info->disp : (fb_display + con);
struct fb_cmap *dcmap = &disp->cmap;
int err = 0;
/* No colormap allocated ? */
if (!dcmap->len) {
int size = info->cmap.len;
err = fb_alloc_cmap(dcmap, size, 0);
}
if (!err && con == info->currcon) {
err = fb_set_cmap(cmap, kspc, info);
dcmap = &info->cmap;
}
if (!err)
fb_copy_cmap(cmap, dcmap, kspc ? 0 : 1);
return err;
}
/**
* fbgen_pan_display - pan or wrap the display
......@@ -292,7 +365,6 @@ int fbgen_do_set_var(struct fb_var_screeninfo *var, int isactive,
return 0;
}
/**
* fbgen_set_disp - set generic display
* @con: virtual console number
......@@ -340,6 +412,52 @@ void fbgen_set_disp(int con, struct fb_info_gen *info)
#endif
}
void gen_set_disp(int con, struct fb_info *info)
{
struct display *display;
if (con >= 0)
display = fb_display + con;
else
display = info->disp;
display->visual = info->fix.visual;
display->type = info->fix.type;
display->type_aux = info->fix.type_aux;
display->ypanstep = info->fix.ypanstep;
display->ywrapstep = info->fix.ywrapstep;
display->line_length = info->fix.line_length;
if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR ||
info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
display->can_soft_blank = info->fbops->fb_blank ? 1 : 0;
display->dispsw_data = NULL;
} else {
display->can_soft_blank = 0;
display->dispsw_data = info->pseudo_palette;
}
display->var = info->var;
/*
* If we are setting all the virtual consoles, also set
* the defaults used to create new consoles.
*/
if (con < 0 || info->var.activate & FB_ACTIVATE_ALL)
info->disp->var = info->var;
if (info->var.bits_per_pixel == 24) {
#ifdef FBCON_HAS_CFB24
display->scrollmode = SCROLL_YREDRAW;
display->dispsw = &fbcon_cfb24;
return;
#endif
}
#ifdef FBCON_HAS_ACCEL
display->scrollmode = SCROLL_YNOMOVE;
display->dispsw = &fbcon_accel;
#endif
return;
}
/**
* do_install_cmap - install the current colormap
......@@ -390,6 +508,19 @@ int fbgen_update_var(int con, struct fb_info *info)
return 0;
}
int gen_update_var(int con, struct fb_info *info)
{
int err;
if (con == info->currcon) {
if (info->fbops->fb_pan_display) {
if ((err = info->fbops->fb_pan_display(&info->var, con, info)))
return err;
}
}
return 0;
}
/**
* fbgen_switch - switch to a different virtual console.
......@@ -419,6 +550,46 @@ int fbgen_switch(int con, struct fb_info *info)
}
int gen_switch(int con, struct fb_info *info)
{
struct display *disp;
struct fb_cmap *cmap;
if (info->currcon >= 0) {
disp = fb_display + info->currcon;
/*
* Save the old colormap and graphics mode.
*/
disp->var = info->var;
if (disp->cmap.len)
fb_copy_cmap(&info->cmap, &disp->cmap, 0);
}
info->currcon = con;
disp = fb_display + con;
/*
* Install the new colormap and change the graphics mode. By default
* fbcon sets all the colormaps and graphics modes to the default
* values at bootup.
*
* Really, we want to set the colormap size depending on the
* depth of the new grpahics mode. For now, we leave it as its
* default 256 entry.
*/
if (disp->cmap.len)
cmap = &disp->cmap;
else
cmap = fb_default_cmap(1 << disp->var.bits_per_pixel);
fb_copy_cmap(cmap, &info->cmap, 0);
disp->var.activate = FB_ACTIVATE_NOW;
info->fbops->fb_set_var(&disp->var, con, info);
return 0;
}
/**
* fbgen_blank - blank the screen
* @blank: boolean, 0 unblank, 1 blank
......@@ -436,7 +607,7 @@ int fbgen_blank(int blank, struct fb_info *info)
struct fb_cmap cmap;
if (fbhw->blank && !fbhw->blank(blank, info2))
return 1;
return 0;
if (blank) {
memset(black, 0, 16*sizeof(u16));
cmap.red = black;
......@@ -451,13 +622,16 @@ int fbgen_blank(int blank, struct fb_info *info)
return 0;
}
/* generic frame buffer operations */
EXPORT_SYMBOL(fbgen_get_fix);
EXPORT_SYMBOL(gen_get_fix);
EXPORT_SYMBOL(fbgen_get_var);
EXPORT_SYMBOL(gen_get_var);
EXPORT_SYMBOL(fbgen_set_var);
EXPORT_SYMBOL(gen_set_var);
EXPORT_SYMBOL(fbgen_get_cmap);
EXPORT_SYMBOL(gen_get_cmap);
EXPORT_SYMBOL(fbgen_set_cmap);
EXPORT_SYMBOL(gen_set_cmap);
EXPORT_SYMBOL(fbgen_pan_display);
/* helper functions */
......@@ -465,7 +639,9 @@ EXPORT_SYMBOL(fbgen_do_set_var);
EXPORT_SYMBOL(fbgen_set_disp);
EXPORT_SYMBOL(do_install_cmap);
EXPORT_SYMBOL(fbgen_update_var);
EXPORT_SYMBOL(gen_update_var);
EXPORT_SYMBOL(fbgen_switch);
EXPORT_SYMBOL(gen_switch);
EXPORT_SYMBOL(fbgen_blank);
MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment