Пример #1
0
static int _disp_get_ump_secure_id(struct fb_info *info, struct rk_fb_inf *g_fbi,
				   unsigned long arg, int nbuf)
{
	u32 __user *psecureid = (u32 __user *) arg;
	int buf_len = 1920*1080*4;
//	int buf_len = info->var.xres * info->var.yres * (info->var.bits_per_pixel >> 3);
	ump_secure_id secure_id;
        int layer_id = get_fb_layer_id(&info->fix);

//if(nbuf>0) return -ENOTSUPP;
//printk("\nUMP: ENTER   num_fb:%d  num_buf:%d",layer_id,nbuf);
	if (!(info->var.yres * 2 <= info->var.yres_virtual))//IAM
	    printk("\nUMP: Double-buffering not enabled");
//	else

	if (!g_fbi->ump_wrapped_buffer[layer_id][nbuf]) {
		ump_dd_physical_block ump_memory_description;

		ump_memory_description.addr = info->fix.smem_start;
		ump_memory_description.size = buf_len;
		if (nbuf > 0) {
		    ump_memory_description.addr += (buf_len * nbuf);
//		    ump_memory_description.size = buf_len;
		}
//printk("\nUMP: nbuf:%d, addr:%X, size:%X\n",nbuf, ump_memory_description.addr,ump_memory_description.size);
		g_fbi->ump_wrapped_buffer[layer_id][nbuf] =
			ump_dd_handle_create_from_phys_blocks
			(&ump_memory_description, 1);
	}
	secure_id = ump_dd_secure_id_get(g_fbi->
					 ump_wrapped_buffer[layer_id][nbuf]);
//printk("UMP: secure_id:%X, arg:%X",secure_id,arg);
	return put_user((unsigned int)secure_id, psecureid);
}
Пример #2
0
static int Fb_open(struct fb_info *info, int user)
{
#ifdef CONFIG_LYCHEE_FB_UMP_SUN4I
	ump_dd_physical_block ump_memory_description;
	ump_memory_description.addr = info->fix.smem_start;
	ump_memory_description.size = info->fix.smem_len;
	ump_wrapped_buffer = ump_dd_handle_create_from_phys_blocks( &ump_memory_description, 1);
#endif
	return 0;
}
Пример #3
0
int s3cfb_ump_wrapper(struct s3cfb_window *win,
		struct fb_fix_screeninfo *fix, int arg)
{
	ump_dd_physical_block ump_memory_description;

	if (UMP_HANDLE_DD_INVALID == ump_wrapped_buffer) {
		ump_memory_description.addr = fix->smem_start;
		ump_memory_description.size = fix->smem_len;

		ump_wrapped_buffer =
			ump_dd_handle_create_from_phys_blocks
				(&ump_memory_description, 1);
		if (UMP_DD_HANDLE_INVALID == ump_wrapped_buffer)
			return -ENOMEM;
	}
	return 0;
}
Пример #4
0
static int _disp_get_ump_secure_id(struct fb_info *info, myfb_dev_t *g_fbi,
				   unsigned long arg, int buf)
{
	u32 __user *psecureid = (u32 __user *) arg;
	ump_secure_id secure_id;

	if (!g_fbi->ump_wrapped_buffer[info->node][buf]) {
		printk("create_disp_get_ump_secure_id******%d\n", buf);
		ump_dd_physical_block ump_memory_description;

		ump_memory_description.addr = info->fix.smem_start;
		ump_memory_description.size = info->fix.smem_len;
		g_fbi->ump_wrapped_buffer[info->node][buf] =
			ump_dd_handle_create_from_phys_blocks(&ump_memory_description, 1);
	}
	secure_id = ump_dd_secure_id_get(g_fbi->ump_wrapped_buffer[info->node][buf]);
	return put_user((unsigned int)secure_id, psecureid);
}
Пример #5
0
int s3cfb_ump_wrapper(struct fb_fix_screeninfo *fix, int arg, int id,
			struct s3cfb_window *win)
{
	ump_dd_physical_block ump_memory_description;
	unsigned int buffer_size;
	buffer_size = fix->smem_len / CONFIG_FB_S3C_NR_BUFFERS;

