From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stanislaw Gruszka Subject: Re: [RFC] double buffering for atmel_lcdfb Date: Wed, 6 Aug 2008 15:53:03 +0200 Message-ID: <200808061553.03706.stf_xl@wp.pl> References: <200808061136.16783.stf_xl@wp.pl> <20080806141305.49e883a2@hskinnemo-gx745.norway.atmel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1816464361==" Return-path: Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92] helo=mail.sourceforge.net) by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43) id 1KQjS2-0004HZ-Bx for linux-fbdev-devel@lists.sourceforge.net; Wed, 06 Aug 2008 06:53:18 -0700 Received: from mx1.wp.pl ([212.77.101.5]) by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.44) id 1KQjS1-00073U-Gv for linux-fbdev-devel@lists.sourceforge.net; Wed, 06 Aug 2008 06:53:18 -0700 In-Reply-To: <20080806141305.49e883a2@hskinnemo-gx745.norway.atmel.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-fbdev-devel-bounces@lists.sourceforge.net Errors-To: linux-fbdev-devel-bounces@lists.sourceforge.net To: Haavard Skinnemoen Cc: linux-fbdev-devel@lists.sourceforge.net --===============1816464361== Content-Type: multipart/alternative; boundary="Boundary-01=_/yamIhQEB0tODqx" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_/yamIhQEB0tODqx Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Wednesday 06 August 2008 14:13:05 Haavard Skinnemoen napisa=C5=82(a): > Stanislaw Gruszka wrote: > > Below is patch I have already done. I also attached program which I used > > for for tests - as far result are quite nice. > > I sent this patch a while ago, but I forgot to send Nicolas a test > program when he asked for it :-( > > Could you give it a try? If it works for you, I think we can conclude > that y-panning indeed works on AT91 so the patch can be applied. Yes, it works with my program with ypanstep =3D=3D yres (I did not check wi= th ypanstep =3D=3D 1 yet),=20 > Haavard > > From c1dc155e3c1a828faa4379a1f6f6de0bb58385cc Mon Sep 17 00:00:00 2001 > From: Haavard Skinnemoen > Date: Sat, 23 Jun 2007 17:38:26 +0200 > Subject: [PATCH] atmel_lcdfb: Set ypanstep to 1 and enable y-panning on > AT91 > > Panning in the y-direction can be done by simply changing the DMA base > address. This code is already in place, but FBIOPAN_DISPLAY will > currently fail because ypanstep is 0. > > Set ypanstep to 1 to indicate that we do support y-panning and also > set the necessary acceleration flags on AT91 (AVR32 already have > them.) > > Signed-off-by: Haavard Skinnemoen > --- > drivers/video/atmel_lcdfb.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c > index b004036..c0a0364 100644 > --- a/drivers/video/atmel_lcdfb.c > +++ b/drivers/video/atmel_lcdfb.c > @@ -39,7 +39,9 @@ > #endif > > #if defined(CONFIG_ARCH_AT91) > -#define ATMEL_LCDFB_FBINFO_DEFAULT FBINFO_DEFAULT > +#define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \ > + | FBINFO_PARTIAL_PAN_OK \ > + | FBINFO_HWACCEL_YPAN) > > static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info > *sinfo, struct fb_var_screeninfo *var) > @@ -177,7 +179,7 @@ static struct fb_fix_screeninfo atmel_lcdfb_fix > __initdata =3D { .type =3D FB_TYPE_PACKED_PIXELS, > .visual =3D FB_VISUAL_TRUECOLOR, > .xpanstep =3D 0, > - .ypanstep =3D 0, > + .ypanstep =3D 1, > .ywrapstep =3D 0, > .accel =3D FB_ACCEL_NONE, > }; I think some video memory allocation control is also needed for users which= =20 want to have frame buffer in main memory (this is a must with bigger LCDs) Currently I just increase smem_len just before dma_alloc_writecombine() is = called. =20 @@ -241,7 +243,7 @@ static int atmel_lcdfb_alloc_video_memory(struct atmel_= lcdfb_info *sinfo) struct fb_info *info =3D sinfo->info; struct fb_var_screeninfo *var =3D &info->var; =2D info->fix.smem_len =3D (var->xres_virtual * var->yres_virtual + info->fix.smem_len =3D (var->xres_virtual * var->yres_virtual * 2 * ((var->bits_per_pixel + 7) / 8)); info->screen_base =3D dma_alloc_writecombine(info->device,=20 Ok I know that I could just add memory resource to at91_lcdc_device, but main RAM memory is managed by linux and need to be somehow allocated. So maybe worth to add smem_len hint in at91_lcdc_device like this: =2D-- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c @@ -240,9 +242,11 @@ static int atmel_lcdfb_alloc_video_memory(struct atmel= _lcdfb_info *sinfo) { struct fb_info *info =3D sinfo->info; struct fb_var_screeninfo *var =3D &info->var; =2D =2D info->fix.smem_len =3D (var->xres_virtual * var->yres_virtual + unsigned int smem_len; + + smem_len =3D (var->xres_virtual * var->yres_virtual * ((var->bits_per_pixel + 7) / 8)); + info->fix.smem_len =3D max(smem_len, sinfo->smem_len); info->screen_base =3D dma_alloc_writecombine(info->device, info->fi= x.smem_len, (dma_addr_t *)&info->fix.smem_start= , GFP_KERNEL); diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h index ed64862..7f3ff79 100644 =2D-- a/include/video/atmel_lcdc.h +++ b/include/video/atmel_lcdc.h @@ -37,6 +37,7 @@ struct atmel_lcdfb_info { struct fb_info *info; void __iomem *mmio; unsigned long irq_base; + unsigned int smem_len; unsigned int guard_time; struct platform_device *pdev; Regards Stanislaw Gruszka --Boundary-01=_/yamIhQEB0tODqx Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

