annotate vidix/mga_vid.c @ 36052:caf1f563e0ee

Remove all gtk_widget_set_name() calls. This is probably a leftover from the very early days and has very probably never been used.
author ib
date Thu, 04 Apr 2013 10:53:20 +0000
parents 8773e8565983
children 945eab072c9d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1 /*
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
2 * VIDIX driver for Matrox chipsets.
26718
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 25504
diff changeset
3 *
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
4 * Copyright (C) 2002 Alex Beregszaszi
26718
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 25504
diff changeset
5 * Original sources from Aaron Holtzman (C) 1999.
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 25504
diff changeset
6 * module skeleton based on gutted agpgart module by Jeff Hartmann
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 25504
diff changeset
7 * <slicer@ionet.net>
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 25504
diff changeset
8 * YUY2 support and double buffering added by A'rpi/ESP-team
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 25504
diff changeset
9 * brightness/contrast support by Nick Kurshev/Dariush Pietrzak (eyck)
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
10 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
11 * This file is part of MPlayer.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
12 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
13 * MPlayer is free software; you can redistribute it and/or modify
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
14 * it under the terms of the GNU General Public License as published by
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
15 * the Free Software Foundation; either version 2 of the License, or
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
16 * (at your option) any later version.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
17 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
18 * MPlayer is distributed in the hope that it will be useful,
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
21 * GNU General Public License for more details.
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
22 *
26719
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
23 * You should have received a copy of the GNU General Public License along
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
24 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26718
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 25504
diff changeset
26 */
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 25504
diff changeset
27
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 25504
diff changeset
28 /* TODO:
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
29 * - fix memory size detection (current reading pci userconfig isn't
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
30 * working as requested - returns the max avail. ram on arch?)
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
31 * - translate all non-english comments to english
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
32 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
33
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
34 //#define CRTC2
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
35
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
36 // Set this value, if autodetection fails! (video ram size in megabytes)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
37 //#define MGA_MEMORY_SIZE 16
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
38
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
39 /* No irq support in userspace implemented yet, do not enable this! */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
40 /* disable irq */
28363
7baa7292f575 Fix warnings about undefined preprocessor directives.
diego
parents: 28232
diff changeset
41 #define MGA_ALLOW_IRQ 0
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
42
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
43 #define MGA_VSYNC_POS 2
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
44
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
45 #undef MGA_PCICONFIG_MEMDETECT
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
46
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
47 #define MGA_DEFAULT_FRAMES 4
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
48
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
49 #include <errno.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
50 #include <stdio.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
51 #include <stdlib.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
52 #include <string.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
53 #include <math.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
54 #include <inttypes.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
55
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
56 #include "vidix.h"
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
57 #include "fourcc.h"
22901
a7605669b114 renamed libdha.[hc] to dha.[hc]
ben
parents: 22900
diff changeset
58 #include "dha.h"
22900
a9e111b88c4a merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents: 22874
diff changeset
59 #include "pci_ids.h"
a9e111b88c4a merged libdha and libvidix, moved all files from libdha to vidix directory
ben
parents: 22874
diff changeset
60 #include "pci_names.h"
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
61
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
62 #ifdef __MINGW32__
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
63 #define ENOTSUP 134
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
64 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
65
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
66 #if !defined(ENOTSUP) && defined(EOPNOTSUPP)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
67 #define ENOTSUP EOPNOTSUPP
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
68 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
69
33324
8773e8565983 Simplify macros and get rid of incorrect casts from pointers to
reimar
parents: 31834
diff changeset
70 #define GETREG(TYPE,PTR) (*(volatile TYPE*)(PTR))
8773e8565983 Simplify macros and get rid of incorrect casts from pointers to
reimar
parents: 31834
diff changeset
71 #define SETREG(TYPE,PTR,VAL) (*(volatile TYPE*)(PTR))=VAL
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
72
33324
8773e8565983 Simplify macros and get rid of incorrect casts from pointers to
reimar
parents: 31834
diff changeset
73 #define readb(addr) GETREG(uint8_t,addr)
8773e8565983 Simplify macros and get rid of incorrect casts from pointers to
reimar
parents: 31834
diff changeset
74 #define writeb(val,addr) SETREG(uint8_t,addr,val)
8773e8565983 Simplify macros and get rid of incorrect casts from pointers to
reimar
parents: 31834
diff changeset
75 #define readl(addr) GETREG(uint32_t,addr)
8773e8565983 Simplify macros and get rid of incorrect casts from pointers to
reimar
parents: 31834
diff changeset
76 #define writel(val,addr) SETREG(uint32_t,addr,val)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
77
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
78 static int mga_verbose = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
79
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
80 /* for device detection */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
81 static int probed = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
82 static pciinfo_t pci_info;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
83
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
84 /* internal booleans */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
85 static int mga_vid_in_use = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
86 static int is_g400 = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
87 static int vid_src_ready = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
88 static int vid_overlay_on = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
89
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
90 /* mapped physical addresses */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
91 static uint8_t *mga_mmio_base = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
92 static uint8_t *mga_mem_base = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
93
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
94 static int mga_src_base = 0; /* YUV buffer position in video memory */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
95
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
96 static uint32_t mga_ram_size = 0; /* how much megabytes videoram we have */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
97
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
98 /* Graphic keys */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
99 static vidix_grkey_t mga_grkey;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
100
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
101 static int colkey_saved = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
102 static int colkey_on = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
103 static unsigned char colkey_color[4];
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
104 static unsigned char colkey_mask[4];
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
105
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
106 /* for IRQ */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
107 static int mga_irq = -1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
108
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
109 static int mga_next_frame = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
110
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
111 static vidix_capability_t mga_cap =
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
112 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
113 "Matrox MGA G200/G4x0/G5x0 YUV Video",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
114 "Aaron Holtzman, Arpad Gereoffy, Alex Beregszaszi, Nick Kurshev",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
115 TYPE_OUTPUT,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
116 { 0, 0, 0, 0 },
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
117 2048,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
118 2048,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
119 4,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
120 4,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
121 -1,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
122 FLAG_UPSCALER | FLAG_DOWNSCALER | FLAG_EQUALIZER,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
123 VENDOR_MATROX,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
124 -1, /* will be set in vixProbe */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
125 { 0, 0, 0, 0}
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
126 };
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
127
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
128 /* MATROX BES registers */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
129 typedef struct bes_registers_s
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
130 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
131 //BES Control
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
132 uint32_t besctl;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
133 //BES Global control
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
134 uint32_t besglobctl;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
135 //Luma control (brightness and contrast)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
136 uint32_t beslumactl;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
137 //Line pitch
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
138 uint32_t bespitch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
139
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
140 //Buffer A-1 Chroma 3 plane org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
141 uint32_t besa1c3org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
142 //Buffer A-1 Chroma org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
143 uint32_t besa1corg;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
144 //Buffer A-1 Luma org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
145 uint32_t besa1org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
146
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
147 //Buffer A-2 Chroma 3 plane org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
148 uint32_t besa2c3org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
149 //Buffer A-2 Chroma org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
150 uint32_t besa2corg;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
151 //Buffer A-2 Luma org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
152 uint32_t besa2org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
153
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
154 //Buffer B-1 Chroma 3 plane org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
155 uint32_t besb1c3org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
156 //Buffer B-1 Chroma org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
157 uint32_t besb1corg;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
158 //Buffer B-1 Luma org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
159 uint32_t besb1org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
160
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
161 //Buffer B-2 Chroma 3 plane org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
162 uint32_t besb2c3org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
163 //Buffer B-2 Chroma org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
164 uint32_t besb2corg;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
165 //Buffer B-2 Luma org
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
166 uint32_t besb2org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
167
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
168 //BES Horizontal coord
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
169 uint32_t beshcoord;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
170 //BES Horizontal inverse scaling [5.14]
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
171 uint32_t beshiscal;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
172 //BES Horizontal source start [10.14] (for scaling)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
173 uint32_t beshsrcst;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
174 //BES Horizontal source ending [10.14] (for scaling)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
175 uint32_t beshsrcend;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
176 //BES Horizontal source last
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
177 uint32_t beshsrclst;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
178
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
179
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
180 //BES Vertical coord
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
181 uint32_t besvcoord;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
182 //BES Vertical inverse scaling [5.14]
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
183 uint32_t besviscal;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
184 //BES Field 1 vertical source last position
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
185 uint32_t besv1srclst;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
186 //BES Field 1 weight start
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
187 uint32_t besv1wght;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
188 //BES Field 2 vertical source last position
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
189 uint32_t besv2srclst;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
190 //BES Field 2 weight start
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
191 uint32_t besv2wght;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
192
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
193 } bes_registers_t;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
194 static bes_registers_t regs;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
195
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
196 #ifdef CRTC2
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
197 typedef struct crtc2_registers_s
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
198 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
199 uint32_t c2ctl;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
200 uint32_t c2datactl;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
201 uint32_t c2misc;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
202 uint32_t c2hparam;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
203 uint32_t c2hsync;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
204 uint32_t c2offset;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
205 uint32_t c2pl2startadd0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
206 uint32_t c2pl2startadd1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
207 uint32_t c2pl3startadd0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
208 uint32_t c2pl3startadd1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
209 uint32_t c2preload;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
210 uint32_t c2spicstartadd0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
211 uint32_t c2spicstartadd1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
212 uint32_t c2startadd0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
213 uint32_t c2startadd1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
214 uint32_t c2subpiclut;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
215 uint32_t c2vcount;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
216 uint32_t c2vparam;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
217 uint32_t c2vsync;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
218 } crtc2_registers_t;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
219 static crtc2_registers_t cregs;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
220 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
221
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
222 //All register offsets are converted to word aligned offsets (32 bit)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
223 //because we want all our register accesses to be 32 bits
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
224 #define VCOUNT 0x1e20
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
225
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
226 #define PALWTADD 0x3c00 // Index register for X_DATAREG port
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
227 #define X_DATAREG 0x3c0a
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
228
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
229 #define XMULCTRL 0x19
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
230 #define BPP_8 0x00
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
231 #define BPP_15 0x01
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
232 #define BPP_16 0x02
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
233 #define BPP_24 0x03
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
234 #define BPP_32_DIR 0x04
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
235 #define BPP_32_PAL 0x07
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
236
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
237 #define XCOLMSK 0x40
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
238 #define X_COLKEY 0x42
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
239 #define XKEYOPMODE 0x51
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
240 #define XCOLMSK0RED 0x52
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
241 #define XCOLMSK0GREEN 0x53
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
242 #define XCOLMSK0BLUE 0x54
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
243 #define XCOLKEY0RED 0x55
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
244 #define XCOLKEY0GREEN 0x56
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
245 #define XCOLKEY0BLUE 0x57
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
246
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
247 #ifdef CRTC2
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
248 /*CRTC2 registers*/
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
249 #define XMISCCTRL 0x1e
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
250 #define C2CTL 0x3c10
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
251 #define C2DATACTL 0x3c4c
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
252 #define C2MISC 0x3c44
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
253 #define C2HPARAM 0x3c14
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
254 #define C2HSYNC 0x3c18
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
255 #define C2OFFSET 0x3c40
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
256 #define C2PL2STARTADD0 0x3c30 // like BESA1CORG
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
257 #define C2PL2STARTADD1 0x3c34 // like BESA2CORG
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
258 #define C2PL3STARTADD0 0x3c38 // like BESA1C3ORG
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
259 #define C2PL3STARTADD1 0x3c3c // like BESA2C3ORG
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
260 #define C2PRELOAD 0x3c24
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
261 #define C2SPICSTARTADD0 0x3c54
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
262 #define C2SPICSTARTADD1 0x3c58
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
263 #define C2STARTADD0 0x3c28 // like BESA1ORG
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
264 #define C2STARTADD1 0x3c2c // like BESA2ORG
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
265 #define C2SUBPICLUT 0x3c50
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
266 #define C2VCOUNT 0x3c48
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
267 #define C2VPARAM 0x3c1c
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
268 #define C2VSYNC 0x3c20
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
269 #endif /* CRTC2 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
270
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
271 // Backend Scaler registers
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
272 #define BESCTL 0x3d20
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
273 #define BESGLOBCTL 0x3dc0
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
274 #define BESLUMACTL 0x3d40
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
275 #define BESPITCH 0x3d24
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
276
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
277 #define BESA1C3ORG 0x3d60
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
278 #define BESA1CORG 0x3d10
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
279 #define BESA1ORG 0x3d00
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
280
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
281 #define BESA2C3ORG 0x3d64
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
282 #define BESA2CORG 0x3d14
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
283 #define BESA2ORG 0x3d04
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
284
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
285 #define BESB1C3ORG 0x3d68
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
286 #define BESB1CORG 0x3d18
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
287 #define BESB1ORG 0x3d08
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
288
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
289 #define BESB2C3ORG 0x3d6C
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
290 #define BESB2CORG 0x3d1C
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
291 #define BESB2ORG 0x3d0C
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
292
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
293 #define BESHCOORD 0x3d28
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
294 #define BESHISCAL 0x3d30
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
295 #define BESHSRCEND 0x3d3C
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
296 #define BESHSRCLST 0x3d50
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
297 #define BESHSRCST 0x3d38
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
298 #define BESV1WGHT 0x3d48
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
299 #define BESV2WGHT 0x3d4c
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
300 #define BESV1SRCLST 0x3d54
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
301 #define BESV2SRCLST 0x3d58
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
302 #define BESVISCAL 0x3d34
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
303 #define BESVCOORD 0x3d2c
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
304 #define BESSTATUS 0x3dc4
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
305
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
306 #define CRTCX 0x1fd4
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
307 #define CRTCD 0x1fd5
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
308 #define IEN 0x1e1c
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
309 #define ICLEAR 0x1e18
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
310 #define STATUS 0x1e14
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
311
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
312
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
313 #ifdef CRTC2
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
314 static void crtc2_frame_sel(int frame)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
315 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
316 switch(frame) {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
317 case 0:
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
318 cregs.c2pl2startadd0=regs.besa1corg;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
319 cregs.c2pl3startadd0=regs.besa1c3org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
320 cregs.c2startadd0=regs.besa1org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
321 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
322 case 1:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
323 cregs.c2pl2startadd0=regs.besa2corg;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
324 cregs.c2pl3startadd0=regs.besa2c3org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
325 cregs.c2startadd0=regs.besa2org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
326 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
327 case 2:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
328 cregs.c2pl2startadd0=regs.besb1corg;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
329 cregs.c2pl3startadd0=regs.besb1c3org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
330 cregs.c2startadd0=regs.besb1org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
331 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
332 case 3:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
333 cregs.c2pl2startadd0=regs.besb2corg;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
334 cregs.c2pl3startadd0=regs.besb2c3org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
335 cregs.c2startadd0=regs.besb2org;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
336 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
337 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
338 writel(cregs.c2startadd0, mga_mmio_base + C2STARTADD0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
339 writel(cregs.c2pl2startadd0, mga_mmio_base + C2PL2STARTADD0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
340 writel(cregs.c2pl3startadd0, mga_mmio_base + C2PL3STARTADD0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
341 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
342 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
343
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
344 static int mga_frame_select(unsigned int frame)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
345 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
346 mga_next_frame = frame;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
347 if (mga_verbose>1) printf("[mga] frameselect: %d\n", mga_next_frame);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
348 #if MGA_ALLOW_IRQ
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
349 if (mga_irq == -1)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
350 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
351 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
352 //we don't need the vcount protection as we're only hitting
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
353 //one register (and it doesn't seem to be double buffered)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
354 regs.besctl = (regs.besctl & ~0x07000000) + (mga_next_frame << 25);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
355 writel( regs.besctl, mga_mmio_base + BESCTL );
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
356
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
357 // writel( regs.besglobctl + ((readl(mga_mmio_base + VCOUNT)+2)<<16),
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
358 writel( regs.besglobctl + (MGA_VSYNC_POS<<16),
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
359 mga_mmio_base + BESGLOBCTL);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
360 #ifdef CRTC2
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
361 crtc2_frame_sel(mga_next_frame);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
362 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
363 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
364
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
365 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
366 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
367
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
368
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
369 static void mga_vid_write_regs(int restore)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
370 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
371 //Make sure internal registers don't get updated until we're done
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
372 writel( (readl(mga_mmio_base + VCOUNT)-1)<<16,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
373 mga_mmio_base + BESGLOBCTL);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
374
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
375 // color or coordinate keying
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
376
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
377 if(restore && colkey_saved){
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
378 // restore it
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
379 colkey_saved=0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
380
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
381 // Set color key registers:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
382 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
383 writeb( colkey_on, mga_mmio_base + X_DATAREG);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
384
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
385 writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
386 writeb( colkey_color[0], mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
387 writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
388 writeb( colkey_color[1], mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
389 writeb( XCOLKEY0BLUE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
390 writeb( colkey_color[2], mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
391 writeb( X_COLKEY, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
392 writeb( colkey_color[3], mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
393
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
394 writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
395 writeb( colkey_mask[0], mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
396 writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
397 writeb( colkey_mask[1], mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
398 writeb( XCOLMSK0BLUE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
399 writeb( colkey_mask[2], mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
400 writeb( XCOLMSK, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
401 writeb( colkey_mask[3], mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
402
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
403 } else if(!colkey_saved){
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
404 // save it
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
405 colkey_saved=1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
406 // Get color key registers:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
407 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
408 colkey_on=(unsigned char)readb(mga_mmio_base + X_DATAREG) & 1;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
409
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
410 writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
411 colkey_color[0]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
412 writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
413 colkey_color[1]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
414 writeb( XCOLKEY0BLUE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
415 colkey_color[2]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
416 writeb( X_COLKEY, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
417 colkey_color[3]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
418
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
419 writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
420 colkey_mask[0]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
421 writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
422 colkey_mask[1]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
423 writeb( XCOLMSK0BLUE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
424 colkey_mask[2]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
425 writeb( XCOLMSK, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
426 colkey_mask[3]=(unsigned char)readb(mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
427 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
428
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
429 if(!restore){
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
430 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
431 writeb( mga_grkey.ckey.op == CKEY_TRUE, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
432 if ( mga_grkey.ckey.op == CKEY_TRUE )
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
433 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
434 uint32_t r=0, g=0, b=0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
435
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
436 writeb( XMULCTRL, mga_mmio_base + PALWTADD);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
437 switch (readb (mga_mmio_base + X_DATAREG))
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
438 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
439 case BPP_8:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
440 /* Need to look up the color index, just using
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
441 color 0 for now. */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
442 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
443
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
444 case BPP_15:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
445 r = mga_grkey.ckey.red >> 3;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
446 g = mga_grkey.ckey.green >> 3;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
447 b = mga_grkey.ckey.blue >> 3;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
448 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
449
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
450 case BPP_16:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
451 r = mga_grkey.ckey.red >> 3;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
452 g = mga_grkey.ckey.green >> 2;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
453 b = mga_grkey.ckey.blue >> 3;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
454 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
455
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
456 case BPP_24:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
457 case BPP_32_DIR:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
458 case BPP_32_PAL:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
459 r = mga_grkey.ckey.red;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
460 g = mga_grkey.ckey.green;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
461 b = mga_grkey.ckey.blue;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
462 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
463 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
464
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
465 // Enable colorkeying
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
466 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
467 writeb( 1, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
468
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
469 // Disable color keying on alpha channel
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
470 writeb( XCOLMSK, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
471 writeb( 0x00, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
472 writeb( X_COLKEY, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
473 writeb( 0x00, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
474
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
475
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
476 // Set up color key registers
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
477 writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
478 writeb( r, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
479 writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
480 writeb( g, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
481 writeb( XCOLKEY0BLUE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
482 writeb( b, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
483
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
484 // Set up color key mask registers
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
485 writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
486 writeb( 0xff, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
487 writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
488 writeb( 0xff, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
489 writeb( XCOLMSK0BLUE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
490 writeb( 0xff, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
491 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
492 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
493 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
494 // Disable colorkeying
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
495 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
496 writeb( 0, mga_mmio_base + X_DATAREG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
497 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
498 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
499
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
500 // Backend Scaler
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
501 writel( regs.besctl, mga_mmio_base + BESCTL);
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
502 if(is_g400)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
503 writel( regs.beslumactl, mga_mmio_base + BESLUMACTL);
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
504 writel( regs.bespitch, mga_mmio_base + BESPITCH);
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
505
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
506 writel( regs.besa1org, mga_mmio_base + BESA1ORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
507 writel( regs.besa1corg, mga_mmio_base + BESA1CORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
508 writel( regs.besa2org, mga_mmio_base + BESA2ORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
509 writel( regs.besa2corg, mga_mmio_base + BESA2CORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
510 writel( regs.besb1org, mga_mmio_base + BESB1ORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
511 writel( regs.besb1corg, mga_mmio_base + BESB1CORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
512 writel( regs.besb2org, mga_mmio_base + BESB2ORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
513 writel( regs.besb2corg, mga_mmio_base + BESB2CORG);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
514 if(is_g400)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
515 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
516 writel( regs.besa1c3org, mga_mmio_base + BESA1C3ORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
517 writel( regs.besa2c3org, mga_mmio_base + BESA2C3ORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
518 writel( regs.besb1c3org, mga_mmio_base + BESB1C3ORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
519 writel( regs.besb2c3org, mga_mmio_base + BESB2C3ORG);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
520 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
521
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
522 writel( regs.beshcoord, mga_mmio_base + BESHCOORD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
523 writel( regs.beshiscal, mga_mmio_base + BESHISCAL);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
524 writel( regs.beshsrcst, mga_mmio_base + BESHSRCST);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
525 writel( regs.beshsrcend, mga_mmio_base + BESHSRCEND);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
526 writel( regs.beshsrclst, mga_mmio_base + BESHSRCLST);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
527
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
528 writel( regs.besvcoord, mga_mmio_base + BESVCOORD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
529 writel( regs.besviscal, mga_mmio_base + BESVISCAL);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
530
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
531 writel( regs.besv1srclst, mga_mmio_base + BESV1SRCLST);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
532 writel( regs.besv1wght, mga_mmio_base + BESV1WGHT);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
533 writel( regs.besv2srclst, mga_mmio_base + BESV2SRCLST);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
534 writel( regs.besv2wght, mga_mmio_base + BESV2WGHT);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
535
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
536 //update the registers somewhere between 1 and 2 frames from now.
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
537 writel( regs.besglobctl + ((readl(mga_mmio_base + VCOUNT)+2)<<16),
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
538 mga_mmio_base + BESGLOBCTL);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
539
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
540 if (mga_verbose > 1)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
541 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
542 printf("[mga] wrote BES registers\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
543 printf("[mga] BESCTL = 0x%08x\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
544 readl(mga_mmio_base + BESCTL));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
545 printf("[mga] BESGLOBCTL = 0x%08x\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
546 readl(mga_mmio_base + BESGLOBCTL));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
547 printf("[mga] BESSTATUS= 0x%08x\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
548 readl(mga_mmio_base + BESSTATUS));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
549 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
550 #ifdef CRTC2
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
551 writel(((readl(mga_mmio_base + C2CTL) & ~0x03e00000) + (cregs.c2ctl & 0x03e00000)), mga_mmio_base + C2CTL);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
552 writel(((readl(mga_mmio_base + C2DATACTL) & ~0x000000ff) + (cregs.c2datactl & 0x000000ff)), mga_mmio_base + C2DATACTL);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
553 // ctrc2
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
554 // disable CRTC2 acording to specs
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
555 writel(cregs.c2misc, mga_mmio_base + C2MISC);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
556
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
557 if (mga_verbose > 1) printf("[mga] c2offset = %d\n",cregs.c2offset);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
558
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
559 writel(cregs.c2offset, mga_mmio_base + C2OFFSET);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
560 writel(cregs.c2startadd0, mga_mmio_base + C2STARTADD0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
561 writel(cregs.c2pl2startadd0, mga_mmio_base + C2PL2STARTADD0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
562 writel(cregs.c2pl3startadd0, mga_mmio_base + C2PL3STARTADD0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
563 writel(cregs.c2spicstartadd0, mga_mmio_base + C2SPICSTARTADD0);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
564 #endif
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
565 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
566
28363
7baa7292f575 Fix warnings about undefined preprocessor directives.
diego
parents: 28232
diff changeset
567 #if MGA_ALLOW_IRQ
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 27079
diff changeset
568 static void enable_irq(void)
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 27079
diff changeset
569 {
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
570 long int cc;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
571
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
572 cc = readl(mga_mmio_base + IEN);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
573
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
574 writeb( 0x11, mga_mmio_base + CRTCX);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
575
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
576 writeb(0x20, mga_mmio_base + CRTCD ); /* clear 0, enable off */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
577 writeb(0x00, mga_mmio_base + CRTCD ); /* enable on */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
578 writeb(0x10, mga_mmio_base + CRTCD ); /* clear = 1 */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
579
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
580 writel( regs.besglobctl , mga_mmio_base + BESGLOBCTL);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
581
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
582 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
583 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
584
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 27079
diff changeset
585 static void disable_irq(void)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
586 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
587 writeb( 0x11, mga_mmio_base + CRTCX);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
588 writeb(0x20, mga_mmio_base + CRTCD ); /* clear 0, enable off */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
589
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
590 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
591 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
592
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
593 void mga_handle_irq(int irq, void *dev_id/*, struct pt_regs *pregs*/) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
594 long int cc;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
595
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
596 if ( irq != -1 ) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
597
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
598 cc = readl(mga_mmio_base + STATUS);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
599 if ( ! (cc & 0x10) ) return; /* vsyncpen */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
600 }
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
601
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
602 regs.besctl = (regs.besctl & ~0x07000000) + (mga_next_frame << 25);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
603 writel( regs.besctl, mga_mmio_base + BESCTL );
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
604
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
605 #ifdef CRTC2
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
606 // sem pridat vyber obrazku !!!!
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
607 crtc2_frame_sel(mga_next_frame);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
608 #endif
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
609
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
610 if ( irq != -1 ) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
611 writeb( 0x11, mga_mmio_base + CRTCX);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
612 writeb( 0, mga_mmio_base + CRTCD );
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
613 writeb( 0x10, mga_mmio_base + CRTCD );
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
614 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
615
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
616 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
617
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
618 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
619 #endif /* MGA_ALLOW_IRQ */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
620
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
621 static int mga_config_playback(vidix_playback_t *config)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
622 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
623 unsigned int i;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
624 int x, y, sw, sh, dw, dh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
625 int besleft, bestop, ifactor, ofsleft, ofstop, baseadrofs, weight, weights;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
626 #ifdef CRTC2
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
627 #define right_margin 0
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
628 #define left_margin 18
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
629 #define hsync_len 46
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
630 #define lower_margin 10
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
631 #define vsync_len 4
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
632 #define upper_margin 39
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
633
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
634 unsigned int hdispend = (config->src.w + 31) & ~31;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
635 unsigned int hsyncstart = hdispend + (right_margin & ~7);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
636 unsigned int hsyncend = hsyncstart + (hsync_len & ~7);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
637 unsigned int htotal = hsyncend + (left_margin & ~7);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
638 unsigned int vdispend = config->src.h;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
639 unsigned int vsyncstart = vdispend + lower_margin;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
640 unsigned int vsyncend = vsyncstart + vsync_len;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
641 unsigned int vtotal = vsyncend + upper_margin;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
642 #endif
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
643
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
644 if ((config->num_frames < 1) || (config->num_frames > 4))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
645 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
646 printf("[mga] illegal num_frames: %d, setting to %d\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
647 config->num_frames, MGA_DEFAULT_FRAMES);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
648 config->num_frames = MGA_DEFAULT_FRAMES;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
649 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
650
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
651 x = config->dest.x;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
652 y = config->dest.y;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
653 sw = config->src.w;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
654 sh = config->src.h;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
655 dw = config->dest.w;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
656 dh = config->dest.h;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
657
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
658 config->dest.pitch.y=32;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
659 config->dest.pitch.u=config->dest.pitch.v=32;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
660
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
661 if (mga_verbose) printf("[mga] Setting up a %dx%d-%dx%d video window (src %dx%d) format %X\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
662 dw, dh, x, y, sw, sh, config->fourcc);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
663
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
664 if ((sw < 4) || (sh < 4) || (dw < 4) || (dh < 4))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
665 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
666 printf("[mga] Invalid src/dest dimensions\n");
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
667 return EINVAL;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
668 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
669
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
670 //FIXME check that window is valid and inside desktop
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
671
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
672 sw+=sw&1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
673 switch(config->fourcc)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
674 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
675 case IMGFMT_I420:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
676 case IMGFMT_IYUV:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
677 case IMGFMT_YV12:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
678 sh+=sh&1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
679 config->frame_size = ((sw + 31) & ~31) * sh + (((sw + 31) & ~31) * sh) / 2;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
680 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
681 case IMGFMT_YUY2:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
682 case IMGFMT_UYVY:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
683 config->frame_size = ((sw + 31) & ~31) * sh * 2;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
684 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
685 default:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
686 printf("[mga] Unsupported pixel format: %x\n", config->fourcc);
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
687 return ENOTSUP;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
688 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
689
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
690 config->offsets[0] = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
691 for (i = 1; i < config->num_frames+1; i++)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
692 config->offsets[i] = i*config->frame_size;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
693
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
694 config->offset.y=0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
695 if(config->fourcc == IMGFMT_I420 || config->fourcc == IMGFMT_IYUV)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
696 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
697 config->offset.u=((sw + 31) & ~31) * sh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
698 config->offset.v=config->offset.u+((sw + 31) & ~31) * sh /4;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
699 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
700 else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
701 config->offset.v=((sw + 31) & ~31) * sh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
702 config->offset.u=config->offset.v+((sw + 31) & ~31) * sh /4;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
703 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
704
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
705 mga_src_base = (mga_ram_size*0x100000-config->num_frames*config->frame_size);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
706 if (mga_src_base < 0)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
707 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
708 printf("[mga] not enough memory for frames!\n");
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
709 return EFAULT;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
710 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
711 mga_src_base &= (~0xFFFF); /* 64k boundary */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
712 if (mga_verbose > 1) printf("[mga] YUV buffer base: %#x\n", mga_src_base);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
713
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
714 config->dga_addr = mga_mem_base + mga_src_base;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
715
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
716 /* for G200 set Interleaved UV planes */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
717 if (!is_g400)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
718 config->flags = VID_PLAY_INTERLEAVED_UV | INTERLEAVING_UV;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
719
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
720 //Setup the BES registers for a three plane 4:2:0 video source
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
721
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
722 regs.besglobctl = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
723
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
724 switch(config->fourcc)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
725 {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
726 case IMGFMT_YV12:
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
727 case IMGFMT_I420:
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
728 case IMGFMT_IYUV:
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
729 regs.besctl = 1 // BES enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
730 + (0<<6) // even start polarity
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
731 + (1<<10) // x filtering enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
732 + (1<<11) // y filtering enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
733 + (1<<16) // chroma upsampling
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
734 + (1<<17) // 4:2:0 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
735 + (1<<18); // dither enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
736 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
737
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
738 case IMGFMT_YUY2:
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
739 regs.besctl = 1 // BES enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
740 + (0<<6) // even start polarity
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
741 + (1<<10) // x filtering enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
742 + (1<<11) // y filtering enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
743 + (1<<16) // chroma upsampling
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
744 + (0<<17) // 4:2:2 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
745 + (1<<18); // dither enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
746
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
747 regs.besglobctl = 0; // YUY2 format selected
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
748 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
749
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
750 case IMGFMT_UYVY:
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
751 regs.besctl = 1 // BES enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
752 + (0<<6) // even start polarity
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
753 + (1<<10) // x filtering enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
754 + (1<<11) // y filtering enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
755 + (1<<16) // chroma upsampling
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
756 + (0<<17) // 4:2:2 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
757 + (1<<18); // dither enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
758
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
759 regs.besglobctl = 1<<6; // UYVY format selected
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
760 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
761
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
762 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
763
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
764 //Disable contrast and brightness control
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
765 regs.besglobctl |= (1<<5) + (1<<7);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
766 regs.beslumactl = (0x7f << 16) + (0x80<<0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
767 regs.beslumactl = 0x80<<0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
768
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
769 //Setup destination window boundaries
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
770 besleft = x > 0 ? x : 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
771 bestop = y > 0 ? y : 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
772 regs.beshcoord = (besleft<<16) + (x + dw-1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
773 regs.besvcoord = (bestop<<16) + (y + dh-1);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
774
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
775 //Setup source dimensions
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
776 regs.beshsrclst = (sw - 1) << 16;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
777 regs.bespitch = (sw + 31) & ~31 ;
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
778
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
779 //Setup horizontal scaling
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
780 ifactor = ((sw-1)<<14)/(dw-1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
781 ofsleft = besleft - x;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
782
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
783 regs.beshiscal = ifactor<<2;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
784 regs.beshsrcst = (ofsleft*ifactor)<<2;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
785 regs.beshsrcend = regs.beshsrcst + (((dw - ofsleft - 1) * ifactor) << 2);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
786
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
787 //Setup vertical scaling
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
788 ifactor = ((sh-1)<<14)/(dh-1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
789 ofstop = bestop - y;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
790
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
791 regs.besviscal = ifactor<<2;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
792
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
793 baseadrofs = ((ofstop*regs.besviscal)>>16)*regs.bespitch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
794 regs.besa1org = (uint32_t) mga_src_base + baseadrofs;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
795 regs.besa2org = (uint32_t) mga_src_base + baseadrofs + 1*config->frame_size;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
796 regs.besb1org = (uint32_t) mga_src_base + baseadrofs + 2*config->frame_size;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
797 regs.besb2org = (uint32_t) mga_src_base + baseadrofs + 3*config->frame_size;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
798
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
799 if(config->fourcc==IMGFMT_YV12
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
800 ||config->fourcc==IMGFMT_IYUV
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
801 ||config->fourcc==IMGFMT_I420
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
802 ){
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
803 // planar YUV frames:
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
804 if (is_g400)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
805 baseadrofs = (((ofstop*regs.besviscal)/4)>>16)*regs.bespitch;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
806 else
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
807 baseadrofs = (((ofstop*regs.besviscal)/2)>>16)*regs.bespitch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
808
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
809 if(config->fourcc==IMGFMT_YV12){
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
810 regs.besa1corg = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
811 regs.besa2corg = (uint32_t) mga_src_base + baseadrofs + 1*config->frame_size + regs.bespitch * sh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
812 regs.besb1corg = (uint32_t) mga_src_base + baseadrofs + 2*config->frame_size + regs.bespitch * sh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
813 regs.besb2corg = (uint32_t) mga_src_base + baseadrofs + 3*config->frame_size + regs.bespitch * sh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
814 regs.besa1c3org = regs.besa1corg + ((regs.bespitch * sh) / 4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
815 regs.besa2c3org = regs.besa2corg + ((regs.bespitch * sh) / 4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
816 regs.besb1c3org = regs.besb1corg + ((regs.bespitch * sh) / 4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
817 regs.besb2c3org = regs.besb2corg + ((regs.bespitch * sh) / 4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
818 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
819 regs.besa1c3org = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
820 regs.besa2c3org = (uint32_t) mga_src_base + baseadrofs + 1*config->frame_size + regs.bespitch * sh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
821 regs.besb1c3org = (uint32_t) mga_src_base + baseadrofs + 2*config->frame_size + regs.bespitch * sh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
822 regs.besb2c3org = (uint32_t) mga_src_base + baseadrofs + 3*config->frame_size + regs.bespitch * sh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
823 regs.besa1corg = regs.besa1c3org + ((regs.bespitch * sh) / 4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
824 regs.besa2corg = regs.besa2c3org + ((regs.bespitch * sh) / 4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
825 regs.besb1corg = regs.besb1c3org + ((regs.bespitch * sh) / 4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
826 regs.besb2corg = regs.besb2c3org + ((regs.bespitch * sh) / 4);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
827 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
828
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
829 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
830
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
831 weight = ofstop * (regs.besviscal >> 2);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
832 weights = weight < 0 ? 1 : 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
833 regs.besv2wght = regs.besv1wght = (weights << 16) + ((weight & 0x3FFF) << 2);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
834 regs.besv2srclst = regs.besv1srclst = sh - 1 - (((ofstop * regs.besviscal) >> 16) & 0x03FF);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
835
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
836 #ifdef CRTC2
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
837 // pridat hlavni registry - tj. casovani ...
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
838
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
839
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
840 switch(config->fourcc){
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
841 case IMGFMT_YV12:
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
842 case IMGFMT_I420:
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
843 case IMGFMT_IYUV:
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
844 cregs.c2ctl = 1 // CRTC2 enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
845 + (1<<1) // external clock
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
846 + (0<<2) // external clock
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
847 + (1<<3) // pixel clock enable - not needed ???
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
848 + (0<<4) // high prioryty req
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
849 + (1<<5) // high prioryty req
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
850 + (0<<6) // high prioryty req
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
851 + (1<<8) // high prioryty req max
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
852 + (0<<9) // high prioryty req max
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
853 + (0<<10) // high prioryty req max
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
854 + (0<<20) // CRTC1 to DAC
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
855 + (1<<21) // 420 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
856 + (1<<22) // 420 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
857 + (1<<23) // 420 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
858 + (0<<24) // single chroma line for 420 mode - need to be corrected
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
859 + (0<<25) /*/ interlace mode - need to be corrected*/
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
860 + (0<<26) // field legth polariry
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
861 + (0<<27) // field identification polariry
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
862 + (1<<28) // VIDRST detection mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
863 + (0<<29) // VIDRST detection mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
864 + (1<<30) // Horizontal counter preload
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
865 + (1<<31) // Vertical counter preload
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
866 ;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
867 cregs.c2datactl = 1 // disable dither - propably not needed, we are already in YUV mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
868 + (1<<1) // Y filter enable
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
869 + (1<<2) // CbCr filter enable
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
870 + (0<<3) // subpicture enable (disabled)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
871 + (0<<4) // NTSC enable (disabled - PAL)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
872 + (0<<5) // C2 static subpicture enable (disabled)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
873 + (0<<6) // C2 subpicture offset division (disabled)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
874 + (0<<7) // 422 subformat selection !
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
875 /* + (0<<8) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
876 + (0<<9) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
877 + (0<<10) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
878 + (0<<11) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
879 + (0<<12) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
880 + (0<<13) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
881 + (0<<14) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
882 + (0<<15) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
883 + (0<<16) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
884 + (0<<17) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
885 + (0<<18) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
886 + (0<<19) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
887 + (0<<20) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
888 + (0<<21) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
889 + (0<<22) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
890 + (0<<23) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
891 + (0<<24) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
892 + (0<<25) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
893 + (0<<26) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
894 + (0<<27) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
895 + (0<<28) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
896 */ ;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
897 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
898
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
899 case IMGFMT_YUY2:
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
900 cregs.c2ctl = 1 // CRTC2 enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
901 + (1<<1) // external clock
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
902 + (0<<2) // external clock
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
903 + (1<<3) // pixel clock enable - not needed ???
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
904 + (0<<4) // high prioryty req - acc to spec
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
905 + (1<<5) // high prioryty req
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
906 + (0<<6) // high prioryty req
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
907 // 7 reserved
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
908 + (1<<8) // high prioryty req max
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
909 + (0<<9) // high prioryty req max
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
910 + (0<<10) // high prioryty req max
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
911 // 11-19 reserved
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
912 + (0<<20) // CRTC1 to DAC
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
913 + (1<<21) // 422 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
914 + (0<<22) // 422 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
915 + (1<<23) // 422 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
916 + (0<<24) // single chroma line for 420 mode - need to be corrected
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
917 + (0<<25) /*/ interlace mode - need to be corrected*/
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
918 + (0<<26) // field legth polariry
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
919 + (0<<27) // field identification polariry
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
920 + (1<<28) // VIDRST detection mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
921 + (0<<29) // VIDRST detection mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
922 + (1<<30) // Horizontal counter preload
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
923 + (1<<31) // Vertical counter preload
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
924 ;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
925 cregs.c2datactl = 1 // disable dither - propably not needed, we are already in YUV mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
926 + (1<<1) // Y filter enable
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
927 + (1<<2) // CbCr filter enable
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
928 + (0<<3) // subpicture enable (disabled)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
929 + (0<<4) // NTSC enable (disabled - PAL)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
930 + (0<<5) // C2 static subpicture enable (disabled)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
931 + (0<<6) // C2 subpicture offset division (disabled)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
932 + (0<<7) // 422 subformat selection !
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
933 /* + (0<<8) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
934 + (0<<9) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
935 + (0<<10) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
936 + (0<<11) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
937 + (0<<12) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
938 + (0<<13) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
939 + (0<<14) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
940 + (0<<15) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
941 + (0<<16) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
942 + (0<<17) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
943 + (0<<18) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
944 + (0<<19) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
945 + (0<<20) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
946 + (0<<21) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
947 + (0<<22) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
948 + (0<<23) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
949 + (0<<24) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
950 + (0<<25) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
951 + (0<<26) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
952 + (0<<27) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
953 + (0<<28) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
954 */ ;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
955 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
956
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
957 case IMGFMT_UYVY:
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
958 cregs.c2ctl = 1 // CRTC2 enabled
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
959 + (1<<1) // external clock
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
960 + (0<<2) // external clock
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
961 + (1<<3) // pixel clock enable - not needed ???
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
962 + (0<<4) // high prioryty req
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
963 + (1<<5) // high prioryty req
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
964 + (0<<6) // high prioryty req
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
965 + (1<<8) // high prioryty req max
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
966 + (0<<9) // high prioryty req max
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
967 + (0<<10) // high prioryty req max
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
968 + (0<<20) // CRTC1 to DAC
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
969 + (1<<21) // 422 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
970 + (0<<22) // 422 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
971 + (1<<23) // 422 mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
972 + (1<<24) // single chroma line for 420 mode - need to be corrected
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
973 + (1<<25) /*/ interlace mode - need to be corrected*/
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
974 + (0<<26) // field legth polariry
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
975 + (0<<27) // field identification polariry
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
976 + (1<<28) // VIDRST detection mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
977 + (0<<29) // VIDRST detection mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
978 + (1<<30) // Horizontal counter preload
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
979 + (1<<31) // Vertical counter preload
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
980 ;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
981 cregs.c2datactl = 0 // enable dither - propably not needed, we are already in YUV mode
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
982 + (1<<1) // Y filter enable
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
983 + (1<<2) // CbCr filter enable
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
984 + (0<<3) // subpicture enable (disabled)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
985 + (0<<4) // NTSC enable (disabled - PAL)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
986 + (0<<5) // C2 static subpicture enable (disabled)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
987 + (0<<6) // C2 subpicture offset division (disabled)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
988 + (1<<7) // 422 subformat selection !
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
989 /* + (0<<8) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
990 + (0<<9) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
991 + (0<<10) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
992 + (0<<11) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
993 + (0<<12) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
994 + (0<<13) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
995 + (0<<14) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
996 + (0<<15) // 15 bpp high alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
997 + (0<<16) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
998 + (0<<17) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
999 + (0<<18) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1000 + (0<<19) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1001 + (0<<20) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1002 + (0<<21) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1003 + (0<<22) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1004 + (0<<23) // 15 bpp low alpha
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1005 + (0<<24) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1006 + (0<<25) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1007 + (0<<26) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1008 + (0<<27) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1009 + (0<<28) // static subpicture key
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1010 */ ;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1011 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1012 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1013
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1014 cregs.c2hparam=((hdispend - 8) << 16) | (htotal - 8);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1015 cregs.c2hsync=((hsyncend - 8) << 16) | (hsyncstart - 8);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1016
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1017 cregs.c2misc=0 // CRTCV2 656 togg f0
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1018 +(0<<1) // CRTCV2 656 togg f0
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1019 +(0<<2) // CRTCV2 656 togg f0
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1020 +(0<<4) // CRTCV2 656 togg f1
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1021 +(0<<5) // CRTCV2 656 togg f1
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1022 +(0<<6) // CRTCV2 656 togg f1
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1023 +(0<<8) // Hsync active high
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1024 +(0<<9) // Vsync active high
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1025 // 16-27 c2vlinecomp - nevim co tam dat
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1026 ;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1027 cregs.c2offset=(regs.bespitch << 1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1028
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1029 cregs.c2pl2startadd0=regs.besa1corg;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1030 cregs.c2pl3startadd0=regs.besa1c3org;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1031
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1032 cregs.c2preload=(vsyncstart << 16) | (hsyncstart); // from
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1033
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1034 cregs.c2spicstartadd0=0; // not used
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1035
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1036 cregs.c2startadd0=regs.besa1org;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1037
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1038 cregs.c2subpiclut=0; //not used
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1039
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1040 cregs.c2vparam=((vdispend - 1) << 16) | (vtotal - 1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1041 cregs.c2vsync=((vsyncend - 1) << 16) | (vsyncstart - 1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1042 #endif /* CRTC2 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1043
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1044 mga_vid_write_regs(0);
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1045 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1046 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1047
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1048 static int mga_playback_on(void)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1049 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1050 if (mga_verbose) printf("[mga] playback on\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1051
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1052 vid_src_ready = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1053 if(vid_overlay_on)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1054 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1055 regs.besctl |= 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1056 mga_vid_write_regs(0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1057 }
28363
7baa7292f575 Fix warnings about undefined preprocessor directives.
diego
parents: 28232
diff changeset
1058 #if MGA_ALLOW_IRQ
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1059 if (mga_irq != -1)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1060 enable_irq();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1061 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1062 mga_next_frame=0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1063
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1064 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1065 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1066
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1067 static int mga_playback_off(void)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1068 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1069 if (mga_verbose) printf("[mga] playback off\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1070
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1071 vid_src_ready = 0;
28363
7baa7292f575 Fix warnings about undefined preprocessor directives.
diego
parents: 28232
diff changeset
1072 #if MGA_ALLOW_IRQ
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1073 if (mga_irq != -1)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1074 disable_irq();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1075 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1076 regs.besctl &= ~1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1077 regs.besglobctl &= ~(1<<6); /* UYVY format selected */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1078 mga_vid_write_regs(0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1079
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1080 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1081 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1082
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1083 static int mga_probe(int verbose,int force)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1084 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1085 pciinfo_t lst[MAX_PCI_DEVICES];
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1086 unsigned int i, num_pci;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1087 int err;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1088
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1089 if (verbose) printf("[mga] probe\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1090
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1091 mga_verbose = verbose;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1092
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1093 is_g400 = -1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1094
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1095 err = pci_scan(lst, &num_pci);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1096 if (err)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1097 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1098 printf("[mga] Error occurred during pci scan: %s\n", strerror(err));
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1099 return err;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1100 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1101
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1102 if (mga_verbose)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1103 printf("[mga] found %d pci devices\n", num_pci);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1104
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1105 for (i = 0; i < num_pci; i++)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1106 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1107 if (mga_verbose > 1)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1108 printf("[mga] pci[%d] vendor: %d device: %d\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1109 i, lst[i].vendor, lst[i].device);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1110 if (lst[i].vendor == VENDOR_MATROX)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1111 {
23167
2ab3eac7f6da synced with upstream vidix, prevented some drivers to work on some configs/archs
ben
parents: 23054
diff changeset
1112 #if 0
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1113 if ((lst[i].command & PCI_COMMAND_IO) == 0)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1114 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1115 printf("[mga] Device is disabled, ignoring\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1116 continue;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1117 }
23167
2ab3eac7f6da synced with upstream vidix, prevented some drivers to work on some configs/archs
ben
parents: 23054
diff changeset
1118 #endif
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1119 switch(lst[i].device)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1120 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1121 case DEVICE_MATROX_MGA_G550_AGP:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1122 printf("[mga] Found MGA G550\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1123 is_g400 = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1124 goto card_found;
22874
9a8f6901e888 updated pci ids list, fixed vidix drivers compilation and added nearly exhaustive pci ids for nvidia driver
ben
parents: 22858
diff changeset
1125 case DEVICE_MATROX_MGA_G400_G450:
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1126 printf("[mga] Found MGA G400/G450\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1127 is_g400 = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1128 goto card_found;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1129 case DEVICE_MATROX_MGA_G200_AGP:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1130 printf("[mga] Found MGA G200 AGP\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1131 is_g400 = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1132 goto card_found;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1133 case DEVICE_MATROX_MGA_G200:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1134 printf("[mga] Found MGA G200 PCI\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1135 is_g400 = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1136 goto card_found;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1137 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1138 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1139 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1140
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1141 if (is_g400 == -1)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1142 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1143 if (verbose) printf("[mga] Can't find chip\n");
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1144 return ENXIO;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1145 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1146
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1147 card_found:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1148 probed = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1149 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1150
31834
64ba1daa147a various spelling fixes, found by the Debian QA tool 'lintian'
siretart
parents: 29263
diff changeset
1151 mga_cap.device_id = pci_info.device; /* set device id in capabilities */
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1152
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1153 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1154 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1155
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1156 static int mga_init(void)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1157 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1158 unsigned int card_option = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1159 int err;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1160
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1161 if (mga_verbose) printf("[mga] init\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1162
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1163 mga_vid_in_use = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1164
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1165 printf("Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n");
25504
48441c610249 typo in preprocessor condition
diego
parents: 23167
diff changeset
1166 #ifdef CRTC2
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1167 printf("Driver compiled with TV-out (second-head) support\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1168 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1169
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1170 if (!probed)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1171 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1172 printf("[mga] driver was not probed but is being initializing\n");
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1173 return EINTR;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1174 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1175
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1176 #ifdef MGA_PCICONFIG_MEMDETECT
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1177 pci_config_read(pci_info.bus, pci_info.card, pci_info.func,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1178 0x40, 4, &card_option);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1179 if (mga_verbose > 1) printf("[mga] OPTION word: 0x%08X mem: 0x%02X %s\n", card_option,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1180 (card_option>>10)&0x17, ((card_option>>14)&1)?"SGRAM":"SDRAM");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1181 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1182
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1183 if (mga_ram_size)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1184 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1185 printf("[mga] RAMSIZE forced to %d MB\n", mga_ram_size);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1186 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1187 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1188 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1189 #ifdef MGA_MEMORY_SIZE
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1190 mga_ram_size = MGA_MEMORY_SIZE;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1191 printf("[mga] hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1192 #else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1193 if (is_g400)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1194 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1195 switch((card_option>>10)&0x17)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1196 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1197 // SDRAM:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1198 case 0x00:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1199 case 0x04: mga_ram_size = 16; break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1200 case 0x03: mga_ram_size = 32; break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1201 // SGRAM:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1202 case 0x10:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1203 case 0x14: mga_ram_size = 32; break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1204 case 0x11:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1205 case 0x12: mga_ram_size = 16; break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1206 default:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1207 mga_ram_size = 16;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1208 printf("[mga] Couldn't detect RAMSIZE, assuming 16MB!\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1209 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1210 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1211 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1212 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1213 switch((card_option>>10)&0x17)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1214 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1215 default: mga_ram_size = 8;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1216 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1217 }
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1218
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1219 printf("[mga] detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1220 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1221 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1222
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1223 if (mga_ram_size)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1224 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1225 if ((mga_ram_size < 4) || (mga_ram_size > 64))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1226 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1227 printf("[mga] invalid RAMSIZE: %d MB\n", mga_ram_size);
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1228 return EINVAL;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1229 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1230 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1231
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1232 if (mga_verbose > 1) printf("[mga] hardware addresses: mmio: %#x, framebuffer: %#x\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1233 pci_info.base1, pci_info.base0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1234
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1235 mga_mmio_base = map_phys_mem(pci_info.base1,0x4000);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1236 mga_mem_base = map_phys_mem(pci_info.base0,mga_ram_size*1024*1024);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1237
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1238 if (mga_verbose > 1) printf("[mga] MMIO at %p, IRQ: %d, framebuffer: %p\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1239 mga_mmio_base, mga_irq, mga_mem_base);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1240 err = mtrr_set_type(pci_info.base0,mga_ram_size*1024*1024,MTRR_TYPE_WRCOMB);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1241 if(!err) printf("[mga] Set write-combining type of video memory\n");
28363
7baa7292f575 Fix warnings about undefined preprocessor directives.
diego
parents: 28232
diff changeset
1242 #if MGA_ALLOW_IRQ
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1243 if (mga_irq != -1)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1244 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1245 int tmp = request_irq(mga_irq, mga_handle_irq, SA_INTERRUPT | SA_SHIRQ, "Syncfb Time Base", &mga_irq);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1246 if (tmp)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1247 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1248 printf("syncfb (mga): cannot register irq %d (Err: %d)\n", mga_irq, tmp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1249 mga_irq=-1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1250 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1251 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1252 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1253 printf("syncfb (mga): registered irq %d\n", mga_irq);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1254 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1255 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1256 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1257 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1258 printf("syncfb (mga): No valid irq was found\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1259 mga_irq=-1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1260 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1261 #else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1262 printf("syncfb (mga): IRQ disabled in mga_vid.c\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1263 mga_irq=-1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1264 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1265
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1266 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1267 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1268
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1269 static void mga_destroy(void)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1270 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1271 if (mga_verbose) printf("[mga] destroy\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1272
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1273 /* FIXME turn off BES */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1274 vid_src_ready = 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1275 regs.besctl &= ~1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1276 regs.besglobctl &= ~(1<<6); // UYVY format selected
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1277 mga_vid_write_regs(1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1278 mga_vid_in_use = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1279
28363
7baa7292f575 Fix warnings about undefined preprocessor directives.
diego
parents: 28232
diff changeset
1280 #if MGA_ALLOW_IRQ
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1281 if (mga_irq != -1)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1282 free_irq(mga_irq, &mga_irq);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1283 #endif
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1284
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1285 if (mga_mmio_base)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1286 unmap_phys_mem(mga_mmio_base, 0x4000);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1287 if (mga_mem_base)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1288 unmap_phys_mem(mga_mem_base, mga_ram_size);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1289 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1290 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1291
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1292 static int mga_query_fourcc(vidix_fourcc_t *to)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1293 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1294 if (mga_verbose) printf("[mga] query fourcc (%x)\n", to->fourcc);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1295
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1296 switch(to->fourcc)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1297 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1298 case IMGFMT_YV12:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1299 case IMGFMT_IYUV:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1300 case IMGFMT_I420:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1301 case IMGFMT_YUY2:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1302 case IMGFMT_UYVY:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1303 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1304 default:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1305 to->depth = to->flags = 0;
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1306 return ENOTSUP;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1307 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1308
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1309 to->depth = VID_DEPTH_12BPP |
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1310 VID_DEPTH_15BPP | VID_DEPTH_16BPP |
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1311 VID_DEPTH_24BPP | VID_DEPTH_32BPP;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1312 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1313 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1314 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1315
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1316 static int mga_get_caps(vidix_capability_t *to)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1317 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1318 memcpy(to, &mga_cap, sizeof(vidix_capability_t));
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1319 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1320 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1321
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1322 static int mga_get_gkeys(vidix_grkey_t *grkey)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1323 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1324 memcpy(grkey, &mga_grkey, sizeof(vidix_grkey_t));
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1325 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1326 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1327
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1328 static int mga_set_gkeys(const vidix_grkey_t *grkey)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1329 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1330 memcpy(&mga_grkey, grkey, sizeof(vidix_grkey_t));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1331 mga_vid_write_regs(0);
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1332 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1333 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1334
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1335 static int mga_set_eq( const vidix_video_eq_t * eq)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1336 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1337 /* contrast and brightness control isn't supported on G200 - alex */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1338 if (!is_g400)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1339 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1340 if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n");
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1341 return ENOTSUP;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1342 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1343
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1344 // only brightness&contrast are supported:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1345 if(!(eq->cap & (VEQ_CAP_BRIGHTNESS|VEQ_CAP_CONTRAST)))
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1346 return ENOTSUP;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1347
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1348 //regs.beslumactl = readl(mga_mmio_base + BESLUMACTL);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1349 if (eq->cap & VEQ_CAP_BRIGHTNESS) {
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1350 regs.beslumactl &= 0xFFFF;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1351 regs.beslumactl |= (eq->brightness*255/2000)<<16;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1352 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1353 if (eq->cap & VEQ_CAP_CONTRAST) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1354 regs.beslumactl &= 0xFFFF0000;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1355 regs.beslumactl |= (128+eq->contrast*255/2000)&0xFFFF;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1356 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1357 writel(regs.beslumactl,mga_mmio_base + BESLUMACTL);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1358
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1359 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1360 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1361
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1362 static int mga_get_eq( vidix_video_eq_t * eq)
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1363 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1364 /* contrast and brightness control isn't supported on G200 - alex */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1365 if (!is_g400)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1366 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1367 if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n");
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1368 return ENOTSUP;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1369 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1370
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1371 eq->brightness = (signed short int)(regs.beslumactl >> 16) * 1000 / 128;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1372 eq->contrast = (signed short int)(regs.beslumactl & 0xFFFF) * 1000 / 128 - 1000;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1373 eq->cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1374
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1375 printf("MGA GET_EQ: br=%d c=%d \n",eq->brightness,eq->contrast);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1376
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
1377 return 0;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
1378 }
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1379
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1380 #ifndef CRTC2
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1381 VDXDriver mga_drv = {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1382 "mga",
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1383 #else
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1384 VDXDriver mga_crtc2_drv = {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1385 "mga_crtc2",
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1386 #endif
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1387 NULL,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28363
diff changeset
1388
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1389 .probe = mga_probe,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1390 .get_caps = mga_get_caps,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1391 .query_fourcc = mga_query_fourcc,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1392 .init = mga_init,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1393 .destroy = mga_destroy,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1394 .config_playback = mga_config_playback,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1395 .playback_on = mga_playback_on,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1396 .playback_off = mga_playback_off,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1397 .frame_sel = mga_frame_select,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1398 .get_eq = mga_get_eq,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1399 .set_eq = mga_set_eq,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1400 .get_gkey = mga_get_gkeys,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1401 .set_gkey = mga_set_gkeys,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents: 22850
diff changeset
1402 };