Mercurial > mplayer.hg
annotate libvo/vo_vesa.c @ 16152:10a69a812eff
remove unused cache-prefill and create cache-seek-min that controls when seek_long is prefered over waiting for cache to fill
author | iive |
---|---|
date | Sun, 31 Jul 2005 00:26:07 +0000 |
parents | 05aa13cdf92f |
children | fd51fd1ff231 |
rev | line source |
---|---|
2519 | 1 /* |
2244 | 2 * video_out_vesa.c |
3 * | |
4 * Copyright (C) Nick Kurshev <nickols_k@mail.ru> - Oct 2001 | |
5 * | |
6 * You can redistribute this file under terms and conditions | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
7 * of GNU General Public licence v2. |
2244 | 8 * This file is partly based on vbetest.c from lrmi distributive. |
9 */ | |
10 | |
11 /* | |
12 TODO: | |
13 - hw YUV support (need volunteers who have corresponding hardware) | |
2649 | 14 - triple buffering (if it will really speedup playback). |
2692 | 15 note: triple buffering requires VBE 3.0 - need volunteers. |
2244 | 16 */ |
2775 | 17 #include "config.h" |
7069 | 18 #include "gtf.h" |
2244 | 19 #include <stdio.h> |
2775 | 20 #ifdef HAVE_MALLOC_H |
21 #include <malloc.h> | |
22 #endif | |
2446 | 23 #include <stdlib.h> |
2244 | 24 #include <string.h> |
25 #include <stddef.h> | |
26 #include <limits.h> | |
4739 | 27 #include <unistd.h> |
28 #include <pwd.h> | |
29 #include <sys/types.h> | |
30 #include <sys/stat.h> | |
8791
668b30187d48
Check if we can open /dev/mem in preinit(), so we can exit cleanly.
filon
parents:
8786
diff
changeset
|
31 #include <fcntl.h> |
4739 | 32 |
2244 | 33 |
34 #include "video_out.h" | |
35 #include "video_out_internal.h" | |
36 | |
37 #include "fastmemcpy.h" | |
2337 | 38 #include "sub.h" |
9380 | 39 #include "osdep/vbelib.h" |
2244 | 40 #include "bswap.h" |
2689 | 41 #include "aspect.h" |
3202 | 42 #include "vesa_lvo.h" |
4089 | 43 #ifdef CONFIG_VIDIX |
4030 | 44 #include "vosub_vidix.h" |
4089 | 45 #endif |
2244 | 46 |
2298 | 47 #include "../postproc/swscale.h" |
10233
35f52ad860a0
vf_scale.h & related cleanup & some small warning fix by dominik
michael
parents:
9958
diff
changeset
|
48 #include "../libmpcodecs/vf_scale.h" |
2298 | 49 |
4739 | 50 |
51 #ifdef HAVE_PNG | |
52 extern vo_functions_t video_out_png; | |
53 #endif | |
54 | |
2244 | 55 extern int verbose; |
56 | |
7069 | 57 extern char *monitor_hfreq_str; |
58 extern char *monitor_vfreq_str; | |
59 extern char *monitor_dotclock_str; | |
60 | |
2649 | 61 #define MAX_BUFFERS 3 |
62 | |
2244 | 63 #ifndef max |
64 #define max(a,b) ((a)>(b)?(a):(b)) | |
65 #endif | |
66 #ifndef min | |
67 #define min(a,b) ((a)<(b)?(a):(b)) | |
68 #endif | |
69 | |
2688 | 70 #define UNUSED(x) ((void)(x)) /**< Removes warning about unused arguments */ |
2244 | 71 |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7690
diff
changeset
|
72 static vo_info_t info = |
2244 | 73 { |
74 "VESA VBE 2.0 video output", | |
75 "vesa", | |
76 "Nick Kurshev <nickols_k@mail.ru>", | |
77 "Requires ROOT privileges" | |
78 }; | |
79 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7690
diff
changeset
|
80 LIBVO_EXTERN(vesa) |
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7690
diff
changeset
|
81 |
2244 | 82 /* driver data */ |
83 | |
84 struct win_frame | |
85 { | |
86 uint8_t *ptr; /* pointer to window's frame memory */ | |
87 uint32_t low; /* lowest boundary of frame */ | |
88 uint32_t high; /* highest boundary of frame */ | |
2610 | 89 char idx; /* indicates index of relocatable frame (A=0 or B=1) |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
90 special case for DGA: idx=-1 |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
91 idx=-2 indicates invalid frame, exists only in init() */ |
2244 | 92 }; |
93 | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
94 static void (*cpy_blk_fnc)(unsigned long,uint8_t *,unsigned long) = NULL; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
95 |
4537 | 96 static uint32_t srcW=0,srcH=0,srcBpp,srcFourcc; /* source image description */ |
97 static uint32_t dstBpp,dstW, dstH,dstFourcc; /* destinition image description */ | |
2298 | 98 |
9494
543ab3909b78
sws_ prefix, more seperation between internal & external swscaler API
michael
parents:
9380
diff
changeset
|
99 static struct SwsContext * sws = NULL; |
4537 | 100 |
2329 | 101 static int32_t x_offset,y_offset; /* to center image on screen */ |
9170 | 102 static unsigned init_mode=0; /* mode before run of mplayer */ |
2244 | 103 static void *init_state = NULL; /* state before run of mplayer */ |
104 static struct win_frame win; /* real-mode window to video memory */ | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
105 static uint8_t *dga_buffer = NULL; /* for yuv2rgb and sw_scaling */ |
2244 | 106 static unsigned video_mode; /* selected video mode for playback */ |
107 static struct VesaModeInfoBlock video_mode_info; | |
2331 | 108 static int flip_trigger = 0; |
2337 | 109 static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); |
2244 | 110 |
2649 | 111 /* multibuffering */ |
112 uint8_t* video_base; /* should be never changed */ | |
113 uint32_t multi_buff[MAX_BUFFERS]; /* contains offsets of buffers */ | |
114 uint8_t multi_size=0; /* total number of buffers */ | |
115 uint8_t multi_idx=0; /* active buffer */ | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
116 |
2869 | 117 /* Linux Video Overlay */ |
118 static const char *lvo_name = NULL; | |
9883
3a407acefec5
multiple init fix by Aurelien JACOBS <aurel@gnuage.org>
alex
parents:
9714
diff
changeset
|
119 static int lvo_opened = 0; |
4089 | 120 #ifdef CONFIG_VIDIX |
4030 | 121 static const char *vidix_name = NULL; |
9883
3a407acefec5
multiple init fix by Aurelien JACOBS <aurel@gnuage.org>
alex
parents:
9714
diff
changeset
|
122 static int vidix_opened = 0; |
11158
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
123 static vidix_grkey_t gr_key; |
4089 | 124 #endif |
2869 | 125 |
12660
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
126 /* Neomagic TV out */ |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
127 static int neomagic_tvout = 0; |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
128 static int neomagic_tvnorm = NEO_PAL; |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
129 |
2649 | 130 #define HAS_DGA() (win.idx == -1) |
2244 | 131 #define MOVIE_MODE (MODE_ATTR_COLOR | MODE_ATTR_GRAPHICS) |
2649 | 132 #define FRAME_MODE (MODE_WIN_RELOCATABLE | MODE_WIN_WRITEABLE) |
133 | |
2244 | 134 static char * vbeErrToStr(int err) |
135 { | |
136 char *retval; | |
137 static char sbuff[80]; | |
138 if((err & VBE_VESA_ERROR_MASK) == VBE_VESA_ERROR_MASK) | |
139 { | |
4667 | 140 sprintf(sbuff,"VESA failed = 0x4f%02x",(err & VBE_VESA_ERRCODE_MASK)>>8); |
2244 | 141 retval = sbuff; |
142 } | |
143 else | |
144 switch(err) | |
145 { | |
146 case VBE_OK: retval = "No error"; break; | |
147 case VBE_VM86_FAIL: retval = "vm86() syscall failed"; break; | |
148 case VBE_OUT_OF_DOS_MEM: retval = "Out of DOS memory"; break; | |
149 case VBE_OUT_OF_MEM: retval = "Out of memory"; break; | |
2360 | 150 case VBE_BROKEN_BIOS: retval = "Broken BIOS or DOS TSR"; break; |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
151 default: sprintf(sbuff,"Unknown or internal error: %i",err); retval=sbuff; break; |
2244 | 152 } |
153 return retval; | |
154 } | |
155 | |
156 #define PRINT_VBE_ERR(name,err) { printf("vo_vesa: %s returns: %s\n",name,vbeErrToStr(err)); fflush(stdout); } | |
157 | |
158 static void vesa_term( void ) | |
159 { | |
160 int err; | |
9883
3a407acefec5
multiple init fix by Aurelien JACOBS <aurel@gnuage.org>
alex
parents:
9714
diff
changeset
|
161 if(lvo_opened) { vlvo_term(); lvo_opened = 0; } |
4089 | 162 #ifdef CONFIG_VIDIX |
9883
3a407acefec5
multiple init fix by Aurelien JACOBS <aurel@gnuage.org>
alex
parents:
9714
diff
changeset
|
163 else if(vidix_opened) { vidix_term(); vidix_opened = 0; } |
4089 | 164 #endif |
9170 | 165 if(init_state) if((err=vbeRestoreState(init_state)) != VBE_OK) PRINT_VBE_ERR("vbeRestoreState",err); |
166 init_state=NULL; | |
167 if(init_mode) if((err=vbeSetMode(init_mode,NULL)) != VBE_OK) PRINT_VBE_ERR("vbeSetMode",err); | |
168 init_mode=0; | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
169 if(HAS_DGA()) vbeUnmapVideoBuffer((unsigned long)win.ptr,win.high); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
170 if(dga_buffer && !HAS_DGA()) free(dga_buffer); |
2244 | 171 vbeDestroy(); |
9494
543ab3909b78
sws_ prefix, more seperation between internal & external swscaler API
michael
parents:
9380
diff
changeset
|
172 if(sws) sws_freeContext(sws); |
9170 | 173 sws=NULL; |
2244 | 174 } |
175 | |
176 #define VALID_WIN_FRAME(offset) (offset >= win.low && offset < win.high) | |
177 #define VIDEO_PTR(offset) (win.ptr + offset - win.low) | |
178 | |
179 static inline void __vbeSwitchBank(unsigned long offset) | |
180 { | |
181 unsigned long gran; | |
182 unsigned new_offset; | |
183 int err; | |
184 gran = video_mode_info.WinGranularity*1024; | |
185 new_offset = offset / gran; | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
186 if(HAS_DGA()) { err = -1; goto show_err; } |
2244 | 187 if((err=vbeSetWindow(win.idx,new_offset)) != VBE_OK) |
188 { | |
2610 | 189 show_err: |
2686 | 190 vesa_term(); |
2244 | 191 PRINT_VBE_ERR("vbeSetWindow",err); |
11678
972d1998bde9
occured --> occurred typo patch by Clinton Roy <croy@dstc.edu.au>
diego
parents:
11565
diff
changeset
|
192 printf("vo_vesa: Fatal error occurred! Can't continue\n"); |
10734 | 193 abort(); |
2244 | 194 } |
195 win.low = new_offset * gran; | |
196 win.high = win.low + video_mode_info.WinSize*1024; | |
197 } | |
198 | |
199 static void __vbeSetPixel(int x, int y, int r, int g, int b) | |
200 { | |
201 int x_res = video_mode_info.XResolution; | |
202 int y_res = video_mode_info.YResolution; | |
203 int shift_r = video_mode_info.RedFieldPosition; | |
204 int shift_g = video_mode_info.GreenFieldPosition; | |
205 int shift_b = video_mode_info.BlueFieldPosition; | |
4537 | 206 int pixel_size = (dstBpp+7)/8; |
2244 | 207 int bpl = video_mode_info.BytesPerScanLine; |
2676 | 208 int color; |
209 unsigned offset; | |
2244 | 210 |
211 if (x < 0 || x >= x_res || y < 0 || y >= y_res) return; | |
212 r >>= 8 - video_mode_info.RedMaskSize; | |
213 g >>= 8 - video_mode_info.GreenMaskSize; | |
214 b >>= 8 - video_mode_info.BlueMaskSize; | |
215 color = (r << shift_r) | (g << shift_g) | (b << shift_b); | |
216 offset = y * bpl + (x * pixel_size); | |
217 if(!VALID_WIN_FRAME(offset)) __vbeSwitchBank(offset); | |
218 memcpy(VIDEO_PTR(offset), &color, pixel_size); | |
219 } | |
220 | |
221 /* | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
222 Copies part of frame to video memory. Data should be in the same format |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
223 as video memory. |
2244 | 224 */ |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
225 static void __vbeCopyBlockFast(unsigned long offset,uint8_t *image,unsigned long size) |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
226 { |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
227 memcpy(&win.ptr[offset],image,size); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
228 } |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
229 |
2244 | 230 static void __vbeCopyBlock(unsigned long offset,uint8_t *image,unsigned long size) |
231 { | |
232 unsigned long delta,src_idx = 0; | |
233 while(size) | |
234 { | |
4537 | 235 if(!VALID_WIN_FRAME(offset)) __vbeSwitchBank(offset); |
236 delta = min(size,win.high - offset); | |
237 memcpy(VIDEO_PTR(offset),&image[src_idx],delta); | |
238 src_idx += delta; | |
239 offset += delta; | |
240 size -= delta; | |
2244 | 241 } |
242 } | |
243 | |
244 /* | |
245 Copies frame to video memory. Data should be in the same format as video | |
246 memory. | |
247 */ | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
248 |
4537 | 249 #define PIXEL_SIZE() ((dstBpp+7)/8) |
2676 | 250 #define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) ) |
4537 | 251 #define IMAGE_LINE_SIZE(pixel_size) (dstW*(pixel_size)) |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
252 |
2244 | 253 static void __vbeCopyData(uint8_t *image) |
254 { | |
2308 | 255 unsigned long i,j,image_offset,offset; |
2244 | 256 unsigned pixel_size,image_line_size,screen_line_size,x_shift; |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
257 pixel_size = PIXEL_SIZE(); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
258 screen_line_size = SCREEN_LINE_SIZE(pixel_size); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
259 image_line_size = IMAGE_LINE_SIZE(pixel_size); |
4537 | 260 if(dstW == video_mode_info.XResolution) |
2306 | 261 { |
262 /* Special case for zooming */ | |
4537 | 263 (*cpy_blk_fnc)(y_offset*screen_line_size,image,image_line_size*dstH); |
2306 | 264 } |
265 else | |
2244 | 266 { |
2306 | 267 x_shift = x_offset*pixel_size; |
4537 | 268 for(j=0,i=y_offset;j<dstH;i++,j++) |
2306 | 269 { |
270 offset = i*screen_line_size+x_shift; | |
271 image_offset = j*image_line_size; | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
272 (*cpy_blk_fnc)(offset,&image[image_offset],image_line_size); |
2306 | 273 } |
2244 | 274 } |
275 } | |
2328 | 276 |
2244 | 277 /* is called for yuv only */ |
278 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
279 { | |
14796 | 280 int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; |
4537 | 281 uint8_t *dst[3]= {dga_buffer, NULL, NULL}; |
282 int dstStride[3]; | |
2504 | 283 if(verbose > 2) |
284 printf("vo_vesa: draw_slice was called: w=%u h=%u x=%u y=%u\n",w,h,x,y); | |
4537 | 285 dstStride[0]=dstride*((dstBpp+7)/8); |
286 dstStride[1]= | |
287 dstStride[2]=dstStride[0]>>1; | |
288 if(HAS_DGA()) dst[0] += y_offset*SCREEN_LINE_SIZE(PIXEL_SIZE())+x_offset*PIXEL_SIZE(); | |
10404 | 289 sws_scale_ordered(sws,image,stride,y,h,dst,dstStride); |
2331 | 290 flip_trigger = 1; |
2298 | 291 return 0; |
2244 | 292 } |
293 | |
4572 | 294 /* Please comment it out if you want have OSD within movie */ |
6825
2cbf7d447bb2
Disable OSD outside movie, because it's not redrawn currently, user can use -vop expand to get osd outisde movie.
atmos4
parents:
6203
diff
changeset
|
295 /*#define OSD_OUTSIDE_MOVIE 1*/ |
4572 | 296 |
2649 | 297 static void draw_alpha_32(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) |
298 { | |
14796 | 299 int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; |
4572 | 300 #ifndef OSD_OUTSIDE_MOVIE |
301 if(HAS_DGA()) | |
302 { | |
303 x0 += x_offset; | |
304 y0 += y_offset; | |
305 } | |
306 #endif | |
2649 | 307 vo_draw_alpha_rgb32(w,h,src,srca,stride,dga_buffer+4*(y0*dstride+x0),4*dstride); |
2337 | 308 } |
309 | |
2649 | 310 static void draw_alpha_24(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) |
311 { | |
14796 | 312 int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; |
4572 | 313 #ifndef OSD_OUTSIDE_MOVIE |
314 if(HAS_DGA()) | |
315 { | |
316 x0 += x_offset; | |
317 y0 += y_offset; | |
318 } | |
319 #endif | |
2649 | 320 vo_draw_alpha_rgb24(w,h,src,srca,stride,dga_buffer+3*(y0*dstride+x0),3*dstride); |
2337 | 321 } |
322 | |
2649 | 323 static void draw_alpha_16(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) |
324 { | |
14796 | 325 int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; |
4572 | 326 #ifndef OSD_OUTSIDE_MOVIE |
327 if(HAS_DGA()) | |
328 { | |
329 x0 += x_offset; | |
330 y0 += y_offset; | |
331 } | |
332 #endif | |
2649 | 333 vo_draw_alpha_rgb16(w,h,src,srca,stride,dga_buffer+2*(y0*dstride+x0),2*dstride); |
2337 | 334 } |
335 | |
2649 | 336 static void draw_alpha_15(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) |
337 { | |
14796 | 338 int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; |
4572 | 339 #ifndef OSD_OUTSIDE_MOVIE |
340 if(HAS_DGA()) | |
341 { | |
342 x0 += x_offset; | |
343 y0 += y_offset; | |
344 } | |
345 #endif | |
2649 | 346 vo_draw_alpha_rgb15(w,h,src,srca,stride,dga_buffer+2*(y0*dstride+x0),2*dstride); |
2337 | 347 } |
348 | |
2649 | 349 static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) |
350 { | |
2688 | 351 UNUSED(x0); |
352 UNUSED(y0); | |
353 UNUSED(w); | |
354 UNUSED(h); | |
355 UNUSED(src); | |
356 UNUSED(srca); | |
357 UNUSED(stride); | |
2337 | 358 } |
359 | |
360 | |
2244 | 361 static void draw_osd(void) |
362 { | |
2649 | 363 uint32_t w,h; |
2504 | 364 if(verbose > 2) |
365 printf("vo_vesa: draw_osd was called\n"); | |
2869 | 366 { |
4572 | 367 #ifdef OSD_OUTSIDE_MOVIE |
4537 | 368 w = HAS_DGA()?video_mode_info.XResolution:dstW; |
369 h = HAS_DGA()?video_mode_info.YResolution:dstH; | |
4572 | 370 #else |
371 w = dstW; | |
372 h = dstH; | |
373 #endif | |
2869 | 374 if(dga_buffer) vo_draw_text(w,h,draw_alpha_fnc); |
375 } | |
2244 | 376 } |
377 | |
378 static void flip_page(void) | |
379 { | |
2504 | 380 if(verbose > 2) |
381 printf("vo_vesa: flip_page was called\n"); | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
382 if(flip_trigger) |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
383 { |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
384 if(!HAS_DGA()) __vbeCopyData(dga_buffer); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
385 flip_trigger = 0; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
386 } |
4493 | 387 if(vo_doublebuffering && multi_size > 1) |
2649 | 388 { |
2686 | 389 int err; |
4667 | 390 if((err=vbeSetDisplayStart(multi_buff[multi_idx],vo_vsync)) != VBE_OK) |
2686 | 391 { |
392 vesa_term(); | |
2692 | 393 PRINT_VBE_ERR("vbeSetDisplayStart",err); |
11678
972d1998bde9
occured --> occurred typo patch by Clinton Roy <croy@dstc.edu.au>
diego
parents:
11565
diff
changeset
|
394 printf("vo_vesa: Fatal error occurred! Can't continue\n"); |
10734 | 395 abort(); |
2686 | 396 } |
397 multi_idx = multi_idx ? 0 : 1; | |
398 win.ptr = dga_buffer = video_base + multi_buff[multi_idx]; | |
2649 | 399 } |
400 /* | |
401 else | |
402 if(tripple_buffering) | |
403 { | |
4667 | 404 vbeSetScheduledDisplayStart(multi_buff[multi_idx],vo_vsync); |
2649 | 405 multi_idx++; |
406 if(multi_idx > 2) multi_idx = 0; | |
4667 | 407 win.ptr = dga_buffer = video_base + multi_buff[multi_idx]; |
2649 | 408 } |
409 */ | |
2244 | 410 } |
411 | |
412 /* is called for rgb only */ | |
413 static uint32_t draw_frame(uint8_t *src[]) | |
414 { | |
2504 | 415 if(verbose > 2) |
416 printf("vo_vesa: draw_frame was called\n"); | |
4537 | 417 if(sws) |
2504 | 418 { |
14796 | 419 int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; |
4537 | 420 int srcStride[1]; |
421 uint8_t *dst[3]= {dga_buffer, NULL, NULL}; | |
422 int dstStride[3]; | |
423 dstStride[0]=dstride*((dstBpp+7)/8); | |
424 dstStride[1]= | |
425 dstStride[2]=dstStride[0]>>1; | |
426 if(srcFourcc == IMGFMT_RGB32 || srcFourcc == IMGFMT_BGR32) | |
427 srcStride[0] = srcW*4; | |
428 else | |
429 if(srcFourcc == IMGFMT_RGB24 || srcFourcc == IMGFMT_BGR24) | |
430 srcStride[0] = srcW*3; | |
431 else | |
432 srcStride[0] = srcW*2; | |
433 if(HAS_DGA()) dst[0] += y_offset*SCREEN_LINE_SIZE(PIXEL_SIZE())+x_offset*PIXEL_SIZE(); | |
10404 | 434 sws_scale_ordered(sws,src,srcStride,0,srcH,dst,dstStride); |
4537 | 435 flip_trigger=1; |
436 } | |
2504 | 437 return 0; |
2244 | 438 } |
439 | |
2953
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
440 #define SUBDEV_NODGA 0x00000001UL |
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
441 #define SUBDEV_FORCEDGA 0x00000002UL |
4362 | 442 static uint32_t subdev_flags = 0xFFFFFFFEUL; |
2953
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
443 static uint32_t parseSubDevice(const char *sd) |
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
444 { |
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
445 uint32_t flags; |
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
446 flags = 0; |
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
447 if(strcmp(sd,"nodga") == 0) { flags |= SUBDEV_NODGA; flags &= ~(SUBDEV_FORCEDGA); } |
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
448 else |
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
449 if(strcmp(sd,"dga") == 0) { flags &= ~(SUBDEV_NODGA); flags |= SUBDEV_FORCEDGA; } |
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
450 else |
12660
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
451 if(strcmp(sd,"neotv_pal") == 0) { neomagic_tvout = 1; neomagic_tvnorm = NEO_PAL; } |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
452 else |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
453 if(strcmp(sd,"neotv_ntsc") == 0) { neomagic_tvout = 1; neomagic_tvnorm = NEO_NTSC; } |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
454 else |
2953
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
455 if(memcmp(sd,"lvo:",4) == 0) lvo_name = &sd[4]; /* lvo_name will be valid within init() */ |
4089 | 456 #ifdef CONFIG_VIDIX |
4030 | 457 else |
458 if(memcmp(sd,"vidix",5) == 0) vidix_name = &sd[5]; /* vidix_name will be valid within init() */ | |
4089 | 459 #endif |
4537 | 460 else { printf("vo_vesa: Unknown subdevice: '%s'\n", sd); return 0xFFFFFFFFUL; } |
2953
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
461 return flags; |
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
462 } |
b0cf2b649d3c
Fixed incorretc terminating of lvo stuff and improving of query_format
nick
parents:
2918
diff
changeset
|
463 |
2244 | 464 static uint32_t query_format(uint32_t format) |
465 { | |
2504 | 466 if(verbose > 2) |
467 printf("vo_vesa: query_format was called: %x (%s)\n",format,vo_format_name(format)); | |
12926
6eb8d78e2d47
10l query format at least when used with vidix, disable colorkeying with vidix, should fix #38 and #33
faust3
parents:
12660
diff
changeset
|
468 #ifdef CONFIG_VIDIX |
6eb8d78e2d47
10l query format at least when used with vidix, disable colorkeying with vidix, should fix #38 and #33
faust3
parents:
12660
diff
changeset
|
469 if(vidix_name)return(vidix_query_fourcc(format)); |
6eb8d78e2d47
10l query format at least when used with vidix, disable colorkeying with vidix, should fix #38 and #33
faust3
parents:
12660
diff
changeset
|
470 #endif |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14796
diff
changeset
|
471 return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_SWSCALE | VFCAP_ACCEPT_STRIDE; /* due new SwScale code */ |
2244 | 472 } |
473 | |
2686 | 474 static void paintBkGnd( void ) |
475 { | |
476 int x_res = video_mode_info.XResolution; | |
477 int y_res = video_mode_info.YResolution; | |
478 int x, y; | |
479 | |
480 for (y = 0; y < y_res; ++y) | |
481 { | |
482 for (x = 0; x < x_res; ++x) | |
483 { | |
484 int r, g, b; | |
485 if ((x & 16) ^ (y & 16)) | |
486 { | |
487 r = x * 255 / x_res; | |
488 g = y * 255 / y_res; | |
489 b = 255 - x * 255 / x_res; | |
490 } | |
491 else | |
492 { | |
493 r = 255 - x * 255 / x_res; | |
494 g = y * 255 / y_res; | |
495 b = 255 - y * 255 / y_res; | |
496 } | |
497 __vbeSetPixel(x, y, r, g, b); | |
498 } | |
499 } | |
500 } | |
501 | |
2914 | 502 static void clear_screen( void ) |
503 { | |
504 int x_res = video_mode_info.XResolution; | |
505 int y_res = video_mode_info.YResolution; | |
506 int x, y; | |
507 | |
508 for (y = 0; y < y_res; ++y) | |
509 for (x = 0; x < x_res; ++x) | |
510 __vbeSetPixel(x, y, 0, 0, 0); | |
511 } | |
512 | |
2293 | 513 static char *model2str(unsigned char type) |
514 { | |
515 char *retval; | |
516 switch(type) | |
517 { | |
518 case memText: retval = "Text"; break; | |
519 case memCGA: retval="CGA"; break; | |
520 case memHercules: retval="Hercules"; break; | |
521 case memPL: retval="Planar"; break; | |
522 case memPK: retval="Packed pixel"; break; | |
523 case mem256: retval="256"; break; | |
524 case memRGB: retval="Direct color RGB"; break; | |
525 case memYUV: retval="Direct color YUV"; break; | |
526 default: retval="Unknown"; break; | |
527 } | |
528 return retval; | |
529 } | |
530 | |
2649 | 531 unsigned fillMultiBuffer( unsigned long vsize, unsigned nbuffs ) |
532 { | |
533 unsigned long screen_size, offset; | |
534 unsigned total,i; | |
4537 | 535 screen_size = video_mode_info.XResolution*video_mode_info.YResolution*((dstBpp+7)/8); |
2649 | 536 if(screen_size%64) screen_size=((screen_size/64)*64)+64; |
537 total = vsize / screen_size; | |
2918 | 538 if(verbose) printf("vo_vesa: Can use up to %u video buffers\n",total); |
2649 | 539 i = 0; |
540 offset = 0; | |
541 total = min(total,nbuffs); | |
542 while(i < total) { multi_buff[i++] = offset; offset += screen_size; } | |
543 if(!i) | |
544 printf("vo_vesa: Your have too small size of video memory for this mode:\n" | |
545 "vo_vesa: Requires: %08lX exists: %08lX\n", screen_size, vsize); | |
546 return i; | |
547 } | |
548 | |
7360 | 549 |
7069 | 550 static int set_refresh(unsigned x, unsigned y, unsigned mode,struct VesaCRTCInfoBlock *crtc_pass) |
551 { | |
552 unsigned pixclk; | |
553 float H_freq; | |
554 | |
555 range_t *monitor_hfreq = NULL; | |
556 range_t *monitor_vfreq = NULL; | |
557 range_t *monitor_dotclock = NULL; | |
2649 | 558 |
7069 | 559 monitor_hfreq = str2range(monitor_hfreq_str); |
560 monitor_vfreq = str2range(monitor_vfreq_str); | |
561 monitor_dotclock = str2range(monitor_dotclock_str); | |
562 | |
563 if (!monitor_hfreq || !monitor_vfreq || !monitor_dotclock) { | |
564 printf("vo_vesa: you have to specify the capabilities of" | |
565 " the monitor. Not changing refresh rate.\n"); | |
566 return 0; | |
567 } | |
568 | |
569 H_freq = range_max(monitor_hfreq)/1000; | |
570 | |
571 // printf("H_freq MAX %f\n",H_freq); | |
572 | |
573 do | |
574 { | |
7360 | 575 H_freq -= 0.01; |
7069 | 576 GTF_calcTimings(x,y,H_freq,GTF_HF,0, 0,crtc_pass); |
577 // printf("PixelCLK %d\n",(unsigned)crtc_pass->PixelClock); | |
578 } | |
7360 | 579 while ( (!in_range(monitor_vfreq,crtc_pass->RefreshRate/100)|| |
580 !in_range(monitor_hfreq,H_freq*1000))&&(H_freq>0)); | |
7069 | 581 |
582 pixclk = crtc_pass->PixelClock; | |
583 // printf("PIXclk before %d\n",pixclk); | |
584 vbeGetPixelClock(&mode,&pixclk); | |
585 // printf("PIXclk after %d\n",pixclk); | |
586 GTF_calcTimings(x,y,pixclk/1000000,GTF_PF,0,0,crtc_pass); | |
587 // printf("Flags: %x\n",(unsigned) crtc_pass->Flags); | |
588 /* | |
589 printf("hTotal %d\n",crtc_pass->hTotal); | |
590 printf("hSyncStart %d\n",crtc_pass->hSyncStart); | |
591 printf("hSyncEnd %d\n",crtc_pass->hSyncEnd); | |
592 | |
593 printf("vTotal %d\n",crtc_pass->vTotal); | |
594 printf("vSyncStart %d\n",crtc_pass->vSyncStart); | |
595 printf("vSyncEnd %d\n",crtc_pass->vSyncEnd); | |
596 | |
597 printf("RR %d\n",crtc_pass->RefreshRate); | |
598 printf("PixelCLK %d\n",(unsigned)crtc_pass->PixelClock);*/ | |
7360 | 599 |
600 if (!in_range(monitor_vfreq,crtc_pass->RefreshRate/100)|| | |
601 !in_range(monitor_hfreq,H_freq*1000)) { | |
602 printf( "vo_vesa: Unable to fit the mode into monitor's limitation." | |
603 " Not changing refresh rate.\n"); | |
604 return 0; | |
605 } | |
606 | |
7069 | 607 return 1; |
608 } | |
7360 | 609 |
2244 | 610 /* fullscreen: |
611 * bit 0 (0x01) means fullscreen (-fs) | |
612 * bit 1 (0x02) means mode switching (-vm) | |
613 * bit 2 (0x04) enables software scaling (-zoom) | |
2335 | 614 * bit 3 (0x08) enables flipping (-flip) (NK: and for what?) |
2244 | 615 */ |
7069 | 616 |
2244 | 617 static uint32_t |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
7069
diff
changeset
|
618 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) |
2244 | 619 { |
7069 | 620 struct VbeInfoBlock vib; |
2244 | 621 struct VesaModeInfoBlock vmib; |
7069 | 622 struct VesaCRTCInfoBlock crtc_pass; |
2244 | 623 size_t i,num_modes; |
4362 | 624 uint32_t w,h; |
2244 | 625 unsigned short *mode_ptr,win_seg; |
626 unsigned bpp,best_x = UINT_MAX,best_y=UINT_MAX,best_mode_idx = UINT_MAX; | |
4601
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
627 int err,fs_mode,use_scaler=0; |
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
628 srcW = dstW = width; |
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
629 srcH = dstH = height; |
2336 | 630 fs_mode = 0; |
4362 | 631 if(subdev_flags == 0xFFFFFFFEUL) |
2971 | 632 { |
4362 | 633 printf("vo_vesa: detected internal fatal error: init is called before preinit\n"); |
2971 | 634 return -1; |
4362 | 635 } |
4537 | 636 if(subdev_flags == 0xFFFFFFFFUL) return -1; |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14796
diff
changeset
|
637 if(flags & VOFLAG_FLIPPING) |
2244 | 638 { |
2329 | 639 printf("vo_vesa: switch -flip is not supported\n"); |
2244 | 640 } |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14796
diff
changeset
|
641 if(flags & VOFLAG_SWSCALE) use_scaler = 1; |
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14796
diff
changeset
|
642 if(flags & VOFLAG_FULLSCREEN) |
2336 | 643 { |
4537 | 644 if(use_scaler) use_scaler = 2; |
2336 | 645 else fs_mode = 1; |
646 } | |
2244 | 647 if((err=vbeInit()) != VBE_OK) { PRINT_VBE_ERR("vbeInit",err); return -1; } |
648 memcpy(vib.VESASignature,"VBE2",4); | |
649 if((err=vbeGetControllerInfo(&vib)) != VBE_OK) | |
650 { | |
651 PRINT_VBE_ERR("vbeGetControllerInfo",err); | |
652 printf("vo_vesa: possible reason: No VBE2 BIOS found\n"); | |
653 return -1; | |
654 } | |
655 /* Print general info here */ | |
656 printf("vo_vesa: Found VESA VBE BIOS Version %x.%x Revision: %x\n", | |
657 (int)(vib.VESAVersion >> 8) & 0xff, | |
658 (int)(vib.VESAVersion & 0xff), | |
659 (int)(vib.OemSoftwareRev & 0xffff)); | |
2255 | 660 printf("vo_vesa: Video memory: %u Kb\n",vib.TotalMemory*64); |
661 printf("vo_vesa: VESA Capabilities: %s %s %s %s %s\n" | |
662 ,vib.Capabilities & VBE_DAC_8BIT ? "8-bit DAC," : "6-bit DAC," | |
663 ,vib.Capabilities & VBE_NONVGA_CRTC ? "non-VGA CRTC,":"VGA CRTC," | |
664 ,vib.Capabilities & VBE_SNOWED_RAMDAC ? "snowed RAMDAC,":"normal RAMDAC," | |
665 ,vib.Capabilities & VBE_STEREOSCOPIC ? "stereoscopic,":"no stereoscopic," | |
666 ,vib.Capabilities & VBE_STEREO_EVC ? "Stereo EVC":"no stereo"); | |
667 printf("vo_vesa: !!! Below will be printed OEM info. !!!\n"); | |
668 printf("vo_vesa: You should watch 5 OEM related lines below else you've broken vm86\n"); | |
2244 | 669 printf("vo_vesa: OEM info: %s\n",vib.OemStringPtr); |
2255 | 670 printf("vo_vesa: OEM Revision: %x\n",vib.OemSoftwareRev); |
671 printf("vo_vesa: OEM vendor: %s\n",vib.OemVendorNamePtr); | |
672 printf("vo_vesa: OEM Product Name: %s\n",vib.OemProductNamePtr); | |
673 printf("vo_vesa: OEM Product Rev: %s\n",vib.OemProductRevPtr); | |
674 printf("vo_vesa: Hint: To get workable TV-Out you should have plugged tv-connector in\n" | |
675 "vo_vesa: before booting PC since VESA BIOS initializes itself only during POST\n"); | |
2244 | 676 /* Find best mode here */ |
677 num_modes = 0; | |
678 mode_ptr = vib.VideoModePtr; | |
679 while(*mode_ptr++ != 0xffff) num_modes++; | |
680 switch(format) | |
681 { | |
682 case IMGFMT_BGR8: | |
683 case IMGFMT_RGB8: bpp = 8; break; | |
684 case IMGFMT_BGR15: | |
685 case IMGFMT_RGB15: bpp = 15; break; | |
686 case IMGFMT_BGR16: | |
687 case IMGFMT_RGB16: bpp = 16; break; | |
688 case IMGFMT_BGR24: | |
689 case IMGFMT_RGB24: bpp = 24; break; | |
690 case IMGFMT_BGR32: | |
691 case IMGFMT_RGB32: bpp = 32; break; | |
4601
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
692 default: bpp = 16; break; |
2244 | 693 } |
4537 | 694 srcBpp = bpp; |
695 srcFourcc = format; | |
2504 | 696 if(vo_dbpp) bpp = vo_dbpp; |
2337 | 697 switch(bpp) |
698 { | |
4537 | 699 case 15: draw_alpha_fnc = draw_alpha_15; |
700 dstFourcc = IMGFMT_BGR15; | |
701 break; | |
702 case 16: draw_alpha_fnc = draw_alpha_16; | |
703 dstFourcc = IMGFMT_BGR16; | |
704 break; | |
705 case 24: draw_alpha_fnc = draw_alpha_24; | |
706 dstFourcc = IMGFMT_BGR24; | |
707 break; | |
708 case 32: draw_alpha_fnc = draw_alpha_32; | |
709 dstFourcc = IMGFMT_BGR32; | |
710 break; | |
711 default: draw_alpha_fnc = draw_alpha_null; | |
712 dstFourcc = IMGFMT_BGR16; | |
713 break; | |
2337 | 714 } |
2244 | 715 if(verbose) |
716 { | |
2304 | 717 printf("vo_vesa: Requested mode: %ux%u@%u (%s)\n",width,height,bpp,vo_format_name(format)); |
2244 | 718 printf("vo_vesa: Total modes found: %u\n",num_modes); |
719 mode_ptr = vib.VideoModePtr; | |
720 printf("vo_vesa: Mode list:"); | |
721 for(i = 0;i < num_modes;i++) | |
722 { | |
723 printf(" %04X",mode_ptr[i]); | |
724 } | |
725 printf("\nvo_vesa: Modes in detail:\n"); | |
726 } | |
727 mode_ptr = vib.VideoModePtr; | |
4537 | 728 if(use_scaler) |
2335 | 729 { |
4537 | 730 dstW = d_width; |
4601
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
731 dstH = d_height; |
2335 | 732 } |
733 if(vo_screenwidth) w = vo_screenwidth; | |
4537 | 734 else w = max(dstW,width); |
2335 | 735 if(vo_screenheight) h = vo_screenheight; |
4537 | 736 else h = max(dstH,height); |
2244 | 737 for(i=0;i < num_modes;i++) |
738 { | |
739 if((err=vbeGetModeInfo(mode_ptr[i],&vmib)) != VBE_OK) | |
740 { | |
741 PRINT_VBE_ERR("vbeGetModeInfo",err); | |
13568
1cb0e1833515
Currently vbeGetProtModeInfo call the 0x4f0a function of int 10h the get
faust3
parents:
13480
diff
changeset
|
742 continue; |
2244 | 743 } |
2329 | 744 if(vmib.XResolution >= w && |
745 vmib.YResolution >= h && | |
2244 | 746 (vmib.ModeAttributes & MOVIE_MODE) == MOVIE_MODE && |
747 vmib.BitsPerPixel == bpp && | |
748 vmib.MemoryModel == memRGB) | |
749 { | |
2293 | 750 if(vmib.XResolution <= best_x && |
751 vmib.YResolution <= best_y) | |
2244 | 752 { |
753 best_x = vmib.XResolution; | |
754 best_y = vmib.YResolution; | |
755 best_mode_idx = i; | |
756 } | |
757 } | |
758 if(verbose) | |
759 { | |
2298 | 760 printf("vo_vesa: Mode (%03u): mode=%04X %ux%u@%u attr=%04X\n" |
2293 | 761 "vo_vesa: #planes=%u model=%u(%s) #pages=%u\n" |
762 "vo_vesa: winA=%X(attr=%u) winB=%X(attr=%u) winSize=%u winGran=%u\n" | |
2446 | 763 "vo_vesa: direct_color=%u DGA_phys_addr=%08lX\n" |
2244 | 764 ,i,mode_ptr[i],vmib.XResolution,vmib.YResolution,vmib.BitsPerPixel,vmib.ModeAttributes |
2293 | 765 ,vmib.NumberOfPlanes,vmib.MemoryModel,model2str(vmib.MemoryModel),vmib.NumberOfImagePages |
2244 | 766 ,vmib.WinASegment,vmib.WinAAttributes,vmib.WinBSegment,vmib.WinBAttributes,vmib.WinSize,vmib.WinGranularity |
767 ,vmib.DirectColorModeInfo,vmib.PhysBasePtr); | |
768 if(vmib.MemoryModel == 6 || vmib.MemoryModel == 7) | |
769 printf("vo_vesa: direct_color_info = %u:%u:%u:%u\n" | |
770 ,vmib.RedMaskSize,vmib.GreenMaskSize,vmib.BlueMaskSize,vmib.RsvdMaskSize); | |
771 fflush(stdout); | |
772 } | |
773 } | |
774 if(best_mode_idx != UINT_MAX) | |
775 { | |
776 video_mode = vib.VideoModePtr[best_mode_idx]; | |
777 fflush(stdout); | |
778 if((err=vbeGetMode(&init_mode)) != VBE_OK) | |
779 { | |
780 PRINT_VBE_ERR("vbeGetMode",err); | |
781 return -1; | |
782 } | |
783 if(verbose) printf("vo_vesa: Initial video mode: %x\n",init_mode); | |
784 if((err=vbeGetModeInfo(video_mode,&video_mode_info)) != VBE_OK) | |
785 { | |
786 PRINT_VBE_ERR("vbeGetModeInfo",err); | |
787 return -1; | |
788 } | |
7025
3bc8ff93d64e
10l bug - noticed by Emiel Neggers <emiel@neggers.net>
arpi
parents:
6825
diff
changeset
|
789 dstBpp = video_mode_info.BitsPerPixel; |
2329 | 790 printf("vo_vesa: Using VESA mode (%u) = %x [%ux%u@%u]\n" |
791 ,best_mode_idx,video_mode,video_mode_info.XResolution | |
4537 | 792 ,video_mode_info.YResolution,dstBpp); |
4362 | 793 if(subdev_flags & SUBDEV_NODGA) video_mode_info.PhysBasePtr = 0; |
4601
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
794 if(use_scaler || fs_mode) |
2298 | 795 { |
2304 | 796 /* software scale */ |
13480 | 797 if(use_scaler > 1 |
798 #ifdef CONFIG_VIDIX | |
799 || vidix_name | |
800 #endif | |
801 ) | |
2689 | 802 { |
803 aspect_save_orig(width,height); | |
804 aspect_save_prescale(d_width,d_height); | |
805 aspect_save_screenres(video_mode_info.XResolution,video_mode_info.YResolution); | |
4537 | 806 aspect(&dstW,&dstH,A_ZOOM); |
2689 | 807 } |
2336 | 808 else |
809 if(fs_mode) | |
810 { | |
4537 | 811 dstW = video_mode_info.XResolution; |
812 dstH = video_mode_info.YResolution; | |
2336 | 813 } |
4537 | 814 use_scaler = 1; |
4601
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
815 } |
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
816 if(!lvo_name |
4089 | 817 #ifdef CONFIG_VIDIX |
4601
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
818 && !vidix_name |
4089 | 819 #endif |
4601
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
820 ) |
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
821 { |
9494
543ab3909b78
sws_ prefix, more seperation between internal & external swscaler API
michael
parents:
9380
diff
changeset
|
822 sws = sws_getContextFromCmdLine(srcW,srcH,srcFourcc,dstW,dstH,dstFourcc); |
4601
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
823 if(!sws) |
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
824 { |
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
825 printf("vo_vesa: Can't initialize SwScaler\n"); |
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
826 return -1; |
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
827 } |
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
828 else if(verbose) printf("vo_vesa: Using SW BES emulator\n"); |
2298 | 829 } |
2244 | 830 if((video_mode_info.WinAAttributes & FRAME_MODE) == FRAME_MODE) |
831 win.idx = 0; /* frame A */ | |
832 else | |
833 if((video_mode_info.WinBAttributes & FRAME_MODE) == FRAME_MODE) | |
834 win.idx = 1; /* frame B */ | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
835 else win.idx = -2; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
836 /* Try use DGA instead */ |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
837 if(video_mode_info.PhysBasePtr && vib.TotalMemory && (video_mode_info.ModeAttributes & MODE_ATTR_LINEAR)) |
2244 | 838 { |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
839 void *lfb; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
840 unsigned long vsize; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
841 vsize = vib.TotalMemory*64*1024; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
842 lfb = vbeMapVideoBuffer(video_mode_info.PhysBasePtr,vsize); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
843 if(lfb == NULL) |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
844 printf("vo_vesa: Can't use DGA. Force bank switching mode. :(\n"); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
845 else |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
846 { |
2649 | 847 video_base = win.ptr = lfb; |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
848 win.low = 0UL; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
849 win.high = vsize; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
850 win.idx = -1; /* HAS_DGA() is on */ |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
851 video_mode |= VESA_MODE_USE_LINEAR; |
2649 | 852 printf("vo_vesa: Using DGA (physical resources: %08lXh, %08lXh)" |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
853 ,video_mode_info.PhysBasePtr |
2649 | 854 ,vsize); |
855 if(verbose) printf(" at %08lXh",(unsigned long)lfb); | |
856 printf("\n"); | |
857 if(!(multi_size = fillMultiBuffer(vsize,2))) return -1; | |
858 if(vo_doublebuffering && multi_size < 2) | |
859 printf("vo_vesa: Can't use double buffering: not enough video memory\n"); | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
860 } |
2244 | 861 } |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
862 if(win.idx == -2) |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
863 { |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
864 printf("vo_vesa: Can't find neither DGA nor relocatable window's frame.\n"); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
865 return -1; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
866 } |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
867 if(!HAS_DGA()) |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
868 { |
4362 | 869 if(subdev_flags & SUBDEV_FORCEDGA) |
2649 | 870 { |
871 printf("vo_vesa: you've forced DGA. Exiting\n"); | |
872 return -1; | |
873 } | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
874 if(!(win_seg = win.idx == 0 ? video_mode_info.WinASegment:video_mode_info.WinBSegment)) |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
875 { |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
876 printf("vo_vesa: Can't find valid window address\n"); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
877 return -1; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
878 } |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
879 win.ptr = PhysToVirtSO(win_seg,0); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
880 win.low = 0L; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
881 win.high= video_mode_info.WinSize*1024; |
2649 | 882 printf("vo_vesa: Using bank switching mode (physical resources: %08lXh, %08lXh)\n" |
883 ,(unsigned long)win.ptr,(unsigned long)win.high); | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
884 } |
4537 | 885 if(video_mode_info.XResolution > dstW) |
886 x_offset = (video_mode_info.XResolution - dstW) / 2; | |
2329 | 887 else x_offset = 0; |
4537 | 888 if(video_mode_info.YResolution > dstH) |
889 y_offset = (video_mode_info.YResolution - dstH) / 2; | |
2329 | 890 else y_offset = 0; |
2305
82c17b134946
Fixed half-image bug and added computing of correct aspect during zooming
nick
parents:
2304
diff
changeset
|
891 if(verbose) |
82c17b134946
Fixed half-image bug and added computing of correct aspect during zooming
nick
parents:
2304
diff
changeset
|
892 printf("vo_vesa: image: %ux%u screen = %ux%u x_offset = %u y_offset = %u\n" |
4537 | 893 ,dstW,dstH |
2305
82c17b134946
Fixed half-image bug and added computing of correct aspect during zooming
nick
parents:
2304
diff
changeset
|
894 ,video_mode_info.XResolution,video_mode_info.YResolution |
82c17b134946
Fixed half-image bug and added computing of correct aspect during zooming
nick
parents:
2304
diff
changeset
|
895 ,x_offset,y_offset); |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
896 if(HAS_DGA()) |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
897 { |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
898 dga_buffer = win.ptr; /* Trickly ;) */ |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
899 cpy_blk_fnc = __vbeCopyBlockFast; |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
900 } |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
901 else |
2610 | 902 { |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
903 cpy_blk_fnc = __vbeCopyBlock; |
4601
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
904 if(!lvo_name |
4089 | 905 #ifdef CONFIG_VIDIX |
906 && !vidix_name | |
907 #endif | |
4601
8cda24d7f074
Make code simple. Use swScaler even for fastmemcpy purposes :)
nick
parents:
4596
diff
changeset
|
908 ) |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
909 { |
4537 | 910 if(!(dga_buffer = memalign(64,video_mode_info.XResolution*video_mode_info.YResolution*dstBpp))) |
2610 | 911 { |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
912 printf("vo_vesa: Can't allocate temporary buffer\n"); |
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
913 return -1; |
2610 | 914 } |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
915 if(verbose) printf("vo_vesa: dga emulator was allocated = %p\n",dga_buffer); |
2337 | 916 } |
2504 | 917 } |
2244 | 918 if((err=vbeSaveState(&init_state)) != VBE_OK) |
919 { | |
920 PRINT_VBE_ERR("vbeSaveState",err); | |
921 return -1; | |
922 } | |
7360 | 923 |
924 /* TODO: | |
925 user might pass refresh value, | |
7069 | 926 GTF constants might be read from monitor |
7360 | 927 for best results, I don't have a spec (RM) |
7069 | 928 */ |
7360 | 929 |
7069 | 930 if (((int)(vib.VESAVersion >> 8) & 0xff) > 2) { |
931 | |
7650
7e8193475ddf
a small fix for vo_vesa, when calling set_refresh, when -nofs used.
arpi
parents:
7360
diff
changeset
|
932 if (set_refresh(video_mode_info.XResolution,video_mode_info.YResolution,video_mode,&crtc_pass)) |
7069 | 933 video_mode = video_mode | 0x800; |
934 | |
935 } | |
936 | |
937 ; | |
938 | |
939 if ((err=vbeSetMode(video_mode,&crtc_pass)) != VBE_OK) | |
2244 | 940 { |
941 PRINT_VBE_ERR("vbeSetMode",err); | |
942 return -1; | |
943 } | |
7069 | 944 |
12660
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
945 if (neomagic_tvout) { |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
946 err = vbeSetTV(video_mode,neomagic_tvnorm); |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
947 if (err!=0x4f) { |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
948 printf("vo_vesa: Sorry unsupported mode, try -x 640 -zoom\n"); |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
949 } |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
950 else { |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
951 printf("vo_vesa: Oh you really have picture on TV!\n"); |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
952 } |
430a71a762b4
neomagic tv out support throught vesa vbe, patch by Rudolf Marek
alex
parents:
11678
diff
changeset
|
953 } |
2244 | 954 /* Now we are in video mode!!!*/ |
2337 | 955 /* Below 'return -1' is impossible */ |
2244 | 956 if(verbose) |
957 { | |
958 printf("vo_vesa: Graphics mode was activated\n"); | |
959 fflush(stdout); | |
960 } | |
2869 | 961 if(lvo_name) |
962 { | |
4537 | 963 if(vlvo_init(width,height,x_offset,y_offset,dstW,dstH,format,dstBpp) != 0) |
2869 | 964 { |
965 printf("vo_vesa: Can't initialize Linux Video Overlay\n"); | |
966 vesa_term(); | |
967 return -1; | |
968 } | |
969 else printf("vo_vesa: Using video overlay: %s\n",lvo_name); | |
9883
3a407acefec5
multiple init fix by Aurelien JACOBS <aurel@gnuage.org>
alex
parents:
9714
diff
changeset
|
970 lvo_opened = 1; |
2869 | 971 } |
4089 | 972 #ifdef CONFIG_VIDIX |
4030 | 973 else |
974 if(vidix_name) | |
975 { | |
4537 | 976 if(vidix_init(width,height,x_offset,y_offset,dstW, |
977 dstH,format,dstBpp, | |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
7069
diff
changeset
|
978 video_mode_info.XResolution,video_mode_info.YResolution) != 0) |
4030 | 979 { |
980 printf("vo_vesa: Can't initialize VIDIX driver\n"); | |
4548 | 981 vesa_term(); |
4030 | 982 return -1; |
983 } | |
4083 | 984 else printf("vo_vesa: Using VIDIX\n"); |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4089
diff
changeset
|
985 vidix_start(); |
11158
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
986 |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
987 /* set colorkey */ |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
988 if (vidix_grkey_support()) |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
989 { |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
990 vidix_grkey_get(&gr_key); |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
991 gr_key.key_op = KEYS_PUT; |
12926
6eb8d78e2d47
10l query format at least when used with vidix, disable colorkeying with vidix, should fix #38 and #33
faust3
parents:
12660
diff
changeset
|
992 #if 0 |
11216 | 993 if (!(vo_colorkey & 0xFF000000)) |
11158
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
994 { |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
995 gr_key.ckey.op = CKEY_TRUE; |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
996 gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16; |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
997 gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8; |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
998 gr_key.ckey.blue = vo_colorkey & 0x000000FF; |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
999 } else |
12926
6eb8d78e2d47
10l query format at least when used with vidix, disable colorkeying with vidix, should fix #38 and #33
faust3
parents:
12660
diff
changeset
|
1000 #endif |
11158
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
1001 gr_key.ckey.op = CKEY_FALSE; |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
1002 vidix_grkey_set(&gr_key); |
85f4534d1edb
Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents:
10734
diff
changeset
|
1003 } |
9883
3a407acefec5
multiple init fix by Aurelien JACOBS <aurel@gnuage.org>
alex
parents:
9714
diff
changeset
|
1004 vidix_opened = 1; |
4030 | 1005 } |
4089 | 1006 #endif |
2244 | 1007 } |
1008 else | |
1009 { | |
2255 | 1010 printf("vo_vesa: Can't find mode for: %ux%u@%u\n",width,height,bpp); |
2244 | 1011 return -1; |
1012 } | |
1013 if(verbose) | |
1014 { | |
1015 printf("vo_vesa: VESA initialization complete\n"); | |
1016 fflush(stdout); | |
1017 } | |
2688 | 1018 if(HAS_DGA() && vo_doublebuffering) |
2244 | 1019 { |
2686 | 1020 for(i=0;i<MAX_BUFFERS;i++) |
1021 { | |
1022 win.ptr = dga_buffer = video_base + multi_buff[i]; | |
8652
edfe94b9d578
Juste a trivial patch for vesa output. The screen were cleaned at init
arpi
parents:
8148
diff
changeset
|
1023 clear_screen(); /* Clear screen for stupid BIOSes */ |
4002 | 1024 if(verbose>1) paintBkGnd(); |
2686 | 1025 } |
2244 | 1026 } |
2686 | 1027 else |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
1028 { |
8652
edfe94b9d578
Juste a trivial patch for vesa output. The screen were cleaned at init
arpi
parents:
8148
diff
changeset
|
1029 clear_screen(); /* Clear screen for stupid BIOSes */ |
9714 | 1030 if(verbose>1) |
2686 | 1031 { |
1032 int x; | |
1033 x = (video_mode_info.XResolution/video_mode_info.XCharSize)/2-strlen(title)/2; | |
1034 if(x < 0) x = 0; | |
9714 | 1035 paintBkGnd(); |
2686 | 1036 vbeWriteString(x,0,7,title); |
1037 } | |
2633
fe5ab8c660de
Qualitative speedup decoding when video card supports DGA!
nick
parents:
2610
diff
changeset
|
1038 } |
2244 | 1039 return 0; |
1040 } | |
1041 | |
1042 static void | |
1043 uninit(void) | |
1044 { | |
8786
605c85c27e68
Not checking it caused SIGSEV when uninitning after vesa init failed.
filon
parents:
8652
diff
changeset
|
1045 // not inited |
2686 | 1046 vesa_term(); |
2504 | 1047 if(verbose > 2) |
1048 printf("vo_vesa: uninit was called\n"); | |
2244 | 1049 } |
1050 | |
1051 | |
1052 static void check_events(void) | |
1053 { | |
2504 | 1054 if(verbose > 2) |
1055 printf("vo_vesa: check_events was called\n"); | |
2244 | 1056 /* Nothing to do */ |
1057 } | |
4352 | 1058 |
1059 static uint32_t preinit(const char *arg) | |
1060 { | |
4362 | 1061 int pre_init_err = 0; |
8791
668b30187d48
Check if we can open /dev/mem in preinit(), so we can exit cleanly.
filon
parents:
8786
diff
changeset
|
1062 int fd; |
4362 | 1063 if(verbose>1) printf("vo_vesa: preinit(%s) was called\n",arg); |
1064 if(verbose > 2) | |
1065 printf("vo_vesa: subdevice %s is being initialized\n",arg); | |
1066 subdev_flags = 0; | |
9958 | 1067 lvo_name = NULL; |
1068 #ifdef CONFIG_VIDIX | |
1069 vidix_name = NULL; | |
1070 #endif | |
4362 | 1071 if(arg) subdev_flags = parseSubDevice(arg); |
1072 if(lvo_name) pre_init_err = vlvo_preinit(lvo_name); | |
1073 #ifdef CONFIG_VIDIX | |
1074 else if(vidix_name) pre_init_err = vidix_preinit(vidix_name,&video_out_vesa); | |
1075 #endif | |
8791
668b30187d48
Check if we can open /dev/mem in preinit(), so we can exit cleanly.
filon
parents:
8786
diff
changeset
|
1076 // check if we can open /dev/mem (it will be opened later in config(), but if we |
668b30187d48
Check if we can open /dev/mem in preinit(), so we can exit cleanly.
filon
parents:
8786
diff
changeset
|
1077 // detect now that we can't we can exit cleanly) |
668b30187d48
Check if we can open /dev/mem in preinit(), so we can exit cleanly.
filon
parents:
8786
diff
changeset
|
1078 fd = open("/dev/mem", O_RDWR); |
668b30187d48
Check if we can open /dev/mem in preinit(), so we can exit cleanly.
filon
parents:
8786
diff
changeset
|
1079 if (fd < 0) |
668b30187d48
Check if we can open /dev/mem in preinit(), so we can exit cleanly.
filon
parents:
8786
diff
changeset
|
1080 return -1; |
8792 | 1081 else |
1082 close(fd); | |
4362 | 1083 if(verbose > 2) |
1084 printf("vo_subdevice: initialization returns: %i\n",pre_init_err); | |
1085 return pre_init_err; | |
4352 | 1086 } |
1087 | |
4596 | 1088 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 1089 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4572
diff
changeset
|
1090 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4572
diff
changeset
|
1091 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4572
diff
changeset
|
1092 return query_format(*((uint32_t*)data)); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4572
diff
changeset
|
1093 } |
11565
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1094 |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1095 #ifdef CONFIG_VIDIX |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1096 if (vidix_name) { |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1097 switch (request) { |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1098 case VOCTRL_SET_EQUALIZER: |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1099 { |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1100 va_list ap; |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1101 int value; |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1102 |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1103 va_start(ap, data); |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1104 value = va_arg(ap, int); |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1105 va_end(ap); |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1106 |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1107 return vidix_control(request, data, (int *)value); |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1108 } |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1109 case VOCTRL_GET_EQUALIZER: |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1110 { |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1111 va_list ap; |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1112 int *value; |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1113 |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1114 va_start(ap, data); |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1115 value = va_arg(ap, int*); |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1116 va_end(ap); |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1117 |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1118 return vidix_control(request, data, value); |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1119 } |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1120 } |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1121 return vidix_control(request, data); |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1122 } |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1123 #endif |
0d24c99199e2
Some more vidix crap - vidix equalizer passthrough. Patch by Oleg I. Vdovikin <vdovikin@jscc.ru>
alex
parents:
11216
diff
changeset
|
1124 |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4572
diff
changeset
|
1125 return VO_NOTIMPL; |
4352 | 1126 } |