Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1353857 > unrolled thread

[PATCH 2/2] nouveau: use new vga_switcheroo power domain.

Started byDave Airlie <airlied@gmail.com>
First post2016-03-09 07:20 +0100
Last post2016-03-15 21:50 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] nouveau: use new vga_switcheroo power domain. Dave Airlie <airlied@gmail.com> - 2016-03-09 07:20 +0100
    Re: [PATCH 2/2] nouveau: use new vga_switcheroo power domain. "Rafael J. Wysocki" <rafael@kernel.org> - 2016-03-09 14:30 +0100
    Re: [PATCH 2/2] nouveau: use new vga_switcheroo power domain. Lukas Wunner <lukas@wunner.de> - 2016-03-09 15:40 +0100
      Re: [PATCH 2/2] nouveau: use new vga_switcheroo power domain. Dave Airlie <airlied@gmail.com> - 2016-03-09 23:10 +0100
        Re: [PATCH 2/2] nouveau: use new vga_switcheroo power domain. Lukas Wunner <lukas@wunner.de> - 2016-03-15 21:50 +0100

#1353857 — [PATCH 2/2] nouveau: use new vga_switcheroo power domain.

FromDave Airlie <airlied@gmail.com>
Date2016-03-09 07:20 +0100
Subject[PATCH 2/2] nouveau: use new vga_switcheroo power domain.
Message-ID<raFDs-3W3-19@gated-at.bofh.it>
From: Dave Airlie <airlied@redhat.com>

This fixes GPU auto powerdown on the Lenovo W541,
since we advertise Windows 2013 to the ACPI layer.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_vga.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
index af89c36..b987427f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_vga.c
+++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
@@ -101,8 +101,12 @@ nouveau_vga_init(struct nouveau_drm *drm)
 		runtime = true;
 	vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops, runtime);
 
-	if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
-		vga_switcheroo_init_domain_pm_ops(drm->dev->dev, &drm->vga_pm_domain);
+	if (runtime) {
+		if (nouveau_is_v1_dsm() && !nouveau_is_optimus())
+			vga_switcheroo_init_domain_pm_ops(drm->dev->dev, &drm->vga_pm_domain);
+		else if (nouveau_is_optimus())
+			vga_switcheroo_init_parent_pr3_ops(drm->dev->dev, &drm->vga_pm_domain);
+	}
 }
 
 void
@@ -117,7 +121,7 @@ nouveau_vga_fini(struct nouveau_drm *drm)
 		runtime = true;
 
 	vga_switcheroo_unregister_client(dev->pdev);
-	if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
+	if (runtime && (nouveau_is_v1_dsm() || nouveau_is_optimus()))
 		vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
 	vga_client_register(dev->pdev, NULL, NULL, NULL);
 }
-- 
2.5.0

[toc] | [next] | [standalone]


#1354117

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2016-03-09 14:30 +0100
Message-ID<raMlB-8tQ-39@gated-at.bofh.it>
In reply to#1353857
On Wed, Mar 9, 2016 at 7:14 AM, Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> This fixes GPU auto powerdown on the Lenovo W541,
> since we advertise Windows 2013 to the ACPI layer.
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/nouveau/nouveau_vga.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
> index af89c36..b987427f 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_vga.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
> @@ -101,8 +101,12 @@ nouveau_vga_init(struct nouveau_drm *drm)
>                 runtime = true;
>         vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops, runtime);
>
> -       if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
> -               vga_switcheroo_init_domain_pm_ops(drm->dev->dev, &drm->vga_pm_domain);
> +       if (runtime) {
> +               if (nouveau_is_v1_dsm() && !nouveau_is_optimus())
> +                       vga_switcheroo_init_domain_pm_ops(drm->dev->dev, &drm->vga_pm_domain);
> +               else if (nouveau_is_optimus())
> +                       vga_switcheroo_init_parent_pr3_ops(drm->dev->dev, &drm->vga_pm_domain);
> +       }
>  }
>
>  void
> @@ -117,7 +121,7 @@ nouveau_vga_fini(struct nouveau_drm *drm)
>                 runtime = true;
>
>         vga_switcheroo_unregister_client(dev->pdev);
> -       if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
> +       if (runtime && (nouveau_is_v1_dsm() || nouveau_is_optimus()))
>                 vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
>         vga_client_register(dev->pdev, NULL, NULL, NULL);
>  }
> --

Looks reasonable to me.

Thanks,
Rafael

[toc] | [prev] | [next] | [standalone]


#1354176

FromLukas Wunner <lukas@wunner.de>
Date2016-03-09 15:40 +0100
Message-ID<raNrk-Hp-11@gated-at.bofh.it>
In reply to#1353857
Hi Dave,

