summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/gma500/psb_drv.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-12-02 21:55:41 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-01-20 15:57:21 +0100
commit7147573a5ce499dec3979e6b524691d47e1288d5 (patch)
treeb3c414243613b8aeee33921602d6b6363d4f2565 /drivers/gpu/drm/gma500/psb_drv.c
parent80f0b5aff8f49f63eaf08bdae243de3a8ea3f77e (diff)
downloadlinux-7147573a5ce499dec3979e6b524691d47e1288d5.tar.bz2
drm/gma500: move fbcon restore to lastclose
Doing this within the fb->destroy callback leads to a locking nightmare. And all other drm drivers that restore the fbcon do it in lastclose, too. With this adjustments all fb->destroy callbacks optionally drop references to any gem objects used as backing storage, call drm_framebuffer_cleanup and then kfree the struct. Which nicely simplifies the locking for framebuffer unreferencing and freeing, since this doesn't require that we hold the mode_config lock. A slight exception is the vmwgfx surface backed framebuffer, it also calls drm_master_put and removes the object from a device-private framebuffer list. Both seem to have solid locking in place already. Conclusion is that now it is no longer required to hold the mode_config lock while freeing a framebuffer. v2: Drop the corresponding mutex_lock WARN check from drm_framebuffer_unreference. v3: Use just the mode_config lock not modeset_lock_all, due to patch reordering. Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/gma500/psb_drv.c')
-rw-r--r--drivers/gpu/drm/gma500/psb_drv.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index dd1fbfa7e467..dbcefe9f78fa 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -149,6 +149,16 @@ static struct drm_ioctl_desc psb_ioctls[] = {
static void psb_lastclose(struct drm_device *dev)
{
+ int ret;
+ struct drm_psb_private *dev_priv = dev->dev_private;
+ struct psb_fbdev *fbdev = dev_priv->fbdev;
+
+ mutex_lock(&dev->mode_config.mutex);
+ ret = drm_fb_helper_restore_fbdev_mode(&fbdev->psb_fb_helper);
+ if (ret)
+ DRM_DEBUG("failed to restore crtc mode\n");
+ mutex_unlock(&dev->mode_config.mutex);
+
return;
}