diff mbox

[2/2] drm/nouveau: don't suspend/resume display on runtime s/r

Message ID 5360E847.6040808@canonical.com
State New
Headers show

Commit Message

Maarten Lankhorst April 30, 2014, 12:10 p.m. UTC
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1313986

This should ensure we don't hit a locking problem when someone
wakes us up via a connector, we should never go into suspend
while the display is on anyways.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 05c63c2ff23a80b654d6c088ac3ba21628db0173)
---
  drivers/gpu/drm/nouveau/nouveau_drm.c |   12 +++++-------
  1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Tim Gardner April 30, 2014, 12:59 p.m. UTC | #1
On 04/30/2014 06:10 AM, Maarten Lankhorst wrote:
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1313986
>
> This should ensure we don't hit a locking problem when someone
> wakes us up via a connector, we should never go into suspend
> while the display is on anyways.
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> (cherry picked from commit 05c63c2ff23a80b654d6c088ac3ba21628db0173)
> ---
>   drivers/gpu/drm/nouveau/nouveau_drm.c |   12 +++++-------
>   1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c
> b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 9434981..d859bf2 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -486,13 +486,13 @@ nouveau_drm_remove(struct pci_dev *pdev)
>   }
>
>   static int
> -nouveau_do_suspend(struct drm_device *dev)
> +nouveau_do_suspend(struct drm_device *dev, bool runtime)
>   {
>       struct nouveau_drm *drm = nouveau_drm(dev);
>       struct nouveau_cli *cli;
>       int ret;
>
> -    if (dev->mode_config.num_crtc) {
> +    if (dev->mode_config.num_crtc && !runtime) {
>           NV_INFO(drm, "suspending display...\n");
>           ret = nouveau_display_suspend(dev);
>           if (ret)
> @@ -560,7 +560,7 @@ int nouveau_pmops_suspend(struct device *dev)
>       if (drm_dev->mode_config.num_crtc)
>           nouveau_fbcon_set_suspend(drm_dev, 1);
>
> -    ret = nouveau_do_suspend(drm_dev);
> +    ret = nouveau_do_suspend(drm_dev, false);
>       if (ret)
>           return ret;
>
> @@ -640,7 +640,7 @@ static int nouveau_pmops_freeze(struct device *dev)
>       if (drm_dev->mode_config.num_crtc)
>           nouveau_fbcon_set_suspend(drm_dev, 1);
>
> -    ret = nouveau_do_suspend(drm_dev);
> +    ret = nouveau_do_suspend(drm_dev, false);
>       return ret;
>   }
>
> @@ -874,7 +874,7 @@ static int nouveau_pmops_runtime_suspend(struct
> device *dev)
>       drm_kms_helper_poll_disable(drm_dev);
>       vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);
>       nouveau_switcheroo_optimus_dsm();
> -    ret = nouveau_do_suspend(drm_dev);
> +    ret = nouveau_do_suspend(drm_dev, true);
>       pci_save_state(pdev);
>       pci_disable_device(pdev);
>       pci_set_power_state(pdev, PCI_D3cold);
> @@ -900,8 +900,6 @@ static int nouveau_pmops_runtime_resume(struct
> device *dev)
>       pci_set_master(pdev);
>
>       ret = nouveau_do_resume(drm_dev);
> -    if (drm_dev->mode_config.num_crtc)
> -        nouveau_display_resume(drm_dev);
>       drm_kms_helper_poll_enable(drm_dev);
>       /* do magic */
>       nv_mask(device, 0x88488, (1 << 25), (1 << 25));

Luis, Kamal - stable material for 3.13 ?
Seth Forshee April 30, 2014, 1:29 p.m. UTC | #2
On Wed, Apr 30, 2014 at 02:10:47PM +0200, Maarten Lankhorst wrote:
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1313986
> 
> This should ensure we don't hit a locking problem when someone
> wakes us up via a connector, we should never go into suspend
> while the display is on anyways.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> (cherry picked from commit 05c63c2ff23a80b654d6c088ac3ba21628db0173)
> ---
>  drivers/gpu/drm/nouveau/nouveau_drm.c |   12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 9434981..d859bf2 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -486,13 +486,13 @@ nouveau_drm_remove(struct pci_dev *pdev)
>  }
>  static int
> -nouveau_do_suspend(struct drm_device *dev)
> +nouveau_do_suspend(struct drm_device *dev, bool runtime)
>  {
>  	struct nouveau_drm *drm = nouveau_drm(dev);
>  	struct nouveau_cli *cli;
>  	int ret;
> -	if (dev->mode_config.num_crtc) {
> +	if (dev->mode_config.num_crtc && !runtime) {
>  		NV_INFO(drm, "suspending display...\n");
>  		ret = nouveau_display_suspend(dev);
>  		if (ret)
> @@ -560,7 +560,7 @@ int nouveau_pmops_suspend(struct device *dev)
>  	if (drm_dev->mode_config.num_crtc)
>  		nouveau_fbcon_set_suspend(drm_dev, 1);
> -	ret = nouveau_do_suspend(drm_dev);
> +	ret = nouveau_do_suspend(drm_dev, false);
>  	if (ret)
>  		return ret;
> @@ -640,7 +640,7 @@ static int nouveau_pmops_freeze(struct device *dev)
>  	if (drm_dev->mode_config.num_crtc)
>  		nouveau_fbcon_set_suspend(drm_dev, 1);
> -	ret = nouveau_do_suspend(drm_dev);
> +	ret = nouveau_do_suspend(drm_dev, false);
>  	return ret;
>  }
> @@ -874,7 +874,7 @@ static int nouveau_pmops_runtime_suspend(struct device *dev)
>  	drm_kms_helper_poll_disable(drm_dev);
>  	vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);
>  	nouveau_switcheroo_optimus_dsm();
> -	ret = nouveau_do_suspend(drm_dev);
> +	ret = nouveau_do_suspend(drm_dev, true);
>  	pci_save_state(pdev);
>  	pci_disable_device(pdev);
>  	pci_set_power_state(pdev, PCI_D3cold);
> @@ -900,8 +900,6 @@ static int nouveau_pmops_runtime_resume(struct device *dev)
>  	pci_set_master(pdev);
>  	ret = nouveau_do_resume(drm_dev);
> -	if (drm_dev->mode_config.num_crtc)
> -		nouveau_display_resume(drm_dev);
>  	drm_kms_helper_poll_enable(drm_dev);
>  	/* do magic */
>  	nv_mask(device, 0x88488, (1 << 25), (1 << 25));
> -- 
> 1.7.9.5
> 
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Tim Gardner April 30, 2014, 2:34 p.m. UTC | #3

diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 9434981..d859bf2 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -486,13 +486,13 @@  nouveau_drm_remove(struct pci_dev *pdev)
  }
  
  static int
