[alsa-devel] [PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-09 Thread Takashi Iwai
At Sat, 9 Jun 2012 08:57:20 +0100,
Dave Airlie wrote:
> 
> > Good to hear.
> > Dave, is it OK to apply the patch below through sound tree?
> 
> ack below,
> >
> >
> > thanks,
> >
> > Takashi
> >
> > ---
> > From: Takashi Iwai 
> > Subject: [PATCH] vga_switcheroo: Enable/disable audio clients at the right 
> > time
> >
> > The audio clients have to be disabled before disabling the VGA and
> > switching. ?Similarly, enabling the audio client should be done at
> > last. ?Otherwise the audio-side operation stalls, eventually leading
> > to Oops or lockups.
> >
> > Tested-by: J?rg-Volker Peetz 
> 
> Acked-by: Dave Airlie 

Thanks!


Takashi


[alsa-devel] [PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-09 Thread Dave Airlie
> Good to hear.
> Dave, is it OK to apply the patch below through sound tree?

ack below,
>
>
> thanks,
>
> Takashi
>
> ---
> From: Takashi Iwai 
> Subject: [PATCH] vga_switcheroo: Enable/disable audio clients at the right 
> time
>
> The audio clients have to be disabled before disabling the VGA and
> switching. ?Similarly, enabling the audio client should be done at
> last. ?Otherwise the audio-side operation stalls, eventually leading
> to Oops or lockups.
>
> Tested-by: J?rg-Volker Peetz 

Acked-by: Dave Airlie 

> Signed-off-by: Takashi Iwai 
> ---
> ?drivers/gpu/vga/vga_switcheroo.c | ? 14 --
> ?1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/vga/vga_switcheroo.c 
> b/drivers/gpu/vga/vga_switcheroo.c
> index 38f9534..e24ad99 100644
> --- a/drivers/gpu/vga/vga_switcheroo.c
> +++ b/drivers/gpu/vga/vga_switcheroo.c
> @@ -291,8 +291,6 @@ static int vga_switchto_stage1(struct 
> vga_switcheroo_client *new_client)
> ? ? ? ? ? ? ? ?vga_switchon(new_client);
>
> ? ? ? ?vga_set_default_device(new_client->pdev);
> - ? ? ? set_audio_state(new_client->id, VGA_SWITCHEROO_ON);
> -
> ? ? ? ?return 0;
> ?}
>
> @@ -308,6 +306,8 @@ static int vga_switchto_stage2(struct 
> vga_switcheroo_client *new_client)
>
> ? ? ? ?active->active = false;
>
> + ? ? ? set_audio_state(active->id, VGA_SWITCHEROO_OFF);
> +
> ? ? ? ?if (new_client->fb_info) {
> ? ? ? ? ? ? ? ?struct fb_event event;
> ? ? ? ? ? ? ? ?event.info = new_client->fb_info;
> @@ -321,11 +321,11 @@ static int vga_switchto_stage2(struct 
> vga_switcheroo_client *new_client)
> ? ? ? ?if (new_client->ops->reprobe)
> ? ? ? ? ? ? ? ?new_client->ops->reprobe(new_client->pdev);
>
> - ? ? ? set_audio_state(active->id, VGA_SWITCHEROO_OFF);
> -
> ? ? ? ?if (active->pwr_state == VGA_SWITCHEROO_ON)
> ? ? ? ? ? ? ? ?vga_switchoff(active);
>
> + ? ? ? set_audio_state(new_client->id, VGA_SWITCHEROO_ON);
> +
> ? ? ? ?new_client->active = true;
> ? ? ? ?return 0;
> ?}
> @@ -371,8 +371,9 @@ vga_switcheroo_debugfs_write(struct file *filp, const 
> char __user *ubuf,
> ? ? ? ?/* pwr off the device not in use */
> ? ? ? ?if (strncmp(usercmd, "OFF", 3) == 0) {
> ? ? ? ? ? ? ? ?list_for_each_entry(client, _priv.clients, list) {
> - ? ? ? ? ? ? ? ? ? ? ? if (client->active)
> + ? ? ? ? ? ? ? ? ? ? ? if (client->active || client_is_audio(client))
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?continue;
> + ? ? ? ? ? ? ? ? ? ? ? set_audio_state(client->id, VGA_SWITCHEROO_OFF);
> ? ? ? ? ? ? ? ? ? ? ? ?if (client->pwr_state == VGA_SWITCHEROO_ON)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vga_switchoff(client);
> ? ? ? ? ? ? ? ?}
> @@ -381,10 +382,11 @@ vga_switcheroo_debugfs_write(struct file *filp, const 
> char __user *ubuf,
> ? ? ? ?/* pwr on the device not in use */
> ? ? ? ?if (strncmp(usercmd, "ON", 2) == 0) {
> ? ? ? ? ? ? ? ?list_for_each_entry(client, _priv.clients, list) {
> - ? ? ? ? ? ? ? ? ? ? ? if (client->active)
> + ? ? ? ? ? ? ? ? ? ? ? if (client->active || client_is_audio(client))
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?continue;
> ? ? ? ? ? ? ? ? ? ? ? ?if (client->pwr_state == VGA_SWITCHEROO_OFF)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vga_switchon(client);
> + ? ? ? ? ? ? ? ? ? ? ? set_audio_state(client->id, VGA_SWITCHEROO_ON);
> ? ? ? ? ? ? ? ?}
> ? ? ? ? ? ? ? ?goto out;
> ? ? ? ?}
> --
> 1.7.10.4
>
> ___
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-09 Thread Takashi Iwai
At Fri, 08 Jun 2012 22:17:29 +0200,
J?rg-Volker Peetz wrote:
> 
> Takashi Iwai wrote, on 06/08/12 17:52:
> > At Fri, 08 Jun 2012 17:45:17 +0200,
> > J?rg-Volker Peetz wrote:
> >>
> >> Hello Takashi,
> >>
> >> Takashi Iwai wrote, on 06/08/12 15:03:
> >>> At Fri, 08 Jun 2012 13:26:57 +0200,
> >>> J?rg-Volker Peetz wrote:
> 
>  Takashi Iwai wrote, on 06/07/12 12:15:
> > Hi,
> >
> > this is a series of patches to fix the regressions of HD-audio HDMI
> > on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.
> >
> > The first patch adds a new helper function to vga-switcheroo and the
> > second just uses that instead of an open code.
> >
> > Dave, if the first patch is OK, I'm going to apply it though sound tree.
> > Let me know if any problem is found.
> >
> > Joerg, could you check whether this doesn't break your setup, too?
> >
> >
> > thanks,
> >
> > Takashi
> 
>  Hello Takashi,
> 
>  I applied both your patches on 3.5-rc1. With this kernel I made three 
>  tests.
>  1) After booting I switched off the discrete GPU via vga_switcheroo.
> Then ca. 210 times the message
> 
>   hda-intel: spurious response 0x0:0x0, last cmd=0x170503
> 
> appears on the console and in the logs.
> Starting X and using the built-in USB web-cam work, as well as sound 
>  with
> mplayer2 works.
> 
>  2) After booting I switched to the discrete GPU via
> 
>   echo -n DDIS > /sys/kernel/debugfs/vgaswitcheroo/switch
> 
> Then I started X via startx. The desktop screen appears but the system
> freezes. No reaction on keyboard or touchpad input. The computer is 
>  not
> reachable via ethernet wire.
> >>>
> >>> Hm, these issues aren't seen on 3.5-rc1 before my patches?
> >>> If so, we need to fix now.
> >>>
> >> No, these issues aren't seen on 3.5-rc1 without your patches. I'm able to 
> >> start
> >> X with the discrete GPU in use, direct rendering and the built-in USB 
> >> camera work.
> > 
> > OK, it means that the switching from the audio-ON to audio-OFF doesn't
> > work.  Could you try the patch below in additon?
> > 
> 
> Applying all your three patches on 3.5-rc1 makes the discrete GPU work on my
> system: after mounting debugfs and switching to "DDIS", I can start X and 
> direct
> rendering, sound and built-in USB camera work.

Good to hear.
Dave, is it OK to apply the patch below through sound tree?


thanks,

Takashi

---
From: Takashi Iwai 
Subject: [PATCH] vga_switcheroo: Enable/disable audio clients at the right time

The audio clients have to be disabled before disabling the VGA and
switching.  Similarly, enabling the audio client should be done at
last.  Otherwise the audio-side operation stalls, eventually leading
to Oops or lockups.

Tested-by: J?rg-Volker Peetz 
Signed-off-by: Takashi Iwai 
---
 drivers/gpu/vga/vga_switcheroo.c |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index 38f9534..e24ad99 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -291,8 +291,6 @@ static int vga_switchto_stage1(struct vga_switcheroo_client 
*new_client)
vga_switchon(new_client);

vga_set_default_device(new_client->pdev);
-   set_audio_state(new_client->id, VGA_SWITCHEROO_ON);
-
return 0;
 }

@@ -308,6 +306,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client 
*new_client)

