1 /* Copyright (C) 2001-2006 Artifex Software, Inc. 2 All Rights Reserved. 3 4 This software is provided AS-IS with no warranty, either express or 5 implied. 6 7 This software is distributed under license and may not be copied, modified 8 or distributed except as expressly authorized under the terms of that 9 license. Refer to licensing information at http://www.artifex.com/ 10 or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, 11 San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. 12 */ 13 14 /* $Id: gdevsvga.h 8022 2007-06-05 22:23:38Z giles $ */ 15 /* Common definitions and procedures for SuperVGA drivers */ 16 /* Requires gdevpcfb.h */ 17 18 #ifndef gdevsvga_INCLUDED 19 # define gdevsvga_INCLUDED 20 21 /* Common procedures */ 22 23 /* See gxdevice.h for the definitions of the procedures. */ 24 25 dev_proc_close_device(svga_close); 26 dev_proc_map_rgb_color(svga_map_rgb_color); 27 dev_proc_map_color_rgb(svga_map_color_rgb); 28 dev_proc_fill_rectangle(svga_fill_rectangle); 29 dev_proc_copy_mono(svga_copy_mono); 30 dev_proc_copy_color(svga_copy_color); 31 dev_proc_get_params(svga_get_params); 32 dev_proc_put_params(svga_put_params); 33 dev_proc_get_bits(svga_get_bits); 34 dev_proc_copy_alpha(svga_copy_alpha); 35 36 /* Table structure for looking up graphics modes. */ 37 typedef struct { 38 int width, height; /* "key" */ 39 int mode; /* "value" */ 40 } mode_info; 41 42 /* The device descriptor structure */ 43 typedef struct gx_device_svga_s gx_device_svga; 44 struct gx_device_svga_s { 45 gx_device_common; 46 int (*get_mode) (void); 47 void (*set_mode) (int); 48 void (*set_page) (gx_device_svga * fbdev, int pnum, int wnum); 49 bool fixed_colors; /* if true, used a fixed palette */ 50 const mode_info *mode; /* BIOS display mode info */ 51 uint raster; /* frame buffer bytes per line */ 52 int current_page; /* current page */ 53 int wnum_read, wnum_write; /* window #s for read vs. write */ 54 /* Following are device-specific. */ 55 union { 56 struct { 57 void (*bios_set_page) (int, int); /* set-page function */ 58 int pn_shift; /* log2(64K/granularity) */ 59 } vesa; 60 struct { 61 int select_reg; /* page-select register */ 62 } atiw; 63 struct { 64 int et_model; /* 4 for ET4000, */ 65 /* 3 for ET3000 */ 66 } tseng; 67 } info; 68 }; 69 70 /* The initial parameters map an appropriate fraction of */ 71 /* the screen to a full-page coordinate space. */ 72 /* This may or may not be what is desired! */ 73 #define svga_color_device(procs, name, depth, maxv, dither, get_mode, set_mode, set_page) {\ 74 std_device_color_body(gx_device_svga, &procs, name,\ 75 640, 480,\ 76 480 / PAGE_HEIGHT_INCHES, 480 / PAGE_HEIGHT_INCHES,\ 77 /*dci_color(*/depth, maxv, dither/*)*/),\ 78 { 0 }, /* std_procs */\ 79 get_mode, set_mode, set_page,\ 80 0 /*fixed_colors*/\ 81 } 82 #define svga_device(procs, name, get_mode, set_mode, set_page)\ 83 svga_color_device(procs, name, 8, 31, 4, get_mode, set_mode, set_page) 84 85 /* Utility procedures */ 86 void svga_init_colors(gx_device *); 87 int svga_find_mode(gx_device *, const mode_info *); 88 int svga_open(gx_device *); 89 90 #endif /* gdevsvga_INCLUDED */ 91