annotate libvo/vo_dga.c @ 36540:3908962d8e48

Explain the relationship between the subtitle encoding options.
author ib
date Sun, 19 Jan 2014 14:15:53 +0000
parents 5d3f93051de9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
1 /*
10021
a7ae63354098 Spring cleanup: removed the full yv12 support as it was broken anyway. The BGR/RGB native/non-native case needs some cleanup, too. Currently it works for me (tm)
alex
parents: 9274
diff changeset
2 * X11 DGA Interface
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
3 *
26400
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
4 * Copyright (C) 2001 Andreas Ackermann <acki@acki-netz.de>
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
5 * Sourceforge username: acki2
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
6 *
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
7 * This file is part of MPlayer.
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
8 *
26400
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
9 * MPlayer is free software; you can redistribute it and/or modify
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
10 * it under the terms of the GNU General Public License as published by
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
12 * (at your option) any later version.
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
13 *
26400
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
14 * MPlayer is distributed in the hope that it will be useful,
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
17 * GNU General Public License for more details.
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
18 *
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
19 * You should have received a copy of the GNU General Public License along
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
20 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
5af4096b9fec Replace "all rights reserved" statement with standard GPL license header.
diego
parents: 25220
diff changeset
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
22 */
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
23
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
24 #include <stdio.h>
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
25 #include <stdlib.h>
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
26 #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
27 #include <errno.h>
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
28
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
29 #include "config.h"
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
30 #include "video_out.h"
36517
5d3f93051de9 Remove empty draw_slice and draw_frame stubs.
reimar
parents: 35050
diff changeset
31 #define NO_DRAW_SLICE
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
32 #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
33 #include "aspect.h"
10021
a7ae63354098 Spring cleanup: removed the full yv12 support as it was broken anyway. The BGR/RGB native/non-native case needs some cleanup, too. Currently it works for me (tm)
alex
parents: 9274
diff changeset
34 #include "x11_common.h"
a7ae63354098 Spring cleanup: removed the full yv12 support as it was broken anyway. The BGR/RGB native/non-native case needs some cleanup, too. Currently it works for me (tm)
alex
parents: 9274
diff changeset
35 #include "fastmemcpy.h"
13787
e047e70a9767 Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents: 12582
diff changeset
36 #include "mp_msg.h"
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
37
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
38 #include <X11/Xlib.h>
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
39 #include <X11/extensions/xf86dga.h>
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
40
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
41 #ifdef CONFIG_XF86VM
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
42 #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
43 #endif
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
44
25216
3aee342be929 Make vo info structs const
reimar
parents: 18976
diff changeset
45 static const vo_info_t info = {
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
46 #ifdef CONFIG_DGA2
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
47 "DGA ( Direct Graphic Access V2.0 )",
533
ca59ef4ce54d driver info now depends on detected DGA version
arpi_esp
parents: 493
diff changeset
48 #else
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
49 #ifdef CONFIG_XF86VM
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
50 "DGA ( Direct Graphic Access V1.0+XF86VidModeExt. )",
7499
dcb9f392eae4 cosmetics...
arpi
parents: 7498
diff changeset
51 #else
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
52 "DGA ( Direct Graphic Access V1.0 )",
7499
dcb9f392eae4 cosmetics...
arpi
parents: 7498
diff changeset
53 #endif
533
ca59ef4ce54d driver info now depends on detected DGA version
arpi_esp
parents: 493
diff changeset
54 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
55 "dga",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
56 "Andreas Ackermann <acki@acki-netz.de>",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
57 ""
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
58 };
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
59
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
60 const LIBVO_EXTERN(dga)
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
61 //------------------------------------------------------------------
680
fbd9327b899b - now features 24->32 conversion (this is actually faster than letting the
acki2
parents: 677
diff changeset
62 //#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
63 //#define BYTESPP (vo_dga_modes[vo_dga_active_mode].vdm_bytespp)
1154
4bf4e057c82e - if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents: 1150
diff changeset
64 #define VO_DGA_INVALID_RES 100000
680
fbd9327b899b - now features 24->32 conversion (this is actually faster than letting the
acki2
parents: 677
diff changeset
65 #define HW_MODE (vo_dga_modes[vo_dga_hw_mode])
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
66 #define SRC_MODE (vo_dga_modes[vo_dga_src_mode])
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
67 struct vd_modes
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
68 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
69 int vdm_mplayer_depth;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
70 int vdm_supported;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
71 int vdm_depth;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
72 int vdm_bitspp;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
73 int vdm_bytespp;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
74 int vdm_rmask;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
75 int vdm_gmask;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
76 int vdm_bmask;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
77 int vdm_hw_mode;
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
78 };
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
79
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
80 //------------------------------------------------------------------
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
81
680
fbd9327b899b - now features 24->32 conversion (this is actually faster than letting the
acki2
parents: 677
diff changeset
82 static struct vd_modes vo_dga_modes[] = {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
83 // these entries describe HW modes
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
84 // however, we use the same entries to tell mplayer what we support
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
85 // so the last two values describe, which HW mode to use and which conversion
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
86 // function to use for a mode that is not supported by HW
680
fbd9327b899b - now features 24->32 conversion (this is actually faster than letting the
acki2
parents: 677
diff changeset
87
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
88 {0, 0, 0, 0, 0, 0, 0, 0, 0,},
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
89 {15, 0, 15, 16, 2, 0x7c00, 0x03e0, 0x001f, 2,},
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
90 {16, 0, 16, 16, 2, 0xf800, 0x07e0, 0x001f, 2,},
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
91 {24, 0, 24, 24, 3, 0xff0000, 0x00ff00, 0x0000ff, 4},
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
92 {32, 0, 24, 32, 4, 0x00ff0000, 0x0000ff00, 0x000000ff, 4}
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
93 };
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
94
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
95 static int vo_dga_mode_num =
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
96 sizeof(vo_dga_modes) / sizeof(struct vd_modes);
392
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 // enable a HW mode (by description)
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
99 static int vd_EnableMode(int depth, int bitspp,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
100 int rmask, int gmask, int bmask)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
101 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
102 int i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
103
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
104 for (i = 1; i < vo_dga_mode_num; i++)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
105 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
106 if (vo_dga_modes[i].vdm_depth == depth &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
107 vo_dga_modes[i].vdm_bitspp == bitspp &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
108 vo_dga_modes[i].vdm_rmask == rmask &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
109 vo_dga_modes[i].vdm_gmask == gmask &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
110 vo_dga_modes[i].vdm_bmask == bmask)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
111 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
112 vo_dga_modes[i].vdm_supported = 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
113 vo_dga_modes[i].vdm_hw_mode = i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
114 return i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
115 }
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
116 }
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
117 return 0;
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
118 }
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
119
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
120 static int vd_ModeEqual(int depth, int bitspp,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
121 int rmask, int gmask, int bmask, int index)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
122 {
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 26400
diff changeset
123 return (vo_dga_modes[index].vdm_depth == depth &&
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
124 vo_dga_modes[index].vdm_bitspp == bitspp &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
125 vo_dga_modes[index].vdm_rmask == rmask &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
126 vo_dga_modes[index].vdm_gmask == gmask &&
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 26400
diff changeset
127 vo_dga_modes[index].vdm_bmask == bmask) ? 1 : 0;
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
128 }
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
129
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
130
680
fbd9327b899b - now features 24->32 conversion (this is actually faster than letting the
acki2
parents: 677
diff changeset
131 // enable a HW mode (mplayer_depth decides which)
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
132 static int vd_ValidateMode(int mplayer_depth)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
133 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
134 int i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
135
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
136 if (mplayer_depth == 0)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
137 return 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
138 for (i = 1; i < vo_dga_mode_num; i++)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
139 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
140 if (vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
141 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
142 vo_dga_modes[i].vdm_supported = 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
143 vo_dga_modes[i].vdm_hw_mode = i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
144 return i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
145 }
395
01768a027e7d - fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents: 392
diff changeset
146 }
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
147 return 0;
395
01768a027e7d - fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents: 392
diff changeset
148 }
01768a027e7d - fixed bug with depth and mpg when current bpp of XServer was != 32
acki2
parents: 392
diff changeset
149
680
fbd9327b899b - now features 24->32 conversion (this is actually faster than letting the
acki2
parents: 677
diff changeset
150 // do we support this mode? (not important whether native or conversion)
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
151 static int vd_ModeValid(int mplayer_depth)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
152 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
153 int i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
154
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
155 if (mplayer_depth == 0)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
156 return 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
157 for (i = 1; i < vo_dga_mode_num; i++)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
158 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
159 if (vo_dga_modes[i].vdm_mplayer_depth == mplayer_depth &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
160 vo_dga_modes[i].vdm_supported != 0)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
161 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
162 return i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
163 }
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
164 }
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
165 return 0;
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
166 }
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
167
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
168 static char *vd_GetModeString(int index)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
169 {
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
170
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
171 #define VO_DGA_MAX_STRING_LEN 100
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
172 static char stringbuf[VO_DGA_MAX_STRING_LEN];
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
173
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
174 stringbuf[VO_DGA_MAX_STRING_LEN - 1] = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
175 snprintf(stringbuf, VO_DGA_MAX_STRING_LEN - 2,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
176 "depth=%d, bpp=%d, r=%06x, g=%06x, b=%06x, %s (-bpp %d)",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
177 vo_dga_modes[index].vdm_depth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
178 vo_dga_modes[index].vdm_bitspp,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
179 vo_dga_modes[index].vdm_rmask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
180 vo_dga_modes[index].vdm_gmask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
181 vo_dga_modes[index].vdm_bmask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
182 vo_dga_modes[index].
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
183 vdm_supported ? "native" : "not supported",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
184 vo_dga_modes[index].vdm_mplayer_depth);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
185 return stringbuf;
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
186 }
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
187
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
188 //-----------------------------------------------------------------
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
189
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
190 #if defined(CONFIG_XF86VM) && !defined(CONFIG_DGA2)
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
191 static XF86VidModeModeInfo **vo_dga_vidmodes = NULL;
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
192 #endif
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
193
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
194
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
195 static int vo_dga_src_format;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
196 static int vo_dga_width; // bytes per line in framebuffer
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
197 static int vo_dga_vp_width; // visible pixels per line in
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
198
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
199 // framebuffer
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
200 static int vo_dga_vp_height; // visible lines in framebuffer
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
201 static int vo_dga_is_running = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
202 static int vo_dga_src_width; // width of video in pixels
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
203 static int vo_dga_src_height; // height of video in pixels
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
204 static int vo_dga_src_offset = 0; // offset in src
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
205 static int vo_dga_vp_offset = 0; // offset in dest
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
206 static int vo_dga_bytes_per_line; // bytes per line to copy
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
207 static int vo_dga_vp_skip; // dto. for dest
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
208 static int vo_dga_lines; // num of lines to copy
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
209 static int vo_dga_hw_mode = 0; // index in mode list that is actually
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
210
680
fbd9327b899b - now features 24->32 conversion (this is actually faster than letting the
acki2
parents: 677
diff changeset
211 // used by framebuffer
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
212 static int vo_dga_src_mode = 0; // index in mode list that is used by
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
213
680
fbd9327b899b - now features 24->32 conversion (this is actually faster than letting the
acki2
parents: 677
diff changeset
214 // codec
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
215 static int vo_dga_XServer_mode = 0; // index in mode list for resolution
8067
482666d4c729 - cleanup
pontscho
parents: 8027
diff changeset
216
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
217 #ifdef CONFIG_DGA2
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
218 static XDGAMode *vo_modelines;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
219 static int vo_modecount;
8067
482666d4c729 - cleanup
pontscho
parents: 8027
diff changeset
220 #endif
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
221
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
222 #define MAX_NR_VIDEO_BUFFERS 3
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
223
7575
3a6d7933a6ad flickering fix, patch by Fredrik Noring <noring@nocrew.org>
arpi
parents: 7539
diff changeset
224 #define CURRENT_VIDEO_BUFFER \
3a6d7933a6ad flickering fix, patch by Fredrik Noring <noring@nocrew.org>
arpi
parents: 7539
diff changeset
225 (vo_dga_video_buffer[vo_dga_current_video_buffer])
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
226
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
227 static int vo_dga_nr_video_buffers; // Total number of frame buffers.
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
228 static int vo_dga_current_video_buffer; // Buffer available for rendering.
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
229
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
230 static struct video_buffer
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
231 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
232 int y;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
233 uint8_t *data;
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
234 } vo_dga_video_buffer[MAX_NR_VIDEO_BUFFERS];
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
235
4060
974e028471a4 SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents: 3852
diff changeset
236 /* 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
237 static unsigned int scale_srcW = 0,
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
238 scale_dstW = 0, scale_srcH = 0, scale_dstH = 0;
4060
974e028471a4 SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents: 3852
diff changeset
239
490
caf5ddb0d19a - query_format() now uses new return value concept
acki2
parents: 395
diff changeset
240 //---------------------------------------------------------
caf5ddb0d19a - query_format() now uses new return value concept
acki2
parents: 395
diff changeset
241
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
242 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
243 unsigned char *srca, int stride)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
244 {
490
caf5ddb0d19a - query_format() now uses new return value concept
acki2
parents: 395
diff changeset
245
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
246 char *d;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
247 unsigned int offset;
14795
041a13490497 no effect in practice, but strides should always be signed
rfelker
parents: 13787
diff changeset
248 int buffer_stride;
35050
b291f44d864a Avoid some code duplication related to drawing the OSD.
reimar
parents: 33305
diff changeset
249 int bpp = pixel_stride(vo_dga_src_format);
b291f44d864a Avoid some code duplication related to drawing the OSD.
reimar
parents: 33305
diff changeset
250 vo_draw_alpha_func draw = vo_get_draw_alpha(vo_dga_src_format);
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
251
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
252 offset = vo_dga_width * y0 + x0;
35050
b291f44d864a Avoid some code duplication related to drawing the OSD.
reimar
parents: 33305
diff changeset
253 buffer_stride = vo_dga_width * bpp;
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
254 d = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset;
35050
b291f44d864a Avoid some code duplication related to drawing the OSD.
reimar
parents: 33305
diff changeset
255 d += bpp * offset;
490
caf5ddb0d19a - query_format() now uses new return value concept
acki2
parents: 395
diff changeset
256
35050
b291f44d864a Avoid some code duplication related to drawing the OSD.
reimar
parents: 33305
diff changeset
257 if (draw) draw(w, h, src, srca, stride, d, buffer_stride);
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
258 }
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
259
490
caf5ddb0d19a - query_format() now uses new return value concept
acki2
parents: 395
diff changeset
260
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
261 //---------------------------------------------------------
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
262
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
263
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
264
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
265
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
266 // quick & dirty - for debugging only
10495
81e99e4c6640 10l & warning fixes
alex
parents: 10286
diff changeset
267 #if 0
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
268 static void fillblock(char *strt, int yoff, int lines, int val)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
269 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
270 char *i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
271
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
272 for (i = strt + yoff * vo_dga_width * HW_MODE.vdm_bytespp;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
273 i < strt + (lines + yoff) * vo_dga_width * HW_MODE.vdm_bytespp;)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
274 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
275 *i++ = val;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
276 }
720
8146b106816a - now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents: 691
diff changeset
277 }
10495
81e99e4c6640 10l & warning fixes
alex
parents: 10286
diff changeset
278 #endif
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
279
260
1742ea658d0b Source cleanup. Improved resolution selection (I think :-)).
acki2
parents: 233
diff changeset
280 //---------------------------------------------------------
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
281
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
282 static int draw_frame(uint8_t * src[])
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
283 {
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
284
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
285 int numlines = vo_dga_lines;
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
286
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
287 char *s, *d;
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
288
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
289 s = *src;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
290 d = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
291
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
292 mem2agpcpy_pic(d, s,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
293 vo_dga_bytes_per_line,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
294 numlines,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
295 vo_dga_bytes_per_line + vo_dga_vp_skip,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
296 vo_dga_bytes_per_line);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
297
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
298 // DBG-COde
720
8146b106816a - now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents: 691
diff changeset
299
8146b106816a - now chooses mode with highest ymax (enables doublebuffering in some cases
acki2
parents: 691
diff changeset
300 #if 0
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
301 d = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
302 fillblock(d, 0, 10, 0x800000ff);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
303 fillblock(d, 10, 10, 0x8000ff00);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
304 fillblock(d, 20, 10, 0x80ff0000);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
305 fillblock(d, 30, 10, 0xff0000ff);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
306 fillblock(d, 40, 10, 0x800000ff);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
307 fillblock(d, 50, 10, 0x0f0000ff);
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
308 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
309 return 0;
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
310 }
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
311
260
1742ea658d0b Source cleanup. Improved resolution selection (I think :-)).
acki2
parents: 233
diff changeset
312 //---------------------------------------------------------
1742ea658d0b Source cleanup. Improved resolution selection (I think :-)).
acki2
parents: 233
diff changeset
313
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 13
diff changeset
314 static void check_events(void)
1fc618eba830 added check_events() interface
arpi_esp
parents: 13
diff changeset
315 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
316 vo_x11_check_events(mDisplay);
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 13
diff changeset
317 }
1fc618eba830 added check_events() interface
arpi_esp
parents: 13
diff changeset
318
260
1742ea658d0b Source cleanup. Improved resolution selection (I think :-)).
acki2
parents: 233
diff changeset
319 //---------------------------------------------------------
1742ea658d0b Source cleanup. Improved resolution selection (I think :-)).
acki2
parents: 233
diff changeset
320
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 29263
diff changeset
321 #include "sub/sub.h"
612
77e0094f0cce some warnings killed
szabii
parents: 533
diff changeset
322
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1336
diff changeset
323 static void draw_osd(void)
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
324 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
325 vo_draw_text(vo_dga_src_width, vo_dga_src_height, draw_alpha);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
326 }
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1336
diff changeset
327
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
328 static void switch_video_buffers(void)
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
329 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
330 vo_dga_current_video_buffer =
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
331 (vo_dga_current_video_buffer + 1) % vo_dga_nr_video_buffers;
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
332 }
262
2c7c77d793df - added double buffering :-)
acki2
parents: 261
diff changeset
333
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
334 static void flip_page(void)
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
335 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
336 if (1 < vo_dga_nr_video_buffers)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
337 {
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
338 #ifdef CONFIG_DGA2
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
339 XDGASetViewport(mDisplay, mScreen,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
340 0, CURRENT_VIDEO_BUFFER.y, XDGAFlipRetrace);
262
2c7c77d793df - added double buffering :-)
acki2
parents: 261
diff changeset
341 #else
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
342 XF86DGASetViewPort(mDisplay, mScreen, 0, CURRENT_VIDEO_BUFFER.y);
262
2c7c77d793df - added double buffering :-)
acki2
parents: 261
diff changeset
343 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
344 switch_video_buffers();
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
345 }
260
1742ea658d0b Source cleanup. Improved resolution selection (I think :-)).
acki2
parents: 233
diff changeset
346 }
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
347
260
1742ea658d0b Source cleanup. Improved resolution selection (I think :-)).
acki2
parents: 233
diff changeset
348 //---------------------------------------------------------
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
349
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
350 static int query_format(uint32_t format)
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
351 {
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
352
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
353 if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
354 vd_ModeValid(format & 0xff))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
355 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
356 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
357 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
358
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
359 return 0;
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
360 }
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
361
260
1742ea658d0b Source cleanup. Improved resolution selection (I think :-)).
acki2
parents: 233
diff changeset
362 //---------------------------------------------------------
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
363
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
364 static void uninit(void)
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
365 {
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
366
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
367 #ifdef CONFIG_DGA2
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
368 XDGADevice *dgadevice;
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
369 #endif
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
370
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
371 if (!vo_config_count)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
372 return;
8067
482666d4c729 - cleanup
pontscho
parents: 8027
diff changeset
373
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
374 if (vo_dga_is_running)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
375 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
376 vo_dga_is_running = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
377 mp_msg(MSGT_VO, MSGL_V, "vo_dga: in uninit\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
378 if (vo_grabpointer)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
379 XUngrabPointer(mDisplay, CurrentTime);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
380 XUngrabKeyboard(mDisplay, CurrentTime);
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
381 #ifdef CONFIG_DGA2
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
382 XDGACloseFramebuffer(mDisplay, mScreen);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
383 dgadevice = XDGASetMode(mDisplay, mScreen, 0);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
384 if (dgadevice != NULL)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
385 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
386 XFree(dgadevice);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
387 }
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
388 #else
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
389 XF86DGADirectVideo(mDisplay, mScreen, 0);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
390 // first disable DirectVideo and then switch mode back!
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
391 #ifdef CONFIG_XF86VM
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
392 if (vo_dga_vidmodes != NULL)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
393 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
394 int screen;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
395
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
396 screen = XDefaultScreen(mDisplay);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
397 mp_msg(MSGT_VO, MSGL_V,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
398 "vo_dga: VidModeExt: Switching back..\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
399 // seems some graphics adaptors need this more than once ...
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
400 XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
401 XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
402 XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
403 XF86VidModeSwitchToMode(mDisplay, screen, vo_dga_vidmodes[0]);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
404 XFree(vo_dga_vidmodes);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
405 }
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
406 #endif
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
407 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
408 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
409 vo_x11_uninit();
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
410 }
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
411
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
412
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
413 //----------------------------------------------------------
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
414 // TODO: check for larger maxy value
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
415 // (useful for double buffering!!!)
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
416
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
417 static int check_res(int num, int x, int y, int bpp,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
418 int new_x, int new_y, int new_vbi, int new_maxy,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
419 int *old_x, int *old_y, int *old_vbi, int *old_maxy)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
420 {
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
421
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
422 mp_msg(MSGT_VO, MSGL_V,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
423 "vo_dga: (%3d) Trying %4d x %4d @ %3d Hz @ depth %2d ..", num,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
424 new_x, new_y, new_vbi, bpp);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
425 mp_msg(MSGT_VO, MSGL_V, "(old: %dx%d@%d).", *old_x, *old_y, *old_vbi);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
426 if ((new_x >= x) && (new_y >= y) && (
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
427 // prefer a better resolution either in X or in Y
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
428 // as long as the other dimension is at least the same
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
429 //
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
430 // hmm ... MAYBE it would be more clever to focus on the
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
431 // x-resolution; I had 712x400 and 640x480 and the movie
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
432 // was 640x360; 640x480 would be the 'right thing' here
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
433 // but since 712x400 was queried first I got this one.
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
434 // I think there should be a cmd-line switch to let the
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
435 // user choose the mode he likes ... (acki2)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
436 (((new_x < *old_x) &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
437 !(new_y > *old_y)) ||
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
438 ((new_y < *old_y) &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
439 !(new_x > *old_x)))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
440 // but if we get an identical resolution choose
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
441 // the one with the lower refreshrate (saves bandwidth !!!)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
442 // as long as it's above 50 Hz (acki2 on 30/3/2001)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
443 ||
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
444 (((new_x == *old_x) &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
445 (new_y == *old_y) &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
446 ((new_vbi >= *old_vbi
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
447 && *old_vbi < 50)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
448 || (*old_vbi >= 50
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
449 && new_vbi < *old_vbi
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
450 && new_vbi >= 50))) ||
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
451 // if everything is equal, then use the mode with the lower
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
452 // stride
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
453 ((new_x == *old_x) &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
454 (new_y == *old_y) &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
455 (new_vbi == *old_vbi) &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
456 (new_maxy > *old_maxy)))))
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
457 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
458 *old_x = new_x;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
459 *old_y = new_y;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
460 *old_maxy = new_maxy;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
461 *old_vbi = new_vbi;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
462 mp_msg(MSGT_VO, MSGL_V, ".ok!!\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
463 return 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
464 } else
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
465 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
466 mp_msg(MSGT_VO, MSGL_V, ".no\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
467 return 0;
260
1742ea658d0b Source cleanup. Improved resolution selection (I think :-)).
acki2
parents: 233
diff changeset
468 }
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
469 }
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
470
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
471
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
472
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
473 //---------------------------------------------------------
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
474
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
475 static void init_video_buffers(uint8_t * buffer_base,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
476 int view_port_height,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
477 int bytes_per_scanline,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
478 int max_view_port_y,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
479 int use_multiple_buffers)
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
480 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
481 int bytes_per_buffer = view_port_height * bytes_per_scanline;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
482 int i;
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
483
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
484 if (use_multiple_buffers)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
485 vo_dga_nr_video_buffers = max_view_port_y / view_port_height;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
486 else
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
487 vo_dga_nr_video_buffers = 1;
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
488
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
489 if (vo_dga_nr_video_buffers > MAX_NR_VIDEO_BUFFERS)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
490 vo_dga_nr_video_buffers = MAX_NR_VIDEO_BUFFERS;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
491 if (vo_dga_nr_video_buffers <= 0)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
492 vo_dga_nr_video_buffers = 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
493
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
494 vo_dga_current_video_buffer = 0;
9274
737c44487ebc 10l, avoid getting num_of_buffers=0
alex
parents: 8148
diff changeset
495
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
496 for (i = 0; i < vo_dga_nr_video_buffers; i++)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
497 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
498 vo_dga_video_buffer[i].y = i * view_port_height;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
499 vo_dga_video_buffer[i].data = buffer_base + i * bytes_per_buffer;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
500
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
501 // Clear video buffer.
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
502 memset(vo_dga_video_buffer[i].data, 0, bytes_per_buffer);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
503 }
7498
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
504 }
2b4190fb8218 Attached patch improves the vertical retrace synchronisation (vsync)
arpi
parents: 7124
diff changeset
505
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
506 static int config(uint32_t width, uint32_t height,
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
507 uint32_t d_width, uint32_t d_height,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
508 uint32_t flags, char *title, uint32_t format)
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
509 {
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
510
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
511 int x_off, y_off;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
512 int wanted_width, wanted_height;
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
513
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
514 static unsigned char *vo_dga_base;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
515 static int prev_width, prev_height;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
516
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
517 #ifdef CONFIG_DGA2
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
518 // needed to change DGA video mode
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
519 int mX = VO_DGA_INVALID_RES, mY = VO_DGA_INVALID_RES, mVBI =
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
520 100000, mMaxY = 0, i, j = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
521 int dga_modenum;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
522 XDGAMode *modeline;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
523 XDGADevice *dgadevice;
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
524 #else
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
525 #ifdef CONFIG_XF86VM
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
526 unsigned int vm_event, vm_error;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
527 unsigned int vm_ver, vm_rev;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
528 int i, j = 0, have_vm = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
529 int mX = VO_DGA_INVALID_RES, mY = VO_DGA_INVALID_RES, mVBI =
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
530 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
531 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
532 int bank, ram;
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
533 #endif
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
534
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
535 vo_dga_src_format = format;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
536
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
537 wanted_width = d_width;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
538 wanted_height = d_height;
4060
974e028471a4 SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents: 3852
diff changeset
539
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
540 if (!wanted_height)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
541 wanted_height = height;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
542 if (!wanted_width)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
543 wanted_width = width;
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
544
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
545 if (!vo_dbpp)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
546 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
547 if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
548 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
549 vo_dga_src_mode = vd_ModeValid(format & 0xff);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
550 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
551 } else
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
552 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
553 vo_dga_src_mode = vd_ModeValid(vo_dbpp);
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
554 }
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
555 vo_dga_hw_mode = SRC_MODE.vdm_hw_mode;
680
fbd9327b899b - now features 24->32 conversion (this is actually faster than letting the
acki2
parents: 677
diff changeset
556
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
557 if (!vo_dga_src_mode)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
558 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
559 mp_msg(MSGT_VO, MSGL_ERR, "vo_dga: unsupported video format!\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
560 return 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
561 }
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
562
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
563 vo_dga_vp_width = vo_screenwidth;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
564 vo_dga_vp_height = vo_screenheight;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
565
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
566 mp_msg(MSGT_VO, MSGL_V, "vo_dga: XServer res: %dx%d\n",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
567 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
568
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
569 // choose a suitable mode ...
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
570
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
571 #ifdef CONFIG_DGA2
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
572 // Code to change the video mode added by Michael Graffam
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
573 // mgraffam@idsi.net
3318
a3739b590cf2 do not crash if can't get modelines (dga2.0)
alex
parents: 2732
diff changeset
574
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
575 mp_msg(MSGT_VO, MSGL_V, "vo_dga: vo_modelines=%p, vo_modecount=%d\n",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
576 vo_modelines, vo_modecount);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
577
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
578 if (vo_modelines == NULL)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
579 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
580 mp_msg(MSGT_VO, MSGL_ERR, "vo_dga: can't get modelines\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
581 return 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
582 }
3318
a3739b590cf2 do not crash if can't get modelines (dga2.0)
alex
parents: 2732
diff changeset
583
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
584 mp_msg(MSGT_VO, MSGL_INFO,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
585 "vo_dga: DGA 2.0 available :-) Can switch resolution AND depth!\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
586 for (i = 0; i < vo_modecount; i++)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
587 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
588 if (vd_ModeEqual(vo_modelines[i].depth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
589 vo_modelines[i].bitsPerPixel,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
590 vo_modelines[i].redMask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
591 vo_modelines[i].greenMask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
592 vo_modelines[i].blueMask, vo_dga_hw_mode))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
593 {
272
8ffe2f459851 - still more debug output to be able to fix 15/16 bpp problem
acki2
parents: 266
diff changeset
594
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
595 mp_msg(MSGT_VO, MSGL_V, "maxy: %4d, depth: %2d, %4dx%4d, ",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
596 vo_modelines[i].maxViewportY, vo_modelines[i].depth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
597 vo_modelines[i].imageWidth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
598 vo_modelines[i].imageHeight);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
599 if (check_res
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
600 (i, wanted_width, wanted_height, vo_modelines[i].depth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
601 vo_modelines[i].viewportWidth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
602 vo_modelines[i].viewportHeight,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
603 (unsigned) vo_modelines[i].verticalRefresh,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
604 vo_modelines[i].maxViewportY, &mX, &mY, &mVBI, &mMaxY))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
605 j = i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
606 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
607 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
608 mp_msg(MSGT_VO, MSGL_INFO,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
609 "vo_dga: Selected hardware mode %4d x %4d @ %3d Hz @ depth %2d, bitspp %2d.\n",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
610 mX, mY, mVBI, HW_MODE.vdm_depth, HW_MODE.vdm_bitspp);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
611 mp_msg(MSGT_VO, MSGL_INFO,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
612 "vo_dga: Video parameters by codec: %3d x %3d, depth %2d, bitspp %2d.\n",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
613 width, height, SRC_MODE.vdm_depth, SRC_MODE.vdm_bitspp);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
614 vo_dga_vp_width = mX;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
615 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
616
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 14795
diff changeset
617 if ((flags & VOFLAG_SWSCALE) || (flags & VOFLAG_FULLSCREEN))
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
618 { /* -zoom or -fs */
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
619 scale_dstW = (d_width + 7) & ~7;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
620 scale_dstH = d_height;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
621 scale_srcW = width;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
622 scale_srcH = height;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
623 aspect_save_screenres(mX, mY);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
624 aspect_save_orig(scale_srcW, scale_srcH);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
625 aspect_save_prescale(scale_dstW, scale_dstH);
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 14795
diff changeset
626 if (flags & VOFLAG_FULLSCREEN) /* -fs */
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
627 aspect(&scale_dstW, &scale_dstH, A_ZOOM);
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 14795
diff changeset
628 else if (flags & VOFLAG_SWSCALE) /* -fs */
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
629 aspect(&scale_dstW, &scale_dstH, A_NOZOOM);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
630 mp_msg(MSGT_VO, MSGL_INFO,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
631 "vo_dga: Aspect corrected size for SwScaler: %4d x %4d.\n",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
632 scale_dstW, scale_dstH);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
633 /* XXX this is a hack, but I'm lazy ;-) :: atmos */
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
634 width = scale_dstW;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
635 height = scale_dstH;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
636 }
4060
974e028471a4 SwScaler support for vo_png by Kim Minh, SwScale w/aspecz for vo_dga by me
atmos4
parents: 3852
diff changeset
637
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
638 vo_dga_width = vo_modelines[j].bytesPerScanline / HW_MODE.vdm_bytespp;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
639 dga_modenum = vo_modelines[j].num;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
640 modeline = vo_modelines + j;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
641
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
642 #else
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
643
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
644 #ifdef CONFIG_XF86VM
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
645
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
646 mp_msg(MSGT_VO, MSGL_INFO,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
647 "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
648
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
649 if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
650 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
651 XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
652 mp_msg(MSGT_VO, MSGL_INFO,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
653 "vo_dga: XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
654 have_vm = 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
655 } else
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
656 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
657 mp_msg(MSGT_VO, MSGL_ERR,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
658 "vo_dga: XF86VidMode Extension not available.\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
659 }
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
660
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
661 #define GET_VREFRESH(dotclk, x, y)( (((dotclk)/(x))*1000)/(y) )
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
662
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
663 if (have_vm)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
664 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
665 int modecount;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
666
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
667 XF86VidModeGetAllModeLines(mDisplay, mScreen, &modecount,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
668 &vo_dga_vidmodes);
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
669
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
670 if (vo_dga_vidmodes != NULL)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
671 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
672 for (i = 0; i < modecount; i++)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
673 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
674 if (check_res(i, wanted_width, wanted_height,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
675 vo_dga_modes[vo_dga_hw_mode].vdm_depth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
676 vo_dga_vidmodes[i]->hdisplay,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
677 vo_dga_vidmodes[i]->vdisplay,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
678 GET_VREFRESH(vo_dga_vidmodes[i]->dotclock,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
679 vo_dga_vidmodes[i]->htotal,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
680 vo_dga_vidmodes[i]->vtotal),
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
681 0, &mX, &mY, &mVBI, &mMaxY))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
682 j = i;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
683 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
684
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
685 mp_msg(MSGT_VO, MSGL_INFO,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
686 "vo_dga: Selected video mode %4d x %4d @ %3d Hz @ depth %2d, bitspp %2d, video %3d x %3d.\n",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
687 mX, mY, mVBI,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
688 vo_dga_modes[vo_dga_hw_mode].vdm_depth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
689 vo_dga_modes[vo_dga_hw_mode].vdm_bitspp, width, height);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
690 } else
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
691 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
692 mp_msg(MSGT_VO, MSGL_INFO,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
693 "vo_dga: XF86VidMode returned no screens - using current resolution.\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
694 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
695 dga_modenum = j;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
696 vo_dga_vp_width = mX;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
697 vo_dga_vp_height = mY;
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
698 }
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
699
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
700 #else
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
701 mp_msg(MSGT_VO, MSGL_INFO,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
702 "vo_dga: Only have DGA 1.0 extension and no XF86VidMode :-(\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
703 mp_msg(MSGT_VO, MSGL_INFO,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
704 " Thus, resolution switching is NOT possible.\n");
392
50214d6c1826 - completely rewrote depth switching
acki2
parents: 272
diff changeset
705
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
706 #endif
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
707 #endif
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
708
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
709 vo_dga_src_width = width;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
710 vo_dga_src_height = height;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
711
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
712 if (vo_dga_src_width > vo_dga_vp_width ||
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
713 vo_dga_src_height > vo_dga_vp_height)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
714 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
715 mp_msg(MSGT_VO, MSGL_ERR,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
716 "vo_dga: Sorry, video larger than viewport is not yet supported!\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
717 // ugly, do something nicer in the future ...
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
718 #ifndef CONFIG_DGA2
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
719 #ifdef CONFIG_XF86VM
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
720 if (vo_dga_vidmodes)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
721 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
722 XFree(vo_dga_vidmodes);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
723 vo_dga_vidmodes = NULL;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
724 }
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
725 #endif
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
726 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
727 return 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
728 }
1154
4bf4e057c82e - if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents: 1150
diff changeset
729
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
730 if (vo_dga_vp_width == VO_DGA_INVALID_RES)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
731 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
732 mp_msg(MSGT_VO, MSGL_ERR,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
733 "vo_dga: Something is wrong with your DGA. There doesn't seem to be a\n"
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
734 " single suitable mode!\n"
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
735 " Please file a bug report (see DOCS/HTML/en/bugreports.html)\n");
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
736 #ifndef CONFIG_DGA2
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
737 #ifdef CONFIG_XF86VM
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
738 if (vo_dga_vidmodes)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
739 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
740 XFree(vo_dga_vidmodes);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
741 vo_dga_vidmodes = NULL;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
742 }
1154
4bf4e057c82e - if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents: 1150
diff changeset
743 #endif
4bf4e057c82e - if DGA fails to report some valid modes, vo_dga now exits gracefully
acki2
parents: 1150
diff changeset
744 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
745 return 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
746 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
747 // now let's start the DGA thing
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
748
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
749 if (!vo_config_count || width != prev_width || height != prev_height)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
750 {
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
751 #ifdef CONFIG_DGA2
8067
482666d4c729 - cleanup
pontscho
parents: 8027
diff changeset
752
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
753 if (!XDGAOpenFramebuffer(mDisplay, mScreen))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
754 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
755 mp_msg(MSGT_VO, MSGL_ERR,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
756 "vo_dga: Framebuffer mapping failed!!!\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
757 return 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
758 }
8067
482666d4c729 - cleanup
pontscho
parents: 8027
diff changeset
759
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
760 dgadevice = XDGASetMode(mDisplay, mScreen, dga_modenum);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
761 XDGASync(mDisplay, mScreen);
221
3daeae4a4aa6 Added support to vo_dga to change the video mode to the lowest resolution
mgraffam
parents: 31
diff changeset
762
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
763 vo_dga_base = dgadevice->data;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
764 XFree(dgadevice);
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
765
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
766 XDGASetViewport(mDisplay, mScreen, 0, 0, XDGAFlipRetrace);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
767
233
f62ccacbe1e5 Changes to configure to autodetect DGA 2.0 functionality, and to only use
mgraffam
parents: 221
diff changeset
768 #else
8067
482666d4c729 - cleanup
pontscho
parents: 8027
diff changeset
769
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
770 #ifdef CONFIG_XF86VM
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
771 if (have_vm)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
772 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
773 XF86VidModeLockModeSwitch(mDisplay, mScreen, 0);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
774 // Two calls are needed to switch modes on my ATI Rage 128. Why?
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
775 // for riva128 one call is enough!
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
776 XF86VidModeSwitchToMode(mDisplay, mScreen,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
777 vo_dga_vidmodes[dga_modenum]);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
778 XF86VidModeSwitchToMode(mDisplay, mScreen,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
779 vo_dga_vidmodes[dga_modenum]);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
780 }
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
781 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
782
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
783 XF86DGAGetViewPortSize(mDisplay, mScreen,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
784 &vo_dga_vp_width, &vo_dga_vp_height);
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
785
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
786 XF86DGAGetVideo(mDisplay, mScreen,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
787 (char **) &vo_dga_base, &vo_dga_width, &bank,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
788 &ram);
233
f62ccacbe1e5 Changes to configure to autodetect DGA 2.0 functionality, and to only use
mgraffam
parents: 221
diff changeset
789
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
790 XF86DGADirectVideo(mDisplay, mScreen,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
791 XF86DGADirectGraphics | XF86DGADirectMouse |
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
792 XF86DGADirectKeyb);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
793
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
794 XF86DGASetViewPort(mDisplay, mScreen, 0, 0);
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
795
233
f62ccacbe1e5 Changes to configure to autodetect DGA 2.0 functionality, and to only use
mgraffam
parents: 221
diff changeset
796 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
797 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
798 // do some more checkings here ...
261
3b7e4bf7c7ed - 32/16 bit mode swtiching with DGA2.0
acki2
parents: 260
diff changeset
799
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
800 mp_msg(MSGT_VO, MSGL_V,
17366
934380353fd6 massive attack: mp_msg printf format fixes
rathann
parents: 16301
diff changeset
801 "vo_dga: bytes/line: %d, screen res: %dx%d, depth: %d, base: %p, bpp: %d\n",
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
802 vo_dga_width, vo_dga_vp_width, vo_dga_vp_height,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
803 HW_MODE.vdm_bytespp, vo_dga_base, HW_MODE.vdm_bitspp);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
804
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
805 x_off = (vo_dga_vp_width - vo_dga_src_width) >> 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
806 y_off = (vo_dga_vp_height - vo_dga_src_height) >> 1;
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
807
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
808 vo_dga_bytes_per_line = vo_dga_src_width * HW_MODE.vdm_bytespp;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
809 vo_dga_lines = vo_dga_src_height;
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
810
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
811 vo_dga_src_offset = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
812 vo_dga_vp_offset =
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
813 (y_off * vo_dga_width + x_off) * HW_MODE.vdm_bytespp;
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
814
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
815 vo_dga_vp_skip = (vo_dga_width - vo_dga_src_width) * HW_MODE.vdm_bytespp; // todo
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
816
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
817 mp_msg(MSGT_VO, MSGL_V, "vo_dga: vp_off=%d, vp_skip=%d, bpl=%d\n",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
818 vo_dga_vp_offset, vo_dga_vp_skip, vo_dga_bytes_per_line);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
819
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
820
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
821 XGrabKeyboard(mDisplay, DefaultRootWindow(mDisplay), True,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
822 GrabModeAsync, GrabModeAsync, CurrentTime);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
823 if (vo_grabpointer)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
824 XGrabPointer(mDisplay, DefaultRootWindow(mDisplay), True,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
825 ButtonPressMask, GrabModeAsync, GrabModeAsync,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
826 None, None, CurrentTime);
262
2c7c77d793df - added double buffering :-)
acki2
parents: 261
diff changeset
827
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
828 if (!vo_config_count || width != prev_width || height != prev_height)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
829 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
830 init_video_buffers(vo_dga_base,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
831 vo_dga_vp_height,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
832 vo_dga_width * HW_MODE.vdm_bytespp,
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
833 #ifdef CONFIG_DGA2
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
834 modeline->maxViewportY,
7515
72dd0b05d562 DGA1 fix by Fredrik Noring <noring@nocrew.org>
arpi
parents: 7500
diff changeset
835 #else
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
836 vo_dga_vp_height,
7515
72dd0b05d562 DGA1 fix by Fredrik Noring <noring@nocrew.org>
arpi
parents: 7500
diff changeset
837 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
838 vo_doublebuffering);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
839 prev_width = width;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
840 prev_height = height;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
841 }
263
78e8925fd6b4 - added VidMode changing support for DGA1.0 (used code from Michael Graffam (mgraffam@idsi.net))
acki2
parents: 262
diff changeset
842
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
843 mp_msg(MSGT_VO, MSGL_V, "vo_dga: Using %d frame buffer%s.\n",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
844 vo_dga_nr_video_buffers,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
845 vo_dga_nr_video_buffers == 1 ? "" : "s");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
846
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
847 vo_dga_is_running = 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
848 return 0;
13
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
849 }
36314c7bda8d initial version
arpi_esp
parents:
diff changeset
850
7930
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
851 static int dga_depths_init = 0;
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
852
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
853 static int preinit(const char *arg)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
854 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
855 if (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
856 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
857 mp_msg(MSGT_VO, MSGL_INFO, "vo_dga: Unknown subdevice: %s\n", arg);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
858 return ENOSYS;
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4713
diff changeset
859 }
7930
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
860
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
861 if (!vo_init())
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
862 return -1; // Can't open X11
7930
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
863
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
864 if (dga_depths_init == 0)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
865 { // FIXME!?
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
866 int i;
7930
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
867
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
868 vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen);
7930
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
869
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
870 if (vo_dga_XServer_mode == 0)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
871 {
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
872 #ifndef CONFIG_DGA2
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
873 mp_msg(MSGT_VO, MSGL_ERR,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
874 "vo_dga: Your X-Server is not running in a ");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
875 mp_msg(MSGT_VO, MSGL_ERR,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
876 "resolution supported by DGA driver!\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
877 #endif
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
878 } //else{
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
879 // mp_msg(MSGT_VO, MSGL_V, "vo_dga: X running at: %s\n",
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
880 // vd_GetModeString(vo_dga_XServer_mode));
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
881 //}
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
882
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26755
diff changeset
883 #ifdef CONFIG_DGA2
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
884 vo_modelines = XDGAQueryModes(mDisplay, mScreen, &vo_modecount);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
885 if (vo_modelines)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
886 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
887 for (i = 0; i < vo_modecount; i++)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
888 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
889 mp_msg(MSGT_VO, MSGL_V,
17366
934380353fd6 massive attack: mp_msg printf format fixes
rathann
parents: 16301
diff changeset
890 "vo_dga: (%03d) depth=%d, bpp=%d, r=%08lx, g=%08lx, b=%08lx, %d x %d\n",
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
891 i, vo_modelines[i].depth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
892 vo_modelines[i].bitsPerPixel,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
893 vo_modelines[i].redMask, vo_modelines[i].greenMask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
894 vo_modelines[i].blueMask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
895 vo_modelines[i].viewportWidth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
896 vo_modelines[i].viewportHeight);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
897 vd_EnableMode(vo_modelines[i].depth,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
898 vo_modelines[i].bitsPerPixel,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
899 vo_modelines[i].redMask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
900 vo_modelines[i].greenMask,
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
901 vo_modelines[i].blueMask);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
902 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
903 }
7930
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
904 #endif
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
905 dga_depths_init = 1;
7930
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
906
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
907 if (!vo_dga_modes[1].vdm_supported
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
908 && vo_dga_modes[2].vdm_supported)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
909 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
910 vo_dga_modes[1].vdm_supported = 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
911 }
7930
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
912
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
913 if (!vo_dga_modes[3].vdm_supported
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
914 && vo_dga_modes[4].vdm_supported)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
915 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
916 vo_dga_modes[3].vdm_supported = 1;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
917 }
7930
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
918
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
919 for (i = 1; i < vo_dga_mode_num; i++)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
920 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
921 mp_msg(MSGT_VO, MSGL_INFO, "vo_dga: Mode: %s",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
922 vd_GetModeString(i));
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
923 if (vo_dbpp && vo_dbpp != vo_dga_modes[i].vdm_mplayer_depth)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
924 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
925 vo_dga_modes[i].vdm_supported = 0;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
926 mp_msg(MSGT_VO, MSGL_INFO, " ...disabled by -bpp %d",
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
927 vo_dbpp);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
928 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
929 mp_msg(MSGT_VO, MSGL_INFO, "\n");
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
930 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
931 }
7930
a77aff3d7ac0 mode detection && vo_init() moved to preinit()
arpi
parents: 7652
diff changeset
932
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4713
diff changeset
933 return 0;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
934 }
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
935
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
936 static uint32_t get_image(mp_image_t * mpi)
8084
c524ca26ace1 arpi add direct render support
pontscho
parents: 8067
diff changeset
937 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
938 if (!IMGFMT_IS_BGR(mpi->imgfmt) ||
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
939 (IMGFMT_BGR_DEPTH(mpi->imgfmt) !=
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
940 vo_dga_modes[vo_dga_hw_mode].vdm_mplayer_depth)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
941 || (mpi->type == MP_IMGTYPE_STATIC && vo_dga_nr_video_buffers > 1)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
942 || (mpi->type == MP_IMGTYPE_IP && vo_dga_nr_video_buffers < 2)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
943 || (mpi->type == MP_IMGTYPE_IPB))
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 26400
diff changeset
944 return VO_FALSE;
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
945
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
946 if ((mpi->flags & MP_IMGFLAG_ACCEPT_STRIDE) ||
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
947 (mpi->flags & MP_IMGFLAG_ACCEPT_WIDTH &&
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
948 ((vo_dga_bytes_per_line + vo_dga_vp_skip) % (mpi->bpp / 8)) == 0)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
949 || (mpi->width * (mpi->bpp / 8) ==
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
950 (vo_dga_bytes_per_line + vo_dga_vp_skip)))
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
951 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
952
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
953 mpi->planes[0] = CURRENT_VIDEO_BUFFER.data + vo_dga_vp_offset;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
954 mpi->stride[0] = vo_dga_bytes_per_line + vo_dga_vp_skip;
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
955 mpi->width =
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
956 (vo_dga_bytes_per_line + vo_dga_vp_skip) / (mpi->bpp / 8);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
957 mpi->flags |= MP_IMGFLAG_DIRECT;
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 26400
diff changeset
958 return VO_TRUE;
8084
c524ca26ace1 arpi add direct render support
pontscho
parents: 8067
diff changeset
959 }
c524ca26ace1 arpi add direct render support
pontscho
parents: 8067
diff changeset
960
26755
46f0b4d34fa1 cosmetics: Remove useless parentheses from from return statements.
diego
parents: 26400
diff changeset
961 return VO_FALSE;
8084
c524ca26ace1 arpi add direct render support
pontscho
parents: 8067
diff changeset
962 }
c524ca26ace1 arpi add direct render support
pontscho
parents: 8067
diff changeset
963
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 32467
diff changeset
964 static int control(uint32_t request, void *data)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
965 {
12582
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
966 switch (request)
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
967 {
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
968 case VOCTRL_GET_IMAGE:
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
969 return get_image(data);
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
970 case VOCTRL_QUERY_FORMAT:
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
971 return query_format(*((uint32_t *) data));
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
972 }
162c80b2d432 major reindentation of x11 code try #2
attila
parents: 11183
diff changeset
973 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
974 }
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
975
260
1742ea658d0b Source cleanup. Improved resolution selection (I think :-)).
acki2
parents: 233
diff changeset
976 //---------------------------------------------------------