Patchwork Patch: SAUCE: Disable acceleration on MacBook Pro and GeForce 3

login
register
mail settings
Submitter Christopher James Halse Rogers
Date April 8, 2010, 9:10 a.m.
Message ID <1270717848.8368.42.camel@Spike>
Download mbox | patch
Permalink /patch/49718/
State Superseded
Delegated to: Andy Whitcroft
Headers show

Comments

Christopher James Halse Rogers - April 8, 2010, 9:10 a.m.
Currently in Lucid we have reports of nouveau hanging during boot on
many of the recent MacBook Pro revisions, and also on GeForce 3 cards.
See:  
https://bugs.launchpad.net/bugs/546393 and
https://bugs.launchpad.net/bugs/544088

Disabling acceleration on these cards prevents the hang, and the systems
boot and run successfully.  The attached patch disables acceleration on
MacBook Pros, and GeForce 3 cards.
Chase Douglas - April 8, 2010, 7:41 p.m.
On Thu, Apr 8, 2010 at 5:10 AM, Christopher James Halse Rogers
<raof@ubuntu.com> wrote:
> Currently in Lucid we have reports of nouveau hanging during boot on
> many of the recent MacBook Pro revisions, and also on GeForce 3 cards.
> See:
> https://bugs.launchpad.net/bugs/546393 and
> https://bugs.launchpad.net/bugs/544088
>
> Disabling acceleration on these cards prevents the hang, and the systems
> boot and run successfully.  The attached patch disables acceleration on
> MacBook Pros, and GeForce 3 cards.

It would be nice if we could fix this instead of brute force
disabling, but we're so close to release and this looks to affect so
many people (assumption based on number of mbp users alone) that I
think this approach is best for now. The logic seems right, but I
haven't seen any reports of tests to ensure this patch works as
intended. Christopher, have you or anyone else tested this?

What do we lose when we disable accel? I assume it's more than just
the non-existent 3D acceleration. I still think it's more important
that things work at all, but a discussion of what this causes would be
useful.

Once this can be confirmed as tested I will Ack it.

-- Chase
Andy Whitcroft - April 9, 2010, 3:05 p.m.
On Thu, Apr 08, 2010 at 07:10:48PM +1000, Christopher James Halse Rogers wrote:
> Currently in Lucid we have reports of nouveau hanging during boot on
> many of the recent MacBook Pro revisions, and also on GeForce 3 cards.
> See:  
> https://bugs.launchpad.net/bugs/546393 and
> https://bugs.launchpad.net/bugs/544088
> 
> Disabling acceleration on these cards prevents the hang, and the systems
> boot and run successfully.  The attached patch disables acceleration on
> MacBook Pros, and GeForce 3 cards.

> From 93f6ecde964414035e15fd3a773f46aa8e8366fa Mon Sep 17 00:00:00 2001
> From: Christopher James Halse Rogers <raof@ubuntu.com>
> Date: Thu, 8 Apr 2010 18:08:32 +1000
> Subject: [PATCH] UBUNTU: SAUCE: Nouveau: Disable acceleration on MacBook Pros and GeForce3 cards
> 
> Upstream obviously wants to fix acceleration rather than disable it.  For Lucid
> however we need these cards to boot more than we need them to be fast.
> 
> With acceleration enabled these cards hang during boot.

Concur with that position.

