From: Imre Deak <imre.deak@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 15/16] drm/i915/cdclk: abstract intel_cdclk_actual() and intel_cdclk_actual_voltage_level()
Date: Thu, 19 Jun 2025 14:23:19 +0300 [thread overview]
Message-ID: <aFPzJ5EyRb5YXqFt@ideak-desk> (raw)
In-Reply-To: <223efae2cddd35d932e439e051362c2f77f9c919@intel.com>
On Thu, Jun 19, 2025 at 01:11:32PM +0300, Jani Nikula wrote:
> On Wed, 18 Jun 2025, Imre Deak <imre.deak@intel.com> wrote:
> > On Thu, Jun 12, 2025 at 03:12:10PM +0300, Jani Nikula wrote:
> >> Add intel_cdclk_actual() and intel_cdclk_actual_voltage_level() helpers
> >> to avoid looking at struct intel_cdclk_state internals outside of
> >> intel_cdclk.c.
> >>
> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >> ---
> >> drivers/gpu/drm/i915/display/intel_cdclk.c | 10 ++++++++++
> >> drivers/gpu/drm/i915/display/intel_cdclk.h | 2 ++
> >> drivers/gpu/drm/i915/display/intel_pmdemand.c | 4 ++--
> >> 3 files changed, 14 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> >> index 994be1d0e20c..2e8abf237bd1 100644
> >> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> >> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> >> @@ -3884,3 +3884,13 @@ void intel_cdclk_read_hw(struct intel_display *display)
> >> cdclk_state->actual = display->cdclk.hw;
> >> cdclk_state->logical = display->cdclk.hw;
> >> }
> >> +
> >> +int intel_cdclk_actual(const struct intel_cdclk_state *cdclk_state)
> >> +{
> >> + return cdclk_state->actual.cdclk;
> >> +}
> >> +
> >> +int intel_cdclk_actual_voltage_level(const struct intel_cdclk_state *cdclk_state)
> >> +{
> >> + return cdclk_state->actual.voltage_level;
> >> +}
> >
> > These could've been grouped better after intel_cdclk_logical().
>
> Yes, changing that.
>
> > I wondered if it'd make sense to use
> > intel_cdclk_{logical,actual}_cdclk() instead of
> > intel_cdclk_{logical,actual}().
>
> Mmh. I dislike the repetition, "cdclk logical cdclk"...
Yes, though there's already intel_cdclk_min_cdclk() anyway.
> > Or *_clock() instead of *_cdclk() in the above and other helpers.
>
> ...so I set out to consistently use "clock", but then it didn't feel
> right for things like "intel_cdclk_min_cdclk" because it's then compared
> against min_cdclk in a number of places.
>
> I don't know, leave it as it is now in the patches?
I only pointed this out since intel_cdclk_actual() is strange wrt.
intel_cdclk_actual_voltage_level() for instace. But sure, this is not a
big deal.
>
> BR,
> Jani.
>
>
>
> >
> >> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.h b/drivers/gpu/drm/i915/display/intel_cdclk.h
> >> index 0d5ee1826168..f38605c6ab72 100644
> >> --- a/drivers/gpu/drm/i915/display/intel_cdclk.h
> >> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.h
> >> @@ -103,5 +103,7 @@ int intel_cdclk_bw_min_cdclk(const struct intel_cdclk_state *cdclk_state);
> >> bool intel_cdclk_pmdemand_needs_update(struct intel_atomic_state *state);
> >> void intel_cdclk_force_min_cdclk(struct intel_cdclk_state *cdclk_state, int force_min_cdclk);
> >> void intel_cdclk_read_hw(struct intel_display *display);
> >> +int intel_cdclk_actual(const struct intel_cdclk_state *cdclk_state);
> >> +int intel_cdclk_actual_voltage_level(const struct intel_cdclk_state *cdclk_state);
> >>
> >> #endif /* __INTEL_CDCLK_H__ */
> >> diff --git a/drivers/gpu/drm/i915/display/intel_pmdemand.c b/drivers/gpu/drm/i915/display/intel_pmdemand.c
> >> index 16ef68ef4041..d806c15db7ce 100644
> >> --- a/drivers/gpu/drm/i915/display/intel_pmdemand.c
> >> +++ b/drivers/gpu/drm/i915/display/intel_pmdemand.c
> >> @@ -360,9 +360,9 @@ int intel_pmdemand_atomic_check(struct intel_atomic_state *state)
> >> return PTR_ERR(new_cdclk_state);
> >>
> >> new_pmdemand_state->params.voltage_index =
> >> - new_cdclk_state->actual.voltage_level;
> >> + intel_cdclk_actual_voltage_level(new_cdclk_state);
> >> new_pmdemand_state->params.cdclk_freq_mhz =
> >> - DIV_ROUND_UP(new_cdclk_state->actual.cdclk, 1000);
> >> + DIV_ROUND_UP(intel_cdclk_actual(new_cdclk_state), 1000);
> >>
> >> intel_pmdemand_update_max_ddiclk(display, state, new_pmdemand_state);
> >>
> >> --
> >> 2.39.5
> >>
>
> --
> Jani Nikula, Intel
next prev parent reply other threads:[~2025-06-19 11:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 12:11 [PATCH 00/16] drm/i915/display: make all global state opaque Jani Nikula
2025-06-12 12:11 ` [PATCH 01/16] drm/i915/wm: abstract intel_dbuf_pmdemand_needs_update() Jani Nikula
2025-06-12 12:11 ` [PATCH 02/16] drm/i915/wm: add more accessors to dbuf state Jani Nikula
2025-06-12 12:11 ` [PATCH 03/16] drm/i915/wm: make struct intel_dbuf_state opaque type Jani Nikula
2025-06-12 12:11 ` [PATCH 04/16] drm/i915/bw: abstract intel_bw_pmdemand_needs_update() Jani Nikula
2025-06-12 12:12 ` [PATCH 05/16] drm/i915/bw: relocate intel_can_enable_sagv() and rename to intel_bw_can_enable_sagv() Jani Nikula
2025-06-12 12:12 ` [PATCH 06/16] drm/i915: move icl_sagv_{pre, post}_plane_update() to intel_bw.c Jani Nikula
2025-06-12 12:12 ` [PATCH 07/16] drm/i915/bw: abstract intel_bw_qgv_point_peakbw() Jani Nikula
2025-06-12 12:12 ` [PATCH 08/16] drm/i915/bw: make struct intel_bw_state opaque Jani Nikula
2025-06-12 12:12 ` [PATCH 09/16] drm/i915/cdclk: abstract intel_cdclk_logical() Jani Nikula
2025-06-12 12:12 ` [PATCH 10/16] drm/i915/cdclk: abstract intel_cdclk_min_cdclk() Jani Nikula
2025-06-12 12:12 ` [PATCH 11/16] drm/i915/cdclk: abstract intel_cdclk_bw_min_cdclk() Jani Nikula
2025-06-12 12:12 ` [PATCH 12/16] drm/i915/cdclk: abstract intel_cdclk_pmdemand_needs_update() Jani Nikula
2025-06-12 12:12 ` [PATCH 13/16] drm/i915/cdclk: abstract intel_cdclk_force_min_cdclk() Jani Nikula
2025-06-12 12:12 ` [PATCH 14/16] drm/i915/cdclk: abstract intel_cdclk_read_hw() Jani Nikula
2025-06-12 12:12 ` [PATCH 15/16] drm/i915/cdclk: abstract intel_cdclk_actual() and intel_cdclk_actual_voltage_level() Jani Nikula
2025-06-18 18:17 ` Imre Deak
2025-06-19 10:11 ` Jani Nikula
2025-06-19 11:23 ` Imre Deak [this message]
2025-06-12 12:12 ` [PATCH 16/16] drm/i915/cdclk: make struct intel_cdclk_state opaque Jani Nikula
2025-06-12 15:35 ` ✗ i915.CI.BAT: failure for drm/i915/display: make all global state opaque Patchwork
2025-06-18 18:08 ` [PATCH 00/16] " Imre Deak
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=aFPzJ5EyRb5YXqFt@ideak-desk \
--to=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.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