diff options
-rw-r--r-- | drivers/video/stifb.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c index 83cd76ca0265..3f050a770a15 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/stifb.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Low level Frame buffer driver for HP workstations with | 3 | * Low level Frame buffer driver for HP workstations with |
4 | * STI (standard text interface) video firmware. | 4 | * STI (standard text interface) video firmware. |
5 | * | 5 | * |
6 | * Copyright (C) 2001-2004 Helge Deller <deller@gmx.de> | 6 | * Copyright (C) 2001-2005 Helge Deller <deller@gmx.de> |
7 | * Portions Copyright (C) 2001 Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 7 | * Portions Copyright (C) 2001 Thomas Bogendoerfer <tsbogend@alpha.franken.de> |
8 | * | 8 | * |
9 | * Based on: | 9 | * Based on: |
@@ -78,6 +78,8 @@ | |||
78 | 78 | ||
79 | #define NGLEDEVDEPROM_CRT_REGION 1 | 79 | #define NGLEDEVDEPROM_CRT_REGION 1 |
80 | 80 | ||
81 | #define NR_PALETTE 256 | ||
82 | |||
81 | typedef struct { | 83 | typedef struct { |
82 | __s32 video_config_reg; | 84 | __s32 video_config_reg; |
83 | __s32 misc_video_start; | 85 | __s32 misc_video_start; |
@@ -107,7 +109,7 @@ struct stifb_info { | |||
107 | ngle_rom_t ngle_rom; | 109 | ngle_rom_t ngle_rom; |
108 | struct sti_struct *sti; | 110 | struct sti_struct *sti; |
109 | int deviceSpecificConfig; | 111 | int deviceSpecificConfig; |
110 | u32 pseudo_palette[256]; | 112 | u32 pseudo_palette[16]; |
111 | }; | 113 | }; |
112 | 114 | ||
113 | static int __initdata stifb_bpp_pref[MAX_STI_ROMS]; | 115 | static int __initdata stifb_bpp_pref[MAX_STI_ROMS]; |
@@ -347,10 +349,10 @@ ARTIST_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable) | |||
347 | #define IS_888_DEVICE(fb) \ | 349 | #define IS_888_DEVICE(fb) \ |
348 | (!(IS_24_DEVICE(fb))) | 350 | (!(IS_24_DEVICE(fb))) |
349 | 351 | ||
350 | #define GET_FIFO_SLOTS(fb, cnt, numslots) \ | 352 | #define GET_FIFO_SLOTS(fb, cnt, numslots) \ |
351 | { while (cnt < numslots) \ | 353 | { while (cnt < numslots) \ |
352 | cnt = READ_WORD(fb, REG_34); \ | 354 | cnt = READ_WORD(fb, REG_34); \ |
353 | cnt -= numslots; \ | 355 | cnt -= numslots; \ |
354 | } | 356 | } |
355 | 357 | ||
356 | #define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */ | 358 | #define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */ |
@@ -990,7 +992,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green, | |||
990 | struct stifb_info *fb = (struct stifb_info *) info; | 992 | struct stifb_info *fb = (struct stifb_info *) info; |
991 | u32 color; | 993 | u32 color; |
992 | 994 | ||
993 | if (regno >= 256) /* no. of hw registers */ | 995 | if (regno >= NR_PALETTE) |
994 | return 1; | 996 | return 1; |
995 | 997 | ||
996 | red >>= 8; | 998 | red >>= 8; |
@@ -1000,8 +1002,8 @@ stifb_setcolreg(u_int regno, u_int red, u_int green, | |||
1000 | DEBUG_OFF(); | 1002 | DEBUG_OFF(); |
1001 | 1003 | ||
1002 | START_IMAGE_COLORMAP_ACCESS(fb); | 1004 | START_IMAGE_COLORMAP_ACCESS(fb); |
1003 | 1005 | ||
1004 | if (fb->info.var.grayscale) { | 1006 | if (unlikely(fb->info.var.grayscale)) { |
1005 | /* gray = 0.30*R + 0.59*G + 0.11*B */ | 1007 | /* gray = 0.30*R + 0.59*G + 0.11*B */ |
1006 | color = ((red * 77) + | 1008 | color = ((red * 77) + |
1007 | (green * 151) + | 1009 | (green * 151) + |
@@ -1012,17 +1014,17 @@ stifb_setcolreg(u_int regno, u_int red, u_int green, | |||
1012 | (blue)); | 1014 | (blue)); |
1013 | } | 1015 | } |
1014 | 1016 | ||
1015 | if (info->var.bits_per_pixel == 32) { | 1017 | if (fb->info.fix.visual == FB_VISUAL_DIRECTCOLOR) { |
1016 | ((u32 *)(info->pseudo_palette))[regno] = | 1018 | struct fb_var_screeninfo *var = &fb->info.var; |
1017 | (red << info->var.red.offset) | | 1019 | if (regno < 16) |
1018 | (green << info->var.green.offset) | | 1020 | ((u32 *)fb->info.pseudo_palette)[regno] = |
1019 | (blue << info->var.blue.offset); | 1021 | regno << var->red.offset | |
1020 | } else { | 1022 | regno << var->green.offset | |
1021 | ((u32 *)(info->pseudo_palette))[regno] = regno; | 1023 | regno << var->blue.offset; |
1022 | } | 1024 | } |
1023 | 1025 | ||
1024 | WRITE_IMAGE_COLOR(fb, regno, color); | 1026 | WRITE_IMAGE_COLOR(fb, regno, color); |
1025 | 1027 | ||
1026 | if (fb->id == S9000_ID_HCRX) { | 1028 | if (fb->id == S9000_ID_HCRX) { |
1027 | NgleLutBltCtl lutBltCtl; | 1029 | NgleLutBltCtl lutBltCtl; |
1028 | 1030 | ||
@@ -1061,9 +1063,9 @@ stifb_blank(int blank_mode, struct fb_info *info) | |||
1061 | case S9000_ID_HCRX: | 1063 | case S9000_ID_HCRX: |
1062 | HYPER_ENABLE_DISABLE_DISPLAY(fb, enable); | 1064 | HYPER_ENABLE_DISABLE_DISPLAY(fb, enable); |
1063 | break; | 1065 | break; |
1064 | case S9000_ID_A1659A:; /* fall through */ | 1066 | case S9000_ID_A1659A: /* fall through */ |
1065 | case S9000_ID_TIMBER:; | 1067 | case S9000_ID_TIMBER: |
1066 | case CRX24_OVERLAY_PLANES:; | 1068 | case CRX24_OVERLAY_PLANES: |
1067 | default: | 1069 | default: |
1068 | ENABLE_DISABLE_DISPLAY(fb, enable); | 1070 | ENABLE_DISABLE_DISPLAY(fb, enable); |
1069 | break; | 1071 | break; |
@@ -1308,7 +1310,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1308 | break; | 1310 | break; |
1309 | case 32: | 1311 | case 32: |
1310 | fix->type = FB_TYPE_PACKED_PIXELS; | 1312 | fix->type = FB_TYPE_PACKED_PIXELS; |
1311 | fix->visual = FB_VISUAL_TRUECOLOR; | 1313 | fix->visual = FB_VISUAL_DIRECTCOLOR; |
1312 | var->red.length = var->green.length = var->blue.length = var->transp.length = 8; | 1314 | var->red.length = var->green.length = var->blue.length = var->transp.length = 8; |
1313 | var->blue.offset = 0; | 1315 | var->blue.offset = 0; |
1314 | var->green.offset = 8; | 1316 | var->green.offset = 8; |
@@ -1330,7 +1332,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1330 | info->pseudo_palette = &fb->pseudo_palette; | 1332 | info->pseudo_palette = &fb->pseudo_palette; |
1331 | 1333 | ||
1332 | /* This has to been done !!! */ | 1334 | /* This has to been done !!! */ |
1333 | fb_alloc_cmap(&info->cmap, 256, 0); | 1335 | fb_alloc_cmap(&info->cmap, NR_PALETTE, 0); |
1334 | stifb_init_display(fb); | 1336 | stifb_init_display(fb); |
1335 | 1337 | ||
1336 | if (!request_mem_region(fix->smem_start, fix->smem_len, "stifb fb")) { | 1338 | if (!request_mem_region(fix->smem_start, fix->smem_len, "stifb fb")) { |