active->active = false;

+   set_audio_state(active->id, VGA_SWITCHEROO_OFF);
+
if (new_client->fb_info) {
struct fb_event event;
event.info = new_client->fb_info;
@@ -321,11 +321,11 @@ static int vga_switchto_stage2(struct 
vga_switcheroo_client *new_client)
if (new_client->ops->reprobe)
new_client->ops->reprobe(new_client->pdev);

-   set_audio_state(active->id, VGA_SWITCHEROO_OFF);
-
if (active->pwr_state == VGA_SWITCHEROO_ON)
vga_switchoff(active);

+   set_audio_state(new_client->id, VGA_SWITCHEROO_ON);
+
new_client->active = true;
return 0;
 }
@@ -371,8 +371,9 @@ vga_switcheroo_debugfs_write(struct file *filp, const char 
__user *ubuf,
/* pwr off the device not in use */
if (strncmp(usercmd, "OFF", 3) == 0) {
list_for_each_entry(client, _priv.clients, list) {
-   if (client->active)
+   if (client->active || client_is_audio(client))
continue;
+   set_audio_state(client->id, VGA_SWITCHEROO_OFF);
if (client->pwr_state == VGA_SWITCHEROO_ON)
vga_switchoff(client);
}
@@ -381,10 +382,11 @@ vga_switcheroo_debugfs_write(struct file 

Re: [alsa-devel] [PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-09 Thread Dave Airlie
 Good to hear.
 Dave, is it OK to apply the patch below through sound tree?

ack below,


 thanks,

 Takashi

 ---
 From: Takashi Iwai ti...@suse.de
 Subject: [PATCH] vga_switcheroo: Enable/disable audio clients at the right 
 time

 The audio clients have to be disabled before disabling the VGA and
 switching.  Similarly, enabling the audio client should be done at
 last.  Otherwise the audio-side operation stalls, eventually leading
 to Oops or lockups.

 Tested-by: Jörg-Volker Peetz jvpe...@web.de

Acked-by: Dave Airlie airl...@redhat.com

 Signed-off-by: Takashi Iwai ti...@suse.de
 ---
  drivers/gpu/vga/vga_switcheroo.c |   14 --
  1 file changed, 8 insertions(+), 6 deletions(-)

 diff --git a/drivers/gpu/vga/vga_switcheroo.c 
 b/drivers/gpu/vga/vga_switcheroo.c
 index 38f9534..e24ad99 100644
 --- a/drivers/gpu/vga/vga_switcheroo.c
 +++ b/drivers/gpu/vga/vga_switcheroo.c
 @@ -291,8 +291,6 @@ static int vga_switchto_stage1(struct 
 vga_switcheroo_client *new_client)
                vga_switchon(new_client);

        vga_set_default_device(new_client-pdev);
 -       set_audio_state(new_client-id, VGA_SWITCHEROO_ON);
 -
        return 0;
  }

 @@ -308,6 +306,8 @@ static int vga_switchto_stage2(struct 
 vga_switcheroo_client *new_client)

        active-active = false;

 +       set_audio_state(active-id, VGA_SWITCHEROO_OFF);
 +
        if (new_client-fb_info) {
                struct fb_event event;
                event.info = new_client-fb_info;
 @@ -321,11 +321,11 @@ static int vga_switchto_stage2(struct 
 vga_switcheroo_client *new_client)
        if (new_client-ops-reprobe)
                new_client-ops-reprobe(new_client-pdev);

 -       set_audio_state(active-id, VGA_SWITCHEROO_OFF);
 -
        if (active-pwr_state == VGA_SWITCHEROO_ON)
                vga_switchoff(active);

 +       set_audio_state(new_client-id, VGA_SWITCHEROO_ON);
 +
        new_client-active = true;
        return 0;
  }
 @@ -371,8 +371,9 @@ vga_switcheroo_debugfs_write(struct file *filp, const 
 char __user *ubuf,
        /* pwr off the device not in use */
        if (strncmp(usercmd, OFF, 3) == 0) {
                list_for_each_entry(client, vgasr_priv.clients, list) {
 -                       if (client-active)
 +                       if (client-active || client_is_audio(client))
                                continue;
 +                       set_audio_state(client-id, VGA_SWITCHEROO_OFF);
                        if (client-pwr_state == VGA_SWITCHEROO_ON)
                                vga_switchoff(client);
                }
 @@ -381,10 +382,11 @@ vga_switcheroo_debugfs_write(struct file *filp, const 
 char __user *ubuf,
        /* pwr on the device not in use */
        if (strncmp(usercmd, ON, 2) == 0) {
                list_for_each_entry(client, vgasr_priv.clients, list) {
 -                       if (client-active)
 +                       if (client-active || client_is_audio(client))
                                continue;
                        if (client-pwr_state == VGA_SWITCHEROO_OFF)
                                vga_switchon(client);
 +                       set_audio_state(client-id, VGA_SWITCHEROO_ON);
                }
                goto out;
        }
 --
 1.7.10.4

 ___
 Alsa-devel mailing list
 alsa-de...@alsa-project.org
 http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [alsa-devel] [PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-09 Thread Takashi Iwai
At Sat, 9 Jun 2012 08:57:20 +0100,
Dave Airlie wrote:
 
  Good to hear.
  Dave, is it OK to apply the patch below through sound tree?
 
 ack below,
 
 
  thanks,
 
  Takashi
 
  ---
  From: Takashi Iwai ti...@suse.de
  Subject: [PATCH] vga_switcheroo: Enable/disable audio clients at the right 
  time
 
  The audio clients have to be disabled before disabling the VGA and
  switching.  Similarly, enabling the audio client should be done at
  last.  Otherwise the audio-side operation stalls, eventually leading
  to Oops or lockups.
 
  Tested-by: Jörg-Volker Peetz jvpe...@web.de
 
 Acked-by: Dave Airlie airl...@redhat.com

Thanks!


Takashi
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-08 Thread Jörg-Volker Peetz
Takashi Iwai wrote, on 06/08/12 17:52:
> At Fri, 08 Jun 2012 17:45:17 +0200,
> J?rg-Volker Peetz wrote:
>>
>> Hello Takashi,
>>
>> Takashi Iwai wrote, on 06/08/12 15:03:
>>> At Fri, 08 Jun 2012 13:26:57 +0200,
>>> J?rg-Volker Peetz wrote:

 Takashi Iwai wrote, on 06/07/12 12:15:
> Hi,
>
> this is a series of patches to fix the regressions of HD-audio HDMI
> on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.
>
> The first patch adds a new helper function to vga-switcheroo and the
> second just uses that instead of an open code.
>
> Dave, if the first patch is OK, I'm going to apply it though sound tree.
> Let me know if any problem is found.
>
> Joerg, could you check whether this doesn't break your setup, too?
>
>
> thanks,
>
> Takashi

 Hello Takashi,

 I applied both your patches on 3.5-rc1. With this kernel I made three 
 tests.
 1) After booting I switched off the discrete GPU via vga_switcheroo.
Then ca. 210 times the message

  hda-intel: spurious response 0x0:0x0, last cmd=0x170503

appears on the console and in the logs.
Starting X and using the built-in USB web-cam work, as well as sound 
 with
mplayer2 works.

 2) After booting I switched to the discrete GPU via

  echo -n DDIS > /sys/kernel/debugfs/vgaswitcheroo/switch

Then I started X via startx. The desktop screen appears but the system
freezes. No reaction on keyboard or touchpad input. The computer is not
reachable via ethernet wire.
>>>
>>> Hm, these issues aren't seen on 3.5-rc1 before my patches?
>>> If so, we need to fix now.
>>>
>> No, these issues aren't seen on 3.5-rc1 without your patches. I'm able to 
>> start
>> X with the discrete GPU in use, direct rendering and the built-in USB camera 
>> work.
> 
> OK, it means that the switching from the audio-ON to audio-OFF doesn't
> work.  Could you try the patch below in additon?
> 

Applying all your three patches on 3.5-rc1 makes the discrete GPU work on my
system: after mounting debugfs and switching to "DDIS", I can start X and direct
rendering, sound and built-in USB camera work.

By the way, writing "DDIS" to /sys/kernel/debugfs/vgaswitcheroo switches off the
integrated GPU. That's the reason for loosing the control over the screen
brightness. Switching on also the integrated GPU (writing "ON" to
/sys/kernel/debugfs/vgaswitcheroo) enables the brightness control of the screen.
Of course for the energy consumption this is awkward.
I write all this as information about the state of vga_switcheroo for David.

Many thanks to you and David for all your work.

>> Probably unrelated: in both cases I'm unable to lower the screen brightness 
>> from
>> highest value. Without your patches it appears a warning:
>>
>>   ACPI Warning: _BQC returned an invalid level (20120320/video-472)
> 
> Hmm, I see no relation between this and the HDMI audio part.
> It's of course possible that some non-working state gives
> side-effects...
> 
> 
> thanks,
> 
> Takashi
> 

-- 
Best regards,
J?rg-Volker.



[PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-08 Thread Takashi Iwai
At Fri, 08 Jun 2012 17:45:17 +0200,
J?rg-Volker Peetz wrote:
> 
> Hello Takashi,
> 
> Takashi Iwai wrote, on 06/08/12 15:03:
> > At Fri, 08 Jun 2012 13:26:57 +0200,
> > J?rg-Volker Peetz wrote:
> >>
> >> Takashi Iwai wrote, on 06/07/12 12:15:
> >>> Hi,
> >>>
> >>> this is a series of patches to fix the regressions of HD-audio HDMI
> >>> on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.
> >>>
> >>> The first patch adds a new helper function to vga-switcheroo and the
> >>> second just uses that instead of an open code.
> >>>
> >>> Dave, if the first patch is OK, I'm going to apply it though sound tree.
> >>> Let me know if any problem is found.
> >>>
> >>> Joerg, could you check whether this doesn't break your setup, too?
> >>>
> >>>
> >>> thanks,
> >>>
> >>> Takashi
> >>
> >> Hello Takashi,
> >>
> >> I applied both your patches on 3.5-rc1. With this kernel I made three 
> >> tests.
> >> 1) After booting I switched off the discrete GPU via vga_switcheroo.
> >>Then ca. 210 times the message
> >>
> >>  hda-intel: spurious response 0x0:0x0, last cmd=0x170503
> >>
> >>appears on the console and in the logs.
> >>Starting X and using the built-in USB web-cam work, as well as sound 
> >> with
> >>mplayer2 works.
> >>
> >> 2) After booting I switched to the discrete GPU via
> >>
> >>  echo -n DDIS > /sys/kernel/debugfs/vgaswitcheroo/switch
> >>
> >>Then I started X via startx. The desktop screen appears but the system
> >>freezes. No reaction on keyboard or touchpad input. The computer is not
> >>reachable via ethernet wire.
> > 
> > Hm, these issues aren't seen on 3.5-rc1 before my patches?
> > If so, we need to fix now.
> > 
> No, these issues aren't seen on 3.5-rc1 without your patches. I'm able to 
> start
> X with the discrete GPU in use, direct rendering and the built-in USB camera 
> work.

OK, it means that the switching from the audio-ON to audio-OFF doesn't
work.  Could you try the patch below in additon?

> Probably unrelated: in both cases I'm unable to lower the screen brightness 
> from
> highest value. Without your patches it appears a warning:
> 
>   ACPI Warning: _BQC returned an invalid level (20120320/video-472)

Hmm, I see no relation between this and the HDMI audio part.
It's of course possible that some non-working state gives
side-effects...


thanks,

Takashi

---
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index eb4f64f..5b3c7d1 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -304,8 +304,6 @@ static int vga_switchto_stage1(struct vga_switcheroo_client 
*new_client)
vga_switchon(new_client);

vga_set_default_device(new_client->pdev);
-   set_audio_state(new_client->id, VGA_SWITCHEROO_ON);
-
return 0;
 }

@@ -321,6 +319,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client 
*new_client)

active->active = false;

+   set_audio_state(active->id, VGA_SWITCHEROO_OFF);
+
if (new_client->fb_info) {
struct fb_event event;
event.info = new_client->fb_info;
@@ -334,11 +334,11 @@ static int vga_switchto_stage2(struct 
vga_switcheroo_client *new_client)
if (new_client->ops->reprobe)
new_client->ops->reprobe(new_client->pdev);

-   set_audio_state(active->id, VGA_SWITCHEROO_OFF);
-
if (active->pwr_state == VGA_SWITCHEROO_ON)
vga_switchoff(active);

+   set_audio_state(new_client->id, VGA_SWITCHEROO_ON);
+
new_client->active = true;
return 0;
 }
@@ -384,8 +384,9 @@ vga_switcheroo_debugfs_write(struct file *filp, const char 
__user *ubuf,
/* pwr off the device not in use */
if (strncmp(usercmd, "OFF", 3) == 0) {
list_for_each_entry(client, _priv.clients, list) {
-   if (client->active)
+   if (client->active || client_is_audio(client))
continue;
+   set_audio_state(client->id, VGA_SWITCHEROO_OFF);
if (client->pwr_state == VGA_SWITCHEROO_ON)
vga_switchoff(client);
}
@@ -394,10 +395,11 @@ vga_switcheroo_debugfs_write(struct file *filp, const 
char __user *ubuf,
/* pwr on the device not in use */
if (strncmp(usercmd, "ON", 2) == 0) {
list_for_each_entry(client, _priv.clients, list) {
-   if (client->active)
+   if (client->active || client_is_audio(client))
continue;
if (client->pwr_state == VGA_SWITCHEROO_OFF)
vga_switchon(client);
+   set_audio_state(client->id, VGA_SWITCHEROO_ON);
}
goto out;
}


[PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-08 Thread Jörg-Volker Peetz
Hello Takashi,

Takashi Iwai wrote, on 06/08/12 15:03:
> At Fri, 08 Jun 2012 13:26:57 +0200,
> J?rg-Volker Peetz wrote:
>>
>> Takashi Iwai wrote, on 06/07/12 12:15:
>>> Hi,
>>>
>>> this is a series of patches to fix the regressions of HD-audio HDMI
>>> on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.
>>>
>>> The first patch adds a new helper function to vga-switcheroo and the
>>> second just uses that instead of an open code.
>>>
>>> Dave, if the first patch is OK, I'm going to apply it though sound tree.
>>> Let me know if any problem is found.
>>>
>>> Joerg, could you check whether this doesn't break your setup, too?
>>>
>>>
>>> thanks,
>>>
>>> Takashi
>>
>> Hello Takashi,
>>
>> I applied both your patches on 3.5-rc1. With this kernel I made three tests.
>> 1) After booting I switched off the discrete GPU via vga_switcheroo.
>>Then ca. 210 times the message
>>
>>  hda-intel: spurious response 0x0:0x0, last cmd=0x170503
>>
>>appears on the console and in the logs.
>>Starting X and using the built-in USB web-cam work, as well as sound with
>>mplayer2 works.
>>
>> 2) After booting I switched to the discrete GPU via
>>
>>  echo -n DDIS > /sys/kernel/debugfs/vgaswitcheroo/switch
>>
>>Then I started X via startx. The desktop screen appears but the system
>>freezes. No reaction on keyboard or touchpad input. The computer is not
>>reachable via ethernet wire.
> 
> Hm, these issues aren't seen on 3.5-rc1 before my patches?
> If so, we need to fix now.
> 
No, these issues aren't seen on 3.5-rc1 without your patches. I'm able to start
X with the discrete GPU in use, direct rendering and the built-in USB camera 
work.
Probably unrelated: in both cases I'm unable to lower the screen brightness from
highest value. Without your patches it appears a warning:

  ACPI Warning: _BQC returned an invalid level (20120320/video-472)


>>
>> 3) After booting the machine freezes (hard-lock) when trying to switch to
>>dynamic power mangement on the integrated GPU via
>>
>>  echo -n dynpm > /sys/class/drm/card0/device/power_method
>>
>>   at least two trace calls are done. On the console only the last two lines 
>> of
>>   one call trace and the last one are visible (machine is frozen). It says
>>   (typed by hand, therefore, not complete):
> 
> This is an irrelevant issue with my patches.
> 
> 
> thanks,
> 
> Takashi

-- 
Best regards,
J?rg-Volker.



[PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-08 Thread Takashi Iwai
At Fri, 08 Jun 2012 13:26:57 +0200,
J?rg-Volker Peetz wrote:
> 
> Takashi Iwai wrote, on 06/07/12 12:15:
> > Hi,
> > 
> > this is a series of patches to fix the regressions of HD-audio HDMI
> > on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.
> > 
> > The first patch adds a new helper function to vga-switcheroo and the
> > second just uses that instead of an open code.
> > 
> > Dave, if the first patch is OK, I'm going to apply it though sound tree.
> > Let me know if any problem is found.
> > 
> > Joerg, could you check whether this doesn't break your setup, too?
> > 
> > 
> > thanks,
> > 
> > Takashi
> 
> Hello Takashi,
> 
> I applied both your patches on 3.5-rc1. With this kernel I made three tests.
> 1) After booting I switched off the discrete GPU via vga_switcheroo.
>Then ca. 210 times the message
> 
>  hda-intel: spurious response 0x0:0x0, last cmd=0x170503
> 
>appears on the console and in the logs.
>Starting X and using the built-in USB web-cam work, as well as sound with
>mplayer2 works.
> 
> 2) After booting I switched to the discrete GPU via
> 
>  echo -n DDIS > /sys/kernel/debugfs/vgaswitcheroo/switch
> 
>Then I started X via startx. The desktop screen appears but the system
>freezes. No reaction on keyboard or touchpad input. The computer is not
>reachable via ethernet wire.

Hm, these issues aren't seen on 3.5-rc1 before my patches?
If so, we need to fix now.

> 
> 3) After booting the machine freezes (hard-lock) when trying to switch to
>dynamic power mangement on the integrated GPU via
> 
>  echo -n dynpm > /sys/class/drm/card0/device/power_method
> 
>   at least two trace calls are done. On the console only the last two lines of
>   one call trace and the last one are visible (machine is frozen). It says
>   (typed by hand, therefore, not complete):

This is an irrelevant issue with my patches.


thanks,

Takashi


[PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-08 Thread Jörg-Volker Peetz
Takashi Iwai wrote, on 06/07/12 12:15:
> Hi,
> 
> this is a series of patches to fix the regressions of HD-audio HDMI
> on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.
> 
> The first patch adds a new helper function to vga-switcheroo and the
> second just uses that instead of an open code.
> 
> Dave, if the first patch is OK, I'm going to apply it though sound tree.
> Let me know if any problem is found.
> 
> Joerg, could you check whether this doesn't break your setup, too?
> 
> 
> thanks,
> 
> Takashi

Hello Takashi,

I applied both your patches on 3.5-rc1. With this kernel I made three tests.
1) After booting I switched off the discrete GPU via vga_switcheroo.
   Then ca. 210 times the message

 hda-intel: spurious response 0x0:0x0, last cmd=0x170503

   appears on the console and in the logs.
   Starting X and using the built-in USB web-cam work, as well as sound with
   mplayer2 works.

2) After booting I switched to the discrete GPU via

 echo -n DDIS > /sys/kernel/debugfs/vgaswitcheroo/switch

   Then I started X via startx. The desktop screen appears but the system
   freezes. No reaction on keyboard or touchpad input. The computer is not
   reachable via ethernet wire.