	ump_memory_description.addr = fix->smem_start + (buffer_size * id);
	ump_memory_description.size = buffer_size;

	win->ump_wrapped_buffer[id] =
		ump_dd_handle_create_from_phys_blocks
		(&ump_memory_description, 1);

	if (ump_dd_vcm_attribute_set(win->ump_wrapped_buffer[id], arg))
		return -ENOMEM;

	return 0;
}
/*
 * IOCTL operation; Import fd to  UMP memory
 */
int ump_ion_import_wrapper(u32 __user * argument, struct ump_session_data  * session_data)
{
	_ump_uk_ion_import_s user_interaction;
	ump_dd_handle *ump_handle;
	ump_dd_physical_block * blocks;
	unsigned long num_blocks;
	struct ion_handle *ion_hnd;
	struct scatterlist *sg;
	struct scatterlist *sg_ion;
	unsigned long i = 0;

	ump_session_memory_list_element * session_memory_element = NULL;
	if (ion_client_ump==NULL)
	    ion_client_ump = ion_client_create(ion_exynos, -1, "ump");

	/* Sanity check input parameters */
	if (NULL == argument || NULL == session_data)
	{
		MSG_ERR(("NULL parameter in ump_ioctl_allocate()\n"));
		return -ENOTTY;
	}

	/* Copy the user space memory to kernel space (so we safely can read it) */
	if (0 != copy_from_user(&user_interaction, argument, sizeof(user_interaction)))
	{
		MSG_ERR(("copy_from_user() in ump_ioctl_allocate()\n"));
		return -EFAULT;
	}

	user_interaction.ctx = (void *) session_data;

	/* translate fd to secure ID*/
	ion_hnd = ion_import_fd(ion_client_ump, user_interaction.ion_fd);
	sg_ion = ion_map_dma(ion_client_ump,ion_hnd);

	blocks = (ump_dd_physical_block*)_mali_osk_malloc(sizeof(ump_dd_physical_block)*1024);

	if (NULL == blocks) {
		MSG_ERR(("Failed to allocate blocks in ump_ioctl_allocate()\n"));
		return -ENOMEM;
	}

	sg = sg_ion;
	do {
		blocks[i].addr = sg_phys(sg);
		blocks[i].size = sg_dma_len(sg);
		i++;
		if (i>=1024) {
			_mali_osk_free(blocks);
			MSG_ERR(("ion_import fail() in ump_ioctl_allocate()\n"));
			return -EFAULT;
		}
		sg = sg_next(sg);
	} while(sg);

	num_blocks = i;

	/* Initialize the session_memory_element, and add it to the session object */
	session_memory_element = _mali_osk_calloc( 1, sizeof(ump_session_memory_list_element));

	if (NULL == session_memory_element)
	{
		_mali_osk_free(blocks);
		DBG_MSG(1, ("Failed to allocate ump_session_memory_list_element in ump_ioctl_allocate()\n"));
		return -EFAULT;
	}

	ump_handle = ump_dd_handle_create_from_phys_blocks(blocks, num_blocks);
	if (UMP_DD_HANDLE_INVALID == ump_handle)
	{
		_mali_osk_free(session_memory_element);
		_mali_osk_free(blocks);
		DBG_MSG(1, ("Failed to allocate ump_session_memory_list_element in ump_ioctl_allocate()\n"));
		return -EFAULT;
	}

	session_memory_element->mem = (ump_dd_mem*)ump_handle;
	_mali_osk_mutex_wait(session_data->lock);
	_mali_osk_list_add(&(session_memory_element->list), &(session_data->list_head_session_memory_list));
	_mali_osk_mutex_signal(session_data->lock);
	ion_unmap_dma(ion_client_ump,ion_hnd);
	ion_free(ion_client_ump, ion_hnd);

	_mali_osk_free(blocks);

	user_interaction.secure_id = ump_dd_secure_id_get(ump_handle);
	user_interaction.size = ump_dd_size_get(ump_handle);
	user_interaction.ctx = NULL;

	if (0 != copy_to_user(argument, &user_interaction, sizeof(user_interaction)))
	{
		/* If the copy fails then we should release the memory. We can use the IOCTL release to accomplish this */

		MSG_ERR(("copy_to_user() failed in ump_ioctl_allocate()\n"));

		return -EFAULT;
	}
	return 0; /* success */
}
Пример #7
0
int s3cfb_map_default_video_memory(struct s3cfb_global *fbdev,
					struct fb_info *fb, int fimd_id)
{
	struct fb_fix_screeninfo *fix = &fb->fix;
	struct s3cfb_window *win = fb->par;

#ifdef CONFIG_VCM
	struct cma_info mem_info;
	unsigned int reserved_size;
	int err;
	struct vcm_phys *phys = NULL;
	ump_dd_physical_block ump_memory_description;
	unsigned int device_virt_start = 0;
	int frame_size = fix->smem_len / CONFIG_FB_S3C_NR_BUFFERS;
	struct  vcm_res *fb_dev_vcm_res[CONFIG_FB_S3C_NR_BUFFERS];

