amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PART1 PATCH 2/8] drm/amdgpu: add parse clock gating state
Date: Thu, 5 Jan 2017 11:33:38 -0500	[thread overview]
Message-ID: <b407dd74-16e2-8df3-0adb-2afa17bf8f13@amd.com> (raw)
In-Reply-To: <1483624193-20897-3-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>

This could be done with much less code duplication:

	static const struct {
		u32 flag;
		const char *name;
	} clocks[] = {
		{AMD_CG_SUPPORT_GFX_MGCG, "Medium Grain Clock Gating"},
		{AMD_CG_SUPPORT_GFX_MGLS, "Medium Grain memory Light Sleep"},
		...
		{0, NULL}
	};

	for (i = 0; clocks[i].flag; i++)
		seq_printf(m, "\t%s: %s\n",
			clocks[i].name,
			(flags & clocks[i].flag) ? "On" : "Off");

Regards,
  Felix

On 17-01-05 08:49 AM, Huang Rui wrote:
> Signed-off-by: Huang Rui <ray.huang@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 95 ++++++++++++++++++++++++++++++++++
>  1 file changed, 95 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> index 7aa561d..431bae4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> @@ -1536,6 +1536,99 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a
>  	return 0;
>  }
>  
> +static void amdgpu_parse_cg_state(struct seq_file *m, u32 flags)
> +{
> +       if (flags & AMD_CG_SUPPORT_GFX_MGCG)
> +               seq_printf(m, "\tMedium Grain Clock Gating: On\n");
> +       else
> +               seq_printf(m, "\tMedium Grain Clock Gating: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_GFX_MGLS)
> +               seq_printf(m, "\tMedium Grain memory Light Sleep: On\n");
> +       else
> +               seq_printf(m, "\tMedium Grain memory Light Sleep: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_GFX_CGCG)
> +               seq_printf(m, "\tCoarse Grain Clock Gating: On\n");
> +       else
> +               seq_printf(m, "\tCoarse Grain Clock Gating: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_GFX_CGLS)
> +               seq_printf(m, "\tCoarse Grain memory Light Sleep: On\n");
> +       else
> +               seq_printf(m, "\tCoarse Grain memory Light Sleep: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_GFX_CGTS)
> +               seq_printf(m, "\tCoarse Grain Tree Shader: On\n");
> +       else
> +               seq_printf(m, "\tCoarse Grain Tree Shader: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_GFX_CGTS_LS)
> +               seq_printf(m, "\tCoarse Grain Tree Shader Light Sleep: On\n");
> +       else
> +               seq_printf(m, "\tCoarse Grain Tree Shader Light Sleep: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_GFX_CP_LS)
> +               seq_printf(m, "\tCommand Processor Light Sleep: On\n");
> +       else
> +               seq_printf(m, "\tCommand Processor Light Sleep: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_GFX_RLC_LS)
> +               seq_printf(m, "\tRun List Controller Light Sleep: On\n");
> +       else
> +               seq_printf(m, "\tRun List Controller Light Sleep: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_MC_LS)
> +               seq_printf(m, "\tMemory Controller Light Sleep: On\n");
> +       else
> +               seq_printf(m, "\tMemory Controller Light Sleep: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_MC_MGCG)
> +               seq_printf(m, "\tMemory Controller Medium Grain Clock Gating: On\n");
> +       else
> +               seq_printf(m, "\tMemory Controller Medium Grain Clock Gating: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_SDMA_LS)
> +               seq_printf(m, "\tSystem Direct Memory Access Light Sleep: On\n");
> +       else
> +               seq_printf(m, "\tSystem Direct Memory Access Light Sleep: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_SDMA_MGCG)
> +               seq_printf(m, "\tSystem Direct Memory Access Medium Grain Clock Gating: On\n");
> +       else
> +               seq_printf(m, "\tSystem Direct Memory Access Medium Grain Clock Gating: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_BIF_LS)
> +               seq_printf(m, "\tBus Interface Light Sleep: On\n");
> +       else
> +               seq_printf(m, "\tBus Interface Light Sleep: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_UVD_MGCG)
> +               seq_printf(m, "\tUniversal Video Decoder Medium Grain Clock Gating: On\n");
> +       else
> +               seq_printf(m, "\tUniversal Video Decoder Medium Grain Clock Gating: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_VCE_MGCG)
> +               seq_printf(m, "\tVideo Coding Engine Medium Grain Clock Gating: On\n");
> +       else
> +               seq_printf(m, "\tVideo Coding Engine Medium Grain Clock Gating: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_HDP_LS)
> +               seq_printf(m, "\tHost Data Path Light Sleep: On\n");
> +       else
> +               seq_printf(m, "\tHost Data Path Light Sleep: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_HDP_MGCG)
> +               seq_printf(m, "\tHost Data Path Medium Grain Clock Gating: On\n");
> +       else
> +               seq_printf(m, "\tHost Data Path Medium Grain Clock Gating: Off\n");
> +
> +       if (flags & AMD_CG_SUPPORT_ROM_MGCG)
> +               seq_printf(m, "\tRom Medium Grain Clock Gating: On\n");
> +       else
> +               seq_printf(m, "\tRom Medium Grain Clock Gating: Off\n");
> +}
> +
>  static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data)
>  {
>  	struct drm_info_node *node = (struct drm_info_node *) m->private;
> @@ -1546,6 +1639,8 @@ static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data)
>  
>  	amdgpu_clockgating_state(adev, &flags);
>  	seq_printf(m, "Clock Gating Flags Mask: 0x%x\n", flags);
> +	amdgpu_parse_cg_state(m, flags);
> +	seq_printf(m, "\n");
>  
>  	if (!adev->pm.dpm_enabled) {
>  		seq_printf(m, "dpm not enabled\n");

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-01-05 16:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-05 13:49 [PART1 PATCH 0/8] Introduce a method to get clock gating status dynamically Huang Rui
     [not found] ` <1483624193-20897-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2017-01-05 13:49   ` [PART1 PATCH 1/8] drm/amdgpu: introduce an interface " Huang Rui
2017-01-05 13:49   ` [PART1 PATCH 2/8] drm/amdgpu: add parse clock gating state Huang Rui
     [not found]     ` <1483624193-20897-3-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2017-01-05 16:33       ` Felix Kuehling [this message]
     [not found]         ` <b407dd74-16e2-8df3-0adb-2afa17bf8f13-5C7GfCeVMHo@public.gmane.org>
2017-01-06  6:19           ` Huang Rui
2017-01-05 16:34       ` William Lewis
     [not found]         ` <BN6PR17MB0913FDE2AC51D02FD9730FD1C8600-jOV4XOBZ6Mu/5fi7T5v52H+GY4YGzQ7gvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-06  6:21           ` Huang Rui
2017-01-05 13:49   ` [PART1 PATCH 3/8] drm/amdgpu: add clockgating_state method for gfx v8 Huang Rui
2017-01-05 13:49   ` [PART1 PATCH 4/8] drm/amdgpu: add clockgating_state method for gmc v8 Huang Rui
2017-01-05 13:49   ` [PART1 PATCH 5/8] drm/amdgpu: add clockgating_state method for sdma v3 Huang Rui
2017-01-05 13:49   ` [PART1 PATCH 6/8] drm/amdgpu: add clockgating_state method for vi common Huang Rui
2017-01-05 13:49   ` [PART1 PATCH 7/8] drm/amdgpu: add clockgating_state method for uvd v5&v6 Huang Rui
2017-01-05 13:49   ` [PART1 PATCH 8/8] drm/amdgpu: add clockgating_state method for vce v3 Huang Rui
2017-01-05 15:40   ` [PART1 PATCH 0/8] Introduce a method to get clock gating status dynamically Deucher, Alexander
     [not found]     ` <BN6PR12MB1652B0E3AD8F9252CE089FA0F7600-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-05 15:51       ` StDenis, Tom
2017-01-06  6:12       ` Huang Rui

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=b407dd74-16e2-8df3-0adb-2afa17bf8f13@amd.com \
    --to=felix.kuehling-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).