annotate drivers/mga_vid.c @ 1216:4059e05c480a

some info printfs moved stderr->stdout
author arpi_esp
date Sat, 23 Jun 2001 23:38:51 +0000
parents 76ca00724e12
children bddeddc2cf42
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 // YUY2 support (see config.format) added by A'rpi/ESP-team
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
2 // double buffering added by A'rpi/ESP-team
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
3
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
4 // Set this value, if autodetection fails! (video ram size in megabytes)
91
315979891f2d Force matrox memsize module option fixes
lgb
parents: 90
diff changeset
5 // #define MGA_MEMORY_SIZE 16
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
7 //#define MGA_ALLOW_IRQ
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
8
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
9 #define MGA_VSYNC_POS 2
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
10
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * mga_vid.c
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 * Copyright (C) 1999 Aaron Holtzman
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 * Module skeleton based on gutted agpgart module by Jeff Hartmann
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 * <slicer@ionet.net>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 * Matrox MGA G200/G400 YUV Video Interface module Version 0.1.0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 * BES == Back End Scaler
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 * This software has been released under the terms of the GNU Public
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 * license. See http://www.gnu.org/copyleft/gpl.html for details.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 //It's entirely possible this major conflicts with something else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 /* mknod /dev/mga_vid c 178 0 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 #include <linux/config.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 #include <linux/version.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 #include <linux/module.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 #include <linux/types.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 #include <linux/kernel.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 #include <linux/sched.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 #include <linux/mm.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 #include <linux/string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 #include <linux/errno.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 #include <linux/malloc.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 #include <linux/pci.h>
63
6bdaa0626a9b some printk debug level changed
arpi_esp
parents: 61
diff changeset
42 #include <linux/ioport.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 #include <linux/init.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 #include "mga_vid.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 #ifdef CONFIG_MTRR
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 #include <asm/mtrr.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 #include <asm/uaccess.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 #include <asm/system.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 #include <asm/io.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 #define TRUE 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 #define FALSE 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 #define MGA_VID_MAJOR 178
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
60 //#define MGA_VIDMEM_SIZE mga_ram_size
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 #ifndef PCI_DEVICE_ID_MATROX_G200_PCI
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 #define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 #ifndef PCI_DEVICE_ID_MATROX_G200_AGP
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 #define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 #ifndef PCI_DEVICE_ID_MATROX_G400
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 #define PCI_DEVICE_ID_MATROX_G400 0x0525
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 MODULE_AUTHOR("Aaron Holtzman <aholtzma@engr.uvic.ca>");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 typedef struct bes_registers_s
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 //BES Control
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 uint32_t besctl;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 //BES Global control
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 uint32_t besglobctl;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 //Luma control (brightness and contrast)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 uint32_t beslumactl;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 //Line pitch
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 uint32_t bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 //Buffer A-1 Chroma 3 plane org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 uint32_t besa1c3org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 //Buffer A-1 Chroma org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 uint32_t besa1corg;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 //Buffer A-1 Luma org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 uint32_t besa1org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 //Buffer A-2 Chroma 3 plane org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 uint32_t besa2c3org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 //Buffer A-2 Chroma org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 uint32_t besa2corg;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 //Buffer A-2 Luma org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 uint32_t besa2org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 //Buffer B-1 Chroma 3 plane org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 uint32_t besb1c3org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 //Buffer B-1 Chroma org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 uint32_t besb1corg;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 //Buffer B-1 Luma org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 uint32_t besb1org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 //Buffer B-2 Chroma 3 plane org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 uint32_t besb2c3org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 //Buffer B-2 Chroma org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 uint32_t besb2corg;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 //Buffer B-2 Luma org
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 uint32_t besb2org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 //BES Horizontal coord
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 uint32_t beshcoord;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 //BES Horizontal inverse scaling [5.14]
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 uint32_t beshiscal;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 //BES Horizontal source start [10.14] (for scaling)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 uint32_t beshsrcst;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 //BES Horizontal source ending [10.14] (for scaling)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 uint32_t beshsrcend;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124 //BES Horizontal source last
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 uint32_t beshsrclst;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 //BES Vertical coord
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 uint32_t besvcoord;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 //BES Vertical inverse scaling [5.14]
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 uint32_t besviscal;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 //BES Field 1 vertical source last position
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 uint32_t besv1srclst;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 //BES Field 1 weight start
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 uint32_t besv1wght;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 //BES Field 2 vertical source last position
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 uint32_t besv2srclst;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 //BES Field 2 weight start
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 uint32_t besv2wght;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 } bes_registers_t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 static bes_registers_t regs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 static uint32_t mga_vid_in_use = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 static uint32_t is_g400 = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 static uint32_t vid_src_ready = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 static uint32_t vid_overlay_on = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 static uint8_t *mga_mmio_base = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 static uint32_t mga_mem_base = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
152 static int mga_src_base = 0; // YUV buffer position in video memory
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
153
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
154 static uint32_t mga_ram_size = 0; // how much megabytes videoram we have
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155
95
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
156 //static int mga_force_memsize = 0;
90
b97d1e5fddea mga_force_memsize parameter added
szabii
parents: 77
diff changeset
157
95
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
158 MODULE_PARM(mga_ram_size, "i");
90
b97d1e5fddea mga_force_memsize parameter added
szabii
parents: 77
diff changeset
159
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 static struct pci_dev *pci_dev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 static mga_vid_config_t mga_config;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
164 static int mga_irq = -1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 //All register offsets are converted to word aligned offsets (32 bit)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 //because we want all our register accesses to be 32 bits
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 #define VCOUNT 0x1e20
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 #define PALWTADD 0x3c00 // Index register for X_DATAREG port
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 #define X_DATAREG 0x3c0a
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 #define XMULCTRL 0x19
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 #define BPP_8 0x00
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 #define BPP_15 0x01
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 #define BPP_16 0x02
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 #define BPP_24 0x03
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 #define BPP_32_DIR 0x04
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 #define BPP_32_PAL 0x07
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 #define XCOLMSK 0x40
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 #define X_COLKEY 0x42
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 #define XKEYOPMODE 0x51
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 #define XCOLMSK0RED 0x52
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 #define XCOLMSK0GREEN 0x53
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 #define XCOLMSK0BLUE 0x54
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 #define XCOLKEY0RED 0x55
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 #define XCOLKEY0GREEN 0x56
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 #define XCOLKEY0BLUE 0x57
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 // Backend Scaler registers
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 #define BESCTL 0x3d20
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 #define BESGLOBCTL 0x3dc0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 #define BESLUMACTL 0x3d40
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 #define BESPITCH 0x3d24
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
196
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 #define BESA1C3ORG 0x3d60
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 #define BESA1CORG 0x3d10
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 #define BESA1ORG 0x3d00
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
200
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 #define BESA2C3ORG 0x3d64
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 #define BESA2CORG 0x3d14
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 #define BESA2ORG 0x3d04
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
204
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 #define BESB1C3ORG 0x3d68
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 #define BESB1CORG 0x3d18
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 #define BESB1ORG 0x3d08
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
208
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 #define BESB2C3ORG 0x3d6C
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 #define BESB2CORG 0x3d1C
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 #define BESB2ORG 0x3d0C
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
212
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 #define BESHCOORD 0x3d28
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 #define BESHISCAL 0x3d30
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 #define BESHSRCEND 0x3d3C
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 #define BESHSRCLST 0x3d50
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 #define BESHSRCST 0x3d38
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 #define BESV1WGHT 0x3d48
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 #define BESV2WGHT 0x3d4c
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 #define BESV1SRCLST 0x3d54
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 #define BESV2SRCLST 0x3d58
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 #define BESVISCAL 0x3d34
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 #define BESVCOORD 0x3d2c
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 #define BESSTATUS 0x3dc4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
226 #define CRTCX 0x1fd4
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
227 #define CRTCD 0x1fd5
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
228 #define IEN 0x1e1c
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
229 #define ICLEAR 0x1e18
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
230 #define STATUS 0x1e14
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
231
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
232 static int mga_next_frame=0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 static void mga_vid_frame_sel(int frame)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 {
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
236 if ( mga_irq != -1 ) {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
237 mga_next_frame=frame;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
238 } else {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
239
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 //we don't need the vcount protection as we're only hitting
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 //one register (and it doesn't seem to be double buffered)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 regs.besctl = (regs.besctl & ~0x07000000) + (frame << 25);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 writel( regs.besctl, mga_mmio_base + BESCTL );
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
244
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
245 // writel( regs.besglobctl + ((readl(mga_mmio_base + VCOUNT)+2)<<16),
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
246 writel( regs.besglobctl + (MGA_VSYNC_POS<<16),
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
247 mga_mmio_base + BESGLOBCTL);
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
248
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
249 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 static void mga_vid_write_regs(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255 //Make sure internal registers don't get updated until we're done
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 writel( (readl(mga_mmio_base + VCOUNT)-1)<<16,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 mga_mmio_base + BESGLOBCTL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 // color or coordinate keying
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 writeb( XKEYOPMODE, mga_mmio_base + PALWTADD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 writeb( mga_config.colkey_on, mga_mmio_base + X_DATAREG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262 if ( mga_config.colkey_on )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 uint32_t r=0, g=0, b=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 writeb( XMULCTRL, mga_mmio_base + PALWTADD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 switch (readb (mga_mmio_base + X_DATAREG))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 case BPP_8:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 /* Need to look up the color index, just using
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 color 0 for now. */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274 case BPP_15:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275 r = mga_config.colkey_red >> 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 g = mga_config.colkey_green >> 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277 b = mga_config.colkey_blue >> 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
278 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280 case BPP_16:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281 r = mga_config.colkey_red >> 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282 g = mga_config.colkey_green >> 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283 b = mga_config.colkey_blue >> 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 case BPP_24:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287 case BPP_32_DIR:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288 case BPP_32_PAL:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 r = mga_config.colkey_red;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 g = mga_config.colkey_green;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291 b = mga_config.colkey_blue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 // Disable color keying on alpha channel
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 writeb( XCOLMSK, mga_mmio_base + PALWTADD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 writeb( 0x00, mga_mmio_base + X_DATAREG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 writeb( X_COLKEY, mga_mmio_base + PALWTADD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 writeb( 0x00, mga_mmio_base + X_DATAREG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 // Set up color key registers
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 writeb( XCOLKEY0RED, mga_mmio_base + PALWTADD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303 writeb( r, mga_mmio_base + X_DATAREG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 writeb( XCOLKEY0GREEN, mga_mmio_base + PALWTADD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305 writeb( g, mga_mmio_base + X_DATAREG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306 writeb( XCOLKEY0BLUE, mga_mmio_base + PALWTADD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 writeb( b, mga_mmio_base + X_DATAREG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 // Set up color key mask registers
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310 writeb( XCOLMSK0RED, mga_mmio_base + PALWTADD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 writeb( 0xff, mga_mmio_base + X_DATAREG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 writeb( XCOLMSK0GREEN, mga_mmio_base + PALWTADD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 writeb( 0xff, mga_mmio_base + X_DATAREG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 writeb( XCOLMSK0BLUE, mga_mmio_base + PALWTADD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 writeb( 0xff, mga_mmio_base + X_DATAREG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
317
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 // Backend Scaler
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319 writel( regs.besctl, mga_mmio_base + BESCTL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320 if(is_g400)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 writel( regs.beslumactl, mga_mmio_base + BESLUMACTL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322 writel( regs.bespitch, mga_mmio_base + BESPITCH);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 writel( regs.besa1org, mga_mmio_base + BESA1ORG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 writel( regs.besa1corg, mga_mmio_base + BESA1CORG);
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
326 writel( regs.besa2org, mga_mmio_base + BESA2ORG);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
327 writel( regs.besa2corg, mga_mmio_base + BESA2CORG);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 writel( regs.besb1org, mga_mmio_base + BESB1ORG);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 writel( regs.besb1corg, mga_mmio_base + BESB1CORG);
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
330 writel( regs.besb2org, mga_mmio_base + BESB2ORG);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
331 writel( regs.besb2corg, mga_mmio_base + BESB2CORG);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 if(is_g400)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 writel( regs.besa1c3org, mga_mmio_base + BESA1C3ORG);
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
335 writel( regs.besa2c3org, mga_mmio_base + BESA2C3ORG);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336 writel( regs.besb1c3org, mga_mmio_base + BESB1C3ORG);
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
337 writel( regs.besb2c3org, mga_mmio_base + BESB2C3ORG);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 writel( regs.beshcoord, mga_mmio_base + BESHCOORD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 writel( regs.beshiscal, mga_mmio_base + BESHISCAL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 writel( regs.beshsrcst, mga_mmio_base + BESHSRCST);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 writel( regs.beshsrcend, mga_mmio_base + BESHSRCEND);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344 writel( regs.beshsrclst, mga_mmio_base + BESHSRCLST);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
345
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 writel( regs.besvcoord, mga_mmio_base + BESVCOORD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 writel( regs.besviscal, mga_mmio_base + BESVISCAL);
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
348
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349 writel( regs.besv1srclst, mga_mmio_base + BESV1SRCLST);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350 writel( regs.besv1wght, mga_mmio_base + BESV1WGHT);
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
351 writel( regs.besv2srclst, mga_mmio_base + BESV2SRCLST);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
352 writel( regs.besv2wght, mga_mmio_base + BESV2WGHT);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 //update the registers somewhere between 1 and 2 frames from now.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355 writel( regs.besglobctl + ((readl(mga_mmio_base + VCOUNT)+2)<<16),
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 mga_mmio_base + BESGLOBCTL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
357
77
9bbba5880f70 printk's updated
arpi_esp
parents: 75
diff changeset
358 #if 0
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
359 printk(KERN_DEBUG "mga_vid: wrote BES registers\n");
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
360 printk(KERN_DEBUG "mga_vid: BESCTL = 0x%08x\n",
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
361 readl(mga_mmio_base + BESCTL));
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
362 printk(KERN_DEBUG "mga_vid: BESGLOBCTL = 0x%08x\n",
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 readl(mga_mmio_base + BESGLOBCTL));
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
364 printk(KERN_DEBUG "mga_vid: BESSTATUS= 0x%08x\n",
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365 readl(mga_mmio_base + BESSTATUS));
77
9bbba5880f70 printk's updated
arpi_esp
parents: 75
diff changeset
366 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369 static int mga_vid_set_config(mga_vid_config_t *config)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
370 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371 int x, y, sw, sh, dw, dh;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 int besleft, bestop, ifactor, ofsleft, ofstop, baseadrofs, weight, weights;
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
373 int frame_size=config->frame_size;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 x = config->x_org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 y = config->y_org;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376 sw = config->src_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 sh = config->src_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 dw = config->dest_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379 dh = config->dest_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
381 printk(KERN_DEBUG "mga_vid: Setting up a %dx%d+%d+%d video window (src %dx%d) format %X\n",
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 dw, dh, x, y, sw, sh, config->format);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384 //FIXME check that window is valid and inside desktop
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386 //FIXME figure out a better way to allocate memory on card
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387 //allocate 2 megs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388 //mga_src_base = mga_mem_base + (MGA_VIDMEM_SIZE-2) * 0x100000;
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
389 //mga_src_base = (MGA_VIDMEM_SIZE-3) * 0x100000;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
391
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 //Setup the BES registers for a three plane 4:2:0 video source
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
393
466
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
394 regs.besglobctl = 0;
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
395
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
396 switch(config->format){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 case MGA_VID_FORMAT_YV12:
470
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
398 case MGA_VID_FORMAT_I420:
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
399 case MGA_VID_FORMAT_IYUV:
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400 regs.besctl = 1 // BES enabled
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401 + (0<<6) // even start polarity
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 + (1<<10) // x filtering enabled
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
403 + (1<<11) // y filtering enabled
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
404 + (1<<16) // chroma upsampling
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
405 + (1<<17) // 4:2:0 mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
406 + (1<<18); // dither enabled
466
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
407 #if 0
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
408 if(is_g400)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
409 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
410 //zoom disabled, zoom filter disabled, 420 3 plane format, proc amp
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
411 //disabled, rgb mode disabled
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
412 regs.besglobctl = (1<<5);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
413 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
415 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
416 //zoom disabled, zoom filter disabled, Cb samples in 0246, Cr
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 //in 1357, BES register update on besvcnt
466
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
418 regs.besglobctl = 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419 }
466
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
420 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
421 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
422
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
423 case MGA_VID_FORMAT_YUY2:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
424 regs.besctl = 1 // BES enabled
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
425 + (0<<6) // even start polarity
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
426 + (1<<10) // x filtering enabled
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
427 + (1<<11) // y filtering enabled
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
428 + (1<<16) // chroma upsampling
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
429 + (0<<17) // 4:2:2 mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
430 + (1<<18); // dither enabled
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
431
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
432 regs.besglobctl = 0; // YUY2 format selected
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
433 break;
466
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
434
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
435 case MGA_VID_FORMAT_UYVY:
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
436 regs.besctl = 1 // BES enabled
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
437 + (0<<6) // even start polarity
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
438 + (1<<10) // x filtering enabled
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
439 + (1<<11) // y filtering enabled
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
440 + (1<<16) // chroma upsampling
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
441 + (0<<17) // 4:2:2 mode
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
442 + (1<<18); // dither enabled
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
443
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
444 regs.besglobctl = 1<<6; // UYVY format selected
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
445 break;
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
446
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
447 default:
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
448 printk(KERN_ERR "mga_vid: Unsupported pixel format: 0x%X\n",config->format);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
449 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
453 //Disable contrast and brightness control
466
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
454 regs.besglobctl |= (1<<5) + (1<<7);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
455 regs.beslumactl = (0x7f << 16) + (0x80<<0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
456 regs.beslumactl = 0x80<<0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
457
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
458 //Setup destination window boundaries
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
459 besleft = x > 0 ? x : 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
460 bestop = y > 0 ? y : 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
461 regs.beshcoord = (besleft<<16) + (x + dw-1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
462 regs.besvcoord = (bestop<<16) + (y + dh-1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
463
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
464 //Setup source dimensions
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
465 regs.beshsrclst = (sw - 1) << 16;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
466 regs.bespitch = (sw + 31) & ~31 ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
467
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
468 //Setup horizontal scaling
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
469 ifactor = ((sw-1)<<14)/(dw-1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
470 ofsleft = besleft - x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
471
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
472 regs.beshiscal = ifactor<<2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
473 regs.beshsrcst = (ofsleft*ifactor)<<2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
474 regs.beshsrcend = regs.beshsrcst + (((dw - ofsleft - 1) * ifactor) << 2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
475
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
476 //Setup vertical scaling
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
477 ifactor = ((sh-1)<<14)/(dh-1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
478 ofstop = bestop - y;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
479
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
480 regs.besviscal = ifactor<<2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
481
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
482 baseadrofs = ((ofstop*regs.besviscal)>>16)*regs.bespitch;
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
483 //frame_size = ((sw + 31) & ~31) * sh + (((sw + 31) & ~31) * sh) / 2;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
484 regs.besa1org = (uint32_t) mga_src_base + baseadrofs;
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
485 regs.besa2org = (uint32_t) mga_src_base + baseadrofs + 1*frame_size;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
486 regs.besb1org = (uint32_t) mga_src_base + baseadrofs + 2*frame_size;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
487 regs.besb2org = (uint32_t) mga_src_base + baseadrofs + 3*frame_size;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
488
470
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
489 if(config->format==MGA_VID_FORMAT_YV12
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
490 ||config->format==MGA_VID_FORMAT_IYUV
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
491 ||config->format==MGA_VID_FORMAT_I420
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
492 ){
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
493 // planar YUV frames:
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
494 if (is_g400)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
495 baseadrofs = (((ofstop*regs.besviscal)/4)>>16)*regs.bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
496 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
497 baseadrofs = (((ofstop*regs.besviscal)/2)>>16)*regs.bespitch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
498
470
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
499 if(config->format==MGA_VID_FORMAT_YV12){
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
500 regs.besa1corg = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ;
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
501 regs.besa2corg = (uint32_t) mga_src_base + baseadrofs + 1*frame_size + regs.bespitch * sh;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
502 regs.besb1corg = (uint32_t) mga_src_base + baseadrofs + 2*frame_size + regs.bespitch * sh;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
503 regs.besb2corg = (uint32_t) mga_src_base + baseadrofs + 3*frame_size + regs.bespitch * sh;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
504 regs.besa1c3org = regs.besa1corg + ((regs.bespitch * sh) / 4);
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
505 regs.besa2c3org = regs.besa2corg + ((regs.bespitch * sh) / 4);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
506 regs.besb1c3org = regs.besb1corg + ((regs.bespitch * sh) / 4);
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
507 regs.besb2c3org = regs.besb2corg + ((regs.bespitch * sh) / 4);
470
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
508 } else {
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
509 regs.besa1c3org = (uint32_t) mga_src_base + baseadrofs + regs.bespitch * sh ;
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
510 regs.besa2c3org = (uint32_t) mga_src_base + baseadrofs + 1*frame_size + regs.bespitch * sh;
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
511 regs.besb1c3org = (uint32_t) mga_src_base + baseadrofs + 2*frame_size + regs.bespitch * sh;
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
512 regs.besb2c3org = (uint32_t) mga_src_base + baseadrofs + 3*frame_size + regs.bespitch * sh;
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
513 regs.besa1corg = regs.besa1c3org + ((regs.bespitch * sh) / 4);
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
514 regs.besa2corg = regs.besa2c3org + ((regs.bespitch * sh) / 4);
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
515 regs.besb1corg = regs.besb1c3org + ((regs.bespitch * sh) / 4);
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
516 regs.besb2corg = regs.besb2c3org + ((regs.bespitch * sh) / 4);
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
517 }
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 466
diff changeset
518
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
519 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
520
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
521 weight = ofstop * (regs.besviscal >> 2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
522 weights = weight < 0 ? 1 : 0;
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
523 regs.besv2wght = regs.besv1wght = (weights << 16) + ((weight & 0x3FFF) << 2);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
524 regs.besv2srclst = regs.besv1srclst = sh - 1 - (((ofstop * regs.besviscal) >> 16) & 0x03FF);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
525
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
526 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
527 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
528 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
529
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
530 #ifdef MGA_ALLOW_IRQ
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
531
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
532 static void enable_irq(){
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
533 long int cc;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
534
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
535 cc = readl(mga_mmio_base + IEN);
63
6bdaa0626a9b some printk debug level changed
arpi_esp
parents: 61
diff changeset
536 // printk(KERN_ALERT "*** !!! IRQREG = %d\n", (int)(cc&0xff));
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
537
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
538 writeb( 0x11, mga_mmio_base + CRTCX);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
539
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
540 writeb(0x20, mga_mmio_base + CRTCD ); /* clear 0, enable off */
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
541 writeb(0x00, mga_mmio_base + CRTCD ); /* enable on */
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
542 writeb(0x10, mga_mmio_base + CRTCD ); /* clear = 1 */
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
543
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
544 writel( regs.besglobctl , mga_mmio_base + BESGLOBCTL);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
545
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
546 }
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
547
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
548 static void disable_irq(){
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
549
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
550 writeb( 0x11, mga_mmio_base + CRTCX);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
551 writeb(0x20, mga_mmio_base + CRTCD ); /* clear 0, enable off */
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
552
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
553 }
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
554
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
555 void mga_handle_irq(int irq, void *dev_id, struct pt_regs *pregs) {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
556 // static int frame=0;
854
76ca00724e12 gcc warnings fixed - patch by Aelius aelius@wish.net
arpi_esp
parents: 662
diff changeset
557 // static int counter=0;
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
558 long int cc;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
559 // if ( ! mga_enabled_flag ) return;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
560
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
561 // printk(KERN_DEBUG "vcount = %d\n",readl(mga_mmio_base + VCOUNT));
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
562
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
563 //printk("mga_interrupt #%d\n", irq);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
564
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
565 if ( irq != -1 ) {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
566
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
567 cc = readl(mga_mmio_base + STATUS);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
568 if ( ! (cc & 0x10) ) return; /* vsyncpen */
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
569 // debug_irqcnt++;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
570 }
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
571
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
572 // if ( debug_irqignore ) {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
573 // debug_irqignore = 0;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
574
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
575
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
576 /*
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
577 if ( mga_conf_deinterlace ) {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
578 if ( mga_first_field ) {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
579 // printk("mga_interrupt first field\n");
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
580 if ( syncfb_interrupt() )
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
581 mga_first_field = 0;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
582 } else {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
583 // printk("mga_interrupt second field\n");
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
584 mga_select_buffer( mga_current_field | 2 );
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
585 mga_first_field = 1;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
586 }
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
587 } else {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
588 syncfb_interrupt();
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
589 }
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
590 */
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
591
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
592 // frame=(frame+1)&1;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
593 regs.besctl = (regs.besctl & ~0x07000000) + (mga_next_frame << 25);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
594 writel( regs.besctl, mga_mmio_base + BESCTL );
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
595
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
596 #if 0
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
597 ++counter;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
598 if(!(counter&63)){
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
599 printk("mga irq counter = %d\n",counter);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
600 }
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
601 #endif
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
602
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
603 // } else {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
604 // debug_irqignore = 1;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
605 // }
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
606
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
607 if ( irq != -1 ) {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
608 writeb( 0x11, mga_mmio_base + CRTCX);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
609 writeb( 0, mga_mmio_base + CRTCD );
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
610 writeb( 0x10, mga_mmio_base + CRTCD );
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
611 }
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
612
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
613 // writel( regs.besglobctl, mga_mmio_base + BESGLOBCTL);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
614
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
615
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
616 return;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
617
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
618 }
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
619
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
620 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
621
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
622 static int mga_vid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
623 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
624 int frame;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
625
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
626 switch(cmd)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
627 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
628 case MGA_VID_CONFIG:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
629 //FIXME remove
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
630 // printk(KERN_DEBUG "vcount = %d\n",readl(mga_mmio_base + VCOUNT));
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
631 printk(KERN_DEBUG "mga_mmio_base = %p\n",mga_mmio_base);
854
76ca00724e12 gcc warnings fixed - patch by Aelius aelius@wish.net
arpi_esp
parents: 662
diff changeset
632 printk(KERN_DEBUG "mga_mem_base = %08x\n",mga_mem_base);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
633 //FIXME remove
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
634
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
635 printk(KERN_DEBUG "mga_vid: Received configuration\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
636
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
637 if(copy_from_user(&mga_config,(mga_vid_config_t*) arg,sizeof(mga_vid_config_t)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
638 {
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
639 printk(KERN_ERR "mga_vid: failed copy from userspace\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
640 return(-EFAULT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
641 }
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
642 if(mga_config.version != MGA_VID_VERSION){
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
643 printk(KERN_ERR "mga_vid: incompatible version! driver: %X requested: %X\n",MGA_VID_VERSION,mga_config.version);
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
644 return(-EFAULT);
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
645 }
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
646
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
647 if(mga_config.frame_size==0 || mga_config.frame_size>1024*768*2){
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
648 printk(KERN_ERR "mga_vid: illegal frame_size: %d\n",mga_config.frame_size);
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
649 return(-EFAULT);
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
650 }
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
651
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
652 if(mga_config.num_frames<1 || mga_config.num_frames>4){
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
653 printk(KERN_ERR "mga_vid: illegal num_frames: %d\n",mga_config.num_frames);
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
654 return(-EFAULT);
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
655 }
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
656
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
657 mga_src_base = (mga_ram_size*0x100000-mga_config.num_frames*mga_config.frame_size);
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
658 if(mga_src_base<0){
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
659 printk(KERN_ERR "mga_vid: not enough memory for frames!\n");
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
660 return(-EFAULT);
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
661 }
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
662 mga_src_base &= (~0xFFFF); // 64k boundary
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
663 printk(KERN_DEBUG "mga YUV buffer base: 0x%X\n", mga_src_base);
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
664
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
665 if (is_g400)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
666 mga_config.card_type = MGA_G400;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
667 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
668 mga_config.card_type = MGA_G200;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
669
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
670 mga_config.ram_size = mga_ram_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
671
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
672 if (copy_to_user((mga_vid_config_t *) arg, &mga_config, sizeof(mga_vid_config_t)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
673 {
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
674 printk(KERN_ERR "mga_vid: failed copy to userspace\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
675 return(-EFAULT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
676 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
677 return mga_vid_set_config(&mga_config);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
678 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
679
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
680 case MGA_VID_ON:
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
681 printk(KERN_DEBUG "mga_vid: Video ON\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
682 vid_src_ready = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
683 if(vid_overlay_on)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
684 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
685 regs.besctl |= 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
686 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
687 }
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
688 #ifdef MGA_ALLOW_IRQ
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
689 if ( mga_irq != -1 ) enable_irq();
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
690 #endif
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
691 mga_next_frame=0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
692 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
693
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
694 case MGA_VID_OFF:
94
fbd99740af99 printk() message for video off when releasing mga without ioctl()
lgb
parents: 93
diff changeset
695 printk(KERN_DEBUG "mga_vid: Video OFF (ioctl)\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
696 vid_src_ready = 0;
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
697 #ifdef MGA_ALLOW_IRQ
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
698 if ( mga_irq != -1 ) disable_irq();
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
699 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
700 regs.besctl &= ~1;
466
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
701 regs.besglobctl &= ~(1<<6); // UYVY format selected
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
702 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
703 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
704
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
705 case MGA_VID_FSEL:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
706 if(copy_from_user(&frame,(int *) arg,sizeof(int)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
707 {
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
708 printk(KERN_ERR "mga_vid: FSEL failed copy from userspace\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
709 return(-EFAULT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
710 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
711
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
712 mga_vid_frame_sel(frame);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
713 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
714
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
715 default:
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
716 printk(KERN_ERR "mga_vid: Invalid ioctl\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
717 return (-EINVAL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
718 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
719
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
720 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
721 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
722
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
723
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
724 static int mga_vid_find_card(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
725 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
726 struct pci_dev *dev = NULL;
854
76ca00724e12 gcc warnings fixed - patch by Aelius aelius@wish.net
arpi_esp
parents: 662
diff changeset
727 unsigned int card_option;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
728
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
729 if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G400, NULL)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
730 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
731 is_g400 = 1;
77
9bbba5880f70 printk's updated
arpi_esp
parents: 75
diff changeset
732 printk(KERN_INFO "mga_vid: Found MGA G400/G450\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
733 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
734 else if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G200_AGP, NULL)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
735 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
736 is_g400 = 0;
63
6bdaa0626a9b some printk debug level changed
arpi_esp
parents: 61
diff changeset
737 printk(KERN_INFO "mga_vid: Found MGA G200 AGP\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
738 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
739 else if((dev = pci_find_device(PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G200_PCI, NULL)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
740 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
741 is_g400 = 0;
63
6bdaa0626a9b some printk debug level changed
arpi_esp
parents: 61
diff changeset
742 printk(KERN_INFO "mga_vid: Found MGA G200 PCI\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
743 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
744 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
745 {
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
746 printk(KERN_ERR "mga_vid: No supported cards found\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
747 return FALSE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
748 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
749
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
750 pci_dev = dev;
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
751
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
752 mga_irq = pci_dev->irq;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
753
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
754 #if LINUX_VERSION_CODE >= 0x020300
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
755 mga_mmio_base = ioremap_nocache(dev->resource[1].start,0x4000);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
756 mga_mem_base = dev->resource[0].start;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
757 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
758 mga_mmio_base = ioremap_nocache(dev->base_address[1] & PCI_BASE_ADDRESS_MEM_MASK,0x4000);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
759 mga_mem_base = dev->base_address[0] & PCI_BASE_ADDRESS_MEM_MASK;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
760 #endif
854
76ca00724e12 gcc warnings fixed - patch by Aelius aelius@wish.net
arpi_esp
parents: 662
diff changeset
761 printk(KERN_INFO "mga_vid: MMIO at 0x%p IRQ: %d framebuffer: 0x%08X\n", mga_mmio_base, mga_irq, mga_mem_base);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
762
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
763 pci_read_config_dword(dev, 0x40, &card_option);
77
9bbba5880f70 printk's updated
arpi_esp
parents: 75
diff changeset
764 printk(KERN_INFO "mga_vid: OPTION word: 0x%08X mem: 0x%02X %s\n", card_option,
9bbba5880f70 printk's updated
arpi_esp
parents: 75
diff changeset
765 (card_option>>10)&0x17, ((card_option>>14)&1)?"SGRAM":"SDRAM");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
766
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
767 // temp = (card_option >> 10) & 0x17;
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
768
95
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
769 if (mga_ram_size) {
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
770 printk(KERN_INFO "mga_vid: RAMSIZE forced to %d MB\n", mga_ram_size);
91
315979891f2d Force matrox memsize module option fixes
lgb
parents: 90
diff changeset
771 } else {
90
b97d1e5fddea mga_force_memsize parameter added
szabii
parents: 77
diff changeset
772
101
7fe6855f19cd mga_ram_size=x works with hard-coded ramsize too (szabi)
arpi_esp
parents: 95
diff changeset
773 #ifdef MGA_MEMORY_SIZE
7fe6855f19cd mga_ram_size=x works with hard-coded ramsize too (szabi)
arpi_esp
parents: 95
diff changeset
774 mga_ram_size = MGA_MEMORY_SIZE;
7fe6855f19cd mga_ram_size=x works with hard-coded ramsize too (szabi)
arpi_esp
parents: 95
diff changeset
775 printk(KERN_INFO "mga_vid: hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
7fe6855f19cd mga_ram_size=x works with hard-coded ramsize too (szabi)
arpi_esp
parents: 95
diff changeset
776
7fe6855f19cd mga_ram_size=x works with hard-coded ramsize too (szabi)
arpi_esp
parents: 95
diff changeset
777 #else
7fe6855f19cd mga_ram_size=x works with hard-coded ramsize too (szabi)
arpi_esp
parents: 95
diff changeset
778
95
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
779 if (is_g400){
75
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
780 switch((card_option>>10)&0x17){
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
781 // SDRAM:
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
782 case 0x00:
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
783 case 0x04: mga_ram_size = 16; break;
105
1e09830f2e96 G400 32MB SDRAM fixed
arpi_esp
parents: 102
diff changeset
784 case 0x03: mga_ram_size = 32; break;
75
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
785 // SGRAM:
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
786 case 0x10:
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
787 case 0x14: mga_ram_size = 32; break;
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
788 case 0x11:
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
789 case 0x12: mga_ram_size = 16; break;
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
790 default:
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
791 mga_ram_size = 16;
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
792 printk(KERN_INFO "mga_vid: Couldn't detect RAMSIZE, assuming 16MB!");
e1cd3bdbea86 ramsize detection updated, test again\!
arpi_esp
parents: 68
diff changeset
793 }
95
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
794 }else{
662
4a959b73d51e G200 ramsize detection disabled, using 8M by default
arpi_esp
parents: 470
diff changeset
795 switch((card_option>>10)&0x17){
4a959b73d51e G200 ramsize detection disabled, using 8M by default
arpi_esp
parents: 470
diff changeset
796 // case 0x10:
4a959b73d51e G200 ramsize detection disabled, using 8M by default
arpi_esp
parents: 470
diff changeset
797 // case 0x13: mga_ram_size = 8; break;
4a959b73d51e G200 ramsize detection disabled, using 8M by default
arpi_esp
parents: 470
diff changeset
798 default: mga_ram_size = 8;
64
62ec382fd6aa new RAMSIZE detection code... test it\!
arpi_esp
parents: 63
diff changeset
799 }
95
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
800 }
64
62ec382fd6aa new RAMSIZE detection code... test it\!
arpi_esp
parents: 63
diff changeset
801 #if 0
95
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
802 // printk("List resources -----------\n");
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
803 for(temp=0;temp<DEVICE_COUNT_RESOURCE;temp++){
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
804 struct resource *res=&pci_dev->resource[temp];
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
805 if(res->flags){
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
806 int size=(1+res->end-res->start)>>20;
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
807 printk(KERN_DEBUG "res %d: start: 0x%X end: 0x%X (%d MB) flags=0x%X\n",temp,res->start,res->end,size,res->flags);
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
808 if(res->flags&(IORESOURCE_MEM|IORESOURCE_PREFETCH)){
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
809 if(size>mga_ram_size && size<=64) mga_ram_size=size;
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
810 }
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
811 }
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
812 }
64
62ec382fd6aa new RAMSIZE detection code... test it\!
arpi_esp
parents: 63
diff changeset
813 #endif
95
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
814 printk(KERN_INFO "mga_vid: detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
101
7fe6855f19cd mga_ram_size=x works with hard-coded ramsize too (szabi)
arpi_esp
parents: 95
diff changeset
815 #endif
95
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
816 }
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
817
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
818
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
819 #ifdef MGA_ALLOW_IRQ
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
820 if ( mga_irq != -1 ) {
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
821 int tmp = request_irq(mga_irq, mga_handle_irq, SA_INTERRUPT | SA_SHIRQ, "Syncfb Time Base", &mga_irq);
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
822 if ( tmp ) {
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
823 printk(KERN_INFO "syncfb (mga): cannot register irq %d (Err: %d)\n", mga_irq, tmp);
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
824 mga_irq=-1;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
825 } else {
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
826 printk(KERN_DEBUG "syncfb (mga): registered irq %d\n", mga_irq);
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
827 }
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
828 } else {
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
829 printk(KERN_INFO "syncfb (mga): No valid irq was found\n");
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
830 mga_irq=-1;
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
831 }
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
832 #else
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
833 printk(KERN_INFO "syncfb (mga): IRQ disabled in mga_vid.c\n");
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
834 mga_irq=-1;
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
835 #endif
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
836
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
837 return TRUE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
838 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
839
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
840
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
841 static ssize_t mga_vid_read(struct file *file, char *buf, size_t count, loff_t *ppos)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
842 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
843 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
844 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
845
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
846 static ssize_t mga_vid_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
847 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
848 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
849 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
850
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
851 static int mga_vid_mmap(struct file *file, struct vm_area_struct *vma)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
852 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
853
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
854 printk(KERN_DEBUG "mga_vid: mapping video memory into userspace\n");
57
baa0a12438eb config interface changed
arpi_esp
parents: 48
diff changeset
855 if(remap_page_range(vma->vm_start, mga_mem_base + mga_src_base,
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
856 vma->vm_end - vma->vm_start, vma->vm_page_prot))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
857 {
63
6bdaa0626a9b some printk debug level changed
arpi_esp
parents: 61
diff changeset
858 printk(KERN_ERR "mga_vid: error mapping video memory\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
859 return(-EAGAIN);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
860 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
861
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
862 return(0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
863 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
864
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
865 static int mga_vid_release(struct inode *inode, struct file *file)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
866 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
867 //Close the window just in case
94
fbd99740af99 printk() message for video off when releasing mga without ioctl()
lgb
parents: 93
diff changeset
868 printk(KERN_DEBUG "mga_vid: Video OFF (release)\n");
fbd99740af99 printk() message for video off when releasing mga without ioctl()
lgb
parents: 93
diff changeset
869
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
870 vid_src_ready = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
871 regs.besctl &= ~1;
466
c7c03bf70bb7 UYVY support
arpi_esp
parents: 105
diff changeset
872 regs.besglobctl &= ~(1<<6); // UYVY format selected
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
873 mga_vid_write_regs();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
874 mga_vid_in_use = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
875
93
9b1462feadcb Module usage count not to allow remove module when used
lgb
parents: 91
diff changeset
876 MOD_DEC_USE_COUNT;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
877 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
878 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
879
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
880 static long long mga_vid_lseek(struct file *file, long long offset, int origin)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
881 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
882 return -ESPIPE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
883 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
884
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
885 static int mga_vid_open(struct inode *inode, struct file *file)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
886 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
887 int minor = MINOR(inode->i_rdev);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
888
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
889 if(minor != 0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
890 return(-ENXIO);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
891
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
892 if(mga_vid_in_use == 1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
893 return(-EBUSY);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
894
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
895 mga_vid_in_use = 1;
93
9b1462feadcb Module usage count not to allow remove module when used
lgb
parents: 91
diff changeset
896 MOD_INC_USE_COUNT;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
897 return(0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
898 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
899
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
900 #if LINUX_VERSION_CODE >= 0x020400
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
901 static struct file_operations mga_vid_fops =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
902 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
903 llseek: mga_vid_lseek,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
904 read: mga_vid_read,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
905 write: mga_vid_write,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
906 ioctl: mga_vid_ioctl,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
907 mmap: mga_vid_mmap,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
908 open: mga_vid_open,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
909 release: mga_vid_release
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
910 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
911 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
912 static struct file_operations mga_vid_fops =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
913 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
914 mga_vid_lseek,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
915 mga_vid_read,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
916 mga_vid_write,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
917 NULL,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
918 NULL,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
919 mga_vid_ioctl,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
920 mga_vid_mmap,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
921 mga_vid_open,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
922 NULL,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
923 mga_vid_release
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
924 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
925 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
926
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
927
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
928 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
929 * Main Initialization Function
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
930 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
931
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
932 static int mga_vid_initialize(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
933 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
934 mga_vid_in_use = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
935
77
9bbba5880f70 printk's updated
arpi_esp
parents: 75
diff changeset
936 // printk(KERN_INFO "Matrox MGA G200/G400 YUV Video interface v0.01 (c) Aaron Holtzman \n");
9bbba5880f70 printk's updated
arpi_esp
parents: 75
diff changeset
937 printk(KERN_INFO "Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n");
90
b97d1e5fddea mga_force_memsize parameter added
szabii
parents: 77
diff changeset
938
95
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
939 if (mga_ram_size) {
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
940 if (mga_ram_size<4 || mga_ram_size>64) {
2c2d82db06ef mga_force_memsize->mga_ram_size
arpi_esp
parents: 94
diff changeset
941 printk(KERN_ERR "mga_vid: invalid RAMSIZE: %d MB\n", mga_ram_size);
90
b97d1e5fddea mga_force_memsize parameter added
szabii
parents: 77
diff changeset
942 return -EINVAL;
b97d1e5fddea mga_force_memsize parameter added
szabii
parents: 77
diff changeset
943 }
b97d1e5fddea mga_force_memsize parameter added
szabii
parents: 77
diff changeset
944 }
b97d1e5fddea mga_force_memsize parameter added
szabii
parents: 77
diff changeset
945
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
946 if(register_chrdev(MGA_VID_MAJOR, "mga_vid", &mga_vid_fops))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
947 {
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
948 printk(KERN_ERR "mga_vid: unable to get major: %d\n", MGA_VID_MAJOR);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
949 return -EIO;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
950 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
951
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
952 if (!mga_vid_find_card())
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
953 {
61
2a89b5b3ab39 printk() loglevel fix
szabii
parents: 57
diff changeset
954 printk(KERN_ERR "mga_vid: no supported devices found\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
955 unregister_chrdev(MGA_VID_MAJOR, "mga_vid");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
956 return -EINVAL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
957 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
958
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
959 return(0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
960 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
961
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
962 int init_module(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
963 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
964 return mga_vid_initialize();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
965 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
966
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
967 void cleanup_module(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
968 {
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
969
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
970 #ifdef MGA_ALLOW_IRQ
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
971 if ( mga_irq != -1)
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
972 free_irq(mga_irq, &mga_irq);
68
001286db4e90 IRQ handler disabled, vcount-based vsync
arpi_esp
parents: 64
diff changeset
973 #endif
48
66ae768fe0ea vsync (4 buffers) implemented
arpi_esp
parents: 42
diff changeset
974
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
975 if(mga_mmio_base)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
976 iounmap(mga_mmio_base);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
977
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
978 //FIXME turn off BES
63
6bdaa0626a9b some printk debug level changed
arpi_esp
parents: 61
diff changeset
979 printk(KERN_INFO "mga_vid: Cleaning up module\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
980 unregister_chrdev(MGA_VID_MAJOR, "mga_vid");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
981 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
982