aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/stifb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/stifb.c')
-rw-r--r--drivers/video/stifb.c65
1 files changed, 28 insertions, 37 deletions
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c
index fbb17332afd7..56d71d6e9a72 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:
@@ -73,16 +73,13 @@
73#include "sticore.h" 73#include "sticore.h"
74 74
75/* REGION_BASE(fb_info, index) returns the virtual address for region <index> */ 75/* REGION_BASE(fb_info, index) returns the virtual address for region <index> */
76#ifdef __LP64__ 76#define REGION_BASE(fb_info, index) \
77 #define REGION_BASE(fb_info, index) \ 77 F_EXTEND(fb_info->sti->glob_cfg->region_ptrs[index])
78 (fb_info->sti->glob_cfg->region_ptrs[index] | 0xffffffff00000000)
79#else
80 #define REGION_BASE(fb_info, index) \
81 fb_info->sti->glob_cfg->region_ptrs[index]
82#endif
83 78
84#define NGLEDEVDEPROM_CRT_REGION 1 79#define NGLEDEVDEPROM_CRT_REGION 1
85 80
81#define NR_PALETTE 256
82
86typedef struct { 83typedef struct {
87 __s32 video_config_reg; 84 __s32 video_config_reg;
88 __s32 misc_video_start; 85 __s32 misc_video_start;
@@ -112,7 +109,7 @@ struct stifb_info {
112 ngle_rom_t ngle_rom; 109 ngle_rom_t ngle_rom;
113 struct sti_struct *sti; 110 struct sti_struct *sti;
114 int deviceSpecificConfig; 111 int deviceSpecificConfig;
115 u32 pseudo_palette[256]; 112 u32 pseudo_palette[16];
116}; 113};
117 114
118static int __initdata stifb_bpp_pref[MAX_STI_ROMS]; 115static int __initdata stifb_bpp_pref[MAX_STI_ROMS];
@@ -352,10 +349,10 @@ ARTIST_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable)
352#define IS_888_DEVICE(fb) \ 349#define IS_888_DEVICE(fb) \
353 (!(IS_24_DEVICE(fb))) 350 (!(IS_24_DEVICE(fb)))
354 351
355#define GET_FIFO_SLOTS(fb, cnt, numslots) \ 352#define GET_FIFO_SLOTS(fb, cnt, numslots) \
356{ while (cnt < numslots) \ 353{ while (cnt < numslots) \
357 cnt = READ_WORD(fb, REG_34); \ 354 cnt = READ_WORD(fb, REG_34); \
358 cnt -= numslots; \ 355 cnt -= numslots; \
359} 356}
360 357
361#define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */ 358#define IndexedDcd 0 /* Pixel data is indexed (pseudo) color */
@@ -995,7 +992,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
995 struct stifb_info *fb = (struct stifb_info *) info; 992 struct stifb_info *fb = (struct stifb_info *) info;
996 u32 color; 993 u32 color;
997 994
998 if (regno >= 256) /* no. of hw registers */ 995 if (regno >= NR_PALETTE)
999 return 1; 996 return 1;
1000 997
1001 red >>= 8; 998 red >>= 8;
@@ -1005,8 +1002,8 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
1005 DEBUG_OFF(); 1002 DEBUG_OFF();
1006 1003
1007 START_IMAGE_COLORMAP_ACCESS(fb); 1004 START_IMAGE_COLORMAP_ACCESS(fb);
1008 1005
1009 if (fb->info.var.grayscale) { 1006 if (unlikely(fb->info.var.grayscale)) {
1010 /* gray = 0.30*R + 0.59*G + 0.11*B */ 1007 /* gray = 0.30*R + 0.59*G + 0.11*B */
1011 color = ((red * 77) + 1008 color = ((red * 77) +
1012 (green * 151) + 1009 (green * 151) +
@@ -1017,17 +1014,17 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
1017 (blue)); 1014 (blue));
1018 } 1015 }
1019 1016
1020 if (info->var.bits_per_pixel == 32) { 1017 if (fb->info.fix.visual == FB_VISUAL_DIRECTCOLOR) {
1021 ((u32 *)(info->pseudo_palette))[regno] = 1018 struct fb_var_screeninfo *var = &fb->info.var;
1022 (red << info->var.red.offset) | 1019 if (regno < 16)
1023 (green << info->var.green.offset) | 1020 ((u32 *)fb->info.pseudo_palette)[regno] =
1024 (blue << info->var.blue.offset); 1021 regno << var->red.offset |
1025 } else { 1022 regno << var->green.offset |
1026 ((u32 *)(info->pseudo_palette))[regno] = regno; 1023 regno << var->blue.offset;
1027 } 1024 }
1028 1025
1029 WRITE_IMAGE_COLOR(fb, regno, color); 1026 WRITE_IMAGE_COLOR(fb, regno, color);
1030 1027
1031 if (fb->id == S9000_ID_HCRX) { 1028 if (fb->id == S9000_ID_HCRX) {
1032 NgleLutBltCtl lutBltCtl; 1029 NgleLutBltCtl lutBltCtl;
1033 1030
@@ -1066,9 +1063,9 @@ stifb_blank(int blank_mode, struct fb_info *info)
1066 case S9000_ID_HCRX: 1063 case S9000_ID_HCRX:
1067 HYPER_ENABLE_DISABLE_DISPLAY(fb, enable); 1064 HYPER_ENABLE_DISABLE_DISPLAY(fb, enable);
1068 break; 1065 break;
1069 case S9000_ID_A1659A:; /* fall through */ 1066 case S9000_ID_A1659A: /* fall through */
1070 case S9000_ID_TIMBER:; 1067 case S9000_ID_TIMBER:
1071 case CRX24_OVERLAY_PLANES:; 1068 case CRX24_OVERLAY_PLANES:
1072 default: 1069 default:
1073 ENABLE_DISABLE_DISPLAY(fb, enable); 1070 ENABLE_DISABLE_DISPLAY(fb, enable);
1074 break; 1071 break;
@@ -1250,12 +1247,10 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref)
1250 memset(&fb->ngle_rom, 0, sizeof(fb->ngle_rom)); 1247 memset(&fb->ngle_rom, 0, sizeof(fb->ngle_rom));
1251 if ((fb->sti->regions_phys[0] & 0xfc000000) == 1248 if ((fb->sti->regions_phys[0] & 0xfc000000) ==
1252 (fb->sti->regions_phys[2] & 0xfc000000)) 1249 (fb->sti->regions_phys[2] & 0xfc000000))
1253 sti_rom_address = fb->sti->regions_phys[0]; 1250 sti_rom_address = F_EXTEND(fb->sti->regions_phys[0]);
1254 else 1251 else
1255 sti_rom_address = fb->sti->regions_phys[1]; 1252 sti_rom_address = F_EXTEND(fb->sti->regions_phys[1]);
1256#ifdef __LP64__ 1253
1257 sti_rom_address |= 0xffffffff00000000;
1258#endif
1259 fb->deviceSpecificConfig = gsc_readl(sti_rom_address); 1254 fb->deviceSpecificConfig = gsc_readl(sti_rom_address);
1260 if (IS_24_DEVICE(fb)) { 1255 if (IS_24_DEVICE(fb)) {
1261 if (bpp_pref == 8 || bpp_pref == 32) 1256 if (bpp_pref == 8 || bpp_pref == 32)
@@ -1315,7 +1310,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref)
1315 break; 1310 break;
1316 case 32: 1311 case 32:
1317 fix->type = FB_TYPE_PACKED_PIXELS; 1312 fix->type = FB_TYPE_PACKED_PIXELS;
1318 fix->visual = FB_VISUAL_TRUECOLOR; 1313 fix->visual = FB_VISUAL_DIRECTCOLOR;
1319 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;
1320 var->blue.offset = 0; 1315 var->blue.offset = 0;
1321 var->green.offset = 8; 1316 var->green.offset = 8;
@@ -1337,7 +1332,7 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref)
1337 info->pseudo_palette = &fb->pseudo_palette; 1332 info->pseudo_palette = &fb->pseudo_palette;
1338 1333
1339 /* This has to been done !!! */ 1334 /* This has to been done !!! */
1340 fb_alloc_cmap(&info->cmap, 256, 0); 1335 fb_alloc_cmap(&info->cmap, NR_PALETTE, 0);
1341 stifb_init_display(fb); 1336 stifb_init_display(fb);
1342 1337
1343 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")) {
@@ -1488,7 +1483,3 @@ module_exit(stifb_cleanup);
1488MODULE_AUTHOR("Helge Deller <deller@gmx.de>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>"); 1483MODULE_AUTHOR("Helge Deller <deller@gmx.de>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>");
1489MODULE_DESCRIPTION("Framebuffer driver for HP's NGLE series graphics cards in HP PARISC machines"); 1484MODULE_DESCRIPTION("Framebuffer driver for HP's NGLE series graphics cards in HP PARISC machines");
1490MODULE_LICENSE("GPL v2"); 1485MODULE_LICENSE("GPL v2");
1491
1492MODULE_PARM(bpp, "i");
1493MODULE_PARM_DESC(mem, "Bits per pixel (default: 8)");
1494