3) After booting the machine freezes (hard-lock) when trying to switch to
   dynamic power mangement on the integrated GPU via

 echo -n dynpm > /sys/class/drm/card0/device/power_method

  at least two trace calls are done. On the console only the last two lines of
  one call trace and the last one are visible (machine is frozen). It says
  (typed by hand, therefore, not complete):

...
---[ end trace a926a4156be75305 ]---
BUG: unable to handle kernel paging request at fff8
IP: [] kthread_data+0x7/0x10
PGD 1585067 PUD 1586067 PMD 0
Oops:  [#2] SMP
CPU 1

...

Call Trace:
[< ... >] ? wq_worker_sleeping+0x8/0x80
   ...? __schedule+0x363/0x520
   ...? do_exit+0x552/0x850
   ...? oops_end+0x67/0x90
   ...? no_context+0x24e/0x279
   ...? do_page_fault+0x2bb/0x460

...
---[ end trace a926a4156be75305 ]---
Fixing recursive fault but reboot is needed!

-- 
Best regards,
J?rg-Volker.


Re: [PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-08 Thread Takashi Iwai
At Fri, 08 Jun 2012 13:26:57 +0200,
Jörg-Volker Peetz wrote:
 
 Takashi Iwai wrote, on 06/07/12 12:15:
  Hi,
  
  this is a series of patches to fix the regressions of HD-audio HDMI
  on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.
  
  The first patch adds a new helper function to vga-switcheroo and the
  second just uses that instead of an open code.
  
  Dave, if the first patch is OK, I'm going to apply it though sound tree.
  Let me know if any problem is found.
  
  Joerg, could you check whether this doesn't break your setup, too?
  
  
  thanks,
  
  Takashi
 
 Hello Takashi,
 
 I applied both your patches on 3.5-rc1. With this kernel I made three tests.
 1) After booting I switched off the discrete GPU via vga_switcheroo.
Then ca. 210 times the message
 
  hda-intel: spurious response 0x0:0x0, last cmd=0x170503
 
appears on the console and in the logs.
Starting X and using the built-in USB web-cam work, as well as sound with
mplayer2 works.
 
 2) After booting I switched to the discrete GPU via
 
  echo -n DDIS  /sys/kernel/debugfs/vgaswitcheroo/switch
 
