Rev 954 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 954 | Rev 1002 | ||
---|---|---|---|
1 | #define R300_PIO 0 /* now we have cp */ |
1 | #define R300_PIO 1 |
2 | 2 | ||
- | 3 | ||
- | 4 | #define API_VERSION 0x01000100 |
|
- | 5 | ||
- | 6 | #define SRV_GETVERSION 0 |
|
- | 7 | ||
3 | 8 | ||
4 | #include "types.h" |
9 | #include "types.h" |
5 | 10 | ||
6 | #include |
11 | #include |
7 | #include |
12 | #include |
8 | #include |
13 | #include |
9 | 14 | ||
10 | #include "pci.h" |
15 | #include "pci.h" |
11 | 16 | ||
12 | #include "syscall.h" |
17 | #include "syscall.h" |
13 | 18 | ||
14 | #include "radeon_reg.h" |
19 | #include "radeon_reg.h" |
15 | 20 | ||
16 | #include "ati2d.h" |
21 | #include "ati2d.h" |
17 | #include "accel_2d.h" |
22 | #include "accel_2d.h" |
18 | 23 | ||
19 | RHD_t rhd __attribute__ ((aligned (128))); /* reduce cache lock */ |
24 | RHD_t rhd __attribute__ ((aligned (128))); /* reduce cache lock */ |
20 | 25 | ||
21 | static clip_t clip; |
26 | static clip_t clip; |
22 | 27 | ||
23 | static local_pixmap_t scr_pixmap; |
28 | static local_pixmap_t scr_pixmap; |
24 | 29 | ||
25 | int Init3DEngine(RHDPtr info); |
30 | int Init3DEngine(RHDPtr info); |
26 | 31 | ||
27 | int __stdcall srv_2d(ioctl_t *io); |
32 | int __stdcall srv_2d(ioctl_t *io); |
28 | 33 | ||
29 | u32_t __stdcall drvEntry(int action) |
34 | u32_t __stdcall drvEntry(int action) |
30 | { |
35 | { |
31 | RHDPtr rhdPtr; |
36 | RHDPtr rhdPtr; |
32 | u32_t retval; |
37 | u32_t retval; |
33 | 38 | ||
34 | int i; |
39 | int i; |
35 | 40 | ||
36 | if(action != 1) |
41 | if(action != 1) |
37 | return 0; |
42 | return 0; |
38 | 43 | ||
39 | if(!dbg_open("/rd/1/drivers/ati2d.log")) |
44 | if(!dbg_open("/rd/1/drivers/ati2d.log")) |
40 | { |
45 | { |
41 | printf("Can't open /rd/1/drivers/ati2d.log\nExit\n"); |
46 | printf("Can't open /rd/1/drivers/ati2d.log\nExit\n"); |
42 | return 0; |
47 | return 0; |
43 | } |
48 | } |
44 | if( GetScreenBpp() != 32) |
49 | if( GetScreenBpp() != 32) |
45 | { |
50 | { |
46 | dbgprintf("32 bpp dispaly mode required !\nExit\t"); |
51 | dbgprintf("32 bpp dispaly mode required !\nExit\t"); |
47 | return 0; |
52 | return 0; |
48 | } |
53 | } |
49 | 54 | ||
50 | if((rhdPtr=FindPciDevice())==NULL) |
55 | if((rhdPtr=FindPciDevice())==NULL) |
51 | { |
56 | { |
52 | dbgprintf("Device not found\n"); |
57 | dbgprintf("Device not found\n"); |
53 | return 0; |
58 | return 0; |
54 | }; |
59 | }; |
55 | 60 | ||
56 | for(i=0;i<6;i++) |
61 | for(i=0;i<6;i++) |
57 | { |
62 | { |
58 | if(rhd.memBase[i]) |
63 | if(rhd.memBase[i]) |
59 | dbgprintf("Memory base_%d 0x%x size 0x%x\n", |
64 | dbgprintf("Memory base_%d 0x%x size 0x%x\n", |
60 | i,rhd.memBase[i],(1< |
65 | i,rhd.memBase[i],(1< |
61 | }; |
66 | }; |
62 | for(i=0;i<6;i++) |
67 | for(i=0;i<6;i++) |
63 | { |
68 | { |
64 | if(rhd.ioBase[i]) |
69 | if(rhd.ioBase[i]) |
65 | dbgprintf("Io base_%d 0x%x size 0x%x\n", |
70 | dbgprintf("Io base_%d 0x%x size 0x%x\n", |
66 | i,rhd.ioBase[i],(1< |
71 | i,rhd.ioBase[i],(1< |
67 | }; |
72 | }; |
68 | if(!RHDPreInit()) |
73 | if(!RHDPreInit()) |
69 | return 0; |
74 | return 0; |
70 | 75 | ||
71 | R5xx2DInit(); |
76 | R5xx2DInit(); |
72 | 77 | ||
73 | Init3DEngine(&rhd); |
78 | #if !R300_PIO |
- | 79 | ||
- | 80 | Init3DEngine(&rhd); |
|
74 | 81 | ||
- | 82 | #endif |
|
75 | 83 | ||
76 | retval = RegService("HDRAW", srv_2d); |
84 | retval = RegService("HDRAW", srv_2d); |
77 | dbgprintf("reg service %s as: %x\n", "HDRAW", retval); |
85 | dbgprintf("reg service %s as: %x\n", "HDRAW", retval); |
78 | 86 | ||
79 | return retval; |
87 | return retval; |
80 | }; |
88 | }; |
81 | 89 | ||
82 | 90 | ||
83 | #define API_VERSION 0x01000100 |
- | |
84 | - | ||
85 | #define SRV_GETVERSION 0 |
- | |
86 | - | ||
87 | - | ||
88 | int __stdcall srv_2d(ioctl_t *io) |
91 | int __stdcall srv_2d(ioctl_t *io) |
89 | { |
92 | { |
90 | u32_t *inp; |
93 | u32_t *inp; |
91 | u32_t *outp; |
94 | u32_t *outp; |
92 | 95 | ||
93 | inp = io->input; |
96 | inp = io->input; |
94 | outp = io->output; |
97 | outp = io->output; |
95 | 98 | ||
96 | switch(io->io_code) |
99 | switch(io->io_code) |
97 | { |
100 | { |
98 | case SRV_GETVERSION: |
101 | case SRV_GETVERSION: |
99 | if(io->out_size==4) |
102 | if(io->out_size==4) |
100 | { |
103 | { |
101 | *outp = API_VERSION; |
104 | *outp = API_VERSION; |
102 | return 0; |
105 | return 0; |
103 | } |
106 | } |
104 | break; |
107 | break; |
105 | 108 | ||
106 | case PX_CREATE: |
109 | case PX_CREATE: |
107 | if(io->inp_size==7) |
110 | if(io->inp_size==7) |
108 | return CreatePixmap((pixmap_t*)inp); |
111 | return CreatePixmap((pixmap_t*)inp); |
109 | break; |
112 | break; |
110 | 113 | ||
111 | case PX_DESTROY: |
114 | case PX_DESTROY: |
112 | if(io->inp_size==7) |
115 | if(io->inp_size==7) |
113 | return DestroyPixmap((pixmap_t*)inp); |
116 | return DestroyPixmap((pixmap_t*)inp); |
114 | break; |
117 | break; |
115 | 118 | ||
116 | case PX_CLEAR: |
119 | case PX_CLEAR: |
117 | if(io->inp_size==2) |
120 | if(io->inp_size==2) |
118 | return ClearPixmap((io_clear_t*)inp); |
121 | return ClearPixmap((io_clear_t*)inp); |
119 | break; |
122 | break; |
120 | 123 | ||
121 | case PX_DRAW_RECT: |
124 | case PX_DRAW_RECT: |
122 | if(io->inp_size==7) |
125 | if(io->inp_size==7) |
123 | return DrawRect((io_draw_t*)inp); |
126 | return DrawRect((io_draw_t*)inp); |
124 | break; |
127 | break; |
125 | 128 | ||
126 | case PX_FILL_RECT: |
129 | case PX_FILL_RECT: |
127 | if(io->inp_size==10) |
130 | if(io->inp_size==10) |
128 | return FillRect((io_fill_t*)inp); |
131 | return FillRect((io_fill_t*)inp); |
129 | break; |
132 | break; |
130 | 133 | ||
131 | case PX_LINE: |
134 | case PX_LINE: |
132 | if(io->inp_size==6) |
135 | if(io->inp_size==6) |
133 | return Line((io_draw_t*)inp); |
136 | return Line((io_draw_t*)inp); |
134 | break; |
137 | break; |
135 | 138 | ||
136 | case PX_BLIT: |
139 | case PX_BLIT: |
137 | if(io->inp_size==8) |
140 | if(io->inp_size==8) |
138 | return Blit((io_blit_t*)inp); |
141 | return Blit((io_blit_t*)inp); |
139 | break; |
142 | break; |
140 | 143 | ||
141 | case PX_BLIT_TRANSPARENT: |
144 | case PX_BLIT_TRANSPARENT: |
142 | if(io->inp_size==9) |
145 | if(io->inp_size==9) |
143 | return BlitTransparent((io_blit_t*)inp); |
146 | return BlitTransparent((io_blit_t*)inp); |
144 | break; |
147 | break; |
145 | 148 | ||
146 | case PX_BLIT_ALPHA: |
149 | case PX_BLIT_ALPHA: |
147 | if(io->inp_size==9) |
150 | if(io->inp_size==9) |
148 | return RadeonComposite((io_blit_t*)inp); |
151 | return RadeonComposite((io_blit_t*)inp); |
149 | break; |
152 | break; |
150 | 153 | ||
151 | default: |
154 | default: |
152 | return ERR_PARAM; |
155 | return ERR_PARAM; |
153 | }; |
156 | }; |
154 | return ERR_PARAM; |
157 | return ERR_PARAM; |
155 | } |
158 | } |
156 | 159 | ||
157 | 160 | ||
158 | #include "init.c" |
161 | #include "init.c" |
159 | #include "pci.c" |
162 | #include "pci.c" |
160 | #include "ati_mem.c" |
163 | #include "ati_mem.c" |
161 | 164 | ||
162 | #include "init_cp.c" |
165 | #include "init_cp.c" |
163 | #include "r500.inc" |
166 | #include "r500.inc" |
164 | 167 | ||
165 | #include "clip.inc" |
168 | #include "clip.inc" |
166 | #include "pixmap.inc" |
169 | #include "pixmap.inc" |
167 | #include "accel_2d.inc" |
170 | #include "accel_2d.inc" |
168 | #include "init_3d.inc" |
171 | #include "init_3d.inc" |
169 | #include "blend.inc" |
172 | #include "blend.inc" |
170 | > |
173 | > |
171 | >6;i++) |
174 | >6;i++) |
172 | > |
175 | > |
173 | > |
176 | > |
174 | >6;i++) |
177 | >6;i++) |
175 | > |
178 | > |