aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/atmel_lcdfb.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-05-25 05:34:52 -0400
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-08-19 04:30:02 -0400
commitb3e9c12949c1e66f3190e430ad096e53df4e1328 (patch)
tree6b60c23b431c02e055a17cf7323ccb79a89eed64 /drivers/video/atmel_lcdfb.c
parenta35a9b79dd44b36b688c493610dfbbdb42aff136 (diff)
atmel_lcdfb: use display information in info not in var for panning
We must not use any information in the passed var besides xoffset, yoffset and vmode as otherwise applications might abuse it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/video/atmel_lcdfb.c')
-rw-r--r--drivers/video/atmel_lcdfb.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 817ab60f7537..244d55b7c0ae 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)