From a693e8ab12432787a3c02fa5b8f7649a08122012 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 6 Dec 2007 23:36:58 +0100 Subject: radeon_ms: fix fbcon by fixing palette --- linux-core/radeon_ms_fb.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'linux-core/radeon_ms_fb.c') diff --git a/linux-core/radeon_ms_fb.c b/linux-core/radeon_ms_fb.c index b629b9eb..fc9e99ec 100644 --- a/linux-core/radeon_ms_fb.c +++ b/linux-core/radeon_ms_fb.c @@ -52,12 +52,35 @@ static int radeonfb_setcolreg(unsigned regno, unsigned red, unsigned transp, struct fb_info *info) { struct radeonfb_par *par = info->par; + struct drm_framebuffer *fb = par->crtc->fb; struct drm_crtc *crtc = par->crtc; - if (regno > 255) + if (regno > 255) { return 1; - if (crtc->funcs->gamma_set) + } + if (crtc->funcs->gamma_set) { crtc->funcs->gamma_set(crtc, red, green, blue, regno); + } + if (regno < 16) { + switch (fb->depth) { + case 15: + fb->pseudo_palette[regno] = ((red & 0xf800) >> 1) | + ((green & 0xf800) >> 6) | + ((blue & 0xf800) >> 11); + break; + case 16: + fb->pseudo_palette[regno] = (red & 0xf800) | + ((green & 0xfc00) >> 5) | + ((blue & 0xf800) >> 11); + break; + case 24: + case 32: + fb->pseudo_palette[regno] = ((red & 0xff00) << 8) | + (green & 0xff00) | + ((blue & 0xff00) >> 8); + break; + } + } return 0; } -- cgit v1.2.3