示例#1
0
static void osd_clone_process(void)
{
	canvas_t cs, cd;
	u32 x0 = 0;
	u32 y0 = 0;
	u32 y1 = 0;
	unsigned char x_rev = 0;
	unsigned char y_rev = 0;
	unsigned char xy_swap = 0;
	config_para_ex_t *ge2d_config = &s_osd_clone.ge2d_config;
	ge2d_context_t *context = s_osd_clone.ge2d_context;

	canvas_read(OSD1_CANVAS_INDEX, &cs);
	canvas_read(OSD3_CANVAS_INDEX, &cd);

	if (s_osd_clone.pan == 1) {
		y0 = cs.height/2;
		y1 = cd.height/2;
	}

	if (s_osd_clone.angle == 1) {
		xy_swap = 1;
		x_rev = 1;
	} else if (s_osd_clone.angle == 2) {
		x_rev = 1;
		y_rev = 1;
	} else if (s_osd_clone.angle == 3) {
		xy_swap = 1;
		y_rev = 1;
	}

	memset(ge2d_config, 0, sizeof(config_para_ex_t));
	ge2d_config->alu_const_color = 0;
	ge2d_config->bitmask_en = 0;
	ge2d_config->src1_gb_alpha = 0;
	ge2d_config->dst_xy_swap = 0;

	ge2d_config->src_planes[0].addr = cs.addr;
	ge2d_config->src_planes[0].w = cs.width/4;
	ge2d_config->src_planes[0].h = cs.height;

	ge2d_config->dst_planes[0].addr = cd.addr;
	ge2d_config->dst_planes[0].w = cd.width/4;
	ge2d_config->dst_planes[0].h = cd.height;

	ge2d_config->src_para.canvas_index = OSD1_CANVAS_INDEX;
	ge2d_config->src_para.mem_type = CANVAS_OSD0;
	ge2d_config->dst_para.mem_type = CANVAS_TYPE_INVALID;
	ge2d_config->dst_para.format = GE2D_FORMAT_S32_ARGB;
	ge2d_config->src_para.fill_color_en = 0;
	ge2d_config->src_para.fill_mode = 0;
	ge2d_config->src_para.x_rev = 0;
	ge2d_config->src_para.y_rev = 0;
	ge2d_config->src_para.color = 0xffffffff;
	ge2d_config->src_para.top = 0;
	ge2d_config->src_para.left = 0;
	ge2d_config->src_para.width = cs.width/4;
	ge2d_config->src_para.height = cs.height;

	ge2d_config->dst_para.canvas_index = OSD3_CANVAS_INDEX;
	ge2d_config->dst_para.mem_type = CANVAS_TYPE_INVALID;
	ge2d_config->dst_para.format = GE2D_FORMAT_S32_ARGB;
	ge2d_config->dst_para.top = 0;
	ge2d_config->dst_para.left = 0;
	ge2d_config->dst_para.width = cd.width/4;
	ge2d_config->dst_para.height = cd.height;
	ge2d_config->dst_para.fill_color_en = 0;
	ge2d_config->dst_para.fill_mode = 0;
	ge2d_config->dst_para.color = 0;
	ge2d_config->dst_para.x_rev = x_rev;
	ge2d_config->dst_para.y_rev = y_rev;
	ge2d_config->dst_xy_swap = xy_swap;

	if (ge2d_context_config_ex(context, ge2d_config) < 0) {
		printk("++ osd clone ge2d config error.\n");
		return;
	}
	stretchblt_noalpha(context, x0, y0, cs.width/4, cs.height/2, x0, y1, cd.width/4, cd.height/2);
}
示例#2
0
文件: sqlcanvas.C 项目: MycrofD/root
void sqlcanvas()
{
   canvas_write();
   canvas_read();
}
示例#3
0
/*for decoder input processing
    1. output window should 1:1 as source frame size
    2. keep the frame ratio
    3. input format should be YUV420 , output format should be YUV444
*/
int vm_ge2d_pre_process(vframe_t* vf, ge2d_context_t *context,config_para_ex_t* ge2d_config)
{
	int ret;
	int src_top ,src_left ,src_width, src_height;
    canvas_t cs0,cs1,cs2,cd;
    int current_mirror = camera_mirror_flag;
    display_frame_t input_frame={0};
    ret = get_input_frame(&input_frame , vf);
	src_top =     input_frame.content_top   ;
	src_left =    input_frame.content_left  ;
	src_width =   input_frame.content_width ;
	src_height =  input_frame.content_height;
	if(test_zoom){
		test_zoom = 0;
		printk("top is %d , left is %d , width is %d , height is %d\n",input_frame.content_top ,input_frame.content_left,input_frame.content_width,input_frame.content_height);
	}
    /* data operating. */ 
    ge2d_config->alu_const_color= 0;//0x000000ff;
    ge2d_config->bitmask_en  = 0;
    ge2d_config->src1_gb_alpha = 0;//0xff;
    ge2d_config->dst_xy_swap = 0;

    canvas_read(vf->canvas0Addr&0xff,&cs0);
    canvas_read((vf->canvas0Addr>>8)&0xff,&cs1);
    canvas_read((vf->canvas0Addr>>16)&0xff,&cs2);
    ge2d_config->src_planes[0].addr = cs0.addr;
    ge2d_config->src_planes[0].w = cs0.width;
    ge2d_config->src_planes[0].h = cs0.height;
    ge2d_config->src_planes[1].addr = cs1.addr;
    ge2d_config->src_planes[1].w = cs1.width;
    ge2d_config->src_planes[1].h = cs1.height;
    ge2d_config->src_planes[2].addr = cs2.addr;
    ge2d_config->src_planes[2].w = cs2.width;
    ge2d_config->src_planes[2].h = cs2.height;
    canvas_read(output_para.index&0xff,&cd);
    ge2d_config->dst_planes[0].addr = cd.addr;
    ge2d_config->dst_planes[0].w = cd.width;
    ge2d_config->dst_planes[0].h = cd.height;
    ge2d_config->src_key.key_enable = 0;
    ge2d_config->src_key.key_mask = 0;
    ge2d_config->src_key.key_mode = 0;
    ge2d_config->src_para.canvas_index=vf->canvas0Addr;
    ge2d_config->src_para.mem_type = CANVAS_TYPE_INVALID;
    ge2d_config->src_para.format = get_input_format(vf);
    ge2d_config->src_para.fill_color_en = 0;
    ge2d_config->src_para.fill_mode = 0;
    ge2d_config->src_para.x_rev = 0;
    ge2d_config->src_para.y_rev = 0;
    ge2d_config->src_para.color = 0xffffffff;
    ge2d_config->src_para.top = 0;
    ge2d_config->src_para.left = 0;
    ge2d_config->src_para.width = vf->width;
    ge2d_config->src_para.height = vf->height;
//    printk("vf_width is %d , vf_height is %d \n",vf->width ,vf->height);
    ge2d_config->src2_para.mem_type = CANVAS_TYPE_INVALID;
    ge2d_config->dst_para.canvas_index=output_para.index&0xff;
    ge2d_config->dst_para.mem_type = CANVAS_TYPE_INVALID;
    ge2d_config->dst_para.format = get_output_format(output_para.v4l2_format)|GE2D_LITTLE_ENDIAN;     
    
  
    ge2d_config->dst_para.fill_color_en = 0;
    ge2d_config->dst_para.fill_mode = 0;
    ge2d_config->dst_para.x_rev = 0;
    ge2d_config->dst_para.y_rev = 0;
    ge2d_config->dst_para.color = 0;
    ge2d_config->dst_para.top = 0;
    ge2d_config->dst_para.left = 0;
    ge2d_config->dst_para.width = output_para.width;
    ge2d_config->dst_para.height = output_para.height;

    if(current_mirror==1){
        ge2d_config->dst_para.x_rev = 1;
        ge2d_config->dst_para.y_rev = 0;
    }else if(current_mirror==2){
        ge2d_config->dst_para.x_rev = 0;
        ge2d_config->dst_para.y_rev = 1;
    }else{
        ge2d_config->dst_para.x_rev = 0;
        ge2d_config->dst_para.y_rev = 0;
    }

//    printk("output_width is %d , output_height is %d \n",output_para.width ,output_para.height);
    if(ge2d_context_config_ex(context,ge2d_config)<0) {
        printk("++ge2d configing error.\n");
        return -1;
    }              
    stretchblt_noalpha(context,src_left ,src_top ,src_width, src_height,0,0,output_para.width,output_para.height);
    
    /* for cr of  yuv420p or yuv420sp. */
    if(output_para.v4l2_format==V4L2_PIX_FMT_YUV420) {
		/* for cb. */
		canvas_read((output_para.index>>8)&0xff,&cd);
		ge2d_config->dst_planes[0].addr = cd.addr;
		ge2d_config->dst_planes[0].w = cd.width;
		ge2d_config->dst_planes[0].h = cd.height;
		ge2d_config->dst_para.canvas_index=(output_para.index>>8)&0xff;
		ge2d_config->dst_para.format=GE2D_FORMAT_S8_CB|GE2D_LITTLE_ENDIAN;
		ge2d_config->dst_para.width = output_para.width/2;
		ge2d_config->dst_para.height = output_para.height/2;

                if(current_mirror==1){
                    ge2d_config->dst_para.x_rev = 1;
                    ge2d_config->dst_para.y_rev = 0;
                }else if(current_mirror==2){
                    ge2d_config->dst_para.x_rev = 0;
                    ge2d_config->dst_para.y_rev = 1;
                }else{
                    ge2d_config->dst_para.x_rev = 0;
                    ge2d_config->dst_para.y_rev = 0;
                }

		if(ge2d_context_config_ex(context,ge2d_config)<0) {
			printk("++ge2d configing error.\n");
			return -1;
		}
		stretchblt_noalpha(context,src_left ,src_top ,src_width, src_height,0,0,ge2d_config->dst_para.width,ge2d_config->dst_para.height);
	} else if (output_para.v4l2_format==V4L2_PIX_FMT_NV12||
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;
}
示例#5
0
static void osd_antiflicker_process(void)
{
	canvas_t cs, cd;
	u32 x0 = 0;
	u32 y0 = 0;
	u32 y1 = 0;

	config_para_ex_t *ge2d_config = &ge2d_osd_antiflicker.ge2d_config;
	ge2d_context_t *context = ge2d_osd_antiflicker.ge2d_context;

	canvas_read(OSD1_CANVAS_INDEX, &cs);
	canvas_read(OSD2_CANVAS_INDEX, &cd);

	if (ge2d_osd_antiflicker.pan == 1) {
		y0 = cs.height/2;
		//y1 = cd.height/2;
	}

	memset(ge2d_config, 0, sizeof(config_para_ex_t));
	ge2d_config->alu_const_color = 0;
	ge2d_config->bitmask_en = 0;
	ge2d_config->src1_gb_alpha = 0;

	ge2d_config->src_planes[0].addr = cs.addr;
	ge2d_config->src_planes[0].w = cs.width/4;
	ge2d_config->src_planes[0].h = cs.height;

	ge2d_config->dst_planes[0].addr = cd.addr;
	ge2d_config->dst_planes[0].w = cd.width/4;
	ge2d_config->dst_planes[0].h = cd.height;

	ge2d_config->src_para.canvas_index = OSD1_CANVAS_INDEX;
	ge2d_config->src_para.mem_type = CANVAS_OSD0;
	ge2d_config->dst_para.format = GE2D_FORMAT_S32_ARGB;
	ge2d_config->src_para.fill_color_en = 0;
	ge2d_config->src_para.fill_mode = 0;
	ge2d_config->src_para.x_rev = 0;
	ge2d_config->src_para.y_rev = 0;
	ge2d_config->src_para.color = 0xffffffff;
	ge2d_config->src_para.top = 0;
	ge2d_config->src_para.left = 0;
	ge2d_config->src_para.width = cs.width/4;
	ge2d_config->src_para.height = cs.height;

	ge2d_config->dst_para.canvas_index = OSD2_CANVAS_INDEX;
	ge2d_config->dst_para.mem_type = CANVAS_OSD1;
	ge2d_config->dst_para.format = GE2D_FORMAT_S32_ARGB;
	ge2d_config->dst_para.top = 0;
	ge2d_config->dst_para.left = 0;
	ge2d_config->dst_para.width = cd.width/4;
	ge2d_config->dst_para.height = cd.height;
	ge2d_config->dst_para.fill_color_en = 0;
	ge2d_config->dst_para.fill_mode = 0;
	ge2d_config->dst_para.color = 0;
	ge2d_config->dst_para.x_rev = 0;
	ge2d_config->dst_para.y_rev = 0;
	ge2d_config->dst_xy_swap = 0;

	if (ge2d_context_config_ex(context, ge2d_config) < 0) {
		printk("++ osd antiflicker ge2d config error.\n");
		return;
	}
	stretchblt(context, x0, y0, cs.width/4, cs.height/2, x0, y1, cd.width/4, cd.height);
}