Mercurial > mplayer.hg
annotate drivers/tdfx_vid.c @ 16915:6b1d1e4adaea
Speex support. Seeking and pts generation does not work.
author | reimar |
---|---|
date | Sat, 05 Nov 2005 11:58:25 +0000 |
parents | 6180d7558f75 |
children | 49a433e2e78f |
rev | line source |
---|---|
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
2 #include <linux/config.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
3 #include <linux/version.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
4 #include <linux/module.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
5 #include <linux/types.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
6 #include <linux/kernel.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
7 #include <linux/sched.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
8 #include <linux/mm.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
9 #include <linux/string.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
10 #include <linux/errno.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
11 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
12 #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
|
13 #include <linux/malloc.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
14 #else |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
15 #include <linux/slab.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
16 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
17 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
18 #include <linux/pci.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
19 #include <linux/ioport.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
20 #include <linux/init.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
21 #include <linux/agp_backend.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
22 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
23 #include <asm/uaccess.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
24 #include <asm/system.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
25 #include <asm/io.h> |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
26 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
27 #include "tdfx_vid.h" |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
28 #include "3dfx.h" |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
29 |
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 #define TDFX_VID_MAJOR 178 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
32 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
33 MODULE_AUTHOR("Albeu"); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
34 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
|
35 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
36 #ifdef MODULE_LICENSE |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
37 MODULE_LICENSE("GPL"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
38 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
39 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
40 #ifndef min |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
41 #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
|
42 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
43 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
44 static struct pci_dev *pci_dev; |
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 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
|
47 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
|
48 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
|
49 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
50 static int tdfx_ram_size = 0; |
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 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
|
53 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
54 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
|
55 static agp_kern_info agp_info; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
56 static agp_memory *agp_mem = NULL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
57 |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
58 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
|
59 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
|
60 static __initdata unsigned long map_max = (10*1024*1024); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
61 static unsigned long map_base = 0; |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
62 |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
63 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
|
64 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
|
65 MODULE_PARM(map_start,"l"); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
66 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
|
67 MODULE_PARM(map_max,"l"); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
68 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
|
69 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
70 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
|
71 return readl(tdfx_mmio_base + reg); |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
74 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
|
75 writel(val,tdfx_mmio_base + reg); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
76 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
77 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
78 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
|
79 while((tdfx_inl(STATUS) & 0x1f) < size); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
80 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
81 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
82 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
|
83 int i = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
84 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
85 banshee_make_room(1); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
86 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
|
87 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
88 while(1) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
89 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
|
90 if(i == 3) break; |
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 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
93 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
94 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
|
95 u32 draminit0 = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
96 u32 draminit1 = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
97 // u32 miscinit1 = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
98 u32 lfbsize = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
99 int sgram_p = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
100 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
101 draminit0 = tdfx_inl(DRAMINIT0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
102 draminit1 = tdfx_inl(DRAMINIT1); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
103 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
104 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
|
105 (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
|
106 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
|
107 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
108 lfbsize = sgram_p ? |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
109 (((draminit0 & DRAMINIT0_SGRAM_NUM) ? 2 : 1) * |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
110 ((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
|
111 16 * 1024 * 1024; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
112 } else { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
113 /* Voodoo4/5 */ |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
114 u32 chips, psize, banks; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
115 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
116 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
|
117 psize = 1 << ((draminit0 & 0x38000000) >> 28); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
118 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
|
119 lfbsize = chips * psize * banks; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
120 lfbsize <<= 20; |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
123 #if 0 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
124 /* disable block writes for SDRAM (why?) */ |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
125 miscinit1 = tdfx_inl(MISCINIT1); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
126 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
|
127 miscinit1 |= MISCINIT1_CLUT_INV; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
128 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
129 banshee_make_room(1); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
130 tdfx_outl(MISCINIT1, miscinit1); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
131 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
132 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
133 return lfbsize; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
134 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
135 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
136 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
|
137 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
138 struct pci_dev *dev = NULL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
139 // unsigned int card_option; |
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((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
|
142 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
|
143 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
|
144 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
|
145 else |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
146 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
147 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
148 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
149 pci_dev = dev; |
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 #if LINUX_VERSION_CODE >= 0x020300 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
152 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
|
153 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
|
154 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
|
155 #else |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
156 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
|
157 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
|
158 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
|
159 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
160 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
|
161 tdfx_ram_size = get_lfb_size(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
162 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
163 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
|
164 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
|
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 #if 0 |
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 int temp; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
170 printk("List resources -----------\n"); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
171 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
|
172 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
|
173 if(res->flags){ |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
174 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
|
175 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
|
176 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
|
177 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
|
178 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
179 } |
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 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
182 #endif |
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 return 1; |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
188 static int agp_init(void) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
189 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
190 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
|
191 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
192 if(!drm_agp) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
193 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
|
194 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
195 } |
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 if(drm_agp->acquire()) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
198 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
|
199 drm_agp = NULL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
200 return 0; |
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 drm_agp->copy_info(&agp_info); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
204 #if 0 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
205 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
|
206 "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
|
207 "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
|
208 "Page mask = %#X\n", |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
209 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
|
210 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
|
211 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
|
212 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
|
213 agp_info.page_mask); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
214 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
215 drm_agp->enable(agp_info.mode); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
216 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
217 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
218 printk(KERN_INFO "AGP Enabled\n"); |
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 return 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
221 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
222 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
223 static void agp_close(void) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
224 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
225 if(!drm_agp) return; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
226 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
227 if(agp_mem) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
228 drm_agp->unbind_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
229 drm_agp->free_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
230 agp_mem = NULL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
231 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
232 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
233 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
234 drm_agp->release(); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
235 inter_module_put("drm_agp"); |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
236 } |
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 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
|
239 u32 src = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
240 u32 src_h,src_l; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
241 |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
242 if(!(agp_mem||map_start)) |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
243 return (-EAGAIN); |
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(m->move2 > 3) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
246 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
|
247 m->move2); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
248 return (-EAGAIN); |
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 |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
251 if(map_start) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
252 src = map_start + m->src; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
253 else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
254 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
|
255 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
256 src_l = (u32)src; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
257 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
|
258 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
259 // banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
260 banshee_make_room(6); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
261 tdfx_outl(AGPHOSTADDRESSHIGH,src_h); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
262 tdfx_outl(AGPHOSTADDRESSLOW,src_l); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
263 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
264 tdfx_outl(AGPGRAPHICSADDRESS, m->dst); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
265 tdfx_outl(AGPGRAPHICSSTRIDE, m->dst_stride); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
266 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
|
267 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
268 tdfx_outl(AGPMOVECMD,m->move2 << 3); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
269 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
270 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
271 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
272 } |
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 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
|
275 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
|
276 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
|
277 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
278 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
279 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
280 tdfx_outl(CMDBASEADDR0,addr >> 4); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
281 tdfx_outl(CMDRDPTRL0, addr << 4); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
282 tdfx_outl(CMDRDPTRH0, addr >> 28); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
283 tdfx_outl(CMDAMIN0, (addr - 4) & 0xFFFFFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
284 tdfx_outl(CMDAMAX0, (addr - 4) & 0xFFFFFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
285 tdfx_outl(CMDFIFODEPTH0, 0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
286 tdfx_outl(CMDHOLECNT0, 0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
287 tdfx_outl(CMDBASESIZE0,size); |
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 banshee_wait_idle(); |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
293 static int bump_fifo(u16 size) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
294 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
295 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
296 tdfx_outl(CMDBUMP0 , size); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
297 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
298 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
299 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
300 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
301 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
302 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
|
303 u32 in; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
304 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
305 cfg->version = TDFX_VID_VERSION; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
306 cfg->ram_size = tdfx_ram_size; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
307 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
308 in = tdfx_inl(VIDSCREENSIZE); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
309 cfg->screen_width = in & 0xFFF; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
310 cfg->screen_height = (in >> 12) & 0xFFF; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
311 in = (tdfx_inl(VIDPROCCFG)>> 18)& 0x7; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
312 switch(in) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
313 case 0: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
314 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
|
315 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
316 case 1: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
317 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
|
318 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
319 case 2: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
320 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
|
321 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
322 case 3: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
323 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
|
324 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
325 default: |
10397 | 326 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
|
327 cfg->screen_format = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
328 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
329 } |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
330 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
|
331 cfg->screen_start = tdfx_inl(VIDDESKSTART); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
332 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
333 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
334 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
|
335 u32 r = stride & 0xFFF3; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
336 u32 tdfx_fmt = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
337 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
338 // src and dest formats |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
339 switch(fmt) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
340 case TDFX_VID_FORMAT_BGR8: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
341 tdfx_fmt = 1; |
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 case TDFX_VID_FORMAT_BGR16: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
344 tdfx_fmt = 3; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
345 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
346 case TDFX_VID_FORMAT_BGR24: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
347 tdfx_fmt = 4; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
348 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
349 case TDFX_VID_FORMAT_BGR32: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
350 tdfx_fmt = 5; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
351 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
352 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
353 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
354 if(!src && !tdfx_fmt) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
355 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
|
356 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
357 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
358 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
359 if(src && !tdfx_fmt) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
360 // src only format |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
361 switch(fmt){ |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
362 case TDFX_VID_FORMAT_BGR1: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
363 tdfx_fmt = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
364 break; |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
365 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
|
366 tdfx_fmt = 2; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
367 break; |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
368 case TDFX_VID_FORMAT_YUY2: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
369 tdfx_fmt = 8; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
370 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
371 case TDFX_VID_FORMAT_UYVY: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
372 tdfx_fmt = 9; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
373 break; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
374 default: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
375 printk(KERN_INFO "tdfx_vid: Invalid source format %#X\n",fmt); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
376 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
377 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
378 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
379 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
380 r |= tdfx_fmt << 16; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
381 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
382 return r; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
383 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
384 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
385 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
|
386 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
|
387 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
|
388 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
|
389 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
|
390 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
391 //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
|
392 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
|
393 if(!src_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 //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
|
396 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
|
397 if(!dst_fmt) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
398 return 0; |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
399 blit->colorkey &= 0x3; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
400 // 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
|
401 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
|
402 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
|
403 // 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
|
404 // 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
|
405 // 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
|
406 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
|
407 ((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
|
408 cmd = 2; |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
409 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
410 // 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
|
411 // 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
|
412 banshee_wait_idle(); |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
413 cmin = tdfx_inl(CLIP0MIN); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
414 cmax = tdfx_inl(CLIP0MAX); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
415 srcbase = tdfx_inl(SRCBASE); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
416 srcxy = tdfx_inl(SRCXY); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
417 srcfmt = tdfx_inl(SRCFORMAT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
418 srcsize = tdfx_inl(SRCSIZE); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
419 dstbase = tdfx_inl(DSTBASE); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
420 dstxy = tdfx_inl(DSTXY); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
421 dstfmt = tdfx_inl(DSTFORMAT); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
422 if(cmd == 2) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 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
|
427 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
|
428 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
|
429 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
430 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
|
431 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
|
432 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
|
433 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
|
434 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
|
435 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
436 if(blit->colorkey) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
437 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
|
438 rop123 = tdfx_inl(ROP123); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
439 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
|
440 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
|
441 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
442 } |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
443 // 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
|
444 tdfx_outl(CLIP0MIN,0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
445 tdfx_outl(CLIP0MAX,0x0fff0fff); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
446 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
447 // Setup the src |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
448 tdfx_outl(SRCBASE,blit->src & 0x00FFFFFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
449 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
|
450 tdfx_outl(SRCFORMAT,src_fmt); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
451 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
|
452 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
453 // Setup the dst |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
454 tdfx_outl(DSTBASE,blit->dst & 0x00FFFFFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
455 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
|
456 tdfx_outl(DSTFORMAT,dst_fmt); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
457 if(cmd == 2) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
458 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
|
459 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
460 // Send the command |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
461 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
|
462 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
463 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
464 // 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
|
465 tdfx_outl(CLIP0MIN, cmin); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
466 tdfx_outl(CLIP0MAX, cmax); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
467 tdfx_outl(SRCBASE, srcbase); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
468 tdfx_outl(SRCXY, srcxy); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
469 tdfx_outl(SRCFORMAT, srcfmt); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
470 tdfx_outl(SRCSIZE, srcsize); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
471 tdfx_outl(DSTBASE, dstbase); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
472 tdfx_outl(DSTXY, dstxy); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
473 tdfx_outl(DSTFORMAT, dstfmt); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
474 if(cmd == 2) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
475 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
|
476 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
|
477 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
|
478 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
|
479 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
480 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
|
481 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
|
482 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
|
483 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
484 if(blit->colorkey) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
485 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
|
486 tdfx_outl(ROP123,rop123); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
487 } |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
488 return 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
489 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
490 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
491 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
|
492 tdfx_vid_yuv_t yuv; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
493 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
494 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
|
495 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
|
496 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
497 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
498 banshee_make_room(2); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
499 tdfx_outl(YUVBASEADDRESS,yuv.base & 0x01FFFFFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
500 tdfx_outl(YUVSTRIDE, yuv.stride & 0x3FFF); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
501 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
502 banshee_wait_idle(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
503 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
504 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
505 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
506 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
507 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
|
508 tdfx_vid_yuv_t yuv; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
509 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
510 yuv.base = tdfx_inl(YUVBASEADDRESS) & 0x01FFFFFF; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
511 yuv.stride = tdfx_inl(YUVSTRIDE) & 0x3FFF; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
512 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
513 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
|
514 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
|
515 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
516 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
517 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
518 return 0; |
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 |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
521 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
|
522 tdfx_vid_overlay_t ov; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
523 uint32_t screen_w,screen_h; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
524 uint32_t vidcfg,stride,vidbuf; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
525 int disp_w,disp_h; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
526 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
527 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
|
528 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
|
529 return(-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
530 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
531 |
10339 | 532 if(ov.dst_y < 0) { |
533 int shift; | |
534 if(-ov.dst_y >= ov.src_height) { | |
535 printk(KERN_DEBUG "tdfx_vid: Overlay outside of the screen ????\n"); | |
536 return(-EFAULT); | |
537 } | |
538 shift = (-ov.dst_y)/(double)ov.dst_height*ov.src_height; | |
539 ov.src[0] += shift*ov.src_stride; | |
540 ov.src_height -= shift; | |
541 ov.dst_height += ov.dst_y; | |
542 ov.dst_y = 0; | |
543 } | |
544 | |
545 if(ov.dst_x < 0) { | |
546 int shift; | |
547 if(-ov.dst_x >= ov.src_width) { | |
548 printk(KERN_DEBUG "tdfx_vid: Overlay outside of the screen ????\n"); | |
549 return(-EFAULT); | |
550 } | |
551 shift = (-ov.dst_x)/(double)ov.dst_width*ov.src_width; | |
552 shift = ((shift+3)/2)*2; | |
553 ov.src[0] += shift*2; | |
554 ov.src_width -= shift; | |
555 ov.dst_width += ov.dst_x; | |
556 ov.dst_x = 0; | |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
557 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
558 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
559 vidcfg = tdfx_inl(VIDPROCCFG); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
560 // clear the overlay fmt |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
561 vidcfg &= ~(7 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
562 switch(ov.format) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
563 case TDFX_VID_FORMAT_BGR15: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
564 vidcfg |= (1 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
565 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
566 case TDFX_VID_FORMAT_BGR16: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
567 vidcfg |= (7 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
568 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
569 case TDFX_VID_FORMAT_YUY2: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
570 vidcfg |= (5 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
571 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
572 case TDFX_VID_FORMAT_UYVY: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
573 vidcfg |= (6 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
574 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
575 default: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
576 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
|
577 return (-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
578 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
579 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
580 // 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
|
581 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
|
582 ov.format == TDFX_VID_FORMAT_UYVY)) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
583 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
|
584 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
|
585 return(-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
586 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
587 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
|
588 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
|
589 return(-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
590 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
591 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
592 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
593 // 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
|
594 // 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
|
595 // if the size/position is valid |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
596 screen_w = tdfx_inl(VIDSCREENSIZE); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
597 screen_h = (screen_w >> 12) & 0xFFF; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
598 screen_w &= 0xFFF; |
10339 | 599 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
|
600 screen_w - ov.dst_x : ov.dst_width; |
10339 | 601 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
|
602 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
|
603 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
604 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
|
605 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
|
606 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
|
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 // Setup the vidproc |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
610 // H scaling |
9706 | 611 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
|
612 vidcfg |= (1<<14); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
613 else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
614 vidcfg &= ~(1<<14); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
615 // V scaling |
9706 | 616 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
|
617 vidcfg |= (1<<15); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
618 else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
619 vidcfg &= ~(1<<15); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
620 // 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
|
621 if(!(vidcfg | (1<<26))) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
622 vidcfg |= (3<<16); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
623 else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
624 vidcfg &= ~(3<<16); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
625 // disable overlay stereo mode |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
626 vidcfg &= ~(1<<2); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
627 // Colorkey on/off |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
628 if(ov.use_colorkey) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
629 // Colorkey inversion |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
630 if(ov.invert_colorkey) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
631 vidcfg |= (1<<6); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
632 else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
633 vidcfg &= ~(1<<6); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
634 vidcfg |= (1<<5); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
635 } else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
636 vidcfg &= ~(1<<5); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
637 // Overlay isn't VidIn |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
638 vidcfg &= ~(1<<9); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
639 // vidcfg |= (1<<8); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
640 tdfx_outl(VIDPROCCFG,vidcfg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
641 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
642 // Start coord |
9568 | 643 //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
|
644 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
|
645 // End coord |
10339 | 646 tdfx_outl(VIDOVRENDCRD, ((ov.dst_x + disp_w-1) & 0xFFF)| |
647 (((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
|
648 // H Scaling |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
649 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
|
650 // Src offset and width (in bytes) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
651 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
|
652 // V Scaling |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
653 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
|
654 //else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
655 // tdfx_outl(VIDOVRDVDY,0); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
656 // V Offset |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
657 tdfx_outl(VIDOVRDVDYOFF,0); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
658 // Overlay stride |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
659 stride = tdfx_inl(VIDDESKSTRIDE) & 0xFFFF; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
660 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
|
661 // Buffers address |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
662 tdfx_outl(LEFTOVBUF, ov.src[0]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
663 tdfx_outl(RIGHTOVBUF, ov.src[1]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
664 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
665 // 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
|
666 vidbuf = tdfx_inl(VIDCUROVRSTART); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
667 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
|
668 tdfx_outl(SWAPPENDING,0); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
669 tdfx_outl(SWAPBUFCMD, 1); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
670 } |
9568 | 671 //printk(KERN_DEBUG "tdfx_vid: Buf0=0x%x Buf1=0x%x Current=0x%x\n", |
672 // 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
|
673 // Colorkey |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
674 if(ov.use_colorkey) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
675 tdfx_outl(VIDCHRMIN,ov.colorkey[0]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
676 tdfx_outl(VIDCHRMAX,ov.colorkey[1]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
677 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
678 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
679 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
680 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
681 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
682 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
|
683 uint32_t vidcfg = tdfx_inl(VIDPROCCFG); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
684 //return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
685 if(vidcfg & (1<<8)) { // Overlay is alredy on |
9568 | 686 //printk(KERN_DEBUG "tdfx_vid: Overlay is alredy on\n"); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
687 return (-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
688 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
689 vidcfg |= (1<<8); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
690 tdfx_outl(VIDPROCCFG,vidcfg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
691 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
692 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
693 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
694 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
|
695 uint32_t vidcfg = tdfx_inl(VIDPROCCFG); |
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 if(vidcfg & (1<<8)) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
698 vidcfg &= ~(1<<8); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
699 tdfx_outl(VIDPROCCFG,vidcfg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
700 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
701 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
702 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
703 printk(KERN_DEBUG "tdfx_vid: Overlay is alredy off\n"); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
704 return (-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
705 } |
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 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
708 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
|
709 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
710 tdfx_vid_agp_move_t move; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
711 tdfx_vid_config_t cfg; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
712 tdfx_vid_blit_t blit; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
713 u16 int16; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
714 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
715 switch(cmd) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
716 case TDFX_VID_AGP_MOVE: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
717 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
|
718 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
|
719 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
720 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
721 return agp_move(&move); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
722 case TDFX_VID_BUMP0: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
723 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
|
724 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
|
725 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
726 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
727 return bump_fifo(int16); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
728 case TDFX_VID_BLIT: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
729 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
|
730 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
|
731 return(-EFAULT); |
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 if(!tdfx_vid_blit(&blit)) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
734 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
|
735 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
736 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
737 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
738 case TDFX_VID_GET_CONFIG: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
739 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
|
740 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
|
741 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
742 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
743 tdfx_vid_get_config(&cfg); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
744 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
|
745 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
|
746 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
747 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
748 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
749 case TDFX_VID_SET_YUV: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
750 return tdfx_vid_set_yuv(arg); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
751 case TDFX_VID_GET_YUV: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
752 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
|
753 case TDFX_VID_SET_OVERLAY: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
754 return tdfx_vid_set_overlay(arg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
755 case TDFX_VID_OVERLAY_ON: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
756 return tdfx_vid_overlay_on(); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
757 case TDFX_VID_OVERLAY_OFF: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
758 return tdfx_vid_overlay_off(); |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
759 default: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
760 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
|
761 return (-EINVAL); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
762 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
763 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
764 } |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
767 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
768 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
|
769 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
770 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
771 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
772 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
773 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
|
774 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
775 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
776 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
777 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
778 |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
779 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
|
780 int i; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
781 struct page *page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
782 unsigned long phys; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
783 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
784 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
|
785 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
786 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
|
787 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
|
788 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
|
789 if(!page) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
790 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
|
791 return; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
792 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
793 get_page(page); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
794 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
795 MOD_INC_USE_COUNT; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
796 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
797 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
798 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
|
799 int i; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
800 struct page *page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
801 unsigned long phys; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
802 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
803 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
|
804 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
805 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
|
806 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
|
807 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
|
808 if(!page) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
809 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
|
810 return; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
811 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
812 put_page(page); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
813 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
814 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
815 MOD_DEC_USE_COUNT; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
816 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
817 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
818 static 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
|
819 unsigned long address, |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
820 int write_access) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
821 unsigned long off; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
822 uint32_t n; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
823 struct page *page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
824 unsigned long phys; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
825 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
826 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
|
827 n = off / PAGE_SIZE; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
828 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
829 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
|
830 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
|
831 return ((struct page *)0UL); |
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 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
|
834 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
|
835 if(!page) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
836 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
|
837 return ((struct page *)0UL); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
838 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
839 return page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
840 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
841 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
842 /* memory handler functions */ |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
843 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
|
844 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
|
845 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
|
846 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
|
847 }; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
848 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
849 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
850 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
|
851 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
852 size_t size; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
853 #ifdef MP_DEBUG |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
854 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
|
855 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
856 |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
857 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
|
858 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
859 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
|
860 if(size*PAGE_SIZE > map_max) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
861 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
|
862 return(-EAGAIN); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
863 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
864 #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
|
865 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
|
866 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
|
867 #else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
868 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
|
869 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
|
870 #endif |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
871 { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
872 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
|
873 return(-EAGAIN); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
874 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
875 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
|
876 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
877 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
878 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
879 if(agp_mem) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
880 return(-EAGAIN); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
881 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
882 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
|
883 if(!agp_mem) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
884 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
|
885 return(-ENOMEM); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
886 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
887 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
888 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
|
889 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
|
890 drm_agp->free_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
891 agp_mem = NULL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
892 return(-ENOMEM); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
893 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
894 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
895 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
|
896 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
|
897 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
898 |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
899 if(tdfx_map_io) { |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
900 #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
|
901 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
|
902 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
|
903 #else |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
904 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
|
905 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
|
906 #endif |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
907 { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
908 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
|
909 return(-EAGAIN); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
910 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
911 } else { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
912 // Never swap it out |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
913 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
|
914 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
|
915 vma->vm_ops->open(vma); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
916 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
|
917 } |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
918 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
919 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
920 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
921 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
922 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
923 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
|
924 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
925 #ifdef MP_DEBUG |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
926 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
|
927 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
928 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
929 // Release the agp mem |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
930 if(agp_mem) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
931 drm_agp->unbind_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
932 drm_agp->free_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
933 agp_mem = NULL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
934 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
935 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
936 tdfx_vid_in_use = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
937 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
938 MOD_DEC_USE_COUNT; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
939 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
940 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
941 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
942 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
|
943 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
944 return -ESPIPE; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
945 } |
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 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
|
948 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
949 #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
|
950 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
|
951 #else |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
952 int minor = MINOR(inode->i_rdev); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
953 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
954 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
955 if(minor != 0) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
956 return(-ENXIO); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
957 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
958 if(tdfx_vid_in_use == 1) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
959 return(-EBUSY); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
960 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
961 tdfx_vid_in_use = 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
962 MOD_INC_USE_COUNT; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
963 return(0); |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
966 #if LINUX_VERSION_CODE >= 0x020400 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
967 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
|
968 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
969 llseek: tdfx_vid_lseek, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
970 read: tdfx_vid_read, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
971 write: tdfx_vid_write, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
972 ioctl: tdfx_vid_ioctl, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
973 mmap: tdfx_vid_mmap, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
974 open: tdfx_vid_open, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
975 release: tdfx_vid_release |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
976 }; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
977 #else |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
978 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
|
979 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
980 tdfx_vid_lseek, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
981 tdfx_vid_read, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
982 tdfx_vid_write, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
983 NULL, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
984 NULL, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
985 tdfx_vid_ioctl, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
986 tdfx_vid_mmap, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
987 tdfx_vid_open, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
988 NULL, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
989 tdfx_vid_release |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
990 }; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
991 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
992 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
993 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
994 int init_module(void) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
995 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
996 tdfx_vid_in_use = 0; |
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 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
|
999 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
|
1000 return -EIO; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1001 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1002 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1003 if(!agp_init()) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1004 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
|
1005 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
|
1006 return -EINVAL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1007 } |
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 if (!tdfx_vid_find_card()) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1010 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
|
1011 agp_close(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1012 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
|
1013 return -EINVAL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1014 } |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1017 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1018 return (0); |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1022 void cleanup_module(void) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1023 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1024 if(tdfx_mmio_base) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1025 iounmap(tdfx_mmio_base); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1026 agp_close(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1027 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
|
1028 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
|
1029 } |