Mercurial > mplayer.hg
annotate drivers/tdfx_vid.c @ 26540:362f8c285877
Restore line mistakenly commented out in the last commit.
author | diego |
---|---|
date | Mon, 28 Apr 2008 13:31:00 +0000 |
parents | a506a6ab14e1 |
children | 8eff880f638c |
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 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
99 |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
119 draminit0 = tdfx_inl(DRAMINIT0); |
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; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
125 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
126 lfbsize = sgram_p ? |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
127 (((draminit0 & DRAMINIT0_SGRAM_NUM) ? 2 : 1) * |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
147 banshee_make_room(1); |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
166 |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
184 |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
235 |
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 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
240 |
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 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
250 |
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)) |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
261 return (-EAGAIN); |
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); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
266 return (-EAGAIN); |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
292 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
|
293 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
|
294 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
|
295 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
296 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
297 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
298 tdfx_outl(CMDBASEADDR0,addr >> 4); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
299 tdfx_outl(CMDRDPTRL0, addr << 4); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
300 tdfx_outl(CMDRDPTRH0, addr >> 28); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
301 tdfx_outl(CMDAMIN0, (addr - 4) & 0xFFFFFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
302 tdfx_outl(CMDAMAX0, (addr - 4) & 0xFFFFFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
303 tdfx_outl(CMDFIFODEPTH0, 0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
304 tdfx_outl(CMDHOLECNT0, 0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
305 tdfx_outl(CMDBASESIZE0,size); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
306 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
307 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
308 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
309 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
310 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
311 static int bump_fifo(u16 size) { |
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 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
314 tdfx_outl(CMDBUMP0 , size); |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
317 return 0; |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
320 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
|
321 u32 in; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
322 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
323 cfg->version = TDFX_VID_VERSION; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
324 cfg->ram_size = tdfx_ram_size; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
325 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
326 in = tdfx_inl(VIDSCREENSIZE); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
327 cfg->screen_width = in & 0xFFF; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
328 cfg->screen_height = (in >> 12) & 0xFFF; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
329 in = (tdfx_inl(VIDPROCCFG)>> 18)& 0x7; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
330 switch(in) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
331 case 0: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
332 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
|
333 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
334 case 1: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
335 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
|
336 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
337 case 2: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
338 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
|
339 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
340 case 3: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
341 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
|
342 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
343 default: |
10397 | 344 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
|
345 cfg->screen_format = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
346 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
347 } |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
348 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
|
349 cfg->screen_start = tdfx_inl(VIDDESKSTART); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
350 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
351 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
352 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
|
353 u32 r = stride & 0xFFF3; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
354 u32 tdfx_fmt = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
355 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
356 // src and dest formats |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
357 switch(fmt) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
358 case TDFX_VID_FORMAT_BGR8: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
359 tdfx_fmt = 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
360 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
361 case TDFX_VID_FORMAT_BGR16: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
362 tdfx_fmt = 3; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
363 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
364 case TDFX_VID_FORMAT_BGR24: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
365 tdfx_fmt = 4; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
366 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
367 case TDFX_VID_FORMAT_BGR32: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
368 tdfx_fmt = 5; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
369 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
370 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
371 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
372 if(!src && !tdfx_fmt) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
373 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
|
374 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
375 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
376 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
377 if(src && !tdfx_fmt) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
378 // src only format |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
379 switch(fmt){ |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
380 case TDFX_VID_FORMAT_BGR1: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
381 tdfx_fmt = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
382 break; |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
383 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
|
384 tdfx_fmt = 2; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
385 break; |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
386 case TDFX_VID_FORMAT_YUY2: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
387 tdfx_fmt = 8; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
388 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
389 case TDFX_VID_FORMAT_UYVY: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
390 tdfx_fmt = 9; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
391 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
392 default: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
393 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
|
394 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
395 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
396 } |
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 r |= tdfx_fmt << 16; |
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 return r; |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
403 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
|
404 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
|
405 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
|
406 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
|
407 u32 cmd_extra = 0,src_ck[2],dst_ck[2],rop123=0; |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
408 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
409 //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
|
410 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
|
411 if(!src_fmt) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
412 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
413 //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
|
414 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
|
415 if(!dst_fmt) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
416 return 0; |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
417 blit->colorkey &= 0x3; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
418 // 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
|
419 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
|
420 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
|
421 // 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
|
422 // 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
|
423 // as non-stretch blit have more options |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
424 if(((!blit->dst_w) && (!blit->dst_h)) || |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
425 ((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
|
426 cmd = 2; |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
427 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
428 // 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
|
429 // 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
|
430 banshee_wait_idle(); |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
431 cmin = tdfx_inl(CLIP0MIN); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
432 cmax = tdfx_inl(CLIP0MAX); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
433 srcbase = tdfx_inl(SRCBASE); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
434 srcxy = tdfx_inl(SRCXY); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
435 srcfmt = tdfx_inl(SRCFORMAT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
436 srcsize = tdfx_inl(SRCSIZE); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
437 dstbase = tdfx_inl(DSTBASE); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
438 dstxy = tdfx_inl(DSTXY); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
439 dstfmt = tdfx_inl(DSTFORMAT); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
440 if(cmd == 2) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
441 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
|
442 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
|
443 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
|
444 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
|
445 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
|
446 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
|
447 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
448 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
|
449 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
|
450 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
|
451 tdfx_outl(SRCCOLORKEYMIN,blit->dst_colorkey[0]); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
452 tdfx_outl(SRCCOLORKEYMAX,blit->dst_colorkey[1]); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
453 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
454 if(blit->colorkey) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
455 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
|
456 rop123 = tdfx_inl(ROP123); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
457 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
|
458 tdfx_outl(ROP123,(blit->rop[1] | (blit->rop[2] << 8) | blit->rop[3] << 16)); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
459 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
460 } |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
461 // 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
|
462 tdfx_outl(CLIP0MIN,0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
463 tdfx_outl(CLIP0MAX,0x0fff0fff); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
464 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
465 // Setup the src |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
466 tdfx_outl(SRCBASE,blit->src & 0x00FFFFFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
467 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
|
468 tdfx_outl(SRCFORMAT,src_fmt); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
469 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
|
470 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
471 // Setup the dst |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
472 tdfx_outl(DSTBASE,blit->dst & 0x00FFFFFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
473 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
|
474 tdfx_outl(DSTFORMAT,dst_fmt); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
475 if(cmd == 2) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
476 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
|
477 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
478 // Send the command |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
479 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
|
480 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
481 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
482 // 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
|
483 tdfx_outl(CLIP0MIN, cmin); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
484 tdfx_outl(CLIP0MAX, cmax); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
485 tdfx_outl(SRCBASE, srcbase); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
486 tdfx_outl(SRCXY, srcxy); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
487 tdfx_outl(SRCFORMAT, srcfmt); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
488 tdfx_outl(SRCSIZE, srcsize); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
489 tdfx_outl(DSTBASE, dstbase); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
490 tdfx_outl(DSTXY, dstxy); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
491 tdfx_outl(DSTFORMAT, dstfmt); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
492 if(cmd == 2) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
493 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
|
494 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
|
495 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
|
496 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
|
497 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
498 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
|
499 tdfx_outl(SRCCOLORKEYMIN,dst_ck[0]); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
500 tdfx_outl(SRCCOLORKEYMAX,dst_ck[1]); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
501 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
502 if(blit->colorkey) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
503 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
|
504 tdfx_outl(ROP123,rop123); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
505 } |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
506 return 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
507 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
508 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
509 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
|
510 tdfx_vid_yuv_t yuv; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
511 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
512 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
|
513 printk(KERN_DEBUG "tdfx_vid:failed copy from userspace\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
514 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
515 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
516 banshee_make_room(2); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
517 tdfx_outl(YUVBASEADDRESS,yuv.base & 0x01FFFFFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
518 tdfx_outl(YUVSTRIDE, yuv.stride & 0x3FFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
519 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
520 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
521 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
522 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
523 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
524 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
525 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
|
526 tdfx_vid_yuv_t yuv; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
527 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
528 yuv.base = tdfx_inl(YUVBASEADDRESS) & 0x01FFFFFF; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
529 yuv.stride = tdfx_inl(YUVSTRIDE) & 0x3FFF; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
530 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
531 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
|
532 printk(KERN_INFO "tdfx_vid:failed copy to userspace\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
533 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
534 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
535 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
536 return 0; |
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 |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
539 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
|
540 tdfx_vid_overlay_t ov; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
541 uint32_t screen_w,screen_h; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
542 uint32_t vidcfg,stride,vidbuf; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
543 int disp_w,disp_h; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
544 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
545 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
|
546 printk(KERN_DEBUG "tdfx_vid:failed copy from userspace\n"); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
547 return(-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
548 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
549 |
10339 | 550 if(ov.dst_y < 0) { |
551 int shift; | |
552 if(-ov.dst_y >= ov.src_height) { | |
553 printk(KERN_DEBUG "tdfx_vid: Overlay outside of the screen ????\n"); | |
554 return(-EFAULT); | |
555 } | |
556 shift = (-ov.dst_y)/(double)ov.dst_height*ov.src_height; | |
557 ov.src[0] += shift*ov.src_stride; | |
558 ov.src_height -= shift; | |
559 ov.dst_height += ov.dst_y; | |
560 ov.dst_y = 0; | |
561 } | |
562 | |
563 if(ov.dst_x < 0) { | |
564 int shift; | |
565 if(-ov.dst_x >= ov.src_width) { | |
566 printk(KERN_DEBUG "tdfx_vid: Overlay outside of the screen ????\n"); | |
567 return(-EFAULT); | |
568 } | |
569 shift = (-ov.dst_x)/(double)ov.dst_width*ov.src_width; | |
570 shift = ((shift+3)/2)*2; | |
571 ov.src[0] += shift*2; | |
572 ov.src_width -= shift; | |
573 ov.dst_width += ov.dst_x; | |
574 ov.dst_x = 0; | |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
575 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
576 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
577 vidcfg = tdfx_inl(VIDPROCCFG); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
578 // clear the overlay fmt |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
579 vidcfg &= ~(7 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
580 switch(ov.format) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
581 case TDFX_VID_FORMAT_BGR15: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
582 vidcfg |= (1 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
583 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
584 case TDFX_VID_FORMAT_BGR16: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
585 vidcfg |= (7 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
586 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
587 case TDFX_VID_FORMAT_YUY2: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
588 vidcfg |= (5 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
589 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
590 case TDFX_VID_FORMAT_UYVY: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
591 vidcfg |= (6 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
592 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
593 default: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
594 printk(KERN_DEBUG "tdfx_vid: Invalid overlay fmt 0x%x\n",ov.format); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
595 return (-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
596 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
597 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
598 // 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
|
599 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
|
600 ov.format == TDFX_VID_FORMAT_UYVY)) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
601 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
|
602 printk(KERN_DEBUG "tdfx_vid: YUV need a 4 bytes aligned stride %d\n",ov.src_stride); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
603 return(-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
604 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
605 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
|
606 printk(KERN_DEBUG "tdfx_vid: YUV need a 4 bytes aligned address 0x%x 0x%x\n",ov.src[0],ov.src[1]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
607 return(-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
608 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
609 } |
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 // 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
|
612 // 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
|
613 // if the size/position is valid |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
614 screen_w = tdfx_inl(VIDSCREENSIZE); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
615 screen_h = (screen_w >> 12) & 0xFFF; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
616 screen_w &= 0xFFF; |
10339 | 617 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
|
618 screen_w - ov.dst_x : ov.dst_width; |
10339 | 619 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
|
620 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
|
621 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
622 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
|
623 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
|
624 printk(KERN_DEBUG "tdfx_vid: Invalid overlay dimension and/or position\n"); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
625 return (-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
626 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
627 // Setup the vidproc |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
628 // H scaling |
9706 | 629 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
|
630 vidcfg |= (1<<14); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
631 else |
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 // V scaling |
9706 | 634 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
|
635 vidcfg |= (1<<15); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
636 else |
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 // 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
|
639 if(!(vidcfg | (1<<26))) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
640 vidcfg |= (3<<16); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
641 else |
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 // disable overlay stereo mode |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
644 vidcfg &= ~(1<<2); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
645 // Colorkey on/off |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
646 if(ov.use_colorkey) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
647 // Colorkey inversion |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
648 if(ov.invert_colorkey) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
649 vidcfg |= (1<<6); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
650 else |
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 vidcfg |= (1<<5); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
653 } else |
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 // Overlay isn't VidIn |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
656 vidcfg &= ~(1<<9); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
657 // vidcfg |= (1<<8); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
658 tdfx_outl(VIDPROCCFG,vidcfg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
659 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
660 // Start coord |
9568 | 661 //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
|
662 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
|
663 // End coord |
10339 | 664 tdfx_outl(VIDOVRENDCRD, ((ov.dst_x + disp_w-1) & 0xFFF)| |
665 (((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
|
666 // H Scaling |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
667 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
|
668 // Src offset and width (in bytes) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
669 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
|
670 // V Scaling |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
671 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
|
672 //else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
673 // tdfx_outl(VIDOVRDVDY,0); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
674 // V Offset |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
675 tdfx_outl(VIDOVRDVDYOFF,0); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
676 // Overlay stride |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
677 stride = tdfx_inl(VIDDESKSTRIDE) & 0xFFFF; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
678 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
|
679 // Buffers address |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
680 tdfx_outl(LEFTOVBUF, ov.src[0]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
681 tdfx_outl(RIGHTOVBUF, ov.src[1]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
682 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
683 // 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
|
684 vidbuf = tdfx_inl(VIDCUROVRSTART); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
685 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
|
686 tdfx_outl(SWAPPENDING,0); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
687 tdfx_outl(SWAPBUFCMD, 1); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
688 } |
9568 | 689 //printk(KERN_DEBUG "tdfx_vid: Buf0=0x%x Buf1=0x%x Current=0x%x\n", |
690 // 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
|
691 // Colorkey |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
692 if(ov.use_colorkey) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
693 tdfx_outl(VIDCHRMIN,ov.colorkey[0]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
694 tdfx_outl(VIDCHRMAX,ov.colorkey[1]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
695 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
696 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
697 return 0; |
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 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
700 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
|
701 uint32_t vidcfg = tdfx_inl(VIDPROCCFG); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
702 //return 0; |
23873 | 703 if(vidcfg & (1<<8)) { // Overlay is already on |
704 //printk(KERN_DEBUG "tdfx_vid: Overlay is already on.\n"); | |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
705 return (-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
706 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
707 vidcfg |= (1<<8); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
708 tdfx_outl(VIDPROCCFG,vidcfg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
709 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
710 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
711 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
712 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
|
713 uint32_t vidcfg = tdfx_inl(VIDPROCCFG); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
714 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
715 if(vidcfg & (1<<8)) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
716 vidcfg &= ~(1<<8); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
717 tdfx_outl(VIDPROCCFG,vidcfg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
718 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
719 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
720 |
23873 | 721 printk(KERN_DEBUG "tdfx_vid: Overlay is already off.\n"); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
722 return (-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
723 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
724 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
725 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
726 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
|
727 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
728 tdfx_vid_agp_move_t move; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
729 tdfx_vid_config_t cfg; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
730 tdfx_vid_blit_t blit; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
731 u16 int16; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
732 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
733 switch(cmd) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
734 case TDFX_VID_AGP_MOVE: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
735 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
|
736 printk(KERN_INFO "tdfx_vid:failed copy from userspace\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
737 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
738 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
739 return agp_move(&move); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
740 case TDFX_VID_BUMP0: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
741 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
|
742 printk(KERN_INFO "tdfx_vid:failed copy from userspace\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
743 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
744 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
745 return bump_fifo(int16); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
746 case TDFX_VID_BLIT: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
747 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
|
748 printk(KERN_INFO "tdfx_vid:failed copy from userspace\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
749 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
750 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
751 if(!tdfx_vid_blit(&blit)) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
752 printk(KERN_INFO "tdfx_vid: Blit failed\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
753 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
754 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
755 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
756 case TDFX_VID_GET_CONFIG: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
757 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
|
758 printk(KERN_INFO "tdfx_vid:failed copy from userspace\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
759 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
760 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
761 tdfx_vid_get_config(&cfg); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
762 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
|
763 printk(KERN_INFO "tdfx_vid:failed copy to userspace\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
764 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
765 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
766 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
767 case TDFX_VID_SET_YUV: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
768 return tdfx_vid_set_yuv(arg); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
769 case TDFX_VID_GET_YUV: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
770 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
|
771 case TDFX_VID_SET_OVERLAY: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
772 return tdfx_vid_set_overlay(arg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
773 case TDFX_VID_OVERLAY_ON: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
774 return tdfx_vid_overlay_on(); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
775 case TDFX_VID_OVERLAY_OFF: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
776 return tdfx_vid_overlay_off(); |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
777 default: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
778 printk(KERN_ERR "tdfx_vid: Invalid ioctl %d\n",cmd); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
779 return (-EINVAL); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
780 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
781 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
782 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
783 |
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 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
|
787 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
788 return 0; |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
791 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
|
792 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
793 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
794 return 0; |
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 |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
797 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
|
798 int i; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
799 struct page *page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
800 unsigned long phys; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
801 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
802 printk(KERN_DEBUG "tdfx_vid: mopen\n"); |
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 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
|
805 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
|
806 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
|
807 if(!page) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
808 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
|
809 return; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
810 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
811 get_page(page); |
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 MOD_INC_USE_COUNT; |
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 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
816 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
|
817 int i; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
818 struct page *page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
819 unsigned long phys; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
820 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
821 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
|
822 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
823 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
|
824 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
|
825 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
|
826 if(!page) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
827 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
|
828 return; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
829 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
830 put_page(page); |
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 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
833 MOD_DEC_USE_COUNT; |
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 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
836 static struct page *tdfx_vid_nopage(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
|
837 unsigned long address, |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
838 int write_access) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
839 unsigned long off; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
840 uint32_t n; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
841 struct page *page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
842 unsigned long phys; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
843 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
844 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
|
845 n = off / PAGE_SIZE; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
846 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
847 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
|
848 printk(KERN_DEBUG "tdfx_vid: Too far away\n"); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
849 return ((struct page *)0UL); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
850 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
851 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
|
852 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
|
853 if(!page) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
854 printk(KERN_DEBUG "tdfx_vid: Can't get the page\n"); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
855 return ((struct page *)0UL); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
856 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
857 return page; |
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 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
860 /* memory handler functions */ |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
861 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
|
862 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
|
863 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
|
864 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
|
865 }; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
866 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
867 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
868 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
|
869 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
870 size_t size; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
871 #ifdef MP_DEBUG |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
872 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
|
873 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
874 |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
875 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
|
876 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
877 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
|
878 if(size*PAGE_SIZE > map_max) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
879 printk(KERN_ERR "tdfx_vid: Not enouth mem\n"); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
880 return(-EAGAIN); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
881 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
882 #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
|
883 if(remap_page_range(vma, vma->vm_start,map_start, |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
884 vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
885 #else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
886 if(remap_page_range(vma->vm_start, (unsigned long)map_start, |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
887 vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
888 #endif |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
889 { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
890 printk(KERN_ERR "tdfx_vid: error mapping video memory\n"); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
891 return(-EAGAIN); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
892 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
893 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
|
894 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
895 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
896 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
897 if(agp_mem) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
898 return(-EAGAIN); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
899 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
900 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
|
901 if(!agp_mem) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
902 printk(KERN_ERR "Failed to allocate AGP memory\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
903 return(-ENOMEM); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
904 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
905 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
906 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
|
907 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
|
908 drm_agp->free_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
909 agp_mem = NULL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
910 return(-ENOMEM); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
911 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
912 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
913 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
|
914 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
|
915 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
916 |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
917 if(tdfx_map_io) { |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
918 #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
|
919 if(remap_page_range(vma, vma->vm_start,agp_info.aper_base, |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
920 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
|
921 #else |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
922 if(remap_page_range(vma->vm_start, (unsigned long)agp_info.aper_base, |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
923 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
|
924 #endif |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
925 { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
926 printk(KERN_ERR "tdfx_vid: error mapping video memory\n"); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
927 return(-EAGAIN); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
928 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
929 } else { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
930 // Never swap it out |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
931 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
|
932 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
|
933 vma->vm_ops->open(vma); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
934 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
|
935 } |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
936 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
937 return 0; |
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 |
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 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
|
942 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
943 #ifdef MP_DEBUG |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
944 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
|
945 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
946 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
947 // Release the agp mem |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
948 if(agp_mem) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
949 drm_agp->unbind_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
950 drm_agp->free_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
951 agp_mem = NULL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
952 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
953 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
954 tdfx_vid_in_use = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
955 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
956 MOD_DEC_USE_COUNT; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
957 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
958 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
959 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
960 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
|
961 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
962 return -ESPIPE; |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
965 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
|
966 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
967 #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
|
968 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
|
969 #else |
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); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
971 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
972 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
973 if(minor != 0) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
974 return(-ENXIO); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
975 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
976 if(tdfx_vid_in_use == 1) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
977 return(-EBUSY); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
978 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
979 tdfx_vid_in_use = 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
980 MOD_INC_USE_COUNT; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
981 return(0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
982 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
983 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
984 #if LINUX_VERSION_CODE >= 0x020400 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
985 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
|
986 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
987 llseek: tdfx_vid_lseek, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
988 read: tdfx_vid_read, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
989 write: tdfx_vid_write, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
990 ioctl: tdfx_vid_ioctl, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
991 mmap: tdfx_vid_mmap, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
992 open: tdfx_vid_open, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
993 release: tdfx_vid_release |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
994 }; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
995 #else |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
996 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
|
997 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
998 tdfx_vid_lseek, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
999 tdfx_vid_read, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1000 tdfx_vid_write, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1001 NULL, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1002 NULL, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1003 tdfx_vid_ioctl, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1004 tdfx_vid_mmap, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1005 tdfx_vid_open, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1006 NULL, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1007 tdfx_vid_release |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1008 }; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1009 #endif |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1012 int init_module(void) |
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 tdfx_vid_in_use = 0; |
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 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
|
1017 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
|
1018 return -EIO; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1019 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1020 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1021 if(!agp_init()) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1022 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
|
1023 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
|
1024 return -EINVAL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1025 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1026 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1027 if (!tdfx_vid_find_card()) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1028 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
|
1029 agp_close(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1030 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
|
1031 return -EINVAL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1032 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1033 |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1036 return (0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1037 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1038 } |
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 void cleanup_module(void) |
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 if(tdfx_mmio_base) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1043 iounmap(tdfx_mmio_base); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1044 agp_close(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1045 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
|
1046 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
|
1047 } |