Rev 5367 | Rev 6088 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5367 | Rev 6084 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | #include |
|
- | 2 | ||
1 | #include |
3 | #include |
2 | #include |
4 | #include |
3 | #include "i915_drv.h" |
5 | #include "i915_drv.h" |
Line 4... | Line 6... | ||
4 | 6 | ||
5 | #include |
7 | #include |
6 | #include |
8 | #include |
7 | #include |
9 | #include |
8 | #include |
- | |
Line 9... | Line 10... | ||
9 | #include |
10 | #include |
Line -... | Line 11... | ||
- | 11 | ||
- | 12 | #include "bitmap.h" |
|
10 | 13 | ||
11 | #include "bitmap.h" |
14 | #define DRV_NAME "i915 v4.4" |
12 | 15 | ||
Line 26... | Line 29... | ||
26 | uint16_t subdevice_id; |
29 | uint16_t subdevice_id; |
27 | uint32_t device_class; |
30 | uint32_t device_class; |
28 | uint8_t revision; |
31 | uint8_t revision; |
29 | }; |
32 | }; |
Line -... | Line 33... | ||
- | 33 | ||
- | 34 | struct cmdtable |
|
- | 35 | { |
|
- | 36 | char *key; |
|
- | 37 | int size; |
|
- | 38 | int *val; |
|
- | 39 | }; |
|
- | 40 | ||
- | 41 | #define CMDENTRY(key, val) {(key), (sizeof(key)-1), &val} |
|
- | 42 | void parse_cmdline(char *cmdline, struct cmdtable *table, char *log, videomode_t *mode); |
|
- | 43 | ||
- | 44 | ||
- | 45 | int oops_in_progress; |
|
30 | 46 | int i915_fbsize = 16; |
|
31 | struct drm_device *main_device; |
47 | struct drm_device *main_device; |
32 | struct drm_file *drm_file_handlers[256]; |
48 | struct drm_file *drm_file_handlers[256]; |
Line 33... | Line 49... | ||
33 | videomode_t usermode; |
49 | videomode_t usermode; |
34 | 50 | ||
Line 35... | Line 51... | ||
35 | void cpu_detect1(); |
51 | void cpu_detect1(); |
36 | int kmap_init(); |
52 | int kmap_init(); |
Line 37... | Line -... | ||
37 | - | ||
38 | int _stdcall display_handler(ioctl_t *io); |
- | |
39 | int init_agp(void); |
- | |
40 | - | ||
41 | int srv_blit_bitmap(u32 hbitmap, int dst_x, int dst_y, |
- | |
42 | int src_x, int src_y, u32 w, u32 h); |
- | |
43 | - | ||
44 | int blit_textured(u32 hbitmap, int dst_x, int dst_y, |
- | |
45 | int src_x, int src_y, u32 w, u32 h); |
- | |
46 | 53 | ||
47 | int blit_tex(u32 hbitmap, int dst_x, int dst_y, |
54 | int _stdcall display_handler(ioctl_t *io); |
48 | int src_x, int src_y, u32 w, u32 h); |
55 | int init_agp(void); |
Line 49... | Line 56... | ||
49 | 56 | ||
50 | void get_pci_info(struct pci_device *dev); |
57 | void get_pci_info(struct pci_device *dev); |
Line 51... | Line 58... | ||
51 | int i915_getparam(struct drm_device *dev, void *data, |
58 | int i915_getparam(struct drm_device *dev, void *data, |
52 | struct drm_file *file_priv); |
59 | struct drm_file *file_priv); |
53 | 60 | ||
54 | int i915_mask_update(struct drm_device *dev, void *data, |
61 | int i915_mask_update(struct drm_device *dev, void *data, |
55 | struct drm_file *file); |
62 | struct drm_file *file); |
56 | 63 | ||
57 | struct cmdtable cmdtable[]= { |
64 | struct cmdtable cmdtable[]= { |
58 | // CMDENTRY("-pm=", i915_powersave), |
65 | CMDENTRY("-FB=", i915_fbsize), |
Line 59... | Line 66... | ||
59 | // CMDENTRY("-rc6=", i915_enable_rc6), |
66 | /* CMDENTRY("-pm=", i915.powersave), */ |
Line 108... | Line 115... | ||
108 | 115 | ||
Line 109... | Line 116... | ||
109 | printf("%s\n",__FUNCTION__); |
116 | printf("%s\n",__FUNCTION__); |
110 | 117 | ||
111 | while(driver_wq_state == I915_DEV_INIT) |
118 | while(driver_wq_state == I915_DEV_INIT) |
112 | { |
119 | { |
113 | jiffies = GetTimerTicks(); |
120 | jiffies = GetClockNs() / 10000000; |
Line -... | Line 121... | ||
- | 121 | delay(1); |
|
- | 122 | }; |
|
- | 123 | ||
- | 124 | if( driver_wq_state == I915_DEV_CLOSE) |
|
- | 125 | { |
|
114 | delay(1); |
126 | asm volatile ("int $0x40"::"a"(-1)); |
115 | }; |
127 | }; |
Line 116... | Line 128... | ||
116 | 128 | ||
117 | dev_priv = main_device->dev_private; |
129 | dev_priv = main_device->dev_private; |
118 | cwq = dev_priv->wq; |
130 | cwq = dev_priv->wq; |
Line 119... | Line 131... | ||
119 | 131 | ||
120 | asm volatile("int $0x40":"=a"(tmp):"a"(66),"b"(1),"c"(1)); |
132 | asm volatile("int $0x40":"=a"(tmp):"a"(66),"b"(1),"c"(1)); |
121 | asm volatile("int $0x40":"=a"(tmp):"a"(66),"b"(4),"c"(0x46),"d"(0x330)); |
133 | asm volatile("int $0x40":"=a"(tmp):"a"(66),"b"(4),"c"(0x46),"d"(0x330)); |
Line 122... | Line 134... | ||
122 | asm volatile("int $0x40":"=a"(tmp):"a"(66),"b"(4),"c"(0xC6),"d"(0x330)); |
134 | asm volatile("int $0x40":"=a"(tmp):"a"(66),"b"(4),"c"(0xC6),"d"(0x330)); |
Line 123... | Line 135... | ||
123 | 135 | ||
124 | while(driver_wq_state != I915_DEV_CLOSE) |
136 | while(driver_wq_state != I915_DEV_CLOSE) |
Line 184... | Line 196... | ||
184 | }; |
196 | }; |
Line 185... | Line 197... | ||
185 | 197 | ||
186 | if( GetService("DISPLAY") != 0 ) |
198 | if( GetService("DISPLAY") != 0 ) |
Line 187... | Line 199... | ||
187 | return 0; |
199 | return 0; |
- | 200 | ||
188 | 201 | printf("\n%s build %s %s\nusage: i915 [options]\n" |
|
189 | printf("\ni915 v3.19-rc2 build %s %s\nusage: i915 [options]\n" |
202 | "-FB=<0-9> Set framebuffer size in megabytes (default: 16)\n", |
- | 203 | "-pm=<0,1> Enable powersavings, fbc, downclocking, etc. (default: 1 - true)\n", |
|
190 | "-pm=<0,1> Enable powersavings, fbc, downclocking, etc. (default: 1 - true)\n", |
204 | DRV_NAME, __DATE__, __TIME__); |
191 | __DATE__, __TIME__); |
205 | |
192 | printf("-rc6=<-1,0-7> Enable power-saving render C-state 6.\n" |
206 | printf("-rc6=<-1,0-7> Enable power-saving render C-state 6.\n" |
193 | " Different stages can be selected via bitmask values\n" |
207 | " Different stages can be selected via bitmask values\n" |
194 | " (0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6).\n" |
208 | " (0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6).\n" |
195 | " For example, 3 would enable rc6 and deep rc6, and 7 would enable everything.\n" |
209 | " For example, 3 would enable rc6 and deep rc6, and 7 would enable everything.\n" |
196 | " default: -1 (use per-chip default)\n"); |
210 | " default: -1 (use per-chip default)\n"); |
197 | printf("-fbc=<-1,0,1> Enable frame buffer compression for power savings\n" |
211 | printf("-fbc=<-1,0,1> Enable frame buffer compression for power savings\n" |
198 | " (default: -1 (use per-chip default))\n"); |
- | |
- | 212 | " (default: -1 (use per-chip default))\n"); |
|
199 | printf("-ppgt=<0,1> Enable PPGTT (default: true)\n"); |
213 | printf("-ppgt=<0,1> Enable PPGTT (default: true)\n"); |
200 | printf("-pc8=<0,1> Enable support for low power package C states (PC8+) (default: 0 - false)\n"); |
214 | |
Line -... | Line 215... | ||
- | 215 | printf("-l |
|
201 | printf("-l |
216 | printf("-m |
202 | printf("-m |
217 | |
Line 203... | Line 218... | ||
203 | 218 | printf("cmdline %s\n", cmdline); |
|
204 | if( cmdline && *cmdline ) |
219 | if( cmdline && *cmdline ) |
205 | parse_cmdline(cmdline, cmdtable, log, &usermode); |
220 | parse_cmdline(cmdline, cmdtable, log, &usermode); |
206 | 221 | ||
207 | if( *log && !dbg_open(log)) |
222 | if( *log && !dbg_open(log)) |
- | 223 | { |
|
- | 224 | printf("Can't open %s\nExit\n", log); |
|
- | 225 | return 0; |
|
- | 226 | } |
|
Line 208... | Line 227... | ||
208 | { |
227 | else |
209 | printf("Can't open %s\nExit\n", log); |
228 | { |
Line 210... | Line 229... | ||
210 | return 0; |
229 | dbgprintf("\nLOG: %s build %s %s\n",DRV_NAME,__DATE__, __TIME__); |
Line 235... | Line 254... | ||
235 | err = i915_init(); |
254 | err = i915_init(); |
236 | if(unlikely(err!= 0)) |
255 | if(unlikely(err!= 0)) |
237 | { |
256 | { |
238 | driver_wq_state = I915_DEV_CLOSE; |
257 | driver_wq_state = I915_DEV_CLOSE; |
239 | dbgprintf("Epic Fail :(\n"); |
258 | dbgprintf("Epic Fail :(\n"); |
- | 259 | delay(100); |
|
240 | return 0; |
260 | return 0; |
241 | }; |
261 | }; |
Line 242... | Line 262... | ||
242 | 262 | ||
Line 263... | Line 283... | ||
263 | #define SRV_GETVERSION 0 |
283 | #define SRV_GETVERSION 0 |
264 | #define SRV_ENUM_MODES 1 |
284 | #define SRV_ENUM_MODES 1 |
265 | #define SRV_SET_MODE 2 |
285 | #define SRV_SET_MODE 2 |
266 | #define SRV_GET_CAPS 3 |
286 | #define SRV_GET_CAPS 3 |
Line 267... | Line -... | ||
267 | - | ||
268 | #define SRV_CREATE_SURFACE 10 |
- | |
269 | #define SRV_DESTROY_SURFACE 11 |
- | |
270 | #define SRV_LOCK_SURFACE 12 |
- | |
271 | #define SRV_UNLOCK_SURFACE 13 |
- | |
272 | #define SRV_RESIZE_SURFACE 14 |
- | |
273 | #define SRV_BLIT_BITMAP 15 |
- | |
274 | #define SRV_BLIT_TEXTURE 16 |
- | |
275 | #define SRV_BLIT_VIDEO 17 |
- | |
Line 276... | Line 287... | ||
276 | 287 | ||
277 | 288 | ||
278 | #define SRV_GET_PCI_INFO 20 |
289 | #define SRV_GET_PCI_INFO 20 |
279 | #define SRV_I915_GET_PARAM 21 |
290 | #define SRV_I915_GET_PARAM 21 |
Line 377... | Line 388... | ||
377 | 388 | ||
378 | case SRV_DRM_GEM_OPEN: |
389 | case SRV_DRM_GEM_OPEN: |
379 | retval = drm_gem_open_ioctl(main_device, inp, file); |
390 | retval = drm_gem_open_ioctl(main_device, inp, file); |
Line 380... | Line -... | ||
380 | break; |
- | |
381 | - | ||
382 | case SRV_I915_GEM_PIN: |
- | |
383 | retval = i915_gem_pin_ioctl(main_device, inp, file); |
- | |
384 | break; |
- | |
385 | - | ||
386 | case SRV_I915_GEM_UNPIN: |
- | |
387 | retval = i915_gem_unpin_ioctl(main_device, inp, file); |
- | |
388 | break; |
391 | break; |
389 | 392 | ||
390 | case SRV_I915_GEM_GET_CACHING: |
393 | case SRV_I915_GEM_GET_CACHING: |
Line 391... | Line 394... | ||
391 | retval = i915_gem_get_caching_ioctl(main_device, inp, file); |
394 | retval = i915_gem_get_caching_ioctl(main_device, inp, file); |
Line 884... | Line 887... | ||
884 | : "0" (0), "1" (0xffffffff), "2" (cs), "g" (ct) |
887 | : "0" (0), "1" (0xffffffff), "2" (cs), "g" (ct) |
885 | : "dx", "di"); |
888 | : "dx", "di"); |
886 | return __res; |
889 | return __res; |
887 | }>30)); |
890 | } |
Line -... | Line 891... | ||
- | 891 | ||
- | 892 | #include |
|
- | 893 | ||
- | 894 | u64 long_div(u64 dividend, u64 divisor) |
|
- | 895 | { |
|
- | 896 | #if 1 |
|
- | 897 | u32 high = divisor >> 32; |
|
- | 898 | u64 quot; |
|
- | 899 | ||
- | 900 | if (high == 0) { |
|
- | 901 | quot = div_u64(dividend, divisor); |
|
- | 902 | } else { |
|
- | 903 | int n = 1 + fls(high); |
|
- | 904 | quot = div_u64(dividend >> n, divisor >> n); |
|
- | 905 | ||
- | 906 | if (quot != 0) |
|
- | 907 | quot--; |
|
- | 908 | if ((dividend - quot * divisor) >= divisor) |
|
- | 909 | quot++; |
|
- | 910 | } |
|
- | 911 | ||
- | 912 | return quot; |
|
- | 913 | #endif |
|
- | 914 | // return dividend / divisor; |
|
- | 915 | };>30)); |
|
- | 916 | ||
- | 917 | ><30)); |
|
- | 918 |