mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
[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: Helge Deller <deller@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
This commit is contained in:
parent
5d6d1640a2
commit
daaeb6f8d3
1 changed files with 23 additions and 21 deletions
|
@ -3,7 +3,7 @@
|
|||
* Low level Frame buffer driver for HP workstations with
|
||||
* 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>
|
||||
*
|
||||
* Based on:
|
||||
|
@ -78,6 +78,8 @@
|
|||
|
||||
#define NGLEDEVDEPROM_CRT_REGION 1
|
||||
|
||||
#define NR_PALETTE 256
|
||||
|
||||
typedef struct {
|
||||
__s32 video_config_reg;
|
||||
__s32 misc_video_start;
|
||||
|
@ -107,7 +109,7 @@ struct stifb_info {
|
|||
ngle_rom_t ngle_rom;
|
||||
struct sti_struct *sti;
|
||||
int deviceSpecificConfig;
|
||||
u32 pseudo_palette[256];
|
||||
u32 pseudo_palette[16];
|
||||
};
|
||||
|
||||
static int __initdata stifb_bpp_pref[MAX_STI_ROMS];
|
||||
|
@ -347,10 +349,10 @@ ARTIST_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable)
|
|||
#define IS_888_DEVICE(fb) \
|
||||
(!(IS_24_DEVICE(fb)))
|
||||
|
||||
#define GET_FIFO_SLOTS(fb, cnt, numslots) \
|
||||
{ while (cnt < numslots) \
|
||||
#define GET_FIFO_SLOTS(fb, cnt, numslots) \
|
||||
{ while (cnt < numslots) \
|
||||
cnt = READ_WORD(fb, REG_34); \
|
||||
cnt -= numslots; \
|
||||
cnt -= numslots; \
|
||||
}
|
||||
|
||||
#define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */
|
||||
|
@ -990,7 +992,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
|
|||
struct stifb_info *fb = (struct stifb_info *) info;
|
||||
u32 color;
|
||||
|
||||
if (regno >= 256) /* no. of hw registers */
|
||||
if (regno >= NR_PALETTE)
|
||||
return 1;
|
||||
|
||||
red >>= 8;
|
||||
|
@ -1000,8 +1002,8 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
|
|||
DEBUG_OFF();
|
||||
|
||||
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 */
|
||||
color = ((red * 77) +
|
||||
(green * 151) +
|
||||
|
@ -1012,17 +1014,17 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
|
|||
(blue));
|
||||
}
|
||||
|
||||
if (info->var.bits_per_pixel == 32) {
|
||||
((u32 *)(info->pseudo_palette))[regno] =
|
||||
(red << info->var.red.offset) |
|
||||
(green << info->var.green.offset) |
|
||||
(blue << info->var.blue.offset);
|
||||
} else {
|
||||
((u32 *)(info->pseudo_palette))[regno] = regno;
|
||||
if (fb->info.fix.visual == FB_VISUAL_DIRECTCOLOR) {
|
||||
struct fb_var_screeninfo *var = &fb->info.var;
|
||||
if (regno < 16)
|
||||
((u32 *)fb->info.pseudo_palette)[regno] =
|
||||
regno << var->red.offset |
|
||||
regno << var->green.offset |
|
||||
regno << var->blue.offset;
|
||||
}
|
||||
|
||||
WRITE_IMAGE_COLOR(fb, regno, color);
|
||||
|
||||
|
||||
if (fb->id == S9000_ID_HCRX) {
|
||||
NgleLutBltCtl lutBltCtl;
|
||||
|
||||
|
@ -1061,9 +1063,9 @@ stifb_blank(int blank_mode, struct fb_info *info)
|
|||
case S9000_ID_HCRX:
|
||||
HYPER_ENABLE_DISABLE_DISPLAY(fb, enable);
|
||||
break;
|
||||
case S9000_ID_A1659A:; /* fall through */
|
||||
case S9000_ID_TIMBER:;
|
||||
case CRX24_OVERLAY_PLANES:;
|
||||
case S9000_ID_A1659A: /* fall through */
|
||||
case S9000_ID_TIMBER:
|
||||
case CRX24_OVERLAY_PLANES:
|
||||
default:
|
||||
ENABLE_DISABLE_DISPLAY(fb, enable);
|
||||
break;
|
||||
|
@ -1308,7 +1310,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref)
|
|||
break;
|
||||
case 32:
|
||||
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->blue.offset = 0;
|
||||
var->green.offset = 8;
|
||||
|
@ -1330,7 +1332,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref)
|
|||
info->pseudo_palette = &fb->pseudo_palette;
|
||||
|
||||
/* This has to been done !!! */
|
||||
fb_alloc_cmap(&info->cmap, 256, 0);
|
||||
fb_alloc_cmap(&info->cmap, NR_PALETTE, 0);
|
||||
stifb_init_display(fb);
|
||||
|
||||
if (!request_mem_region(fix->smem_start, fix->smem_len, "stifb fb")) {
|
||||
|
|
Loading…
Reference in a new issue