s3c2410fb_map_video_memory


 

s3c2410fb_map_video_memory

/*

 * s3c2410fb_map_video_memory():

 *  Allocates the DRAM memory for the frame buffer.  This buffer is

 *  remapped into a non-cached, non-buffered, memory region to

 *  allow palette and pixel writes to occur without flushing the

 *  cache.  Once this area is remapped, all virtual memory

 *  access to the video memory should occur at the new region.

 */

static int __init s3c2410fb_map_video_memory(struct s3c2410fb_info *fbi)

{

    dprintk("map_video_memory(fbi=%p)\n", fbi);

    fbi->map_size = PAGE_ALIGN(fbi->fb->fix.smem_len + PAGE_SIZE); /*分配总数对齐*/

    fbi->map_cpu  = dma_alloc_writecombine(fbi->dev, fbi->map_size,

                          &fbi->map_dma, GFP_KERNEL);  /*分配DMA地址*/

    fbi->map_size = fbi->fb->fix.smem_len;

    if (fbi->map_cpu) {

        /* prevent initial garbage on screen */

        dprintk("map_video_memory: clear %p:%08x\n",

            fbi->map_cpu, fbi->map_size);

        memset(fbi->map_cpu, 0xf0, fbi->map_size);

        fbi->screen_dma    = fbi->map_dma;

        fbi->fb->screen_base   = fbi->map_cpu;

        fbi->fb->fix.smem_start  = fbi->screen_dma;

        dprintk("map_video_memory: dma=%08x cpu=%p size=%08x\n",

            fbi->map_dma, fbi->map_cpu, fbi->fb->fix.smem_len);

    }

     return fbi->map_cpu ? 0 : -ENOMEM;

}

这个函数分配完frame buffer地址后,设置好相关参数就返回了.



 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

 
 
 
 
 
 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值