linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] atmel_lcdfb: Disallow to set larger resolution than framebuffer memory can handle
@ 2008-09-03 13:37 Stanislaw Gruszka
  2008-09-03 18:59 ` Krzysztof Helt
  2008-09-05  7:25 ` Nicolas Ferre
  0 siblings, 2 replies; 4+ messages in thread
From: Stanislaw Gruszka @ 2008-09-03 13:37 UTC (permalink / raw)
  To: linux-fbdev-devel

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/video/atmel_lcdfb.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 3376f35..5d6cf33 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -342,6 +342,13 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
 	var->transp.offset = var->transp.length = 0;
 	var->xoffset = var->yoffset = 0;
 
+	if (info->fix.smem_len) {
+		unsigned int smem_len = (var->xres_virtual * var->yres_virtual
+					 * ((var->bits_per_pixel + 7) / 8));
+		if (smem_len > info->fix.smem_len)
+			return -EINVAL;
+	}
+
 	/* Saturate vertical and horizontal timings at maximum values */
 	var->vsync_len = min_t(u32, var->vsync_len,
 			(ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1);
-- 
1.5.2.5


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

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

* Re: [PATCH 2/2] atmel_lcdfb: Disallow to set larger resolution than framebuffer memory can handle
  2008-09-03 13:37 [PATCH 2/2] atmel_lcdfb: Disallow to set larger resolution than framebuffer memory can handle Stanislaw Gruszka
@ 2008-09-03 18:59 ` Krzysztof Helt
  2008-09-04  7:14   ` Stanislaw Gruszka
  2008-09-05  7:25 ` Nicolas Ferre
  1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Helt @ 2008-09-03 18:59 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-fbdev-devel

On Wed, 3 Sep 2008 15:37:40 +0200
Stanislaw Gruszka <stf_xl@wp.pl> wrote:

> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
> CC: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>  drivers/video/atmel_lcdfb.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index 3376f35..5d6cf33 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -342,6 +342,13 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
>  	var->transp.offset = var->transp.length = 0;
>  	var->xoffset = var->yoffset = 0;
>  
> +	if (info->fix.smem_len) {

Is it possible to have smem_len not set in the atmel_lcdfb?
Probably not as it is always set in the probe function.

Kind regards,
Krzysztof

> +		unsigned int smem_len = (var->xres_virtual * var->yres_virtual
> +					 * ((var->bits_per_pixel + 7) / 8));
> +		if (smem_len > info->fix.smem_len)
> +			return -EINVAL;
> +	}
> +
>  	/* Saturate vertical and horizontal timings at maximum values */
>  	var->vsync_len = min_t(u32, var->vsync_len,
>  			(ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1);
> -- 
> 1.5.2.5
> 
> 

----------------------------------------------------------------------
Teraz taniej na zagraniczne komorki!
Sprawdz >> http://link.interia.pl/f1ef7 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

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

* Re: [PATCH 2/2] atmel_lcdfb: Disallow to set larger resolution than framebuffer memory can handle
  2008-09-03 18:59 ` Krzysztof Helt
@ 2008-09-04  7:14   ` Stanislaw Gruszka
  0 siblings, 0 replies; 4+ messages in thread
From: Stanislaw Gruszka @ 2008-09-04  7:14 UTC (permalink / raw)
  To: Krzysztof Helt; +Cc: linux-fbdev-devel

Wednesday 03 September 2008 20:59:26 Krzysztof Helt napisał(a):
> On Wed, 3 Sep 2008 15:37:40 +0200
> Stanislaw Gruszka <stf_xl@wp.pl> wrote:
> 
> > Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
> > CC: Nicolas Ferre <nicolas.ferre@atmel.com>
> > ---
> >  drivers/video/atmel_lcdfb.c |    7 +++++++
> >  1 files changed, 7 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> > index 3376f35..5d6cf33 100644
> > --- a/drivers/video/atmel_lcdfb.c
> > +++ b/drivers/video/atmel_lcdfb.c
> > @@ -342,6 +342,13 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
> >  	var->transp.offset = var->transp.length = 0;
> >  	var->xoffset = var->yoffset = 0;
> >  
> > +	if (info->fix.smem_len) {
> 
> Is it possible to have smem_len not set in the atmel_lcdfb?
> Probably not as it is always set in the probe function.
fb_check_var() is called indirectly (via fb_find_mode() call) before smem_len
is setted in probe function. And in some cases we need to know resolution
to set up smem_len and allocate memory (egg and chicken problem). 
So such check is needed in atmel_lcdfb_check_var().

Cheers
Stanislaw Gruszka

> Kind regards,
> Krzysztof
> 
> > +		unsigned int smem_len = (var->xres_virtual * var->yres_virtual
> > +					 * ((var->bits_per_pixel + 7) / 8));
> > +		if (smem_len > info->fix.smem_len)
> > +			return -EINVAL;
> > +	}
> > +
> >  	/* Saturate vertical and horizontal timings at maximum values */
> >  	var->vsync_len = min_t(u32, var->vsync_len,
> >  			(ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1);
> > -- 
> > 1.5.2.5
> > 
> > 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Linux-fbdev-devel mailing list
Linux-fbdev-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

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

* Re: [PATCH 2/2] atmel_lcdfb: Disallow to set larger resolution than framebuffer memory can handle
  2008-09-03 13:37 [PATCH 2/2] atmel_lcdfb: Disallow to set larger resolution than framebuffer memory can handle Stanislaw Gruszka
  2008-09-03 18:59 ` Krzysztof Helt
@ 2008-09-05  7:25 ` Nicolas Ferre
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Ferre @ 2008-09-05  7:25 UTC (permalink / raw)
  To: Stanislaw Gruszka, Andrew Morton
  Cc: krzysztof.h1, linux-fbdev-devel, Haavard Skinnemoen

Stanislaw Gruszka :
> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
> CC: Nicolas Ferre <nicolas.ferre@atmel.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  drivers/video/atmel_lcdfb.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index 3376f35..5d6cf33 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -342,6 +342,13 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
>  	var->transp.offset = var->transp.length = 0;
>  	var->xoffset = var->yoffset = 0;
>  
> +	if (info->fix.smem_len) {
> +		unsigned int smem_len = (var->xres_virtual * var->yres_virtual
> +					 * ((var->bits_per_pixel + 7) / 8));
> +		if (smem_len > info->fix.smem_len)
> +			return -EINVAL;
> +	}
> +
>  	/* Saturate vertical and horizontal timings at maximum values */
>  	var->vsync_len = min_t(u32, var->vsync_len,
>  			(ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1);


-- 
Nicolas Ferre


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

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

end of thread, other threads:[~2008-09-05  7:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-03 13:37 [PATCH 2/2] atmel_lcdfb: Disallow to set larger resolution than framebuffer memory can handle Stanislaw Gruszka
2008-09-03 18:59 ` Krzysztof Helt
2008-09-04  7:14   ` Stanislaw Gruszka
2008-09-05  7:25 ` Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).