diff options
author | Jakob Bornecrantz <jakob@vmware.com> | 2011-10-17 05:59:43 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-10-18 04:39:01 -0400 |
commit | 60a16a30d97e8acc9bfed5f4bd1dd03e21a479ea (patch) | |
tree | 39731fbd2536bd8f5444b2ba9750c9eb51ce1b1c /drivers | |
parent | b07759bf41d52aaecd5de92c7d725d6834b23349 (diff) |
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')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 4 |
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 7fc8e7de180..a8830d730dc 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) | |||
380 | dev_priv->ldu_priv->last_num_active = 0; | 380 | dev_priv->ldu_priv->last_num_active = 0; |
381 | dev_priv->ldu_priv->fb = NULL; | 381 | dev_priv->ldu_priv->fb = NULL; |
382 | 382 | ||
383 | drm_mode_create_dirty_info_property(dev_priv->dev); | 383 | /* for old hardware without multimon only enable one display */ |
384 | if (dev_priv->capabilities & SVGA_CAP_MULTIMON) | ||
385 | ret = drm_vblank_init(dev, VMWGFX_NUM_DISPLAY_UNITS); | ||
386 | else | ||
387 | ret = drm_vblank_init(dev, 1); | ||
388 | if (ret != 0) | ||
389 | goto err_free; | ||
384 | 390 | ||
385 | if (dev_priv->capabilities & SVGA_CAP_MULTIMON) { | 391 | ret = drm_mode_create_dirty_info_property(dev); |
392 | if (ret != 0) | ||
393 | goto err_vblank_cleanup; | ||
394 | |||
395 | if (dev_priv->capabilities & SVGA_CAP_MULTIMON) | ||
386 | for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i) | 396 | for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i) |
387 | vmw_ldu_init(dev_priv, i); | 397 | vmw_ldu_init(dev_priv, i); |
388 | ret = drm_vblank_init(dev, VMWGFX_NUM_DISPLAY_UNITS); | 398 | else |
389 | } else { | ||
390 | /* for old hardware without multimon only enable one display */ | ||
391 | vmw_ldu_init(dev_priv, 0); | 399 | vmw_ldu_init(dev_priv, 0); |
392 | ret = drm_vblank_init(dev, 1); | ||
393 | } | ||
394 | 400 | ||
401 | return 0; | ||
402 | |||
403 | err_vblank_cleanup: | ||
404 | drm_vblank_cleanup(dev); | ||
405 | err_free: | ||
406 | kfree(dev_priv->ldu_priv); | ||
407 | dev_priv->ldu_priv = NULL; | ||
395 | return ret; | 408 | return ret; |
396 | } | 409 | } |
397 | 410 | ||
@@ -399,10 +412,11 @@ int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv) | |||
399 | { | 412 | { |
400 | struct drm_device *dev = dev_priv->dev; | 413 | struct drm_device *dev = dev_priv->dev; |
401 | 414 | ||
402 | drm_vblank_cleanup(dev); | ||
403 | if (!dev_priv->ldu_priv) | 415 | if (!dev_priv->ldu_priv) |
404 | return -ENOSYS; | 416 | return -ENOSYS; |
405 | 417 | ||
418 | drm_vblank_cleanup(dev); | ||
419 | |||
406 | BUG_ON(!list_empty(&dev_priv->ldu_priv->active)); | 420 | BUG_ON(!list_empty(&dev_priv->ldu_priv->active)); |
407 | 421 | ||
408 | kfree(dev_priv->ldu_priv); | 422 | kfree(dev_priv->ldu_priv); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index 347e4069944..319516f4ace 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | |||
@@ -545,6 +545,7 @@ err_vblank_cleanup: | |||
545 | drm_vblank_cleanup(dev); | 545 | drm_vblank_cleanup(dev); |
546 | err_free: | 546 | err_free: |
547 | kfree(dev_priv->sou_priv); | 547 | kfree(dev_priv->sou_priv); |
548 | dev_priv->sou_priv = NULL; | ||
548 | err_no_mem: | 549 | err_no_mem: |
549 | return ret; | 550 | return ret; |
550 | } | 551 | } |
@@ -553,10 +554,11 @@ int vmw_kms_close_screen_object_display(struct vmw_private *dev_priv) | |||
553 | { | 554 | { |
554 | struct drm_device *dev = dev_priv->dev; | 555 | struct drm_device *dev = dev_priv->dev; |
555 | 556 | ||
556 | drm_vblank_cleanup(dev); | ||
557 | if (!dev_priv->sou_priv) | 557 | if (!dev_priv->sou_priv) |
558 | return -ENOSYS; | 558 | return -ENOSYS; |
559 | 559 | ||
560 | drm_vblank_cleanup(dev); | ||
561 | |||
560 | if (!list_empty(&dev_priv->sou_priv->active)) | 562 | if (!list_empty(&dev_priv->sou_priv->active)) |
561 | DRM_ERROR("Still have active outputs when unloading driver"); | 563 | DRM_ERROR("Still have active outputs when unloading driver"); |
562 | 564 | ||