annotate libvo/vo_dga.c @ 9068:8f1659a47aa4

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