	enum vcm_dev_id id;
#else
#ifdef CONFIG_S5P_MEM_CMA
	struct cma_info mem_info;
	unsigned int reserved_size;
	int err;
#endif
#endif

#ifdef MALI_USE_UNIFIED_MEMORY_PROVIDER
#ifdef CONFIG_VCM
	int i;
	unsigned int arg = 0;
#ifdef CONFIG_UMP_VCM_ALLOC
	struct ump_vcm ump_vcm;
#endif
	unsigned int arg = 0;
#endif
#endif

	if (win->owner == DMA_MEM_OTHER)
		return 0;

#ifdef CONFIG_VCM
	phys = kmalloc(sizeof(*phys) + sizeof(*phys->parts), GFP_KERNEL);
	memset(phys, 0, sizeof(*phys) + sizeof(*phys->parts));

	if (fimd_id == 0)
		id = VCM_DEV_FIMD0;
	else
		id = VCM_DEV_FIMD1;

	err = cma_info(&mem_info, fbdev->dev, 0);
	if (ERR_PTR(err))
		return -ENOMEM;
	reserved_size = fix->smem_len;
	fix->smem_start = (dma_addr_t)cma_alloc
		(fbdev->dev, "fimd", (size_t)reserved_size, 0);
	fb->screen_base = cma_get_virt(fix->smem_start, reserved_size, 1);

	fbdev->s5p_vcm = vcm_create_unified((SZ_64M), id, &s3cfb_vcm_driver);
	if (IS_ERR(fbdev->s5p_vcm))
		return PTR_ERR(fbdev->s5p_vcm);
	if (vcm_activate(fbdev->s5p_vcm))
		dev_info(fbdev->dev, "[fb%d] : VCM activated", win->id);

	phys->count = 1;
	phys->size = fix->smem_len;
	phys->free = NULL;
	phys->parts[0].size = fix->smem_len;
	phys->parts[0].start = fix->smem_start;

	win->s5p_vcm_res = vcm_map(fbdev->s5p_vcm, phys, 0);
	device_virt_start = win->s5p_vcm_res->start;

	for (i = 0; i < CONFIG_FB_S3C_NR_BUFFERS; i++) {
		fb_dev_vcm_res[i] = kzalloc(sizeof(struct vcm_res), GFP_KERNEL);
		win->s3cfb_vcm[i].dev_vcm_res = fb_dev_vcm_res[i];

		win->s3cfb_vcm[i].dev_vcm_res->start = device_virt_start
							+ frame_size * i;
		win->s3cfb_vcm[i].dev_vcm_res->bound_size = frame_size;
		win->s3cfb_vcm[i].dev_vcm_res->res_size = frame_size;
		win->s3cfb_vcm[i].dev_vcm = fbdev->s5p_vcm;
		win->s3cfb_vcm[i].dev_vcm_res->vcm = fbdev->s5p_vcm;
		if (IS_ERR(win->s3cfb_vcm[i].dev_vcm_res))
			return -ENOMEM;
	}
#else
#ifdef CONFIG_S5P_MEM_CMA
	err = cma_info(&mem_info, fbdev->dev, 0);
	if (ERR_PTR(err))
		return -ENOMEM;
	reserved_size = mem_info.total_size;
	fix->smem_start = (dma_addr_t)cma_alloc
		(fbdev->dev, "fimd", (size_t)reserved_size, 0);
	fb->screen_base = cma_get_virt(fix->smem_start, reserved_size, 1);
#elif defined(CONFIG_S5P_MEM_BOOTMEM)
	fix->smem_start = s5p_get_media_memory_bank(S5P_MDEV_FIMD, 1);
	fix->smem_len = s5p_get_media_memsize_bank(S5P_MDEV_FIMD, 1);
	fb->screen_base = ioremap_wc(fix->smem_start, fix->smem_len);
#endif
#endif