Then I started X via startx. The desktop screen appears but the system
freezes. No reaction on keyboard or touchpad input. The computer is not
reachable via ethernet wire.

Hm, these issues aren't seen on 3.5-rc1 before my patches?
If so, we need to fix now.

 
 3) After booting the machine freezes (hard-lock) when trying to switch to
dynamic power mangement on the integrated GPU via
 
  echo -n dynpm  /sys/class/drm/card0/device/power_method
 
   at least two trace calls are done. On the console only the last two lines of
   one call trace and the last one are visible (machine is frozen). It says
   (typed by hand, therefore, not complete):

This is an irrelevant issue with my patches.


thanks,

Takashi
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-08 Thread Jörg-Volker Peetz
Takashi Iwai wrote, on 06/07/12 12:15:
 Hi,
 
 this is a series of patches to fix the regressions of HD-audio HDMI
 on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.
 
 The first patch adds a new helper function to vga-switcheroo and the
 second just uses that instead of an open code.
 
 Dave, if the first patch is OK, I'm going to apply it though sound tree.
 Let me know if any problem is found.
 
 Joerg, could you check whether this doesn't break your setup, too?
 
 
 thanks,
 
 Takashi

Hello Takashi,

I applied both your patches on 3.5-rc1. With this kernel I made three tests.
1) After booting I switched off the discrete GPU via vga_switcheroo.
   Then ca. 210 times the message

 hda-intel: spurious response 0x0:0x0, last cmd=0x170503

   appears on the console and in the logs.
   Starting X and using the built-in USB web-cam work, as well as sound with
   mplayer2 works.

