/* * linux/drivers/video/macmodes.c -- Standard MacOS video modes * * Copyright (C) 1998 Geert Uytterhoeven * * 2000 - Removal of OpenFirmware dependencies by: * - Ani Joshi * - Brad Douglas <brad@neruo.com> * * 2001 - Documented with DocBook * - Brad Douglas <brad@neruo.com> * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details.
*/
/* * Mapping between MacOS video mode numbers and video mode definitions * * These MUST be ordered in * - increasing resolution * - decreasing pixel clock period
*/
/** * mac_vmode_to_var - converts vmode/cmode pair to var structure * @vmode: MacOS video mode * @cmode: MacOS color mode * @var: frame buffer video mode structure * * Converts a MacOS vmode/cmode pair to a frame buffer video * mode structure. * * Returns negative errno on error, or zero for success. *
*/
int mac_vmode_to_var(int vmode, int cmode, struct fb_var_screeninfo *var)
{ conststruct fb_videomode *mode = NULL; conststruct mode_map *map;
for (map = mac_modes; map->vmode != -1; map++) if (map->vmode == vmode) {
mode = map->mode; break;
} if (!mode) return -EINVAL;
/** * mac_var_to_vmode - convert var structure to MacOS vmode/cmode pair * @var: frame buffer video mode structure * @vmode: MacOS video mode * @cmode: MacOS color mode * * Converts a frame buffer video mode structure to a MacOS * vmode/cmode pair. * * Returns negative errno on error, or zero for success. *
*/
int mac_var_to_vmode(conststruct fb_var_screeninfo *var, int *vmode, int *cmode)
{ conststruct mode_map *map;
/* * Find the mac_mode with a matching resolution or failing that, the * closest larger resolution. Skip modes with a shorter pixel clock period.
*/ for (map = mac_modes; map->vmode != -1; map++) { conststruct fb_videomode *mode = map->mode;
if (var->xres > mode->xres || var->yres > mode->yres) continue; if (var->xres_virtual > mode->xres || var->yres_virtual > mode->yres) continue; if (var->pixclock > mode->pixclock) continue; if ((var->vmode & FB_VMODE_MASK) != mode->vmode) continue;
*vmode = map->vmode;
/* * Having found a good resolution, find the matching pixel clock * or failing that, the closest longer pixel clock period.
*/
map++; while (map->vmode != -1) { conststruct fb_videomode *clk_mode = map->mode;
if (mode->xres != clk_mode->xres || mode->yres != clk_mode->yres) break; if (var->pixclock > mode->pixclock) break; if (mode->vmode != clk_mode->vmode) continue;
*vmode = map->vmode;
map++;
} return 0;
} return -EINVAL;
}
/** * mac_map_monitor_sense - Convert monitor sense to vmode * @sense: Macintosh monitor sense number * * Converts a Macintosh monitor sense number to a MacOS * vmode number. * * Returns MacOS vmode video mode number. *
*/
int mac_map_monitor_sense(int sense)
{ conststruct monitor_map *map;
for (map = mac_monitors; map->sense != -1; map++) if (map->sense == sense) break; return map->vmode;
}
EXPORT_SYMBOL(mac_map_monitor_sense);
/** * mac_find_mode - find a video mode * @var: frame buffer user defined part of display * @info: frame buffer info structure * @mode_option: video mode name (see mac_modedb[]) * @default_bpp: default color depth in bits per pixel * * Finds a suitable video mode. Tries to set mode specified * by @mode_option. If the name of the wanted mode begins with * 'mac', the Mac video mode database will be used, otherwise it * will fall back to the standard video mode database. * * Note: Function marked as __init and can only be used during * system boot. * * Returns error code from fb_find_mode (see fb_find_mode * function). *
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.