# Re: \[RFC 2.6.26-rc9 3/5\] pxafb: add shared framebuffer interface

- From: Krzysztof Helt \<hidden\>
- Date: 2008-07-31 15:23:37 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2008/07/13458562
- Thread: https://ratatoskr.run/linux-fbdev/2008/07/13458545/t.md

```text
On Wed, 30 Jul 2008 08:51:07 -0400
Jaya Kumar [ref] wrote:

> These changes are to make it possible for a secondary driver to share the
> pxafb framebuffer. The changes include:
> - adding extra_video_mem entry so that a driver can tell pxafb of its
>   additional needs.
> - adding share_video_mem/unshare_video_mem callbacks to notify the secondary
>   driver of the framebuffer address, to allow refcounting, and to cleanup on
>   completion.
> 
> Signed-off-by: Jaya Kumar <redacted>
> ---
> diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
> index bb25143..f799c52 100644
> --- a/drivers/video/pxafb.c
> +++ b/drivers/video/pxafb.c
> @@ -57,6 +57,8 @@
>   */
>  #define DEBUG_VAR 1
>  
> +static struct platform_driver pxafb_driver;
> +

Not needed - see below

(...)

> -static int __devinit pxafb_map_video_memory(struct pxafb_info *fbi)
> +static int __devinit pxafb_map_video_memory(struct pxafb_info *fbi,
> +						struct pxafb_mach_info *inf)
>  {
> +	int ret;
>  	/*
>  	 * We reserve one page for the palette, plus the size
>  	 * of the framebuffer.
>  	 */
>  	fbi->video_offset = PAGE_ALIGN(sizeof(struct pxafb_dma_buff));
> -	fbi->map_size = PAGE_ALIGN(fbi->fb.fix.smem_len + fbi->video_offset);
> +	fbi->map_size = PAGE_ALIGN(fbi->fb.fix.smem_len + fbi->video_offset +
> +					inf->extra_video_mem);
>  	fbi->map_cpu = dma_alloc_writecombine(fbi->dev, fbi->map_size,
>  					      &fbi->map_dma, GFP_KERNEL);
>  
> @@ -1340,6 +1346,13 @@ static int __devinit pxafb_map_video_memory(struct pxafb_info *fbi)
>  		fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff;
>  		fbi->n_smart_cmds = 0;
>  #endif
> +		if (inf->share_video_mem) {
> +			ret = inf->share_video_mem(fbi->fb.screen_base,
> +				fbi->screen_dma, pxafb_driver.driver.owner,

You should use here either THIS_MODULE or runtime information
from fbi->fb.device.driver.owner.

> +				inf->extra_data);
> +			if (ret)
> +				return ret;
> +		}
>  	}
>  

The rest of the patch is ok.

Regards,
Krzysztof


----------------------------------------------------------------------
Partyjka w Chinczyka?
Graj >>> http://link.interia.pl/f1e67


-------------------------------------------------------------------------
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=/
```
