Rev 4246 | Rev 4293 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4246 | Rev 4280 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | uint8_t revision; |
26 | uint8_t revision; |
27 | }; |
27 | }; |
Line 28... | Line 28... | ||
28 | 28 | ||
29 | struct drm_device *main_device; |
29 | struct drm_device *main_device; |
- | 30 | struct drm_file *drm_file_handlers[256]; |
|
Line 30... | Line 31... | ||
30 | struct drm_file *drm_file_handlers[256]; |
31 | videomode_t usermode; |
Line 31... | Line -... | ||
31 | - | ||
32 | void cpu_detect(); |
32 | |
33 | 33 | void cpu_detect(); |
|
Line 34... | Line 34... | ||
34 | void parse_cmdline(char *cmdline, char *log); |
34 | |
35 | int _stdcall display_handler(ioctl_t *io); |
35 | int _stdcall display_handler(ioctl_t *io); |
Line 49... | Line 49... | ||
49 | struct drm_file *file_priv); |
49 | struct drm_file *file_priv); |
Line 50... | Line 50... | ||
50 | 50 | ||
51 | int i915_mask_update(struct drm_device *dev, void *data, |
51 | int i915_mask_update(struct drm_device *dev, void *data, |
Line -... | Line 52... | ||
- | 52 | struct drm_file *file); |
|
- | 53 | ||
- | 54 | struct cmdtable cmdtable[]= { |
|
- | 55 | CMDENTRY("-pm=", i915_powersave), |
|
- | 56 | CMDENTRY("-rc6=", i915_enable_rc6), |
|
- | 57 | CMDENTRY("-fbc=", i915_enable_fbc), |
|
- | 58 | CMDENTRY("-ppgt=", i915_enable_ppgtt), |
|
- | 59 | CMDENTRY("-pc8=", i915_enable_pc8), |
|
- | 60 | {NULL, 0} |
|
Line 52... | Line 61... | ||
52 | struct drm_file *file); |
61 | }; |
Line 53... | Line 62... | ||
53 | 62 | ||
54 | 63 | ||
Line 156... | Line 165... | ||
156 | }; |
165 | }; |
Line 157... | Line 166... | ||
157 | 166 | ||
158 | if( GetService("DISPLAY") != 0 ) |
167 | if( GetService("DISPLAY") != 0 ) |
Line -... | Line 168... | ||
- | 168 | return 0; |
|
- | 169 | ||
- | 170 | printf("i915 v3.12\n\nusage: i915 [options]\n" |
|
- | 171 | "-pm=<0,1> Enable powersavings, fbc, downclocking, etc. (default: 0 - false)\n"); |
|
- | 172 | printf("-rc6=<-1,0-7> Enable power-saving render C-state 6.\n" |
|
- | 173 | " Different stages can be selected via bitmask values\n" |
|
- | 174 | " (0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6).\n" |
|
- | 175 | " For example, 3 would enable rc6 and deep rc6, and 7 would enable everything.\n" |
|
- | 176 | " default: -1 (use per-chip default)\n"); |
|
- | 177 | printf("-fbc=<-1,0,1> Enable frame buffer compression for power savings\n" |
|
- | 178 | " (default: 0 - false)\n"); |
|
- | 179 | printf("-ppgt=<0,1> Enable PPGTT (default: 0 - false)\n"); |
|
- | 180 | printf("-pc8=<0,1> Enable support for low power package C states (PC8+) (default: 0 - false)\n"); |
|
- | 181 | printf("-l |
|
159 | return 0; |
182 | printf("-m |
160 | 183 | ||
Line 161... | Line 184... | ||
161 | if( cmdline && *cmdline ) |
184 | if( cmdline && *cmdline ) |
162 | parse_cmdline(cmdline, log); |
185 | parse_cmdline(cmdline, cmdtable, log, &usermode); |
163 | 186 | ||
Line 169... | Line 192... | ||
169 | { |
192 | { |
170 | printf("Can't open %s\nExit\n", log); |
193 | printf("Can't open %s\nExit\n", log); |
171 | return 0; |
194 | return 0; |
172 | }; |
195 | }; |
173 | } |
196 | } |
174 | dbgprintf(" i915 v3.12-6\n cmdline: %s\n", cmdline); |
- | |
Line 175... | Line 197... | ||
175 | 197 | ||
176 | cpu_detect(); |
198 | cpu_detect(); |
Line 177... | Line 199... | ||
177 | // dbgprintf("\ncache line size %d\n", x86_clflush_size); |
199 | // dbgprintf("\ncache line size %d\n", x86_clflush_size); |
Line 182... | Line 204... | ||
182 | if(err) |
204 | if(err) |
183 | { |
205 | { |
184 | dbgprintf("Epic Fail :(\n"); |
206 | dbgprintf("Epic Fail :(\n"); |
185 | return 0; |
207 | return 0; |
186 | }; |
208 | }; |
- | 209 | ||
187 | init_display_kms(main_device); |
210 | init_display_kms(main_device, &usermode); |
Line 188... | Line 211... | ||
188 | 211 | ||
Line 189... | Line 212... | ||
189 | err = RegService("DISPLAY", display_handler); |
212 | err = RegService("DISPLAY", display_handler); |
190 | 213 | ||
Line 456... | Line 479... | ||
456 | } |
479 | } |
457 | return ret; |
480 | return ret; |
458 | }; |
481 | }; |
Line 459... | Line -... | ||
459 | - | ||
460 | - | ||
461 | static char* parse_path(char *p, char *log) |
- | |
462 | { |
- | |
463 | char c; |
- | |
464 | - | ||
465 | while( (c = *p++) == ' '); |
- | |
466 | p--; |
- | |
467 | while( (c = *log++ = *p++) && (c != ' ')); |
- | |
468 | *log = 0; |
- | |
469 | - | ||
470 | return p; |
- | |
471 | }; |
- | |
472 | - | ||
473 | void parse_cmdline(char *cmdline, char *log) |
- | |
474 | { |
- | |
475 | char *p = cmdline; |
- | |
476 | - | ||
477 | char c = *p++; |
- | |
478 | - | ||
479 | while( c ) |
- | |
480 | { |
- | |
481 | if( c == '-') |
- | |
482 | { |
- | |
483 | switch(*p++) |
- | |
484 | { |
- | |
485 | case 'l': |
- | |
486 | p = parse_path(p, log); |
- | |
487 | break; |
- | |
488 | }; |
- | |
489 | }; |
- | |
490 | c = *p++; |
- | |
Line 491... | Line 482... | ||
491 | }; |
482 | |
492 | }; |
483 | |
493 | 484 | ||
Line 569... | Line 560... | ||
569 | dev->revision = pdev->revision; |
560 | dev->revision = pdev->revision; |
570 | };19)) |
561 | }; |
Line -... | Line 562... | ||
- | 562 | ||
- | 563 | ||
- | 564 | ||
- | 565 | char *strstr(const char *cs, const char *ct); |
|
- | 566 | ||
- | 567 | static int my_atoi(char **cmd) |
|
- | 568 | { |
|
- | 569 | char* p = *cmd; |
|
- | 570 | int val = 0; |
|
- | 571 | int sign = 1; |
|
- | 572 | ||
- | 573 | if(*p == '-') |
|
- | 574 | { |
|
- | 575 | sign = -1; |
|
- | 576 | p++; |
|
- | 577 | }; |
|
- | 578 | ||
- | 579 | for (;; *p++) { |
|
- | 580 | switch (*p) { |
|
- | 581 | case '0' ... '9': |
|
- | 582 | val = 10*val+(*p-'0'); |
|
- | 583 | break; |
|
- | 584 | default: |
|
- | 585 | *cmd = p; |
|
- | 586 | return val*sign; |
|
- | 587 | } |
|
- | 588 | } |
|
- | 589 | } |
|
- | 590 | ||
- | 591 | char* parse_mode(char *p, videomode_t *mode) |
|
- | 592 | { |
|
- | 593 | char c; |
|
- | 594 | ||
- | 595 | while( (c = *p++) == ' '); |
|
- | 596 | ||
- | 597 | if( c ) |
|
- | 598 | { |
|
- | 599 | p--; |
|
- | 600 | ||
- | 601 | mode->width = my_atoi(&p); |
|
- | 602 | if(*p == 'x') p++; |
|
- | 603 | ||
- | 604 | mode->height = my_atoi(&p); |
|
- | 605 | if(*p == 'x') p++; |
|
- | 606 | ||
- | 607 | mode->bpp = 32; |
|
- | 608 | ||
- | 609 | mode->freq = my_atoi(&p); |
|
- | 610 | ||
- | 611 | if( mode->freq == 0 ) |
|
- | 612 | mode->freq = 60; |
|
- | 613 | } |
|
- | 614 | ||
- | 615 | return p; |
|
- | 616 | }; |
|
- | 617 | ||
- | 618 | ||
- | 619 | static char* parse_path(char *p, char *log) |
|
- | 620 | { |
|
- | 621 | char c; |
|
- | 622 | ||
- | 623 | while( (c = *p++) == ' '); |
|
- | 624 | p--; |
|
- | 625 | while( (c = *log++ = *p++) && (c != ' ')); |
|
- | 626 | *log = 0; |
|
- | 627 | ||
- | 628 | return p; |
|
- | 629 | }; |
|
- | 630 | ||
- | 631 | void parse_cmdline(char *cmdline, struct cmdtable *table, char *log, videomode_t *mode) |
|
- | 632 | { |
|
- | 633 | char *p = cmdline; |
|
- | 634 | char *p1; |
|
- | 635 | int val; |
|
- | 636 | char c = *p++; |
|
- | 637 | ||
- | 638 | if( table ) |
|
- | 639 | { |
|
- | 640 | while(table->key) |
|
- | 641 | { |
|
- | 642 | if(p1 = strstr(cmdline, table->key)) |
|
- | 643 | { |
|
- | 644 | p1+= table->size; |
|
- | 645 | *table->val = my_atoi(&p1); |
|
- | 646 | // printf("%s %d\n", table->key, *table->val); |
|
- | 647 | } |
|
- | 648 | table++; |
|
- | 649 | } |
|
- | 650 | } |
|
- | 651 | ||
- | 652 | while( c ) |
|
- | 653 | { |
|
- | 654 | if( c == '-') |
|
- | 655 | { |
|
- | 656 | switch(*p++) |
|
- | 657 | { |
|
- | 658 | case 'l': |
|
- | 659 | p = parse_path(p, log); |
|
- | 660 | break; |
|
- | 661 | ||
- | 662 | case 'm': |
|
- | 663 | p = parse_mode(p, mode); |
|
- | 664 | break; |
|
- | 665 | }; |
|
- | 666 | }; |
|
- | 667 | c = *p++; |
|
- | 668 | }; |
|
- | 669 | }; |
|
- | 670 | ||
- | 671 | char *strstr(const char *cs, const char *ct) |
|
- | 672 | { |
|
- | 673 | int d0, d1; |
|
- | 674 | register char *__res; |
|
- | 675 | __asm__ __volatile__( |
|
- | 676 | "movl %6,%%edi\n\t" |
|
- | 677 | "repne\n\t" |
|
- | 678 | "scasb\n\t" |
|
- | 679 | "notl %%ecx\n\t" |
|
- | 680 | "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ |
|
- | 681 | "movl %%ecx,%%edx\n" |
|
- | 682 | "1:\tmovl %6,%%edi\n\t" |
|
- | 683 | "movl %%esi,%%eax\n\t" |
|
- | 684 | "movl %%edx,%%ecx\n\t" |
|
- | 685 | "repe\n\t" |
|
- | 686 | "cmpsb\n\t" |
|
- | 687 | "je 2f\n\t" /* also works for empty string, see above */ |
|
- | 688 | "xchgl %%eax,%%esi\n\t" |
|
- | 689 | "incl %%esi\n\t" |
|
- | 690 | "cmpb $0,-1(%%eax)\n\t" |
|
- | 691 | "jne 1b\n\t" |
|
- | 692 | "xorl %%eax,%%eax\n\t" |
|
- | 693 | "2:" |
|
- | 694 | : "=a" (__res), "=&c" (d0), "=&S" (d1) |
|
- | 695 | : "0" (0), "1" (0xffffffff), "2" (cs), "g" (ct) |