• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    桌面應用——寬屏筆記本,915GM芯片組,Linux的設置

    發布: 2007-7-04 12:06 | 作者: admin | 來源:  網友評論 | 查看: 15次 | 進入軟件測試論壇討論

    領測軟件測試網

    為寬屏的分辯率率一和普通屏的不一樣,如:1280*768,一些廠家的linux還不支持這些非傳統標準的分辨率!
    這幾天天天在老外的論壇里轉,終于 時間看到for 915GM的video BIOS修改程序,可以直接修改內存里有mode line叁數,讓系統支持寬屏顯示!
    另也找到了,最新的915GM的驅動,經過第三方修改的(奇怪的是Intel提供的不能正常工作,第三方的倒是可以,有了它才能真正發揮915GM的顯示能力啊,那個vesa的驅動,太慢了,呵呵)

    因這里不好上傳附件,只能把原碼貼上來了,是那個支持寬屏的修正程序,自己編譯一下,如下:
    #gcc 915resolution.c -o 915resolution
    然后運行 915resolution 5c 1280*768

    然后寫一腳本,讓系統每次啟動自動運行!呵呵!

    915GM的驅動,大了點,不好貼上來,需要的朋友加我QQ,傳給你!


    #include
    #include
    #include
    #define __USE_GNU
    #include
    #include
    #include
    #include
    #include
    #include



    #define NEW(a) ((a *)(calloc(1, sizeof(a))))
    #define FREE(a) (free(a))

    #define VBIOS_START 0xc0000
    #define VBIOS_SIZE 0x10000

    #define VBIOS_FILE "/dev/mem"
    #define VBIOS_OFFSET_IN_FILE VBIOS_START

    #define CFG_SIGNATURE "BIOS_DATA_BLOCK "

    #define FALSE 0
    #define TRUE 1

    typedef unsigned char * address;
    typedef unsigned char boolean;

    typedef struct {
    unsigned char mode;
    unsigned char bits_per_pixel;
    unsigned short resolution;
    unsigned char unknown;
    } __attribute__((packed)) vbios_mode;

    typedef struct {
    unsigned char unknow1[2];
    unsigned char x1;
    unsigned char unknow2;
    unsigned char x2;
    unsigned char y1;
    unsigned char unknow3;
    unsigned char y2;
    } __attribute__((packed)) vbios_resolution;


    typedef struct {
    int bios_fd;
    address bios_ptr;

    address cnfg_ptr;

    vbios_mode * mode_table;
    int mode_table_size;

    boolean unlocked;
    } vbios_map;


    void initialize_system();
    char * get_chipset(void);

    vbios_map * open_vbios();
    void close_vbios(vbios_map * map);

    void unlock_vbios(vbios_map * map);
    void relock_vbios(vbios_map * map);



    void initialize_system(void) {
    if (iopl(3) < 0) {
    perror("Unable to obtain the proper IO permissions");
    exit(2);
    }
    }

    static unsigned int get_chipset_id(void) {
    outl(0x80000000, 0xcf8);
    return inl(0xcfc);
    }

    static char chipset_buffer[256];

    char * get_chipset(void) {
    unsigned int id;
    char * name;

    id = get_chipset_id();

    switch (id) {
    case 0x25608086:
    name = "845G";
    break;

    case 0x35808086:
    name = "855GM";
    break;

    case 0x25708086:
    name = "865G";
    break;

    case 0x25908086:
    name = "915GM";
    break;

    default:
    sprintf(chipset_buffer, "Unknown (0x%08x)", id);
    name = chipset_buffer;
    break;
    }

    return name;
    }


    vbios_map * open_vbios() {
    vbios_map * map = NEW(vbios_map);

    /*
    * Map the video bios to memory
    */

    map->bios_fd = open(VBIOS_FILE, O_RDWR);
    if(map->bios_fd < 0) {
    perror("Unable to open the BIOS file");
    exit(2);
    }

    map->bios_ptr = mmap((void *)VBIOS_START, VBIOS_SIZE,
    PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
    map->bios_fd, VBIOS_OFFSET_IN_FILE);

    if (map->bios_ptr == NULL) {
    fprintf(stderr, "Cannot mmap() the video BIOS\n");
    close(map->bios_fd);
    exit(2);
    }

    /*
    * figure out where the configuration information is
    */

    map->cnfg_ptr = memmem(map->bios_ptr, VBIOS_SIZE, CFG_SIGNATURE, strlen(CFG_SIGNATURE));

    if (map->cnfg_ptr == NULL) {
    fprintf(stderr, "Couldn't find the configuration area in the VBIOS!\n");
    close_vbios(map);
    exit(2);
    }

    /*
    * Figure out where the mode table is and which type of bios we have
    */

    {
    address p = map->bios_ptr;
    address limit = map->bios_ptr + VBIOS_SIZE - (3 * sizeof(vbios_mode));

    while (p < limit && map->mode_table == 0) {
    vbios_mode * mode_ptr = (vbios_mode *) p;

    if (((mode_ptr[0].mode & 0xf0) == 0x30) && ((mode_ptr[1].mode & 0xf0) == 0x30) &&
    ((mode_ptr[2].mode & 0xf0) == 0x30) && ((mode_ptr[3].mode & 0xf0) == 0x30)) {

    map->mode_table = mode_ptr;
    }

    p++;
    }

    if (map->mode_table == 0) {
    fprintf(stderr, "Unable to locate mode table!\n");
    close_vbios(map);
    exit(2);
    }
    }

    /*
    * Determine size of mode table
    */

    {
    vbios_mode * mode_ptr = map->mode_table;

    while (mode_ptr->mode != 0xff) {
    map->mode_table_size++;
    mode_ptr++;
    }
    }


    return map;
    }

    void close_vbios(vbios_map * map) {
    assert(!map->unlocked);

    if(map->bios_ptr == NULL) {
    fprintf(stderr, "BIOS should be open already!\n");
    exit(2);
    }

    munmap(map->bios_ptr, VBIOS_SIZE);
    close(map->bios_fd);

    FREE(map);
    }

    void unlock_vbios(vbios_map * map) {
    assert(!map->unlocked);

    map->unlocked = TRUE;

    outl(0x80000090, 0xcf8);

    #if DEBUG
    {
    unsigned int t = inl(0xcfc);
    printf("unlock PAM: (0x%08x)\n", t);
    }
    #endif

    outb(0x33, 0xcfd);
    outb(0x33, 0xcfe);

    #if DEBUG
    {
    unsigned int t = inl(0xcfc);
    printf("unlock PAM: (0x%08x)\n", t);
    }
    #endif

    }

    void relock_vbios(vbios_map * map) {
    assert(map->unlocked);

    map->unlocked = FALSE;

    outl(0x80000090, 0xcf8);

    #if DEBUG
    {
    unsigned int t = inl(0xcfc);
    printf("relock PAM: (0x%08x)\n", t);
    }
    #endif

    outb(0x11, 0xcfd);
    outb(0x11, 0xcfe);

    #if DEBUG
    {
    unsigned int t = inl(0xcfc);
    printf("relock PAM: (0x%08x)\n", t);
    }
    #endif
    }


    vbios_resolution * map_resolution(vbios_map * map, unsigned short res) {

    vbios_resolution * ptr = ((vbios_resolution*)(map->bios_ptr + res));

    return ptr;
    }


    void list_modes(vbios_map *map) {
    unsigned int i, x, y;

    for (i=0; i < map->mode_table_size; i++) {
    vbios_resolution * res = map_resolution(map, map->mode_table[i].resolution);

    x = ((((unsigned int) res->x2) & 0xf0) << 4) | res->x1;
    y = ((((unsigned int) res->y2) & 0xf0) << 4) | res->y1;

    if (x != 0 && y != 0) {
    printf("Mode %02x : %dx%d, %d bits/pixel\n", map->mode_table[i].mode, x, y, map->mode_table[i].bits_per_pixel);
    }
    }
    }


    void set_mode(vbios_map * map, unsigned int mode, unsigned int x, unsigned int y) {
    unsigned int i;


    for (i=0; i < map->mode_table_size; i++) {
    if (map->mode_table[i].mode == mode) {
    vbios_resolution * res = map_resolution(map, map->mode_table[i].resolution);

    res->x2 = (res->x2 & 0x0f) | ((x >> 4) & 0xf0);
    res->x1 = (x & 0xff);

    res->y2 = (res->y2 & 0x0f) | ((y >> 4) & 0xf0);
    res->y1 = (y & 0xff);
    }
    }


    }

    int parse_args(int argc, char *argv[], int *list, int *mode, int *x, int *y) {
    int index = 1;

    *list = *mode = *x = *y = 0;

    if ((argc > index) && !strcmp(argv[index], "-l")) {
    *list = 1;
    index++;

    if(argc<=index) {
    return 0;
    }
    }

    if(argc-index != 3) {
    return -1;
    }

    *mode = (int) strtol(argv[index], NULL, 16);
    *x = atoi(argv[index+1]);
    *y = atoi(argv[index+2]);

    return 0;
    }

    void usage(char *name) {
    printf("Usage: %s [-l] [mode X Y]\n", name);
    printf(" Set the resolution to XxY for mode\n");
    printf(" Options:\n");
    printf(" -l display the modes found into the vbios\n");
    }

    int main (int argc, char *argv[]) {
    vbios_map * map;
    char * chipset;
    int list, mode, x, y;

    printf("Intel 915GM VBIOS Hack : version 0.1\n\n");

    if (parse_args(argc, argv, &list, &mode, &x, &y) == -1) {
    usage(argv[0]);
    return 2;
    }

    initialize_system();

    chipset = get_chipset();

    printf("Chipset: %s\n", chipset);

    map = open_vbios();

    printf("\n");

    if (list) {
    list_modes(map);
    }

    if (mode!=0 && x!=0 && y!=0) {
    unlock_vbios(map);
    set_mode(map, mode, x, y);
    relock_vbios(map);

    printf("** Patch mode %02x to resolution %dx%d complete\n", mode, x, y);

    if (list) {
    list_modes(map);
    }
    }

    close_vbios(map);

    return 0;
    }

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>