drm_dev_put(&vbox->ddev);
}
-static int vbox_drm_freeze(struct vbox_private *vbox)
-{
- drm_kms_helper_poll_disable(&vbox->ddev);
-
- pci_save_state(vbox->ddev.pdev);
-
- drm_fb_helper_set_suspend_unlocked(&vbox->fbdev->helper, true);
-
- return 0;
-}
-
-static int vbox_drm_thaw(struct vbox_private *vbox)
-{
- drm_mode_config_reset(&vbox->ddev);
- drm_helper_resume_force_mode(&vbox->ddev);
- drm_fb_helper_set_suspend_unlocked(&vbox->fbdev->helper, false);
-
- return 0;
-}
-
static int vbox_pm_suspend(struct device *dev)
{
struct vbox_private *vbox = dev_get_drvdata(dev);
int error;
- error = vbox_drm_freeze(vbox);
+ error = drm_mode_config_helper_suspend(&vbox->ddev);
if (error)
return error;
+ pci_save_state(vbox->ddev.pdev);
pci_disable_device(vbox->ddev.pdev);
pci_set_power_state(vbox->ddev.pdev, PCI_D3hot);
static int vbox_pm_resume(struct device *dev)
{
struct vbox_private *vbox = dev_get_drvdata(dev);
- int ret;
if (pci_enable_device(vbox->ddev.pdev))
return -EIO;
- ret = vbox_drm_thaw(vbox);
- if (ret)
- return ret;
-
- drm_kms_helper_poll_enable(&vbox->ddev);
-
- return 0;
+ return drm_mode_config_helper_resume(&vbox->ddev);
}
static int vbox_pm_freeze(struct device *dev)
{
struct vbox_private *vbox = dev_get_drvdata(dev);
- return vbox_drm_freeze(vbox);
+ return drm_mode_config_helper_suspend(&vbox->ddev);
}
static int vbox_pm_thaw(struct device *dev)
{
struct vbox_private *vbox = dev_get_drvdata(dev);
- return vbox_drm_thaw(vbox);
+ return drm_mode_config_helper_resume(&vbox->ddev);
}
static int vbox_pm_poweroff(struct device *dev)
{
struct vbox_private *vbox = dev_get_drvdata(dev);
- return vbox_drm_freeze(vbox);
+ return drm_mode_config_helper_suspend(&vbox->ddev);
}
static const struct dev_pm_ops vbox_pm_ops = {
static struct drm_driver driver = {
.driver_features =
DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
- DRIVER_PRIME,
+ DRIVER_PRIME | DRIVER_ATOMIC,
.dev_priv_size = 0,
.lastclose = vbox_driver_lastclose,
mutex_unlock(&vbox->hw_mutex);
}
-static bool vbox_crtc_mode_fixup(struct drm_crtc *crtc,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
- return true;
-}
-
/*
* Try to map the layout of virtual screens to the range of the input device.
* Return true if we need to re-set the crtc modes due to screen offset
{
}
-static void vbox_crtc_prepare(struct drm_crtc *crtc)
-{
-}
-
static void vbox_crtc_commit(struct drm_crtc *crtc)
{
}
-static void vbox_crtc_mode_set_nofb(struct drm_crtc *crtc)
-{
- /* We always set the mode when we set the fb/base */
-}
-
static void vbox_crtc_atomic_flush(struct drm_crtc *crtc,
struct drm_crtc_state *old_crtc_state)
{
static const struct drm_crtc_helper_funcs vbox_crtc_helper_funcs = {
.dpms = vbox_crtc_dpms,
- .mode_fixup = vbox_crtc_mode_fixup,
- .mode_set = drm_helper_crtc_mode_set,
- .mode_set_nofb = vbox_crtc_mode_set_nofb,
.disable = vbox_crtc_disable,
- .prepare = vbox_crtc_prepare,
.commit = vbox_crtc_commit,
.atomic_flush = vbox_crtc_atomic_flush,
};
}
static const struct drm_crtc_funcs vbox_crtc_funcs = {
- .set_config = drm_crtc_helper_set_config,
+ .set_config = drm_atomic_helper_set_config,
/* .gamma_set = vbox_crtc_gamma_set, */
.destroy = vbox_crtc_destroy,
.reset = drm_atomic_helper_crtc_reset,
};
static const struct drm_plane_funcs vbox_cursor_plane_funcs = {
- .update_plane = drm_plane_helper_update,
- .disable_plane = drm_plane_helper_disable,
+ .update_plane = drm_atomic_helper_update_plane,
+ .disable_plane = drm_atomic_helper_disable_plane,
.destroy = drm_primary_helper_destroy,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
};
static const struct drm_plane_funcs vbox_primary_plane_funcs = {
- .update_plane = drm_plane_helper_update,
- .disable_plane = drm_primary_helper_disable,
+ .update_plane = drm_atomic_helper_update_plane,
+ .disable_plane = drm_atomic_helper_disable_plane,
.destroy = drm_primary_helper_destroy,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.detect = vbox_connector_detect,
.fill_modes = vbox_fill_modes,
.destroy = vbox_connector_destroy,
+ .reset = drm_atomic_helper_connector_reset,
+ .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static int vbox_connector_init(struct drm_device *dev,
static const struct drm_mode_config_funcs vbox_mode_funcs = {
.fb_create = vbox_user_framebuffer_create,
+ .atomic_check = drm_atomic_helper_check,
+ .atomic_commit = drm_atomic_helper_commit,
};
int vbox_mode_init(struct vbox_private *vbox)