diff options
-rw-r--r-- | drivers/gpu/drm/drm_fb_helper.c | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 7c2eb75db60f..7590df5e2e72 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -1042,7 +1042,6 @@ static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green, | |||
1042 | { | 1042 | { |
1043 | struct drm_fb_helper *fb_helper = info->par; | 1043 | struct drm_fb_helper *fb_helper = info->par; |
1044 | struct drm_framebuffer *fb = fb_helper->fb; | 1044 | struct drm_framebuffer *fb = fb_helper->fb; |
1045 | int pindex; | ||
1046 | 1045 | ||
1047 | if (info->fix.visual == FB_VISUAL_TRUECOLOR) { | 1046 | if (info->fix.visual == FB_VISUAL_TRUECOLOR) { |
1048 | u32 *palette; | 1047 | u32 *palette; |
@@ -1074,38 +1073,10 @@ static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green, | |||
1074 | !fb_helper->funcs->gamma_get)) | 1073 | !fb_helper->funcs->gamma_get)) |
1075 | return -EINVAL; | 1074 | return -EINVAL; |
1076 | 1075 | ||
1077 | pindex = regno; | 1076 | WARN_ON(fb->bits_per_pixel != 8); |
1078 | 1077 | ||
1079 | if (fb->bits_per_pixel == 16) { | 1078 | fb_helper->funcs->gamma_set(crtc, red, green, blue, regno); |
1080 | pindex = regno << 3; | ||
1081 | 1079 | ||
1082 | if (fb->depth == 16 && regno > 63) | ||
1083 | return -EINVAL; | ||
1084 | if (fb->depth == 15 && regno > 31) | ||
1085 | return -EINVAL; | ||
1086 | |||
1087 | if (fb->depth == 16) { | ||
1088 | u16 r, g, b; | ||
1089 | int i; | ||
1090 | if (regno < 32) { | ||
1091 | for (i = 0; i < 8; i++) | ||
1092 | fb_helper->funcs->gamma_set(crtc, red, | ||
1093 | green, blue, pindex + i); | ||
1094 | } | ||
1095 | |||
1096 | fb_helper->funcs->gamma_get(crtc, &r, | ||
1097 | &g, &b, | ||
1098 | pindex >> 1); | ||
1099 | |||
1100 | for (i = 0; i < 4; i++) | ||
1101 | fb_helper->funcs->gamma_set(crtc, r, | ||
1102 | green, b, | ||
1103 | (pindex >> 1) + i); | ||
1104 | } | ||
1105 | } | ||
1106 | |||
1107 | if (fb->depth != 16) | ||
1108 | fb_helper->funcs->gamma_set(crtc, red, green, blue, pindex); | ||
1109 | return 0; | 1080 | return 0; |
1110 | } | 1081 | } |
1111 | 1082 | ||