Commit 4961eb60 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/ast: Enable atomic modesetting

This commit sets the remaining atomic-modesetting helpers and the flag
DRIVER_ATOMIC. Legacy cursor functions are removed in favor of the cursor
plane. For power management, atomic helpers replace the indvidual
operations that the driver currently runs.

Atomic modesetting is enabled with this commit.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Acked-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191107083404.6852-10-tzimmermann@suse.de
parent 02f3bb75
...@@ -99,14 +99,14 @@ ast_pci_remove(struct pci_dev *pdev) ...@@ -99,14 +99,14 @@ ast_pci_remove(struct pci_dev *pdev)
drm_put_dev(dev); drm_put_dev(dev);
} }
static int ast_drm_freeze(struct drm_device *dev) static int ast_drm_freeze(struct drm_device *dev)
{ {
drm_kms_helper_poll_disable(dev); int error;
pci_save_state(dev->pdev);
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, true);
error = drm_mode_config_helper_suspend(dev);
if (error)
return error;
pci_save_state(dev->pdev);
return 0; return 0;
} }
...@@ -114,11 +114,7 @@ static int ast_drm_thaw(struct drm_device *dev) ...@@ -114,11 +114,7 @@ static int ast_drm_thaw(struct drm_device *dev)
{ {
ast_post_gpu(dev); ast_post_gpu(dev);
drm_mode_config_reset(dev); return drm_mode_config_helper_resume(dev);
drm_helper_resume_force_mode(dev);
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, false);
return 0;
} }
static int ast_drm_resume(struct drm_device *dev) static int ast_drm_resume(struct drm_device *dev)
...@@ -131,8 +127,6 @@ static int ast_drm_resume(struct drm_device *dev) ...@@ -131,8 +127,6 @@ static int ast_drm_resume(struct drm_device *dev)
ret = ast_drm_thaw(dev); ret = ast_drm_thaw(dev);
if (ret) if (ret)
return ret; return ret;
drm_kms_helper_poll_enable(dev);
return 0; return 0;
} }
...@@ -150,6 +144,7 @@ static int ast_pm_suspend(struct device *dev) ...@@ -150,6 +144,7 @@ static int ast_pm_suspend(struct device *dev)
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
return 0; return 0;
} }
static int ast_pm_resume(struct device *dev) static int ast_pm_resume(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
...@@ -165,7 +160,6 @@ static int ast_pm_freeze(struct device *dev) ...@@ -165,7 +160,6 @@ static int ast_pm_freeze(struct device *dev)
if (!ddev || !ddev->dev_private) if (!ddev || !ddev->dev_private)
return -ENODEV; return -ENODEV;
return ast_drm_freeze(ddev); return ast_drm_freeze(ddev);
} }
static int ast_pm_thaw(struct device *dev) static int ast_pm_thaw(struct device *dev)
...@@ -203,7 +197,9 @@ static struct pci_driver ast_pci_driver = { ...@@ -203,7 +197,9 @@ static struct pci_driver ast_pci_driver = {
DEFINE_DRM_GEM_FOPS(ast_fops); DEFINE_DRM_GEM_FOPS(ast_fops);
static struct drm_driver driver = { static struct drm_driver driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM, .driver_features = DRIVER_ATOMIC |
DRIVER_GEM |
DRIVER_MODESET,
.load = ast_driver_load, .load = ast_driver_load,
.unload = ast_driver_unload, .unload = ast_driver_unload,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_gem.h> #include <drm/drm_gem.h>
...@@ -412,6 +413,8 @@ enum drm_mode_status ast_mode_config_mode_valid(struct drm_device *dev, ...@@ -412,6 +413,8 @@ enum drm_mode_status ast_mode_config_mode_valid(struct drm_device *dev,
static const struct drm_mode_config_funcs ast_mode_funcs = { static const struct drm_mode_config_funcs ast_mode_funcs = {
.fb_create = drm_gem_fb_create, .fb_create = drm_gem_fb_create,
.mode_valid = ast_mode_config_mode_valid, .mode_valid = ast_mode_config_mode_valid,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
}; };
static u32 ast_get_vram_info(struct drm_device *dev) static u32 ast_get_vram_info(struct drm_device *dev)
...@@ -529,6 +532,8 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -529,6 +532,8 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags)
if (ret) if (ret)
goto out_free; goto out_free;
drm_mode_config_reset(dev);
ret = drm_fbdev_generic_setup(dev, 32); ret = drm_fbdev_generic_setup(dev, 32);
if (ret) if (ret)
goto out_free; goto out_free;
......
This diff is collapsed.
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