-nouveau_do_suspend(struct drm_device *dev)
+nouveau_do_suspend(struct drm_device *dev, bool runtime)
  {
  	struct nouveau_drm *drm = nouveau_drm(dev);
  	struct nouveau_cli *cli;
  	int ret;
  
-	if (dev->mode_config.num_crtc) {
+	if (dev->mode_config.num_crtc && !runtime) {
  		NV_INFO(drm, "suspending display...\n");
  		ret = nouveau_display_suspend(dev);
  		if (ret)
@@ -560,7 +560,7 @@  int nouveau_pmops_suspend(struct device *dev)
  	if (drm_dev->mode_config.num_crtc)
  		nouveau_fbcon_set_suspend(drm_dev, 1);
  
-	ret = nouveau_do_suspend(drm_dev);
+	ret = nouveau_do_suspend(drm_dev, false);
  	if (ret)
  		return ret;
  
@@ -640,7 +640,7 @@  static int nouveau_pmops_freeze(struct device *dev)
  	if (drm_dev->mode_config.num_crtc)
  		nouveau_fbcon_set_suspend(drm_dev, 1);
  
-	ret = nouveau_do_suspend(drm_dev);
+	ret = nouveau_do_suspend(drm_dev, false);
  	return ret;
  }
  
@@ -874,7 +874,7 @@  static int nouveau_pmops_runtime_suspend(struct device *dev)
  	drm_kms_helper_poll_disable(drm_dev);
  	vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);
  	nouveau_switcheroo_optimus_dsm();
-	ret = nouveau_do_suspend(drm_dev);
+	ret = nouveau_do_suspend(drm_dev, true);
  	pci_save_state(pdev);
  	pci_disable_device(pdev);
  	pci_set_power_state(pdev, PCI_D3cold);
@@ -900,8 +900,6 @@  static int nouveau_pmops_runtime_resume(struct device *dev)
  	pci_set_master(pdev);
  
  	ret = nouveau_do_resume(drm_dev);
-	if (drm_dev->mode_config.num_crtc)
-		nouveau_display_resume(drm_dev);
  	drm_kms_helper_poll_enable(drm_dev);
  	/* do magic */
  	nv_mask(device, 0x88488, (1 << 25), (1 << 25));