Mercurial > mplayer.hg
annotate drivers/tdfx_vid.c @ 10252:d275152390ee
I've found some time to implement the encoding support for the new
DivX API. Now it's possible to play and encode movies with the
latest DivX release.
One thing that doesn't work is the new Video Buffer Verifier (VBV)
multipass encoding. The encoder segfaults. Maybe it just isn't
supported with the standard profile of the released binary encoder.
Andreas Hess <jaska@gmx.net>
author | arpi |
---|---|
date | Fri, 06 Jun 2003 19:57:37 +0000 |
parents | 8ae20fe919c9 |
children | 7074d8b6f585 |
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: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
326 printk(KERN_INFO "tdfx_vid: unknow screen format %d\n",in); |
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 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
532 if(ov.dst_x < 0 || ov.dst_y < 0) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
533 printk(KERN_DEBUG "tdfx_vid: Negative x/y not yet supported\n"); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
534 return(-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
535 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
536 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
537 vidcfg = tdfx_inl(VIDPROCCFG); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
538 // clear the overlay fmt |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
539 vidcfg &= ~(7 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
540 switch(ov.format) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
541 case TDFX_VID_FORMAT_BGR15: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
542 vidcfg |= (1 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
543 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
544 case TDFX_VID_FORMAT_BGR16: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
545 vidcfg |= (7 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
546 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
547 case TDFX_VID_FORMAT_YUY2: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
548 vidcfg |= (5 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
549 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
550 case TDFX_VID_FORMAT_UYVY: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
551 vidcfg |= (6 << 21); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
552 break; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
553 default: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
554 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
|
555 return (-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
556 } |
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 // 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
|
559 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
|
560 ov.format == TDFX_VID_FORMAT_UYVY)) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
561 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
|
562 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
|
563 return(-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
564 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
565 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
|
566 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
|
567 return(-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
568 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
569 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
570 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
571 // 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
|
572 // 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
|
573 // if the size/position is valid |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
574 screen_w = tdfx_inl(VIDSCREENSIZE); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
575 screen_h = (screen_w >> 12) & 0xFFF; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
576 screen_w &= 0xFFF; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
577 disp_w = ov.dst_x + ov.dst_width > screen_w ? |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
578 screen_w - ov.dst_x : ov.dst_width; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
579 disp_h = ov.dst_y + ov.dst_height > screen_h ? |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
580 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
|
581 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
582 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
|
583 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
|
584 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
|
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 // Setup the vidproc |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
588 // H scaling |
9706 | 589 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
|
590 vidcfg |= (1<<14); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
591 else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
592 vidcfg &= ~(1<<14); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
593 // V scaling |
9706 | 594 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
|
595 vidcfg |= (1<<15); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
596 else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
597 vidcfg &= ~(1<<15); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
598 // 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
|
599 if(!(vidcfg | (1<<26))) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
600 vidcfg |= (3<<16); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
601 else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
602 vidcfg &= ~(3<<16); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
603 // disable overlay stereo mode |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
604 vidcfg &= ~(1<<2); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
605 // Colorkey on/off |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
606 if(ov.use_colorkey) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
607 // Colorkey inversion |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
608 if(ov.invert_colorkey) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
609 vidcfg |= (1<<6); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
610 else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
611 vidcfg &= ~(1<<6); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
612 vidcfg |= (1<<5); |
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<<5); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
615 // Overlay isn't VidIn |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
616 vidcfg &= ~(1<<9); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
617 // vidcfg |= (1<<8); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
618 tdfx_outl(VIDPROCCFG,vidcfg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
619 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
620 // Start coord |
9568 | 621 //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
|
622 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
|
623 // End coord |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
624 tdfx_outl(VIDOVRENDCRD, ((ov.dst_x + disp_w) & 0xFFF)| |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
625 (((ov.dst_y + disp_h) & 0xFFF)<<12)); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
626 // H Scaling |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
627 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
|
628 // Src offset and width (in bytes) |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
629 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
|
630 // V Scaling |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
631 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
|
632 //else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
633 // tdfx_outl(VIDOVRDVDY,0); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
634 // V Offset |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
635 tdfx_outl(VIDOVRDVDYOFF,0); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
636 // Overlay stride |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
637 stride = tdfx_inl(VIDDESKSTRIDE) & 0xFFFF; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
638 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
|
639 // Buffers address |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
640 tdfx_outl(LEFTOVBUF, ov.src[0]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
641 tdfx_outl(RIGHTOVBUF, ov.src[1]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
642 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
643 // 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
|
644 vidbuf = tdfx_inl(VIDCUROVRSTART); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
645 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
|
646 tdfx_outl(SWAPPENDING,0); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
647 tdfx_outl(SWAPBUFCMD, 1); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
648 } |
9568 | 649 //printk(KERN_DEBUG "tdfx_vid: Buf0=0x%x Buf1=0x%x Current=0x%x\n", |
650 // 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
|
651 // Colorkey |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
652 if(ov.use_colorkey) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
653 tdfx_outl(VIDCHRMIN,ov.colorkey[0]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
654 tdfx_outl(VIDCHRMAX,ov.colorkey[1]); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
655 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
656 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
657 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
658 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
659 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
660 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
|
661 uint32_t vidcfg = tdfx_inl(VIDPROCCFG); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
662 //return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
663 if(vidcfg & (1<<8)) { // Overlay is alredy on |
9568 | 664 //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
|
665 return (-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
666 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
667 vidcfg |= (1<<8); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
668 tdfx_outl(VIDPROCCFG,vidcfg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
669 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
670 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
671 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
672 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
|
673 uint32_t vidcfg = tdfx_inl(VIDPROCCFG); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
674 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
675 if(vidcfg & (1<<8)) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
676 vidcfg &= ~(1<<8); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
677 tdfx_outl(VIDPROCCFG,vidcfg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
678 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
679 } |
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 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
|
682 return (-EFAULT); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
683 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
684 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
685 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
686 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
|
687 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
688 tdfx_vid_agp_move_t move; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
689 tdfx_vid_config_t cfg; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
690 tdfx_vid_blit_t blit; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
691 u16 int16; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
692 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
693 switch(cmd) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
694 case TDFX_VID_AGP_MOVE: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
695 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
|
696 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
|
697 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
698 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
699 return agp_move(&move); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
700 case TDFX_VID_BUMP0: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
701 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
|
702 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
|
703 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
704 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
705 return bump_fifo(int16); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
706 case TDFX_VID_BLIT: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
707 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
|
708 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
|
709 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
710 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
711 if(!tdfx_vid_blit(&blit)) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
712 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
|
713 return(-EFAULT); |
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 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
716 case TDFX_VID_GET_CONFIG: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
717 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
|
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 tdfx_vid_get_config(&cfg); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
722 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
|
723 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
|
724 return(-EFAULT); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
725 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
726 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
727 case TDFX_VID_SET_YUV: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
728 return tdfx_vid_set_yuv(arg); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
729 case TDFX_VID_GET_YUV: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
730 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
|
731 case TDFX_VID_SET_OVERLAY: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
732 return tdfx_vid_set_overlay(arg); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
733 case TDFX_VID_OVERLAY_ON: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
734 return tdfx_vid_overlay_on(); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
735 case TDFX_VID_OVERLAY_OFF: |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
736 return tdfx_vid_overlay_off(); |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
737 default: |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
738 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
|
739 return (-EINVAL); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
740 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
741 return 0; |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
744 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
745 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
746 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
|
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 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
750 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
751 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
|
752 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
753 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
754 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
755 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
756 |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
757 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
|
758 int i; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
759 struct page *page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
760 unsigned long phys; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
761 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
762 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
|
763 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
764 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
|
765 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
|
766 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
|
767 if(!page) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
768 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
|
769 return; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
770 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
771 get_page(page); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
772 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
773 MOD_INC_USE_COUNT; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
774 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
775 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
776 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
|
777 int i; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
778 struct page *page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
779 unsigned long phys; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
780 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
781 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
|
782 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
783 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
|
784 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
|
785 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
|
786 if(!page) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
787 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
|
788 return; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
789 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
790 put_page(page); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
791 } |
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 MOD_DEC_USE_COUNT; |
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 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
796 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
|
797 unsigned long address, |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
798 int write_access) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
799 unsigned long off; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
800 uint32_t n; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
801 struct page *page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
802 unsigned long phys; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
803 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
804 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
|
805 n = off / PAGE_SIZE; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
806 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
807 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
|
808 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
|
809 return ((struct page *)0UL); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
810 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
811 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
|
812 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
|
813 if(!page) { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
814 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
|
815 return ((struct page *)0UL); |
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 return page; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
818 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
819 |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
820 /* memory handler functions */ |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
821 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
|
822 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
|
823 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
|
824 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
|
825 }; |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
826 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
827 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
828 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
|
829 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
830 size_t size; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
831 #ifdef MP_DEBUG |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
832 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
|
833 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
834 |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
835 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
|
836 |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
837 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
|
838 if(size*PAGE_SIZE > map_max) { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
839 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
|
840 return(-EAGAIN); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
841 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
842 #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
|
843 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
|
844 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
|
845 #else |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
846 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
|
847 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
|
848 #endif |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
849 { |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
850 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
|
851 return(-EAGAIN); |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
852 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
853 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
|
854 return 0; |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
855 } |
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
856 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
857 if(agp_mem) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
858 return(-EAGAIN); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
859 |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
860 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
|
861 if(!agp_mem) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
862 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
|
863 return(-ENOMEM); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
864 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
865 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
866 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
|
867 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
|
868 drm_agp->free_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
869 agp_mem = NULL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
870 return(-ENOMEM); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
871 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
872 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
873 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
|
874 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
|
875 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
876 |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
877 if(tdfx_map_io) { |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
878 #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
|
879 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
|
880 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
|
881 #else |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
882 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
|
883 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
|
884 #endif |
9558
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
885 { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
886 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
|
887 return(-EAGAIN); |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
888 } |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
889 } else { |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
890 // Never swap it out |
29aa61268e54
Update, new page fault handler to access the agp mem. Doesn't really work
albeu
parents:
9545
diff
changeset
|
891 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
|
892 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
|
893 vma->vm_ops->open(vma); |
9566
015b404023f5
Overlay support (now vo_xtdfx is possible :) and yet another way to
albeu
parents:
9558
diff
changeset
|
894 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
|
895 } |
9545
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
896 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
897 return 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
898 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
899 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
900 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
901 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
|
902 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
903 #ifdef MP_DEBUG |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
904 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
|
905 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
906 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
907 // Release the agp mem |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
908 if(agp_mem) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
909 drm_agp->unbind_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
910 drm_agp->free_memory(agp_mem); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
911 agp_mem = NULL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
912 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
913 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
914 tdfx_vid_in_use = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
915 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
916 MOD_DEC_USE_COUNT; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
917 return 0; |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
920 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
|
921 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
922 return -ESPIPE; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
923 } |
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 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
|
926 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
927 #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
|
928 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
|
929 #else |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
930 int minor = MINOR(inode->i_rdev); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
931 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
932 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
933 if(minor != 0) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
934 return(-ENXIO); |
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 if(tdfx_vid_in_use == 1) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
937 return(-EBUSY); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
938 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
939 tdfx_vid_in_use = 1; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
940 MOD_INC_USE_COUNT; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
941 return(0); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
942 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
943 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
944 #if LINUX_VERSION_CODE >= 0x020400 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
945 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
|
946 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
947 llseek: tdfx_vid_lseek, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
948 read: tdfx_vid_read, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
949 write: tdfx_vid_write, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
950 ioctl: tdfx_vid_ioctl, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
951 mmap: tdfx_vid_mmap, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
952 open: tdfx_vid_open, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
953 release: tdfx_vid_release |
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 #else |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
956 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
|
957 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
958 tdfx_vid_lseek, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
959 tdfx_vid_read, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
960 tdfx_vid_write, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
961 NULL, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
962 NULL, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
963 tdfx_vid_ioctl, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
964 tdfx_vid_mmap, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
965 tdfx_vid_open, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
966 NULL, |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
967 tdfx_vid_release |
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 #endif |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
970 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
971 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
972 int init_module(void) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
973 { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
974 tdfx_vid_in_use = 0; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
975 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
976 if(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
|
977 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
|
978 return -EIO; |
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 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
981 if(!agp_init()) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
982 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
|
983 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
|
984 return -EINVAL; |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
985 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
986 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
987 if (!tdfx_vid_find_card()) { |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
988 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
|
989 agp_close(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
990 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
|
991 return -EINVAL; |
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 |
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 return (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 } |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
999 |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1000 void cleanup_module(void) |
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 if(tdfx_mmio_base) |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1003 iounmap(tdfx_mmio_base); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1004 agp_close(); |
d1bbeae9f46a
tdfx_vid a new kernel driver for tdfx wich let use agp move :)
albeu
parents:
diff
changeset
|
1005 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
|
1006 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
|
1007 } |