From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Govindapillai, Vinod" <vinod.govindapillai@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"Saarinen, Jani" <jani.saarinen@intel.com>,
"Reddy Guddati, Santhosh" <santhosh.reddy.guddati@intel.com>,
"Syrjala, Ville" <ville.syrjala@intel.com>
Subject: Re: [PATCH v1 8/8] drm/i915/fbc: handle dirty rect coords for the first frame
Date: Mon, 17 Feb 2025 08:45:34 +0200 [thread overview]
Message-ID: <Z7LbDvQuMXPTncGK@intel.com> (raw)
In-Reply-To: <ec66cadd32ae2be4a944f845b7dc84a11e058487.camel@intel.com>
On Sun, Feb 16, 2025 at 08:16:44PM +0000, Govindapillai, Vinod wrote:
> Hi Ville,
>
> During some testing I noticed that for the very first frame while enabling we wouldnt have executed
> the intel_fbc_prepare_dirty_rect() as fbc_state->plane will be NULL. So we will end-up programming
> wrong values for the first frame. And for the very first frame after the boot it will be completely
> bogus! Added this patch to the list and if you could Ack this, then I can squash this patch to the
> fbc dirty rect patch (patch 6) in the list
>
> Br
> Vinod
>
>
> On Sun, 2025-02-16 at 22:09 +0200, Vinod Govindapillai wrote:
> > During enablig FBC, for the very first frame, the prepare dirty
> > rect routine wouldnt have executed as at that time the plane
> > reference in the fbc_state would be NULL. So this could make
> > driver program some invalid entries as the damage area. Though
> > fbc hw ignores the dirty rect values programmed for the first
> > frame after enabling FBC, driver must ensure that valid dirty
> > rect coords are programmed. So ensure that for the first frame
> > prepare dirty rect is called at the time enabling FBC.
> >
> > Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
> > ---
> > drivers/gpu/drm/i915/display/intel_fbc.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> > index 6222eea4b1ce..21fd57c7f163 100644
> > --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> > +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> > @@ -1230,6 +1230,8 @@ intel_fbc_dirty_rect_update(struct intel_dsb *dsb, struct intel_fbc *fbc)
> >
> > lockdep_assert_held(&fbc->lock);
> >
> > + drm_WARN_ON(display->drm, fbc_dirty_rect->y2 == 0);
> > +
> > intel_de_write_dsb(display, dsb, XE3_FBC_DIRTY_RECT(fbc->id),
> > FBC_DIRTY_RECT_START_LINE(fbc_dirty_rect->y1) |
> > FBC_DIRTY_RECT_END_LINE(fbc_dirty_rect->y2 - 1));
> > @@ -1313,6 +1315,13 @@ static void intel_fbc_update_state(struct intel_atomic_state *state,
> > WARN_ON(plane_state->no_fbc_reason);
> > WARN_ON(fbc_state->plane && fbc_state->plane != plane);
> >
> > + /*
> > + * For the very first frame while enabling FBC, ensure that we have a
> > + * valid dirty rect coords.
> > + */
> > + if (HAS_FBC_DIRTY_RECT(display) && !fbc_state->plane)
> > + __intel_fbc_prepare_dirty_rect(plane_state);
I don't think this will do quite the right thing when
using the DSB for the commit.
I think to make it more correct we'd have to do somethig like this
perhaps:
- invalidate fbc_state->dirty rect in intel_fbc_prepare_dirty_rect()
if we are going to call __intel_fbc_disable() later, which
I think would happen for
'crtc_needs_modeset() || !intel_fbc_is_ok()'
- probably invalidate fbc_state->dirty_rect in
__intel_fbc_disable() as well for good measure (in case we call
it outside the normal commit path, ie. due to underruns).
- program some kind of valid dirty rectangle directly from
__intel_fbc_enable()
- skip the dirty rectangle programming in
intel_fbc_dirty_rect_update_noarm() if the dirty rectangle
is invalid
That way we reprogram the dirty rect from noarm only if FBC
is guaranteed to stay on its current plane, and we should
end up programming it the same way regardless of whether we
use DSB or MMIO for the commit.
> > +
> > fbc_state->plane = plane;
> >
> > /* FBC1 compression interval: arbitrary choice of 1 second */
>
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2025-02-17 6:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-13 13:25 [PATCH v8 0/7] drm/i915/fbc: FBC Dirty rect feature support Vinod Govindapillai
2025-02-13 13:25 ` [PATCH v8 1/7] drm/damage-helper: add const qualifier in drm_atomic_helper_damage_merged() Vinod Govindapillai
2025-02-13 13:25 ` [PATCH v8 2/7] drm/i915/display: update and store the plane damage clips Vinod Govindapillai
2025-02-13 13:25 ` [PATCH v8 3/7] drm/i915/fbc: add register definitions for fbc dirty rect support Vinod Govindapillai
2025-02-13 13:25 ` [PATCH v8 4/7] drm/i915/fbc: introduce HAS_FBC_DIRTY_RECT() for FBC " Vinod Govindapillai
2025-02-13 13:25 ` [PATCH v8 5/7] drm/i915/fbc: avoid calling fbc activate if fbc is active Vinod Govindapillai
2025-02-13 13:25 ` [PATCH v8 6/7] drm/i915/fbc: dirty rect support for FBC Vinod Govindapillai
2025-02-13 13:51 ` Ville Syrjälä
2025-02-13 13:25 ` [PATCH v8 7/7] drm/i915/fbc: disable FBC if PSR2 selective fetch is enabled Vinod Govindapillai
2025-02-13 13:32 ` ✓ CI.Patch_applied: success for drm/i915/fbc: FBC Dirty rect feature support (rev2) Patchwork
2025-02-13 13:33 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-13 13:34 ` ✓ CI.KUnit: success " Patchwork
2025-02-13 13:50 ` ✓ CI.Build: " Patchwork
2025-02-13 13:53 ` ✓ CI.Hooks: " Patchwork
2025-02-13 13:54 ` ✗ CI.checksparse: warning " Patchwork
2025-02-13 14:14 ` ✓ Xe.CI.BAT: success " Patchwork
2025-02-14 5:40 ` ✗ Xe.CI.Full: failure " Patchwork
2025-02-16 20:09 ` [PATCH v1 8/8] drm/i915/fbc: handle dirty rect coords for the first frame Vinod Govindapillai
2025-02-16 20:16 ` Govindapillai, Vinod
2025-02-17 6:45 ` Ville Syrjälä [this message]
2025-02-16 20:15 ` ✓ CI.Patch_applied: success for drm/i915/fbc: FBC Dirty rect feature support (rev2) Patchwork
2025-02-16 20:15 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-16 20:17 ` ✓ CI.KUnit: success " Patchwork
2025-02-16 20:23 ` ✗ CI.Build: failure " 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=Z7LbDvQuMXPTncGK@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.saarinen@intel.com \
--cc=santhosh.reddy.guddati@intel.com \
--cc=ville.syrjala@intel.com \
--cc=vinod.govindapillai@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