2) After booting I switched to the discrete GPU via

 echo -n DDIS  /sys/kernel/debugfs/vgaswitcheroo/switch

   Then I started X via startx. The desktop screen appears but the system
   freezes. No reaction on keyboard or touchpad input. The computer is not
   reachable via ethernet wire.

3) After booting the machine freezes (hard-lock) when trying to switch to
   dynamic power mangement on the integrated GPU via

 echo -n dynpm  /sys/class/drm/card0/device/power_method

  at least two trace calls are done. On the console only the last two lines of
  one call trace and the last one are visible (machine is frozen). It says
  (typed by hand, therefore, not complete):

...
---[ end trace a926a4156be75305 ]---
BUG: unable to handle kernel paging request at fff8
IP: [81045097] kthread_data+0x7/0x10
PGD 1585067 PUD 1586067 PMD 0
Oops:  [#2] SMP
CPU 1

...

Call Trace:
[ ... ] ? wq_worker_sleeping+0x8/0x80
   ...? __schedule+0x363/0x520
   ...? do_exit+0x552/0x850
   ...? oops_end+0x67/0x90
   ...? no_context+0x24e/0x279
   ...? do_page_fault+0x2bb/0x460

...
---[ end trace a926a4156be75305 ]---
Fixing recursive fault but reboot is needed!

-- 
Best regards,
Jörg-Volker.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-08 Thread Takashi Iwai
At Fri, 08 Jun 2012 17:45:17 +0200,
Jörg-Volker Peetz wrote:
 
 Hello Takashi,
 
 Takashi Iwai wrote, on 06/08/12 15:03:
  At Fri, 08 Jun 2012 13:26:57 +0200,
  Jörg-Volker Peetz wrote:
 
  Takashi Iwai wrote, on 06/07/12 12:15:
  Hi,
 
  this is a series of patches to fix the regressions of HD-audio HDMI
  on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.
 
  The first patch adds a new helper function to vga-switcheroo and the
  second just uses that instead of an open code.
 
  Dave, if the first patch is OK, I'm going to apply it though sound tree.
  Let me know if any problem is found.
 
  Joerg, could you check whether this doesn't break your setup, too?
 
 
  thanks,
 
  Takashi
 
  Hello Takashi,
 
  I applied both your patches on 3.5-rc1. With this kernel I made three 
  tests.
  1) After booting I switched off the discrete GPU via vga_switcheroo.
 Then ca. 210 times the message
 
   hda-intel: spurious response 0x0:0x0, last cmd=0x170503
 
 appears on the console and in the logs.
 Starting X and using the built-in USB web-cam work, as well as sound 
  with
 mplayer2 works.
 
  2) After booting I switched to the discrete GPU via
 
   echo -n DDIS  /sys/kernel/debugfs/vgaswitcheroo/switch
 
 Then I started X via startx. The desktop screen appears but the system
 freezes. No reaction on keyboard or touchpad input. The computer is not
 reachable via ethernet wire.
  
  Hm, these issues aren't seen on 3.5-rc1 before my patches?
  If so, we need to fix now.
  
 No, these issues aren't seen on 3.5-rc1 without your patches. I'm able to 
 start
 X with the discrete GPU in use, direct rendering and the built-in USB camera 
 work.

