Esempio n. 1
0
static int Fb_pan_display(struct fb_var_screeninfo *var,struct fb_info *info)
{
	__u32 sel = 0;
	__u32 num_screens;

	num_screens = bsp_disp_feat_get_num_screens();

	//__inf("Fb_pan_display\n");

	for(sel = 0; sel < num_screens; sel++) {
		if(((sel==0) && (g_fbi.fb_mode[info->node] != FB_MODE_SCREEN1))
		    || ((sel==1) && (g_fbi.fb_mode[info->node] != FB_MODE_SCREEN0))) {
			__s32 layer_hdl = g_fbi.layer_hdl[info->node][sel];
			__disp_layer_info_t layer_para;
			__u32 buffer_num = 1;
			__u32 y_offset = 0;

			if(g_fbi.fb_mode[info->node] == FB_MODE_DUAL_DIFF_SCREEN_SAME_CONTENTS)	{
				if(sel != var->reserved[0])	{
					return -1;
				}
			}

			if(g_fbi.fb_mode[info->node] == FB_MODE_DUAL_SAME_SCREEN_TB) {
				buffer_num = 2;
			}
			if((sel==0) && (g_fbi.fb_mode[info->node] == FB_MODE_DUAL_SAME_SCREEN_TB)) {
				y_offset = var->yres / 2;
			}

			bsp_disp_layer_get_para(sel, layer_hdl, &layer_para);

			if(layer_para.mode == DISP_LAYER_WORK_MODE_SCALER) {
				layer_para.src_win.x = var->xoffset;
				layer_para.src_win.y = var->yoffset + y_offset;
				layer_para.src_win.width = var->xres;
				layer_para.src_win.height = var->yres / buffer_num;

				bsp_disp_layer_set_src_window(sel, layer_hdl, &(layer_para.src_win));
			}	else {
				layer_para.src_win.x = var->xoffset;
				layer_para.src_win.y = var->yoffset + y_offset;
				layer_para.src_win.width = var->xres;
				layer_para.src_win.height = var->yres / buffer_num;

				layer_para.scn_win.width = var->xres;
				layer_para.scn_win.height = var->yres / buffer_num;

				bsp_disp_layer_set_src_window(sel, layer_hdl, &(layer_para.src_win));
				bsp_disp_layer_set_screen_window(sel, layer_hdl, &(layer_para.scn_win));
			}
		}
	}

	Fb_wait_for_vsync(info);

	return 0;
}
Esempio n. 2
0
static int Fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
{
	long ret = 0;
	int secure_id_buf_num = 0;
	unsigned long layer_hdl = 0;

	switch (cmd) {
	case FBIOGET_LAYER_HDL_0:
		if (g_fbi.fb_mode[info->node] != FB_MODE_SCREEN1) {
			layer_hdl = g_fbi.layer_hdl[info->node][0];
			ret = copy_to_user((void __user *)arg, &layer_hdl,
					   sizeof(unsigned long));
		} else {
			ret = -1;
		}
		break;

	case FBIOGET_LAYER_HDL_1:
		if (g_fbi.fb_mode[info->node] != FB_MODE_SCREEN0) {
			layer_hdl = g_fbi.layer_hdl[info->node][1];
			ret = copy_to_user((void __user *)arg, &layer_hdl,
					   sizeof(unsigned long));
		} else {
			ret = -1;
		}
		break;

#if 0
	case FBIOGET_VBLANK:
		{
			struct fb_vblank vblank;
			__disp_tcon_timing_t tt;
			__u32 line = 0;
			__u32 sel;

			sel = (g_fbi.fb_mode[info->node] == FB_MODE_SCREEN1) ?
				1 : 0;
			line = BSP_disp_get_cur_line(sel);
			BSP_disp_get_timing(sel, &tt);

			memset(&vblank, 0, sizeof(struct fb_vblank));
			vblank.flags |= FB_VBLANK_HAVE_VBLANK;
			vblank.flags |= FB_VBLANK_HAVE_VSYNC;

			if (line <= (tt.ver_total_time - tt.ver_pixels))
				vblank.flags |= FB_VBLANK_VBLANKING;

			if ((line > tt.ver_front_porch) &&
			    (line < (tt.ver_front_porch + tt.ver_sync_time)))
				vblank.flags |= FB_VBLANK_VSYNCING;

			if (copy_to_user((void __user *)arg, &vblank,
					 sizeof(struct fb_vblank)))
				ret = -EFAULT;

			break;
		}
#endif

	case FBIO_WAITFORVSYNC:
		{
			ret = Fb_wait_for_vsync(info);
			break;
		}

#ifdef CONFIG_FB_SUNXI_UMP
	case GET_UMP_SECURE_ID_BUF2:	/* flow trough */
		secure_id_buf_num = 1;
	case GET_UMP_SECURE_ID_BUF1:
		{
			if (!disp_get_ump_secure_id)
				request_module("disp_ump");
			if (disp_get_ump_secure_id)
				return disp_get_ump_secure_id(info, &g_fbi, arg,
							      secure_id_buf_num);
			else
				return -ENOTSUPP;
		}
#endif

	default:
		//__inf("not supported fb io cmd:%x\n", cmd);
		break;
	}
	return ret;
}
Esempio n. 3
0
static int Fb_ioctl(struct fb_info *info, unsigned int cmd,unsigned long arg)
{
	long ret = 0;
	unsigned long layer_hdl = 0;

#ifdef CONFIG_LYCHEE_FB_UMP_SUN4I
	u32 __user *psecureid = (u32 __user *) arg;
	ump_secure_id secure_id;
#endif

	switch (cmd) 
	{
    case FBIOGET_LAYER_HDL_0:
        if(g_fbi.fb_mode[info->node] != FB_MODE_SCREEN1)
        {
            layer_hdl = g_fbi.layer_hdl[info->node][0];
            ret = copy_to_user((void __user *)arg, &layer_hdl, sizeof(unsigned long));
        }
        else
        {
            ret = -1;
        }
        break; 

    case FBIOGET_LAYER_HDL_1:
        if(g_fbi.fb_mode[info->node] != FB_MODE_SCREEN0)
        {
            layer_hdl = g_fbi.layer_hdl[info->node][1];
            ret = copy_to_user((void __user *)arg, &layer_hdl, sizeof(unsigned long));
        }
        else
        {
            ret = -1;
        }
        break; 

#if 0
    case FBIOGET_VBLANK:
    {
        struct fb_vblank vblank;
        __disp_tcon_timing_t tt;
        __u32 line = 0;
        __u32 sel;

        sel = (g_fbi.fb_mode[info->node] == FB_MODE_SCREEN1)?1:0;
        line = BSP_disp_get_cur_line(sel);
        BSP_disp_get_timming(sel, &tt);
        
        memset(&vblank, 0, sizeof(struct fb_vblank));
        vblank.flags |= FB_VBLANK_HAVE_VBLANK;
        vblank.flags |= FB_VBLANK_HAVE_VSYNC;
        if(line <= (tt.ver_total_time-tt.ver_pixels))
        {
            vblank.flags |= FB_VBLANK_VBLANKING;
        }
        if((line > tt.ver_front_porch) && (line < (tt.ver_front_porch+tt.ver_sync_time)))
        {
            vblank.flags |= FB_VBLANK_VSYNCING;
        }
        
        if (copy_to_user((void __user *)arg, &vblank, sizeof(struct fb_vblank)))
            ret = -EFAULT;

        break;
    }
#endif

    case FBIO_WAITFORVSYNC:
    {
        ret = Fb_wait_for_vsync(info);
        break;
    }

#ifdef CONFIG_LYCHEE_FB_UMP_SUN4I
	case GET_UMP_SECURE_ID:
	{
		secure_id = ump_dd_secure_id_get( ump_wrapped_buffer );
		return put_user( (unsigned int)secure_id, psecureid );
		break;
	}
#endif

   	default:
   	    //__inf("not supported fb io cmd:%x\n", cmd);
		break;
	}
	return ret;
}