int bochs_fbdev_init(struct bochs_device *bochs) { int ret; drm_fb_helper_prepare(bochs->dev, &bochs->fb.helper, &bochs_fb_helper_funcs); ret = drm_fb_helper_init(bochs->dev, &bochs->fb.helper, 1, 1); if (ret) return ret; ret = drm_fb_helper_single_add_all_connectors(&bochs->fb.helper); if (ret) goto fini; drm_helper_disable_unused_functions(bochs->dev); ret = drm_fb_helper_initial_config(&bochs->fb.helper, 32); if (ret) goto fini; bochs->fb.initialized = true; return 0; fini: drm_fb_helper_fini(&bochs->fb.helper); return ret; }
int evdi_fbdev_init(struct drm_device *dev) { struct evdi_device *evdi = dev->dev_private; struct evdi_fbdev *ufbdev; int ret; ufbdev = kzalloc(sizeof(struct evdi_fbdev), GFP_KERNEL); if (!ufbdev) { return -ENOMEM; } #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) drm_fb_helper_prepare(dev, &ufbdev->helper, &evdi_fb_helper_funcs); #else evdi->fbdev = ufbdev; ufbdev->helper.funcs = &evdi_fb_helper_funcs; #endif ret = drm_fb_helper_init(dev, &ufbdev->helper, 1, 1); if (ret) { kfree(ufbdev); return ret; } drm_fb_helper_single_add_all_connectors(&ufbdev->helper); /* disable all the possible outputs/crtcs before entering KMS mode */ drm_helper_disable_unused_functions(dev); drm_fb_helper_initial_config(&ufbdev->helper, 32); return 0; }
int virtio_gpu_fbdev_init(struct virtio_gpu_device *vgdev) { struct virtio_gpu_fbdev *vgfbdev; int bpp_sel = 32; /* TODO: parameter from somewhere? */ int ret; vgfbdev = kzalloc(sizeof(struct virtio_gpu_fbdev), GFP_KERNEL); if (!vgfbdev) return -ENOMEM; vgfbdev->vgdev = vgdev; vgdev->vgfbdev = vgfbdev; INIT_DELAYED_WORK(&vgfbdev->work, virtio_gpu_fb_dirty_work); drm_fb_helper_prepare(vgdev->ddev, &vgfbdev->helper, &virtio_gpu_fb_helper_funcs); ret = drm_fb_helper_init(vgdev->ddev, &vgfbdev->helper, VIRTIO_GPUFB_CONN_LIMIT); if (ret) { kfree(vgfbdev); return ret; } drm_fb_helper_single_add_all_connectors(&vgfbdev->helper); drm_fb_helper_initial_config(&vgfbdev->helper, bpp_sel); return 0; }
static struct hisi_drm_fbdev *hisi_drm_fbdev_create(struct drm_device *dev, unsigned int preferred_bpp, unsigned int num_crtc, unsigned int max_conn_count) { struct hisi_drm_fbdev *fbdev; struct drm_fb_helper *helper; int ret; DRM_DEBUG_DRIVER("enter, dev=%p, preferred_bpp=%d, num_crtc=%d .\n", dev, preferred_bpp, num_crtc); fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); if (!fbdev) { dev_err(dev->dev, "Failed to allocate drm fbdev.\n"); return ERR_PTR(-ENOMEM); } helper = &fbdev->fb_helper; drm_fb_helper_prepare(dev, helper, &hisi_fb_helper_funcs); ret = drm_fb_helper_init(dev, helper, num_crtc, max_conn_count); if (ret < 0) { dev_err(dev->dev, "Failed to initialize drm fb helper.\n"); goto err_free; } ret = drm_fb_helper_single_add_all_connectors(helper); if (ret < 0) { dev_err(dev->dev, "Failed to add connectors.\n"); goto err_drm_fb_helper_fini; } /* disable all the possible outputs/crtcs before entering KMS mode */ drm_helper_disable_unused_functions(dev); ret = drm_fb_helper_initial_config(helper, preferred_bpp); if (ret < 0) { dev_err(dev->dev, "Failed to set initial hw configuration.\n"); goto err_drm_fb_helper_fini; } DRM_DEBUG_DRIVER("exit successfully.\n"); return fbdev; err_drm_fb_helper_fini: drm_fb_helper_fini(helper); err_free: kfree(fbdev); return ERR_PTR(ret); }
int radeon_fbdev_init(struct radeon_device *rdev) { struct radeon_fbdev *rfbdev; int bpp_sel = 32; int ret; /* don't enable fbdev if no connectors */ if (list_empty(&rdev->ddev->mode_config.connector_list)) return 0; /* select 8 bpp console on 8MB cards, or 16 bpp on RN50 or 32MB */ if (rdev->mc.real_vram_size <= (8*1024*1024)) bpp_sel = 8; else if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024)) bpp_sel = 16; rfbdev = kzalloc(sizeof(struct radeon_fbdev), GFP_KERNEL); if (!rfbdev) return -ENOMEM; rfbdev->rdev = rdev; rdev->mode_info.rfbdev = rfbdev; drm_fb_helper_prepare(rdev->ddev, &rfbdev->helper, &radeon_fb_helper_funcs); ret = drm_fb_helper_init(rdev->ddev, &rfbdev->helper, RADEONFB_CONN_LIMIT); if (ret) goto free; ret = drm_fb_helper_single_add_all_connectors(&rfbdev->helper); if (ret) goto fini; /* disable all the possible outputs/crtcs before entering KMS mode */ drm_helper_disable_unused_functions(rdev->ddev); ret = drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); if (ret) goto fini; return 0; fini: drm_fb_helper_fini(&rfbdev->helper); free: kfree(rfbdev); return ret; }
static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm) { struct tegra_fbdev *fbdev; fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); if (!fbdev) { dev_err(drm->dev, "failed to allocate DRM fbdev\n"); return ERR_PTR(-ENOMEM); } drm_fb_helper_prepare(drm, &fbdev->base, &tegra_fb_helper_funcs); return fbdev; }
int amdgpu_fbdev_init(struct amdgpu_device *adev) { struct amdgpu_fbdev *rfbdev; int bpp_sel = 32; int ret; /* don't init fbdev on hw without DCE */ if (!adev->mode_info.mode_config_initialized) return 0; /* don't init fbdev if there are no connectors */ if (list_empty(&adev->ddev->mode_config.connector_list)) return 0; /* select 8 bpp console on low vram cards */ if (adev->gmc.real_vram_size <= (32*1024*1024)) bpp_sel = 8; rfbdev = kzalloc(sizeof(struct amdgpu_fbdev), GFP_KERNEL); if (!rfbdev) return -ENOMEM; rfbdev->adev = adev; adev->mode_info.rfbdev = rfbdev; drm_fb_helper_prepare(adev->ddev, &rfbdev->helper, &amdgpu_fb_helper_funcs); ret = drm_fb_helper_init(adev->ddev, &rfbdev->helper, AMDGPUFB_CONN_LIMIT); if (ret) { kfree(rfbdev); return ret; } drm_fb_helper_single_add_all_connectors(&rfbdev->helper); /* disable all the possible outputs/crtcs before entering KMS mode */ if (!amdgpu_device_has_dc_support(adev)) drm_helper_disable_unused_functions(adev->ddev); drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); return 0; }
int qxl_fbdev_init(struct qxl_device *qdev) { struct qxl_fbdev *qfbdev; int bpp_sel = 32; /* TODO: parameter from somewhere? */ int ret; qfbdev = kzalloc(sizeof(struct qxl_fbdev), GFP_KERNEL); if (!qfbdev) return -ENOMEM; qfbdev->qdev = qdev; qdev->mode_info.qfbdev = qfbdev; spin_lock_init(&qfbdev->delayed_ops_lock); INIT_LIST_HEAD(&qfbdev->delayed_ops); drm_fb_helper_prepare(qdev->ddev, &qfbdev->helper, &qxl_fb_helper_funcs); ret = drm_fb_helper_init(qdev->ddev, &qfbdev->helper, qxl_num_crtc /* num_crtc - QXL supports just 1 */, QXLFB_CONN_LIMIT); if (ret) goto free; ret = drm_fb_helper_single_add_all_connectors(&qfbdev->helper); if (ret) goto fini; ret = drm_fb_helper_initial_config(&qfbdev->helper, bpp_sel); if (ret) goto fini; return 0; fini: drm_fb_helper_fini(&qfbdev->helper); free: kfree(qfbdev); return ret; }
int armada_fbdev_init(struct drm_device *dev) { struct armada_private *priv = dev->dev_private; struct drm_fb_helper *fbh; int ret; fbh = devm_kzalloc(dev->dev, sizeof(*fbh), GFP_KERNEL); if (!fbh) return -ENOMEM; priv->fbdev = fbh; drm_fb_helper_prepare(dev, fbh, &armada_fb_helper_funcs); ret = drm_fb_helper_init(dev, fbh, 1, 1); if (ret) { DRM_ERROR("failed to initialize drm fb helper\n"); goto err_fb_helper; } ret = drm_fb_helper_single_add_all_connectors(fbh); if (ret) { DRM_ERROR("failed to add fb connectors\n"); goto err_fb_setup; } ret = drm_fb_helper_initial_config(fbh, 32); if (ret) { DRM_ERROR("failed to set initial config\n"); goto err_fb_setup; } return 0; err_fb_setup: drm_fb_helper_release_fbi(fbh); drm_fb_helper_fini(fbh); err_fb_helper: priv->fbdev = NULL; return ret; }
int mtk_fbdev_create(struct drm_device *dev) { struct mtk_drm_private *priv = (struct mtk_drm_private *)dev->dev_private; struct drm_fb_helper *fbdev; int ret; fbdev = devm_kzalloc(dev->dev, sizeof(*fbdev), GFP_KERNEL); if (!fbdev) return -ENOMEM; drm_fb_helper_prepare(dev, fbdev, &mediatek_drm_fb_helper_funcs); ret = drm_fb_helper_init(dev, fbdev, dev->mode_config.num_crtc, dev->mode_config.num_connector); if (ret) { dev_err(dev->dev, "failed to initialize DRM FB helper\n"); goto fini; } ret = drm_fb_helper_single_add_all_connectors(fbdev); if (ret) { dev_err(dev->dev, "failed to add connectors\n"); goto fini; } ret = drm_fb_helper_initial_config(fbdev, FBDEV_BPP); if (ret) { dev_err(dev->dev, "failed to set initial configuration\n"); goto fini; } priv->fb_helper = fbdev; return 0; fini: drm_fb_helper_fini(fbdev); return ret; }
int udl_fbdev_init(struct drm_device *dev) { struct udl_device *udl = dev->dev_private; int bpp_sel = fb_bpp; struct udl_fbdev *ufbdev; int ret; ufbdev = kzalloc(sizeof(struct udl_fbdev), GFP_KERNEL); if (!ufbdev) return -ENOMEM; udl->fbdev = ufbdev; drm_fb_helper_prepare(dev, &ufbdev->helper, &udl_fb_helper_funcs); ret = drm_fb_helper_init(dev, &ufbdev->helper, 1, 1); if (ret) goto free; ret = drm_fb_helper_single_add_all_connectors(&ufbdev->helper); if (ret) goto fini; /* disable all the possible outputs/crtcs before entering KMS mode */ drm_helper_disable_unused_functions(dev); ret = drm_fb_helper_initial_config(&ufbdev->helper, bpp_sel); if (ret) goto fini; return 0; fini: drm_fb_helper_fini(&ufbdev->helper); free: kfree(ufbdev); return ret; }
int radeon_fbdev_init(struct radeon_device *rdev) { struct radeon_fbdev *rfbdev; int bpp_sel = 32; int ret; /* select 8 bpp console on RN50 or 16MB cards */ if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024)) bpp_sel = 8; rfbdev = kzalloc(sizeof(struct radeon_fbdev), GFP_KERNEL); if (!rfbdev) return -ENOMEM; rfbdev->rdev = rdev; rdev->mode_info.rfbdev = rfbdev; drm_fb_helper_prepare(rdev->ddev, &rfbdev->helper, &radeon_fb_helper_funcs); ret = drm_fb_helper_init(rdev->ddev, &rfbdev->helper, rdev->num_crtc, RADEONFB_CONN_LIMIT); if (ret) { kfree(rfbdev); return ret; } drm_fb_helper_single_add_all_connectors(&rfbdev->helper); /* disable all the possible outputs/crtcs before entering KMS mode */ drm_helper_disable_unused_functions(rdev->ddev); drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); return 0; }
int hibmc_fbdev_init(struct hibmc_drm_private *priv) { int ret; struct fb_var_screeninfo *var; struct fb_fix_screeninfo *fix; struct hibmc_fbdev *hifbdev; hifbdev = devm_kzalloc(priv->dev->dev, sizeof(*hifbdev), GFP_KERNEL); if (!hifbdev) { DRM_ERROR("failed to allocate hibmc_fbdev\n"); return -ENOMEM; } priv->fbdev = hifbdev; drm_fb_helper_prepare(priv->dev, &hifbdev->helper, &hibmc_fbdev_helper_funcs); /* Now just one crtc and one channel */ ret = drm_fb_helper_init(priv->dev, &hifbdev->helper, 1); if (ret) { DRM_ERROR("failed to initialize fb helper: %d\n", ret); return ret; } ret = drm_fb_helper_single_add_all_connectors(&hifbdev->helper); if (ret) { DRM_ERROR("failed to add all connectors: %d\n", ret); goto fini; } ret = drm_fb_helper_initial_config(&hifbdev->helper, 16); if (ret) { DRM_ERROR("failed to setup initial conn config: %d\n", ret); goto fini; } var = &hifbdev->helper.fbdev->var; fix = &hifbdev->helper.fbdev->fix; DRM_DEBUG_DRIVER("Member of info->var is :\n" "xres=%d\n" "yres=%d\n" "xres_virtual=%d\n" "yres_virtual=%d\n" "xoffset=%d\n" "yoffset=%d\n" "bits_per_pixel=%d\n" "...\n", var->xres, var->yres, var->xres_virtual, var->yres_virtual, var->xoffset, var->yoffset, var->bits_per_pixel); DRM_DEBUG_DRIVER("Member of info->fix is :\n" "smem_start=%lx\n" "smem_len=%d\n" "type=%d\n" "type_aux=%d\n" "visual=%d\n" "xpanstep=%d\n" "ypanstep=%d\n" "ywrapstep=%d\n" "line_length=%d\n" "accel=%d\n" "capabilities=%d\n" "...\n", fix->smem_start, fix->smem_len, fix->type, fix->type_aux, fix->visual, fix->xpanstep, fix->ypanstep, fix->ywrapstep, fix->line_length, fix->accel, fix->capabilities); return 0; fini: drm_fb_helper_fini(&hifbdev->helper); return ret; }