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