aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrent Cook <busterb@gmail.com>2010-12-31 00:56:50 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-01-06 01:48:13 -0500
commit529ed806d4540d23ca2f68b28c3715d1566fc3ac (patch)
treeb8287b72e0a832496eb49fc77e17add713273c55
parente045da7d835a28950543f5f10f0cb1905ca9bbaf (diff)
video: Fix the HGA framebuffer driver
Resurrected some old hardware and fixed up the hgafb driver to work again. Only tested with fbcon, since most fbdev-based software appears to only support 12bpp and up. It does not appear that this driver has worked for at least the entire 2.6.x series, perhaps since 2002. Hercules graphics hardware uses packed pixels horizontally, but rows are not linear. In other words, the pixels are not packed vertically. This means that custom imageblit, fillrect and copyarea need to be written specific to the hardware. * Removed the experimental acceleration option, since it is required for the hardware to work. * Fixed imageblit to work with fb_image's wider than 8 pixels. * Updated configuration text (HGA hardware is from 1984) Signed-off-by: Brent Cook <busterb@gmail.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--drivers/video/Kconfig14
-rw-r--r--drivers/video/hgafb.c22
2 files changed, 11 insertions, 25 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index e231041a5e33..fdddf58bdaf5 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -824,24 +824,14 @@ config FB_N411
824config FB_HGA 824config FB_HGA
825 tristate "Hercules mono graphics support" 825 tristate "Hercules mono graphics support"
826 depends on FB && X86 826 depends on FB && X86
827 select FB_CFB_FILLRECT
828 select FB_CFB_COPYAREA
829 select FB_CFB_IMAGEBLIT
830 help 827 help
831 Say Y here if you have a Hercules mono graphics card. 828 Say Y here if you have a Hercules mono graphics card.
832 829
833 To compile this driver as a module, choose M here: the 830 To compile this driver as a module, choose M here: the
834 module will be called hgafb. 831 module will be called hgafb.
835 832
836 As this card technology is 15 years old, most people will answer N 833 As this card technology is at least 25 years old,
837 here. 834 most people will answer N here.
838
839config FB_HGA_ACCEL
840 bool "Hercules mono Acceleration functions (EXPERIMENTAL)"
841 depends on FB_HGA && EXPERIMENTAL
842 ---help---
843 This will compile the Hercules mono graphics with
844 acceleration functions.
845 835
846config FB_SGIVW 836config FB_SGIVW
847 tristate "SGI Visual Workstation framebuffer support" 837 tristate "SGI Visual Workstation framebuffer support"
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c
index af8f0f2cc782..4052718eefaa 100644
--- a/drivers/video/hgafb.c
+++ b/drivers/video/hgafb.c
@@ -454,7 +454,6 @@ static int hgafb_blank(int blank_mode, struct fb_info *info)
454/* 454/*
455 * Accel functions 455 * Accel functions
456 */ 456 */
457#ifdef CONFIG_FB_HGA_ACCEL
458static void hgafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) 457static void hgafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
459{ 458{
460 u_int rows, y; 459 u_int rows, y;
@@ -466,7 +465,7 @@ static void hgafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
466 dest = rowaddr(info, y) + (rect->dx >> 3); 465 dest = rowaddr(info, y) + (rect->dx >> 3);
467 switch (rect->rop) { 466 switch (rect->rop) {
468 case ROP_COPY: 467 case ROP_COPY:
469 //fb_memset(dest, rect->color, (rect->width >> 3)); 468 memset_io(dest, rect->color, (rect->width >> 3));
470 break; 469 break;
471 case ROP_XOR: 470 case ROP_XOR:
472 fb_writeb(~(fb_readb(dest)), dest); 471 fb_writeb(~(fb_readb(dest)), dest);
@@ -488,7 +487,7 @@ static void hgafb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
488 for (rows = area->height; rows--; ) { 487 for (rows = area->height; rows--; ) {
489 src = rowaddr(info, y1) + (area->sx >> 3); 488 src = rowaddr(info, y1) + (area->sx >> 3);
490 dest = rowaddr(info, y2) + (area->dx >> 3); 489 dest = rowaddr(info, y2) + (area->dx >> 3);
491 //fb_memmove(dest, src, (area->width >> 3)); 490 memmove(dest, src, (area->width >> 3));
492 y1++; 491 y1++;
493 y2++; 492 y2++;
494 } 493 }
@@ -499,7 +498,7 @@ static void hgafb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
499 for (rows = area->height; rows--;) { 498 for (rows = area->height; rows--;) {
500 src = rowaddr(info, y1) + (area->sx >> 3); 499 src = rowaddr(info, y1) + (area->sx >> 3);
501 dest = rowaddr(info, y2) + (area->dx >> 3); 500 dest = rowaddr(info, y2) + (area->dx >> 3);
502 //fb_memmove(dest, src, (area->width >> 3)); 501 memmove(dest, src, (area->width >> 3));
503 y1--; 502 y1--;
504 y2--; 503 y2--;
505 } 504 }
@@ -511,20 +510,17 @@ static void hgafb_imageblit(struct fb_info *info, const struct fb_image *image)
511 u8 __iomem *dest; 510 u8 __iomem *dest;
512 u8 *cdat = (u8 *) image->data; 511 u8 *cdat = (u8 *) image->data;
513 u_int rows, y = image->dy; 512 u_int rows, y = image->dy;
513 u_int x;
514 u8 d; 514 u8 d;
515 515
516 for (rows = image->height; rows--; y++) { 516 for (rows = image->height; rows--; y++) {
517 d = *cdat++; 517 for (x = 0; x < image->width; x+= 8) {
518 dest = rowaddr(info, y) + (image->dx >> 3); 518 d = *cdat++;
519 fb_writeb(d, dest); 519 dest = rowaddr(info, y) + ((image->dx + x)>> 3);
520 fb_writeb(d, dest);
521 }
520 } 522 }
521} 523}
522#else /* !CONFIG_FB_HGA_ACCEL */
523#define hgafb_fillrect cfb_fillrect
524#define hgafb_copyarea cfb_copyarea
525#define hgafb_imageblit cfb_imageblit
526#endif /* CONFIG_FB_HGA_ACCEL */
527
528 524
529static struct fb_ops hgafb_ops = { 525static struct fb_ops hgafb_ops = {
530 .owner = THIS_MODULE, 526 .owner = THIS_MODULE,