Mercurial > sdl-ios-xcode
comparison src/video/fbcon/SDL_fbvideo.h @ 106:63ec24e0575f
Merged DGA video surface handling improvements, unified locking code.
Fixed matrox blit bug where src Y less than dst Y
Fixed hardware surface init when no resolution change
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Fri, 13 Jul 2001 10:19:51 +0000 |
parents | 74212992fb08 |
children | e8157fcb3114 |
comparison
equal
deleted
inserted
replaced
105:2136ea8953f9 | 106:63ec24e0575f |
---|---|
41 | 41 |
42 | 42 |
43 /* This is the structure we use to keep track of video memory */ | 43 /* This is the structure we use to keep track of video memory */ |
44 typedef struct vidmem_bucket { | 44 typedef struct vidmem_bucket { |
45 struct vidmem_bucket *prev; | 45 struct vidmem_bucket *prev; |
46 unsigned int used; | 46 int used; |
47 int dirty; | |
47 char *base; | 48 char *base; |
48 unsigned int size; | 49 unsigned int size; |
49 struct vidmem_bucket *next; | 50 struct vidmem_bucket *next; |
50 } vidmem_bucket; | 51 } 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 | 52 |
58 /* Private display data */ | 53 /* Private display data */ |
59 struct SDL_PrivateVideoData { | 54 struct SDL_PrivateVideoData { |
60 int console_fd; | 55 int console_fd; |
61 struct fb_var_screeninfo cache_vinfo; | 56 struct fb_var_screeninfo cache_vinfo; |
88 int surfaces_memleft; | 83 int surfaces_memleft; |
89 | 84 |
90 SDL_mutex *hw_lock; | 85 SDL_mutex *hw_lock; |
91 | 86 |
92 void (*wait_vbl)(_THIS); | 87 void (*wait_vbl)(_THIS); |
88 void (*wait_idle)(_THIS); | |
93 }; | 89 }; |
94 /* Old variable names */ | 90 /* Old variable names */ |
95 #define console_fd (this->hidden->console_fd) | 91 #define console_fd (this->hidden->console_fd) |
96 #define current_vt (this->hidden->current_vt) | 92 #define current_vt (this->hidden->current_vt) |
97 #define saved_vt (this->hidden->saved_vt) | 93 #define saved_vt (this->hidden->saved_vt) |
115 #define surfaces (this->hidden->surfaces) | 111 #define surfaces (this->hidden->surfaces) |
116 #define surfaces_memtotal (this->hidden->surfaces_memtotal) | 112 #define surfaces_memtotal (this->hidden->surfaces_memtotal) |
117 #define surfaces_memleft (this->hidden->surfaces_memleft) | 113 #define surfaces_memleft (this->hidden->surfaces_memleft) |
118 #define hw_lock (this->hidden->hw_lock) | 114 #define hw_lock (this->hidden->hw_lock) |
119 #define wait_vbl (this->hidden->wait_vbl) | 115 #define wait_vbl (this->hidden->wait_vbl) |
116 #define wait_idle (this->hidden->wait_idle) | |
120 | 117 |
121 /* Accelerator types that are supported by the driver, but are not | 118 /* Accelerator types that are supported by the driver, but are not |
122 necessarily in the kernel headers on the system we compile on. | 119 necessarily in the kernel headers on the system we compile on. |
123 */ | 120 */ |
124 #ifndef FB_ACCEL_MATROX_MGAG400 | 121 #ifndef FB_ACCEL_MATROX_MGAG400 |
130 | 127 |
131 /* These functions are defined in SDL_fbvideo.c */ | 128 /* These functions are defined in SDL_fbvideo.c */ |
132 extern void FB_SavePaletteTo(_THIS, int palette_len, __u16 *area); | 129 extern void FB_SavePaletteTo(_THIS, int palette_len, __u16 *area); |
133 extern void FB_RestorePaletteFrom(_THIS, int palette_len, __u16 *area); | 130 extern void FB_RestorePaletteFrom(_THIS, int palette_len, __u16 *area); |
134 | 131 |
132 /* These are utility functions for working with video surfaces */ | |
133 | |
134 static __inline__ void FB_AddBusySurface(SDL_Surface *surface) | |
135 { | |
136 ((vidmem_bucket *)surface->hwdata)->dirty = 1; | |
137 } | |
138 | |
139 static __inline__ int FB_IsSurfaceBusy(SDL_Surface *surface) | |
140 { | |
141 return ((vidmem_bucket *)surface->hwdata)->dirty; | |
142 } | |
143 | |
144 static __inline__ void FB_WaitBusySurfaces(_THIS) | |
145 { | |
146 vidmem_bucket *bucket; | |
147 | |
148 /* Wait for graphic operations to complete */ | |
149 wait_idle(this); | |
150 | |
151 /* Clear all surface dirty bits */ | |
152 for ( bucket=&surfaces; bucket; bucket=bucket->next ) { | |
153 bucket->dirty = 0; | |
154 } | |
155 } | |
156 | |
157 static __inline__ void FB_dst_to_xy(_THIS, SDL_Surface *dst, int *x, int *y) | |
158 { | |
159 *x = (long)((char *)dst->pixels - mapped_mem)%this->screen->pitch; | |
160 *y = (long)((char *)dst->pixels - mapped_mem)/this->screen->pitch; | |
161 if ( dst == this->screen ) { | |
162 *x += this->offset_x; | |
163 *y += this->offset_y; | |
164 } | |
165 } | |
166 | |
135 #endif /* _SDL_fbvideo_h */ | 167 #endif /* _SDL_fbvideo_h */ |