aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/vesafb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/vesafb.c')
-rw-r--r--drivers/video/vesafb.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index 3cc23106641d..e25eae1a78c1 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -48,7 +48,7 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = {
48}; 48};
49 49
50static int inverse = 0; 50static int inverse = 0;
51static int mtrr = 3; /* default to write-combining */ 51static int mtrr = 0; /* disable mtrr */
52static int vram_remap __initdata = 0; /* Set amount of memory to be used */ 52static int vram_remap __initdata = 0; /* Set amount of memory to be used */
53static int vram_total __initdata = 0; /* Set total amount of memory */ 53static int vram_total __initdata = 0; /* Set total amount of memory */
54static int pmi_setpal = 0; /* pmi for palette changes ??? */ 54static int pmi_setpal = 0; /* pmi for palette changes ??? */
@@ -166,45 +166,39 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
166 if (regno >= info->cmap.len) 166 if (regno >= info->cmap.len)
167 return 1; 167 return 1;
168 168
169 switch (info->var.bits_per_pixel) { 169 if (info->var.bits_per_pixel == 8)
170 case 8:
171 vesa_setpalette(regno,red,green,blue); 170 vesa_setpalette(regno,red,green,blue);
172 break; 171 else if (regno < 16) {
173 case 16: 172 switch (info->var.bits_per_pixel) {
174 if (info->var.red.offset == 10) { 173 case 16:
175 /* 1:5:5:5 */ 174 if (info->var.red.offset == 10) {
176 ((u32*) (info->pseudo_palette))[regno] = 175 /* 1:5:5:5 */
176 ((u32*) (info->pseudo_palette))[regno] =
177 ((red & 0xf800) >> 1) | 177 ((red & 0xf800) >> 1) |
178 ((green & 0xf800) >> 6) | 178 ((green & 0xf800) >> 6) |
179 ((blue & 0xf800) >> 11); 179 ((blue & 0xf800) >> 11);
180 } else { 180 } else {
181 /* 0:5:6:5 */ 181 /* 0:5:6:5 */
182 ((u32*) (info->pseudo_palette))[regno] = 182 ((u32*) (info->pseudo_palette))[regno] =
183 ((red & 0xf800) ) | 183 ((red & 0xf800) ) |
184 ((green & 0xfc00) >> 5) | 184 ((green & 0xfc00) >> 5) |
185 ((blue & 0xf800) >> 11); 185 ((blue & 0xf800) >> 11);
186 }
187 break;
188 case 24:
189 case 32:
190 red >>= 8;
191 green >>= 8;
192 blue >>= 8;
193 ((u32 *)(info->pseudo_palette))[regno] =
194 (red << info->var.red.offset) |
195 (green << info->var.green.offset) |
196 (blue << info->var.blue.offset);
197 break;
186 } 198 }
187 break; 199 }
188 case 24: 200
189 red >>= 8; 201 return 0;
190 green >>= 8;
191 blue >>= 8;
192 ((u32 *)(info->pseudo_palette))[regno] =
193 (red << info->var.red.offset) |
194 (green << info->var.green.offset) |
195 (blue << info->var.blue.offset);
196 break;
197 case 32:
198 red >>= 8;
199 green >>= 8;
200 blue >>= 8;
201 ((u32 *)(info->pseudo_palette))[regno] =
202 (red << info->var.red.offset) |
203 (green << info->var.green.offset) |
204 (blue << info->var.blue.offset);
205 break;
206 }
207 return 0;
208} 202}
209 203
210static struct fb_ops vesafb_ops = { 204static struct fb_ops vesafb_ops = {
@@ -215,7 +209,6 @@ static struct fb_ops vesafb_ops = {
215 .fb_fillrect = cfb_fillrect, 209 .fb_fillrect = cfb_fillrect,
216 .fb_copyarea = cfb_copyarea, 210 .fb_copyarea = cfb_copyarea,
217 .fb_imageblit = cfb_imageblit, 211 .fb_imageblit = cfb_imageblit,
218 .fb_cursor = soft_cursor,
219}; 212};
220 213
221static int __init vesafb_setup(char *options) 214static int __init vesafb_setup(char *options)