intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Dibin Moolakadan Subrahmanian
	<dibin.moolakadan.subrahmanian@intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	ankit.k.nautiyal@intel.com, uma.shankar@intel.com,
	arun.r.murthy@intel.com, Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH] drm/i915/display: Optimize panel power-on wait time
Date: Fri, 04 Jul 2025 15:47:30 +0300	[thread overview]
Message-ID: <652c78d343137c9cd67eea2bb7059854c24a62cf@intel.com> (raw)
In-Reply-To: <91eb3ff6-1b47-4ca3-acb3-566a97eb6d35@intel.com>

On Thu, 03 Jul 2025, Dibin Moolakadan Subrahmanian <dibin.moolakadan.subrahmanian@intel.com> wrote:
> On 02-07-2025 14:31, Jani Nikula wrote:
>> On Tue, 01 Jul 2025, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
>>> On Tue, Jul 01, 2025 at 12:28:41PM +0300, Jani Nikula wrote:
>>>> On Mon, 30 Jun 2025, Dibin Moolakadan Subrahmanian <dibin.moolakadan.subrahmanian@intel.com> wrote:
>>>>>   The current wait_panel_on() uses intel_de_wait() with a long timeout
>>>>>   (5000ms), which is suboptimal on Xe platforms where the underlying
>>>>>   xe_mmio_wait32() employs an exponential backoff strategy. This leads
>>>>>   to unnecessary delays during resume or power-on  when the panel becomes
>>>>>   ready earlier than the full timeout.
>>>>>
>>>>>   This patch splits the total wait time into two pases
>>>>>      - First wait for the typical panel-on time(180ms)
>>>>>      - If panel is not ready , continue polling in short 20ms intervals
>>>>>        until the maximum timeout (5000ms) is reached
>>>> I'm *very* reluctant to merge any new custom wait hacks. I'm in the
>>>> process of *removing* a plethora of them [1][2][3].
>>> good riddance
>> Yay!
>>
>>>> I think the question is, should xe_mmio_wait32() (and the i915
>>>> counterpart) and the intel_de_wait*() functions be migrated to an
>>>> interface similar to read_poll_timeout(), i.e. provide sleep and timeout
>>>> separately, no exponential backoff. And implement the waits using
>>>> read_poll_timeout(), or whatever Ville ends up with [4].
>>> I saw your patch series and I'm eagerly waiting it to either propagate
>>> it in xe or have someone merge such a patch.  I'm not sure about
>>> removing the exponential backoff is a good thing overall, but if it's
>>> needed then it needs to be justified to add a new function to pair with
>>> read_poll_timeout(), not a custom driver function.
>> While I'm negative about the patch at hand, the underlying problem is
>> very real.
>>
>> I think at the very least the exponential sleep backoff needs an upper
>> bound that's relative to the timeout. Maybe 10-25% of timeout?
>>
>> With the example case of 5 second timeout, the exponential backoff
>> starting from 10 us leads to a dozen polls before reaching 100 ms
>> elapsed time, but then polls at approximately 1 s, 2 s, 4 s, and 8 s
>> elapsed time. Longer timeouts are of course rare, but they exhibit
>> increasingly worse behaviour.
>>
>> So if what we're waiting takes 2.1 seconds, the next check will be about
>> 2 seconds later. Similarly, if it takes 4.1 seconds, the next check will
>> be about 4 seconds later, in this case exceeding the timeout by 3
>> seconds.
>>
>> Anyway, if xe_mmio_wait32() remains as it is, with read_poll_timeout()
>> it's trivial to do the wait in the intel_de_*() macros, in display side,
>> with sleeps and timeouts defined in display. Because for most things the
>> really quick fast polls are useless in display.
>>
> This exponential sleep back-off is causing around 120ms additional  
> delay in resume compared to  i915.
>
> how about polling as below , use intel_de_read and read_poll_timeout
>
>      ret = read_poll_timeout(intel_de_read, reg_val,
>                      ((reg_val & mask) == value),
>                      (20 * 1000),                        // poll every 20ms
>                      (PANEL_MAXIMUM_ON_TIME_MS * 1000),  // total 
> timeout (us)
>                      true,
>                      display, pp_stat_reg);

This would be a temporary measure pending Ville's work [1], but I'm not
against it.

Also, needs to happen in wait_panel_status() instead of adding a
separate wait_panel_on_status() function.

BR,
Jani.


[1] https://lore.kernel.org/r/20250702223439.19752-1-ville.syrjala@linux.intel.com

>
> Regards,
>
> Dibin
>
>> BR,
>> Jani.
>
>>
>>

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-07-04 12:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 12:23 [PATCH] drm/i915/display: Optimize panel power-on wait time Dibin Moolakadan Subrahmanian
2025-06-30 17:46 ` ✓ i915.CI.BAT: success for " Patchwork
2025-07-01  9:28 ` [PATCH] " Jani Nikula
2025-07-01 14:25   ` Lucas De Marchi
2025-07-02  9:01     ` Jani Nikula
2025-07-03  8:28       ` Dibin Moolakadan Subrahmanian
2025-07-04 12:47         ` Jani Nikula [this message]
2025-07-07 13:23           ` Dibin Moolakadan Subrahmanian
2025-07-01 10:31 ` ✓ i915.CI.Full: success for " 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=652c78d343137c9cd67eea2bb7059854c24a62cf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=dibin.moolakadan.subrahmanian@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=uma.shankar@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;
as well as URLs for NNTP newsgroup(s).