annotate drivers/tdfx_vid.c @ 32778:9404cb19e08d

Print a message when lavc subtitle decoding fails.
author reimar
date Sun, 06 Feb 2011 14:03:10 +0000
parents 0f1b5b68af32
children 1495455e6d22
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26003
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
1 /*
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
2 * Copyright (C) 2003 Alban Bedel
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
3 *
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
4 * This file is part of MPlayer.
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
5 *
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
7 * it under the terms of the GNU General Public License as published by
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
9 * (at your option) any later version.
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
10 *
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
14 * GNU General Public License for more details.
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
15 *
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
16 * You should have received a copy of the GNU General Public License along
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
a506a6ab14e1 Add standard license header and make copyright notices consistent.
diego
parents: 24264
diff changeset
19 */
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
20
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
21 #include <linux/config.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
22 #include <linux/version.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
23 #include <linux/module.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
24 #include <linux/types.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
25 #include <linux/kernel.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
26 #include <linux/sched.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
27 #include <linux/mm.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
28 #include <linux/string.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
29 #include <linux/errno.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
30
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
31 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
32 #include <linux/malloc.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
33 #else
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
34 #include <linux/slab.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
35 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
36
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
37 #include <linux/pci.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
38 #include <linux/ioport.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
39 #include <linux/init.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
40 #include <linux/agp_backend.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
41
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
42 #include <asm/uaccess.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
43 #include <asm/system.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
44 #include <asm/io.h>
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
45
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
46 #include "tdfx_vid.h"
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
47 #include "3dfx.h"
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
48
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
49
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
50 #define TDFX_VID_MAJOR 178
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
51
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
52 MODULE_AUTHOR("Albeu");
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
53 MODULE_DESCRIPTION("A driver for Banshee targeted for video app");
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
54
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
55 #ifdef MODULE_LICENSE
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
56 MODULE_LICENSE("GPL");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
57 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
58
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
59 #ifndef min
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
60 #define min(x,y) (((x)<(y))?(x):(y))
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
61 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
62
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
63 static struct pci_dev *pci_dev;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
64
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
65 static uint8_t *tdfx_mmio_base = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
66 static uint32_t tdfx_mem_base = 0;
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
67 static uint32_t tdfx_io_base = 0;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
68
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
69 static int tdfx_ram_size = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
70
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
71 static int tdfx_vid_in_use = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
72
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
73 static drm_agp_t *drm_agp = NULL;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
74 static agp_kern_info agp_info;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
75 static agp_memory *agp_mem = NULL;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
76
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
77 static __initdata int tdfx_map_io = 1;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
78 static __initdata unsigned long map_start = 0; //0x7300000;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
79 static __initdata unsigned long map_max = (10*1024*1024);
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
80
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
81 MODULE_PARM(tdfx_map_io,"i");
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
82 MODULE_PARM_DESC(tdfx_map_io, "Set to 0 to use the page fault handler (you need to patch agpgart_be.c to allow the mapping in user space)\n");
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
83 MODULE_PARM(map_start,"l");
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
84 MODULE_PARM_DESC(map_start,"Use a block of physical mem instead of the agp arerture.");
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
85 MODULE_PARM(map_max,"l");
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
86 MODULE_PARM_DESC(map_max, "Maximum amout of physical memory (in bytes) that can be used\n");
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
87
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
88 static inline u32 tdfx_inl(unsigned int reg) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
89 return readl(tdfx_mmio_base + reg);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
90 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
91
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
92 static inline void tdfx_outl(unsigned int reg, u32 val) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
93 writel(val,tdfx_mmio_base + reg);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
94 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
95
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
96 static inline void banshee_make_room(int size) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
97 while((tdfx_inl(STATUS) & 0x1f) < size);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
98 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
99
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
100 static inline void banshee_wait_idle(void) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
101 int i = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
102
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
103 banshee_make_room(1);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
104 tdfx_outl(COMMAND_3D, COMMAND_3D_NOP);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
105
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
106 while(1) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
107 i = (tdfx_inl(STATUS) & STATUS_BUSY) ? 0 : i + 1;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
108 if(i == 3) break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
109 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
110 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
111
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
112 static unsigned long get_lfb_size(void) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
113 u32 draminit0 = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
114 u32 draminit1 = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
115 // u32 miscinit1 = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
116 u32 lfbsize = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
117 int sgram_p = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
118
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
119 draminit0 = tdfx_inl(DRAMINIT0);
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
120 draminit1 = tdfx_inl(DRAMINIT1);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
121
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
122 if ((pci_dev->device == PCI_DEVICE_ID_3DFX_BANSHEE) ||
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
123 (pci_dev->device == PCI_DEVICE_ID_3DFX_VOODOO3)) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
124 sgram_p = (draminit1 & DRAMINIT1_MEM_SDRAM) ? 0 : 1;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
125
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
126 lfbsize = sgram_p ?
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
127 (((draminit0 & DRAMINIT0_SGRAM_NUM) ? 2 : 1) *
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
128 ((draminit0 & DRAMINIT0_SGRAM_TYPE) ? 8 : 4) * 1024 * 1024) :
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
129 16 * 1024 * 1024;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
130 } else {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
131 /* Voodoo4/5 */
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
132 u32 chips, psize, banks;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
133
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
134 chips = ((draminit0 & (1 << 26)) == 0) ? 4 : 8;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
135 psize = 1 << ((draminit0 & 0x38000000) >> 28);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
136 banks = ((draminit0 & (1 << 30)) == 0) ? 2 : 4;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
137 lfbsize = chips * psize * banks;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
138 lfbsize <<= 20;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
139 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
140
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
141 #if 0
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
142 /* disable block writes for SDRAM (why?) */
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
143 miscinit1 = tdfx_inl(MISCINIT1);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
144 miscinit1 |= sgram_p ? 0 : MISCINIT1_2DBLOCK_DIS;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
145 miscinit1 |= MISCINIT1_CLUT_INV;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
146
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
147 banshee_make_room(1);
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
148 tdfx_outl(MISCINIT1, miscinit1);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
149 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
150
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
151 return lfbsize;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
152 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
153
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
154 static int tdfx_vid_find_card(void)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
155 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
156 struct pci_dev *dev = NULL;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
157 // unsigned int card_option;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
158
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
159 if((dev = pci_find_device(PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE, NULL)))
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
160 printk(KERN_INFO "tdfx_vid: Found VOODOO BANSHEE\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
161 else if((dev = pci_find_device(PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3, NULL)))
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
162 printk(KERN_INFO "tdfx_vid: Found VOODOO 3 \n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
163 else
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
164 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
165
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
166
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
167 pci_dev = dev;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
168
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
169 #if LINUX_VERSION_CODE >= 0x020300
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
170 tdfx_mmio_base = ioremap_nocache(dev->resource[0].start,1 << 24);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
171 tdfx_mem_base = dev->resource[1].start;
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
172 tdfx_io_base = dev->resource[2].start;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
173 #else
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
174 tdfx_mmio_base = ioremap_nocache(dev->base_address[1] & PCI_BASE_ADDRESS_MEM_MASK,0x4000);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
175 tdfx_mem_base = dev->base_address[1] & PCI_BASE_ADDRESS_MEM_MASK;
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
176 tdfx_io_base = dev->base_address[2] & PCI_BASE_ADDRESS_MEM_MASK;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
177 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
178 printk(KERN_INFO "tdfx_vid: MMIO at 0x%p\n", tdfx_mmio_base);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
179 tdfx_ram_size = get_lfb_size();
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
180
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
181 printk(KERN_INFO "tdfx_vid: Found %d MB (%d bytes) of memory\n",
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
182 tdfx_ram_size / 1024 / 1024,tdfx_ram_size);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
183
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
184
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
185 #if 0
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
186 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
187 int temp;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
188 printk("List resources -----------\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
189 for(temp=0;temp<DEVICE_COUNT_RESOURCE;temp++){
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
190 struct resource *res=&pci_dev->resource[temp];
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
191 if(res->flags){
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
192 int size=(1+res->end-res->start)>>20;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
193 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);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
194 if(res->flags&(IORESOURCE_MEM|IORESOURCE_PREFETCH)){
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
195 if(size>tdfx_ram_size && size<=64) tdfx_ram_size=size;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
196 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
197 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
198 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
199 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
200 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
201
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
202
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
203 return 1;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
204 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
205
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
206 static int agp_init(void) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
207
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
208 drm_agp = (drm_agp_t*)inter_module_get("drm_agp");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
209
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
210 if(!drm_agp) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
211 printk(KERN_ERR "tdfx_vid: Unable to get drm_agp pointer\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
212 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
213 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
214
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
215 if(drm_agp->acquire()) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
216 printk(KERN_ERR "tdfx_vid: Unable to acquire the agp backend\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
217 drm_agp = NULL;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
218 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
219 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
220
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
221 drm_agp->copy_info(&agp_info);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
222 #if 0
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
223 printk(KERN_DEBUG "AGP Version : %d %d\n"
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
224 "AGP Mode: %#X\nAperture Base: %p\nAperture Size: %d\n"
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
225 "Max memory = %d\nCurrent mem = %d\nCan use perture : %s\n"
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
226 "Page mask = %#X\n",
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
227 agp_info.version.major,agp_info.version.minor,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
228 agp_info.mode,agp_info.aper_base,agp_info.aper_size,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
229 agp_info.max_memory,agp_info.current_memory,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
230 agp_info.cant_use_aperture ? "no" : "yes",
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
231 agp_info.page_mask);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
232 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
233 drm_agp->enable(agp_info.mode);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
234
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
235
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
236 printk(KERN_INFO "AGP Enabled\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
237
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
238 return 1;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
239 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
240
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
241 static void agp_close(void) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
242
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
243 if(!drm_agp) return;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
244
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
245 if(agp_mem) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
246 drm_agp->unbind_memory(agp_mem);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
247 drm_agp->free_memory(agp_mem);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
248 agp_mem = NULL;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
249 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
250
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
251
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
252 drm_agp->release();
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
253 inter_module_put("drm_agp");
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
254 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
255
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
256 static int agp_move(tdfx_vid_agp_move_t* m) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
257 u32 src = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
258 u32 src_h,src_l;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
259
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
260 if(!(agp_mem||map_start))
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
261 return -EAGAIN;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
262
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
263 if(m->move2 > 3) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
264 printk(KERN_DEBUG "tdfx_vid: AGP move invalid destination %d\n",
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
265 m->move2);
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
266 return -EAGAIN;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
267 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
268
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
269 if(map_start)
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
270 src = map_start + m->src;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
271 else
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
272 src = agp_info.aper_base + m->src;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
273
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
274 src_l = (u32)src;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
275 src_h = (m->width | (m->src_stride << 14)) & 0x0FFFFFFF;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
276
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
277 // banshee_wait_idle();
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
278 banshee_make_room(6);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
279 tdfx_outl(AGPHOSTADDRESSHIGH,src_h);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
280 tdfx_outl(AGPHOSTADDRESSLOW,src_l);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
281
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
282 tdfx_outl(AGPGRAPHICSADDRESS, m->dst);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
283 tdfx_outl(AGPGRAPHICSSTRIDE, m->dst_stride);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
284 tdfx_outl(AGPREQSIZE,m->src_stride*m->height);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
285
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
286 tdfx_outl(AGPMOVECMD,m->move2 << 3);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
287 banshee_wait_idle();
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
288
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
289 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
290 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
291
26880
60e75a146f45 Disable unused function, fixes the warning:
diego
parents: 26759
diff changeset
292 #if 0
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
293 static void setup_fifo(u32 offset,ssize_t pages) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
294 long addr = agp_info.aper_base + offset;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
295 u32 size = pages | 0x700; // fifo on, in agp mem, disable hole cnt
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
296
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
297 banshee_wait_idle();
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
298
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
299 tdfx_outl(CMDBASEADDR0,addr >> 4);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
300 tdfx_outl(CMDRDPTRL0, addr << 4);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
301 tdfx_outl(CMDRDPTRH0, addr >> 28);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
302 tdfx_outl(CMDAMIN0, (addr - 4) & 0xFFFFFF);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
303 tdfx_outl(CMDAMAX0, (addr - 4) & 0xFFFFFF);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
304 tdfx_outl(CMDFIFODEPTH0, 0);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
305 tdfx_outl(CMDHOLECNT0, 0);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
306 tdfx_outl(CMDBASESIZE0,size);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
307
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
308 banshee_wait_idle();
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
309
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
310 }
26880
60e75a146f45 Disable unused function, fixes the warning:
diego
parents: 26759
diff changeset
311 #endif
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
312
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
313 static int bump_fifo(u16 size) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
314
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
315 banshee_wait_idle();
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
316 tdfx_outl(CMDBUMP0 , size);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
317 banshee_wait_idle();
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
318
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
319 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
320 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
321
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
322 static void tdfx_vid_get_config(tdfx_vid_config_t* cfg) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
323 u32 in;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
324
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
325 cfg->version = TDFX_VID_VERSION;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
326 cfg->ram_size = tdfx_ram_size;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
327
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
328 in = tdfx_inl(VIDSCREENSIZE);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
329 cfg->screen_width = in & 0xFFF;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
330 cfg->screen_height = (in >> 12) & 0xFFF;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
331 in = (tdfx_inl(VIDPROCCFG)>> 18)& 0x7;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
332 switch(in) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
333 case 0:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
334 cfg->screen_format = TDFX_VID_FORMAT_BGR8;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
335 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
336 case 1:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
337 cfg->screen_format = TDFX_VID_FORMAT_BGR16;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
338 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
339 case 2:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
340 cfg->screen_format = TDFX_VID_FORMAT_BGR24;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
341 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
342 case 3:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
343 cfg->screen_format = TDFX_VID_FORMAT_BGR32;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
344 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
345 default:
10397
6180d7558f75 output typo fixes: unknow --> unknown
diego
parents: 10339
diff changeset
346 printk(KERN_INFO "tdfx_vid: unknown screen format %d\n",in);
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
347 cfg->screen_format = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
348 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
349 }
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
350 cfg->screen_stride = tdfx_inl(VIDDESKSTRIDE) & 0x7FFF;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
351 cfg->screen_start = tdfx_inl(VIDDESKSTART);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
352 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
353
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
354 inline static u32 tdfx_vid_make_format(int src,u16 stride,u32 fmt) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
355 u32 r = stride & 0xFFF3;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
356 u32 tdfx_fmt = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
357
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
358 // src and dest formats
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
359 switch(fmt) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
360 case TDFX_VID_FORMAT_BGR8:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
361 tdfx_fmt = 1;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
362 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
363 case TDFX_VID_FORMAT_BGR16:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
364 tdfx_fmt = 3;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
365 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
366 case TDFX_VID_FORMAT_BGR24:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
367 tdfx_fmt = 4;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
368 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
369 case TDFX_VID_FORMAT_BGR32:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
370 tdfx_fmt = 5;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
371 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
372 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
373
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
374 if(!src && !tdfx_fmt) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
375 printk(KERN_INFO "tdfx_vid: Invalid destination format %#X\n",fmt);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
376 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
377 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
378
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
379 if(src && !tdfx_fmt) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
380 // src only format
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
381 switch(fmt){
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
382 case TDFX_VID_FORMAT_BGR1:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
383 tdfx_fmt = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
384 break;
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
385 case TDFX_VID_FORMAT_BGR15: // To check
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
386 tdfx_fmt = 2;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
387 break;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
388 case TDFX_VID_FORMAT_YUY2:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
389 tdfx_fmt = 8;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
390 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
391 case TDFX_VID_FORMAT_UYVY:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
392 tdfx_fmt = 9;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
393 break;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
394 default:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
395 printk(KERN_INFO "tdfx_vid: Invalid source format %#X\n",fmt);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
396 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
397 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
398 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
399
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
400 r |= tdfx_fmt << 16;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
401
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
402 return r;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
403 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
404
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
405 static int tdfx_vid_blit(tdfx_vid_blit_t* blit) {
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
406 u32 src_fmt,dst_fmt,cmd = 2;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
407 u32 cmin,cmax,srcbase,srcxy,srcfmt,srcsize;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
408 u32 dstbase,dstxy,dstfmt,dstsize = 0;
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
409 u32 cmd_extra = 0,src_ck[2],dst_ck[2],rop123=0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
410
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
411 //printk(KERN_INFO "tdfx_vid: Make src fmt 0x%x\n",blit->src_format);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
412 src_fmt = tdfx_vid_make_format(1,blit->src_stride,blit->src_format);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
413 if(!src_fmt)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
414 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
415 //printk(KERN_INFO "tdfx_vid: Make dst fmt 0x%x\n", blit->dst_format);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
416 dst_fmt = tdfx_vid_make_format(0,blit->dst_stride,blit->dst_format);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
417 if(!dst_fmt)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
418 return 0;
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
419 blit->colorkey &= 0x3;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
420 // Be nice if user just want a simple blit
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
421 if((!blit->colorkey) && (!blit->rop[0]))
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
422 blit->rop[0] = TDFX_VID_ROP_COPY;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
423 // No stretch : fix me the cmd should be 1 but it
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
424 // doesn't work. Maybe some other regs need to be set
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
425 // as non-stretch blit have more options
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
426 if(((!blit->dst_w) && (!blit->dst_h)) ||
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
427 ((blit->dst_w == blit->src_w) && (blit->dst_h == blit->src_h)))
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
428 cmd = 2;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
429
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
430 // Save the regs otherwise fb get crazy
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
431 // we can perhaps avoid some ...
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
432 banshee_wait_idle();
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
433 cmin = tdfx_inl(CLIP0MIN);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
434 cmax = tdfx_inl(CLIP0MAX);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
435 srcbase = tdfx_inl(SRCBASE);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
436 srcxy = tdfx_inl(SRCXY);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
437 srcfmt = tdfx_inl(SRCFORMAT);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
438 srcsize = tdfx_inl(SRCSIZE);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
439 dstbase = tdfx_inl(DSTBASE);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
440 dstxy = tdfx_inl(DSTXY);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
441 dstfmt = tdfx_inl(DSTFORMAT);
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
442 if(cmd == 2)
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
443 dstsize = tdfx_inl(DSTSIZE);
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
444 if(blit->colorkey & TDFX_VID_SRC_COLORKEY) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
445 src_ck[0] = tdfx_inl(SRCCOLORKEYMIN);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
446 src_ck[1] = tdfx_inl(SRCCOLORKEYMAX);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
447 tdfx_outl(SRCCOLORKEYMIN,blit->src_colorkey[0]);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
448 tdfx_outl(SRCCOLORKEYMAX,blit->src_colorkey[1]);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
449 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
450 if(blit->colorkey & TDFX_VID_DST_COLORKEY) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
451 dst_ck[0] = tdfx_inl(DSTCOLORKEYMIN);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
452 dst_ck[1] = tdfx_inl(DSTCOLORKEYMAX);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
453 tdfx_outl(SRCCOLORKEYMIN,blit->dst_colorkey[0]);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
454 tdfx_outl(SRCCOLORKEYMAX,blit->dst_colorkey[1]);
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
455 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
456 if(blit->colorkey) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
457 cmd_extra = tdfx_inl(COMMANDEXTRA_2D);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
458 rop123 = tdfx_inl(ROP123);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
459 tdfx_outl(COMMANDEXTRA_2D, blit->colorkey);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
460 tdfx_outl(ROP123,(blit->rop[1] | (blit->rop[2] << 8) | blit->rop[3] << 16));
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
461
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
462 }
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
463 // Get rid of the clipping at the moment
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
464 tdfx_outl(CLIP0MIN,0);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
465 tdfx_outl(CLIP0MAX,0x0fff0fff);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
466
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
467 // Setup the src
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
468 tdfx_outl(SRCBASE,blit->src & 0x00FFFFFF);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
469 tdfx_outl(SRCXY,XYREG(blit->src_x,blit->src_y));
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
470 tdfx_outl(SRCFORMAT,src_fmt);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
471 tdfx_outl(SRCSIZE,XYREG(blit->src_w,blit->src_h));
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
472
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
473 // Setup the dst
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
474 tdfx_outl(DSTBASE,blit->dst & 0x00FFFFFF);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
475 tdfx_outl(DSTXY,XYREG(blit->dst_x,blit->dst_y));
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
476 tdfx_outl(DSTFORMAT,dst_fmt);
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
477 if(cmd == 2)
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
478 tdfx_outl(DSTSIZE,XYREG(blit->dst_w,blit->dst_h));
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
479
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
480 // Send the command
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
481 tdfx_outl(COMMAND_2D,cmd | 0x100 | (blit->rop[0] << 24));
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
482 banshee_wait_idle();
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
483
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
484 // Now restore the regs to make fb happy
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
485 tdfx_outl(CLIP0MIN, cmin);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
486 tdfx_outl(CLIP0MAX, cmax);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
487 tdfx_outl(SRCBASE, srcbase);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
488 tdfx_outl(SRCXY, srcxy);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
489 tdfx_outl(SRCFORMAT, srcfmt);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
490 tdfx_outl(SRCSIZE, srcsize);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
491 tdfx_outl(DSTBASE, dstbase);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
492 tdfx_outl(DSTXY, dstxy);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
493 tdfx_outl(DSTFORMAT, dstfmt);
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
494 if(cmd == 2)
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
495 tdfx_outl(DSTSIZE, dstsize);
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
496 if(blit->colorkey & TDFX_VID_SRC_COLORKEY) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
497 tdfx_outl(SRCCOLORKEYMIN,src_ck[0]);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
498 tdfx_outl(SRCCOLORKEYMAX,src_ck[1]);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
499 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
500 if(blit->colorkey & TDFX_VID_DST_COLORKEY) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
501 tdfx_outl(SRCCOLORKEYMIN,dst_ck[0]);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
502 tdfx_outl(SRCCOLORKEYMAX,dst_ck[1]);
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
503 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
504 if(blit->colorkey) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
505 tdfx_outl(COMMANDEXTRA_2D,cmd_extra);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
506 tdfx_outl(ROP123,rop123);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
507 }
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
508 return 1;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
509 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
510
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
511 static int tdfx_vid_set_yuv(unsigned long arg) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
512 tdfx_vid_yuv_t yuv;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
513
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
514 if(copy_from_user(&yuv,(tdfx_vid_yuv_t*)arg,sizeof(tdfx_vid_yuv_t))) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
515 printk(KERN_DEBUG "tdfx_vid:failed copy from userspace\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
516 return -EFAULT;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
517 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
518 banshee_make_room(2);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
519 tdfx_outl(YUVBASEADDRESS,yuv.base & 0x01FFFFFF);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
520 tdfx_outl(YUVSTRIDE, yuv.stride & 0x3FFF);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
521
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
522 banshee_wait_idle();
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
523
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
524 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
525 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
526
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
527 static int tdfx_vid_get_yuv(unsigned long arg) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
528 tdfx_vid_yuv_t yuv;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
529
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
530 yuv.base = tdfx_inl(YUVBASEADDRESS) & 0x01FFFFFF;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
531 yuv.stride = tdfx_inl(YUVSTRIDE) & 0x3FFF;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
532
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
533 if(copy_to_user((tdfx_vid_yuv_t*)arg,&yuv,sizeof(tdfx_vid_yuv_t))) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
534 printk(KERN_INFO "tdfx_vid:failed copy to userspace\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
535 return -EFAULT;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
536 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
537
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
538 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
539 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
540
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
541 static int tdfx_vid_set_overlay(unsigned long arg) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
542 tdfx_vid_overlay_t ov;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
543 uint32_t screen_w,screen_h;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
544 uint32_t vidcfg,stride,vidbuf;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
545 int disp_w,disp_h;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
546
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
547 if(copy_from_user(&ov,(tdfx_vid_overlay_t*)arg,sizeof(tdfx_vid_overlay_t))) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
548 printk(KERN_DEBUG "tdfx_vid:failed copy from userspace\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
549 return -EFAULT;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
550 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
551
10339
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
552 if(ov.dst_y < 0) {
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
553 int shift;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
554 if(-ov.dst_y >= ov.src_height) {
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
555 printk(KERN_DEBUG "tdfx_vid: Overlay outside of the screen ????\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
556 return -EFAULT;
10339
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
557 }
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
558 shift = (-ov.dst_y)/(double)ov.dst_height*ov.src_height;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
559 ov.src[0] += shift*ov.src_stride;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
560 ov.src_height -= shift;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
561 ov.dst_height += ov.dst_y;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
562 ov.dst_y = 0;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
563 }
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
564
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
565 if(ov.dst_x < 0) {
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
566 int shift;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
567 if(-ov.dst_x >= ov.src_width) {
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
568 printk(KERN_DEBUG "tdfx_vid: Overlay outside of the screen ????\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
569 return -EFAULT;
10339
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
570 }
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
571 shift = (-ov.dst_x)/(double)ov.dst_width*ov.src_width;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
572 shift = ((shift+3)/2)*2;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
573 ov.src[0] += shift*2;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
574 ov.src_width -= shift;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
575 ov.dst_width += ov.dst_x;
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
576 ov.dst_x = 0;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
577 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
578
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
579 vidcfg = tdfx_inl(VIDPROCCFG);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
580 // clear the overlay fmt
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
581 vidcfg &= ~(7 << 21);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
582 switch(ov.format) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
583 case TDFX_VID_FORMAT_BGR15:
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
584 vidcfg |= (1 << 21);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
585 break;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
586 case TDFX_VID_FORMAT_BGR16:
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
587 vidcfg |= (7 << 21);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
588 break;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
589 case TDFX_VID_FORMAT_YUY2:
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
590 vidcfg |= (5 << 21);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
591 break;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
592 case TDFX_VID_FORMAT_UYVY:
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
593 vidcfg |= (6 << 21);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
594 break;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
595 default:
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
596 printk(KERN_DEBUG "tdfx_vid: Invalid overlay fmt 0x%x\n",ov.format);
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
597 return -EFAULT;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
598 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
599
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
600 // YUV422 need 4 bytes aligned stride and address
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
601 if((ov.format == TDFX_VID_FORMAT_YUY2 ||
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
602 ov.format == TDFX_VID_FORMAT_UYVY)) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
603 if((ov.src_stride & ~0x3) != ov.src_stride) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
604 printk(KERN_DEBUG "tdfx_vid: YUV need a 4 bytes aligned stride %d\n",ov.src_stride);
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
605 return -EFAULT;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
606 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
607 if((ov.src[0] & ~0x3) != ov.src[0] || (ov.src[1] & ~0x3) != ov.src[1]){
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
608 printk(KERN_DEBUG "tdfx_vid: YUV need a 4 bytes aligned address 0x%x 0x%x\n",ov.src[0],ov.src[1]);
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
609 return -EFAULT;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
610 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
611 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
612
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
613 // Now we have a good input format
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
614 // but first get the screen size to check a bit
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
615 // if the size/position is valid
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
616 screen_w = tdfx_inl(VIDSCREENSIZE);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
617 screen_h = (screen_w >> 12) & 0xFFF;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
618 screen_w &= 0xFFF;
10339
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
619 disp_w = ov.dst_x + ov.dst_width >= screen_w ?
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
620 screen_w - ov.dst_x : ov.dst_width;
10339
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
621 disp_h = ov.dst_y + ov.dst_height >= screen_h ?
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
622 screen_h - ov.dst_y : ov.dst_height;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
623
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
624 if(ov.dst_x >= screen_w || ov.dst_y >= screen_h ||
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
625 disp_h <= 0 || disp_h > screen_h || disp_w <= 0 || disp_w > screen_w) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
626 printk(KERN_DEBUG "tdfx_vid: Invalid overlay dimension and/or position\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
627 return -EFAULT;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
628 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
629 // Setup the vidproc
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
630 // H scaling
9706
8ae20fe919c9 The overlay can't downscale
albeu
parents: 9568
diff changeset
631 if(ov.src_width < ov.dst_width)
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
632 vidcfg |= (1<<14);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
633 else
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
634 vidcfg &= ~(1<<14);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
635 // V scaling
9706
8ae20fe919c9 The overlay can't downscale
albeu
parents: 9568
diff changeset
636 if(ov.src_height < ov.dst_height)
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
637 vidcfg |= (1<<15);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
638 else
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
639 vidcfg &= ~(1<<15);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
640 // Filtering can only be used in 1x mode
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
641 if(!(vidcfg | (1<<26)))
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
642 vidcfg |= (3<<16);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
643 else
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
644 vidcfg &= ~(3<<16);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
645 // disable overlay stereo mode
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
646 vidcfg &= ~(1<<2);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
647 // Colorkey on/off
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
648 if(ov.use_colorkey) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
649 // Colorkey inversion
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
650 if(ov.invert_colorkey)
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
651 vidcfg |= (1<<6);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
652 else
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
653 vidcfg &= ~(1<<6);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
654 vidcfg |= (1<<5);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
655 } else
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
656 vidcfg &= ~(1<<5);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
657 // Overlay isn't VidIn
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
658 vidcfg &= ~(1<<9);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
659 // vidcfg |= (1<<8);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
660 tdfx_outl(VIDPROCCFG,vidcfg);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
661
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
662 // Start coord
9568
ed8827c95386 Shut up some debug messages
albeu
parents: 9566
diff changeset
663 //printk(KERN_DEBUG "tdfx_vid: start %dx%d\n",ov.dst_x & 0xFFF,ov.dst_y & 0xFFF);
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
664 tdfx_outl(VIDOVRSTARTCRD,(ov.dst_x & 0xFFF)|((ov.dst_y & 0xFFF)<<12));
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
665 // End coord
10339
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
666 tdfx_outl(VIDOVRENDCRD, ((ov.dst_x + disp_w-1) & 0xFFF)|
7074d8b6f585 Allow negative x,y for the overlay.
albeu
parents: 9706
diff changeset
667 (((ov.dst_y + disp_h-1) & 0xFFF)<<12));
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
668 // H Scaling
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
669 tdfx_outl(VIDOVRDUDX,( ((u32)ov.src_width) << 20) / ov.dst_width);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
670 // Src offset and width (in bytes)
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
671 tdfx_outl(VIDOVRDUDXOFF,((ov.src_width<<1) & 0xFFF) << 19);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
672 // V Scaling
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
673 tdfx_outl(VIDOVRDVDY, ( ((u32)ov.src_height) << 20) / ov.dst_height);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
674 //else
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
675 // tdfx_outl(VIDOVRDVDY,0);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
676 // V Offset
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
677 tdfx_outl(VIDOVRDVDYOFF,0);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
678 // Overlay stride
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
679 stride = tdfx_inl(VIDDESKSTRIDE) & 0xFFFF;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
680 tdfx_outl(VIDDESKSTRIDE,stride | (((u32)ov.src_stride) << 16));
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
681 // Buffers address
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
682 tdfx_outl(LEFTOVBUF, ov.src[0]);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
683 tdfx_outl(RIGHTOVBUF, ov.src[1]);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
684
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
685 // Send a swap buffer cmd if we are not on one of the 2 buffers
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
686 vidbuf = tdfx_inl(VIDCUROVRSTART);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
687 if(vidbuf != ov.src[0] && vidbuf != ov.src[1]) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
688 tdfx_outl(SWAPPENDING,0);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
689 tdfx_outl(SWAPBUFCMD, 1);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
690 }
9568
ed8827c95386 Shut up some debug messages
albeu
parents: 9566
diff changeset
691 //printk(KERN_DEBUG "tdfx_vid: Buf0=0x%x Buf1=0x%x Current=0x%x\n",
ed8827c95386 Shut up some debug messages
albeu
parents: 9566
diff changeset
692 // ov.src[0],ov.src[1],tdfx_inl(VIDCUROVRSTART));
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
693 // Colorkey
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
694 if(ov.use_colorkey) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
695 tdfx_outl(VIDCHRMIN,ov.colorkey[0]);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
696 tdfx_outl(VIDCHRMAX,ov.colorkey[1]);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
697 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
698
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
699 return 0;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
700 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
701
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
702 static int tdfx_vid_overlay_on(void) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
703 uint32_t vidcfg = tdfx_inl(VIDPROCCFG);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
704 //return 0;
23873
49a433e2e78f cosmetics: misc typo fixes
diego
parents: 10397
diff changeset
705 if(vidcfg & (1<<8)) { // Overlay is already on
49a433e2e78f cosmetics: misc typo fixes
diego
parents: 10397
diff changeset
706 //printk(KERN_DEBUG "tdfx_vid: Overlay is already on.\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
707 return -EFAULT;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
708 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
709 vidcfg |= (1<<8);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
710 tdfx_outl(VIDPROCCFG,vidcfg);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
711 return 0;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
712 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
713
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
714 static int tdfx_vid_overlay_off(void) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
715 uint32_t vidcfg = tdfx_inl(VIDPROCCFG);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
716
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
717 if(vidcfg & (1<<8)) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
718 vidcfg &= ~(1<<8);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
719 tdfx_outl(VIDPROCCFG,vidcfg);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
720 return 0;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
721 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
722
23873
49a433e2e78f cosmetics: misc typo fixes
diego
parents: 10397
diff changeset
723 printk(KERN_DEBUG "tdfx_vid: Overlay is already off.\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
724 return -EFAULT;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
725 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
726
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
727
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
728 static int tdfx_vid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
729 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
730 tdfx_vid_agp_move_t move;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
731 tdfx_vid_config_t cfg;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
732 tdfx_vid_blit_t blit;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
733 u16 int16;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
734
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
735 switch(cmd) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
736 case TDFX_VID_AGP_MOVE:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
737 if(copy_from_user(&move,(tdfx_vid_agp_move_t*)arg,sizeof(tdfx_vid_agp_move_t))) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
738 printk(KERN_INFO "tdfx_vid:failed copy from userspace\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
739 return -EFAULT;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
740 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
741 return agp_move(&move);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
742 case TDFX_VID_BUMP0:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
743 if(copy_from_user(&int16,(u16*)arg,sizeof(u16))) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
744 printk(KERN_INFO "tdfx_vid:failed copy from userspace\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
745 return -EFAULT;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
746 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
747 return bump_fifo(int16);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
748 case TDFX_VID_BLIT:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
749 if(copy_from_user(&blit,(tdfx_vid_blit_t*)arg,sizeof(tdfx_vid_blit_t))) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
750 printk(KERN_INFO "tdfx_vid:failed copy from userspace\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
751 return -EFAULT;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
752 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
753 if(!tdfx_vid_blit(&blit)) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
754 printk(KERN_INFO "tdfx_vid: Blit failed\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
755 return -EFAULT;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
756 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
757 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
758 case TDFX_VID_GET_CONFIG:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
759 if(copy_from_user(&cfg,(tdfx_vid_config_t*)arg,sizeof(tdfx_vid_config_t))) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
760 printk(KERN_INFO "tdfx_vid:failed copy from userspace\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
761 return -EFAULT;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
762 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
763 tdfx_vid_get_config(&cfg);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
764 if(copy_to_user((tdfx_vid_config_t*)arg,&cfg,sizeof(tdfx_vid_config_t))) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
765 printk(KERN_INFO "tdfx_vid:failed copy to userspace\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
766 return -EFAULT;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
767 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
768 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
769 case TDFX_VID_SET_YUV:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
770 return tdfx_vid_set_yuv(arg);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
771 case TDFX_VID_GET_YUV:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
772 return tdfx_vid_get_yuv(arg);
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
773 case TDFX_VID_SET_OVERLAY:
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
774 return tdfx_vid_set_overlay(arg);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
775 case TDFX_VID_OVERLAY_ON:
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
776 return tdfx_vid_overlay_on();
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
777 case TDFX_VID_OVERLAY_OFF:
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
778 return tdfx_vid_overlay_off();
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
779 default:
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
780 printk(KERN_ERR "tdfx_vid: Invalid ioctl %d\n",cmd);
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
781 return -EINVAL;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
782 }
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
783 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
784 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
785
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
786
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
787
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
788 static ssize_t tdfx_vid_read(struct file *file, char *buf, size_t count, loff_t *ppos)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
789 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
790 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
791 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
792
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
793 static ssize_t tdfx_vid_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
794 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
795
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
796 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
797 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
798
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
799 static void tdfx_vid_mopen(struct vm_area_struct *vma) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
800 int i;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
801 struct page *page;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
802 unsigned long phys;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
803
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
804 printk(KERN_DEBUG "tdfx_vid: mopen\n");
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
805
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
806 for(i = 0 ; i < agp_mem->page_count ; i++) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
807 phys = agp_mem->memory[i] & ~(0x00000fff);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
808 page = virt_to_page(phys_to_virt(phys));
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
809 if(!page) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
810 printk(KERN_DEBUG "tdfx_vid: Can't get the page %d\%d\n",i,agp_mem->page_count);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
811 return;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
812 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
813 get_page(page);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
814 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
815 MOD_INC_USE_COUNT;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
816 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
817
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
818 static void tdfx_vid_mclose(struct vm_area_struct *vma) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
819 int i;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
820 struct page *page;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
821 unsigned long phys;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
822
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
823 printk(KERN_DEBUG "tdfx_vid: mclose\n");
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
824
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
825 for(i = 0 ; i < agp_mem->page_count ; i++) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
826 phys = agp_mem->memory[i] & ~(0x00000fff);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
827 page = virt_to_page(phys_to_virt(phys));
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
828 if(!page) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
829 printk(KERN_DEBUG "tdfx_vid: Can't get the page %d\%d\n",i,agp_mem->page_count);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
830 return;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
831 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
832 put_page(page);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
833 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
834
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
835 MOD_DEC_USE_COUNT;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
836 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
837
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
838 static struct page *tdfx_vid_nopage(struct vm_area_struct *vma,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
839 unsigned long address,
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
840 int write_access) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
841 unsigned long off;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
842 uint32_t n;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
843 struct page *page;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
844 unsigned long phys;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
845
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
846 off = address - vma->vm_start + (vma->vm_pgoff<<PAGE_SHIFT);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
847 n = off / PAGE_SIZE;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
848
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
849 if(n >= agp_mem->page_count) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
850 printk(KERN_DEBUG "tdfx_vid: Too far away\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
851 return (struct page *)0UL;
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
852 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
853 phys = agp_mem->memory[n] & ~(0x00000fff);
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
854 page = virt_to_page(phys_to_virt(phys));
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
855 if(!page) {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
856 printk(KERN_DEBUG "tdfx_vid: Can't get the page\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
857 return (struct page *)0UL;
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
858 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
859 return page;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
860 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
861
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
862 /* memory handler functions */
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
863 static struct vm_operations_struct tdfx_vid_vm_ops = {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
864 open: tdfx_vid_mopen, /* mmap-open */
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
865 close: tdfx_vid_mclose,/* mmap-close */
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
866 nopage: tdfx_vid_nopage, /* no-page fault handler */
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
867 };
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
868
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
869
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
870 static int tdfx_vid_mmap(struct file *file, struct vm_area_struct *vma)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
871 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
872 size_t size;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
873 #ifdef MP_DEBUG
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
874 printk(KERN_DEBUG "tdfx_vid: mapping agp memory into userspace\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
875 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
876
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
877 size = (vma->vm_end-vma->vm_start + PAGE_SIZE - 1) / PAGE_SIZE;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
878
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
879 if(map_start) { // Ok we map directly in the physcal ram
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
880 if(size*PAGE_SIZE > map_max) {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
881 printk(KERN_ERR "tdfx_vid: Not enouth mem\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
882 return -EAGAIN;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
883 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
884 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,3)
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
885 if(remap_page_range(vma, vma->vm_start,map_start,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
886 vma->vm_end - vma->vm_start, vma->vm_page_prot))
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
887 #else
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
888 if(remap_page_range(vma->vm_start, (unsigned long)map_start,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
889 vma->vm_end - vma->vm_start, vma->vm_page_prot))
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
890 #endif
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
891 {
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
892 printk(KERN_ERR "tdfx_vid: error mapping video memory\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
893 return -EAGAIN;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
894 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
895 printk(KERN_INFO "Physical mem 0x%lx mapped in userspace\n",map_start);
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
896 return 0;
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
897 }
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
898
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
899 if(agp_mem)
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
900 return -EAGAIN;
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
901
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
902 agp_mem = drm_agp->allocate_memory(size,AGP_NORMAL_MEMORY);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
903 if(!agp_mem) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
904 printk(KERN_ERR "Failed to allocate AGP memory\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
905 return -ENOMEM;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
906 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
907
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
908 if(drm_agp->bind_memory(agp_mem,0)) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
909 printk(KERN_ERR "Failed to bind the AGP memory\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
910 drm_agp->free_memory(agp_mem);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
911 agp_mem = NULL;
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
912 return -ENOMEM;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
913 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
914
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
915 printk(KERN_INFO "%d pages of AGP mem allocated (%ld/%ld bytes) :)))\n",
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
916 size,vma->vm_end-vma->vm_start,size*PAGE_SIZE);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
917
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
918
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
919 if(tdfx_map_io) {
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
920 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,3)
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
921 if(remap_page_range(vma, vma->vm_start,agp_info.aper_base,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
922 vma->vm_end - vma->vm_start, vma->vm_page_prot))
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
923 #else
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
924 if(remap_page_range(vma->vm_start, (unsigned long)agp_info.aper_base,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
925 vma->vm_end - vma->vm_start, vma->vm_page_prot))
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
926 #endif
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
927 {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
928 printk(KERN_ERR "tdfx_vid: error mapping video memory\n");
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
929 return -EAGAIN;
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
930 }
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
931 } else {
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
932 // Never swap it out
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
933 vma->vm_flags |= VM_LOCKED | VM_IO;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
934 vma->vm_ops = &tdfx_vid_vm_ops;
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
935 vma->vm_ops->open(vma);
9566
015b404023f5 Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents: 9558
diff changeset
936 printk(KERN_INFO "Page fault handler ready !!!!!\n");
9558
29aa61268e54 Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents: 9545
diff changeset
937 }
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
938
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
939 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
940 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
941
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
942
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
943 static int tdfx_vid_release(struct inode *inode, struct file *file)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
944 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
945 #ifdef MP_DEBUG
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
946 printk(KERN_DEBUG "tdfx_vid: Video OFF (release)\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
947 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
948
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
949 // Release the agp mem
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
950 if(agp_mem) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
951 drm_agp->unbind_memory(agp_mem);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
952 drm_agp->free_memory(agp_mem);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
953 agp_mem = NULL;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
954 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
955
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
956 tdfx_vid_in_use = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
957
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
958 MOD_DEC_USE_COUNT;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
959 return 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
960 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
961
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
962 static long long tdfx_vid_lseek(struct file *file, long long offset, int origin)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
963 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
964 return -ESPIPE;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
965 }
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
966
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
967 static int tdfx_vid_open(struct inode *inode, struct file *file)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
968 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
969 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
970 int minor = MINOR(inode->i_rdev.value);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
971 #else
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
972 int minor = MINOR(inode->i_rdev);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
973 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
974
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
975 if(minor != 0)
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
976 return -ENXIO;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
977
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
978 if(tdfx_vid_in_use == 1)
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
979 return -EBUSY;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
980
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
981 tdfx_vid_in_use = 1;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
982 MOD_INC_USE_COUNT;
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
983 return 0;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
984 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
985
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
986 #if LINUX_VERSION_CODE >= 0x020400
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
987 static struct file_operations tdfx_vid_fops =
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
988 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
989 llseek: tdfx_vid_lseek,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
990 read: tdfx_vid_read,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
991 write: tdfx_vid_write,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
992 ioctl: tdfx_vid_ioctl,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
993 mmap: tdfx_vid_mmap,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
994 open: tdfx_vid_open,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
995 release: tdfx_vid_release
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
996 };
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
997 #else
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
998 static struct file_operations tdfx_vid_fops =
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
999 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1000 tdfx_vid_lseek,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1001 tdfx_vid_read,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1002 tdfx_vid_write,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1003 NULL,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1004 NULL,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1005 tdfx_vid_ioctl,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1006 tdfx_vid_mmap,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1007 tdfx_vid_open,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1008 NULL,
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1009 tdfx_vid_release
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1010 };
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1011 #endif
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1012
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1013
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1014 int init_module(void)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1015 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1016 tdfx_vid_in_use = 0;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1017
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1018 if(register_chrdev(TDFX_VID_MAJOR, "tdfx_vid", &tdfx_vid_fops)) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1019 printk(KERN_ERR "tdfx_vid: unable to get major: %d\n", TDFX_VID_MAJOR);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1020 return -EIO;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1021 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1022
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1023 if(!agp_init()) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1024 printk(KERN_ERR "tdfx_vid: AGP init failed\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1025 unregister_chrdev(TDFX_VID_MAJOR, "tdfx_vid");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1026 return -EINVAL;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1027 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1028
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1029 if (!tdfx_vid_find_card()) {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1030 printk(KERN_ERR "tdfx_vid: no supported devices found\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1031 agp_close();
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1032 unregister_chrdev(TDFX_VID_MAJOR, "tdfx_vid");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1033 return -EINVAL;
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1034 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1035
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26880
diff changeset
1036
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1037
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 26003
diff changeset
1038 return 0;
9545
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1039
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1040 }
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1041
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1042 void cleanup_module(void)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1043 {
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1044 if(tdfx_mmio_base)
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1045 iounmap(tdfx_mmio_base);
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1046 agp_close();
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1047 printk(KERN_INFO "tdfx_vid: Cleaning up module\n");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1048 unregister_chrdev(TDFX_VID_MAJOR, "tdfx_vid");
d1bbeae9f46a tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff changeset
1049 }