Mercurial > sdl-ios-xcode
comparison src/video/fbcon/SDL_fbvideo.h @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | 14717b52abc0 |
children | 4da1ee79c9af |
comparison
equal
deleted
inserted
replaced
1661:281d3f4870e5 | 1662:782fd950bd46 |
---|---|
38 /* Hidden "this" pointer for the video functions */ | 38 /* Hidden "this" pointer for the video functions */ |
39 #define _THIS SDL_VideoDevice *this | 39 #define _THIS SDL_VideoDevice *this |
40 | 40 |
41 | 41 |
42 /* This is the structure we use to keep track of video memory */ | 42 /* This is the structure we use to keep track of video memory */ |
43 typedef struct vidmem_bucket { | 43 typedef struct vidmem_bucket |
44 struct vidmem_bucket *prev; | 44 { |
45 int used; | 45 struct vidmem_bucket *prev; |
46 int dirty; | 46 int used; |
47 char *base; | 47 int dirty; |
48 unsigned int size; | 48 char *base; |
49 struct vidmem_bucket *next; | 49 unsigned int size; |
50 struct vidmem_bucket *next; | |
50 } vidmem_bucket; | 51 } vidmem_bucket; |
51 | 52 |
52 /* Private display data */ | 53 /* Private display data */ |
53 struct SDL_PrivateVideoData { | 54 struct SDL_PrivateVideoData |
54 int console_fd; | 55 { |
55 struct fb_var_screeninfo cache_vinfo; | 56 int console_fd; |
56 struct fb_var_screeninfo saved_vinfo; | 57 struct fb_var_screeninfo cache_vinfo; |
57 int saved_cmaplen; | 58 struct fb_var_screeninfo saved_vinfo; |
58 __u16 *saved_cmap; | 59 int saved_cmaplen; |
60 __u16 *saved_cmap; | |
59 | 61 |
60 int current_vt; | 62 int current_vt; |
61 int saved_vt; | 63 int saved_vt; |
62 int keyboard_fd; | 64 int keyboard_fd; |
63 int saved_kbd_mode; | 65 int saved_kbd_mode; |
64 struct termios saved_kbd_termios; | 66 struct termios saved_kbd_termios; |
65 | 67 |
66 int mouse_fd; | 68 int mouse_fd; |
67 #if SDL_INPUT_TSLIB | 69 #if SDL_INPUT_TSLIB |
68 struct tsdev *ts_dev; | 70 struct tsdev *ts_dev; |
69 #endif | 71 #endif |
70 | 72 |
71 char *mapped_mem; | 73 char *mapped_mem; |
72 int mapped_memlen; | 74 int mapped_memlen; |
73 int mapped_offset; | 75 int mapped_offset; |
74 char *mapped_io; | 76 char *mapped_io; |
75 long mapped_iolen; | 77 long mapped_iolen; |
76 int flip_page; | 78 int flip_page; |
77 char *flip_address[2]; | 79 char *flip_address[2]; |
78 | 80 |
79 #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ | 81 #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ |
80 int SDL_nummodes[NUM_MODELISTS]; | 82 int SDL_nummodes[NUM_MODELISTS]; |
81 SDL_Rect **SDL_modelist[NUM_MODELISTS]; | 83 SDL_Rect **SDL_modelist[NUM_MODELISTS]; |
82 | 84 |
83 vidmem_bucket surfaces; | 85 vidmem_bucket surfaces; |
84 int surfaces_memtotal; | 86 int surfaces_memtotal; |
85 int surfaces_memleft; | 87 int surfaces_memleft; |
86 | 88 |
87 SDL_mutex *hw_lock; | 89 SDL_mutex *hw_lock; |
88 int switched_away; | 90 int switched_away; |
89 struct fb_var_screeninfo screen_vinfo; | 91 struct fb_var_screeninfo screen_vinfo; |
90 Uint32 screen_arealen; | 92 Uint32 screen_arealen; |
91 Uint8 *screen_contents; | 93 Uint8 *screen_contents; |
92 __u16 screen_palette[3*256]; | 94 __u16 screen_palette[3 * 256]; |
93 | 95 |
94 void (*wait_vbl)(_THIS); | 96 void (*wait_vbl) (_THIS); |
95 void (*wait_idle)(_THIS); | 97 void (*wait_idle) (_THIS); |
96 }; | 98 }; |
97 /* Old variable names */ | 99 /* Old variable names */ |
98 #define console_fd (this->hidden->console_fd) | 100 #define console_fd (this->hidden->console_fd) |
99 #define current_vt (this->hidden->current_vt) | 101 #define current_vt (this->hidden->current_vt) |
100 #define saved_vt (this->hidden->saved_vt) | 102 #define saved_vt (this->hidden->saved_vt) |
132 | 134 |
133 /* Accelerator types that are supported by the driver, but are not | 135 /* Accelerator types that are supported by the driver, but are not |
134 necessarily in the kernel headers on the system we compile on. | 136 necessarily in the kernel headers on the system we compile on. |
135 */ | 137 */ |
136 #ifndef FB_ACCEL_MATROX_MGAG400 | 138 #ifndef FB_ACCEL_MATROX_MGAG400 |
137 #define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */ | 139 #define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */ |
138 #endif | 140 #endif |
139 #ifndef FB_ACCEL_3DFX_BANSHEE | 141 #ifndef FB_ACCEL_3DFX_BANSHEE |
140 #define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */ | 142 #define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */ |
141 #endif | 143 #endif |
142 | 144 |
143 /* These functions are defined in SDL_fbvideo.c */ | 145 /* These functions are defined in SDL_fbvideo.c */ |
144 extern void FB_SavePaletteTo(_THIS, int palette_len, __u16 *area); | 146 extern void FB_SavePaletteTo (_THIS, int palette_len, __u16 * area); |
145 extern void FB_RestorePaletteFrom(_THIS, int palette_len, __u16 *area); | 147 extern void FB_RestorePaletteFrom (_THIS, int palette_len, __u16 * area); |
146 | 148 |
147 /* These are utility functions for working with video surfaces */ | 149 /* These are utility functions for working with video surfaces */ |
148 | 150 |
149 static __inline__ void FB_AddBusySurface(SDL_Surface *surface) | 151 static __inline__ void |
152 FB_AddBusySurface (SDL_Surface * surface) | |
150 { | 153 { |
151 ((vidmem_bucket *)surface->hwdata)->dirty = 1; | 154 ((vidmem_bucket *) surface->hwdata)->dirty = 1; |
152 } | 155 } |
153 | 156 |
154 static __inline__ int FB_IsSurfaceBusy(SDL_Surface *surface) | 157 static __inline__ int |
158 FB_IsSurfaceBusy (SDL_Surface * surface) | |
155 { | 159 { |
156 return ((vidmem_bucket *)surface->hwdata)->dirty; | 160 return ((vidmem_bucket *) surface->hwdata)->dirty; |
157 } | 161 } |
158 | 162 |
159 static __inline__ void FB_WaitBusySurfaces(_THIS) | 163 static __inline__ void |
164 FB_WaitBusySurfaces (_THIS) | |
160 { | 165 { |
161 vidmem_bucket *bucket; | 166 vidmem_bucket *bucket; |
162 | 167 |
163 /* Wait for graphic operations to complete */ | 168 /* Wait for graphic operations to complete */ |
164 wait_idle(this); | 169 wait_idle (this); |
165 | 170 |
166 /* Clear all surface dirty bits */ | 171 /* Clear all surface dirty bits */ |
167 for ( bucket=&surfaces; bucket; bucket=bucket->next ) { | 172 for (bucket = &surfaces; bucket; bucket = bucket->next) { |
168 bucket->dirty = 0; | 173 bucket->dirty = 0; |
169 } | 174 } |
170 } | 175 } |
171 | 176 |
172 static __inline__ void FB_dst_to_xy(_THIS, SDL_Surface *dst, int *x, int *y) | 177 static __inline__ void |
178 FB_dst_to_xy (_THIS, SDL_Surface * dst, int *x, int *y) | |
173 { | 179 { |
174 *x = (long)((char *)dst->pixels - mapped_mem)%this->screen->pitch; | 180 *x = (long) ((char *) dst->pixels - mapped_mem) % this->screen->pitch; |
175 *y = (long)((char *)dst->pixels - mapped_mem)/this->screen->pitch; | 181 *y = (long) ((char *) dst->pixels - mapped_mem) / this->screen->pitch; |
176 if ( dst == this->screen ) { | 182 if (dst == this->screen) { |
177 *x += this->offset_x; | 183 *x += this->offset_x; |
178 *y += this->offset_y; | 184 *y += this->offset_y; |
179 } | 185 } |
180 } | 186 } |
181 | 187 |
182 #endif /* _SDL_fbvideo_h */ | 188 #endif /* _SDL_fbvideo_h */ |
189 /* vi: set ts=4 sw=4 expandtab: */ |