From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ankit Nautiyal <ankit.k.nautiyal@intel.com>,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: jouni.hogander@intel.com, Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Subject: Re: [PATCH 1/2] drm/i915/psr: Simplify the conditions for SCL computation
Date: Fri, 15 May 2026 13:30:47 +0300 [thread overview]
Message-ID: <5c97667e52e740df76951ffa4f2044372214fc18@intel.com> (raw)
In-Reply-To: <20260515073616.2794146-2-ankit.k.nautiyal@intel.com>
On Fri, 15 May 2026, Ankit Nautiyal <ankit.k.nautiyal@intel.com> wrote:
> The SCL condition checks can be combined into one expression.
> needs_sel_update is common for both display version branches, so check it
> once and keep the version specific checks together.
>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_psr.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
> index 8f70b7dcd881..5bf1d782188c 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1477,15 +1477,12 @@ int _intel_psr_min_set_context_latency(const struct intel_crtc_state *crtc_state
> * SRD_STATUS is used by PSR1 and Panel Replay DP on LunarLake.
> */
>
> - if (DISPLAY_VER(display) >= 30 && (needs_panel_replay ||
> - needs_sel_update))
> + if (needs_sel_update ||
> + (DISPLAY_VER(display) >= 30 && needs_panel_replay) ||
> + (DISPLAY_VER(display) < 30 && intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP)))
> return 0;
> - else if (DISPLAY_VER(display) < 30 && (needs_sel_update ||
> - intel_crtc_has_type(crtc_state,
> - INTEL_OUTPUT_EDP)))
> - return 0;
> - else
> - return 1;
The function has a bunch of simple "if foo return bar" statements.
Please don't combine more stuff together, but rather split them up.
if (needs_sel_update)
return 0;
if (DISPLAY_VER(display) < 30 && intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP))
return 0;
if (DISPLAY_VER(display) >= 30 && needs_panel_reply)
return 0;
Please consider which one is easier and faster to read and understand.
BR,
Jani.
> +
> + return 1;
> }
>
> static bool _wake_lines_fit_into_vblank(const struct intel_crtc_state *crtc_state,
--
Jani Nikula, Intel
next prev parent reply other threads:[~2026-05-15 10:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 7:36 [PATCH 0/2] drm/i915/psr: Refactor and extend SCL handling for VRRTG Ankit Nautiyal
2026-05-15 7:36 ` [PATCH 1/2] drm/i915/psr: Simplify the conditions for SCL computation Ankit Nautiyal
2026-05-15 10:30 ` Jani Nikula [this message]
2026-05-15 7:36 ` [PATCH 2/2] drm/i915/psr: Allow SCL=0 on platforms with always-on VRR TG Ankit Nautiyal
2026-05-15 7:56 ` ✗ CI.checkpatch: warning for drm/i915/psr: Refactor and extend SCL handling for VRRTG Patchwork
2026-05-15 7:57 ` ✓ CI.KUnit: success " Patchwork
2026-05-15 8:35 ` ✓ Xe.CI.BAT: " Patchwork
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=5c97667e52e740df76951ffa4f2044372214fc18@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jouni.hogander@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