annotate libvo/vo_vesa.c @ 27449:5723b671a0f6

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