示例#1
0
vinfo_t * hdmi_get_current_vinfo(void)
{
    const vinfo_t *info;
#ifdef CONFIG_AM_TV_OUTPUT2
    if(get_cur_vout_index() == 2){
        info = get_current_vinfo2();
    }
    else{
        info = get_current_vinfo();
    }
#else
    info = get_current_vinfo();
#endif
    return info;
}    
示例#2
0
static int  create_vout_attr(void)
{
	//create base class for display
	int  i;
    extern const vinfo_t *get_current_vinfo(void);
    vinfo_t * init_mode;

	vout_info.base_class=class_create(THIS_MODULE,VOUT_CLASS_NAME);
	if(IS_ERR(vout_info.base_class))
	{
		amlog_mask_level(LOG_MASK_INIT,LOG_LEVEL_HIGH,"create vout class fail\n");
		return  -1 ;
	}
	//create  class attr
	for(i=0;i<VOUT_ATTR_MAX;i++)
	{
		if ( class_create_file(vout_info.base_class,vout_attr[i]))
		{
			amlog_mask_level(LOG_MASK_INIT,LOG_LEVEL_HIGH,"create disp attribute %s fail\n",vout_attr[i]->attr.name);
		}
	}

    // Init /sys/class/display/mode value
    init_mode = (vinfo_t *)get_current_vinfo();
    if(init_mode)
        strcpy(mode, init_mode->name);

	return   0;
}
示例#3
0
static int set_disp_mode_auto(void)
{
    int ret=-1;
#ifndef AVOS
    const vinfo_t *info = get_current_vinfo();
#else
    vinfo_t* info=&lvideo_info;
#endif    
    HDMI_Video_Codes_t vic;     //Prevent warning
    //msleep(500);

    vic = hdmitx_edid_get_VIC(&hdmitx_device, info->name, (hdmitx_device.disp_switch_config==DISP_SWITCH_FORCE)?1:0);
    hdmitx_device.cur_VIC = HDMI_Unkown;
    ret = hdmitx_set_display(&hdmitx_device, vic); //if vic is HDMI_Unkown, hdmitx_set_display will disable HDMI
    if(ret>=0){
        hdmitx_device.cur_VIC = vic;
        hdmitx_device.audio_param_update_flag = 1;
        hdmi_authenticated = -1;
        hdmitx_device.auth_process_timer = AUTH_PROCESS_TIME;
        set_test_mode();
    }
    if(hdmitx_device.cur_VIC == HDMI_Unkown){
        if(hpdmode==2){
            hdmitx_edid_clear(&hdmitx_device); /* edid will be read again when hpd is muxed and it is high */
            hdmitx_device.mux_hpd_if_pin_high_flag = 0;
        }
        if(hdmitx_device.HWOp.Cntl){
            hdmitx_device.HWOp.Cntl(&hdmitx_device, HDMITX_HWCMD_TURNOFF_HDMIHW, (hpdmode==2)?1:0);    
        }
    }
    return ret;
}    
示例#4
0
static int
osd_set_par(struct fb_info *info)
{
	const vinfo_t *vinfo;
	struct myfb_dev *fbdev = (struct myfb_dev *)info->par;
	osd_ctl_t *osd_ctrl=&fbdev->osd_ctl; 
	u32  virt_end_x,virt_end_y;
	
	vinfo = get_current_vinfo();
	virt_end_x=osd_ctrl->disp_start_x+info->var.xres;
	virt_end_y=osd_ctrl->disp_start_y+info->var.yres;
	
	if(virt_end_x > vinfo->width)
	{
		osd_ctrl->disp_end_x=vinfo->width - 1 ;
	}
	else
	{
		osd_ctrl->disp_end_x=virt_end_x -1;
	}
	if(virt_end_y  >vinfo->height)
	{
		osd_ctrl->disp_end_y=vinfo->height - 1;
	}
	else
	{     
		osd_ctrl->disp_end_y=virt_end_y - 1; 
	}
	osddev_set((struct myfb_dev *)info->par);
	return  0;
}
示例#5
0
static unsigned char is_dispmode_valid_for_hdmi(void)
{
    HDMI_Video_Codes_t vic;
#ifndef AVOS
    const vinfo_t *info = get_current_vinfo();
#else
    vinfo_t* info=&lvideo_info;
#endif    
    vic = hdmitx_edid_get_VIC(&hdmitx_device, info->name, (hdmitx_device.disp_switch_config==DISP_SWITCH_FORCE)?1:0);
    return (vic != HDMI_Unkown);
}
示例#6
0
static int osd1_init(logo_object_t *plogo)
{
	int hpd_state = 0;

	if(plogo->para.output_dev_type==output_osd1.idx)
	{
		DisableVideoLayer();
		if((plogo->platform_res[output_osd1.idx].mem_end - plogo->platform_res[output_osd1.idx].mem_start) ==0)
		{
			return OUTPUT_DEV_UNFOUND;
		}
		if(plogo->para.loaded)
		{
			osd_init_hw(plogo->para.loaded);
			if(plogo->para.vout_mode > VMODE_4K2K_SMPTE){
				plogo->para.vout_mode|=VMODE_LOGO_BIT_MASK;
			}
		}
#ifdef CONFIG_AM_HDMI_ONLY
		if(plogo->para.vout_mode > VMODE_4K2K_SMPTE) {
			set_current_vmode(plogo->para.vout_mode);
		}else{
			extern int read_hpd_gpio(void);
			hpd_state = read_hpd_gpio();
    		
			if (hpd_state == 0){
			    set_current_vmode(cvbsmode_hdmionly);
			}
			else{
			    set_current_vmode(hdmimode_hdmionly);
			}
		}
#else
		set_current_vmode(plogo->para.vout_mode);
#endif
		output_osd1.vinfo=get_current_vinfo();
		plogo->dev=&output_osd1;
		plogo->dev->window.x=0;
		plogo->dev->window.y=0;
		plogo->dev->window.w=plogo->dev->vinfo->width;
		plogo->dev->window.h=plogo->dev->vinfo->height;
		plogo->dev->output_dev.osd.mem_start=plogo->platform_res[LOGO_DEV_OSD1].mem_start;
		plogo->dev->output_dev.osd.mem_end=plogo->platform_res[LOGO_DEV_OSD1].mem_end;
		plogo->dev->output_dev.osd.color_depth=get_curr_color_depth(P_VIU_OSD2_BLK0_CFG_W0);//setup by uboot
		return OUTPUT_DEV_FOUND;
	}
	return OUTPUT_DEV_UNFOUND;
}
static int vid_init(logo_object_t *plogo)
{
	if(plogo->para.output_dev_type==output_vid.idx)
	{
		set_current_vmode(plogo->para.vout_mode);
		output_vid.vinfo=get_current_vinfo();
		plogo->dev=&output_vid;
		plogo->dev->window.x=0;
		plogo->dev->window.y=0;
		plogo->dev->window.w=plogo->dev->vinfo->width;
		plogo->dev->window.h=plogo->dev->vinfo->height;
		plogo->dev->output_dev.vid.mem_start=plogo->platform_res[LOGO_DEV_VID].mem_start;
		plogo->dev->output_dev.vid.mem_end=plogo->platform_res[LOGO_DEV_VID].mem_end;
		amlog_mask_level(LOG_MASK_DEVICE,LOG_LEVEL_LOW,"display on video layer\n");
		return OUTPUT_DEV_FOUND;
	}
	return OUTPUT_DEV_UNFOUND;
}
int osd_init_progress_bar(void)
{
	struct src_dst_info_s  *op_info = &progress_bar.op_info;
	const struct vinfo_s *vinfo = progress_bar.vinfo;
	struct osd_fb_dev_s *fb_dev;
	struct canvas_s cs;
	struct config_para_s *cfg = &ge2d_config;
	struct ge2d_context_s *context = ge2d_context;
	u32 step = 1;

	memset(&progress_bar, 0, sizeof(struct osd_progress_bar_s));

	vinfo = get_current_vinfo();

	progress_bar.bar_border =
		(((vinfo->field_height ?
		vinfo->field_height :
		vinfo->height) * 4 / 720)>>2)<<2;
	progress_bar.bar_width =
		(((vinfo->width * 200 / 1280)>>2)<<2) + progress_bar.bar_border;
	progress_bar.bar_height =
		(((vinfo->field_height ?
		vinfo->field_height :
		vinfo->height) * 32 / 720) >> 2) << 2;

	if (0 == init_fb1_first(vinfo)) {
		fb_dev = gp_fbdev_list[1];
		if (NULL == fb_dev) {
			pr_debug("fb1 should exit!!!");
			return -EFAULT;
		}

		canvas_read(OSD2_CANVAS_INDEX, &cs);
		context = create_ge2d_work_queue();
		if (!context) {
			pr_debug("create work queue error\n");
			return -EFAULT;
		}

		memset(cfg, 0, sizeof(struct config_para_s));
		cfg->src_dst_type = OSD1_OSD1;
		cfg->src_format = GE2D_FORMAT_S32_ARGB;
		cfg->src_planes[0].addr = cs.addr;
		cfg->src_planes[0].w = cs.width / 4;
		cfg->src_planes[0].h = cs.height;
		cfg->dst_planes[0].addr = cs.addr;
		cfg->dst_planes[0].w = cs.width / 4;
		cfg->dst_planes[0].h = cs.height;

		if (ge2d_context_config(context, cfg) < 0) {
			pr_debug("ge2d config error.\n");
			return -EFAULT;
		}

		if (NULL == context) {
			pr_debug("ge2d_context is NULL!!!!!!\n");
			return -EFAULT;
		}
		progress_bar.ge2d_context = context;
		pr_debug("progress bar setup ge2d device OK\n");
		/* clear dst rect */
		op_info->color = 0x000000bf;
		op_info->dst_rect.x = 0;
		op_info->dst_rect.y = 0;
		op_info->dst_rect.w = vinfo->width;
		op_info->dst_rect.h =
			vinfo->field_height ?
			vinfo->field_height :
			vinfo->height;

		fillrect(context, op_info->dst_rect.x,
			op_info->dst_rect.y,
			op_info->dst_rect.w,
			op_info->dst_rect.h,
			op_info->color);

		pr_debug("clear dstrect is - (%d, %d)-(%d, %d) -\n",
			op_info->dst_rect.x,
			op_info->dst_rect.y,
			op_info->dst_rect.w,
			op_info->dst_rect.h);

		/* show fb1 */
		console_lock();
		osd_blank(0, fb_dev->fb_info);
		console_unlock();
		op_info->color = 0x555555ff;
		op_info->dst_rect.x =
			(vinfo->width / 2) - progress_bar.bar_width;
		op_info->dst_rect.y =
			((vinfo->field_height ?
			vinfo->field_height :
			vinfo->height) * 9) / 10;
		op_info->dst_rect.w = progress_bar.bar_width * 2;
		op_info->dst_rect.h = progress_bar.bar_height;

		pr_debug("fill==dst:%d-%d-%d-%d\n",
			op_info->dst_rect.x, op_info->dst_rect.y,
			op_info->dst_rect.w, op_info->dst_rect.h);

		fillrect(context, op_info->dst_rect.x,
			op_info->dst_rect.y,
			op_info->dst_rect.w,
			op_info->dst_rect.h,
			op_info->color);
	} else {
		pr_debug("fb1 init failed, exit!!!");
		return -EFAULT;
	}

	/* initial op info before draw actrualy */
	op_info->dst_rect.x += progress_bar.bar_border;
	op_info->dst_rect.y += progress_bar.bar_border;
	op_info->dst_rect.w =
		(progress_bar.bar_width - progress_bar.bar_border)
		* 2 * step/100;
	op_info->dst_rect.h =
		progress_bar.bar_height - progress_bar.bar_border * 2;
	op_info->color = 0xffffff;

	return 0;
}
示例#9
0
int osd_notify_callback(struct notifier_block *block, unsigned long cmd , void *para)
{
	const vinfo_t *vinfo;
	myfb_dev_t *fb_dev;
	int  i,blank;
	disp_rect_t  *disp_rect;

	
	vinfo = get_current_vinfo();
	amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"tv_server:vmode=%s\r\n", vinfo->name);
	
	switch(cmd)
	{
		case  VOUT_EVENT_MODE_CHANGE:
		amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"recevie change mode  message \r\n");
		for(i=0;i<OSD_COUNT;i++)
		{
			if(NULL==(fb_dev=gp_fbdev_list[i])) continue;
			set_default_display_axis(&fb_dev->fb_info->var,&fb_dev->osd_ctl,vinfo);
			console_lock();
			osddev_update_disp_axis(fb_dev,1);
			console_unlock();
		}
		break;

		case VOUT_EVENT_OSD_BLANK:
		blank=*(int*)para ;	
		for(i=0;i<OSD_COUNT;i++)
		{
			if(NULL==(fb_dev=gp_fbdev_list[i])) continue;
			console_lock();
			osd_blank(blank,fb_dev->fb_info);
			console_unlock();
		}
		break;
		case   VOUT_EVENT_OSD_DISP_AXIS:
		disp_rect=(disp_rect_t*)para;	
		
		for(i=0;i<OSD_COUNT;i++)
		{	
			if(!disp_rect)  break;
			fb_dev=gp_fbdev_list[i];
			if(fb_dev->preblend_enable) break;  //if osd layer preblend ,it's position is controled by vpp.
			fb_dev->osd_ctl.disp_start_x=disp_rect->x  ;
			fb_dev->osd_ctl.disp_start_y=disp_rect->y  ;
			amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"set disp axis: x:%d y:%d w:%d h:%d\r\n"  , \
					disp_rect->x, disp_rect->y,\
					disp_rect->w, disp_rect->h );
			if(disp_rect->x+disp_rect->w > vinfo->width)
			{
				fb_dev->osd_ctl.disp_end_x=vinfo->width - 1;
			}
			else
			{
				fb_dev->osd_ctl.disp_end_x=fb_dev->osd_ctl.disp_start_x+disp_rect->w -1 ; 
			}
			if(disp_rect->y+ disp_rect->h>vinfo->height)
			{
				fb_dev->osd_ctl.disp_end_y=vinfo->height- 1;
			}
			else
			{
				fb_dev->osd_ctl.disp_end_y=fb_dev->osd_ctl.disp_start_y + disp_rect->h - 1 ;
			}
			disp_rect ++;
			amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_LOW,"new disp axis: startx:%d starty:%d endx:%d endy:%d\r\n"  , \
					fb_dev->osd_ctl.disp_start_x, fb_dev->osd_ctl.disp_start_y,\
					fb_dev->osd_ctl.disp_end_x,fb_dev->osd_ctl.disp_end_y);
			console_lock();
			osddev_update_disp_axis(fb_dev,0);
			console_unlock();
		}
		
		break;
	}
	return 0;
}
示例#10
0
static int 
osd_probe(struct platform_device *pdev)
{
	int r;
       	struct fb_info *fbi=NULL;
	const vinfo_t *vinfo;
    	struct fb_var_screeninfo *var;
  	struct fb_fix_screeninfo *fix;
	struct resource *mem;
	int  index,Bpp;
	logo_object_t  *init_logo_obj=NULL;
	int  logo_osd_index=0,i;
	myfb_dev_t 	*fbdev = NULL;
	
	vout_register_client(&osd_notifier_nb);

#ifdef CONFIG_AM_LOGO
	init_logo_obj = get_current_logo_obj();
	if( init_logo_obj )
	{
		if(init_logo_obj->para.output_dev_type<LOGO_DEV_VID) //osd0 or osd1
		{
			logo_osd_index= init_logo_obj->para.output_dev_type;
		}else{
			if(init_logo_obj->para.output_dev_type==LOGO_DEV_VID)
			init_logo_obj=NULL; //if logo device on video layer ,
		}					 //we cant use it .
		
	}
#endif

   	if (NULL==init_logo_obj )
    	{
#ifdef CONFIG_AM_LCD_OUTPUT
		set_current_vmode(VMODE_LCD);
#else
    		set_current_vmode(VMODE_720P);	
#endif
		osddev_init();
    	}
	vinfo = get_current_vinfo();
    	for (index=0;index<OSD_COUNT;index++)
    	{
    		//platform resource 
		if (!(mem = platform_get_resource(pdev, IORESOURCE_MEM, index)))
		{
			amlog_level(LOG_LEVEL_HIGH,"No frame buffer memory define.\n");
			r = -EFAULT;
			goto failed2;
		}
		//if we have no resource then no need to create this device.
		amlog_level(LOG_LEVEL_HIGH,"[osd%d] 0x%x-0x%x\n",index,mem->start,mem->end);
		if (!mem || mem->start== 0 || mem->end==0 || mem->start==mem->end)
		{
			continue ;
		}
		
    		fbi = framebuffer_alloc(sizeof(struct myfb_dev), &pdev->dev);
    		if(!fbi)
    		{
        		r = -ENOMEM;
        		goto failed1;
    		}
	
		fbdev = (struct myfb_dev *)fbi->par;
		fbdev->fb_info = fbi;
		fbdev->dev = pdev;
 	
		mutex_init(&fbdev->lock);

    		var = &fbi->var;
    		fix = &fbi->fix;

		gp_fbdev_list[index]=fbdev;
		fbdev->fb_mem_paddr = mem->start;
		fbdev->fb_len = mem->end - mem->start + 1;
		fbdev->fb_mem_vaddr = ioremap_wc(fbdev->fb_mem_paddr, fbdev->fb_len);

		if (!fbdev->fb_mem_vaddr)
		{
			amlog_level(LOG_LEVEL_HIGH,"failed to ioremap framebuffer\n");
        		r = -ENOMEM;
        		goto failed1;
		}
	
		//clear framebuffer memory
		 amlog_level(LOG_LEVEL_HIGH,"Frame buffer memory assigned at phy:0x%08x, vir:0x%p, size=%dK\n",
	    	fbdev->fb_mem_paddr, fbdev->fb_mem_vaddr, fbdev->fb_len >> 10);
		 

		if(init_logo_obj && index==logo_osd_index ) //adjust default var info
		{
			int  bpp=init_logo_obj->dev->output_dev.osd.color_depth;//bytes per pixel
		
			mydef_var[index].xres=init_logo_obj->dev->vinfo->width;
			mydef_var[index].yres=init_logo_obj->dev->vinfo->height;	
			mydef_var[index].xres_virtual=init_logo_obj->dev->vinfo->width;
			mydef_var[index].yres_virtual=init_logo_obj->dev->vinfo->height<<1;//logo always use double buffer
			mydef_var[index].bits_per_pixel=bpp ;
			amlog_level(LOG_LEVEL_HIGH,"init fbdev bpp is :%d\r\n",mydef_var[index].bits_per_pixel);
			
			if(mydef_var[index].bits_per_pixel>32) 
			{
				mydef_var[index].bits_per_pixel=32;
			}
		} else {
			amlog_level(LOG_LEVEL_HIGH,"---------------clear framebuffer%d memory  \r\n",index);
			memset((char*)fbdev->fb_mem_vaddr, 0x80, fbdev->fb_len);	
		}
	
		_fbdev_set_default(fbdev,index);
		if(NULL==fbdev->color)
		{
			r = -ENOENT;
        		goto failed1;
		}
		Bpp=(fbdev->color->color_index >8?(fbdev->color->color_index>16?(fbdev->color->color_index>24?4:3):2):1);
		fix->line_length=var->xres_virtual*Bpp;
		fix->smem_start = fbdev->fb_mem_paddr;
		fix->smem_len = fbdev->fb_len;
		if (fb_alloc_cmap(&fbi->cmap, 16, 0) != 0) {
			amlog_level(LOG_LEVEL_HIGH,"unable to allocate color map memory\n");
      		r = -ENOMEM;
        	goto failed2;
    		}

		if (!(fbi->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL))) {
			amlog_level(LOG_LEVEL_HIGH,"unable to allocate pseudo palette memory\n");
        	r = -ENOMEM;
        	goto failed2;
		}
		memset(fbi->pseudo_palette, 0, sizeof(u32) * 16);

	   	fbi->fbops = &osd_ops;
    		fbi->screen_base = (char __iomem *)fbdev->fb_mem_vaddr ;
		fbi->screen_size = fix->smem_len;
		set_default_display_axis(&fbdev->fb_info->var,&fbdev->osd_ctl,vinfo);
		osd_check_var(var, fbi);
    		register_framebuffer(fbi);
		if(NULL==init_logo_obj )//if we have init a logo object ,then no need to setup hardware . 
		{
			osddev_set(fbdev);
		}
		for(i=0;i<ARRAY_SIZE(osd_attrs);i++)
		r=device_create_file(fbi->dev, &osd_attrs[i]);
		
   	}	
	
	index=0;

#ifdef CONFIG_HAS_EARLYSUSPEND
    early_suspend.level = EARLY_SUSPEND_LEVEL_STOP_DRAWING;
    early_suspend.suspend = osd_early_suspend;
    early_suspend.resume = osd_late_resume;
    register_early_suspend(&early_suspend);
#endif

	amlog_level(LOG_LEVEL_HIGH,"osd probe ok  \r\n");
	return 0;

failed2:
	fb_dealloc_cmap(&fbi->cmap);
failed1:
    	amlog_level(LOG_LEVEL_HIGH,"Driver module insert failed.\n");
   	return r;
}
示例#11
0
static int osd1_init(logo_object_t *plogo)
{
#if defined(CONFIG_AM_HDMI_ONLY)
	int hpd_state = 0;
#endif
#if defined(CONFIG_AM_HDMI_ONLY) || (MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8)
	vmode_t cur_mode = plogo->para.vout_mode;
#endif

	if(plogo->para.output_dev_type==output_osd1.idx)
	{
		DisableVideoLayer();
		if((plogo->platform_res[output_osd1.idx].mem_end - plogo->platform_res[output_osd1.idx].mem_start) ==0)
		{
			return OUTPUT_DEV_UNFOUND;
		}
		if(plogo->para.loaded)
		{
			osd_init_hw(plogo->para.loaded);
			if(plogo->para.vout_mode > VMODE_4K2K_SMPTE){
				plogo->para.vout_mode|=VMODE_LOGO_BIT_MASK;
			}
		}
#ifdef CONFIG_AM_HDMI_ONLY
		if(plogo->para.vout_mode > VMODE_4K2K_SMPTE) {
			set_current_vmode(plogo->para.vout_mode);
		}else{
			extern int read_hpd_gpio(void);
			hpd_state = read_hpd_gpio();
    		
			if (hpd_state == 0){
			    cur_mode = cvbsmode_hdmionly;
			}
			else{
			    cur_mode = hdmimode_hdmionly;
			}
			set_current_vmode(cur_mode);
		}
#else
		set_current_vmode(plogo->para.vout_mode);
#endif

#if MESON_CPU_TYPE < MESON_CPU_TYPE_MESON8
		osd_init_scan_mode();
#endif
		output_osd1.vinfo=get_current_vinfo();
		plogo->dev=&output_osd1;
		plogo->dev->window.x=0;
		plogo->dev->window.y=0;
		plogo->dev->window.w=plogo->dev->vinfo->width;
		plogo->dev->window.h=plogo->dev->vinfo->height;
		plogo->dev->output_dev.osd.mem_start=plogo->platform_res[LOGO_DEV_OSD1].mem_start;
		plogo->dev->output_dev.osd.mem_end=plogo->platform_res[LOGO_DEV_OSD1].mem_end;
		plogo->dev->output_dev.osd.color_depth=get_curr_color_depth(P_VIU_OSD2_BLK0_CFG_W0);//setup by uboot
#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8
		if((cur_mode != (plogo->para.vout_mode & VMODE_MODE_BIT_MASK)) && (cur_mode <= VMODE_4K2K_SMPTE)) {
		    set_osd_freescaler(LOGO_DEV_OSD1, plogo, cur_mode);
		}
#endif
		return OUTPUT_DEV_FOUND;
	}
	return OUTPUT_DEV_UNFOUND;
}