	memset(fb->screen_base, 0, fix->smem_len);
	win->owner = DMA_MEM_FIMD;

#if MALI_USE_UNIFIED_MEMORY_PROVIDER
#ifdef CONFIG_VCM
#ifdef CONFIG_UMP_VCM_ALLOC
	for (i = 0; i < CONFIG_FB_S3C_NR_BUFFERS; i++) {
		ump_vcm.vcm = win->s3cfb_vcm[i].dev_vcm;
		ump_vcm.vcm_res = win->s3cfb_vcm[i].dev_vcm_res;
		ump_vcm.dev_id = id;
		arg = (unsigned int)&ump_vcm;
		ump_memory_description.addr = fix->smem_start + ((fix->smem_len / CONFIG_FB_S3C_NR_BUFFERS) * i);
		ump_memory_description.size = fix->smem_len / CONFIG_FB_S3C_NR_BUFFERS;

		win->ump_wrapped_buffer[i] =
			ump_dd_handle_create_from_phys_blocks
			(&ump_memory_description, 1);

		if (ump_dd_vcm_attribute_set(win->ump_wrapped_buffer[i], arg))
			return -ENOMEM;
	}
#else
	if (s3cfb_ump_wrapper(fix, arg, 0, win)) {
		dev_info(fbdev->dev, "[fb%d] : Wrapped UMP memory : %x\n"
				, win->id, (unsigned int)ump_wrapped_buffer);
		s3cfb_unmap_video_memory(fbdev, fb);
		return -ENOMEM;
	}
#endif
#endif
#endif

