static ssize_t disp_fps_show(struct device *dev, struct device_attribute *attr, char *buf) { __u32 screen_fps = bsp_disp_get_fps(sel); return sprintf(buf, "screen%d fps=%d.%d\n", sel, screen_fps/10,screen_fps%10); }
static ssize_t disp_video_fps_show(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "screen_id %d : %dHZ\n", sel, bsp_disp_get_fps(sel)); }
static ssize_t disp_sys_status_show(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t count = 0; int num_screens, screen_id; int num_layers, layer_id; num_screens = bsp_disp_feat_get_num_screens(); for(screen_id=0; screen_id < num_screens; screen_id ++) { count += sprintf(buf + count, "screen %d:\n", screen_id); /* output */ if(bsp_disp_get_output_type(screen_id) == DISP_OUTPUT_TYPE_LCD) { count += sprintf(buf + count, "\tlcd output\tbacklight(%3d)", bsp_disp_lcd_get_bright(screen_id)); } else if(bsp_disp_get_output_type(screen_id) == DISP_OUTPUT_TYPE_HDMI) { count += sprintf(buf + count, "\thdmi output"); if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_720P_50HZ) { count += sprintf(buf + count, "%16s", "720p50hz"); } else if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_720P_60HZ) { count += sprintf(buf + count, "%16s", "720p60hz"); } else if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_1080P_60HZ) { count += sprintf(buf + count, "%16s", "1080p60hz"); } else if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_1080P_50HZ) { count += sprintf(buf + count, "%16s", "1080p50hz"); } else if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_1080I_50HZ) { count += sprintf(buf + count, "%16s", "1080i50hz"); } else if(bsp_disp_hdmi_get_mode(screen_id) == DISP_TV_MOD_1080I_60HZ) { count += sprintf(buf + count, "%16s", "1080i60hz"); } } if(bsp_disp_get_output_type(screen_id) != DISP_OUTPUT_TYPE_NONE) { count += sprintf(buf + count, "\t%4dx%4d", bsp_disp_get_screen_width(screen_id), bsp_disp_get_screen_height(screen_id)); count += sprintf(buf + count, "\tfps(%3d.%1d)", bsp_disp_get_fps(screen_id)/10, bsp_disp_get_fps(screen_id)%10); count += sprintf(buf + count, "\n"); } /* hdmi hpd */ if((bsp_disp_feat_get_supported_output_types(screen_id) & DISP_OUTPUT_TYPE_HDMI)) { int hpd; hpd = bsp_disp_hdmi_get_hpd_status(screen_id); count += sprintf(buf + count, "\t%11s\n", hpd? "hdmi plugin":"hdmi unplug"); } count += sprintf(buf + count, " type | status | id | pipe | z | pre_mult | alpha | colorkey | format | framebuffer | source crop | frame | trd | address\n"); count += sprintf(buf + count, "----------+---------+----+------+---+----------+------------+----------+----------+-------------+-----------------------+-----------------------+---------+-----------------------------\n"); num_layers = bsp_disp_feat_get_num_layers(screen_id); /* layer info */ for(layer_id=0; layer_id<num_layers; layer_id++) { __disp_layer_info_t layer_para; int ret; ret = bsp_disp_layer_get_para(screen_id, IDTOHAND(layer_id), &layer_para); if(ret == 0) { count += sprintf(buf + count, " %8s |", (layer_para.mode == DISP_LAYER_WORK_MODE_SCALER)? "SCALER":"NORAML"); count += sprintf(buf + count, " %7s |", bsp_disp_layer_is_open(screen_id, IDTOHAND(layer_id))?"enable":"disable"); count += sprintf(buf + count, " %2d |", layer_id); count += sprintf(buf + count, " %4d |", layer_para.pipe); count += sprintf(buf + count, " %1d |", layer_para.prio); count += sprintf(buf + count, " %8s |", (layer_para.fb.pre_multiply)? "Y":"N"); count += sprintf(buf + count, " %5s(%3d) |", (layer_para.alpha_en)? "globl":"pixel", layer_para.alpha_val); count += sprintf(buf + count, " %8s |", (layer_para.ck_enable)? "enable":"disable"); count += sprintf(buf + count, " %2d,%2d,%2d |", layer_para.fb.mode, layer_para.fb.format, layer_para.fb.seq); count += sprintf(buf + count, " [%4d,%4d] |", layer_para.fb.size.width, layer_para.fb.size.height); count += sprintf(buf + count, " [%4d,%4d,%4d,%4d] |", layer_para.src_win.x, layer_para.src_win.y, layer_para.src_win.width, layer_para.src_win.height); count += sprintf(buf + count, " [%4d,%4d,%4d,%4d] |", layer_para.scn_win.x, layer_para.scn_win.y, layer_para.scn_win.width, layer_para.scn_win.height); count += sprintf(buf + count, " [%1d%1d,%1d%1d] |", layer_para.fb.b_trd_src, layer_para.fb.trd_mode, layer_para.b_trd_out, layer_para.out_trd_mode); count += sprintf(buf + count, " [%8x,%8x,%8x]", layer_para.fb.addr[0], layer_para.fb.addr[1], layer_para.fb.addr[2]); count += sprintf(buf + count, "\n"); } } if(bsp_disp_feat_get_smart_backlight_support(screen_id)) { __disp_rect_t window; count += sprintf(buf + count, "\n\tsmart backlight: %s", bsp_disp_drc_get_enable(screen_id)? "enable":"disable"); if(bsp_disp_drc_get_enable(screen_id)) { bsp_disp_drc_get_window(screen_id, &window); count += sprintf(buf + count, "\twindow[%4d,%4d,%4d,%4d]", window.x, window.y, window.width, window.height); } count += sprintf(buf + count, "\n"); } } return count; }
static void dispdbg_process(void) { int start = simple_strtoul(dispdbg_priv.start,NULL,0); if(start != 1) return ; if(!strncmp(dispdbg_priv.name,"layer",5)) { char *p = dispdbg_priv.name + 5; int disp,chan,id; struct disp_layer *lyr = NULL; printk("%s,%s\n", dispdbg_priv.command, dispdbg_priv.name); disp = (unsigned int)simple_strtoul(p, &p, 10); p++; chan = (unsigned int)simple_strtoul(p, &p, 10); p++; id = (unsigned int)simple_strtoul(p, &p, 10); lyr = disp_get_layer(disp, chan, id); if(NULL == lyr) { sprintf(dispdbg_priv.info,"get %s fail!", dispdbg_priv.name); return ; } if(!strncmp(dispdbg_priv.command,"enable",6)) { //lyr->enable(lyr); } else if(!strncmp(dispdbg_priv.command,"disable",7)) { //lyr->disable(lyr); } else if(!strncmp(dispdbg_priv.command,"getinfo",7)) { lyr->dump(lyr, dispdbg_priv.info); } else { sprintf(dispdbg_priv.info,"not support command for %s!", dispdbg_priv.name); return ; } } else if(!strncmp(dispdbg_priv.name,"lcd",3)) { char *p = dispdbg_priv.name + 3; int disp; struct disp_device *lcd = NULL; disp = (unsigned int)simple_strtoul(p, &p, 10); lcd = disp_get_lcd(disp); if(NULL == lcd) { sprintf(dispdbg_priv.info,"get %s fail!", dispdbg_priv.name); return ; } if(!strncmp(dispdbg_priv.command,"enable",6)) { lcd->enable(lcd); } else if(!strncmp(dispdbg_priv.command,"disable",7)) { lcd->disable(lcd); } else if(!strncmp(dispdbg_priv.command,"setbl",6)) { int bl = (unsigned int)simple_strtoul(dispdbg_priv.param, NULL, 10); if(lcd->set_bright) lcd->set_bright(lcd, bl); else sprintf(dispdbg_priv.info,"set lcd%d backlight fail", disp); } else if(!strncmp(dispdbg_priv.command,"getbl",5)) { int bl; if(lcd->get_bright) { bl = lcd->get_bright(lcd); sprintf(dispdbg_priv.info,"%d", bl); } else sprintf(dispdbg_priv.info,"get lcd%d backlight fail", disp); } else { sprintf(dispdbg_priv.info,"not support command for %s!", dispdbg_priv.name); return ; } } else if(!strncmp(dispdbg_priv.name,"disp",4)) { char *p = dispdbg_priv.name + 4; int disp; char* next; char* tosearch; struct disp_manager *mgr = NULL; disp = (unsigned int)simple_strtoul(p, &p, 10); mgr = disp_get_layer_manager(disp); if(NULL == mgr) { sprintf(dispdbg_priv.info,"get %s fail!", dispdbg_priv.name); return ; } if(!strncmp(dispdbg_priv.command,"getinfo",7)) { mgr->dump(mgr, dispdbg_priv.info); } else if(!strncmp(dispdbg_priv.command,"switch",6)) { u32 type,mode; tosearch = dispdbg_priv.param; next = strsep(&tosearch, " "); type = simple_strtoul(next,NULL,0); next = strsep(&tosearch, " "); mode = simple_strtoul(next,NULL,0); printk("disp %d, type %d, mode%d\n", disp, type, mode); bsp_disp_device_switch(disp, type, mode); } else if(!strncmp(dispdbg_priv.command,"blank",5)) { u32 level; struct disp_device *dispdev = mgr->device; if(NULL == dispdev) { sprintf(dispdbg_priv.info,"get device fail for disp %d!", disp); return ; } level = simple_strtoul(dispdbg_priv.param,NULL,0); printk("disp %d, blank%d\n", disp, level); if(0 == level) dispdev->enable(dispdev); else dispdev->disable(dispdev); } else if(!strncmp(dispdbg_priv.command,"getxres",7)) { u32 width, height; struct disp_device *dispdev = mgr->device; if(NULL == dispdev) { sprintf(dispdbg_priv.info,"get device fail for disp %d!", disp); return ; } dispdev->get_resolution(dispdev, &width, &height); sprintf(dispdbg_priv.info,"%d", width); } else if(!strncmp(dispdbg_priv.command,"getyres",7)) { u32 width, height; struct disp_device *dispdev = mgr->device; if(NULL == dispdev) { sprintf(dispdbg_priv.info,"get device fail for disp %d!", disp); return ; } dispdev->get_resolution(dispdev, &width, &height); sprintf(dispdbg_priv.info,"%d", height); } else if(!strncmp(dispdbg_priv.command,"getfps",6)) { u32 fps = bsp_disp_get_fps(disp); u32 count = 0; count = sprintf(dispdbg_priv.info,"device:%d.%d fps\n", fps/10, fps%10); composer_dump(dispdbg_priv.info+count); } #if defined(SUPPORT_TV) else if(!strncmp(dispdbg_priv.command,"suspend",7)) { //dispdev = disp_device_get(dispdev, DISP_OUTPUT_TYPE_TV); if(mgr->device) { if((DISP_OUTPUT_TYPE_TV == mgr->device->type)) { disp_tv_suspend(mgr->device); } } } else if(!strncmp(dispdbg_priv.command,"resume",6)) { //dispdev = disp_device_get(dispdev, DISP_OUTPUT_TYPE_TV); if(mgr->device) { if((DISP_OUTPUT_TYPE_TV == mgr->device->type)) { disp_tv_resume(mgr->device); } } } #endif else { sprintf(dispdbg_priv.info,"not support command for %s!", dispdbg_priv.name); return ; } } else if(!strncmp(dispdbg_priv.name,"enhance",7)) { char *p = dispdbg_priv.name + 7; int disp; char* next; char* tosearch; struct disp_manager *mgr = NULL; struct disp_enhance *enhance = NULL; disp_enhance_para para; memset(¶, 0, sizeof(disp_enhance_para)); disp = (unsigned int)simple_strtoul(p, &p, 10); mgr = disp_get_layer_manager(disp); if(NULL == mgr) { sprintf(dispdbg_priv.info,"get %s fail!", dispdbg_priv.name); return ; } enhance = mgr->enhance; if(NULL == enhance) { sprintf(dispdbg_priv.info,"get %s fail!", dispdbg_priv.name); return ; } if(!strncmp(dispdbg_priv.command,"setinfo",7)) { /* en */ tosearch = dispdbg_priv.param; next = strsep(&tosearch, " "); para.enable = simple_strtoul(next,NULL,0); /* mode */ next = strsep(&tosearch, " "); para.mode = simple_strtoul(next,NULL,0); /* bright/contrast/saturation/hue */ next = strsep(&tosearch, " "); para.bright = simple_strtoul(next,NULL,0); next = strsep(&tosearch, " "); para.contrast = simple_strtoul(next,NULL,0); next = strsep(&tosearch, " "); para.saturation = simple_strtoul(next,NULL,0); next = strsep(&tosearch, " "); para.hue = simple_strtoul(next,NULL,0); /* sharp */ next = strsep(&tosearch, " "); para.sharp = simple_strtoul(next,NULL,0); /* auto color */ next = strsep(&tosearch, " "); para.auto_contrast = simple_strtoul(next,NULL,0); next = strsep(&tosearch, " "); para.auto_color = simple_strtoul(next,NULL,0); /* fancycolor */ next = strsep(&tosearch, " "); para.fancycolor_red = simple_strtoul(next,NULL,0); next = strsep(&tosearch, " "); para.fancycolor_green = simple_strtoul(next,NULL,0); next = strsep(&tosearch, " "); para.fancycolor_blue = simple_strtoul(next,NULL,0); /* window */ next = strsep(&tosearch, " "); if(!strncmp(next,"win",3)) { next = strsep(&tosearch, " "); para.window.x = simple_strtoul(next,NULL,0); next = strsep(&tosearch, " "); para.window.y = simple_strtoul(next,NULL,0); next = strsep(&tosearch, " "); para.window.width = simple_strtoul(next,NULL,0); next = strsep(&tosearch, " "); para.window.height = simple_strtoul(next,NULL,0); } printk("enhance %d, en(%d), mode(%d), bcsh(%d,%d,%d,%d), sharp(%d), autocolor(%d,%d), fancycolor(%d,%d,%d)\n", disp, para.enable, para.mode, para.bright, para.contrast, para.saturation, para.hue, para.sharp, para.auto_contrast, para.auto_color, para.fancycolor_red, para.fancycolor_green, para.fancycolor_blue); enhance->set_para(enhance, ¶); } else if(!strncmp(dispdbg_priv.command,"getinfo",7)) { if(enhance->dump) enhance->dump(enhance, dispdbg_priv.info); } else { sprintf(dispdbg_priv.info,"not support command for %s!", dispdbg_priv.name); return ; } } else if(!strncmp(dispdbg_priv.name,"smbl",4)) { char *p = dispdbg_priv.name + 4; int disp; struct disp_manager *mgr = NULL; struct disp_smbl *smbl = NULL; disp = (unsigned int)simple_strtoul(p, &p, 10); mgr = disp_get_layer_manager(disp); if(NULL == mgr) { sprintf(dispdbg_priv.info,"get %s fail!", dispdbg_priv.name); return ; } smbl = mgr->smbl; if(NULL == smbl) { sprintf(dispdbg_priv.info,"get %s fail!", dispdbg_priv.name); return ; } if(!strncmp(dispdbg_priv.command,"setinfo",7)) { } else if(!strncmp(dispdbg_priv.command,"getinfo",7)) { if(smbl->dump) smbl->dump(smbl, dispdbg_priv.info); } else { sprintf(dispdbg_priv.info,"not support command for %s!", dispdbg_priv.name); return ; } } else if(!strncmp(dispdbg_priv.name,"hdmi",4)) { char *p = dispdbg_priv.name + 4; int disp; unsigned int mode; disp = (unsigned int)simple_strtoul(p, &p, 10); if(!strncmp(dispdbg_priv.command,"is_support",10)) { int is_support = 0; mode = (unsigned int)simple_strtoul(dispdbg_priv.param, NULL, 10); is_support = bsp_disp_hdmi_check_support_mode(disp, (disp_tv_mode)mode); sprintf(dispdbg_priv.info,"%d", is_support); } else { sprintf(dispdbg_priv.info,"not support command for %s!", dispdbg_priv.name); return ; } } }