Commit 0f7d9052 authored by Archit Taneja's avatar Archit Taneja Committed by Daniel Vetter

drm/tegra: Use new drm_fb_helper functions

Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

v2:
- Fix up error handling path in tegra_fbdev_probe

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: "Terje Bergström" <tbergstrom@nvidia.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 990e8440
...@@ -184,9 +184,9 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm, ...@@ -184,9 +184,9 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
#ifdef CONFIG_DRM_TEGRA_FBDEV #ifdef CONFIG_DRM_TEGRA_FBDEV
static struct fb_ops tegra_fb_ops = { static struct fb_ops tegra_fb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_fillrect = sys_fillrect, .fb_fillrect = drm_fb_helper_sys_fillrect,
.fb_copyarea = sys_copyarea, .fb_copyarea = drm_fb_helper_sys_copyarea,
.fb_imageblit = sys_imageblit, .fb_imageblit = drm_fb_helper_sys_imageblit,
.fb_check_var = drm_fb_helper_check_var, .fb_check_var = drm_fb_helper_check_var,
.fb_set_par = drm_fb_helper_set_par, .fb_set_par = drm_fb_helper_set_par,
.fb_blank = drm_fb_helper_blank, .fb_blank = drm_fb_helper_blank,
...@@ -224,11 +224,11 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, ...@@ -224,11 +224,11 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
if (IS_ERR(bo)) if (IS_ERR(bo))
return PTR_ERR(bo); return PTR_ERR(bo);
info = framebuffer_alloc(0, drm->dev); info = drm_fb_helper_alloc_fbi(helper);
if (!info) { if (IS_ERR(info)) {
dev_err(drm->dev, "failed to allocate framebuffer info\n"); dev_err(drm->dev, "failed to allocate framebuffer info\n");
drm_gem_object_unreference_unlocked(&bo->gem); drm_gem_object_unreference_unlocked(&bo->gem);
return -ENOMEM; return PTR_ERR(info);
} }
fbdev->fb = tegra_fb_alloc(drm, &cmd, &bo, 1); fbdev->fb = tegra_fb_alloc(drm, &cmd, &bo, 1);
...@@ -248,12 +248,6 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, ...@@ -248,12 +248,6 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
info->flags = FBINFO_FLAG_DEFAULT; info->flags = FBINFO_FLAG_DEFAULT;
info->fbops = &tegra_fb_ops; info->fbops = &tegra_fb_ops;
err = fb_alloc_cmap(&info->cmap, 256, 0);
if (err < 0) {
dev_err(drm->dev, "failed to allocate color map: %d\n", err);
goto destroy;
}
drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth); drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
drm_fb_helper_fill_var(info, helper, fb->width, fb->height); drm_fb_helper_fill_var(info, helper, fb->width, fb->height);
...@@ -282,7 +276,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, ...@@ -282,7 +276,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
drm_framebuffer_unregister_private(fb); drm_framebuffer_unregister_private(fb);
tegra_fb_destroy(fb); tegra_fb_destroy(fb);
release: release:
framebuffer_release(info); drm_fb_helper_release_fbi(helper);
return err; return err;
} }
...@@ -347,20 +341,9 @@ static int tegra_fbdev_init(struct tegra_fbdev *fbdev, ...@@ -347,20 +341,9 @@ static int tegra_fbdev_init(struct tegra_fbdev *fbdev,
static void tegra_fbdev_exit(struct tegra_fbdev *fbdev) static void tegra_fbdev_exit(struct tegra_fbdev *fbdev)
{ {
struct fb_info *info = fbdev->base.fbdev;
if (info) {
int err;
err = unregister_framebuffer(info);
if (err < 0)
DRM_DEBUG_KMS("failed to unregister framebuffer\n");
if (info->cmap.len) drm_fb_helper_unregister_fbi(&fbdev->base);
fb_dealloc_cmap(&info->cmap); drm_fb_helper_release_fbi(&fbdev->base);
framebuffer_release(info);
}
if (fbdev->fb) { if (fbdev->fb) {
drm_framebuffer_unregister_private(&fbdev->fb->base); drm_framebuffer_unregister_private(&fbdev->fb->base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment