Commit 7948a2b1 authored by Peter Wu's avatar Peter Wu Committed by Gerd Hoffmann

qxl: fix null-pointer crash during suspend

"crtc->helper_private" is not initialized by the QXL driver and thus the
"crtc_funcs->disable" call would crash (resulting in suspend failure).
Fix this by converting the suspend/resume functions to use the
drm_mode_config_helper_* helpers.

Tested system sleep with QEMU 3.0 using "echo mem > /sys/power/state".
During suspend the following message is visible from QEMU:

    spice/server/display-channel.c:2425:display_channel_validate_surface: canvas address is 0x7fd05da68308 for 0 (and is NULL)
    spice/server/display-channel.c:2426:display_channel_validate_surface: failed on 0

This seems to be triggered by QXL_IO_NOTIFY_CMD after
QXL_IO_DESTROY_PRIMARY_ASYNC, but aside from the warning things still
seem to work (tested with both the GTK and -spice options).
Signed-off-by: default avatarPeter Wu <peter@lekensteyn.nl>
Link: http://patchwork.freedesktop.org/patch/msgid/20180904202747.14968-1-peter@lekensteyn.nlSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 5ddd6582
...@@ -136,20 +136,11 @@ static int qxl_drm_freeze(struct drm_device *dev) ...@@ -136,20 +136,11 @@ static int qxl_drm_freeze(struct drm_device *dev)
{ {
struct pci_dev *pdev = dev->pdev; struct pci_dev *pdev = dev->pdev;
struct qxl_device *qdev = dev->dev_private; struct qxl_device *qdev = dev->dev_private;
struct drm_crtc *crtc; int ret;
drm_kms_helper_poll_disable(dev);
console_lock();
qxl_fbdev_set_suspend(qdev, 1);
console_unlock();
/* unpin the front buffers */ ret = drm_mode_config_helper_suspend(dev);
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { if (ret)
const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; return ret;
if (crtc->enabled)
(*crtc_funcs->disable)(crtc);
}
qxl_destroy_monitors_object(qdev); qxl_destroy_monitors_object(qdev);
qxl_surf_evict(qdev); qxl_surf_evict(qdev);
...@@ -175,14 +166,7 @@ static int qxl_drm_resume(struct drm_device *dev, bool thaw) ...@@ -175,14 +166,7 @@ static int qxl_drm_resume(struct drm_device *dev, bool thaw)
} }
qxl_create_monitors_object(qdev); qxl_create_monitors_object(qdev);
drm_helper_resume_force_mode(dev); return drm_mode_config_helper_resume(dev);
console_lock();
qxl_fbdev_set_suspend(qdev, 0);
console_unlock();
drm_kms_helper_poll_enable(dev);
return 0;
} }
static int qxl_pm_suspend(struct device *dev) static int qxl_pm_suspend(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment