aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/vesafb.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index 4f02615225ac..67e215443953 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -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 = {