On Wed, Mar 09, 2016 at 04:14:05PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> This fixes GPU auto powerdown on the Lenovo W541,
> since we advertise Windows 2013 to the ACPI layer.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/nouveau/nouveau_vga.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
> index af89c36..b987427f 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_vga.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
> @@ -101,8 +101,12 @@ nouveau_vga_init(struct nouveau_drm *drm)
>  		runtime = true;
>  	vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops, runtime);
>  
> -	if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
> -		vga_switcheroo_init_domain_pm_ops(drm->dev->dev, &drm->vga_pm_domain);
> +	if (runtime) {
> +		if (nouveau_is_v1_dsm() && !nouveau_is_optimus())

The " && !nouveau_is_optimus()" can be dropped because a machine cannot
have both. Note the "else" in nouveau_dsm_detect():

        if (has_optimus == 1) { ...
                nouveau_dsm_priv.optimus_detected = true;
        } else if (vga_count == 2 && has_dsm && guid_valid) { ...
                nouveau_dsm_priv.dsm_detected = true;
        }

> +			vga_switcheroo_init_domain_pm_ops(drm->dev->dev, &drm->vga_pm_domain);
> +		else if (nouveau_is_optimus())
> +			vga_switcheroo_init_parent_pr3_ops(drm->dev->dev, &drm->vga_pm_domain);

You're calling this unconditionally for all Optimus machines yet
I assume pre Windows 10 machines lack the PR3 hooks.

Best regards,

Lukas

> +	}
>  }
>  
>  void
> @@ -117,7 +121,7 @@ nouveau_vga_fini(struct nouveau_drm *drm)
>  		runtime = true;
>  
>  	vga_switcheroo_unregister_client(dev->pdev);
> -	if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
> +	if (runtime && (nouveau_is_v1_dsm() || nouveau_is_optimus()))
>  		vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
>  	vga_client_register(dev->pdev, NULL, NULL, NULL);
>  }
> -- 
> 2.5.0

[toc] | [prev] | [next] | [standalone]


#1354508

FromDave Airlie <airlied@gmail.com>
Date2016-03-09 23:10 +0100
Message-ID<raUsQ-5Y7-39@gated-at.bofh.it>
In reply to#1354176
On 10 March 2016 at 00:40, Lukas Wunner <lukas@wunner.de> wrote:
> Hi Dave,
>
> On Wed, Mar 09, 2016 at 04:14:05PM +1000, Dave Airlie wrote:
>> From: Dave Airlie <airlied@redhat.com>
>>
>> This fixes GPU auto powerdown on the Lenovo W541,
>> since we advertise Windows 2013 to the ACPI layer.
>>
>> Signed-off-by: Dave Airlie <airlied@redhat.com>
>> ---
>>  drivers/gpu/drm/nouveau/nouveau_vga.c | 10 +++++++---
>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
>> index af89c36..b987427f 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_vga.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
>> @@ -101,8 +101,12 @@ nouveau_vga_init(struct nouveau_drm *drm)
>>               runtime = true;
>>       vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops, runtime);
>>
>> -     if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
>> -             vga_switcheroo_init_domain_pm_ops(drm->dev->dev, &drm->vga_pm_domain);
>> +     if (runtime) {
>> +             if (nouveau_is_v1_dsm() && !nouveau_is_optimus())
>
> The " && !nouveau_is_optimus()" can be dropped because a machine cannot
> have both. Note the "else" in nouveau_dsm_detect():

I'm pretty sure I've seen a machine with both in my past, back in the
Vista/Win7 crossover days.

> You're calling this unconditionally for all Optimus machines yet
> I assume pre Windows 10 machines lack the PR3 hooks.
>

Yes and I've confirmed on my older machine that nothing bad happens
doing it unconditionally,
and I couldn't find any bits in the _DSM flags to tell me if I should
do something different.

Dave.

[toc] | [prev] | [next] | [standalone]


#1358236

FromLukas Wunner <lukas@wunner.de>
Date2016-03-15 21:50 +0100
Message-ID<rd44G-7jA-9@gated-at.bofh.it>
In reply to#1354508
Hi Dave,

On Thu, Mar 10, 2016 at 08:04:26AM +1000, Dave Airlie wrote:
> On 10 March 2016 at 00:40, Lukas Wunner <lukas@wunner.de> wrote:
> > On Wed, Mar 09, 2016 at 04:14:05PM +1000, Dave Airlie wrote:
> >> From: Dave Airlie <airlied@redhat.com>
> >>
> >> This fixes GPU auto powerdown on the Lenovo W541,
> >> since we advertise Windows 2013 to the ACPI layer.
> >>
> >> Signed-off-by: Dave Airlie <airlied@redhat.com>
> >> ---
> >>  drivers/gpu/drm/nouveau/nouveau_vga.c | 10 +++++++---
> >>  1 file changed, 7 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
> >> index af89c36..b987427f 100644
> >> --- a/drivers/gpu/drm/nouveau/nouveau_vga.c
> >> +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
> >> @@ -101,8 +101,12 @@ nouveau_vga_init(struct nouveau_drm *drm)
> >>               runtime = true;
> >>       vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops, runtime);
> >>
> >> -     if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
> >> -             vga_switcheroo_init_domain_pm_ops(drm->dev->dev, &drm->vga_pm_domain);
> >> +     if (runtime) {
> >> +             if (nouveau_is_v1_dsm() && !nouveau_is_optimus())
> >
> > The " && !nouveau_is_optimus()" can be dropped because a machine cannot
> > have both. Note the "else" in nouveau_dsm_detect():
> 
> I'm pretty sure I've seen a machine with both in my past, back in the
> Vista/Win7 crossover days.

Yes, but the code in nouveau_dsm_detect() is such that you'll never have
both nouveau_is_v1_dsm() and nouveau_is_optimus() return true.

So you can drop the " && !nouveau_is_optimus()".

Best regards,

Lukas

> 
> > You're calling this unconditionally for all Optimus machines yet
> > I assume pre Windows 10 machines lack the PR3 hooks.
> >
> 
> Yes and I've confirmed on my older machine that nothing bad happens
> doing it unconditionally,
> and I couldn't find any bits in the _DSM flags to tell me if I should
> do something different.
> 
> Dave.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web