OK, it means that the switching from the audio-ON to audio-OFF doesn't
work.  Could you try the patch below in additon?

 Probably unrelated: in both cases I'm unable to lower the screen brightness 
 from
 highest value. Without your patches it appears a warning:
 
   ACPI Warning: _BQC returned an invalid level (20120320/video-472)

Hmm, I see no relation between this and the HDMI audio part.
It's of course possible that some non-working state gives
side-effects...


thanks,

Takashi

---
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index eb4f64f..5b3c7d1 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -304,8 +304,6 @@ static int vga_switchto_stage1(struct vga_switcheroo_client 
*new_client)
vga_switchon(new_client);
 
vga_set_default_device(new_client-pdev);
-   set_audio_state(new_client-id, VGA_SWITCHEROO_ON);
-
return 0;
 }
 
@@ -321,6 +319,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client 
*new_client)
 
active-active = false;
 
+   set_audio_state(active-id, VGA_SWITCHEROO_OFF);
+
if (new_client-fb_info) {
struct fb_event event;
event.info = new_client-fb_info;
@@ -334,11 +334,11 @@ static int vga_switchto_stage2(struct 
vga_switcheroo_client *new_client)
if (new_client-ops-reprobe)
new_client-ops-reprobe(new_client-pdev);
 
-   set_audio_state(active-id, VGA_SWITCHEROO_OFF);
-
if (active-pwr_state == VGA_SWITCHEROO_ON)
vga_switchoff(active);
 
+   set_audio_state(new_client-id, VGA_SWITCHEROO_ON);
+
new_client-active = true;
return 0;
 }
