All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 15/29] mx3fb: use display information in info not in var for panning
@ 2011-05-25 22:58 Laurent Pinchart
  2011-06-10  9:01 ` [PATCH 15/29] mx3fb: use display information in info not in var Guennadi Liakhovetski
  2011-06-10 17:01 ` [PATCH 15/29] mx3fb: use display information in info not in var for panning Laurent Pinchart
  0 siblings, 2 replies; 3+ messages in thread
From: Laurent Pinchart @ 2011-05-25 22:58 UTC (permalink / raw)
  To: linux-fbdev

We must not use any information in the passed var besides xoffset,
yoffset and vmode as otherwise applications might abuse it. Also use the
aligned fix.line_length and not the (possible) unaligned xres_virtual.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/video/mx3fb.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index 7e3a490..759e244 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,
 	y_bottom = var->yoffset;
 
 	if (!(var->vmode & FB_VMODE_YWRAP))
-		y_bottom += var->yres;
+		y_bottom += fbi->var.yres;
 
 	if (y_bottom > fbi->var.yres_virtual)
 		return -EINVAL;
 
 	mutex_lock(&mx3_fbi->mutex);
 
-	offset = (var->yoffset * var->xres_virtual + var->xoffset) *
-		(var->bits_per_pixel / 8);
+	offset = var->yoffset * fbi->fix.line_length
+	       + var->xoffset * (var->bits_per_pixel / 8);
 	base = fbi->fix.smem_start + offset;
 
 	dev_dbg(fbi->device, "Updating SDC BG buf %d address=0x%08lX\n",
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 15/29] mx3fb: use display information in info not in var
  2011-05-25 22:58 [PATCH 15/29] mx3fb: use display information in info not in var for panning Laurent Pinchart
@ 2011-06-10  9:01 ` Guennadi Liakhovetski
  2011-06-10 17:01 ` [PATCH 15/29] mx3fb: use display information in info not in var for panning Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2011-06-10  9:01 UTC (permalink / raw)
  To: linux-fbdev

On Thu, 26 May 2011, Laurent Pinchart wrote:

> We must not use any information in the passed var besides xoffset,
> yoffset and vmode as otherwise applications might abuse it. Also use the
> aligned fix.line_length and not the (possible) unaligned xres_virtual.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>  drivers/video/mx3fb.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
> index 7e3a490..759e244 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,
>  	y_bottom = var->yoffset;
>  
>  	if (!(var->vmode & FB_VMODE_YWRAP))
> -		y_bottom += var->yres;
> +		y_bottom += fbi->var.yres;
>  
>  	if (y_bottom > fbi->var.yres_virtual)
>  		return -EINVAL;
>  
>  	mutex_lock(&mx3_fbi->mutex);
>  
> -	offset = (var->yoffset * var->xres_virtual + var->xoffset) *
> -		(var->bits_per_pixel / 8);
> +	offset = var->yoffset * fbi->fix.line_length
> +	       + var->xoffset * (var->bits_per_pixel / 8);

Didn't you mean

+	       + var->xoffset * (fbi->var.bits_per_pixel / 8);

With this fix:

Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

(tested using http://git.ideasonboard.org/?pûdev-test.git;a=summary)

Thanks
Guennadi

>  	base = fbi->fix.smem_start + offset;
>  
>  	dev_dbg(fbi->device, "Updating SDC BG buf %d address=0x%08lX\n",
> -- 
> 1.7.3.4
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 15/29] mx3fb: use display information in info not in var for panning
  2011-05-25 22:58 [PATCH 15/29] mx3fb: use display information in info not in var for panning Laurent Pinchart
  2011-06-10  9:01 ` [PATCH 15/29] mx3fb: use display information in info not in var Guennadi Liakhovetski
@ 2011-06-10 17:01 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2011-06-10 17:01 UTC (permalink / raw)
  To: linux-fbdev

Hi Guennadi,

On Friday 10 June 2011 11:01:46 Guennadi Liakhovetski wrote:
> On Thu, 26 May 2011, Laurent Pinchart wrote:
> > We must not use any information in the passed var besides xoffset,
> > yoffset and vmode as otherwise applications might abuse it. Also use the
> > aligned fix.line_length and not the (possible) unaligned xres_virtual.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > ---
> > 
> >  drivers/video/mx3fb.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
> > index 7e3a490..759e244 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,
> > 
> >  	y_bottom = var->yoffset;
> >  	
> >  	if (!(var->vmode & FB_VMODE_YWRAP))
> > 
> > -		y_bottom += var->yres;
> > +		y_bottom += fbi->var.yres;
> > 
> >  	if (y_bottom > fbi->var.yres_virtual)
> >  	
> >  		return -EINVAL;
> >  	
> >  	mutex_lock(&mx3_fbi->mutex);
> > 
> > -	offset = (var->yoffset * var->xres_virtual + var->xoffset) *
> > -		(var->bits_per_pixel / 8);
> > +	offset = var->yoffset * fbi->fix.line_length
> > +	       + var->xoffset * (var->bits_per_pixel / 8);
> 
> Didn't you mean
> 
> +	       + var->xoffset * (fbi->var.bits_per_pixel / 8);

Yes, my bad. Thank you.

> With this fix:
> 
> Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> 
> (tested using http://git.ideasonboard.org/?pûdev-test.git;a=summary)

Thanks.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-10 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25 22:58 [PATCH 15/29] mx3fb: use display information in info not in var for panning Laurent Pinchart
2011-06-10  9:01 ` [PATCH 15/29] mx3fb: use display information in info not in var Guennadi Liakhovetski
2011-06-10 17:01 ` [PATCH 15/29] mx3fb: use display information in info not in var for panning Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.