	return 0;
}
Пример #8
0
int s3cfb_map_video_memory(struct s3cfb_global *fbdev, struct fb_info *fb)
{
	struct fb_fix_screeninfo *fix = &fb->fix;
	struct s3cfb_window *win = fb->par;

#ifdef CONFIG_VCM
	struct fb_var_screeninfo *var = &fb->var;
	struct cma_info mem_info;
	unsigned int reserved_size;
	int err;
	struct vcm_phys *phys = NULL;
	unsigned int device_virt_start = 0;
	int frame_num = var->yres_virtual / var->yres;
	int frame_size = fix->smem_len / frame_num;
	struct  vcm_res *fb_dev_vcm_res[frame_num];

	enum vcm_dev_id id;

	struct ump_vcm ump_vcm;
	unsigned int arg = 0;

	int i;
	ump_dd_physical_block ump_memory_description;

	if (win->owner == DMA_MEM_OTHER)
		return 0;

	phys = kmalloc(sizeof(*phys) + sizeof(*phys->parts), GFP_KERNEL);
	memset(phys, 0, sizeof(*phys) + sizeof(*phys->parts));

	if (win->id < 5)
		id = VCM_DEV_FIMD0;
	else
		id = VCM_DEV_FIMD1;

	err = cma_info(&mem_info, fbdev->dev, 0);
	if (ERR_PTR(err))
		return -ENOMEM;
	reserved_size = fix->smem_len;
	fix->smem_start = (dma_addr_t)cma_alloc
		(fbdev->dev, "fimd", (size_t)reserved_size, 0);
	fb->screen_base = cma_get_virt(fix->smem_start, reserved_size, 1);

	phys->count = 1;
	phys->size = fix->smem_len;
	phys->free = NULL;
	phys->parts[0].size = fix->smem_len;
	phys->parts[0].start = fix->smem_start;

	win->s5p_vcm_res = vcm_map(fbdev->s5p_vcm, phys, 0);
	device_virt_start = win->s5p_vcm_res->start;

	for (i = 0; i < frame_num; i++) {
		fb_dev_vcm_res[i] = kzalloc(sizeof(struct vcm_res), GFP_KERNEL);
		win->s3cfb_vcm[i].dev_vcm_res = fb_dev_vcm_res[i];

		win->s3cfb_vcm[i].dev_vcm_res->start = device_virt_start
							+ frame_size * i;
		win->s3cfb_vcm[i].dev_vcm_res->bound_size = frame_size;
		win->s3cfb_vcm[i].dev_vcm_res->res_size = frame_size;
		win->s3cfb_vcm[i].dev_vcm = fbdev->s5p_vcm;
		win->s3cfb_vcm[i].dev_vcm_res->vcm = fbdev->s5p_vcm;
		if (IS_ERR(win->s3cfb_vcm[i].dev_vcm_res))
			return -ENOMEM;
	}

	memset(fb->screen_base, 0, (fix->smem_len / frame_num));
	win->owner = DMA_MEM_FIMD;
#else
	if (win->owner == DMA_MEM_OTHER)
		return 0;

	fb->screen_base = dma_alloc_writecombine(fbdev->dev,
						 PAGE_ALIGN(fix->smem_len),
						 (unsigned int *)
						 &fix->smem_start, GFP_KERNEL);

	if (!fb->screen_base)
		return -ENOMEM;
	else
		dev_info(fbdev->dev, "[fb%d] dma: 0x%08x, cpu: 0x%08x, "
			 "size: 0x%08x\n", win->id,
			 (unsigned int)fix->smem_start,
			 (unsigned int)fb->screen_base, fix->smem_len);

	memset(fb->screen_base, 0, fix->smem_len);
	win->owner = DMA_MEM_FIMD;
#endif

#if MALI_USE_UNIFIED_MEMORY_PROVIDER
#ifdef CONFIG_VCM
#ifdef CONFIG_UMP_VCM_ALLOC
	for (i = 0; i < frame_num; i++) {
		ump_vcm.vcm = win->s3cfb_vcm[i].dev_vcm;
		ump_vcm.vcm_res = win->s3cfb_vcm[i].dev_vcm_res;
		ump_vcm.dev_id = id;
		arg = (unsigned int)&ump_vcm;

		ump_memory_description.addr = fix->smem_start + ((fix->smem_len / frame_num) * i);
		ump_memory_description.size = fix->smem_len / frame_num;

		win->ump_wrapped_buffer[i] =
			ump_dd_handle_create_from_phys_blocks
			(&ump_memory_description, 1);

		if (ump_dd_vcm_attribute_set(win->ump_wrapped_buffer[i], arg))
			return -ENOMEM;

	}
#else
	if (s3cfb_ump_wrapper(fix, arg, 0, win)) {
		dev_info(fbdev->dev, "[fb%d] : Wrapped UMP memory : %x\n"
				, win->id, (unsigned int)ump_wrapped_buffer);
		s3cfb_unmap_video_memory(fbdev, fb);
		return -ENOMEM;
	}
#endif
#endif
#endif

	return 0;
}
Пример #9
0
int ump_dmabuf_import_wrapper(u32 __user *argument,
				struct ump_session_data  *session_data)
{
	ump_session_memory_list_element *session = NULL;
	struct ump_uk_dmabuf ump_dmabuf;
	ump_dd_handle *ump_handle;
	ump_dd_physical_block *blocks;
	struct dma_buf_attachment *attach;
	struct dma_buf *dma_buf;
	struct sg_table *sgt;
	struct scatterlist *sgl;
	unsigned long block_size;
	/* FIXME */
	struct device dev;
	unsigned int i = 0, npages;
	int ret;

	/* Sanity check input parameters */
	if (!argument || !session_data) {
		MSG_ERR(("NULL parameter.\n"));
		return -EINVAL;
	}

	if (copy_from_user(&ump_dmabuf, argument,
				sizeof(struct ump_uk_dmabuf))) {
		MSG_ERR(("copy_from_user() failed.\n"));
		return -EFAULT;
	}

	dma_buf = dma_buf_get(ump_dmabuf.fd);
	if (IS_ERR(dma_buf))
		return PTR_ERR(dma_buf);

	/*
	 * check whether dma_buf imported already exists or not.
	 *
	 * TODO
	 * if already imported then dma_buf_put() should be called
	 * and then just return dma_buf imported.
	 */

	attach = dma_buf_attach(dma_buf, &dev);
	if (IS_ERR(attach)) {
		ret = PTR_ERR(attach);
		goto err_dma_buf_put;
	}

	sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
	if (IS_ERR(sgt)) {
		ret = PTR_ERR(sgt);
		goto err_dma_buf_detach;
	}

	npages = sgt->nents;

	/* really need? */
	ump_dmabuf.ctx = (void *)session_data;

	block_size = sizeof(ump_dd_physical_block) * npages;

	blocks = (ump_dd_physical_block *)_mali_osk_malloc(block_size);

	if (NULL == blocks) {
		MSG_ERR(("Failed to allocate blocks\n"));
		ret = -ENOMEM;
		goto err_dmu_buf_unmap;
	}

	sgl = sgt->sgl;

	while (i < npages) {
		blocks[i].addr = sg_phys(sgl);
		blocks[i].size = sg_dma_len(sgl);
		sgl = sg_next(sgl);
		i++;
	}

	/*
	 * Initialize the session memory list element, and add it
	 * to the session object
	 */
	session = _mali_osk_calloc(1, sizeof(*session));
	if (!session) {
		DBG_MSG(1, ("Failed to allocate session.\n"));
		ret = -EFAULT;
		goto err_free_block;
	}

	ump_handle = ump_dd_handle_create_from_phys_blocks(blocks, i);
	if (UMP_DD_HANDLE_INVALID == ump_handle) {
		DBG_MSG(1, ("Failed to create ump handle.\n"));
		ret = -EFAULT;
		goto err_free_session;
	}

	session->mem = (ump_dd_mem *)ump_handle;

	_mali_osk_lock_wait(session_data->lock, _MALI_OSK_LOCKMODE_RW);
	_mali_osk_list_add(&(session->list),
			&(session_data->list_head_session_memory_list));
	_mali_osk_lock_signal(session_data->lock, _MALI_OSK_LOCKMODE_RW);

	_mali_osk_free(blocks);

	ump_dmabuf.ump_handle = (uint32_t)ump_handle;
	ump_dmabuf.size = ump_dd_size_get(ump_handle);

	if (copy_to_user(argument, &ump_dmabuf,
				sizeof(struct ump_uk_dmabuf))) {
		MSG_ERR(("copy_to_user() failed.\n"));
		ret =  -EFAULT;
		goto err_release_ump_handle;
	}

	return 0;

err_release_ump_handle:
	ump_dd_reference_release(ump_handle);
err_free_session:
	_mali_osk_free(session);
err_free_block:
	_mali_osk_free(blocks);
err_dmu_buf_unmap:
	dma_buf_unmap_attachment(attach, sgt, DMA_BIDIRECTIONAL);
err_dma_buf_detach:
	dma_buf_detach(dma_buf, attach);
err_dma_buf_put:
	dma_buf_put(dma_buf);
	return ret;
}
Пример #10
0
static int
osd_ioctl(struct fb_info *info, unsigned int cmd,
               unsigned long arg)
{
	 struct myfb_dev *fbdev = (struct myfb_dev *)info->par;
	 void __user *argp = (void __user *)arg;
   	 u32  src_colorkey;//16 bit or 24 bit 
   	 u32  srckey_enable;
	 u32  gbl_alpha;
	 u32  osd_order;
	 s32  osd_axis[4] = {0};
	 u32  block_windows[8] = {0};
	 u32  block_mode;
        unsigned long  ret;

    	switch (cmd)
  	{
   		case  FBIOPUT_OSD_SRCKEY_ENABLE:
			ret=copy_from_user(&srckey_enable,argp,sizeof(u32));
			break;
   		case  FBIOPUT_OSD_SRCCOLORKEY:
			ret=copy_from_user(&src_colorkey,argp,sizeof(u32));
			break ;
		case FBIOPUT_OSD_SET_GBL_ALPHA:
			ret=copy_from_user(&gbl_alpha,argp,sizeof(u32));
			break;
		case FBIOPUT_OSD_SCALE_AXIS:
			ret=copy_from_user(&osd_axis, argp, 4 * sizeof(s32));
			break;
		case FBIOGET_OSD_SCALE_AXIS:
		case FBIOPUT_OSD_ORDER:
		case FBIOGET_OSD_ORDER:
		case FBIOGET_OSD_GET_GBL_ALPHA:
		case FBIOPUT_OSD_2X_SCALE:	
		case FBIOPUT_OSD_ENABLE_3D_MODE:
		case FBIOPUT_OSD_FREE_SCALE_ENABLE:
		case FBIOPUT_OSD_FREE_SCALE_WIDTH:
		case FBIOPUT_OSD_FREE_SCALE_HEIGHT:
		case FBIOGET_OSD_BLOCK_WINDOWS:
		case FBIOGET_OSD_BLOCK_MODE:
		case FBIOGET_OSD_FREE_SCALE_AXIS:
			break;
		case FBIOPUT_OSD_BLOCK_MODE:
			block_mode = (u32)argp;
			break;
		case FBIOPUT_OSD_BLOCK_WINDOWS:
			ret=copy_from_user(&block_windows, argp, 8 * sizeof(u32));
			break;
		case FBIOPUT_OSD_FREE_SCALE_AXIS:
			ret=copy_from_user(&osd_axis, argp, 4 * sizeof(s32));
			break;

                case GET_UMP_SECURE_ID_BUF1:
	        {
        	     u32 __user *psecureid = (u32 __user *) arg;
        	     ump_secure_id secure_id;
		     if (!ump_wrapped_buffer[0]) {
			ump_dd_physical_block ump_memory_description;
			ump_memory_description.addr = info->fix.smem_start;
			ump_memory_description.size = info->fix.smem_len;
			ump_wrapped_buffer[0] = ump_dd_handle_create_from_phys_blocks( &ump_memory_description, 1);
		     }
        	     //Get secure id for top-half of framebuffer
        	     secure_id = ump_dd_secure_id_get(ump_wrapped_buffer[0]);
        	     return put_user((unsigned int)secure_id, psecureid);
		     break;
	        }

	        case GET_UMP_SECURE_ID_BUF2:
	        {
		     u32 __user *psecureid = (u32 __user *) arg;
        	     ump_secure_id secure_id;
		     if (!ump_wrapped_buffer[1]) {
			ump_dd_physical_block ump_memory_description;
			ump_memory_description.addr = info->fix.smem_start;
			ump_memory_description.size = info->fix.smem_len;
			ump_wrapped_buffer[1] = ump_dd_handle_create_from_phys_blocks( &ump_memory_description, 1);
		     }
        	//Get secure id for bottom-half of framebuffer 
        	secure_id = ump_dd_secure_id_get(ump_wrapped_buffer[1]);
        	return put_user((unsigned int)secure_id, psecureid);
		break;
                }
		default :
			amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_HIGH,"command not supported\r\n ");
			return -1;
	}
	mutex_lock(&fbdev->lock);

  	switch (cmd)
    	{
    		case FBIOPUT_OSD_ORDER:
		osddev_change_osd_order(info->node,arg);	
		break;
		case FBIOGET_OSD_ORDER:
		osd_order=osddev_get_osd_order(info->node);
		ret=copy_to_user(argp, &osd_order, sizeof(u32));
		break;	
    		case FBIOPUT_OSD_FREE_SCALE_WIDTH:
		osddev_free_scale_width(info->node,arg);			
		break;
		case FBIOPUT_OSD_FREE_SCALE_HEIGHT:
		osddev_free_scale_height(info->node,arg);		
		break;
    		case FBIOPUT_OSD_FREE_SCALE_ENABLE:
		osddev_free_scale_enable(info->node,arg);			
		break;		
    		case FBIOPUT_OSD_ENABLE_3D_MODE:
		osddev_enable_3d_mode(info->node,arg);
		break;		
    		case FBIOPUT_OSD_2X_SCALE: //arg :higher 16 bit h_scale_enable, lower 16 bit v_scale_enable
		osddev_set_2x_scale(info->node,arg&0xffff0000?1:0,arg&0xffff?1:0);
		break;		
    		case FBIOPUT_OSD_SRCCOLORKEY:
	    	switch(fbdev->color->color_index)
	  	{
	 		case COLOR_INDEX_16_655:
			case COLOR_INDEX_16_844:
			case COLOR_INDEX_16_565:
			case COLOR_INDEX_24_888_B:
			case COLOR_INDEX_24_RGB:
			case COLOR_INDEX_YUV_422:
	  	   	amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"set osd color key 0x%x\r\n",src_colorkey);
            fbdev->color_key = src_colorkey;
	  	 	osddev_set_colorkey(info->node,fbdev->color->color_index,src_colorkey);
			break;
			default: break;
	  	}
	   	break ;
	  	case FBIOPUT_OSD_SRCKEY_ENABLE:
	   	switch(fbdev->color->color_index)
	  	{
	 		case COLOR_INDEX_16_655:
			case COLOR_INDEX_16_844:
			case COLOR_INDEX_16_565:
			case COLOR_INDEX_24_888_B:
			case COLOR_INDEX_24_RGB:
			case COLOR_INDEX_YUV_422:	
			amlog_mask_level(LOG_MASK_IOCTL,LOG_LEVEL_LOW,"set osd color key %s\r\n",srckey_enable?"enable":"disable");
			if (srckey_enable != 0) {
				fbdev->enable_key_flag |= KEYCOLOR_FLAG_TARGET;
				if (!(fbdev->enable_key_flag & KEYCOLOR_FLAG_ONHOLD)) {
					osddev_srckey_enable(info->node, 1);
					fbdev->enable_key_flag |= KEYCOLOR_FLAG_CURRENT;
				}
			} else {
				osddev_srckey_enable(info->node, 0);
				fbdev->enable_key_flag &= ~(KEYCOLOR_FLAG_TARGET | KEYCOLOR_FLAG_CURRENT);
			}
			break;
			default:break;
	 	}
	   	break;
	 	case FBIOPUT_OSD_SET_GBL_ALPHA:
	 	osddev_set_gbl_alpha(info->node,gbl_alpha);
	 	break;
	 	case  FBIOGET_OSD_GET_GBL_ALPHA:
	 	gbl_alpha=osddev_get_gbl_alpha(info->node);
	 	ret=copy_to_user(argp, &gbl_alpha, sizeof(u32));
	  	break;

		case FBIOGET_OSD_SCALE_AXIS:
			osddev_get_scale_axis(info->node, &osd_axis[0], &osd_axis[1], &osd_axis[2], &osd_axis[3]);
			ret=copy_to_user(argp, &osd_axis, 4 * sizeof(s32));
			break;
		case FBIOPUT_OSD_SCALE_AXIS:
			osddev_set_scale_axis(info->node, osd_axis[0], osd_axis[1], osd_axis[2], osd_axis[3]);
			break;
		case FBIOGET_OSD_BLOCK_WINDOWS:
			osddev_get_block_windows(info->node, block_windows);
			ret=copy_to_user(argp, &block_windows, 8 * sizeof(u32));
			break;
		case FBIOPUT_OSD_BLOCK_WINDOWS:
			osddev_set_block_windows(info->node, block_windows);
			break;
		case FBIOPUT_OSD_BLOCK_MODE:
			osddev_set_block_mode(info->node, block_mode);
			break;
		case FBIOGET_OSD_BLOCK_MODE:
			osddev_get_block_mode(info->node, &block_mode);
			ret=copy_to_user(argp, &block_mode, sizeof(u32));
			break;
		case FBIOGET_OSD_FREE_SCALE_AXIS:
			osddev_get_free_scale_axis(info->node, &osd_axis[0], &osd_axis[1], &osd_axis[2], &osd_axis[3]);
			ret=copy_to_user(argp, &osd_axis, 4 * sizeof(s32));
			break;
		case FBIOPUT_OSD_FREE_SCALE_AXIS:
			osddev_set_free_scale_axis(info->node, osd_axis[0], osd_axis[1], osd_axis[2], osd_axis[3]);
			break;

		default:
			break;
    	}

   	mutex_unlock(&fbdev->lock);
	
	return  0;
}