@@ -384,8 +384,9 @@ vga_switcheroo_debugfs_write(struct file *filp, const char 
__user *ubuf,
/* pwr off the device not in use */
if (strncmp(usercmd, OFF, 3) == 0) {
list_for_each_entry(client, vgasr_priv.clients, list) {
-   if (client-active)
+   if (client-active || client_is_audio(client))
continue;
+   set_audio_state(client-id, VGA_SWITCHEROO_OFF);
if (client-pwr_state == VGA_SWITCHEROO_ON)
vga_switchoff(client);
}
@@ -394,10 +395,11 @@ vga_switcheroo_debugfs_write(struct file *filp, const 
char __user *ubuf,
/* pwr on the device not in use */
if (strncmp(usercmd, ON, 2) == 0) {
list_for_each_entry(client, vgasr_priv.clients, list) {
-   if (client-active)
+   if (client-active || client_is_audio(client))
continue;
if (client-pwr_state == VGA_SWITCHEROO_OFF)
vga_switchon(client);
+   set_audio_state(client-id, VGA_SWITCHEROO_ON);
}
goto out;
}
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-08 Thread Jörg-Volker Peetz
Hello Takashi,

Takashi Iwai wrote, on 06/08/12 15:03:
 At Fri, 08 Jun 2012 13:26:57 +0200,
 Jörg-Volker Peetz wrote:

 Takashi Iwai wrote, on 06/07/12 12:15:
 Hi,

 this is a series of patches to fix the regressions of HD-audio HDMI
 on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.

 The first patch adds a new helper function to vga-switcheroo and the
 second just uses that instead of an open code.

 Dave, if the first patch is OK, I'm going to apply it though sound tree.
 Let me know if any problem is found.

 Joerg, could you check whether this doesn't break your setup, too?


 thanks,

 Takashi

 Hello Takashi,

 I applied both your patches on 3.5-rc1. With this kernel I made three tests.
 1) After booting I switched off the discrete GPU via vga_switcheroo.
Then ca. 210 times the message

  hda-intel: spurious response 0x0:0x0, last cmd=0x170503

appears on the console and in the logs.
Starting X and using the built-in USB web-cam work, as well as sound with
mplayer2 works.

 2) After booting I switched to the discrete GPU via

  echo -n DDIS  /sys/kernel/debugfs/vgaswitcheroo/switch

Then I started X via startx. The desktop screen appears but the system
freezes. No reaction on keyboard or touchpad input. The computer is not
reachable via ethernet wire.
 
 Hm, these issues aren't seen on 3.5-rc1 before my patches?
 If so, we need to fix now.
 
No, these issues aren't seen on 3.5-rc1 without your patches. I'm able to start
X with the discrete GPU in use, direct rendering and the built-in USB camera 
work.
Probably unrelated: in both cases I'm unable to lower the screen brightness from
highest value. Without your patches it appears a warning:

  ACPI Warning: _BQC returned an invalid level (20120320/video-472)



 3) After booting the machine freezes (hard-lock) when trying to switch to
