Mercurial > mplayer.hg
annotate libvo/vo_dga.c @ 10181:d480b7ffd2ef
Info updated, patch by Andoni Zubimendi <andoni@lpsat.net>.
author | diego |
---|---|
date | Sun, 25 May 2003 15:44:14 +0000 |
parents | a7ae63354098 |
children | d358fa9a1068 |
rev | line source |
---|---|
13 | 1 /* |
2 * | |
10021
a7ae63354098
Spring cleanup: removed the full yv12 support as it was broken anyway. The BGR/RGB native/non-native case needs some cleanup, too. Currently it works for me (tm)
alex
parents:
9274
diff
changeset
|
3 * X11 DGA Interface |
13 | 4 * |
5 * Copyright ( C ) 2001, Andreas Ackermann. All Rights Reserved. | |
6 * | |
7 * <acki@acki-netz.de> | |
8 * | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
9 * Sourceforge username: acki2 |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
10 * |
13 | 11 */ |
12 | |
392 | 13 //#define VO_DGA_DBG 1 |
14 //#undef HAVE_DGA2 | |
15 //#undef HAVE_XF86VM | |
13 | 16 |
17 #include <stdio.h> | |
18 #include <stdlib.h> | |
19 #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
|
20 #include <errno.h> |
13 | 21 |
22 #include "config.h" | |
23 #include "video_out.h" | |
24 #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
|
25 #include "../postproc/swscale.h" |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
26 #include "aspect.h" |
10021
a7ae63354098
Spring cleanup: removed the full yv12 support as it was broken anyway. The BGR/RGB native/non-native case needs some cleanup, too. Currently it works for me (tm)
alex
parents:
9274
diff
changeset
|
27 #include "x11_common.h" |
a7ae63354098
Spring cleanup: removed the full yv12 support as it was broken anyway. The BGR/RGB native/non-native case needs some cleanup, too. Currently it works for me (tm)
alex
parents:
9274
diff
changeset
|
28 #include "fastmemcpy.h" |
a7ae63354098
Spring cleanup: removed the full yv12 support as it was broken anyway. The BGR/RGB native/non-native case needs some cleanup, too. Currently it works for me (tm)
alex
parents:
9274
diff
changeset
|
29 #include "../mp_msg.h" |
13 | 30 |
31 #include <X11/Xlib.h> | |
32 #include <X11/extensions/xf86dga.h> | |
33 | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
34 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
35 #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
|
36 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
37 |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8123
diff
changeset
|
38 static vo_info_t info = |
13 | 39 { |
533 | 40 #ifdef HAVE_DGA2 |
41 "DGA ( Direct Graphic Access V2.0 )", | |
42 #else | |
7499 | 43 #ifdef HAVE_XF86VM |
44 "DGA ( Direct Graphic Access V1.0+XF86VidModeExt. )", | |
45 #else | |
46 "DGA ( Direct Graphic Access V1.0 )", | |
47 #endif | |
533 | 48 #endif |
13 | 49 "dga", |
50 "Andreas Ackermann <acki@acki-netz.de>", | |
51 "" | |
52 }; | |
53 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8123
diff
changeset
|
54 LIBVO_EXTERN( dga ) |
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8123
diff
changeset
|
55 |
392 | 56 |
57 //------------------------------------------------------------------ | |
58 | |
59 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
60 //#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
|
61 //#define BYTESPP (vo_dga_modes[vo_dga_active_mode].vdm_bytespp) |
392 | 62 |
1154
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
63 #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
|
64 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
65 #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
|
66 #define SRC_MODE (vo_dga_modes[vo_dga_src_mode]) |
490 | 67 |
392 | 68 struct vd_modes { |
69 int vdm_mplayer_depth; | |
70 int vdm_supported; | |
71 int vdm_depth; | |
72 int vdm_bitspp; | |
73 int vdm_bytespp; | |
74 int vdm_rmask; | |
75 int vdm_gmask; | |
76 int vdm_bmask; | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
77 int vdm_hw_mode; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
78 int vdm_conversion_func; |
392 | 79 }; |
80 | |
81 //------------------------------------------------------------------ | |
82 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
83 #define VDM_CONV_NATIVE 0 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
84 #define VDM_CONV_15TO16 1 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
85 #define VDM_CONV_24TO32 2 |
392 | 86 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
87 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
|
88 // these entries describe HW modes |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
89 // 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
|
90 // 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
|
91 // 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
|
92 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
93 { 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
|
94 { 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
|
95 { 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
|
96 { 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
|
97 { 32, 0, 24, 32, 4, 0x00ff0000, 0x0000ff00, 0x000000ff, 4, VDM_CONV_NATIVE} |
392 | 98 }; |
99 | |
100 static int vo_dga_mode_num = sizeof(vo_dga_modes)/sizeof(struct vd_modes); | |
101 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
102 // enable a HW mode (by description) |
7499 | 103 static int vd_EnableMode( int depth, int bitspp, |
392 | 104 int rmask, int gmask, int bmask){ |
105 int i; | |
106 for(i=1; i<vo_dga_mode_num; i++){ | |
107 if(vo_dga_modes[i].vdm_depth == depth && | |
108 vo_dga_modes[i].vdm_bitspp == bitspp && | |
109 vo_dga_modes[i].vdm_rmask == rmask && | |
110 vo_dga_modes[i].vdm_gmask == gmask && | |
111 vo_dga_modes[i].vdm_bmask == bmask){ | |
112 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
|
113 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
|
114 vo_dga_modes[i].vdm_conversion_func = VDM_CONV_NATIVE; |
392 | 115 return i; |
116 } | |
117 } | |
118 return 0; | |
119 } | |
120 | |
7499 | 121 static int vd_ModeEqual(int depth, int bitspp, |
392 | 122 int rmask, int gmask, int bmask, int index){ |
123 return ( | |
124 (vo_dga_modes[index].vdm_depth == depth && | |
125 vo_dga_modes[index].vdm_bitspp == bitspp && | |
126 vo_dga_modes[index].vdm_rmask == rmask && | |
127 vo_dga_modes[index].vdm_gmask == gmask && | |
128 vo_dga_modes[index].vdm_bmask == bmask) | |
129 ? 1 : 0); | |
130 } | |
131 | |
132 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
133 // enable a HW mode (mplayer_depth decides which) |
7499 | 134 static int vd_ValidateMode( int mplayer_depth){ |
395
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
135 int i; |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
136 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 return i; |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
143 } |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
144 } |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
145 return 0; |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
146 } |
01768a027e7d
- fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents:
392
diff
changeset
|
147 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
148 // do we support this mode? (not important whether native or conversion) |
7499 | 149 static int vd_ModeValid( int mplayer_depth){ |
392 | 150 int i; |
151 if(mplayer_depth == 0)return 0; | |
152 for(i=1; i<vo_dga_mode_num; i++){ | |
153 if(vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth && | |
154 vo_dga_modes[i].vdm_supported != 0){ | |
155 return i; | |
156 } | |
157 } | |
158 return 0; | |
159 } | |
160 | |
7499 | 161 static int vd_ModeSupportedMethod( int mplayer_depth){ |
6206
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
162 int i; |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
163 if(mplayer_depth == 0)return 0; |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
164 for(i=1; i<vo_dga_mode_num; i++){ |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
165 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
|
166 vo_dga_modes[i].vdm_supported != 0){ |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
167 return vo_dga_modes[i].vdm_conversion_func; |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
168 } |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
169 } |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
170 return 0; |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
171 } |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
172 |
7499 | 173 static char *vd_GetModeString(int index){ |
392 | 174 |
175 #define VO_DGA_MAX_STRING_LEN 100 | |
176 static char stringbuf[VO_DGA_MAX_STRING_LEN]; | |
177 stringbuf[VO_DGA_MAX_STRING_LEN-1]=0; | |
178 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
|
179 "depth=%d, bpp=%d, r=%06x, g=%06x, b=%06x, %s (-bpp %d)", |
392 | 180 vo_dga_modes[index].vdm_depth, |
181 vo_dga_modes[index].vdm_bitspp, | |
182 vo_dga_modes[index].vdm_rmask, | |
183 vo_dga_modes[index].vdm_gmask, | |
184 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
|
185 vo_dga_modes[index].vdm_supported ? |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
186 (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
|
187 "native (fast), " : "conversion (slow),") : |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
188 "not supported :-( ", |
392 | 189 vo_dga_modes[index].vdm_mplayer_depth); |
190 return stringbuf; | |
191 } | |
192 | |
193 //----------------------------------------------------------------- | |
194 | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
195 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
196 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
|
197 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
198 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
199 |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
200 static int vo_dga_src_format; |
31 | 201 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
|
202 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
|
203 // framebuffer |
31 | 204 static int vo_dga_vp_height; // visible lines in framebuffer |
205 static int vo_dga_is_running = 0; | |
206 static int vo_dga_src_width; // width of video in pixels | |
207 static int vo_dga_src_height; // height of video in pixels | |
208 static int vo_dga_src_offset=0; // offset in src | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
209 static int vo_dga_vp_offset=0; // offset in dest |
262 | 210 static int vo_dga_bytes_per_line; // bytes per line to copy |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
211 static int vo_dga_vp_skip; // dto. for dest |
392 | 212 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
|
213 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
|
214 // used by framebuffer |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
215 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
|
216 // codec |
392 | 217 static int vo_dga_XServer_mode = 0;// index in mode list for resolution |
8067 | 218 |
219 #ifdef HAVE_DGA2 | |
220 static XDGAMode * vo_modelines; | |
221 static int vo_modecount; | |
222 #endif | |
13 | 223 |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
224 #define MAX_NR_VIDEO_BUFFERS 3 |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
225 |
7575
3a6d7933a6ad
flickering fix, patch by Fredrik Noring <noring@nocrew.org>
arpi
parents:
7539
diff
changeset
|
226 #define CURRENT_VIDEO_BUFFER \ |
3a6d7933a6ad
flickering fix, patch by Fredrik Noring <noring@nocrew.org>
arpi
parents:
7539
diff
changeset
|
227 (vo_dga_video_buffer[vo_dga_current_video_buffer]) |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
228 |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
229 static int vo_dga_nr_video_buffers; // Total number of frame buffers. |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
230 static int vo_dga_current_video_buffer; // Buffer available for rendering. |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
231 |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
232 static struct video_buffer |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
233 { |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
234 int y; |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
235 uint8_t *data; |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
236 } vo_dga_video_buffer[MAX_NR_VIDEO_BUFFERS]; |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
237 |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
238 /* 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
|
239 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
|
240 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
|
241 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
|
242 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
|
243 |
490 | 244 //--------------------------------------------------------- |
245 | |
246 static void draw_alpha( int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride ){ | |
247 | |
248 char *d; | |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
249 unsigned int offset; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
250 unsigned int buffer_stride; |
490 | 251 |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
252 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
|
253 buffer_stride = vo_dga_width; |
7575
3a6d7933a6ad
flickering fix, patch by Fredrik Noring <noring@nocrew.org>
arpi
parents:
7539
diff
changeset
|
254 d = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset; |
490 | 255 |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
256 switch( HW_MODE.vdm_mplayer_depth ){ |
490 | 257 |
493
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
258 case 32: |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
259 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
|
260 break; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
261 case 24: |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
262 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
|
263 break; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
264 case 15: |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
265 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
|
266 break; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
267 case 16: |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
268 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
|
269 break; |
b8f1ed2b411b
- now also supports OSD for YV12 (big speed penalty by having to build image
acki2
parents:
490
diff
changeset
|
270 } |
392 | 271 } |
272 | |
490 | 273 |
392 | 274 //--------------------------------------------------------- |
275 | |
276 | |
277 | |
13 | 278 |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
279 // quick & dirty - for debugging only |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
280 |
7499 | 281 static void fillblock(char *strt, int yoff, int lines, int val){ |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
282 char *i; |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
283 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
|
284 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
|
285 *i++ = val; |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
286 } |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
287 } |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
288 |
13 | 289 |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
290 //--------------------------------------------------------- |
13 | 291 |
292 static uint32_t draw_frame( uint8_t *src[] ){ | |
293 | |
294 int vp_skip = vo_dga_vp_skip; | |
295 int numlines = vo_dga_lines; | |
296 | |
297 char *s, *d; | |
298 | |
262 | 299 s = *src; |
7575
3a6d7933a6ad
flickering fix, patch by Fredrik Noring <noring@nocrew.org>
arpi
parents:
7539
diff
changeset
|
300 d = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset; |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
301 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
302 switch(SRC_MODE.vdm_conversion_func){ |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
303 case VDM_CONV_NATIVE: |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
304 |
4713 | 305 mem2agpcpy_pic( |
306 d, s, | |
307 vo_dga_bytes_per_line, | |
308 numlines, | |
309 vo_dga_bytes_per_line+vo_dga_vp_skip, | |
310 vo_dga_bytes_per_line); | |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
311 |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
312 // DBG-COde |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
313 |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
314 #if 0 |
7575
3a6d7933a6ad
flickering fix, patch by Fredrik Noring <noring@nocrew.org>
arpi
parents:
7539
diff
changeset
|
315 d = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset; |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
316 fillblock(d, 0, 10, 0x800000ff); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
317 fillblock(d, 10, 10, 0x8000ff00); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
318 fillblock(d, 20, 10, 0x80ff0000); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
319 fillblock(d, 30, 10, 0xff0000ff); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
320 fillblock(d, 40, 10, 0x800000ff); |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
321 fillblock(d, 50, 10, 0x0f0000ff); |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
322 #endif |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
323 break; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
324 case VDM_CONV_15TO16: |
691 | 325 { |
326 int i; | |
327 for(i=0; i< vo_dga_lines; i++){ | |
2556 | 328 rgb15to16( s, d, vo_dga_bytes_per_line); |
691 | 329 d+=vo_dga_bytes_per_line; |
330 s+=vo_dga_bytes_per_line; | |
331 d+= vo_dga_vp_skip; | |
332 } | |
333 } | |
334 break; | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
335 case VDM_CONV_24TO32: |
691 | 336 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
337 { |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
338 int i,k,l,m; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
339 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
|
340 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
|
341 l = *(((uint32_t *)s)++); |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
342 m = (l & 0xff000000)>> 24 ; |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
343 *(((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
|
344 m |= *(((uint16_t *)s)++) << 8; |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
345 *(((uint32_t *)d)++) = m; // | 0x80000000 ; |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
346 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
347 d+= vp_skip; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
348 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
349 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
350 //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
|
351 break; |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
352 } |
13 | 353 return 0; |
354 } | |
355 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
356 //--------------------------------------------------------- |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
357 |
31 | 358 static void check_events(void) |
359 { | |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
8084
diff
changeset
|
360 vo_x11_check_events(mDisplay); |
31 | 361 } |
362 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
363 //--------------------------------------------------------- |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
364 |
616 | 365 #include "sub.h" |
612 | 366 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1336
diff
changeset
|
367 static void draw_osd(void) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1336
diff
changeset
|
368 { 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
|
369 |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
370 static void switch_video_buffers(void) |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
371 { |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
372 vo_dga_current_video_buffer = |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
373 (vo_dga_current_video_buffer + 1) % vo_dga_nr_video_buffers; |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
374 } |
262 | 375 |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
376 static void flip_page( void ) |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
377 { |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
378 if(1 < vo_dga_nr_video_buffers) |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
379 { |
262 | 380 #ifdef HAVE_DGA2 |
8067 | 381 XDGASetViewport(mDisplay, mScreen, |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
382 0, |
7575
3a6d7933a6ad
flickering fix, patch by Fredrik Noring <noring@nocrew.org>
arpi
parents:
7539
diff
changeset
|
383 CURRENT_VIDEO_BUFFER.y, |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
384 XDGAFlipRetrace); |
262 | 385 #else |
8067 | 386 XF86DGASetViewPort(mDisplay, mScreen, |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
387 0, |
7652
dc789525a89b
DGA1 trivial fix by Fredrik Noring <noring@nocrew.org>
arpi
parents:
7575
diff
changeset
|
388 CURRENT_VIDEO_BUFFER.y); |
262 | 389 #endif |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
390 switch_video_buffers(); |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
391 } |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
392 } |
13 | 393 |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
394 //--------------------------------------------------------- |
13 | 395 |
396 static uint32_t draw_slice( uint8_t *src[],int stride[], | |
397 int w,int h,int x,int y ) | |
398 { | |
399 return 0; | |
400 }; | |
401 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
402 //--------------------------------------------------------- |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
403 |
13 | 404 static uint32_t query_format( uint32_t format ) |
405 { | |
261 | 406 |
392 | 407 if( (format&IMGFMT_BGR_MASK) == IMGFMT_BGR && |
6206
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
408 vd_ModeValid(format&0xff)) |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
409 { |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
410 if (vd_ModeSupportedMethod(format&0xff) == VDM_CONV_NATIVE) |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
411 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
|
412 else |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
413 return VFCAP_CSP_SUPPORTED|VFCAP_OSD; |
4bffe1ffa86c
revised query_format. added support for native/conversion detection
alex
parents:
4737
diff
changeset
|
414 } |
392 | 415 |
13 | 416 return 0; |
417 } | |
418 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
419 //--------------------------------------------------------- |
13 | 420 |
421 static void | |
422 uninit(void) | |
423 { | |
424 | |
261 | 425 #ifdef HAVE_DGA2 |
426 XDGADevice *dgadevice; | |
427 #endif | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
428 |
8067 | 429 if ( !vo_config_count ) return; |
430 | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
431 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
|
432 vo_dga_is_running = 0; |
7499 | 433 mp_msg(MSGT_VO, MSGL_V, "vo_dga: in uninit\n"); |
7539
56ea9db91251
-nograbpointer, based on old patch by Christian Ohm <chr.ohm@gmx.net>
arpi
parents:
7533
diff
changeset
|
434 if(vo_grabpointer) |
8067 | 435 XUngrabPointer (mDisplay, CurrentTime); |
436 XUngrabKeyboard (mDisplay, CurrentTime); | |
261 | 437 #ifdef HAVE_DGA2 |
8067 | 438 XDGACloseFramebuffer(mDisplay, mScreen); |
439 dgadevice = XDGASetMode(mDisplay, mScreen, 0); | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
440 if(dgadevice != NULL){ |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
441 XFree(dgadevice); |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
442 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
443 #else |
8067 | 444 XF86DGADirectVideo (mDisplay, mScreen, 0); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
445 // 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
|
446 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
447 if (vo_dga_vidmodes != NULL ){ |
8067 | 448 int screen; screen=XDefaultScreen( mDisplay ); |
7499 | 449 mp_msg(MSGT_VO, MSGL_V, "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
|
450 // seems some graphics adaptors need this more than once ... |
8067 | 451 XF86VidModeSwitchToMode(mDisplay,screen,vo_dga_vidmodes[0]); |
452 XF86VidModeSwitchToMode(mDisplay,screen,vo_dga_vidmodes[0]); | |
453 XF86VidModeSwitchToMode(mDisplay,screen,vo_dga_vidmodes[0]); | |
454 XF86VidModeSwitchToMode(mDisplay,screen,vo_dga_vidmodes[0]); | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
455 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
|
456 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
457 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
458 #endif |
261 | 459 } |
8067 | 460 vo_x11_uninit(); |
13 | 461 } |
462 | |
463 | |
261 | 464 //---------------------------------------------------------- |
392 | 465 // TODO: check for larger maxy value |
466 // (useful for double buffering!!!) | |
261 | 467 |
7499 | 468 static 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
|
469 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
|
470 int *old_x, int *old_y, int *old_vbi, int *old_maxy){ |
261 | 471 |
7499 | 472 mp_msg(MSGT_VO, MSGL_V, "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
|
473 num, new_x, new_y, new_vbi, bpp ); |
7499 | 474 mp_msg(MSGT_VO, MSGL_V, "(old: %dx%d@%d).", *old_x, *old_y, *old_vbi); |
261 | 475 if ( |
476 (new_x >= x) && | |
477 (new_y >= y) && | |
478 ( | |
479 // prefer a better resolution either in X or in Y | |
480 // as long as the other dimension is at least the same | |
481 // | |
482 // hmm ... MAYBE it would be more clever to focus on the | |
483 // x-resolution; I had 712x400 and 640x480 and the movie | |
484 // was 640x360; 640x480 would be the 'right thing' here | |
485 // but since 712x400 was queried first I got this one. | |
486 // I think there should be a cmd-line switch to let the | |
487 // user choose the mode he likes ... (acki2) | |
488 | |
489 ( | |
490 ((new_x < *old_x) && | |
491 !(new_y > *old_y)) || | |
492 ((new_y < *old_y) && | |
493 !(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
|
494 ) |
261 | 495 // but if we get an identical resolution choose |
496 // the one with the lower refreshrate (saves bandwidth !!!) | |
497 // as long as it's above 50 Hz (acki2 on 30/3/2001) | |
498 || | |
499 ( | |
500 (new_x == *old_x) && | |
501 (new_y == *old_y) && | |
502 ( | |
503 ( | |
504 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
|
505 ) |
261 | 506 || |
507 ( | |
508 *old_vbi >= 50 && | |
509 new_vbi < *old_vbi && | |
510 new_vbi >= 50 | |
511 ) | |
512 ) | |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
513 || |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
514 // 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
|
515 // stride |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
516 ( |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
517 (new_x == *old_x) && |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
518 (new_y == *old_y) && |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
519 (new_vbi == *old_vbi) && |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
520 (new_maxy > *old_maxy) |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
521 ) |
261 | 522 ) |
266
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
523 ) |
336b1559a447
- added detection of memsize of graphics card to check if double buffering is possible
acki2
parents:
263
diff
changeset
|
524 ) |
261 | 525 { |
526 *old_x = new_x; | |
527 *old_y = new_y; | |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
528 *old_maxy = new_maxy; |
261 | 529 *old_vbi = new_vbi; |
7499 | 530 mp_msg(MSGT_VO, MSGL_V, ".ok!!\n"); |
261 | 531 return 1; |
532 }else{ | |
7499 | 533 mp_msg(MSGT_VO, MSGL_V, ".no\n"); |
261 | 534 return 0; |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
535 } |
261 | 536 } |
537 | |
538 | |
539 | |
540 //--------------------------------------------------------- | |
541 | |
7515 | 542 static void init_video_buffers(uint8_t *buffer_base, |
543 int view_port_height, | |
544 int bytes_per_scanline, | |
545 int max_view_port_y, | |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
546 int use_multiple_buffers) |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
547 { |
7515 | 548 int bytes_per_buffer = view_port_height * bytes_per_scanline; |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
549 int i; |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
550 |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
551 if(use_multiple_buffers) |
7515 | 552 vo_dga_nr_video_buffers = max_view_port_y / view_port_height; |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
553 else |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
554 vo_dga_nr_video_buffers = 1; |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
555 |
9274 | 556 if (vo_dga_nr_video_buffers > MAX_NR_VIDEO_BUFFERS) |
557 vo_dga_nr_video_buffers = MAX_NR_VIDEO_BUFFERS; | |
558 if (vo_dga_nr_video_buffers <= 0) | |
559 vo_dga_nr_video_buffers = 1; | |
560 | |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
561 vo_dga_current_video_buffer = 0; |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
562 |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
563 for(i = 0; i < vo_dga_nr_video_buffers; i++) |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
564 { |
7515 | 565 vo_dga_video_buffer[i].y = i * view_port_height; |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
566 vo_dga_video_buffer[i].data = |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
567 buffer_base + i * bytes_per_buffer; |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
568 |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
569 // Clear video buffer. |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
570 memset(vo_dga_video_buffer[i].data, 0, bytes_per_buffer); |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
571 } |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
572 } |
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
573 |
4433 | 574 static uint32_t config( uint32_t width, uint32_t height, |
261 | 575 uint32_t d_width,uint32_t d_height, |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
6206
diff
changeset
|
576 uint32_t flags,char *title,uint32_t format) |
261 | 577 { |
578 | |
579 int x_off, y_off; | |
392 | 580 int wanted_width, wanted_height; |
261 | 581 |
8067 | 582 static unsigned char *vo_dga_base; |
583 static int prev_width, prev_height; | |
261 | 584 #ifdef HAVE_DGA2 |
585 // needed to change DGA video mode | |
8067 | 586 int mX=VO_DGA_INVALID_RES, mY=VO_DGA_INVALID_RES , mVBI=100000, mMaxY=0, i,j=0; |
261 | 587 int dga_modenum; |
8067 | 588 XDGAMode *modeline; |
261 | 589 XDGADevice *dgadevice; |
590 #else | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
591 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
592 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
|
593 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
|
594 int i, j=0, have_vm=0; |
8067 | 595 int 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
|
596 #endif |
261 | 597 int bank, ram; |
598 #endif | |
599 | |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
600 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
|
601 |
392 | 602 wanted_width = d_width; |
603 wanted_height = d_height; | |
261 | 604 |
392 | 605 if(!wanted_height) wanted_height = height; |
606 if(!wanted_width) wanted_width = width; | |
607 | |
608 if( !vo_dbpp ){ | |
10021
a7ae63354098
Spring cleanup: removed the full yv12 support as it was broken anyway. The BGR/RGB native/non-native case needs some cleanup, too. Currently it works for me (tm)
alex
parents:
9274
diff
changeset
|
609 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
|
610 vo_dga_src_mode = vd_ModeValid( format & 0xff ); |
392 | 611 } |
261 | 612 }else{ |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
613 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
|
614 } |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
615 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
|
616 |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
617 if(!vo_dga_src_mode){ |
7499 | 618 mp_msg(MSGT_VO, MSGL_ERR, "vo_dga: unsupported video format!\n"); |
392 | 619 return 1; |
261 | 620 } |
621 | |
8067 | 622 vo_dga_vp_width = vo_screenwidth; |
623 vo_dga_vp_height = vo_screenheight; | |
261 | 624 |
7499 | 625 mp_msg(MSGT_VO, MSGL_V, "vo_dga: XServer res: %dx%d\n", |
392 | 626 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
|
627 |
261 | 628 // choose a suitable mode ... |
629 | |
630 #ifdef HAVE_DGA2 | |
631 // Code to change the video mode added by Michael Graffam | |
632 // mgraffam@idsi.net | |
3318 | 633 |
8067 | 634 mp_msg(MSGT_VO, MSGL_V, "vo_dga: vo_modelines=%p, vo_modecount=%d\n", vo_modelines, vo_modecount); |
3318 | 635 |
8067 | 636 if (vo_modelines == NULL) |
3318 | 637 { |
7499 | 638 mp_msg(MSGT_VO, MSGL_ERR, "vo_dga: can't get modelines\n"); |
3318 | 639 return 1; |
640 } | |
261 | 641 |
7499 | 642 mp_msg(MSGT_VO, MSGL_INFO, |
392 | 643 "vo_dga: DGA 2.0 available :-) Can switch resolution AND depth!\n"); |
8067 | 644 for (i=0; i<vo_modecount; i++) |
261 | 645 { |
8067 | 646 if(vd_ModeEqual( vo_modelines[i].depth, |
647 vo_modelines[i].bitsPerPixel, | |
648 vo_modelines[i].redMask, | |
649 vo_modelines[i].greenMask, | |
650 vo_modelines[i].blueMask, | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
651 vo_dga_hw_mode)){ |
272
8ffe2f459851
- still more debug output to be able to fix 15/16 bpp problem
acki2
parents:
266
diff
changeset
|
652 |
7499 | 653 mp_msg(MSGT_VO, MSGL_V, "maxy: %4d, depth: %2d, %4dx%4d, ", |
8067 | 654 vo_modelines[i].maxViewportY, vo_modelines[i].depth, |
655 vo_modelines[i].imageWidth, vo_modelines[i].imageHeight ); | |
656 if ( check_res(i, wanted_width, wanted_height, vo_modelines[i].depth, | |
657 vo_modelines[i].viewportWidth, | |
658 vo_modelines[i].viewportHeight, | |
659 (unsigned) vo_modelines[i].verticalRefresh, | |
660 vo_modelines[i].maxViewportY, | |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
661 &mX, &mY, &mVBI, &mMaxY )) j = i; |
261 | 662 } |
663 } | |
7499 | 664 mp_msg(MSGT_VO, MSGL_INFO, |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
665 "vo_dga: Selected hardware mode %4d x %4d @ %3d Hz @ depth %2d, bitspp %2d.\n", |
392 | 666 mX, mY, mVBI, |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
667 HW_MODE.vdm_depth, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
668 HW_MODE.vdm_bitspp); |
7499 | 669 mp_msg(MSGT_VO, MSGL_INFO, |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
670 "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
|
671 width, height, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
672 SRC_MODE.vdm_depth, |
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
673 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
|
674 vo_dga_vp_width = mX; |
261 | 675 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
|
676 |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
677 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
|
678 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
|
679 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
|
680 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
|
681 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
|
682 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
|
683 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
|
684 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
|
685 SwScale_Init(); |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
686 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
|
687 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
|
688 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
|
689 aspect(&scale_dstW,&scale_dstH,A_NOZOOM); |
7499 | 690 mp_msg(MSGT_VO, MSGL_INFO, |
4060
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
691 "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
|
692 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
|
693 /* 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
|
694 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
|
695 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
|
696 } |
974e028471a4
SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents:
3852
diff
changeset
|
697 |
8067 | 698 vo_dga_width = vo_modelines[j].bytesPerScanline / HW_MODE.vdm_bytespp ; |
699 dga_modenum = vo_modelines[j].num; | |
700 modeline = vo_modelines + j; | |
261 | 701 |
702 #else | |
703 | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
704 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
705 |
7499 | 706 mp_msg(MSGT_VO, MSGL_INFO, |
392 | 707 "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
|
708 |
8067 | 709 if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) { |
710 XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev); | |
7499 | 711 mp_msg(MSGT_VO, MSGL_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
|
712 have_vm=1; |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
713 } else { |
7499 | 714 mp_msg(MSGT_VO, MSGL_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
|
715 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
716 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
717 #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
|
718 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
719 if (have_vm) { |
8067 | 720 int modecount; |
721 XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vo_dga_vidmodes); | |
261 | 722 |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
723 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
|
724 for (i=0; i<modecount; i++){ |
392 | 725 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
|
726 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
|
727 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
|
728 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
|
729 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
|
730 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
|
731 vo_dga_vidmodes[i]->vtotal), |
720
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
732 0, |
8146b106816a
- now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents:
691
diff
changeset
|
733 &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
|
734 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
735 |
7499 | 736 mp_msg(MSGT_VO, MSGL_INFO, |
392 | 737 "vo_dga: Selected video mode %4d x %4d @ %3d Hz @ depth %2d, bitspp %2d, video %3d x %3d.\n", |
738 mX, mY, mVBI, | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
739 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
|
740 vo_dga_modes[vo_dga_hw_mode].vdm_bitspp, |
392 | 741 width, height); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
742 }else{ |
7499 | 743 mp_msg(MSGT_VO, MSGL_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
|
744 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
745 dga_modenum = j; |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
746 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
|
747 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
|
748 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
749 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
750 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
751 #else |
7499 | 752 mp_msg(MSGT_VO, MSGL_INFO, "vo_dga: Only have DGA 1.0 extension and no XF86VidMode :-(\n"); |
753 mp_msg(MSGT_VO, MSGL_INFO, " Thus, resolution switching is NOT possible.\n"); | |
392 | 754 |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
755 #endif |
261 | 756 #endif |
757 | |
758 vo_dga_src_width = width; | |
759 vo_dga_src_height = height; | |
760 | |
761 if(vo_dga_src_width > vo_dga_vp_width || | |
762 vo_dga_src_height > vo_dga_vp_height) | |
763 { | |
7499 | 764 mp_msg(MSGT_VO, MSGL_ERR, "vo_dga: Sorry, video larger than viewport is not yet supported!\n"); |
261 | 765 // 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
|
766 #ifndef HAVE_DGA2 |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
767 #ifdef HAVE_XF86VM |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
768 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
|
769 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
|
770 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
|
771 } |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
772 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
773 #endif |
261 | 774 return 1; |
775 } | |
1154
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
776 |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
777 if(vo_dga_vp_width == VO_DGA_INVALID_RES){ |
7499 | 778 mp_msg(MSGT_VO, MSGL_ERR, "vo_dga: Something is wrong with your DGA. There doesn't seem to be a\n" |
1158 | 779 " single suitable mode!\n" |
7499 | 780 " Please file a bug report (see DOCS/bugreports.html)\n"); |
1154
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
781 #ifndef HAVE_DGA2 |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
782 #ifdef HAVE_XF86VM |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
783 if(vo_dga_vidmodes){ |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
784 XFree(vo_dga_vidmodes); |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
785 vo_dga_vidmodes = NULL; |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
786 } |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
787 #endif |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
788 #endif |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
789 return 1; |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
790 } |
4bf4e057c82e
- if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents:
1150
diff
changeset
|
791 |
261 | 792 // now lets start the DGA thing |
793 | |
8067 | 794 if ( !vo_config_count || width != prev_width || height != prev_height ) |
795 { | |
261 | 796 #ifdef HAVE_DGA2 |
8067 | 797 |
798 if (!XDGAOpenFramebuffer(mDisplay, mScreen)){ | |
799 mp_msg(MSGT_VO, MSGL_ERR, "vo_dga: Framebuffer mapping failed!!!\n"); | |
800 return 1; | |
261 | 801 } |
8067 | 802 |
803 dgadevice=XDGASetMode(mDisplay, mScreen, dga_modenum); | |
804 XDGASync(mDisplay, mScreen); | |
221
3daeae4a4aa6
Added support to vo_dga to change the video mode to the lowest resolution
mgraffam
parents:
31
diff
changeset
|
805 |
261 | 806 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
|
807 XFree(dgadevice); |
261 | 808 |
8067 | 809 XDGASetViewport (mDisplay, mScreen, 0, 0, XDGAFlipRetrace); |
810 | |
233
f62ccacbe1e5
Changes to configure to autodetect DGA 2.0 functionality, and to only use
mgraffam
parents:
221
diff
changeset
|
811 #else |
8067 | 812 |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
813 #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
|
814 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
|
815 { |
8067 | 816 XF86VidModeLockModeSwitch(mDisplay,mScreen,0); |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
817 // 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
|
818 // for riva128 one call is enough! |
8067 | 819 XF86VidModeSwitchToMode(mDisplay,mScreen,vo_dga_vidmodes[dga_modenum]); |
820 XF86VidModeSwitchToMode(mDisplay,mScreen,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
|
821 } |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
822 #endif |
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
823 |
8067 | 824 XF86DGAGetViewPortSize(mDisplay,mScreen, |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
825 &vo_dga_vp_width, |
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
826 &vo_dga_vp_height); |
13 | 827 |
8067 | 828 XF86DGAGetVideo (mDisplay, mScreen, |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
829 (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
|
830 |
8067 | 831 XF86DGADirectVideo (mDisplay, mScreen, |
261 | 832 XF86DGADirectGraphics | XF86DGADirectMouse | |
833 XF86DGADirectKeyb); | |
834 | |
8067 | 835 XF86DGASetViewPort (mDisplay, mScreen, 0, 0); |
261 | 836 |
233
f62ccacbe1e5
Changes to configure to autodetect DGA 2.0 functionality, and to only use
mgraffam
parents:
221
diff
changeset
|
837 #endif |
8067 | 838 } |
233
f62ccacbe1e5
Changes to configure to autodetect DGA 2.0 functionality, and to only use
mgraffam
parents:
221
diff
changeset
|
839 |
13 | 840 // do some more checkings here ... |
261 | 841 |
7499 | 842 mp_msg(MSGT_VO, MSGL_V, "vo_dga: bytes/line: %d, screen res: %dx%d, depth: %d, base: %08x, bpp: %d\n", |
13 | 843 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
|
844 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
|
845 HW_MODE.vdm_bitspp); |
13 | 846 |
847 x_off = (vo_dga_vp_width - vo_dga_src_width)>>1; | |
848 y_off = (vo_dga_vp_height - vo_dga_src_height)>>1; | |
849 | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
850 vo_dga_bytes_per_line = vo_dga_src_width * HW_MODE.vdm_bytespp; |
261 | 851 vo_dga_lines = vo_dga_src_height; |
13 | 852 |
853 vo_dga_src_offset = 0; | |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
854 vo_dga_vp_offset = (y_off * vo_dga_width + x_off ) * HW_MODE.vdm_bytespp; |
13 | 855 |
680
fbd9327b899b
- now features 24->32 conversion (this is actually faster than letting the
acki2
parents:
677
diff
changeset
|
856 vo_dga_vp_skip = (vo_dga_width - vo_dga_src_width) * HW_MODE.vdm_bytespp; // todo |
13 | 857 |
7499 | 858 mp_msg(MSGT_VO, MSGL_V, "vo_dga: vp_off=%d, vp_skip=%d, bpl=%d\n", |
13 | 859 vo_dga_vp_offset, vo_dga_vp_skip, vo_dga_bytes_per_line); |
860 | |
861 | |
8067 | 862 XGrabKeyboard (mDisplay, DefaultRootWindow(mDisplay), True, |
13 | 863 GrabModeAsync,GrabModeAsync, CurrentTime); |
7539
56ea9db91251
-nograbpointer, based on old patch by Christian Ohm <chr.ohm@gmx.net>
arpi
parents:
7533
diff
changeset
|
864 if(vo_grabpointer) |
8067 | 865 XGrabPointer (mDisplay, DefaultRootWindow(mDisplay), True, |
13 | 866 ButtonPressMask,GrabModeAsync, GrabModeAsync, |
867 None, None, CurrentTime); | |
262 | 868 |
8067 | 869 if ( !vo_config_count || width != prev_width || height != prev_height ) |
870 { | |
871 init_video_buffers(vo_dga_base, | |
7515 | 872 vo_dga_vp_height, |
873 vo_dga_width * HW_MODE.vdm_bytespp, | |
8067 | 874 #ifdef HAVE_DGA2 |
7515 | 875 modeline->maxViewportY, |
876 #else | |
877 vo_dga_vp_height, | |
878 #endif | |
879 vo_doublebuffering); | |
8067 | 880 prev_width=width; prev_height=height; |
881 } | |
263
78e8925fd6b4
- added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents:
262
diff
changeset
|
882 |
7499 | 883 mp_msg(MSGT_VO, MSGL_V, "vo_dga: Using %d frame buffer%s.\n", |
7498
2b4190fb8218
Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents:
7124
diff
changeset
|
884 vo_dga_nr_video_buffers, vo_dga_nr_video_buffers == 1 ? "" : "s"); |
262 | 885 |
13 | 886 vo_dga_is_running = 1; |
887 return 0; | |
888 } | |
889 | |
7930 | 890 static int dga_depths_init = 0; |
891 | |
4352 | 892 static uint32_t preinit(const char *arg) |
893 { | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4713
diff
changeset
|
894 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
|
895 { |
7499 | 896 mp_msg(MSGT_VO, MSGL_INFO, "vo_dga: Unknown subdevice: %s\n",arg); |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4713
diff
changeset
|
897 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
|
898 } |
7930 | 899 |
900 if( !vo_init() ) return -1; // Can't open X11 | |
901 | |
902 if(dga_depths_init == 0){ // FIXME!? | |
903 int i; | |
904 | |
905 vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen); | |
906 | |
907 if(vo_dga_XServer_mode ==0){ | |
908 #ifndef HAVE_DGA2 | |
909 mp_msg(MSGT_VO, MSGL_ERR, "vo_dga: Your X-Server is not running in a "); | |
910 mp_msg(MSGT_VO, MSGL_ERR, "resolution supported by DGA driver!\n"); | |
911 #endif | |
912 }//else{ | |
913 // mp_msg(MSGT_VO, MSGL_INFO, "vo_dga: X running at: %s\n", | |
914 // vd_GetModeString(vo_dga_XServer_mode)); | |
915 //} | |
916 | |
917 #ifdef HAVE_DGA2 | |
8067 | 918 vo_modelines=XDGAQueryModes(mDisplay, mScreen, &vo_modecount); |
919 if(vo_modelines){ | |
920 for(i=0; i< vo_modecount; i++){ | |
7930 | 921 mp_msg(MSGT_VO, MSGL_V, "vo_dga: (%03d) depth=%d, bpp=%d, r=%08x, g=%08x, b=%08x, %d x %d\n", |
922 i, | |
8067 | 923 vo_modelines[i].depth, |
924 vo_modelines[i].bitsPerPixel, | |
925 vo_modelines[i].redMask, | |
926 vo_modelines[i].greenMask, | |
927 vo_modelines[i].blueMask, | |
928 vo_modelines[i].viewportWidth, | |
929 vo_modelines[i].viewportHeight); | |
7930 | 930 vd_EnableMode( |
8067 | 931 vo_modelines[i].depth, |
932 vo_modelines[i].bitsPerPixel, | |
933 vo_modelines[i].redMask, | |
934 vo_modelines[i].greenMask, | |
935 vo_modelines[i].blueMask); | |
7930 | 936 } |
937 } | |
938 #endif | |
939 dga_depths_init = 1; | |
940 | |
941 if( !vo_dga_modes[1].vdm_supported && vo_dga_modes[2].vdm_supported ){ | |
942 vo_dga_modes[1].vdm_supported = 1; | |
943 } | |
944 | |
945 if( !vo_dga_modes[3].vdm_supported && vo_dga_modes[4].vdm_supported ){ | |
946 vo_dga_modes[3].vdm_supported = 1; | |
947 } | |
948 | |
949 for(i=1; i<vo_dga_mode_num; i++){ | |
950 mp_msg(MSGT_VO, MSGL_INFO, "vo_dga: Mode: %s", vd_GetModeString(i)); | |
951 if(vo_dbpp && vo_dbpp != vo_dga_modes[i].vdm_mplayer_depth){ | |
952 vo_dga_modes[i].vdm_supported = 0; | |
953 mp_msg(MSGT_VO, MSGL_INFO, " ...disabled by -bpp %d", vo_dbpp ); | |
954 } | |
955 mp_msg(MSGT_VO, MSGL_INFO, "\n"); | |
956 } | |
957 } | |
958 | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4713
diff
changeset
|
959 return 0; |
4352 | 960 } |
961 | |
8084 | 962 static uint32_t get_image(mp_image_t *mpi) |
963 { | |
964 if ( | |
965 !IMGFMT_IS_BGR(mpi->imgfmt) || | |
966 (IMGFMT_BGR_DEPTH(mpi->imgfmt) != vo_dga_modes[vo_dga_hw_mode].vdm_mplayer_depth) || | |
967 (mpi->type==MP_IMGTYPE_STATIC && vo_dga_nr_video_buffers>1) || | |
968 (mpi->type==MP_IMGTYPE_IP && vo_dga_nr_video_buffers<2) || | |
969 (mpi->type==MP_IMGTYPE_IPB) | |
970 ) | |
971 return(VO_FALSE); | |
972 | |
973 if( (mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) || | |
974 (mpi->flags&MP_IMGFLAG_ACCEPT_WIDTH && | |
975 ((vo_dga_bytes_per_line+vo_dga_vp_skip)%(mpi->bpp/8))==0 ) || | |
976 (mpi->width*(mpi->bpp/8)==(vo_dga_bytes_per_line+vo_dga_vp_skip)) ){ | |
977 | |
978 mpi->planes[0] = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset; | |
979 mpi->stride[0] = vo_dga_bytes_per_line + vo_dga_vp_skip; | |
980 mpi->width=(vo_dga_bytes_per_line+vo_dga_vp_skip)/(mpi->bpp/8); | |
981 mpi->flags |= MP_IMGFLAG_DIRECT; | |
982 return(VO_TRUE); | |
983 } | |
984 | |
985 return(VO_FALSE); | |
986 } | |
987 | |
4596 | 988 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 989 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4439
diff
changeset
|
990 switch (request) { |
8084 | 991 case VOCTRL_GET_IMAGE: |
992 return get_image(data); | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4439
diff
changeset
|
993 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4439
diff
changeset
|
994 return query_format(*((uint32_t*)data)); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4439
diff
changeset
|
995 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4439
diff
changeset
|
996 return VO_NOTIMPL; |
4352 | 997 } |
998 | |
260
1742ea658d0b
Source cleanup. Improved resolution selection (I think :-)).
acki2
parents:
233
diff
changeset
|
999 //--------------------------------------------------------- |