Mercurial > mplayer.hg
annotate libvo/vo_dga.c @ 4178:a7fece7c628e
Grab PS_IOPL define from <sys/psw.h> on solaris x86
author | jkeil |
---|---|
date | Tue, 15 Jan 2002 18:46:31 +0000 |
parents | 974e028471a4 |
children | ed5b85b713a3 |
rev | line source |
---|---|
13 | 1 #define DISP |
2 | |
3 /* | |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
4 * $Id$ |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
5 * |
13 | 6 * video_out_dga.c, X11 interface |
7 * | |
8 * | |
9 * Copyright ( C ) 2001, Andreas Ackermann. All Rights Reserved. | |
10 * | |
11 * <acki@acki-netz.de> | |
12 * | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
13 * Sourceforge username: acki2 |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
14 * |
13 | 15 * note well: |
16 * | |
392 | 17 * - covers only common video card formats i.e. |
18 * BGR_16_15_555 | |
19 * BGR_16_16_565 | |
20 * BGR_24_24_888 | |
21 * BGR_32_24_888 | |
22 * | |
23 * - works only on x86 architectures | |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
24 * |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
25 * $Log$ |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
26 * Revision 1.36 2002/01/08 20:58:53 atmos4 |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
27 * SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
28 * |
3852
cd642e995366
use XF86VidMode later in init (at line 1031) only if we've got support (if have_vm==1)
alex
parents:
3318
diff
changeset
|
29 * Revision 1.35 2001/12/28 20:52:54 alex |
cd642e995366
use XF86VidMode later in init (at line 1031) only if we've got support (if have_vm==1)
alex
parents:
3318
diff
changeset
|
30 * use XF86VidMode later in init (at line 1031) only if we've got support (if have_vm==1) |
cd642e995366
use XF86VidMode later in init (at line 1031) only if we've got support (if have_vm==1)
alex
parents:
3318
diff
changeset
|
31 * |
3318 | 32 * Revision 1.34 2001/12/04 17:24:25 alex |
33 * do not crash if can't get modelines (dga2.0) | |
34 * | |
2732 | 35 * Revision 1.33 2001/11/06 11:21:08 nick |
36 * Move yuv2rgb to postprocess | |
2629 | 37 * |
38 * | |
2556 | 39 * Revision 1.31 2001/10/30 17:04:31 nick |
40 * Using new stuff of rgb15to16 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1336
diff
changeset
|
41 * |
2629 | 42 * Revision 1.30 2001/08/13 11:08:18 atlka |
43 * changes according to -utf8 option, draw_osd() function added | |
44 * | |
1336
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
45 * Revision 1.29 2001/07/16 18:41:52 jkeil |
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
46 * vo_dga doesn't compile on non-x86 architecture due to x86 asm usage. |
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
47 * |
1268 | 48 * Revision 1.28 2001/07/03 23:45:49 arpi |
49 * extern vo_doublebuffering cleanup | |
50 * | |
1193 | 51 * Revision 1.27 2001/06/22 19:51:25 atmosfear |
52 * Fixed pointer->integer cast warning. | |
53 * | |
1158 | 54 * Revision 1.26 2001/06/18 16:38:06 acki2 |
55 * - just modified an error message | |
56 * | |
1154
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
57 * Revision 1.25 2001/06/17 22:21:47 acki2 |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
58 * - if DGA fails to report some valid modes, vo_dga now exits gracefully |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
59 * instead of crashing ... (100000x100000 bug ...) |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
60 * |
1150
8682a16321db
- doublebuffering now can be switched on and off with the -(no)double switch.
acki2
parents:
865
diff
changeset
|
61 * Revision 1.24 2001/06/17 20:59:39 acki2 |
8682a16321db
- doublebuffering now can be switched on and off with the -(no)double switch.
acki2
parents:
865
diff
changeset
|
62 * - doublebuffering now can be switched on and off with the -(no)double switch. |
8682a16321db
- doublebuffering now can be switched on and off with the -(no)double switch.
acki2
parents:
865
diff
changeset
|
63 * Default in libvo is disabled. |
8682a16321db
- doublebuffering now can be switched on and off with the -(no)double switch.
acki2
parents:
865
diff
changeset
|
64 * |
865 | 65 * Revision 1.23 2001/05/24 20:48:45 arpi_esp |
66 * removed redundant osd.h includes | |
67 * | |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
68 * Revision 1.22 2001/05/07 19:16:04 acki2 |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
69 * - now chooses mode with highest ymax (enables doublebuffering in some cases |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
70 * it didn't work before) |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
71 * - use my own memcopy() on non MMX machines again |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
72 * - do memcpy() in one single block if stride==0 |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
73 * |
691 | 74 * Revision 1.21 2001/05/03 22:39:38 acki2 |
75 * - finally: 15to16 conversion included!!! | |
76 * | |
690
2094b195a9bc
- now we use fastmemcpy() for copying. Saves about 25% of copying time on K6-2+
acki2
parents:
680
diff
changeset
|
77 * Revision 1.20 2001/05/02 23:21:27 acki2 |
2094b195a9bc
- now we use fastmemcpy() for copying. Saves about 25% of copying time on K6-2+
acki2
parents:
680
diff
changeset
|
78 * - now we use fastmemcpy() for copying. Saves about 25% of copying time on K6-2+ |
2094b195a9bc
- now we use fastmemcpy() for copying. Saves about 25% of copying time on K6-2+
acki2
parents:
680
diff
changeset
|
79 * |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
80 * Revision 1.19 2001/05/01 22:37:37 acki2 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
81 * - now features 24->32 conversion (this is actually faster than letting the |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
82 * codec produce depth 32 in the first place for avis :-))) ) |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
83 * |
677
ee2dac2cc633
- now mpeg is fast again (no more offscreen buffer rubbish) But is it really ok?
acki2
parents:
616
diff
changeset
|
84 * Revision 1.18 2001/05/01 20:24:31 acki2 |
ee2dac2cc633
- now mpeg is fast again (no more offscreen buffer rubbish) But is it really ok?
acki2
parents:
616
diff
changeset
|
85 * - now mpeg is fast again (no more offscreen buffer rubbish) But is it really ok? |
ee2dac2cc633
- now mpeg is fast again (no more offscreen buffer rubbish) But is it really ok?
acki2
parents:
616
diff
changeset
|
86 * |
616 | 87 * Revision 1.17 2001/04/24 11:42:04 pontscho |
88 * clean up | |
89 * | |
612 | 90 * Revision 1.16 2001/04/24 10:21:12 szabii |
91 * some warnings killed | |
92 * | |
533 | 93 * Revision 1.15 2001/04/19 21:39:10 arpi_esp |
94 * driver info now depends on detected DGA version | |
95 * | |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
96 * Revision 1.14 2001/04/17 22:28:09 acki2 |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
97 * - now also supports OSD for YV12 (big speed penalty by having to build image |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
98 * in offscreen memory and then copying; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
99 * - OSD still works just with doublebuffering enabled :-( |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
100 * |
490 | 101 * Revision 1.13 2001/04/17 20:51:58 acki2 |
102 * - query_format() now uses new return value concept | |
103 * - now support for OSD :-))) for RGB modes | |
104 * YV12 is flickering in quite an ugly fashion; have to fix this, but | |
105 * will cost an extra copying of image data ... :-((( | |
106 * | |
395
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
107 * Revision 1.12 2001/04/13 22:11:08 acki2 |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
108 * - fixed bug with depth and mpg when current bpp of XServer was != 32 |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
109 * - when -bpp is selected, I accept only query_modes() for THIS particular depth |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
110 * (if it's supported by hardware) |
392 | 111 * |
272
8ffe2f459851
- still more debug output to be able to fix 15/16 bpp problem
acki2
parents:
266
diff
changeset
|
112 * Revision 1.10 2001/04/01 22:01:28 acki2 |
8ffe2f459851
- still more debug output to be able to fix 15/16 bpp problem
acki2
parents:
266
diff
changeset
|
113 * - still more debug output to be able to fix 15/16 bpp problem |
8ffe2f459851
- still more debug output to be able to fix 15/16 bpp problem
acki2
parents:
266
diff
changeset
|
114 * |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
115 * Revision 1.9 2001/04/01 08:07:14 acki2 |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
116 * - added detection of memsize of graphics card to check if double buffering is possible |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
117 * - fixed resolution switching a little and added more debug output |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
118 * - resolution switching is still according to d_width and d_height which |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
119 * is not always a good idea ... |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
120 * |
261 | 121 * |
122 * 30/02/2001 | |
13 | 123 * |
261 | 124 * o query_format(): with DGA 2.0 it returns all depths it supports |
125 * (even 16 when running 32 and vice versa) | |
126 * Checks for (hopefully!) compatible RGBmasks in 15/16 bit modes | |
127 * o added some more criterions for resolution switching | |
128 * o cleanup | |
129 * o with DGA2.0 present, ONLY DGA2.0 functions are used | |
130 * o for 15/16 modes ONLY RGB 555 is supported, since the divx-codec | |
131 * happens to map the data this way. If your graphics card supports | |
132 * this, you're well off and may use these modes; for mpeg | |
133 * movies things could be different, but I was too lazy to implement | |
134 * it ... | |
262 | 135 * o you may define VO_DGA_FORCE_DEPTH to the depth you desire |
136 * if you don't like the choice the driver makes | |
137 * Beware: unless you can use DGA2.0 this has to be your X Servers | |
138 * depth!!! | |
139 * o Added double buffering :-)) | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
140 * o included VidMode switching support for DGA1.0, written by Michael Graffam |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
141 * mgraffam@idsi.net |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
142 * |
13 | 143 */ |
144 | |
392 | 145 //#define VO_DGA_DBG 1 |
146 //#undef HAVE_DGA2 | |
147 //#undef HAVE_XF86VM | |
13 | 148 |
149 #include <stdio.h> | |
150 #include <stdlib.h> | |
1336
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
151 #include <stdarg.h> |
13 | 152 #include <string.h> |
153 | |
154 #include "config.h" | |
155 #include "video_out.h" | |
156 #include "video_out_internal.h" | |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
157 #include "../postproc/swscale.h" |
2732 | 158 #include "../postproc/rgb2rgb.h" |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
159 #include "aspect.h" |
13 | 160 |
161 LIBVO_EXTERN( dga ) | |
162 | |
163 #include <X11/Xlib.h> | |
164 #include <X11/extensions/xf86dga.h> | |
165 | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
166 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
167 #include <X11/extensions/xf86vmode.h> |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
168 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
169 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
170 |
31 | 171 #include "x11_common.h" |
2556 | 172 #include "../postproc/rgb2rgb.h" |
690
2094b195a9bc
- now we use fastmemcpy() for copying. Saves about 25% of copying time on K6-2+
acki2
parents:
680
diff
changeset
|
173 #include "fastmemcpy.h" |
691 | 174 |
13 | 175 static vo_info_t vo_info = |
176 { | |
533 | 177 #ifdef HAVE_DGA2 |
178 "DGA ( Direct Graphic Access V2.0 )", | |
179 #else | |
180 "DGA ( Direct Graphic Access V1.0+XF86VidModeExtension )", | |
181 #endif | |
13 | 182 "dga", |
183 "Andreas Ackermann <acki@acki-netz.de>", | |
184 "" | |
185 }; | |
186 | |
392 | 187 |
188 //------------------------------------------------------------------ | |
189 | |
190 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
191 //#define BITSPP (vo_dga_modes[vo_dga_active_mode].vdm_bitspp) |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
192 //#define BYTESPP (vo_dga_modes[vo_dga_active_mode].vdm_bytespp) |
392 | 193 |
1154
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
194 #define VO_DGA_INVALID_RES 100000 |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
195 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
196 #define HW_MODE (vo_dga_modes[vo_dga_hw_mode]) |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
197 #define SRC_MODE (vo_dga_modes[vo_dga_src_mode]) |
490 | 198 |
392 | 199 struct vd_modes { |
200 int vdm_mplayer_depth; | |
201 int vdm_supported; | |
202 int vdm_depth; | |
203 int vdm_bitspp; | |
204 int vdm_bytespp; | |
205 int vdm_rmask; | |
206 int vdm_gmask; | |
207 int vdm_bmask; | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
208 int vdm_hw_mode; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
209 int vdm_conversion_func; |
392 | 210 }; |
211 | |
212 //------------------------------------------------------------------ | |
213 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
214 #define VDM_CONV_NATIVE 0 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
215 #define VDM_CONV_15TO16 1 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
216 #define VDM_CONV_24TO32 2 |
392 | 217 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
218 static struct vd_modes vo_dga_modes[] = { |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
219 // these entries describe HW modes |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
220 // however, we use the same entries to tell mplayer what we support |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
221 // so the last two values describe, which HW mode to use and which conversion |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
222 // function to use for a mode that is not supported by HW |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
223 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
224 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
225 { 15, 0, 15, 16, 2, 0x7c00, 0x03e0, 0x001f, 2, VDM_CONV_15TO16 }, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
226 { 16, 0, 16, 16, 2, 0xf800, 0x07e0, 0x001f, 2, VDM_CONV_NATIVE }, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
227 { 24, 0, 24, 24, 3, 0xff0000, 0x00ff00, 0x0000ff, 4, VDM_CONV_24TO32}, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
228 { 32, 0, 24, 32, 4, 0x00ff0000, 0x0000ff00, 0x000000ff, 4, VDM_CONV_NATIVE} |
392 | 229 }; |
230 | |
231 static int vo_dga_mode_num = sizeof(vo_dga_modes)/sizeof(struct vd_modes); | |
232 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
233 // enable a HW mode (by description) |
392 | 234 int vd_EnableMode( int depth, int bitspp, |
235 int rmask, int gmask, int bmask){ | |
236 int i; | |
237 for(i=1; i<vo_dga_mode_num; i++){ | |
238 if(vo_dga_modes[i].vdm_depth == depth && | |
239 vo_dga_modes[i].vdm_bitspp == bitspp && | |
240 vo_dga_modes[i].vdm_rmask == rmask && | |
241 vo_dga_modes[i].vdm_gmask == gmask && | |
242 vo_dga_modes[i].vdm_bmask == bmask){ | |
243 vo_dga_modes[i].vdm_supported = 1; | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
244 vo_dga_modes[i].vdm_hw_mode = i; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
245 vo_dga_modes[i].vdm_conversion_func = VDM_CONV_NATIVE; |
392 | 246 return i; |
247 } | |
248 } | |
249 return 0; | |
250 } | |
251 | |
252 int vd_ModeEqual(int depth, int bitspp, | |
253 int rmask, int gmask, int bmask, int index){ | |
254 return ( | |
255 (vo_dga_modes[index].vdm_depth == depth && | |
256 vo_dga_modes[index].vdm_bitspp == bitspp && | |
257 vo_dga_modes[index].vdm_rmask == rmask && | |
258 vo_dga_modes[index].vdm_gmask == gmask && | |
259 vo_dga_modes[index].vdm_bmask == bmask) | |
260 ? 1 : 0); | |
261 } | |
262 | |
263 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
264 // enable a HW mode (mplayer_depth decides which) |
395
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
265 int vd_ValidateMode( int mplayer_depth){ |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
266 int i; |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
267 if(mplayer_depth == 0)return 0; |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
268 for(i=1; i<vo_dga_mode_num; i++){ |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
269 if(vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth ){ |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
270 vo_dga_modes[i].vdm_supported = 1; |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
271 vo_dga_modes[i].vdm_hw_mode = i; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
272 vo_dga_modes[i].vdm_conversion_func = VDM_CONV_NATIVE; |
395
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
273 return i; |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
274 } |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
275 } |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
276 return 0; |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
277 } |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
278 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
279 // do we support this mode? (not important whether native or conversion) |
392 | 280 int vd_ModeValid( int mplayer_depth){ |
281 int i; | |
282 if(mplayer_depth == 0)return 0; | |
283 for(i=1; i<vo_dga_mode_num; i++){ | |
284 if(vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth && | |
285 vo_dga_modes[i].vdm_supported != 0){ | |
286 return i; | |
287 } | |
288 } | |
289 return 0; | |
290 } | |
291 | |
292 char *vd_GetModeString(int index){ | |
293 | |
294 #define VO_DGA_MAX_STRING_LEN 100 | |
295 static char stringbuf[VO_DGA_MAX_STRING_LEN]; | |
296 stringbuf[VO_DGA_MAX_STRING_LEN-1]=0; | |
297 snprintf(stringbuf, VO_DGA_MAX_STRING_LEN-2, | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
298 "depth=%d, bpp=%d, r=%06x, g=%06x, b=%06x, %s (-bpp %d)", |
392 | 299 vo_dga_modes[index].vdm_depth, |
300 vo_dga_modes[index].vdm_bitspp, | |
301 vo_dga_modes[index].vdm_rmask, | |
302 vo_dga_modes[index].vdm_gmask, | |
303 vo_dga_modes[index].vdm_bmask, | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
304 vo_dga_modes[index].vdm_supported ? |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
305 (vo_dga_modes[index].vdm_conversion_func == VDM_CONV_NATIVE ? |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
306 "native (fast), " : "conversion (slow),") : |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
307 "not supported :-( ", |
392 | 308 vo_dga_modes[index].vdm_mplayer_depth); |
309 return stringbuf; | |
310 } | |
311 | |
312 //----------------------------------------------------------------- | |
313 | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
314 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
315 static XF86VidModeModeInfo **vo_dga_vidmodes=NULL; |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
316 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
317 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
318 |
392 | 319 extern int verbose; |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
320 |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
321 static int vo_dga_src_format; |
31 | 322 static int vo_dga_width; // bytes per line in framebuffer |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
323 static int vo_dga_vp_width; // visible pixels per line in |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
324 // framebuffer |
31 | 325 static int vo_dga_vp_height; // visible lines in framebuffer |
326 static int vo_dga_is_running = 0; | |
327 static int vo_dga_src_width; // width of video in pixels | |
328 static int vo_dga_src_height; // height of video in pixels | |
329 static int vo_dga_src_offset=0; // offset in src | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
330 static int vo_dga_vp_offset=0; // offset in dest |
262 | 331 static int vo_dga_bytes_per_line; // bytes per line to copy |
392 | 332 static int vo_dga_src_skip; // bytes to skip after copying one |
333 // line | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
334 // (not supported yet) in src |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
335 static int vo_dga_vp_skip; // dto. for dest |
392 | 336 static int vo_dga_lines; // num of lines to copy |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
337 static int vo_dga_hw_mode = 0; // index in mode list that is actually |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
338 // used by framebuffer |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
339 static int vo_dga_src_mode = 0; // index in mode list that is used by |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
340 // codec |
392 | 341 static int vo_dga_XServer_mode = 0;// index in mode list for resolution |
342 // XServer is running | |
13 | 343 |
262 | 344 static int vo_dga_dbf_mem_offset; // offset in bytes for alternative |
345 // framebuffer (0 if dbf is not | |
346 // possible) | |
347 static int vo_dga_dbf_y_offset; // y offset (in scanlines) | |
348 static int | |
349 vo_dga_dbf_current; // current buffer (0 or 1) | |
350 | |
31 | 351 static unsigned char *vo_dga_base; |
352 static Display *vo_dga_dpy; | |
13 | 353 |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
354 /* saved src and dst dimensions for SwScaler */ |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
355 static unsigned int scale_srcW = 0, |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
356 scale_dstW = 0, |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
357 scale_srcH = 0, |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
358 scale_dstH = 0; |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
359 |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
360 |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
361 //--------------------------------------------------------- |
13 | 362 |
392 | 363 #define VD_INFO 0 |
364 #define VD_ERR 0 | |
365 #define VD_DBG 2 | |
366 #define VD_RES 1 | |
367 | |
368 void vd_printf( int level, const char *str, ...){ | |
1336
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
369 va_list ap; |
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
370 |
490 | 371 #ifndef VO_DGA_DBG |
392 | 372 // show resolution and DBG-messages only in verbose mode ... |
373 if( !verbose && level)return; | |
374 #endif | |
1336
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
375 |
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
376 va_start(ap, str); |
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
377 vprintf(str, ap); |
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
378 va_end(ap); |
490 | 379 } |
392 | 380 |
490 | 381 //--------------------------------------------------------- |
382 | |
383 static void draw_alpha( int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride ){ | |
384 | |
385 char *d; | |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
386 unsigned int offset; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
387 unsigned int buffer_stride; |
490 | 388 |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
389 offset = vo_dga_width * y0 +x0; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
390 buffer_stride = vo_dga_width; |
490 | 391 d = (&((char *)vo_dga_base)[vo_dga_vp_offset + vo_dga_dbf_current * vo_dga_dbf_mem_offset]); |
392 | |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
393 switch( HW_MODE.vdm_mplayer_depth ){ |
490 | 394 |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
395 case 32: |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
396 vo_draw_alpha_rgb32(w,h,src,srca,stride, d+4*offset , 4*buffer_stride); |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
397 break; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
398 case 24: |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
399 vo_draw_alpha_rgb24(w,h,src,srca,stride, d+3*offset , 3*buffer_stride); |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
400 break; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
401 case 15: |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
402 vo_draw_alpha_rgb15(w,h,src,srca,stride, d+2*offset , 2*buffer_stride); |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
403 break; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
404 case 16: |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
405 vo_draw_alpha_rgb16(w,h,src,srca,stride, d+2*offset , 2*buffer_stride); |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
406 break; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
407 } |
392 | 408 } |
409 | |
490 | 410 |
392 | 411 //--------------------------------------------------------- |
412 | |
413 | |
414 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
415 // I had tried to work with mmx/3dnow copy code but |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
416 // there was not much speed gain and I didn't know |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
417 // how to save the FPU/mmx registers - so the copy |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
418 // code interferred with sound output ... |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
419 // removed the leftovers |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
420 // acki2 on 30/3/2001 |
13 | 421 |
422 | |
423 #define rep_movsl(dest, src, numwords, d_add, count) \ | |
424 __asm__ __volatile__( \ | |
425 " \ | |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
426 1: \n\t\ |
13 | 427 movl %%edx, %%ecx \n\t \ |
428 cld\n\t \ | |
429 rep\n\t \ | |
430 movsl \n\t\ | |
431 add %%eax, %%edi \n\t\ | |
432 dec %%ebx \n\t\ | |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
433 jnz 1b \n\t\ |
13 | 434 " \ |
435 : \ | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
436 : "a" (d_add), "b" (count), "S" (src), "D" (dest), \ |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
437 "d" (numwords) \ |
13 | 438 : "memory" ) |
439 | |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
440 // quick & dirty - for debugging only |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
441 |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
442 void fillblock(char *strt, int yoff, int lines, int val){ |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
443 char *i; |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
444 for(i = strt + yoff * vo_dga_width *HW_MODE.vdm_bytespp; |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
445 i< strt + (lines+yoff) * vo_dga_width *HW_MODE.vdm_bytespp; ){ |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
446 *i++ = val; |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
447 } |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
448 } |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
449 |
13 | 450 |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
451 //--------------------------------------------------------- |
13 | 452 |
453 static uint32_t draw_frame( uint8_t *src[] ){ | |
454 | |
455 int vp_skip = vo_dga_vp_skip; | |
456 int lpl = vo_dga_bytes_per_line >> 2; | |
457 int numlines = vo_dga_lines; | |
458 | |
459 char *s, *d; | |
460 | |
262 | 461 s = *src; |
462 d = (&((char *)vo_dga_base)[vo_dga_vp_offset + vo_dga_dbf_current * vo_dga_dbf_mem_offset]); | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
463 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
464 switch(SRC_MODE.vdm_conversion_func){ |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
465 case VDM_CONV_NATIVE: |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
466 |
1336
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
467 #if defined(HAVE_MMX) || !defined(ARCH_X86) |
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
468 // use the code from fastmemcpy.h on x86, |
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
469 // or ordinary memcpy on non-x86 cpus. |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
470 if(vo_dga_vp_skip){ |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
471 // use some stride ... |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
472 int i; |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
473 for(i=0; i< vo_dga_lines; i++){ |
690
2094b195a9bc
- now we use fastmemcpy() for copying. Saves about 25% of copying time on K6-2+
acki2
parents:
680
diff
changeset
|
474 memcpy(d, s, vo_dga_bytes_per_line); |
2094b195a9bc
- now we use fastmemcpy() for copying. Saves about 25% of copying time on K6-2+
acki2
parents:
680
diff
changeset
|
475 d+=vo_dga_vp_skip; |
2094b195a9bc
- now we use fastmemcpy() for copying. Saves about 25% of copying time on K6-2+
acki2
parents:
680
diff
changeset
|
476 d+=vo_dga_bytes_per_line; |
2094b195a9bc
- now we use fastmemcpy() for copying. Saves about 25% of copying time on K6-2+
acki2
parents:
680
diff
changeset
|
477 s+=vo_dga_bytes_per_line; |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
478 } |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
479 }else{ |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
480 // no stride, cool + fast ... |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
481 memcpy(d,s, vo_dga_bytes_per_line * vo_dga_lines); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
482 } |
1336
345165f41f1b
vo_dga doesn't compile on non-x86 architecture due to x86 asm usage.
jkeil
parents:
1268
diff
changeset
|
483 #else /* ARCH_X86 and NO_MMX */ |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
484 // use some homebrewn assembly code ... |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
485 rep_movsl(d, s, lpl, vo_dga_vp_skip, numlines ); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
486 #endif |
690
2094b195a9bc
- now we use fastmemcpy() for copying. Saves about 25% of copying time on K6-2+
acki2
parents:
680
diff
changeset
|
487 |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
488 // DBG-COde |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
489 |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
490 #if 0 |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
491 d = (&((char *)vo_dga_base)[vo_dga_vp_offset + vo_dga_dbf_current * vo_dga_dbf_mem_offset]); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
492 fillblock(d, 0, 10, 0x800000ff); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
493 fillblock(d, 10, 10, 0x8000ff00); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
494 fillblock(d, 20, 10, 0x80ff0000); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
495 fillblock(d, 30, 10, 0xff0000ff); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
496 fillblock(d, 40, 10, 0x800000ff); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
497 fillblock(d, 50, 10, 0x0f0000ff); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
498 #endif |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
499 break; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
500 case VDM_CONV_15TO16: |
691 | 501 { |
502 int i; | |
503 char *e; | |
504 for(i=0; i< vo_dga_lines; i++){ | |
2556 | 505 rgb15to16( s, d, vo_dga_bytes_per_line); |
691 | 506 d+=vo_dga_bytes_per_line; |
507 s+=vo_dga_bytes_per_line; | |
508 d+= vo_dga_vp_skip; | |
509 } | |
510 } | |
511 break; | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
512 case VDM_CONV_24TO32: |
691 | 513 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
514 { |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
515 int i,k,l,m; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
516 for(i = 0; i< vo_dga_lines; i++ ){ |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
517 for(k = 0; k< vo_dga_src_width; k+=2 ){ |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
518 l = *(((uint32_t *)s)++); |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
519 m = (l & 0xff000000)>> 24 ; |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
520 *(((uint32_t *)d)++) = (l & 0x00ffffff); // | 0x80000000; |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
521 m |= *(((uint16_t *)s)++) << 8; |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
522 *(((uint32_t *)d)++) = m; // | 0x80000000 ; |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
523 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
524 d+= vp_skip; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
525 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
526 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
527 //printf("vo_dga: 24 to 32 not implemented yet!!!\n"); |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
528 break; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
529 } |
13 | 530 return 0; |
531 } | |
532 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
533 //--------------------------------------------------------- |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
534 |
31 | 535 static void check_events(void) |
536 { | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
537 int e=vo_x11_check_events(vo_dga_dpy); |
31 | 538 } |
539 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
540 //--------------------------------------------------------- |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
541 |
616 | 542 #include "sub.h" |
612 | 543 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1336
diff
changeset
|
544 static void draw_osd(void) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1336
diff
changeset
|
545 { vo_draw_text(vo_dga_src_width,vo_dga_src_height,draw_alpha); } |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1336
diff
changeset
|
546 |
13 | 547 static void flip_page( void ){ |
262 | 548 |
549 if(vo_dga_dbf_mem_offset != 0){ | |
550 | |
551 #ifdef HAVE_DGA2 | |
552 XDGASetViewport (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), | |
553 0, vo_dga_dbf_current * vo_dga_dbf_y_offset, | |
554 XDGAFlipRetrace); | |
555 #else | |
556 XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), | |
392 | 557 0, vo_dga_dbf_current * vo_dga_dbf_y_offset); |
262 | 558 #endif |
559 vo_dga_dbf_current = 1 - vo_dga_dbf_current; | |
560 } | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
561 } |
13 | 562 |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
563 //--------------------------------------------------------- |
13 | 564 |
565 static uint32_t draw_slice( uint8_t *src[],int stride[], | |
566 int w,int h,int x,int y ) | |
567 { | |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
568 if (scale_srcW) { |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
569 uint8_t *dst[3] = {vo_dga_base + vo_dga_dbf_current * vo_dga_dbf_mem_offset + vo_dga_vp_offset, NULL, NULL}; |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
570 SwScale_YV12slice(src,stride,y,h, |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
571 dst, |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
572 /*scale_dstW*/ vo_dga_width * HW_MODE.vdm_bytespp, HW_MODE.vdm_bitspp, |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
573 scale_srcW, scale_srcH, scale_dstW, scale_dstH); |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
574 } else { |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
575 yuv2rgb( vo_dga_base + vo_dga_dbf_current * vo_dga_dbf_mem_offset + vo_dga_vp_offset + |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
576 (vo_dga_width * y +x) * HW_MODE.vdm_bytespp, |
677
ee2dac2cc633
- now mpeg is fast again (no more offscreen buffer rubbish) But is it really ok?
acki2
parents:
616
diff
changeset
|
577 src[0], src[1], src[2], |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
578 w,h, vo_dga_width * HW_MODE.vdm_bytespp, |
677
ee2dac2cc633
- now mpeg is fast again (no more offscreen buffer rubbish) But is it really ok?
acki2
parents:
616
diff
changeset
|
579 stride[0],stride[1] ); |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
580 } |
13 | 581 return 0; |
582 }; | |
583 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
584 //--------------------------------------------------------- |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
585 |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
586 |
13 | 587 static void Terminate_Display_Process( void ){ |
392 | 588 vd_printf(VD_DBG, "vo_dga: Terminating display process\n"); |
13 | 589 } |
590 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
591 //--------------------------------------------------------- |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
592 |
13 | 593 static const vo_info_t* get_info( void ) |
594 { return &vo_info; } | |
595 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
596 //--------------------------------------------------------- |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
597 |
13 | 598 static uint32_t query_format( uint32_t format ) |
599 { | |
261 | 600 |
601 #ifdef HAVE_DGA2 | |
602 XDGAMode *modelines; | |
603 int modecount; | |
392 | 604 #endif |
261 | 605 Display *qdisp; |
392 | 606 |
607 int i; | |
261 | 608 static int dga_depths_init = 0; |
609 | |
610 if(dga_depths_init == 0){ | |
13 | 611 |
261 | 612 if((qdisp = XOpenDisplay(0))==NULL){ |
392 | 613 vd_printf(VD_ERR, "vo_dga: Can't open display!\n"); |
261 | 614 return 0; |
615 } | |
395
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
616 if( !vo_init() ){ |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
617 vd_printf(VD_ERR, "vo_dga: vo_init() failed!\n"); |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
618 return 1; |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
619 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
620 vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen); |
395
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
621 |
392 | 622 if(vo_dga_XServer_mode ==0){ |
623 #ifndef HAVE_DGA2 | |
624 vd_printf(VD_ERR, "vo_dga: Your X-Server is not running in a "); | |
625 vd_printf(VD_ERR, "resolution supported by DGA driver!\n"); | |
626 #endif | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
627 }//else{ |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
628 // vd_printf(VD_INFO, "vo_dga: X running at: %s\n", |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
629 // vd_GetModeString(vo_dga_XServer_mode)); |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
630 //} |
392 | 631 |
632 #ifdef HAVE_DGA2 | |
261 | 633 modelines=XDGAQueryModes(qdisp, XDefaultScreen(qdisp),&modecount); |
392 | 634 if(modelines){ |
635 for(i=0; i< modecount; i++){ | |
636 vd_printf(VD_DBG, "vo_dga: (%03d) depth=%d, bpp=%d, r=%08x, g=%08x, b=%08x, %d x %d\n", | |
637 i, | |
638 modelines[i].depth, | |
639 modelines[i].bitsPerPixel, | |
640 modelines[i].redMask, | |
641 modelines[i].greenMask, | |
642 modelines[i].blueMask, | |
395
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
643 modelines[i].viewportWidth, |
392 | 644 modelines[i].viewportHeight); |
645 vd_EnableMode( | |
646 modelines[i].depth, | |
647 modelines[i].bitsPerPixel, | |
648 modelines[i].redMask, | |
649 modelines[i].greenMask, | |
650 modelines[i].blueMask); | |
651 } | |
652 XFree(modelines); | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
653 |
261 | 654 } |
655 #endif | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
656 dga_depths_init = 1; |
392 | 657 XCloseDisplay(qdisp); |
658 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
659 if( !vo_dga_modes[1].vdm_supported && vo_dga_modes[2].vdm_supported ){ |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
660 vo_dga_modes[1].vdm_supported = 1; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
661 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
662 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
663 if( !vo_dga_modes[3].vdm_supported && vo_dga_modes[4].vdm_supported ){ |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
664 vo_dga_modes[3].vdm_supported = 1; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
665 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
666 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
667 for(i=1; i<vo_dga_mode_num; i++){ |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
668 vd_printf(VD_INFO, "vo_dga: Mode: %s", vd_GetModeString(i)); |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
669 if(vo_dbpp && vo_dbpp != vo_dga_modes[i].vdm_mplayer_depth){ |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
670 vo_dga_modes[i].vdm_supported = 0; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
671 vd_printf(VD_INFO, " ...disabled by -bpp %d", vo_dbpp ); |
261 | 672 } |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
673 vd_printf(VD_INFO, "\n"); |
261 | 674 } |
675 } | |
392 | 676 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
677 // TODO: respect bit for native/not native |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
678 if( format==IMGFMT_YV12 ) return 7; |
261 | 679 |
392 | 680 if( (format&IMGFMT_BGR_MASK) == IMGFMT_BGR && |
490 | 681 vd_ModeValid(format&0xff)) return 7; |
392 | 682 |
13 | 683 return 0; |
684 } | |
685 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
686 //--------------------------------------------------------- |
13 | 687 |
688 static void | |
689 uninit(void) | |
690 { | |
691 | |
261 | 692 #ifdef HAVE_DGA2 |
693 XDGADevice *dgadevice; | |
694 #endif | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
695 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
696 if(vo_dga_is_running){ |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
697 vo_dga_is_running = 0; |
392 | 698 vd_printf( VD_DBG, "vo_dga: in uninit\n"); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
699 XUngrabPointer (vo_dga_dpy, CurrentTime); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
700 XUngrabKeyboard (vo_dga_dpy, CurrentTime); |
261 | 701 #ifdef HAVE_DGA2 |
395
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
702 XDGACloseFramebuffer(vo_dga_dpy, XDefaultScreen(vo_dga_dpy)); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
703 dgadevice = XDGASetMode(vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 0); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
704 if(dgadevice != NULL){ |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
705 XFree(dgadevice); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
706 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
707 #else |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
708 XF86DGADirectVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 0); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
709 // first disable DirectVideo and then switch mode back! |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
710 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
711 if (vo_dga_vidmodes != NULL ){ |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
712 int screen; screen=XDefaultScreen( vo_dga_dpy ); |
392 | 713 vd_printf(VD_DBG, "vo_dga: VidModeExt: Switching back..\n"); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
714 // seems some graphics adaptors need this more than once ... |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
715 XF86VidModeSwitchToMode(vo_dga_dpy,screen,vo_dga_vidmodes[0]); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
716 XF86VidModeSwitchToMode(vo_dga_dpy,screen,vo_dga_vidmodes[0]); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
717 XF86VidModeSwitchToMode(vo_dga_dpy,screen,vo_dga_vidmodes[0]); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
718 XF86VidModeSwitchToMode(vo_dga_dpy,screen,vo_dga_vidmodes[0]); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
719 XFree(vo_dga_vidmodes); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
720 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
721 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
722 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
723 XCloseDisplay(vo_dga_dpy); |
261 | 724 } |
13 | 725 } |
726 | |
727 | |
261 | 728 //---------------------------------------------------------- |
392 | 729 // TODO: check for larger maxy value |
730 // (useful for double buffering!!!) | |
261 | 731 |
392 | 732 int check_res( int num, int x, int y, int bpp, |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
733 int new_x, int new_y, int new_vbi, int new_maxy, |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
734 int *old_x, int *old_y, int *old_vbi, int *old_maxy){ |
261 | 735 |
392 | 736 vd_printf(VD_RES, "vo_dga: (%3d) Trying %4d x %4d @ %3d Hz @ depth %2d ..", |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
737 num, new_x, new_y, new_vbi, bpp ); |
392 | 738 vd_printf(VD_RES, "(old: %dx%d@%d).", *old_x, *old_y, *old_vbi); |
261 | 739 if ( |
740 (new_x >= x) && | |
741 (new_y >= y) && | |
742 ( | |
743 // prefer a better resolution either in X or in Y | |
744 // as long as the other dimension is at least the same | |
745 // | |
746 // hmm ... MAYBE it would be more clever to focus on the | |
747 // x-resolution; I had 712x400 and 640x480 and the movie | |
748 // was 640x360; 640x480 would be the 'right thing' here | |
749 // but since 712x400 was queried first I got this one. | |
750 // I think there should be a cmd-line switch to let the | |
751 // user choose the mode he likes ... (acki2) | |
752 | |
753 ( | |
754 ((new_x < *old_x) && | |
755 !(new_y > *old_y)) || | |
756 ((new_y < *old_y) && | |
757 !(new_x > *old_x)) | |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
758 ) |
261 | 759 // but if we get an identical resolution choose |
760 // the one with the lower refreshrate (saves bandwidth !!!) | |
761 // as long as it's above 50 Hz (acki2 on 30/3/2001) | |
762 || | |
763 ( | |
764 (new_x == *old_x) && | |
765 (new_y == *old_y) && | |
766 ( | |
767 ( | |
768 new_vbi >= *old_vbi && *old_vbi < 50 | |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
769 ) |
261 | 770 || |
771 ( | |
772 *old_vbi >= 50 && | |
773 new_vbi < *old_vbi && | |
774 new_vbi >= 50 | |
775 ) | |
776 ) | |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
777 || |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
778 // if everything is equal, then use the mode with the lower |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
779 // stride |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
780 ( |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
781 (new_x == *old_x) && |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
782 (new_y == *old_y) && |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
783 (new_vbi == *old_vbi) && |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
784 (new_maxy > *old_maxy) |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
785 ) |
261 | 786 ) |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
787 ) |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
788 ) |
261 | 789 { |
790 *old_x = new_x; | |
791 *old_y = new_y; | |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
792 *old_maxy = new_maxy; |
261 | 793 *old_vbi = new_vbi; |
392 | 794 vd_printf(VD_RES, ".ok!!\n"); |
261 | 795 return 1; |
796 }else{ | |
392 | 797 vd_printf(VD_RES, ".no\n"); |
261 | 798 return 0; |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
799 } |
261 | 800 } |
801 | |
802 | |
803 | |
804 //--------------------------------------------------------- | |
805 | |
806 static uint32_t init( uint32_t width, uint32_t height, | |
807 uint32_t d_width,uint32_t d_height, | |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
808 uint32_t flags,char *title,uint32_t format ) |
261 | 809 { |
810 | |
811 int x_off, y_off; | |
392 | 812 int wanted_width, wanted_height; |
261 | 813 |
814 #ifdef HAVE_DGA2 | |
815 // needed to change DGA video mode | |
1154
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
816 int modecount, mX=VO_DGA_INVALID_RES, mY=VO_DGA_INVALID_RES , mVBI=100000, mMaxY=0, i,j=0; |
261 | 817 int dga_modenum; |
818 XDGAMode *modelines=NULL; | |
819 XDGADevice *dgadevice; | |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
820 int max_vpy_pos; |
261 | 821 #else |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
822 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
823 unsigned int vm_event, vm_error; |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
824 unsigned int vm_ver, vm_rev; |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
825 int i, j=0, have_vm=0; |
1154
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
826 int modecount, mX=VO_DGA_INVALID_RES, mY=VO_DGA_INVALID_RES, mVBI=100000, mMaxY=0, dga_modenum; |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
827 #endif |
261 | 828 int bank, ram; |
829 #endif | |
830 | |
831 if( vo_dga_is_running )return -1; | |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
832 vo_dga_src_format = format; |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
833 |
392 | 834 wanted_width = d_width; |
835 wanted_height = d_height; | |
261 | 836 |
392 | 837 if(!wanted_height) wanted_height = height; |
838 if(!wanted_width) wanted_width = width; | |
839 | |
261 | 840 if( !vo_init() ){ |
392 | 841 vd_printf(VD_ERR, "vo_dga: vo_init() failed!\n"); |
842 return 1; | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
843 } |
392 | 844 |
845 if( !vo_dbpp ){ | |
261 | 846 |
392 | 847 if (format == IMGFMT_YV12){ |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
848 vo_dga_src_mode = vo_dga_XServer_mode; |
392 | 849 }else if((format & IMGFMT_BGR_MASK) == IMGFMT_BGR){ |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
850 vo_dga_src_mode = vd_ModeValid( format & 0xff ); |
392 | 851 } |
261 | 852 }else{ |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
853 vo_dga_src_mode = vd_ModeValid(vo_dbpp); |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
854 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
855 vo_dga_hw_mode = SRC_MODE.vdm_hw_mode; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
856 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
857 if( format == IMGFMT_YV12 && vo_dga_src_mode != vo_dga_hw_mode ){ |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
858 vd_printf(VD_ERR, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
859 "vo_dga: YV12 supports native modes only. Using %d instead of selected %d.\n", |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
860 HW_MODE.vdm_mplayer_depth, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
861 SRC_MODE.vdm_mplayer_depth ); |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
862 vo_dga_src_mode = vo_dga_hw_mode; |
392 | 863 } |
261 | 864 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
865 if(!vo_dga_src_mode){ |
392 | 866 vd_printf(VD_ERR, "vo_dga: unsupported video format!\n"); |
867 return 1; | |
261 | 868 } |
869 | |
392 | 870 if((vo_dga_dpy = XOpenDisplay(0))==NULL){ |
871 vd_printf (VD_ERR, "vo_dga: Can't open display\n"); | |
261 | 872 return 1; |
873 } | |
874 | |
392 | 875 vo_dga_vp_width = DisplayWidth( vo_dga_dpy, DefaultScreen(vo_dga_dpy)); |
876 vo_dga_vp_height = DisplayHeight( vo_dga_dpy, DefaultScreen(vo_dga_dpy)); | |
261 | 877 |
392 | 878 vd_printf(VD_DBG, "vo_dga: XServer res: %dx%d\n", |
879 vo_dga_vp_width, vo_dga_vp_height); | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
880 |
261 | 881 // choose a suitable mode ... |
882 | |
883 #ifdef HAVE_DGA2 | |
884 // Code to change the video mode added by Michael Graffam | |
885 // mgraffam@idsi.net | |
886 if (modelines==NULL) | |
887 modelines=XDGAQueryModes(vo_dga_dpy, XDefaultScreen(vo_dga_dpy),&modecount); | |
3318 | 888 |
889 vd_printf(VD_DBG, | |
890 "vo_dga: modelines=%p, modecount=%d\n", modelines, modecount); | |
891 | |
892 if (modelines == NULL) | |
893 { | |
894 vd_printf(VD_ERR, "vo_dga: can't get modelines\n"); | |
895 return 1; | |
896 } | |
261 | 897 |
392 | 898 vd_printf(VD_INFO, |
899 "vo_dga: DGA 2.0 available :-) Can switch resolution AND depth!\n"); | |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
900 for (i=0; i<modecount; i++) |
261 | 901 { |
392 | 902 if(vd_ModeEqual( modelines[i].depth, |
903 modelines[i].bitsPerPixel, | |
904 modelines[i].redMask, | |
905 modelines[i].greenMask, | |
906 modelines[i].blueMask, | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
907 vo_dga_hw_mode)){ |
272
8ffe2f459851
- still more debug output to be able to fix 15/16 bpp problem
acki2
parents:
266
diff
changeset
|
908 |
392 | 909 vd_printf(VD_DBG, "maxy: %4d, depth: %2d, %4dx%4d, ", |
910 modelines[i].maxViewportY, modelines[i].depth, | |
272
8ffe2f459851
- still more debug output to be able to fix 15/16 bpp problem
acki2
parents:
266
diff
changeset
|
911 modelines[i].imageWidth, modelines[i].imageHeight ); |
392 | 912 if ( check_res(i, wanted_width, wanted_height, modelines[i].depth, |
261 | 913 modelines[i].viewportWidth, |
914 modelines[i].viewportHeight, | |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
915 (unsigned) modelines[i].verticalRefresh, |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
916 modelines[i].maxViewportY, |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
917 &mX, &mY, &mVBI, &mMaxY )) j = i; |
261 | 918 } |
919 } | |
392 | 920 vd_printf(VD_INFO, |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
921 "vo_dga: Selected hardware mode %4d x %4d @ %3d Hz @ depth %2d, bitspp %2d.\n", |
392 | 922 mX, mY, mVBI, |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
923 HW_MODE.vdm_depth, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
924 HW_MODE.vdm_bitspp); |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
925 vd_printf(VD_INFO, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
926 "vo_dga: Video parameters by codec: %3d x %3d, depth %2d, bitspp %2d.\n", |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
927 width, height, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
928 SRC_MODE.vdm_depth, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
929 SRC_MODE.vdm_bitspp); |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
930 vo_dga_vp_width = mX; |
261 | 931 vo_dga_vp_height = mY; |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
932 |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
933 if((flags&0x04)||(flags&0x01)) { /* -zoom or -fs */ |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
934 scale_dstW = (d_width + 7) & ~7; |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
935 scale_dstH = d_height; |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
936 scale_srcW = width; |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
937 scale_srcH = height; |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
938 aspect_save_screenres(mX,mY); |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
939 aspect_save_orig(scale_srcW,scale_srcH); |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
940 aspect_save_prescale(scale_dstW,scale_dstH); |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
941 SwScale_Init(); |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
942 if(flags&0x01) /* -fs */ |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
943 aspect(&scale_dstW,&scale_dstH,A_ZOOM); |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
944 else if(flags&0x04) /* -fs */ |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
945 aspect(&scale_dstW,&scale_dstH,A_NOZOOM); |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
946 vd_printf(VD_INFO, |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
947 "vo_dga: Aspect corrected size for SwScaler: %4d x %4d.\n", |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
948 scale_dstW, scale_dstH); |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
949 /* XXX this is a hack, but I'm lazy ;-) :: atmos */ |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
950 width = scale_dstW; |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
951 height = scale_dstH; |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
952 } |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
953 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
954 vo_dga_width = modelines[j].bytesPerScanline / HW_MODE.vdm_bytespp ; |
261 | 955 dga_modenum = modelines[j].num; |
392 | 956 max_vpy_pos = modelines[j].maxViewportY; |
261 | 957 |
958 XFree(modelines); | |
959 modelines = NULL; | |
960 | |
961 #else | |
962 | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
963 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
964 |
392 | 965 vd_printf( VD_INFO, |
966 "vo_dga: DGA 1.0 compatibility code: Using XF86VidMode for mode switching!\n"); | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
967 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
968 if (XF86VidModeQueryExtension(vo_dga_dpy, &vm_event, &vm_error)) { |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
969 XF86VidModeQueryVersion(vo_dga_dpy, &vm_ver, &vm_rev); |
392 | 970 vd_printf(VD_INFO, "vo_dga: XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
971 have_vm=1; |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
972 } else { |
392 | 973 vd_printf(VD_ERR, "vo_dga: XF86VidMode Extension not available.\n"); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
974 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
975 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
976 #define GET_VREFRESH(dotclk, x, y)( (((dotclk)/(x))*1000)/(y) ) |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
977 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
978 if (have_vm) { |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
979 int screen; |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
980 screen=XDefaultScreen(vo_dga_dpy); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
981 XF86VidModeGetAllModeLines(vo_dga_dpy,screen,&modecount,&vo_dga_vidmodes); |
261 | 982 |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
983 if(vo_dga_vidmodes != NULL ){ |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
984 for (i=0; i<modecount; i++){ |
392 | 985 if ( check_res(i, wanted_width, wanted_height, |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
986 vo_dga_modes[vo_dga_hw_mode].vdm_depth, |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
987 vo_dga_vidmodes[i]->hdisplay, |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
988 vo_dga_vidmodes[i]->vdisplay, |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
989 GET_VREFRESH(vo_dga_vidmodes[i]->dotclock, |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
990 vo_dga_vidmodes[i]->htotal, |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
991 vo_dga_vidmodes[i]->vtotal), |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
992 0, |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
993 &mX, &mY, &mVBI, &mMaxY )) j = i; |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
994 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
995 |
392 | 996 vd_printf(VD_INFO, |
997 "vo_dga: Selected video mode %4d x %4d @ %3d Hz @ depth %2d, bitspp %2d, video %3d x %3d.\n", | |
998 mX, mY, mVBI, | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
999 vo_dga_modes[vo_dga_hw_mode].vdm_depth, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1000 vo_dga_modes[vo_dga_hw_mode].vdm_bitspp, |
392 | 1001 width, height); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1002 }else{ |
392 | 1003 vd_printf(VD_INFO, "vo_dga: XF86VidMode returned no screens - using current resolution.\n"); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1004 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1005 dga_modenum = j; |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1006 vo_dga_vp_width = mX; |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1007 vo_dga_vp_height = mY; |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1008 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1009 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1010 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1011 #else |
392 | 1012 vd_printf( VD_INFO, "vo_dga: Only have DGA 1.0 extension and no XF86VidMode :-(\n"); |
1013 vd_printf( VD_INFO, " Thus, resolution switching is NOT possible.\n"); | |
1014 | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1015 #endif |
261 | 1016 #endif |
1017 | |
1018 vo_dga_src_width = width; | |
1019 vo_dga_src_height = height; | |
1020 | |
1021 if(vo_dga_src_width > vo_dga_vp_width || | |
1022 vo_dga_src_height > vo_dga_vp_height) | |
1023 { | |
392 | 1024 vd_printf( VD_ERR, "vo_dga: Sorry, video larger than viewport is not yet supported!\n"); |
261 | 1025 // ugly, do something nicer in the future ... |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1026 #ifndef HAVE_DGA2 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1027 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1028 if(vo_dga_vidmodes){ |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1029 XFree(vo_dga_vidmodes); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1030 vo_dga_vidmodes = NULL; |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1031 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1032 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1033 #endif |
261 | 1034 return 1; |
1035 } | |
1154
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1036 |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1037 if(vo_dga_vp_width == VO_DGA_INVALID_RES){ |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1038 vd_printf( VD_ERR, "vo_dga: Something is wrong with your DGA. There doesn't seem to be a\n" |
1158 | 1039 " single suitable mode!\n" |
1040 " Please file a bug report (see DOCS/DGA)\n"); | |
1154
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1041 #ifndef HAVE_DGA2 |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1042 #ifdef HAVE_XF86VM |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1043 if(vo_dga_vidmodes){ |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1044 XFree(vo_dga_vidmodes); |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1045 vo_dga_vidmodes = NULL; |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1046 } |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1047 #endif |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1048 #endif |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1049 return 1; |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1050 } |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
1051 |
261 | 1052 // now lets start the DGA thing |
1053 | |
1054 #ifdef HAVE_DGA2 | |
1055 | |
1056 if (!XDGAOpenFramebuffer(vo_dga_dpy, XDefaultScreen(vo_dga_dpy))){ | |
392 | 1057 vd_printf(VD_ERR, "vo_dga: Framebuffer mapping failed!!!\n"); |
261 | 1058 XCloseDisplay(vo_dga_dpy); |
1059 return 1; | |
1060 } | |
1061 dgadevice=XDGASetMode(vo_dga_dpy, XDefaultScreen(vo_dga_dpy), dga_modenum); | |
221
3daeae4a4aa6
Added support to vo_dga to change the video mode to the lowest resolution
mgraffam
parents:
31
diff
changeset
|
1062 XDGASync(vo_dga_dpy, XDefaultScreen(vo_dga_dpy)); |
3daeae4a4aa6
Added support to vo_dga to change the video mode to the lowest resolution
mgraffam
parents:
31
diff
changeset
|
1063 |
261 | 1064 vo_dga_base = dgadevice->data; |
221
3daeae4a4aa6
Added support to vo_dga to change the video mode to the lowest resolution
mgraffam
parents:
31
diff
changeset
|
1065 XFree(dgadevice); |
261 | 1066 |
1067 XDGASetViewport (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 0, 0, XDGAFlipRetrace); | |
1068 | |
233
f62ccacbe1e5
Changes to configure to autodetect DGA 2.0 functionality, and to only use
mgraffam
parents:
221
diff
changeset
|
1069 #else |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1070 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1071 #ifdef HAVE_XF86VM |
3852
cd642e995366
use XF86VidMode later in init (at line 1031) only if we've got support (if have_vm==1)
alex
parents:
3318
diff
changeset
|
1072 if (have_vm) |
cd642e995366
use XF86VidMode later in init (at line 1031) only if we've got support (if have_vm==1)
alex
parents:
3318
diff
changeset
|
1073 { |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1074 XF86VidModeLockModeSwitch(vo_dga_dpy,XDefaultScreen(vo_dga_dpy),0); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1075 // Two calls are needed to switch modes on my ATI Rage 128. Why? |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1076 // for riva128 one call is enough! |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1077 XF86VidModeSwitchToMode(vo_dga_dpy,XDefaultScreen(vo_dga_dpy),vo_dga_vidmodes[dga_modenum]); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1078 XF86VidModeSwitchToMode(vo_dga_dpy,XDefaultScreen(vo_dga_dpy),vo_dga_vidmodes[dga_modenum]); |
3852
cd642e995366
use XF86VidMode later in init (at line 1031) only if we've got support (if have_vm==1)
alex
parents:
3318
diff
changeset
|
1079 } |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1080 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1081 |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
1082 XF86DGAGetViewPortSize(vo_dga_dpy,XDefaultScreen(vo_dga_dpy), |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
1083 &vo_dga_vp_width, |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
1084 &vo_dga_vp_height); |
13 | 1085 |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
1086 XF86DGAGetVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
1087 (char **)&vo_dga_base, &vo_dga_width, &bank, &ram); |
233
f62ccacbe1e5
Changes to configure to autodetect DGA 2.0 functionality, and to only use
mgraffam
parents:
221
diff
changeset
|
1088 |
261 | 1089 XF86DGADirectVideo (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), |
1090 XF86DGADirectGraphics | XF86DGADirectMouse | | |
1091 XF86DGADirectKeyb); | |
1092 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
1093 XF86DGASetViewPort (vo_dga_dpy, XDefaultScreen(vo_dga_dpy), 0, 0); |
261 | 1094 |
233
f62ccacbe1e5
Changes to configure to autodetect DGA 2.0 functionality, and to only use
mgraffam
parents:
221
diff
changeset
|
1095 #endif |
f62ccacbe1e5
Changes to configure to autodetect DGA 2.0 functionality, and to only use
mgraffam
parents:
221
diff
changeset
|
1096 |
13 | 1097 // do some more checkings here ... |
261 | 1098 |
392 | 1099 if( format==IMGFMT_YV12 ){ |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1100 yuv2rgb_init( vo_dga_modes[vo_dga_hw_mode].vdm_mplayer_depth , MODE_RGB ); |
392 | 1101 vd_printf( VD_DBG, "vo_dga: Using mplayer depth %d for YV12\n", |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1102 vo_dga_modes[vo_dga_hw_mode].vdm_mplayer_depth); |
392 | 1103 } |
13 | 1104 |
392 | 1105 vd_printf(VD_DBG, "vo_dga: bytes/line: %d, screen res: %dx%d, depth: %d, base: %08x, bpp: %d\n", |
13 | 1106 vo_dga_width, vo_dga_vp_width, |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1107 vo_dga_vp_height, HW_MODE.vdm_bytespp, vo_dga_base, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1108 HW_MODE.vdm_bitspp); |
13 | 1109 |
1110 x_off = (vo_dga_vp_width - vo_dga_src_width)>>1; | |
1111 y_off = (vo_dga_vp_height - vo_dga_src_height)>>1; | |
1112 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1113 vo_dga_bytes_per_line = vo_dga_src_width * HW_MODE.vdm_bytespp; |
261 | 1114 vo_dga_lines = vo_dga_src_height; |
13 | 1115 |
1116 vo_dga_src_offset = 0; | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1117 vo_dga_vp_offset = (y_off * vo_dga_width + x_off ) * HW_MODE.vdm_bytespp; |
13 | 1118 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1119 vo_dga_vp_skip = (vo_dga_width - vo_dga_src_width) * HW_MODE.vdm_bytespp; // todo |
13 | 1120 |
392 | 1121 vd_printf(VD_DBG, "vo_dga: vp_off=%d, vp_skip=%d, bpl=%d\n", |
13 | 1122 vo_dga_vp_offset, vo_dga_vp_skip, vo_dga_bytes_per_line); |
1123 | |
1124 | |
1125 XGrabKeyboard (vo_dga_dpy, DefaultRootWindow(vo_dga_dpy), True, | |
1126 GrabModeAsync,GrabModeAsync, CurrentTime); | |
1127 XGrabPointer (vo_dga_dpy, DefaultRootWindow(vo_dga_dpy), True, | |
1128 ButtonPressMask,GrabModeAsync, GrabModeAsync, | |
1129 None, None, CurrentTime); | |
262 | 1130 // TODO: chekc if mem of graphics adaptor is large enough for dbf |
1131 | |
1132 // set up variables for double buffering ... | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1133 // note: set vo_dga_dbf_mem_offset to NULL to disable doublebuffering |
262 | 1134 |
1135 vo_dga_dbf_y_offset = y_off + vo_dga_src_height; | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1136 vo_dga_dbf_mem_offset = vo_dga_width * HW_MODE.vdm_bytespp * vo_dga_dbf_y_offset; |
262 | 1137 vo_dga_dbf_current = 0; |
1150
8682a16321db
- doublebuffering now can be switched on and off with the -(no)double switch.
acki2
parents:
865
diff
changeset
|
1138 |
8682a16321db
- doublebuffering now can be switched on and off with the -(no)double switch.
acki2
parents:
865
diff
changeset
|
1139 |
1193 | 1140 if(!vo_doublebuffering) vo_dga_dbf_mem_offset = 0; |
262 | 1141 |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
1142 // if(format ==IMGFMT_YV12 ) |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
1143 //vo_dga_dbf_mem_offset = 0; |
262 | 1144 // disable doublebuffering for YV12 |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1145 |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1146 #ifdef HAVE_DGA2 |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1147 if(vo_dga_vp_height>max_vpy_pos){ |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1148 vo_dga_dbf_mem_offset = 0; |
392 | 1149 vd_printf(VD_INFO, "vo_dga: Not enough memory for double buffering!\n"); |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1150 } |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1151 #endif |
262 | 1152 |
13 | 1153 // now clear screen |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1154 { |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1155 int size = vo_dga_width * |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1156 (vo_dga_vp_height + (vo_dga_dbf_mem_offset != 0 ? |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1157 (vo_dga_src_height+y_off) : 0)) * |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1158 HW_MODE.vdm_bytespp; |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1159 #ifndef HAVE_DGA2 |
392 | 1160 vd_printf(VD_DBG, "vo_dga: wanted size=%d, fb-size=%d\n", size, ram); |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1161 if(size>ram*1024){ |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1162 vo_dga_dbf_mem_offset = 0; |
392 | 1163 vd_printf(VD_INFO, "vo_dga: Not enough memory for double buffering!\n"); |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
1164 size -= (vo_dga_src_height+y_off) * vo_dga_width * HW_MODE.vdm_bytespp; |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1165 } |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1166 #endif |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1167 |
392 | 1168 vd_printf(VD_INFO, "vo_dga: Clearing framebuffer (%d bytes). If mplayer exits", size); |
1169 vd_printf(VD_INFO, " here, you haven't enough memory on your card.\n"); | |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1170 fflush(stdout); |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
1171 memset(vo_dga_base, 0, size); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
1172 } |
392 | 1173 vd_printf(VD_INFO, "vo_dga: Doublebuffering is %s.\n", vo_dga_dbf_mem_offset ? "enabled" : "disabled"); |
13 | 1174 vo_dga_is_running = 1; |
1175 return 0; | |
1176 } | |
1177 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
1178 //--------------------------------------------------------- |
13 | 1179 |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
1180 // deleted the old vo_dga_query_event() routine 'cause it is obsolete |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
1181 // since using check_events() |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
1182 // acki2 on 30/3/2001 |
392 | 1183 |
1184 | |
1185 | |
1186 | |
1187 | |
1188 | |
1189 | |
1190 | |
1191 | |
1192 |