aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSven Neumann <s.neumann@raumfeld.com>2009-10-22 02:34:34 -0400
committerEric Miao <eric.y.miao@gmail.com>2009-11-30 20:02:29 -0500
commit448ac479768d6c242338ecf13569dc297f8908ce (patch)
treef5c435e8af9c429fb023c7467fb8238a1fcc31c3 /drivers
parent7f49a7f7011f3a59b51dd6003714d7aed72d7718 (diff)
pxafb: use passed fb_var_screeninfo struct in pxafb_pan_display()
pxafb_pan_display() used to ignore the fb_var_screeninfo parameter. Now pass it to setup_base_frame() instead of pulling default values out of fb_info. And the original patch has an issue of pxafb_pan_display() paying only attention to the 'var' parameter passed in, and Ville Syrjälä pointed out, this is potentially dangerous as user could pass in any other screeninfo parameters as well, and not only such that are relevant for display panning. This is fixed by limiting the arguments actually used to .xoffset, .yoffset and .vmode & FB_VMODE_YWRAP. Signed-off-by: Sven Neumann <s.neumann@raumfeld.com> Cc: Ville Syrjälä <syrjala@sci.fi> Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/pxafb.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 1820c4a24434..33a6aacfcbe3 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -80,7 +80,8 @@
80static int pxafb_activate_var(struct fb_var_screeninfo *var, 80static int pxafb_activate_var(struct fb_var_screeninfo *var,
81 struct pxafb_info *); 81 struct pxafb_info *);
82static void set_ctrlr_state(struct pxafb_info *fbi, u_int state); 82static void set_ctrlr_state(struct pxafb_info *fbi, u_int state);
83static void setup_base_frame(struct pxafb_info *fbi, int branch); 83static void setup_base_frame(struct pxafb_info *fbi,
84 struct fb_var_screeninfo *var, int branch);
84static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal, 85static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal,
85 unsigned long offset, size_t size); 86 unsigned long offset, size_t size);
86 87
@@ -531,12 +532,22 @@ static int pxafb_pan_display(struct fb_var_screeninfo *var,
531 struct fb_info *info) 532 struct fb_info *info)
532{ 533{
533 struct pxafb_info *fbi = (struct pxafb_info *)info; 534 struct pxafb_info *fbi = (struct pxafb_info *)info;
535 struct fb_var_screeninfo newvar;
534 int dma = DMA_MAX + DMA_BASE; 536 int dma = DMA_MAX + DMA_BASE;
535 537
536 if (fbi->state != C_ENABLE) 538 if (fbi->state != C_ENABLE)
537 return 0; 539 return 0;
538 540
539 setup_base_frame(fbi, 1); 541 /* Only take .xoffset, .yoffset and .vmode & FB_VMODE_YWRAP from what
542 * was passed in and copy the rest from the old screeninfo.
543 */
544 memcpy(&newvar, &fbi->fb.var, sizeof(newvar));
545 newvar.xoffset = var->xoffset;
546 newvar.yoffset = var->yoffset;
547 newvar.vmode &= ~FB_VMODE_YWRAP;
548 newvar.vmode |= var->vmode & FB_VMODE_YWRAP;
549
550 setup_base_frame(fbi, &newvar, 1);
540 551
541 if (fbi->lccr0 & LCCR0_SDS) 552 if (fbi->lccr0 & LCCR0_SDS)
542 lcd_writel(fbi, FBR1, fbi->fdadr[dma + 1] | 0x1); 553 lcd_writel(fbi, FBR1, fbi->fdadr[dma + 1] | 0x1);
@@ -1052,9 +1063,10 @@ static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal,
1052 return 0; 1063 return 0;
1053} 1064}
1054 1065
1055static void setup_base_frame(struct pxafb_info *fbi, int branch) 1066static void setup_base_frame(struct pxafb_info *fbi,
1067 struct fb_var_screeninfo *var,
1068 int branch)
1056{ 1069{
1057 struct fb_var_screeninfo *var = &fbi->fb.var;
1058 struct fb_fix_screeninfo *fix = &fbi->fb.fix; 1070 struct fb_fix_screeninfo *fix = &fbi->fb.fix;
1059 int nbytes, dma, pal, bpp = var->bits_per_pixel; 1071 int nbytes, dma, pal, bpp = var->bits_per_pixel;
1060 unsigned long offset; 1072 unsigned long offset;
@@ -1332,7 +1344,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,
1332#endif 1344#endif
1333 setup_parallel_timing(fbi, var); 1345 setup_parallel_timing(fbi, var);
1334 1346
1335 setup_base_frame(fbi, 0); 1347 setup_base_frame(fbi, var, 0);
1336 1348
1337 fbi->reg_lccr0 = fbi->lccr0 | 1349 fbi->reg_lccr0 = fbi->lccr0 |
1338 (LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM | 1350 (LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM |