summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorShashank Sharma <shashanks@nvidia.com>2012-02-09 00:50:20 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:02:05 -0400
commit4f62735dd32f7b2a5536bf2dc31057ce45c9a2c5 (patch)
treea161fd40af5cffc6bd781db5e2da49a427080d81 /drivers/video
parentfe7b129564c3b405dbbd366ebe28f762f98c5a84 (diff)
ARM: tegra: video: Support basic color scheme
This patch contains: 1. Changes in fb.c to support the old color scheme for fbcon 2. Addition of color registration function in fb ops in fb.c tegra_fb_setcolreg was removed by mistake in commit f80e81610f4e2e3a9051b465a9176ac70f6913f1 (http://git-master/r/60201) This patch contains a work around for the co-existence of both basic and new color schemes. Bug: 921567 Change-Id: I2b10d4956ce655511fc277d113e623d5d717ed5c Signed-off-by: Shashank Sharma <shashanks@nvidia.com> Reviewed-on: http://git-master/r/79397 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com> Rebase-Id: Rab127e79e8fdc17051b1de665ff1dd35f7ef9651
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/tegra/fb.c68
1 files changed, 60 insertions, 8 deletions
diff --git a/drivers/video/tegra/fb.c b/drivers/video/tegra/fb.c
index 68c328c90..e9bc1f78c 100644
--- a/drivers/video/tegra/fb.c
+++ b/drivers/video/tegra/fb.c
@@ -146,6 +146,33 @@ static int tegra_fb_set_par(struct fb_info *info)
146 return 0; 146 return 0;
147} 147}
148 148
149static int tegra_fb_setcolreg(unsigned regno, unsigned red, unsigned green,
150 unsigned blue, unsigned transp, struct fb_info *info)
151{
152 struct fb_var_screeninfo *var = &info->var;
153
154 if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
155 info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
156 u32 v;
157
158 if (regno >= 16)
159 return -EINVAL;
160
161 red = (red >> (16 - info->var.red.length));
162 green = (green >> (16 - info->var.green.length));
163 blue = (blue >> (16 - info->var.blue.length));
164
165 v = (red << var->red.offset) |
166 (green << var->green.offset) |
167 (blue << var->blue.offset);
168
169 ((u32 *)info->pseudo_palette)[regno] = v;
170 }
171
172 return 0;
173}
174
175
149static int tegra_fb_setcmap(struct fb_cmap *cmap, struct fb_info *info) 176static int tegra_fb_setcmap(struct fb_cmap *cmap, struct fb_info *info)
150{ 177{
151 struct tegra_fb_info *tegra_fb = info->par; 178 struct tegra_fb_info *tegra_fb = info->par;
@@ -160,16 +187,41 @@ static int tegra_fb_setcmap(struct fb_cmap *cmap, struct fb_info *info)
160 return -EINVAL; 187 return -EINVAL;
161 188
162 if (info->fix.visual == FB_VISUAL_TRUECOLOR || 189 if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
163 info->fix.visual == FB_VISUAL_DIRECTCOLOR) { 190 info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
164 for (i = 0; i < cmap->len; i++) { 191 /*
165 dc->fb_lut.r[start+i] = *red++ >> 8; 192 * For now we are considering color schemes with
166 dc->fb_lut.g[start+i] = *green++ >> 8; 193 * cmap->len <=16 as special case of basic color
167 dc->fb_lut.b[start+i] = *blue++ >> 8; 194 * scheme to support fbconsole.But for DirectColor
195 * visuals(like the one we actually have, that include
196 * a HW LUT),the way it's intended to work is that the
197 * actual LUT HW is programmed to the intended values,
198 * even for small color maps like those with 16 or fewer
199 * entries. The pseudo_palette is then programmed to the
200 * identity transform.
201 */
202 if (cmap->len <= 16) {
203 /* Low-color schemes like fbconsole*/
204 u16 *transp = cmap->transp;
205 u_int vtransp = 0xffff;
206
207 for (i = 0; i < cmap->len; i++) {
208 if (transp)
209 vtransp = *transp++;
210 if (tegra_fb_setcolreg(start++, *red++,
211 *green++, *blue++,
212 vtransp, info))
213 return -EINVAL;
214 }
215 } else {
216 /* High-color schemes*/
217 for (i = 0; i < cmap->len; i++) {
218 dc->fb_lut.r[start+i] = *red++ >> 8;
219 dc->fb_lut.g[start+i] = *green++ >> 8;
220 dc->fb_lut.b[start+i] = *blue++ >> 8;
221 }
222 tegra_dc_update_lut(dc, -1, -1);
168 } 223 }
169
170 tegra_dc_update_lut(dc, -1, -1);
171 } 224 }
172
173 return 0; 225 return 0;
174} 226}
175 227