diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2005-08-04 16:56:15 -0400 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2005-08-04 16:56:15 -0400 |
commit | a5c96cab8f3c4ca9b2177dceb5de5a0edb31418e (patch) | |
tree | 45692a1b3d770f721f4586ad81c206f1b8509b75 /drivers/video | |
parent | 30db1ae8640d3527ca7ac8df4bcbf14ccc6ae9cd (diff) | |
parent | 1c5ad84516ae7ea4ec868436a910a6bd8d20215a (diff) |
Merge with /home/shaggy/git/linus-clean/
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbmem.c | 6 | ||||
-rw-r--r-- | drivers/video/fbsysfs.c | 22 | ||||
-rw-r--r-- | drivers/video/tridentfb.c | 28 | ||||
-rw-r--r-- | drivers/video/vesafb.c | 47 |
4 files changed, 72 insertions, 31 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 40784a944d05..d2e19f6dd72c 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -80,10 +80,12 @@ EXPORT_SYMBOL(fb_get_color_depth); | |||
80 | */ | 80 | */ |
81 | void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) | 81 | void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) |
82 | { | 82 | { |
83 | int i; | 83 | int i, j; |
84 | 84 | ||
85 | for (i = height; i--; ) { | 85 | for (i = height; i--; ) { |
86 | memcpy(dst, src, s_pitch); | 86 | /* s_pitch is a few bytes at the most, memcpy is suboptimal */ |
87 | for (j = 0; j < s_pitch; j++) | ||
88 | dst[j] = src[j]; | ||
87 | src += s_pitch; | 89 | src += s_pitch; |
88 | dst += d_pitch; | 90 | dst += d_pitch; |
89 | } | 91 | } |
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 63b505cce4ec..1147b899f007 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
@@ -244,15 +244,15 @@ static ssize_t show_virtual(struct class_device *class_device, char *buf) | |||
244 | 244 | ||
245 | /* Format for cmap is "%02x%c%4x%4x%4x\n" */ | 245 | /* Format for cmap is "%02x%c%4x%4x%4x\n" */ |
246 | /* %02x entry %c transp %4x red %4x blue %4x green \n */ | 246 | /* %02x entry %c transp %4x red %4x blue %4x green \n */ |
247 | /* 255 rows at 16 chars equals 4096 */ | 247 | /* 256 rows at 16 chars equals 4096, the normal page size */ |
248 | /* PAGE_SIZE can be 4096 or larger */ | 248 | /* the code will automatically adjust for different page sizes */ |
249 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, | 249 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, |
250 | size_t count) | 250 | size_t count) |
251 | { | 251 | { |
252 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 252 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); |
253 | int rc, i, start, length, transp = 0; | 253 | int rc, i, start, length, transp = 0; |
254 | 254 | ||
255 | if ((count > 4096) || ((count % 16) != 0) || (PAGE_SIZE < 4096)) | 255 | if ((count > PAGE_SIZE) || ((count % 16) != 0)) |
256 | return -EINVAL; | 256 | return -EINVAL; |
257 | 257 | ||
258 | if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap) | 258 | if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap) |
@@ -317,18 +317,18 @@ static ssize_t show_cmap(struct class_device *class_device, char *buf) | |||
317 | !fb_info->cmap.green) | 317 | !fb_info->cmap.green) |
318 | return -EINVAL; | 318 | return -EINVAL; |
319 | 319 | ||
320 | if (PAGE_SIZE < 4096) | 320 | if (fb_info->cmap.len > PAGE_SIZE / 16) |
321 | return -EINVAL; | 321 | return -EINVAL; |
322 | 322 | ||
323 | /* don't mess with the format, the buffer is PAGE_SIZE */ | 323 | /* don't mess with the format, the buffer is PAGE_SIZE */ |
324 | /* 255 entries at 16 chars per line equals 4096 = PAGE_SIZE */ | 324 | /* 256 entries at 16 chars per line equals 4096 = PAGE_SIZE */ |
325 | for (i = 0; i < fb_info->cmap.len; i++) { | 325 | for (i = 0; i < fb_info->cmap.len; i++) { |
326 | sprintf(&buf[ i * 16], "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start, | 326 | snprintf(&buf[ i * 16], PAGE_SIZE - i * 16, "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start, |
327 | ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '), | 327 | ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '), |
328 | fb_info->cmap.red[i], fb_info->cmap.blue[i], | 328 | fb_info->cmap.red[i], fb_info->cmap.blue[i], |
329 | fb_info->cmap.green[i]); | 329 | fb_info->cmap.green[i]); |
330 | } | 330 | } |
331 | return 4096; | 331 | return 16 * fb_info->cmap.len; |
332 | } | 332 | } |
333 | 333 | ||
334 | static ssize_t store_blank(struct class_device *class_device, const char * buf, | 334 | static ssize_t store_blank(struct class_device *class_device, const char * buf, |
@@ -414,6 +414,13 @@ static ssize_t show_pan(struct class_device *class_device, char *buf) | |||
414 | fb_info->var.xoffset); | 414 | fb_info->var.xoffset); |
415 | } | 415 | } |
416 | 416 | ||
417 | static ssize_t show_name(struct class_device *class_device, char *buf) | ||
418 | { | ||
419 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | ||
420 | |||
421 | return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id); | ||
422 | } | ||
423 | |||
417 | static struct class_device_attribute class_device_attrs[] = { | 424 | static struct class_device_attribute class_device_attrs[] = { |
418 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), | 425 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), |
419 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), | 426 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), |
@@ -424,6 +431,7 @@ static struct class_device_attribute class_device_attrs[] = { | |||
424 | __ATTR(modes, S_IRUGO|S_IWUSR, show_modes, store_modes), | 431 | __ATTR(modes, S_IRUGO|S_IWUSR, show_modes, store_modes), |
425 | __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan), | 432 | __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan), |
426 | __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual), | 433 | __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual), |
434 | __ATTR(name, S_IRUGO, show_name, NULL), | ||
427 | }; | 435 | }; |
428 | 436 | ||
429 | int fb_init_class_device(struct fb_info *fb_info) | 437 | int fb_init_class_device(struct fb_info *fb_info) |
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c index da8004e5d03d..698ca9232e73 100644 --- a/drivers/video/tridentfb.c +++ b/drivers/video/tridentfb.c | |||
@@ -454,13 +454,16 @@ static struct accel_switch accel_image = { | |||
454 | static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *fr) | 454 | static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *fr) |
455 | { | 455 | { |
456 | int bpp = info->var.bits_per_pixel; | 456 | int bpp = info->var.bits_per_pixel; |
457 | int col; | 457 | int col = 0; |
458 | 458 | ||
459 | switch (bpp) { | 459 | switch (bpp) { |
460 | default: | 460 | default: |
461 | case 8: col = fr->color; | 461 | case 8: col |= fr->color; |
462 | col |= col << 8; | ||
463 | col |= col << 16; | ||
462 | break; | 464 | break; |
463 | case 16: col = ((u32 *)(info->pseudo_palette))[fr->color]; | 465 | case 16: col = ((u32 *)(info->pseudo_palette))[fr->color]; |
466 | |||
464 | break; | 467 | break; |
465 | case 32: col = ((u32 *)(info->pseudo_palette))[fr->color]; | 468 | case 32: col = ((u32 *)(info->pseudo_palette))[fr->color]; |
466 | break; | 469 | break; |
@@ -882,8 +885,9 @@ static int tridentfb_set_par(struct fb_info *info) | |||
882 | 885 | ||
883 | write3X4(GraphEngReg, 0x80); //enable GE for text acceleration | 886 | write3X4(GraphEngReg, 0x80); //enable GE for text acceleration |
884 | 887 | ||
885 | // if (info->var.accel_flags & FB_ACCELF_TEXT) | 888 | #ifdef CONFIG_FB_TRIDENT_ACCEL |
886 | //FIXME acc->init_accel(info->var.xres,bpp); | 889 | acc->init_accel(info->var.xres,bpp); |
890 | #endif | ||
887 | 891 | ||
888 | switch (bpp) { | 892 | switch (bpp) { |
889 | case 8: tmp = 0x00; break; | 893 | case 8: tmp = 0x00; break; |
@@ -900,7 +904,7 @@ static int tridentfb_set_par(struct fb_info *info) | |||
900 | write3X4(DRAMControl, tmp); //both IO,linear enable | 904 | write3X4(DRAMControl, tmp); //both IO,linear enable |
901 | 905 | ||
902 | write3X4(InterfaceSel, read3X4(InterfaceSel) | 0x40); | 906 | write3X4(InterfaceSel, read3X4(InterfaceSel) | 0x40); |
903 | write3X4(Performance,0x20); | 907 | write3X4(Performance,0x92); |
904 | write3X4(PCIReg,0x07); //MMIO & PCI read and write burst enable | 908 | write3X4(PCIReg,0x07); //MMIO & PCI read and write burst enable |
905 | 909 | ||
906 | /* convert from picoseconds to MHz */ | 910 | /* convert from picoseconds to MHz */ |
@@ -981,12 +985,14 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
981 | t_outb(green>>10,0x3C9); | 985 | t_outb(green>>10,0x3C9); |
982 | t_outb(blue>>10,0x3C9); | 986 | t_outb(blue>>10,0x3C9); |
983 | 987 | ||
984 | } else | 988 | } else if (bpp == 16) { /* RGB 565 */ |
985 | if (bpp == 16) /* RGB 565 */ | 989 | u32 col; |
986 | ((u32*)info->pseudo_palette)[regno] = (red & 0xF800) | | 990 | |
987 | ((green & 0xFC00) >> 5) | ((blue & 0xF800) >> 11); | 991 | col = (red & 0xF800) | ((green & 0xFC00) >> 5) | |
988 | else | 992 | ((blue & 0xF800) >> 11); |
989 | if (bpp == 32) /* ARGB 8888 */ | 993 | col |= col << 16; |
994 | ((u32 *)(info->pseudo_palette))[regno] = col; | ||
995 | } else if (bpp == 32) /* ARGB 8888 */ | ||
990 | ((u32*)info->pseudo_palette)[regno] = | 996 | ((u32*)info->pseudo_palette)[regno] = |
991 | ((transp & 0xFF00) <<16) | | 997 | ((transp & 0xFF00) <<16) | |
992 | ((red & 0xFF00) << 8) | | 998 | ((red & 0xFF00) << 8) | |
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 9ed1a931dd31..a272592b0373 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
@@ -45,7 +45,7 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = { | |||
45 | }; | 45 | }; |
46 | 46 | ||
47 | static int inverse = 0; | 47 | static int inverse = 0; |
48 | static int mtrr = 1; | 48 | static int mtrr = 3; /* default to write-combining */ |
49 | static int vram_remap __initdata = 0; /* Set amount of memory to be used */ | 49 | static int vram_remap __initdata = 0; /* Set amount of memory to be used */ |
50 | static int vram_total __initdata = 0; /* Set total amount of memory */ | 50 | static int vram_total __initdata = 0; /* Set total amount of memory */ |
51 | static int pmi_setpal = 0; /* pmi for palette changes ??? */ | 51 | static int pmi_setpal = 0; /* pmi for palette changes ??? */ |
@@ -204,8 +204,8 @@ static int __init vesafb_setup(char *options) | |||
204 | pmi_setpal=0; | 204 | pmi_setpal=0; |
205 | else if (! strcmp(this_opt, "pmipal")) | 205 | else if (! strcmp(this_opt, "pmipal")) |
206 | pmi_setpal=1; | 206 | pmi_setpal=1; |
207 | else if (! strcmp(this_opt, "mtrr")) | 207 | else if (! strncmp(this_opt, "mtrr:", 5)) |
208 | mtrr=1; | 208 | mtrr = simple_strtoul(this_opt+5, NULL, 0); |
209 | else if (! strcmp(this_opt, "nomtrr")) | 209 | else if (! strcmp(this_opt, "nomtrr")) |
210 | mtrr=0; | 210 | mtrr=0; |
211 | else if (! strncmp(this_opt, "vtotal:", 7)) | 211 | else if (! strncmp(this_opt, "vtotal:", 7)) |
@@ -387,14 +387,39 @@ static int __init vesafb_probe(struct device *device) | |||
387 | 387 | ||
388 | if (mtrr) { | 388 | if (mtrr) { |
389 | unsigned int temp_size = size_total; | 389 | unsigned int temp_size = size_total; |
390 | /* Find the largest power-of-two */ | 390 | unsigned int type = 0; |
391 | while (temp_size & (temp_size - 1)) | 391 | |
392 | temp_size &= (temp_size - 1); | 392 | switch (mtrr) { |
393 | 393 | case 1: | |
394 | /* Try and find a power of two to add */ | 394 | type = MTRR_TYPE_UNCACHABLE; |
395 | while (temp_size > PAGE_SIZE && | 395 | break; |
396 | mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) { | 396 | case 2: |
397 | temp_size >>= 1; | 397 | type = MTRR_TYPE_WRBACK; |
398 | break; | ||
399 | case 3: | ||
400 | type = MTRR_TYPE_WRCOMB; | ||
401 | break; | ||
402 | case 4: | ||
403 | type = MTRR_TYPE_WRTHROUGH; | ||
404 | break; | ||
405 | default: | ||
406 | type = 0; | ||
407 | break; | ||
408 | } | ||
409 | |||
410 | if (type) { | ||
411 | int rc; | ||
412 | |||
413 | /* Find the largest power-of-two */ | ||
414 | while (temp_size & (temp_size - 1)) | ||
415 | temp_size &= (temp_size - 1); | ||
416 | |||
417 | /* Try and find a power of two to add */ | ||
418 | do { | ||
419 | rc = mtrr_add(vesafb_fix.smem_start, temp_size, | ||
420 | type, 1); | ||
421 | temp_size >>= 1; | ||
422 | } while (temp_size >= PAGE_SIZE && rc == -EINVAL); | ||
398 | } | 423 | } |
399 | } | 424 | } |
400 | 425 | ||