comparison libvo/vo_vesa.c @ 25861:5442946cade2

Fix illegal identifiers, names starting with __ are reserved for the system.
author diego
date Sun, 27 Jan 2008 18:01:19 +0000
parents 8911d4b81d78
children afa125da85cf
comparison
equal deleted inserted replaced
25860:110952f312cc 25861:5442946cade2
168 } 168 }
169 169
170 #define VALID_WIN_FRAME(offset) (offset >= win.low && offset < win.high) 170 #define VALID_WIN_FRAME(offset) (offset >= win.low && offset < win.high)
171 #define VIDEO_PTR(offset) (win.ptr + offset - win.low) 171 #define VIDEO_PTR(offset) (win.ptr + offset - win.low)
172 172
173 static inline void __vbeSwitchBank(unsigned long offset) 173 static inline void vbeSwitchBank(unsigned long offset)
174 { 174 {
175 unsigned long gran; 175 unsigned long gran;
176 unsigned new_offset; 176 unsigned new_offset;
177 int err; 177 int err;
178 gran = video_mode_info.WinGranularity*1024; 178 gran = video_mode_info.WinGranularity*1024;
188 } 188 }
189 win.low = new_offset * gran; 189 win.low = new_offset * gran;
190 win.high = win.low + video_mode_info.WinSize*1024; 190 win.high = win.low + video_mode_info.WinSize*1024;
191 } 191 }
192 192
193 static void __vbeSetPixel(int x, int y, int r, int g, int b) 193 static void vbeSetPixel(int x, int y, int r, int g, int b)
194 { 194 {
195 int x_res = video_mode_info.XResolution; 195 int x_res = video_mode_info.XResolution;
196 int y_res = video_mode_info.YResolution; 196 int y_res = video_mode_info.YResolution;
197 int shift_r = video_mode_info.RedFieldPosition; 197 int shift_r = video_mode_info.RedFieldPosition;
198 int shift_g = video_mode_info.GreenFieldPosition; 198 int shift_g = video_mode_info.GreenFieldPosition;
206 r >>= 8 - video_mode_info.RedMaskSize; 206 r >>= 8 - video_mode_info.RedMaskSize;
207 g >>= 8 - video_mode_info.GreenMaskSize; 207 g >>= 8 - video_mode_info.GreenMaskSize;
208 b >>= 8 - video_mode_info.BlueMaskSize; 208 b >>= 8 - video_mode_info.BlueMaskSize;
209 color = (r << shift_r) | (g << shift_g) | (b << shift_b); 209 color = (r << shift_r) | (g << shift_g) | (b << shift_b);
210 offset = y * bpl + (x * pixel_size); 210 offset = y * bpl + (x * pixel_size);
211 if(!VALID_WIN_FRAME(offset)) __vbeSwitchBank(offset); 211 if(!VALID_WIN_FRAME(offset)) vbeSwitchBank(offset);
212 memcpy(VIDEO_PTR(offset), &color, pixel_size); 212 memcpy(VIDEO_PTR(offset), &color, pixel_size);
213 } 213 }
214 214
215 /* 215 /*
216 Copies part of frame to video memory. Data should be in the same format 216 Copies part of frame to video memory. Data should be in the same format
217 as video memory. 217 as video memory.
218 */ 218 */
219 static void __vbeCopyBlockFast(unsigned long offset,uint8_t *image,unsigned long size) 219 static void vbeCopyBlockFast(unsigned long offset,uint8_t *image,unsigned long size)
220 { 220 {
221 fast_memcpy(&win.ptr[offset],image,size); 221 fast_memcpy(&win.ptr[offset],image,size);
222 } 222 }
223 223
224 static void __vbeCopyBlock(unsigned long offset,uint8_t *image,unsigned long size) 224 static void vbeCopyBlock(unsigned long offset,uint8_t *image,unsigned long size)
225 { 225 {
226 unsigned long delta,src_idx = 0; 226 unsigned long delta,src_idx = 0;
227 while(size) 227 while(size)
228 { 228 {
229 if(!VALID_WIN_FRAME(offset)) __vbeSwitchBank(offset); 229 if(!VALID_WIN_FRAME(offset)) vbeSwitchBank(offset);
230 delta = min(size,win.high - offset); 230 delta = min(size,win.high - offset);
231 fast_memcpy(VIDEO_PTR(offset),&image[src_idx],delta); 231 fast_memcpy(VIDEO_PTR(offset),&image[src_idx],delta);
232 src_idx += delta; 232 src_idx += delta;
233 offset += delta; 233 offset += delta;
234 size -= delta; 234 size -= delta;
242 242
243 #define PIXEL_SIZE() ((dstBpp+7)/8) 243 #define PIXEL_SIZE() ((dstBpp+7)/8)
244 #define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) ) 244 #define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) )
245 #define IMAGE_LINE_SIZE(pixel_size) (dstW*(pixel_size)) 245 #define IMAGE_LINE_SIZE(pixel_size) (dstW*(pixel_size))
246 246
247 static void __vbeCopyData(uint8_t *image) 247 static void vbeCopyData(uint8_t *image)
248 { 248 {
249 unsigned long i,j,image_offset,offset; 249 unsigned long i,j,image_offset,offset;
250 unsigned pixel_size,image_line_size,screen_line_size,x_shift; 250 unsigned pixel_size,image_line_size,screen_line_size,x_shift;
251 pixel_size = PIXEL_SIZE(); 251 pixel_size = PIXEL_SIZE();
252 screen_line_size = SCREEN_LINE_SIZE(pixel_size); 252 screen_line_size = SCREEN_LINE_SIZE(pixel_size);
373 { 373 {
374 if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) 374 if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
375 mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: flip_page was called\n"); 375 mp_msg(MSGT_VO,MSGL_DBG3, "vo_vesa: flip_page was called\n");
376 if(flip_trigger) 376 if(flip_trigger)
377 { 377 {
378 if(!HAS_DGA()) __vbeCopyData(dga_buffer); 378 if(!HAS_DGA()) vbeCopyData(dga_buffer);
379 flip_trigger = 0; 379 flip_trigger = 0;
380 } 380 }
381 if(vo_doublebuffering && multi_size > 1) 381 if(vo_doublebuffering && multi_size > 1)
382 { 382 {
383 int err; 383 int err;
489 { 489 {
490 r = 255 - x * 255 / x_res; 490 r = 255 - x * 255 / x_res;
491 g = y * 255 / y_res; 491 g = y * 255 / y_res;
492 b = 255 - y * 255 / y_res; 492 b = 255 - y * 255 / y_res;
493 } 493 }
494 __vbeSetPixel(x, y, r, g, b); 494 vbeSetPixel(x, y, r, g, b);
495 } 495 }
496 } 496 }
497 } 497 }
498 498
499 static void clear_screen( void ) 499 static void clear_screen( void )
502 int y_res = video_mode_info.YResolution; 502 int y_res = video_mode_info.YResolution;
503 int x, y; 503 int x, y;
504 504
505 for (y = 0; y < y_res; ++y) 505 for (y = 0; y < y_res; ++y)
506 for (x = 0; x < x_res; ++x) 506 for (x = 0; x < x_res; ++x)
507 __vbeSetPixel(x, y, 0, 0, 0); 507 vbeSetPixel(x, y, 0, 0, 0);
508 } 508 }
509 509
510 static char *model2str(unsigned char type) 510 static char *model2str(unsigned char type)
511 { 511 {
512 char *retval; 512 char *retval;
893 ,video_mode_info.XResolution,video_mode_info.YResolution 893 ,video_mode_info.XResolution,video_mode_info.YResolution
894 ,x_offset,y_offset); 894 ,x_offset,y_offset);
895 if(HAS_DGA()) 895 if(HAS_DGA())
896 { 896 {
897 dga_buffer = win.ptr; /* Trickly ;) */ 897 dga_buffer = win.ptr; /* Trickly ;) */
898 cpy_blk_fnc = __vbeCopyBlockFast; 898 cpy_blk_fnc = vbeCopyBlockFast;
899 } 899 }
900 else 900 else
901 { 901 {
902 cpy_blk_fnc = __vbeCopyBlock; 902 cpy_blk_fnc = vbeCopyBlock;
903 if(!lvo_name 903 if(!lvo_name
904 #ifdef CONFIG_VIDIX 904 #ifdef CONFIG_VIDIX
905 && !vidix_name 905 && !vidix_name
906 #endif 906 #endif
907 ) 907 )