1139825Simp/*- 21541Srgrimes * Copyright (c) 1992, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * This code is derived from software developed by the Computer Systems 61541Srgrimes * Engineering group at Lawrence Berkeley Laboratory under DARPA 71541Srgrimes * contract BG 91-66 and contributed to Berkeley. 81541Srgrimes * 91541Srgrimes * Redistribution and use in source and binary forms, with or without 101541Srgrimes * modification, are permitted provided that the following conditions 111541Srgrimes * are met: 121541Srgrimes * 1. Redistributions of source code must retain the above copyright 131541Srgrimes * notice, this list of conditions and the following disclaimer. 141541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 151541Srgrimes * notice, this list of conditions and the following disclaimer in the 161541Srgrimes * documentation and/or other materials provided with the distribution. 171541Srgrimes * 4. Neither the name of the University nor the names of its contributors 181541Srgrimes * may be used to endorse or promote products derived from this software 191541Srgrimes * without specific prior written permission. 201541Srgrimes * 211541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311541Srgrimes * SUCH DAMAGE. 321541Srgrimes * 331541Srgrimes * @(#)fbio.h 8.2 (Berkeley) 10/30/93 341541Srgrimes * 3550477Speter * $FreeBSD$ 361541Srgrimes */ 371541Srgrimes 382165Spaul#ifndef _SYS_FBIO_H_ 392165Spaul#define _SYS_FBIO_H_ 402165Spaul 4155205Speter#ifndef _KERNEL 4248104Syokota#include <sys/types.h> 43262861Sjhb#else 44262861Sjhb#include <sys/param.h> 45262861Sjhb#include <sys/systm.h> 46262861Sjhb#include <sys/eventhandler.h> 4748104Syokota#endif 4848104Syokota#include <sys/ioccom.h> 4948104Syokota 501541Srgrimes/* 511541Srgrimes * Frame buffer ioctls (from Sprite, trimmed to essentials for X11). 521541Srgrimes */ 531541Srgrimes 541541Srgrimes/* 551541Srgrimes * Frame buffer type codes. 561541Srgrimes */ 571541Srgrimes#define FBTYPE_SUN1BW 0 /* multibus mono */ 581541Srgrimes#define FBTYPE_SUN1COLOR 1 /* multibus color */ 591541Srgrimes#define FBTYPE_SUN2BW 2 /* memory mono */ 601541Srgrimes#define FBTYPE_SUN2COLOR 3 /* color w/rasterop chips */ 611541Srgrimes#define FBTYPE_SUN2GP 4 /* GP1/GP2 */ 621541Srgrimes#define FBTYPE_SUN5COLOR 5 /* RoadRunner accelerator */ 631541Srgrimes#define FBTYPE_SUN3COLOR 6 /* memory color */ 641541Srgrimes#define FBTYPE_MEMCOLOR 7 /* memory 24-bit */ 651541Srgrimes#define FBTYPE_SUN4COLOR 8 /* memory color w/overlay */ 661541Srgrimes 671541Srgrimes#define FBTYPE_NOTSUN1 9 /* reserved for customer */ 681541Srgrimes#define FBTYPE_NOTSUN2 10 /* reserved for customer */ 69146481Smarius#define FBTYPE_PCIMISC 11 /* (generic) PCI misc. disp. */ 701541Srgrimes 711541Srgrimes#define FBTYPE_SUNFAST_COLOR 12 /* accelerated 8bit */ 721541Srgrimes#define FBTYPE_SUNROP_COLOR 13 /* MEMCOLOR with rop h/w */ 731541Srgrimes#define FBTYPE_SUNFB_VIDEO 14 /* Simple video mixing */ 741541Srgrimes#define FBTYPE_RESERVED5 15 /* reserved, do not use */ 751541Srgrimes#define FBTYPE_RESERVED4 16 /* reserved, do not use */ 76116545Sjake#define FBTYPE_SUNGP3 17 77116545Sjake#define FBTYPE_SUNGT 18 78116545Sjake#define FBTYPE_SUNLEO 19 /* zx Leo */ 791541Srgrimes 8048104Syokota#define FBTYPE_MDA 20 8148104Syokota#define FBTYPE_HERCULES 21 8248104Syokota#define FBTYPE_CGA 22 8348104Syokota#define FBTYPE_EGA 23 8448104Syokota#define FBTYPE_VGA 24 8548104Syokota#define FBTYPE_PC98 25 8648104Syokota#define FBTYPE_TGA 26 8794617Sobrien#define FBTYPE_TGA2 27 881541Srgrimes 89116545Sjake#define FBTYPE_MDICOLOR 28 /* cg14 */ 90116545Sjake#define FBTYPE_TCXCOLOR 29 /* SUNW,tcx */ 91116545Sjake#define FBTYPE_CREATOR 30 9248104Syokota 93116545Sjake#define FBTYPE_LASTPLUSONE 31 /* max number of fbs (change as add) */ 94116545Sjake 951541Srgrimes/* 961541Srgrimes * Frame buffer descriptor as returned by FBIOGTYPE. 971541Srgrimes */ 981541Srgrimesstruct fbtype { 991541Srgrimes int fb_type; /* as defined above */ 1001541Srgrimes int fb_height; /* in pixels */ 1011541Srgrimes int fb_width; /* in pixels */ 1021541Srgrimes int fb_depth; /* bits per pixel */ 1031541Srgrimes int fb_cmsize; /* size of color map (entries) */ 1041541Srgrimes int fb_size; /* total size in bytes */ 1051541Srgrimes}; 1061541Srgrimes#define FBIOGTYPE _IOR('F', 0, struct fbtype) 1071541Srgrimes 108262861Sjhb#define FBTYPE_GET_STRIDE(_fb) ((_fb)->fb_size / (_fb)->fb_height) 109262861Sjhb#define FBTYPE_GET_BPP(_fb) ((_fb)->fb_bpp) 110262861Sjhb#define FBTYPE_GET_BYTESPP(_fb) ((_fb)->fb_bpp / 8) 111262861Sjhb 112262861Sjhb#ifdef _KERNEL 113262861Sjhb 114262861Sjhbstruct fb_info; 115262861Sjhb 116262861Sjhbtypedef int fb_enter_t(void *priv); 117262861Sjhbtypedef int fb_leave_t(void *priv); 118262861Sjhb 119262861Sjhbstruct fb_info { 120262861Sjhb /* Raw copy of fbtype. Do not change. */ 121262861Sjhb int fb_type; /* as defined above */ 122262861Sjhb int fb_height; /* in pixels */ 123262861Sjhb int fb_width; /* in pixels */ 124262861Sjhb int fb_depth; /* bits to define color */ 125262861Sjhb int fb_cmsize; /* size of color map (entries) */ 126262861Sjhb int fb_size; /* total size in bytes */ 127262861Sjhb 128262861Sjhb struct cdev *fb_cdev; 129262861Sjhb 130262861Sjhb fb_enter_t *enter; 131262861Sjhb fb_leave_t *leave; 132262861Sjhb 133262861Sjhb intptr_t fb_pbase; /* For FB mmap. */ 134262861Sjhb intptr_t fb_vbase; /* if NULL, use fb_write/fb_read. */ 135262861Sjhb void *fb_priv; /* First argument for read/write. */ 136262861Sjhb const char *fb_name; 137262861Sjhb uint32_t fb_flags; 138262861Sjhb int fb_stride; 139262861Sjhb int fb_bpp; /* bits per pixel */ 140262861Sjhb#define FB_FLAG_NOMMAP 1 /* mmap unsupported. */ 141262861Sjhb uint32_t fb_cmap[16]; 142262861Sjhb}; 143262861Sjhb 144262861Sjhbint fbd_list(void); 145262861Sjhbint fbd_register(struct fb_info *); 146262861Sjhbint fbd_unregister(struct fb_info *); 147262861Sjhb 148262861Sjhbstatic inline int 149262861Sjhbregister_framebuffer(struct fb_info *info) 150262861Sjhb{ 151262861Sjhb 152262861Sjhb EVENTHANDLER_INVOKE(register_framebuffer, info); 153262861Sjhb return (0); 154262861Sjhb} 155262861Sjhb 156262861Sjhbstatic inline int 157262861Sjhbunregister_framebuffer(struct fb_info *info) 158262861Sjhb{ 159262861Sjhb 160262861Sjhb EVENTHANDLER_INVOKE(unregister_framebuffer, info); 161262861Sjhb return (0); 162262861Sjhb} 163262861Sjhb#endif 164262861Sjhb 1651541Srgrimes#ifdef notdef 1661541Srgrimes/* 1671541Srgrimes * General purpose structure for passing info in and out of frame buffers 1681541Srgrimes * (used for gp1) -- unsupported. 1691541Srgrimes */ 1701541Srgrimesstruct fbinfo { 1711541Srgrimes int fb_physaddr; /* physical frame buffer address */ 1721541Srgrimes int fb_hwwidth; /* fb board width */ 1731541Srgrimes int fb_hwheight; /* fb board height */ 1741541Srgrimes int fb_addrdelta; /* phys addr diff between boards */ 1751541Srgrimes u_char *fb_ropaddr; /* fb virtual addr */ 1761541Srgrimes int fb_unit; /* minor devnum of fb */ 1771541Srgrimes}; 1781541Srgrimes#define FBIOGINFO _IOR('F', 2, struct fbinfo) 1791541Srgrimes#endif 1801541Srgrimes 1811541Srgrimes/* 1821541Srgrimes * Color map I/O. 1831541Srgrimes */ 1841541Srgrimesstruct fbcmap { 1851541Srgrimes int index; /* first element (0 origin) */ 1861541Srgrimes int count; /* number of elements */ 1871541Srgrimes u_char *red; /* red color map elements */ 1881541Srgrimes u_char *green; /* green color map elements */ 1891541Srgrimes u_char *blue; /* blue color map elements */ 1901541Srgrimes}; 1911541Srgrimes#define FBIOPUTCMAP _IOW('F', 3, struct fbcmap) 1921541Srgrimes#define FBIOGETCMAP _IOW('F', 4, struct fbcmap) 1931541Srgrimes 1941541Srgrimes/* 1951541Srgrimes * Set/get attributes. 1961541Srgrimes */ 1971541Srgrimes#define FB_ATTR_NDEVSPECIFIC 8 /* no. of device specific values */ 1981541Srgrimes#define FB_ATTR_NEMUTYPES 4 /* no. of emulation types */ 1991541Srgrimes 2001541Srgrimesstruct fbsattr { 2011541Srgrimes int flags; /* flags; see below */ 2021541Srgrimes int emu_type; /* emulation type (-1 if unused) */ 2031541Srgrimes int dev_specific[FB_ATTR_NDEVSPECIFIC]; /* catchall */ 2041541Srgrimes}; 2051541Srgrimes#define FB_ATTR_AUTOINIT 1 /* emulation auto init flag */ 2061541Srgrimes#define FB_ATTR_DEVSPECIFIC 2 /* dev. specific stuff valid flag */ 2071541Srgrimes 2081541Srgrimesstruct fbgattr { 2091541Srgrimes int real_type; /* real device type */ 2101541Srgrimes int owner; /* PID of owner, 0 if myself */ 2111541Srgrimes struct fbtype fbtype; /* fbtype info for real device */ 2121541Srgrimes struct fbsattr sattr; /* see above */ 2131541Srgrimes int emu_types[FB_ATTR_NEMUTYPES]; /* possible emulations */ 2141541Srgrimes /* (-1 if unused) */ 2151541Srgrimes}; 21681038Syokota#define FBIOSATTR _IOW('F', 5, struct fbsattr) 2171541Srgrimes#define FBIOGATTR _IOR('F', 6, struct fbgattr) 2181541Srgrimes 2191541Srgrimes/* 2201541Srgrimes * Video control. 2211541Srgrimes */ 2221541Srgrimes#define FBVIDEO_OFF 0 2231541Srgrimes#define FBVIDEO_ON 1 2241541Srgrimes 2251541Srgrimes#define FBIOSVIDEO _IOW('F', 7, int) 2261541Srgrimes#define FBIOGVIDEO _IOR('F', 8, int) 2271541Srgrimes 22881038Syokota/* vertical retrace */ 22981038Syokota#define FBIOVERTICAL _IO('F', 9) 23081038Syokota 2311541Srgrimes/* 2321541Srgrimes * Hardware cursor control (for, e.g., CG6). A rather complex and icky 2331541Srgrimes * interface that smells like VMS, but there it is.... 2341541Srgrimes */ 2351541Srgrimesstruct fbcurpos { 2361541Srgrimes short x; 2371541Srgrimes short y; 2381541Srgrimes}; 2391541Srgrimes 2401541Srgrimesstruct fbcursor { 2411541Srgrimes short set; /* flags; see below */ 2421541Srgrimes short enable; /* nonzero => cursor on, 0 => cursor off */ 2431541Srgrimes struct fbcurpos pos; /* position on display */ 2441541Srgrimes struct fbcurpos hot; /* hot-spot within cursor */ 2451541Srgrimes struct fbcmap cmap; /* cursor color map */ 2461541Srgrimes struct fbcurpos size; /* number of valid bits in image & mask */ 2471541Srgrimes caddr_t image; /* cursor image bits */ 2481541Srgrimes caddr_t mask; /* cursor mask bits */ 2491541Srgrimes}; 2501541Srgrimes#define FB_CUR_SETCUR 0x01 /* set on/off (i.e., obey fbcursor.enable) */ 2511541Srgrimes#define FB_CUR_SETPOS 0x02 /* set position */ 2521541Srgrimes#define FB_CUR_SETHOT 0x04 /* set hot-spot */ 2531541Srgrimes#define FB_CUR_SETCMAP 0x08 /* set cursor color map */ 2541541Srgrimes#define FB_CUR_SETSHAPE 0x10 /* set size & bits */ 2551541Srgrimes#define FB_CUR_SETALL (FB_CUR_SETCUR | FB_CUR_SETPOS | FB_CUR_SETHOT | \ 2561541Srgrimes FB_CUR_SETCMAP | FB_CUR_SETSHAPE) 2571541Srgrimes 2581541Srgrimes/* controls for cursor attributes & shape (including position) */ 2591541Srgrimes#define FBIOSCURSOR _IOW('F', 24, struct fbcursor) 2601541Srgrimes#define FBIOGCURSOR _IOWR('F', 25, struct fbcursor) 2611541Srgrimes 2621541Srgrimes/* controls for cursor position only */ 2631541Srgrimes#define FBIOSCURPOS _IOW('F', 26, struct fbcurpos) 2641541Srgrimes#define FBIOGCURPOS _IOW('F', 27, struct fbcurpos) 2651541Srgrimes 2661541Srgrimes/* get maximum cursor size */ 2671541Srgrimes#define FBIOGCURMAX _IOR('F', 28, struct fbcurpos) 2682165Spaul 26981038Syokota/* 27081038Syokota * Video board information 27181038Syokota */ 27281038Syokotastruct brd_info { 27381038Syokota u_short accessible_width; /* accessible bytes in scanline */ 27481038Syokota u_short accessible_height; /* number of accessible scanlines */ 27581038Syokota u_short line_bytes; /* number of bytes/scanline */ 27681038Syokota u_short hdb_capable; /* can this thing hardware db? */ 27781038Syokota u_short vmsize; /* video memory size */ 27881038Syokota u_char boardrev; /* board revision # */ 27981038Syokota u_char pad0; 28081038Syokota u_long pad1; 28181038Syokota}; 28281038Syokota#define FBIOGXINFO _IOR('F', 39, struct brd_info) 28381038Syokota 28481038Syokota/* 28581038Syokota * Monitor information 28681038Syokota */ 28781038Syokotastruct mon_info { 28881038Syokota u_long mon_type; /* bit array */ 28981038Syokota#define MON_TYPE_STEREO 0x8 /* stereo display */ 29081038Syokota#define MON_TYPE_0_OFFSET 0x4 /* black level 0 ire instead of 7.5 */ 29181038Syokota#define MON_TYPE_OVERSCAN 0x2 /* overscan */ 29281038Syokota#define MON_TYPE_GRAY 0x1 /* greyscale monitor */ 29381038Syokota u_long pixfreq; /* pixel frequency in Hz */ 29481038Syokota u_long hfreq; /* horizontal freq in Hz */ 29581038Syokota u_long vfreq; /* vertical freq in Hz */ 29681038Syokota u_long vsync; /* vertical sync in scanlines */ 29781038Syokota u_long hsync; /* horizontal sync in pixels */ 29881038Syokota /* these are in pixel units */ 29981038Syokota u_short hfporch; /* horizontal front porch */ 30081038Syokota u_short hbporch; /* horizontal back porch */ 30181038Syokota u_short vfporch; /* vertical front porch */ 30281038Syokota u_short vbporch; /* vertical back porch */ 30381038Syokota}; 30481038Syokota#define FBIOMONINFO _IOR('F', 40, struct mon_info) 30581038Syokota 30681038Syokota/* 30781038Syokota * Color map I/O. 30881038Syokota */ 30981038Syokotastruct fbcmap_i { 31081038Syokota unsigned int flags; 31181038Syokota#define FB_CMAP_BLOCK (1 << 0) /* wait for vertical refresh */ 31281038Syokota#define FB_CMAP_KERNEL (1 << 1) /* called within kernel */ 31381038Syokota int id; /* color map id */ 31481038Syokota int index; /* first element (0 origin) */ 31581038Syokota int count; /* number of elements */ 31681038Syokota u_char *red; /* red color map elements */ 31781038Syokota u_char *green; /* green color map elements */ 31881038Syokota u_char *blue; /* blue color map elements */ 31981038Syokota}; 32081038Syokota#define FBIOPUTCMAPI _IOW('F', 41, struct fbcmap_i) 32181038Syokota#define FBIOGETCMAPI _IOW('F', 42, struct fbcmap_i) 32281038Syokota 32348104Syokota/* The new style frame buffer ioctls. */ 32448104Syokota 32548104Syokota/* video mode information block */ 32648104Syokotastruct video_info { 32748104Syokota int vi_mode; /* mode number, see below */ 32848104Syokota int vi_flags; 32948104Syokota#define V_INFO_COLOR (1 << 0) 33048104Syokota#define V_INFO_GRAPHICS (1 << 1) 33148104Syokota#define V_INFO_LINEAR (1 << 2) 33248104Syokota#define V_INFO_VESA (1 << 3) 333198858Sjkim#define V_INFO_NONVGA (1 << 4) 33448104Syokota int vi_width; 33548104Syokota int vi_height; 33648104Syokota int vi_cwidth; 33748104Syokota int vi_cheight; 33848104Syokota int vi_depth; 33948104Syokota int vi_planes; 34094617Sobrien vm_offset_t vi_window; /* physical address */ 34148104Syokota size_t vi_window_size; 34248104Syokota size_t vi_window_gran; 34394617Sobrien vm_offset_t vi_buffer; /* physical address */ 34448104Syokota size_t vi_buffer_size; 34548104Syokota int vi_mem_model; 34648104Syokota#define V_INFO_MM_OTHER (-1) 34748104Syokota#define V_INFO_MM_TEXT 0 34848104Syokota#define V_INFO_MM_PLANAR 1 34948104Syokota#define V_INFO_MM_PACKED 2 35048104Syokota#define V_INFO_MM_DIRECT 3 35148104Syokota#define V_INFO_MM_CGA 100 35248104Syokota#define V_INFO_MM_HGC 101 35350299Syokota#define V_INFO_MM_VGAX 102 35448104Syokota /* for MM_PACKED and MM_DIRECT only */ 35548104Syokota int vi_pixel_size; /* in bytes */ 35648104Syokota /* for MM_DIRECT only */ 35748104Syokota int vi_pixel_fields[4]; /* RGB and reserved fields */ 35848104Syokota int vi_pixel_fsizes[4]; 35948104Syokota /* reserved */ 360203535Sjkim u_char vi_reserved[64]; 36194617Sobrien vm_offset_t vi_registers; /* physical address */ 36294617Sobrien vm_offset_t vi_registers_size; 36348104Syokota}; 36448104Syokotatypedef struct video_info video_info_t; 36548104Syokota 36648104Syokota/* adapter infromation block */ 36748104Syokotastruct video_adapter { 36848104Syokota int va_index; 36948104Syokota int va_type; 37048104Syokota#define KD_OTHER 0 /* unknown */ 37148104Syokota#define KD_MONO 1 /* monochrome adapter */ 37248104Syokota#define KD_HERCULES 2 /* hercules adapter */ 37348104Syokota#define KD_CGA 3 /* color graphics adapter */ 37448104Syokota#define KD_EGA 4 /* enhanced graphics adapter */ 37548104Syokota#define KD_VGA 5 /* video graphics adapter */ 37648104Syokota#define KD_PC98 6 /* PC-98 display */ 37748104Syokota#define KD_TGA 7 /* TGA */ 37894617Sobrien#define KD_TGA2 8 /* TGA2 */ 37948104Syokota char *va_name; 38048104Syokota int va_unit; 38148104Syokota int va_minor; 38248104Syokota int va_flags; 38348104Syokota#define V_ADP_COLOR (1 << 0) 38448104Syokota#define V_ADP_MODECHANGE (1 << 1) 38548104Syokota#define V_ADP_STATESAVE (1 << 2) 38648104Syokota#define V_ADP_STATELOAD (1 << 3) 38748104Syokota#define V_ADP_FONT (1 << 4) 38848104Syokota#define V_ADP_PALETTE (1 << 5) 38948104Syokota#define V_ADP_BORDER (1 << 6) 39048104Syokota#define V_ADP_VESA (1 << 7) 39181038Syokota#define V_ADP_BOOTDISPLAY (1 << 8) 39248104Syokota#define V_ADP_PROBED (1 << 16) 39348104Syokota#define V_ADP_INITIALIZED (1 << 17) 39448104Syokota#define V_ADP_REGISTERED (1 << 18) 39581038Syokota#define V_ADP_ATTACHED (1 << 19) 396204265Sjkim#define V_ADP_DAC8 (1 << 20) 39794617Sobrien vm_offset_t va_io_base; 39848104Syokota int va_io_size; 39994617Sobrien vm_offset_t va_crtc_addr; 40094617Sobrien vm_offset_t va_mem_base; 40148104Syokota int va_mem_size; 40248104Syokota vm_offset_t va_window; /* virtual address */ 40348104Syokota size_t va_window_size; 40448104Syokota size_t va_window_gran; 40548104Syokota u_int va_window_orig; 40648104Syokota vm_offset_t va_buffer; /* virtual address */ 40748104Syokota size_t va_buffer_size; 40848104Syokota int va_initial_mode; 40948104Syokota int va_initial_bios_mode; 41048104Syokota int va_mode; 41148104Syokota struct video_info va_info; 41248104Syokota int va_line_width; 41348104Syokota struct { 41448104Syokota int x; 41548104Syokota int y; 41648104Syokota } va_disp_start; 41748104Syokota void *va_token; 41894617Sobrien int va_model; 41994617Sobrien int va_little_bitian; 42094617Sobrien int va_little_endian; 42194617Sobrien int va_buffer_alias; 42294617Sobrien vm_offset_t va_registers; /* virtual address */ 42394617Sobrien vm_offset_t va_registers_size; 42448104Syokota}; 42548104Syokotatypedef struct video_adapter video_adapter_t; 42648104Syokota 42748104Syokotastruct video_adapter_info { 42848104Syokota int va_index; 42948104Syokota int va_type; 43048104Syokota char va_name[16]; 43148104Syokota int va_unit; 43248104Syokota int va_flags; 43394617Sobrien vm_offset_t va_io_base; 43448104Syokota int va_io_size; 43594617Sobrien vm_offset_t va_crtc_addr; 43694617Sobrien vm_offset_t va_mem_base; 43748104Syokota int va_mem_size; 43894617Sobrien vm_offset_t va_window; /* virtual address */ 43948104Syokota size_t va_window_size; 44048104Syokota size_t va_window_gran; 44194617Sobrien vm_offset_t va_unused0; 44248104Syokota size_t va_buffer_size; 44348104Syokota int va_initial_mode; 44448104Syokota int va_initial_bios_mode; 44548104Syokota int va_mode; 44648104Syokota int va_line_width; 44748104Syokota struct { 44848104Syokota int x; 44948104Syokota int y; 45048104Syokota } va_disp_start; 45148104Syokota u_int va_window_orig; 45248104Syokota /* reserved */ 45348104Syokota u_char va_reserved[64]; 45448104Syokota}; 45548104Syokotatypedef struct video_adapter_info video_adapter_info_t; 45648104Syokota 45748104Syokota/* some useful video adapter index */ 45848104Syokota#define V_ADP_PRIMARY 0 45948104Syokota#define V_ADP_SECONDARY 1 46048104Syokota 46148104Syokota/* video mode numbers */ 46248104Syokota 46348104Syokota#define M_B40x25 0 /* black & white 40 columns */ 46448104Syokota#define M_C40x25 1 /* color 40 columns */ 46548104Syokota#define M_B80x25 2 /* black & white 80 columns */ 46648104Syokota#define M_C80x25 3 /* color 80 columns */ 46748104Syokota#define M_BG320 4 /* black & white graphics 320x200 */ 46848104Syokota#define M_CG320 5 /* color graphics 320x200 */ 46948104Syokota#define M_BG640 6 /* black & white graphics 640x200 hi-res */ 47048104Syokota#define M_EGAMONO80x25 7 /* ega-mono 80x25 */ 47148104Syokota#define M_CG320_D 13 /* ega mode D */ 47248104Syokota#define M_CG640_E 14 /* ega mode E */ 47348104Syokota#define M_EGAMONOAPA 15 /* ega mode F */ 47448104Syokota#define M_CG640x350 16 /* ega mode 10 */ 47548104Syokota#define M_ENHMONOAPA2 17 /* ega mode F with extended memory */ 47648104Syokota#define M_ENH_CG640 18 /* ega mode 10* */ 47748104Syokota#define M_ENH_B40x25 19 /* ega enhanced black & white 40 columns */ 47848104Syokota#define M_ENH_C40x25 20 /* ega enhanced color 40 columns */ 47948104Syokota#define M_ENH_B80x25 21 /* ega enhanced black & white 80 columns */ 48048104Syokota#define M_ENH_C80x25 22 /* ega enhanced color 80 columns */ 48148104Syokota#define M_VGA_C40x25 23 /* vga 8x16 font on color */ 48248104Syokota#define M_VGA_C80x25 24 /* vga 8x16 font on color */ 48348104Syokota#define M_VGA_M80x25 25 /* vga 8x16 font on mono */ 48448104Syokota 48548104Syokota#define M_VGA11 26 /* vga 640x480 2 colors */ 48648104Syokota#define M_BG640x480 26 48748104Syokota#define M_VGA12 27 /* vga 640x480 16 colors */ 48848104Syokota#define M_CG640x480 27 48948104Syokota#define M_VGA13 28 /* vga 320x200 256 colors */ 49048104Syokota#define M_VGA_CG320 28 49148104Syokota 49248104Syokota#define M_VGA_C80x50 30 /* vga 8x8 font on color */ 49348104Syokota#define M_VGA_M80x50 31 /* vga 8x8 font on color */ 49448104Syokota#define M_VGA_C80x30 32 /* vga 8x16 font on color */ 49548104Syokota#define M_VGA_M80x30 33 /* vga 8x16 font on color */ 49648104Syokota#define M_VGA_C80x60 34 /* vga 8x8 font on color */ 49748104Syokota#define M_VGA_M80x60 35 /* vga 8x8 font on color */ 49848104Syokota#define M_VGA_CG640 36 /* vga 640x400 256 color */ 49948104Syokota#define M_VGA_MODEX 37 /* vga 320x240 256 color */ 50048104Syokota 50148104Syokota#define M_VGA_C90x25 40 /* vga 8x16 font on color */ 50248104Syokota#define M_VGA_M90x25 41 /* vga 8x16 font on mono */ 50348104Syokota#define M_VGA_C90x30 42 /* vga 8x16 font on color */ 50448104Syokota#define M_VGA_M90x30 43 /* vga 8x16 font on mono */ 50548104Syokota#define M_VGA_C90x43 44 /* vga 8x8 font on color */ 50648104Syokota#define M_VGA_M90x43 45 /* vga 8x8 font on mono */ 50748104Syokota#define M_VGA_C90x50 46 /* vga 8x8 font on color */ 50848104Syokota#define M_VGA_M90x50 47 /* vga 8x8 font on mono */ 50948104Syokota#define M_VGA_C90x60 48 /* vga 8x8 font on color */ 51048104Syokota#define M_VGA_M90x60 49 /* vga 8x8 font on mono */ 51148104Syokota 51248104Syokota#define M_ENH_B80x43 0x70 /* ega black & white 80x43 */ 51348104Syokota#define M_ENH_C80x43 0x71 /* ega color 80x43 */ 51448104Syokota 51559689Snyan#define M_PC98_80x25 98 /* PC98 text 80x25 */ 51659689Snyan#define M_PC98_80x30 99 /* PC98 text 80x30 */ 51759689Snyan#define M_PC98_EGC640x400 100 /* PC98 graphic 640x400 16 colors */ 51859689Snyan#define M_PC98_PEGC640x400 101 /* PC98 graphic 640x400 256 colors */ 51959689Snyan#define M_PC98_PEGC640x480 102 /* PC98 graphic 640x480 256 colors */ 52048104Syokota 52148104Syokota#define M_HGC_P0 0xe0 /* hercules graphics - page 0 @ B0000 */ 52248104Syokota#define M_HGC_P1 0xe1 /* hercules graphics - page 1 @ B8000 */ 52348104Syokota#define M_MCA_MODE 0xff /* monochrome adapter mode */ 52448104Syokota 52548104Syokota#define M_TEXT_80x25 200 /* generic text modes */ 52648104Syokota#define M_TEXT_80x30 201 52748104Syokota#define M_TEXT_80x43 202 52848104Syokota#define M_TEXT_80x50 203 52948104Syokota#define M_TEXT_80x60 204 53048104Syokota#define M_TEXT_132x25 205 53148104Syokota#define M_TEXT_132x30 206 53248104Syokota#define M_TEXT_132x43 207 53348104Syokota#define M_TEXT_132x50 208 53448104Syokota#define M_TEXT_132x60 209 53548104Syokota 53648104Syokota#define M_VESA_BASE 0x100 /* VESA mode number base */ 53748104Syokota#define M_VESA_CG640x400 0x100 /* 640x400, 256 color */ 53848104Syokota#define M_VESA_CG640x480 0x101 /* 640x480, 256 color */ 53948104Syokota#define M_VESA_800x600 0x102 /* 800x600, 16 color */ 54048104Syokota#define M_VESA_CG800x600 0x103 /* 800x600, 256 color */ 54148104Syokota#define M_VESA_1024x768 0x104 /* 1024x768, 16 color */ 54248104Syokota#define M_VESA_CG1024x768 0x105 /* 1024x768, 256 color */ 54348104Syokota#define M_VESA_1280x1024 0x106 /* 1280x1024, 16 color */ 54448104Syokota#define M_VESA_CG1280x1024 0x107 /* 1280x1024, 256 color */ 54548104Syokota#define M_VESA_C80x60 0x108 /* 8x8 font */ 54648104Syokota#define M_VESA_C132x25 0x109 /* 8x16 font */ 54748104Syokota#define M_VESA_C132x43 0x10a /* 8x14 font */ 54848104Syokota#define M_VESA_C132x50 0x10b /* 8x8 font */ 54948104Syokota#define M_VESA_C132x60 0x10c /* 8x8 font */ 55048104Syokota#define M_VESA_32K_320 0x10d /* 320x200, 5:5:5 */ 55148104Syokota#define M_VESA_64K_320 0x10e /* 320x200, 5:6:5 */ 55248104Syokota#define M_VESA_FULL_320 0x10f /* 320x200, 8:8:8 */ 55348104Syokota#define M_VESA_32K_640 0x110 /* 640x480, 5:5:5 */ 55448104Syokota#define M_VESA_64K_640 0x111 /* 640x480, 5:6:5 */ 55548104Syokota#define M_VESA_FULL_640 0x112 /* 640x480, 8:8:8 */ 55648104Syokota#define M_VESA_32K_800 0x113 /* 800x600, 5:5:5 */ 55748104Syokota#define M_VESA_64K_800 0x114 /* 800x600, 5:6:5 */ 55848104Syokota#define M_VESA_FULL_800 0x115 /* 800x600, 8:8:8 */ 55948104Syokota#define M_VESA_32K_1024 0x116 /* 1024x768, 5:5:5 */ 56048104Syokota#define M_VESA_64K_1024 0x117 /* 1024x768, 5:6:5 */ 56148104Syokota#define M_VESA_FULL_1024 0x118 /* 1024x768, 8:8:8 */ 56248104Syokota#define M_VESA_32K_1280 0x119 /* 1280x1024, 5:5:5 */ 56348104Syokota#define M_VESA_64K_1280 0x11a /* 1280x1024, 5:6:5 */ 56448104Syokota#define M_VESA_FULL_1280 0x11b /* 1280x1024, 8:8:8 */ 56548104Syokota#define M_VESA_MODE_MAX 0x1ff 56648104Syokota 56748104Syokotastruct video_display_start { 56848104Syokota int x; 56948104Syokota int y; 57048104Syokota}; 57148104Syokotatypedef struct video_display_start video_display_start_t; 57248104Syokota 57348104Syokotastruct video_color_palette { 57448104Syokota int index; /* first element (zero-based) */ 57548104Syokota int count; /* number of elements */ 57648104Syokota u_char *red; /* red */ 57748104Syokota u_char *green; /* green */ 57848104Syokota u_char *blue; /* blue */ 57948104Syokota u_char *transparent; /* may be NULL */ 58048104Syokota}; 58148104Syokotatypedef struct video_color_palette video_color_palette_t; 58248104Syokota 58348104Syokota/* adapter info. */ 58448104Syokota#define FBIO_ADAPTER _IOR('F', 100, int) 58548104Syokota#define FBIO_ADPTYPE _IOR('F', 101, int) 58648104Syokota#define FBIO_ADPINFO _IOR('F', 102, struct video_adapter_info) 58748104Syokota 58848104Syokota/* video mode control */ 58948104Syokota#define FBIO_MODEINFO _IOWR('F', 103, struct video_info) 59048104Syokota#define FBIO_FINDMODE _IOWR('F', 104, struct video_info) 59148104Syokota#define FBIO_GETMODE _IOR('F', 105, int) 59248104Syokota#define FBIO_SETMODE _IOW('F', 106, int) 59348104Syokota 59448104Syokota/* get/set frame buffer window origin */ 59548104Syokota#define FBIO_GETWINORG _IOR('F', 107, u_int) 59648104Syokota#define FBIO_SETWINORG _IOW('F', 108, u_int) 59748104Syokota 59848104Syokota/* get/set display start address */ 59948104Syokota#define FBIO_GETDISPSTART _IOR('F', 109, video_display_start_t) 60048104Syokota#define FBIO_SETDISPSTART _IOW('F', 110, video_display_start_t) 60148104Syokota 60248104Syokota/* get/set scan line width */ 60348104Syokota#define FBIO_GETLINEWIDTH _IOR('F', 111, u_int) 60448104Syokota#define FBIO_SETLINEWIDTH _IOW('F', 112, u_int) 60548104Syokota 60648104Syokota/* color palette control */ 60748104Syokota#define FBIO_GETPALETTE _IOW('F', 113, video_color_palette_t) 60848104Syokota#define FBIO_SETPALETTE _IOW('F', 114, video_color_palette_t) 60948104Syokota 61081038Syokota/* blank display */ 61181038Syokota#define V_DISPLAY_ON 0 61281038Syokota#define V_DISPLAY_BLANK 1 61381038Syokota#define V_DISPLAY_STAND_BY 2 61481038Syokota#define V_DISPLAY_SUSPEND 3 61581038Syokota 61681038Syokota#define FBIO_BLANK _IOW('F', 115, int) 61781038Syokota 61848104Syokota#endif /* !_SYS_FBIO_H_ */ 619