aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-24 05:20:02 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-24 05:20:02 -0400
commit3c470f33e6a1df1398143c1f3dd619f675602472 (patch)
treef9d7c0ea938193599e815a4e4691ba331f75a68c
parentfcb8ce5cfe30ca9ca5c9a79cdfe26d1993e65e0c (diff)
parent0d5c6ca30bb0190c0a63fd6452c71051fb6bfbe4 (diff)
Merge branch 'pan-fixes' of git://linuxtv.org/pinchartl/fbdev into fbdev-next
-rw-r--r--drivers/staging/xgifb/XGI_main_26.c22
-rw-r--r--drivers/video/68328fb.c4
-rw-r--r--drivers/video/acornfb.c5
-rw-r--r--drivers/video/arkfb.c9
-rw-r--r--drivers/video/atmel_lcdfb.c15
-rw-r--r--drivers/video/aty/radeon_base.c10
-rw-r--r--drivers/video/da8xx-fb.c4
-rw-r--r--drivers/video/fb-puv3.c4
-rw-r--r--drivers/video/g364fb.c5
-rw-r--r--drivers/video/gxt4500.c4
-rw-r--r--drivers/video/hgafb.c4
-rw-r--r--drivers/video/imsttfb.c2
-rw-r--r--drivers/video/intelfb/intelfbhw.c6
-rw-r--r--drivers/video/mb862xx/mb862xxfbdrv.c2
-rw-r--r--drivers/video/mx3fb.c6
-rw-r--r--drivers/video/neofb.c4
-rw-r--r--drivers/video/pm2fb.c4
-rw-r--r--drivers/video/pm3fb.c4
-rw-r--r--drivers/video/s3c-fb.c2
-rw-r--r--drivers/video/s3fb.c7
-rw-r--r--drivers/video/savage/savagefb_driver.c16
-rw-r--r--drivers/video/sis/sis_main.c30
-rw-r--r--drivers/video/sm501fb.c6
-rw-r--r--drivers/video/tridentfb.c4
-rw-r--r--drivers/video/vfb.c4
-rw-r--r--drivers/video/vga16fb.c2
-rw-r--r--drivers/video/vt8500lcdfb.c4
-rw-r--r--drivers/video/vt8623fb.c9
28 files changed, 92 insertions, 106 deletions
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 4403e5f8059..f8b88add952 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -1364,26 +1364,16 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
1364} 1364}
1365 1365
1366#ifdef XGIFB_PAN 1366#ifdef XGIFB_PAN
1367static int XGIfb_pan_var(struct fb_var_screeninfo *var) 1367static int XGIfb_pan_var(struct fb_var_screeninfo *var, struct fb_info *info)
1368{ 1368{
1369 unsigned int base; 1369 unsigned int base;
1370 1370
1371 /* printk("Inside pan_var"); */ 1371 /* printk("Inside pan_var"); */
1372 1372
1373 if (var->xoffset > (var->xres_virtual - var->xres)) { 1373 base = var->yoffset * info->var.xres_virtual + var->xoffset;
1374 /* printk("Pan: xo: %d xv %d xr %d\n",
1375 var->xoffset, var->xres_virtual, var->xres); */
1376 return -EINVAL;
1377 }
1378 if (var->yoffset > (var->yres_virtual - var->yres)) {
1379 /* printk("Pan: yo: %d yv %d yr %d\n",
1380 var->yoffset, var->yres_virtual, var->yres); */
1381 return -EINVAL;
1382 }
1383 base = var->yoffset * var->xres_virtual + var->xoffset;
1384 1374
1385 /* calculate base bpp dep. */ 1375 /* calculate base bpp dep. */
1386 switch (var->bits_per_pixel) { 1376 switch (info->var.bits_per_pixel) {
1387 case 16: 1377 case 16:
1388 base >>= 1; 1378 base >>= 1;
1389 break; 1379 break;
@@ -1681,9 +1671,9 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var,
1681 1671
1682 /* printk("\nInside pan_display:\n"); */ 1672 /* printk("\nInside pan_display:\n"); */
1683 1673
1684 if (var->xoffset > (var->xres_virtual - var->xres)) 1674 if (var->xoffset > (info->var.xres_virtual - info->var.xres))
1685 return -EINVAL; 1675 return -EINVAL;
1686 if (var->yoffset > (var->yres_virtual - var->yres)) 1676 if (var->yoffset > (info->var.yres_virtual - info->var.yres))
1687 return -EINVAL; 1677 return -EINVAL;
1688 1678
1689 if (var->vmode & FB_VMODE_YWRAP) { 1679 if (var->vmode & FB_VMODE_YWRAP) {
@@ -1696,7 +1686,7 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var,
1696 > info->var.yres_virtual) 1686 > info->var.yres_virtual)
1697 return -EINVAL; 1687 return -EINVAL;
1698 } 1688 }
1699 err = XGIfb_pan_var(var); 1689 err = XGIfb_pan_var(var, info);
1700 if (err < 0) 1690 if (err < 0)
1701 return err; 1691 return err;
1702 1692
diff --git a/drivers/video/68328fb.c b/drivers/video/68328fb.c
index 75a39eab70c..a425d65d5ba 100644
--- a/drivers/video/68328fb.c
+++ b/drivers/video/68328fb.c
@@ -378,8 +378,8 @@ static int mc68x328fb_pan_display(struct fb_var_screeninfo *var,
378 || var->xoffset) 378 || var->xoffset)
379 return -EINVAL; 379 return -EINVAL;
380 } else { 380 } else {
381 if (var->xoffset + var->xres > info->var.xres_virtual || 381 if (var->xoffset + info->var.xres > info->var.xres_virtual ||
382 var->yoffset + var->yres > info->var.yres_virtual) 382 var->yoffset + info->var.yres > info->var.yres_virtual)
383 return -EINVAL; 383 return -EINVAL;
384 } 384 }
385 info->var.xoffset = var->xoffset; 385 info->var.xoffset = var->xoffset;
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c
index 6183a57eb69..b303f171506 100644
--- a/drivers/video/acornfb.c
+++ b/drivers/video/acornfb.c
@@ -850,9 +850,10 @@ acornfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
850 u_int y_bottom = var->yoffset; 850 u_int y_bottom = var->yoffset;
851 851
852 if (!(var->vmode & FB_VMODE_YWRAP)) 852 if (!(var->vmode & FB_VMODE_YWRAP))
853 y_bottom += var->yres; 853 y_bottom += info->var.yres;
854 854
855 BUG_ON(y_bottom > var->yres_virtual); 855 if (y_bottom > info->var.yres_virtual)
856 return -EINVAL;
856 857
857 acornfb_update_dma(info, var); 858 acornfb_update_dma(info, var);
858 859
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
index 8686429cbdf..555dd4c64f5 100644
--- a/drivers/video/arkfb.c
+++ b/drivers/video/arkfb.c
@@ -908,13 +908,14 @@ static int arkfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info
908 unsigned int offset; 908 unsigned int offset;
909 909
910 /* Calculate the offset */ 910 /* Calculate the offset */
911 if (var->bits_per_pixel == 0) { 911 if (info->var.bits_per_pixel == 0) {
912 offset = (var->yoffset / 16) * (var->xres_virtual / 2) + (var->xoffset / 2); 912 offset = (var->yoffset / 16) * (info->var.xres_virtual / 2)
913 + (var->xoffset / 2);
913 offset = offset >> 2; 914 offset = offset >> 2;
914 } else { 915 } else {
915 offset = (var->yoffset * info->fix.line_length) + 916 offset = (var->yoffset * info->fix.line_length) +
916 (var->xoffset * var->bits_per_pixel / 8); 917 (var->xoffset * info->var.bits_per_pixel / 8);
917 offset = offset >> ((var->bits_per_pixel == 4) ? 2 : 3); 918 offset = offset >> ((info->var.bits_per_pixel == 4) ? 2 : 3);
918 } 919 }
919 920
920 /* Set the offset */ 921 /* Set the offset */
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 817ab60f753..244d55b7c0a 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -39,7 +39,8 @@
39 | FBINFO_HWACCEL_YPAN) 39 | FBINFO_HWACCEL_YPAN)
40 40
41static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo, 41static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
42 struct fb_var_screeninfo *var) 42 struct fb_var_screeninfo *var,
43 struct fb_info *info)
43{ 44{
44 45
45} 46}
@@ -50,14 +51,16 @@ static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
50 | FBINFO_HWACCEL_YPAN) 51 | FBINFO_HWACCEL_YPAN)
51 52
52static void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo, 53static void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
53 struct fb_var_screeninfo *var) 54 struct fb_var_screeninfo *var,
55 struct fb_info *info)
54{ 56{
55 u32 dma2dcfg; 57 u32 dma2dcfg;
56 u32 pixeloff; 58 u32 pixeloff;
57 59
58 pixeloff = (var->xoffset * var->bits_per_pixel) & 0x1f; 60 pixeloff = (var->xoffset * info->var.bits_per_pixel) & 0x1f;
59 61
60 dma2dcfg = ((var->xres_virtual - var->xres) * var->bits_per_pixel) / 8; 62 dma2dcfg = (info->var.xres_virtual - info->var.xres)
63 * info->var.bits_per_pixel / 8;
61 dma2dcfg |= pixeloff << ATMEL_LCDC_PIXELOFF_OFFSET; 64 dma2dcfg |= pixeloff << ATMEL_LCDC_PIXELOFF_OFFSET;
62 lcdc_writel(sinfo, ATMEL_LCDC_DMA2DCFG, dma2dcfg); 65 lcdc_writel(sinfo, ATMEL_LCDC_DMA2DCFG, dma2dcfg);
63 66
@@ -249,14 +252,14 @@ static void atmel_lcdfb_update_dma(struct fb_info *info,
249 unsigned long dma_addr; 252 unsigned long dma_addr;
250 253
251 dma_addr = (fix->smem_start + var->yoffset * fix->line_length 254 dma_addr = (fix->smem_start + var->yoffset * fix->line_length
252 + var->xoffset * var->bits_per_pixel / 8); 255 + var->xoffset * info->var.bits_per_pixel / 8);
253 256
254 dma_addr &= ~3UL; 257 dma_addr &= ~3UL;
255 258
256 /* Set framebuffer DMA base address and pixel offset */ 259 /* Set framebuffer DMA base address and pixel offset */
257 lcdc_writel(sinfo, ATMEL_LCDC_DMABADDR1, dma_addr); 260 lcdc_writel(sinfo, ATMEL_LCDC_DMABADDR1, dma_addr);
258 261
259 atmel_lcdfb_update_dma2d(sinfo, var); 262 atmel_lcdfb_update_dma2d(sinfo, var, info);
260} 263}
261 264
262static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo) 265static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo)
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 32f8cf6200a..150684882ef 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -845,16 +845,16 @@ static int radeonfb_pan_display (struct fb_var_screeninfo *var,
845{ 845{
846 struct radeonfb_info *rinfo = info->par; 846 struct radeonfb_info *rinfo = info->par;
847 847
848 if ((var->xoffset + var->xres > var->xres_virtual) 848 if ((var->xoffset + info->var.xres > info->var.xres_virtual)
849 || (var->yoffset + var->yres > var->yres_virtual)) 849 || (var->yoffset + info->var.yres > info->var.yres_virtual))
850 return -EINVAL; 850 return -EINVAL;
851 851
852 if (rinfo->asleep) 852 if (rinfo->asleep)
853 return 0; 853 return 0;
854 854
855 radeon_fifo_wait(2); 855 radeon_fifo_wait(2);
856 OUTREG(CRTC_OFFSET, ((var->yoffset * var->xres_virtual + var->xoffset) 856 OUTREG(CRTC_OFFSET, (var->yoffset * info->fix.line_length +
857 * var->bits_per_pixel / 8) & ~7); 857 var->xoffset * info->var.bits_per_pixel / 8) & ~7);
858 return 0; 858 return 0;
859} 859}
860 860
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index fcdac872522..8d4e4ebd997 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -877,8 +877,8 @@ static int da8xx_pan_display(struct fb_var_screeninfo *var,
877 877
878 start = fix->smem_start + 878 start = fix->smem_start +
879 new_var.yoffset * fix->line_length + 879 new_var.yoffset * fix->line_length +
880 new_var.xoffset * var->bits_per_pixel / 8; 880 new_var.xoffset * fbi->var.bits_per_pixel / 8;
881 end = start + var->yres * fix->line_length - 1; 881 end = start + fbi->var.yres * fix->line_length - 1;
882 par->dma_start = start; 882 par->dma_start = start;
883 par->dma_end = end; 883 par->dma_end = end;
884 } 884 }
diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
index 27f2c57e06e..60a787fa32c 100644
--- a/drivers/video/fb-puv3.c
+++ b/drivers/video/fb-puv3.c
@@ -624,8 +624,8 @@ static int unifb_pan_display(struct fb_var_screeninfo *var,
624 || var->xoffset) 624 || var->xoffset)
625 return -EINVAL; 625 return -EINVAL;
626 } else { 626 } else {
627 if (var->xoffset + var->xres > info->var.xres_virtual || 627 if (var->xoffset + info->var.xres > info->var.xres_virtual ||
628 var->yoffset + var->yres > info->var.yres_virtual) 628 var->yoffset + info->var.yres > info->var.yres_virtual)
629 return -EINVAL; 629 return -EINVAL;
630 } 630 }
631 info->var.xoffset = var->xoffset; 631 info->var.xoffset = var->xoffset;
diff --git a/drivers/video/g364fb.c b/drivers/video/g364fb.c
index d662317d85e..223896cc5f7 100644
--- a/drivers/video/g364fb.c
+++ b/drivers/video/g364fb.c
@@ -149,10 +149,11 @@ int g364fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
149static int g364fb_pan_display(struct fb_var_screeninfo *var, 149static int g364fb_pan_display(struct fb_var_screeninfo *var,
150 struct fb_info *info) 150 struct fb_info *info)
151{ 151{
152 if (var->xoffset || var->yoffset + var->yres > var->yres_virtual) 152 if (var->xoffset ||
153 var->yoffset + info->var.yres > info->var.yres_virtual)
153 return -EINVAL; 154 return -EINVAL;
154 155
155 *(unsigned int *) TOP_REG = var->yoffset * var->xres; 156 *(unsigned int *) TOP_REG = var->yoffset * info->var.xres;
156 return 0; 157 return 0;
157} 158}
158 159
diff --git a/drivers/video/gxt4500.c b/drivers/video/gxt4500.c
index 896e53dea90..0fad23f810a 100644
--- a/drivers/video/gxt4500.c
+++ b/drivers/video/gxt4500.c
@@ -543,8 +543,8 @@ static int gxt4500_pan_display(struct fb_var_screeninfo *var,
543 543
544 if (var->xoffset & 7) 544 if (var->xoffset & 7)
545 return -EINVAL; 545 return -EINVAL;
546 if (var->xoffset + var->xres > var->xres_virtual || 546 if (var->xoffset + info->var.xres > info->var.xres_virtual ||
547 var->yoffset + var->yres > var->yres_virtual) 547 var->yoffset + info->var.yres > info->var.yres_virtual)
548 return -EINVAL; 548 return -EINVAL;
549 549
550 writereg(par, REFRESH_START, (var->xoffset << 16) | var->yoffset); 550 writereg(par, REFRESH_START, (var->xoffset << 16) | var->yoffset);
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c
index 4052718eefa..4394389caf6 100644
--- a/drivers/video/hgafb.c
+++ b/drivers/video/hgafb.c
@@ -422,8 +422,8 @@ static int hgafb_pan_display(struct fb_var_screeninfo *var,
422 var->xoffset) 422 var->xoffset)
423 return -EINVAL; 423 return -EINVAL;
424 } else { 424 } else {
425 if (var->xoffset + var->xres > info->var.xres_virtual 425 if (var->xoffset + info->var.xres > info->var.xres_virtual
426 || var->yoffset + var->yres > info->var.yres_virtual 426 || var->yoffset + info->var.yres > info->var.yres_virtual
427 || var->yoffset % 8) 427 || var->yoffset % 8)
428 return -EINVAL; 428 return -EINVAL;
429 } 429 }
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c
index efb2c10656b..8149356471e 100644
--- a/drivers/video/imsttfb.c
+++ b/drivers/video/imsttfb.c
@@ -749,7 +749,7 @@ set_offset (struct fb_var_screeninfo *var, struct fb_info *info)
749{ 749{
750 struct imstt_par *par = info->par; 750 struct imstt_par *par = info->par;
751 __u32 off = var->yoffset * (info->fix.line_length >> 3) 751 __u32 off = var->yoffset * (info->fix.line_length >> 3)
752 + ((var->xoffset * (var->bits_per_pixel >> 3)) >> 3); 752 + ((var->xoffset * (info->var.bits_per_pixel >> 3)) >> 3);
753 write_reg_le32(par->dc_regs, SSR, off); 753 write_reg_le32(par->dc_regs, SSR, off);
754} 754}
755 755
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index 38065cf94ac..fbad61da359 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -390,12 +390,12 @@ int intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
390 xoffset = ROUND_DOWN_TO(var->xoffset, 8); 390 xoffset = ROUND_DOWN_TO(var->xoffset, 8);
391 yoffset = var->yoffset; 391 yoffset = var->yoffset;
392 392
393 if ((xoffset + var->xres > var->xres_virtual) || 393 if ((xoffset + info->var.xres > info->var.xres_virtual) ||
394 (yoffset + var->yres > var->yres_virtual)) 394 (yoffset + info->var.yres > info->var.yres_virtual))
395 return -EINVAL; 395 return -EINVAL;
396 396
397 offset = (yoffset * dinfo->pitch) + 397 offset = (yoffset * dinfo->pitch) +
398 (xoffset * var->bits_per_pixel) / 8; 398 (xoffset * info->var.bits_per_pixel) / 8;
399 399
400 offset += dinfo->fb.offset << 12; 400 offset += dinfo->fb.offset << 12;
401 401
diff --git a/drivers/video/mb862xx/mb862xxfbdrv.c b/drivers/video/mb862xx/mb862xxfbdrv.c
index ee1de3e26de..7a1f2773cf3 100644
--- a/drivers/video/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/mb862xx/mb862xxfbdrv.c
@@ -278,7 +278,7 @@ static int mb862xxfb_pan(struct fb_var_screeninfo *var,
278 reg = pack(var->yoffset, var->xoffset); 278 reg = pack(var->yoffset, var->xoffset);
279 outreg(disp, GC_L0WY_L0WX, reg); 279 outreg(disp, GC_L0WY_L0WX, reg);
280 280
281 reg = pack(var->yres_virtual, var->xres_virtual); 281 reg = pack(info->var.yres_virtual, info->var.xres_virtual);
282 outreg(disp, GC_L0WH_L0WW, reg); 282 outreg(disp, GC_L0WH_L0WW, reg);
283 return 0; 283 return 0;
284} 284}
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index 7e3a490e8d7..bd768588cf1 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -1062,15 +1062,15 @@ static int mx3fb_pan_display(struct fb_var_screeninfo *var,
1062 y_bottom = var->yoffset; 1062 y_bottom = var->yoffset;
1063 1063
1064 if (!(var->vmode & FB_VMODE_YWRAP)) 1064 if (!(var->vmode & FB_VMODE_YWRAP))
1065 y_bottom += var->yres; 1065 y_bottom += fbi->var.yres;
1066 1066
1067 if (y_bottom > fbi->var.yres_virtual) 1067 if (y_bottom > fbi->var.yres_virtual)
1068 return -EINVAL; 1068 return -EINVAL;
1069 1069
1070 mutex_lock(&mx3_fbi->mutex); 1070 mutex_lock(&mx3_fbi->mutex);
1071 1071
1072 offset = (var->yoffset * var->xres_virtual + var->xoffset) * 1072 offset = var->yoffset * fbi->fix.line_length
1073 (var->bits_per_pixel / 8); 1073 + var->xoffset * (fbi->var.bits_per_pixel / 8);
1074 base = fbi->fix.smem_start + offset; 1074 base = fbi->fix.smem_start + offset;
1075 1075
1076 dev_dbg(fbi->device, "Updating SDC BG buf %d address=0x%08lX\n", 1076 dev_dbg(fbi->device, "Updating SDC BG buf %d address=0x%08lX\n",
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index 588527a254c..feea7b1dc38 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -1185,8 +1185,8 @@ static int neofb_pan_display(struct fb_var_screeninfo *var,
1185 1185
1186 DBG("neofb_update_start"); 1186 DBG("neofb_update_start");
1187 1187
1188 Base = (var->yoffset * var->xres_virtual + var->xoffset) >> 2; 1188 Base = (var->yoffset * info->var.xres_virtual + var->xoffset) >> 2;
1189 Base *= (var->bits_per_pixel + 7) / 8; 1189 Base *= (info->var.bits_per_pixel + 7) / 8;
1190 1190
1191 neoUnlock(); 1191 neoUnlock();
1192 1192
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index 27f93aab6dd..f4f8ce802d0 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -973,8 +973,8 @@ static int pm2fb_pan_display(struct fb_var_screeninfo *var,
973{ 973{
974 struct pm2fb_par *p = info->par; 974 struct pm2fb_par *p = info->par;
975 u32 base; 975 u32 base;
976 u32 depth = (var->bits_per_pixel + 7) & ~7; 976 u32 depth = (info->var.bits_per_pixel + 7) & ~7;
977 u32 xres = (var->xres + 31) & ~31; 977 u32 xres = (info->var.xres + 31) & ~31;
978 978
979 depth = (depth > 32) ? 32 : depth; 979 depth = (depth > 32) ? 32 : depth;
980 base = to3264(var->yoffset * xres + var->xoffset, depth, 1); 980 base = to3264(var->yoffset * xres + var->xoffset, depth, 1);
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c
index 6666f45a2f8..8221b5b42da 100644
--- a/drivers/video/pm3fb.c
+++ b/drivers/video/pm3fb.c
@@ -1147,9 +1147,9 @@ static int pm3fb_pan_display(struct fb_var_screeninfo *var,
1147 struct fb_info *info) 1147 struct fb_info *info)
1148{ 1148{
1149 struct pm3_par *par = info->par; 1149 struct pm3_par *par = info->par;
1150 const u32 xres = (var->xres + 31) & ~31; 1150 const u32 xres = (info->var.xres + 31) & ~31;
1151 1151
1152 par->base = pm3fb_shift_bpp(var->bits_per_pixel, 1152 par->base = pm3fb_shift_bpp(info->var.bits_per_pixel,
1153 (var->yoffset * xres) 1153 (var->yoffset * xres)
1154 + var->xoffset); 1154 + var->xoffset);
1155 PM3_WAIT(par, 1); 1155 PM3_WAIT(par, 1);
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 4aecf213c9b..fd9f20df912 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -883,7 +883,7 @@ static int s3c_fb_pan_display(struct fb_var_screeninfo *var,
883 } 883 }
884 } 884 }
885 /* Offset in bytes to the end of the displayed area */ 885 /* Offset in bytes to the end of the displayed area */
886 end_boff = start_boff + var->yres * info->fix.line_length; 886 end_boff = start_boff + info->var.yres * info->fix.line_length;
887 887
888 /* Temporarily turn off per-vsync update from shadow registers until 888 /* Temporarily turn off per-vsync update from shadow registers until
889 * both start and end addresses are updated to prevent corruption */ 889 * both start and end addresses are updated to prevent corruption */
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index 4ca5d0c8fe8..0f9af1aa507 100644
--- a/drivers/video/s3fb.c
+++ b/drivers/video/s3fb.c
@@ -1019,12 +1019,13 @@ static int s3fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
1019 unsigned int offset; 1019 unsigned int offset;
1020 1020
1021 /* Calculate the offset */ 1021 /* Calculate the offset */
1022 if (var->bits_per_pixel == 0) { 1022 if (info->var.bits_per_pixel == 0) {
1023 offset = (var->yoffset / 16) * (var->xres_virtual / 2) + (var->xoffset / 2); 1023 offset = (var->yoffset / 16) * (info->var.xres_virtual / 2)
1024 + (var->xoffset / 2);
1024 offset = offset >> 2; 1025 offset = offset >> 2;
1025 } else { 1026 } else {
1026 offset = (var->yoffset * info->fix.line_length) + 1027 offset = (var->yoffset * info->fix.line_length) +
1027 (var->xoffset * var->bits_per_pixel / 8); 1028 (var->xoffset * info->var.bits_per_pixel / 8);
1028 offset = offset >> 2; 1029 offset = offset >> 2;
1029 } 1030 }
1030 1031
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 4de541ca9c5..beb495044b2 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -1477,15 +1477,9 @@ static void savagefb_set_par_int(struct savagefb_par *par, struct savage_reg *r
1477 vgaHWProtect(par, 0); 1477 vgaHWProtect(par, 0);
1478} 1478}
1479 1479
1480static void savagefb_update_start(struct savagefb_par *par, 1480static void savagefb_update_start(struct savagefb_par *par, int base)
1481 struct fb_var_screeninfo *var)
1482{ 1481{
1483 int base; 1482 /* program the start address registers */
1484
1485 base = ((var->yoffset * var->xres_virtual + (var->xoffset & ~1))
1486 * ((var->bits_per_pixel+7) / 8)) >> 2;
1487
1488 /* now program the start address registers */
1489 vga_out16(0x3d4, (base & 0x00ff00) | 0x0c, par); 1483 vga_out16(0x3d4, (base & 0x00ff00) | 0x0c, par);
1490 vga_out16(0x3d4, ((base & 0x00ff) << 8) | 0x0d, par); 1484 vga_out16(0x3d4, ((base & 0x00ff) << 8) | 0x0d, par);
1491 vga_out8(0x3d4, 0x69, par); 1485 vga_out8(0x3d4, 0x69, par);
@@ -1550,8 +1544,12 @@ static int savagefb_pan_display(struct fb_var_screeninfo *var,
1550 struct fb_info *info) 1544 struct fb_info *info)
1551{ 1545{
1552 struct savagefb_par *par = info->par; 1546 struct savagefb_par *par = info->par;
1547 int base;
1548
1549 base = (var->yoffset * info->fix.line_length
1550 + (var->xoffset & ~1) * ((info->var.bits_per_pixel+7) / 8)) >> 2;
1553 1551
1554 savagefb_update_start(par, var); 1552 savagefb_update_start(par, base);
1555 return 0; 1553 return 0;
1556} 1554}
1557 1555
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index 75259845933..078ca2167d6 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -1333,19 +1333,14 @@ sisfb_set_base_CRT2(struct sis_video_info *ivideo, unsigned int base)
1333} 1333}
1334 1334
1335static int 1335static int
1336sisfb_pan_var(struct sis_video_info *ivideo, struct fb_var_screeninfo *var) 1336sisfb_pan_var(struct sis_video_info *ivideo, struct fb_info *info,
1337 struct fb_var_screeninfo *var)
1337{ 1338{
1338 if(var->xoffset > (var->xres_virtual - var->xres)) { 1339 ivideo->current_base = var->yoffset * info->var.xres_virtual
1339 return -EINVAL; 1340 + var->xoffset;
1340 }
1341 if(var->yoffset > (var->yres_virtual - var->yres)) {
1342 return -EINVAL;
1343 }
1344
1345 ivideo->current_base = (var->yoffset * var->xres_virtual) + var->xoffset;
1346 1341
1347 /* calculate base bpp dep. */ 1342 /* calculate base bpp dep. */
1348 switch(var->bits_per_pixel) { 1343 switch (info->var.bits_per_pixel) {
1349 case 32: 1344 case 32:
1350 break; 1345 break;
1351 case 16: 1346 case 16:
@@ -1635,20 +1630,15 @@ sisfb_pan_display(struct fb_var_screeninfo *var, struct fb_info* info)
1635 struct sis_video_info *ivideo = (struct sis_video_info *)info->par; 1630 struct sis_video_info *ivideo = (struct sis_video_info *)info->par;
1636 int err; 1631 int err;
1637 1632
1638 if(var->xoffset > (var->xres_virtual - var->xres)) 1633 if (var->vmode & FB_VMODE_YWRAP)
1639 return -EINVAL;
1640
1641 if(var->yoffset > (var->yres_virtual - var->yres))
1642 return -EINVAL;
1643
1644 if(var->vmode & FB_VMODE_YWRAP)
1645 return -EINVAL; 1634 return -EINVAL;
1646 1635
1647 if(var->xoffset + info->var.xres > info->var.xres_virtual || 1636 if (var->xoffset + info->var.xres > info->var.xres_virtual ||
1648 var->yoffset + info->var.yres > info->var.yres_virtual) 1637 var->yoffset + info->var.yres > info->var.yres_virtual)
1649 return -EINVAL; 1638 return -EINVAL;
1650 1639
1651 if((err = sisfb_pan_var(ivideo, var)) < 0) 1640 err = sisfb_pan_var(ivideo, info, var);
1641 if (err < 0)
1652 return err; 1642 return err;
1653 1643
1654 info->var.xoffset = var->xoffset; 1644 info->var.xoffset = var->xoffset;
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index 6294dca9550..a78254cf8e8 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -582,7 +582,7 @@ static int sm501fb_pan_crt(struct fb_var_screeninfo *var,
582{ 582{
583 struct sm501fb_par *par = info->par; 583 struct sm501fb_par *par = info->par;
584 struct sm501fb_info *fbi = par->info; 584 struct sm501fb_info *fbi = par->info;
585 unsigned int bytes_pixel = var->bits_per_pixel / 8; 585 unsigned int bytes_pixel = info->var.bits_per_pixel / 8;
586 unsigned long reg; 586 unsigned long reg;
587 unsigned long xoffs; 587 unsigned long xoffs;
588 588
@@ -614,10 +614,10 @@ static int sm501fb_pan_pnl(struct fb_var_screeninfo *var,
614 struct sm501fb_info *fbi = par->info; 614 struct sm501fb_info *fbi = par->info;
615 unsigned long reg; 615 unsigned long reg;
616 616
617 reg = var->xoffset | (var->xres_virtual << 16); 617 reg = var->xoffset | (info->var.xres_virtual << 16);
618 smc501_writel(reg, fbi->regs + SM501_DC_PANEL_FB_WIDTH); 618 smc501_writel(reg, fbi->regs + SM501_DC_PANEL_FB_WIDTH);
619 619
620 reg = var->yoffset | (var->yres_virtual << 16); 620 reg = var->yoffset | (info->var.yres_virtual << 16);
621 smc501_writel(reg, fbi->regs + SM501_DC_PANEL_FB_HEIGHT); 621 smc501_writel(reg, fbi->regs + SM501_DC_PANEL_FB_HEIGHT);
622 622
623 sm501fb_sync_regs(fbi); 623 sm501fb_sync_regs(fbi);
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index c6c77562839..34cf019bba4 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -987,8 +987,8 @@ static int tridentfb_pan_display(struct fb_var_screeninfo *var,
987 unsigned int offset; 987 unsigned int offset;
988 988
989 debug("enter\n"); 989 debug("enter\n");
990 offset = (var->xoffset + (var->yoffset * var->xres_virtual)) 990 offset = (var->xoffset + (var->yoffset * info->var.xres_virtual))
991 * var->bits_per_pixel / 32; 991 * info->var.bits_per_pixel / 32;
992 set_screen_start(par, offset); 992 set_screen_start(par, offset);
993 debug("exit\n"); 993 debug("exit\n");
994 return 0; 994 return 0;
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c
index bc67251f1a2..bf2f78065cf 100644
--- a/drivers/video/vfb.c
+++ b/drivers/video/vfb.c
@@ -395,8 +395,8 @@ static int vfb_pan_display(struct fb_var_screeninfo *var,
395 || var->xoffset) 395 || var->xoffset)
396 return -EINVAL; 396 return -EINVAL;
397 } else { 397 } else {
398 if (var->xoffset + var->xres > info->var.xres_virtual || 398 if (var->xoffset + info->var.xres > info->var.xres_virtual ||
399 var->yoffset + var->yres > info->var.yres_virtual) 399 var->yoffset + info->var.yres > info->var.yres_virtual)
400 return -EINVAL; 400 return -EINVAL;
401 } 401 }
402 info->var.xoffset = var->xoffset; 402 info->var.xoffset = var->xoffset;
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c
index 305c975b178..0267acd8dc8 100644
--- a/drivers/video/vga16fb.c
+++ b/drivers/video/vga16fb.c
@@ -207,7 +207,7 @@ static void vga16fb_pan_var(struct fb_info *info,
207 * granularity if someone supports xoffset in bit resolution */ 207 * granularity if someone supports xoffset in bit resolution */
208 vga_io_r(VGA_IS1_RC); /* reset flip-flop */ 208 vga_io_r(VGA_IS1_RC); /* reset flip-flop */
209 vga_io_w(VGA_ATT_IW, VGA_ATC_PEL); 209 vga_io_w(VGA_ATT_IW, VGA_ATC_PEL);
210 if (var->bits_per_pixel == 8) 210 if (info->var.bits_per_pixel == 8)
211 vga_io_w(VGA_ATT_IW, (xoffset & 3) << 1); 211 vga_io_w(VGA_ATT_IW, (xoffset & 3) << 1);
212 else 212 else
213 vga_io_w(VGA_ATT_IW, xoffset & 7); 213 vga_io_w(VGA_ATT_IW, xoffset & 7);
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c
index 0e120d67eb6..c13c246be9a 100644
--- a/drivers/video/vt8500lcdfb.c
+++ b/drivers/video/vt8500lcdfb.c
@@ -210,8 +210,8 @@ static int vt8500lcd_pan_display(struct fb_var_screeninfo *var,
210 struct vt8500lcd_info *fbi = to_vt8500lcd_info(info); 210 struct vt8500lcd_info *fbi = to_vt8500lcd_info(info);
211 211
212 writel((1 << 31) 212 writel((1 << 31)
213 | (((var->xres_virtual - var->xres) * pixlen / 4) << 20) 213 | (((info->var.xres_virtual - info->var.xres) * pixlen / 4) << 20)
214 | (off >> 2), fbi->regbase + 0x20); 214 | (off >> 2), fbi->regbase + 0x20);
215 return 0; 215 return 0;
216} 216}
217 217
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
index f9b3e3dc242..4e74d262cf3 100644
--- a/drivers/video/vt8623fb.c
+++ b/drivers/video/vt8623fb.c
@@ -620,13 +620,14 @@ static int vt8623fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *i
620 unsigned int offset; 620 unsigned int offset;
621 621
622 /* Calculate the offset */ 622 /* Calculate the offset */
623 if (var->bits_per_pixel == 0) { 623 if (info->var.bits_per_pixel == 0) {
624 offset = (var->yoffset / 16) * var->xres_virtual + var->xoffset; 624 offset = (var->yoffset / 16) * info->var.xres_virtual
625 + var->xoffset;
625 offset = offset >> 3; 626 offset = offset >> 3;
626 } else { 627 } else {
627 offset = (var->yoffset * info->fix.line_length) + 628 offset = (var->yoffset * info->fix.line_length) +
628 (var->xoffset * var->bits_per_pixel / 8); 629 (var->xoffset * info->var.bits_per_pixel / 8);
629 offset = offset >> ((var->bits_per_pixel == 4) ? 2 : 1); 630 offset = offset >> ((info->var.bits_per_pixel == 4) ? 2 : 1);
630 } 631 }
631 632
632 /* Set the offset */ 633 /* Set the offset */