关于linux/android 下LCD /camera等DMA内存的预留和申请——和wince 的方式换汤不换药啊

 
//#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMC0 (6144 * SZ_1K)
#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMC0 (24576 * SZ_1K)
//#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMC1 (9900 * SZ_1K)
#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMC1 (24576 * SZ_1K)
//#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMC2 (6144 * SZ_1K)
#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMC2 (24576 * SZ_1K)
#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_MFC0 (36864 * SZ_1K)
#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_MFC1 (36864 * SZ_1K)
#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMD (S5PV210_LCD_WIDTH * \
          S5PV210_LCD_HEIGHT * 4 * \
          CONFIG_FB_S3C_NR_BUFFERS)
          
#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_JPEG (40960 * SZ_1K) 
/* 1920 * 1080 * 4 (RGBA)
 * - framesize == 1080p : 1920 * 1080 * 2(16bpp) * 2(double buffer) = 8MB
 * - framesize <  1080p : 1080 *  720 * 4(32bpp) * 2(double buffer) = under 8MB
 **/
#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_G2D (8192 * SZ_1K)
#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_TEXSTREAM (3000 * SZ_1K)
//#define  S5PV210_ANDROID_PMEM_MEMSIZE_PMEM_GPU1 (3300 * SZ_1K)
#define  S5PV210_ANDROID_PMEM_MEMSIZE_PMEM_GPU1 (4096 * SZ_1K)
static struct s5p_media_device smdkc110_media_devs[] = {
 [0] = {
  .id = S5P_MDEV_MFC,
  .name = "mfc",
  .bank = 0,
  .memsize = S5PV210_VIDEO_SAMSUNG_MEMSIZE_MFC0,
  .paddr = 0,
 },
 [1] = {
  .id = S5P_MDEV_MFC,
  .name = "mfc",
  .bank = 1,
  .memsize = S5PV210_VIDEO_SAMSUNG_MEMSIZE_MFC1,
  .paddr = 0,
 },
 [2] = {
  .id = S5P_MDEV_FIMC0,
  .name = "fimc0",
  .bank = 1,
  .memsize = S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMC0,
  .paddr = 0,
 },
 [3] = {
  .id = S5P_MDEV_FIMC1,
  .name = "fimc1",
  .bank = 1,
  .memsize = S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMC1,
  .paddr = 0,
 },
 [4] = {
  .id = S5P_MDEV_FIMC2,
  .name = "fimc2",
  .bank = 1,
  .memsize = S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMC2,
  .paddr = 0,
 },
 [5] = {
  .id = S5P_MDEV_JPEG,
  .name = "jpeg",
  .bank = 0,
  .memsize = S5PV210_VIDEO_SAMSUNG_MEMSIZE_JPEG,
  .paddr = 0,
 },
 [6] = {
  .id = S5P_MDEV_FIMD,
  .name = "fimd",
  .bank = 1,
  .memsize = S5PV210_VIDEO_SAMSUNG_MEMSIZE_FIMD,
  .paddr = 0,
 },
 [7] = {
  .id = S5P_MDEV_TEXSTREAM,
  .name = "texstream",
  .bank = 1,
  .memsize = S5PV210_VIDEO_SAMSUNG_MEMSIZE_TEXSTREAM,
  .paddr = 0,
 },
 [8] = {
  .id = S5P_MDEV_PMEM_GPU1,
  .name = "pmem_gpu1",
  .bank = 0, /* OneDRAM */
  .memsize = S5PV210_ANDROID_PMEM_MEMSIZE_PMEM_GPU1,
  .paddr = 0,
 },
 [9] = {
  .id = S5P_MDEV_G2D,
  .name = "g2d",
  .bank = 0,
  .memsize = S5PV210_VIDEO_SAMSUNG_MEMSIZE_G2D,
  .paddr = 0,
 },
};
 
arch/arm/plat-s5p/bootmem.c:void s5p_reserve_bootmem(struct s5p_media_device *mdevs, int nr_mdevs)
void s5p_reserve_bootmem(struct s5p_media_device *mdevs, int nr_mdevs)
{
        struct s5p_media_device *mdev;
        void *virt_mem;
        int i;

        media_devs = mdevs;
        nr_media_devs = nr_mdevs;

        for (i = 0; i < nr_media_devs; i++) {
                mdev = &media_devs[i];
                if (mdev->memsize <= 0)
                        continue;

                if (mdev->paddr)
                        virt_mem = __alloc_bootmem(mdev->memsize, PAGE_SIZE,
                                        mdev->paddr);
                else
                        virt_mem = __alloc_bootmem(mdev->memsize, PAGE_SIZE,
                                        meminfo.bank[mdev->bank].start);

                if (virt_mem != NULL) {
                        mdev->paddr = virt_to_phys(virt_mem);
                } else {
                        mdev->paddr = (dma_addr_t)NULL;
                        printk(KERN_INFO "s5p: Failed to reserve system memory\n");
                }

}

在mach-smdkc110.c 里面初始化的时候,就预留DMA,这样其他的程序就不能用这部分内存了。

这个和wince不同,wince,一般用config.bib 来划分DMA,属于静态分配,linux和android 下类似动态分配的方法了,不过还是一直没有释放这部分DMA,也属于静态分配的类型。

继续往下看。


 


   

你可能感兴趣的:(android,struct,video,mfc,buffer,WinCE)