Commit daaeb6f8 authored by Helge Deller's avatar Helge Deller Committed by Kyle McMartin

[PARISC] stifb: Fix framebuffer console at 32bpp

Fix stifb framebuffer console at 32bpp on a HCRX-24 card
by properly setting DIRECTCOLOR. Also a few nice cleanups
to the code.
Signed-off-by: default avatarHelge Deller <deller@parisc-linux.org>
Signed-off-by: default avatarKyle McMartin <kyle@parisc-linux.org>
parent 5d6d1640
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Low level Frame buffer driver for HP workstations with * Low level Frame buffer driver for HP workstations with
* STI (standard text interface) video firmware. * STI (standard text interface) video firmware.
* *
* Copyright (C) 2001-2004 Helge Deller <deller@gmx.de> * Copyright (C) 2001-2005 Helge Deller <deller@gmx.de>
* Portions Copyright (C) 2001 Thomas Bogendoerfer <tsbogend@alpha.franken.de> * Portions Copyright (C) 2001 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
* *
* Based on: * Based on:
...@@ -78,6 +78,8 @@ ...@@ -78,6 +78,8 @@
#define NGLEDEVDEPROM_CRT_REGION 1 #define NGLEDEVDEPROM_CRT_REGION 1
#define NR_PALETTE 256
typedef struct { typedef struct {
__s32 video_config_reg; __s32 video_config_reg;
__s32 misc_video_start; __s32 misc_video_start;
...@@ -107,7 +109,7 @@ struct stifb_info { ...@@ -107,7 +109,7 @@ struct stifb_info {
ngle_rom_t ngle_rom; ngle_rom_t ngle_rom;
struct sti_struct *sti; struct sti_struct *sti;
int deviceSpecificConfig; int deviceSpecificConfig;
u32 pseudo_palette[256]; u32 pseudo_palette[16];
}; };
static int __initdata stifb_bpp_pref[MAX_STI_ROMS]; static int __initdata stifb_bpp_pref[MAX_STI_ROMS];
...@@ -990,7 +992,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green, ...@@ -990,7 +992,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
struct stifb_info *fb = (struct stifb_info *) info; struct stifb_info *fb = (struct stifb_info *) info;
u32 color; u32 color;
if (regno >= 256) /* no. of hw registers */ if (regno >= NR_PALETTE)
return 1; return 1;
red >>= 8; red >>= 8;
...@@ -1001,7 +1003,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green, ...@@ -1001,7 +1003,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
START_IMAGE_COLORMAP_ACCESS(fb); START_IMAGE_COLORMAP_ACCESS(fb);
if (fb->info.var.grayscale) { if (unlikely(fb->info.var.grayscale)) {
/* gray = 0.30*R + 0.59*G + 0.11*B */ /* gray = 0.30*R + 0.59*G + 0.11*B */
color = ((red * 77) + color = ((red * 77) +
(green * 151) + (green * 151) +
...@@ -1012,13 +1014,13 @@ stifb_setcolreg(u_int regno, u_int red, u_int green, ...@@ -1012,13 +1014,13 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
(blue)); (blue));
} }
if (info->var.bits_per_pixel == 32) { if (fb->info.fix.visual == FB_VISUAL_DIRECTCOLOR) {
((u32 *)(info->pseudo_palette))[regno] = struct fb_var_screeninfo *var = &fb->info.var;
(red << info->var.red.offset) | if (regno < 16)
(green << info->var.green.offset) | ((u32 *)fb->info.pseudo_palette)[regno] =
(blue << info->var.blue.offset); regno << var->red.offset |
} else { regno << var->green.offset |
((u32 *)(info->pseudo_palette))[regno] = regno; regno << var->blue.offset;
} }
WRITE_IMAGE_COLOR(fb, regno, color); WRITE_IMAGE_COLOR(fb, regno, color);
...@@ -1061,9 +1063,9 @@ stifb_blank(int blank_mode, struct fb_info *info) ...@@ -1061,9 +1063,9 @@ stifb_blank(int blank_mode, struct fb_info *info)
case S9000_ID_HCRX: case S9000_ID_HCRX:
HYPER_ENABLE_DISABLE_DISPLAY(fb, enable); HYPER_ENABLE_DISABLE_DISPLAY(fb, enable);
break; break;
case S9000_ID_A1659A:; /* fall through */ case S9000_ID_A1659A: /* fall through */
case S9000_ID_TIMBER:; case S9000_ID_TIMBER:
case CRX24_OVERLAY_PLANES:; case CRX24_OVERLAY_PLANES:
default: default:
ENABLE_DISABLE_DISPLAY(fb, enable); ENABLE_DISABLE_DISPLAY(fb, enable);
break; break;
...@@ -1308,7 +1310,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref) ...@@ -1308,7 +1310,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref)
break; break;
case 32: case 32:
fix->type = FB_TYPE_PACKED_PIXELS; fix->type = FB_TYPE_PACKED_PIXELS;
fix->visual = FB_VISUAL_TRUECOLOR; fix->visual = FB_VISUAL_DIRECTCOLOR;
var->red.length = var->green.length = var->blue.length = var->transp.length = 8; var->red.length = var->green.length = var->blue.length = var->transp.length = 8;
var->blue.offset = 0; var->blue.offset = 0;
var->green.offset = 8; var->green.offset = 8;
...@@ -1330,7 +1332,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref) ...@@ -1330,7 +1332,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref)
info->pseudo_palette = &fb->pseudo_palette; info->pseudo_palette = &fb->pseudo_palette;
/* This has to been done !!! */ /* This has to been done !!! */
fb_alloc_cmap(&info->cmap, 256, 0); fb_alloc_cmap(&info->cmap, NR_PALETTE, 0);
stifb_init_display(fb); stifb_init_display(fb);
if (!request_mem_region(fix->smem_start, fix->smem_len, "stifb fb")) { if (!request_mem_region(fix->smem_start, fix->smem_len, "stifb fb")) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment