diff options
author | Archit Taneja <architt@codeaurora.org> | 2015-07-31 06:51:57 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-08-06 08:13:05 -0400 |
commit | b166aeb99faa0b42f75ab4f48e98afa44d6a8958 (patch) | |
tree | 3fc0df576206a37df3e395ce625197d57bcc9e30 | |
parent | 21cff14847421ff75d110890ccea729d8ad1b174 (diff) |
drm/nouveau: 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.
v3:
- Don't touch remove_conflicting_framebuffers
v2:
- remove unused variable pdev in nouveau_fbcon_create
Cc: David Airlie <airlied@linux.ie>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fbcon.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 6751553abe4a..2791701685dc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -84,7 +84,7 @@ nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
84 | 84 | ||
85 | if (ret != -ENODEV) | 85 | if (ret != -ENODEV) |
86 | nouveau_fbcon_gpu_lockup(info); | 86 | nouveau_fbcon_gpu_lockup(info); |
87 | cfb_fillrect(info, rect); | 87 | drm_fb_helper_cfb_fillrect(info, rect); |
88 | } | 88 | } |
89 | 89 | ||
90 | static void | 90 | static void |
@@ -116,7 +116,7 @@ nouveau_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *image) | |||
116 | 116 | ||
117 | if (ret != -ENODEV) | 117 | if (ret != -ENODEV) |
118 | nouveau_fbcon_gpu_lockup(info); | 118 | nouveau_fbcon_gpu_lockup(info); |
119 | cfb_copyarea(info, image); | 119 | drm_fb_helper_cfb_copyarea(info, image); |
120 | } | 120 | } |
121 | 121 | ||
122 | static void | 122 | static void |
@@ -148,7 +148,7 @@ nouveau_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
148 | 148 | ||
149 | if (ret != -ENODEV) | 149 | if (ret != -ENODEV) |
150 | nouveau_fbcon_gpu_lockup(info); | 150 | nouveau_fbcon_gpu_lockup(info); |
151 | cfb_imageblit(info, image); | 151 | drm_fb_helper_cfb_imageblit(info, image); |
152 | } | 152 | } |
153 | 153 | ||
154 | static int | 154 | static int |
@@ -197,9 +197,9 @@ static struct fb_ops nouveau_fbcon_sw_ops = { | |||
197 | .owner = THIS_MODULE, | 197 | .owner = THIS_MODULE, |
198 | .fb_check_var = drm_fb_helper_check_var, | 198 | .fb_check_var = drm_fb_helper_check_var, |
199 | .fb_set_par = drm_fb_helper_set_par, | 199 | .fb_set_par = drm_fb_helper_set_par, |
200 | .fb_fillrect = cfb_fillrect, | 200 | .fb_fillrect = drm_fb_helper_cfb_fillrect, |
201 | .fb_copyarea = cfb_copyarea, | 201 | .fb_copyarea = drm_fb_helper_cfb_copyarea, |
202 | .fb_imageblit = cfb_imageblit, | 202 | .fb_imageblit = drm_fb_helper_cfb_imageblit, |
203 | .fb_pan_display = drm_fb_helper_pan_display, | 203 | .fb_pan_display = drm_fb_helper_pan_display, |
204 | .fb_blank = drm_fb_helper_blank, | 204 | .fb_blank = drm_fb_helper_blank, |
205 | .fb_setcmap = drm_fb_helper_setcmap, | 205 | .fb_setcmap = drm_fb_helper_setcmap, |
@@ -319,7 +319,6 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, | |||
319 | struct nouveau_channel *chan; | 319 | struct nouveau_channel *chan; |
320 | struct nouveau_bo *nvbo; | 320 | struct nouveau_bo *nvbo; |
321 | struct drm_mode_fb_cmd2 mode_cmd; | 321 | struct drm_mode_fb_cmd2 mode_cmd; |
322 | struct pci_dev *pdev = dev->pdev; | ||
323 | int size, ret; | 322 | int size, ret; |
324 | 323 | ||
325 | mode_cmd.width = sizes->surface_width; | 324 | mode_cmd.width = sizes->surface_width; |
@@ -365,20 +364,13 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, | |||
365 | 364 | ||
366 | mutex_lock(&dev->struct_mutex); | 365 | mutex_lock(&dev->struct_mutex); |
367 | 366 | ||
368 | info = framebuffer_alloc(0, &pdev->dev); | 367 | info = drm_fb_helper_alloc_fbi(helper); |
369 | if (!info) { | 368 | if (IS_ERR(info)) { |
370 | ret = -ENOMEM; | 369 | ret = PTR_ERR(info); |
371 | goto out_unlock; | 370 | goto out_unlock; |
372 | } | 371 | } |
373 | info->skip_vt_switch = 1; | 372 | info->skip_vt_switch = 1; |
374 | 373 | ||
375 | ret = fb_alloc_cmap(&info->cmap, 256, 0); | ||
376 | if (ret) { | ||
377 | ret = -ENOMEM; | ||
378 | framebuffer_release(info); | ||
379 | goto out_unlock; | ||
380 | } | ||
381 | |||
382 | info->par = fbcon; | 374 | info->par = fbcon; |
383 | 375 | ||
384 | nouveau_framebuffer_init(dev, &fbcon->nouveau_fb, &mode_cmd, nvbo); | 376 | nouveau_framebuffer_init(dev, &fbcon->nouveau_fb, &mode_cmd, nvbo); |
@@ -388,7 +380,6 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, | |||
388 | 380 | ||
389 | /* setup helper */ | 381 | /* setup helper */ |
390 | fbcon->helper.fb = fb; | 382 | fbcon->helper.fb = fb; |
391 | fbcon->helper.fbdev = info; | ||
392 | 383 | ||
393 | strcpy(info->fix.id, "nouveaufb"); | 384 | strcpy(info->fix.id, "nouveaufb"); |
394 | if (!chan) | 385 | if (!chan) |
@@ -450,15 +441,9 @@ static int | |||
450 | nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon) | 441 | nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon) |
451 | { | 442 | { |
452 | struct nouveau_framebuffer *nouveau_fb = &fbcon->nouveau_fb; | 443 | struct nouveau_framebuffer *nouveau_fb = &fbcon->nouveau_fb; |
453 | struct fb_info *info; | ||
454 | 444 | ||
455 | if (fbcon->helper.fbdev) { | 445 | drm_fb_helper_unregister_fbi(&fbcon->helper); |
456 | info = fbcon->helper.fbdev; | 446 | drm_fb_helper_release_fbi(&fbcon->helper); |
457 | unregister_framebuffer(info); | ||
458 | if (info->cmap.len) | ||
459 | fb_dealloc_cmap(&info->cmap); | ||
460 | framebuffer_release(info); | ||
461 | } | ||
462 | 447 | ||
463 | if (nouveau_fb->nvbo) { | 448 | if (nouveau_fb->nvbo) { |
464 | nouveau_bo_unmap(nouveau_fb->nvbo); | 449 | nouveau_bo_unmap(nouveau_fb->nvbo); |
@@ -496,7 +481,7 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state) | |||
496 | console_lock(); | 481 | console_lock(); |
497 | if (state == FBINFO_STATE_RUNNING) | 482 | if (state == FBINFO_STATE_RUNNING) |
498 | nouveau_fbcon_accel_restore(dev); | 483 | nouveau_fbcon_accel_restore(dev); |
499 | fb_set_suspend(drm->fbcon->helper.fbdev, state); | 484 | drm_fb_helper_set_suspend(&drm->fbcon->helper, state); |
500 | if (state != FBINFO_STATE_RUNNING) | 485 | if (state != FBINFO_STATE_RUNNING) |
501 | nouveau_fbcon_accel_save_disable(dev); | 486 | nouveau_fbcon_accel_save_disable(dev); |
502 | console_unlock(); | 487 | console_unlock(); |