summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2011-10-17 11:59:43 +0200
committerDave Airlie <airlied@redhat.com>2011-10-18 09:39:01 +0100
commit60a16a30d97e8acc9bfed5f4bd1dd03e21a479ea (patch)
tree39731fbd2536bd8f5444b2ba9750c9eb51ce1b1c /drivers/gpu/drm/vmwgfx
parentb07759bf41d52aaecd5de92c7d725d6834b23349 (diff)
downloadblackbird-op-linux-60a16a30d97e8acc9bfed5f4bd1dd03e21a479ea.tar.gz
blackbird-op-linux-60a16a30d97e8acc9bfed5f4bd1dd03e21a479ea.zip
vmwgfx: Fix display system init & close functions
Make sure we null the display private, make sure we catch and handle vblank failing to init and don't call vblank_cleanup if we haven't initialized the display system. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c30
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c4
2 files changed, 25 insertions, 9 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 7fc8e7de180b..a8830d730dc1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -380,18 +380,31 @@ int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv)
dev_priv->ldu_priv->last_num_active = 0;
dev_priv->ldu_priv->fb = NULL;
- drm_mode_create_dirty_info_property(dev_priv->dev);
+ /* for old hardware without multimon only enable one display */
+ if (dev_priv->capabilities & SVGA_CAP_MULTIMON)
+ ret = drm_vblank_init(dev, VMWGFX_NUM_DISPLAY_UNITS);
+ else
+ ret = drm_vblank_init(dev, 1);
+ if (ret != 0)
+ goto err_free;
- if (dev_priv->capabilities & SVGA_CAP_MULTIMON) {
+ ret = drm_mode_create_dirty_info_property(dev);
+ if (ret != 0)
+ goto err_vblank_cleanup;
+
+ if (dev_priv->capabilities & SVGA_CAP_MULTIMON)
for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i)
vmw_ldu_init(dev_priv, i);
- ret = drm_vblank_init(dev, VMWGFX_NUM_DISPLAY_UNITS);
- } else {
- /* for old hardware without multimon only enable one display */
+ else
vmw_ldu_init(dev_priv, 0);
- ret = drm_vblank_init(dev, 1);
- }
+ return 0;
+
+err_vblank_cleanup:
+ drm_vblank_cleanup(dev);
+err_free:
+ kfree(dev_priv->ldu_priv);
+ dev_priv->ldu_priv = NULL;
return ret;
}
@@ -399,10 +412,11 @@ int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv)
{
struct drm_device *dev = dev_priv->dev;
- drm_vblank_cleanup(dev);
if (!dev_priv->ldu_priv)
return -ENOSYS;
+ drm_vblank_cleanup(dev);
+
BUG_ON(!list_empty(&dev_priv->ldu_priv->active));
kfree(dev_priv->ldu_priv);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index 347e40699443..319516f4ace2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -545,6 +545,7 @@ err_vblank_cleanup:
drm_vblank_cleanup(dev);
err_free:
kfree(dev_priv->sou_priv);
+ dev_priv->sou_priv = NULL;
err_no_mem:
return ret;
}
@@ -553,10 +554,11 @@ int vmw_kms_close_screen_object_display(struct vmw_private *dev_priv)
{
struct drm_device *dev = dev_priv->dev;
- drm_vblank_cleanup(dev);
if (!dev_priv->sou_priv)
return -ENOSYS;
+ drm_vblank_cleanup(dev);
+
if (!list_empty(&dev_priv->sou_priv->active))
DRM_ERROR("Still have active outputs when unloading driver");
OpenPOWER on IntegriCloud