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