Wednesday 06 August 2008 14:13:05 Haavard Skinnemoen napisa=C5=82(a):

> Stanislaw Gruszka <stf_xl@wp.pl> wrote:

> > Below is patch I have already done. I also attached program wh= ich I used

> > for for tests - as far result are quite nice.

>

> I sent this patch a while ago, but I forgot to send Nicolas a test<= /p>

> program when he asked for it :-(

>

> Could you give it a try? If it works for you, I think we can conclu= de

> that y-panning indeed works on AT91 so the patch can be applied.

Yes, it works with my program with ypanstep =3D=3D yres (I did not check= with ypanstep =3D=3D 1 yet),

> Haavard

>

> From c1dc155e3c1a828faa4379a1f6f6de0bb58385cc Mon Sep 17 00:00:00 2= 001

> From: Haavard Skinnemoen <hskinnemoen@atmel.com>

> Date: Sat, 23 Jun 2007 17:38:26 +0200

> Subject: [PATCH] atmel_lcdfb: Set ypanstep to 1 and enable y-pannin= g on

> AT91

>

> Panning in the y-direction can be done by simply changing the DMA b= ase

> address. This code is already in place, but FBIOPAN_DISPLAY will

> currently fail because ypanstep is 0.

>

> Set ypanstep to 1 to indicate that we do support y-panning and also=

> set the necessary acceleration flags on AT91 (AVR32 already have

> them.)

>

> Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>

> ---

> drivers/video/atmel_lcdfb.c | 6 ++++--

> 1 files changed, 4 insertions(+), 2 deletions(-)

>

> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdf= b.c

> index b004036..c0a0364 100644

> --- a/drivers/video/atmel_lcdfb.c

> +++ b/drivers/video/atmel_lcdfb.c

> @@ -39,7 +39,9 @@

> #endif

>

> #if defined(CONFIG_ARCH_AT91)

> -#define ATMEL_LCDFB_FBINFO_DEFAULT FBINFO_DEFAULT

> +#define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \

> + | FBINFO_PARTIAL_PAN_OK \

> + | FBINFO_HWACCEL_YPAN)

>

> static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_inf= o

> *sinfo, struct fb_var_screeninfo *var)

> @@ -177,7 +179,7 @@ static struct fb_fix_screeninfo atmel_lcdfb_fix=

> __initdata =3D { .type =3D FB_TYPE_PACKED_PIXELS,

> .visual =3D FB_VISUAL_TRUECOLOR,

> .xpanstep =3D 0,

> - .ypanstep =3D 0,

> + .ypanstep =3D 1,

> .ywrapstep =3D 0,

> .accel =3D FB_ACCEL_NONE,

> };

I think some video memory allocation control is also needed for users wh= ich

want to have frame buffer in main memory (this is a must with bigger LCD= s)

Currently I just increase smem_len just before dma_alloc_writecombine() = is called.

@@ -241,7 +243,7 @@ static int atmel_lcdfb_alloc_video_memory(struct atm= el_lcdfb_info *sinfo)

struct fb_info *info =3D sinfo->info;

struct fb_var_screeninfo *var =3D &info->var;

- info->fix.smem_len =3D (var->xres_virtual * var->yres_v= irtual

+ info->fix.smem_len =3D (var->xres_virtual * var->yres_v= irtual * 2

* ((var->bits_per_pixel + 7) / 8));

info->screen_base =3D dma_alloc_writecombine(info->device,=

Ok I know that I could just add memory resource to at91_lcdc_device, but=

main RAM memory is managed by linux and need to be somehow allocated.

So maybe worth to add smem_len hint in at91_lcdc_device like this:

--- a/drivers/video/atmel_lcdfb.c

+++ b/drivers/video/atmel_lcdfb.c

@@ -240,9 +242,11 @@ static int atmel_lcdfb_alloc_video_memory(struct at= mel_lcdfb_info *sinfo)

{

struct fb_info *info =3D sinfo->info;

struct fb_var_screeninfo *var =3D &info->var;

-

- info->fix.smem_len =3D (var->xres_virtual * var->yres_v= irtual

+ unsigned int smem_len;

+

+ smem_len =3D (var->xres_virtual * var->yres_virtual

* ((var->bits_per_pixel + 7) / 8));

+ info->fix.smem_len =3D max(smem_len, sinfo->smem_len);

info->screen_base =3D dma_alloc_writecombine(info->device,= info->fix.smem_len,

(dma_addr_t *)&info->fix.= smem_start, GFP_KERNEL);

diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h

index ed64862..7f3ff79 100644

--- a/include/video/atmel_lcdc.h

+++ b/include/video/atmel_lcdc.h

@@ -37,6 +37,7 @@ struct atmel_lcdfb_info {

struct fb_info *info;

void __iomem *mmio;

unsigned long irq_base;

+ unsigned int smem_len;

unsigned int guard_time;

struct platform_device *pdev;

Regards

Stanislaw Gruszka

--Boundary-01=_/yamIhQEB0tODqx-- --===============1816464361== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- 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=/ --===============1816464361== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Linux-fbdev-devel mailing list Linux-fbdev-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel --===============1816464361==--