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