为宽屏的分辩率率一和普通屏的不相同,如: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 (0xx)", 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");

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!