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