src/video/fbcon/SDL_fbvideo.h
changeset 0 74212992fb08
child 106 63ec24e0575f
equal deleted inserted replaced
-1:000000000000 0:74212992fb08
       
     1 /*
       
     2     SDL - Simple DirectMedia Layer
       
     3     Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
       
     4 
       
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Library General Public
       
     7     License as published by the Free Software Foundation; either
       
     8     version 2 of the License, or (at your option) any later version.
       
     9 
       
    10     This library is distributed in the hope that it will be useful,
       
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13     Library General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Library General Public
       
    16     License along with this library; if not, write to the Free
       
    17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    18 
       
    19     Sam Lantinga
       
    20     slouken@devolution.com
       
    21 */
       
    22 
       
    23 #ifdef SAVE_RCSID
       
    24 static char rcsid =
       
    25  "@(#) $Id$";
       
    26 #endif
       
    27 
       
    28 #ifndef _SDL_fbvideo_h
       
    29 #define _SDL_fbvideo_h
       
    30 
       
    31 #include <sys/types.h>
       
    32 #include <termios.h>
       
    33 #include <linux/fb.h>
       
    34 
       
    35 #include "SDL_mouse.h"
       
    36 #include "SDL_mutex.h"
       
    37 #include "SDL_sysvideo.h"
       
    38 
       
    39 /* Hidden "this" pointer for the video functions */
       
    40 #define _THIS	SDL_VideoDevice *this
       
    41 
       
    42 
       
    43 /* This is the structure we use to keep track of video memory */
       
    44 typedef struct vidmem_bucket {
       
    45 	struct vidmem_bucket *prev;
       
    46 	unsigned int used;
       
    47 	char *base;
       
    48 	unsigned int size;
       
    49 	struct vidmem_bucket *next;
       
    50 } vidmem_bucket;
       
    51 
       
    52 /* Information about the location of the surface in hardware memory */
       
    53 struct private_hwdata {
       
    54 	int x;
       
    55 	int y;
       
    56 };
       
    57 
       
    58 /* Private display data */
       
    59 struct SDL_PrivateVideoData {
       
    60 	int console_fd;
       
    61 	struct fb_var_screeninfo cache_vinfo;
       
    62 	struct fb_var_screeninfo saved_vinfo;
       
    63 	int saved_cmaplen;
       
    64 	__u16 *saved_cmap;
       
    65 
       
    66 	int current_vt;
       
    67 	int saved_vt;
       
    68 	int keyboard_fd;
       
    69 	int saved_kbd_mode;
       
    70 	struct termios saved_kbd_termios;
       
    71 
       
    72 	int mouse_fd;
       
    73 
       
    74 	char *mapped_mem;
       
    75 	int mapped_memlen;
       
    76 	int mapped_offset;
       
    77 	char *mapped_io;
       
    78 	long mapped_iolen;
       
    79 	int flip_page;
       
    80 	char *flip_address[2];
       
    81 
       
    82 #define NUM_MODELISTS	4		/* 8, 16, 24, and 32 bits-per-pixel */
       
    83 	int SDL_nummodes[NUM_MODELISTS];
       
    84 	SDL_Rect **SDL_modelist[NUM_MODELISTS];
       
    85 
       
    86 	vidmem_bucket surfaces;
       
    87 	int surfaces_memtotal;
       
    88 	int surfaces_memleft;
       
    89 
       
    90 	SDL_mutex *hw_lock;
       
    91 
       
    92 	void (*wait_vbl)(_THIS);
       
    93 };
       
    94 /* Old variable names */
       
    95 #define console_fd		(this->hidden->console_fd)
       
    96 #define current_vt		(this->hidden->current_vt)
       
    97 #define saved_vt		(this->hidden->saved_vt)
       
    98 #define keyboard_fd		(this->hidden->keyboard_fd)
       
    99 #define saved_kbd_mode		(this->hidden->saved_kbd_mode)
       
   100 #define saved_kbd_termios	(this->hidden->saved_kbd_termios)
       
   101 #define mouse_fd		(this->hidden->mouse_fd)
       
   102 #define cache_vinfo		(this->hidden->cache_vinfo)
       
   103 #define saved_vinfo		(this->hidden->saved_vinfo)
       
   104 #define saved_cmaplen		(this->hidden->saved_cmaplen)
       
   105 #define saved_cmap		(this->hidden->saved_cmap)
       
   106 #define mapped_mem		(this->hidden->mapped_mem)
       
   107 #define mapped_memlen		(this->hidden->mapped_memlen)
       
   108 #define mapped_offset		(this->hidden->mapped_offset)
       
   109 #define mapped_io		(this->hidden->mapped_io)
       
   110 #define mapped_iolen		(this->hidden->mapped_iolen)
       
   111 #define flip_page		(this->hidden->flip_page)
       
   112 #define flip_address		(this->hidden->flip_address)
       
   113 #define SDL_nummodes		(this->hidden->SDL_nummodes)
       
   114 #define SDL_modelist		(this->hidden->SDL_modelist)
       
   115 #define surfaces		(this->hidden->surfaces)
       
   116 #define surfaces_memtotal	(this->hidden->surfaces_memtotal)
       
   117 #define surfaces_memleft	(this->hidden->surfaces_memleft)
       
   118 #define hw_lock			(this->hidden->hw_lock)
       
   119 #define wait_vbl		(this->hidden->wait_vbl)
       
   120 
       
   121 /* Accelerator types that are supported by the driver, but are not
       
   122    necessarily in the kernel headers on the system we compile on.
       
   123 */
       
   124 #ifndef FB_ACCEL_MATROX_MGAG400
       
   125 #define FB_ACCEL_MATROX_MGAG400	26	/* Matrox G400			*/
       
   126 #endif
       
   127 #ifndef FB_ACCEL_3DFX_BANSHEE
       
   128 #define FB_ACCEL_3DFX_BANSHEE	31	/* 3Dfx Banshee			*/
       
   129 #endif
       
   130 
       
   131 /* These functions are defined in SDL_fbvideo.c */
       
   132 extern void FB_SavePaletteTo(_THIS, int palette_len, __u16 *area);
       
   133 extern void FB_RestorePaletteFrom(_THIS, int palette_len, __u16 *area);
       
   134 
       
   135 #endif /* _SDL_fbvideo_h */