From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andi Shyti <andi.shyti@linux.intel.com>,
Swati Sharma <swati2.sharma@intel.com>
Cc: Mohammed Khajapasha <mohammed.khajapasha@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/display: Add a debugfs entry for fifo underruns
Date: Tue, 14 Feb 2023 14:25:22 +0200 [thread overview]
Message-ID: <87fsb8sabx.fsf@intel.com> (raw)
In-Reply-To: <Y+OHjpIX43yFVKYS@ashyti-mobl2.lan>
On Wed, 08 Feb 2023, Andi Shyti <andi.shyti@linux.intel.com> wrote:
> Hi Swati,
>
> [...]
>
>> +static void intel_fifo_underrun_inc_count(struct intel_crtc *crtc,
>> + bool is_cpu_fifo)
>
> I'm not a big fan of the true/false parameters in functions. I
> actually hate them because it's never clear from the caller what
> the true/false means.
>
> Isn't it clear to just have some wrappers
>
> #define intel_fifo_underrun_inc_cpu_count(...)
> #define intel_fifo_underrun_inc_cph_count(...)
>
> or similar?
>
>> +{
>> +#ifdef CONFIG_DEBUG_FS
>> + if (is_cpu_fifo)
>> + crtc->cpu_fifo_underrun_count++;
>> + else
>> + crtc->pch_fifo_underrun_count++;
>> +#endif
>> +}
>> +
>> static void i9xx_check_fifo_underruns(struct intel_crtc *crtc)
>> {
>> struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>> @@ -103,6 +114,7 @@ static void i9xx_check_fifo_underruns(struct intel_crtc *crtc)
>> intel_de_write(dev_priv, reg, enable_mask | PIPE_FIFO_UNDERRUN_STATUS);
>> intel_de_posting_read(dev_priv, reg);
>>
>> + intel_fifo_underrun_inc_count(crtc, true);
>> trace_intel_cpu_fifo_underrun(dev_priv, crtc->pipe);
>> drm_err(&dev_priv->drm, "pipe %c underrun\n", pipe_name(crtc->pipe));
>> }
>> @@ -156,6 +168,7 @@ static void ivb_check_fifo_underruns(struct intel_crtc *crtc)
>> intel_de_write(dev_priv, GEN7_ERR_INT, ERR_INT_FIFO_UNDERRUN(pipe));
>> intel_de_posting_read(dev_priv, GEN7_ERR_INT);
>>
>> + intel_fifo_underrun_inc_count(crtc, true);
>> trace_intel_cpu_fifo_underrun(dev_priv, pipe);
>> drm_err(&dev_priv->drm, "fifo underrun on pipe %c\n", pipe_name(pipe));
>> }
>> @@ -244,6 +257,7 @@ static void cpt_check_pch_fifo_underruns(struct intel_crtc *crtc)
>> SERR_INT_TRANS_FIFO_UNDERRUN(pch_transcoder));
>> intel_de_posting_read(dev_priv, SERR_INT);
>>
>> + intel_fifo_underrun_inc_count(crtc, false);
>> trace_intel_pch_fifo_underrun(dev_priv, pch_transcoder);
>> drm_err(&dev_priv->drm, "pch fifo underrun on pch transcoder %c\n",
>> pipe_name(pch_transcoder));
>> @@ -286,6 +300,11 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,
>>
>> old = !crtc->cpu_fifo_underrun_disabled;
>> crtc->cpu_fifo_underrun_disabled = !enable;
>> +#ifdef CONFIG_DEBUG_FS
>> + /* don't reset count in fifo underrun irq path */
>> + if (!in_irq() && !enable)
>> + crtc->cpu_fifo_underrun_count = 0;
>> +#endif
>>
>> if (HAS_GMCH(dev_priv))
>> i9xx_set_fifo_underrun_reporting(dev, pipe, enable, old);
>> @@ -365,6 +384,11 @@ bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
>>
>> old = !crtc->pch_fifo_underrun_disabled;
>> crtc->pch_fifo_underrun_disabled = !enable;
>> +#ifdef CONFIG_DEBUG_FS
>> + /* don't reset count in fifo underrun irq path */
>> + if (!in_irq() && !enable)
>> + crtc->pch_fifo_underrun_count = 0;
>> +#endif
>
> All these ifdefs are a bit ugly. Can we put all these stuff
> inside the debugfs.c file that is compiled only if DEBUG_FS is
> configured?
The opposite, the debugfs should be added in this file instead. :)
See my reply.
BR,
Jani.
>
> Andi
>
>>
>> if (HAS_PCH_IBX(dev_priv))
>> ibx_set_fifo_underrun_reporting(&dev_priv->drm,
>> @@ -434,6 +458,7 @@ void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
>> drm_err(&dev_priv->drm, "CPU pipe %c FIFO underrun\n", pipe_name(pipe));
>> }
>>
>> + intel_fifo_underrun_inc_count(crtc, true);
>> intel_fbc_handle_fifo_underrun_irq(dev_priv);
>> }
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2023-02-14 12:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 10:59 [Intel-gfx] [PATCH] drm/i915/display: Add a debugfs entry for fifo underruns Swati Sharma
2023-02-08 11:29 ` Andi Shyti
2023-02-14 12:25 ` Jani Nikula [this message]
2023-03-14 15:46 ` Swati Sharma
2023-02-08 18:45 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2023-02-14 12:24 ` [Intel-gfx] [PATCH] " Jani Nikula
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=87fsb8sabx.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=andi.shyti@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mohammed.khajapasha@intel.com \
--cc=swati2.sharma@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.