> 
> BugLink: http://bugs.launchpad.net/bugs/546393
> BugLink: http://bugs.launchpad.net/bugs/544088
> 
> Signed-off-by: Christopher James Halse Rogers <raof@ubuntu.com>
> ---
>  drivers/gpu/drm/nouveau/nouveau_drv.c   |    2 +-
>  drivers/gpu/drm/nouveau/nouveau_state.c |   28 ++++++++++++++++++++++++++++
>  2 files changed, 29 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c
> index da3b93b..d0caed5 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drv.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
> @@ -76,7 +76,7 @@ int nouveau_ignorelid = 0;
>  module_param_named(ignorelid, nouveau_ignorelid, int, 0400);
>  
>  MODULE_PARM_DESC(noagp, "Disable all acceleration");
> -int nouveau_noaccel = 0;
> +int nouveau_noaccel = -1;
>  module_param_named(noaccel, nouveau_noaccel, int, 0400);
>  
>  MODULE_PARM_DESC(noagp, "Disable fbcon acceleration");
> diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
> index a4851af..77f8f60 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_state.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_state.c
> @@ -599,6 +599,31 @@ static void nouveau_OF_copy_vbios_to_ramin(struct drm_device *dev)
>  #endif
>  }
>  
> +static void nouveau_apply_noaccel_quirks (struct drm_device *dev)
> +{
> +	struct drm_nouveau_private *dev_priv = dev->dev_private;
> +	if (nouveau_noaccel == -1) {
> +		/* If not specified, noaccel should default off */
> +		nouveau_noaccel = 0;
> +		
> +		/* MacBook Pro laptops with 9600GT cards hang with acceleration */
> +		/* See https://bugs.launchpad.net/bugs/546393 */
> +		if ((dev->pdev->device == 0x0647) &&
> +		    (dev->pdev->subsystem_vendor == 0x106b)) {
> +			nouveau_noaccel = 1;
> +			NV_INFO(dev, "Detected MacBook Pro 9600GT chip. "
> +				 "Disabling acceleration\n");
> +		}
> +		/* At least two of the three nv20 cards hang with acceleration */
> +		/* See https://bugs.launchpad.net/bugs/544088 */
> +		if (dev_priv->chipset == 0x20) {
> +			nouveau_noaccel = 1;
> +			NV_INFO(dev, "Detected NV20 (GeForce 3) chip. "
> +				 "Disabling acceleration\n");
> +		}
> +	}
> +}
> +
>  int nouveau_load(struct drm_device *dev, unsigned long flags)
>  {
>  	struct drm_nouveau_private *dev_priv;
> @@ -728,6 +753,9 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
>  	else if (dev->pci_device == 0x01f0)
>  		dev_priv->flags |= NV_NFORCE2;
>  
> +	/* Apply noaccel quirks */
> +	nouveau_apply_noaccel_quirks(dev);
> +
>  	/* For kernel modesetting, init card now and bring up fbcon */
>  	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
>  		int ret = nouveau_card_init(dev);

The overall concept looks fine.  I think that to make it more
maintainable going forward I will split it into three patches, then we
can revert individual bits of support more easily going forward.

Otherwise I think it does what I would expect, honouring the users
selection first and then switching only if they do not do so.

Acked-by: Andy Whitcroft <apw@canonical.com>

-apw
Andy Whitcroft - April 13, 2010, 5:05 p.m.
Ok, the patches are pretty simple and look straight forward.  All of the
combinations have tested good with the kernel command line nouveau.accel=0,
not booting at all or to corrupted displays without.  The patches have
been tested on a number of nvidia based systems to which the quirks do
_not_ apply and have neither triggered nor caused issues.

In light of this and in discussions with the X-team we have decided that
the risk is low for these patches, and the up-side for the affected
systems sufficient to warrent their inclusion in the release.

Therefore:

Acked-by: Andy Whitcroft <apw@canonical.com>

and:

Applied to Lucid.

-apw

Patch

From 93f6ecde964414035e15fd3a773f46aa8e8366fa Mon Sep 17 00:00:00 2001
From: Christopher James Halse Rogers <raof@ubuntu.com>
Date: Thu, 8 Apr 2010 18:08:32 +1000
Subject: [PATCH] UBUNTU: SAUCE: Nouveau: Disable acceleration on MacBook Pros and GeForce3 cards

Upstream obviously wants to fix acceleration rather than disable it.  For Lucid
however we need these cards to boot more than we need them to be fast.

With acceleration enabled these cards hang during boot.

BugLink: http://bugs.launchpad.net/bugs/546393
BugLink: http://bugs.launchpad.net/bugs/544088

Signed-off-by: Christopher James Halse Rogers <raof@ubuntu.com>
---

 drivers/gpu/drm/nouveau/nouveau_drv.c   |    2 +-
 drivers/gpu/drm/nouveau/nouveau_state.c |   28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c

index da3b93b..d0caed5 100644

--- a/drivers/gpu/drm/nouveau/nouveau_drv.c

+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c

@@ -76,7 +76,7 @@  int nouveau_ignorelid = 0;

 module_param_named(ignorelid, nouveau_ignorelid, int, 0400);
 
 MODULE_PARM_DESC(noagp, "Disable all acceleration");
-int nouveau_noaccel = 0;

+int nouveau_noaccel = -1;

 module_param_named(noaccel, nouveau_noaccel, int, 0400);
 
 MODULE_PARM_DESC(noagp, "Disable fbcon acceleration");
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c

index a4851af..77f8f60 100644

--- a/drivers/gpu/drm/nouveau/nouveau_state.c

+++ b/drivers/gpu/drm/nouveau/nouveau_state.c

@@ -599,6 +599,31 @@  static void nouveau_OF_copy_vbios_to_ramin(struct drm_device *dev)

 #endif
 }
 
+static void nouveau_apply_noaccel_quirks (struct drm_device *dev)

+{

+	struct drm_nouveau_private *dev_priv = dev->dev_private;

+	if (nouveau_noaccel == -1) {

+		/* If not specified, noaccel should default off */

+		nouveau_noaccel = 0;

+		

+		/* MacBook Pro laptops with 9600GT cards hang with acceleration */

+		/* See https://bugs.launchpad.net/bugs/546393 */

+		if ((dev->pdev->device == 0x0647) &&

+		    (dev->pdev->subsystem_vendor == 0x106b)) {

+			nouveau_noaccel = 1;

+			NV_INFO(dev, "Detected MacBook Pro 9600GT chip. "

+				 "Disabling acceleration\n");

+		}

+		/* At least two of the three nv20 cards hang with acceleration */

+		/* See https://bugs.launchpad.net/bugs/544088 */

+		if (dev_priv->chipset == 0x20) {

+			nouveau_noaccel = 1;

+			NV_INFO(dev, "Detected NV20 (GeForce 3) chip. "

+				 "Disabling acceleration\n");

+		}

+	}

+}

+

 int nouveau_load(struct drm_device *dev, unsigned long flags)
 {
 	struct drm_nouveau_private *dev_priv;
@@ -728,6 +753,9 @@  int nouveau_load(struct drm_device *dev, unsigned long flags)

 	else if (dev->pci_device == 0x01f0)
 		dev_priv->flags |= NV_NFORCE2;
 
+	/* Apply noaccel quirks */

+	nouveau_apply_noaccel_quirks(dev);

+

 	/* For kernel modesetting, init card now and bring up fbcon */
 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
 		int ret = nouveau_card_init(dev);
-- 

1.7.0