dynamic power mangement on the integrated GPU via

  echo -n dynpm  /sys/class/drm/card0/device/power_method

   at least two trace calls are done. On the console only the last two lines 
 of
   one call trace and the last one are visible (machine is frozen). It says
   (typed by hand, therefore, not complete):
 
 This is an irrelevant issue with my patches.
 
 
 thanks,
 
 Takashi

-- 
Best regards,
Jörg-Volker.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-08 Thread Jörg-Volker Peetz
Takashi Iwai wrote, on 06/08/12 17:52:
 At Fri, 08 Jun 2012 17:45:17 +0200,
 Jörg-Volker Peetz wrote:

 Hello Takashi,

 Takashi Iwai wrote, on 06/08/12 15:03:
 At Fri, 08 Jun 2012 13:26:57 +0200,
 Jörg-Volker Peetz wrote:

 Takashi Iwai wrote, on 06/07/12 12:15:
 Hi,

 this is a series of patches to fix the regressions of HD-audio HDMI
 on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.

 The first patch adds a new helper function to vga-switcheroo and the
 second just uses that instead of an open code.

 Dave, if the first patch is OK, I'm going to apply it though sound tree.
 Let me know if any problem is found.

 Joerg, could you check whether this doesn't break your setup, too?


 thanks,

 Takashi

 Hello Takashi,

 I applied both your patches on 3.5-rc1. With this kernel I made three 
 tests.
 1) After booting I switched off the discrete GPU via vga_switcheroo.
Then ca. 210 times the message

  hda-intel: spurious response 0x0:0x0, last cmd=0x170503

appears on the console and in the logs.
Starting X and using the built-in USB web-cam work, as well as sound 
 with
mplayer2 works.

 2) After booting I switched to the discrete GPU via

  echo -n DDIS  /sys/kernel/debugfs/vgaswitcheroo/switch

Then I started X via startx. The desktop screen appears but the system
freezes. No reaction on keyboard or touchpad input. The computer is not
reachable via ethernet wire.

 Hm, these issues aren't seen on 3.5-rc1 before my patches?
 If so, we need to fix now.

 No, these issues aren't seen on 3.5-rc1 without your patches. I'm able to 
 start
 X with the discrete GPU in use, direct rendering and the built-in USB camera 
 work.
 
 OK, it means that the switching from the audio-ON to audio-OFF doesn't
 work.  Could you try the patch below in additon?
 

Applying all your three patches on 3.5-rc1 makes the discrete GPU work on my
system: after mounting debugfs and switching to DDIS, I can start X and direct
rendering, sound and built-in USB camera work.

By the way, writing DDIS to /sys/kernel/debugfs/vgaswitcheroo switches off the
integrated GPU. That's the reason for loosing the control over the screen
brightness. Switching on also the integrated GPU (writing ON to
/sys/kernel/debugfs/vgaswitcheroo) enables the brightness control of the screen.
Of course for the energy consumption this is awkward.
I write all this as information about the state of vga_switcheroo for David.

Many thanks to you and David for all your work.

 Probably unrelated: in both cases I'm unable to lower the screen brightness 
 from
 highest value. Without your patches it appears a warning:

   ACPI Warning: _BQC returned an invalid level (20120320/video-472)
 
 Hmm, I see no relation between this and the HDMI audio part.
 It's of course possible that some non-working state gives
 side-effects...
 
 
 thanks,
 
 Takashi
 
snip
-- 
Best regards,
Jörg-Volker.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-07 Thread Takashi Iwai
Hi,

this is a series of patches to fix the regressions of HD-audio HDMI
on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.

The first patch adds a new helper function to vga-switcheroo and the
second just uses that instead of an open code.

Dave, if the first patch is OK, I'm going to apply it though sound tree.
Let me know if any problem is found.

Joerg, could you check whether this doesn't break your setup, too?


thanks,

Takashi


[PATCH 0/2] HD-audio HDMI regression fixes with VGA-switcheroo

2012-06-07 Thread Takashi Iwai
Hi,

this is a series of patches to fix the regressions of HD-audio HDMI
on D-GPUs in 3.5-rc1 due to the support of VGA-switcheroo audio clients.

The first patch adds a new helper function to vga-switcheroo and the
second just uses that instead of an open code.

Dave, if the first patch is OK, I'm going to apply it though sound tree.
Let me know if any problem is found.

Joerg, could you check whether this doesn't break your setup, too?


thanks,

Takashi
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel