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