public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org,
	Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH] lib/igt_aux: move audio RPM code to igt_setup_runtime_pm()
Date: Tue, 21 Oct 2014 19:41:49 +0200	[thread overview]
Message-ID: <20141021174149.GG26941@phenom.ffwll.local> (raw)
In-Reply-To: <1413910909-2080-1-git-send-email-przanoni@gmail.com>

On Tue, Oct 21, 2014 at 03:01:49PM -0200, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> If we don't enable audio runtime PM, the audio driver won't release
> its reference, the refcount won't ever become zero, so we will never
> actually runtime suspend. So move this code from pm_rpm.c to
> igt_aux.c, so kms_flip - and any other IGT test case using RPM - can
> benefit from it.
> 
> Previously, if you ran pm_rpm before running the other tests - or if
> you just didn't have snd_hda_intel loaded - you wouldn't notice this
> bug.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78893
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Yeah, somehow missed that in my extraction - with all the trouble I've
stopped building with audio enabled.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Cheers, Daniel

> ---
>  lib/igt_aux.c  | 14 ++++++++++++++
>  tests/pm_rpm.c | 12 ------------
>  2 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index 01654f0..0e1eeea 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -431,6 +431,20 @@ bool igt_setup_runtime_pm(void)
>  	if (pm_status_fd >= 0)
>  		return true;
>  
> +	/* The Audio driver can get runtime PM references, so we need to make
> +	 * sure its runtime PM is enabled, so it can release the refs and
> +	 * actually enable us to runtime suspend. */
> +	fd = open("/sys/module/snd_hda_intel/parameters/power_save", O_WRONLY);
> +	if (fd >= 0) {
> +		igt_assert(write(fd, "1\n", 2) == 2);
> +		close(fd);
> +	}
> +	fd = open("/sys/bus/pci/devices/0000:00:03.0/power/control", O_WRONLY);
> +	if (fd >= 0) {
> +		igt_assert(write(fd, "auto\n", 5) == 5);
> +		close(fd);
> +	}
> +
>  	/* Our implementation uses autosuspend. Try to set it to 0ms so the test
>  	 * suite goes faster and we have a higher probability of triggering race
>  	 * conditions. */
> diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
> index 4ee3ca7..25c9900 100644
> --- a/tests/pm_rpm.c
> +++ b/tests/pm_rpm.c
> @@ -697,18 +697,6 @@ static void setup_non_graphics_runtime_pm(void)
>  		close(fd);
>  	}
>  	free(file_name);
> -
> -	/* Audio runtime PM policies. */
> -	fd = open("/sys/module/snd_hda_intel/parameters/power_save", O_WRONLY);
> -	if (fd >= 0) {
> -		igt_assert(write(fd, "1\n", 2) == 2);
> -		close(fd);
> -	}
> -	fd = open("/sys/bus/pci/devices/0000:00:03.0/power/control", O_WRONLY);
> -	if (fd >= 0) {
> -		igt_assert(write(fd, "auto\n", 5) == 5);
> -		close(fd);
> -	}
>  }
>  
>  static void setup_environment(void)
> -- 
> 1.9.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

      reply	other threads:[~2014-10-21 17:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21 17:01 [PATCH] lib/igt_aux: move audio RPM code to igt_setup_runtime_pm() Paulo Zanoni
2014-10-21 17:41 ` Daniel Vetter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141021174149.GG26941@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=przanoni@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox