aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/Kconfig4
-rw-r--r--drivers/video/aty/radeon_base.c5
-rw-r--r--drivers/video/console/fbcon.c3
-rw-r--r--drivers/video/fbcmap.c96
-rw-r--r--drivers/video/fbmem.c7
-rw-r--r--drivers/video/fbmon.c2
-rw-r--r--drivers/video/fbsysfs.c90
-rw-r--r--drivers/video/modedb.c5
-rw-r--r--drivers/video/nvidia/nvidia.c7
-rw-r--r--drivers/video/pm2fb.c16
-rw-r--r--drivers/video/riva/fbdev.c2
-rw-r--r--drivers/video/sa1100fb.c2
-rw-r--r--drivers/video/tridentfb.c28
-rw-r--r--drivers/video/vesafb.c47
14 files changed, 207 insertions, 107 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 04d3120f7236..cde0ed097af6 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1399,8 +1399,8 @@ config FB_TX3912
1399 Say Y here to enable kernel support for the on-board framebuffer. 1399 Say Y here to enable kernel support for the on-board framebuffer.
1400 1400
1401config FB_G364 1401config FB_G364
1402 bool 1402 bool "G364 frame buffer support"
1403 depends on MIPS_MAGNUM_4000 || OLIVETTI_M700 1403 depends on (FB = y) && (MIPS_MAGNUM_4000 || OLIVETTI_M700)
1404 select FB_CFB_FILLRECT 1404 select FB_CFB_FILLRECT
1405 select FB_CFB_COPYAREA 1405 select FB_CFB_COPYAREA
1406 select FB_CFB_IMAGEBLIT 1406 select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 47a6b12bc968..e7e8b52014c3 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -2521,6 +2521,11 @@ static void __devexit radeonfb_pci_unregister (struct pci_dev *pdev)
2521 2521
2522 radeonfb_pm_exit(rinfo); 2522 radeonfb_pm_exit(rinfo);
2523 2523
2524 if (rinfo->mon1_EDID)
2525 sysfs_remove_bin_file(&rinfo->pdev->dev.kobj, &edid1_attr);
2526 if (rinfo->mon2_EDID)
2527 sysfs_remove_bin_file(&rinfo->pdev->dev.kobj, &edid2_attr);
2528
2524#if 0 2529#if 0
2525 /* restore original state 2530 /* restore original state
2526 * 2531 *
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 9dd0fbccf994..35c88bd7ba5e 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -275,7 +275,8 @@ static void fb_flashcursor(void *private)
275 275
276 if (!vc || !CON_IS_VISIBLE(vc) || 276 if (!vc || !CON_IS_VISIBLE(vc) ||
277 fbcon_is_inactive(vc, info) || 277 fbcon_is_inactive(vc, info) ||
278 registered_fb[con2fb_map[vc->vc_num]] != info) 278 registered_fb[con2fb_map[vc->vc_num]] != info ||
279 vc_cons[ops->currcon].d->vc_deccm != 1)
279 return; 280 return;
280 acquire_console_sem(); 281 acquire_console_sem();
281 p = &fb_display[vc->vc_num]; 282 p = &fb_display[vc->vc_num];
diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
index 4e5ce8f7d65e..c32a2a50bfa2 100644
--- a/drivers/video/fbcmap.c
+++ b/drivers/video/fbcmap.c
@@ -212,7 +212,7 @@ int fb_cmap_to_user(struct fb_cmap *from, struct fb_cmap_user *to)
212 212
213int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info) 213int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info)
214{ 214{
215 int i, start; 215 int i, start, rc = 0;
216 u16 *red, *green, *blue, *transp; 216 u16 *red, *green, *blue, *transp;
217 u_int hred, hgreen, hblue, htransp = 0xffff; 217 u_int hred, hgreen, hblue, htransp = 0xffff;
218 218
@@ -225,75 +225,51 @@ int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info)
225 if (start < 0 || (!info->fbops->fb_setcolreg && 225 if (start < 0 || (!info->fbops->fb_setcolreg &&
226 !info->fbops->fb_setcmap)) 226 !info->fbops->fb_setcmap))
227 return -EINVAL; 227 return -EINVAL;
228 if (info->fbops->fb_setcmap) 228 if (info->fbops->fb_setcmap) {
229 return info->fbops->fb_setcmap(cmap, info); 229 rc = info->fbops->fb_setcmap(cmap, info);
230 for (i = 0; i < cmap->len; i++) { 230 } else {
231 hred = *red++; 231 for (i = 0; i < cmap->len; i++) {
232 hgreen = *green++; 232 hred = *red++;
233 hblue = *blue++; 233 hgreen = *green++;
234 if (transp) 234 hblue = *blue++;
235 htransp = *transp++; 235 if (transp)
236 if (info->fbops->fb_setcolreg(start++, 236 htransp = *transp++;
237 hred, hgreen, hblue, htransp, 237 if (info->fbops->fb_setcolreg(start++,
238 info)) 238 hred, hgreen, hblue,
239 break; 239 htransp, info))
240 break;
241 }
240 } 242 }
241 return 0; 243 if (rc == 0)
244 fb_copy_cmap(cmap, &info->cmap);
245
246 return rc;
242} 247}
243 248
244int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) 249int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
245{ 250{
246 int i, start; 251 int rc, size = cmap->len * sizeof(u16);
247 u16 __user *red, *green, *blue, *transp; 252 struct fb_cmap umap;
248 u_int hred, hgreen, hblue, htransp = 0xffff;
249
250 red = cmap->red;
251 green = cmap->green;
252 blue = cmap->blue;
253 transp = cmap->transp;
254 start = cmap->start;
255 253
256 if (start < 0 || (!info->fbops->fb_setcolreg && 254 if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
257 !info->fbops->fb_setcmap)) 255 !info->fbops->fb_setcmap))
258 return -EINVAL; 256 return -EINVAL;
259 257
260 /* If we can batch, do it */ 258 memset(&umap, 0, sizeof(struct fb_cmap));
261 if (info->fbops->fb_setcmap && cmap->len > 1) { 259 rc = fb_alloc_cmap(&umap, cmap->len, cmap->transp != NULL);
262 struct fb_cmap umap; 260 if (rc)
263 int size = cmap->len * sizeof(u16);
264 int rc;
265
266 memset(&umap, 0, sizeof(struct fb_cmap));
267 rc = fb_alloc_cmap(&umap, cmap->len, transp != NULL);
268 if (rc)
269 return rc;
270 if (copy_from_user(umap.red, red, size) ||
271 copy_from_user(umap.green, green, size) ||
272 copy_from_user(umap.blue, blue, size) ||
273 (transp && copy_from_user(umap.transp, transp, size))) {
274 rc = -EFAULT;
275 }
276 umap.start = start;
277 if (rc == 0)
278 rc = info->fbops->fb_setcmap(&umap, info);
279 fb_dealloc_cmap(&umap);
280 return rc; 261 return rc;
262 if (copy_from_user(umap.red, cmap->red, size) ||
263 copy_from_user(umap.green, cmap->green, size) ||
264 copy_from_user(umap.blue, cmap->blue, size) ||
265 (cmap->transp && copy_from_user(umap.transp, cmap->transp, size))) {
266 fb_dealloc_cmap(&umap);
267 return -EFAULT;
281 } 268 }
282 269 umap.start = cmap->start;
283 for (i = 0; i < cmap->len; i++, red++, blue++, green++) { 270 rc = fb_set_cmap(&umap, info);
284 if (get_user(hred, red) || 271 fb_dealloc_cmap(&umap);
285 get_user(hgreen, green) || 272 return rc;
286 get_user(hblue, blue) ||
287 (transp && get_user(htransp, transp)))
288 return -EFAULT;
289 if (info->fbops->fb_setcolreg(start++,
290 hred, hgreen, hblue, htransp,
291 info))
292 return 0;
293 if (transp)
294 transp++;
295 }
296 return 0;
297} 273}
298 274
299/** 275/**
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 2222de6ad844..d2e19f6dd72c 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -80,10 +80,12 @@ EXPORT_SYMBOL(fb_get_color_depth);
80 */ 80 */
81void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) 81void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height)
82{ 82{
83 int i; 83 int i, j;
84 84
85 for (i = height; i--; ) { 85 for (i = height; i--; ) {
86 memcpy(dst, src, s_pitch); 86 /* s_pitch is a few bytes at the most, memcpy is suboptimal */
87 for (j = 0; j < s_pitch; j++)
88 dst[j] = src[j];
87 src += s_pitch; 89 src += s_pitch;
88 dst += d_pitch; 90 dst += d_pitch;
89 } 91 }
@@ -1164,6 +1166,7 @@ static void __exit
1164fbmem_exit(void) 1166fbmem_exit(void)
1165{ 1167{
1166 class_destroy(fb_class); 1168 class_destroy(fb_class);
1169 unregister_chrdev(FB_MAJOR, "fb");
1167} 1170}
1168 1171
1169module_exit(fbmem_exit); 1172module_exit(fbmem_exit);
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index 6cd1976548d4..c2718bb94949 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -1241,6 +1241,8 @@ int fb_validate_mode(const struct fb_var_screeninfo *var, struct fb_info *info)
1241 vtotal *= 2; 1241 vtotal *= 2;
1242 1242
1243 hfreq = pixclock/htotal; 1243 hfreq = pixclock/htotal;
1244 hfreq = (hfreq + 500) / 1000 * 1000;
1245
1244 vfreq = hfreq/vtotal; 1246 vfreq = hfreq/vtotal;
1245 1247
1246 return (vfreq < vfmin || vfreq > vfmax || 1248 return (vfreq < vfmin || vfreq > vfmax ||
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index ddc9443254d9..1147b899f007 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -242,10 +242,68 @@ static ssize_t show_virtual(struct class_device *class_device, char *buf)
242 fb_info->var.yres_virtual); 242 fb_info->var.yres_virtual);
243} 243}
244 244
245static ssize_t store_cmap(struct class_device *class_device, const char * buf, 245/* Format for cmap is "%02x%c%4x%4x%4x\n" */
246/* %02x entry %c transp %4x red %4x blue %4x green \n */
247/* 256 rows at 16 chars equals 4096, the normal page size */
248/* the code will automatically adjust for different page sizes */
249static ssize_t store_cmap(struct class_device *class_device, const char *buf,
246 size_t count) 250 size_t count)
247{ 251{
248// struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); 252 struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device);
253 int rc, i, start, length, transp = 0;
254
255 if ((count > PAGE_SIZE) || ((count % 16) != 0))
256 return -EINVAL;
257
258 if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap)
259 return -EINVAL;
260
261 sscanf(buf, "%02x", &start);
262 length = count / 16;
263
264 for (i = 0; i < length; i++)
265 if (buf[i * 16 + 2] != ' ')
266 transp = 1;
267
268 /* If we can batch, do it */
269 if (fb_info->fbops->fb_setcmap && length > 1) {
270 struct fb_cmap umap;
271
272 memset(&umap, 0, sizeof(umap));
273 if ((rc = fb_alloc_cmap(&umap, length, transp)))
274 return rc;
275
276 umap.start = start;
277 for (i = 0; i < length; i++) {
278 sscanf(&buf[i * 16 + 3], "%4hx", &umap.red[i]);
279 sscanf(&buf[i * 16 + 7], "%4hx", &umap.blue[i]);
280 sscanf(&buf[i * 16 + 11], "%4hx", &umap.green[i]);
281 if (transp)
282 umap.transp[i] = (buf[i * 16 + 2] != ' ');
283 }
284 rc = fb_info->fbops->fb_setcmap(&umap, fb_info);
285 fb_copy_cmap(&umap, &fb_info->cmap);
286 fb_dealloc_cmap(&umap);
287
288 return rc;
289 }
290 for (i = 0; i < length; i++) {
291 u16 red, blue, green, tsp;
292
293 sscanf(&buf[i * 16 + 3], "%4hx", &red);
294 sscanf(&buf[i * 16 + 7], "%4hx", &blue);
295 sscanf(&buf[i * 16 + 11], "%4hx", &green);
296 tsp = (buf[i * 16 + 2] != ' ');
297 if ((rc = fb_info->fbops->fb_setcolreg(start++,
298 red, green, blue, tsp, fb_info)))
299 return rc;
300
301 fb_info->cmap.red[i] = red;
302 fb_info->cmap.blue[i] = blue;
303 fb_info->cmap.green[i] = green;
304 if (transp)
305 fb_info->cmap.transp[i] = tsp;
306 }
249 return 0; 307 return 0;
250} 308}
251 309
@@ -253,20 +311,24 @@ static ssize_t show_cmap(struct class_device *class_device, char *buf)
253{ 311{
254 struct fb_info *fb_info = 312 struct fb_info *fb_info =
255 (struct fb_info *)class_get_devdata(class_device); 313 (struct fb_info *)class_get_devdata(class_device);
256 unsigned int offset = 0, i; 314 unsigned int i;
257 315
258 if (!fb_info->cmap.red || !fb_info->cmap.blue || 316 if (!fb_info->cmap.red || !fb_info->cmap.blue ||
259 !fb_info->cmap.green || !fb_info->cmap.transp) 317 !fb_info->cmap.green)
318 return -EINVAL;
319
320 if (fb_info->cmap.len > PAGE_SIZE / 16)
260 return -EINVAL; 321 return -EINVAL;
261 322
323 /* don't mess with the format, the buffer is PAGE_SIZE */
324 /* 256 entries at 16 chars per line equals 4096 = PAGE_SIZE */
262 for (i = 0; i < fb_info->cmap.len; i++) { 325 for (i = 0; i < fb_info->cmap.len; i++) {
263 offset += snprintf(buf, PAGE_SIZE - offset, 326 snprintf(&buf[ i * 16], PAGE_SIZE - i * 16, "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start,
264 "%d,%d,%d,%d,%d\n", i + fb_info->cmap.start, 327 ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '),
265 fb_info->cmap.red[i], fb_info->cmap.blue[i], 328 fb_info->cmap.red[i], fb_info->cmap.blue[i],
266 fb_info->cmap.green[i], 329 fb_info->cmap.green[i]);
267 fb_info->cmap.transp[i]);
268 } 330 }
269 return offset; 331 return 16 * fb_info->cmap.len;
270} 332}
271 333
272static ssize_t store_blank(struct class_device *class_device, const char * buf, 334static ssize_t store_blank(struct class_device *class_device, const char * buf,
@@ -352,6 +414,13 @@ static ssize_t show_pan(struct class_device *class_device, char *buf)
352 fb_info->var.xoffset); 414 fb_info->var.xoffset);
353} 415}
354 416
417static ssize_t show_name(struct class_device *class_device, char *buf)
418{
419 struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device);
420
421 return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id);
422}
423
355static struct class_device_attribute class_device_attrs[] = { 424static struct class_device_attribute class_device_attrs[] = {
356 __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), 425 __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp),
357 __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), 426 __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank),
@@ -362,6 +431,7 @@ static struct class_device_attribute class_device_attrs[] = {
362 __ATTR(modes, S_IRUGO|S_IWUSR, show_modes, store_modes), 431 __ATTR(modes, S_IRUGO|S_IWUSR, show_modes, store_modes),
363 __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan), 432 __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan),
364 __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual), 433 __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual),
434 __ATTR(name, S_IRUGO, show_name, NULL),
365}; 435};
366 436
367int fb_init_class_device(struct fb_info *fb_info) 437int fb_init_class_device(struct fb_info *fb_info)
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index fbf659b6dab0..3edc9f49344b 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -246,6 +246,11 @@ static const struct fb_videomode modedb[] = {
246 /* 480x300 @ 72 Hz, 48.0 kHz hsync */ 246 /* 480x300 @ 72 Hz, 48.0 kHz hsync */
247 NULL, 72, 480, 300, 33386, 40, 24, 11, 19, 80, 3, 247 NULL, 72, 480, 300, 33386, 40, 24, 11, 19, 80, 3,
248 0, FB_VMODE_DOUBLE 248 0, FB_VMODE_DOUBLE
249 }, {
250 /* 1920x1200 @ 60 Hz, 74.5 Khz hsync */
251 NULL, 60, 1920, 1200, 5177, 128, 336, 1, 38, 208, 3,
252 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
253 FB_VMODE_NONINTERLACED
249 }, 254 },
250}; 255};
251 256
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index b2e6b2407869..52b16850a54e 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -1324,6 +1324,13 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info)
1324 1324
1325 fb_videomode_to_var(&nvidiafb_default_var, &modedb); 1325 fb_videomode_to_var(&nvidiafb_default_var, &modedb);
1326 nvidiafb_default_var.bits_per_pixel = 8; 1326 nvidiafb_default_var.bits_per_pixel = 8;
1327 } else if (par->fpWidth && par->fpHeight) {
1328 char buf[16];
1329
1330 memset(buf, 0, 16);
1331 snprintf(buf, 15, "%dx%d", par->fpWidth, par->fpHeight);
1332 fb_find_mode(&nvidiafb_default_var, info, buf, specs->modedb,
1333 specs->modedb_len, &modedb, 8);
1327 } 1334 }
1328 1335
1329 if (mode_option) 1336 if (mode_option)
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index 5dceddedf507..42c17efa9fb0 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -138,27 +138,27 @@ static struct fb_var_screeninfo pm2fb_var __devinitdata = {
138 * Utility functions 138 * Utility functions
139 */ 139 */
140 140
141inline static u32 RD32(unsigned char __iomem *base, s32 off) 141static inline u32 RD32(unsigned char __iomem *base, s32 off)
142{ 142{
143 return fb_readl(base + off); 143 return fb_readl(base + off);
144} 144}
145 145
146inline static void WR32(unsigned char __iomem *base, s32 off, u32 v) 146static inline void WR32(unsigned char __iomem *base, s32 off, u32 v)
147{ 147{
148 fb_writel(v, base + off); 148 fb_writel(v, base + off);
149} 149}
150 150
151inline static u32 pm2_RD(struct pm2fb_par* p, s32 off) 151static inline u32 pm2_RD(struct pm2fb_par* p, s32 off)
152{ 152{
153 return RD32(p->v_regs, off); 153 return RD32(p->v_regs, off);
154} 154}
155 155
156inline static void pm2_WR(struct pm2fb_par* p, s32 off, u32 v) 156static inline void pm2_WR(struct pm2fb_par* p, s32 off, u32 v)
157{ 157{
158 WR32(p->v_regs, off, v); 158 WR32(p->v_regs, off, v);
159} 159}
160 160
161inline static u32 pm2_RDAC_RD(struct pm2fb_par* p, s32 idx) 161static inline u32 pm2_RDAC_RD(struct pm2fb_par* p, s32 idx)
162{ 162{
163 int index = PM2R_RD_INDEXED_DATA; 163 int index = PM2R_RD_INDEXED_DATA;
164 switch (p->type) { 164 switch (p->type) {
@@ -174,7 +174,7 @@ inline static u32 pm2_RDAC_RD(struct pm2fb_par* p, s32 idx)
174 return pm2_RD(p, index); 174 return pm2_RD(p, index);
175} 175}
176 176
177inline static void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) 177static inline void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
178{ 178{
179 int index = PM2R_RD_INDEXED_DATA; 179 int index = PM2R_RD_INDEXED_DATA;
180 switch (p->type) { 180 switch (p->type) {
@@ -190,7 +190,7 @@ inline static void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
190 pm2_WR(p, index, v); 190 pm2_WR(p, index, v);
191} 191}
192 192
193inline static void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) 193static inline void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
194{ 194{
195 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff); 195 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff);
196 mb(); 196 mb();
@@ -200,7 +200,7 @@ inline static void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
200#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT 200#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT
201#define WAIT_FIFO(p,a) 201#define WAIT_FIFO(p,a)
202#else 202#else
203inline static void WAIT_FIFO(struct pm2fb_par* p, u32 a) 203static inline void WAIT_FIFO(struct pm2fb_par* p, u32 a)
204{ 204{
205 while( pm2_RD(p, PM2R_IN_FIFO_SPACE) < a ); 205 while( pm2_RD(p, PM2R_IN_FIFO_SPACE) < a );
206 mb(); 206 mb();
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 6a9e183be41b..ae297e222681 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -1826,7 +1826,7 @@ static void __devinit riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
1826#ifdef CONFIG_PPC_OF 1826#ifdef CONFIG_PPC_OF
1827 if (!riva_get_EDID_OF(info, pdev)) 1827 if (!riva_get_EDID_OF(info, pdev))
1828 printk(PFX "could not retrieve EDID from OF\n"); 1828 printk(PFX "could not retrieve EDID from OF\n");
1829#elif CONFIG_FB_RIVA_I2C 1829#elif defined(CONFIG_FB_RIVA_I2C)
1830 if (!riva_get_EDID_i2c(info)) 1830 if (!riva_get_EDID_i2c(info))
1831 printk(PFX "could not retrieve EDID from DDC/I2C\n"); 1831 printk(PFX "could not retrieve EDID from DDC/I2C\n");
1832#endif 1832#endif
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index 2d29db7ef800..beeec7b51425 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -598,7 +598,7 @@ sa1100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
598 * requests for the LCD controller. If we hit this, it means we're 598 * requests for the LCD controller. If we hit this, it means we're
599 * doing nothing but LCD DMA. 599 * doing nothing but LCD DMA.
600 */ 600 */
601static unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo *var) 601static inline unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo *var)
602{ 602{
603 /* 603 /*
604 * Period = pixclock * bits_per_byte * bytes_per_transfer 604 * Period = pixclock * bits_per_byte * bytes_per_transfer
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index da8004e5d03d..698ca9232e73 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -454,13 +454,16 @@ static struct accel_switch accel_image = {
454static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *fr) 454static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *fr)
455{ 455{
456 int bpp = info->var.bits_per_pixel; 456 int bpp = info->var.bits_per_pixel;
457 int col; 457 int col = 0;
458 458
459 switch (bpp) { 459 switch (bpp) {
460 default: 460 default:
461 case 8: col = fr->color; 461 case 8: col |= fr->color;
462 col |= col << 8;
463 col |= col << 16;
462 break; 464 break;
463 case 16: col = ((u32 *)(info->pseudo_palette))[fr->color]; 465 case 16: col = ((u32 *)(info->pseudo_palette))[fr->color];
466
464 break; 467 break;
465 case 32: col = ((u32 *)(info->pseudo_palette))[fr->color]; 468 case 32: col = ((u32 *)(info->pseudo_palette))[fr->color];
466 break; 469 break;
@@ -882,8 +885,9 @@ static int tridentfb_set_par(struct fb_info *info)
882 885
883 write3X4(GraphEngReg, 0x80); //enable GE for text acceleration 886 write3X4(GraphEngReg, 0x80); //enable GE for text acceleration
884 887
885// if (info->var.accel_flags & FB_ACCELF_TEXT) 888#ifdef CONFIG_FB_TRIDENT_ACCEL
886//FIXME acc->init_accel(info->var.xres,bpp); 889 acc->init_accel(info->var.xres,bpp);
890#endif
887 891
888 switch (bpp) { 892 switch (bpp) {
889 case 8: tmp = 0x00; break; 893 case 8: tmp = 0x00; break;
@@ -900,7 +904,7 @@ static int tridentfb_set_par(struct fb_info *info)
900 write3X4(DRAMControl, tmp); //both IO,linear enable 904 write3X4(DRAMControl, tmp); //both IO,linear enable
901 905
902 write3X4(InterfaceSel, read3X4(InterfaceSel) | 0x40); 906 write3X4(InterfaceSel, read3X4(InterfaceSel) | 0x40);
903 write3X4(Performance,0x20); 907 write3X4(Performance,0x92);
904 write3X4(PCIReg,0x07); //MMIO & PCI read and write burst enable 908 write3X4(PCIReg,0x07); //MMIO & PCI read and write burst enable
905 909
906 /* convert from picoseconds to MHz */ 910 /* convert from picoseconds to MHz */
@@ -981,12 +985,14 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green,
981 t_outb(green>>10,0x3C9); 985 t_outb(green>>10,0x3C9);
982 t_outb(blue>>10,0x3C9); 986 t_outb(blue>>10,0x3C9);
983 987
984 } else 988 } else if (bpp == 16) { /* RGB 565 */
985 if (bpp == 16) /* RGB 565 */ 989 u32 col;
986 ((u32*)info->pseudo_palette)[regno] = (red & 0xF800) | 990
987 ((green & 0xFC00) >> 5) | ((blue & 0xF800) >> 11); 991 col = (red & 0xF800) | ((green & 0xFC00) >> 5) |
988 else 992 ((blue & 0xF800) >> 11);
989 if (bpp == 32) /* ARGB 8888 */ 993 col |= col << 16;
994 ((u32 *)(info->pseudo_palette))[regno] = col;
995 } else if (bpp == 32) /* ARGB 8888 */
990 ((u32*)info->pseudo_palette)[regno] = 996 ((u32*)info->pseudo_palette)[regno] =
991 ((transp & 0xFF00) <<16) | 997 ((transp & 0xFF00) <<16) |
992 ((red & 0xFF00) << 8) | 998 ((red & 0xFF00) << 8) |
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index 9ed1a931dd31..a272592b0373 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -45,7 +45,7 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = {
45}; 45};
46 46
47static int inverse = 0; 47static int inverse = 0;
48static int mtrr = 1; 48static int mtrr = 3; /* default to write-combining */
49static int vram_remap __initdata = 0; /* Set amount of memory to be used */ 49static int vram_remap __initdata = 0; /* Set amount of memory to be used */
50static int vram_total __initdata = 0; /* Set total amount of memory */ 50static int vram_total __initdata = 0; /* Set total amount of memory */
51static int pmi_setpal = 0; /* pmi for palette changes ??? */ 51static int pmi_setpal = 0; /* pmi for palette changes ??? */
@@ -204,8 +204,8 @@ static int __init vesafb_setup(char *options)
204 pmi_setpal=0; 204 pmi_setpal=0;
205 else if (! strcmp(this_opt, "pmipal")) 205 else if (! strcmp(this_opt, "pmipal"))
206 pmi_setpal=1; 206 pmi_setpal=1;
207 else if (! strcmp(this_opt, "mtrr")) 207 else if (! strncmp(this_opt, "mtrr:", 5))
208 mtrr=1; 208 mtrr = simple_strtoul(this_opt+5, NULL, 0);
209 else if (! strcmp(this_opt, "nomtrr")) 209 else if (! strcmp(this_opt, "nomtrr"))
210 mtrr=0; 210 mtrr=0;
211 else if (! strncmp(this_opt, "vtotal:", 7)) 211 else if (! strncmp(this_opt, "vtotal:", 7))
@@ -387,14 +387,39 @@ static int __init vesafb_probe(struct device *device)
387 387
388 if (mtrr) { 388 if (mtrr) {
389 unsigned int temp_size = size_total; 389 unsigned int temp_size = size_total;
390 /* Find the largest power-of-two */ 390 unsigned int type = 0;
391 while (temp_size & (temp_size - 1)) 391
392 temp_size &= (temp_size - 1); 392 switch (mtrr) {
393 393 case 1:
394 /* Try and find a power of two to add */ 394 type = MTRR_TYPE_UNCACHABLE;
395 while (temp_size > PAGE_SIZE && 395 break;
396 mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) { 396 case 2:
397 temp_size >>= 1; 397 type = MTRR_TYPE_WRBACK;
398 break;
399 case 3:
400 type = MTRR_TYPE_WRCOMB;
401 break;
402 case 4:
403 type = MTRR_TYPE_WRTHROUGH;
404 break;
405 default:
406 type = 0;
407 break;
408 }
409
410 if (type) {
411 int rc;
412
413 /* Find the largest power-of-two */
414 while (temp_size & (temp_size - 1))
415 temp_size &= (temp_size - 1);
416
417 /* Try and find a power of two to add */
418 do {
419 rc = mtrr_add(vesafb_fix.smem_start, temp_size,
420 type, 1);
421 temp_size >>= 1;
422 } while (temp_size >= PAGE_SIZE && rc == -EINVAL);
398 } 423 }
399 } 424 }
400 425