static int display_postregistered_callback(struct notifier_block *nb, unsigned long event, void *dev) { struct mcde_display_device *ddev = dev; u16 width, height; u16 virtual_height; struct fb_info *fbi; #if defined(CONFIG_COMPDEV) struct mcde_fb *mfb; #endif if (event != MCDE_DSS_EVENT_DISPLAY_REGISTERED) return 0; if (ddev->id < PRIMARY_DISPLAY_ID || ddev->id >= MCDE_NR_OF_DISPLAYS) return 0; mcde_dss_get_native_resolution(ddev, &width, &height); virtual_height = height * 3; /* Create frame buffer */ fbi = mcde_fb_create(ddev, width, height, width, virtual_height, ddev->default_pixel_format, FB_ROTATE_UR); if (IS_ERR(fbi)) { dev_warn(&ddev->dev, "Failed to create fb for display %s\n", ddev->name); goto display_postregistered_callback_err; } else { dev_info(&ddev->dev, "Framebuffer created (%s)\n", ddev->name); if (ddev->id == PRIMARY_DISPLAY_ID) { primary_fbi = fbi; #if defined (CONFIG_SAMSUNG_USE_GETLOG) sec_getlog_supply_fbinfo(primary_fbi); #endif } } #ifdef CONFIG_COMPDEV mfb = to_mcde_fb(fbi); /* Create a compdev overlay for this display */ if (compdev_create(ddev, mfb->ovlys[0], true, NULL) < 0) { dev_warn(&ddev->dev, "Failed to create compdev for display %s\n", ddev->name); goto display_postregistered_callback_err; } else { dev_info(&ddev->dev, "compdev created for (%s)\n", ddev->name); } #endif return 0; display_postregistered_callback_err: return -1; }
int s3cfb_alloc_framebuffer(struct s3cfb_global *fbdev, int fimd_id) { struct s3c_platform_fb *pdata = to_fb_plat(fbdev->dev); int ret = 0; int i; fbdev->fb = kmalloc(pdata->nr_wins * sizeof(struct fb_info *), GFP_KERNEL); if (!fbdev->fb) { dev_err(fbdev->dev, "not enough memory\n"); ret = -ENOMEM; goto err_alloc; } for (i = 0; i < pdata->nr_wins; i++) { fbdev->fb[i] = framebuffer_alloc(sizeof(struct s3cfb_window), fbdev->dev); if (!fbdev->fb[i]) { dev_err(fbdev->dev, "not enough memory\n"); ret = -ENOMEM; goto err_alloc_fb; } ret = s3cfb_init_fbinfo(fbdev, i); if (ret) { dev_err(fbdev->dev, "failed to allocate memory for fb%d\n", i); ret = -ENOMEM; goto err_alloc_fb; } if (i == pdata->default_win) if (s3cfb_map_default_video_memory(fbdev, fbdev->fb[i], fimd_id)) { dev_err(fbdev->dev, "failed to map video memory " "for default window (%d)\n", i); ret = -ENOMEM; goto err_alloc_fb; } sec_getlog_supply_fbinfo((void *)fbdev->fb[i]->fix.smem_start, fbdev->fb[i]->var.xres, fbdev->fb[i]->var.yres, fbdev->fb[i]->var.bits_per_pixel, 2); } return 0; err_alloc_fb: for (i = 0; i < pdata->nr_wins; i++) { if (fbdev->fb[i]) framebuffer_release(fbdev->fb[i]); } kfree(fbdev->fb); err_alloc: return ret; }
static void setup_fb_info(struct sprdfb_device *dev) { struct fb_info *fb = dev->fb; struct panel_spec *panel = dev->panel; int r; fb->fbops = &sprdfb_ops; fb->flags = FBINFO_DEFAULT; /* finish setting up the fb_info struct */ strncpy(fb->fix.id, "sprdfb", 16); fb->fix.ypanstep = 1; fb->fix.type = FB_TYPE_PACKED_PIXELS; fb->fix.visual = FB_VISUAL_TRUECOLOR; #ifdef CONFIG_FB_LOW_RES_SIMU if((0 != dev->display_width) && (0 != dev->display_height)){ fb->fix.line_length = dev->display_width * dev->bpp / 8; fb->var.xres = dev->display_width; fb->var.yres = dev->display_height; fb->var.width = dev->display_width; fb->var.height = dev->display_height; fb->var.xres_virtual = dev->display_width; fb->var.yres_virtual = dev->display_height * FRAMEBUFFER_NR; }else #endif { fb->fix.line_length = panel->width * dev->bpp / 8; fb->var.xres = panel->width; fb->var.yres = panel->height; fb->var.width = panel->display_width; fb->var.height = panel->display_height; fb->var.xres_virtual = panel->width; fb->var.yres_virtual = panel->height * FRAMEBUFFER_NR; } fb->var.bits_per_pixel = dev->bpp; #ifdef CONFIG_FB_LOW_RES_SIMU if((0 != dev->display_width) && (0 != dev->display_height)){ if(0 != dev->panel->fps){ fb->var.pixclock = ((1000000000 /dev->display_width) * 1000) / (dev->panel->fps * dev->display_height); }else{ fb->var.pixclock = ((1000000000 /dev->display_width) * 1000) / (SPRDFB_DEFAULT_FPS * dev->display_height); } }else #endif { if(0 != dev->panel->fps){ fb->var.pixclock = ((1000000000 /panel->width) * 1000) / (dev->panel->fps * panel->height); }else{ fb->var.pixclock = ((1000000000 /panel->width) * 1000) / (SPRDFB_DEFAULT_FPS * panel->height); } } fb->var.accel_flags = 0; fb->var.yoffset = 0; /* only support two pixel format */ if (dev->bpp == 32) { /* ABGR */ fb->var.red.offset = 16; fb->var.red.length = 8; fb->var.red.msb_right = 0; fb->var.green.offset = 8; fb->var.green.length = 8; fb->var.green.msb_right = 0; fb->var.blue.offset = 0; fb->var.blue.length = 8; fb->var.blue.msb_right = 0; } else { /*BGR*/ fb->var.red.offset = 11; fb->var.red.length = 5; fb->var.red.msb_right = 0; fb->var.green.offset = 5; fb->var.green.length = 6; fb->var.green.msb_right = 0; fb->var.blue.offset = 0; fb->var.blue.length = 5; fb->var.blue.msb_right = 0; } r = fb_alloc_cmap(&fb->cmap, 16, 0); fb->pseudo_palette = PP; PP[0] = 0; for (r = 1; r < 16; r++){ PP[r] = 0xffffffff; } #if defined(CONFIG_SEC_DEBUG) /*{{ Mark for GetLog*/ sec_getlog_supply_fbinfo(phys_to_virt(fb->fix.smem_start) , \ fb->var.xres, fb->var.yres, \ fb->var.bits_per_pixel, \ dev->framebuffer_nr); #endif }