drm/armada: 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. Cc: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Родитель
df3b031cef
Коммит
e8b70e4dd7
|
@ -22,9 +22,9 @@ static /*const*/ struct fb_ops armada_fb_ops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.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_fillrect = cfb_fillrect,
|
.fb_fillrect = drm_fb_helper_cfb_fillrect,
|
||||||
.fb_copyarea = cfb_copyarea,
|
.fb_copyarea = drm_fb_helper_cfb_copyarea,
|
||||||
.fb_imageblit = cfb_imageblit,
|
.fb_imageblit = drm_fb_helper_cfb_imageblit,
|
||||||
.fb_pan_display = drm_fb_helper_pan_display,
|
.fb_pan_display = drm_fb_helper_pan_display,
|
||||||
.fb_blank = drm_fb_helper_blank,
|
.fb_blank = drm_fb_helper_blank,
|
||||||
.fb_setcmap = drm_fb_helper_setcmap,
|
.fb_setcmap = drm_fb_helper_setcmap,
|
||||||
|
@ -80,18 +80,12 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
|
||||||
if (IS_ERR(dfb))
|
if (IS_ERR(dfb))
|
||||||
return PTR_ERR(dfb);
|
return PTR_ERR(dfb);
|
||||||
|
|
||||||
info = framebuffer_alloc(0, dev->dev);
|
info = drm_fb_helper_alloc_fbi(fbh);
|
||||||
if (!info) {
|
if (IS_ERR(info)) {
|
||||||
ret = -ENOMEM;
|
ret = PTR_ERR(info);
|
||||||
goto err_fballoc;
|
goto err_fballoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = fb_alloc_cmap(&info->cmap, 256, 0);
|
|
||||||
if (ret) {
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto err_fbcmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
strlcpy(info->fix.id, "armada-drmfb", sizeof(info->fix.id));
|
strlcpy(info->fix.id, "armada-drmfb", sizeof(info->fix.id));
|
||||||
info->par = fbh;
|
info->par = fbh;
|
||||||
info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
|
info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
|
||||||
|
@ -101,7 +95,7 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
|
||||||
info->screen_size = obj->obj.size;
|
info->screen_size = obj->obj.size;
|
||||||
info->screen_base = ptr;
|
info->screen_base = ptr;
|
||||||
fbh->fb = &dfb->fb;
|
fbh->fb = &dfb->fb;
|
||||||
fbh->fbdev = info;
|
|
||||||
drm_fb_helper_fill_fix(info, dfb->fb.pitches[0], dfb->fb.depth);
|
drm_fb_helper_fill_fix(info, dfb->fb.pitches[0], dfb->fb.depth);
|
||||||
drm_fb_helper_fill_var(info, fbh, sizes->fb_width, sizes->fb_height);
|
drm_fb_helper_fill_var(info, fbh, sizes->fb_width, sizes->fb_height);
|
||||||
|
|
||||||
|
@ -111,8 +105,6 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_fbcmap:
|
|
||||||
framebuffer_release(info);
|
|
||||||
err_fballoc:
|
err_fballoc:
|
||||||
dfb->fb.funcs->destroy(&dfb->fb);
|
dfb->fb.funcs->destroy(&dfb->fb);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -171,6 +163,7 @@ int armada_fbdev_init(struct drm_device *dev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err_fb_setup:
|
err_fb_setup:
|
||||||
|
drm_fb_helper_release_fbi(fbh);
|
||||||
drm_fb_helper_fini(fbh);
|
drm_fb_helper_fini(fbh);
|
||||||
err_fb_helper:
|
err_fb_helper:
|
||||||
priv->fbdev = NULL;
|
priv->fbdev = NULL;
|
||||||
|
@ -191,14 +184,8 @@ void armada_fbdev_fini(struct drm_device *dev)
|
||||||
struct drm_fb_helper *fbh = priv->fbdev;
|
struct drm_fb_helper *fbh = priv->fbdev;
|
||||||
|
|
||||||
if (fbh) {
|
if (fbh) {
|
||||||
struct fb_info *info = fbh->fbdev;
|
drm_fb_helper_unregister_fbi(fbh);
|
||||||
|
drm_fb_helper_release_fbi(fbh);
|
||||||
if (info) {
|
|
||||||
unregister_framebuffer(info);
|
|
||||||
if (info->cmap.len)
|
|
||||||
fb_dealloc_cmap(&info->cmap);
|
|
||||||
framebuffer_release(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
drm_fb_helper_fini(fbh);
|
drm_fb_helper_fini(fbh);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче