コード例 #1
0
ファイル: subfq.c プロジェクト: mali1/NST-kernel
static int omap3epfb_alloc_buffer(struct fb_info *info,
				struct omap3epfb_buffer *buf, size_t size,
				unsigned int offset_lines)
{
	int stat;
	void __iomem *virt;
	struct omap3epfb_par *par = info->par;
	long lines = par->mode.pxres * offset_lines / 4;
	unsigned long off = PAGE_ALIGN(lines);

	stat = omap_vram_alloc(OMAPFB_MEMTYPE_SDRAM, size + off,  &buf->phys_aligned);
	if(stat) {
		dev_err(info->device, "Failed to allocate memory (phys): %d\n", stat);
		return -ENOMEM;
	}

	buf->phys = buf->phys_aligned + off;
	buf->phys_lines = buf->phys - lines;

	virt = ioremap_wc(buf->phys, size);
	if (!virt) {
		dev_err(info->device, "Failed to allocate memory (virt)\n");
		omap_vram_free(buf->phys_aligned, size);
		return -ENOMEM;
	}

	buf->virt = virt;
	buf->size = size;

	dev_dbg(info->device, "allocated %Zd bytes @%08lx / @%08lx (phys)\n",
			size, (unsigned long)buf->virt,
			(unsigned long)buf->phys);

	return 0;
}
コード例 #2
0
ファイル: subfq.c プロジェクト: mali1/NST-kernel
/* ------------------------------------------------------------------------- */
static int omap3epfb_alloc_shmem(struct fb_info *info,
				 struct omap3epfb_sharedbuf *buf)
{
	int size = PAGE_ALIGN(OMAP3EPFB_SHARED_MEM_SIZE);
	int stat;

	BUG_ON(sizeof(dma_addr_t) != sizeof(uint32_t));

	stat = omap_vram_alloc(OMAPFB_MEMTYPE_SDRAM,
			       OMAP3EPFB_SHARED_MEM_SIZE, &buf->phys);

	if(stat) {
		dev_err(info->device, "Failed to allocate shared memory (phys): %d\n", stat);
		return -ENOMEM;
	}

	buf->p =(omap3epqe_rdwr_un *)ioremap_wc(buf->phys, size);

	if (!buf->p) {
		dev_err(info->device, "Failed to allocate shared memory (virt)\n");
		omap_vram_free(buf->phys, size);
		return -ENOMEM;
	}

	buf->size = size;

	dev_dbg(info->device, "allocated %Zd bytes @%08lx / @%08lx (phys)\n",
			size, (unsigned long)buf->p,
			(unsigned long)buf->phys);
			
	memset(buf->p, 0, OMAP3EPFB_SHARED_MEM_SIZE);

	return 0;
}
コード例 #3
0
ファイル: subfq.c プロジェクト: mali1/NST-kernel
static void omap3epfb_free_shmem(struct fb_info *info,
				struct omap3epfb_sharedbuf *buf)
{
	iounmap(buf->p);
	if(omap_vram_free(buf->phys, buf->size)) {
		dev_err(info->device, "VRAM FREE failed!\n");
	}
}
コード例 #4
0
ファイル: subfq.c プロジェクト: mali1/NST-kernel
static void omap3epfb_free_buffer(struct fb_info *info,
				struct omap3epfb_buffer *buf,
				unsigned int offset_lines)
{
	struct omap3epfb_par *par = info->par;
	long lines = par->mode.pxres * offset_lines / 4;
	unsigned long off = PAGE_ALIGN(lines);

	iounmap(buf->virt);
	if(omap_vram_free(buf->phys_aligned, buf->size + off)) {
		dev_err(info->device, "VRAM FREE failed!\n");
	}
}
コード例 #5
0
static struct InterleaveBuffer* allocInterleaveBufferAt(int at, int size, u32 paddr)
{
	struct InterleaveBuffer *IB = &(interleave_buffers[at]);
	int r;
	if ( IB->buffer!=NULL )
	{
		if ( IB->size==size )
		{
			printk("S3D : size same re-use interlave buffer\n");
			IB->fbbuffer_paddr = paddr;
			return IB;
		}
//		kfree(IB->buffer);
		omap_vram_free(IB->paddr, IB->size);
		IB->buffer = NULL;
	}
//	IB->buffer = kmalloc(size, GFP_DMA | __GFP_COLD);
	r = omap_vram_alloc(OMAP_VRAM_MEMTYPE_SDRAM, size, &IB->paddr);
//	if ( IB->buffer!=NULL )
	if ( !r )
	{
//		IB->paddr = virt_to_bus(IB->buffer);
		IB->buffer = ioremap_wc(IB->paddr, size);
		IB->size = size;
		IB->fbbuffer_paddr = paddr;
		printk("S3D : allocat %dth buffer success. size:%d, vaddr:%p paddr:0x%lx for 0x%x\n",
				at,
				size,
				IB->buffer,
				IB->paddr,
				paddr
				);
		return IB;
	}
	else
	{
		printk("S3D : alloc fail for 0x%x\n", paddr);
		return NULL;
	}
}